Commit 62a72035 authored by Michael Starzinger's avatar Michael Starzinger Committed by Commit Bot

[heap] Fix immovable {Code} allocation in no-snap builds.

R=mlippautz@chromium.org
BUG=v8:6792

Change-Id: I4b148b4bcb6e3cb73bc58eaad61d52a14da19a35
Reviewed-on: https://chromium-review.googlesource.com/760739Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
Commit-Queue: Michael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#49278}
parent 667555c6
......@@ -172,8 +172,7 @@ Handle<Code> CodeStub::GetCode() {
}
Activate(code);
DCHECK(!NeedsImmovableCode() || Heap::IsImmovable(code) ||
heap->code_space()->FirstPage()->Contains(code->address()));
DCHECK(!NeedsImmovableCode() || Heap::IsImmovable(code));
return Handle<Code>(code, isolate());
}
......
......@@ -1795,7 +1795,7 @@ void Deoptimizer::EnsureCodeForDeoptimizationEntry(Isolate* isolate,
Handle<Code> code = isolate->factory()->NewCode(
desc, Code::STUB, Handle<Object>(), MaybeHandle<HandlerTable>(),
MaybeHandle<ByteArray>(), MaybeHandle<DeoptimizationData>(), true);
CHECK(isolate->heap()->IsImmovable(*code));
CHECK(Heap::IsImmovable(*code));
CHECK_NULL(data->deopt_entry_code_[type]);
data->deopt_entry_code_[type] = *code;
......
......@@ -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
......
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