Chromium Code Reviews| Index: src/frames.h |
| diff --git a/src/frames.h b/src/frames.h |
| index cd66277b178a23d3fe9d0b61153707cf89c7c690..4db2fb875bede4d4724dcb337e3b74ee2b7152c4 100644 |
| --- a/src/frames.h |
| +++ b/src/frames.h |
| @@ -111,6 +111,41 @@ class StackHandler BASE_EMBEDDED { |
| V(CONSTRUCT, ConstructFrame) \ |
| V(ARGUMENTS_ADAPTOR, ArgumentsAdaptorFrame) |
| +// Every pointer in a frame has a slot id. On 32-bit platforms, doubles consume |
| +// two slots. |
| +// |
| +// Stack slot indices >= 0 access the callee stack with slot 0 corresponding to |
| +// the callee's saved return address and 1 corresponding to the saved frame |
| +// pointer. Some frames have additional information stored in the fixed header, |
| +// for example JSFunctions store the function context and marker in the fixed |
| +// header, with slot index 2 corresponding to the current function context and 3 |
| +// corresponding to the frame marker/JSFunction. |
| +// |
| +// slot JS frame |
| +// +-----------------+-------------------------------- |
| +// -n-1 | parameter 0 | ^ |
| +// |- - - - - - - - -| | |
| +// -n | | Caller |
| +// ... | ... | frame slots |
| +// -2 | parameter n-1 | (slot < 0) |
| +// |- - - - - - - - -| | |
| +// -1 | parameter n | v |
| +// -----+-----------------+-------------------------------- |
| +// 0 | return addr | ^ ^ |
| +// |- - - - - - - - -| | | |
| +// 1 | saved frame ptr | Fixed | |
|
Jarin
2016/02/17 11:48:31
There can be an optional constant pool here, no?
danno
2016/02/17 12:52:21
Fixed the picture. I plan to try to make the fp/ra
|
| +// |- - - - - - - - -| Header <-- frame ptr | |
| +// 2 | Context | | | |
| +// |- - - - - - - - -| | | |
| +// 3 |JSFunction/Marker| v | |
| +// +-----------------+---- | |
| +// 4 | | ^ Callee |
| +// |- - - - - - - - -| | frame slots |
| +// ... | | Frame slots (slot >= 0) |
| +// |- - - - - - - - -| | | |
| +// | | v | |
| +// -----+-----------------+----- <-- stack ptr ------------- |
| +// |
| class StandardFrameConstants : public AllStatic { |
| public: |
| @@ -207,6 +242,15 @@ class InterpreterFrameConstants : public AllStatic { |
| static const int kContextFromRegisterPointer = 5 * kPointerSize; |
| }; |
| +inline static int FPOffsetToFrameSlot(int frame_offset) { |
| + return StandardFrameConstants::kFixedSlotCountAboveFp - 1 - |
| + frame_offset / kPointerSize; |
| +} |
| + |
| +inline static int FrameSlotToFPOffset(int slot) { |
| + return (StandardFrameConstants::kFixedSlotCountAboveFp - 1 - slot) * |
| + kPointerSize; |
| +} |
| // Abstract base class for all stack frames. |
| class StackFrame BASE_EMBEDDED { |