Index: src/heap/heap.cc |
diff --git a/src/heap/heap.cc b/src/heap/heap.cc |
index 456fc34fc8cf8601d5902937d3451cc8a0205a58..d2398717a4a1c0e56f9319968005439dfc4cad71 100644 |
--- a/src/heap/heap.cc |
+++ b/src/heap/heap.cc |
@@ -3847,7 +3847,8 @@ AllocationResult Heap::AllocateCode(int object_size, bool immovable) { |
Code* code = Code::cast(result); |
DCHECK(IsAligned(bit_cast<intptr_t>(code->address()), kCodeAlignment)); |
DCHECK(isolate_->code_range() == NULL || !isolate_->code_range()->valid() || |
- isolate_->code_range()->contains(code->address())); |
+ isolate_->code_range()->contains(code->address()) || |
+ object_size <= code_space()->AreaSize()); |
code->set_gc_metadata(Smi::FromInt(0)); |
code->set_ic_age(global_ic_age_); |
return code; |
@@ -3872,7 +3873,8 @@ AllocationResult Heap::CopyCode(Code* code) { |
// Relocate the copy. |
DCHECK(IsAligned(bit_cast<intptr_t>(new_code->address()), kCodeAlignment)); |
DCHECK(isolate_->code_range() == NULL || !isolate_->code_range()->valid() || |
- isolate_->code_range()->contains(code->address())); |
+ isolate_->code_range()->contains(code->address()) || |
+ obj_size <= code_space()->AreaSize()); |
new_code->Relocate(new_addr - old_addr); |
return new_code; |
} |
@@ -3918,7 +3920,9 @@ AllocationResult Heap::CopyCode(Code* code, Vector<byte> reloc_info) { |
// Relocate the copy. |
DCHECK(IsAligned(bit_cast<intptr_t>(new_code->address()), kCodeAlignment)); |
DCHECK(isolate_->code_range() == NULL || !isolate_->code_range()->valid() || |
- isolate_->code_range()->contains(code->address())); |
+ isolate_->code_range()->contains(code->address()) || |
+ new_obj_size <= code_space()->AreaSize()); |
+ |
new_code->Relocate(new_addr - old_addr); |
#ifdef VERIFY_HEAP |