Home | History | Annotate | Download | only in x64
      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_FRAMES_X64_H_
      6 #define V8_X64_FRAMES_X64_H_
      7 
      8 namespace v8 {
      9 namespace internal {
     10 
     11 const int kNumRegs = 16;
     12 const RegList kJSCallerSaved =
     13     1 << 0 |  // rax
     14     1 << 1 |  // rcx
     15     1 << 2 |  // rdx
     16     1 << 3 |  // rbx - used as a caller-saved register in JavaScript code
     17     1 << 7;   // rdi - callee function
     18 
     19 const int kNumJSCallerSaved = 5;
     20 
     21 // Number of registers for which space is reserved in safepoints.
     22 const int kNumSafepointRegisters = 16;
     23 
     24 // ----------------------------------------------------
     25 
     26 class EntryFrameConstants : public AllStatic {
     27  public:
     28 #ifdef _WIN64
     29   static const int kCalleeSaveXMMRegisters = 10;
     30   static const int kXMMRegisterSize = 16;
     31   static const int kXMMRegistersBlockSize =
     32       kXMMRegisterSize * kCalleeSaveXMMRegisters;
     33   static const int kCallerFPOffset =
     34       -3 * kPointerSize + -7 * kRegisterSize - kXMMRegistersBlockSize;
     35 #else
     36   // We have 3 Push and 5 pushq in the JSEntryStub::GenerateBody.
     37   static const int kCallerFPOffset = -3 * kPointerSize + -5 * kRegisterSize;
     38 #endif
     39   static const int kArgvOffset     = 6 * kPointerSize;
     40 };
     41 
     42 
     43 class ExitFrameConstants : public AllStatic {
     44  public:
     45   static const int kFrameSize       = 2 * kPointerSize;
     46 
     47   static const int kCodeOffset      = -2 * kPointerSize;
     48   static const int kSPOffset        = -1 * kPointerSize;
     49 
     50   static const int kCallerFPOffset  = +0 * kPointerSize;
     51   static const int kCallerPCOffset  = kFPOnStackSize;
     52 
     53   // FP-relative displacement of the caller's SP.  It points just
     54   // below the saved PC.
     55   static const int kCallerSPDisplacement = kCallerPCOffset + kPCOnStackSize;
     56 
     57   static const int kConstantPoolOffset   = 0;  // Not used
     58 };
     59 
     60 
     61 class JavaScriptFrameConstants : public AllStatic {
     62  public:
     63   // FP-relative.
     64   static const int kLocal0Offset = StandardFrameConstants::kExpressionsOffset;
     65   static const int kLastParameterOffset = kFPOnStackSize + kPCOnStackSize;
     66   static const int kFunctionOffset = StandardFrameConstants::kMarkerOffset;
     67 
     68   // Caller SP-relative.
     69   static const int kParam0Offset   = -2 * kPointerSize;
     70   static const int kReceiverOffset = -1 * kPointerSize;
     71 };
     72 
     73 
     74 }  // namespace internal
     75 }  // namespace v8
     76 
     77 #endif  // V8_X64_FRAMES_X64_H_
     78