#include "src/compiler/access-info.h"
#include <optional>
#include <ostream>
#include "src/builtins/accessors.h"
#include "src/compiler/compilation-dependencies.h"
#include "src/compiler/heap-refs.h"
#include "src/compiler/js-heap-broker-inl.h"
#include "src/compiler/simplified-operator.h"
#include "src/compiler/type-cache.h"
#include "src/ic/call-optimization.h"
#include "src/objects/cell-inl.h"
#include "src/objects/field-index-inl.h"
#include "src/objects/field-type.h"
#include "src/objects/objects-inl.h"
#include "src/objects/property-details.h"
#include "src/objects/struct-inl.h"
#include "src/objects/templates.h"
namespace v8 {
namespace internal {
namespace compiler {
namespace {
bool CanInlinePropertyAccess(MapRef map, AccessMode access_mode) { … }
#ifdef DEBUG
bool HasFieldRepresentationDependenciesOnMap(
ZoneVector<CompilationDependency const*>& dependencies,
Handle<Map> const& field_owner_map) { … }
#endif
}
std::ostream& operator<<(std::ostream& os, AccessMode access_mode) { … }
ElementAccessInfo::ElementAccessInfo(
ZoneVector<MapRef>&& lookup_start_object_maps, ElementsKind elements_kind,
Zone* zone)
: … { … }
PropertyAccessInfo PropertyAccessInfo::Invalid(Zone* zone) { … }
PropertyAccessInfo PropertyAccessInfo::NotFound(Zone* zone, MapRef receiver_map,
OptionalJSObjectRef holder) { … }
PropertyAccessInfo PropertyAccessInfo::DataField(
JSHeapBroker* broker, Zone* zone, MapRef receiver_map,
ZoneVector<CompilationDependency const*>&& dependencies,
FieldIndex field_index, Representation field_representation,
Type field_type, MapRef field_owner_map, OptionalMapRef field_map,
OptionalJSObjectRef holder, OptionalMapRef transition_map) { … }
PropertyAccessInfo PropertyAccessInfo::FastDataConstant(
Zone* zone, MapRef receiver_map,
ZoneVector<CompilationDependency const*>&& dependencies,
FieldIndex field_index, Representation field_representation,
Type field_type, MapRef field_owner_map, OptionalMapRef field_map,
OptionalJSObjectRef holder, OptionalMapRef transition_map) { … }
PropertyAccessInfo PropertyAccessInfo::FastAccessorConstant(
Zone* zone, MapRef receiver_map, OptionalJSObjectRef holder,
OptionalObjectRef constant, OptionalJSObjectRef api_holder) { … }
PropertyAccessInfo PropertyAccessInfo::ModuleExport(Zone* zone,
MapRef receiver_map,
CellRef cell) { … }
PropertyAccessInfo PropertyAccessInfo::StringLength(Zone* zone,
MapRef receiver_map) { … }
PropertyAccessInfo PropertyAccessInfo::DictionaryProtoDataConstant(
Zone* zone, MapRef receiver_map, JSObjectRef holder,
InternalIndex dictionary_index, NameRef name) { … }
PropertyAccessInfo PropertyAccessInfo::DictionaryProtoAccessorConstant(
Zone* zone, MapRef receiver_map, OptionalJSObjectRef holder,
ObjectRef constant, OptionalJSObjectRef api_holder, NameRef property_name) { … }
PropertyAccessInfo::PropertyAccessInfo(Zone* zone)
: … { … }
PropertyAccessInfo::PropertyAccessInfo(
Zone* zone, Kind kind, OptionalJSObjectRef holder,
ZoneVector<MapRef>&& lookup_start_object_maps)
: … { … }
PropertyAccessInfo::PropertyAccessInfo(
Zone* zone, Kind kind, OptionalJSObjectRef holder,
OptionalObjectRef constant, OptionalJSObjectRef api_holder,
OptionalNameRef name, ZoneVector<MapRef>&& lookup_start_object_maps)
: … { … }
PropertyAccessInfo::PropertyAccessInfo(
Kind kind, OptionalJSObjectRef holder, OptionalMapRef transition_map,
FieldIndex field_index, Representation field_representation,
Type field_type, MapRef field_owner_map, OptionalMapRef field_map,
ZoneVector<MapRef>&& lookup_start_object_maps,
ZoneVector<CompilationDependency const*>&& unrecorded_dependencies)
: … { … }
PropertyAccessInfo::PropertyAccessInfo(
Zone* zone, Kind kind, OptionalJSObjectRef holder,
ZoneVector<MapRef>&& lookup_start_object_maps,
InternalIndex dictionary_index, NameRef name)
: … { … }
namespace {
template <class RefT>
bool OptionalRefEquals(OptionalRef<RefT> lhs, OptionalRef<RefT> rhs) { … }
template <class T>
void AppendVector(ZoneVector<T>* dst, const ZoneVector<T>& src) { … }
}
bool PropertyAccessInfo::Merge(PropertyAccessInfo const* that,
AccessMode access_mode, Zone* zone) { … }
ConstFieldInfo PropertyAccessInfo::GetConstFieldInfo() const { … }
AccessInfoFactory::AccessInfoFactory(JSHeapBroker* broker, Zone* zone)
: … { … }
std::optional<ElementAccessInfo> AccessInfoFactory::ComputeElementAccessInfo(
MapRef map, AccessMode access_mode) const { … }
bool AccessInfoFactory::ComputeElementAccessInfos(
ElementAccessFeedback const& feedback,
ZoneVector<ElementAccessInfo>* access_infos) const { … }
PropertyAccessInfo AccessInfoFactory::ComputeDataFieldAccessInfo(
MapRef receiver_map, MapRef map, NameRef name, OptionalJSObjectRef holder,
InternalIndex descriptor, AccessMode access_mode) const { … }
namespace {
AccessorsObjectGetter;
PropertyAccessInfo AccessorAccessInfoHelper(
Isolate* isolate, Zone* zone, JSHeapBroker* broker,
const AccessInfoFactory* ai_factory, MapRef receiver_map, NameRef name,
MapRef holder_map, OptionalJSObjectRef holder, AccessMode access_mode,
AccessorsObjectGetter get_accessors) { … }
}
PropertyAccessInfo AccessInfoFactory::ComputeAccessorDescriptorAccessInfo(
MapRef receiver_map, NameRef name, MapRef holder_map,
OptionalJSObjectRef holder, InternalIndex descriptor,
AccessMode access_mode) const { … }
PropertyAccessInfo AccessInfoFactory::ComputeDictionaryProtoAccessInfo(
MapRef receiver_map, NameRef name, JSObjectRef holder,
InternalIndex dictionary_index, AccessMode access_mode,
PropertyDetails details) const { … }
bool AccessInfoFactory::TryLoadPropertyDetails(
MapRef map, OptionalJSObjectRef maybe_holder, NameRef name,
InternalIndex* index_out, PropertyDetails* details_out) const { … }
PropertyAccessInfo AccessInfoFactory::ComputePropertyAccessInfo(
MapRef map, NameRef name, AccessMode access_mode) const { … }
PropertyAccessInfo AccessInfoFactory::FinalizePropertyAccessInfosAsOne(
ZoneVector<PropertyAccessInfo> access_infos, AccessMode access_mode) const { … }
void PropertyAccessInfo::RecordDependencies(
CompilationDependencies* dependencies) { … }
bool AccessInfoFactory::FinalizePropertyAccessInfos(
ZoneVector<PropertyAccessInfo> access_infos, AccessMode access_mode,
ZoneVector<PropertyAccessInfo>* result) const { … }
void AccessInfoFactory::MergePropertyAccessInfos(
ZoneVector<PropertyAccessInfo> infos, AccessMode access_mode,
ZoneVector<PropertyAccessInfo>* result) const { … }
CompilationDependencies* AccessInfoFactory::dependencies() const { … }
Isolate* AccessInfoFactory::isolate() const { … }
namespace {
Maybe<ElementsKind> GeneralizeElementsKind(ElementsKind this_kind,
ElementsKind that_kind) { … }
}
std::optional<ElementAccessInfo> AccessInfoFactory::ConsolidateElementLoad(
ElementAccessFeedback const& feedback) const { … }
PropertyAccessInfo AccessInfoFactory::LookupSpecialFieldAccessor(
MapRef map, NameRef name) const { … }
PropertyAccessInfo AccessInfoFactory::LookupTransition(
MapRef map, NameRef name, OptionalJSObjectRef holder,
PropertyAttributes attrs) const { … }
}
}
}