Revision: 23797
Author: [email protected]
Date: Tue Sep 9 12:12:35 2014 UTC
Log: Version 3.28.71.8 (merged r23404)
Handle empty allocation list in CodeRange properly.
BUG=407566,v8:3540
LOG=N
[email protected]
Review URL: https://codereview.chromium.org/556863002
https://code.google.com/p/v8/source/detail?r=23797
Modified:
/branches/3.28/src/heap/spaces.cc
/branches/3.28/src/version.cc
/branches/3.28/test/cctest/test-spaces.cc
=======================================
--- /branches/3.28/src/heap/spaces.cc Tue Aug 12 06:42:13 2014 UTC
+++ /branches/3.28/src/heap/spaces.cc Tue Sep 9 12:12:35 2014 UTC
@@ -193,8 +193,10 @@
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;
}
@@ -218,7 +220,7 @@
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;
}
=======================================
--- /branches/3.28/src/version.cc Wed Sep 3 11:55:50 2014 UTC
+++ /branches/3.28/src/version.cc Tue Sep 9 12:12:35 2014 UTC
@@ -35,7 +35,7 @@
#define MAJOR_VERSION 3
#define MINOR_VERSION 28
#define BUILD_NUMBER 71
-#define PATCH_LEVEL 7
+#define PATCH_LEVEL 8
// Use 1 for candidates and 0 otherwise.
// (Boolean macro values are not supported by all preprocessors.)
#define IS_CANDIDATE_VERSION 0
=======================================
--- /branches/3.28/test/cctest/test-spaces.cc Tue Jul 1 11:58:10 2014 UTC
+++ /branches/3.28/test/cctest/test-spaces.cc Tue Sep 9 12:12:35 2014 UTC
@@ -201,6 +201,28 @@
memory_allocator->TearDown();
delete memory_allocator;
}
+
+
+TEST(Regress3540) {
+ Isolate* isolate = CcTest::i_isolate();
+ isolate->InitializeLoggingAndCounters();
+ Heap* heap = isolate->heap();
+ CHECK(heap->ConfigureHeapDefault());
+ MemoryAllocator* memory_allocator = new MemoryAllocator(isolate);
+ CHECK(
+ memory_allocator->SetUp(heap->MaxReserved(),
heap->MaxExecutableSize()));
+ TestMemoryAllocatorScope test_allocator_scope(isolate, memory_allocator);
+ CodeRange* code_range = new CodeRange(isolate);
+ const size_t code_range_size = 4 * MB;
+ if (!code_range->SetUp(code_range_size)) return;
+ size_t allocated_size;
+ Address result;
+ for (int i = 0; i < 5; i++) {
+ result = code_range->AllocateRawMemory(
+ code_range_size - MB, code_range_size - MB, &allocated_size);
+ CHECK((result != NULL) == (i == 0));
+ }
+}
static unsigned int Pseudorandom() {
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.