Commit f590c153 authored by Michael Starzinger's avatar Michael Starzinger Committed by Commit Bot

[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/1005056Reviewed-by: 's avatarClemens Hammacher <clemensh@chromium.org>
Commit-Queue: Michael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#52527}
parent ff64dfa0
......@@ -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
......
......@@ -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
......
This diff is collapsed.
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment