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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 } | 184 } |
185 UNREACHABLE(); | 185 UNREACHABLE(); |
186 return os; | 186 return os; |
187 } | 187 } |
188 | 188 |
189 RegionObservability RegionObservabilityOf(Operator const* op) { | 189 RegionObservability RegionObservabilityOf(Operator const* op) { |
190 DCHECK_EQ(IrOpcode::kBeginRegion, op->opcode()); | 190 DCHECK_EQ(IrOpcode::kBeginRegion, op->opcode()); |
191 return OpParameter<RegionObservability>(op); | 191 return OpParameter<RegionObservability>(op); |
192 } | 192 } |
193 | 193 |
| 194 Type* TypeGuardTypeOf(Operator const* op) { |
| 195 DCHECK_EQ(IrOpcode::kTypeGuard, op->opcode()); |
| 196 return OpParameter<Type*>(op); |
| 197 } |
| 198 |
194 std::ostream& operator<<(std::ostream& os, | 199 std::ostream& operator<<(std::ostream& os, |
195 const ZoneVector<MachineType>* types) { | 200 const ZoneVector<MachineType>* types) { |
196 // Print all the MachineTypes, separated by commas. | 201 // Print all the MachineTypes, separated by commas. |
197 bool first = true; | 202 bool first = true; |
198 for (MachineType elem : *types) { | 203 for (MachineType elem : *types) { |
199 if (!first) { | 204 if (!first) { |
200 os << ", "; | 205 os << ", "; |
201 } | 206 } |
202 first = false; | 207 first = false; |
203 os << elem; | 208 os << elem; |
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
791 CACHED_PHI_LIST(CACHED_PHI) | 796 CACHED_PHI_LIST(CACHED_PHI) |
792 #undef CACHED_PHI | 797 #undef CACHED_PHI |
793 // Uncached. | 798 // Uncached. |
794 return new (zone()) Operator1<MachineRepresentation>( // -- | 799 return new (zone()) Operator1<MachineRepresentation>( // -- |
795 IrOpcode::kPhi, Operator::kPure, // opcode | 800 IrOpcode::kPhi, Operator::kPure, // opcode |
796 "Phi", // name | 801 "Phi", // name |
797 value_input_count, 0, 1, 1, 0, 0, // counts | 802 value_input_count, 0, 1, 1, 0, 0, // counts |
798 rep); // parameter | 803 rep); // parameter |
799 } | 804 } |
800 | 805 |
| 806 const Operator* CommonOperatorBuilder::TypeGuard(Type* type) { |
| 807 return new (zone()) Operator1<Type*>( // -- |
| 808 IrOpcode::kTypeGuard, Operator::kPure, // opcode |
| 809 "TypeGuard", // name |
| 810 1, 0, 1, 1, 0, 0, // counts |
| 811 type); // parameter |
| 812 } |
801 | 813 |
802 const Operator* CommonOperatorBuilder::EffectPhi(int effect_input_count) { | 814 const Operator* CommonOperatorBuilder::EffectPhi(int effect_input_count) { |
803 DCHECK(effect_input_count > 0); // Disallow empty effect phis. | 815 DCHECK(effect_input_count > 0); // Disallow empty effect phis. |
804 switch (effect_input_count) { | 816 switch (effect_input_count) { |
805 #define CACHED_EFFECT_PHI(input_count) \ | 817 #define CACHED_EFFECT_PHI(input_count) \ |
806 case input_count: \ | 818 case input_count: \ |
807 return &cache_.kEffectPhi##input_count##Operator; | 819 return &cache_.kEffectPhi##input_count##Operator; |
808 CACHED_EFFECT_PHI_LIST(CACHED_EFFECT_PHI) | 820 CACHED_EFFECT_PHI_LIST(CACHED_EFFECT_PHI) |
809 #undef CACHED_EFFECT_PHI | 821 #undef CACHED_EFFECT_PHI |
810 default: | 822 default: |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
975 CommonOperatorBuilder::CreateFrameStateFunctionInfo( | 987 CommonOperatorBuilder::CreateFrameStateFunctionInfo( |
976 FrameStateType type, int parameter_count, int local_count, | 988 FrameStateType type, int parameter_count, int local_count, |
977 Handle<SharedFunctionInfo> shared_info) { | 989 Handle<SharedFunctionInfo> shared_info) { |
978 return new (zone()->New(sizeof(FrameStateFunctionInfo))) | 990 return new (zone()->New(sizeof(FrameStateFunctionInfo))) |
979 FrameStateFunctionInfo(type, parameter_count, local_count, shared_info); | 991 FrameStateFunctionInfo(type, parameter_count, local_count, shared_info); |
980 } | 992 } |
981 | 993 |
982 } // namespace compiler | 994 } // namespace compiler |
983 } // namespace internal | 995 } // namespace internal |
984 } // namespace v8 | 996 } // namespace v8 |
OLD | NEW |