Changeset 1112 in webkit for trunk/JavaScriptCore/kjs


Ignore:
Timestamp:
May 8, 2002, 5:11:06 PM (23 years ago)
Author:
darin
Message:
  • kjs/collector.h:
  • kjs/collector.cpp: (Collector::numInterpreters): (Collector::numGCNotAllowedObjects): (Collector::numReferencedObjects): Add three new functions so we can see a bit more about leaking JavaScriptCore.
Location:
trunk/JavaScriptCore/kjs
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/kjs/collector.cpp

    r1024 r1112  
    276276}
    277277#endif
     278
     279#ifdef APPLE_CHANGES
     280int Collector::numInterpreters()
     281{
     282  int count = 0;
     283  if (InterpreterImp::s_hook) {
     284    InterpreterImp *scr = InterpreterImp::s_hook;
     285    do {
     286      ++count;
     287      scr = scr->next;
     288    } while (scr != InterpreterImp::s_hook);
     289  }
     290  return count;
     291}
     292
     293int Collector::numGCNotAllowedObjects()
     294{
     295  int count = 0;
     296  CollectorBlock *block = root;
     297  while (block) {
     298    ValueImp **r = (ValueImp**)block->mem;
     299    assert(r);
     300    for (int i = 0; i < block->size; i++, r++)
     301    {
     302      ValueImp *imp = *r;
     303      if (imp && (imp->_flags & ValueImp::VI_GCALLOWED) == 0) {
     304        ++count;
     305      }
     306    }
     307    block = block->next;
     308  }
     309  return count;
     310}
     311
     312int Collector::numReferencedObjects()
     313{
     314  int count = 0;
     315  CollectorBlock *block = root;
     316  while (block) {
     317    ValueImp **r = (ValueImp**)block->mem;
     318    assert(r);
     319    for (int i = 0; i < block->size; i++, r++)
     320    {
     321      ValueImp *imp = *r;
     322      if (imp && imp->refcount) {
     323        ++count;
     324      }
     325    }
     326    block = block->next;
     327  }
     328  return count;
     329}
     330#endif
  • trunk/JavaScriptCore/kjs/collector.h

    r1024 r1112  
    8989    static bool collecting;
    9090#endif
     91#ifdef APPLE_CHANGES
     92    static int numInterpreters();
     93    static int numGCNotAllowedObjects();
     94    static int numReferencedObjects();
     95#endif
    9196  private:
    9297    static CollectorBlock* root;
Note: See TracChangeset for help on using the changeset viewer.