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 888 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
899 if (rep == MachineRepresentation::kFloat64) { | 899 if (rep == MachineRepresentation::kFloat64) { |
900 if (!field_index.is_inobject() || field_index.is_hidden_field() || | 900 if (!field_index.is_inobject() || field_index.is_hidden_field() || |
901 !FLAG_unbox_double_fields) { | 901 !FLAG_unbox_double_fields) { |
902 storage = effect = graph()->NewNode( | 902 storage = effect = graph()->NewNode( |
903 simplified()->LoadField(field_access), storage, effect, control); | 903 simplified()->LoadField(field_access), storage, effect, control); |
904 field_access.offset = HeapNumber::kValueOffset; | 904 field_access.offset = HeapNumber::kValueOffset; |
905 field_access.name = MaybeHandle<Name>(); | 905 field_access.name = MaybeHandle<Name>(); |
906 } | 906 } |
907 field_access.machine_type = MachineType::Float64(); | 907 field_access.machine_type = MachineType::Float64(); |
908 } | 908 } |
| 909 // TODO(turbofan): Track the field_map (if any) on the {field_access} and |
| 910 // use it in LoadElimination to eliminate map checks. |
909 value = effect = graph()->NewNode(simplified()->LoadField(field_access), | 911 value = effect = graph()->NewNode(simplified()->LoadField(field_access), |
910 storage, effect, control); | 912 storage, effect, control); |
911 } else { | 913 } else { |
912 DCHECK_EQ(AccessMode::kStore, access_mode); | 914 DCHECK_EQ(AccessMode::kStore, access_mode); |
913 if (rep == MachineRepresentation::kFloat64) { | 915 if (rep == MachineRepresentation::kFloat64) { |
914 value = effect = graph()->NewNode(simplified()->CheckNumber(), value, | 916 value = effect = graph()->NewNode(simplified()->CheckNumber(), value, |
915 effect, control); | 917 effect, control); |
916 | 918 |
917 if (!field_index.is_inobject() || field_index.is_hidden_field() || | 919 if (!field_index.is_inobject() || field_index.is_hidden_field() || |
918 !FLAG_unbox_double_fields) { | 920 !FLAG_unbox_double_fields) { |
(...skipping 30 matching lines...) Expand all Loading... |
949 // Unboxed double field, we store directly to the field. | 951 // Unboxed double field, we store directly to the field. |
950 field_access.machine_type = MachineType::Float64(); | 952 field_access.machine_type = MachineType::Float64(); |
951 } | 953 } |
952 } else if (rep == MachineRepresentation::kTaggedSigned) { | 954 } else if (rep == MachineRepresentation::kTaggedSigned) { |
953 value = effect = graph()->NewNode(simplified()->CheckTaggedSigned(), | 955 value = effect = graph()->NewNode(simplified()->CheckTaggedSigned(), |
954 value, effect, control); | 956 value, effect, control); |
955 } else if (rep == MachineRepresentation::kTaggedPointer) { | 957 } else if (rep == MachineRepresentation::kTaggedPointer) { |
956 // Ensure that {value} is a HeapObject. | 958 // Ensure that {value} is a HeapObject. |
957 value = effect = graph()->NewNode(simplified()->CheckTaggedPointer(), | 959 value = effect = graph()->NewNode(simplified()->CheckTaggedPointer(), |
958 value, effect, control); | 960 value, effect, control); |
959 if (field_type->NumClasses() == 1) { | 961 Handle<Map> field_map; |
| 962 if (access_info.field_map().ToHandle(&field_map)) { |
960 // Emit a map check for the value. | 963 // Emit a map check for the value. |
961 Node* field_map = | |
962 jsgraph()->Constant(field_type->Classes().Current()); | |
963 effect = graph()->NewNode(simplified()->CheckMaps(1), value, | 964 effect = graph()->NewNode(simplified()->CheckMaps(1), value, |
964 field_map, effect, control); | 965 jsgraph()->HeapConstant(field_map), effect, |
965 } else { | 966 control); |
966 DCHECK_EQ(0, field_type->NumClasses()); | |
967 } | 967 } |
968 } else { | 968 } else { |
969 // DCHECK(field_type->Is(Type::Tagged())); | 969 // DCHECK(field_type->Is(Type::Tagged())); |
970 DCHECK(rep == MachineRepresentation::kTagged); | 970 DCHECK(rep == MachineRepresentation::kTagged); |
971 } | 971 } |
972 Handle<Map> transition_map; | 972 Handle<Map> transition_map; |
973 if (access_info.transition_map().ToHandle(&transition_map)) { | 973 if (access_info.transition_map().ToHandle(&transition_map)) { |
974 effect = graph()->NewNode( | 974 effect = graph()->NewNode( |
975 common()->BeginRegion(RegionObservability::kObservable), effect); | 975 common()->BeginRegion(RegionObservability::kObservable), effect); |
976 effect = graph()->NewNode( | 976 effect = graph()->NewNode( |
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1481 } | 1481 } |
1482 | 1482 |
1483 | 1483 |
1484 SimplifiedOperatorBuilder* JSNativeContextSpecialization::simplified() const { | 1484 SimplifiedOperatorBuilder* JSNativeContextSpecialization::simplified() const { |
1485 return jsgraph()->simplified(); | 1485 return jsgraph()->simplified(); |
1486 } | 1486 } |
1487 | 1487 |
1488 } // namespace compiler | 1488 } // namespace compiler |
1489 } // namespace internal | 1489 } // namespace internal |
1490 } // namespace v8 | 1490 } // namespace v8 |
OLD | NEW |