summaryrefslogtreecommitdiff
path: root/chromium/v8/src/builtins/ic.tq
blob: a9e92cf63ec4ae4717cd9f5aba3d10f42450d97f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
// Copyright 2020 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

namespace ic {

// --- The public interface (forwards to the actual implementation).

@export
macro CollectCallFeedback(
    maybeTarget: JSAny, maybeReceiver: Lazy<JSAny>, context: Context,
    maybeFeedbackVector: Undefined|FeedbackVector, slotId: uintptr): void {
  callable::CollectCallFeedback(
      maybeTarget, maybeReceiver, context, maybeFeedbackVector, slotId);
}

@export
macro CollectInstanceOfFeedback(
    maybeTarget: JSAny, context: Context,
    maybeFeedbackVector: Undefined|FeedbackVector, slotId: uintptr): void {
  callable::CollectInstanceOfFeedback(
      maybeTarget, context, maybeFeedbackVector, slotId);
}

@export
macro CollectConstructFeedback(implicit context: Context)(
    target: JSAny, newTarget: JSAny,
    maybeFeedbackVector: Undefined|FeedbackVector, slotId: uintptr,
    updateFeedbackMode: constexpr UpdateFeedbackMode):
    never labels ConstructGeneric,
    ConstructArray(AllocationSite) {
  callable::CollectConstructFeedback(
      target, newTarget, maybeFeedbackVector, slotId, updateFeedbackMode)
      otherwise ConstructGeneric, ConstructArray;
}

// --- Common functionality.

extern macro MegamorphicSymbolConstant(): Symbol;
extern macro UninitializedSymbolConstant(): Symbol;

const kMegamorphicSymbol: Symbol = MegamorphicSymbolConstant();
const kUninitializedSymbol: Symbol = UninitializedSymbolConstant();

macro IsMegamorphic(feedback: MaybeObject): bool {
  return TaggedEqual(feedback, kMegamorphicSymbol);
}

macro IsUninitialized(feedback: MaybeObject): bool {
  return TaggedEqual(feedback, kUninitializedSymbol);
}

extern macro LoadFeedbackVectorSlot(FeedbackVector, uintptr): MaybeObject;
extern macro LoadFeedbackVectorSlot(
    FeedbackVector, uintptr, constexpr int32): MaybeObject;
extern operator '[]' macro LoadFeedbackVectorSlot(
    FeedbackVector, intptr): MaybeObject;
extern macro StoreFeedbackVectorSlot(
    FeedbackVector, uintptr, MaybeObject): void;
extern macro StoreFeedbackVectorSlot(
    FeedbackVector, uintptr, MaybeObject, constexpr WriteBarrierMode,
    constexpr int32): void;
extern macro StoreWeakReferenceInFeedbackVector(
    FeedbackVector, uintptr, HeapObject): MaybeObject;
extern macro ReportFeedbackUpdate(FeedbackVector, uintptr, constexpr string);
extern operator '.length_intptr' macro LoadFeedbackVectorLength(FeedbackVector):
    intptr;

}  // namespace ic