blob: 1a378ed3ecc1f1643a8829f8d52ce564fada78ea [file] [log] [blame]
Ben Murdochb8a8cc12014-11-26 15:28:44 +00001// 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_X87_FRAMES_X87_H_
6#define V8_X87_FRAMES_X87_H_
7
8namespace v8 {
9namespace internal {
10
11
12// Register lists
13// Note that the bit values must match those used in actual instruction encoding
14const int kNumRegs = 8;
15
16
17// Caller-saved registers
18const RegList kJSCallerSaved =
19 1 << 0 | // eax
20 1 << 1 | // ecx
21 1 << 2 | // edx
22 1 << 3 | // ebx - used as a caller-saved register in JavaScript code
23 1 << 7; // edi - callee function
24
25const int kNumJSCallerSaved = 5;
26
27
28// Number of registers for which space is reserved in safepoints.
29const int kNumSafepointRegisters = 8;
30
Ben Murdochb8a8cc12014-11-26 15:28:44 +000031// ----------------------------------------------------
32
33
34class EntryFrameConstants : public AllStatic {
35 public:
36 static const int kCallerFPOffset = -6 * kPointerSize;
37
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000038 static const int kNewTargetArgOffset = +2 * kPointerSize;
Ben Murdochb8a8cc12014-11-26 15:28:44 +000039 static const int kFunctionArgOffset = +3 * kPointerSize;
40 static const int kReceiverArgOffset = +4 * kPointerSize;
41 static const int kArgcOffset = +5 * kPointerSize;
42 static const int kArgvOffset = +6 * kPointerSize;
43};
44
Ben Murdochda12d292016-06-02 14:46:10 +010045class ExitFrameConstants : public TypedFrameConstants {
Ben Murdochb8a8cc12014-11-26 15:28:44 +000046 public:
Ben Murdochda12d292016-06-02 14:46:10 +010047 static const int kSPOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(0);
48 static const int kCodeOffset = TYPED_FRAME_PUSHED_VALUE_OFFSET(1);
49 DEFINE_TYPED_FRAME_SIZES(2);
Ben Murdochb8a8cc12014-11-26 15:28:44 +000050
51 static const int kCallerFPOffset = 0 * kPointerSize;
52 static const int kCallerPCOffset = +1 * kPointerSize;
53
54 // FP-relative displacement of the caller's SP. It points just
55 // below the saved PC.
56 static const int kCallerSPDisplacement = +2 * kPointerSize;
57
58 static const int kConstantPoolOffset = 0; // Not used
59};
60
61
62class JavaScriptFrameConstants : public AllStatic {
63 public:
64 // FP-relative.
65 static const int kLocal0Offset = StandardFrameConstants::kExpressionsOffset;
66 static const int kLastParameterOffset = +2 * kPointerSize;
Ben Murdochda12d292016-06-02 14:46:10 +010067 static const int kFunctionOffset = StandardFrameConstants::kFunctionOffset;
Ben Murdochb8a8cc12014-11-26 15:28:44 +000068
69 // Caller SP-relative.
70 static const int kParam0Offset = -2 * kPointerSize;
71 static const int kReceiverOffset = -1 * kPointerSize;
Ben Murdochb8a8cc12014-11-26 15:28:44 +000072};
73
74
Ben Murdoch4a90d5f2016-03-22 12:00:34 +000075} // namespace internal
76} // namespace v8
Ben Murdochb8a8cc12014-11-26 15:28:44 +000077
78#endif // V8_X87_FRAMES_X87_H_