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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 | 173 |
174 CheckChange(IrOpcode::kChangeInt32ToTagged, rWord32 | tInt32, rTagged); | 174 CheckChange(IrOpcode::kChangeInt32ToTagged, rWord32 | tInt32, rTagged); |
175 CheckChange(IrOpcode::kChangeUint32ToTagged, rWord32 | tUint32, rTagged); | 175 CheckChange(IrOpcode::kChangeUint32ToTagged, rWord32 | tUint32, rTagged); |
176 CheckChange(IrOpcode::kChangeFloat64ToTagged, rFloat64, rTagged); | 176 CheckChange(IrOpcode::kChangeFloat64ToTagged, rFloat64, rTagged); |
177 | 177 |
178 CheckChange(IrOpcode::kChangeTaggedToInt32, rTagged | tInt32, rWord32); | 178 CheckChange(IrOpcode::kChangeTaggedToInt32, rTagged | tInt32, rWord32); |
179 CheckChange(IrOpcode::kChangeTaggedToUint32, rTagged | tUint32, rWord32); | 179 CheckChange(IrOpcode::kChangeTaggedToUint32, rTagged | tUint32, rWord32); |
180 CheckChange(IrOpcode::kChangeTaggedToFloat64, rTagged, rFloat64); | 180 CheckChange(IrOpcode::kChangeTaggedToFloat64, rTagged, rFloat64); |
181 | 181 |
182 // Int32,Uint32 <-> Float64 are actually machine conversions. | 182 // Int32,Uint32 <-> Float64 are actually machine conversions. |
183 CheckChange(IrOpcode::kConvertInt32ToFloat64, rWord32 | tInt32, rFloat64); | 183 CheckChange(IrOpcode::kChangeInt32ToFloat64, rWord32 | tInt32, rFloat64); |
184 CheckChange(IrOpcode::kConvertUint32ToFloat64, rWord32 | tUint32, rFloat64); | 184 CheckChange(IrOpcode::kChangeUint32ToFloat64, rWord32 | tUint32, rFloat64); |
185 CheckChange(IrOpcode::kConvertFloat64ToInt32, rFloat64 | tInt32, rWord32); | 185 CheckChange(IrOpcode::kChangeFloat64ToInt32, rFloat64 | tInt32, rWord32); |
186 CheckChange(IrOpcode::kConvertFloat64ToUint32, rFloat64 | tUint32, rWord32); | 186 CheckChange(IrOpcode::kChangeFloat64ToUint32, rFloat64 | tUint32, rWord32); |
187 } | 187 } |
188 | 188 |
189 | 189 |
190 TEST(SignednessInWord32) { | 190 TEST(SignednessInWord32) { |
191 RepresentationChangerTester r; | 191 RepresentationChangerTester r; |
192 | 192 |
193 // TODO(titzer): these are currently type errors because the output type is | 193 // TODO(titzer): these are currently type errors because the output type is |
194 // not specified. Maybe the RepresentationChanger should assume anything to or | 194 // not specified. Maybe the RepresentationChanger should assume anything to or |
195 // from {rWord32} is {tInt32}, i.e. signed, if not it is explicitly otherwise? | 195 // from {rWord32} is {tInt32}, i.e. signed, if not it is explicitly otherwise? |
196 r.CheckTypeError(rTagged, rWord32 | tInt32); | 196 r.CheckTypeError(rTagged, rWord32 | tInt32); |
197 r.CheckTypeError(rTagged, rWord32 | tUint32); | 197 r.CheckTypeError(rTagged, rWord32 | tUint32); |
198 r.CheckTypeError(rWord32, rFloat64); | 198 r.CheckTypeError(rWord32, rFloat64); |
199 r.CheckTypeError(rFloat64, rWord32); | 199 r.CheckTypeError(rFloat64, rWord32); |
200 | 200 |
201 // CheckChange(IrOpcode::kChangeTaggedToInt32, rTagged, rWord32 | tInt32); | 201 // CheckChange(IrOpcode::kChangeTaggedToInt32, rTagged, rWord32 | tInt32); |
202 // CheckChange(IrOpcode::kChangeTaggedToUint32, rTagged, rWord32 | tUint32); | 202 // CheckChange(IrOpcode::kChangeTaggedToUint32, rTagged, rWord32 | tUint32); |
203 // CheckChange(IrOpcode::kConvertInt32ToFloat64, rWord32, rFloat64); | 203 // CheckChange(IrOpcode::kChangeInt32ToFloat64, rWord32, rFloat64); |
204 // CheckChange(IrOpcode::kConvertFloat64ToInt32, rFloat64, rWord32); | 204 // CheckChange(IrOpcode::kChangeFloat64ToInt32, rFloat64, rWord32); |
205 } | 205 } |
206 | 206 |
207 | 207 |
208 TEST(Nops) { | 208 TEST(Nops) { |
209 RepresentationChangerTester r; | 209 RepresentationChangerTester r; |
210 | 210 |
211 // X -> X is always a nop for any single representation X. | 211 // X -> X is always a nop for any single representation X. |
212 for (size_t i = 0; i < ARRAY_SIZE(all_reps); i++) { | 212 for (size_t i = 0; i < ARRAY_SIZE(all_reps); i++) { |
213 r.CheckNop(all_reps[i], all_reps[i]); | 213 r.CheckNop(all_reps[i], all_reps[i]); |
214 } | 214 } |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 // rW64 | 272 // rW64 |
273 // tIrW64 | 273 // tIrW64 |
274 // tUrW64 | 274 // tUrW64 |
275 // rF64 | 275 // rF64 |
276 // tIrF64 | 276 // tIrF64 |
277 // tUrF64 | 277 // tUrF64 |
278 // tArF64 | 278 // tArF64 |
279 // rT | 279 // rT |
280 // tArT | 280 // tArT |
281 } | 281 } |
OLD | NEW |