Make sure the heap is in consistent state when calling allocation observers.

The observer might want to lookup something in the heap, e.g. code objects
it has in the call stack.

BUG=v8:4959
LOG=N

Review-Url: https://codereview.chromium.org/1948893002
Cr-Commit-Position: refs/heads/master@{#36027}
This commit is contained in:
alph 2016-05-04 07:38:13 -07:00 committed by Commit bot
parent 9ae91f8d77
commit e8e9c07e54

View File

@ -2444,7 +2444,6 @@ HeapObject* FreeList::Allocate(int size_in_bytes) {
int new_node_size = 0; int new_node_size = 0;
FreeSpace* new_node = FindNodeFor(size_in_bytes, &new_node_size); FreeSpace* new_node = FindNodeFor(size_in_bytes, &new_node_size);
if (new_node == nullptr) return nullptr; if (new_node == nullptr) return nullptr;
owner_->AllocationStep(new_node->address(), size_in_bytes);
int bytes_left = new_node_size - size_in_bytes; int bytes_left = new_node_size - size_in_bytes;
DCHECK(bytes_left >= 0); DCHECK(bytes_left >= 0);
@ -2490,6 +2489,8 @@ HeapObject* FreeList::Allocate(int size_in_bytes) {
new_node->address() + new_node_size); new_node->address() + new_node_size);
} }
owner_->AllocationStep(new_node->address(), size_in_bytes);
return new_node; return new_node;
} }