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 |
213 #define CACHED_OP_LIST(V) \ | 238 #define CACHED_OP_LIST(V) \ |
214 V(Dead, Operator::kFoldable, 0, 0, 0, 1, 1, 1) \ | 239 V(Dead, Operator::kFoldable, 0, 0, 0, 1, 1, 1) \ |
215 V(IfTrue, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \ | 240 V(IfTrue, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \ |
216 V(IfFalse, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \ | 241 V(IfFalse, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \ |
217 V(IfSuccess, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \ | 242 V(IfSuccess, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \ |
218 V(IfException, Operator::kKontrol, 0, 1, 1, 1, 1, 1) \ | 243 V(IfException, Operator::kKontrol, 0, 1, 1, 1, 1, 1) \ |
219 V(IfDefault, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \ | 244 V(IfDefault, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \ |
220 V(Throw, Operator::kKontrol, 1, 1, 1, 0, 0, 1) \ | 245 V(Throw, Operator::kKontrol, 1, 1, 1, 0, 0, 1) \ |
221 V(Terminate, Operator::kKontrol, 0, 1, 1, 0, 0, 1) \ | 246 V(Terminate, Operator::kKontrol, 0, 1, 1, 0, 0, 1) \ |
222 V(OsrNormalEntry, Operator::kFoldable, 0, 1, 1, 0, 1, 1) \ | 247 V(OsrNormalEntry, Operator::kFoldable, 0, 1, 1, 0, 1, 1) \ |
(...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
773 } | 798 } |
774 } | 799 } |
775 // Uncached. | 800 // Uncached. |
776 return new (zone()) Operator1<ParameterInfo>( // -- | 801 return new (zone()) Operator1<ParameterInfo>( // -- |
777 IrOpcode::kParameter, Operator::kPure, // opcode | 802 IrOpcode::kParameter, Operator::kPure, // opcode |
778 "Parameter", // name | 803 "Parameter", // name |
779 1, 0, 0, 1, 0, 0, // counts | 804 1, 0, 0, 1, 0, 0, // counts |
780 ParameterInfo(index, debug_name)); // parameter info | 805 ParameterInfo(index, debug_name)); // parameter info |
781 } | 806 } |
782 | 807 |
783 | |
784 const Operator* CommonOperatorBuilder::OsrValue(int index) { | 808 const Operator* CommonOperatorBuilder::OsrValue(int index) { |
785 return new (zone()) Operator1<int>( // -- | 809 return new (zone()) Operator1<int>( // -- |
786 IrOpcode::kOsrValue, Operator::kNoProperties, // opcode | 810 IrOpcode::kOsrValue, Operator::kNoProperties, // opcode |
787 "OsrValue", // name | 811 "OsrValue", // name |
788 0, 0, 1, 1, 0, 0, // counts | 812 0, 0, 1, 1, 0, 0, // counts |
789 index); // parameter | 813 index); // parameter |
790 } | 814 } |
791 | 815 |
| 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 } |
792 | 823 |
793 const Operator* CommonOperatorBuilder::Int32Constant(int32_t value) { | 824 const Operator* CommonOperatorBuilder::Int32Constant(int32_t value) { |
794 return new (zone()) Operator1<int32_t>( // -- | 825 return new (zone()) Operator1<int32_t>( // -- |
795 IrOpcode::kInt32Constant, Operator::kPure, // opcode | 826 IrOpcode::kInt32Constant, Operator::kPure, // opcode |
796 "Int32Constant", // name | 827 "Int32Constant", // name |
797 0, 0, 0, 1, 0, 0, // counts | 828 0, 0, 0, 1, 0, 0, // counts |
798 value); // parameter | 829 value); // parameter |
799 } | 830 } |
800 | 831 |
801 | 832 |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1085 CommonOperatorBuilder::CreateFrameStateFunctionInfo( | 1116 CommonOperatorBuilder::CreateFrameStateFunctionInfo( |
1086 FrameStateType type, int parameter_count, int local_count, | 1117 FrameStateType type, int parameter_count, int local_count, |
1087 Handle<SharedFunctionInfo> shared_info) { | 1118 Handle<SharedFunctionInfo> shared_info) { |
1088 return new (zone()->New(sizeof(FrameStateFunctionInfo))) | 1119 return new (zone()->New(sizeof(FrameStateFunctionInfo))) |
1089 FrameStateFunctionInfo(type, parameter_count, local_count, shared_info); | 1120 FrameStateFunctionInfo(type, parameter_count, local_count, shared_info); |
1090 } | 1121 } |
1091 | 1122 |
1092 } // namespace compiler | 1123 } // namespace compiler |
1093 } // namespace internal | 1124 } // namespace internal |
1094 } // namespace v8 | 1125 } // namespace v8 |
OLD | NEW |