11cb0ef41Sopenharmony_ci// Copyright 2020 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_cinamespace ic {
61cb0ef41Sopenharmony_ci
71cb0ef41Sopenharmony_ci// --- The public interface (forwards to the actual implementation).
81cb0ef41Sopenharmony_ci
91cb0ef41Sopenharmony_ci@export
101cb0ef41Sopenharmony_cimacro CollectCallFeedback(
111cb0ef41Sopenharmony_ci    maybeTarget: JSAny, maybeReceiver: Lazy<JSAny>, context: Context,
121cb0ef41Sopenharmony_ci    maybeFeedbackVector: Undefined|FeedbackVector, slotId: uintptr): void {
131cb0ef41Sopenharmony_ci  callable::CollectCallFeedback(
141cb0ef41Sopenharmony_ci      maybeTarget, maybeReceiver, context, maybeFeedbackVector, slotId);
151cb0ef41Sopenharmony_ci}
161cb0ef41Sopenharmony_ci
171cb0ef41Sopenharmony_ci@export
181cb0ef41Sopenharmony_cimacro CollectInstanceOfFeedback(
191cb0ef41Sopenharmony_ci    maybeTarget: JSAny, context: Context,
201cb0ef41Sopenharmony_ci    maybeFeedbackVector: Undefined|FeedbackVector, slotId: uintptr): void {
211cb0ef41Sopenharmony_ci  callable::CollectInstanceOfFeedback(
221cb0ef41Sopenharmony_ci      maybeTarget, context, maybeFeedbackVector, slotId);
231cb0ef41Sopenharmony_ci}
241cb0ef41Sopenharmony_ci
251cb0ef41Sopenharmony_ci@export
261cb0ef41Sopenharmony_cimacro CollectConstructFeedback(implicit context: Context)(
271cb0ef41Sopenharmony_ci    target: JSAny, newTarget: JSAny,
281cb0ef41Sopenharmony_ci    maybeFeedbackVector: Undefined|FeedbackVector, slotId: uintptr,
291cb0ef41Sopenharmony_ci    updateFeedbackMode: constexpr UpdateFeedbackMode):
301cb0ef41Sopenharmony_ci    never labels ConstructGeneric,
311cb0ef41Sopenharmony_ci    ConstructArray(AllocationSite) {
321cb0ef41Sopenharmony_ci  callable::CollectConstructFeedback(
331cb0ef41Sopenharmony_ci      target, newTarget, maybeFeedbackVector, slotId, updateFeedbackMode)
341cb0ef41Sopenharmony_ci      otherwise ConstructGeneric, ConstructArray;
351cb0ef41Sopenharmony_ci}
361cb0ef41Sopenharmony_ci
371cb0ef41Sopenharmony_ci// --- Common functionality.
381cb0ef41Sopenharmony_ci
391cb0ef41Sopenharmony_ciextern macro MegamorphicSymbolConstant(): Symbol;
401cb0ef41Sopenharmony_ciextern macro UninitializedSymbolConstant(): Symbol;
411cb0ef41Sopenharmony_ci
421cb0ef41Sopenharmony_ciconst kMegamorphicSymbol: Symbol = MegamorphicSymbolConstant();
431cb0ef41Sopenharmony_ciconst kUninitializedSymbol: Symbol = UninitializedSymbolConstant();
441cb0ef41Sopenharmony_ci
451cb0ef41Sopenharmony_cimacro IsMegamorphic(feedback: MaybeObject): bool {
461cb0ef41Sopenharmony_ci  return TaggedEqual(feedback, kMegamorphicSymbol);
471cb0ef41Sopenharmony_ci}
481cb0ef41Sopenharmony_ci
491cb0ef41Sopenharmony_cimacro IsUninitialized(feedback: MaybeObject): bool {
501cb0ef41Sopenharmony_ci  return TaggedEqual(feedback, kUninitializedSymbol);
511cb0ef41Sopenharmony_ci}
521cb0ef41Sopenharmony_ci
531cb0ef41Sopenharmony_ciextern macro LoadFeedbackVectorSlot(FeedbackVector, uintptr): MaybeObject;
541cb0ef41Sopenharmony_ciextern macro LoadFeedbackVectorSlot(
551cb0ef41Sopenharmony_ci    FeedbackVector, uintptr, constexpr int32): MaybeObject;
561cb0ef41Sopenharmony_ciextern operator '[]' macro LoadFeedbackVectorSlot(
571cb0ef41Sopenharmony_ci    FeedbackVector, intptr): MaybeObject;
581cb0ef41Sopenharmony_ciextern macro StoreFeedbackVectorSlot(
591cb0ef41Sopenharmony_ci    FeedbackVector, uintptr, MaybeObject): void;
601cb0ef41Sopenharmony_ciextern macro StoreFeedbackVectorSlot(
611cb0ef41Sopenharmony_ci    FeedbackVector, uintptr, MaybeObject, constexpr WriteBarrierMode,
621cb0ef41Sopenharmony_ci    constexpr int32): void;
631cb0ef41Sopenharmony_ciextern macro StoreWeakReferenceInFeedbackVector(
641cb0ef41Sopenharmony_ci    FeedbackVector, uintptr, HeapObject): MaybeObject;
651cb0ef41Sopenharmony_ciextern macro ReportFeedbackUpdate(
661cb0ef41Sopenharmony_ci    FeedbackVector, uintptr, constexpr string): void;
671cb0ef41Sopenharmony_ciextern operator '.length_intptr' macro LoadFeedbackVectorLength(FeedbackVector):
681cb0ef41Sopenharmony_ci    intptr;
691cb0ef41Sopenharmony_ci
701cb0ef41Sopenharmony_ci}  // namespace ic
71