diff --git a/js/src/jsapi.cpp b/js/src/jsapi.cpp index 6eb1b80d80c..b5c76978f5c 100644 --- a/js/src/jsapi.cpp +++ b/js/src/jsapi.cpp @@ -896,13 +896,12 @@ JS_SuspendRequest(JSContext *cx) if (saveDepth == 0) return 0; + JS_THREAD_DATA(cx)->conservativeGC.enable(); do { cx->outstandingRequests++; /* compensate for StopRequest */ StopRequest(cx); } while (cx->requestDepth); - JS_THREAD_DATA(cx)->conservativeGC.enable(); - return saveDepth; #else return 0; @@ -916,13 +915,12 @@ JS_ResumeRequest(JSContext *cx, jsrefcount saveDepth) if (saveDepth == 0) return; - JS_THREAD_DATA(cx)->conservativeGC.disable(); - JS_ASSERT(cx->outstandingRequests != 0); do { JS_BeginRequest(cx); cx->outstandingRequests--; /* compensate for JS_BeginRequest */ } while (--saveDepth != 0); + JS_THREAD_DATA(cx)->conservativeGC.disable(); #endif } diff --git a/js/src/jsgc.cpp b/js/src/jsgc.cpp index 480c176d520..afa3da3937c 100644 --- a/js/src/jsgc.cpp +++ b/js/src/jsgc.cpp @@ -2462,6 +2462,7 @@ js_TraceRuntime(JSTracer *trc) #ifdef JS_THREADSAFE JS_ASSERT(acx->outstandingRequests != 0); #endif + JS_ASSERT(JS_THREAD_DATA(acx)->conservativeGC.isEnabled()); void *thing; switch (gcr->tag) { default: @@ -2496,8 +2497,16 @@ js_TraceRuntime(JSTracer *trc) if (!IsMarkedGCThing(thing)) { ConservativeGCTest test = IsGCThingWord(rt, reinterpret_cast(thing)); fprintf(stderr, - "Conservative GC scanner has missed the root %p with tag %ld" - " on the stack due to %d. Aborting.\n", thing, (long) gcr->tag, int(test)); + "Conservative GC scanner has missed the root 0x%p with tag %ld" + " on the stack due to %d. The root location 0x%p, distance from" + " the stack base %ld, conservative gc span %ld." + " Consevtaive GC status for the thread %d." + " Aborting.\n", + thing, (long) gcr->tag, int(test), (void *) gcr, + (long) ((jsword) JS_THREAD_DATA(acx)->nativeStackBase - (jsword) gcr), + (long) ((jsword) JS_THREAD_DATA(acx)->nativeStackBase - + (jsword) JS_THREAD_DATA(acx)->conservativeGC.nativeStackTop), + JS_THREAD_DATA(acx)->conservativeGC.enableCount); JS_ASSERT(false); abort(); } diff --git a/js/src/jsval.h b/js/src/jsval.h index 540d1e9e6ce..a9d992057eb 100644 --- a/js/src/jsval.h +++ b/js/src/jsval.h @@ -150,7 +150,7 @@ JS_STATIC_ASSERT(sizeof(JSValueTag) == sizeof(uint32)); JS_ENUM_HEADER(JSValueShiftedTag, uint64) { - JSVAL_SHIFTED_TAG_MAX_DOUBLE = (((uint64)JSVAL_TAG_MAX_DOUBLE) << JSVAL_TAG_SHIFT), + JSVAL_SHIFTED_TAG_MAX_DOUBLE = ((((uint64)JSVAL_TAG_MAX_DOUBLE) << JSVAL_TAG_SHIFT) | 0xFFFFFFFF), JSVAL_SHIFTED_TAG_INT32 = (((uint64)JSVAL_TAG_INT32) << JSVAL_TAG_SHIFT), JSVAL_SHIFTED_TAG_UNDEFINED = (((uint64)JSVAL_TAG_UNDEFINED) << JSVAL_TAG_SHIFT), JSVAL_SHIFTED_TAG_STRING = (((uint64)JSVAL_TAG_STRING) << JSVAL_TAG_SHIFT), @@ -207,7 +207,7 @@ typedef uint32 JSValueTag; #define JSVAL_TAG_OBJECT (uint32)(JSVAL_TAG_MAX_DOUBLE | JSVAL_TYPE_OBJECT) typedef uint64 JSValueShiftedTag; -#define JSVAL_SHIFTED_TAG_MAX_DOUBLE (((uint64)JSVAL_TAG_MAX_DOUBLE) << JSVAL_TAG_SHIFT) +#define JSVAL_SHIFTED_TAG_MAX_DOUBLE ((((uint64)JSVAL_TAG_MAX_DOUBLE) << JSVAL_TAG_SHIFT) | 0xFFFFFFFF) #define JSVAL_SHIFTED_TAG_INT32 (((uint64)JSVAL_TAG_INT32) << JSVAL_TAG_SHIFT) #define JSVAL_SHIFTED_TAG_UNDEFINED (((uint64)JSVAL_TAG_UNDEFINED) << JSVAL_TAG_SHIFT) #define JSVAL_SHIFTED_TAG_STRING (((uint64)JSVAL_TAG_STRING) << JSVAL_TAG_SHIFT)