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

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

Issue 9950048: Reduce initial boot-up memory use. This is an other attempt at what (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 8 years, 8 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
« src/spaces.cc ('K') | « 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 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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 133
134 MemoryAllocator* memory_allocator = new MemoryAllocator(isolate); 134 MemoryAllocator* memory_allocator = new MemoryAllocator(isolate);
135 CHECK(memory_allocator->SetUp(heap->MaxReserved(), 135 CHECK(memory_allocator->SetUp(heap->MaxReserved(),
136 heap->MaxExecutableSize())); 136 heap->MaxExecutableSize()));
137 137
138 int total_pages = 0; 138 int total_pages = 0;
139 OldSpace faked_space(heap, 139 OldSpace faked_space(heap,
140 heap->MaxReserved(), 140 heap->MaxReserved(),
141 OLD_POINTER_SPACE, 141 OLD_POINTER_SPACE,
142 NOT_EXECUTABLE); 142 NOT_EXECUTABLE);
143 Page* first_page = 143 Page* first_page = memory_allocator->AllocatePage(
144 memory_allocator->AllocatePage(&faked_space, NOT_EXECUTABLE); 144 faked_space.AreaSize(), &faked_space, NOT_EXECUTABLE);
145 145
146 first_page->InsertAfter(faked_space.anchor()->prev_page()); 146 first_page->InsertAfter(faked_space.anchor()->prev_page());
147 CHECK(first_page->is_valid()); 147 CHECK(first_page->is_valid());
148 CHECK(first_page->next_page() == faked_space.anchor()); 148 CHECK(first_page->next_page() == faked_space.anchor());
149 total_pages++; 149 total_pages++;
150 150
151 for (Page* p = first_page; p != faked_space.anchor(); p = p->next_page()) { 151 for (Page* p = first_page; p != faked_space.anchor(); p = p->next_page()) {
152 CHECK(p->owner() == &faked_space); 152 CHECK(p->owner() == &faked_space);
153 } 153 }
154 154
155 // Again, we should get n or n - 1 pages. 155 // Again, we should get n or n - 1 pages.
156 Page* other = 156 Page* other = memory_allocator->AllocatePage(
157 memory_allocator->AllocatePage(&faked_space, NOT_EXECUTABLE); 157 faked_space.AreaSize(), &faked_space, NOT_EXECUTABLE);
158 CHECK(other->is_valid()); 158 CHECK(other->is_valid());
159 total_pages++; 159 total_pages++;
160 other->InsertAfter(first_page); 160 other->InsertAfter(first_page);
161 int page_count = 0; 161 int page_count = 0;
162 for (Page* p = first_page; p != faked_space.anchor(); p = p->next_page()) { 162 for (Page* p = first_page; p != faked_space.anchor(); p = p->next_page()) {
163 CHECK(p->owner() == &faked_space); 163 CHECK(p->owner() == &faked_space);
164 page_count++; 164 page_count++;
165 } 165 }
166 CHECK(total_pages == page_count); 166 CHECK(total_pages == page_count);
167 167
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 { MaybeObject* maybe_obj = lo->AllocateRaw(lo_size, NOT_EXECUTABLE); 258 { MaybeObject* maybe_obj = lo->AllocateRaw(lo_size, NOT_EXECUTABLE);
259 if (!maybe_obj->ToObject(&obj)) break; 259 if (!maybe_obj->ToObject(&obj)) break;
260 } 260 }
261 CHECK(lo->Available() < available); 261 CHECK(lo->Available() < available);
262 }; 262 };
263 263
264 CHECK(!lo->IsEmpty()); 264 CHECK(!lo->IsEmpty());
265 265
266 CHECK(lo->AllocateRaw(lo_size, NOT_EXECUTABLE)->IsFailure()); 266 CHECK(lo->AllocateRaw(lo_size, NOT_EXECUTABLE)->IsFailure());
267 } 267 }
OLDNEW
« src/spaces.cc ('K') | « test/cctest/test-mark-compact.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698