frames-ia32.h 2.27 KB
Newer Older
1
// Copyright 2012 the V8 project authors. All rights reserved.
2 3
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
4

5 6
#ifndef V8_IA32_FRAMES_IA32_H_
#define V8_IA32_FRAMES_IA32_H_
7

8 9
namespace v8 {
namespace internal {
10 11 12 13


// Register lists
// Note that the bit values must match those used in actual instruction encoding
14
const int kNumRegs = 8;
15 16 17


// Caller-saved registers
18
const RegList kJSCallerSaved =
19 20 21 22 23 24
  1 << 0 |  // eax
  1 << 1 |  // ecx
  1 << 2 |  // edx
  1 << 3 |  // ebx - used as a caller-saved register in JavaScript code
  1 << 7;   // edi - callee function

25
const int kNumJSCallerSaved = 5;
26

27 28

// Number of registers for which space is reserved in safepoints.
29
const int kNumSafepointRegisters = 8;
30

31 32 33 34 35 36 37
// ----------------------------------------------------


class EntryFrameConstants : public AllStatic {
 public:
  static const int kCallerFPOffset      = -6 * kPointerSize;

38
  static const int kNewTargetArgOffset  = +2 * kPointerSize;
39 40 41 42 43 44
  static const int kFunctionArgOffset   = +3 * kPointerSize;
  static const int kReceiverArgOffset   = +4 * kPointerSize;
  static const int kArgcOffset          = +5 * kPointerSize;
  static const int kArgvOffset          = +6 * kPointerSize;
};

45
class ExitFrameConstants : public TypedFrameConstants {
46
 public:
47 48 49
  static const int kSPOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(0);
  static const int kCodeOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(1);
  DEFINE_TYPED_FRAME_SIZES(2);
50 51 52

  static const int kCallerFPOffset =  0 * kPointerSize;
  static const int kCallerPCOffset = +1 * kPointerSize;
53 54 55 56

  // FP-relative displacement of the caller's SP.  It points just
  // below the saved PC.
  static const int kCallerSPDisplacement = +2 * kPointerSize;
57 58

  static const int kConstantPoolOffset   = 0;  // Not used
59 60 61 62 63 64 65
};


class JavaScriptFrameConstants : public AllStatic {
 public:
  // FP-relative.
  static const int kLocal0Offset = StandardFrameConstants::kExpressionsOffset;
66
  static const int kLastParameterOffset = +2 * kPointerSize;
67
  static const int kFunctionOffset = StandardFrameConstants::kFunctionOffset;
68

69
  // Caller SP-relative.
70 71 72 73 74
  static const int kParam0Offset   = -2 * kPointerSize;
  static const int kReceiverOffset = -1 * kPointerSize;
};


75 76
}  // namespace internal
}  // namespace v8
77

78
#endif  // V8_IA32_FRAMES_IA32_H_