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

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

Issue 9178014: Revert 10413-10416 initial memory use reduction due to (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
« no previous file with comments | « src/utils.h ('k') | test/cctest/test-mark-compact.cc » ('j') | 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 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 1% of the larger result. 1239 // Delta must be within 5% 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.
1240 if (size_of_objects_1 > size_of_objects_2) { 1243 if (size_of_objects_1 > size_of_objects_2) {
1241 intptr_t delta = size_of_objects_1 - size_of_objects_2; 1244 intptr_t delta = size_of_objects_1 - size_of_objects_2;
1242 PrintF("Heap::SizeOfObjects: %" V8_PTR_PREFIX "d, " 1245 PrintF("Heap::SizeOfObjects: %" V8_PTR_PREFIX "d, "
1243 "Iterator: %" V8_PTR_PREFIX "d, " 1246 "Iterator: %" V8_PTR_PREFIX "d, "
1244 "delta: %" V8_PTR_PREFIX "d\n", 1247 "delta: %" V8_PTR_PREFIX "d\n",
1245 size_of_objects_1, size_of_objects_2, delta); 1248 size_of_objects_1, size_of_objects_2, delta);
1246 CHECK_GT(size_of_objects_1 / 100, delta); 1249 CHECK_GT(size_of_objects_1 / 20, delta);
1247 } else { 1250 } else {
1248 intptr_t delta = size_of_objects_2 - size_of_objects_1; 1251 intptr_t delta = size_of_objects_2 - size_of_objects_1;
1249 PrintF("Heap::SizeOfObjects: %" V8_PTR_PREFIX "d, " 1252 PrintF("Heap::SizeOfObjects: %" V8_PTR_PREFIX "d, "
1250 "Iterator: %" V8_PTR_PREFIX "d, " 1253 "Iterator: %" V8_PTR_PREFIX "d, "
1251 "delta: %" V8_PTR_PREFIX "d\n", 1254 "delta: %" V8_PTR_PREFIX "d\n",
1252 size_of_objects_1, size_of_objects_2, delta); 1255 size_of_objects_1, size_of_objects_2, delta);
1253 CHECK_GT(size_of_objects_2 / 20, delta); 1256 CHECK_GT(size_of_objects_2 / 20, delta);
1254 } 1257 }
1255 } 1258 }
1256 1259
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
1562 v8::HandleScope scope; 1565 v8::HandleScope scope;
1563 v8::Handle<v8::Object> global = v8::Context::GetCurrent()->Global(); 1566 v8::Handle<v8::Object> global = v8::Context::GetCurrent()->Global();
1564 v8::Handle<v8::Function> g = 1567 v8::Handle<v8::Function> g =
1565 v8::Handle<v8::Function>::Cast(global->Get(v8_str("g"))); 1568 v8::Handle<v8::Function>::Cast(global->Get(v8_str("g")));
1566 g->Call(global, 0, NULL); 1569 g->Call(global, 0, NULL);
1567 } 1570 }
1568 1571
1569 HEAP->incremental_marking()->set_should_hurry(true); 1572 HEAP->incremental_marking()->set_should_hurry(true);
1570 HEAP->CollectGarbage(OLD_POINTER_SPACE); 1573 HEAP->CollectGarbage(OLD_POINTER_SPACE);
1571 } 1574 }
OLDNEW
« no previous file with comments | « 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