Skip to content

Commit

Permalink
Guard third-party heap in V8
Browse files Browse the repository at this point in the history
Fixes linking issues of MSVC debug build after
https://chromium-review.googlesource.com/c/v8/v8/+/1928860/

Change-Id: I29311103904bef7abdace80edf5f090c756bcbf9
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
  • Loading branch information
stampho authored and patricia-gallardo committed Feb 7, 2021
1 parent 8863076 commit 54738c3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions v8/src/heap/heap-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -457,9 +457,11 @@ bool Heap::InOldSpace(Object object) { return old_space_->Contains(object); }

// static
Heap* Heap::FromWritableHeapObject(HeapObject obj) {
#ifdef V8_ENABLE_THIRD_PARTY_HEAP
if (V8_ENABLE_THIRD_PARTY_HEAP_BOOL) {
return Heap::GetIsolateFromWritableObject(obj)->heap();
}
#endif
BasicMemoryChunk* chunk = BasicMemoryChunk::FromHeapObject(obj);
// RO_SPACE can be shared between heaps, so we can't use RO_SPACE objects to
// find a heap. The exception is when the ReadOnlySpace is writeable, during
Expand Down
2 changes: 2 additions & 0 deletions v8/src/heap/heap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6589,10 +6589,12 @@ Code Heap::GcSafeFindCodeForInnerPointer(Address inner_pointer) {
Code code = InstructionStream::TryLookupCode(isolate(), inner_pointer);
if (!code.is_null()) return code;

#ifdef V8_ENABLE_THIRD_PARTY_HEAP
if (V8_ENABLE_THIRD_PARTY_HEAP_BOOL) {
Address start = tp_heap_->GetObjectFromInnerPointer(inner_pointer);
return GcSafeCastToCode(HeapObject::FromAddress(start), inner_pointer);
}
#endif

// Check if the inner pointer points into a large object chunk.
LargePage* large_page = code_lo_space()->FindPage(inner_pointer);
Expand Down

0 comments on commit 54738c3

Please sign in to comment.