Commit 5168a847 authored by Dominik Inführ's avatar Dominik Inführ Committed by Commit Bot

[handles] Always allow dereference of builtin handles

Code objects for builtins are immortal and immovable and can thus be
dereferenced like read-only-objects.

Bug: v8:10315
Change-Id: I60d961fee71056160ad2913bffe3ca50280cb9d2
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2465835Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Reviewed-by: 's avatarIgor Sheludko <ishell@chromium.org>
Commit-Queue: Dominik Inführ <dinfuehr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#70471}
parent c6368d29
......@@ -2657,6 +2657,15 @@ void Isolate::ReleaseSharedPtrs() {
}
}
bool Isolate::IsBuiltinsTableHandleLocation(Address* handle_location) {
FullObjectSlot location(handle_location);
FullObjectSlot first_root(builtins_table());
FullObjectSlot last_root(builtins_table() + Builtins::builtin_count);
if (location >= last_root) return false;
if (location < first_root) return false;
return true;
}
void Isolate::RegisterManagedPtrDestructor(ManagedPtrDestructor* destructor) {
base::MutexGuard lock(&managed_ptr_destructors_mutex_);
DCHECK_NULL(destructor->prev_);
......
......@@ -1020,6 +1020,8 @@ class V8_EXPORT_PRIVATE Isolate final : private HiddenFactory {
Address* builtin_entry_table() { return isolate_data_.builtin_entry_table(); }
V8_INLINE Address* builtins_table() { return isolate_data_.builtins(); }
bool IsBuiltinsTableHandleLocation(Address* handle_location);
StubCache* load_stub_cache() { return load_stub_cache_; }
StubCache* store_stub_cache() { return store_stub_cache_; }
DeoptimizerData* deoptimizer_data() { return deoptimizer_data_; }
......
......@@ -41,6 +41,7 @@ bool HandleBase::IsDereferenceAllowed() const {
RootsTable::IsImmortalImmovable(root_index)) {
return true;
}
if (isolate->IsBuiltinsTableHandleLocation(location_)) return true;
LocalHeap* local_heap = LocalHeap::Current();
if (FLAG_local_heaps && local_heap) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment