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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 1.4495e+24f, 5.94015e+25f, 4.43608e+30f, | 95 1.4495e+24f, 5.94015e+25f, 4.43608e+30f, |
96 2.44502e+33f, 2.61152e+33f, 1.38178e+37f, | 96 2.44502e+33f, 2.61152e+33f, 1.38178e+37f, |
97 1.71306e+37f, 3.31899e+38f, 3.40282e+38f, | 97 1.71306e+37f, 3.31899e+38f, 3.40282e+38f, |
98 std::numeric_limits<float>::infinity()}; | 98 std::numeric_limits<float>::infinity()}; |
99 return std::vector<float>(&kValues[0], &kValues[arraysize(kValues)]); | 99 return std::vector<float>(&kValues[0], &kValues[arraysize(kValues)]); |
100 } | 100 } |
101 | 101 |
102 static std::vector<double> float64_vector() { | 102 static std::vector<double> float64_vector() { |
103 static const double nan = v8::base::OS::nan_value(); | 103 static const double nan = v8::base::OS::nan_value(); |
104 static const double values[] = { | 104 static const double values[] = { |
105 0.125, 0.25, 0.375, 0.5, 1.25, -1.75, 2, 5.125, 6.25, 0.0, -0.0, | 105 0.125, 0.25, 0.375, 0.5, |
106 982983.25, 888, 2147483647.0, -999.75, 3.1e7, -2e66, 3e-88, | 106 1.25, -1.75, 2, 5.125, |
107 -2147483648.0, std::numeric_limits<double>::infinity(), | 107 6.25, 0.0, -0.0, 982983.25, |
108 -std::numeric_limits<double>::infinity(), nan, 2147483647.375, | 108 888, 2147483647.0, -999.75, 3.1e7, |
109 2147483647.75, 2147483648.0, 2147483648.25, 2147483649.25, | 109 -2e66, 3e-88, -2147483648.0, V8_INFINITY, |
110 -2147483647.0, -2147483647.125, -2147483647.875, -2147483648.25, | 110 -V8_INFINITY, nan, 2147483647.375, 2147483647.75, |
111 -2147483649.5}; | 111 2147483648.0, 2147483648.25, 2147483649.25, -2147483647.0, |
| 112 -2147483647.125, -2147483647.875, -2147483648.25, -2147483649.5}; |
112 return std::vector<double>(&values[0], &values[arraysize(values)]); | 113 return std::vector<double>(&values[0], &values[arraysize(values)]); |
113 } | 114 } |
114 | 115 |
115 static const std::vector<int32_t> int32_vector() { | 116 static const std::vector<int32_t> int32_vector() { |
116 std::vector<uint32_t> values = uint32_vector(); | 117 std::vector<uint32_t> values = uint32_vector(); |
117 return std::vector<int32_t>(values.begin(), values.end()); | 118 return std::vector<int32_t>(values.begin(), values.end()); |
118 } | 119 } |
119 | 120 |
120 static const std::vector<uint32_t> uint32_vector() { | 121 static const std::vector<uint32_t> uint32_vector() { |
121 static const uint32_t kValues[] = { | 122 static const uint32_t kValues[] = { |
122 0x00000000, 0x00000001, 0xffffffff, 0x1b09788b, 0x04c5fce8, 0xcc0de5bf, | 123 0x00000000, 0x00000001, 0xffffffff, 0x1b09788b, 0x04c5fce8, 0xcc0de5bf, |
123 // This row is useful for testing lea optimizations on intel. | 124 // This row is useful for testing lea optimizations on intel. |
124 0x00000002, 0x00000003, 0x00000004, 0x00000005, 0x00000008, 0x00000009, | 125 0x00000002, 0x00000003, 0x00000004, 0x00000005, 0x00000008, 0x00000009, |
125 0x273a798e, 0x187937a3, 0xece3af83, 0x5495a16b, 0x0b668ecc, 0x11223344, | 126 0x273a798e, 0x187937a3, 0xece3af83, 0x5495a16b, 0x0b668ecc, 0x11223344, |
126 0x0000009e, 0x00000043, 0x0000af73, 0x0000116b, 0x00658ecc, 0x002b3b4c, | 127 0x0000009e, 0x00000043, 0x0000af73, 0x0000116b, 0x00658ecc, 0x002b3b4c, |
127 0x88776655, 0x70000000, 0x07200000, 0x7fffffff, 0x56123761, 0x7fffff00, | 128 0x88776655, 0x70000000, 0x07200000, 0x7fffffff, 0x56123761, 0x7fffff00, |
128 0x761c4761, 0x80000000, 0x88888888, 0xa0000000, 0xdddddddd, 0xe0000000, | 129 0x761c4761, 0x80000000, 0x88888888, 0xa0000000, 0xdddddddd, 0xe0000000, |
129 0xeeeeeeee, 0xfffffffd, 0xf0000000, 0x007fffff, 0x003fffff, 0x001fffff, | 130 0xeeeeeeee, 0xfffffffd, 0xf0000000, 0x007fffff, 0x003fffff, 0x001fffff, |
130 0x000fffff, 0x0007ffff, 0x0003ffff, 0x0001ffff, 0x0000ffff, 0x00007fff, | 131 0x000fffff, 0x0007ffff, 0x0003ffff, 0x0001ffff, 0x0000ffff, 0x00007fff, |
131 0x00003fff, 0x00001fff, 0x00000fff, 0x000007ff, 0x000003ff, 0x000001ff}; | 132 0x00003fff, 0x00001fff, 0x00000fff, 0x000007ff, 0x000003ff, 0x000001ff}; |
132 return std::vector<uint32_t>(&kValues[0], &kValues[arraysize(kValues)]); | 133 return std::vector<uint32_t>(&kValues[0], &kValues[arraysize(kValues)]); |
133 } | 134 } |
134 | 135 |
135 static const std::vector<double> nan_vector(size_t limit = 0) { | 136 static const std::vector<double> nan_vector(size_t limit = 0) { |
136 static const double nan = v8::base::OS::nan_value(); | 137 static const double nan = v8::base::OS::nan_value(); |
137 static const double values[] = { | 138 static const double values[] = {-nan, -V8_INFINITY * -0.0, |
138 -nan, -std::numeric_limits<double>::infinity() * -0.0, | 139 -V8_INFINITY * 0.0, V8_INFINITY * -0.0, |
139 -std::numeric_limits<double>::infinity() * 0.0, | 140 V8_INFINITY * 0.0, nan}; |
140 std::numeric_limits<double>::infinity() * -0.0, | |
141 std::numeric_limits<double>::infinity() * 0.0, nan}; | |
142 return std::vector<double>(&values[0], &values[arraysize(values)]); | 141 return std::vector<double>(&values[0], &values[arraysize(values)]); |
143 } | 142 } |
144 | 143 |
145 static const std::vector<uint32_t> ror_vector() { | 144 static const std::vector<uint32_t> ror_vector() { |
146 static const uint32_t kValues[31] = { | 145 static const uint32_t kValues[31] = { |
147 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, | 146 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, |
148 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31}; | 147 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31}; |
149 return std::vector<uint32_t>(&kValues[0], &kValues[arraysize(kValues)]); | 148 return std::vector<uint32_t>(&kValues[0], &kValues[arraysize(kValues)]); |
150 } | 149 } |
151 }; | 150 }; |
(...skipping 12 matching lines...) Expand all Loading... |
164 | 163 |
165 #define FOR_INT32_SHIFTS(var) for (int32_t var = 0; var < 32; var++) | 164 #define FOR_INT32_SHIFTS(var) for (int32_t var = 0; var < 32; var++) |
166 | 165 |
167 #define FOR_UINT32_SHIFTS(var) for (uint32_t var = 0; var < 32; var++) | 166 #define FOR_UINT32_SHIFTS(var) for (uint32_t var = 0; var < 32; var++) |
168 | 167 |
169 } // namespace compiler | 168 } // namespace compiler |
170 } // namespace internal | 169 } // namespace internal |
171 } // namespace v8 | 170 } // namespace v8 |
172 | 171 |
173 #endif // V8_CCTEST_COMPILER_VALUE_HELPER_H_ | 172 #endif // V8_CCTEST_COMPILER_VALUE_HELPER_H_ |
OLD | NEW |