| 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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 os << i.index(); | 98 os << i.index(); |
| 99 return os; | 99 return os; |
| 100 } | 100 } |
| 101 | 101 |
| 102 | 102 |
| 103 #define CACHED_OP_LIST(V) \ | 103 #define CACHED_OP_LIST(V) \ |
| 104 V(Dead, Operator::kFoldable, 0, 0, 0, 0, 0, 1) \ | 104 V(Dead, Operator::kFoldable, 0, 0, 0, 0, 0, 1) \ |
| 105 V(IfTrue, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \ | 105 V(IfTrue, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \ |
| 106 V(IfFalse, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \ | 106 V(IfFalse, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \ |
| 107 V(IfSuccess, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \ | 107 V(IfSuccess, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \ |
| 108 V(IfException, Operator::kKontrol, 0, 0, 1, 1, 0, 1) \ | |
| 109 V(IfDefault, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \ | 108 V(IfDefault, Operator::kKontrol, 0, 0, 1, 0, 0, 1) \ |
| 110 V(Throw, Operator::kKontrol, 1, 1, 1, 0, 0, 1) \ | 109 V(Throw, Operator::kKontrol, 1, 1, 1, 0, 0, 1) \ |
| 111 V(Deoptimize, Operator::kNoThrow, 1, 1, 1, 0, 0, 1) \ | 110 V(Deoptimize, Operator::kNoThrow, 1, 1, 1, 0, 0, 1) \ |
| 112 V(Return, Operator::kNoThrow, 1, 1, 1, 0, 0, 1) \ | 111 V(Return, Operator::kNoThrow, 1, 1, 1, 0, 0, 1) \ |
| 113 V(Terminate, Operator::kKontrol, 0, 1, 1, 0, 0, 1) \ | 112 V(Terminate, Operator::kKontrol, 0, 1, 1, 0, 0, 1) \ |
| 114 V(OsrNormalEntry, Operator::kFoldable, 0, 1, 1, 0, 1, 1) \ | 113 V(OsrNormalEntry, Operator::kFoldable, 0, 1, 1, 0, 1, 1) \ |
| 115 V(OsrLoopEntry, Operator::kFoldable, 0, 1, 1, 0, 1, 1) | 114 V(OsrLoopEntry, Operator::kFoldable, 0, 1, 1, 0, 1, 1) |
| 116 | 115 |
| 117 | 116 |
| 118 #define CACHED_END_LIST(V) \ | 117 #define CACHED_END_LIST(V) \ |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 Name##Operator() \ | 202 Name##Operator() \ |
| 204 : Operator(IrOpcode::k##Name, properties, #Name, value_input_count, \ | 203 : Operator(IrOpcode::k##Name, properties, #Name, value_input_count, \ |
| 205 effect_input_count, control_input_count, \ | 204 effect_input_count, control_input_count, \ |
| 206 value_output_count, effect_output_count, \ | 205 value_output_count, effect_output_count, \ |
| 207 control_output_count) {} \ | 206 control_output_count) {} \ |
| 208 }; \ | 207 }; \ |
| 209 Name##Operator k##Name##Operator; | 208 Name##Operator k##Name##Operator; |
| 210 CACHED_OP_LIST(CACHED) | 209 CACHED_OP_LIST(CACHED) |
| 211 #undef CACHED | 210 #undef CACHED |
| 212 | 211 |
| 212 template <bool kCaughtLocally> |
| 213 struct IfExceptionOperator final : public Operator1<bool> { |
| 214 IfExceptionOperator() |
| 215 : Operator1<bool>( // -- |
| 216 IrOpcode::kIfException, Operator::kKontrol, // opcode |
| 217 "IfException", // name |
| 218 0, 0, 1, 1, 0, 1, // counts |
| 219 kCaughtLocally) {} // parameter |
| 220 }; |
| 221 IfExceptionOperator<false> kLocallyUncaugthIfExceptionOperator; |
| 222 IfExceptionOperator<true> kLocallyCaugthIfExceptionOperator; |
| 223 |
| 213 template <size_t kInputCount> | 224 template <size_t kInputCount> |
| 214 struct EndOperator final : public Operator { | 225 struct EndOperator final : public Operator { |
| 215 EndOperator() | 226 EndOperator() |
| 216 : Operator( // -- | 227 : Operator( // -- |
| 217 IrOpcode::kEnd, Operator::kKontrol, // opcode | 228 IrOpcode::kEnd, Operator::kKontrol, // opcode |
| 218 "End", // name | 229 "End", // name |
| 219 0, 0, kInputCount, 0, 0, 0) {} // counts | 230 0, 0, kInputCount, 0, 0, 0) {} // counts |
| 220 }; | 231 }; |
| 221 #define CACHED_END(input_count) \ | 232 #define CACHED_END(input_count) \ |
| 222 EndOperator<input_count> kEnd##input_count##Operator; | 233 EndOperator<input_count> kEnd##input_count##Operator; |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 case BranchHint::kTrue: | 389 case BranchHint::kTrue: |
| 379 return &cache_.kBranchTrueOperator; | 390 return &cache_.kBranchTrueOperator; |
| 380 case BranchHint::kFalse: | 391 case BranchHint::kFalse: |
| 381 return &cache_.kBranchFalseOperator; | 392 return &cache_.kBranchFalseOperator; |
| 382 } | 393 } |
| 383 UNREACHABLE(); | 394 UNREACHABLE(); |
| 384 return nullptr; | 395 return nullptr; |
| 385 } | 396 } |
| 386 | 397 |
| 387 | 398 |
| 399 const Operator* CommonOperatorBuilder::IfException(bool locally_caught) { |
| 400 if (locally_caught) { |
| 401 return &cache_.kLocallyCaugthIfExceptionOperator; |
| 402 } else { |
| 403 return &cache_.kLocallyUncaugthIfExceptionOperator; |
| 404 } |
| 405 UNREACHABLE(); |
| 406 return nullptr; |
| 407 } |
| 408 |
| 409 |
| 388 const Operator* CommonOperatorBuilder::Switch(size_t control_output_count) { | 410 const Operator* CommonOperatorBuilder::Switch(size_t control_output_count) { |
| 389 DCHECK_GE(control_output_count, 3u); // Disallow trivial switches. | 411 DCHECK_GE(control_output_count, 3u); // Disallow trivial switches. |
| 390 return new (zone()) Operator( // -- | 412 return new (zone()) Operator( // -- |
| 391 IrOpcode::kSwitch, Operator::kKontrol, // opcode | 413 IrOpcode::kSwitch, Operator::kKontrol, // opcode |
| 392 "Switch", // name | 414 "Switch", // name |
| 393 1, 0, 1, 0, 0, control_output_count); // counts | 415 1, 0, 1, 0, 0, control_output_count); // counts |
| 394 } | 416 } |
| 395 | 417 |
| 396 | 418 |
| 397 const Operator* CommonOperatorBuilder::IfValue(int32_t index) { | 419 const Operator* CommonOperatorBuilder::IfValue(int32_t index) { |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 732 } else { | 754 } else { |
| 733 UNREACHABLE(); | 755 UNREACHABLE(); |
| 734 return nullptr; | 756 return nullptr; |
| 735 } | 757 } |
| 736 } | 758 } |
| 737 | 759 |
| 738 | 760 |
| 739 } // namespace compiler | 761 } // namespace compiler |
| 740 } // namespace internal | 762 } // namespace internal |
| 741 } // namespace v8 | 763 } // namespace v8 |
| OLD | NEW |