| 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 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 | 269 |
| 270 | 270 |
| 271 #define CACHED_EFFECT_PHI_LIST(V) \ | 271 #define CACHED_EFFECT_PHI_LIST(V) \ |
| 272 V(1) \ | 272 V(1) \ |
| 273 V(2) \ | 273 V(2) \ |
| 274 V(3) \ | 274 V(3) \ |
| 275 V(4) \ | 275 V(4) \ |
| 276 V(5) \ | 276 V(5) \ |
| 277 V(6) | 277 V(6) |
| 278 | 278 |
| 279 #define CACHED_INDUCTION_VARIABLE_PHI_LIST(V) \ |
| 280 V(4) \ |
| 281 V(5) \ |
| 282 V(6) \ |
| 283 V(7) |
| 279 | 284 |
| 280 #define CACHED_LOOP_LIST(V) \ | 285 #define CACHED_LOOP_LIST(V) \ |
| 281 V(1) \ | 286 V(1) \ |
| 282 V(2) | 287 V(2) |
| 283 | 288 |
| 284 | 289 |
| 285 #define CACHED_MERGE_LIST(V) \ | 290 #define CACHED_MERGE_LIST(V) \ |
| 286 V(1) \ | 291 V(1) \ |
| 287 V(2) \ | 292 V(2) \ |
| 288 V(3) \ | 293 V(3) \ |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 466 "Phi", // name | 471 "Phi", // name |
| 467 kInputCount, 0, 1, 1, 0, 0, // counts | 472 kInputCount, 0, 1, 1, 0, 0, // counts |
| 468 kRep) {} // parameter | 473 kRep) {} // parameter |
| 469 }; | 474 }; |
| 470 #define CACHED_PHI(rep, input_count) \ | 475 #define CACHED_PHI(rep, input_count) \ |
| 471 PhiOperator<MachineRepresentation::rep, input_count> \ | 476 PhiOperator<MachineRepresentation::rep, input_count> \ |
| 472 kPhi##rep##input_count##Operator; | 477 kPhi##rep##input_count##Operator; |
| 473 CACHED_PHI_LIST(CACHED_PHI) | 478 CACHED_PHI_LIST(CACHED_PHI) |
| 474 #undef CACHED_PHI | 479 #undef CACHED_PHI |
| 475 | 480 |
| 481 template <int kInputCount> |
| 482 struct InductionVariablePhiOperator final : public Operator { |
| 483 InductionVariablePhiOperator() |
| 484 : Operator( //-- |
| 485 IrOpcode::kInductionVariablePhi, Operator::kPure, // opcode |
| 486 "InductionVariablePhi", // name |
| 487 kInputCount, 0, 1, 1, 0, 0) {} // counts |
| 488 }; |
| 489 #define CACHED_INDUCTION_VARIABLE_PHI(input_count) \ |
| 490 InductionVariablePhiOperator<input_count> \ |
| 491 kInductionVariablePhi##input_count##Operator; |
| 492 CACHED_INDUCTION_VARIABLE_PHI_LIST(CACHED_INDUCTION_VARIABLE_PHI) |
| 493 #undef CACHED_INDUCTION_VARIABLE_PHI |
| 494 |
| 476 template <int kIndex> | 495 template <int kIndex> |
| 477 struct ParameterOperator final : public Operator1<ParameterInfo> { | 496 struct ParameterOperator final : public Operator1<ParameterInfo> { |
| 478 ParameterOperator() | 497 ParameterOperator() |
| 479 : Operator1<ParameterInfo>( // -- | 498 : Operator1<ParameterInfo>( // -- |
| 480 IrOpcode::kParameter, Operator::kPure, // opcode | 499 IrOpcode::kParameter, Operator::kPure, // opcode |
| 481 "Parameter", // name | 500 "Parameter", // name |
| 482 1, 0, 0, 1, 0, 0, // counts, | 501 1, 0, 0, 1, 0, 0, // counts, |
| 483 ParameterInfo(kIndex, nullptr)) {} // parameter and name | 502 ParameterInfo(kIndex, nullptr)) {} // parameter and name |
| 484 }; | 503 }; |
| 485 #define CACHED_PARAMETER(index) \ | 504 #define CACHED_PARAMETER(index) \ |
| (...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 846 default: | 865 default: |
| 847 break; | 866 break; |
| 848 } | 867 } |
| 849 // Uncached. | 868 // Uncached. |
| 850 return new (zone()) Operator( // -- | 869 return new (zone()) Operator( // -- |
| 851 IrOpcode::kEffectPhi, Operator::kKontrol, // opcode | 870 IrOpcode::kEffectPhi, Operator::kKontrol, // opcode |
| 852 "EffectPhi", // name | 871 "EffectPhi", // name |
| 853 0, effect_input_count, 1, 0, 1, 0); // counts | 872 0, effect_input_count, 1, 0, 1, 0); // counts |
| 854 } | 873 } |
| 855 | 874 |
| 875 const Operator* CommonOperatorBuilder::InductionVariablePhi(int input_count) { |
| 876 DCHECK(input_count >= 4); // There must be always the entry, backedge, |
| 877 // increment and at least one bound. |
| 878 switch (input_count) { |
| 879 #define CACHED_INDUCTION_VARIABLE_PHI(input_count) \ |
| 880 case input_count: \ |
| 881 return &cache_.kInductionVariablePhi##input_count##Operator; |
| 882 CACHED_INDUCTION_VARIABLE_PHI_LIST(CACHED_INDUCTION_VARIABLE_PHI) |
| 883 #undef CACHED_INDUCTION_VARIABLE_PHI |
| 884 default: |
| 885 break; |
| 886 } |
| 887 // Uncached. |
| 888 return new (zone()) Operator( // -- |
| 889 IrOpcode::kInductionVariablePhi, Operator::kPure, // opcode |
| 890 "InductionVariablePhi", // name |
| 891 input_count, 0, 1, 1, 0, 0); // counts |
| 892 } |
| 893 |
| 856 const Operator* CommonOperatorBuilder::BeginRegion( | 894 const Operator* CommonOperatorBuilder::BeginRegion( |
| 857 RegionObservability region_observability) { | 895 RegionObservability region_observability) { |
| 858 switch (region_observability) { | 896 switch (region_observability) { |
| 859 case RegionObservability::kObservable: | 897 case RegionObservability::kObservable: |
| 860 return &cache_.kBeginRegionObservableOperator; | 898 return &cache_.kBeginRegionObservableOperator; |
| 861 case RegionObservability::kNotObservable: | 899 case RegionObservability::kNotObservable: |
| 862 return &cache_.kBeginRegionNotObservableOperator; | 900 return &cache_.kBeginRegionNotObservableOperator; |
| 863 } | 901 } |
| 864 UNREACHABLE(); | 902 UNREACHABLE(); |
| 865 return nullptr; | 903 return nullptr; |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 992 CommonOperatorBuilder::CreateFrameStateFunctionInfo( | 1030 CommonOperatorBuilder::CreateFrameStateFunctionInfo( |
| 993 FrameStateType type, int parameter_count, int local_count, | 1031 FrameStateType type, int parameter_count, int local_count, |
| 994 Handle<SharedFunctionInfo> shared_info) { | 1032 Handle<SharedFunctionInfo> shared_info) { |
| 995 return new (zone()->New(sizeof(FrameStateFunctionInfo))) | 1033 return new (zone()->New(sizeof(FrameStateFunctionInfo))) |
| 996 FrameStateFunctionInfo(type, parameter_count, local_count, shared_info); | 1034 FrameStateFunctionInfo(type, parameter_count, local_count, shared_info); |
| 997 } | 1035 } |
| 998 | 1036 |
| 999 } // namespace compiler | 1037 } // namespace compiler |
| 1000 } // namespace internal | 1038 } // namespace internal |
| 1001 } // namespace v8 | 1039 } // namespace v8 |
| OLD | NEW |