| 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 "src/compiler/machine-operator.h" | 5 #include "src/compiler/machine-operator.h" |
| 6 | 6 |
| 7 #include "src/base/lazy-instance.h" | 7 #include "src/base/lazy-instance.h" |
| 8 #include "src/compiler/opcodes.h" | 8 #include "src/compiler/opcodes.h" |
| 9 #include "src/compiler/operator.h" | 9 #include "src/compiler/operator.h" |
| 10 | 10 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 | 36 |
| 37 LoadRepresentation LoadRepresentationOf(Operator const* op) { | 37 LoadRepresentation LoadRepresentationOf(Operator const* op) { |
| 38 DCHECK(IrOpcode::kLoad == op->opcode() || | 38 DCHECK(IrOpcode::kLoad == op->opcode() || |
| 39 IrOpcode::kProtectedLoad == op->opcode() || | 39 IrOpcode::kProtectedLoad == op->opcode() || |
| 40 IrOpcode::kAtomicLoad == op->opcode()); | 40 IrOpcode::kAtomicLoad == op->opcode()); |
| 41 return OpParameter<LoadRepresentation>(op); | 41 return OpParameter<LoadRepresentation>(op); |
| 42 } | 42 } |
| 43 | 43 |
| 44 | 44 |
| 45 StoreRepresentation const& StoreRepresentationOf(Operator const* op) { | 45 StoreRepresentation const& StoreRepresentationOf(Operator const* op) { |
| 46 DCHECK_EQ(IrOpcode::kStore, op->opcode()); | 46 DCHECK(IrOpcode::kStore == op->opcode() || |
| 47 IrOpcode::kProtectedStore == op->opcode()); |
| 47 return OpParameter<StoreRepresentation>(op); | 48 return OpParameter<StoreRepresentation>(op); |
| 48 } | 49 } |
| 49 | 50 |
| 50 UnalignedLoadRepresentation UnalignedLoadRepresentationOf(Operator const* op) { | 51 UnalignedLoadRepresentation UnalignedLoadRepresentationOf(Operator const* op) { |
| 51 DCHECK_EQ(IrOpcode::kUnalignedLoad, op->opcode()); | 52 DCHECK_EQ(IrOpcode::kUnalignedLoad, op->opcode()); |
| 52 return OpParameter<UnalignedLoadRepresentation>(op); | 53 return OpParameter<UnalignedLoadRepresentation>(op); |
| 53 } | 54 } |
| 54 | 55 |
| 55 UnalignedStoreRepresentation const& UnalignedStoreRepresentationOf( | 56 UnalignedStoreRepresentation const& UnalignedStoreRepresentationOf( |
| 56 Operator const* op) { | 57 Operator const* op) { |
| (...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 503 }; \ | 504 }; \ |
| 504 struct CheckedLoad##Type##Operator final \ | 505 struct CheckedLoad##Type##Operator final \ |
| 505 : public Operator1<CheckedLoadRepresentation> { \ | 506 : public Operator1<CheckedLoadRepresentation> { \ |
| 506 CheckedLoad##Type##Operator() \ | 507 CheckedLoad##Type##Operator() \ |
| 507 : Operator1<CheckedLoadRepresentation>( \ | 508 : Operator1<CheckedLoadRepresentation>( \ |
| 508 IrOpcode::kCheckedLoad, \ | 509 IrOpcode::kCheckedLoad, \ |
| 509 Operator::kNoDeopt | Operator::kNoThrow | Operator::kNoWrite, \ | 510 Operator::kNoDeopt | Operator::kNoThrow | Operator::kNoWrite, \ |
| 510 "CheckedLoad", 3, 1, 1, 1, 1, 0, MachineType::Type()) {} \ | 511 "CheckedLoad", 3, 1, 1, 1, 1, 0, MachineType::Type()) {} \ |
| 511 }; \ | 512 }; \ |
| 512 struct ProtectedLoad##Type##Operator final \ | 513 struct ProtectedLoad##Type##Operator final \ |
| 513 : public Operator1<ProtectedLoadRepresentation> { \ | 514 : public Operator1<LoadRepresentation> { \ |
| 514 ProtectedLoad##Type##Operator() \ | 515 ProtectedLoad##Type##Operator() \ |
| 515 : Operator1<ProtectedLoadRepresentation>( \ | 516 : Operator1<LoadRepresentation>( \ |
| 516 IrOpcode::kProtectedLoad, \ | 517 IrOpcode::kProtectedLoad, \ |
| 517 Operator::kNoDeopt | Operator::kNoThrow | Operator::kNoWrite, \ | 518 Operator::kNoDeopt | Operator::kNoThrow | Operator::kNoWrite, \ |
| 518 "ProtectedLoad", 4, 1, 1, 1, 1, 0, MachineType::Type()) {} \ | 519 "ProtectedLoad", 4, 1, 1, 1, 1, 0, MachineType::Type()) {} \ |
| 519 }; \ | 520 }; \ |
| 520 Load##Type##Operator kLoad##Type; \ | 521 Load##Type##Operator kLoad##Type; \ |
| 521 UnalignedLoad##Type##Operator kUnalignedLoad##Type; \ | 522 UnalignedLoad##Type##Operator kUnalignedLoad##Type; \ |
| 522 CheckedLoad##Type##Operator kCheckedLoad##Type; \ | 523 CheckedLoad##Type##Operator kCheckedLoad##Type; \ |
| 523 ProtectedLoad##Type##Operator kProtectedLoad##Type; | 524 ProtectedLoad##Type##Operator kProtectedLoad##Type; |
| 524 MACHINE_TYPE_LIST(LOAD) | 525 MACHINE_TYPE_LIST(LOAD) |
| 525 #undef LOAD | 526 #undef LOAD |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 578 }; \ | 579 }; \ |
| 579 struct CheckedStore##Type##Operator final \ | 580 struct CheckedStore##Type##Operator final \ |
| 580 : public Operator1<CheckedStoreRepresentation> { \ | 581 : public Operator1<CheckedStoreRepresentation> { \ |
| 581 CheckedStore##Type##Operator() \ | 582 CheckedStore##Type##Operator() \ |
| 582 : Operator1<CheckedStoreRepresentation>( \ | 583 : Operator1<CheckedStoreRepresentation>( \ |
| 583 IrOpcode::kCheckedStore, \ | 584 IrOpcode::kCheckedStore, \ |
| 584 Operator::kNoDeopt | Operator::kNoRead | Operator::kNoThrow, \ | 585 Operator::kNoDeopt | Operator::kNoRead | Operator::kNoThrow, \ |
| 585 "CheckedStore", 4, 1, 1, 0, 1, 0, MachineRepresentation::Type) { \ | 586 "CheckedStore", 4, 1, 1, 0, 1, 0, MachineRepresentation::Type) { \ |
| 586 } \ | 587 } \ |
| 587 }; \ | 588 }; \ |
| 589 struct ProtectedStore##Type##Operator \ |
| 590 : public Operator1<StoreRepresentation> { \ |
| 591 explicit ProtectedStore##Type##Operator() \ |
| 592 : Operator1<StoreRepresentation>( \ |
| 593 IrOpcode::kProtectedStore, \ |
| 594 Operator::kNoDeopt | Operator::kNoRead | Operator::kNoThrow, \ |
| 595 "Store", 5, 1, 1, 0, 1, 0, \ |
| 596 StoreRepresentation(MachineRepresentation::Type, \ |
| 597 kNoWriteBarrier)) {} \ |
| 598 }; \ |
| 588 Store##Type##NoWriteBarrier##Operator kStore##Type##NoWriteBarrier; \ | 599 Store##Type##NoWriteBarrier##Operator kStore##Type##NoWriteBarrier; \ |
| 589 Store##Type##MapWriteBarrier##Operator kStore##Type##MapWriteBarrier; \ | 600 Store##Type##MapWriteBarrier##Operator kStore##Type##MapWriteBarrier; \ |
| 590 Store##Type##PointerWriteBarrier##Operator \ | 601 Store##Type##PointerWriteBarrier##Operator \ |
| 591 kStore##Type##PointerWriteBarrier; \ | 602 kStore##Type##PointerWriteBarrier; \ |
| 592 Store##Type##FullWriteBarrier##Operator kStore##Type##FullWriteBarrier; \ | 603 Store##Type##FullWriteBarrier##Operator kStore##Type##FullWriteBarrier; \ |
| 593 UnalignedStore##Type##Operator kUnalignedStore##Type; \ | 604 UnalignedStore##Type##Operator kUnalignedStore##Type; \ |
| 594 CheckedStore##Type##Operator kCheckedStore##Type; | 605 CheckedStore##Type##Operator kCheckedStore##Type; \ |
| 606 ProtectedStore##Type##Operator kProtectedStore##Type; |
| 595 MACHINE_REPRESENTATION_LIST(STORE) | 607 MACHINE_REPRESENTATION_LIST(STORE) |
| 596 #undef STORE | 608 #undef STORE |
| 597 | 609 |
| 598 #define ATOMIC_LOAD(Type) \ | 610 #define ATOMIC_LOAD(Type) \ |
| 599 struct AtomicLoad##Type##Operator final \ | 611 struct AtomicLoad##Type##Operator final \ |
| 600 : public Operator1<LoadRepresentation> { \ | 612 : public Operator1<LoadRepresentation> { \ |
| 601 AtomicLoad##Type##Operator() \ | 613 AtomicLoad##Type##Operator() \ |
| 602 : Operator1<LoadRepresentation>( \ | 614 : Operator1<LoadRepresentation>( \ |
| 603 IrOpcode::kAtomicLoad, \ | 615 IrOpcode::kAtomicLoad, \ |
| 604 Operator::kNoDeopt | Operator::kNoThrow | Operator::kNoWrite, \ | 616 Operator::kNoDeopt | Operator::kNoThrow | Operator::kNoWrite, \ |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 755 MACHINE_REPRESENTATION_LIST(STORE) | 767 MACHINE_REPRESENTATION_LIST(STORE) |
| 756 #undef STORE | 768 #undef STORE |
| 757 case MachineRepresentation::kBit: | 769 case MachineRepresentation::kBit: |
| 758 case MachineRepresentation::kNone: | 770 case MachineRepresentation::kNone: |
| 759 break; | 771 break; |
| 760 } | 772 } |
| 761 UNREACHABLE(); | 773 UNREACHABLE(); |
| 762 return nullptr; | 774 return nullptr; |
| 763 } | 775 } |
| 764 | 776 |
| 777 const Operator* MachineOperatorBuilder::ProtectedStore( |
| 778 MachineRepresentation rep) { |
| 779 switch (rep) { |
| 780 #define STORE(kRep) \ |
| 781 case MachineRepresentation::kRep: \ |
| 782 return &cache_.kProtectedStore##kRep; \ |
| 783 break; |
| 784 MACHINE_REPRESENTATION_LIST(STORE) |
| 785 #undef STORE |
| 786 case MachineRepresentation::kBit: |
| 787 case MachineRepresentation::kNone: |
| 788 break; |
| 789 } |
| 790 UNREACHABLE(); |
| 791 return nullptr; |
| 792 } |
| 793 |
| 765 const Operator* MachineOperatorBuilder::UnsafePointerAdd() { | 794 const Operator* MachineOperatorBuilder::UnsafePointerAdd() { |
| 766 return &cache_.kUnsafePointerAdd; | 795 return &cache_.kUnsafePointerAdd; |
| 767 } | 796 } |
| 768 | 797 |
| 769 const Operator* MachineOperatorBuilder::DebugBreak() { | 798 const Operator* MachineOperatorBuilder::DebugBreak() { |
| 770 return &cache_.kDebugBreak; | 799 return &cache_.kDebugBreak; |
| 771 } | 800 } |
| 772 | 801 |
| 773 const Operator* MachineOperatorBuilder::Comment(const char* msg) { | 802 const Operator* MachineOperatorBuilder::Comment(const char* msg) { |
| 774 return new (zone_) CommentOperator(msg); | 803 return new (zone_) CommentOperator(msg); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 821 } | 850 } |
| 822 ATOMIC_REPRESENTATION_LIST(STORE) | 851 ATOMIC_REPRESENTATION_LIST(STORE) |
| 823 #undef STORE | 852 #undef STORE |
| 824 UNREACHABLE(); | 853 UNREACHABLE(); |
| 825 return nullptr; | 854 return nullptr; |
| 826 } | 855 } |
| 827 | 856 |
| 828 } // namespace compiler | 857 } // namespace compiler |
| 829 } // namespace internal | 858 } // namespace internal |
| 830 } // namespace v8 | 859 } // namespace v8 |
| OLD | NEW |