Changeset 2781 in webkit for trunk/JavaScriptCore/kjs
- Timestamp:
- Nov 20, 2002, 8:54:45 AM (23 years ago)
- Location:
- trunk/JavaScriptCore/kjs
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/collector.cpp
r2779 r2781 44 44 static const int WORD_SIZE = sizeof(uint32_t); 45 45 static const int BITS_PER_WORD = WORD_SIZE * 8; 46 static const uint32_t ALL_BITS_ON = 0xffffffff; 46 47 static const int CELLS_PER_BLOCK = ((BLOCK_SIZE * 8 - 32) / (CELL_SIZE * 8 + 1)); 47 48 static const int BITMAP_SIZE = (CELLS_PER_BLOCK / BITS_PER_WORD) + (CELLS_PER_BLOCK % BITS_PER_WORD != 0 ? 1 : 0); … … 77 78 static CollectorHeap heap = {NULL, 0, 0, NULL, 0, 0, 0, 0}; 78 79 80 bool Collector::memoryFull = false; 81 82 79 83 void* Collector::allocate(size_t s) 80 84 { … … 86 90 collect(); 87 91 88 heap.numLiveObjects++;89 90 if (heap.numLiveObjects >= KJS_MEM_LIMIT) {91 // fprintf(stderr,"Out of memory");92 }93 94 95 92 if (s > (unsigned)CELL_SIZE) { 96 93 // oversize allocator … … 135 132 for (int wordInBitmap = 0; wordInBitmap < BITMAP_SIZE; wordInBitmap++) { 136 133 uint32_t word = targetBlock->bitmap[wordInBitmap]; 134 if (word == ALL_BITS_ON) { 135 continue; 136 } 137 137 for (int bitInWord = 0; bitInWord < BITS_PER_WORD; bitInWord++) { 138 138 if ((word & (1 << bitInWord)) == 0) { … … 276 276 heap.numAllocationsSinceLastCollect = 0; 277 277 278 memoryFull = (heap.numLiveObjects >= KJS_MEM_LIMIT); 279 278 280 return deleted; 279 281 } … … 282 284 { 283 285 return heap.numLiveObjects; 284 }285 286 bool Collector::outOfMemory()287 {288 return heap.numLiveObjects >= KJS_MEM_LIMIT;289 286 } 290 287 -
trunk/JavaScriptCore/kjs/collector.h
r2779 r2781 58 58 static bool collect(); 59 59 static int size(); 60 static bool outOfMemory() ;60 static bool outOfMemory() { return memoryFull; } 61 61 62 62 #ifdef KJS_DEBUG_MEM … … 73 73 static CFSetRef liveObjectClasses(); 74 74 #endif 75 private: 76 static bool memoryFull; 75 77 }; 76 78
Note:
See TracChangeset
for help on using the changeset viewer.