| 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 #define CACHED_LOOP_LIST(V) \ | 117 #define CACHED_LOOP_LIST(V) \ |
| 116 V(1) \ | 118 V(1) \ |
| 117 V(2) | 119 V(2) |
| 118 | 120 |
| 119 | 121 |
| 120 #define CACHED_MERGE_LIST(V) \ | 122 #define CACHED_MERGE_LIST(V) \ |
| 121 V(1) \ | 123 V(1) \ |
| 122 V(2) \ | 124 V(2) \ |
| 123 V(3) \ | 125 V(3) \ |
| 124 V(4) \ | 126 V(4) \ |
| 125 V(5) \ | 127 V(5) \ |
| 126 V(6) \ | 128 V(6) \ |
| 127 V(7) \ | 129 V(7) \ |
| 128 V(8) | 130 V(8) |
| 129 | 131 |
| 130 | 132 |
| 131 #define CACHED_PARAMETER_LIST(V) \ | 133 #define CACHED_PARAMETER_LIST(V) \ |
| 132 V(0) \ | 134 V(0) \ |
| 133 V(1) \ | 135 V(1) \ |
| 134 V(2) \ | 136 V(2) \ |
| 135 V(3) \ | 137 V(3) \ |
| 136 V(4) \ | 138 V(4) \ |
| 137 V(5) \ | 139 V(5) \ |
| 138 V(6) | 140 V(6) |
| 139 | 141 |
| 140 | 142 |
| 141 struct CommonOperatorGlobalCache FINAL { | 143 struct CommonOperatorGlobalCache FINAL { |
| 142 #define CACHED(Name, properties, value_input_count, effect_input_count, \ | 144 #define CACHED(Name, properties, value_input_count, effect_input_count, \ |
| 143 control_input_count, control_output_count) \ | 145 control_input_count, value_output_count, effect_output_count, \ |
| 144 struct Name##Operator FINAL : public Operator { \ | 146 control_output_count) \ |
| 145 Name##Operator() \ | 147 struct Name##Operator FINAL : public Operator { \ |
| 146 : Operator(IrOpcode::k##Name, properties, #Name, value_input_count, \ | 148 Name##Operator() \ |
| 147 effect_input_count, control_input_count, 0, 0, \ | 149 : Operator(IrOpcode::k##Name, properties, #Name, value_input_count, \ |
| 148 control_output_count) {} \ | 150 effect_input_count, control_input_count, \ |
| 149 }; \ | 151 value_output_count, effect_output_count, \ |
| 152 control_output_count) {} \ |
| 153 }; \ |
| 150 Name##Operator k##Name##Operator; | 154 Name##Operator k##Name##Operator; |
| 151 CACHED_OP_LIST(CACHED) | 155 CACHED_OP_LIST(CACHED) |
| 152 #undef CACHED | 156 #undef CACHED |
| 153 | 157 |
| 154 template <BranchHint kBranchHint> | 158 template <BranchHint kBranchHint> |
| 155 struct BranchOperator FINAL : public Operator1<BranchHint> { | 159 struct BranchOperator FINAL : public Operator1<BranchHint> { |
| 156 BranchOperator() | 160 BranchOperator() |
| 157 : Operator1<BranchHint>( // -- | 161 : Operator1<BranchHint>( // -- |
| 158 IrOpcode::kBranch, Operator::kFoldable, // opcode | 162 IrOpcode::kBranch, Operator::kFoldable, // opcode |
| 159 "Branch", // name | 163 "Branch", // name |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 | 211 |
| 208 | 212 |
| 209 static base::LazyInstance<CommonOperatorGlobalCache>::type kCache = | 213 static base::LazyInstance<CommonOperatorGlobalCache>::type kCache = |
| 210 LAZY_INSTANCE_INITIALIZER; | 214 LAZY_INSTANCE_INITIALIZER; |
| 211 | 215 |
| 212 | 216 |
| 213 CommonOperatorBuilder::CommonOperatorBuilder(Zone* zone) | 217 CommonOperatorBuilder::CommonOperatorBuilder(Zone* zone) |
| 214 : cache_(kCache.Get()), zone_(zone) {} | 218 : cache_(kCache.Get()), zone_(zone) {} |
| 215 | 219 |
| 216 | 220 |
| 217 #define CACHED(Name, properties, value_input_count, effect_input_count, \ | 221 #define CACHED(Name, properties, value_input_count, effect_input_count, \ |
| 218 control_input_count, control_output_count) \ | 222 control_input_count, value_output_count, effect_output_count, \ |
| 219 const Operator* CommonOperatorBuilder::Name() { \ | 223 control_output_count) \ |
| 220 return &cache_.k##Name##Operator; \ | 224 const Operator* CommonOperatorBuilder::Name() { \ |
| 225 return &cache_.k##Name##Operator; \ |
| 221 } | 226 } |
| 222 CACHED_OP_LIST(CACHED) | 227 CACHED_OP_LIST(CACHED) |
| 223 #undef CACHED | 228 #undef CACHED |
| 224 | 229 |
| 225 | 230 |
| 226 const Operator* CommonOperatorBuilder::Branch(BranchHint hint) { | 231 const Operator* CommonOperatorBuilder::Branch(BranchHint hint) { |
| 227 switch (hint) { | 232 switch (hint) { |
| 228 case BranchHint::kNone: | 233 case BranchHint::kNone: |
| 229 return &cache_.kBranchNoneOperator; | 234 return &cache_.kBranchNoneOperator; |
| 230 case BranchHint::kTrue: | 235 case BranchHint::kTrue: |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 } | 308 } |
| 304 // Uncached. | 309 // Uncached. |
| 305 return new (zone()) Operator1<int>( // -- | 310 return new (zone()) Operator1<int>( // -- |
| 306 IrOpcode::kParameter, Operator::kPure, // opcode | 311 IrOpcode::kParameter, Operator::kPure, // opcode |
| 307 "Parameter", // name | 312 "Parameter", // name |
| 308 1, 0, 0, 1, 0, 0, // counts | 313 1, 0, 0, 1, 0, 0, // counts |
| 309 index); // parameter | 314 index); // parameter |
| 310 } | 315 } |
| 311 | 316 |
| 312 | 317 |
| 318 const Operator* CommonOperatorBuilder::OsrValue(int index) { |
| 319 return new (zone()) Operator1<int>( // -- |
| 320 IrOpcode::kOsrValue, Operator::kPure, // opcode |
| 321 "OsrValue", // name |
| 322 0, 0, 1, 1, 0, 0, // counts |
| 323 index); // parameter |
| 324 } |
| 325 |
| 326 |
| 313 const Operator* CommonOperatorBuilder::Int32Constant(int32_t value) { | 327 const Operator* CommonOperatorBuilder::Int32Constant(int32_t value) { |
| 314 return new (zone()) Operator1<int32_t>( // -- | 328 return new (zone()) Operator1<int32_t>( // -- |
| 315 IrOpcode::kInt32Constant, Operator::kPure, // opcode | 329 IrOpcode::kInt32Constant, Operator::kPure, // opcode |
| 316 "Int32Constant", // name | 330 "Int32Constant", // name |
| 317 0, 0, 0, 1, 0, 0, // counts | 331 0, 0, 0, 1, 0, 0, // counts |
| 318 value); // parameter | 332 value); // parameter |
| 319 } | 333 } |
| 320 | 334 |
| 321 | 335 |
| 322 const Operator* CommonOperatorBuilder::Int64Constant(int64_t value) { | 336 const Operator* CommonOperatorBuilder::Int64Constant(int64_t value) { |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 468 return new (zone()) Operator1<size_t>( // -- | 482 return new (zone()) Operator1<size_t>( // -- |
| 469 IrOpcode::kProjection, Operator::kPure, // opcode | 483 IrOpcode::kProjection, Operator::kPure, // opcode |
| 470 "Projection", // name | 484 "Projection", // name |
| 471 1, 0, 0, 1, 0, 0, // counts | 485 1, 0, 0, 1, 0, 0, // counts |
| 472 index); // parameter | 486 index); // parameter |
| 473 } | 487 } |
| 474 | 488 |
| 475 } // namespace compiler | 489 } // namespace compiler |
| 476 } // namespace internal | 490 } // namespace internal |
| 477 } // namespace v8 | 491 } // namespace v8 |
| OLD | NEW |