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 18 matching lines...) Expand all Loading... |
29 | 29 |
30 | 30 |
31 std::ostream& operator<<(std::ostream& os, StoreRepresentation rep) { | 31 std::ostream& operator<<(std::ostream& os, StoreRepresentation rep) { |
32 return os << "(" << rep.representation() << " : " << rep.write_barrier_kind() | 32 return os << "(" << rep.representation() << " : " << rep.write_barrier_kind() |
33 << ")"; | 33 << ")"; |
34 } | 34 } |
35 | 35 |
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::kAtomicLoad == op->opcode()); | 40 IrOpcode::kAtomicLoad == op->opcode()); |
40 return OpParameter<LoadRepresentation>(op); | 41 return OpParameter<LoadRepresentation>(op); |
41 } | 42 } |
42 | 43 |
43 | 44 |
44 StoreRepresentation const& StoreRepresentationOf(Operator const* op) { | 45 StoreRepresentation const& StoreRepresentationOf(Operator const* op) { |
45 DCHECK_EQ(IrOpcode::kStore, op->opcode()); | 46 DCHECK_EQ(IrOpcode::kStore, op->opcode()); |
46 return OpParameter<StoreRepresentation>(op); | 47 return OpParameter<StoreRepresentation>(op); |
47 } | 48 } |
48 | 49 |
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
493 "UnalignedLoad", 2, 1, 1, 1, 1, 0, MachineType::Type()) {} \ | 494 "UnalignedLoad", 2, 1, 1, 1, 1, 0, MachineType::Type()) {} \ |
494 }; \ | 495 }; \ |
495 struct CheckedLoad##Type##Operator final \ | 496 struct CheckedLoad##Type##Operator final \ |
496 : public Operator1<CheckedLoadRepresentation> { \ | 497 : public Operator1<CheckedLoadRepresentation> { \ |
497 CheckedLoad##Type##Operator() \ | 498 CheckedLoad##Type##Operator() \ |
498 : Operator1<CheckedLoadRepresentation>( \ | 499 : Operator1<CheckedLoadRepresentation>( \ |
499 IrOpcode::kCheckedLoad, \ | 500 IrOpcode::kCheckedLoad, \ |
500 Operator::kNoDeopt | Operator::kNoThrow | Operator::kNoWrite, \ | 501 Operator::kNoDeopt | Operator::kNoThrow | Operator::kNoWrite, \ |
501 "CheckedLoad", 3, 1, 1, 1, 1, 0, MachineType::Type()) {} \ | 502 "CheckedLoad", 3, 1, 1, 1, 1, 0, MachineType::Type()) {} \ |
502 }; \ | 503 }; \ |
| 504 struct ProtectedLoad##Type##Operator final \ |
| 505 : public Operator1<ProtectedLoadRepresentation> { \ |
| 506 ProtectedLoad##Type##Operator() \ |
| 507 : Operator1<ProtectedLoadRepresentation>( \ |
| 508 IrOpcode::kProtectedLoad, \ |
| 509 Operator::kNoDeopt | Operator::kNoThrow | Operator::kNoWrite, \ |
| 510 "ProtectedLoad", 4, 1, 1, 1, 1, 0, MachineType::Type()) {} \ |
| 511 }; \ |
503 Load##Type##Operator kLoad##Type; \ | 512 Load##Type##Operator kLoad##Type; \ |
504 UnalignedLoad##Type##Operator kUnalignedLoad##Type; \ | 513 UnalignedLoad##Type##Operator kUnalignedLoad##Type; \ |
505 CheckedLoad##Type##Operator kCheckedLoad##Type; | 514 CheckedLoad##Type##Operator kCheckedLoad##Type; \ |
| 515 ProtectedLoad##Type##Operator kProtectedLoad##Type; |
506 MACHINE_TYPE_LIST(LOAD) | 516 MACHINE_TYPE_LIST(LOAD) |
507 #undef LOAD | 517 #undef LOAD |
508 | 518 |
509 #define STACKSLOT(Type) \ | 519 #define STACKSLOT(Type) \ |
510 struct StackSlot##Type##Operator final \ | 520 struct StackSlot##Type##Operator final \ |
511 : public Operator1<MachineRepresentation> { \ | 521 : public Operator1<MachineRepresentation> { \ |
512 StackSlot##Type##Operator() \ | 522 StackSlot##Type##Operator() \ |
513 : Operator1<MachineRepresentation>( \ | 523 : Operator1<MachineRepresentation>( \ |
514 IrOpcode::kStackSlot, Operator::kNoDeopt | Operator::kNoThrow, \ | 524 IrOpcode::kStackSlot, Operator::kNoDeopt | Operator::kNoThrow, \ |
515 "StackSlot", 0, 0, 0, 1, 0, 0, \ | 525 "StackSlot", 0, 0, 0, 1, 0, 0, \ |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
690 #define LOAD(Type) \ | 700 #define LOAD(Type) \ |
691 if (rep == MachineType::Type()) { \ | 701 if (rep == MachineType::Type()) { \ |
692 return &cache_.kLoad##Type; \ | 702 return &cache_.kLoad##Type; \ |
693 } | 703 } |
694 MACHINE_TYPE_LIST(LOAD) | 704 MACHINE_TYPE_LIST(LOAD) |
695 #undef LOAD | 705 #undef LOAD |
696 UNREACHABLE(); | 706 UNREACHABLE(); |
697 return nullptr; | 707 return nullptr; |
698 } | 708 } |
699 | 709 |
| 710 const Operator* MachineOperatorBuilder::ProtectedLoad(LoadRepresentation rep) { |
| 711 #define LOAD(Type) \ |
| 712 if (rep == MachineType::Type()) { \ |
| 713 return &cache_.kProtectedLoad##Type; \ |
| 714 } |
| 715 MACHINE_TYPE_LIST(LOAD) |
| 716 #undef LOAD |
| 717 UNREACHABLE(); |
| 718 return nullptr; |
| 719 } |
| 720 |
700 const Operator* MachineOperatorBuilder::StackSlot(MachineRepresentation rep) { | 721 const Operator* MachineOperatorBuilder::StackSlot(MachineRepresentation rep) { |
701 #define STACKSLOT(Type) \ | 722 #define STACKSLOT(Type) \ |
702 if (rep == MachineType::Type().representation()) { \ | 723 if (rep == MachineType::Type().representation()) { \ |
703 return &cache_.kStackSlot##Type; \ | 724 return &cache_.kStackSlot##Type; \ |
704 } | 725 } |
705 MACHINE_TYPE_LIST(STACKSLOT) | 726 MACHINE_TYPE_LIST(STACKSLOT) |
706 #undef STACKSLOT | 727 #undef STACKSLOT |
707 UNREACHABLE(); | 728 UNREACHABLE(); |
708 return nullptr; | 729 return nullptr; |
709 } | 730 } |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
792 } | 813 } |
793 ATOMIC_REPRESENTATION_LIST(STORE) | 814 ATOMIC_REPRESENTATION_LIST(STORE) |
794 #undef STORE | 815 #undef STORE |
795 UNREACHABLE(); | 816 UNREACHABLE(); |
796 return nullptr; | 817 return nullptr; |
797 } | 818 } |
798 | 819 |
799 } // namespace compiler | 820 } // namespace compiler |
800 } // namespace internal | 821 } // namespace internal |
801 } // namespace v8 | 822 } // namespace v8 |
OLD | NEW |