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 <stdint.h> |
| 9 |
8 #include "src/compiler/common-operator.h" | 10 #include "src/compiler/common-operator.h" |
9 #include "src/compiler/node.h" | 11 #include "src/compiler/node.h" |
10 #include "src/compiler/node-matchers.h" | 12 #include "src/compiler/node-matchers.h" |
11 #include "src/isolate.h" | 13 #include "src/isolate.h" |
12 #include "src/objects.h" | 14 #include "src/objects.h" |
13 #include "test/cctest/cctest.h" | 15 #include "test/cctest/cctest.h" |
14 | 16 |
15 namespace v8 { | 17 namespace v8 { |
16 namespace internal { | 18 namespace internal { |
17 namespace compiler { | 19 namespace compiler { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 void CheckTrue(Node* node) { | 55 void CheckTrue(Node* node) { |
54 CheckHeapConstant(isolate_->heap()->true_value(), node); | 56 CheckHeapConstant(isolate_->heap()->true_value(), node); |
55 } | 57 } |
56 | 58 |
57 void CheckFalse(Node* node) { | 59 void CheckFalse(Node* node) { |
58 CheckHeapConstant(isolate_->heap()->false_value(), node); | 60 CheckHeapConstant(isolate_->heap()->false_value(), node); |
59 } | 61 } |
60 | 62 |
61 static std::vector<float> float32_vector() { | 63 static std::vector<float> float32_vector() { |
62 static const float nan = std::numeric_limits<float>::quiet_NaN(); | 64 static const float nan = std::numeric_limits<float>::quiet_NaN(); |
63 static const float kValues[] = {-std::numeric_limits<float>::infinity(), | 65 static const float kValues[] = { |
64 -2.70497e+38f, | 66 -std::numeric_limits<float>::infinity(), |
65 -1.4698e+37f, | 67 -2.70497e+38f, |
66 -1.22813e+35f, | 68 -1.4698e+37f, |
67 -1.20555e+35f, | 69 -1.22813e+35f, |
68 -1.34584e+34f, | 70 -1.20555e+35f, |
69 -1.0079e+32f, | 71 -1.34584e+34f, |
70 -6.49364e+26f, | 72 -1.0079e+32f, |
71 -3.06077e+25f, | 73 -6.49364e+26f, |
72 -1.46821e+25f, | 74 -3.06077e+25f, |
73 -1.17658e+23f, | 75 -1.46821e+25f, |
74 -1.9617e+22f, | 76 -1.17658e+23f, |
75 -2.7357e+20f, | 77 -1.9617e+22f, |
76 -1.48708e+13f, | 78 -2.7357e+20f, |
77 -1.89633e+12f, | 79 -9223372036854775808.0f, // INT64_MIN |
78 -4.66622e+11f, | 80 -1.48708e+13f, |
79 -2.22581e+11f, | 81 -1.89633e+12f, |
80 -1.45381e+10f, | 82 -4.66622e+11f, |
81 -1.3956e+09f, | 83 -2.22581e+11f, |
82 -1.32951e+09f, | 84 -1.45381e+10f, |
83 -1.30721e+09f, | 85 -1.3956e+09f, |
84 -1.19756e+09f, | 86 -1.32951e+09f, |
85 -9.26822e+08f, | 87 -1.30721e+09f, |
86 -6.35647e+08f, | 88 -1.19756e+09f, |
87 -4.00037e+08f, | 89 -9.26822e+08f, |
88 -1.81227e+08f, | 90 -6.35647e+08f, |
89 -5.09256e+07f, | 91 -4.00037e+08f, |
90 -964300.0f, | 92 -1.81227e+08f, |
91 -192446.0f, | 93 -5.09256e+07f, |
92 -28455.0f, | 94 -964300.0f, |
93 -27194.0f, | 95 -192446.0f, |
94 -26401.0f, | 96 -28455.0f, |
95 -20575.0f, | 97 -27194.0f, |
96 -17069.0f, | 98 -26401.0f, |
97 -9167.0f, | 99 -20575.0f, |
98 -960.178f, | 100 -17069.0f, |
99 -113.0f, | 101 -9167.0f, |
100 -62.0f, | 102 -960.178f, |
101 -15.0f, | 103 -113.0f, |
102 -7.0f, | 104 -62.0f, |
103 -0.0256635f, | 105 -15.0f, |
104 -4.60374e-07f, | 106 -7.0f, |
105 -3.63759e-10f, | 107 -0.0256635f, |
106 -4.30175e-14f, | 108 -4.60374e-07f, |
107 -5.27385e-15f, | 109 -3.63759e-10f, |
108 -1.48084e-15f, | 110 -4.30175e-14f, |
109 -1.05755e-19f, | 111 -5.27385e-15f, |
110 -3.2995e-21f, | 112 -1.48084e-15f, |
111 -1.67354e-23f, | 113 -1.05755e-19f, |
112 -1.11885e-23f, | 114 -3.2995e-21f, |
113 -1.78506e-30f, | 115 -1.67354e-23f, |
114 -5.07594e-31f, | 116 -1.11885e-23f, |
115 -3.65799e-31f, | 117 -1.78506e-30f, |
116 -1.43718e-34f, | 118 -5.07594e-31f, |
117 -1.27126e-38f, | 119 -3.65799e-31f, |
118 -0.0f, | 120 -1.43718e-34f, |
119 0.0f, | 121 -1.27126e-38f, |
120 1.17549e-38f, | 122 -0.0f, |
121 1.56657e-37f, | 123 0.0f, |
122 4.08512e-29f, | 124 1.17549e-38f, |
123 3.31357e-28f, | 125 1.56657e-37f, |
124 6.25073e-22f, | 126 4.08512e-29f, |
125 4.1723e-13f, | 127 3.31357e-28f, |
126 1.44343e-09f, | 128 6.25073e-22f, |
127 5.27004e-08f, | 129 4.1723e-13f, |
128 9.48298e-08f, | 130 1.44343e-09f, |
129 5.57888e-07f, | 131 5.27004e-08f, |
130 4.89988e-05f, | 132 9.48298e-08f, |
131 0.244326f, | 133 5.57888e-07f, |
132 12.4895f, | 134 4.89988e-05f, |
133 19.0f, | 135 0.244326f, |
134 47.0f, | 136 12.4895f, |
135 106.0f, | 137 19.0f, |
136 538.324f, | 138 47.0f, |
137 564.536f, | 139 106.0f, |
138 819.124f, | 140 538.324f, |
139 7048.0f, | 141 564.536f, |
140 12611.0f, | 142 819.124f, |
141 19878.0f, | 143 7048.0f, |
142 20309.0f, | 144 12611.0f, |
143 797056.0f, | 145 19878.0f, |
144 1.77219e+09f, | 146 20309.0f, |
145 1.51116e+11f, | 147 797056.0f, |
146 4.18193e+13f, | 148 1.77219e+09f, |
147 3.59167e+16f, | 149 1.51116e+11f, |
148 3.38211e+19f, | 150 4.18193e+13f, |
149 2.67488e+20f, | 151 3.59167e+16f, |
150 1.78831e+21f, | 152 9223372036854775807.0f, // INT64_MAX |
151 9.20914e+21f, | 153 18446744073709551615.0f, // UINT64_MAX |
152 8.35654e+23f, | 154 3.38211e+19f, |
153 1.4495e+24f, | 155 2.67488e+20f, |
154 5.94015e+25f, | 156 1.78831e+21f, |
155 4.43608e+30f, | 157 9.20914e+21f, |
156 2.44502e+33f, | 158 8.35654e+23f, |
157 2.61152e+33f, | 159 1.4495e+24f, |
158 1.38178e+37f, | 160 5.94015e+25f, |
159 1.71306e+37f, | 161 4.43608e+30f, |
160 3.31899e+38f, | 162 2.44502e+33f, |
161 3.40282e+38f, | 163 2.61152e+33f, |
162 std::numeric_limits<float>::infinity(), | 164 1.38178e+37f, |
163 nan, | 165 1.71306e+37f, |
164 -nan}; | 166 3.31899e+38f, |
| 167 3.40282e+38f, |
| 168 std::numeric_limits<float>::infinity(), |
| 169 nan, |
| 170 -nan, |
| 171 }; |
165 return std::vector<float>(&kValues[0], &kValues[arraysize(kValues)]); | 172 return std::vector<float>(&kValues[0], &kValues[arraysize(kValues)]); |
166 } | 173 } |
167 | 174 |
168 static std::vector<double> float64_vector() { | 175 static std::vector<double> float64_vector() { |
169 static const double nan = std::numeric_limits<double>::quiet_NaN(); | 176 static const double nan = std::numeric_limits<double>::quiet_NaN(); |
170 static const double values[] = {0.125, | 177 static const double values[] = {-2e66, |
| 178 -9223373136366403584.0, |
| 179 -9223372036854775808.0, // INT64_MIN |
| 180 -2147483649.5, |
| 181 -2147483648.25, |
| 182 -2147483648.0, |
| 183 -2147483647.875, |
| 184 -2147483647.125, |
| 185 -2147483647.0, |
| 186 -999.75, |
| 187 -2e66, |
| 188 -1.75, |
| 189 -0.5, |
| 190 -0.0, |
| 191 0.0, |
| 192 3e-88, |
| 193 0.125, |
171 0.25, | 194 0.25, |
172 0.375, | 195 0.375, |
173 0.5, | 196 0.5, |
174 -0.5, | |
175 1.25, | 197 1.25, |
176 -1.75, | |
177 2, | 198 2, |
| 199 3.1e7, |
178 5.125, | 200 5.125, |
179 6.25, | 201 6.25, |
180 0.0, | 202 888, |
181 -0.0, | |
182 982983.25, | 203 982983.25, |
183 888, | |
184 2147483647.0, | 204 2147483647.0, |
185 -999.75, | |
186 3.1e7, | |
187 -2e66, | |
188 2e66, | |
189 3e-88, | |
190 -2147483648.0, | |
191 V8_INFINITY, | |
192 -V8_INFINITY, | |
193 -nan, | |
194 nan, | |
195 2147483647.375, | 205 2147483647.375, |
196 2147483647.75, | 206 2147483647.75, |
197 2147483648.0, | 207 2147483648.0, |
198 2147483648.25, | 208 2147483648.25, |
199 2147483649.25, | 209 2147483649.25, |
200 -2147483647.0, | 210 9223372036854775807.0, // INT64_MAX |
201 -2147483647.125, | 211 9223373136366403584.0, |
202 -2147483647.875, | 212 18446744073709551615.0, // UINT64_MAX |
203 -2147483648.25, | 213 2e66, |
204 -2147483649.5}; | 214 V8_INFINITY, |
| 215 -V8_INFINITY, |
| 216 -nan, |
| 217 nan}; |
205 return std::vector<double>(&values[0], &values[arraysize(values)]); | 218 return std::vector<double>(&values[0], &values[arraysize(values)]); |
206 } | 219 } |
207 | 220 |
208 static const std::vector<int32_t> int32_vector() { | 221 static const std::vector<int32_t> int32_vector() { |
209 std::vector<uint32_t> values = uint32_vector(); | 222 std::vector<uint32_t> values = uint32_vector(); |
210 return std::vector<int32_t>(values.begin(), values.end()); | 223 return std::vector<int32_t>(values.begin(), values.end()); |
211 } | 224 } |
212 | 225 |
213 static const std::vector<uint32_t> uint32_vector() { | 226 static const std::vector<uint32_t> uint32_vector() { |
214 static const uint32_t kValues[] = { | 227 static const uint32_t kValues[] = { |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 | 306 |
294 #define FOR_INT32_SHIFTS(var) for (int32_t var = 0; var < 32; var++) | 307 #define FOR_INT32_SHIFTS(var) for (int32_t var = 0; var < 32; var++) |
295 | 308 |
296 #define FOR_UINT32_SHIFTS(var) for (uint32_t var = 0; var < 32; var++) | 309 #define FOR_UINT32_SHIFTS(var) for (uint32_t var = 0; var < 32; var++) |
297 | 310 |
298 } // namespace compiler | 311 } // namespace compiler |
299 } // namespace internal | 312 } // namespace internal |
300 } // namespace v8 | 313 } // namespace v8 |
301 | 314 |
302 #endif // V8_CCTEST_COMPILER_VALUE_HELPER_H_ | 315 #endif // V8_CCTEST_COMPILER_VALUE_HELPER_H_ |
OLD | NEW |