#include "src/compiler/js-native-context-specialization.h"
#include <optional>
#include "src/base/logging.h"
#include "src/builtins/accessors.h"
#include "src/codegen/code-factory.h"
#include "src/common/globals.h"
#include "src/compiler/access-builder.h"
#include "src/compiler/access-info.h"
#include "src/compiler/allocation-builder-inl.h"
#include "src/compiler/allocation-builder.h"
#include "src/compiler/common-operator.h"
#include "src/compiler/compilation-dependencies.h"
#include "src/compiler/const-tracking-let-helpers.h"
#include "src/compiler/frame-states.h"
#include "src/compiler/graph-assembler.h"
#include "src/compiler/js-graph.h"
#include "src/compiler/js-heap-broker.h"
#include "src/compiler/js-operator.h"
#include "src/compiler/linkage.h"
#include "src/compiler/map-inference.h"
#include "src/compiler/node-matchers.h"
#include "src/compiler/node-properties.h"
#include "src/compiler/property-access-builder.h"
#include "src/compiler/simplified-operator.h"
#include "src/compiler/type-cache.h"
#include "src/flags/flags.h"
#include "src/handles/handles.h"
#include "src/heap/factory.h"
#include "src/heap/heap-write-barrier-inl.h"
#include "src/objects/elements-kind.h"
#include "src/objects/feedback-vector.h"
#include "src/objects/heap-number.h"
#include "src/objects/string.h"
namespace v8 {
namespace internal {
namespace compiler {
namespace {
bool HasNumberMaps(JSHeapBroker* broker, ZoneVector<MapRef> const& maps) { … }
bool HasOnlyJSArrayMaps(JSHeapBroker* broker, ZoneVector<MapRef> const& maps) { … }
}
JSNativeContextSpecialization::JSNativeContextSpecialization(
Editor* editor, JSGraph* jsgraph, JSHeapBroker* broker, Flags flags,
Zone* zone, Zone* shared_zone)
: … { … }
Reduction JSNativeContextSpecialization::Reduce(Node* node) { … }
std::optional<size_t> JSNativeContextSpecialization::GetMaxStringLength(
JSHeapBroker* broker, Node* node) { … }
Reduction JSNativeContextSpecialization::ReduceJSToString(Node* node) { … }
Handle<String> JSNativeContextSpecialization::CreateStringConstant(Node* node) { … }
namespace {
bool IsStringConstant(JSHeapBroker* broker, Node* node) { … }
bool IsStringWithNonAccessibleContent(JSHeapBroker* broker, Node* node) { … }
}
Reduction JSNativeContextSpecialization::ReduceJSAsyncFunctionEnter(
Node* node) { … }
Reduction JSNativeContextSpecialization::ReduceJSAsyncFunctionReject(
Node* node) { … }
Reduction JSNativeContextSpecialization::ReduceJSAsyncFunctionResolve(
Node* node) { … }
Handle<String> JSNativeContextSpecialization::Concatenate(
Handle<String> left, Handle<String> right) { … }
bool JSNativeContextSpecialization::StringCanSafelyBeRead(Node* const node,
Handle<String> str) { … }
Reduction JSNativeContextSpecialization::ReduceJSAdd(Node* node) { … }
Reduction JSNativeContextSpecialization::ReduceJSGetSuperConstructor(
Node* node) { … }
Reduction
JSNativeContextSpecialization::ReduceJSFindNonDefaultConstructorOrConstruct(
Node* node) { … }
Reduction JSNativeContextSpecialization::ReduceJSInstanceOf(Node* node) { … }
JSNativeContextSpecialization::InferHasInPrototypeChainResult
JSNativeContextSpecialization::InferHasInPrototypeChain(
Node* receiver, Effect effect, HeapObjectRef prototype) { … }
Reduction JSNativeContextSpecialization::ReduceJSHasInPrototypeChain(
Node* node) { … }
Reduction JSNativeContextSpecialization::ReduceJSOrdinaryHasInstance(
Node* node) { … }
Reduction JSNativeContextSpecialization::ReduceJSPromiseResolve(Node* node) { … }
Reduction JSNativeContextSpecialization::ReduceJSResolvePromise(Node* node) { … }
namespace {
FieldAccess ForPropertyCellValue(MachineRepresentation representation,
Type type, OptionalMapRef map, NameRef name) { … }
}
Reduction JSNativeContextSpecialization::ReduceGlobalAccess(
Node* node, Node* lookup_start_object, Node* receiver, Node* value,
NameRef name, AccessMode access_mode, Node* key,
PropertyCellRef property_cell, Node* effect) { … }
Reduction JSNativeContextSpecialization::ReduceJSLoadGlobal(Node* node) { … }
Reduction JSNativeContextSpecialization::ReduceJSStoreGlobal(Node* node) { … }
Reduction JSNativeContextSpecialization::ReduceMegaDOMPropertyAccess(
Node* node, Node* value, MegaDOMPropertyAccessFeedback const& feedback,
FeedbackSource const& source) { … }
Reduction JSNativeContextSpecialization::ReduceNamedAccess(
Node* node, Node* value, NamedAccessFeedback const& feedback,
AccessMode access_mode, Node* key) { … }
Reduction JSNativeContextSpecialization::ReduceJSLoadNamed(Node* node) { … }
Reduction JSNativeContextSpecialization::ReduceJSLoadNamedFromSuper(
Node* node) { … }
Reduction JSNativeContextSpecialization::ReduceJSGetIterator(Node* node) { … }
Reduction JSNativeContextSpecialization::ReduceJSSetNamedProperty(Node* node) { … }
Reduction JSNativeContextSpecialization::ReduceJSDefineNamedOwnProperty(
Node* node) { … }
Reduction JSNativeContextSpecialization::ReduceElementAccessOnString(
Node* node, Node* index, Node* value, KeyedAccessMode const& keyed_mode) { … }
namespace {
OptionalJSTypedArrayRef GetTypedArrayConstant(JSHeapBroker* broker,
Node* receiver) { … }
}
void JSNativeContextSpecialization::RemoveImpossibleMaps(
Node* object, ZoneVector<MapRef>* maps) const { … }
ElementAccessFeedback const&
JSNativeContextSpecialization::TryRefineElementAccessFeedback(
ElementAccessFeedback const& feedback, Node* receiver,
Effect effect) const { … }
Reduction JSNativeContextSpecialization::ReduceElementAccess(
Node* node, Node* index, Node* value,
ElementAccessFeedback const& feedback) { … }
Reduction JSNativeContextSpecialization::ReduceElementLoadFromHeapConstant(
Node* node, Node* key, AccessMode access_mode,
KeyedAccessLoadMode load_mode) { … }
Reduction JSNativeContextSpecialization::ReducePropertyAccess(
Node* node, Node* key, OptionalNameRef static_name, Node* value,
FeedbackSource const& source, AccessMode access_mode) { … }
Reduction JSNativeContextSpecialization::ReduceEagerDeoptimize(
Node* node, DeoptimizeReason reason) { … }
Reduction JSNativeContextSpecialization::ReduceJSHasProperty(Node* node) { … }
Reduction JSNativeContextSpecialization::ReduceJSLoadPropertyWithEnumeratedKey(
Node* node) { … }
Reduction JSNativeContextSpecialization::ReduceJSLoadProperty(Node* node) { … }
Reduction JSNativeContextSpecialization::ReduceJSSetKeyedProperty(Node* node) { … }
Reduction JSNativeContextSpecialization::ReduceJSDefineKeyedOwnProperty(
Node* node) { … }
Node* JSNativeContextSpecialization::InlinePropertyGetterCall(
Node* receiver, ConvertReceiverMode receiver_mode,
Node* lookup_start_object, Node* context, Node* frame_state, Node** effect,
Node** control, ZoneVector<Node*>* if_exceptions,
PropertyAccessInfo const& access_info) { … }
void JSNativeContextSpecialization::InlinePropertySetterCall(
Node* receiver, Node* value, Node* context, Node* frame_state,
Node** effect, Node** control, ZoneVector<Node*>* if_exceptions,
PropertyAccessInfo const& access_info) { … }
Node* JSNativeContextSpecialization::InlineApiCall(
Node* receiver, Node* api_holder, Node* frame_state, Node* value,
Node** effect, Node** control,
FunctionTemplateInfoRef function_template_info) { … }
std::optional<JSNativeContextSpecialization::ValueEffectControl>
JSNativeContextSpecialization::BuildPropertyLoad(
Node* lookup_start_object, Node* receiver, Node* context, Node* frame_state,
Node* effect, Node* control, NameRef name, ZoneVector<Node*>* if_exceptions,
PropertyAccessInfo const& access_info) { … }
JSNativeContextSpecialization::ValueEffectControl
JSNativeContextSpecialization::BuildPropertyTest(
Node* effect, Node* control, PropertyAccessInfo const& access_info) { … }
std::optional<JSNativeContextSpecialization::ValueEffectControl>
JSNativeContextSpecialization::BuildPropertyAccess(
Node* lookup_start_object, Node* receiver, Node* value, Node* context,
Node* frame_state, Node* effect, Node* control, NameRef name,
ZoneVector<Node*>* if_exceptions, PropertyAccessInfo const& access_info,
AccessMode access_mode) { … }
JSNativeContextSpecialization::ValueEffectControl
JSNativeContextSpecialization::BuildPropertyStore(
Node* receiver, Node* value, Node* context, Node* frame_state, Node* effect,
Node* control, NameRef name, ZoneVector<Node*>* if_exceptions,
PropertyAccessInfo const& access_info, AccessMode access_mode) { … }
Reduction
JSNativeContextSpecialization::ReduceJSDefineKeyedOwnPropertyInLiteral(
Node* node) { … }
Reduction JSNativeContextSpecialization::ReduceJSStoreInArrayLiteral(
Node* node) { … }
Reduction JSNativeContextSpecialization::ReduceJSToObject(Node* node) { … }
JSNativeContextSpecialization::ValueEffectControl
JSNativeContextSpecialization::BuildElementAccess(
Node* receiver, Node* index, Node* value, Node* effect, Node* control,
Node* context, ElementAccessInfo const& access_info,
KeyedAccessMode const& keyed_mode) { … }
JSNativeContextSpecialization::ValueEffectControl
JSNativeContextSpecialization::
BuildElementAccessForTypedArrayOrRabGsabTypedArray(
Node* receiver, Node* index, Node* value, Node* effect, Node* control,
Node* context, ElementsKind elements_kind,
KeyedAccessMode const& keyed_mode) { … }
Node* JSNativeContextSpecialization::BuildIndexedStringLoad(
Node* receiver, Node* index, Node* length, Node** effect, Node** control,
KeyedAccessLoadMode load_mode) { … }
Node* JSNativeContextSpecialization::BuildExtendPropertiesBackingStore(
MapRef map, Node* properties, Node* effect, Node* control) { … }
Node* JSNativeContextSpecialization::BuildCheckEqualsName(NameRef name,
Node* value,
Node* effect,
Node* control) { … }
bool JSNativeContextSpecialization::CanTreatHoleAsUndefined(
ZoneVector<MapRef> const& receiver_maps) { … }
bool JSNativeContextSpecialization::InferMaps(Node* object, Effect effect,
ZoneVector<MapRef>* maps) const { … }
OptionalMapRef JSNativeContextSpecialization::InferRootMap(Node* object) const { … }
Node* JSNativeContextSpecialization::BuildLoadPrototypeFromObject(
Node* object, Node* effect, Node* control) { … }
std::pair<Node*, Node*>
JSNativeContextSpecialization::ReleaseEffectAndControlFromAssembler(
JSGraphAssembler* gasm) { … }
Graph* JSNativeContextSpecialization::graph() const { … }
Isolate* JSNativeContextSpecialization::isolate() const { … }
Factory* JSNativeContextSpecialization::factory() const { … }
CommonOperatorBuilder* JSNativeContextSpecialization::common() const { … }
JSOperatorBuilder* JSNativeContextSpecialization::javascript() const { … }
SimplifiedOperatorBuilder* JSNativeContextSpecialization::simplified() const { … }
}
}
}