[frames] Turn all frame constants into {constexpr}.

This is in preparation of using some of these constants to compute
values for the Liftoff assembler that are themselves constexpr.

R=clemensh@chromium.org

Change-Id: I573ef4ca164e0107968e482996963fde9a3960b0
Reviewed-on: https://chromium-review.googlesource.com/1005056
Reviewed-by: Clemens Hammacher <clemensh@chromium.org>
Commit-Queue: Michael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#52527}
This commit is contained in:
Michael Starzinger 2018-04-10 16:28:28 +02:00 committed by Commit Bot
parent ff64dfa092
commit f590c153e2
9 changed files with 194 additions and 171 deletions

View File

@ -10,36 +10,38 @@ namespace internal {
class EntryFrameConstants : public AllStatic {
public:
static const int kCallerFPOffset =
static constexpr int kCallerFPOffset =
-(StandardFrameConstants::kFixedFrameSizeFromFp + kPointerSize);
};
class ExitFrameConstants : public TypedFrameConstants {
public:
static const int kSPOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(0);
static const int kCodeOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(1);
static constexpr int kSPOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(0);
static constexpr int kCodeOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(1);
DEFINE_TYPED_FRAME_SIZES(2);
// The caller fields are below the frame pointer on the stack.
static const int kCallerFPOffset = 0 * kPointerSize;
static constexpr int kCallerFPOffset = 0 * kPointerSize;
// The calling JS function is below FP.
static const int kCallerPCOffset = 1 * kPointerSize;
static constexpr int kCallerPCOffset = 1 * kPointerSize;
// FP-relative displacement of the caller's SP. It points just
// below the saved PC.
static const int kCallerSPDisplacement = 2 * kPointerSize;
static constexpr int kCallerSPDisplacement = 2 * kPointerSize;
};
class JavaScriptFrameConstants : public AllStatic {
public:
// FP-relative.
static const int kLocal0Offset = StandardFrameConstants::kExpressionsOffset;
static const int kLastParameterOffset = +2 * kPointerSize;
static const int kFunctionOffset = StandardFrameConstants::kFunctionOffset;
static constexpr int kLocal0Offset =
StandardFrameConstants::kExpressionsOffset;
static constexpr int kLastParameterOffset = +2 * kPointerSize;
static constexpr int kFunctionOffset =
StandardFrameConstants::kFunctionOffset;
// Caller SP-relative.
static const int kParam0Offset = -2 * kPointerSize;
static const int kReceiverOffset = -1 * kPointerSize;
static constexpr int kParam0Offset = -2 * kPointerSize;
static constexpr int kReceiverOffset = -1 * kPointerSize;
};
} // namespace internal

View File

@ -31,31 +31,33 @@ namespace internal {
//
class EntryFrameConstants : public AllStatic {
public:
static const int kCallerFPOffset = -3 * kPointerSize;
static const int kFixedFrameSize = 6 * kPointerSize;
static constexpr int kCallerFPOffset = -3 * kPointerSize;
static constexpr int kFixedFrameSize = 6 * kPointerSize;
};
class ExitFrameConstants : public TypedFrameConstants {
public:
static const int kSPOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(0);
static const int kCodeOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(1);
static const int kPaddingOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(2);
static constexpr int kSPOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(0);
static constexpr int kCodeOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(1);
static constexpr int kPaddingOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(2);
DEFINE_TYPED_FRAME_SIZES(3);
static const int kLastExitFrameField = kPaddingOffset;
static constexpr int kLastExitFrameField = kPaddingOffset;
static const int kConstantPoolOffset = 0; // Not used
static constexpr int kConstantPoolOffset = 0; // Not used
};
class JavaScriptFrameConstants : public AllStatic {
public:
// FP-relative.
static const int kLocal0Offset = StandardFrameConstants::kExpressionsOffset;
static constexpr int kLocal0Offset =
StandardFrameConstants::kExpressionsOffset;
// There are two words on the stack (saved fp and saved lr) between fp and
// the arguments.
static const int kLastParameterOffset = 2 * kPointerSize;
static constexpr int kLastParameterOffset = 2 * kPointerSize;
static const int kFunctionOffset = StandardFrameConstants::kFunctionOffset;
static constexpr int kFunctionOffset =
StandardFrameConstants::kFunctionOffset;
};
} // namespace internal

View File

@ -50,23 +50,24 @@ namespace internal {
//
class CommonFrameConstants : public AllStatic {
public:
static const int kCallerFPOffset = 0 * kPointerSize;
static const int kCallerPCOffset = kCallerFPOffset + 1 * kFPOnStackSize;
static const int kCallerSPOffset = kCallerPCOffset + 1 * kPCOnStackSize;
static constexpr int kCallerFPOffset = 0 * kPointerSize;
static constexpr int kCallerPCOffset = kCallerFPOffset + 1 * kFPOnStackSize;
static constexpr int kCallerSPOffset = kCallerPCOffset + 1 * kPCOnStackSize;
// Fixed part of the frame consists of return address, caller fp,
// constant pool (if FLAG_enable_embedded_constant_pool), context, and
// function. StandardFrame::IterateExpressions assumes that kLastObjectOffset
// is the last object pointer.
static const int kFixedFrameSizeAboveFp = kPCOnStackSize + kFPOnStackSize;
static const int kFixedSlotCountAboveFp =
static constexpr int kFixedFrameSizeAboveFp = kPCOnStackSize + kFPOnStackSize;
static constexpr int kFixedSlotCountAboveFp =
kFixedFrameSizeAboveFp / kPointerSize;
static const int kCPSlotSize =
static constexpr int kCPSlotSize =
FLAG_enable_embedded_constant_pool ? kPointerSize : 0;
static const int kCPSlotCount = kCPSlotSize / kPointerSize;
static const int kConstantPoolOffset = kCPSlotSize ? -1 * kPointerSize : 0;
static const int kContextOrFrameTypeSize = kPointerSize;
static const int kContextOrFrameTypeOffset =
static constexpr int kCPSlotCount = kCPSlotSize / kPointerSize;
static constexpr int kConstantPoolOffset =
kCPSlotSize ? -1 * kPointerSize : 0;
static constexpr int kContextOrFrameTypeSize = kPointerSize;
static constexpr int kContextOrFrameTypeOffset =
-(kCPSlotSize + kContextOrFrameTypeSize);
};
@ -103,15 +104,16 @@ class CommonFrameConstants : public AllStatic {
//
class StandardFrameConstants : public CommonFrameConstants {
public:
static const int kFixedFrameSizeFromFp = 2 * kPointerSize + kCPSlotSize;
static const int kFixedFrameSize =
static constexpr int kFixedFrameSizeFromFp = 2 * kPointerSize + kCPSlotSize;
static constexpr int kFixedFrameSize =
kFixedFrameSizeAboveFp + kFixedFrameSizeFromFp;
static const int kFixedSlotCountFromFp = kFixedFrameSizeFromFp / kPointerSize;
static const int kFixedSlotCount = kFixedFrameSize / kPointerSize;
static const int kContextOffset = kContextOrFrameTypeOffset;
static const int kFunctionOffset = -2 * kPointerSize - kCPSlotSize;
static const int kExpressionsOffset = -3 * kPointerSize - kCPSlotSize;
static const int kLastObjectOffset = kContextOffset;
static constexpr int kFixedSlotCountFromFp =
kFixedFrameSizeFromFp / kPointerSize;
static constexpr int kFixedSlotCount = kFixedFrameSize / kPointerSize;
static constexpr int kContextOffset = kContextOrFrameTypeOffset;
static constexpr int kFunctionOffset = -2 * kPointerSize - kCPSlotSize;
static constexpr int kExpressionsOffset = -3 * kPointerSize - kCPSlotSize;
static constexpr int kLastObjectOffset = kContextOffset;
};
// OptimizedBuiltinFrameConstants are used for TF-generated builtins. They
@ -150,10 +152,10 @@ class StandardFrameConstants : public CommonFrameConstants {
//
class OptimizedBuiltinFrameConstants : public StandardFrameConstants {
public:
static const int kArgCSize = kPointerSize;
static const int kArgCOffset = -3 * kPointerSize - kCPSlotSize;
static const int kFixedFrameSize = kFixedFrameSizeAboveFp - kArgCOffset;
static const int kFixedSlotCount = kFixedFrameSize / kPointerSize;
static constexpr int kArgCSize = kPointerSize;
static constexpr int kArgCOffset = -3 * kPointerSize - kCPSlotSize;
static constexpr int kFixedFrameSize = kFixedFrameSizeAboveFp - kArgCOffset;
static constexpr int kFixedSlotCount = kFixedFrameSize / kPointerSize;
};
// TypedFrames have a SMI type maker value below the saved FP/constant pool to
@ -189,14 +191,15 @@ class OptimizedBuiltinFrameConstants : public StandardFrameConstants {
//
class TypedFrameConstants : public CommonFrameConstants {
public:
static const int kFrameTypeSize = kContextOrFrameTypeSize;
static const int kFrameTypeOffset = kContextOrFrameTypeOffset;
static const int kFixedFrameSizeFromFp = kCPSlotSize + kFrameTypeSize;
static const int kFixedSlotCountFromFp = kFixedFrameSizeFromFp / kPointerSize;
static const int kFixedFrameSize =
static constexpr int kFrameTypeSize = kContextOrFrameTypeSize;
static constexpr int kFrameTypeOffset = kContextOrFrameTypeOffset;
static constexpr int kFixedFrameSizeFromFp = kCPSlotSize + kFrameTypeSize;
static constexpr int kFixedSlotCountFromFp =
kFixedFrameSizeFromFp / kPointerSize;
static constexpr int kFixedFrameSize =
StandardFrameConstants::kFixedFrameSizeAboveFp + kFixedFrameSizeFromFp;
static const int kFixedSlotCount = kFixedFrameSize / kPointerSize;
static const int kFirstPushedFrameValueOffset =
static constexpr int kFixedSlotCount = kFixedFrameSize / kPointerSize;
static constexpr int kFirstPushedFrameValueOffset =
-StandardFrameConstants::kCPSlotSize - kFrameTypeSize - kPointerSize;
};
@ -206,44 +209,46 @@ class TypedFrameConstants : public CommonFrameConstants {
(TypedFrameConstants::kFixedFrameSize + (count)*kPointerSize)
#define TYPED_FRAME_SIZE_FROM_SP(count) \
(TypedFrameConstants::kFixedFrameSizeFromFp + (count)*kPointerSize)
#define DEFINE_TYPED_FRAME_SIZES(count) \
static const int kFixedFrameSize = TYPED_FRAME_SIZE(count); \
static const int kFixedSlotCount = kFixedFrameSize / kPointerSize; \
static const int kFixedFrameSizeFromFp = TYPED_FRAME_SIZE_FROM_SP(count); \
static const int kFixedSlotCountFromFp = kFixedFrameSizeFromFp / kPointerSize
#define DEFINE_TYPED_FRAME_SIZES(count) \
static constexpr int kFixedFrameSize = TYPED_FRAME_SIZE(count); \
static constexpr int kFixedSlotCount = kFixedFrameSize / kPointerSize; \
static constexpr int kFixedFrameSizeFromFp = \
TYPED_FRAME_SIZE_FROM_SP(count); \
static constexpr int kFixedSlotCountFromFp = \
kFixedFrameSizeFromFp / kPointerSize
class ArgumentsAdaptorFrameConstants : public TypedFrameConstants {
public:
// FP-relative.
static const int kFunctionOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(0);
static const int kLengthOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(1);
static const int kPaddingOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(2);
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.
static const int kFunctionOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(0);
static const int kLengthOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(1);
static constexpr int kFunctionOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(0);
static constexpr int kLengthOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(1);
DEFINE_TYPED_FRAME_SIZES(2);
};
class InternalFrameConstants : public TypedFrameConstants {
public:
// FP-relative.
static const int kCodeOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(0);
static constexpr int kCodeOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(0);
DEFINE_TYPED_FRAME_SIZES(1);
};
class ConstructFrameConstants : public TypedFrameConstants {
public:
// FP-relative.
static const int kContextOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(0);
static const int kLengthOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(1);
static const int kConstructorOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(2);
static const int kPaddingOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(3);
static const int kNewTargetOrImplicitReceiverOffset =
static constexpr int kContextOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(0);
static constexpr int kLengthOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(1);
static constexpr int kConstructorOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(2);
static constexpr int kPaddingOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(3);
static constexpr int kNewTargetOrImplicitReceiverOffset =
TYPED_FRAME_PUSHED_VALUE_OFFSET(4);
DEFINE_TYPED_FRAME_SIZES(5);
};
@ -251,15 +256,16 @@ class ConstructFrameConstants : public TypedFrameConstants {
class BuiltinContinuationFrameConstants : public TypedFrameConstants {
public:
// FP-relative.
static const int kFunctionOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(0);
static const int kFrameSPtoFPDeltaAtDeoptimize =
static constexpr int kFunctionOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(0);
static constexpr int kFrameSPtoFPDeltaAtDeoptimize =
TYPED_FRAME_PUSHED_VALUE_OFFSET(1);
static const int kBuiltinContextOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(2);
static const int kBuiltinOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(3);
static constexpr int kBuiltinContextOffset =
TYPED_FRAME_PUSHED_VALUE_OFFSET(2);
static constexpr int kBuiltinOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(3);
// The argument count is in the first allocatable register, stored below the
// fixed part of the frame and therefore is not part of the fixed frame size.
static const int kArgCOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(4);
static constexpr int kArgCOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(4);
DEFINE_TYPED_FRAME_SIZES(4);
// Returns the number of padding stack slots needed when we have
@ -272,44 +278,45 @@ class BuiltinContinuationFrameConstants : public TypedFrameConstants {
// Behaves like an exit frame but with target and new target args.
class BuiltinExitFrameConstants : public CommonFrameConstants {
public:
static const int kNewTargetOffset = kCallerPCOffset + 1 * kPointerSize;
static const int kTargetOffset = kNewTargetOffset + 1 * kPointerSize;
static const int kArgcOffset = kTargetOffset + 1 * kPointerSize;
static const int kPaddingOffset = kArgcOffset + 1 * kPointerSize;
static const int kFirstArgumentOffset = kPaddingOffset + 1 * kPointerSize;
static const int kNumExtraArgsWithReceiver = 5;
static constexpr int kNewTargetOffset = kCallerPCOffset + 1 * kPointerSize;
static constexpr int kTargetOffset = kNewTargetOffset + 1 * kPointerSize;
static constexpr int kArgcOffset = kTargetOffset + 1 * kPointerSize;
static constexpr int kPaddingOffset = kArgcOffset + 1 * kPointerSize;
static constexpr int kFirstArgumentOffset = kPaddingOffset + 1 * kPointerSize;
static constexpr int kNumExtraArgsWithReceiver = 5;
};
class InterpreterFrameConstants : public AllStatic {
public:
// Fixed frame includes bytecode array and bytecode offset.
static const int kFixedFrameSize =
static constexpr int kFixedFrameSize =
StandardFrameConstants::kFixedFrameSize + 2 * kPointerSize;
static const int kFixedFrameSizeFromFp =
static constexpr int kFixedFrameSizeFromFp =
StandardFrameConstants::kFixedFrameSizeFromFp + 2 * kPointerSize;
// FP-relative.
static const int kLastParamFromFp = StandardFrameConstants::kCallerSPOffset;
static const int kCallerPCOffsetFromFp =
static constexpr int kLastParamFromFp =
StandardFrameConstants::kCallerSPOffset;
static constexpr int kCallerPCOffsetFromFp =
StandardFrameConstants::kCallerPCOffset;
static const int kBytecodeArrayFromFp =
static constexpr int kBytecodeArrayFromFp =
-StandardFrameConstants::kFixedFrameSizeFromFp - 1 * kPointerSize;
static const int kBytecodeOffsetFromFp =
static constexpr int kBytecodeOffsetFromFp =
-StandardFrameConstants::kFixedFrameSizeFromFp - 2 * kPointerSize;
static const int kRegisterFileFromFp =
static constexpr int kRegisterFileFromFp =
-StandardFrameConstants::kFixedFrameSizeFromFp - 3 * kPointerSize;
static const int kExpressionsOffset = kRegisterFileFromFp;
static constexpr int kExpressionsOffset = kRegisterFileFromFp;
// Number of fixed slots in addition to a {StandardFrame}.
static const int kExtraSlotCount =
static constexpr int kExtraSlotCount =
InterpreterFrameConstants::kFixedFrameSize / kPointerSize -
StandardFrameConstants::kFixedFrameSize / kPointerSize;
// Expression index for {StandardFrame::GetExpressionAddress}.
static const int kBytecodeArrayExpressionIndex = -2;
static const int kBytecodeOffsetExpressionIndex = -1;
static const int kRegisterFileExpressionIndex = 0;
static constexpr int kBytecodeArrayExpressionIndex = -2;
static constexpr int kBytecodeOffsetExpressionIndex = -1;
static constexpr int kRegisterFileExpressionIndex = 0;
// Returns the number of stack slots needed for 'register_count' registers.
// This is needed because some architectures must pad the stack frame with

View File

@ -10,41 +10,43 @@ namespace internal {
class EntryFrameConstants : public AllStatic {
public:
static const int kCallerFPOffset = -6 * kPointerSize;
static constexpr int kCallerFPOffset = -6 * kPointerSize;
static const int kNewTargetArgOffset = +2 * kPointerSize;
static const int kFunctionArgOffset = +3 * kPointerSize;
static const int kReceiverArgOffset = +4 * kPointerSize;
static const int kArgcOffset = +5 * kPointerSize;
static const int kArgvOffset = +6 * kPointerSize;
static constexpr int kNewTargetArgOffset = +2 * kPointerSize;
static constexpr int kFunctionArgOffset = +3 * kPointerSize;
static constexpr int kReceiverArgOffset = +4 * kPointerSize;
static constexpr int kArgcOffset = +5 * kPointerSize;
static constexpr int kArgvOffset = +6 * kPointerSize;
};
class ExitFrameConstants : public TypedFrameConstants {
public:
static const int kSPOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(0);
static const int kCodeOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(1);
static constexpr int kSPOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(0);
static constexpr int kCodeOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(1);
DEFINE_TYPED_FRAME_SIZES(2);
static const int kCallerFPOffset = 0 * kPointerSize;
static const int kCallerPCOffset = +1 * kPointerSize;
static constexpr int kCallerFPOffset = 0 * kPointerSize;
static constexpr int kCallerPCOffset = +1 * kPointerSize;
// FP-relative displacement of the caller's SP. It points just
// below the saved PC.
static const int kCallerSPDisplacement = +2 * kPointerSize;
static constexpr int kCallerSPDisplacement = +2 * kPointerSize;
static const int kConstantPoolOffset = 0; // Not used
static constexpr int kConstantPoolOffset = 0; // Not used
};
class JavaScriptFrameConstants : public AllStatic {
public:
// FP-relative.
static const int kLocal0Offset = StandardFrameConstants::kExpressionsOffset;
static const int kLastParameterOffset = +2 * kPointerSize;
static const int kFunctionOffset = StandardFrameConstants::kFunctionOffset;
static constexpr int kLocal0Offset =
StandardFrameConstants::kExpressionsOffset;
static constexpr int kLastParameterOffset = +2 * kPointerSize;
static constexpr int kFunctionOffset =
StandardFrameConstants::kFunctionOffset;
// Caller SP-relative.
static const int kParam0Offset = -2 * kPointerSize;
static const int kReceiverOffset = -1 * kPointerSize;
static constexpr int kParam0Offset = -2 * kPointerSize;
static constexpr int kReceiverOffset = -1 * kPointerSize;
};
} // namespace internal

View File

@ -10,40 +10,42 @@ namespace internal {
class EntryFrameConstants : public AllStatic {
public:
static const int kCallerFPOffset =
static constexpr int kCallerFPOffset =
-(StandardFrameConstants::kFixedFrameSizeFromFp + kPointerSize);
};
class ExitFrameConstants : public TypedFrameConstants {
public:
static const int kSPOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(0);
static const int kCodeOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(1);
static constexpr int kSPOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(0);
static constexpr int kCodeOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(1);
DEFINE_TYPED_FRAME_SIZES(2);
// The caller fields are below the frame pointer on the stack.
static const int kCallerFPOffset = +0 * kPointerSize;
static constexpr int kCallerFPOffset = +0 * kPointerSize;
// The calling JS function is between FP and PC.
static const int kCallerPCOffset = +1 * kPointerSize;
static constexpr int kCallerPCOffset = +1 * kPointerSize;
// MIPS-specific: a pointer to the old sp to avoid unnecessary calculations.
static const int kCallerSPOffset = +2 * kPointerSize;
static constexpr int kCallerSPOffset = +2 * kPointerSize;
// FP-relative displacement of the caller's SP.
static const int kCallerSPDisplacement = +2 * kPointerSize;
static constexpr int kCallerSPDisplacement = +2 * kPointerSize;
static const int kConstantPoolOffset = 0; // Not used.
static constexpr int kConstantPoolOffset = 0; // Not used.
};
class JavaScriptFrameConstants : public AllStatic {
public:
// FP-relative.
static const int kLocal0Offset = StandardFrameConstants::kExpressionsOffset;
static const int kLastParameterOffset = +2 * kPointerSize;
static const int kFunctionOffset = StandardFrameConstants::kFunctionOffset;
static constexpr int kLocal0Offset =
StandardFrameConstants::kExpressionsOffset;
static constexpr int kLastParameterOffset = +2 * kPointerSize;
static constexpr int kFunctionOffset =
StandardFrameConstants::kFunctionOffset;
// Caller SP-relative.
static const int kParam0Offset = -2 * kPointerSize;
static const int kReceiverOffset = -1 * kPointerSize;
static constexpr int kParam0Offset = -2 * kPointerSize;
static constexpr int kReceiverOffset = -1 * kPointerSize;
};
} // namespace internal

View File

@ -10,40 +10,42 @@ namespace internal {
class EntryFrameConstants : public AllStatic {
public:
static const int kCallerFPOffset =
static constexpr int kCallerFPOffset =
-(StandardFrameConstants::kFixedFrameSizeFromFp + kPointerSize);
};
class ExitFrameConstants : public TypedFrameConstants {
public:
static const int kSPOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(0);
static const int kCodeOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(1);
static constexpr int kSPOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(0);
static constexpr int kCodeOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(1);
DEFINE_TYPED_FRAME_SIZES(2);
// The caller fields are below the frame pointer on the stack.
static const int kCallerFPOffset = +0 * kPointerSize;
static constexpr int kCallerFPOffset = +0 * kPointerSize;
// The calling JS function is between FP and PC.
static const int kCallerPCOffset = +1 * kPointerSize;
static constexpr int kCallerPCOffset = +1 * kPointerSize;
// MIPS-specific: a pointer to the old sp to avoid unnecessary calculations.
static const int kCallerSPOffset = +2 * kPointerSize;
static constexpr int kCallerSPOffset = +2 * kPointerSize;
// FP-relative displacement of the caller's SP.
static const int kCallerSPDisplacement = +2 * kPointerSize;
static constexpr int kCallerSPDisplacement = +2 * kPointerSize;
static const int kConstantPoolOffset = 0; // Not used.
static constexpr int kConstantPoolOffset = 0; // Not used.
};
class JavaScriptFrameConstants : public AllStatic {
public:
// FP-relative.
static const int kLocal0Offset = StandardFrameConstants::kExpressionsOffset;
static const int kLastParameterOffset = +2 * kPointerSize;
static const int kFunctionOffset = StandardFrameConstants::kFunctionOffset;
static constexpr int kLocal0Offset =
StandardFrameConstants::kExpressionsOffset;
static constexpr int kLastParameterOffset = +2 * kPointerSize;
static constexpr int kFunctionOffset =
StandardFrameConstants::kFunctionOffset;
// Caller SP-relative.
static const int kParam0Offset = -2 * kPointerSize;
static const int kReceiverOffset = -1 * kPointerSize;
static constexpr int kParam0Offset = -2 * kPointerSize;
static constexpr int kReceiverOffset = -1 * kPointerSize;
};
} // namespace internal

View File

@ -12,36 +12,38 @@ namespace internal {
class EntryFrameConstants : public AllStatic {
public:
static const int kCallerFPOffset =
static constexpr int kCallerFPOffset =
-(StandardFrameConstants::kFixedFrameSizeFromFp + kPointerSize);
};
class ExitFrameConstants : public TypedFrameConstants {
public:
static const int kSPOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(0);
static const int kCodeOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(1);
static constexpr int kSPOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(0);
static constexpr int kCodeOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(1);
DEFINE_TYPED_FRAME_SIZES(2);
// The caller fields are below the frame pointer on the stack.
static const int kCallerFPOffset = 0 * kPointerSize;
static constexpr int kCallerFPOffset = 0 * kPointerSize;
// The calling JS function is below FP.
static const int kCallerPCOffset = 1 * kPointerSize;
static constexpr int kCallerPCOffset = 1 * kPointerSize;
// FP-relative displacement of the caller's SP. It points just
// below the saved PC.
static const int kCallerSPDisplacement = 2 * kPointerSize;
static constexpr int kCallerSPDisplacement = 2 * kPointerSize;
};
class JavaScriptFrameConstants : public AllStatic {
public:
// FP-relative.
static const int kLocal0Offset = StandardFrameConstants::kExpressionsOffset;
static const int kLastParameterOffset = +2 * kPointerSize;
static const int kFunctionOffset = StandardFrameConstants::kFunctionOffset;
static constexpr int kLocal0Offset =
StandardFrameConstants::kExpressionsOffset;
static constexpr int kLastParameterOffset = +2 * kPointerSize;
static constexpr int kFunctionOffset =
StandardFrameConstants::kFunctionOffset;
// Caller SP-relative.
static const int kParam0Offset = -2 * kPointerSize;
static const int kReceiverOffset = -1 * kPointerSize;
static constexpr int kParam0Offset = -2 * kPointerSize;
static constexpr int kReceiverOffset = -1 * kPointerSize;
};
} // namespace internal

View File

@ -10,36 +10,38 @@ namespace internal {
class EntryFrameConstants : public AllStatic {
public:
static const int kCallerFPOffset =
static constexpr int kCallerFPOffset =
-(StandardFrameConstants::kFixedFrameSizeFromFp + kPointerSize);
};
class ExitFrameConstants : public TypedFrameConstants {
public:
static const int kSPOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(0);
static const int kCodeOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(1);
static constexpr int kSPOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(0);
static constexpr int kCodeOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(1);
DEFINE_TYPED_FRAME_SIZES(2);
// The caller fields are below the frame pointer on the stack.
static const int kCallerFPOffset = 0 * kPointerSize;
static constexpr int kCallerFPOffset = 0 * kPointerSize;
// The calling JS function is below FP.
static const int kCallerPCOffset = 1 * kPointerSize;
static constexpr int kCallerPCOffset = 1 * kPointerSize;
// FP-relative displacement of the caller's SP. It points just
// below the saved PC.
static const int kCallerSPDisplacement = 2 * kPointerSize;
static constexpr int kCallerSPDisplacement = 2 * kPointerSize;
};
class JavaScriptFrameConstants : public AllStatic {
public:
// FP-relative.
static const int kLocal0Offset = StandardFrameConstants::kExpressionsOffset;
static const int kLastParameterOffset = +2 * kPointerSize;
static const int kFunctionOffset = StandardFrameConstants::kFunctionOffset;
static constexpr int kLocal0Offset =
StandardFrameConstants::kExpressionsOffset;
static constexpr int kLastParameterOffset = +2 * kPointerSize;
static constexpr int kFunctionOffset =
StandardFrameConstants::kFunctionOffset;
// Caller SP-relative.
static const int kParam0Offset = -2 * kPointerSize;
static const int kReceiverOffset = -1 * kPointerSize;
static constexpr int kParam0Offset = -2 * kPointerSize;
static constexpr int kReceiverOffset = -1 * kPointerSize;
};
} // namespace internal

View File

@ -11,45 +11,47 @@ namespace internal {
class EntryFrameConstants : public AllStatic {
public:
#ifdef _WIN64
static const int kCalleeSaveXMMRegisters = 10;
static const int kXMMRegisterSize = 16;
static const int kXMMRegistersBlockSize =
static constexpr int kCalleeSaveXMMRegisters = 10;
static constexpr int kXMMRegisterSize = 16;
static constexpr int kXMMRegistersBlockSize =
kXMMRegisterSize * kCalleeSaveXMMRegisters;
static const int kCallerFPOffset =
static constexpr int kCallerFPOffset =
-3 * kPointerSize + -7 * kRegisterSize - kXMMRegistersBlockSize;
#else
// We have 3 Push and 5 pushq in the JSEntryStub::GenerateBody.
static const int kCallerFPOffset = -3 * kPointerSize + -5 * kRegisterSize;
static constexpr int kCallerFPOffset = -3 * kPointerSize + -5 * kRegisterSize;
#endif
static const int kArgvOffset = 6 * kPointerSize;
static constexpr int kArgvOffset = 6 * kPointerSize;
};
class ExitFrameConstants : public TypedFrameConstants {
public:
static const int kSPOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(0);
static const int kCodeOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(1);
static constexpr int kSPOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(0);
static constexpr int kCodeOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(1);
DEFINE_TYPED_FRAME_SIZES(2);
static const int kCallerFPOffset = +0 * kPointerSize;
static const int kCallerPCOffset = kFPOnStackSize;
static constexpr int kCallerFPOffset = +0 * kPointerSize;
static constexpr int kCallerPCOffset = kFPOnStackSize;
// FP-relative displacement of the caller's SP. It points just
// below the saved PC.
static const int kCallerSPDisplacement = kCallerPCOffset + kPCOnStackSize;
static constexpr int kCallerSPDisplacement = kCallerPCOffset + kPCOnStackSize;
static const int kConstantPoolOffset = 0; // Not used
static constexpr int kConstantPoolOffset = 0; // Not used
};
class JavaScriptFrameConstants : public AllStatic {
public:
// FP-relative.
static const int kLocal0Offset = StandardFrameConstants::kExpressionsOffset;
static const int kLastParameterOffset = kFPOnStackSize + kPCOnStackSize;
static const int kFunctionOffset = StandardFrameConstants::kFunctionOffset;
static constexpr int kLocal0Offset =
StandardFrameConstants::kExpressionsOffset;
static constexpr int kLastParameterOffset = kFPOnStackSize + kPCOnStackSize;
static constexpr int kFunctionOffset =
StandardFrameConstants::kFunctionOffset;
// Caller SP-relative.
static const int kParam0Offset = -2 * kPointerSize;
static const int kReceiverOffset = -1 * kPointerSize;
static constexpr int kParam0Offset = -2 * kPointerSize;
static constexpr int kReceiverOffset = -1 * kPointerSize;
};
} // namespace internal