Commit c27eafe8 authored by Maya Lekova's avatar Maya Lekova Committed by Commit Bot

[cleanup] Add DisallowHeapAllocation to (de)serializer

This CL moves the DisallowHeapAllocation scopes closer to the
callsites that get detected as GC causes by GCMole.

Bug: v8:9992
Change-Id: I3148f088ff40cee877683f214f85d745ed685a25
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1928865Reviewed-by: 's avatarDan Elphick <delphick@chromium.org>
Commit-Queue: Maya Lekova <mslekova@chromium.org>
Cr-Commit-Position: refs/heads/master@{#65150}
parent fbeb1235
......@@ -101,6 +101,8 @@ void Deserializer::Synchronize(VisitorSynchronization::SyncTag tag) {
}
void Deserializer::DeserializeDeferredObjects() {
DisallowHeapAllocation no_gc;
for (int code = source_.Get(); code != kSynchronize; code = source_.Get()) {
switch (code) {
case kAlignmentPrefix:
......@@ -196,6 +198,8 @@ String ForwardStringIfExists(Isolate* isolate, StringTableInsertionKey* key) {
HeapObject Deserializer::PostProcessNewObject(HeapObject obj,
SnapshotSpace space) {
DisallowHeapAllocation no_gc;
if ((FLAG_rehash_snapshot && can_rehash_) || deserializing_user_code()) {
if (obj.IsString()) {
// Uninitialize hash field as we need to recompute the hash.
......@@ -373,6 +377,8 @@ HeapObject Deserializer::ReadObject() {
}
HeapObject Deserializer::ReadObject(SnapshotSpace space) {
DisallowHeapAllocation no_gc;
const int size = source_.GetInt() << kObjectAlignmentBits;
Address address = allocator()->Allocate(space, size);
......
......@@ -643,6 +643,8 @@ void Serializer::ObjectSerializer::VisitPointers(HeapObject host,
void Serializer::ObjectSerializer::VisitPointers(HeapObject host,
MaybeObjectSlot start,
MaybeObjectSlot end) {
DisallowHeapAllocation no_gc;
MaybeObjectSlot current = start;
while (current < end) {
while (current < end && (*current)->IsSmi()) {
......
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