/[jscoverage]/trunk/js/jshash.cpp
ViewVC logotype

Diff of /trunk/js/jshash.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 459 by siliconforks, Thu Oct 23 19:03:33 2008 UTC revision 460 by siliconforks, Sat Sep 26 23:15:22 2009 UTC
# Line 71  Line 71 
71  }  }
72    
73  static void  static void
74  DefaultFreeTable(void *pool, void *item)  DefaultFreeTable(void *pool, void *item, size_t size)
75  {  {
76      free(item);      free(item);
77  }  }
# Line 121  Line 121 
121      nb = n * sizeof(JSHashEntry *);      nb = n * sizeof(JSHashEntry *);
122      ht->buckets = (JSHashEntry**) allocOps->allocTable(allocPriv, nb);      ht->buckets = (JSHashEntry**) allocOps->allocTable(allocPriv, nb);
123      if (!ht->buckets) {      if (!ht->buckets) {
124          allocOps->freeTable(allocPriv, ht);          allocOps->freeTable(allocPriv, ht, nb);
125          return NULL;          return NULL;
126      }      }
127      memset(ht->buckets, 0, nb);      memset(ht->buckets, 0, nb);
# Line 153  Line 153 
153  #ifdef DEBUG  #ifdef DEBUG
154      memset(ht->buckets, 0xDB, n * sizeof ht->buckets[0]);      memset(ht->buckets, 0xDB, n * sizeof ht->buckets[0]);
155  #endif  #endif
156      allocOps->freeTable(allocPriv, ht->buckets);      allocOps->freeTable(allocPriv, ht->buckets, n * sizeof ht->buckets[0]);
157  #ifdef DEBUG  #ifdef DEBUG
158      memset(ht, 0xDB, sizeof *ht);      memset(ht, 0xDB, sizeof *ht);
159  #endif  #endif
160      allocOps->freeTable(allocPriv, ht);      allocOps->freeTable(allocPriv, ht, sizeof *ht);
161  }  }
162    
163  /*  /*
# Line 198  Line 198 
198  {  {
199      size_t nb, nentries, i;      size_t nb, nentries, i;
200      JSHashEntry **oldbuckets, *he, *next, **hep;      JSHashEntry **oldbuckets, *he, *next, **hep;
 #ifdef DEBUG  
201      size_t nold = NBUCKETS(ht);      size_t nold = NBUCKETS(ht);
 #endif  
202    
203      JS_ASSERT(newshift < JS_HASH_BITS);      JS_ASSERT(newshift < JS_HASH_BITS);
204    
# Line 230  Line 228 
228              hep = BUCKET_HEAD(ht, he->keyHash);              hep = BUCKET_HEAD(ht, he->keyHash);
229    
230              /*              /*
231               * Since he comes from the old table, it must be unique and we               * We do not require unique entries, instead appending he to the
232               * simply add it to the head of bucket chain without chain lookup.               * chain starting at hep.
233               */               */
234              he->next = *hep;              while (*hep)
235                    hep = &(*hep)->next;
236                he->next = NULL;
237              *hep = he;              *hep = he;
238          }          }
239      }      }
240  #ifdef DEBUG  #ifdef DEBUG
241      memset(oldbuckets, 0xDB, nold * sizeof oldbuckets[0]);      memset(oldbuckets, 0xDB, nold * sizeof oldbuckets[0]);
242  #endif  #endif
243      ht->allocOps->freeTable(ht->allocPriv, oldbuckets);      ht->allocOps->freeTable(ht->allocPriv, oldbuckets,
244                                nold * sizeof oldbuckets[0]);
245      return JS_TRUE;      return JS_TRUE;
246  }  }
247    

Legend:
Removed from v.459  
changed lines
  Added in v.460

  ViewVC Help
Powered by ViewVC 1.1.24