1 // Copyright 2013 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_ARM64_FRAME_CONSTANTS_ARM64_H_ 6 #define V8_ARM64_FRAME_CONSTANTS_ARM64_H_ 7 8 #include "src/base/macros.h" 9 #include "src/frame-constants.h" 10 #include "src/globals.h" 11 12 namespace v8 { 13 namespace internal { 14 15 // The layout of an EntryFrame is as follows: 16 // 17 // slot Entry frame 18 // +---------------------+----------------------- 19 // 0 | bad frame pointer | <-- frame ptr 20 // | (0xFFF.. FF) | 21 // |- - - - - - - - - - -| 22 // 1 | stack frame marker | 23 // | (ENTRY) | 24 // |- - - - - - - - - - -| 25 // 2 | stack frame marker | 26 // | (0) | 27 // |- - - - - - - - - - -| 28 // 3 | C entry FP | 29 // |- - - - - - - - - - -| 30 // 4 | JS entry frame | 31 // | marker | 32 // |- - - - - - - - - - -| 33 // 5 | padding | <-- stack ptr 34 // -----+---------------------+----------------------- 35 // 36 class EntryFrameConstants : public AllStatic { 37 public: 38 static constexpr int kCallerFPOffset = -3 * kPointerSize; 39 static constexpr int kFixedFrameSize = 6 * kPointerSize; 40 }; 41 42 class ExitFrameConstants : public TypedFrameConstants { 43 public: 44 static constexpr int kSPOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(0); 45 static constexpr int kCodeOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(1); 46 static constexpr int kPaddingOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(2); 47 DEFINE_TYPED_FRAME_SIZES(3); 48 static constexpr int kLastExitFrameField = kPaddingOffset; 49 50 static constexpr int kConstantPoolOffset = 0; // Not used 51 }; 52 53 class WasmCompileLazyFrameConstants : public TypedFrameConstants { 54 public: 55 static constexpr int kNumberOfSavedGpParamRegs = 8; 56 static constexpr int kNumberOfSavedFpParamRegs = 8; 57 58 // FP-relative. 59 static constexpr int kWasmInstanceOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(1); 60 static constexpr int kFixedFrameSizeFromFp = 61 // Header is padded to 16 byte (see {MacroAssembler::EnterFrame}). 62 RoundUp<16>(TypedFrameConstants::kFixedFrameSizeFromFp) + 63 kNumberOfSavedGpParamRegs * kPointerSize + 64 kNumberOfSavedFpParamRegs * kDoubleSize; 65 }; 66 67 class JavaScriptFrameConstants : public AllStatic { 68 public: 69 // FP-relative. 70 static constexpr int kLocal0Offset = 71 StandardFrameConstants::kExpressionsOffset; 72 73 // There are two words on the stack (saved fp and saved lr) between fp and 74 // the arguments. 75 static constexpr int kLastParameterOffset = 2 * kPointerSize; 76 77 static constexpr int kFunctionOffset = 78 StandardFrameConstants::kFunctionOffset; 79 }; 80 81 } // namespace internal 82 } // namespace v8 83 84 #endif // V8_ARM64_FRAME_CONSTANTS_ARM64_H_ 85