OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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/load-elimination.h" | 5 #include "src/compiler/load-elimination.h" |
6 | 6 |
7 #include "src/compiler/common-operator.h" | 7 #include "src/compiler/common-operator.h" |
8 #include "src/compiler/js-graph.h" | 8 #include "src/compiler/js-graph.h" |
9 #include "src/compiler/node-properties.h" | 9 #include "src/compiler/node-properties.h" |
10 #include "src/compiler/simplified-operator.h" | 10 #include "src/compiler/simplified-operator.h" |
(...skipping 879 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
890 if (field_index >= static_cast<int>(kMaxTrackedFields)) return -1; | 890 if (field_index >= static_cast<int>(kMaxTrackedFields)) return -1; |
891 return field_index; | 891 return field_index; |
892 } | 892 } |
893 | 893 |
894 // static | 894 // static |
895 int LoadElimination::FieldIndexOf(FieldAccess const& access) { | 895 int LoadElimination::FieldIndexOf(FieldAccess const& access) { |
896 MachineRepresentation rep = access.machine_type.representation(); | 896 MachineRepresentation rep = access.machine_type.representation(); |
897 switch (rep) { | 897 switch (rep) { |
898 case MachineRepresentation::kNone: | 898 case MachineRepresentation::kNone: |
899 case MachineRepresentation::kBit: | 899 case MachineRepresentation::kBit: |
| 900 case MachineRepresentation::kSimd128: |
900 UNREACHABLE(); | 901 UNREACHABLE(); |
901 break; | 902 break; |
902 case MachineRepresentation::kWord32: | 903 case MachineRepresentation::kWord32: |
903 case MachineRepresentation::kWord64: | 904 case MachineRepresentation::kWord64: |
904 if (rep != MachineType::PointerRepresentation()) { | 905 if (rep != MachineType::PointerRepresentation()) { |
905 return -1; // We currently only track pointer size fields. | 906 return -1; // We currently only track pointer size fields. |
906 } | 907 } |
907 break; | 908 break; |
908 case MachineRepresentation::kWord8: | 909 case MachineRepresentation::kWord8: |
909 case MachineRepresentation::kWord16: | 910 case MachineRepresentation::kWord16: |
910 case MachineRepresentation::kFloat32: | 911 case MachineRepresentation::kFloat32: |
911 return -1; // Currently untracked. | 912 return -1; // Currently untracked. |
912 case MachineRepresentation::kFloat64: | 913 case MachineRepresentation::kFloat64: |
913 case MachineRepresentation::kSimd128: | 914 if (kDoubleSize != kPointerSize) { |
914 return -1; // Currently untracked. | 915 return -1; // We currently only track pointer size fields. |
| 916 } |
| 917 // Fall through. |
915 case MachineRepresentation::kTaggedSigned: | 918 case MachineRepresentation::kTaggedSigned: |
916 case MachineRepresentation::kTaggedPointer: | 919 case MachineRepresentation::kTaggedPointer: |
917 case MachineRepresentation::kTagged: | 920 case MachineRepresentation::kTagged: |
918 // TODO(bmeurer): Check that we never do overlapping load/stores of | 921 // TODO(bmeurer): Check that we never do overlapping load/stores of |
919 // individual parts of Float64/Simd128 values. | 922 // individual parts of Float64 values. |
920 break; | 923 break; |
921 } | 924 } |
922 DCHECK_EQ(kTaggedBase, access.base_is_tagged); | 925 if (access.base_is_tagged != kTaggedBase) { |
| 926 return -1; // We currently only track tagged objects. |
| 927 } |
923 return FieldIndexOf(access.offset); | 928 return FieldIndexOf(access.offset); |
924 } | 929 } |
925 | 930 |
926 CommonOperatorBuilder* LoadElimination::common() const { | 931 CommonOperatorBuilder* LoadElimination::common() const { |
927 return jsgraph()->common(); | 932 return jsgraph()->common(); |
928 } | 933 } |
929 | 934 |
930 Graph* LoadElimination::graph() const { return jsgraph()->graph(); } | 935 Graph* LoadElimination::graph() const { return jsgraph()->graph(); } |
931 | 936 |
932 } // namespace compiler | 937 } // namespace compiler |
933 } // namespace internal | 938 } // namespace internal |
934 } // namespace v8 | 939 } // namespace v8 |
OLD | NEW |