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 1944 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1955 element_machine_type = MachineType::TaggedSigned(); | 1955 element_machine_type = MachineType::TaggedSigned(); |
1956 } | 1956 } |
1957 ElementAccess element_access = {kTaggedBase, FixedArray::kHeaderSize, | 1957 ElementAccess element_access = {kTaggedBase, FixedArray::kHeaderSize, |
1958 element_type, element_machine_type, | 1958 element_type, element_machine_type, |
1959 kFullWriteBarrier}; | 1959 kFullWriteBarrier}; |
1960 | 1960 |
1961 // Access the actual element. | 1961 // Access the actual element. |
1962 if (access_mode == AccessMode::kLoad) { | 1962 if (access_mode == AccessMode::kLoad) { |
1963 // Compute the real element access type, which includes the hole in case | 1963 // Compute the real element access type, which includes the hole in case |
1964 // of holey backing stores. | 1964 // of holey backing stores. |
| 1965 if (IsHoleyElementsKind(elements_kind)) { |
| 1966 element_access.type = |
| 1967 Type::Union(element_type, Type::Hole(), graph()->zone()); |
| 1968 } |
1965 if (elements_kind == FAST_HOLEY_ELEMENTS || | 1969 if (elements_kind == FAST_HOLEY_ELEMENTS || |
1966 elements_kind == FAST_HOLEY_SMI_ELEMENTS) { | 1970 elements_kind == FAST_HOLEY_SMI_ELEMENTS) { |
1967 element_access.type = | |
1968 Type::Union(element_type, Type::Hole(), graph()->zone()); | |
1969 element_access.machine_type = MachineType::AnyTagged(); | 1971 element_access.machine_type = MachineType::AnyTagged(); |
1970 } | 1972 } |
1971 // Perform the actual backing store access. | 1973 // Perform the actual backing store access. |
1972 value = effect = | 1974 value = effect = |
1973 graph()->NewNode(simplified()->LoadElement(element_access), elements, | 1975 graph()->NewNode(simplified()->LoadElement(element_access), elements, |
1974 index, effect, control); | 1976 index, effect, control); |
1975 // Handle loading from holey backing stores correctly, by either mapping | 1977 // Handle loading from holey backing stores correctly, by either mapping |
1976 // the hole to undefined if possible, or deoptimizing otherwise. | 1978 // the hole to undefined if possible, or deoptimizing otherwise. |
1977 if (elements_kind == FAST_HOLEY_ELEMENTS || | 1979 if (elements_kind == FAST_HOLEY_ELEMENTS || |
1978 elements_kind == FAST_HOLEY_SMI_ELEMENTS) { | 1980 elements_kind == FAST_HOLEY_SMI_ELEMENTS) { |
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2341 return jsgraph()->javascript(); | 2343 return jsgraph()->javascript(); |
2342 } | 2344 } |
2343 | 2345 |
2344 SimplifiedOperatorBuilder* JSNativeContextSpecialization::simplified() const { | 2346 SimplifiedOperatorBuilder* JSNativeContextSpecialization::simplified() const { |
2345 return jsgraph()->simplified(); | 2347 return jsgraph()->simplified(); |
2346 } | 2348 } |
2347 | 2349 |
2348 } // namespace compiler | 2350 } // namespace compiler |
2349 } // namespace internal | 2351 } // namespace internal |
2350 } // namespace v8 | 2352 } // namespace v8 |
OLD | NEW |