11cb0ef41Sopenharmony_ci// Copyright 2012 the V8 project authors. All rights reserved.
21cb0ef41Sopenharmony_ci// Use of this source code is governed by a BSD-style license that can be
31cb0ef41Sopenharmony_ci// found in the LICENSE file.
41cb0ef41Sopenharmony_ci
51cb0ef41Sopenharmony_ci#ifndef V8_IC_IC_H_
61cb0ef41Sopenharmony_ci#define V8_IC_IC_H_
71cb0ef41Sopenharmony_ci
81cb0ef41Sopenharmony_ci#include <vector>
91cb0ef41Sopenharmony_ci
101cb0ef41Sopenharmony_ci#include "src/common/message-template.h"
111cb0ef41Sopenharmony_ci#include "src/execution/isolate.h"
121cb0ef41Sopenharmony_ci#include "src/heap/factory.h"
131cb0ef41Sopenharmony_ci#include "src/ic/stub-cache.h"
141cb0ef41Sopenharmony_ci#include "src/objects/feedback-vector.h"
151cb0ef41Sopenharmony_ci#include "src/objects/map.h"
161cb0ef41Sopenharmony_ci#include "src/objects/maybe-object.h"
171cb0ef41Sopenharmony_ci#include "src/objects/smi.h"
181cb0ef41Sopenharmony_ci
191cb0ef41Sopenharmony_cinamespace v8 {
201cb0ef41Sopenharmony_cinamespace internal {
211cb0ef41Sopenharmony_ci
221cb0ef41Sopenharmony_cienum class NamedPropertyType : bool { kNotOwn, kOwn };
231cb0ef41Sopenharmony_ci
241cb0ef41Sopenharmony_ci//
251cb0ef41Sopenharmony_ci// IC is the base class for LoadIC, StoreIC, KeyedLoadIC, and KeyedStoreIC.
261cb0ef41Sopenharmony_ci//
271cb0ef41Sopenharmony_ciclass IC {
281cb0ef41Sopenharmony_ci public:
291cb0ef41Sopenharmony_ci  // Alias the inline cache state type to make the IC code more readable.
301cb0ef41Sopenharmony_ci  using State = InlineCacheState;
311cb0ef41Sopenharmony_ci
321cb0ef41Sopenharmony_ci  // Construct the IC structure with the given number of extra
331cb0ef41Sopenharmony_ci  // JavaScript frames on the stack.
341cb0ef41Sopenharmony_ci  IC(Isolate* isolate, Handle<FeedbackVector> vector, FeedbackSlot slot,
351cb0ef41Sopenharmony_ci     FeedbackSlotKind kind);
361cb0ef41Sopenharmony_ci  virtual ~IC() = default;
371cb0ef41Sopenharmony_ci
381cb0ef41Sopenharmony_ci  State state() const { return state_; }
391cb0ef41Sopenharmony_ci
401cb0ef41Sopenharmony_ci  // Compute the current IC state based on the target stub, lookup_start_object
411cb0ef41Sopenharmony_ci  // and name.
421cb0ef41Sopenharmony_ci  void UpdateState(Handle<Object> lookup_start_object, Handle<Object> name);
431cb0ef41Sopenharmony_ci
441cb0ef41Sopenharmony_ci  bool RecomputeHandlerForName(Handle<Object> name);
451cb0ef41Sopenharmony_ci  void MarkRecomputeHandler(Handle<Object> name) {
461cb0ef41Sopenharmony_ci    DCHECK(RecomputeHandlerForName(name));
471cb0ef41Sopenharmony_ci    old_state_ = state_;
481cb0ef41Sopenharmony_ci    state_ = InlineCacheState::RECOMPUTE_HANDLER;
491cb0ef41Sopenharmony_ci  }
501cb0ef41Sopenharmony_ci
511cb0ef41Sopenharmony_ci  bool IsAnyHas() const { return IsKeyedHasIC(); }
521cb0ef41Sopenharmony_ci  bool IsAnyLoad() const {
531cb0ef41Sopenharmony_ci    return IsLoadIC() || IsLoadGlobalIC() || IsKeyedLoadIC();
541cb0ef41Sopenharmony_ci  }
551cb0ef41Sopenharmony_ci  bool IsAnyStore() const {
561cb0ef41Sopenharmony_ci    return IsSetNamedIC() || IsDefineNamedOwnIC() || IsStoreGlobalIC() ||
571cb0ef41Sopenharmony_ci           IsKeyedStoreIC() || IsStoreInArrayLiteralICKind(kind()) ||
581cb0ef41Sopenharmony_ci           IsDefineKeyedOwnIC();
591cb0ef41Sopenharmony_ci  }
601cb0ef41Sopenharmony_ci  bool IsAnyDefineOwn() const {
611cb0ef41Sopenharmony_ci    return IsDefineNamedOwnIC() || IsDefineKeyedOwnIC();
621cb0ef41Sopenharmony_ci  }
631cb0ef41Sopenharmony_ci
641cb0ef41Sopenharmony_ci  static inline bool IsHandler(MaybeObject object);
651cb0ef41Sopenharmony_ci
661cb0ef41Sopenharmony_ci  // Nofity the IC system that a feedback has changed.
671cb0ef41Sopenharmony_ci  static void OnFeedbackChanged(Isolate* isolate, FeedbackVector vector,
681cb0ef41Sopenharmony_ci                                FeedbackSlot slot, const char* reason);
691cb0ef41Sopenharmony_ci
701cb0ef41Sopenharmony_ci  void OnFeedbackChanged(const char* reason);
711cb0ef41Sopenharmony_ci
721cb0ef41Sopenharmony_ci protected:
731cb0ef41Sopenharmony_ci  void set_slow_stub_reason(const char* reason) { slow_stub_reason_ = reason; }
741cb0ef41Sopenharmony_ci  void set_accessor(Handle<Object> accessor) { accessor_ = accessor; }
751cb0ef41Sopenharmony_ci  MaybeHandle<Object> accessor() const { return accessor_; }
761cb0ef41Sopenharmony_ci
771cb0ef41Sopenharmony_ci  Isolate* isolate() const { return isolate_; }
781cb0ef41Sopenharmony_ci
791cb0ef41Sopenharmony_ci  bool is_vector_set() { return vector_set_; }
801cb0ef41Sopenharmony_ci  inline bool vector_needs_update();
811cb0ef41Sopenharmony_ci
821cb0ef41Sopenharmony_ci  inline Handle<Object> CodeHandler(Builtin builtin);
831cb0ef41Sopenharmony_ci
841cb0ef41Sopenharmony_ci  // Configure for most states.
851cb0ef41Sopenharmony_ci  bool ConfigureVectorState(IC::State new_state, Handle<Object> key);
861cb0ef41Sopenharmony_ci  // Configure the vector for MONOMORPHIC.
871cb0ef41Sopenharmony_ci  void ConfigureVectorState(Handle<Name> name, Handle<Map> map,
881cb0ef41Sopenharmony_ci                            Handle<Object> handler);
891cb0ef41Sopenharmony_ci  void ConfigureVectorState(Handle<Name> name, Handle<Map> map,
901cb0ef41Sopenharmony_ci                            const MaybeObjectHandle& handler);
911cb0ef41Sopenharmony_ci  // Configure the vector for POLYMORPHIC.
921cb0ef41Sopenharmony_ci  void ConfigureVectorState(Handle<Name> name, MapHandles const& maps,
931cb0ef41Sopenharmony_ci                            MaybeObjectHandles* handlers);
941cb0ef41Sopenharmony_ci  void ConfigureVectorState(
951cb0ef41Sopenharmony_ci      Handle<Name> name, std::vector<MapAndHandler> const& maps_and_handlers);
961cb0ef41Sopenharmony_ci
971cb0ef41Sopenharmony_ci  char TransitionMarkFromState(IC::State state);
981cb0ef41Sopenharmony_ci  void TraceIC(const char* type, Handle<Object> name);
991cb0ef41Sopenharmony_ci  void TraceIC(const char* type, Handle<Object> name, State old_state,
1001cb0ef41Sopenharmony_ci               State new_state);
1011cb0ef41Sopenharmony_ci
1021cb0ef41Sopenharmony_ci  MaybeHandle<Object> TypeError(MessageTemplate, Handle<Object> object,
1031cb0ef41Sopenharmony_ci                                Handle<Object> key);
1041cb0ef41Sopenharmony_ci  MaybeHandle<Object> ReferenceError(Handle<Name> name);
1051cb0ef41Sopenharmony_ci
1061cb0ef41Sopenharmony_ci  void UpdateMonomorphicIC(const MaybeObjectHandle& handler, Handle<Name> name);
1071cb0ef41Sopenharmony_ci  bool UpdateMegaDOMIC(const MaybeObjectHandle& handler, Handle<Name> name);
1081cb0ef41Sopenharmony_ci  bool UpdatePolymorphicIC(Handle<Name> name, const MaybeObjectHandle& handler);
1091cb0ef41Sopenharmony_ci  void UpdateMegamorphicCache(Handle<Map> map, Handle<Name> name,
1101cb0ef41Sopenharmony_ci                              const MaybeObjectHandle& handler);
1111cb0ef41Sopenharmony_ci
1121cb0ef41Sopenharmony_ci  StubCache* stub_cache();
1131cb0ef41Sopenharmony_ci
1141cb0ef41Sopenharmony_ci  void CopyICToMegamorphicCache(Handle<Name> name);
1151cb0ef41Sopenharmony_ci  bool IsTransitionOfMonomorphicTarget(Map source_map, Map target_map);
1161cb0ef41Sopenharmony_ci  void SetCache(Handle<Name> name, Handle<Object> handler);
1171cb0ef41Sopenharmony_ci  void SetCache(Handle<Name> name, const MaybeObjectHandle& handler);
1181cb0ef41Sopenharmony_ci  FeedbackSlotKind kind() const { return kind_; }
1191cb0ef41Sopenharmony_ci  bool IsGlobalIC() const { return IsLoadGlobalIC() || IsStoreGlobalIC(); }
1201cb0ef41Sopenharmony_ci  bool IsLoadIC() const { return IsLoadICKind(kind_); }
1211cb0ef41Sopenharmony_ci  bool IsLoadGlobalIC() const { return IsLoadGlobalICKind(kind_); }
1221cb0ef41Sopenharmony_ci  bool IsKeyedLoadIC() const { return IsKeyedLoadICKind(kind_); }
1231cb0ef41Sopenharmony_ci  bool IsStoreGlobalIC() const { return IsStoreGlobalICKind(kind_); }
1241cb0ef41Sopenharmony_ci  bool IsSetNamedIC() const { return IsSetNamedICKind(kind_); }
1251cb0ef41Sopenharmony_ci  bool IsDefineNamedOwnIC() const { return IsDefineNamedOwnICKind(kind_); }
1261cb0ef41Sopenharmony_ci  bool IsStoreInArrayLiteralIC() const {
1271cb0ef41Sopenharmony_ci    return IsStoreInArrayLiteralICKind(kind_);
1281cb0ef41Sopenharmony_ci  }
1291cb0ef41Sopenharmony_ci  bool IsKeyedStoreIC() const { return IsKeyedStoreICKind(kind_); }
1301cb0ef41Sopenharmony_ci  bool IsKeyedHasIC() const { return IsKeyedHasICKind(kind_); }
1311cb0ef41Sopenharmony_ci  bool IsDefineKeyedOwnIC() const { return IsDefineKeyedOwnICKind(kind_); }
1321cb0ef41Sopenharmony_ci  bool is_keyed() const {
1331cb0ef41Sopenharmony_ci    return IsKeyedLoadIC() || IsKeyedStoreIC() || IsStoreInArrayLiteralIC() ||
1341cb0ef41Sopenharmony_ci           IsKeyedHasIC() || IsDefineKeyedOwnIC();
1351cb0ef41Sopenharmony_ci  }
1361cb0ef41Sopenharmony_ci  bool ShouldRecomputeHandler(Handle<String> name);
1371cb0ef41Sopenharmony_ci
1381cb0ef41Sopenharmony_ci  Handle<Map> lookup_start_object_map() { return lookup_start_object_map_; }
1391cb0ef41Sopenharmony_ci  inline void update_lookup_start_object_map(Handle<Object> object);
1401cb0ef41Sopenharmony_ci
1411cb0ef41Sopenharmony_ci  void TargetMaps(MapHandles* list) {
1421cb0ef41Sopenharmony_ci    FindTargetMaps();
1431cb0ef41Sopenharmony_ci    for (Handle<Map> map : target_maps_) {
1441cb0ef41Sopenharmony_ci      list->push_back(map);
1451cb0ef41Sopenharmony_ci    }
1461cb0ef41Sopenharmony_ci  }
1471cb0ef41Sopenharmony_ci
1481cb0ef41Sopenharmony_ci  Map FirstTargetMap() {
1491cb0ef41Sopenharmony_ci    FindTargetMaps();
1501cb0ef41Sopenharmony_ci    return !target_maps_.empty() ? *target_maps_[0] : Map();
1511cb0ef41Sopenharmony_ci  }
1521cb0ef41Sopenharmony_ci
1531cb0ef41Sopenharmony_ci  const FeedbackNexus* nexus() const { return &nexus_; }
1541cb0ef41Sopenharmony_ci  FeedbackNexus* nexus() { return &nexus_; }
1551cb0ef41Sopenharmony_ci
1561cb0ef41Sopenharmony_ci private:
1571cb0ef41Sopenharmony_ci  void FindTargetMaps() {
1581cb0ef41Sopenharmony_ci    if (target_maps_set_) return;
1591cb0ef41Sopenharmony_ci    target_maps_set_ = true;
1601cb0ef41Sopenharmony_ci    nexus()->ExtractMaps(&target_maps_);
1611cb0ef41Sopenharmony_ci  }
1621cb0ef41Sopenharmony_ci
1631cb0ef41Sopenharmony_ci  Isolate* isolate_;
1641cb0ef41Sopenharmony_ci
1651cb0ef41Sopenharmony_ci  bool vector_set_;
1661cb0ef41Sopenharmony_ci  State old_state_;  // For saving if we marked as prototype failure.
1671cb0ef41Sopenharmony_ci  State state_;
1681cb0ef41Sopenharmony_ci  FeedbackSlotKind kind_;
1691cb0ef41Sopenharmony_ci  Handle<Map> lookup_start_object_map_;
1701cb0ef41Sopenharmony_ci  MaybeHandle<Object> accessor_;
1711cb0ef41Sopenharmony_ci  MapHandles target_maps_;
1721cb0ef41Sopenharmony_ci  bool target_maps_set_;
1731cb0ef41Sopenharmony_ci
1741cb0ef41Sopenharmony_ci  const char* slow_stub_reason_;
1751cb0ef41Sopenharmony_ci
1761cb0ef41Sopenharmony_ci  FeedbackNexus nexus_;
1771cb0ef41Sopenharmony_ci
1781cb0ef41Sopenharmony_ci  DISALLOW_IMPLICIT_CONSTRUCTORS(IC);
1791cb0ef41Sopenharmony_ci};
1801cb0ef41Sopenharmony_ci
1811cb0ef41Sopenharmony_ciclass LoadIC : public IC {
1821cb0ef41Sopenharmony_ci public:
1831cb0ef41Sopenharmony_ci  LoadIC(Isolate* isolate, Handle<FeedbackVector> vector, FeedbackSlot slot,
1841cb0ef41Sopenharmony_ci         FeedbackSlotKind kind)
1851cb0ef41Sopenharmony_ci      : IC(isolate, vector, slot, kind) {
1861cb0ef41Sopenharmony_ci    DCHECK(IsAnyLoad() || IsAnyHas());
1871cb0ef41Sopenharmony_ci  }
1881cb0ef41Sopenharmony_ci
1891cb0ef41Sopenharmony_ci  static bool ShouldThrowReferenceError(FeedbackSlotKind kind) {
1901cb0ef41Sopenharmony_ci    return kind == FeedbackSlotKind::kLoadGlobalNotInsideTypeof;
1911cb0ef41Sopenharmony_ci  }
1921cb0ef41Sopenharmony_ci
1931cb0ef41Sopenharmony_ci  bool ShouldThrowReferenceError() const {
1941cb0ef41Sopenharmony_ci    return ShouldThrowReferenceError(kind());
1951cb0ef41Sopenharmony_ci  }
1961cb0ef41Sopenharmony_ci
1971cb0ef41Sopenharmony_ci  // If receiver is empty, use object as the receiver.
1981cb0ef41Sopenharmony_ci  V8_WARN_UNUSED_RESULT MaybeHandle<Object> Load(
1991cb0ef41Sopenharmony_ci      Handle<Object> object, Handle<Name> name, bool update_feedback = true,
2001cb0ef41Sopenharmony_ci      Handle<Object> receiver = Handle<Object>());
2011cb0ef41Sopenharmony_ci
2021cb0ef41Sopenharmony_ci protected:
2031cb0ef41Sopenharmony_ci  // Update the inline cache and the global stub cache based on the
2041cb0ef41Sopenharmony_ci  // lookup result.
2051cb0ef41Sopenharmony_ci  void UpdateCaches(LookupIterator* lookup);
2061cb0ef41Sopenharmony_ci
2071cb0ef41Sopenharmony_ci private:
2081cb0ef41Sopenharmony_ci  Handle<Object> ComputeHandler(LookupIterator* lookup);
2091cb0ef41Sopenharmony_ci
2101cb0ef41Sopenharmony_ci  friend class IC;
2111cb0ef41Sopenharmony_ci  friend class NamedLoadHandlerCompiler;
2121cb0ef41Sopenharmony_ci};
2131cb0ef41Sopenharmony_ci
2141cb0ef41Sopenharmony_ciclass LoadGlobalIC : public LoadIC {
2151cb0ef41Sopenharmony_ci public:
2161cb0ef41Sopenharmony_ci  LoadGlobalIC(Isolate* isolate, Handle<FeedbackVector> vector,
2171cb0ef41Sopenharmony_ci               FeedbackSlot slot, FeedbackSlotKind kind)
2181cb0ef41Sopenharmony_ci      : LoadIC(isolate, vector, slot, kind) {}
2191cb0ef41Sopenharmony_ci
2201cb0ef41Sopenharmony_ci  V8_WARN_UNUSED_RESULT MaybeHandle<Object> Load(Handle<Name> name,
2211cb0ef41Sopenharmony_ci                                                 bool update_feedback = true);
2221cb0ef41Sopenharmony_ci};
2231cb0ef41Sopenharmony_ci
2241cb0ef41Sopenharmony_ciclass KeyedLoadIC : public LoadIC {
2251cb0ef41Sopenharmony_ci public:
2261cb0ef41Sopenharmony_ci  KeyedLoadIC(Isolate* isolate, Handle<FeedbackVector> vector,
2271cb0ef41Sopenharmony_ci              FeedbackSlot slot, FeedbackSlotKind kind)
2281cb0ef41Sopenharmony_ci      : LoadIC(isolate, vector, slot, kind) {}
2291cb0ef41Sopenharmony_ci
2301cb0ef41Sopenharmony_ci  V8_WARN_UNUSED_RESULT MaybeHandle<Object> Load(Handle<Object> object,
2311cb0ef41Sopenharmony_ci                                                 Handle<Object> key);
2321cb0ef41Sopenharmony_ci
2331cb0ef41Sopenharmony_ci protected:
2341cb0ef41Sopenharmony_ci  V8_WARN_UNUSED_RESULT MaybeHandle<Object> RuntimeLoad(Handle<Object> object,
2351cb0ef41Sopenharmony_ci                                                        Handle<Object> key);
2361cb0ef41Sopenharmony_ci
2371cb0ef41Sopenharmony_ci  // receiver is HeapObject because it could be a String or a JSObject
2381cb0ef41Sopenharmony_ci  void UpdateLoadElement(Handle<HeapObject> receiver,
2391cb0ef41Sopenharmony_ci                         KeyedAccessLoadMode load_mode);
2401cb0ef41Sopenharmony_ci
2411cb0ef41Sopenharmony_ci private:
2421cb0ef41Sopenharmony_ci  friend class IC;
2431cb0ef41Sopenharmony_ci
2441cb0ef41Sopenharmony_ci  Handle<Object> LoadElementHandler(Handle<Map> receiver_map,
2451cb0ef41Sopenharmony_ci                                    KeyedAccessLoadMode load_mode);
2461cb0ef41Sopenharmony_ci
2471cb0ef41Sopenharmony_ci  void LoadElementPolymorphicHandlers(MapHandles* receiver_maps,
2481cb0ef41Sopenharmony_ci                                      MaybeObjectHandles* handlers,
2491cb0ef41Sopenharmony_ci                                      KeyedAccessLoadMode load_mode);
2501cb0ef41Sopenharmony_ci
2511cb0ef41Sopenharmony_ci  // Returns true if the receiver_map has a kElement or kIndexedString
2521cb0ef41Sopenharmony_ci  // handler in the nexus currently but didn't yet allow out of bounds
2531cb0ef41Sopenharmony_ci  // accesses.
2541cb0ef41Sopenharmony_ci  bool CanChangeToAllowOutOfBounds(Handle<Map> receiver_map);
2551cb0ef41Sopenharmony_ci};
2561cb0ef41Sopenharmony_ci
2571cb0ef41Sopenharmony_ciclass StoreIC : public IC {
2581cb0ef41Sopenharmony_ci public:
2591cb0ef41Sopenharmony_ci  StoreIC(Isolate* isolate, Handle<FeedbackVector> vector, FeedbackSlot slot,
2601cb0ef41Sopenharmony_ci          FeedbackSlotKind kind)
2611cb0ef41Sopenharmony_ci      : IC(isolate, vector, slot, kind) {
2621cb0ef41Sopenharmony_ci    DCHECK(IsAnyStore());
2631cb0ef41Sopenharmony_ci  }
2641cb0ef41Sopenharmony_ci
2651cb0ef41Sopenharmony_ci  V8_WARN_UNUSED_RESULT MaybeHandle<Object> Store(
2661cb0ef41Sopenharmony_ci      Handle<Object> object, Handle<Name> name, Handle<Object> value,
2671cb0ef41Sopenharmony_ci      StoreOrigin store_origin = StoreOrigin::kNamed);
2681cb0ef41Sopenharmony_ci
2691cb0ef41Sopenharmony_ci  bool LookupForWrite(LookupIterator* it, Handle<Object> value,
2701cb0ef41Sopenharmony_ci                      StoreOrigin store_origin);
2711cb0ef41Sopenharmony_ci
2721cb0ef41Sopenharmony_ci protected:
2731cb0ef41Sopenharmony_ci  // Stub accessors.
2741cb0ef41Sopenharmony_ci  // Update the inline cache and the global stub cache based on the
2751cb0ef41Sopenharmony_ci  // lookup result.
2761cb0ef41Sopenharmony_ci  void UpdateCaches(LookupIterator* lookup, Handle<Object> value,
2771cb0ef41Sopenharmony_ci                    StoreOrigin store_origin);
2781cb0ef41Sopenharmony_ci
2791cb0ef41Sopenharmony_ci private:
2801cb0ef41Sopenharmony_ci  MaybeObjectHandle ComputeHandler(LookupIterator* lookup);
2811cb0ef41Sopenharmony_ci
2821cb0ef41Sopenharmony_ci  friend class IC;
2831cb0ef41Sopenharmony_ci};
2841cb0ef41Sopenharmony_ci
2851cb0ef41Sopenharmony_ciclass StoreGlobalIC : public StoreIC {
2861cb0ef41Sopenharmony_ci public:
2871cb0ef41Sopenharmony_ci  StoreGlobalIC(Isolate* isolate, Handle<FeedbackVector> vector,
2881cb0ef41Sopenharmony_ci                FeedbackSlot slot, FeedbackSlotKind kind)
2891cb0ef41Sopenharmony_ci      : StoreIC(isolate, vector, slot, kind) {}
2901cb0ef41Sopenharmony_ci
2911cb0ef41Sopenharmony_ci  V8_WARN_UNUSED_RESULT MaybeHandle<Object> Store(Handle<Name> name,
2921cb0ef41Sopenharmony_ci                                                  Handle<Object> value);
2931cb0ef41Sopenharmony_ci};
2941cb0ef41Sopenharmony_ci
2951cb0ef41Sopenharmony_cienum KeyedStoreCheckMap { kDontCheckMap, kCheckMap };
2961cb0ef41Sopenharmony_ci
2971cb0ef41Sopenharmony_cienum KeyedStoreIncrementLength { kDontIncrementLength, kIncrementLength };
2981cb0ef41Sopenharmony_ci
2991cb0ef41Sopenharmony_cienum class TransitionMode {
3001cb0ef41Sopenharmony_ci  kNoTransition,
3011cb0ef41Sopenharmony_ci  kTransitionToDouble,
3021cb0ef41Sopenharmony_ci  kTransitionToObject
3031cb0ef41Sopenharmony_ci};
3041cb0ef41Sopenharmony_ci
3051cb0ef41Sopenharmony_ciclass KeyedStoreIC : public StoreIC {
3061cb0ef41Sopenharmony_ci public:
3071cb0ef41Sopenharmony_ci  KeyedAccessStoreMode GetKeyedAccessStoreMode() {
3081cb0ef41Sopenharmony_ci    return nexus()->GetKeyedAccessStoreMode();
3091cb0ef41Sopenharmony_ci  }
3101cb0ef41Sopenharmony_ci
3111cb0ef41Sopenharmony_ci  KeyedStoreIC(Isolate* isolate, Handle<FeedbackVector> vector,
3121cb0ef41Sopenharmony_ci               FeedbackSlot slot, FeedbackSlotKind kind)
3131cb0ef41Sopenharmony_ci      : StoreIC(isolate, vector, slot, kind) {}
3141cb0ef41Sopenharmony_ci
3151cb0ef41Sopenharmony_ci  V8_WARN_UNUSED_RESULT MaybeHandle<Object> Store(Handle<Object> object,
3161cb0ef41Sopenharmony_ci                                                  Handle<Object> name,
3171cb0ef41Sopenharmony_ci                                                  Handle<Object> value);
3181cb0ef41Sopenharmony_ci
3191cb0ef41Sopenharmony_ci protected:
3201cb0ef41Sopenharmony_ci  void UpdateStoreElement(Handle<Map> receiver_map,
3211cb0ef41Sopenharmony_ci                          KeyedAccessStoreMode store_mode,
3221cb0ef41Sopenharmony_ci                          Handle<Map> new_receiver_map);
3231cb0ef41Sopenharmony_ci
3241cb0ef41Sopenharmony_ci private:
3251cb0ef41Sopenharmony_ci  Handle<Map> ComputeTransitionedMap(Handle<Map> map,
3261cb0ef41Sopenharmony_ci                                     TransitionMode transition_mode);
3271cb0ef41Sopenharmony_ci
3281cb0ef41Sopenharmony_ci  Handle<Object> StoreElementHandler(
3291cb0ef41Sopenharmony_ci      Handle<Map> receiver_map, KeyedAccessStoreMode store_mode,
3301cb0ef41Sopenharmony_ci      MaybeHandle<Object> prev_validity_cell = MaybeHandle<Object>());
3311cb0ef41Sopenharmony_ci
3321cb0ef41Sopenharmony_ci  void StoreElementPolymorphicHandlers(
3331cb0ef41Sopenharmony_ci      std::vector<MapAndHandler>* receiver_maps_and_handlers,
3341cb0ef41Sopenharmony_ci      KeyedAccessStoreMode store_mode);
3351cb0ef41Sopenharmony_ci
3361cb0ef41Sopenharmony_ci  friend class IC;
3371cb0ef41Sopenharmony_ci};
3381cb0ef41Sopenharmony_ci
3391cb0ef41Sopenharmony_ciclass StoreInArrayLiteralIC : public KeyedStoreIC {
3401cb0ef41Sopenharmony_ci public:
3411cb0ef41Sopenharmony_ci  StoreInArrayLiteralIC(Isolate* isolate, Handle<FeedbackVector> vector,
3421cb0ef41Sopenharmony_ci                        FeedbackSlot slot)
3431cb0ef41Sopenharmony_ci      : KeyedStoreIC(isolate, vector, slot,
3441cb0ef41Sopenharmony_ci                     FeedbackSlotKind::kStoreInArrayLiteral) {
3451cb0ef41Sopenharmony_ci    DCHECK(IsStoreInArrayLiteralICKind(kind()));
3461cb0ef41Sopenharmony_ci  }
3471cb0ef41Sopenharmony_ci
3481cb0ef41Sopenharmony_ci  MaybeHandle<Object> Store(Handle<JSArray> array, Handle<Object> index,
3491cb0ef41Sopenharmony_ci                            Handle<Object> value);
3501cb0ef41Sopenharmony_ci};
3511cb0ef41Sopenharmony_ci
3521cb0ef41Sopenharmony_ci}  // namespace internal
3531cb0ef41Sopenharmony_ci}  // namespace v8
3541cb0ef41Sopenharmony_ci
3551cb0ef41Sopenharmony_ci#endif  // V8_IC_IC_H_
356