- Export JSSLOT_ITER_* from jsiter.cpp to jsiter.h, for jstracer.cpp to use.

- Fix OBJ_GET_SLOT to be STOBJ_GET_SLOT in jsiter.cpp, no thread safety here (bug on file).
- Move JSNativeEnumerator from jsobj.cpp to jsobj.h for jstracer.cpp as well.
- Rename JOF_2BYTE JOF_UINT8 for consistency, and actually decompile it.
- Trace JSOP_FORVAR (can't do anything in JSOP_ITER, it comes before the loop).
- Shortened some guardMyLongSummerVacationWithinBounds names ;-).
- Removed/refactored to avoid dslots_ins obligation on all callers.
This commit is contained in:
Brendan Eich
2008-07-30 16:32:33 -07:00
parent 2987cbf82d
commit 342e1a24b5
9 changed files with 229 additions and 109 deletions

View File

@@ -69,9 +69,6 @@
#include "jsxml.h"
#endif
#define JSSLOT_ITER_STATE (JSSLOT_PRIVATE)
#define JSSLOT_ITER_FLAGS (JSSLOT_PRIVATE + 1)
#if JSSLOT_ITER_FLAGS >= JS_INITIAL_NSLOTS
#error JS_INITIAL_NSLOTS must be greater than JSSLOT_ITER_FLAGS.
#endif
@@ -225,11 +222,11 @@ IteratorNextImpl(JSContext *cx, JSObject *obj, jsval *rval)
iterable = OBJ_GET_PARENT(cx, obj);
JS_ASSERT(iterable);
state = OBJ_GET_SLOT(cx, obj, JSSLOT_ITER_STATE);
state = STOBJ_GET_SLOT(obj, JSSLOT_ITER_STATE);
if (JSVAL_IS_NULL(state))
goto stop;
flags = JSVAL_TO_INT(OBJ_GET_SLOT(cx, obj, JSSLOT_ITER_FLAGS));
flags = JSVAL_TO_INT(STOBJ_GET_SLOT(obj, JSSLOT_ITER_FLAGS));
JS_ASSERT(!(flags & JSITER_ENUMERATE));
foreach = (flags & JSITER_FOREACH) != 0;
ok =
@@ -263,7 +260,7 @@ IteratorNextImpl(JSContext *cx, JSObject *obj, jsval *rval)
return JS_TRUE;
stop:
JS_ASSERT(OBJ_GET_SLOT(cx, obj, JSSLOT_ITER_STATE) == JSVAL_NULL);
JS_ASSERT(STOBJ_GET_SLOT(obj, JSSLOT_ITER_STATE) == JSVAL_NULL);
*rval = JSVAL_HOLE;
return JS_TRUE;
}
@@ -319,7 +316,7 @@ js_GetNativeIteratorFlags(JSContext *cx, JSObject *iterobj)
{
if (OBJ_GET_CLASS(cx, iterobj) != &js_IteratorClass)
return 0;
return JSVAL_TO_INT(OBJ_GET_SLOT(cx, iterobj, JSSLOT_ITER_FLAGS));
return JSVAL_TO_INT(STOBJ_GET_SLOT(iterobj, JSSLOT_ITER_FLAGS));
}
/*
@@ -598,7 +595,7 @@ js_CallIteratorNext(JSContext *cx, JSObject *iterobj, jsval *rval)
/* Fast path for native iterators */
if (OBJ_GET_CLASS(cx, iterobj) == &js_IteratorClass) {
flags = JSVAL_TO_INT(OBJ_GET_SLOT(cx, iterobj, JSSLOT_ITER_FLAGS));
flags = JSVAL_TO_INT(STOBJ_GET_SLOT(iterobj, JSSLOT_ITER_FLAGS));
if (flags & JSITER_ENUMERATE)
return CallEnumeratorNext(cx, iterobj, flags, rval);