- Tighten up code in gc_root_marker that now allows for roots to contain jsvals

(tagged machine words, some of which when untagged are 8-byte-aligned GC heap
  pointers).
- Fix bad effects of rogue global-replace of JS_FREE by free.


git-svn-id: svn://10.0.0.236/trunk@42693 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
brendan%mozilla.org 1999-08-08 02:32:00 +00:00
parent 3c68e438c8
commit 7c7947dd9f
2 changed files with 12 additions and 12 deletions

View File

@ -121,11 +121,11 @@ struct JSArenaPool {
#define JS_UPTRDIFF(p,q) ((jsuword)(p) - (jsuword)(q))
#ifdef DEBUG
#define free_PATTERN 0xDA
#define JS_FREE_PATTERN 0xDA
#define JS_CLEAR_UNUSED(a) (JS_ASSERT((a)->avail <= (a)->limit), \
memset((void*)(a)->avail, free_PATTERN, \
memset((void*)(a)->avail, JS_FREE_PATTERN, \
(a)->limit - (a)->avail))
#define JS_CLEAR_ARENA(a) memset((void*)(a), free_PATTERN, \
#define JS_CLEAR_ARENA(a) memset((void*)(a), JS_FREE_PATTERN, \
(a)->limit - (jsuword)(a))
#else
#define JS_CLEAR_UNUSED(a) /* nothing */

View File

@ -186,8 +186,8 @@ retry:
METER(rt->gcStats.freelen--);
METER(rt->gcStats.recycle++);
} else {
if (rt->gcBytes < rt->gcMaxBytes &&
(tried_gc || rt->gcMallocBytes < rt->gcMaxBytes))
if (rt->gcBytes < rt->gcMaxBytes &&
(tried_gc || rt->gcMallocBytes < rt->gcMaxBytes))
{
JS_ARENA_ALLOCATE(thing, &rt->gcArenaPool, sizeof(JSGCThing));
JS_ARENA_ALLOCATE(flagp, &rt->gcFlagsPool, sizeof(uint8));
@ -580,19 +580,19 @@ gc_hash_root(const void *key)
JS_STATIC_DLL_CALLBACK(intN)
gc_root_marker(JSHashEntry *he, intN i, void *arg)
{
jsval *rp = (jsval*)he->key;
jsval *rp = (jsval *)he->key;
jsval v = *rp;
/* Ignore null object and scalar values. */
if (v && JSVAL_IS_GCTHING(v)) {
if (!JSVAL_IS_NULL(v) && JSVAL_IS_GCTHING(v)) {
JSRuntime *rt = (JSRuntime *)arg;
#ifdef DEBUG
JSArena *a;
JSRuntime *rt = (JSRuntime *)arg;
JSBool root_points_to_gcArenaPool = JS_FALSE;
void *thing = JSVAL_TO_GCTHING(v);
for (a = rt->gcArenaPool.first.next; a; a = a->next) {
if (JSVAL_TO_GCTHING(v) >= (void*)a->base && JSVAL_TO_GCTHING(v) <= (void*)a->avail) {
if (JS_UPTRDIFF(thing, a->base) < a->avail - a->base) {
root_points_to_gcArenaPool = JS_TRUE;
break;
}
@ -600,7 +600,7 @@ gc_root_marker(JSHashEntry *he, intN i, void *arg)
JS_ASSERT(root_points_to_gcArenaPool);
#endif
GC_MARK(arg, JSVAL_TO_GCTHING(v), he->value ? he->value : "root", NULL);
GC_MARK(rt, JSVAL_TO_GCTHING(v), he->value ? he->value : "root", NULL);
}
return HT_ENUMERATE_NEXT;
}