Commit 5bd6a123 authored by Shu-yu Guo's avatar Shu-yu Guo Committed by V8 LUCI CQ

Check for RO space in SharedStringAccessGuard

Bug: v8:11460
Change-Id: Iec0b913e5b6dbe27eae3ee0ae207d8339336961d
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3774094Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
Auto-Submit: Shu-yu Guo <syg@chromium.org>
Commit-Queue: Shu-yu Guo <syg@chromium.org>
Cr-Commit-Position: refs/heads/main@{#81830}
parent ff79c40c
......@@ -79,6 +79,13 @@ class V8_NODISCARD SharedStringAccessGuardIfNeeded {
// Don't acquire the lock for the main thread.
if (!local_heap || local_heap->is_main_thread()) return nullptr;
#ifdef V8_COMPRESS_POINTERS_IN_ISOLATE_CAGE
// We don't need to guard when the string is in RO space. When compressing
// pointers in a per-Isolate cage, GetIsolateFromHeapObject always returns
// an Isolate, even for objects in RO space, so manually check.
if (ReadOnlyHeap::Contains(str)) return nullptr;
#endif
Isolate* isolate;
if (!GetIsolateFromHeapObject(str, &isolate)) {
// If we can't get the isolate from the String, it must be read-only.
......
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