Commit 3fa8fb0d authored by Igor Sheludko's avatar Igor Sheludko

[ext-code-space] Fix Code with non-Code object comparisons

... which might fail because usual operator== for tagged values compares
only lower 32 bits of the pointer.

Bug: v8:11880, v8:12958
Change-Id: I0978d6c510424aecfee2f044c40ea424b6cb3ab9
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3695593Reviewed-by: 's avatarDominik Inführ <dinfuehr@chromium.org>
Auto-Submit: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/main@{#81096}
parent 5e3abf44
......@@ -3381,7 +3381,11 @@ class LeftTrimmerVerifierRootVisitor : public RootVisitor {
void VisitRootPointers(Root root, const char* description,
FullObjectSlot start, FullObjectSlot end) override {
for (FullObjectSlot p = start; p < end; ++p) {
DCHECK_NE(*p, to_check_);
// V8_EXTERNAL_CODE_SPACE specific: we might be comparing Code object
// with non-Code object here and it might produce false positives because
// operator== for tagged values compares only lower 32 bits when pointer
// compression is enabled.
DCHECK_NE((*p).ptr(), to_check_.ptr());
}
}
......
......@@ -1053,7 +1053,11 @@ static int ObjectsFoundInHeap(Heap* heap, Handle<Object> objs[], int size) {
for (HeapObject obj = iterator.Next(); !obj.is_null();
obj = iterator.Next()) {
for (int i = 0; i < size; i++) {
if (*objs[i] == obj) {
// V8_EXTERNAL_CODE_SPACE specific: we might be comparing Code object
// with non-Code object here and it might produce false positives because
// operator== for tagged values compares only lower 32 bits when pointer
// compression is enabled.
if (objs[i]->ptr() == obj.ptr()) {
found_count++;
}
}
......
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