1 // Copyright 2012 the V8 project authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef V8_X64_FRAME_CONSTANTS_X64_H_ 6 #define V8_X64_FRAME_CONSTANTS_X64_H_ 7 8 #include "src/base/macros.h" 9 #include "src/frame-constants.h" 10 11 namespace v8 { 12 namespace internal { 13 14 class EntryFrameConstants : public AllStatic { 15 public: 16 #ifdef _WIN64 17 static constexpr int kCalleeSaveXMMRegisters = 10; 18 static constexpr int kXMMRegisterSize = 16; 19 static constexpr int kXMMRegistersBlockSize = 20 kXMMRegisterSize * kCalleeSaveXMMRegisters; 21 static constexpr int kCallerFPOffset = 22 -3 * kPointerSize + -7 * kRegisterSize - kXMMRegistersBlockSize; 23 #else 24 // We have 3 Push and 5 pushq in the JSEntryStub::GenerateBody. 25 static constexpr int kCallerFPOffset = -3 * kPointerSize + -5 * kRegisterSize; 26 #endif 27 static constexpr int kArgvOffset = 6 * kPointerSize; 28 }; 29 30 class ExitFrameConstants : public TypedFrameConstants { 31 public: 32 static constexpr int kSPOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(0); 33 static constexpr int kCodeOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(1); 34 DEFINE_TYPED_FRAME_SIZES(2); 35 36 static constexpr int kCallerFPOffset = +0 * kPointerSize; 37 static constexpr int kCallerPCOffset = kFPOnStackSize; 38 39 // FP-relative displacement of the caller's SP. It points just 40 // below the saved PC. 41 static constexpr int kCallerSPDisplacement = kCallerPCOffset + kPCOnStackSize; 42 43 static constexpr int kConstantPoolOffset = 0; // Not used 44 }; 45 46 class WasmCompileLazyFrameConstants : public TypedFrameConstants { 47 public: 48 static constexpr int kNumberOfSavedGpParamRegs = 6; 49 static constexpr int kNumberOfSavedFpParamRegs = 6; 50 51 // FP-relative. 52 static constexpr int kWasmInstanceOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(0); 53 static constexpr int kFixedFrameSizeFromFp = 54 TypedFrameConstants::kFixedFrameSizeFromFp + 55 kNumberOfSavedGpParamRegs * kPointerSize + 56 kNumberOfSavedFpParamRegs * kSimd128Size; 57 }; 58 59 class JavaScriptFrameConstants : public AllStatic { 60 public: 61 // FP-relative. 62 static constexpr int kLocal0Offset = 63 StandardFrameConstants::kExpressionsOffset; 64 static constexpr int kLastParameterOffset = kFPOnStackSize + kPCOnStackSize; 65 static constexpr int kFunctionOffset = 66 StandardFrameConstants::kFunctionOffset; 67 68 // Caller SP-relative. 69 static constexpr int kParam0Offset = -2 * kPointerSize; 70 static constexpr int kReceiverOffset = -1 * kPointerSize; 71 }; 72 73 } // namespace internal 74 } // namespace v8 75 76 #endif // V8_X64_FRAME_CONSTANTS_X64_H_ 77