OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_CCTEST_COMPILER_VALUE_HELPER_H_ | 5 #ifndef V8_CCTEST_COMPILER_VALUE_HELPER_H_ |
6 #define V8_CCTEST_COMPILER_VALUE_HELPER_H_ | 6 #define V8_CCTEST_COMPILER_VALUE_HELPER_H_ |
7 | 7 |
8 #include "src/v8.h" | 8 #include "src/v8.h" |
9 | 9 |
10 #include "src/compiler/common-operator.h" | 10 #include "src/compiler/common-operator.h" |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 0x273a798e, 0x187937a3, 0xece3af83, 0x5495a16b, 0x0b668ecc, 0x11223344, | 124 0x273a798e, 0x187937a3, 0xece3af83, 0x5495a16b, 0x0b668ecc, 0x11223344, |
125 0x0000009e, 0x00000043, 0x0000af73, 0x0000116b, 0x00658ecc, 0x002b3b4c, | 125 0x0000009e, 0x00000043, 0x0000af73, 0x0000116b, 0x00658ecc, 0x002b3b4c, |
126 0x88776655, 0x70000000, 0x07200000, 0x7fffffff, 0x56123761, 0x7fffff00, | 126 0x88776655, 0x70000000, 0x07200000, 0x7fffffff, 0x56123761, 0x7fffff00, |
127 0x761c4761, 0x80000000, 0x88888888, 0xa0000000, 0xdddddddd, 0xe0000000, | 127 0x761c4761, 0x80000000, 0x88888888, 0xa0000000, 0xdddddddd, 0xe0000000, |
128 0xeeeeeeee, 0xfffffffd, 0xf0000000, 0x007fffff, 0x003fffff, 0x001fffff, | 128 0xeeeeeeee, 0xfffffffd, 0xf0000000, 0x007fffff, 0x003fffff, 0x001fffff, |
129 0x000fffff, 0x0007ffff, 0x0003ffff, 0x0001ffff, 0x0000ffff, 0x00007fff, | 129 0x000fffff, 0x0007ffff, 0x0003ffff, 0x0001ffff, 0x0000ffff, 0x00007fff, |
130 0x00003fff, 0x00001fff, 0x00000fff, 0x000007ff, 0x000003ff, 0x000001ff}; | 130 0x00003fff, 0x00001fff, 0x00000fff, 0x000007ff, 0x000003ff, 0x000001ff}; |
131 return std::vector<uint32_t>(&kValues[0], &kValues[arraysize(kValues)]); | 131 return std::vector<uint32_t>(&kValues[0], &kValues[arraysize(kValues)]); |
132 } | 132 } |
133 | 133 |
| 134 static const std::vector<int64_t> int64_vector() { |
| 135 std::vector<uint64_t> values = uint64_vector(); |
| 136 return std::vector<int64_t>(values.begin(), values.end()); |
| 137 } |
| 138 |
| 139 static const std::vector<uint64_t> uint64_vector() { |
| 140 static const uint64_t kValues[] = { |
| 141 0x00000000, 0x00000001, 0xffffffff, |
| 142 0x1b09788b, 0x04c5fce8, 0xcc0de5bf, |
| 143 0x00000002, 0x00000003, 0x00000004, |
| 144 0x00000005, 0x00000008, 0x00000009, |
| 145 0xffffffffffffffff, 0xfffffffffffffffe, 0xfffffffffffffffd, |
| 146 0x0000000000000000, 0x0000000100000000, 0xffffffff00000000, |
| 147 0x1b09788b00000000, 0x04c5fce800000000, 0xcc0de5bf00000000, |
| 148 0x0000000200000000, 0x0000000300000000, 0x0000000400000000, |
| 149 0x0000000500000000, 0x0000000800000000, 0x0000000900000000, |
| 150 0x273a798e187937a3, 0xece3af835495a16b, 0x0b668ecc11223344, |
| 151 0x0000009e, 0x00000043, 0x0000af73, |
| 152 0x0000116b, 0x00658ecc, 0x002b3b4c, |
| 153 0x88776655, 0x70000000, 0x07200000, |
| 154 0x7fffffff, 0x56123761, 0x7fffff00, |
| 155 0x761c4761eeeeeeee, 0x80000000eeeeeeee, 0x88888888dddddddd, |
| 156 0xa0000000dddddddd, 0xddddddddaaaaaaaa, 0xe0000000aaaaaaaa, |
| 157 0xeeeeeeeeeeeeeeee, 0xfffffffdeeeeeeee, 0xf0000000dddddddd, |
| 158 0x007fffffdddddddd, 0x003fffffaaaaaaaa, 0x001fffffaaaaaaaa, |
| 159 0x000fffff, 0x0007ffff, 0x0003ffff, |
| 160 0x0001ffff, 0x0000ffff, 0x00007fff, |
| 161 0x00003fff, 0x00001fff, 0x00000fff, |
| 162 0x000007ff, 0x000003ff, 0x000001ff, |
| 163 0x00003fffffffffff, 0x00001fffffffffff, 0x00000fffffffffff, |
| 164 0x000007ffffffffff, 0x000003ffffffffff, 0x000001ffffffffff}; |
| 165 return std::vector<uint64_t>(&kValues[0], &kValues[arraysize(kValues)]); |
| 166 } |
| 167 |
134 static const std::vector<double> nan_vector(size_t limit = 0) { | 168 static const std::vector<double> nan_vector(size_t limit = 0) { |
135 static const double nan = std::numeric_limits<double>::quiet_NaN(); | 169 static const double nan = std::numeric_limits<double>::quiet_NaN(); |
136 static const double values[] = {-nan, -V8_INFINITY * -0.0, | 170 static const double values[] = {-nan, -V8_INFINITY * -0.0, |
137 -V8_INFINITY * 0.0, V8_INFINITY * -0.0, | 171 -V8_INFINITY * 0.0, V8_INFINITY * -0.0, |
138 V8_INFINITY * 0.0, nan}; | 172 V8_INFINITY * 0.0, nan}; |
139 return std::vector<double>(&values[0], &values[arraysize(values)]); | 173 return std::vector<double>(&values[0], &values[arraysize(values)]); |
140 } | 174 } |
141 | 175 |
142 static const std::vector<uint32_t> ror_vector() { | 176 static const std::vector<uint32_t> ror_vector() { |
143 static const uint32_t kValues[31] = { | 177 static const uint32_t kValues[31] = { |
144 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, | 178 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, |
145 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31}; | 179 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31}; |
146 return std::vector<uint32_t>(&kValues[0], &kValues[arraysize(kValues)]); | 180 return std::vector<uint32_t>(&kValues[0], &kValues[arraysize(kValues)]); |
147 } | 181 } |
148 }; | 182 }; |
149 | 183 |
150 // Helper macros that can be used in FOR_INT32_INPUTS(i) { ... *i ... } | 184 // Helper macros that can be used in FOR_INT32_INPUTS(i) { ... *i ... } |
151 // Watch out, these macros aren't hygenic; they pollute your scope. Thanks STL. | 185 // Watch out, these macros aren't hygenic; they pollute your scope. Thanks STL. |
152 #define FOR_INPUTS(ctype, itype, var) \ | 186 #define FOR_INPUTS(ctype, itype, var) \ |
153 std::vector<ctype> var##_vec = ValueHelper::itype##_vector(); \ | 187 std::vector<ctype> var##_vec = ValueHelper::itype##_vector(); \ |
154 for (std::vector<ctype>::iterator var = var##_vec.begin(); \ | 188 for (std::vector<ctype>::iterator var = var##_vec.begin(); \ |
155 var != var##_vec.end(); ++var) | 189 var != var##_vec.end(); ++var) |
156 | 190 |
157 #define FOR_INT32_INPUTS(var) FOR_INPUTS(int32_t, int32, var) | 191 #define FOR_INT32_INPUTS(var) FOR_INPUTS(int32_t, int32, var) |
158 #define FOR_UINT32_INPUTS(var) FOR_INPUTS(uint32_t, uint32, var) | 192 #define FOR_UINT32_INPUTS(var) FOR_INPUTS(uint32_t, uint32, var) |
| 193 #define FOR_INT64_INPUTS(var) FOR_INPUTS(int64_t, int64, var) |
| 194 #define FOR_UINT64_INPUTS(var) FOR_INPUTS(uint64_t, uint64, var) |
159 #define FOR_FLOAT32_INPUTS(var) FOR_INPUTS(float, float32, var) | 195 #define FOR_FLOAT32_INPUTS(var) FOR_INPUTS(float, float32, var) |
160 #define FOR_FLOAT64_INPUTS(var) FOR_INPUTS(double, float64, var) | 196 #define FOR_FLOAT64_INPUTS(var) FOR_INPUTS(double, float64, var) |
161 | 197 |
162 #define FOR_INT32_SHIFTS(var) for (int32_t var = 0; var < 32; var++) | 198 #define FOR_INT32_SHIFTS(var) for (int32_t var = 0; var < 32; var++) |
163 | 199 |
164 #define FOR_UINT32_SHIFTS(var) for (uint32_t var = 0; var < 32; var++) | 200 #define FOR_UINT32_SHIFTS(var) for (uint32_t var = 0; var < 32; var++) |
165 | 201 |
166 } // namespace compiler | 202 } // namespace compiler |
167 } // namespace internal | 203 } // namespace internal |
168 } // namespace v8 | 204 } // namespace v8 |
169 | 205 |
170 #endif // V8_CCTEST_COMPILER_VALUE_HELPER_H_ | 206 #endif // V8_CCTEST_COMPILER_VALUE_HELPER_H_ |
OLD | NEW |