/[jscoverage]/trunk/js/jsgc.h
ViewVC logotype

Diff of /trunk/js/jsgc.h

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

revision 332 by siliconforks, Thu Oct 23 19:03:33 2008 UTC revision 460 by siliconforks, Sat Sep 26 23:15:22 2009 UTC
# Line 50  Line 50 
50    
51  JS_BEGIN_EXTERN_C  JS_BEGIN_EXTERN_C
52    
 JS_STATIC_ASSERT(JSTRACE_STRING == 2);  
   
53  #define JSTRACE_XML         3  #define JSTRACE_XML         3
54    
55  /*  /*
# Line 70  Line 68 
68  #define GCX_EXTERNAL_STRING     JSTRACE_LIMIT       /* JSString with external  #define GCX_EXTERNAL_STRING     JSTRACE_LIMIT       /* JSString with external
69                                                         chars */                                                         chars */
70  /*  /*
71   * The number of defined GC types.   * The number of defined GC types and the maximum limit for the number of
72     * possible GC types.
73   */   */
74  #define GCX_NTYPES              (GCX_EXTERNAL_STRING + 8)  #define GCX_NTYPES              (GCX_EXTERNAL_STRING + 8)
   
 /*  
  * The maximum limit for the number of GC types.  
  */  
75  #define GCX_LIMIT_LOG2         4           /* type index bits */  #define GCX_LIMIT_LOG2         4           /* type index bits */
76  #define GCX_LIMIT              JS_BIT(GCX_LIMIT_LOG2)  #define GCX_LIMIT              JS_BIT(GCX_LIMIT_LOG2)
77    
 JS_STATIC_ASSERT(GCX_NTYPES <= GCX_LIMIT);  
   
78  /* GC flag definitions, must fit in 8 bits (type index goes in the low bits). */  /* GC flag definitions, must fit in 8 bits (type index goes in the low bits). */
79  #define GCF_TYPEMASK    JS_BITMASK(GCX_LIMIT_LOG2)  #define GCF_TYPEMASK    JS_BITMASK(GCX_LIMIT_LOG2)
80  #define GCF_MARK        JS_BIT(GCX_LIMIT_LOG2)  #define GCF_MARK        JS_BIT(GCX_LIMIT_LOG2)
# Line 132  Line 125 
125          if (SCOPE_IS_BRANDED(scope) &&                                        \          if (SCOPE_IS_BRANDED(scope) &&                                        \
126              (oldval) != (newval) &&                                           \              (oldval) != (newval) &&                                           \
127              (VALUE_IS_FUNCTION(cx,oldval) || VALUE_IS_FUNCTION(cx,newval))) { \              (VALUE_IS_FUNCTION(cx,oldval) || VALUE_IS_FUNCTION(cx,newval))) { \
128              SCOPE_MAKE_UNIQUE_SHAPE(cx, scope);                               \              js_MakeScopeShapeUnique(cx, scope);                               \
129          }                                                                     \          }                                                                     \
130          GC_POKE(cx, oldval);                                                  \          GC_POKE(cx, oldval);                                                  \
131      JS_END_MACRO      JS_END_MACRO
# Line 211  Line 204 
204  extern jsdouble *  extern jsdouble *
205  js_NewWeaklyRootedDouble(JSContext *cx, jsdouble d);  js_NewWeaklyRootedDouble(JSContext *cx, jsdouble d);
206    
207    #ifdef JS_TRACER
208    extern JSBool
209    js_ReserveObjects(JSContext *cx, size_t nobjects);
210    #endif
211    
212  extern JSBool  extern JSBool
213  js_LockGCThingRT(JSRuntime *rt, void *thing);  js_LockGCThingRT(JSRuntime *rt, void *thing);
214    
# Line 233  Line 231 
231  #endif  #endif
232    
233  /*  /*
  * JS_IS_VALID_TRACE_KIND assumes that JSTRACE_STRING is the last non-xml  
  * trace kind when JS_HAS_XML_SUPPORT is false.  
  */  
 JS_STATIC_ASSERT(JSTRACE_STRING + 1 == JSTRACE_XML);  
   
 /*  
234   * Trace jsval when JSVAL_IS_OBJECT(v) can be an arbitrary GC thing casted as   * Trace jsval when JSVAL_IS_OBJECT(v) can be an arbitrary GC thing casted as
235   * JSVAL_OBJECT and js_GetGCThingTraceKind has to be used to find the real   * JSVAL_OBJECT and js_GetGCThingTraceKind has to be used to find the real
236   * type behind v.   * type behind v.
# Line 249  Line 241 
241  extern void  extern void
242  js_TraceStackFrame(JSTracer *trc, JSStackFrame *fp);  js_TraceStackFrame(JSTracer *trc, JSStackFrame *fp);
243    
244  extern void  extern JS_REQUIRES_STACK void
245  js_TraceRuntime(JSTracer *trc, JSBool allAtoms);  js_TraceRuntime(JSTracer *trc, JSBool allAtoms);
246    
247  extern JS_FRIEND_API(void)  extern JS_REQUIRES_STACK JS_FRIEND_API(void)
248  js_TraceContext(JSTracer *trc, JSContext *acx);  js_TraceContext(JSTracer *trc, JSContext *acx);
249    
250  /*  /*
251     * Schedule the GC call at a later safe point.
252     */
253    #ifndef JS_THREADSAFE
254    # define js_TriggerGC(cx, gcLocked)    js_TriggerGC (cx)
255    #endif
256    
257    extern void
258    js_TriggerGC(JSContext *cx, JSBool gcLocked);
259    
260    /*
261   * Kinds of js_GC invocation.   * Kinds of js_GC invocation.
262   */   */
263  typedef enum JSGCInvocationKind {  typedef enum JSGCInvocationKind {
# Line 316  Line 318 
318      JSGCDoubleCell  *link;      JSGCDoubleCell  *link;
319  };  };
320    
 JS_STATIC_ASSERT(sizeof(JSGCDoubleCell) == sizeof(double));  
   
321  typedef struct JSGCDoubleArenaList {  typedef struct JSGCDoubleArenaList {
322      JSGCArenaInfo   *first;             /* first allocated GC arena */      JSGCArenaInfo   *first;             /* first allocated GC arena */
323      jsbitmap        *nextDoubleFlags;   /* bitmask with flags to check for free      jsbitmap        *nextDoubleFlags;   /* bitmask with flags to check for free
# Line 336  Line 336 
336  extern void  extern void
337  js_RevokeGCLocalFreeLists(JSContext *cx);  js_RevokeGCLocalFreeLists(JSContext *cx);
338    
339    extern void
340    js_DestroyScriptsToGC(JSContext *cx, JSThreadData *data);
341    
342  struct JSWeakRoots {  struct JSWeakRoots {
343      /* Most recently created things by type, members of the GC's root set. */      /* Most recently created things by type, members of the GC's root set. */
344      void            *newborn[GCX_NTYPES];      void            *newborn[GCX_NTYPES];
# Line 347  Line 350 
350      jsval           lastInternalResult;      jsval           lastInternalResult;
351  };  };
352    
 JS_STATIC_ASSERT(JSVAL_NULL == 0);  
353  #define JS_CLEAR_WEAK_ROOTS(wr) (memset((wr), 0, sizeof(JSWeakRoots)))  #define JS_CLEAR_WEAK_ROOTS(wr) (memset((wr), 0, sizeof(JSWeakRoots)))
354    
355  /*  /*

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

  ViewVC Help
Powered by ViewVC 1.1.24