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...) Expand 10 before | Expand all | Expand 10 after 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 | |
164 #define CACHED_OP_LIST(V) \ | 145 #define CACHED_OP_LIST(V) \ |
165 V(Dead, Operator::kFoldable, 0, 0, 0, 1, 1, 1) \ | 146 V(Dead, Operator::kFoldable, 0, 0, 0, 1, 1, 1) \ |
166 V(DeoptimizeIf, Operator::kFoldable, 2, 1, 1, 0, 0, 1) \ | 147 V(DeoptimizeIf, Operator::kFoldable, 2, 1, 1, 0, 0, 1) \ |
167 V(DeoptimizeUnless, Operator::kFoldable, 2, 1, 1, 0, 0, 1) \ | 148 V(DeoptimizeUnless, Operator::kFoldable, 2, 1, 1, 0, 0, 1) \ |
168 V(IfTrue, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \ | 149 V(IfTrue, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \ |
169 V(IfFalse, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \ | 150 V(IfFalse, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \ |
170 V(IfSuccess, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \ | 151 V(IfSuccess, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \ |
171 V(IfDefault, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \ | 152 V(IfDefault, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \ |
172 V(Throw, Operator::kKontrol, 1, 1, 1, 0, 0, 1) \ | 153 V(Throw, Operator::kKontrol, 1, 1, 1, 0, 0, 1) \ |
173 V(Terminate, Operator::kKontrol, 0, 1, 1, 0, 0, 1) \ | 154 V(Terminate, Operator::kKontrol, 0, 1, 1, 0, 0, 1) \ |
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
680 | 661 |
681 const Operator* CommonOperatorBuilder::HeapConstant( | 662 const Operator* CommonOperatorBuilder::HeapConstant( |
682 const Handle<HeapObject>& value) { | 663 const Handle<HeapObject>& value) { |
683 return new (zone()) Operator1<Handle<HeapObject>>( // -- | 664 return new (zone()) Operator1<Handle<HeapObject>>( // -- |
684 IrOpcode::kHeapConstant, Operator::kPure, // opcode | 665 IrOpcode::kHeapConstant, Operator::kPure, // opcode |
685 "HeapConstant", // name | 666 "HeapConstant", // name |
686 0, 0, 0, 1, 0, 0, // counts | 667 0, 0, 0, 1, 0, 0, // counts |
687 value); // parameter | 668 value); // parameter |
688 } | 669 } |
689 | 670 |
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 } | |
707 | 671 |
708 const Operator* CommonOperatorBuilder::Select(MachineRepresentation rep, | 672 const Operator* CommonOperatorBuilder::Select(MachineRepresentation rep, |
709 BranchHint hint) { | 673 BranchHint hint) { |
710 return new (zone()) Operator1<SelectParameters>( // -- | 674 return new (zone()) Operator1<SelectParameters>( // -- |
711 IrOpcode::kSelect, Operator::kPure, // opcode | 675 IrOpcode::kSelect, Operator::kPure, // opcode |
712 "Select", // name | 676 "Select", // name |
713 3, 0, 0, 1, 0, 0, // counts | 677 3, 0, 0, 1, 0, 0, // counts |
714 SelectParameters(rep, hint)); // parameter | 678 SelectParameters(rep, hint)); // parameter |
715 } | 679 } |
716 | 680 |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
898 CommonOperatorBuilder::CreateFrameStateFunctionInfo( | 862 CommonOperatorBuilder::CreateFrameStateFunctionInfo( |
899 FrameStateType type, int parameter_count, int local_count, | 863 FrameStateType type, int parameter_count, int local_count, |
900 Handle<SharedFunctionInfo> shared_info) { | 864 Handle<SharedFunctionInfo> shared_info) { |
901 return new (zone()->New(sizeof(FrameStateFunctionInfo))) | 865 return new (zone()->New(sizeof(FrameStateFunctionInfo))) |
902 FrameStateFunctionInfo(type, parameter_count, local_count, shared_info); | 866 FrameStateFunctionInfo(type, parameter_count, local_count, shared_info); |
903 } | 867 } |
904 | 868 |
905 } // namespace compiler | 869 } // namespace compiler |
906 } // namespace internal | 870 } // namespace internal |
907 } // namespace v8 | 871 } // namespace v8 |
OLD | NEW |