v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
feedback-cell-inl.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_INL_H_
6#define V8_OBJECTS_FEEDBACK_CELL_INL_H_
7
9// Include the non-inl header before the rest of the headers.
10
11#include <optional>
12
18
19// Has to be the last include (doesn't have include guards):
21
22namespace v8::internal {
23
24#include "torque-generated/src/objects/feedback-cell-tq-inl.inc"
25
27
28RELEASE_ACQUIRE_ACCESSORS(FeedbackCell, value, Tagged<HeapObject>, kValueOffset)
29
36
38 std::optional<std::function<void(Tagged<HeapObject> object, ObjectSlot slot,
39 Tagged<HeapObject> target)>>
40 gc_notify_updated_slot) {
42 if (IsUndefined(value()) || IsClosureFeedbackCellArray(value())) return;
43
44 CHECK(IsFeedbackVector(value()));
45 Tagged<ClosureFeedbackCellArray> closure_feedback_cell_array =
46 Cast<FeedbackVector>(value())->closure_feedback_cell_array();
47 set_value(closure_feedback_cell_array, kReleaseStore);
48 if (gc_notify_updated_slot) {
49 (*gc_notify_updated_slot)(*this, RawField(FeedbackCell::kValueOffset),
50 closure_feedback_cell_array);
51 }
52}
53
55 // This value is always reset to a proper budget before it's used.
56 set_interrupt_budget(0);
57}
58
60 WriteField<JSDispatchHandle::underlying_type>(kDispatchHandleOffset,
62}
63
64#ifdef V8_ENABLE_LEAPTIERING
65JSDispatchHandle FeedbackCell::dispatch_handle() const {
66 return JSDispatchHandle(
67 ReadField<JSDispatchHandle::underlying_type>(kDispatchHandleOffset));
68}
69
70void FeedbackCell::set_dispatch_handle(JSDispatchHandle new_handle) {
71 DCHECK_EQ(dispatch_handle(), kNullJSDispatchHandle);
72 WriteField<JSDispatchHandle::underlying_type>(kDispatchHandleOffset,
73 new_handle.value());
74 JS_DISPATCH_HANDLE_WRITE_BARRIER(*this, new_handle);
75}
76#endif // V8_ENABLE_LEAPTIERING
77
79 Isolate* isolate) {
80 ReadOnlyRoots r(isolate);
81 if (map() == r.no_closures_cell_map()) {
82 set_map(isolate, r.one_closure_cell_map());
83 return kNoneToOne;
84 } else if (map() == r.one_closure_cell_map()) {
85 set_map(isolate, r.many_closures_cell_map());
86 return kOneToMany;
87 } else {
88 DCHECK(map() == r.many_closures_cell_map());
89 return kMany;
90 }
91}
92
93} // namespace v8::internal
94
96
97#endif // V8_OBJECTS_FEEDBACK_CELL_INL_H_
constexpr UnderlyingType & value() &
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)
std::map< const std::string, const std::string > map
int r
Definition mul-fft.cc:298
kInterpreterTrampolineOffset Tagged< HeapObject >
base::StrongAlias< JSDispatchHandleAliasTag, uint32_t > JSDispatchHandle
Definition globals.h:557
constexpr JSDispatchHandle kNullJSDispatchHandle(0)
return value
Definition map-inl.h:893
Tagged< To > Cast(Tagged< From > value, const v8::SourceLocation &loc=INIT_SOURCE_LOCATION_IN_DEBUG)
Definition casting.h:150
static constexpr ReleaseStoreTag kReleaseStore
Definition globals.h:2910
#define JS_DISPATCH_HANDLE_WRITE_BARRIER(object, handle)
#define TQ_OBJECT_CONSTRUCTORS_IMPL(Type)
#define RELEASE_ACQUIRE_ACCESSORS(holder, name, type, offset)
#define CHECK(condition)
Definition logging.h:124
#define DCHECK_GE(v1, v2)
Definition logging.h:488
#define DCHECK(condition)
Definition logging.h:482
#define DCHECK_EQ(v1, v2)
Definition logging.h:485