diff --git a/src/code-stubs.cc b/src/code-stubs.cc index 27105cd0d5..f42272d10c 100644 --- a/src/code-stubs.cc +++ b/src/code-stubs.cc @@ -172,8 +172,7 @@ Handle CodeStub::GetCode() { } Activate(code); - DCHECK(!NeedsImmovableCode() || Heap::IsImmovable(code) || - heap->code_space()->FirstPage()->Contains(code->address())); + DCHECK(!NeedsImmovableCode() || Heap::IsImmovable(code)); return Handle(code, isolate()); } diff --git a/src/deoptimizer.cc b/src/deoptimizer.cc index dc2b4ad48b..882d3add1b 100644 --- a/src/deoptimizer.cc +++ b/src/deoptimizer.cc @@ -1795,7 +1795,7 @@ void Deoptimizer::EnsureCodeForDeoptimizationEntry(Isolate* isolate, Handle code = isolate->factory()->NewCode( desc, Code::STUB, Handle(), MaybeHandle(), MaybeHandle(), MaybeHandle(), true); - CHECK(isolate->heap()->IsImmovable(*code)); + CHECK(Heap::IsImmovable(*code)); CHECK_NULL(data->deopt_entry_code_[type]); data->deopt_entry_code_[type] = *code; diff --git a/src/heap/heap.cc b/src/heap/heap.cc index f4da3239ef..d14fa5fcdf 100644 --- a/src/heap/heap.cc +++ b/src/heap/heap.cc @@ -3031,12 +3031,11 @@ AllocationResult Heap::AllocateCode(int object_size, bool immovable) { Address address = result->address(); MemoryChunk* chunk = MemoryChunk::FromAddress(address); // Code objects which should stay at a fixed address are allocated either - // in the first page of code space (objects on the first page of each space - // are never moved), in large object space, or (during snapshot creation) - // the containing page is marked as immovable. - if (!Heap::IsImmovable(result) && - !code_space_->FirstPage()->Contains(address)) { - if (isolate()->serializer_enabled()) { + // in the first page of code space, in large object space, or (during + // snapshot creation) the containing page is marked as immovable. + if (!Heap::IsImmovable(result)) { + if (isolate()->serializer_enabled() || + code_space_->FirstPage()->Contains(address)) { chunk->MarkNeverEvacuate(); } else { // Discard the first code allocation, which was on a page where it could