Commit 528a6037 authored by Igor Sheludko's avatar Igor Sheludko Committed by Commit Bot

[cleanup][x64] Fix kPointerSize usages in src/builtins/x64

Bug: v8:8477, v8:8562
Change-Id: I37361ded733d21a5814a2a23a4155d7e8b562446
Reviewed-on: https://chromium-review.googlesource.com/c/1384092Reviewed-by: 's avatarToon Verwaest <verwaest@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#58361}
parent 50f6baf4
This diff is collapsed.
...@@ -50,7 +50,7 @@ namespace internal { ...@@ -50,7 +50,7 @@ namespace internal {
// //
class CommonFrameConstants : public AllStatic { class CommonFrameConstants : public AllStatic {
public: public:
static constexpr int kCallerFPOffset = 0 * kPointerSize; static constexpr int kCallerFPOffset = 0 * kSystemPointerSize;
static constexpr int kCallerPCOffset = kCallerFPOffset + 1 * kFPOnStackSize; static constexpr int kCallerPCOffset = kCallerFPOffset + 1 * kFPOnStackSize;
static constexpr int kCallerSPOffset = kCallerPCOffset + 1 * kPCOnStackSize; static constexpr int kCallerSPOffset = kCallerPCOffset + 1 * kPCOnStackSize;
...@@ -60,13 +60,13 @@ class CommonFrameConstants : public AllStatic { ...@@ -60,13 +60,13 @@ class CommonFrameConstants : public AllStatic {
// is the last object pointer. // is the last object pointer.
static constexpr int kFixedFrameSizeAboveFp = kPCOnStackSize + kFPOnStackSize; static constexpr int kFixedFrameSizeAboveFp = kPCOnStackSize + kFPOnStackSize;
static constexpr int kFixedSlotCountAboveFp = static constexpr int kFixedSlotCountAboveFp =
kFixedFrameSizeAboveFp / kPointerSize; kFixedFrameSizeAboveFp / kSystemPointerSize;
static constexpr int kCPSlotSize = static constexpr int kCPSlotSize =
FLAG_enable_embedded_constant_pool ? kPointerSize : 0; FLAG_enable_embedded_constant_pool ? kSystemPointerSize : 0;
static constexpr int kCPSlotCount = kCPSlotSize / kPointerSize; static constexpr int kCPSlotCount = kCPSlotSize / kSystemPointerSize;
static constexpr int kConstantPoolOffset = static constexpr int kConstantPoolOffset =
kCPSlotSize ? -1 * kPointerSize : 0; kCPSlotSize ? -1 * kSystemPointerSize : 0;
static constexpr int kContextOrFrameTypeSize = kPointerSize; static constexpr int kContextOrFrameTypeSize = kSystemPointerSize;
static constexpr int kContextOrFrameTypeOffset = static constexpr int kContextOrFrameTypeOffset =
-(kCPSlotSize + kContextOrFrameTypeSize); -(kCPSlotSize + kContextOrFrameTypeSize);
}; };
...@@ -104,15 +104,17 @@ class CommonFrameConstants : public AllStatic { ...@@ -104,15 +104,17 @@ class CommonFrameConstants : public AllStatic {
// //
class StandardFrameConstants : public CommonFrameConstants { class StandardFrameConstants : public CommonFrameConstants {
public: public:
static constexpr int kFixedFrameSizeFromFp = 2 * kPointerSize + kCPSlotSize; static constexpr int kFixedFrameSizeFromFp =
2 * kSystemPointerSize + kCPSlotSize;
static constexpr int kFixedFrameSize = static constexpr int kFixedFrameSize =
kFixedFrameSizeAboveFp + kFixedFrameSizeFromFp; kFixedFrameSizeAboveFp + kFixedFrameSizeFromFp;
static constexpr int kFixedSlotCountFromFp = static constexpr int kFixedSlotCountFromFp =
kFixedFrameSizeFromFp / kPointerSize; kFixedFrameSizeFromFp / kSystemPointerSize;
static constexpr int kFixedSlotCount = kFixedFrameSize / kPointerSize; static constexpr int kFixedSlotCount = kFixedFrameSize / kSystemPointerSize;
static constexpr int kContextOffset = kContextOrFrameTypeOffset; static constexpr int kContextOffset = kContextOrFrameTypeOffset;
static constexpr int kFunctionOffset = -2 * kPointerSize - kCPSlotSize; static constexpr int kFunctionOffset = -2 * kSystemPointerSize - kCPSlotSize;
static constexpr int kExpressionsOffset = -3 * kPointerSize - kCPSlotSize; static constexpr int kExpressionsOffset =
-3 * kSystemPointerSize - kCPSlotSize;
static constexpr int kLastObjectOffset = kContextOffset; static constexpr int kLastObjectOffset = kContextOffset;
}; };
...@@ -152,10 +154,10 @@ class StandardFrameConstants : public CommonFrameConstants { ...@@ -152,10 +154,10 @@ class StandardFrameConstants : public CommonFrameConstants {
// //
class OptimizedBuiltinFrameConstants : public StandardFrameConstants { class OptimizedBuiltinFrameConstants : public StandardFrameConstants {
public: public:
static constexpr int kArgCSize = kPointerSize; static constexpr int kArgCSize = kSystemPointerSize;
static constexpr int kArgCOffset = -3 * kPointerSize - kCPSlotSize; static constexpr int kArgCOffset = -3 * kSystemPointerSize - kCPSlotSize;
static constexpr int kFixedFrameSize = kFixedFrameSizeAboveFp - kArgCOffset; static constexpr int kFixedFrameSize = kFixedFrameSizeAboveFp - kArgCOffset;
static constexpr int kFixedSlotCount = kFixedFrameSize / kPointerSize; static constexpr int kFixedSlotCount = kFixedFrameSize / kSystemPointerSize;
}; };
// TypedFrames have a SMI type maker value below the saved FP/constant pool to // TypedFrames have a SMI type maker value below the saved FP/constant pool to
...@@ -195,27 +197,28 @@ class TypedFrameConstants : public CommonFrameConstants { ...@@ -195,27 +197,28 @@ class TypedFrameConstants : public CommonFrameConstants {
static constexpr int kFrameTypeOffset = kContextOrFrameTypeOffset; static constexpr int kFrameTypeOffset = kContextOrFrameTypeOffset;
static constexpr int kFixedFrameSizeFromFp = kCPSlotSize + kFrameTypeSize; static constexpr int kFixedFrameSizeFromFp = kCPSlotSize + kFrameTypeSize;
static constexpr int kFixedSlotCountFromFp = static constexpr int kFixedSlotCountFromFp =
kFixedFrameSizeFromFp / kPointerSize; kFixedFrameSizeFromFp / kSystemPointerSize;
static constexpr int kFixedFrameSize = static constexpr int kFixedFrameSize =
StandardFrameConstants::kFixedFrameSizeAboveFp + kFixedFrameSizeFromFp; StandardFrameConstants::kFixedFrameSizeAboveFp + kFixedFrameSizeFromFp;
static constexpr int kFixedSlotCount = kFixedFrameSize / kPointerSize; static constexpr int kFixedSlotCount = kFixedFrameSize / kSystemPointerSize;
static constexpr int kFirstPushedFrameValueOffset = static constexpr int kFirstPushedFrameValueOffset =
-StandardFrameConstants::kCPSlotSize - kFrameTypeSize - kPointerSize; -StandardFrameConstants::kCPSlotSize - kFrameTypeSize -
kSystemPointerSize;
}; };
#define TYPED_FRAME_PUSHED_VALUE_OFFSET(x) \ #define TYPED_FRAME_PUSHED_VALUE_OFFSET(x) \
(TypedFrameConstants::kFirstPushedFrameValueOffset - (x)*kPointerSize) (TypedFrameConstants::kFirstPushedFrameValueOffset - (x)*kSystemPointerSize)
#define TYPED_FRAME_SIZE(count) \ #define TYPED_FRAME_SIZE(count) \
(TypedFrameConstants::kFixedFrameSize + (count)*kPointerSize) (TypedFrameConstants::kFixedFrameSize + (count)*kSystemPointerSize)
#define TYPED_FRAME_SIZE_FROM_SP(count) \ #define TYPED_FRAME_SIZE_FROM_SP(count) \
(TypedFrameConstants::kFixedFrameSizeFromFp + (count)*kPointerSize) (TypedFrameConstants::kFixedFrameSizeFromFp + (count)*kSystemPointerSize)
#define DEFINE_TYPED_FRAME_SIZES(count) \ #define DEFINE_TYPED_FRAME_SIZES(count) \
static constexpr int kFixedFrameSize = TYPED_FRAME_SIZE(count); \ static constexpr int kFixedFrameSize = TYPED_FRAME_SIZE(count); \
static constexpr int kFixedSlotCount = kFixedFrameSize / kPointerSize; \ static constexpr int kFixedSlotCount = kFixedFrameSize / kSystemPointerSize; \
static constexpr int kFixedFrameSizeFromFp = \ static constexpr int kFixedFrameSizeFromFp = \
TYPED_FRAME_SIZE_FROM_SP(count); \ TYPED_FRAME_SIZE_FROM_SP(count); \
static constexpr int kFixedSlotCountFromFp = \ static constexpr int kFixedSlotCountFromFp = \
kFixedFrameSizeFromFp / kPointerSize kFixedFrameSizeFromFp / kSystemPointerSize
class ArgumentsAdaptorFrameConstants : public TypedFrameConstants { class ArgumentsAdaptorFrameConstants : public TypedFrameConstants {
public: public:
...@@ -278,11 +281,14 @@ class BuiltinContinuationFrameConstants : public TypedFrameConstants { ...@@ -278,11 +281,14 @@ class BuiltinContinuationFrameConstants : public TypedFrameConstants {
// Behaves like an exit frame but with target and new target args. // Behaves like an exit frame but with target and new target args.
class BuiltinExitFrameConstants : public CommonFrameConstants { class BuiltinExitFrameConstants : public CommonFrameConstants {
public: public:
static constexpr int kNewTargetOffset = kCallerPCOffset + 1 * kPointerSize; static constexpr int kNewTargetOffset =
static constexpr int kTargetOffset = kNewTargetOffset + 1 * kPointerSize; kCallerPCOffset + 1 * kSystemPointerSize;
static constexpr int kArgcOffset = kTargetOffset + 1 * kPointerSize; static constexpr int kTargetOffset =
static constexpr int kPaddingOffset = kArgcOffset + 1 * kPointerSize; kNewTargetOffset + 1 * kSystemPointerSize;
static constexpr int kFirstArgumentOffset = kPaddingOffset + 1 * kPointerSize; static constexpr int kArgcOffset = kTargetOffset + 1 * kSystemPointerSize;
static constexpr int kPaddingOffset = kArgcOffset + 1 * kSystemPointerSize;
static constexpr int kFirstArgumentOffset =
kPaddingOffset + 1 * kSystemPointerSize;
static constexpr int kNumExtraArgsWithReceiver = 5; static constexpr int kNumExtraArgsWithReceiver = 5;
}; };
...@@ -290,9 +296,9 @@ class InterpreterFrameConstants : public AllStatic { ...@@ -290,9 +296,9 @@ class InterpreterFrameConstants : public AllStatic {
public: public:
// Fixed frame includes bytecode array and bytecode offset. // Fixed frame includes bytecode array and bytecode offset.
static constexpr int kFixedFrameSize = static constexpr int kFixedFrameSize =
StandardFrameConstants::kFixedFrameSize + 2 * kPointerSize; StandardFrameConstants::kFixedFrameSize + 2 * kSystemPointerSize;
static constexpr int kFixedFrameSizeFromFp = static constexpr int kFixedFrameSizeFromFp =
StandardFrameConstants::kFixedFrameSizeFromFp + 2 * kPointerSize; StandardFrameConstants::kFixedFrameSizeFromFp + 2 * kSystemPointerSize;
// FP-relative. // FP-relative.
static constexpr int kLastParamFromFp = static constexpr int kLastParamFromFp =
...@@ -300,18 +306,18 @@ class InterpreterFrameConstants : public AllStatic { ...@@ -300,18 +306,18 @@ class InterpreterFrameConstants : public AllStatic {
static constexpr int kCallerPCOffsetFromFp = static constexpr int kCallerPCOffsetFromFp =
StandardFrameConstants::kCallerPCOffset; StandardFrameConstants::kCallerPCOffset;
static constexpr int kBytecodeArrayFromFp = static constexpr int kBytecodeArrayFromFp =
-StandardFrameConstants::kFixedFrameSizeFromFp - 1 * kPointerSize; -StandardFrameConstants::kFixedFrameSizeFromFp - 1 * kSystemPointerSize;
static constexpr int kBytecodeOffsetFromFp = static constexpr int kBytecodeOffsetFromFp =
-StandardFrameConstants::kFixedFrameSizeFromFp - 2 * kPointerSize; -StandardFrameConstants::kFixedFrameSizeFromFp - 2 * kSystemPointerSize;
static constexpr int kRegisterFileFromFp = static constexpr int kRegisterFileFromFp =
-StandardFrameConstants::kFixedFrameSizeFromFp - 3 * kPointerSize; -StandardFrameConstants::kFixedFrameSizeFromFp - 3 * kSystemPointerSize;
static constexpr int kExpressionsOffset = kRegisterFileFromFp; static constexpr int kExpressionsOffset = kRegisterFileFromFp;
// Number of fixed slots in addition to a {StandardFrame}. // Number of fixed slots in addition to a {StandardFrame}.
static constexpr int kExtraSlotCount = static constexpr int kExtraSlotCount =
InterpreterFrameConstants::kFixedFrameSize / kPointerSize - InterpreterFrameConstants::kFixedFrameSize / kSystemPointerSize -
StandardFrameConstants::kFixedFrameSize / kPointerSize; StandardFrameConstants::kFixedFrameSize / kSystemPointerSize;
// Expression index for {StandardFrame::GetExpressionAddress}. // Expression index for {StandardFrame::GetExpressionAddress}.
static constexpr int kBytecodeArrayExpressionIndex = -2; static constexpr int kBytecodeArrayExpressionIndex = -2;
...@@ -326,12 +332,12 @@ class InterpreterFrameConstants : public AllStatic { ...@@ -326,12 +332,12 @@ class InterpreterFrameConstants : public AllStatic {
inline static int FPOffsetToFrameSlot(int frame_offset) { inline static int FPOffsetToFrameSlot(int frame_offset) {
return StandardFrameConstants::kFixedSlotCountAboveFp - 1 - return StandardFrameConstants::kFixedSlotCountAboveFp - 1 -
frame_offset / kPointerSize; frame_offset / kSystemPointerSize;
} }
inline static int FrameSlotToFPOffset(int slot) { inline static int FrameSlotToFPOffset(int slot) {
return (StandardFrameConstants::kFixedSlotCountAboveFp - 1 - slot) * return (StandardFrameConstants::kFixedSlotCountAboveFp - 1 - slot) *
kPointerSize; kSystemPointerSize;
} }
} // namespace internal } // namespace internal
......
...@@ -126,7 +126,7 @@ class Immediate { ...@@ -126,7 +126,7 @@ class Immediate {
friend class Assembler; friend class Assembler;
}; };
ASSERT_TRIVIALLY_COPYABLE(Immediate); ASSERT_TRIVIALLY_COPYABLE(Immediate);
static_assert(sizeof(Immediate) <= kPointerSize, static_assert(sizeof(Immediate) <= kSystemPointerSize,
"Immediate must be small enough to pass it by value"); "Immediate must be small enough to pass it by value");
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
......
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