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

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

Issue 9233050: Reduce memory use immediately after boot. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 8 years, 10 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
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 2
3 #include <stdlib.h> 3 #include <stdlib.h>
4 4
5 #include "v8.h" 5 #include "v8.h"
6 6
7 #include "execution.h" 7 #include "execution.h"
8 #include "factory.h" 8 #include "factory.h"
9 #include "macro-assembler.h" 9 #include "macro-assembler.h"
10 #include "global-handles.h" 10 #include "global-handles.h"
(...skipping 1218 matching lines...) Expand 10 before | Expand all | Expand 10 after
1229 InitializeVM(); 1229 InitializeVM();
1230 HEAP->EnsureHeapIsIterable(); 1230 HEAP->EnsureHeapIsIterable();
1231 intptr_t size_of_objects_1 = HEAP->SizeOfObjects(); 1231 intptr_t size_of_objects_1 = HEAP->SizeOfObjects();
1232 HeapIterator iterator; 1232 HeapIterator iterator;
1233 intptr_t size_of_objects_2 = 0; 1233 intptr_t size_of_objects_2 = 0;
1234 for (HeapObject* obj = iterator.next(); 1234 for (HeapObject* obj = iterator.next();
1235 obj != NULL; 1235 obj != NULL;
1236 obj = iterator.next()) { 1236 obj = iterator.next()) {
1237 size_of_objects_2 += obj->Size(); 1237 size_of_objects_2 += obj->Size();
1238 } 1238 }
1239 // Delta must be within 5% of the larger result. 1239 // Delta must be within 1% of the larger result.
1240 // TODO(gc): Tighten this up by distinguishing between byte
1241 // arrays that are real and those that merely mark free space
1242 // on the heap.
1243 if (size_of_objects_1 > size_of_objects_2) { 1240 if (size_of_objects_1 > size_of_objects_2) {
1244 intptr_t delta = size_of_objects_1 - size_of_objects_2; 1241 intptr_t delta = size_of_objects_1 - size_of_objects_2;
1245 PrintF("Heap::SizeOfObjects: %" V8_PTR_PREFIX "d, " 1242 PrintF("Heap::SizeOfObjects: %" V8_PTR_PREFIX "d, "
1246 "Iterator: %" V8_PTR_PREFIX "d, " 1243 "Iterator: %" V8_PTR_PREFIX "d, "
1247 "delta: %" V8_PTR_PREFIX "d\n", 1244 "delta: %" V8_PTR_PREFIX "d\n",
1248 size_of_objects_1, size_of_objects_2, delta); 1245 size_of_objects_1, size_of_objects_2, delta);
1249 CHECK_GT(size_of_objects_1 / 20, delta); 1246 CHECK_GT(size_of_objects_1 / 100, delta);
1250 } else { 1247 } else {
1251 intptr_t delta = size_of_objects_2 - size_of_objects_1; 1248 intptr_t delta = size_of_objects_2 - size_of_objects_1;
1252 PrintF("Heap::SizeOfObjects: %" V8_PTR_PREFIX "d, " 1249 PrintF("Heap::SizeOfObjects: %" V8_PTR_PREFIX "d, "
1253 "Iterator: %" V8_PTR_PREFIX "d, " 1250 "Iterator: %" V8_PTR_PREFIX "d, "
1254 "delta: %" V8_PTR_PREFIX "d\n", 1251 "delta: %" V8_PTR_PREFIX "d\n",
1255 size_of_objects_1, size_of_objects_2, delta); 1252 size_of_objects_1, size_of_objects_2, delta);
1256 CHECK_GT(size_of_objects_2 / 20, delta); 1253 CHECK_GT(size_of_objects_2 / 20, delta);
1257 } 1254 }
1258 } 1255 }
1259 1256
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
1619 // clearing correctly records slots in prototype transition array. 1616 // clearing correctly records slots in prototype transition array.
1620 i::FLAG_always_compact = true; 1617 i::FLAG_always_compact = true;
1621 Handle<Map> map(baseObject->map()); 1618 Handle<Map> map(baseObject->map());
1622 CHECK(!space->LastPage()->Contains(map->prototype_transitions()->address())); 1619 CHECK(!space->LastPage()->Contains(map->prototype_transitions()->address()));
1623 CHECK(space->LastPage()->Contains(prototype->address())); 1620 CHECK(space->LastPage()->Contains(prototype->address()));
1624 baseObject->SetPrototype(*prototype, false)->ToObjectChecked(); 1621 baseObject->SetPrototype(*prototype, false)->ToObjectChecked();
1625 CHECK(map->GetPrototypeTransition(*prototype)->IsMap()); 1622 CHECK(map->GetPrototypeTransition(*prototype)->IsMap());
1626 HEAP->CollectAllGarbage(Heap::kNoGCFlags); 1623 HEAP->CollectAllGarbage(Heap::kNoGCFlags);
1627 CHECK(map->GetPrototypeTransition(*prototype)->IsMap()); 1624 CHECK(map->GetPrototypeTransition(*prototype)->IsMap());
1628 } 1625 }
OLDNEW
« src/store-buffer.cc ('K') | « src/utils.h ('k') | test/cctest/test-mark-compact.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698