| 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 1 << 11; // r11 v8 (fp in JavaScript code) | 72 1 << 11; // r11 v8 (fp in JavaScript code) |
| 73 | 73 |
| 74 static const int kNumCalleeSaved = 7 + kR9Available; | 74 static const int kNumCalleeSaved = 7 + kR9Available; |
| 75 | 75 |
| 76 | 76 |
| 77 // ---------------------------------------------------- | 77 // ---------------------------------------------------- |
| 78 | 78 |
| 79 | 79 |
| 80 class StackHandlerConstants : public AllStatic { | 80 class StackHandlerConstants : public AllStatic { |
| 81 public: | 81 public: |
| 82 // TODO(1233780): Get rid of the code slot in stack handlers. | 82 static const int kNextOffset = 0 * kPointerSize; |
| 83 static const int kCodeOffset = 0 * kPointerSize; | 83 static const int kStateOffset = 1 * kPointerSize; |
| 84 static const int kNextOffset = 1 * kPointerSize; | 84 static const int kFPOffset = 2 * kPointerSize; |
| 85 static const int kStateOffset = 2 * kPointerSize; | 85 static const int kPCOffset = 3 * kPointerSize; |
| 86 static const int kPPOffset = 3 * kPointerSize; | |
| 87 static const int kFPOffset = 4 * kPointerSize; | |
| 88 static const int kPCOffset = 5 * kPointerSize; | |
| 89 | 86 |
| 90 static const int kAddressDisplacement = -1 * kPointerSize; | |
| 91 static const int kSize = kPCOffset + kPointerSize; | 87 static const int kSize = kPCOffset + kPointerSize; |
| 92 }; | 88 }; |
| 93 | 89 |
| 94 | 90 |
| 95 class EntryFrameConstants : public AllStatic { | 91 class EntryFrameConstants : public AllStatic { |
| 96 public: | 92 public: |
| 97 static const int kCallerFPOffset = -3 * kPointerSize; | 93 static const int kCallerFPOffset = -3 * kPointerSize; |
| 98 }; | 94 }; |
| 99 | 95 |
| 100 | 96 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 static const int kCodeOffset = StandardFrameConstants::kExpressionsOffset; | 150 static const int kCodeOffset = StandardFrameConstants::kExpressionsOffset; |
| 155 }; | 151 }; |
| 156 | 152 |
| 157 | 153 |
| 158 inline Object* JavaScriptFrame::function_slot_object() const { | 154 inline Object* JavaScriptFrame::function_slot_object() const { |
| 159 const int offset = JavaScriptFrameConstants::kFunctionOffset; | 155 const int offset = JavaScriptFrameConstants::kFunctionOffset; |
| 160 return Memory::Object_at(fp() + offset); | 156 return Memory::Object_at(fp() + offset); |
| 161 } | 157 } |
| 162 | 158 |
| 163 | 159 |
| 164 // ---------------------------------------------------- | |
| 165 | |
| 166 | |
| 167 | |
| 168 | |
| 169 // lower | Stack | | |
| 170 // addresses | ^ | | |
| 171 // | | | | |
| 172 // | | | |
| 173 // | JS frame | | |
| 174 // | | | |
| 175 // | | | |
| 176 // ----------- +=============+ <--- sp (stack pointer) | |
| 177 // | function | | |
| 178 // +-------------+ | |
| 179 // +-------------+ | |
| 180 // | | | |
| 181 // | expressions | | |
| 182 // | | | |
| 183 // +-------------+ | |
| 184 // | | | |
| 185 // a | locals | | |
| 186 // c | | | |
| 187 // t +- - - - - - -+ <--- | |
| 188 // i -4 | local0 | ^ | |
| 189 // v +-------------+ | | |
| 190 // a -3 | code | | | |
| 191 // t +-------------+ | kLocal0Offset | |
| 192 // i -2 | context | | | |
| 193 // o +-------------+ | | |
| 194 // n -1 | args_length | v | |
| 195 // +-------------+ <--- fp (frame pointer) | |
| 196 // 0 | caller_pp | | |
| 197 // f +-------------+ | |
| 198 // r 1 | caller_fp | | |
| 199 // a +-------------+ | |
| 200 // m 2 | sp_on_exit | (pp if return, caller_sp if no return) | |
| 201 // e +-------------+ | |
| 202 // 3 | caller_pc | | |
| 203 // +-------------+ <--- caller_sp (incl. parameters) | |
| 204 // | | | |
| 205 // | parameters | | |
| 206 // | | | |
| 207 // +- - - - - - -+ <--- | |
| 208 // -2 | parameter0 | ^ | |
| 209 // +-------------+ | kParam0Offset | |
| 210 // -1 | receiver | v | |
| 211 // ----------- +=============+ <--- pp (parameter pointer, r10) | |
| 212 // 0 | function | | |
| 213 // +-------------+ | |
| 214 // | | | |
| 215 // |caller-saved | (must be valid JS values, traversed during GC) | |
| 216 // | regs | | |
| 217 // | | | |
| 218 // +-------------+ | |
| 219 // | | | |
| 220 // | caller | | |
| 221 // higher | expressions | | |
| 222 // addresses | | | |
| 223 // | | | |
| 224 // | JS frame | | |
| 225 | |
| 226 | |
| 227 | |
| 228 // Handler frames (part of expressions of JS frames): | |
| 229 | |
| 230 // lower | Stack | | |
| 231 // addresses | ^ | | |
| 232 // | | | | |
| 233 // | | | |
| 234 // h | expressions | | |
| 235 // a | | | |
| 236 // n +-------------+ | |
| 237 // d -1 | code | | |
| 238 // l +-------------+ <--- handler sp | |
| 239 // e 0 | next_sp | link to next handler (next handler's sp) | |
| 240 // r +-------------+ | |
| 241 // 1 | state | | |
| 242 // f +-------------+ | |
| 243 // r 2 | pp | | |
| 244 // a +-------------+ | |
| 245 // m 3 | fp | | |
| 246 // e +-------------+ | |
| 247 // 4 | pc | | |
| 248 // +-------------+ | |
| 249 // | | | |
| 250 // higher | expressions | | |
| 251 // addresses | | | |
| 252 | |
| 253 | |
| 254 | |
| 255 // JS entry frames: When calling from C to JS, we construct two extra | |
| 256 // frames: An entry frame (C) and a trampoline frame (JS). The | |
| 257 // following pictures shows the two frames: | |
| 258 | |
| 259 // lower | Stack | | |
| 260 // addresses | ^ | | |
| 261 // | | | | |
| 262 // | | | |
| 263 // | JS frame | | |
| 264 // | | | |
| 265 // | | | |
| 266 // ----------- +=============+ <--- sp (stack pointer) | |
| 267 // | | | |
| 268 // | parameters | | |
| 269 // t | | | |
| 270 // r +- - - - - - -+ | |
| 271 // a | parameter0 | | |
| 272 // m +-------------+ | |
| 273 // p | receiver | | |
| 274 // o +-------------+ | |
| 275 // l | function | | |
| 276 // i +-------------+ | |
| 277 // n -3 | code | | |
| 278 // e +-------------+ | |
| 279 // -2 | NULL | context is always NULL | |
| 280 // +-------------+ | |
| 281 // f -1 | 0 | args_length is always zero | |
| 282 // r +-------------+ <--- fp (frame pointer) | |
| 283 // a 0 | NULL | caller pp is always NULL for entries | |
| 284 // m +-------------+ | |
| 285 // e 1 | caller_fp | | |
| 286 // +-------------+ | |
| 287 // 2 | sp_on_exit | (caller_sp) | |
| 288 // +-------------+ | |
| 289 // 3 | caller_pc | | |
| 290 // ----------- +=============+ <--- caller_sp == pp | |
| 291 // . ^ | |
| 292 // . | try-handler, fake, not GC'ed | |
| 293 // . v | |
| 294 // +-------------+ <--- | |
| 295 // -2 | next top pp | | |
| 296 // +-------------+ | |
| 297 // -1 | next top fp | | |
| 298 // +-------------+ <--- fp | |
| 299 // | r4 | r4-r9 holding non-JS values must be preserved | |
| 300 // +-------------+ | |
| 301 // J | r5 | before being initialized not to confuse GC | |
| 302 // S +-------------+ | |
| 303 // | r6 | | |
| 304 // +-------------+ | |
| 305 // e | r7 | | |
| 306 // n +-------------+ | |
| 307 // t | r8 | | |
| 308 // r +-------------+ | |
| 309 // y [ | r9 | ] only if r9 available | |
| 310 // +-------------+ | |
| 311 // | r10 | | |
| 312 // f +-------------+ | |
| 313 // r | r11 | | |
| 314 // a +-------------+ | |
| 315 // m | caller_sp | | |
| 316 // e +-------------+ | |
| 317 // | caller_pc | | |
| 318 // +-------------+ <--- caller_sp | |
| 319 // | argv | passed on stack from C code | |
| 320 // +-------------+ | |
| 321 // | | | |
| 322 // higher | | | |
| 323 // addresses | C frame | | |
| 324 | |
| 325 | |
| 326 // The first 4 args are passed from C in r0-r3 and are not spilled on entry: | |
| 327 // r0: code entry | |
| 328 // r1: function | |
| 329 // r2: receiver | |
| 330 // r3: argc | |
| 331 // [sp+0]: argv | |
| 332 | |
| 333 | |
| 334 // C entry frames: When calling from JS to C, we construct one extra | |
| 335 // frame: | |
| 336 | |
| 337 // lower | Stack | | |
| 338 // addresses | ^ | | |
| 339 // | | | | |
| 340 // | | | |
| 341 // | C frame | | |
| 342 // | | | |
| 343 // | | | |
| 344 // ----------- +=============+ <--- sp (stack pointer) | |
| 345 // | | | |
| 346 // | parameters | (first 4 args are passed in r0-r3) | |
| 347 // | | | |
| 348 // +-------------+ <--- fp (frame pointer) | |
| 349 // f 4/5 | caller_fp | | |
| 350 // r +-------------+ | |
| 351 // a 5/6 | sp_on_exit | (pp) | |
| 352 // m +-------------+ | |
| 353 // e 6/7 | caller_pc | | |
| 354 // +-------------+ <--- caller_sp (incl. parameters) | |
| 355 // 7/8 | | | |
| 356 // | parameters | | |
| 357 // | | | |
| 358 // +- - - - - - -+ <--- | |
| 359 // -2 | parameter0 | ^ | |
| 360 // +-------------+ | kParam0Offset | |
| 361 // -1 | receiver | v | |
| 362 // ----------- +=============+ <--- pp (parameter pointer, r10) | |
| 363 // 0 | function | | |
| 364 // +-------------+ | |
| 365 // | | | |
| 366 // |caller-saved | | |
| 367 // | regs | | |
| 368 // | | | |
| 369 // +-------------+ | |
| 370 // | | | |
| 371 // | caller | | |
| 372 // | expressions | | |
| 373 // | | | |
| 374 // higher | | | |
| 375 // addresses | JS frame | | |
| 376 | |
| 377 | |
| 378 } } // namespace v8::internal | 160 } } // namespace v8::internal |
| 379 | 161 |
| 380 #endif // V8_ARM_FRAMES_ARM_H_ | 162 #endif // V8_ARM_FRAMES_ARM_H_ |
| OLD | NEW |