Commit 2afe890d authored by Dan Elphick's avatar Dan Elphick Committed by Commit Bot

[heap] Add DCHECK to AllocateRawWithImmortalMap

Adds DCHECK to Factory::AllocateRawWithImmortalMap to assert that the
Map passed in is read_only_space, since it's passed in as a raw object.

Bug: chromium:1049866
Change-Id: Ia7c6d5c99a4bc790ebcfb06e5ed55340964a5612
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2049846
Commit-Queue: Dan Elphick <delphick@chromium.org>
Commit-Queue: Ulan Degenbaev <ulan@chromium.org>
Auto-Submit: Dan Elphick <delphick@chromium.org>
Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66220}
parent 1a4bbc8a
......@@ -484,6 +484,10 @@ template <typename Impl>
HeapObject FactoryBase<Impl>::AllocateRawWithImmortalMap(
int size, AllocationType allocation, Map map,
AllocationAlignment alignment) {
// TODO(delphick): Potentially you could also pass a immortal immovable Map
// from MAP_SPACE here, like external_map or message_object_map, but currently
// noone does so this check is sufficient.
DCHECK(ReadOnlyHeap::Contains(map));
HeapObject result = AllocateRaw(size, allocation, alignment);
result.set_map_after_allocation(map, SKIP_WRITE_BARRIER);
return result;
......
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