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

Diff of /trunk/js/jsarena.cpp

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

revision 506 by siliconforks, Thu Oct 23 19:03:33 2008 UTC revision 507 by siliconforks, Sun Jan 10 07:23:34 2010 UTC
# Line 1  Line 1 
1  /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-  /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2   *   *
3   * ***** BEGIN LICENSE BLOCK *****   * ***** BEGIN LICENSE BLOCK *****
4   * Version: MPL 1.1/GPL 2.0/LGPL 2.1   * Version: MPL 1.1/GPL 2.0/LGPL 2.1
# Line 42  Line 42 
42   * "Fast Allocation and Deallocation of Memory Based on Object Lifetimes"   * "Fast Allocation and Deallocation of Memory Based on Object Lifetimes"
43   * David R. Hanson, Software -- Practice and Experience, Vol. 20(1).   * David R. Hanson, Software -- Practice and Experience, Vol. 20(1).
44   */   */
 #include "jsstddef.h"  
45  #include <stdlib.h>  #include <stdlib.h>
46  #include <string.h>  #include <string.h>
47  #include "jstypes.h"  #include "jstypes.h"
48    #include "jsstdint.h"
49  #include "jsbit.h"  #include "jsbit.h"
50  #include "jsarena.h" /* Added by JSIFY */  #include "jsarena.h" /* Added by JSIFY */
51  #include "jsutil.h" /* Added by JSIFY */  #include "jsutil.h" /* Added by JSIFY */
# Line 160  Line 160 
160              if (pool->quotap) {              if (pool->quotap) {
161                  if (gross > *pool->quotap)                  if (gross > *pool->quotap)
162                      return NULL;                      return NULL;
163                  b = (JSArena *) malloc(gross);                  b = (JSArena *) js_malloc(gross);
164                  if (!b)                  if (!b)
165                      return NULL;                      return NULL;
166                  *pool->quotap -= gross;                  *pool->quotap -= gross;
167              } else {              } else {
168                  b = (JSArena *) malloc(gross);                  b = (JSArena *) js_malloc(gross);
169                  if (!b)                  if (!b)
170                      return NULL;                      return NULL;
171              }              }
# Line 227  Line 227 
227          growth = gross - (a->limit - (jsuword) a);          growth = gross - (a->limit - (jsuword) a);
228          if (growth > *pool->quotap)          if (growth > *pool->quotap)
229              return NULL;              return NULL;
230          a = (JSArena *) realloc(a, gross);          a = (JSArena *) js_realloc(a, gross);
231          if (!a)          if (!a)
232              return NULL;              return NULL;
233          *pool->quotap -= growth;          *pool->quotap -= growth;
234      } else {      } else {
235          a = (JSArena *) realloc(a, gross);          a = (JSArena *) js_realloc(a, gross);
236          if (!a)          if (!a)
237              return NULL;              return NULL;
238      }      }
# Line 315  Line 315 
315              *pool->quotap += a->limit - (jsuword) a;              *pool->quotap += a->limit - (jsuword) a;
316          JS_CLEAR_ARENA(a);          JS_CLEAR_ARENA(a);
317          JS_COUNT_ARENA(pool,--);          JS_COUNT_ARENA(pool,--);
318          free(a);          js_free(a);
319      } while ((a = *ap) != NULL);      } while ((a = *ap) != NULL);
320    
321      pool->current = head;      pool->current = head;
# Line 354  Line 354 
354          JSArenaStats *stats, **statsp;          JSArenaStats *stats, **statsp;
355    
356          if (pool->stats.name) {          if (pool->stats.name) {
357              free(pool->stats.name);              js_free(pool->stats.name);
358              pool->stats.name = NULL;              pool->stats.name = NULL;
359          }          }
360          for (statsp = &arena_stats_list; (stats = *statsp) != 0;          for (statsp = &arena_stats_list; (stats = *statsp) != 0;

Legend:
Removed from v.506  
changed lines
  Added in v.507

  ViewVC Help
Powered by ViewVC 1.1.24