[ext-code-space] Use IsCodeSpaceObject(obj) predicate in DCHECKs

... instead of obj.IsCode() because it's not safe to use the latter
during GC which might have already moved the object.

Bug: v8:11880, chromium:1292688
Change-Id: Idbe973c0b1919a79c6aa66a8f490d952266aa66d
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3429209
Auto-Submit: Igor Sheludko <ishell@chromium.org>
Reviewed-by: Jakob Gruber <jgruber@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/main@{#78898}
This commit is contained in:
Igor Sheludko 2022-02-01 16:27:49 +01:00 committed by V8 LUCI CQ
parent 7d6deeb99a
commit 638efefba2
3 changed files with 5 additions and 3 deletions

View File

@ -666,7 +666,8 @@ HeapObject RelocInfo::target_object(PtrComprCageBase cage_base) {
Object obj(DecompressTaggedPointer(cage_base, compressed));
// Embedding of compressed Code objects must not happen when external code
// space is enabled, because CodeDataContainers must be used instead.
DCHECK_IMPLIES(V8_EXTERNAL_CODE_SPACE_BOOL, !obj.IsCode(cage_base));
DCHECK_IMPLIES(V8_EXTERNAL_CODE_SPACE_BOOL,
!IsCodeSpaceObject(HeapObject::cast(obj)));
return HeapObject::cast(obj);
} else {
return HeapObject::cast(

View File

@ -322,7 +322,8 @@ HeapObject RelocInfo::target_object(PtrComprCageBase cage_base) {
Object obj(DecompressTaggedPointer(cage_base, compressed));
// Embedding of compressed Code objects must not happen when external code
// space is enabled, because CodeDataContainers must be used instead.
DCHECK_IMPLIES(V8_EXTERNAL_CODE_SPACE_BOOL, !obj.IsCode(cage_base));
DCHECK_IMPLIES(V8_EXTERNAL_CODE_SPACE_BOOL,
!IsCodeSpaceObject(HeapObject::cast(obj)));
return HeapObject::cast(obj);
}
DCHECK(IsFullEmbeddedObject(rmode_) || IsDataEmbeddedObject(rmode_));

View File

@ -727,7 +727,7 @@ HeapObject MapWord::ToForwardingAddress() {
HeapObject obj = HeapObject::FromAddress(value_);
// For objects allocated outside of the main pointer compression cage the
// variant with explicit cage base must be used.
DCHECK_IMPLIES(V8_EXTERNAL_CODE_SPACE_BOOL, !obj.IsCode());
DCHECK_IMPLIES(V8_EXTERNAL_CODE_SPACE_BOOL, !IsCodeSpaceObject(obj));
return obj;
}