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 #include <limits> | 5 #include <limits> |
6 | 6 |
7 #include "src/v8.h" | 7 #include "src/v8.h" |
8 #include "test/cctest/cctest.h" | 8 #include "test/cctest/cctest.h" |
9 #include "test/cctest/compiler/graph-builder-tester.h" | 9 #include "test/cctest/compiler/graph-builder-tester.h" |
10 | 10 |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 CheckChange(IrOpcode::kChangeInt32ToFloat64, rWord32 | tInt32, rFloat64); | 185 CheckChange(IrOpcode::kChangeInt32ToFloat64, rWord32 | tInt32, rFloat64); |
186 CheckChange(IrOpcode::kChangeUint32ToFloat64, rWord32 | tUint32, rFloat64); | 186 CheckChange(IrOpcode::kChangeUint32ToFloat64, rWord32 | tUint32, rFloat64); |
187 CheckChange(IrOpcode::kChangeFloat64ToInt32, rFloat64 | tInt32, rWord32); | 187 CheckChange(IrOpcode::kChangeFloat64ToInt32, rFloat64 | tInt32, rWord32); |
188 CheckChange(IrOpcode::kChangeFloat64ToUint32, rFloat64 | tUint32, rWord32); | 188 CheckChange(IrOpcode::kChangeFloat64ToUint32, rFloat64 | tUint32, rWord32); |
189 } | 189 } |
190 | 190 |
191 | 191 |
192 TEST(SignednessInWord32) { | 192 TEST(SignednessInWord32) { |
193 RepresentationChangerTester r; | 193 RepresentationChangerTester r; |
194 | 194 |
195 // TODO(titzer): these are currently type errors because the output type is | 195 // TODO(titzer): assume that uses of a word32 without a sign mean tInt32. |
196 // not specified. Maybe the RepresentationChanger should assume anything to or | 196 CheckChange(IrOpcode::kChangeTaggedToInt32, rTagged, rWord32 | tInt32); |
197 // from {rWord32} is {tInt32}, i.e. signed, if not it is explicitly otherwise? | 197 CheckChange(IrOpcode::kChangeTaggedToUint32, rTagged, rWord32 | tUint32); |
198 r.CheckTypeError(rTagged, rWord32 | tInt32); | 198 CheckChange(IrOpcode::kChangeInt32ToFloat64, rWord32, rFloat64); |
199 r.CheckTypeError(rTagged, rWord32 | tUint32); | 199 CheckChange(IrOpcode::kChangeFloat64ToInt32, rFloat64, rWord32); |
200 r.CheckTypeError(rWord32, rFloat64); | |
201 r.CheckTypeError(rFloat64, rWord32); | |
202 | |
203 // CheckChange(IrOpcode::kChangeTaggedToInt32, rTagged, rWord32 | tInt32); | |
204 // CheckChange(IrOpcode::kChangeTaggedToUint32, rTagged, rWord32 | tUint32); | |
205 // CheckChange(IrOpcode::kChangeInt32ToFloat64, rWord32, rFloat64); | |
206 // CheckChange(IrOpcode::kChangeFloat64ToInt32, rFloat64, rWord32); | |
207 } | 200 } |
208 | 201 |
209 | 202 |
210 TEST(Nops) { | 203 TEST(Nops) { |
211 RepresentationChangerTester r; | 204 RepresentationChangerTester r; |
212 | 205 |
213 // X -> X is always a nop for any single representation X. | 206 // X -> X is always a nop for any single representation X. |
214 for (size_t i = 0; i < ARRAY_SIZE(all_reps); i++) { | 207 for (size_t i = 0; i < ARRAY_SIZE(all_reps); i++) { |
215 r.CheckNop(all_reps[i], all_reps[i]); | 208 r.CheckNop(all_reps[i], all_reps[i]); |
216 } | 209 } |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 // rW64 | 267 // rW64 |
275 // tIrW64 | 268 // tIrW64 |
276 // tUrW64 | 269 // tUrW64 |
277 // rF64 | 270 // rF64 |
278 // tIrF64 | 271 // tIrF64 |
279 // tUrF64 | 272 // tUrF64 |
280 // tArF64 | 273 // tArF64 |
281 // rT | 274 // rT |
282 // tArT | 275 // tArT |
283 } | 276 } |
OLD | NEW |