~ubuntu-branches/ubuntu/trusty/mozjs24/trusty-proposed

« back to all changes in this revision

Viewing changes to js/src/jit/x86/Architecture-x86.h

  • Committer: Package Import Robot
  • Author(s): Tim Lunn
  • Date: 2014-02-11 21:55:34 UTC
  • Revision ID: package-import@ubuntu.com-20140211215534-m1zyq5aj59md3y07
Tags: upstream-24.2.0
ImportĀ upstreamĀ versionĀ 24.2.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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/. */
 
6
 
 
7
#ifndef jit_x86_Architecture_x86_h
 
8
#define jit_x86_Architecture_x86_h
 
9
 
 
10
#include "assembler/assembler/MacroAssembler.h"
 
11
 
 
12
namespace js {
 
13
namespace jit {
 
14
static const ptrdiff_t STACK_SLOT_SIZE       = 4;
 
15
static const uint32_t DOUBLE_STACK_ALIGNMENT   = 2;
 
16
 
 
17
// In bytes: slots needed for potential memory->memory move spills.
 
18
//   +8 for cycles
 
19
//   +4 for gpr spills
 
20
//   +8 for double spills
 
21
static const uint32_t ION_FRAME_SLACK_SIZE    = 20;
 
22
 
 
23
// Only Win64 requires shadow stack space.
 
24
static const uint32_t ShadowStackSpace = 0;
 
25
 
 
26
// An offset that is illegal for a local variable's stack allocation.
 
27
static const int32_t INVALID_STACK_SLOT       = -1;
 
28
 
 
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;
 
33
 
 
34
////
 
35
// These offsets are related to bailouts.
 
36
////
 
37
 
 
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;
 
40
 
 
41
class Registers {
 
42
  public:
 
43
    typedef JSC::X86Registers::RegisterID Code;
 
44
 
 
45
    static const char *GetName(Code code) {
 
46
        static const char * const Names[] = { "eax", "ecx", "edx", "ebx",
 
47
                                              "esp", "ebp", "esi", "edi" };
 
48
        return Names[code];
 
49
    }
 
50
 
 
51
    static const Code StackPointer = JSC::X86Registers::esp;
 
52
    static const Code Invalid = JSC::X86Registers::invalid_reg;
 
53
 
 
54
    static const uint32_t Total = 8;
 
55
    static const uint32_t Allocatable = 7;
 
56
 
 
57
    static const uint32_t AllMask = (1 << Total) - 1;
 
58
 
 
59
    static const uint32_t ArgRegMask = 0;
 
60
 
 
61
    static const uint32_t VolatileMask =
 
62
        (1 << JSC::X86Registers::eax) |
 
63
        (1 << JSC::X86Registers::ecx) |
 
64
        (1 << JSC::X86Registers::edx);
 
65
 
 
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);
 
71
 
 
72
    static const uint32_t WrapperMask =
 
73
        VolatileMask |
 
74
        (1 << JSC::X86Registers::ebx);
 
75
 
 
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);
 
81
 
 
82
    static const uint32_t NonAllocatableMask =
 
83
        (1 << JSC::X86Registers::esp);
 
84
 
 
85
    static const uint32_t AllocatableMask = AllMask & ~NonAllocatableMask;
 
86
 
 
87
    // Registers that can be allocated without being saved, generally.
 
88
    static const uint32_t TempMask = VolatileMask & ~NonAllocatableMask;
 
89
 
 
90
    // Registers returned from a JS -> JS call.
 
91
    static const uint32_t JSCallMask =
 
92
        (1 << JSC::X86Registers::ecx) |
 
93
        (1 << JSC::X86Registers::edx);
 
94
 
 
95
    // Registers returned from a JS -> C call.
 
96
    static const uint32_t CallMask =
 
97
        (1 << JSC::X86Registers::eax);
 
98
 
 
99
    typedef JSC::MacroAssembler::RegisterID RegisterID;
 
100
};
 
101
 
 
102
// Smallest integer type that can hold a register bitmask.
 
103
typedef uint8_t PackedRegisterMask;
 
104
 
 
105
class FloatRegisters {
 
106
  public:
 
107
    typedef JSC::X86Registers::XMMRegisterID Code;
 
108
 
 
109
    static const char *GetName(Code code) {
 
110
        static const char * const Names[] = { "xmm0", "xmm1", "xmm2", "xmm3",
 
111
                                              "xmm4", "xmm5", "xmm6", "xmm7" };
 
112
        return Names[code];
 
113
    }
 
114
 
 
115
    static const Code Invalid = JSC::X86Registers::invalid_xmm;
 
116
 
 
117
    static const uint32_t Total = 8;
 
118
    static const uint32_t Allocatable = 7;
 
119
 
 
120
    static const uint32_t AllMask = (1 << Total) - 1;
 
121
 
 
122
    static const uint32_t VolatileMask = AllMask;
 
123
    static const uint32_t NonVolatileMask = 0;
 
124
 
 
125
    static const uint32_t WrapperMask = VolatileMask;
 
126
 
 
127
    static const uint32_t NonAllocatableMask =
 
128
        (1 << JSC::X86Registers::xmm7);
 
129
 
 
130
    static const uint32_t AllocatableMask = AllMask & ~NonAllocatableMask;
 
131
};
 
132
 
 
133
} // namespace jit
 
134
} // namespace js
 
135
 
 
136
#endif /* jit_x86_Architecture_x86_h */