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

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

Issue 4634003: Landing for Justin Schuh.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 10 years, 1 month 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 | « test/cctest/test-mark-compact.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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 84
85 // test region marking 85 // test region marking
86 VerifyRegionMarking(page_start); 86 VerifyRegionMarking(page_start);
87 87
88 DeleteArray(mem); 88 DeleteArray(mem);
89 } 89 }
90 90
91 91
92 TEST(MemoryAllocator) { 92 TEST(MemoryAllocator) {
93 CHECK(Heap::ConfigureHeapDefault()); 93 CHECK(Heap::ConfigureHeapDefault());
94 CHECK(MemoryAllocator::Setup(Heap::MaxReserved())); 94 CHECK(MemoryAllocator::Setup(Heap::MaxReserved(), Heap::MaxExecutableSize()));
95 95
96 OldSpace faked_space(Heap::MaxReserved(), OLD_POINTER_SPACE, NOT_EXECUTABLE); 96 OldSpace faked_space(Heap::MaxReserved(), OLD_POINTER_SPACE, NOT_EXECUTABLE);
97 int total_pages = 0; 97 int total_pages = 0;
98 int requested = 2; 98 int requested = 2;
99 int allocated; 99 int allocated;
100 // If we request two pages, we should get one or two. 100 // If we request two pages, we should get one or two.
101 Page* first_page = 101 Page* first_page =
102 MemoryAllocator::AllocatePages(requested, &allocated, &faked_space); 102 MemoryAllocator::AllocatePages(requested, &allocated, &faked_space);
103 CHECK(first_page->is_valid()); 103 CHECK(first_page->is_valid());
104 CHECK(allocated > 0 && allocated <= 2); 104 CHECK(allocated > 0 && allocated <= 2);
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 // the first chunk and return an invalid page. 140 // the first chunk and return an invalid page.
141 Page* invalid_page = MemoryAllocator::FreePages(first_page); 141 Page* invalid_page = MemoryAllocator::FreePages(first_page);
142 CHECK(!invalid_page->is_valid()); 142 CHECK(!invalid_page->is_valid());
143 143
144 MemoryAllocator::TearDown(); 144 MemoryAllocator::TearDown();
145 } 145 }
146 146
147 147
148 TEST(NewSpace) { 148 TEST(NewSpace) {
149 CHECK(Heap::ConfigureHeapDefault()); 149 CHECK(Heap::ConfigureHeapDefault());
150 CHECK(MemoryAllocator::Setup(Heap::MaxReserved())); 150 CHECK(MemoryAllocator::Setup(Heap::MaxReserved(), Heap::MaxExecutableSize()));
151 151
152 NewSpace new_space; 152 NewSpace new_space;
153 153
154 void* chunk = 154 void* chunk =
155 MemoryAllocator::ReserveInitialChunk(4 * Heap::ReservedSemiSpaceSize()); 155 MemoryAllocator::ReserveInitialChunk(4 * Heap::ReservedSemiSpaceSize());
156 CHECK(chunk != NULL); 156 CHECK(chunk != NULL);
157 Address start = RoundUp(static_cast<Address>(chunk), 157 Address start = RoundUp(static_cast<Address>(chunk),
158 2 * Heap::ReservedSemiSpaceSize()); 158 2 * Heap::ReservedSemiSpaceSize());
159 CHECK(new_space.Setup(start, 2 * Heap::ReservedSemiSpaceSize())); 159 CHECK(new_space.Setup(start, 2 * Heap::ReservedSemiSpaceSize()));
160 CHECK(new_space.HasBeenSetup()); 160 CHECK(new_space.HasBeenSetup());
161 161
162 while (new_space.Available() >= Page::kMaxHeapObjectSize) { 162 while (new_space.Available() >= Page::kMaxHeapObjectSize) {
163 Object* obj = 163 Object* obj =
164 new_space.AllocateRaw(Page::kMaxHeapObjectSize)->ToObjectUnchecked(); 164 new_space.AllocateRaw(Page::kMaxHeapObjectSize)->ToObjectUnchecked();
165 CHECK(new_space.Contains(HeapObject::cast(obj))); 165 CHECK(new_space.Contains(HeapObject::cast(obj)));
166 } 166 }
167 167
168 new_space.TearDown(); 168 new_space.TearDown();
169 MemoryAllocator::TearDown(); 169 MemoryAllocator::TearDown();
170 } 170 }
171 171
172 172
173 TEST(OldSpace) { 173 TEST(OldSpace) {
174 CHECK(Heap::ConfigureHeapDefault()); 174 CHECK(Heap::ConfigureHeapDefault());
175 CHECK(MemoryAllocator::Setup(Heap::MaxReserved())); 175 CHECK(MemoryAllocator::Setup(Heap::MaxReserved(), Heap::MaxExecutableSize()));
176 176
177 OldSpace* s = new OldSpace(Heap::MaxOldGenerationSize(), 177 OldSpace* s = new OldSpace(Heap::MaxOldGenerationSize(),
178 OLD_POINTER_SPACE, 178 OLD_POINTER_SPACE,
179 NOT_EXECUTABLE); 179 NOT_EXECUTABLE);
180 CHECK(s != NULL); 180 CHECK(s != NULL);
181 181
182 void* chunk = 182 void* chunk =
183 MemoryAllocator::ReserveInitialChunk(4 * Heap::ReservedSemiSpaceSize()); 183 MemoryAllocator::ReserveInitialChunk(4 * Heap::ReservedSemiSpaceSize());
184 CHECK(chunk != NULL); 184 CHECK(chunk != NULL);
185 Address start = static_cast<Address>(chunk); 185 Address start = static_cast<Address>(chunk);
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 229
230 CHECK(!lo->IsEmpty()); 230 CHECK(!lo->IsEmpty());
231 231
232 CHECK(lo->AllocateRaw(lo_size)->IsFailure()); 232 CHECK(lo->AllocateRaw(lo_size)->IsFailure());
233 233
234 lo->TearDown(); 234 lo->TearDown();
235 delete lo; 235 delete lo;
236 236
237 MemoryAllocator::TearDown(); 237 MemoryAllocator::TearDown();
238 } 238 }
OLDNEW
« no previous file with comments | « test/cctest/test-mark-compact.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698