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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 return std::vector<uint32_t>(&kValues[0], &kValues[ARRAY_SIZE(kValues)]); | 97 return std::vector<uint32_t>(&kValues[0], &kValues[ARRAY_SIZE(kValues)]); |
98 } | 98 } |
99 | 99 |
100 static const std::vector<double> nan_vector(size_t limit = 0) { | 100 static const std::vector<double> nan_vector(size_t limit = 0) { |
101 static const double nan = v8::base::OS::nan_value(); | 101 static const double nan = v8::base::OS::nan_value(); |
102 static const double values[] = {-nan, -V8_INFINITY * -0.0, | 102 static const double values[] = {-nan, -V8_INFINITY * -0.0, |
103 -V8_INFINITY * 0.0, V8_INFINITY * -0.0, | 103 -V8_INFINITY * 0.0, V8_INFINITY * -0.0, |
104 V8_INFINITY * 0.0, nan}; | 104 V8_INFINITY * 0.0, nan}; |
105 return std::vector<double>(&values[0], &values[ARRAY_SIZE(values)]); | 105 return std::vector<double>(&values[0], &values[ARRAY_SIZE(values)]); |
106 } | 106 } |
| 107 |
| 108 static const std::vector<uint32_t> ror_vector() { |
| 109 static const uint32_t kValues[31] = { |
| 110 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, |
| 111 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31}; |
| 112 return std::vector<uint32_t>(&kValues[0], &kValues[ARRAY_SIZE(kValues)]); |
| 113 } |
107 }; | 114 }; |
108 | 115 |
109 // Helper macros that can be used in FOR_INT32_INPUTS(i) { ... *i ... } | 116 // Helper macros that can be used in FOR_INT32_INPUTS(i) { ... *i ... } |
110 // Watch out, these macros aren't hygenic; they pollute your scope. Thanks STL. | 117 // Watch out, these macros aren't hygenic; they pollute your scope. Thanks STL. |
111 #define FOR_INPUTS(ctype, itype, var) \ | 118 #define FOR_INPUTS(ctype, itype, var) \ |
112 std::vector<ctype> var##_vec = ValueHelper::itype##_vector(); \ | 119 std::vector<ctype> var##_vec = ValueHelper::itype##_vector(); \ |
113 for (std::vector<ctype>::iterator var = var##_vec.begin(); \ | 120 for (std::vector<ctype>::iterator var = var##_vec.begin(); \ |
114 var != var##_vec.end(); ++var) | 121 var != var##_vec.end(); ++var) |
115 | 122 |
116 #define FOR_INT32_INPUTS(var) FOR_INPUTS(int32_t, int32, var) | 123 #define FOR_INT32_INPUTS(var) FOR_INPUTS(int32_t, int32, var) |
117 #define FOR_UINT32_INPUTS(var) FOR_INPUTS(uint32_t, uint32, var) | 124 #define FOR_UINT32_INPUTS(var) FOR_INPUTS(uint32_t, uint32, var) |
118 #define FOR_FLOAT64_INPUTS(var) FOR_INPUTS(double, float64, var) | 125 #define FOR_FLOAT64_INPUTS(var) FOR_INPUTS(double, float64, var) |
119 } | 126 |
120 } | 127 } // namespace compiler |
121 } // namespace v8::internal::compiler | 128 } // namespace internal |
| 129 } // namespace v8 |
122 | 130 |
123 #endif // V8_CCTEST_COMPILER_VALUE_HELPER_H_ | 131 #endif // V8_CCTEST_COMPILER_VALUE_HELPER_H_ |
OLD | NEW |