Changeset 2781 in webkit for trunk/JavaScriptCore


Ignore:
Timestamp:
Nov 20, 2002, 8:54:45 AM (23 years ago)
Author:
mjs
Message:

Fixed the two most obvious problems with the new GC for another 6%
improvement.

  • kjs/collector.cpp: (Collector::allocate): Don't bother doing the bit tests on a bitmap word if all it's bits are on. (Collector::collect): Track memoryFull boolean.
  • kjs/collector.h: Inlined outOfMemory since it was showing up on profiles.
Location:
trunk/JavaScriptCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/ChangeLog

    r2779 r2781  
     12002-11-20  Maciej Stachowiak  <[email protected]>
     2
     3        Fixed the two most obvious problems with the new GC for another 6%
     4        improvement.
     5       
     6        * kjs/collector.cpp:
     7        (Collector::allocate): Don't bother doing the bit tests on a bitmap word if
     8        all it's bits are on.
     9        (Collector::collect): Track memoryFull boolean.
     10        * kjs/collector.h: Inlined outOfMemory since it was showing up on profiles.
     11
    1122002-11-20  Maciej Stachowiak  <[email protected]>
    213
  • trunk/JavaScriptCore/ChangeLog-2002-12-03

    r2779 r2781  
     12002-11-20  Maciej Stachowiak  <[email protected]>
     2
     3        Fixed the two most obvious problems with the new GC for another 6%
     4        improvement.
     5       
     6        * kjs/collector.cpp:
     7        (Collector::allocate): Don't bother doing the bit tests on a bitmap word if
     8        all it's bits are on.
     9        (Collector::collect): Track memoryFull boolean.
     10        * kjs/collector.h: Inlined outOfMemory since it was showing up on profiles.
     11
    1122002-11-20  Maciej Stachowiak  <[email protected]>
    213
  • trunk/JavaScriptCore/ChangeLog-2003-10-25

    r2779 r2781  
     12002-11-20  Maciej Stachowiak  <[email protected]>
     2
     3        Fixed the two most obvious problems with the new GC for another 6%
     4        improvement.
     5       
     6        * kjs/collector.cpp:
     7        (Collector::allocate): Don't bother doing the bit tests on a bitmap word if
     8        all it's bits are on.
     9        (Collector::collect): Track memoryFull boolean.
     10        * kjs/collector.h: Inlined outOfMemory since it was showing up on profiles.
     11
    1122002-11-20  Maciej Stachowiak  <[email protected]>
    213
  • trunk/JavaScriptCore/kjs/collector.cpp

    r2779 r2781  
    4444static const int WORD_SIZE = sizeof(uint32_t);
    4545static const int BITS_PER_WORD = WORD_SIZE * 8;
     46static const uint32_t ALL_BITS_ON = 0xffffffff;
    4647static const int CELLS_PER_BLOCK = ((BLOCK_SIZE * 8 - 32) / (CELL_SIZE * 8 + 1));
    4748static const int BITMAP_SIZE = (CELLS_PER_BLOCK / BITS_PER_WORD) + (CELLS_PER_BLOCK % BITS_PER_WORD != 0 ? 1 : 0);
     
    7778static CollectorHeap heap = {NULL, 0, 0, NULL, 0, 0, 0, 0};
    7879
     80bool Collector::memoryFull = false;
     81
     82
    7983void* Collector::allocate(size_t s)
    8084{
     
    8690    collect();
    8791 
    88   heap.numLiveObjects++;
    89 
    90   if (heap.numLiveObjects >= KJS_MEM_LIMIT) {
    91     // fprintf(stderr,"Out of memory");
    92   }
    93 
    94 
    9592  if (s > (unsigned)CELL_SIZE) {
    9693    // oversize allocator
     
    135132  for (int wordInBitmap = 0; wordInBitmap < BITMAP_SIZE; wordInBitmap++) {
    136133    uint32_t word = targetBlock->bitmap[wordInBitmap];
     134    if (word == ALL_BITS_ON) {
     135      continue;
     136    }
    137137    for (int bitInWord = 0; bitInWord < BITS_PER_WORD; bitInWord++) {
    138138      if ((word & (1 << bitInWord)) == 0) {
     
    276276  heap.numAllocationsSinceLastCollect = 0;
    277277 
     278  memoryFull = (heap.numLiveObjects >= KJS_MEM_LIMIT);
     279
    278280  return deleted;
    279281}
     
    282284{
    283285  return heap.numLiveObjects;
    284 }
    285 
    286 bool Collector::outOfMemory()
    287 {
    288   return heap.numLiveObjects >= KJS_MEM_LIMIT;
    289286}
    290287
  • trunk/JavaScriptCore/kjs/collector.h

    r2779 r2781  
    5858    static bool collect();
    5959    static int size();
    60     static bool outOfMemory();
     60    static bool outOfMemory() { return memoryFull; }
    6161
    6262#ifdef KJS_DEBUG_MEM
     
    7373    static CFSetRef liveObjectClasses();
    7474#endif
     75  private:
     76    static bool memoryFull;
    7577  };
    7678
Note: See TracChangeset for help on using the changeset viewer.