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/common-operator.h" | 5 #include "src/compiler/common-operator.h" |
6 | 6 |
7 #include "src/assembler.h" | 7 #include "src/assembler.h" |
8 #include "src/base/lazy-instance.h" | 8 #include "src/base/lazy-instance.h" |
9 #include "src/compiler/linkage.h" | 9 #include "src/compiler/linkage.h" |
10 #include "src/compiler/opcodes.h" | 10 #include "src/compiler/opcodes.h" |
(...skipping 124 matching lines...) Loading... |
135 | 135 |
136 size_t hash_value(ParameterInfo const& p) { return p.index(); } | 136 size_t hash_value(ParameterInfo const& p) { return p.index(); } |
137 | 137 |
138 | 138 |
139 std::ostream& operator<<(std::ostream& os, ParameterInfo const& i) { | 139 std::ostream& operator<<(std::ostream& os, ParameterInfo const& i) { |
140 if (i.debug_name()) os << i.debug_name() << '#'; | 140 if (i.debug_name()) os << i.debug_name() << '#'; |
141 os << i.index(); | 141 os << i.index(); |
142 return os; | 142 return os; |
143 } | 143 } |
144 | 144 |
| 145 bool operator==(RelocatablePtrConstantInfo const& lhs, |
| 146 RelocatablePtrConstantInfo const& rhs) { |
| 147 return lhs.rmode() == rhs.rmode() && lhs.value() == rhs.value(); |
| 148 } |
| 149 |
| 150 bool operator!=(RelocatablePtrConstantInfo const& lhs, |
| 151 RelocatablePtrConstantInfo const& rhs) { |
| 152 return !(lhs == rhs); |
| 153 } |
| 154 |
| 155 size_t hash_value(RelocatablePtrConstantInfo const& p) { |
| 156 return base::hash_combine(p.value(), p.rmode()); |
| 157 } |
| 158 |
| 159 std::ostream& operator<<(std::ostream& os, |
| 160 RelocatablePtrConstantInfo const& p) { |
| 161 return os << p.value() << "|" << p.rmode(); |
| 162 } |
| 163 |
145 #define CACHED_OP_LIST(V) \ | 164 #define CACHED_OP_LIST(V) \ |
146 V(Dead, Operator::kFoldable, 0, 0, 0, 1, 1, 1) \ | 165 V(Dead, Operator::kFoldable, 0, 0, 0, 1, 1, 1) \ |
147 V(DeoptimizeIf, Operator::kFoldable, 2, 1, 1, 0, 0, 1) \ | 166 V(DeoptimizeIf, Operator::kFoldable, 2, 1, 1, 0, 0, 1) \ |
148 V(DeoptimizeUnless, Operator::kFoldable, 2, 1, 1, 0, 0, 1) \ | 167 V(DeoptimizeUnless, Operator::kFoldable, 2, 1, 1, 0, 0, 1) \ |
149 V(IfTrue, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \ | 168 V(IfTrue, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \ |
150 V(IfFalse, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \ | 169 V(IfFalse, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \ |
151 V(IfSuccess, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \ | 170 V(IfSuccess, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \ |
152 V(IfDefault, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \ | 171 V(IfDefault, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \ |
153 V(Throw, Operator::kKontrol, 1, 1, 1, 0, 0, 1) \ | 172 V(Throw, Operator::kKontrol, 1, 1, 1, 0, 0, 1) \ |
154 V(Terminate, Operator::kKontrol, 0, 1, 1, 0, 0, 1) \ | 173 V(Terminate, Operator::kKontrol, 0, 1, 1, 0, 0, 1) \ |
(...skipping 506 matching lines...) Loading... |
661 | 680 |
662 const Operator* CommonOperatorBuilder::HeapConstant( | 681 const Operator* CommonOperatorBuilder::HeapConstant( |
663 const Handle<HeapObject>& value) { | 682 const Handle<HeapObject>& value) { |
664 return new (zone()) Operator1<Handle<HeapObject>>( // -- | 683 return new (zone()) Operator1<Handle<HeapObject>>( // -- |
665 IrOpcode::kHeapConstant, Operator::kPure, // opcode | 684 IrOpcode::kHeapConstant, Operator::kPure, // opcode |
666 "HeapConstant", // name | 685 "HeapConstant", // name |
667 0, 0, 0, 1, 0, 0, // counts | 686 0, 0, 0, 1, 0, 0, // counts |
668 value); // parameter | 687 value); // parameter |
669 } | 688 } |
670 | 689 |
| 690 const Operator* CommonOperatorBuilder::RelocatableInt32Constant( |
| 691 int32_t value, RelocInfo::Mode rmode) { |
| 692 return new (zone()) Operator1<RelocatablePtrConstantInfo>( // -- |
| 693 IrOpcode::kRelocatableInt32Constant, Operator::kPure, // opcode |
| 694 "RelocatableInt32Constant", // name |
| 695 0, 0, 0, 1, 0, 0, // counts |
| 696 RelocatablePtrConstantInfo(value, rmode)); // parameter |
| 697 } |
| 698 |
| 699 const Operator* CommonOperatorBuilder::RelocatableInt64Constant( |
| 700 int64_t value, RelocInfo::Mode rmode) { |
| 701 return new (zone()) Operator1<RelocatablePtrConstantInfo>( // -- |
| 702 IrOpcode::kRelocatableInt64Constant, Operator::kPure, // opcode |
| 703 "RelocatableInt64Constant", // name |
| 704 0, 0, 0, 1, 0, 0, // counts |
| 705 RelocatablePtrConstantInfo(value, rmode)); // parameter |
| 706 } |
671 | 707 |
672 const Operator* CommonOperatorBuilder::Select(MachineRepresentation rep, | 708 const Operator* CommonOperatorBuilder::Select(MachineRepresentation rep, |
673 BranchHint hint) { | 709 BranchHint hint) { |
674 return new (zone()) Operator1<SelectParameters>( // -- | 710 return new (zone()) Operator1<SelectParameters>( // -- |
675 IrOpcode::kSelect, Operator::kPure, // opcode | 711 IrOpcode::kSelect, Operator::kPure, // opcode |
676 "Select", // name | 712 "Select", // name |
677 3, 0, 0, 1, 0, 0, // counts | 713 3, 0, 0, 1, 0, 0, // counts |
678 SelectParameters(rep, hint)); // parameter | 714 SelectParameters(rep, hint)); // parameter |
679 } | 715 } |
680 | 716 |
(...skipping 181 matching lines...) Loading... |
862 CommonOperatorBuilder::CreateFrameStateFunctionInfo( | 898 CommonOperatorBuilder::CreateFrameStateFunctionInfo( |
863 FrameStateType type, int parameter_count, int local_count, | 899 FrameStateType type, int parameter_count, int local_count, |
864 Handle<SharedFunctionInfo> shared_info) { | 900 Handle<SharedFunctionInfo> shared_info) { |
865 return new (zone()->New(sizeof(FrameStateFunctionInfo))) | 901 return new (zone()->New(sizeof(FrameStateFunctionInfo))) |
866 FrameStateFunctionInfo(type, parameter_count, local_count, shared_info); | 902 FrameStateFunctionInfo(type, parameter_count, local_count, shared_info); |
867 } | 903 } |
868 | 904 |
869 } // namespace compiler | 905 } // namespace compiler |
870 } // namespace internal | 906 } // namespace internal |
871 } // namespace v8 | 907 } // namespace v8 |
OLD | NEW |