int obj_size = Code::SizeFor(body_size);
Handle<Code> code = NewCodeRaw(obj_size, immovable);
- DCHECK(isolate()->code_range() == NULL ||
- !isolate()->code_range()->valid() ||
- isolate()->code_range()->contains(code->address()));
+ DCHECK(isolate()->code_range() == NULL || !isolate()->code_range()->valid() ||
+ isolate()->code_range()->contains(code->address()) ||
+ obj_size <= isolate()->heap()->code_space()->AreaSize());
// The code object has not been fully initialized yet. We rely on the
// fact that no allocation will happen from this point on.
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;
// 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;
}
// 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
!isolate_->code_range()->contains(
static_cast<Address>(reservation->address())));
DCHECK(executable == NOT_EXECUTABLE || isolate_->code_range() == NULL ||
- !isolate_->code_range()->valid());
+ !isolate_->code_range()->valid() || size <= Page::kPageSize);
+
reservation->Release();
}
// Use code range only for large object space on mips64 to keep address
// range within 256-MB memory region.
if (isolate_->code_range() != NULL && isolate_->code_range()->valid() &&
- commit_area_size > CodePageAreaSize()) {
+ reserve_area_size > CodePageAreaSize()) {
#else
if (isolate_->code_range() != NULL && isolate_->code_range()->valid()) {
#endif