20#ifdef V8_ENABLE_MAGLEV
31#ifdef V8_ENABLE_DIRECT_HANDLE
47#ifdef V8_ENABLE_DIRECT_HANDLE
49#if !(defined(DEBUG) && V8_HAS_ATTRIBUTE_TRIVIAL_ABI)
70Address* HandleBase::indirect_handle(
Address object, LocalIsolate* isolate) {
75Address* HandleBase::indirect_handle(
Address object, LocalHeap* local_heap) {
86 if (
IsSmi(
object))
return true;
91 if (isolate->roots_table().IsRootHandleLocation(
location_, &root_index) &&
95 if (isolate->IsBuiltinTableHandleLocation(
location_))
return true;
96 if (!AllowHandleDereference::IsAllowed())
return false;
103 if (AllowHandleUsageOnAllThreads::IsAllowed())
return true;
105 LocalHeap* local_heap = isolate->CurrentLocalHeap();
108 if (!local_heap->IsHandleDereferenceAllowed()) {
109 StdoutStream{} <<
"Cannot dereference handle owned by "
110 <<
"non-running local heap\n";
117 if (!local_heap->is_main_thread()) {
119 return local_heap->ContainsPersistentHandle(
location_) ||
120 local_heap->ContainsLocalHandle(
location_);
131#ifdef V8_ENABLE_DIRECT_HANDLE
132bool DirectHandleBase::IsDereferenceAllowed()
const {
135 if (
IsSmi(
object))
return true;
139 if (!AllowHandleDereference::IsAllowed())
return false;
146 if (AllowHandleUsageOnAllThreads::IsAllowed())
return true;
148 LocalHeap* local_heap = isolate->CurrentLocalHeap();
151 if (!local_heap->IsHandleDereferenceAllowed()) {
152 StdoutStream{} <<
"Cannot dereference handle owned by "
153 <<
"non-running local heap\n";
159 if (!local_heap->is_main_thread())
160 return ::heap::base::Stack::IsOnStack(
this);
175 int n =
static_cast<int>(impl->blocks()->
size());
176 if (n == 0)
return 0;
179 (isolate->handle_scope_data()->next - impl->blocks()->back()));
191 "v8::HandleScope::CreateHandle()",
192 "Cannot create a handle without a HandleScope")) {
198 if (!impl->blocks()->empty()) {
200 if (current->limit != limit) {
201 current->limit = limit;
208 if (
result == current->limit) {
210 result = impl->GetSpareOrNewBlock();
213 impl->blocks()->push_back(
result);
222 isolate->handle_scope_implementer()->DeleteExtensions(current->limit);
225#if defined(ENABLE_GLOBAL_HANDLE_ZAPPING) || \
226 defined(ENABLE_LOCAL_HANDLE_ZAPPING)
230 *p =
static_cast<Address>(zap_value);
236 return reinterpret_cast<Address>(&isolate->handle_scope_data()->level);
240 return reinterpret_cast<Address>(&isolate->handle_scope_data()->next);
244 return reinterpret_cast<Address>(&isolate->handle_scope_data()->limit);
DirectHandle< JSObject > obj_
static V8_INLINE bool ApiCheck(bool condition, const char *location, const char *message)
V8_INLINE bool IsDereferenceAllowed() const
static V8_EXPORT_PRIVATE int NumberOfHandles(Isolate *isolate)
static Address current_limit_address(Isolate *isolate)
static V8_EXPORT_PRIVATE void DeleteExtensions(Isolate *isolate)
static Address current_next_address(Isolate *isolate)
V8_EXPORT_PRIVATE static V8_NOINLINE Address * Extend(Isolate *isolate)
static V8_INLINE Address * CreateHandle(Isolate *isolate, Address value)
static Address current_level_address(Isolate *isolate)
static V8_INLINE bool InWritableSharedSpace(Tagged< HeapObject > object)
static V8_INLINE bool InReadOnlySpace(Tagged< HeapObject > object)
static V8_INLINE Isolate * Current()
static V8_INLINE Address * GetHandle(LocalHeap *local_heap, Address value)
static constexpr bool IsImmortalImmovable(RootIndex root_index)
static ThreadId Current()
ZoneVector< RpoNumber > & result
constexpr Address kTaggedNullAddress
V8_INLINE constexpr bool IsSmi(TaggedImpl< kRefType, StorageType > obj)
kInterpreterTrampolineOffset Tagged< HeapObject >
const int kHandleBlockSize
Tagged< To > Cast(Tagged< From > value, const v8::SourceLocation &loc=INIT_SOURCE_LOCATION_IN_DEBUG)
#define DCHECK_LE(v1, v2)
#define DCHECK_NOT_NULL(val)
#define DCHECK_NE(v1, v2)
#define DCHECK(condition)
#define DCHECK_LT(v1, v2)
#define DCHECK_EQ(v1, v2)
#define ASSERT_TRIVIALLY_COPYABLE(T)