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 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 for (MachineType elem : *types) { | 203 for (MachineType elem : *types) { |
204 if (!first) { | 204 if (!first) { |
205 os << ", "; | 205 os << ", "; |
206 } | 206 } |
207 first = false; | 207 first = false; |
208 os << elem; | 208 os << elem; |
209 } | 209 } |
210 return os; | 210 return os; |
211 } | 211 } |
212 | 212 |
213 int OsrValueIndexOf(Operator const* op) { | |
214 DCHECK_EQ(IrOpcode::kOsrValue, op->opcode()); | |
215 return OpParameter<int>(op); | |
216 } | |
217 | |
218 size_t hash_value(OsrGuardType type) { return static_cast<size_t>(type); } | |
219 | |
220 std::ostream& operator<<(std::ostream& os, OsrGuardType type) { | |
221 switch (type) { | |
222 case OsrGuardType::kUninitialized: | |
223 return os << "Uninitialized"; | |
224 case OsrGuardType::kSignedSmall: | |
225 return os << "SignedSmall"; | |
226 case OsrGuardType::kAny: | |
227 return os << "Any"; | |
228 } | |
229 UNREACHABLE(); | |
230 return os; | |
231 } | |
232 | |
233 OsrGuardType OsrGuardTypeOf(Operator const* op) { | |
234 DCHECK_EQ(IrOpcode::kOsrGuard, op->opcode()); | |
235 return OpParameter<OsrGuardType>(op); | |
236 } | |
237 | |
238 #define CACHED_OP_LIST(V) \ | 213 #define CACHED_OP_LIST(V) \ |
239 V(Dead, Operator::kFoldable, 0, 0, 0, 1, 1, 1) \ | 214 V(Dead, Operator::kFoldable, 0, 0, 0, 1, 1, 1) \ |
240 V(IfTrue, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \ | 215 V(IfTrue, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \ |
241 V(IfFalse, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \ | 216 V(IfFalse, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \ |
242 V(IfSuccess, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \ | 217 V(IfSuccess, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \ |
243 V(IfException, Operator::kKontrol, 0, 1, 1, 1, 1, 1) \ | 218 V(IfException, Operator::kKontrol, 0, 1, 1, 1, 1, 1) \ |
244 V(IfDefault, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \ | 219 V(IfDefault, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \ |
245 V(Throw, Operator::kKontrol, 1, 1, 1, 0, 0, 1) \ | 220 V(Throw, Operator::kKontrol, 1, 1, 1, 0, 0, 1) \ |
246 V(Terminate, Operator::kKontrol, 0, 1, 1, 0, 0, 1) \ | 221 V(Terminate, Operator::kKontrol, 0, 1, 1, 0, 0, 1) \ |
247 V(OsrNormalEntry, Operator::kFoldable, 0, 1, 1, 0, 1, 1) \ | 222 V(OsrNormalEntry, Operator::kFoldable, 0, 1, 1, 0, 1, 1) \ |
(...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
798 } | 773 } |
799 } | 774 } |
800 // Uncached. | 775 // Uncached. |
801 return new (zone()) Operator1<ParameterInfo>( // -- | 776 return new (zone()) Operator1<ParameterInfo>( // -- |
802 IrOpcode::kParameter, Operator::kPure, // opcode | 777 IrOpcode::kParameter, Operator::kPure, // opcode |
803 "Parameter", // name | 778 "Parameter", // name |
804 1, 0, 0, 1, 0, 0, // counts | 779 1, 0, 0, 1, 0, 0, // counts |
805 ParameterInfo(index, debug_name)); // parameter info | 780 ParameterInfo(index, debug_name)); // parameter info |
806 } | 781 } |
807 | 782 |
| 783 |
808 const Operator* CommonOperatorBuilder::OsrValue(int index) { | 784 const Operator* CommonOperatorBuilder::OsrValue(int index) { |
809 return new (zone()) Operator1<int>( // -- | 785 return new (zone()) Operator1<int>( // -- |
810 IrOpcode::kOsrValue, Operator::kNoProperties, // opcode | 786 IrOpcode::kOsrValue, Operator::kNoProperties, // opcode |
811 "OsrValue", // name | 787 "OsrValue", // name |
812 0, 0, 1, 1, 0, 0, // counts | 788 0, 0, 1, 1, 0, 0, // counts |
813 index); // parameter | 789 index); // parameter |
814 } | 790 } |
815 | 791 |
816 const Operator* CommonOperatorBuilder::OsrGuard(OsrGuardType type) { | |
817 return new (zone()) Operator1<OsrGuardType>( // -- | |
818 IrOpcode::kOsrGuard, Operator::kNoThrow, // opcode | |
819 "OsrGuard", // name | |
820 1, 1, 1, 1, 1, 0, // counts | |
821 type); // parameter | |
822 } | |
823 | 792 |
824 const Operator* CommonOperatorBuilder::Int32Constant(int32_t value) { | 793 const Operator* CommonOperatorBuilder::Int32Constant(int32_t value) { |
825 return new (zone()) Operator1<int32_t>( // -- | 794 return new (zone()) Operator1<int32_t>( // -- |
826 IrOpcode::kInt32Constant, Operator::kPure, // opcode | 795 IrOpcode::kInt32Constant, Operator::kPure, // opcode |
827 "Int32Constant", // name | 796 "Int32Constant", // name |
828 0, 0, 0, 1, 0, 0, // counts | 797 0, 0, 0, 1, 0, 0, // counts |
829 value); // parameter | 798 value); // parameter |
830 } | 799 } |
831 | 800 |
832 | 801 |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1116 CommonOperatorBuilder::CreateFrameStateFunctionInfo( | 1085 CommonOperatorBuilder::CreateFrameStateFunctionInfo( |
1117 FrameStateType type, int parameter_count, int local_count, | 1086 FrameStateType type, int parameter_count, int local_count, |
1118 Handle<SharedFunctionInfo> shared_info) { | 1087 Handle<SharedFunctionInfo> shared_info) { |
1119 return new (zone()->New(sizeof(FrameStateFunctionInfo))) | 1088 return new (zone()->New(sizeof(FrameStateFunctionInfo))) |
1120 FrameStateFunctionInfo(type, parameter_count, local_count, shared_info); | 1089 FrameStateFunctionInfo(type, parameter_count, local_count, shared_info); |
1121 } | 1090 } |
1122 | 1091 |
1123 } // namespace compiler | 1092 } // namespace compiler |
1124 } // namespace internal | 1093 } // namespace internal |
1125 } // namespace v8 | 1094 } // namespace v8 |
OLD | NEW |