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

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

Issue 9179012: Reduce boot-up memory use of V8. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 8 years, 11 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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
1565 v8::HandleScope scope; 1562 v8::HandleScope scope;
1566 v8::Handle<v8::Object> global = v8::Context::GetCurrent()->Global(); 1563 v8::Handle<v8::Object> global = v8::Context::GetCurrent()->Global();
1567 v8::Handle<v8::Function> g = 1564 v8::Handle<v8::Function> g =
1568 v8::Handle<v8::Function>::Cast(global->Get(v8_str("g"))); 1565 v8::Handle<v8::Function>::Cast(global->Get(v8_str("g")));
1569 g->Call(global, 0, NULL); 1566 g->Call(global, 0, NULL);
1570 } 1567 }
1571 1568
1572 HEAP->incremental_marking()->set_should_hurry(true); 1569 HEAP->incremental_marking()->set_should_hurry(true);
1573 HEAP->CollectGarbage(OLD_POINTER_SPACE); 1570 HEAP->CollectGarbage(OLD_POINTER_SPACE);
1574 } 1571 }
OLDNEW
« src/spaces-inl.h ('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