| 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 #include "src/compiler/graph.h" | 6 #include "src/compiler/graph.h" |
| 7 #include "src/compiler/instruction.h" | 7 #include "src/compiler/instruction.h" |
| 8 #include "src/compiler/schedule.h" | 8 #include "src/compiler/schedule.h" |
| 9 #include "src/compiler/state-values-utils.h" |
| 9 | 10 |
| 10 namespace v8 { | 11 namespace v8 { |
| 11 namespace internal { | 12 namespace internal { |
| 12 namespace compiler { | 13 namespace compiler { |
| 13 | 14 |
| 14 | 15 |
| 15 FlagsCondition CommuteFlagsCondition(FlagsCondition condition) { | 16 FlagsCondition CommuteFlagsCondition(FlagsCondition condition) { |
| 16 switch (condition) { | 17 switch (condition) { |
| 17 case kSignedLessThan: | 18 case kSignedLessThan: |
| 18 return kSignedGreaterThan; | 19 return kSignedGreaterThan; |
| (...skipping 805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 824 OutputFrameStateCombine state_combine, size_t parameters_count, | 825 OutputFrameStateCombine state_combine, size_t parameters_count, |
| 825 size_t locals_count, size_t stack_count, | 826 size_t locals_count, size_t stack_count, |
| 826 MaybeHandle<SharedFunctionInfo> shared_info, | 827 MaybeHandle<SharedFunctionInfo> shared_info, |
| 827 FrameStateDescriptor* outer_state) | 828 FrameStateDescriptor* outer_state) |
| 828 : type_(type), | 829 : type_(type), |
| 829 bailout_id_(bailout_id), | 830 bailout_id_(bailout_id), |
| 830 frame_state_combine_(state_combine), | 831 frame_state_combine_(state_combine), |
| 831 parameters_count_(parameters_count), | 832 parameters_count_(parameters_count), |
| 832 locals_count_(locals_count), | 833 locals_count_(locals_count), |
| 833 stack_count_(stack_count), | 834 stack_count_(stack_count), |
| 834 types_(zone), | 835 values_(zone), |
| 835 shared_info_(shared_info), | 836 shared_info_(shared_info), |
| 836 outer_state_(outer_state) { | 837 outer_state_(outer_state) {} |
| 837 types_.resize(GetSize(), MachineType::None()); | |
| 838 } | |
| 839 | 838 |
| 840 | 839 |
| 841 size_t FrameStateDescriptor::GetSize(OutputFrameStateCombine combine) const { | 840 size_t FrameStateDescriptor::GetSize(OutputFrameStateCombine combine) const { |
| 842 size_t size = 1 + parameters_count() + locals_count() + stack_count() + | 841 size_t size = 1 + parameters_count() + locals_count() + stack_count() + |
| 843 (HasContext() ? 1 : 0); | 842 (HasContext() ? 1 : 0); |
| 844 switch (combine.kind()) { | 843 switch (combine.kind()) { |
| 845 case OutputFrameStateCombine::kPushOutput: | 844 case OutputFrameStateCombine::kPushOutput: |
| 846 size += combine.GetPushCount(); | 845 size += combine.GetPushCount(); |
| 847 break; | 846 break; |
| 848 case OutputFrameStateCombine::kPokeAt: | 847 case OutputFrameStateCombine::kPokeAt: |
| (...skipping 28 matching lines...) Expand all Loading... |
| 877 for (const FrameStateDescriptor* iter = this; iter != NULL; | 876 for (const FrameStateDescriptor* iter = this; iter != NULL; |
| 878 iter = iter->outer_state_) { | 877 iter = iter->outer_state_) { |
| 879 if (FrameStateFunctionInfo::IsJSFunctionType(iter->type_)) { | 878 if (FrameStateFunctionInfo::IsJSFunctionType(iter->type_)) { |
| 880 ++count; | 879 ++count; |
| 881 } | 880 } |
| 882 } | 881 } |
| 883 return count; | 882 return count; |
| 884 } | 883 } |
| 885 | 884 |
| 886 | 885 |
| 887 MachineType FrameStateDescriptor::GetType(size_t index) const { | |
| 888 return types_[index]; | |
| 889 } | |
| 890 | |
| 891 | |
| 892 void FrameStateDescriptor::SetType(size_t index, MachineType type) { | |
| 893 DCHECK(index < GetSize()); | |
| 894 types_[index] = type; | |
| 895 } | |
| 896 | |
| 897 | |
| 898 std::ostream& operator<<(std::ostream& os, const RpoNumber& rpo) { | 886 std::ostream& operator<<(std::ostream& os, const RpoNumber& rpo) { |
| 899 return os << rpo.ToSize(); | 887 return os << rpo.ToSize(); |
| 900 } | 888 } |
| 901 | 889 |
| 902 | 890 |
| 903 std::ostream& operator<<(std::ostream& os, | 891 std::ostream& operator<<(std::ostream& os, |
| 904 const PrintableInstructionSequence& printable) { | 892 const PrintableInstructionSequence& printable) { |
| 905 const InstructionSequence& code = *printable.sequence_; | 893 const InstructionSequence& code = *printable.sequence_; |
| 906 for (size_t i = 0; i < code.immediates_.size(); ++i) { | 894 for (size_t i = 0; i < code.immediates_.size(); ++i) { |
| 907 Constant constant = code.immediates_[i]; | 895 Constant constant = code.immediates_[i]; |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 960 os << " B" << succ.ToInt(); | 948 os << " B" << succ.ToInt(); |
| 961 } | 949 } |
| 962 os << "\n"; | 950 os << "\n"; |
| 963 } | 951 } |
| 964 return os; | 952 return os; |
| 965 } | 953 } |
| 966 | 954 |
| 967 } // namespace compiler | 955 } // namespace compiler |
| 968 } // namespace internal | 956 } // namespace internal |
| 969 } // namespace v8 | 957 } // namespace v8 |
| OLD | NEW |