Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(527)

Side by Side Diff: test/cctest/test-spaces.cc

Issue 496433004: Handle empty allocation list in CodeRange properly. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/heap/spaces.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 memory_chunk->size()); 196 memory_chunk->size());
197 CHECK(static_cast<size_t>(memory_chunk->area_size()) == 197 CHECK(static_cast<size_t>(memory_chunk->area_size()) ==
198 second_commit_area_size); 198 second_commit_area_size);
199 199
200 memory_allocator->Free(memory_chunk); 200 memory_allocator->Free(memory_chunk);
201 memory_allocator->TearDown(); 201 memory_allocator->TearDown();
202 delete memory_allocator; 202 delete memory_allocator;
203 } 203 }
204 204
205 205
206 TEST(Regress3540) {
207 Isolate* isolate = CcTest::i_isolate();
208 isolate->InitializeLoggingAndCounters();
209 Heap* heap = isolate->heap();
210 CHECK(heap->ConfigureHeapDefault());
211 MemoryAllocator* memory_allocator = new MemoryAllocator(isolate);
212 CHECK(
213 memory_allocator->SetUp(heap->MaxReserved(), heap->MaxExecutableSize()));
214 TestMemoryAllocatorScope test_allocator_scope(isolate, memory_allocator);
215 CodeRange* code_range = new CodeRange(isolate);
216 const size_t code_range_size = 4 * MB;
217 if (!code_range->SetUp(code_range_size)) return;
218 size_t allocated_size;
219 Address result;
220 for (int i = 0; i < 5; i++) {
221 result = code_range->AllocateRawMemory(
222 code_range_size - MB, code_range_size - MB, &allocated_size);
223 CHECK((result != NULL) == (i == 0));
224 }
225 }
226
227
206 static unsigned int Pseudorandom() { 228 static unsigned int Pseudorandom() {
207 static uint32_t lo = 2345; 229 static uint32_t lo = 2345;
208 lo = 18273 * (lo & 0xFFFFF) + (lo >> 16); 230 lo = 18273 * (lo & 0xFFFFF) + (lo >> 16);
209 return lo & 0xFFFFF; 231 return lo & 0xFFFFF;
210 } 232 }
211 233
212 234
213 TEST(MemoryChunk) { 235 TEST(MemoryChunk) {
214 Isolate* isolate = CcTest::i_isolate(); 236 Isolate* isolate = CcTest::i_isolate();
215 isolate->InitializeLoggingAndCounters(); 237 isolate->InitializeLoggingAndCounters();
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 CompileRun("/*empty*/"); 446 CompileRun("/*empty*/");
425 for (int i = FIRST_PAGED_SPACE; i <= LAST_PAGED_SPACE; i++) { 447 for (int i = FIRST_PAGED_SPACE; i <= LAST_PAGED_SPACE; i++) {
426 // Debug code can be very large, so skip CODE_SPACE if we are generating it. 448 // Debug code can be very large, so skip CODE_SPACE if we are generating it.
427 if (i == CODE_SPACE && i::FLAG_debug_code) continue; 449 if (i == CODE_SPACE && i::FLAG_debug_code) continue;
428 CHECK_EQ(1, isolate->heap()->paged_space(i)->CountTotalPages()); 450 CHECK_EQ(1, isolate->heap()->paged_space(i)->CountTotalPages());
429 } 451 }
430 452
431 // No large objects required to perform the above steps. 453 // No large objects required to perform the above steps.
432 CHECK(isolate->heap()->lo_space()->IsEmpty()); 454 CHECK(isolate->heap()->lo_space()->IsEmpty());
433 } 455 }
OLDNEW
« no previous file with comments | « src/heap/spaces.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698