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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 Node* c = changer()->GetRepresentationFor(n, from, to); | 82 Node* c = changer()->GetRepresentationFor(n, from, to); |
83 CHECK_EQ(n, c); | 83 CHECK_EQ(n, c); |
84 } | 84 } |
85 }; | 85 }; |
86 } | 86 } |
87 } | 87 } |
88 } // namespace v8::internal::compiler | 88 } // namespace v8::internal::compiler |
89 | 89 |
90 | 90 |
91 // TODO(titzer): add kRepFloat32 when fully supported. | 91 // TODO(titzer): add kRepFloat32 when fully supported. |
92 static const MachineType all_reps[] = {kRepBit, kRepWord32, kRepWord64, | 92 static const MachineType all_reps[] = {kRepBit, kRepWord32, kRepWord64, |
93 kRepFloat64, kRepTagged}; | 93 kRepFloat32, kRepFloat64, kRepTagged}; |
94 | 94 |
95 | 95 |
96 // TODO(titzer): lift this to ValueHelper | 96 // TODO(titzer): lift this to ValueHelper |
97 static const double double_inputs[] = { | 97 static const double double_inputs[] = { |
98 0.0, -0.0, 1.0, -1.0, 0.1, 1.4, -1.7, | 98 0.0, -0.0, 1.0, -1.0, 0.1, 1.4, -1.7, |
99 2, 5, 6, 982983, 888, -999.8, 3.1e7, | 99 2, 5, 6, 982983, 888, -999.8, 3.1e7, |
100 -2e66, 2.3e124, -12e73, V8_INFINITY, -V8_INFINITY}; | 100 -2e66, 2.3e124, -12e73, V8_INFINITY, -V8_INFINITY}; |
101 | 101 |
102 | 102 |
103 static const int32_t int32_inputs[] = { | 103 static const int32_t int32_inputs[] = { |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 r.CheckTypeError(kRepWord64, kRepWord32 | kTypeUint32); | 288 r.CheckTypeError(kRepWord64, kRepWord32 | kTypeUint32); |
289 r.CheckTypeError(kRepWord32 | kTypeUint32, kRepWord64); | 289 r.CheckTypeError(kRepWord32 | kTypeUint32, kRepWord64); |
290 | 290 |
291 for (size_t i = 0; i < arraysize(all_reps); i++) { | 291 for (size_t i = 0; i < arraysize(all_reps); i++) { |
292 for (size_t j = 0; j < arraysize(all_reps); j++) { | 292 for (size_t j = 0; j < arraysize(all_reps); j++) { |
293 if (i == j) continue; | 293 if (i == j) continue; |
294 // Only a single from representation is allowed. | 294 // Only a single from representation is allowed. |
295 r.CheckTypeError(all_reps[i] | all_reps[j], kRepTagged); | 295 r.CheckTypeError(all_reps[i] | all_reps[j], kRepTagged); |
296 } | 296 } |
297 } | 297 } |
298 | |
299 // TODO(titzer): Float32 representation changes trigger type errors now. | |
300 // Enforce current behavior to test all paths through representation changer. | |
301 for (size_t i = 0; i < arraysize(all_reps); i++) { | |
302 r.CheckTypeError(all_reps[i], kRepFloat32); | |
303 r.CheckTypeError(kRepFloat32, all_reps[i]); | |
304 } | |
305 } | 298 } |
OLD | NEW |