v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
feedback-cell.h
Go to the documentation of this file.
1// Copyright 2018 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
5#ifndef V8_OBJECTS_FEEDBACK_CELL_H_
6#define V8_OBJECTS_FEEDBACK_CELL_H_
7
8#include <optional>
9
10#include "src/objects/struct.h"
11
12// Has to be the last include (doesn't have include guards):
14
15namespace v8::internal {
16
17class Undefined;
18
19#include "torque-generated/src/objects/feedback-cell-tq.inc"
20
21// This is a special cell used to maintain both the link between a
22// closure and its feedback vector, as well as a way to count the
23// number of closures created for a certain function per native
24// context. There's at most one FeedbackCell for each function in
25// a native context.
26class FeedbackCell : public TorqueGeneratedFeedbackCell<FeedbackCell, Struct> {
27 public:
28 // Dispatched behavior.
30
31 static const int kUnalignedSize = kSize;
32 static const int kAlignedSize = RoundUp<kObjectAlignment>(int{kSize});
33
34 using TorqueGeneratedFeedbackCell<FeedbackCell, Struct>::value;
35 using TorqueGeneratedFeedbackCell<FeedbackCell, Struct>::set_value;
36
38
39 inline void clear_interrupt_budget();
40 inline void clear_dispatch_handle();
41
42#ifdef V8_ENABLE_LEAPTIERING
43 inline JSDispatchHandle dispatch_handle() const;
44 inline void set_dispatch_handle(JSDispatchHandle new_handle);
45#endif // V8_ENABLE_LEAPTIERING
46
47 inline void clear_padding();
48 inline void reset_feedback_vector(
49 std::optional<
50 std::function<void(Tagged<HeapObject> object, ObjectSlot slot,
51 Tagged<HeapObject> target)>>
52 gc_notify_updated_slot = std::nullopt);
53
55 // The closure count is encoded in the cell's map, which distinguishes
56 // between zero, one, or many closures. This function records a new closure
57 // creation by updating the map.
59
61
62 class BodyDescriptor;
63
65};
66
67} // namespace v8::internal
68
70
71#endif // V8_OBJECTS_FEEDBACK_CELL_H_
static const int kAlignedSize
static const int kUnalignedSize
ClosureCountTransition IncrementClosureCount(Isolate *isolate)
void reset_feedback_vector(std::optional< std::function< void(Tagged< HeapObject > object, ObjectSlot slot, Tagged< HeapObject > target)> > gc_notify_updated_slot=std::nullopt)
constexpr intptr_t kObjectAlignment
Definition globals.h:930
return value
Definition map-inl.h:893
V8_INLINE Local< Primitive > Undefined(Isolate *isolate)
#define DECL_VERIFIER(Name)
#define DECL_PRINTER(Name)
#define DECL_RELEASE_ACQUIRE_ACCESSORS(name,...)
#define TQ_OBJECT_CONSTRUCTORS(Type)
constexpr T RoundUp(T x, intptr_t m)
Definition macros.h:387