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

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

Issue 5188006: Push version 2.5.7 to trunk.... (Closed) Base URL: http://v8.googlecode.com/svn/trunk/
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-dtoa.cc ('k') | test/cctest/test-parsing.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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 1077 matching lines...) Expand 10 before | Expand all | Expand 10 after
1088 // with and without GCs while iterating the list. 1088 // with and without GCs while iterating the list.
1089 for (int i = 0; i < kNumTestContexts; i++) { 1089 for (int i = 0; i < kNumTestContexts; i++) {
1090 ctx[i] = v8::Context::New(); 1090 ctx[i] = v8::Context::New();
1091 CHECK_EQ(i + 1, CountGlobalContexts()); 1091 CHECK_EQ(i + 1, CountGlobalContexts());
1092 CHECK_EQ(i + 1, CountGlobalContextsWithGC(i / 2 + 1)); 1092 CHECK_EQ(i + 1, CountGlobalContextsWithGC(i / 2 + 1));
1093 1093
1094 ctx[i]->Enter(); 1094 ctx[i]->Enter();
1095 ctx[i]->Exit(); 1095 ctx[i]->Exit();
1096 } 1096 }
1097 } 1097 }
1098
1099
1100 TEST(TestSizeOfObjectsVsHeapIteratorPrecision) {
1101 InitializeVM();
1102 intptr_t size_of_objects_1 = Heap::SizeOfObjects();
1103 HeapIterator iterator(HeapIterator::kPreciseFiltering);
1104 intptr_t size_of_objects_2 = 0;
1105 for (HeapObject* obj = iterator.next();
1106 obj != NULL;
1107 obj = iterator.next()) {
1108 size_of_objects_2 += obj->Size();
1109 }
1110 // Delta must be within 1% of the larger result.
1111 if (size_of_objects_1 > size_of_objects_2) {
1112 intptr_t delta = size_of_objects_1 - size_of_objects_2;
1113 PrintF("Heap::SizeOfObjects: %" V8_PTR_PREFIX "d, "
1114 "Iterator: %" V8_PTR_PREFIX "d, "
1115 "delta: %" V8_PTR_PREFIX "d\n",
1116 size_of_objects_1, size_of_objects_2, delta);
1117 CHECK_GT(size_of_objects_1 / 100, delta);
1118 } else {
1119 intptr_t delta = size_of_objects_2 - size_of_objects_1;
1120 PrintF("Heap::SizeOfObjects: %" V8_PTR_PREFIX "d, "
1121 "Iterator: %" V8_PTR_PREFIX "d, "
1122 "delta: %" V8_PTR_PREFIX "d\n",
1123 size_of_objects_1, size_of_objects_2, delta);
1124 CHECK_GT(size_of_objects_2 / 100, delta);
1125 }
1126 }
OLDNEW
« no previous file with comments | « test/cctest/test-dtoa.cc ('k') | test/cctest/test-parsing.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698