diff options
Diffstat (limited to 'deps/v8/src/execution/frame-constants.h')
-rw-r--r-- | deps/v8/src/execution/frame-constants.h | 83 |
1 files changed, 70 insertions, 13 deletions
diff --git a/deps/v8/src/execution/frame-constants.h b/deps/v8/src/execution/frame-constants.h index 1c0a1f65f0..6903ae0032 100644 --- a/deps/v8/src/execution/frame-constants.h +++ b/deps/v8/src/execution/frame-constants.h @@ -71,7 +71,7 @@ class CommonFrameConstants : public AllStatic { -(kCPSlotSize + kContextOrFrameTypeSize); }; -// StandardFrames are used for interpreted and optimized JavaScript +// StandardFrames are used for both unoptimized and optimized JavaScript // frames. They always have a context below the saved fp/constant // pool, below that the JSFunction of the executing function and below that an // integer (not a Smi) containing the actual number of arguments passed to the @@ -196,15 +196,6 @@ class TypedFrameConstants : public CommonFrameConstants { #define DEFINE_TYPED_FRAME_SIZES(count) \ DEFINE_FRAME_SIZES(TypedFrameConstants, count) -class ArgumentsAdaptorFrameConstants : public TypedFrameConstants { - public: - // FP-relative. - static constexpr int kFunctionOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(0); - static constexpr int kLengthOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(1); - static constexpr int kPaddingOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(2); - DEFINE_TYPED_FRAME_SIZES(3); -}; - class BuiltinFrameConstants : public TypedFrameConstants { public: // FP-relative. @@ -293,12 +284,52 @@ class BuiltinExitFrameConstants : public ExitFrameConstants { static constexpr int kNumExtraArgsWithReceiver = 5; }; -class InterpreterFrameConstants : public StandardFrameConstants { +// Unoptimized frames are used for interpreted and baseline-compiled JavaScript +// frames. They are a "standard" frame, with an additional fixed header for the +// BytecodeArray, bytecode offset (if running interpreted), feedback vector (if +// running baseline code), and then the interpreter register file. +// +// slot JS frame +// +-----------------+-------------------------------- +// -n-1 | parameter n | ^ +// |- - - - - - - - -| | +// -n | parameter n-1 | Caller +// ... | ... | frame slots +// -2 | parameter 1 | (slot < 0) +// |- - - - - - - - -| | +// -1 | parameter 0 | v +// -----+-----------------+-------------------------------- +// 0 | return addr | ^ ^ +// |- - - - - - - - -| | | +// 1 | saved frame ptr | Fixed | +// |- - - - - - - - -| Header <-- frame ptr | +// 2 | [Constant Pool] | | | +// |- - - - - - - - -| | | +// 2+cp | Context | | if a constant pool | +// |- - - - - - - - -| | is used, cp = 1, | +// 3+cp | JSFunction | | otherwise, cp = 0 | +// |- - - - - - - - -| | | +// 4+cp | argc | v | +// +-----------------+---- | +// 5+cp | BytecodeArray | ^ | +// |- - - - - - - - -| Unoptimized code header | +// 6+cp | offset or FBV | v | +// +-----------------+---- | +// 7+cp | register 0 | ^ Callee +// |- - - - - - - - -| | frame slots +// 8+cp | register 1 | Register file (slot >= 0) +// ... | ... | | | +// | register n-1 | | | +// |- - - - - - - - -| | | +// 8+cp+n| register n | v v +// -----+-----------------+----- <-- stack ptr ------------- +// +class UnoptimizedFrameConstants : public StandardFrameConstants { public: // FP-relative. static constexpr int kBytecodeArrayFromFp = STANDARD_FRAME_EXTRA_PUSHED_VALUE_OFFSET(0); - static constexpr int kBytecodeOffsetFromFp = + static constexpr int kBytecodeOffsetOrFeedbackVectorFromFp = STANDARD_FRAME_EXTRA_PUSHED_VALUE_OFFSET(1); DEFINE_STANDARD_FRAME_SIZES(2); @@ -310,7 +341,7 @@ class InterpreterFrameConstants : public StandardFrameConstants { // Expression index for {JavaScriptFrame::GetExpressionAddress}. static constexpr int kBytecodeArrayExpressionIndex = -2; - static constexpr int kBytecodeOffsetExpressionIndex = -1; + static constexpr int kBytecodeOffsetOrFeedbackVectorExpressionIndex = -1; static constexpr int kRegisterFileExpressionIndex = 0; // Returns the number of stack slots needed for 'register_count' registers. @@ -319,6 +350,30 @@ class InterpreterFrameConstants : public StandardFrameConstants { static int RegisterStackSlotCount(int register_count); }; +// Interpreter frames are unoptimized frames that are being executed by the +// interpreter. In this case, the "offset or FBV" slot contains the bytecode +// offset of the currently executing bytecode. +class InterpreterFrameConstants : public UnoptimizedFrameConstants { + public: + static constexpr int kBytecodeOffsetExpressionIndex = + kBytecodeOffsetOrFeedbackVectorExpressionIndex; + + static constexpr int kBytecodeOffsetFromFp = + kBytecodeOffsetOrFeedbackVectorFromFp; +}; + +// Sparkplug frames are unoptimized frames that are being executed by +// sparkplug-compiled baseline code. base. In this case, the "offset or FBV" +// slot contains a cached pointer to the feedback vector. +class BaselineFrameConstants : public UnoptimizedFrameConstants { + public: + static constexpr int kFeedbackVectorExpressionIndex = + kBytecodeOffsetOrFeedbackVectorExpressionIndex; + + static constexpr int kFeedbackVectorFromFp = + kBytecodeOffsetOrFeedbackVectorFromFp; +}; + inline static int FPOffsetToFrameSlot(int frame_offset) { return StandardFrameConstants::kFixedSlotCountAboveFp - 1 - frame_offset / kSystemPointerSize; @@ -348,6 +403,8 @@ inline static int FrameSlotToFPOffset(int slot) { #include "src/execution/mips64/frame-constants-mips64.h" // NOLINT #elif V8_TARGET_ARCH_S390 #include "src/execution/s390/frame-constants-s390.h" // NOLINT +#elif V8_TARGET_ARCH_RISCV64 +#include "src/execution/riscv64/frame-constants-riscv64.h" // NOLINT #else #error Unsupported target architecture. #endif |