| Index: src/heap/spaces.cc
|
| diff --git a/src/heap/spaces.cc b/src/heap/spaces.cc
|
| index ff55c89e5d2f34036d79a8d57e704bf9c2dd9302..f91181e03661a927c53b0e7f9cf99f431fa9461b 100644
|
| --- a/src/heap/spaces.cc
|
| +++ b/src/heap/spaces.cc
|
| @@ -186,8 +186,10 @@ Address CodeRange::AllocateRawMemory(const size_t requested_size,
|
| const size_t commit_size,
|
| size_t* allocated) {
|
| DCHECK(commit_size <= requested_size);
|
| - DCHECK(current_allocation_block_index_ < allocation_list_.length());
|
| - if (requested_size > allocation_list_[current_allocation_block_index_].size) {
|
| + DCHECK(allocation_list_.length() == 0 ||
|
| + current_allocation_block_index_ < allocation_list_.length());
|
| + if (allocation_list_.length() == 0 ||
|
| + requested_size > allocation_list_[current_allocation_block_index_].size) {
|
| // Find an allocation block large enough.
|
| if (!GetNextAllocationBlock(requested_size)) return NULL;
|
| }
|
| @@ -211,7 +213,7 @@ Address CodeRange::AllocateRawMemory(const size_t requested_size,
|
| allocation_list_[current_allocation_block_index_].size -= *allocated;
|
| if (*allocated == current.size) {
|
| // This block is used up, get the next one.
|
| - if (!GetNextAllocationBlock(0)) return NULL;
|
| + GetNextAllocationBlock(0);
|
| }
|
| return current.start;
|
| }
|
|
|