| OLD | NEW | 
|     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  Loading... | 
|  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 } | 
| OLD | NEW |