1b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch// Copyright 2012 the V8 project authors. All rights reserved.
2b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch// Use of this source code is governed by a BSD-style license that can be
3b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch// found in the LICENSE file.
4b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch
5b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch#ifndef V8_X87_FRAMES_X87_H_
6b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch#define V8_X87_FRAMES_X87_H_
7b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch
8b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdochnamespace v8 {
9b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdochnamespace internal {
10b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch
11b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch
12b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch// Register lists
13b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch// Note that the bit values must match those used in actual instruction encoding
14b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdochconst int kNumRegs = 8;
15b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch
16b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch
17b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch// Caller-saved registers
18b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdochconst RegList kJSCallerSaved =
19b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  1 << 0 |  // eax
20b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  1 << 1 |  // ecx
21b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  1 << 2 |  // edx
22b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  1 << 3 |  // ebx - used as a caller-saved register in JavaScript code
23b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  1 << 7;   // edi - callee function
24b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch
25b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdochconst int kNumJSCallerSaved = 5;
26b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch
27b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch
28b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch// Number of registers for which space is reserved in safepoints.
29b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdochconst int kNumSafepointRegisters = 8;
30b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch
31b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch// ----------------------------------------------------
32b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch
33b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch
34b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdochclass EntryFrameConstants : public AllStatic {
35b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch public:
36b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  static const int kCallerFPOffset      = -6 * kPointerSize;
37b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch
38014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch  static const int kNewTargetArgOffset = +2 * kPointerSize;
39b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  static const int kFunctionArgOffset   = +3 * kPointerSize;
40b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  static const int kReceiverArgOffset   = +4 * kPointerSize;
41b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  static const int kArgcOffset          = +5 * kPointerSize;
42b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  static const int kArgvOffset          = +6 * kPointerSize;
43b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch};
44b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch
451b268ca467c924004286c97bac133db489cf43d0Ben Murdochclass ExitFrameConstants : public TypedFrameConstants {
46b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch public:
471b268ca467c924004286c97bac133db489cf43d0Ben Murdoch  static const int kSPOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(0);
481b268ca467c924004286c97bac133db489cf43d0Ben Murdoch  static const int kCodeOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(1);
491b268ca467c924004286c97bac133db489cf43d0Ben Murdoch  DEFINE_TYPED_FRAME_SIZES(2);
50b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch
51b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  static const int kCallerFPOffset =  0 * kPointerSize;
52b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  static const int kCallerPCOffset = +1 * kPointerSize;
53b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch
54b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  // FP-relative displacement of the caller's SP.  It points just
55b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  // below the saved PC.
56b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  static const int kCallerSPDisplacement = +2 * kPointerSize;
57b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch
58b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  static const int kConstantPoolOffset   = 0;  // Not used
59b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch};
60b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch
61b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch
62b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdochclass JavaScriptFrameConstants : public AllStatic {
63b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch public:
64b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  // FP-relative.
65b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  static const int kLocal0Offset = StandardFrameConstants::kExpressionsOffset;
66b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  static const int kLastParameterOffset = +2 * kPointerSize;
671b268ca467c924004286c97bac133db489cf43d0Ben Murdoch  static const int kFunctionOffset = StandardFrameConstants::kFunctionOffset;
68b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch
69b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  // Caller SP-relative.
70b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  static const int kParam0Offset   = -2 * kPointerSize;
71b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch  static const int kReceiverOffset = -1 * kPointerSize;
72b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch};
73b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch
74b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch
75014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch}  // namespace internal
76014dc512cdd3e367bee49a713fdc5ed92584a3e5Ben Murdoch}  // namespace v8
77b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch
78b8a8cc1952d61a2f3a2568848933943a543b5d3eBen Murdoch#endif  // V8_X87_FRAMES_X87_H_
79