Don't let GC run when recording.

This commit is contained in:
Brendan Eich
2008-08-29 16:04:54 -07:00
parent d42f0fd685
commit 3a2ac2f52b
5 changed files with 56 additions and 28 deletions

View File

@@ -90,7 +90,7 @@ js_BoxDouble(JSContext* cx, jsdouble d)
jsint i;
if (JSDOUBLE_IS_INT(d, i))
return INT_TO_JSVAL(i);
JS_ASSERT(cx->runningJittedCode);
JS_ASSERT(cx->executingTrace);
jsval v; /* not rooted but ok here because we know GC won't run */
if (!js_NewDoubleInRootedValue(cx, d, &v))
return JSVAL_ERROR_COOKIE;
@@ -102,7 +102,7 @@ js_BoxInt32(JSContext* cx, jsint i)
{
if (JS_LIKELY(INT_FITS_IN_JSVAL(i)))
return INT_TO_JSVAL(i);
JS_ASSERT(cx->runningJittedCode);
JS_ASSERT(cx->executingTrace);
jsval v; /* not rooted but ok here because we know GC won't run */
jsdouble d = (jsdouble)i;
if (!js_NewDoubleInRootedValue(cx, d, &v))
@@ -213,7 +213,7 @@ JSString* FASTCALL
js_String_p_substring(JSContext* cx, JSString* str, jsint begin, jsint end)
{
JS_ASSERT(end >= begin);
JS_ASSERT(cx->runningJittedCode);
JS_ASSERT(cx->executingTrace);
return js_NewDependentString(cx, str, (size_t)begin, (size_t)(end - begin));
}
@@ -222,7 +222,7 @@ js_String_p_substring_1(JSContext* cx, JSString* str, jsint begin)
{
jsint end = JSSTRING_LENGTH(str);
JS_ASSERT(end >= begin);
JS_ASSERT(cx->runningJittedCode);
JS_ASSERT(cx->executingTrace);
return js_NewDependentString(cx, str, (size_t)begin, (size_t)(end - begin));
}
@@ -237,7 +237,7 @@ js_String_getelem(JSContext* cx, JSString* str, jsint i)
JSString* FASTCALL
js_String_fromCharCode(JSContext* cx, jsint i)
{
JS_ASSERT(cx->runningJittedCode);
JS_ASSERT(cx->executingTrace);
jschar c = (jschar)i;
if (c < UNIT_STRING_LIMIT)
return js_GetUnitStringForChar(cx, c);
@@ -441,7 +441,7 @@ js_FastNewObject(JSContext* cx, JSObject* ctor)
JSFunction* fun = GET_FUNCTION_PRIVATE(cx, ctor);
JSClass* clasp = FUN_INTERPRETED(fun) ? &js_ObjectClass : fun->u.n.clasp;
JS_ASSERT(cx->runningJittedCode);
JS_ASSERT(cx->executingTrace);
JSObject* obj = (JSObject*) js_NewGCThing(cx, GCX_OBJECT, sizeof(JSObject));
if (!obj)
return NULL;
@@ -627,7 +627,7 @@ js_ObjectToString(JSContext* cx, JSObject* obj)
JSObject* FASTCALL
js_Array_1int(JSContext* cx, JSObject* ctor, jsint i)
{
JS_ASSERT(cx->runningJittedCode);
JS_ASSERT(cx->executingTrace);
JSObject* obj = js_FastNewObject(cx, ctor);
if (obj)
obj->fslots[JSSLOT_ARRAY_LENGTH] = i;