]>
Commit | Line | Data |
---|---|---|
9b7b3ede MB |
1 | --- a/js/src/jit/RegisterSets.h 2017-02-10 17:33:06.210702431 -0800 |
2 | +++ b/js/src/jit/RegisterSets.h 2017-02-10 17:43:52.877514146 -0800 | |
3 | @@ -7,7 +7,6 @@ | |
4 | #ifndef jit_RegisterSets_h | |
5 | #define jit_RegisterSets_h | |
6 | ||
7 | -#include "mozilla/Alignment.h" | |
8 | #include "mozilla/MathAlgorithms.h" | |
9 | ||
10 | #include "jit/JitAllocPolicy.h" | |
11 | @@ -26,8 +25,8 @@ | |
12 | Code code_; | |
13 | ||
14 | public: | |
15 | - AnyRegister() | |
16 | - { } | |
17 | + AnyRegister() = default; | |
18 | + | |
19 | explicit AnyRegister(Register gpr) { | |
20 | code_ = gpr.code(); | |
21 | } | |
22 | @@ -156,7 +155,7 @@ | |
23 | } | |
24 | #endif | |
25 | ||
26 | - ValueOperand() {} | |
27 | + ValueOperand() = default; | |
28 | }; | |
29 | ||
30 | // Registers to hold either either a typed or untyped value. | |
31 | @@ -165,46 +164,25 @@ | |
32 | // Type of value being stored. | |
33 | MIRType type_; | |
34 | ||
35 | - // Space to hold either an AnyRegister or a ValueOperand. | |
36 | union U { | |
37 | - mozilla::AlignedStorage2<AnyRegister> typed; | |
38 | - mozilla::AlignedStorage2<ValueOperand> value; | |
39 | + AnyRegister typed; | |
40 | + ValueOperand value; | |
41 | } data; | |
42 | ||
43 | - AnyRegister& dataTyped() { | |
44 | - MOZ_ASSERT(hasTyped()); | |
45 | - return *data.typed.addr(); | |
46 | - } | |
47 | - ValueOperand& dataValue() { | |
48 | - MOZ_ASSERT(hasValue()); | |
49 | - return *data.value.addr(); | |
50 | - } | |
51 | - | |
52 | - AnyRegister dataTyped() const { | |
53 | - MOZ_ASSERT(hasTyped()); | |
54 | - return *data.typed.addr(); | |
55 | - } | |
56 | - const ValueOperand& dataValue() const { | |
57 | - MOZ_ASSERT(hasValue()); | |
58 | - return *data.value.addr(); | |
59 | - } | |
60 | - | |
61 | public: | |
62 | ||
63 | - TypedOrValueRegister() | |
64 | - : type_(MIRType_None) | |
65 | - {} | |
66 | + TypedOrValueRegister() = default; | |
67 | ||
68 | TypedOrValueRegister(MIRType type, AnyRegister reg) | |
69 | : type_(type) | |
70 | { | |
71 | - dataTyped() = reg; | |
72 | + data.typed = reg; | |
73 | } | |
74 | ||
75 | MOZ_IMPLICIT TypedOrValueRegister(ValueOperand value) | |
76 | : type_(MIRType_Value) | |
77 | { | |
78 | - dataValue() = value; | |
79 | + data.value = value; | |
80 | } | |
81 | ||
82 | MIRType type() const { | |
83 | @@ -220,11 +198,13 @@ | |
84 | } | |
85 | ||
86 | AnyRegister typedReg() const { | |
87 | - return dataTyped(); | |
88 | + MOZ_ASSERT(hasTyped()); | |
89 | + return data.typed; | |
90 | } | |
91 | ||
92 | ValueOperand valueReg() const { | |
93 | - return dataValue(); | |
94 | + MOZ_ASSERT(hasValue()); | |
95 | + return data.value; | |
96 | } | |
97 | ||
98 | AnyRegister scratchReg() { | |
99 | @@ -240,19 +220,18 @@ | |
100 | // Whether a constant value is being stored. | |
101 | bool constant_; | |
102 | ||
103 | - // Space to hold either a Value or a TypedOrValueRegister. | |
104 | union U { | |
105 | - mozilla::AlignedStorage2<Value> constant; | |
106 | - mozilla::AlignedStorage2<TypedOrValueRegister> reg; | |
107 | + Value constant; | |
108 | + TypedOrValueRegister reg; | |
109 | } data; | |
110 | ||
111 | Value& dataValue() { | |
112 | MOZ_ASSERT(constant()); | |
113 | - return *data.constant.addr(); | |
114 | + return data.constant; | |
115 | } | |
116 | TypedOrValueRegister& dataReg() { | |
117 | MOZ_ASSERT(!constant()); | |
118 | - return *data.reg.addr(); | |
119 | + return data.reg; | |
120 | } | |
121 | ||
122 | public: |