OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/js-native-context-specialization.h" | 5 #include "src/compiler/js-native-context-specialization.h" |
6 | 6 |
7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/code-factory.h" | 8 #include "src/code-factory.h" |
9 #include "src/compilation-dependencies.h" | 9 #include "src/compilation-dependencies.h" |
10 #include "src/compiler/access-builder.h" | 10 #include "src/compiler/access-builder.h" |
(...skipping 1077 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1088 Node* storage = receiver; | 1088 Node* storage = receiver; |
1089 if (!field_index.is_inobject()) { | 1089 if (!field_index.is_inobject()) { |
1090 storage = effect = graph()->NewNode( | 1090 storage = effect = graph()->NewNode( |
1091 simplified()->LoadField(AccessBuilder::ForJSObjectProperties()), | 1091 simplified()->LoadField(AccessBuilder::ForJSObjectProperties()), |
1092 storage, effect, control); | 1092 storage, effect, control); |
1093 } | 1093 } |
1094 FieldAccess field_access = { | 1094 FieldAccess field_access = { |
1095 kTaggedBase, | 1095 kTaggedBase, |
1096 field_index.offset(), | 1096 field_index.offset(), |
1097 name, | 1097 name, |
| 1098 MaybeHandle<Map>(), |
1098 field_type, | 1099 field_type, |
1099 MachineType::TypeForRepresentation(field_representation), | 1100 MachineType::TypeForRepresentation(field_representation), |
1100 kFullWriteBarrier}; | 1101 kFullWriteBarrier}; |
1101 if (access_mode == AccessMode::kLoad) { | 1102 if (access_mode == AccessMode::kLoad) { |
1102 if (field_representation == MachineRepresentation::kFloat64) { | 1103 if (field_representation == MachineRepresentation::kFloat64) { |
1103 if (!field_index.is_inobject() || field_index.is_hidden_field() || | 1104 if (!field_index.is_inobject() || field_index.is_hidden_field() || |
1104 !FLAG_unbox_double_fields) { | 1105 !FLAG_unbox_double_fields) { |
1105 FieldAccess const storage_access = {kTaggedBase, | 1106 FieldAccess const storage_access = {kTaggedBase, |
1106 field_index.offset(), | 1107 field_index.offset(), |
1107 name, | 1108 name, |
| 1109 MaybeHandle<Map>(), |
1108 Type::OtherInternal(), | 1110 Type::OtherInternal(), |
1109 MachineType::TaggedPointer(), | 1111 MachineType::TaggedPointer(), |
1110 kPointerWriteBarrier}; | 1112 kPointerWriteBarrier}; |
1111 storage = effect = | 1113 storage = effect = |
1112 graph()->NewNode(simplified()->LoadField(storage_access), storage, | 1114 graph()->NewNode(simplified()->LoadField(storage_access), storage, |
1113 effect, control); | 1115 effect, control); |
1114 field_access.offset = HeapNumber::kValueOffset; | 1116 field_access.offset = HeapNumber::kValueOffset; |
1115 field_access.name = MaybeHandle<Name>(); | 1117 field_access.name = MaybeHandle<Name>(); |
1116 } | 1118 } |
| 1119 } else if (field_representation == |
| 1120 MachineRepresentation::kTaggedPointer) { |
| 1121 // Remember the map of the field value, if its map is stable. This is |
| 1122 // used by the LoadElimination to eliminate map checks on the result. |
| 1123 Handle<Map> field_map; |
| 1124 if (access_info.field_map().ToHandle(&field_map)) { |
| 1125 if (field_map->is_stable()) { |
| 1126 dependencies()->AssumeMapStable(field_map); |
| 1127 field_access.map = field_map; |
| 1128 } |
| 1129 } |
1117 } | 1130 } |
1118 // TODO(turbofan): Track the field_map (if any) on the {field_access} and | |
1119 // use it in LoadElimination to eliminate map checks. | |
1120 value = effect = graph()->NewNode(simplified()->LoadField(field_access), | 1131 value = effect = graph()->NewNode(simplified()->LoadField(field_access), |
1121 storage, effect, control); | 1132 storage, effect, control); |
1122 } else { | 1133 } else { |
1123 DCHECK_EQ(AccessMode::kStore, access_mode); | 1134 DCHECK_EQ(AccessMode::kStore, access_mode); |
1124 switch (field_representation) { | 1135 switch (field_representation) { |
1125 case MachineRepresentation::kFloat64: { | 1136 case MachineRepresentation::kFloat64: { |
1126 value = effect = graph()->NewNode(simplified()->CheckNumber(), value, | 1137 value = effect = graph()->NewNode(simplified()->CheckNumber(), value, |
1127 effect, control); | 1138 effect, control); |
1128 if (!field_index.is_inobject() || field_index.is_hidden_field() || | 1139 if (!field_index.is_inobject() || field_index.is_hidden_field() || |
1129 !FLAG_unbox_double_fields) { | 1140 !FLAG_unbox_double_fields) { |
(...skipping 16 matching lines...) Expand all Loading... |
1146 graph()->NewNode(common()->FinishRegion(), box, effect); | 1157 graph()->NewNode(common()->FinishRegion(), box, effect); |
1147 | 1158 |
1148 field_access.type = Type::Any(); | 1159 field_access.type = Type::Any(); |
1149 field_access.machine_type = MachineType::TaggedPointer(); | 1160 field_access.machine_type = MachineType::TaggedPointer(); |
1150 field_access.write_barrier_kind = kPointerWriteBarrier; | 1161 field_access.write_barrier_kind = kPointerWriteBarrier; |
1151 } else { | 1162 } else { |
1152 // We just store directly to the MutableHeapNumber. | 1163 // We just store directly to the MutableHeapNumber. |
1153 FieldAccess const storage_access = {kTaggedBase, | 1164 FieldAccess const storage_access = {kTaggedBase, |
1154 field_index.offset(), | 1165 field_index.offset(), |
1155 name, | 1166 name, |
| 1167 MaybeHandle<Map>(), |
1156 Type::OtherInternal(), | 1168 Type::OtherInternal(), |
1157 MachineType::TaggedPointer(), | 1169 MachineType::TaggedPointer(), |
1158 kPointerWriteBarrier}; | 1170 kPointerWriteBarrier}; |
1159 storage = effect = | 1171 storage = effect = |
1160 graph()->NewNode(simplified()->LoadField(storage_access), | 1172 graph()->NewNode(simplified()->LoadField(storage_access), |
1161 storage, effect, control); | 1173 storage, effect, control); |
1162 field_access.offset = HeapNumber::kValueOffset; | 1174 field_access.offset = HeapNumber::kValueOffset; |
1163 field_access.name = MaybeHandle<Name>(); | 1175 field_access.name = MaybeHandle<Name>(); |
1164 field_access.machine_type = MachineType::Float64(); | 1176 field_access.machine_type = MachineType::Float64(); |
1165 } | 1177 } |
(...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1817 return jsgraph()->javascript(); | 1829 return jsgraph()->javascript(); |
1818 } | 1830 } |
1819 | 1831 |
1820 SimplifiedOperatorBuilder* JSNativeContextSpecialization::simplified() const { | 1832 SimplifiedOperatorBuilder* JSNativeContextSpecialization::simplified() const { |
1821 return jsgraph()->simplified(); | 1833 return jsgraph()->simplified(); |
1822 } | 1834 } |
1823 | 1835 |
1824 } // namespace compiler | 1836 } // namespace compiler |
1825 } // namespace internal | 1837 } // namespace internal |
1826 } // namespace v8 | 1838 } // namespace v8 |
OLD | NEW |