1
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2
* vim: set ts=8 sts=4 et sw=4 tw=99:
3
* This Source Code Form is subject to the terms of the Mozilla Public
4
* License, v. 2.0. If a copy of the MPL was not distributed with this
5
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7
#ifndef jit_x86_Architecture_x86_h
8
#define jit_x86_Architecture_x86_h
10
#include "assembler/assembler/MacroAssembler.h"
14
static const ptrdiff_t STACK_SLOT_SIZE = 4;
15
static const uint32_t DOUBLE_STACK_ALIGNMENT = 2;
17
// In bytes: slots needed for potential memory->memory move spills.
20
// +8 for double spills
21
static const uint32_t ION_FRAME_SLACK_SIZE = 20;
23
// Only Win64 requires shadow stack space.
24
static const uint32_t ShadowStackSpace = 0;
26
// An offset that is illegal for a local variable's stack allocation.
27
static const int32_t INVALID_STACK_SLOT = -1;
29
// These offsets are specific to nunboxing, and capture offsets into the
30
// components of a js::Value.
31
static const int32_t NUNBOX32_TYPE_OFFSET = 4;
32
static const int32_t NUNBOX32_PAYLOAD_OFFSET = 0;
35
// These offsets are related to bailouts.
38
// Size of each bailout table entry. On x86 this is a 5-byte relative call.
39
static const uint32_t BAILOUT_TABLE_ENTRY_SIZE = 5;
43
typedef JSC::X86Registers::RegisterID Code;
45
static const char *GetName(Code code) {
46
static const char * const Names[] = { "eax", "ecx", "edx", "ebx",
47
"esp", "ebp", "esi", "edi" };
51
static const Code StackPointer = JSC::X86Registers::esp;
52
static const Code Invalid = JSC::X86Registers::invalid_reg;
54
static const uint32_t Total = 8;
55
static const uint32_t Allocatable = 7;
57
static const uint32_t AllMask = (1 << Total) - 1;
59
static const uint32_t ArgRegMask = 0;
61
static const uint32_t VolatileMask =
62
(1 << JSC::X86Registers::eax) |
63
(1 << JSC::X86Registers::ecx) |
64
(1 << JSC::X86Registers::edx);
66
static const uint32_t NonVolatileMask =
67
(1 << JSC::X86Registers::ebx) |
68
(1 << JSC::X86Registers::esi) |
69
(1 << JSC::X86Registers::edi) |
70
(1 << JSC::X86Registers::ebp);
72
static const uint32_t WrapperMask =
74
(1 << JSC::X86Registers::ebx);
76
static const uint32_t SingleByteRegs =
77
(1 << JSC::X86Registers::eax) |
78
(1 << JSC::X86Registers::ecx) |
79
(1 << JSC::X86Registers::edx) |
80
(1 << JSC::X86Registers::ebx);
82
static const uint32_t NonAllocatableMask =
83
(1 << JSC::X86Registers::esp);
85
static const uint32_t AllocatableMask = AllMask & ~NonAllocatableMask;
87
// Registers that can be allocated without being saved, generally.
88
static const uint32_t TempMask = VolatileMask & ~NonAllocatableMask;
90
// Registers returned from a JS -> JS call.
91
static const uint32_t JSCallMask =
92
(1 << JSC::X86Registers::ecx) |
93
(1 << JSC::X86Registers::edx);
95
// Registers returned from a JS -> C call.
96
static const uint32_t CallMask =
97
(1 << JSC::X86Registers::eax);
99
typedef JSC::MacroAssembler::RegisterID RegisterID;
102
// Smallest integer type that can hold a register bitmask.
103
typedef uint8_t PackedRegisterMask;
105
class FloatRegisters {
107
typedef JSC::X86Registers::XMMRegisterID Code;
109
static const char *GetName(Code code) {
110
static const char * const Names[] = { "xmm0", "xmm1", "xmm2", "xmm3",
111
"xmm4", "xmm5", "xmm6", "xmm7" };
115
static const Code Invalid = JSC::X86Registers::invalid_xmm;
117
static const uint32_t Total = 8;
118
static const uint32_t Allocatable = 7;
120
static const uint32_t AllMask = (1 << Total) - 1;
122
static const uint32_t VolatileMask = AllMask;
123
static const uint32_t NonVolatileMask = 0;
125
static const uint32_t WrapperMask = VolatileMask;
127
static const uint32_t NonAllocatableMask =
128
(1 << JSC::X86Registers::xmm7);
130
static const uint32_t AllocatableMask = AllMask & ~NonAllocatableMask;
136
#endif /* jit_x86_Architecture_x86_h */