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 "test/cctest/cctest.h" | 7 #include "test/cctest/cctest.h" |
8 #include "test/cctest/compiler/codegen-tester.h" | 8 #include "test/cctest/compiler/codegen-tester.h" |
9 #include "test/cctest/compiler/graph-builder-tester.h" | 9 #include "test/cctest/compiler/graph-builder-tester.h" |
10 #include "test/cctest/compiler/value-helper.h" | 10 #include "test/cctest/compiler/value-helper.h" |
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
437 CHECK_EQ(n, c2->InputAt(0)); | 437 CHECK_EQ(n, c2->InputAt(0)); |
438 } | 438 } |
439 | 439 |
440 | 440 |
441 TEST(SingleChanges) { | 441 TEST(SingleChanges) { |
442 CheckChange(IrOpcode::kChangeBoolToBit, MachineRepresentation::kTagged, | 442 CheckChange(IrOpcode::kChangeBoolToBit, MachineRepresentation::kTagged, |
443 Type::None(), MachineRepresentation::kBit); | 443 Type::None(), MachineRepresentation::kBit); |
444 CheckChange(IrOpcode::kChangeBitToBool, MachineRepresentation::kBit, | 444 CheckChange(IrOpcode::kChangeBitToBool, MachineRepresentation::kBit, |
445 Type::None(), MachineRepresentation::kTagged); | 445 Type::None(), MachineRepresentation::kTagged); |
446 | 446 |
| 447 CheckChange(IrOpcode::kChangeInt31ToTagged, MachineRepresentation::kWord32, |
| 448 Type::Signed31(), MachineRepresentation::kTagged); |
447 CheckChange(IrOpcode::kChangeInt32ToTagged, MachineRepresentation::kWord32, | 449 CheckChange(IrOpcode::kChangeInt32ToTagged, MachineRepresentation::kWord32, |
448 Type::Signed32(), MachineRepresentation::kTagged); | 450 Type::Signed32(), MachineRepresentation::kTagged); |
449 CheckChange(IrOpcode::kChangeUint32ToTagged, MachineRepresentation::kWord32, | 451 CheckChange(IrOpcode::kChangeUint32ToTagged, MachineRepresentation::kWord32, |
450 Type::Unsigned32(), MachineRepresentation::kTagged); | 452 Type::Unsigned32(), MachineRepresentation::kTagged); |
451 CheckChange(IrOpcode::kChangeFloat64ToTagged, MachineRepresentation::kFloat64, | 453 CheckChange(IrOpcode::kChangeFloat64ToTagged, MachineRepresentation::kFloat64, |
452 Type::None(), MachineRepresentation::kTagged); | 454 Type::Number(), MachineRepresentation::kTagged); |
| 455 CheckTwoChanges(IrOpcode::kChangeFloat64ToInt32, |
| 456 IrOpcode::kChangeInt31ToTagged, |
| 457 MachineRepresentation::kFloat64, Type::Signed31(), |
| 458 MachineRepresentation::kTagged); |
| 459 CheckTwoChanges(IrOpcode::kChangeFloat64ToInt32, |
| 460 IrOpcode::kChangeInt32ToTagged, |
| 461 MachineRepresentation::kFloat64, Type::Signed32(), |
| 462 MachineRepresentation::kTagged); |
| 463 CheckTwoChanges(IrOpcode::kChangeFloat64ToUint32, |
| 464 IrOpcode::kChangeUint32ToTagged, |
| 465 MachineRepresentation::kFloat64, Type::Unsigned32(), |
| 466 MachineRepresentation::kTagged); |
453 | 467 |
454 CheckChange(IrOpcode::kChangeTaggedToInt32, MachineRepresentation::kTagged, | 468 CheckChange(IrOpcode::kChangeTaggedToInt32, MachineRepresentation::kTagged, |
455 Type::Signed32(), MachineRepresentation::kWord32); | 469 Type::Signed32(), MachineRepresentation::kWord32); |
456 CheckChange(IrOpcode::kChangeTaggedToUint32, MachineRepresentation::kTagged, | 470 CheckChange(IrOpcode::kChangeTaggedToUint32, MachineRepresentation::kTagged, |
457 Type::Unsigned32(), MachineRepresentation::kWord32); | 471 Type::Unsigned32(), MachineRepresentation::kWord32); |
458 CheckChange(IrOpcode::kChangeTaggedToFloat64, MachineRepresentation::kTagged, | 472 CheckChange(IrOpcode::kChangeTaggedToFloat64, MachineRepresentation::kTagged, |
459 Type::None(), MachineRepresentation::kFloat64); | 473 Type::None(), MachineRepresentation::kFloat64); |
460 | 474 |
461 // Int32,Uint32 <-> Float64 are actually machine conversions. | 475 // Int32,Uint32 <-> Float64 are actually machine conversions. |
462 CheckChange(IrOpcode::kChangeInt32ToFloat64, MachineRepresentation::kWord32, | 476 CheckChange(IrOpcode::kChangeInt32ToFloat64, MachineRepresentation::kWord32, |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
621 MachineRepresentation::kWord64); | 635 MachineRepresentation::kWord64); |
622 r.CheckTypeError(MachineRepresentation::kWord32, Type::Signed32(), | 636 r.CheckTypeError(MachineRepresentation::kWord32, Type::Signed32(), |
623 MachineRepresentation::kWord64); | 637 MachineRepresentation::kWord64); |
624 r.CheckTypeError(MachineRepresentation::kWord32, Type::Unsigned32(), | 638 r.CheckTypeError(MachineRepresentation::kWord32, Type::Unsigned32(), |
625 MachineRepresentation::kWord64); | 639 MachineRepresentation::kWord64); |
626 } | 640 } |
627 | 641 |
628 } // namespace compiler | 642 } // namespace compiler |
629 } // namespace internal | 643 } // namespace internal |
630 } // namespace v8 | 644 } // namespace v8 |
OLD | NEW |