| 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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 info.state_combine()); | 96 info.state_combine()); |
| 97 } | 97 } |
| 98 | 98 |
| 99 | 99 |
| 100 std::ostream& operator<<(std::ostream& os, FrameStateCallInfo const& info) { | 100 std::ostream& operator<<(std::ostream& os, FrameStateCallInfo const& info) { |
| 101 return os << info.type() << ", " << info.bailout_id() << ", " | 101 return os << info.type() << ", " << info.bailout_id() << ", " |
| 102 << info.state_combine(); | 102 << info.state_combine(); |
| 103 } | 103 } |
| 104 | 104 |
| 105 | 105 |
| 106 #define CACHED_OP_LIST(V) \ | 106 #define CACHED_OP_LIST(V) \ |
| 107 V(Dead, Operator::kFoldable, 0, 0, 0, 1) \ | 107 V(Dead, Operator::kFoldable, 0, 0, 0, 0, 0, 1) \ |
| 108 V(End, Operator::kFoldable, 0, 0, 1, 0) \ | 108 V(End, Operator::kFoldable, 0, 0, 1, 0, 0, 0) \ |
| 109 V(IfTrue, Operator::kFoldable, 0, 0, 1, 1) \ | 109 V(IfTrue, Operator::kFoldable, 0, 0, 1, 0, 0, 1) \ |
| 110 V(IfFalse, Operator::kFoldable, 0, 0, 1, 1) \ | 110 V(IfFalse, Operator::kFoldable, 0, 0, 1, 0, 0, 1) \ |
| 111 V(Throw, Operator::kFoldable, 1, 1, 1, 1) \ | 111 V(Throw, Operator::kFoldable, 1, 1, 1, 0, 0, 1) \ |
| 112 V(Return, Operator::kNoProperties, 1, 1, 1, 1) | 112 V(Return, Operator::kNoProperties, 1, 1, 1, 0, 0, 1) \ |
| 113 V(OsrNormalEntry, Operator::kFoldable, 0, 1, 1, 0, 1, 1) \ |
| 114 V(OsrLoopEntry, Operator::kFoldable, 0, 1, 1, 0, 1, 1) |
| 113 | 115 |
| 114 | 116 |
| 115 struct CommonOperatorGlobalCache FINAL { | 117 struct CommonOperatorGlobalCache FINAL { |
| 116 #define CACHED(Name, properties, value_input_count, effect_input_count, \ | 118 #define CACHED(Name, properties, value_input_count, effect_input_count, \ |
| 117 control_input_count, control_output_count) \ | 119 control_input_count, value_output_count, effect_output_count, \ |
| 118 struct Name##Operator FINAL : public Operator { \ | 120 control_output_count) \ |
| 119 Name##Operator() \ | 121 struct Name##Operator FINAL : public Operator { \ |
| 120 : Operator(IrOpcode::k##Name, properties, #Name, value_input_count, \ | 122 Name##Operator() \ |
| 121 effect_input_count, control_input_count, 0, 0, \ | 123 : Operator(IrOpcode::k##Name, properties, #Name, value_input_count, \ |
| 122 control_output_count) {} \ | 124 effect_input_count, control_input_count, \ |
| 123 }; \ | 125 value_output_count, effect_output_count, \ |
| 126 control_output_count) {} \ |
| 127 }; \ |
| 124 Name##Operator k##Name##Operator; | 128 Name##Operator k##Name##Operator; |
| 125 CACHED_OP_LIST(CACHED) | 129 CACHED_OP_LIST(CACHED) |
| 126 #undef CACHED | 130 #undef CACHED |
| 127 | 131 |
| 128 template <BranchHint kBranchHint> | 132 template <BranchHint kBranchHint> |
| 129 struct BranchOperator FINAL : public Operator1<BranchHint> { | 133 struct BranchOperator FINAL : public Operator1<BranchHint> { |
| 130 BranchOperator() | 134 BranchOperator() |
| 131 : Operator1<BranchHint>( // -- | 135 : Operator1<BranchHint>( // -- |
| 132 IrOpcode::kBranch, Operator::kFoldable, // opcode | 136 IrOpcode::kBranch, Operator::kFoldable, // opcode |
| 133 "Branch", // name | 137 "Branch", // name |
| 134 1, 0, 1, 0, 0, 2, // counts | 138 1, 0, 1, 0, 0, 2, // counts |
| 135 kBranchHint) {} // parameter | 139 kBranchHint) {} // parameter |
| 136 }; | 140 }; |
| 137 BranchOperator<BranchHint::kNone> kBranchNoneOperator; | 141 BranchOperator<BranchHint::kNone> kBranchNoneOperator; |
| 138 BranchOperator<BranchHint::kTrue> kBranchTrueOperator; | 142 BranchOperator<BranchHint::kTrue> kBranchTrueOperator; |
| 139 BranchOperator<BranchHint::kFalse> kBranchFalseOperator; | 143 BranchOperator<BranchHint::kFalse> kBranchFalseOperator; |
| 140 }; | 144 }; |
| 141 | 145 |
| 142 | 146 |
| 143 static base::LazyInstance<CommonOperatorGlobalCache>::type kCache = | 147 static base::LazyInstance<CommonOperatorGlobalCache>::type kCache = |
| 144 LAZY_INSTANCE_INITIALIZER; | 148 LAZY_INSTANCE_INITIALIZER; |
| 145 | 149 |
| 146 | 150 |
| 147 CommonOperatorBuilder::CommonOperatorBuilder(Zone* zone) | 151 CommonOperatorBuilder::CommonOperatorBuilder(Zone* zone) |
| 148 : cache_(kCache.Get()), zone_(zone) {} | 152 : cache_(kCache.Get()), zone_(zone) {} |
| 149 | 153 |
| 150 | 154 |
| 151 #define CACHED(Name, properties, value_input_count, effect_input_count, \ | 155 #define CACHED(Name, properties, value_input_count, effect_input_count, \ |
| 152 control_input_count, control_output_count) \ | 156 control_input_count, value_output_count, effect_output_count, \ |
| 153 const Operator* CommonOperatorBuilder::Name() { \ | 157 control_output_count) \ |
| 154 return &cache_.k##Name##Operator; \ | 158 const Operator* CommonOperatorBuilder::Name() { \ |
| 159 return &cache_.k##Name##Operator; \ |
| 155 } | 160 } |
| 156 CACHED_OP_LIST(CACHED) | 161 CACHED_OP_LIST(CACHED) |
| 157 #undef CACHED | 162 #undef CACHED |
| 158 | 163 |
| 159 | 164 |
| 160 const Operator* CommonOperatorBuilder::Branch(BranchHint hint) { | 165 const Operator* CommonOperatorBuilder::Branch(BranchHint hint) { |
| 161 switch (hint) { | 166 switch (hint) { |
| 162 case BranchHint::kNone: | 167 case BranchHint::kNone: |
| 163 return &cache_.kBranchNoneOperator; | 168 return &cache_.kBranchNoneOperator; |
| 164 case BranchHint::kTrue: | 169 case BranchHint::kTrue: |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 | 212 |
| 208 const Operator* CommonOperatorBuilder::Parameter(int index) { | 213 const Operator* CommonOperatorBuilder::Parameter(int index) { |
| 209 return new (zone()) Operator1<int>( // -- | 214 return new (zone()) Operator1<int>( // -- |
| 210 IrOpcode::kParameter, Operator::kPure, // opcode | 215 IrOpcode::kParameter, Operator::kPure, // opcode |
| 211 "Parameter", // name | 216 "Parameter", // name |
| 212 1, 0, 0, 1, 0, 0, // counts | 217 1, 0, 0, 1, 0, 0, // counts |
| 213 index); // parameter | 218 index); // parameter |
| 214 } | 219 } |
| 215 | 220 |
| 216 | 221 |
| 222 const Operator* CommonOperatorBuilder::OsrValue(int index) { |
| 223 return new (zone()) Operator1<int>( // -- |
| 224 IrOpcode::kOsrValue, Operator::kPure, // opcode |
| 225 "OsrValue", // name |
| 226 0, 0, 1, 1, 0, 0, // counts |
| 227 index); // parameter |
| 228 } |
| 229 |
| 230 |
| 217 const Operator* CommonOperatorBuilder::Int32Constant(int32_t value) { | 231 const Operator* CommonOperatorBuilder::Int32Constant(int32_t value) { |
| 218 return new (zone()) Operator1<int32_t>( // -- | 232 return new (zone()) Operator1<int32_t>( // -- |
| 219 IrOpcode::kInt32Constant, Operator::kPure, // opcode | 233 IrOpcode::kInt32Constant, Operator::kPure, // opcode |
| 220 "Int32Constant", // name | 234 "Int32Constant", // name |
| 221 0, 0, 0, 1, 0, 0, // counts | 235 0, 0, 0, 1, 0, 0, // counts |
| 222 value); // parameter | 236 value); // parameter |
| 223 } | 237 } |
| 224 | 238 |
| 225 | 239 |
| 226 const Operator* CommonOperatorBuilder::Int64Constant(int64_t value) { | 240 const Operator* CommonOperatorBuilder::Int64Constant(int64_t value) { |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 return new (zone()) Operator1<size_t>( // -- | 386 return new (zone()) Operator1<size_t>( // -- |
| 373 IrOpcode::kProjection, Operator::kPure, // opcode | 387 IrOpcode::kProjection, Operator::kPure, // opcode |
| 374 "Projection", // name | 388 "Projection", // name |
| 375 1, 0, 0, 1, 0, 0, // counts | 389 1, 0, 0, 1, 0, 0, // counts |
| 376 index); // parameter | 390 index); // parameter |
| 377 } | 391 } |
| 378 | 392 |
| 379 } // namespace compiler | 393 } // namespace compiler |
| 380 } // namespace internal | 394 } // namespace internal |
| 381 } // namespace v8 | 395 } // namespace v8 |
| OLD | NEW |