• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright 2020 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5namespace ic {
6
7// --- The public interface (forwards to the actual implementation).
8
9@export
10macro CollectCallFeedback(
11    maybeTarget: JSAny, context: Context,
12    maybeFeedbackVector: Undefined|FeedbackVector, slotId: uintptr): void {
13  callable::CollectCallFeedback(
14      maybeTarget, context, maybeFeedbackVector, slotId);
15}
16
17@export
18macro CollectInstanceOfFeedback(
19    maybeTarget: JSAny, context: Context,
20    maybeFeedbackVector: Undefined|FeedbackVector, slotId: uintptr): void {
21  callable::CollectInstanceOfFeedback(
22      maybeTarget, context, maybeFeedbackVector, slotId);
23}
24
25@export
26macro CollectConstructFeedback(implicit context: Context)(
27    target: JSAny, newTarget: JSAny,
28    maybeFeedbackVector: Undefined|FeedbackVector,
29    slotId: uintptr): never labels ConstructGeneric,
30    ConstructArray(AllocationSite) {
31  callable::CollectConstructFeedback(
32      target, newTarget, maybeFeedbackVector, slotId)
33      otherwise ConstructGeneric, ConstructArray;
34}
35
36// --- Common functionality.
37
38extern macro MegamorphicSymbolConstant(): Symbol;
39extern macro UninitializedSymbolConstant(): Symbol;
40
41const kMegamorphicSymbol: Symbol = MegamorphicSymbolConstant();
42const kUninitializedSymbol: Symbol = UninitializedSymbolConstant();
43
44macro IsMegamorphic(feedback: MaybeObject): bool {
45  return TaggedEqual(feedback, kMegamorphicSymbol);
46}
47
48macro IsUninitialized(feedback: MaybeObject): bool {
49  return TaggedEqual(feedback, kUninitializedSymbol);
50}
51
52extern macro LoadFeedbackVectorSlot(FeedbackVector, uintptr): MaybeObject;
53extern operator '[]' macro LoadFeedbackVectorSlot(
54    FeedbackVector, intptr): MaybeObject;
55extern macro StoreFeedbackVectorSlot(
56    FeedbackVector, uintptr, MaybeObject): void;
57extern macro StoreWeakReferenceInFeedbackVector(
58    FeedbackVector, uintptr, HeapObject): MaybeObject;
59extern macro ReportFeedbackUpdate(FeedbackVector, uintptr, constexpr string);
60extern operator '.length_intptr' macro LoadFeedbackVectorLength(FeedbackVector):
61    intptr;
62
63}  // namespace ic
64