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 801 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
812 Node* const index = NodeProperties::GetValueInput(node, 1); | 812 Node* const index = NodeProperties::GetValueInput(node, 1); |
813 Node* const effect = NodeProperties::GetEffectInput(node); | 813 Node* const effect = NodeProperties::GetEffectInput(node); |
814 Node* const control = NodeProperties::GetControlInput(node); | 814 Node* const control = NodeProperties::GetControlInput(node); |
815 AbstractState const* state = node_states_.Get(effect); | 815 AbstractState const* state = node_states_.Get(effect); |
816 if (state == nullptr) return NoChange(); | 816 if (state == nullptr) return NoChange(); |
817 | 817 |
818 // Only handle loads that do not require truncations. | 818 // Only handle loads that do not require truncations. |
819 ElementAccess const& access = ElementAccessOf(node->op()); | 819 ElementAccess const& access = ElementAccessOf(node->op()); |
820 switch (access.machine_type.representation()) { | 820 switch (access.machine_type.representation()) { |
821 case MachineRepresentation::kNone: | 821 case MachineRepresentation::kNone: |
822 case MachineRepresentation::kSimd1x4: | |
823 case MachineRepresentation::kSimd1x8: | |
824 case MachineRepresentation::kSimd1x16: | |
825 case MachineRepresentation::kBit: | 822 case MachineRepresentation::kBit: |
826 UNREACHABLE(); | 823 UNREACHABLE(); |
827 break; | 824 break; |
828 case MachineRepresentation::kWord8: | 825 case MachineRepresentation::kWord8: |
829 case MachineRepresentation::kWord16: | 826 case MachineRepresentation::kWord16: |
830 case MachineRepresentation::kWord32: | 827 case MachineRepresentation::kWord32: |
831 case MachineRepresentation::kWord64: | 828 case MachineRepresentation::kWord64: |
832 case MachineRepresentation::kFloat32: | 829 case MachineRepresentation::kFloat32: |
833 // TODO(turbofan): Add support for doing the truncations. | 830 // TODO(turbofan): Add support for doing the truncations. |
834 break; | 831 break; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
872 state->LookupElement(object, index, access.machine_type.representation()); | 869 state->LookupElement(object, index, access.machine_type.representation()); |
873 if (old_value == new_value) { | 870 if (old_value == new_value) { |
874 // This store is fully redundant. | 871 // This store is fully redundant. |
875 return Replace(effect); | 872 return Replace(effect); |
876 } | 873 } |
877 // Kill all potentially aliasing elements. | 874 // Kill all potentially aliasing elements. |
878 state = state->KillElement(object, index, zone()); | 875 state = state->KillElement(object, index, zone()); |
879 // Only record the new value if the store doesn't have an implicit truncation. | 876 // Only record the new value if the store doesn't have an implicit truncation. |
880 switch (access.machine_type.representation()) { | 877 switch (access.machine_type.representation()) { |
881 case MachineRepresentation::kNone: | 878 case MachineRepresentation::kNone: |
882 case MachineRepresentation::kSimd1x4: | |
883 case MachineRepresentation::kSimd1x8: | |
884 case MachineRepresentation::kSimd1x16: | |
885 case MachineRepresentation::kBit: | 879 case MachineRepresentation::kBit: |
886 UNREACHABLE(); | 880 UNREACHABLE(); |
887 break; | 881 break; |
888 case MachineRepresentation::kWord8: | 882 case MachineRepresentation::kWord8: |
889 case MachineRepresentation::kWord16: | 883 case MachineRepresentation::kWord16: |
890 case MachineRepresentation::kWord32: | 884 case MachineRepresentation::kWord32: |
891 case MachineRepresentation::kWord64: | 885 case MachineRepresentation::kWord64: |
892 case MachineRepresentation::kFloat32: | 886 case MachineRepresentation::kFloat32: |
893 // TODO(turbofan): Add support for doing the truncations. | 887 // TODO(turbofan): Add support for doing the truncations. |
894 break; | 888 break; |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1085 return field_index - 1; | 1079 return field_index - 1; |
1086 } | 1080 } |
1087 | 1081 |
1088 // static | 1082 // static |
1089 int LoadElimination::FieldIndexOf(FieldAccess const& access) { | 1083 int LoadElimination::FieldIndexOf(FieldAccess const& access) { |
1090 MachineRepresentation rep = access.machine_type.representation(); | 1084 MachineRepresentation rep = access.machine_type.representation(); |
1091 switch (rep) { | 1085 switch (rep) { |
1092 case MachineRepresentation::kNone: | 1086 case MachineRepresentation::kNone: |
1093 case MachineRepresentation::kBit: | 1087 case MachineRepresentation::kBit: |
1094 case MachineRepresentation::kSimd128: | 1088 case MachineRepresentation::kSimd128: |
1095 case MachineRepresentation::kSimd1x4: | |
1096 case MachineRepresentation::kSimd1x8: | |
1097 case MachineRepresentation::kSimd1x16: | |
1098 UNREACHABLE(); | 1089 UNREACHABLE(); |
1099 break; | 1090 break; |
1100 case MachineRepresentation::kWord32: | 1091 case MachineRepresentation::kWord32: |
1101 case MachineRepresentation::kWord64: | 1092 case MachineRepresentation::kWord64: |
1102 if (rep != MachineType::PointerRepresentation()) { | 1093 if (rep != MachineType::PointerRepresentation()) { |
1103 return -1; // We currently only track pointer size fields. | 1094 return -1; // We currently only track pointer size fields. |
1104 } | 1095 } |
1105 break; | 1096 break; |
1106 case MachineRepresentation::kWord8: | 1097 case MachineRepresentation::kWord8: |
1107 case MachineRepresentation::kWord16: | 1098 case MachineRepresentation::kWord16: |
(...skipping 21 matching lines...) Expand all Loading... |
1129 return jsgraph()->common(); | 1120 return jsgraph()->common(); |
1130 } | 1121 } |
1131 | 1122 |
1132 Graph* LoadElimination::graph() const { return jsgraph()->graph(); } | 1123 Graph* LoadElimination::graph() const { return jsgraph()->graph(); } |
1133 | 1124 |
1134 Factory* LoadElimination::factory() const { return jsgraph()->factory(); } | 1125 Factory* LoadElimination::factory() const { return jsgraph()->factory(); } |
1135 | 1126 |
1136 } // namespace compiler | 1127 } // namespace compiler |
1137 } // namespace internal | 1128 } // namespace internal |
1138 } // namespace v8 | 1129 } // namespace v8 |
OLD | NEW |