Merge tracemonkey to mozilla-central.

This commit is contained in:
Robert Sayre 2009-03-24 13:49:05 -04:00
Родитель 28637b1d1c 62a931dac7
Коммит 3006aebbc5
129 изменённых файлов: 8862 добавлений и 1959 удалений

Просмотреть файл

@ -234,6 +234,12 @@ CPPSRCS += \
jsbuiltins.cpp \
$(NULL)
ifdef WINCE
# don't need -c
AS_DASH_C_FLAG =
ASFILES += jswince.asm
endif
ifdef DEBUG
CPPSRCS += TraceTreeDrawer.cpp
endif

Просмотреть файл

@ -1865,10 +1865,8 @@ case "$target" in
AR_EXTRACT="$AR -extract"
AR_DELETE="$AR d"
AR_FLAGS='-OUT:"$@"'
AS="$AS_BIN"
if test -z "$AS_BIN"; then
AS="$AS_BIN"
fi
DSO_CFLAGS=
DSO_PIC_CFLAGS=
DLL_SUFFIX=.dll
@ -3015,25 +3013,6 @@ if test ! "$GNU_CXX"; then
fi
AC_CHECK_LIB(socket, socket)
dnl Enable VFP support on ARM
MOZ_ARG_DISABLE_BOOL(arm-vfp,
[ --disable-arm-vfp Disable ARM VFP instructions in JavaScript JIT],
MOZ_ARM_VFP=, MOZ_ARM_VFP=1, MOZ_ARM_VFP=1)
if test "$MOZ_ARM_VFP"; then
AC_DEFINE(NJ_ARM_VFP)
fi
AC_MSG_CHECKING(for ARM SIMD support)
AC_TRY_COMPILE([],
[asm("uqadd8 r1, r1, r2");],
result="yes", result="no")
AC_MSG_RESULT("$result")
if test "$result" = "yes"; then
AC_DEFINE(HAVE_ARM_SIMD)
HAVE_ARM_SIMD=1
fi
AC_SUBST(HAVE_ARM_SIMD)
dnl ========================================================
dnl = pthread support
dnl = Start by checking whether the system support pthreads

Просмотреть файл

@ -278,6 +278,31 @@ static struct {
/*38*/ JSOP_STOP,
},
};
static struct {
jsbytecode String[39];
} new_imacros = {
{
/* 0*/ JSOP_DUP,
/* 1*/ JSOP_DUP,
/* 2*/ JSOP_GETPROP, 0, COMMON_ATOM_INDEX(toString),
/* 5*/ JSOP_IFPRIMTOP, 0, 13,
/* 8*/ JSOP_SWAP,
/* 9*/ JSOP_CALL, 0, 0,
/*12*/ JSOP_IFPRIMTOP, 0, 21,
/*15*/ JSOP_GOTO, 0, 4,
/*18*/ JSOP_POP,
/*19*/ JSOP_POP,
/*20*/ JSOP_CALLPROP, 0, COMMON_ATOM_INDEX(valueOf),
/*23*/ JSOP_STRING, 0, COMMON_TYPE_ATOM_INDEX(JSTYPE_STRING),
/*26*/ JSOP_CALL, 0, 1,
/*29*/ JSOP_PRIMTOP,
/*30*/ JSOP_GOTO, 0, 5,
/*33*/ JSOP_SWAP,
/*34*/ JSOP_POP,
/*35*/ JSOP_NEW, 0, 1,
/*38*/ JSOP_STOP,
},
};
static struct {
jsbytecode apply0[8];
jsbytecode apply1[12];
@ -640,6 +665,29 @@ static struct {
/* 9*/ JSOP_STOP,
},
};
static struct {
jsbytecode callprop[12];
jsbytecode callelem[12];
} callelem_imacros = {
{
/* 0*/ JSOP_SWAP,
/* 1*/ JSOP_DUP,
/* 2*/ JSOP_CALLBUILTIN, ((JSBUILTIN_GetProperty) & 0xff00) >> 8, ((JSBUILTIN_GetProperty) & 0xff),
/* 5*/ JSOP_PICK, 3,
/* 7*/ JSOP_CALL, 0, 1,
/*10*/ JSOP_SWAP,
/*11*/ JSOP_STOP,
},
{
/* 0*/ JSOP_SWAP,
/* 1*/ JSOP_DUP,
/* 2*/ JSOP_CALLBUILTIN, ((JSBUILTIN_GetElement) & 0xff00) >> 8, ((JSBUILTIN_GetElement) & 0xff),
/* 5*/ JSOP_PICK, 3,
/* 7*/ JSOP_CALL, 0, 1,
/*10*/ JSOP_SWAP,
/*11*/ JSOP_STOP,
},
};
static struct {
jsbytecode setprop[15];
jsbytecode setelem[15];
@ -773,7 +821,7 @@ uint8 js_opcode2extra[JSOP_LIMIT] = {
0, /* JSOP_SWAP */
0, /* JSOP_OBJECT */
0, /* JSOP_POP */
0, /* JSOP_NEW */
2, /* JSOP_NEW */
0, /* JSOP_TRAP */
0, /* JSOP_GETARG */
0, /* JSOP_SETARG */
@ -885,7 +933,7 @@ uint8 js_opcode2extra[JSOP_LIMIT] = {
0, /* JSOP_RESETBASE0 */
0, /* JSOP_STARTXML */
0, /* JSOP_STARTXMLEXPR */
0, /* JSOP_CALLELEM */
3, /* JSOP_CALLELEM */
0, /* JSOP_STOP */
0, /* JSOP_GETXPROP */
0, /* JSOP_CALLXMLNAME */
@ -951,5 +999,7 @@ uint8 js_opcode2extra[JSOP_LIMIT] = {
|| x == JSOP_ITER \
|| x == JSOP_NEXTITER \
|| x == JSOP_APPLY \
|| x == JSOP_NEW \
|| x == JSOP_INITELEM \
|| x == JSOP_CALLELEM \
)

Просмотреть файл

@ -320,6 +320,32 @@
.end
.igroup new JSOP_NEW
.imacro String # String this obj
dup # String this obj obj
dup # String this obj obj obj
getprop toString # String this obj obj toString
ifprimtop 1 # String this obj obj toString
swap # String this obj toString obj
call 0 # String this obj rval
ifprimtop 3 # String this obj rval
goto 2
1: pop # String this obj obj
2: pop # String this obj
callprop valueOf # String this valueOf obj
string string # String this valueOf obj "string"
call 1 # String this rval
primtop # String this rval
goto 4 # String this rval
3: swap # String this rval obj
pop # String this rval
4: new 1 # strobj
stop # strobj
.end
.end
.igroup apply JSOP_APPLY
.imacro apply0 # apply fun this arr
pick 3 # fun this arr apply
@ -685,6 +711,30 @@
.end
.igroup callelem JSOP_CALLELEM
.imacro callprop # obj name
swap # name obj
dup # name obj obj
callbuiltin (JSBUILTIN_GetProperty) # name obj fun obj
pick 3 # obj fun obj name
call 1 # obj propval
swap # propval obj
stop
.end
.imacro callelem # obj i
swap # i obj
dup # i obj obj
callbuiltin (JSBUILTIN_GetElement) # i obj fun obj
pick 3 # obj fun obj i
call 1 # obj propval
swap # propval obj
stop
.end
.end
.igroup setelem JSOP_SETELEM
.imacro setprop # obj name val

Просмотреть файл

@ -155,7 +155,7 @@ MSG_DEF(JSMSG_CURLY_BEFORE_BODY, 72, 0, JSEXN_SYNTAXERR, "missing { before
MSG_DEF(JSMSG_CURLY_AFTER_BODY, 73, 0, JSEXN_SYNTAXERR, "missing } after function body")
MSG_DEF(JSMSG_PAREN_BEFORE_COND, 74, 0, JSEXN_SYNTAXERR, "missing ( before condition")
MSG_DEF(JSMSG_PAREN_AFTER_COND, 75, 0, JSEXN_SYNTAXERR, "missing ) after condition")
MSG_DEF(JSMSG_UNUSED76, 76, 0, JSEXN_NONE, "unused76")
MSG_DEF(JSMSG_DESTRUCT_DUP_ARG, 76, 0, JSEXN_SYNTAXERR, "duplicate argument is mixed with destructuring pattern")
MSG_DEF(JSMSG_NAME_AFTER_DOT, 77, 0, JSEXN_SYNTAXERR, "missing name after . operator")
MSG_DEF(JSMSG_BRACKET_IN_INDEX, 78, 0, JSEXN_SYNTAXERR, "missing ] in index expression")
MSG_DEF(JSMSG_UNUSED79, 79, 0, JSEXN_NONE, "unused79")

Просмотреть файл

@ -788,8 +788,6 @@ JS_NewRuntime(uint32 maxbytes)
if (!js_InitDeflatedStringCache(rt))
goto bad;
#ifdef JS_THREADSAFE
if (!js_InitThreadPrivateIndex(js_ThreadDestructorCB))
goto bad;
rt->gcLock = JS_NEW_LOCK();
if (!rt->gcLock)
goto bad;
@ -818,10 +816,8 @@ JS_NewRuntime(uint32 maxbytes)
#endif
if (!js_InitPropertyTree(rt))
goto bad;
#if !defined JS_THREADSAFE && defined JS_TRACER
js_InitJIT(&rt->traceMonitor);
#endif
if (!js_InitThreads(rt))
goto bad;
return rt;
@ -850,10 +846,7 @@ JS_DestroyRuntime(JSRuntime *rt)
}
#endif
#if !defined JS_THREADSAFE && defined JS_TRACER
js_FinishJIT(&rt->traceMonitor);
#endif
js_FinishThreads(rt);
js_FreeRuntimeScriptState(rt);
js_FinishAtomState(rt);
@ -885,8 +878,6 @@ JS_DestroyRuntime(JSRuntime *rt)
JS_DESTROY_CONDVAR(rt->titleSharingDone);
if (rt->debuggerLock)
JS_DESTROY_LOCK(rt->debuggerLock);
#else
GSN_CACHE_CLEAR(&rt->gsnCache);
#endif
js_FinishPropertyTree(rt);
free(rt);
@ -903,7 +894,6 @@ JS_ShutDown(void)
js_FinishDtoa();
#ifdef JS_THREADSAFE
js_CleanupThreadPrivateData(); /* Fixes bug 464828. */
js_CleanupLocks();
#endif
PRMJ_NowShutdown();
@ -927,7 +917,7 @@ JS_BeginRequest(JSContext *cx)
#ifdef JS_THREADSAFE
JSRuntime *rt;
JS_ASSERT(cx->thread->id == js_CurrentThreadId());
JS_ASSERT(CURRENT_THREAD_IS_ME(cx->thread));
if (!cx->requestDepth) {
JS_ASSERT(cx->gcLocalFreeLists == &js_GCEmptyFreeListSet);
@ -935,7 +925,6 @@ JS_BeginRequest(JSContext *cx)
rt = cx->runtime;
JS_LOCK_GC(rt);
/* NB: we use cx->thread here, not js_GetCurrentThread(). */
if (rt->gcThread != cx->thread) {
while (rt->gcLevel > 0)
JS_AWAIT_GC_DONE(rt);
@ -962,6 +951,7 @@ JS_EndRequest(JSContext *cx)
JSBool shared;
CHECK_REQUEST(cx);
JS_ASSERT(CURRENT_THREAD_IS_ME(cx->thread));
JS_ASSERT(cx->requestDepth > 0);
JS_ASSERT(cx->outstandingRequests > 0);
if (cx->requestDepth == 1) {
@ -1935,14 +1925,8 @@ JS_NewDoubleValue(JSContext *cx, jsdouble d, jsval *rval)
JS_PUBLIC_API(JSBool)
JS_NewNumberValue(JSContext *cx, jsdouble d, jsval *rval)
{
jsint i;
CHECK_REQUEST(cx);
if (JSDOUBLE_IS_INT(d, i) && INT_FITS_IN_JSVAL(i)) {
*rval = INT_TO_JSVAL(i);
return JS_TRUE;
}
return JS_NewDoubleValue(cx, d, rval);
return js_NewWeaklyRootedNumber(cx, d, rval);
}
#undef JS_AddRoot
@ -2851,19 +2835,6 @@ JS_SetPrototype(JSContext *cx, JSObject *obj, JSObject *proto)
{
CHECK_REQUEST(cx);
JS_ASSERT(obj != proto);
#ifdef DEBUG
/*
* FIXME: bug 408416. The cycle-detection required for script-writeable
* __proto__ lives in js_SetProtoOrParent over in jsobj.c, also known as
* js_ObjectOps.setProto. This hook must detect cycles, to prevent scripts
* from ilooping SpiderMonkey trivially. But the overhead of detecting
* cycles is high enough, and the threat from JS-API-calling C++ code is
* low enough, that it's not worth burdening the non-DEBUG callers. Same
* goes for JS_SetParent, below.
*/
if (obj->map->ops->setProto)
return obj->map->ops->setProto(cx, obj, JSSLOT_PROTO, proto);
#else
if (OBJ_IS_NATIVE(obj)) {
JS_LOCK_OBJ(cx, obj);
if (!js_GetMutableScope(cx, obj)) {
@ -2874,7 +2845,6 @@ JS_SetPrototype(JSContext *cx, JSObject *obj, JSObject *proto)
JS_UNLOCK_OBJ(cx, obj);
return JS_TRUE;
}
#endif
OBJ_SET_PROTO(cx, obj, proto);
return JS_TRUE;
}
@ -2895,11 +2865,6 @@ JS_SetParent(JSContext *cx, JSObject *obj, JSObject *parent)
{
CHECK_REQUEST(cx);
JS_ASSERT(obj != parent);
#ifdef DEBUG
/* FIXME: bug 408416, see JS_SetPrototype just above. */
if (obj->map->ops->setParent)
return obj->map->ops->setParent(cx, obj, JSSLOT_PARENT, parent);
#endif
OBJ_SET_PARENT(cx, obj, parent);
return JS_TRUE;
}
@ -5934,25 +5899,17 @@ JS_SetContextThread(JSContext *cx)
#ifdef JS_THREADSAFE
JS_ASSERT(cx->requestDepth == 0);
if (cx->thread) {
JS_ASSERT(cx->thread->id == js_CurrentThreadId());
JS_ASSERT(CURRENT_THREAD_IS_ME(cx->thread));
return cx->thread->id;
}
JSRuntime *rt = cx->runtime;
JSThread *thread = js_GetCurrentThread(rt);
if (!thread) {
if (!js_InitContextThread(cx)) {
js_ReportOutOfMemory(cx);
return -1;
}
/*
* We must not race with a GC that accesses cx->thread for all threads,
* see bug 476934.
*/
JS_LOCK_GC(rt);
js_WaitForGC(rt);
js_InitContextThread(cx, thread);
JS_UNLOCK_GC(rt);
/* Here the GC lock is still held after js_InitContextThread took it. */
JS_UNLOCK_GC(cx->runtime);
#endif
return 0;
}
@ -5969,8 +5926,8 @@ JS_ClearContextThread(JSContext *cx)
JS_ASSERT(cx->requestDepth == 0);
if (!cx->thread)
return 0;
JS_ASSERT(CURRENT_THREAD_IS_ME(cx->thread));
jsword old = cx->thread->id;
JS_ASSERT(old == js_CurrentThreadId());
/*
* We must not race with a GC that accesses cx->thread for all threads,
@ -5979,9 +5936,8 @@ JS_ClearContextThread(JSContext *cx)
JSRuntime *rt = cx->runtime;
JS_LOCK_GC(rt);
js_WaitForGC(rt);
JS_REMOVE_AND_INIT_LINK(&cx->threadLinks);
cx->thread = NULL;
JS_UNLOCK_GC(cx->runtime);
js_ClearContextThread(cx);
JS_UNLOCK_GC(rt);
return old;
#else
return 0;

Просмотреть файл

@ -1545,8 +1545,8 @@ struct JSFunctionSpec {
* frame when activated.
*/
#define JS_FN(name,fastcall,nargs,flags) \
{name, (JSNative)(fastcall), nargs, \
(flags) | JSFUN_FAST_NATIVE | JSFUN_STUB_GSOPS, 0}
JS_FS(name, (JSNative)(fastcall), nargs, \
(flags) | JSFUN_FAST_NATIVE | JSFUN_STUB_GSOPS, 0)
extern JS_PUBLIC_API(JSObject *)
JS_InitClass(JSContext *cx, JSObject *obj, JSObject *parent_proto,

Просмотреть файл

@ -238,13 +238,9 @@ js_GetLengthProperty(JSContext *cx, JSObject *obj, jsuint *lengthp)
}
static JSBool
IndexToValue(JSContext *cx, jsuint index, jsval *vp)
IndexToValue(JSContext *cx, jsdouble index, jsval *vp)
{
if (index <= JSVAL_INT_MAX) {
*vp = INT_TO_JSVAL(index);
return JS_TRUE;
}
return JS_NewDoubleValue(cx, (jsdouble)index, vp);
return js_NewWeaklyRootedNumber(cx, index, vp);
}
JSBool JS_FASTCALL
@ -384,6 +380,37 @@ EnsureCapacity(JSContext *cx, JSObject *obj, uint32 capacity)
return JS_TRUE;
}
static bool
ReallyBigIndexToId(JSContext* cx, jsdouble index, jsid* idp)
{
JSAutoTempValueRooter dval(cx);
if (!js_NewDoubleInRootedValue(cx, index, dval.addr()) ||
!js_ValueToStringId(cx, dval.value(), idp)) {
return JS_FALSE;
}
return JS_TRUE;
}
static bool
IndexToId(JSContext* cx, JSObject* obj, jsdouble index, JSBool* hole, jsid* idp,
JSBool createAtom = JS_FALSE)
{
if (index <= JSVAL_INT_MAX) {
*idp = INT_TO_JSID(index);
return JS_TRUE;
}
if (index <= jsuint(-1)) {
if (!BigIndexToId(cx, obj, jsuint(index), createAtom, idp))
return JS_FALSE;
if (hole && JSVAL_IS_VOID(*idp))
*hole = JS_TRUE;
return JS_TRUE;
}
return ReallyBigIndexToId(cx, index, idp);
}
/*
* If the property at the given index exists, get its value into location
* pointed by vp and set *hole to false. Otherwise set *hole to true and *vp
@ -391,39 +418,36 @@ EnsureCapacity(JSContext *cx, JSObject *obj, uint32 capacity)
* properly rooted and can be used as GC-protected storage for temporaries.
*/
static JSBool
GetArrayElement(JSContext *cx, JSObject *obj, jsuint index, JSBool *hole,
GetArrayElement(JSContext *cx, JSObject *obj, jsdouble index, JSBool *hole,
jsval *vp)
{
jsid id;
JSObject *obj2;
JSProperty *prop;
JS_ASSERT(index >= 0);
if (OBJ_IS_DENSE_ARRAY(cx, obj) && index < js_DenseArrayCapacity(obj) &&
(*vp = obj->dslots[index]) != JSVAL_HOLE) {
(*vp = obj->dslots[jsuint(index)]) != JSVAL_HOLE) {
*hole = JS_FALSE;
return JS_TRUE;
}
if (index <= JSVAL_INT_MAX) {
id = INT_TO_JSID(index);
} else {
if (!BigIndexToId(cx, obj, index, JS_FALSE, &id))
return JS_FALSE;
if (JSVAL_IS_VOID(id)) {
*hole = JS_TRUE;
*vp = JSVAL_VOID;
return JS_TRUE;
}
JSAutoTempIdRooter idr(cx);
*hole = JS_FALSE;
if (!IndexToId(cx, obj, index, hole, idr.addr()))
return JS_FALSE;
if (*hole) {
*vp = JSVAL_VOID;
return JS_TRUE;
}
if (!OBJ_LOOKUP_PROPERTY(cx, obj, id, &obj2, &prop))
JSObject *obj2;
JSProperty *prop;
if (!OBJ_LOOKUP_PROPERTY(cx, obj, idr.id(), &obj2, &prop))
return JS_FALSE;
if (!prop) {
*hole = JS_TRUE;
*vp = JSVAL_VOID;
} else {
OBJ_DROP_PROPERTY(cx, obj2, prop);
if (!OBJ_GET_PROPERTY(cx, obj, id, vp))
if (!OBJ_GET_PROPERTY(cx, obj, idr.id(), vp))
return JS_FALSE;
*hole = JS_FALSE;
}
@ -434,61 +458,66 @@ GetArrayElement(JSContext *cx, JSObject *obj, jsuint index, JSBool *hole,
* Set the value of the property at the given index to v assuming v is rooted.
*/
static JSBool
SetArrayElement(JSContext *cx, JSObject *obj, jsuint index, jsval v)
SetArrayElement(JSContext *cx, JSObject *obj, jsdouble index, jsval v)
{
jsid id;
JS_ASSERT(index >= 0);
if (OBJ_IS_DENSE_ARRAY(cx, obj)) {
/* Predicted/prefeched code should favor the remains-dense case. */
if (!INDEX_TOO_SPARSE(obj, index)) {
if (!EnsureCapacity(cx, obj, index + 1))
return JS_FALSE;
if (index >= (uint32)obj->fslots[JSSLOT_ARRAY_LENGTH])
obj->fslots[JSSLOT_ARRAY_LENGTH] = index + 1;
if (obj->dslots[index] == JSVAL_HOLE)
obj->fslots[JSSLOT_ARRAY_COUNT]++;
obj->dslots[index] = v;
return JS_TRUE;
/* Predicted/prefetched code should favor the remains-dense case. */
if (index <= jsuint(-1)) {
jsuint idx = jsuint(index);
if (!INDEX_TOO_SPARSE(obj, idx)) {
JS_ASSERT(idx + 1 > idx);
if (!EnsureCapacity(cx, obj, idx + 1))
return JS_FALSE;
if (index >= uint32(obj->fslots[JSSLOT_ARRAY_LENGTH]))
obj->fslots[JSSLOT_ARRAY_LENGTH] = idx + 1;
if (obj->dslots[idx] == JSVAL_HOLE)
obj->fslots[JSSLOT_ARRAY_COUNT]++;
obj->dslots[idx] = v;
return JS_TRUE;
}
}
if (!js_MakeArraySlow(cx, obj))
return JS_FALSE;
}
if (index <= JSVAL_INT_MAX) {
id = INT_TO_JSID(index);
} else {
if (!BigIndexToId(cx, obj, index, JS_TRUE, &id))
return JS_FALSE;
JS_ASSERT(!JSVAL_IS_VOID(id));
}
return OBJ_SET_PROPERTY(cx, obj, id, &v);
JSAutoTempIdRooter idr(cx);
if (!IndexToId(cx, obj, index, NULL, idr.addr(), JS_TRUE))
return JS_FALSE;
JS_ASSERT(!JSVAL_IS_VOID(idr.id()));
return OBJ_SET_PROPERTY(cx, obj, idr.id(), &v);
}
static JSBool
DeleteArrayElement(JSContext *cx, JSObject *obj, jsuint index)
DeleteArrayElement(JSContext *cx, JSObject *obj, jsdouble index)
{
jsid id;
jsval junk;
JS_ASSERT(index >= 0);
if (OBJ_IS_DENSE_ARRAY(cx, obj)) {
if (index < js_DenseArrayCapacity(obj)) {
if (obj->dslots[index] != JSVAL_HOLE)
obj->fslots[JSSLOT_ARRAY_COUNT]--;
obj->dslots[index] = JSVAL_HOLE;
if (index <= jsuint(-1)) {
jsuint idx = jsuint(index);
if (!INDEX_TOO_SPARSE(obj, idx) && idx < js_DenseArrayCapacity(obj)) {
if (obj->dslots[idx] != JSVAL_HOLE)
obj->fslots[JSSLOT_ARRAY_COUNT]--;
obj->dslots[idx] = JSVAL_HOLE;
return JS_TRUE;
}
}
return JS_TRUE;
}
if (index <= JSVAL_INT_MAX) {
id = INT_TO_JSID(index);
} else {
if (!BigIndexToId(cx, obj, index, JS_FALSE, &id))
return JS_FALSE;
if (JSVAL_IS_VOID(id))
return JS_TRUE;
}
return OBJ_DELETE_PROPERTY(cx, obj, id, &junk);
JSAutoTempIdRooter idr(cx);
if (!IndexToId(cx, obj, index, NULL, idr.addr()))
return JS_FALSE;
if (JSVAL_IS_VOID(idr.id()))
return JS_TRUE;
jsval junk;
return OBJ_DELETE_PROPERTY(cx, obj, idr.id(), &junk);
}
/*
@ -496,7 +525,7 @@ DeleteArrayElement(JSContext *cx, JSObject *obj, jsuint index)
* its value to v assuming v is rooted.
*/
static JSBool
SetOrDeleteArrayElement(JSContext *cx, JSObject *obj, jsuint index,
SetOrDeleteArrayElement(JSContext *cx, JSObject *obj, jsdouble index,
JSBool hole, jsval v)
{
if (hole) {
@ -507,7 +536,7 @@ SetOrDeleteArrayElement(JSContext *cx, JSObject *obj, jsuint index,
}
JSBool
js_SetLengthProperty(JSContext *cx, JSObject *obj, jsuint length)
js_SetLengthProperty(JSContext *cx, JSObject *obj, jsdouble length)
{
jsval v;
jsid id;
@ -1553,26 +1582,61 @@ array_toLocaleString(JSContext *cx, uintN argc, jsval *vp)
}
static JSBool
InitArrayElements(JSContext *cx, JSObject *obj, jsuint start, jsuint end,
jsval *vector)
InitArrayElements(JSContext *cx, JSObject *obj, jsuint start, jsuint count, jsval *vector)
{
if (OBJ_IS_DENSE_ARRAY(cx, obj)) {
if (!EnsureCapacity(cx, obj, end))
JS_ASSERT(count < MAXINDEX);
/*
* Optimize for dense arrays so long as adding the given set of elements
* wouldn't otherwise make the array slow.
*/
if (OBJ_IS_DENSE_ARRAY(cx, obj) && start <= MAXINDEX - count &&
!INDEX_TOO_BIG(start + count)) {
jsuint newlen = start + count;
JS_ASSERT(jsdouble(start) + count == jsdouble(newlen));
if (!EnsureCapacity(cx, obj, newlen))
return JS_FALSE;
if (end > (uint32)obj->fslots[JSSLOT_ARRAY_LENGTH])
obj->fslots[JSSLOT_ARRAY_LENGTH] = end;
if (newlen > uint32(obj->fslots[JSSLOT_ARRAY_LENGTH]))
obj->fslots[JSSLOT_ARRAY_LENGTH] = newlen;
memcpy(obj->dslots + start, vector, sizeof(jsval) * (end - start));
JS_ASSERT(count < size_t(-1) / sizeof(jsval));
memcpy(obj->dslots + start, vector, sizeof(jsval) * count);
JS_ASSERT_IF(count != 0, obj->dslots[newlen - 1] != JSVAL_HOLE);
return JS_TRUE;
}
while (start != end) {
jsval* end = vector + count;
while (vector != end && start < MAXINDEX) {
if (!JS_CHECK_OPERATION_LIMIT(cx) ||
!SetArrayElement(cx, obj, start++, *vector++)) {
return JS_FALSE;
}
}
if (vector == end)
return JS_TRUE;
/* Finish out any remaining elements past the max array index. */
if (!ENSURE_SLOW_ARRAY(cx, obj))
return JS_FALSE;
JS_ASSERT(start == MAXINDEX);
jsval tmp[2] = {JSVAL_NULL, JSVAL_NULL};
jsdouble* dp = js_NewWeaklyRootedDouble(cx, MAXINDEX);
if (!dp)
return JS_FALSE;
tmp[0] = DOUBLE_TO_JSVAL(dp);
JSAutoTempValueRooter(cx, JS_ARRAY_LENGTH(tmp), tmp);
JSAutoTempIdRooter idr(cx);
do {
tmp[1] = *vector++;
if (!js_ValueToStringId(cx, tmp[0], idr.addr()) ||
!js_SetProperty(cx, obj, idr.id(), &tmp[1])) {
return JS_FALSE;
}
*dp += 1;
} while (vector != end);
return JS_TRUE;
}
@ -2171,15 +2235,15 @@ array_sort(JSContext *cx, uintN argc, jsval *vp)
static JSBool
array_push_slowly(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
{
jsuint length, newlength;
jsuint length;
if (!js_GetLengthProperty(cx, obj, &length))
return JS_FALSE;
newlength = length + argc;
if (!InitArrayElements(cx, obj, length, newlength, argv))
if (!InitArrayElements(cx, obj, length, argc, argv))
return JS_FALSE;
/* Per ECMA-262, return the new array length. */
jsdouble newlength = length + jsdouble(argc);
if (!IndexToValue(cx, newlength, rval))
return JS_FALSE;
return js_SetLengthProperty(cx, obj, newlength);
@ -2374,13 +2438,15 @@ array_unshift(JSContext *cx, uintN argc, jsval *vp)
{
JSObject *obj;
jsval *argv;
jsuint length, last;
jsuint length;
JSBool hole, ok;
JSTempValueRooter tvr;
jsdouble last, newlen;
obj = JS_THIS_OBJECT(cx, vp);
if (!obj || !js_GetLengthProperty(cx, obj, &length))
return JS_FALSE;
newlen = length;
if (argc > 0) {
/* Slide up the array to make room for argc at the bottom. */
argv = JS_ARGV(cx, vp);
@ -2406,13 +2472,13 @@ array_unshift(JSContext *cx, uintN argc, jsval *vp)
if (!InitArrayElements(cx, obj, 0, argc, argv))
return JS_FALSE;
length += argc;
if (!js_SetLengthProperty(cx, obj, length))
newlen += argc;
if (!js_SetLengthProperty(cx, obj, newlen))
return JS_FALSE;
}
/* Follow Perl by returning the new array length. */
return IndexToValue(cx, length, vp);
return IndexToValue(cx, newlen, vp);
}
static JSBool
@ -2533,7 +2599,7 @@ array_splice(JSContext *cx, uintN argc, jsval *vp)
}
/* Copy from argv into the hole to complete the splice. */
ok = InitArrayElements(cx, obj, begin, begin + argc, argv);
ok = InitArrayElements(cx, obj, begin, argc, argv);
if (!ok)
goto out;

Просмотреть файл

@ -122,7 +122,7 @@ extern JSBool
js_GetLengthProperty(JSContext *cx, JSObject *obj, jsuint *lengthp);
extern JSBool
js_SetLengthProperty(JSContext *cx, JSObject *obj, jsuint length);
js_SetLengthProperty(JSContext *cx, JSObject *obj, jsdouble length);
extern JSBool
js_HasLengthProperty(JSContext *cx, JSObject *obj, jsuint *lengthp);

Просмотреть файл

@ -427,6 +427,7 @@ JS_DECLARE_CALLINFO(js_NewUninitializedArray)
JS_DECLARE_CALLINFO(js_NumberToString)
/* Defined in jsstr.cpp. */
JS_DECLARE_CALLINFO(js_String_tn)
JS_DECLARE_CALLINFO(js_CompareStrings)
JS_DECLARE_CALLINFO(js_ConcatStrings)
JS_DECLARE_CALLINFO(js_EqualStrings)

Просмотреть файл

@ -69,142 +69,232 @@
#include "jsstr.h"
#include "jstracer.h"
#ifdef JS_THREADSAFE
#include "prtypes.h"
static void
FreeContext(JSContext *cx);
/*
* The index for JSThread info, returned by PR_NewThreadPrivateIndex. The
* index value is visible and shared by all threads, but the data associated
* with it is private to each thread.
*/
static PRUintn threadTPIndex;
static JSBool tpIndexInited = JS_FALSE;
JS_BEGIN_EXTERN_C
JSBool
js_InitThreadPrivateIndex(void (*ptr)(void *))
static void
InitThreadData(JSThreadData *data)
{
PRStatus status;
if (tpIndexInited)
return JS_TRUE;
status = PR_NewThreadPrivateIndex(&threadTPIndex, ptr);
if (status == PR_SUCCESS)
tpIndexInited = JS_TRUE;
return status == PR_SUCCESS;
#ifdef DEBUG
/* The data must be already zeroed. */
for (size_t i = 0; i != sizeof(*data); ++i)
JS_ASSERT(reinterpret_cast<uint8*>(data)[i] == 0);
#endif
#ifdef JS_TRACER
js_InitJIT(&data->traceMonitor);
#endif
}
JS_END_EXTERN_C
JS_BEGIN_EXTERN_C
JSBool
js_CleanupThreadPrivateData()
static void
FinishThreadData(JSThreadData *data)
{
if (!tpIndexInited)
return JS_TRUE;
return PR_SetThreadPrivate(threadTPIndex, NULL) == PR_SUCCESS;
#ifdef DEBUG
/* All GC-related things must be already removed at this point. */
for (size_t i = 0; i != JS_ARRAY_LENGTH(data->scriptsToGC); ++i)
JS_ASSERT(!data->scriptsToGC[i]);
#endif
js_FinishGSNCache(&data->gsnCache);
js_FinishPropertyCache(&data->propertyCache);
#if defined JS_TRACER
js_FinishJIT(&data->traceMonitor);
#endif
}
JS_END_EXTERN_C
/*
* Callback function to delete a JSThread info when the thread that owns it
* is destroyed.
*/
void
js_ThreadDestructorCB(void *ptr)
static void
PurgeThreadData(JSContext *cx, JSThreadData *data)
{
JSThread *thread = (JSThread *)ptr;
if (!thread)
return;
# ifdef JS_TRACER
JSTraceMonitor *tm = &data->traceMonitor;
tm->reservedDoublePoolPtr = tm->reservedDoublePool;
tm->needFlush = JS_TRUE;
/*
* Check that this thread properly called either JS_DestroyContext or
* JS_ClearContextThread on each JSContext it created or used.
* We want to keep tm->reservedObjects after the GC. So, unless we are
* shutting down, we don't purge them here and rather mark them during
* the GC, see MarkReservedObjects in jsgc.cpp.
*/
JS_ASSERT(JS_CLIST_IS_EMPTY(&thread->contextList));
GSN_CACHE_CLEAR(&thread->gsnCache);
#if defined JS_TRACER
js_FinishJIT(&thread->traceMonitor);
#endif
free(thread);
if (cx->runtime->state == JSRTS_LANDING)
tm->reservedObjects = NULL;
# endif
/* Destroy eval'ed scripts. */
js_DestroyScriptsToGC(cx, data);
js_PurgeGSNCache(&data->gsnCache);
js_PurgePropertyCache(cx, &data->propertyCache);
}
/*
* Get current thread-local JSThread info, creating one if it doesn't exist.
* Each thread has a unique JSThread pointer.
*
* Since we are dealing with thread-local data, no lock is needed.
*
* Return a pointer to the thread local info, NULL if the system runs out
* of memory, or it failed to set thread private data (neither case is very
* likely; both are probably due to out-of-memory). It is up to the caller
* to report an error, if possible.
*/
JSThread *
js_GetCurrentThread(JSRuntime *rt)
#ifdef JS_THREADSAFE
static JSThread *
NewThread(jsword id)
{
JSThread *thread;
thread = (JSThread *)PR_GetThreadPrivate(threadTPIndex);
if (!thread) {
thread = (JSThread *) malloc(sizeof(JSThread));
if (!thread)
return NULL;
#ifdef DEBUG
memset(thread, JS_FREE_PATTERN, sizeof(JSThread));
#endif
if (PR_FAILURE == PR_SetThreadPrivate(threadTPIndex, thread)) {
free(thread);
return NULL;
}
JS_INIT_CLIST(&thread->contextList);
thread->id = js_CurrentThreadId();
thread->gcMallocBytes = 0;
#ifdef JS_TRACER
memset(&thread->traceMonitor, 0, sizeof(thread->traceMonitor));
js_InitJIT(&thread->traceMonitor);
#endif
memset(thread->scriptsToGC, 0, sizeof thread->scriptsToGC);
/*
* js_InitContextThread initializes the remaining fields as necessary.
*/
}
JS_ASSERT(js_CurrentThreadId() == id);
JSThread *thread = (JSThread *) calloc(1, sizeof(JSThread));
if (!thread)
return NULL;
JS_INIT_CLIST(&thread->contextList);
thread->id = id;
InitThreadData(&thread->data);
return thread;
}
/*
* Sets current thread as owning thread of a context by assigning the
* thread-private info to the context.
*/
void
js_InitContextThread(JSContext *cx, JSThread *thread)
static void
DestroyThread(JSThread *thread)
{
/* The thread must have zero contexts. */
JS_ASSERT(JS_CLIST_IS_EMPTY(&thread->contextList));
FinishThreadData(&thread->data);
free(thread);
}
JSBool
js_InitContextThread(JSContext *cx)
{
JS_ASSERT(CURRENT_THREAD_IS_ME(thread));
JS_ASSERT(!cx->thread);
JS_ASSERT(cx->requestDepth == 0);
jsword id = js_CurrentThreadId();
JSRuntime *rt = cx->runtime;
JS_LOCK_GC(rt);
/*
* Clear caches on each transition from 0 to 1 context active on the
* current thread. See bug 425828.
* We must not race with a GC that accesses cx->thread for JSContext
* instances on all threads, see bug 476934.
*/
if (JS_CLIST_IS_EMPTY(&thread->contextList)) {
memset(&thread->gsnCache, 0, sizeof thread->gsnCache);
memset(&thread->propertyCache, 0, sizeof thread->propertyCache);
#ifdef DEBUG
memset(&thread->evalCacheMeter, 0, sizeof thread->evalCacheMeter);
#endif
js_WaitForGC(rt);
JSThreadsHashEntry *entry = (JSThreadsHashEntry *)
JS_DHashTableOperate(&rt->threads,
(const void *) id,
JS_DHASH_LOOKUP);
JSThread *thread;
if (JS_DHASH_ENTRY_IS_BUSY(&entry->base)) {
thread = entry->thread;
JS_ASSERT(thread->id == id);
} else {
JS_UNLOCK_GC(rt);
thread = NewThread(id);
if (!thread)
return false;
JS_LOCK_GC(rt);
js_WaitForGC(rt);
entry = (JSThreadsHashEntry *)
JS_DHashTableOperate(&rt->threads, (const void *) id,
JS_DHASH_ADD);
if (!entry) {
JS_UNLOCK_GC(rt);
DestroyThread(thread);
return false;
}
/* Another thread cannot initialize entry->thread. */
JS_ASSERT(!entry->thread);
entry->thread = thread;
}
JS_APPEND_LINK(&cx->threadLinks, &thread->contextList);
cx->thread = thread;
return true;
}
void
js_ClearContextThread(JSContext *cx)
{
JS_ASSERT(CURRENT_THREAD_IS_ME(cx->thread));
JS_REMOVE_AND_INIT_LINK(&cx->threadLinks);
cx->thread = NULL;
}
static JSBool
thread_matchEntry(JSDHashTable *table,
const JSDHashEntryHdr *hdr,
const void *key)
{
const JSThreadsHashEntry *entry = (const JSThreadsHashEntry *) hdr;
return entry->thread->id == (jsword) key;
}
static const JSDHashTableOps threads_ops = {
JS_DHashAllocTable,
JS_DHashFreeTable,
JS_DHashVoidPtrKeyStub,
thread_matchEntry,
JS_DHashMoveEntryStub,
JS_DHashClearEntryStub,
JS_DHashFinalizeStub,
NULL
};
static JSDHashOperator
thread_destroyer(JSDHashTable *table, JSDHashEntryHdr *hdr, uint32 /* index */,
void * /* arg */)
{
JSThreadsHashEntry *entry = (JSThreadsHashEntry *) hdr;
JSThread *thread = entry->thread;
JS_ASSERT(JS_CLIST_IS_EMPTY(&thread->contextList));
DestroyThread(thread);
return JS_DHASH_REMOVE;
}
static JSDHashOperator
thread_purger(JSDHashTable *table, JSDHashEntryHdr *hdr, uint32 /* index */,
void *arg)
{
JSContext* cx = (JSContext *) arg;
JSThread *thread = ((JSThreadsHashEntry *) hdr)->thread;
if (JS_CLIST_IS_EMPTY(&thread->contextList)) {
JS_ASSERT(cx->thread != thread);
js_DestroyScriptsToGC(cx, &thread->data);
DestroyThread(thread);
return JS_DHASH_REMOVE;
}
PurgeThreadData(cx, &thread->data);
return JS_DHASH_NEXT;
}
#endif /* JS_THREADSAFE */
JSBool
js_InitThreads(JSRuntime *rt)
{
#ifdef JS_THREADSAFE
if (!JS_DHashTableInit(&rt->threads, &threads_ops, NULL,
sizeof(JSThreadsHashEntry), 4)) {
rt->threads.ops = NULL;
return false;
}
#else
InitThreadData(&rt->threadData);
#endif
return true;
}
void
js_FinishThreads(JSRuntime *rt)
{
#ifdef JS_THREADSAFE
if (!rt->threads.ops)
return;
JS_DHashTableEnumerate(&rt->threads, thread_destroyer, NULL);
JS_DHashTableFinish(&rt->threads);
rt->threads.ops = NULL;
#else
FinishThreadData(&rt->threadData);
#endif
}
void
js_PurgeThreads(JSContext *cx)
{
#ifdef JS_THREADSAFE
JS_DHashTableEnumerate(&cx->runtime->threads, thread_purger, cx);
#else
PurgeThreadData(cx, &cx->runtime->threadData);
#endif
}
/*
* JSOPTION_XML and JSOPTION_ANONFUNFIX must be part of the JS version
* associated with scripts, so in addition to storing them in cx->options we
@ -261,12 +351,6 @@ js_NewContext(JSRuntime *rt, size_t stackChunkSize)
JSContext *cx;
JSBool ok, first;
JSContextCallback cxCallback;
#ifdef JS_THREADSAFE
JSThread *thread = js_GetCurrentThread(rt);
if (!thread)
return NULL;
#endif
/*
* We need to initialize the new context fully before adding it to the
@ -285,7 +369,6 @@ js_NewContext(JSRuntime *rt, size_t stackChunkSize)
cx->scriptStackQuota = JS_DEFAULT_SCRIPT_STACK_QUOTA;
#ifdef JS_THREADSAFE
cx->gcLocalFreeLists = (JSGCFreeListSet *) &js_GCEmptyFreeListSet;
js_InitContextThread(cx, thread);
#endif
JS_STATIC_ASSERT(JSVERSION_DEFAULT == 0);
JS_ASSERT(cx->version == JSVERSION_DEFAULT);
@ -300,12 +383,18 @@ js_NewContext(JSRuntime *rt, size_t stackChunkSize)
js_InitRegExpStatics(cx);
JS_ASSERT(cx->resolveFlags == 0);
JS_LOCK_GC(rt);
#ifdef JS_THREADSAFE
if (!js_InitContextThread(cx)) {
FreeContext(cx);
return NULL;
}
#endif
/*
* Here the GC lock is still held after js_InitContextThread took it and
* the GC is not running on another thread.
*/
for (;;) {
/*
* Ensure that we don't race with the GC on other threads, bug 478336.
*/
js_WaitForGC(rt);
if (rt->state == JSRTS_UP) {
JS_ASSERT(!JS_CLIST_IS_EMPTY(&rt->contextList));
first = JS_FALSE;
@ -318,6 +407,15 @@ js_NewContext(JSRuntime *rt, size_t stackChunkSize)
break;
}
JS_WAIT_CONDVAR(rt->stateChange, JS_NO_TIMEOUT);
/*
* During the above wait after we are notified about the state change
* but before we wake up, another thread could enter the GC from
* js_DestroyContext, bug 478336. So we must wait here to ensure that
* when we exit the loop with the first flag set to true, that GC is
* finished.
*/
js_WaitForGC(rt);
}
JS_APPEND_LINK(&cx->link, &rt->contextList);
JS_UNLOCK_GC(rt);
@ -404,7 +502,7 @@ DumpEvalCacheMeter(JSContext *cx)
EVAL_CACHE_METER_LIST(frob)
#undef frob
};
JSEvalCacheMeter *ecm = &JS_CACHE_LOCUS(cx)->evalCacheMeter;
JSEvalCacheMeter *ecm = &JS_THREAD_DATA(cx)->evalCacheMeter;
static AutoFile fp;
if (!fp) {
@ -439,9 +537,6 @@ js_DestroyContext(JSContext *cx, JSDestroyContextMode mode)
JSRuntime *rt;
JSContextCallback cxCallback;
JSBool last;
JSArgumentFormatMap *map;
JSLocalRootStack *lrs;
JSLocalRootChunk *lrc;
#ifdef JS_THREADSAFE
JS_ASSERT(CURRENT_THREAD_IS_ME(cx->thread));
@ -478,73 +573,99 @@ js_DestroyContext(JSContext *cx, JSDestroyContextMode mode)
last = (rt->contextList.next == &rt->contextList);
if (last)
rt->state = JSRTS_LANDING;
JS_UNLOCK_GC(rt);
if (last) {
if (last || mode == JSDCM_FORCE_GC || mode == JSDCM_MAYBE_GC
#ifdef JS_THREADSAFE
/*
* If cx is not in a request already, begin one now so that we wait
* for any racing GC started on a not-last context to finish, before
* we plow ahead and unpin atoms. Note that even though we begin a
* request here if necessary, we end all requests on cx below before
* forcing a final GC. This lets any not-last context destruction
* racing in another thread try to force or maybe run the GC, but by
* that point, rt->state will not be JSRTS_UP, and that GC attempt
* will return early.
*/
if (cx->requestDepth == 0)
JS_BeginRequest(cx);
|| cx->requestDepth != 0
#endif
/* Unlock and clear GC things held by runtime pointers. */
js_FinishRuntimeNumberState(cx);
js_FinishRuntimeStringState(cx);
/* Unpin all common atoms before final GC. */
js_FinishCommonAtoms(cx);
/* Clear debugging state to remove GC roots. */
JS_ClearAllTraps(cx);
JS_ClearAllWatchPoints(cx);
}
/* Remove more GC roots in regExpStatics, then collect garbage. */
JS_ClearRegExpRoots(cx);
#ifdef JS_THREADSAFE
/*
* Destroying a context implicitly calls JS_EndRequest(). Also, we must
* end our request here in case we are "last" -- in that event, another
* js_DestroyContext that was not last might be waiting in the GC for our
* request to end. We'll let it run below, just before we do the truly
* final GC and then free atom state.
*/
while (cx->requestDepth != 0)
JS_EndRequest(cx);
#endif
if (last) {
js_GC(cx, GC_LAST_CONTEXT);
DUMP_EVAL_CACHE_METER(cx);
/*
* Free the script filename table if it exists and is empty. Do this
* after the last GC to avoid finalizers tripping on free memory.
*/
if (rt->scriptFilenameTable && rt->scriptFilenameTable->nentries == 0)
js_FinishRuntimeScriptState(rt);
/* Take the runtime down, now that it has no contexts or atoms. */
JS_LOCK_GC(rt);
rt->state = JSRTS_DOWN;
JS_NOTIFY_ALL_CONDVAR(rt->stateChange);
) {
JS_UNLOCK_GC(rt);
} else {
if (mode == JSDCM_FORCE_GC)
js_GC(cx, GC_NORMAL);
else if (mode == JSDCM_MAYBE_GC)
JS_MaybeGC(cx);
if (last) {
#ifdef JS_THREADSAFE
/*
* If cx is not in a request already, begin one now so that we wait
* for any racing GC started on a not-last context to finish, before
* we plow ahead and unpin atoms. Note that even though we begin a
* request here if necessary, we end all requests on cx below before
* forcing a final GC. This lets any not-last context destruction
* racing in another thread try to force or maybe run the GC, but by
* that point, rt->state will not be JSRTS_UP, and that GC attempt
* will return early.
*/
if (cx->requestDepth == 0)
JS_BeginRequest(cx);
#endif
/* Unlock and clear GC things held by runtime pointers. */
js_FinishRuntimeNumberState(cx);
js_FinishRuntimeStringState(cx);
/* Unpin all common atoms before final GC. */
js_FinishCommonAtoms(cx);
/* Clear debugging state to remove GC roots. */
JS_ClearAllTraps(cx);
JS_ClearAllWatchPoints(cx);
}
/* Remove more GC roots in regExpStatics, then collect garbage. */
JS_ClearRegExpRoots(cx);
#ifdef JS_THREADSAFE
/*
* Destroying a context implicitly calls JS_EndRequest(). Also, we must
* end our request here in case we are "last" -- in that event, another
* js_DestroyContext that was not last might be waiting in the GC for our
* request to end. We'll let it run below, just before we do the truly
* final GC and then free atom state.
*/
while (cx->requestDepth != 0)
JS_EndRequest(cx);
#endif
if (last) {
js_GC(cx, GC_LAST_CONTEXT);
DUMP_EVAL_CACHE_METER(cx);
/*
* Free the script filename table if it exists and is empty. Do this
* after the last GC to avoid finalizers tripping on free memory.
*/
if (rt->scriptFilenameTable &&
rt->scriptFilenameTable->nentries == 0) {
js_FinishRuntimeScriptState(rt);
}
/* Take the runtime down, now that it has no contexts or atoms. */
JS_LOCK_GC(rt);
rt->state = JSRTS_DOWN;
JS_NOTIFY_ALL_CONDVAR(rt->stateChange);
} else {
if (mode == JSDCM_FORCE_GC)
js_GC(cx, GC_NORMAL);
else if (mode == JSDCM_MAYBE_GC)
JS_MaybeGC(cx);
JS_LOCK_GC(rt);
js_WaitForGC(rt);
}
}
#ifdef JS_THREADSAFE
js_ClearContextThread(cx);
#endif
JS_UNLOCK_GC(rt);
FreeContext(cx);
}
static void
FreeContext(JSContext *cx)
{
JSArgumentFormatMap *map;
JSLocalRootStack *lrs;
JSLocalRootChunk *lrc;
#ifdef JS_THREADSAFE
JS_ASSERT(!cx->thread);
#endif
/* Free the stuff hanging off of cx. */
js_FreeRegExpStatics(cx);
@ -578,16 +699,6 @@ js_DestroyContext(JSContext *cx, JSDestroyContextMode mode)
JS_free(cx, lrs);
}
#ifdef JS_THREADSAFE
/*
* Since cx is not on rt->contextList, it cannot be accessed by the GC
* running on another thread. Thus, compared with JS_ClearContextThread,
* we can safely unlink cx from from JSThread.contextList without taking
* the GC lock.
*/
JS_REMOVE_LINK(&cx->threadLinks);
#endif
/* Finally, free cx itself. */
free(cx);
}
@ -1504,3 +1615,33 @@ js_GetScriptedCaller(JSContext *cx, JSStackFrame *fp)
}
return NULL;
}
jsbytecode*
js_GetCurrentBytecodePC(JSContext* cx)
{
jsbytecode *pc, *imacpc;
#ifdef JS_TRACER
if (JS_ON_TRACE(cx)) {
pc = cx->bailExit->pc;
imacpc = cx->bailExit->imacpc;
} else
#endif
{
JS_ASSERT_NOT_ON_TRACE(cx); /* for static analysis */
JSStackFrame* fp = cx->fp;
if (fp && fp->regs) {
pc = fp->regs->pc;
imacpc = fp->imacpc;
} else {
return NULL;
}
}
/*
* If we are inside GetProperty_tn or similar, return a pointer to the
* current instruction in the script, not the CALL instruction in the
* imacro, for the benefit of callers doing bytecode inspection.
*/
return (*pc == JSOP_CALL && imacpc) ? imacpc : pc;
}

Просмотреть файл

@ -72,25 +72,20 @@ typedef struct JSGSNCache {
uint32 hits;
uint32 misses;
uint32 fills;
uint32 clears;
uint32 purges;
# define GSN_CACHE_METER(cache,cnt) (++(cache)->cnt)
#else
# define GSN_CACHE_METER(cache,cnt) /* nothing */
#endif
} JSGSNCache;
#define GSN_CACHE_CLEAR(cache) \
JS_BEGIN_MACRO \
(cache)->code = NULL; \
if ((cache)->table.ops) { \
JS_DHashTableFinish(&(cache)->table); \
(cache)->table.ops = NULL; \
} \
GSN_CACHE_METER(cache, clears); \
JS_END_MACRO
#define js_FinishGSNCache(cache) js_PurgeGSNCache(cache)
extern void
js_PurgeGSNCache(JSGSNCache *cache);
/* These helper macros take a cx as parameter and operate on its GSN cache. */
#define JS_CLEAR_GSN_CACHE(cx) GSN_CACHE_CLEAR(&JS_GSN_CACHE(cx))
#define JS_PURGE_GSN_CACHE(cx) js_PurgeGSNCache(&JS_GSN_CACHE(cx))
#define JS_METER_GSN_CACHE(cx,cnt) GSN_CACHE_METER(&JS_GSN_CACHE(cx), cnt)
typedef struct InterpState InterpState;
@ -125,7 +120,7 @@ struct GlobalState {
* JS_THREADSAFE) has an associated trace monitor that keeps track of loop
* frequencies for all JavaScript code loaded into that runtime.
*/
typedef struct JSTraceMonitor {
struct JSTraceMonitor {
/*
* Flag set when running (or recording) JIT-compiled code. This prevents
* both interpreter activation and last-ditch garbage collection when up
@ -176,7 +171,7 @@ typedef struct JSTraceMonitor {
/* Keep a list of recorders we need to abort on cache flush. */
CLS(TraceRecorder) abortStack;
} JSTraceMonitor;
};
typedef struct InterpStruct InterpStruct;
@ -206,11 +201,31 @@ typedef struct JSEvalCacheMeter {
} JSEvalCacheMeter;
# undef ID
# define DECLARE_EVAL_CACHE_METER JSEvalCacheMeter evalCacheMeter;
#else
# define DECLARE_EVAL_CACHE_METER /* nothing */
#endif
struct JSThreadData {
/*
* The GSN cache is per thread since even multi-cx-per-thread embeddings
* do not interleave js_GetSrcNote calls.
*/
JSGSNCache gsnCache;
/* Property cache for faster call/get/set invocation. */
JSPropertyCache propertyCache;
#ifdef JS_TRACER
/* Trace-tree JIT recorder/interpreter state. */
JSTraceMonitor traceMonitor;
#endif
/* Lock-free hashed lists of scripts created by eval to garbage-collect. */
JSScript *scriptsToGC[JS_EVAL_CACHE_SIZE];
#ifdef JS_EVAL_CACHE_METERING
JSEvalCacheMeter evalCacheMeter;
#endif
};
#ifdef JS_THREADSAFE
/*
@ -230,39 +245,29 @@ struct JSThread {
*/
uint32 gcMallocBytes;
/*
* Store the GSN cache in struct JSThread, not struct JSContext, both to
* save space and to simplify cleanup in js_GC. Any embedding (Firefox
* or another Gecko application) that uses many contexts per thread is
* unlikely to interleave js_GetSrcNote-intensive loops in the decompiler
* among two or more contexts running script in one thread.
*/
JSGSNCache gsnCache;
/* Property cache for faster call/get/set invocation. */
JSPropertyCache propertyCache;
#ifdef JS_TRACER
/* Trace-tree JIT recorder/interpreter state. */
JSTraceMonitor traceMonitor;
#endif
/* Lock-free hashed lists of scripts created by eval to garbage-collect. */
JSScript *scriptsToGC[JS_EVAL_CACHE_SIZE];
DECLARE_EVAL_CACHE_METER
JSThreadData data;
};
#define JS_CACHE_LOCUS(cx) ((cx)->thread)
#define JS_THREAD_DATA(cx) (&(cx)->thread->data)
struct JSThreadsHashEntry {
JSDHashEntryHdr base;
JSThread *thread;
};
/*
* The function takes the GC lock and does not release in successful return.
* On error (out of memory) the function releases the lock but delegates
* the error reporting to the caller.
*/
extern JSBool
js_InitContextThread(JSContext *cx);
/*
* On entrance the GC lock must be held and it will be held on exit.
*/
extern void
js_ThreadDestructorCB(void *ptr);
extern void
js_InitContextThread(JSContext *cx, JSThread *thread);
extern JSThread *
js_GetCurrentThread(JSRuntime *rt);
js_ClearContextThread(JSContext *cx);
#endif /* JS_THREADSAFE */
@ -474,6 +479,8 @@ struct JSRuntime {
* case too.
*/
PRLock *debuggerLock;
JSDHashTable threads;
#endif /* JS_THREADSAFE */
uint32 debuggerMutations;
@ -523,26 +530,9 @@ struct JSRuntime {
JSNativeEnumerator *nativeEnumerators;
#ifndef JS_THREADSAFE
/*
* For thread-unsafe embeddings, the GSN cache lives in the runtime and
* not each context, since we expect it to be filled once when decompiling
* a longer script, then hit repeatedly as js_GetSrcNote is called during
* the decompiler activation that filled it.
*/
JSGSNCache gsnCache;
JSThreadData threadData;
/* Property cache for faster call/get/set invocation. */
JSPropertyCache propertyCache;
/* Trace-tree JIT recorder/interpreter state. */
JSTraceMonitor traceMonitor;
/* Lock-free hashed lists of scripts created by eval to garbage-collect. */
JSScript *scriptsToGC[JS_EVAL_CACHE_SIZE];
DECLARE_EVAL_CACHE_METER
#define JS_CACHE_LOCUS(cx) ((cx)->runtime)
#define JS_THREAD_DATA(cx) (&(cx)->runtime->threadData)
#endif
/*
@ -652,13 +642,13 @@ struct JSRuntime {
};
/* Common macros to access thread-local caches in JSThread or JSRuntime. */
#define JS_GSN_CACHE(cx) (JS_CACHE_LOCUS(cx)->gsnCache)
#define JS_PROPERTY_CACHE(cx) (JS_CACHE_LOCUS(cx)->propertyCache)
#define JS_TRACE_MONITOR(cx) (JS_CACHE_LOCUS(cx)->traceMonitor)
#define JS_SCRIPTS_TO_GC(cx) (JS_CACHE_LOCUS(cx)->scriptsToGC)
#define JS_GSN_CACHE(cx) (JS_THREAD_DATA(cx)->gsnCache)
#define JS_PROPERTY_CACHE(cx) (JS_THREAD_DATA(cx)->propertyCache)
#define JS_TRACE_MONITOR(cx) (JS_THREAD_DATA(cx)->traceMonitor)
#define JS_SCRIPTS_TO_GC(cx) (JS_THREAD_DATA(cx)->scriptsToGC)
#ifdef JS_EVAL_CACHE_METERING
# define EVAL_CACHE_METER(x) (JS_CACHE_LOCUS(cx)->evalCacheMeter.x++)
# define EVAL_CACHE_METER(x) (JS_THREAD_DATA(cx)->evalCacheMeter.x++)
#else
# define EVAL_CACHE_METER(x) ((void) 0)
#endif
@ -1142,22 +1132,14 @@ class JSAutoResolveFlags
#define JS_HAS_XML_OPTION(cx) ((cx)->version & JSVERSION_HAS_XML || \
JSVERSION_NUMBER(cx) >= JSVERSION_1_6)
/*
* Initialize a library-wide thread private data index, and remember that it
* has already been done, so that it happens only once ever. Returns true on
* success.
*/
extern JSBool
js_InitThreadPrivateIndex(void (*ptr)(void *));
js_InitThreads(JSRuntime *rt);
/*
* Clean up thread-private data on the current thread. NSPR automatically
* cleans up thread-private data for every thread except the main thread
* (see bug 383977) on shutdown. Thus, this function should be called for
* exactly those threads that survive JS_ShutDown, including the main thread.
*/
extern JSBool
js_CleanupThreadPrivateData();
extern void
js_FinishThreads(JSRuntime *rt);
extern void
js_PurgeThreads(JSContext *cx);
/*
* Ensures the JSOPTION_XML and JSOPTION_ANONFUNFIX bits of cx->options are
@ -1388,6 +1370,9 @@ js_InvokeOperationCallback(JSContext *cx);
extern JSStackFrame *
js_GetScriptedCaller(JSContext *cx, JSStackFrame *fp);
extern jsbytecode*
js_GetCurrentBytecodePC(JSContext* cx);
#ifdef JS_TRACER
/*
* Reconstruct the JS stack and clear cx->onTrace. We must be currently

Просмотреть файл

@ -124,7 +124,7 @@ js_UntrapScriptCode(JSContext *cx, JSScript *script)
if (!code)
break;
memcpy(code, script->code, nbytes);
JS_CLEAR_GSN_CACHE(cx);
JS_PURGE_GSN_CACHE(cx);
}
code[trap->pc - script->code] = trap->op;
}

Просмотреть файл

@ -2713,4 +2713,8 @@ js_FreezeLocalNames(JSContext *cx, JSFunction *fun)
if (array)
fun->u.i.names.array = array;
}
#ifdef DEBUG
if (n > MAX_ARRAY_LOCALS)
JS_DHashMarkTableImmutable(&fun->u.i.names.map->names);
#endif
}

Просмотреть файл

@ -121,8 +121,8 @@ struct JSFunction {
#ifdef JS_TRACER
/* MSVC demands the intermediate (void *) cast here. */
# define JS_TN(name,fastcall,nargs,flags,trcinfo) \
{name, JS_DATA_TO_FUNC_PTR(JSNative, trcinfo), nargs, \
(flags) | JSFUN_FAST_NATIVE | JSFUN_STUB_GSOPS | JSFUN_TRACEABLE, 0}
JS_FN(name, JS_DATA_TO_FUNC_PTR(JSNative, trcinfo), nargs, \
(flags) | JSFUN_FAST_NATIVE | JSFUN_STUB_GSOPS | JSFUN_TRACEABLE)
#else
# define JS_TN(name,fastcall,nargs,flags,trcinfo) \
JS_FN(name, fastcall, nargs, flags)

Просмотреть файл

@ -3110,24 +3110,34 @@ js_TraceContext(JSTracer *trc, JSContext *acx)
js_TraceRegExpStatics(trc, acx);
}
void
js_TraceTraceMonitor(JSTracer *trc, JSTraceMonitor *tm)
#ifdef JS_TRACER
static void
MarkReservedObjects(JSTraceMonitor *tm)
{
if (IS_GC_MARKING_TRACER(trc)) {
tm->reservedDoublePoolPtr = tm->reservedDoublePool;
tm->needFlush = JS_TRUE;
/* Keep the reserved objects. */
for (JSObject *obj = tm->reservedObjects; obj; obj = JSVAL_TO_OBJECT(obj->fslots[0])) {
uint8 *flagp = GetGCThingFlags(obj);
JS_ASSERT((*flagp & GCF_TYPEMASK) == GCX_OBJECT);
JS_ASSERT(*flagp != GCF_FINAL);
*flagp |= GCF_MARK;
}
/* Keep the reserved objects. */
for (JSObject *obj = tm->reservedObjects; obj; obj = JSVAL_TO_OBJECT(obj->fslots[0])) {
uint8 *flagp = GetGCThingFlags(obj);
JS_ASSERT((*flagp & GCF_TYPEMASK) == GCX_OBJECT);
JS_ASSERT(*flagp != GCF_FINAL);
*flagp |= GCF_MARK;
}
}
#ifdef JS_THREADSAFE
static JSDHashOperator
reserved_objects_marker(JSDHashTable *table, JSDHashEntryHdr *hdr,
uint32, void *)
{
JSThread *thread = ((JSThreadsHashEntry *) hdr)->thread;
MarkReservedObjects(&thread->data.traceMonitor);
return JS_DHASH_NEXT;
}
#endif
#endif
JS_REQUIRES_STACK void
js_TraceRuntime(JSTracer *trc, JSBool allAtoms)
{
@ -3154,16 +3164,15 @@ js_TraceRuntime(JSTracer *trc, JSBool allAtoms)
JS_CALL_OBJECT_TRACER(trc, rt->builtinFunctions[i], "builtin function");
}
/* Mark the reserved objects unless we are shutting down. */
if (IS_GC_MARKING_TRACER(trc) && rt->state != JSRTS_LANDING) {
#ifdef JS_THREADSAFE
/* Trace the loop table(s) which can contain pointers to code objects. */
while ((acx = js_ContextIterator(rt, JS_FALSE, &iter)) != NULL) {
if (!acx->thread)
continue;
js_TraceTraceMonitor(trc, &acx->thread->traceMonitor);
}
JS_DHashTableEnumerate(&rt->threads, reserved_objects_marker, NULL);
#else
js_TraceTraceMonitor(trc, &rt->traceMonitor);
MarkReservedObjects(&rt->threadData.traceMonitor);
#endif
}
#endif
}
@ -3242,15 +3251,18 @@ ProcessSetSlotRequest(JSContext *cx, JSSetSlotRequest *ssr)
STOBJ_SET_DELEGATE(pobj);
}
static void
DestroyScriptsToGC(JSContext *cx, JSScript **listp)
void
js_DestroyScriptsToGC(JSContext *cx, JSThreadData *data)
{
JSScript *script;
JSScript **listp, *script;
while ((script = *listp) != NULL) {
*listp = script->u.nextToGC;
script->u.nextToGC = NULL;
js_DestroyScript(cx, script);
for (size_t i = 0; i != JS_ARRAY_LENGTH(data->scriptsToGC); ++i) {
listp = &data->scriptsToGC[i];
while ((script = *listp) != NULL) {
*listp = script->u.nextToGC;
script->u.nextToGC = NULL;
js_DestroyScript(cx, script);
}
}
}
@ -3282,7 +3294,14 @@ js_GC(JSContext *cx, JSGCInvocationKind gckind)
JS_ASSERT_IF(gckind == GC_LAST_DITCH, !JS_ON_TRACE(cx));
rt = cx->runtime;
#ifdef JS_THREADSAFE
/*
* We allow js_GC calls outside a request but the context must be bound
* to the current thread.
*/
JS_ASSERT(CURRENT_THREAD_IS_ME(cx->thread));
/* Avoid deadlock. */
JS_ASSERT(!JS_IS_RUNTIME_LOCKED(rt));
#endif
@ -3358,11 +3377,10 @@ js_GC(JSContext *cx, JSGCInvocationKind gckind)
/*
* If we're in one or more requests (possibly on more than one context)
* running on the current thread, indicate, temporarily, that all these
* requests are inactive. If cx->thread is NULL, then cx is not using
* the request model, and does not contribute to rt->requestCount.
* requests are inactive.
*/
requestDebit = 0;
if (cx->thread) {
{
JSCList *head, *link;
/*
@ -3376,17 +3394,6 @@ js_GC(JSContext *cx, JSGCInvocationKind gckind)
if (acx->requestDepth)
requestDebit++;
}
} else {
/*
* We assert, but check anyway, in case someone is misusing the API.
* Avoiding the loop over all of rt's contexts is a win in the event
* that the GC runs only on request-less contexts with null threads,
* in a special thread such as might be used by the UI/DOM/Layout
* "mozilla" or "main" thread in Mozilla-the-browser.
*/
JS_ASSERT(cx->requestDepth == 0);
if (cx->requestDepth)
requestDebit = 1;
}
if (requestDebit) {
JS_ASSERT(requestDebit <= rt->requestCount);
@ -3496,43 +3503,10 @@ js_GC(JSContext *cx, JSGCInvocationKind gckind)
}
#endif
/* Clear property and JIT oracle caches (only for cx->thread if JS_THREADSAFE). */
js_FlushPropertyCache(cx);
#ifdef JS_TRACER
js_FlushJITOracle(cx);
#endif
/* Destroy eval'ed scripts. */
for (i = 0; i < JS_ARRAY_LENGTH(JS_SCRIPTS_TO_GC(cx)); i++)
DestroyScriptsToGC(cx, &JS_SCRIPTS_TO_GC(cx)[i]);
#ifdef JS_THREADSAFE
/*
* Clear thread-based caches. To avoid redundant clearing we unroll the
* current thread's step.
*
* In case a JSScript wrapped within an object was finalized, we null
* acx->thread->gsnCache.script and finish the cache's hashtable. Note
* that js_DestroyScript, called from script_finalize, will have already
* cleared cx->thread->gsnCache above during finalization, so we don't
* have to here.
*/
iter = NULL;
while ((acx = js_ContextIterator(rt, JS_FALSE, &iter)) != NULL) {
if (!acx->thread || acx->thread == cx->thread)
continue;
GSN_CACHE_CLEAR(&acx->thread->gsnCache);
js_FlushPropertyCache(acx);
#ifdef JS_TRACER
js_FlushJITOracle(acx);
#endif
for (i = 0; i < JS_ARRAY_LENGTH(acx->thread->scriptsToGC); i++)
DestroyScriptsToGC(cx, &acx->thread->scriptsToGC[i]);
}
#else
/* The thread-unsafe case just has to clear the runtime's GSN cache. */
GSN_CACHE_CLEAR(&rt->gsnCache);
js_PurgeJITOracle();
#endif
js_PurgeThreads(cx);
restart:
rt->gcNumber++;

Просмотреть файл

@ -340,6 +340,9 @@ extern const JSGCFreeListSet js_GCEmptyFreeListSet;
extern void
js_RevokeGCLocalFreeLists(JSContext *cx);
extern void
js_DestroyScriptsToGC(JSContext *cx, JSThreadData *data);
struct JSWeakRoots {
/* Most recently created things by type, members of the GC's root set. */
void *newborn[GCX_NTYPES];

Просмотреть файл

@ -170,7 +170,13 @@ js_FillPropertyCache(JSContext *cx, JSObject *obj, jsuword kshape,
tmp = obj;
for (;;) {
tmp = OBJ_GET_PROTO(cx, tmp);
if (!tmp) {
/*
* We cannot cache properties coming from native objects behind
* non-native ones on the prototype chain. The non-natives can
* mutate in arbitrary way without changing any shapes.
*/
if (!tmp || !OBJ_IS_NATIVE(tmp)) {
PCMETER(cache->noprotos++);
*entryp = NULL;
return;
@ -426,11 +432,8 @@ js_FullTestPropertyCache(JSContext *cx, jsbytecode *pc,
JS_STATIC_ASSERT(PCVAL_NULL == 0);
void
js_FlushPropertyCache(JSContext *cx)
js_PurgePropertyCache(JSContext *cx, JSPropertyCache *cache)
{
JSPropertyCache *cache;
cache = &JS_PROPERTY_CACHE(cx);
if (cache->empty) {
ASSERT_CACHE_IS_EMPTY(cache);
return;
@ -498,7 +501,7 @@ js_FlushPropertyCache(JSContext *cx)
}
void
js_FlushPropertyCacheForScript(JSContext *cx, JSScript *script)
js_PurgePropertyCacheForScript(JSContext *cx, JSScript *script)
{
JSPropertyCache *cache;
JSPropCacheEntry *entry;
@ -564,6 +567,9 @@ js_AllocRawStack(JSContext *cx, uintN nslots, void **markp)
{
jsval *sp;
JS_ASSERT(nslots != 0);
js_LeaveTrace(cx);
if (!cx->stackPool.first.next) {
int64 *timestamp;
@ -5086,7 +5092,6 @@ js_Interpret(JSContext *cx)
if (!cx->rval2set) {
op2 = js_GetOpcode(cx, script, regs.pc + JSOP_SETCALL_LENGTH);
if (op2 != JSOP_DELELEM) {
JS_ASSERT(!(js_CodeSpec[op2].format & JOF_DEL));
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL,
JSMSG_BAD_LEFTSIDE_OF_ASS);
goto error;

Просмотреть файл

@ -390,11 +390,14 @@ js_FullTestPropertyCache(JSContext *cx, jsbytecode *pc,
JSObject **objp, JSObject **pobjp,
JSPropCacheEntry **entryp);
extern void
js_FlushPropertyCache(JSContext *cx);
/* The property cache does not need a destructor. */
#define js_FinishPropertyCache(cache) ((void) 0)
extern void
js_FlushPropertyCacheForScript(JSContext *cx, JSScript *script);
js_PurgePropertyCache(JSContext *cx, JSPropertyCache *cache);
extern void
js_PurgePropertyCacheForScript(JSContext *cx, JSScript *script);
extern void
js_DisablePropertyCache(JSContext *cx);

Просмотреть файл

@ -787,6 +787,17 @@ js_NewNumberInRootedValue(JSContext *cx, jsdouble d, jsval *vp)
return js_NewDoubleInRootedValue(cx, d, vp);
}
JSBool
js_NewWeaklyRootedNumber(JSContext *cx, jsdouble d, jsval *rval)
{
jsint i;
if (JSDOUBLE_IS_INT(d, i) && INT_FITS_IN_JSVAL(i)) {
*rval = INT_TO_JSVAL(i);
return JS_TRUE;
}
return JS_NewDoubleValue(cx, d, rval);
}
/*
* Convert a number to C string. The buf must be large enough to accommodate
* the result, including '-' and '\0', if base == 10 or d is an integer that

Просмотреть файл

@ -178,6 +178,13 @@ extern const char js_parseInt_str[];
extern JSBool
js_NewNumberInRootedValue(JSContext *cx, jsdouble d, jsval *vp);
/*
* Create a weakly rooted integer or double jsval as appropriate for the given
* jsdouble.
*/
extern JSBool
js_NewWeaklyRootedNumber(JSContext *cx, jsdouble d, jsval *vp);
/* Convert a number to a GC'ed string. */
extern JSString * JS_FASTCALL
js_NumberToString(JSContext *cx, jsdouble d);

Просмотреть файл

@ -4203,35 +4203,6 @@ js_NativeSet(JSContext *cx, JSObject *obj, JSScopeProperty *sprop, jsval *vp)
return JS_TRUE;
}
static jsbytecode*
js_GetCurrentBytecodePC(JSContext* cx)
{
jsbytecode *pc, *imacpc;
#ifdef JS_TRACER
if (JS_ON_TRACE(cx)) {
pc = cx->bailExit->pc;
imacpc = cx->bailExit->imacpc;
} else
#endif
{
JS_ASSERT_NOT_ON_TRACE(cx); /* for static analysis */
if (cx->fp && cx->fp->regs) {
pc = cx->fp->regs->pc;
imacpc = cx->fp->imacpc;
} else {
return NULL;
}
}
/*
* If we are inside GetProperty_tn or similar, return a pointer to the
* current instruction in the script, not the CALL instruction in the
* imacro, for the benefit of callers doing bytecode inspection.
*/
return (*pc == JSOP_CALL && imacpc) ? imacpc : pc;
}
JSBool
js_GetPropertyHelper(JSContext *cx, JSObject *obj, jsid id, jsval *vp,
JSPropCacheEntry **entryp)

Просмотреть файл

@ -996,29 +996,6 @@ struct BindData {
} u;
};
static JSBool
BindArg(JSContext *cx, JSAtom *atom, JSTreeContext *tc)
{
const char *name;
/*
* Check for a duplicate parameter name, a "feature" required by ECMA-262.
*/
JS_ASSERT(tc->flags & TCF_IN_FUNCTION);
if (js_LookupLocal(cx, tc->u.fun, atom, NULL) != JSLOCAL_NONE) {
name = js_AtomToPrintableString(cx, atom);
if (!name ||
!js_ReportCompileErrorNumber(cx, TS(tc->parseContext), NULL,
JSREPORT_WARNING | JSREPORT_STRICT,
JSMSG_DUPLICATE_FORMAL,
name)) {
return JS_FALSE;
}
}
return js_AddLocal(cx, tc->u.fun, atom, JSLOCAL_ARG);
}
static JSBool
BindLocalVariable(JSContext *cx, JSFunction *fun, JSAtom *atom,
JSLocalKind localKind)
@ -1050,7 +1027,6 @@ BindDestructuringArg(JSContext *cx, BindData *data, JSAtom *atom,
JSTreeContext *tc)
{
JSAtomListElement *ale;
const char *name;
JS_ASSERT(tc->flags & TCF_IN_FUNCTION);
ATOM_LIST_SEARCH(ale, &tc->decls, atom);
@ -1062,19 +1038,11 @@ BindDestructuringArg(JSContext *cx, BindData *data, JSAtom *atom,
}
if (js_LookupLocal(cx, tc->u.fun, atom, NULL) != JSLOCAL_NONE) {
name = js_AtomToPrintableString(cx, atom);
if (!name ||
!js_ReportCompileErrorNumber(cx, TS(tc->parseContext), data->pn,
JSREPORT_WARNING | JSREPORT_STRICT,
JSMSG_DUPLICATE_FORMAL,
name)) {
return JS_FALSE;
}
} else {
if (!BindLocalVariable(cx, tc->u.fun, atom, JSLOCAL_VAR))
return JS_FALSE;
js_ReportCompileErrorNumber(cx, TS(tc->parseContext), NULL,
JSREPORT_ERROR, JSMSG_DESTRUCT_DUP_ARG);
return JS_FALSE;
}
return JS_TRUE;
return BindLocalVariable(cx, tc->u.fun, atom, JSLOCAL_VAR);
}
#endif /* JS_HAS_DESTRUCTURING */
@ -1131,6 +1099,7 @@ FunctionDef(JSContext *cx, JSTokenStream *ts, JSTreeContext *tc,
JSTreeContext funtc;
#if JS_HAS_DESTRUCTURING
JSParseNode *item, *list = NULL;
bool destructuringArg = false, duplicatedArg = false;
#endif
/* Make a TOK_FUNCTION node. */
@ -1255,6 +1224,11 @@ FunctionDef(JSContext *cx, JSTokenStream *ts, JSTreeContext *tc,
JSParseNode *lhs, *rhs;
jsint slot;
/* See comment below in the TOK_NAME case. */
if (duplicatedArg)
goto report_dup_and_destructuring;
destructuringArg = true;
/*
* A destructuring formal parameter turns into one or more
* local variables initialized from properties of a single
@ -1305,14 +1279,48 @@ FunctionDef(JSContext *cx, JSTokenStream *ts, JSTreeContext *tc,
#endif /* JS_HAS_DESTRUCTURING */
case TOK_NAME:
if (!BindArg(cx, CURRENT_TOKEN(ts).t_atom, &funtc))
{
/*
* Check for a duplicate parameter name, a "feature" that
* ECMA-262 requires. Still if any argument is a destructuring
* pattern, we will report error either now or later, when we
* find the first pattern.
*/
JSAtom *atom = CURRENT_TOKEN(ts).t_atom;
if (js_LookupLocal(cx, fun, atom, NULL) != JSLOCAL_NONE) {
#if JS_HAS_DESTRUCTURING
if (destructuringArg)
goto report_dup_and_destructuring;
duplicatedArg = true;
#endif
const char *name = js_AtomToPrintableString(cx, atom);
if (!name ||
!js_ReportCompileErrorNumber(cx, TS(tc->parseContext),
NULL,
JSREPORT_WARNING |
JSREPORT_STRICT,
JSMSG_DUPLICATE_FORMAL,
name)) {
return NULL;
}
}
if (!js_AddLocal(cx, fun, atom, JSLOCAL_ARG))
return NULL;
break;
}
default:
js_ReportCompileErrorNumber(cx, ts, NULL, JSREPORT_ERROR,
JSMSG_MISSING_FORMAL);
return NULL;
#if JS_HAS_DESTRUCTURING
report_dup_and_destructuring:
js_ReportCompileErrorNumber(cx, TS(tc->parseContext), NULL,
JSREPORT_ERROR,
JSMSG_DESTRUCT_DUP_ARG);
return NULL;
#endif
}
} while (js_MatchToken(cx, ts, TOK_COMMA));

Просмотреть файл

@ -101,10 +101,12 @@ typedef struct JSPropCacheEntry JSPropCacheEntry;
typedef struct JSSharpObjectMap JSSharpObjectMap;
typedef struct JSTempValueRooter JSTempValueRooter;
typedef struct JSThread JSThread;
typedef struct JSThreadData JSThreadData;
typedef struct JSToken JSToken;
typedef struct JSTokenPos JSTokenPos;
typedef struct JSTokenPtr JSTokenPtr;
typedef struct JSTokenStream JSTokenStream;
typedef struct JSTraceMonitor JSTraceMonitor;
typedef struct JSTreeContext JSTreeContext;
typedef struct JSTryNote JSTryNote;
typedef struct JSWeakRoots JSWeakRoots;

Просмотреть файл

@ -1267,7 +1267,14 @@ ParseTerm(CompilerState *state)
/* Treat this as an octal escape. */
goto doOctal;
}
JS_ASSERT(1 <= num && num <= 0x10000);
/*
* When FindParenCount calls the regex parser recursively (to find
* the number of backrefs) num can be arbitrary and the maximum
* supported number of backrefs does not bound it.
*/
JS_ASSERT_IF(!(state->flags & JSREG_FIND_PAREN_COUNT),
1 <= num && num <= 0x10000);
state->result = NewRENode(state, REOP_BACKREF);
if (!state->result)
return JS_FALSE;

Просмотреть файл

@ -1579,13 +1579,13 @@ js_DestroyScript(JSContext *cx, JSScript *script)
JSPRINCIPALS_DROP(cx, script->principals);
if (JS_GSN_CACHE(cx).code == script->code)
JS_CLEAR_GSN_CACHE(cx);
JS_PURGE_GSN_CACHE(cx);
/*
* The GC flushes all property caches, so no need to purge just the
* entries for this script.
*
* JS_THREADSAFE note: js_FlushPropertyCacheForScript flushes only the
* JS_THREADSAFE note: js_PurgePropertyCacheForScript purges only the
* current thread's property cache, so a script not owned by a function
* or object, which hands off lifetime management for that script to the
* GC, must be used by only one thread over its lifetime.
@ -1606,9 +1606,9 @@ js_DestroyScript(JSContext *cx, JSScript *script)
#ifdef CHECK_SCRIPT_OWNER
JS_ASSERT(script->owner == cx->thread);
#endif
js_FlushPropertyCacheForScript(cx, script);
js_PurgePropertyCacheForScript(cx, script);
#ifdef JS_TRACER
js_FlushScriptFragments(cx, script);
js_PurgeScriptFragments(cx, script);
#endif
}
}
@ -1677,6 +1677,17 @@ typedef struct GSNCacheEntry {
#define GSN_CACHE_THRESHOLD 100
void
js_PurgeGSNCache(JSGSNCache *cache)
{
cache->code = NULL;
if (cache->table.ops) {
JS_DHashTableFinish(&cache->table);
cache->table.ops = NULL;
}
GSN_CACHE_METER(cache, purges);
}
jssrcnote *
js_GetSrcNoteCached(JSContext *cx, JSScript *script, jsbytecode *pc)
{
@ -1714,7 +1725,7 @@ js_GetSrcNoteCached(JSContext *cx, JSScript *script, jsbytecode *pc)
if (JS_GSN_CACHE(cx).code != script->code &&
script->length >= GSN_CACHE_THRESHOLD) {
JS_CLEAR_GSN_CACHE(cx);
JS_PURGE_GSN_CACHE(cx);
nsrcnotes = 0;
for (sn = SCRIPT_NOTES(script); !SN_IS_TERMINATOR(sn);
sn = SN_NEXT(sn)) {

Просмотреть файл

@ -167,16 +167,6 @@ js_ConcatStrings(JSContext *cx, JSString *left, JSString *right)
n = ln + rn;
s[n] = 0;
#ifdef JS_TRACER
/*
* Lame hack to avoid trying to deep-bail (@js_ReportAllocationOverflow)
* when called directly from trace. Instead, retry from the interpreter.
* See bug 477351.
*/
if (n > JSSTRING_LENGTH_MASK && JS_ON_TRACE(cx) && !cx->bailExit)
return NULL;
#endif
str = js_NewString(cx, s, n);
if (!str) {
/* Out of memory: clean up any space we (re-)allocated. */
@ -608,21 +598,7 @@ str_resolve(JSContext *cx, JSObject *obj, jsval id, uintN flags,
JSString *str, *str1;
jsint slot;
if (flags & JSRESOLVE_ASSIGNING)
return JS_TRUE;
if (id == ATOM_KEY(cx->runtime->atomState.lengthAtom)) {
v = OBJ_GET_SLOT(cx, obj, JSSLOT_PRIVATE);
str = JSVAL_TO_STRING(v);
if (!OBJ_DEFINE_PROPERTY(cx, obj, id, INT_TO_JSVAL(17), NULL, NULL,
JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_SHARED, NULL)) {
return JS_FALSE;
}
*objp = obj;
return JS_TRUE;
}
if (!JSVAL_IS_INT(id))
if (!JSVAL_IS_INT(id) || (flags & JSRESOLVE_ASSIGNING))
return JS_TRUE;
v = OBJ_GET_SLOT(cx, obj, JSSLOT_PRIVATE);
@ -809,24 +785,6 @@ String_p_toString(JSContext* cx, JSObject* obj)
JS_ASSERT(JSVAL_IS_STRING(v));
return JSVAL_TO_STRING(v);
}
static JSString* FASTCALL
String_p_substring(JSContext* cx, JSString* str, int32 begin, int32 end)
{
JS_ASSERT(JS_ON_TRACE(cx));
size_t length = JSSTRING_LENGTH(str);
return SubstringTail(cx, str, length, begin, end);
}
static JSString* FASTCALL
String_p_substring_1(JSContext* cx, JSString* str, int32 begin)
{
JS_ASSERT(JS_ON_TRACE(cx));
size_t length = JSSTRING_LENGTH(str);
return SubstringTail(cx, str, length, begin, length);
}
#endif
JSString* JS_FASTCALL
@ -1498,39 +1456,9 @@ StringMatchHelper(JSContext *cx, uintN argc, jsval *vp, jsbytecode *pc)
static JSBool
str_match(JSContext *cx, uintN argc, jsval *vp)
{
JSStackFrame *fp;
for (fp = js_GetTopStackFrame(cx); fp && !fp->regs; fp = fp->down)
JS_ASSERT(!fp->script);
return StringMatchHelper(cx, argc, vp, fp ? fp->regs->pc : NULL);
return StringMatchHelper(cx, argc, vp, js_GetCurrentBytecodePC(cx));
}
#ifdef JS_TRACER
static jsval FASTCALL
String_p_match(JSContext* cx, JSString* str, jsbytecode *pc, JSObject* regexp)
{
jsval vp[3] = { JSVAL_NULL, STRING_TO_JSVAL(str), OBJECT_TO_JSVAL(regexp) };
JSAutoTempValueRooter tvr(cx, 3, vp);
if (!StringMatchHelper(cx, 1, vp, pc)) {
cx->builtinStatus |= JSBUILTIN_ERROR;
return JSVAL_VOID;
}
return vp[0];
}
static jsval FASTCALL
String_p_match_obj(JSContext* cx, JSObject* str, jsbytecode *pc, JSObject* regexp)
{
jsval vp[3] = { JSVAL_NULL, OBJECT_TO_JSVAL(str), OBJECT_TO_JSVAL(regexp) };
JSAutoTempValueRooter tvr(cx, 3, vp);
if (!StringMatchHelper(cx, 1, vp, pc)) {
cx->builtinStatus |= JSBUILTIN_ERROR;
return JSVAL_VOID;
}
return vp[0];
}
#endif
static JSBool
str_search(JSContext *cx, uintN argc, jsval *vp)
{
@ -1612,7 +1540,7 @@ interpret_dollar(JSContext *cx, jschar *dp, jschar *ep, ReplaceData *rdata,
return NULL;
}
static JSBool
static JS_REQUIRES_STACK JSBool
find_replen(JSContext *cx, ReplaceData *rdata, size_t *sizep)
{
JSString *repstr;
@ -1628,8 +1556,6 @@ find_replen(JSContext *cx, ReplaceData *rdata, size_t *sizep)
void *mark;
JSBool ok;
JS_ASSERT_NOT_ON_TRACE(cx);
/*
* Save the regExpStatics from the current regexp, since they may be
* clobbered by a RegExp usage in the lambda function. Note that all
@ -1778,7 +1704,7 @@ replace_destroy(JSContext *cx, GlobData *data)
rdata->chars = NULL;
}
static JSBool
static JS_REQUIRES_STACK JSBool
replace_glob(JSContext *cx, jsint count, GlobData *data)
{
ReplaceData *rdata;
@ -1814,7 +1740,7 @@ replace_glob(JSContext *cx, jsint count, GlobData *data)
return JS_TRUE;
}
static JSBool
static JS_REQUIRES_STACK JSBool
str_replace(JSContext *cx, uintN argc, jsval *vp)
{
JSObject *lambda;
@ -1833,51 +1759,7 @@ str_replace(JSContext *cx, uintN argc, jsval *vp)
return js_StringReplaceHelper(cx, argc, lambda, repstr, vp);
}
#ifdef JS_TRACER
static JSString* FASTCALL
String_p_replace_str(JSContext* cx, JSString* str, JSObject* regexp, JSString* repstr)
{
/* Make sure we will not call regexp.toString() later. This is not a _FAIL builtin. */
if (OBJ_GET_CLASS(cx, regexp) != &js_RegExpClass)
return NULL;
jsval vp[4] = {
JSVAL_NULL, STRING_TO_JSVAL(str), OBJECT_TO_JSVAL(regexp), STRING_TO_JSVAL(repstr)
};
if (!js_StringReplaceHelper(cx, 2, NULL, repstr, vp))
return NULL;
JS_ASSERT(JSVAL_IS_STRING(vp[0]));
return JSVAL_TO_STRING(vp[0]);
}
static JSString* FASTCALL
String_p_replace_str2(JSContext* cx, JSString* str, JSString* patstr, JSString* repstr)
{
jsval vp[4] = {
JSVAL_NULL, STRING_TO_JSVAL(str), STRING_TO_JSVAL(patstr), STRING_TO_JSVAL(repstr)
};
if (!js_StringReplaceHelper(cx, 2, NULL, repstr, vp))
return NULL;
JS_ASSERT(JSVAL_IS_STRING(vp[0]));
return JSVAL_TO_STRING(vp[0]);
}
static JSString* FASTCALL
String_p_replace_str3(JSContext* cx, JSString* str, JSString* patstr, JSString* repstr,
JSString* flagstr)
{
jsval vp[5] = {
JSVAL_NULL, STRING_TO_JSVAL(str), STRING_TO_JSVAL(patstr), STRING_TO_JSVAL(repstr),
STRING_TO_JSVAL(flagstr)
};
if (!js_StringReplaceHelper(cx, 3, NULL, repstr, vp))
return NULL;
JS_ASSERT(JSVAL_IS_STRING(vp[0]));
return JSVAL_TO_STRING(vp[0]);
}
#endif
JSBool
JSBool JS_REQUIRES_STACK
js_StringReplaceHelper(JSContext *cx, uintN argc, JSObject *lambda,
JSString *repstr, jsval *vp)
{
@ -2178,19 +2060,6 @@ str_split(JSContext *cx, uintN argc, jsval *vp)
return ok;
}
#ifdef JS_TRACER
static JSObject* FASTCALL
String_p_split(JSContext* cx, JSString* str, JSString* sepstr)
{
// FIXME: Avoid building and then parsing this array.
jsval vp[4] = { JSVAL_NULL, STRING_TO_JSVAL(str), STRING_TO_JSVAL(sepstr), JSVAL_VOID };
if (!str_split(cx, 2, vp))
return NULL;
JS_ASSERT(JSVAL_IS_OBJECT(vp[0]));
return JSVAL_TO_OBJECT(vp[0]);
}
#endif
#if JS_HAS_PERL_SUBSTR
static JSBool
str_substr(JSContext *cx, uintN argc, jsval *vp)
@ -2269,39 +2138,6 @@ str_concat(JSContext *cx, uintN argc, jsval *vp)
return JS_TRUE;
}
#ifdef JS_TRACER
static JSString* FASTCALL
String_p_concat_1int(JSContext* cx, JSString* str, int32 i)
{
// FIXME: should be able to use stack buffer and avoid istr...
JSString* istr = js_NumberToString(cx, i);
if (!istr)
return NULL;
return js_ConcatStrings(cx, str, istr);
}
static JSString* FASTCALL
String_p_concat_2str(JSContext* cx, JSString* str, JSString* a, JSString* b)
{
str = js_ConcatStrings(cx, str, a);
if (str)
return js_ConcatStrings(cx, str, b);
return NULL;
}
static JSString* FASTCALL
String_p_concat_3str(JSContext* cx, JSString* str, JSString* a, JSString* b, JSString* c)
{
str = js_ConcatStrings(cx, str, a);
if (str) {
str = js_ConcatStrings(cx, str, b);
if (str)
return js_ConcatStrings(cx, str, c);
}
return NULL;
}
#endif
static JSBool
str_slice(JSContext *cx, uintN argc, jsval *vp)
{
@ -2552,32 +2388,13 @@ JS_DEFINE_CALLINFO_2(extern, INT32, js_CompareStrings, STRING, STRING,
JS_DEFINE_TRCINFO_1(str_toString,
(2, (extern, STRING_RETRY, String_p_toString, CONTEXT, THIS, 1, 1)))
JS_DEFINE_TRCINFO_2(str_substring,
(4, (static, STRING_RETRY, String_p_substring, CONTEXT, THIS_STRING, INT32, INT32, 1, 1)),
(3, (static, STRING_RETRY, String_p_substring_1, CONTEXT, THIS_STRING, INT32, 1, 1)))
JS_DEFINE_TRCINFO_1(str_charAt,
(3, (extern, STRING_RETRY, js_String_getelem, CONTEXT, THIS_STRING, INT32, 1, 1)))
JS_DEFINE_TRCINFO_2(str_charCodeAt,
(1, (extern, DOUBLE, js_String_p_charCodeAt0, THIS_STRING, 1, 1)),
(2, (extern, DOUBLE, js_String_p_charCodeAt, THIS_STRING, DOUBLE, 1, 1)))
JS_DEFINE_TRCINFO_4(str_concat,
(3, (static, STRING_RETRY, String_p_concat_1int, CONTEXT, THIS_STRING, INT32, 1, 1)),
(3, (extern, STRING_RETRY, js_ConcatStrings, CONTEXT, THIS_STRING, STRING, 1, 1)),
(4, (static, STRING_RETRY, String_p_concat_2str, CONTEXT, THIS_STRING, STRING, STRING, 1, 1)),
(5, (static, STRING_RETRY, String_p_concat_3str, CONTEXT, THIS_STRING, STRING, STRING, STRING, 1, 1)))
JS_DEFINE_TRCINFO_2(str_match,
(4, (static, JSVAL_FAIL, String_p_match, CONTEXT, THIS_STRING, PC, REGEXP, 1, 1)),
(4, (static, JSVAL_FAIL, String_p_match_obj, CONTEXT, THIS, PC, REGEXP, 1, 1)))
JS_DEFINE_TRCINFO_3(str_replace,
(4, (static, STRING_RETRY, String_p_replace_str, CONTEXT, THIS_STRING, REGEXP, STRING, 1, 1)),
(4, (static, STRING_RETRY, String_p_replace_str2, CONTEXT, THIS_STRING, STRING, STRING, 1, 1)),
(5, (static, STRING_RETRY, String_p_replace_str3, CONTEXT, THIS_STRING, STRING, STRING, STRING, 1, 1)))
JS_DEFINE_TRCINFO_1(str_split,
(3, (static, OBJECT_RETRY, String_p_split, CONTEXT, THIS_STRING, STRING, 0, 0)))
JS_DEFINE_TRCINFO_1(str_toLowerCase,
(2, (extern, STRING_RETRY, js_toLowerCase, CONTEXT, THIS_STRING, 1, 1)))
JS_DEFINE_TRCINFO_1(str_toUpperCase,
(2, (extern, STRING_RETRY, js_toUpperCase, CONTEXT, THIS_STRING, 1, 1)))
JS_DEFINE_TRCINFO_1(str_concat,
(3, (extern, STRING_RETRY, js_ConcatStrings, CONTEXT, THIS_STRING, STRING, 1, 1)))
#define GENERIC JSFUN_GENERIC_NATIVE
#define PRIMITIVE JSFUN_THISP_PRIMITIVE
@ -2593,9 +2410,9 @@ static JSFunctionSpec string_methods[] = {
JS_TN(js_toString_str, str_toString, 0,JSFUN_THISP_STRING, str_toString_trcinfo),
JS_FN(js_valueOf_str, str_toString, 0,JSFUN_THISP_STRING),
JS_FN(js_toJSON_str, str_toString, 0,JSFUN_THISP_STRING),
JS_TN("substring", str_substring, 2,GENERIC_PRIMITIVE, str_substring_trcinfo),
JS_TN("toLowerCase", str_toLowerCase, 0,GENERIC_PRIMITIVE, str_toLowerCase_trcinfo),
JS_TN("toUpperCase", str_toUpperCase, 0,GENERIC_PRIMITIVE, str_toUpperCase_trcinfo),
JS_FN("substring", str_substring, 2,GENERIC_PRIMITIVE),
JS_FN("toLowerCase", str_toLowerCase, 0,GENERIC_PRIMITIVE),
JS_FN("toUpperCase", str_toUpperCase, 0,GENERIC_PRIMITIVE),
JS_TN("charAt", str_charAt, 1,GENERIC_PRIMITIVE, str_charAt_trcinfo),
JS_TN("charCodeAt", str_charCodeAt, 1,GENERIC_PRIMITIVE, str_charCodeAt_trcinfo),
JS_FN("indexOf", str_indexOf, 1,GENERIC_PRIMITIVE),
@ -2608,10 +2425,10 @@ static JSFunctionSpec string_methods[] = {
JS_FN("localeCompare", str_localeCompare, 1,GENERIC_PRIMITIVE),
/* Perl-ish methods (search is actually Python-esque). */
JS_TN("match", str_match, 1,GENERIC_PRIMITIVE, str_match_trcinfo),
JS_FN("match", str_match, 1,GENERIC_PRIMITIVE),
JS_FN("search", str_search, 1,GENERIC_PRIMITIVE),
JS_TN("replace", str_replace, 2,GENERIC_PRIMITIVE, str_replace_trcinfo),
JS_TN("split", str_split, 2,GENERIC_PRIMITIVE, str_split_trcinfo),
JS_FN("replace", str_replace, 2,GENERIC_PRIMITIVE),
JS_FN("split", str_split, 2,GENERIC_PRIMITIVE),
#if JS_HAS_PERL_SUBSTR
JS_FN("substr", str_substr, 2,GENERIC_PRIMITIVE),
#endif
@ -2657,10 +2474,28 @@ js_String(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
*rval = STRING_TO_JSVAL(str);
return JS_TRUE;
}
STOBJ_SET_SLOT(obj, JSSLOT_PRIVATE, STRING_TO_JSVAL(str));
obj->fslots[JSSLOT_PRIVATE] = STRING_TO_JSVAL(str);
return JS_TRUE;
}
#ifdef JS_TRACER
JSObject* FASTCALL
js_String_tn(JSContext* cx, JSObject* proto, JSString* str)
{
JS_ASSERT(JS_ON_TRACE(cx));
JSObject* obj = js_NewNativeObject(cx, &js_StringClass, proto, JSSLOT_PRIVATE + 1);
if (!obj)
return NULL;
obj->fslots[JSSLOT_PRIVATE] = STRING_TO_JSVAL(str);
return obj;
}
JS_DEFINE_CALLINFO_3(extern, OBJECT, js_String_tn, CONTEXT, CALLEE_PROTOTYPE, STRING, 0, 0)
#endif /* !JS_TRACER */
static JSBool
str_fromCharCode(JSContext *cx, uintN argc, jsval *vp)
{
@ -2872,8 +2707,14 @@ js_InitStringClass(JSContext *cx, JSObject *obj)
NULL, string_static_methods);
if (!proto)
return NULL;
STOBJ_SET_SLOT(proto, JSSLOT_PRIVATE,
STRING_TO_JSVAL(cx->runtime->emptyString));
proto->fslots[JSSLOT_PRIVATE] = STRING_TO_JSVAL(cx->runtime->emptyString);
if (!js_DefineNativeProperty(cx, proto, ATOM_TO_JSID(cx->runtime->atomState.lengthAtom),
JSVAL_VOID, NULL, NULL,
JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_SHARED, 0, 0,
NULL)) {
return JS_FALSE;
}
return proto;
}

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -155,7 +155,7 @@ public:
#ifdef JS_JIT_SPEW
extern bool js_verboseDebug;
#define debug_only_v(x) if (js_verboseDebug) { x; }
#define debug_only_v(x) if (js_verboseDebug) { x; fflush(stdout); }
#else
#define debug_only_v(x)
#endif
@ -397,27 +397,25 @@ class TraceRecorder : public avmplus::GCObject {
nanojit::LirWriter* cse_filter;
nanojit::LirWriter* expr_filter;
nanojit::LirWriter* func_filter;
#ifdef NJ_SOFTFLOAT
nanojit::LirWriter* float_filter;
#endif
nanojit::LIns* cx_ins;
nanojit::LIns* eos_ins;
nanojit::LIns* eor_ins;
nanojit::LIns* globalObj_ins;
nanojit::LIns* rval_ins;
nanojit::LIns* inner_sp_ins;
nanojit::LIns* invokevp_ins;
bool deepAborted;
bool trashSelf;
Queue<nanojit::Fragment*> whichTreesToTrash;
Queue<jsbytecode*> cfgMerges;
jsval* global_dslots;
JSTraceableNative* generatedTraceableNative;
JSTraceableNative* pendingTraceableNative;
bool terminate;
jsbytecode* terminate_pc;
jsbytecode* terminate_imacpc;
TraceRecorder* nextRecorderToAbort;
bool wasRootFragment;
jsbytecode* outer;
bool loop;
bool isGlobal(jsval* p) const;
ptrdiff_t nativeGlobalOffset(jsval* p) const;
@ -540,13 +538,19 @@ class TraceRecorder : public avmplus::GCObject {
JS_REQUIRES_STACK bool guardCallee(jsval& callee);
JS_REQUIRES_STACK bool getClassPrototype(JSObject* ctor, nanojit::LIns*& proto_ins);
JS_REQUIRES_STACK bool newArray(JSObject* ctor, uint32 argc, jsval* argv, jsval* vp);
JS_REQUIRES_STACK bool newString(JSObject* ctor, jsval& arg, jsval* rval);
JS_REQUIRES_STACK bool interpretedFunctionCall(jsval& fval, JSFunction* fun, uintN argc,
bool constructing);
JS_REQUIRES_STACK bool emitNativeCall(JSTraceableNative* known, uintN argc,
nanojit::LIns* args[]);
JS_REQUIRES_STACK bool callTraceableNative(JSFunction* fun, uintN argc, bool constructing);
JS_REQUIRES_STACK bool callNative(JSFunction* fun, uintN argc, bool constructing);
JS_REQUIRES_STACK bool functionCall(bool constructing, uintN argc);
JS_REQUIRES_STACK void trackCfgMerges(jsbytecode* pc);
JS_REQUIRES_STACK void flipIf(jsbytecode* pc, bool& cond);
JS_REQUIRES_STACK void emitIf(jsbytecode* pc, bool cond, nanojit::LIns* x);
JS_REQUIRES_STACK void fuseIf(jsbytecode* pc, bool cond, nanojit::LIns* x);
JS_REQUIRES_STACK bool checkTraceEnd(jsbytecode* pc);
bool hasMethod(JSObject* obj, jsid id);
JS_REQUIRES_STACK bool hasIteratorMethod(JSObject* obj);
@ -564,9 +568,8 @@ public:
JS_REQUIRES_STACK nanojit::LIns* snapshot(ExitType exitType);
nanojit::Fragment* getFragment() const { return fragment; }
TreeInfo* getTreeInfo() const { return treeInfo; }
JS_REQUIRES_STACK bool isLoopHeader(JSContext* cx) const;
JS_REQUIRES_STACK void compile(JSTraceMonitor* tm);
JS_REQUIRES_STACK bool closeLoop(JSTraceMonitor* tm, bool& demote);
JS_REQUIRES_STACK void closeLoop(JSTraceMonitor* tm, bool& demote);
JS_REQUIRES_STACK void endLoop(JSTraceMonitor* tm);
JS_REQUIRES_STACK void joinEdgesToEntry(nanojit::Fragmento* fragmento,
nanojit::Fragment* peer_root);
@ -590,7 +593,6 @@ public:
void deepAbort() { deepAborted = true; }
bool wasDeepAborted() { return deepAborted; }
bool walkedOutOfLoop() { return terminate; }
TreeInfo* getTreeInfo() { return treeInfo; }
#define OPDEF(op,val,name,token,length,nuses,ndefs,prec,format) \
@ -637,13 +639,13 @@ extern void
js_FinishJIT(JSTraceMonitor *tm);
extern void
js_FlushScriptFragments(JSContext* cx, JSScript* script);
js_PurgeScriptFragments(JSContext* cx, JSScript* script);
extern void
js_FlushJITCache(JSContext* cx);
extern void
js_FlushJITOracle(JSContext* cx);
js_PurgeJITOracle();
extern JSObject *
js_GetBuiltinFunction(JSContext *cx, uintN index);

44
js/src/jswince.asm Normal file
Просмотреть файл

@ -0,0 +1,44 @@
INCLUDE kxarm.h
area js_msvc, code, readonly
MACRO
FUNC_HEADER $Name
FuncName SETS VBar:CC:"$Name":CC:VBar
PrologName SETS VBar:CC:"$Name":CC:"_Prolog":CC:VBar
FuncEndName SETS VBar:CC:"$Name":CC:"_end":CC:VBar
AREA |.pdata|,ALIGN=2,PDATA
DCD $FuncName
DCD (($PrologName-$FuncName)/4) :OR: ((($FuncEndName-$FuncName)/4):SHL:8) :OR: 0x40000000
AREA $AreaName,CODE,READONLY
ALIGN 2
GLOBAL $FuncName
EXPORT $FuncName
$FuncName
ROUT
$PrologName
MEND
export js_arm_try_armv6t2_op
;; I'm not smart enough to figure out which flags to pass to armasm to get it
;; to understand movt and fmdrr/vmov; the disassembler figures them out just fine!
FUNC_HEADER js_arm_try_armv6t2_op
;; movt r0,#0xFFFF
DCD 0xE34F0FFF
mov pc,lr
ENTRY_END
endp
export js_arm_try_vfp_op
FUNC_HEADER js_arm_try_vfp_op
;; fmdrr d0, r0, r1
DCD 0xEC410B10
mov pc,lr
ENTRY_END
endp
end

Просмотреть файл

@ -55,7 +55,7 @@ extern "C" void sync_instruction_memory(caddr_t v, u_int len);
namespace nanojit
{
int UseSoftfloat = 0;
class DeadCodeFilter: public LirFilter
{
@ -602,7 +602,11 @@ namespace nanojit
Register s = resv->reg = registerAlloc(prefer);
_allocator.addActive(s, i);
if ((rmask(r) & GpRegs) && (rmask(s) & GpRegs)) {
#ifdef NANOJIT_ARM
MOV(r, s);
#else
MR(r, s);
#endif
}
else {
asm_nongp_copy(r, s);
@ -1238,7 +1242,6 @@ namespace nanojit
asm_arith(ins);
break;
}
#ifndef NJ_SOFTFLOAT
case LIR_fneg:
{
countlir_fpu();
@ -1266,7 +1269,6 @@ namespace nanojit
asm_u2f(ins);
break;
}
#endif // NJ_SOFTFLOAT
case LIR_st:
case LIR_sti:
{
@ -1417,7 +1419,6 @@ namespace nanojit
break;
}
#ifndef NJ_SOFTFLOAT
case LIR_feq:
case LIR_fle:
case LIR_flt:
@ -1428,7 +1429,6 @@ namespace nanojit
asm_fcond(ins);
break;
}
#endif
case LIR_eq:
case LIR_ov:
case LIR_cs:
@ -1446,10 +1446,8 @@ namespace nanojit
break;
}
#ifndef NJ_SOFTFLOAT
case LIR_fcall:
case LIR_fcalli:
#endif
#if defined NANOJIT_64BIT
case LIR_callh:
#endif
@ -1458,7 +1456,6 @@ namespace nanojit
{
countlir_call();
Register rr = UnknownReg;
#ifndef NJ_SOFTFLOAT
if ((op&LIR64))
{
// fcall or fcalli
@ -1466,7 +1463,6 @@ namespace nanojit
rr = asm_prep_fcall(rR, ins);
}
else
#endif
{
rr = retRegs[0];
prepResultReg(ins, rmask(rr));
@ -1947,13 +1943,12 @@ namespace nanojit
for (uint32_t i = 0; i < MAXARGS; i++) {
argt >>= 2;
ArgSize a = ArgSize(argt&3);
#ifdef NJ_SOFTFLOAT
if (a == ARGSIZE_F) {
if (AvmCore::config.soft_float && a == ARGSIZE_F) {
sizes[argc++] = ARGSIZE_LO;
sizes[argc++] = ARGSIZE_LO;
continue;
}
#endif
if (a != ARGSIZE_NONE) {
sizes[argc++] = a;
} else {

Просмотреть файл

@ -1102,26 +1102,27 @@ namespace nanojit
ArgSize sizes[2*MAXARGS];
int32_t argc = ci->get_sizes(sizes);
#ifdef NJ_SOFTFLOAT
if (op == LIR_fcall)
op = LIR_callh;
LInsp args2[MAXARGS*2]; // arm could require 2 args per double
int32_t j = 0;
int32_t i = 0;
while (j < argc) {
argt >>= 2;
ArgSize a = ArgSize(argt&3);
if (a == ARGSIZE_F) {
LInsp q = args[i++];
args2[j++] = ins1(LIR_qhi, q);
args2[j++] = ins1(LIR_qlo, q);
} else {
args2[j++] = args[i++];
if (AvmCore::config.soft_float) {
if (op == LIR_fcall)
op = LIR_callh;
LInsp args2[MAXARGS*2]; // arm could require 2 args per double
int32_t j = 0;
int32_t i = 0;
while (j < argc) {
argt >>= 2;
ArgSize a = ArgSize(argt&3);
if (a == ARGSIZE_F) {
LInsp q = args[i++];
args2[j++] = ins1(LIR_qhi, q);
args2[j++] = ins1(LIR_qlo, q);
} else {
args2[j++] = args[i++];
}
}
args = args2;
NanoAssert(j == argc);
}
args = args2;
NanoAssert(j == argc);
#endif
//
// An example of the what we're trying to serialize:
//

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -58,25 +58,8 @@ namespace nanojit
const int NJ_LOG2_PAGE_SIZE = 12; // 4K
// If NJ_ARM_VFP is defined, then VFP is assumed to
// be present. If it's not defined, then softfloat
// is used, and NJ_SOFTFLOAT is defined.
// When nanojit is used as part of Mozilla's JavaScript engine, this is
// #defined or left #undefined by js/src/configure.in.
//#define NJ_ARM_VFP
#ifdef NJ_ARM_VFP
// only d0-d7; we'll use d7 as s14-s15 for i2f/u2f/etc.
// only d0-d6 are actually used; we'll use d7 as s14-s15 for i2f/u2f/etc.
#define NJ_VFP_MAX_REGISTERS 8
#else
#define NJ_VFP_MAX_REGISTERS 0
#define NJ_SOFTFLOAT
#endif
#define NJ_MAX_REGISTERS (11 + NJ_VFP_MAX_REGISTERS)
#define NJ_MAX_STACK_ENTRY 256
#define NJ_MAX_PARAMETERS 16
@ -124,12 +107,7 @@ typedef enum {
LastFloatReg = 22,
FirstReg = 0,
#ifdef NJ_ARM_VFP
LastReg = 23,
#else
LastReg = 10,
#endif
Scratch = IP,
UnknownReg = 31,
// special value referring to S14
@ -156,8 +134,6 @@ typedef enum {
NV = 0xF // NeVer
} ConditionCode;
const char *ccName(ConditionCode cc);
typedef int RegisterMask;
typedef struct _FragInfo {
RegisterMask needRestoring;
@ -175,7 +151,7 @@ static const RegisterMask GpRegs = 0x07FF;
static const RegisterMask AllowableFlagRegs = 1<<R0 | 1<<R1 | 1<<R2 | 1<<R3 | 1<<R4 | 1<<R5 | 1<<R6 | 1<<R7 | 1<<R8 | 1<<R9 | 1<<R10;
#define IsFpReg(_r) ((rmask(_r) & (FpRegs | (1<<D7))) != 0)
#define IsGpReg(_r) ((rmask(_r) & (GpRegs | (1<<Scratch))) != 0)
#define IsGpReg(_r) ((rmask(_r) & (GpRegs | (1<<IP))) != 0)
#define FpRegNum(_fpr) ((_fpr) - FirstFloatReg)
#define firstreg() R0
@ -191,6 +167,8 @@ static Register nextreg(Register r) {
#define imm2register(c) (Register)(c-1)
verbose_only( extern const char* regNames[]; )
verbose_only( extern const char* condNames[]; )
verbose_only( extern const char* shiftNames[]; )
// abstract to platform specific calls
#define nExtractPlatformFlags(x) 0
@ -209,7 +187,12 @@ verbose_only( extern const char* regNames[]; )
void nativePageReset(); \
void nativePageSetup(); \
void asm_quad_nochk(Register, const int32_t*); \
void asm_add_imm(Register, Register, int32_t); \
void asm_add_imm(Register, Register, int32_t, int stat = 0); \
void asm_sub_imm(Register, Register, int32_t, int stat = 0); \
void asm_cmpi(Register, int32_t imm); \
void asm_ldr_chk(Register d, Register b, int32_t off, bool chk); \
void asm_ld_imm(Register d, int32_t imm); \
void asm_arm_farg(LInsp arg, Register rlo, Register rhi); \
int* _nSlot; \
int* _nExitSlot;
@ -259,279 +242,254 @@ typedef enum {
*(--_nIns) = (NIns)( COND_AL | (0x12<<20) | (0xFFF<<8) | (1<<4) | (_r)); \
asm_output("bx LR"); } while(0)
// _l = _r OR _l
#define OR(_l,_r) do { \
underrunProtect(4); \
*(--_nIns) = (NIns)( COND_AL | (0xC<<21) | (_r<<16) | (_l<<12) | (_l) ); \
asm_output("or %s,%s",gpn(_l),gpn(_r)); } while(0)
/*
* ALU operations
*/
// _r = _r OR _imm
#define ORi(_r,_imm) do { \
NanoAssert(isU8((_imm))); \
underrunProtect(4); \
*(--_nIns) = (NIns)( COND_AL | OP_IMM | (0xC<<21) | (_r<<16) | (_r<<12) | ((_imm)&0xFF) ); \
asm_output("or %s,%d",gpn(_r), (_imm)); } while(0)
enum {
ARM_and = 0,
ARM_eor = 1,
ARM_sub = 2,
ARM_rsb = 3,
ARM_add = 4,
ARM_adc = 5,
ARM_sbc = 6,
ARM_rsc = 7,
ARM_tst = 8,
ARM_teq = 9,
ARM_cmp = 10,
ARM_cmn = 11,
ARM_orr = 12,
ARM_mov = 13,
ARM_bic = 14,
ARM_mvn = 15
};
// _l = _r AND _l
#define AND(_l,_r) do { \
underrunProtect(4); \
*(--_nIns) = (NIns)( COND_AL | ((_r)<<16) | ((_l)<<12) | (_l)); \
asm_output("and %s,%s",gpn(_l),gpn(_r)); } while(0)
// ALU operation with register and 8-bit immediate arguments
// S - bit, 0 or 1, whether the CPSR register is updated
// rd - destination register
// rl - first (left) operand register
// imm - immediate (max 8 bits)
#define ALUi(cond, op, S, rd, rl, imm) do {\
underrunProtect(4);\
NanoAssert(isU8(imm));\
*(--_nIns) = (NIns) ((cond)<<28 | OP_IMM | (ARM_##op)<<21 | (S)<<20 | (rl)<<16 | (rd)<<12 | (imm));\
if (ARM_##op == ARM_mov || ARM_##op == ARM_mvn)\
asm_output("%s%s%s %s, #0x%X", #op, condNames[cond], (S)?"s":"", gpn(rd), (imm));\
else if (ARM_##op >= ARM_tst && ARM_##op <= ARM_cmn) {\
NanoAssert(S==1);\
asm_output("%s%s %s, #0x%X", #op, condNames[cond], gpn(rl), (imm));\
} else\
asm_output("%s%s%s %s, %s, #0x%X", #op, condNames[cond], (S)?"s":"", gpn(rd), gpn(rl), (imm));\
} while (0)
// _r = _r AND _imm
#define ANDi(_r,_imm) do { \
if (isU8((_imm))) { \
underrunProtect(4); \
*(--_nIns) = (NIns)( COND_AL | OP_IMM | ((_r)<<16) | ((_r)<<12) | ((_imm)&0xFF) ); \
asm_output("and %s,%d",gpn(_r),(_imm));} \
else if ((_imm)<0 && (_imm)>-256) { \
underrunProtect(8); \
*(--_nIns) = (NIns)( COND_AL | ((_r)<<16) | ((_r)<<12) | (Scratch) ); \
asm_output("and %s,%s",gpn(_r),gpn(Scratch)); \
*(--_nIns) = (NIns)( COND_AL | (0x3E<<20) | ((Scratch)<<12) | (((_imm)^0xFFFFFFFF)&0xFF) ); \
asm_output("mvn %s,%d",gpn(Scratch),(_imm));} \
else NanoAssert(0); \
// ALU operation with register and rotated 8-bit immediate arguments
// S - bit, 0 or 1, whether the CPSR register is updated
// rd - destination register
// rl - first (left) operand register
// imm - immediate (max 8 bits)
// rot - rotation to apply to imm
#define ALUi_rot(cond, op, S, rd, rl, imm, rot) do {\
underrunProtect(4);\
NanoAssert(isU8(imm));\
*(--_nIns) = (NIns) ((cond)<<28 | OP_IMM | (ARM_##op)<<21 | (S)<<20 | (rl)<<16 | (rd)<<12 | (rot)<<8 | (imm));\
if (ARM_##op == ARM_mov || ARM_##op == ARM_mvn)\
asm_output("%s%s%s %s, #0x%X, %d", #op, condNames[cond], (S)?"s":"", gpn(rd), (imm), (rot)*2);\
else if (ARM_##op >= ARM_tst && ARM_##op <= ARM_cmn) {\
NanoAssert(S==1);\
asm_output("%s%s %s, #0x%X, %d", #op, condNames[cond], gpn(rl), (imm), (rot)*2);\
} else\
asm_output("%s%s%s %s, %s, #0x%X, %d", #op, condNames[cond], (S)?"s":"", gpn(rd), gpn(rl), (imm), (rot)*2);\
} while (0)
// _l = _l XOR _r
#define XOR(_l,_r) do { \
underrunProtect(4); \
*(--_nIns) = (NIns)( COND_AL | (1<<21) | ((_r)<<16) | ((_l)<<12) | (_l)); \
asm_output("eor %s,%s",gpn(_l),gpn(_r)); } while(0)
// _r = _r XOR _imm
#define XORi(_r,_imm) do { \
NanoAssert(isU8((_imm))); \
underrunProtect(4); \
*(--_nIns) = (NIns)( COND_AL | OP_IMM | (1<<21) | ((_r)<<16) | ((_r)<<12) | ((_imm)&0xFF) ); \
asm_output("eor %s,%d",gpn(_r),(_imm)); } while(0)
// _d = _n + _m
#define arm_ADD(_d,_n,_m) do { \
underrunProtect(4); \
*(--_nIns) = (NIns)( COND_AL | OP_STAT | (1<<23) | ((_n)<<16) | ((_d)<<12) | (_m)); \
asm_output("add %s,%s+%s",gpn(_d),gpn(_n),gpn(_m)); } while(0)
// _l = _l + _r
#define ADD(_l,_r) arm_ADD(_l,_l,_r)
// Note that this sometimes converts negative immediate values to a to a sub.
// _d = _r + _imm
#define arm_ADDi(_d,_n,_imm) asm_add_imm(_d,_n,_imm)
#define ADDi(_r,_imm) arm_ADDi(_r,_r,_imm)
// _l = _l - _r
#define SUB(_l,_r) do { \
underrunProtect(4); \
*(--_nIns) = (NIns)( COND_AL | (1<<22) | ((_l)<<16) | ((_l)<<12) | (_r)); \
asm_output("sub %s,%s",gpn(_l),gpn(_r)); } while(0)
// _r = _r - _imm
#define SUBi(_r,_imm) do { \
if ((_imm)>-256 && (_imm)<256) { \
underrunProtect(4); \
if ((_imm)>=0) *(--_nIns) = (NIns)( COND_AL | OP_IMM | (1<<22) | ((_r)<<16) | ((_r)<<12) | ((_imm)&0xFF) ); \
else *(--_nIns) = (NIns)( COND_AL | OP_IMM | (1<<23) | ((_r)<<16) | ((_r)<<12) | ((-(_imm))&0xFF) ); \
} else { \
if ((_imm)>=0) { \
if ((_imm)<=510) { \
underrunProtect(8); \
int rem = (_imm) - 255; \
NanoAssert(rem<256); \
*(--_nIns) = (NIns)( COND_AL | OP_IMM | (1<<22) | ((_r)<<16) | ((_r)<<12) | (rem&0xFF) ); \
*(--_nIns) = (NIns)( COND_AL | OP_IMM | (1<<22) | ((_r)<<16) | ((_r)<<12) | (0xFF) ); \
} else { \
underrunProtect(4+LD32_size); \
*(--_nIns) = (NIns)( COND_AL | (1<<22) | ((_r)<<16) | ((_r)<<12) | (Scratch)); \
LD32_nochk(Scratch, _imm); \
} \
} else { \
if ((_imm)>=-510) { \
underrunProtect(8); \
int rem = -(_imm) - 255; \
*(--_nIns) = (NIns)( COND_AL | OP_IMM | (1<<23) | ((_r)<<16) | ((_r)<<12) | ((rem)&0xFF) ); \
*(--_nIns) = (NIns)( COND_AL | OP_IMM | (1<<23) | ((_r)<<16) | ((_r)<<12) | (0xFF) ); \
} else { \
underrunProtect(4+LD32_size); \
*(--_nIns) = (NIns)( COND_AL | (1<<23) | ((_r)<<16) | ((_r)<<12) | (Scratch)); \
LD32_nochk(Scratch, -(_imm)); \
} \
} \
} \
asm_output("sub %s,%d",gpn(_r),(_imm)); \
// ALU operation with two register arguments
// S - bit, 0 or 1, whether the CPSR register is updated
// rd - destination register
// rl - first (left) operand register
// rr - first (left) operand register
#define ALUr(cond, op, S, rd, rl, rr) do {\
underrunProtect(4);\
*(--_nIns) = (NIns) ((cond)<<28 |(ARM_##op)<<21 | (S)<<20 | (rl)<<16 | (rd)<<12 | (rr));\
if (ARM_##op == ARM_mov || ARM_##op == ARM_mvn)\
asm_output("%s%s%s %s, %s", #op, condNames[cond], (S)?"s":"", gpn(rd), gpn(rr));\
else if (ARM_##op >= ARM_tst && ARM_##op <= ARM_cmn) {\
NanoAssert(S==1);\
asm_output("%s%s %s, %s", #op, condNames[cond], gpn(rl), gpn(rr));\
} else\
asm_output("%s%s%s %s, %s, %s", #op, condNames[cond], (S)?"s":"", gpn(rd), gpn(rl), gpn(rr));\
} while (0)
// ALU operation with two register arguments, with rr operated on by a shift and shift immediate
// S - bit, 0 or 1, whether the CPSR register is updated
// rd - destination register
// rl - first (left) operand register
// rr - first (left) operand register
// sh - a ShiftOperator
// imm - immediate argument to shift operator, 5 bits (0..31)
#define ALUr_shi(cond, op, S, rd, rl, rr, sh, imm) do {\
underrunProtect(4);\
NanoAssert((imm)>=0 && (imm)<32);\
*(--_nIns) = (NIns) ((cond)<<28 |(ARM_##op)<<21 | (S)<<20 | (rl)<<16 | (rd)<<12 | (imm)<<7 | (sh)<<4 | (rr));\
if (ARM_##op == ARM_mov || ARM_##op == ARM_mvn)\
asm_output("%s%s%s %s, %s, %s #%d", #op, condNames[cond], (S)?"s":"", gpn(rd), gpn(rr), shiftNames[sh], (imm));\
else if (ARM_##op >= ARM_tst && ARM_##op <= ARM_cmn) {\
NanoAssert(S==1);\
asm_output("%s%s %s, %s, %s #%d", #op, condNames[cond], gpn(rl), gpn(rr), shiftNames[sh], (imm));\
} else\
asm_output("%s%s%s %s, %s, %s, %s #%d", #op, condNames[cond], (S)?"s":"", gpn(rd), gpn(rl), gpn(rr), shiftNames[sh], (imm));\
} while (0)
// ALU operation with two register arguments, with rr operated on by a shift and shift register
// S - bit, 0 or 1, whether the CPSR register is updated
// rd - destination register
// rl - first (left) operand register
// rr - first (left) operand register
// sh - a ShiftOperator
// rs - shift operand register
#define ALUr_shr(cond, op, S, rd, rl, rr, sh, rs) do {\
underrunProtect(4);\
*(--_nIns) = (NIns) ((cond)<<28 |(ARM_##op)<<21 | (S)<<20 | (rl)<<16 | (rd)<<12 | (rs)<<8 | (sh)<<4 | (rr));\
if (ARM_##op == ARM_mov || ARM_##op == ARM_mvn)\
asm_output("%s%s%s %s, %s, %s %s", #op, condNames[cond], (S)?"s":"", gpn(rd), gpn(rr), shiftNames[sh], gpn(rs));\
else if (ARM_##op >= ARM_tst && ARM_##op <= ARM_cmn) {\
NanoAssert(S==1);\
asm_output("%s%s %s, %s, %s %s", #op, condNames[cond], gpn(rl), gpn(rr), shiftNames[sh], gpn(rs));\
} else\
asm_output("%s%s%s %s, %s, %s, %s %s", #op, condNames[cond], (S)?"s":"", gpn(rd), gpn(rl), gpn(rr), shiftNames[sh], gpn(rs));\
} while (0)
// _d = _l OR _r
#define ORR(_d,_l,_r) ALUr(AL, orr, 0, _d, _l, _r)
// _d = _l OR _imm
#define ORRi(_d,_l,_imm) ALUi(AL, orr, 0, _d, _l, _imm)
// _d = _l AND _r
#define AND(_d,_l,_r) ALUr(AL, and, 0, _d, _l, _r)
// _d = _l AND _imm
#define ANDi(_d,_l,_imm) ALUi(AL, and, 0, _d, _l, _imm)
// _d = _l ^ _r
#define EOR(_d,_l,_r) ALUr(AL, eor, 0, _d, _l, _r)
// _d = _l ^ _imm
#define EORi(_d,_l,_imm) ALUi(AL, eor, 0, _d, _l, _imm)
// _d = _l + _r; update flags
#define ADD(_d,_l,_r) ALUr(AL, add, 1, _d, _l, _r)
// _d = _l + _r; update flags if _stat == 1
#define ADDs(_d,_l,_r,_stat) ALUr(AL, add, _stat, _d, _l, _r)
// _d = _l + _imm; update flags
#define ADDi(_d,_l,_imm) asm_add_imm(_d, _l, _imm, 1)
// _d = _l + _imm; update flags if _stat == 1
#define ADDis(_d,_l,_imm,_stat) asm_add_imm(_d, _l, _imm, _stat)
// _d = _l - _r; update flags
#define SUB(_d,_l,_r) ALUr(AL, sub, 1, _d, _l, _r)
// _d = _l - _imm; update flags
#define SUBi(_d,_l,_imm) asm_sub_imm(_d, _l, _imm, 1)
// _l = _l * _r
#define MUL(_l,_r) do { \
underrunProtect(4); \
*(--_nIns) = (NIns)( COND_AL | (_l)<<16 | (_l)<<8 | 0x90 | (_r) ); \
asm_output("mul %s,%s",gpn(_l),gpn(_r)); } while(0)
// _d = 0 - _r
#define RSBS(_d,_r) ALUi(AL, rsb, 1, _d, _r, 0)
// RSBS
// _r = -_r
#define NEG(_r) do { \
underrunProtect(4); \
*(--_nIns) = (NIns)( COND_AL | (0x27<<20) | ((_r)<<16) | ((_r)<<12) ); \
asm_output("neg %s",gpn(_r)); } while(0)
// _d = ~_r (one's compliment)
#define MVN(_d,_r) ALUr(AL, mvn, 0, _d, 0, _r)
// MVNS
// _r = !_r
#define NOT(_r) do { \
underrunProtect(4); \
*(--_nIns) = (NIns)( COND_AL | (0x1F<<20) | ((_r)<<12) | (_r) ); \
asm_output("mvn %s",gpn(_r)); } while(0)
// MOVS _d, _r, LSR <_s>
// _d = _r >> _s
#define SHR(_d,_r,_s) ALUr_shr(AL, mov, 1, _d, 0, _r, LSR_reg, _s)
// MOVS _r, _r, LSR <_s>
// _r = _r >> _s
#define SHR(_r,_s) do { \
underrunProtect(4); \
*(--_nIns) = (NIns)( COND_AL | (0x1B<<20) | ((_r)<<12) | ((_s)<<8) | (LSR_reg<<4) | (_r) ); \
asm_output("shr %s,%s",gpn(_r),gpn(_s)); } while(0)
// MOVS _r, _r, LSR #_imm
// _r = _r >> _imm
#define SHRi(_r,_imm) do { \
underrunProtect(4); \
*(--_nIns) = (NIns)( COND_AL | (0x1B<<20) | ((_r)<<12) | ((_imm)<<7) | (LSR_imm<<4) | (_r) ); \
asm_output("shr %s,%d",gpn(_r),_imm); } while(0)
// MOVS _r, _r, ASR <_s>
// _r = _r >> _s
#define SAR(_r,_s) do { \
underrunProtect(4); \
*(--_nIns) = (NIns)( COND_AL | (0x1B<<20) | ((_r)<<12) | ((_s)<<8) | (ASR_reg<<4) | (_r) ); \
asm_output("asr %s,%s",gpn(_r),gpn(_s)); } while(0)
// MOVS _d, _r, LSR #_imm
// _d = _r >> _imm
#define SHRi(_d,_r,_imm) ALUr_shi(AL, mov, 1, _d, 0, _r, LSR_imm, _imm)
// MOVS _d, _r, ASR <_s>
// _d = _r >> _s
#define SAR(_d,_r,_s) ALUr_shr(AL, mov, 1, _d, 0, _r, ASR_reg, _s)
// MOVS _r, _r, ASR #_imm
// _r = _r >> _imm
#define SARi(_r,_imm) do { \
underrunProtect(4); \
*(--_nIns) = (NIns)( COND_AL | (0x1B<<20) | ((_r)<<12) | ((_imm)<<7) | (ASR_imm<<4) | (_r) ); \
asm_output("asr %s,%d",gpn(_r),_imm); } while(0)
// _d = _r >> _imm
#define SARi(_d,_r,_imm) ALUr_shi(AL, mov, 1, _d, 0, _r, ASR_imm, _imm)
// MOVS _r, _r, LSL <_s>
// _r = _r << _s
#define SHL(_r,_s) do { \
underrunProtect(4); \
*(--_nIns) = (NIns)( COND_AL | (0x1B<<20) | ((_r)<<12) | ((_s)<<8) | (LSL_reg<<4) | (_r) ); \
asm_output("lsl %s,%s",gpn(_r),gpn(_s)); } while(0)
// MOVS _d, _r, LSL <_s>
// _d = _r << _s
#define SHL(_d, _r, _s) ALUr_shr(AL, mov, 1, _d, 0, _r, LSL_reg, _s)
// MOVS _r, _r, LSL #_imm
// _r = _r << _imm
#define SHLi(_r,_imm) do { \
underrunProtect(4); \
*(--_nIns) = (NIns)( COND_AL | (0x1B<<20) | ((_r)<<12) | ((_imm)<<7) | (LSL_imm<<4) | (_r) ); \
asm_output("lsl %s,%d",gpn(_r),(_imm)); } while(0)
// MOVS _d, _r, LSL #_imm
// _d = _r << _imm
#define SHLi(_d, _r, _imm) ALUr_shi(AL, mov, 1, _d, 0, _r, LSL_imm, _imm)
// TST
#define TEST(_d,_s) do { \
underrunProtect(4); \
*(--_nIns) = (NIns)( COND_AL | (0x11<<20) | ((_d)<<16) | (_s) ); \
asm_output("test %s,%s",gpn(_d),gpn(_s)); } while(0)
#define TSTi(_d,_imm) do { \
underrunProtect(4); \
NanoAssert(((_imm) & 0xff) == (_imm)); \
*(--_nIns) = (NIns)( COND_AL | OP_IMM | (0x11<<20) | ((_d) << 16) | (0xF<<12) | ((_imm) & 0xff) ); \
asm_output("tst %s,#0x%x", gpn(_d), _imm); \
} while (0);
#define TEST(_l,_r) ALUr(AL, tst, 1, 0, _l, _r)
#define TSTi(_d,_imm) ALUi(AL, tst, 1, 0, _d, _imm)
// CMP
#define CMP(_l,_r) do { \
underrunProtect(4); \
*(--_nIns) = (NIns)( COND_AL | (0x015<<20) | ((_l)<<16) | (_r) ); \
asm_output("cmp %s,%s",gpn(_l),gpn(_r)); } while(0)
// CMP (or CMN)
#define CMPi(_r,_imm) do { \
if (_imm<0) { \
if ((_imm)>-256) { \
underrunProtect(4); \
*(--_nIns) = (NIns)( COND_AL | (0x37<<20) | ((_r)<<16) | (-(_imm)) ); \
} else { \
underrunProtect(4+LD32_size); \
*(--_nIns) = (NIns)( COND_AL | (0x17<<20) | ((_r)<<16) | (Scratch) ); \
LD32_nochk(Scratch, (_imm)); \
} \
} else { \
if ((_imm)<256) { \
underrunProtect(4); \
*(--_nIns) = (NIns)( COND_AL | (0x035<<20) | ((_r)<<16) | ((_imm)&0xFF) ); \
} else { \
underrunProtect(4+LD32_size); \
*(--_nIns) = (NIns)( COND_AL | (0x015<<20) | ((_r)<<16) | (Scratch) ); \
LD32_nochk(Scratch, (_imm)); \
} \
} \
asm_output("cmp %s,0x%x",gpn(_r),(_imm)); \
} while(0)
#define CMP(_l,_r) ALUr(AL, cmp, 1, 0, _l, _r)
// MOV
#define MR(_d,_s) do { \
#define MOV_cond(_cond,_d,_s) ALUr(_cond, mov, 0, _d, 0, _s)
#define MOV(dr,sr) MOV_cond(AL, dr, sr)
#define MOVEQ(dr,sr) MOV_cond(EQ, dr, sr)
#define MOVNE(dr,sr) MOV_cond(NE, dr, sr)
#define MOVLT(dr,sr) MOV_cond(LT, dr, sr)
#define MOVLE(dr,sr) MOV_cond(LE, dr, sr)
#define MOVGT(dr,sr) MOV_cond(GT, dr, sr)
#define MOVGE(dr,sr) MOV_cond(GE, dr, sr)
#define MOVCC(dr,sr) MOV_cond(CC, dr, sr)
#define MOVLS(dr,sr) MOV_cond(LS, dr, sr)
#define MOVHI(dr,sr) MOV_cond(HI, dr, sr)
#define MOVCS(dr,sr) MOV_cond(CS, dr, sr)
#define MOVVC(dr,sr) MOV_cond(VC, dr, sr) // overflow clear
#define MOVNC(dr,sr) MOV_cond(CC, dr, sr) // carry clear
// _d = [_b+off]
#define LDR(_d,_b,_off) asm_ldr_chk(_d,_b,_off,1)
#define LDR_nochk(_d,_b,_off) asm_ldr_chk(_d,_b,_off,0)
// _d = #_imm
#define LDi(_d,_imm) asm_ld_imm(_d,_imm)
// MOVW and MOVT are ARMv6T2 or newer only
// MOVW -- writes _imm into _d, zero-extends.
#define MOVW_cond(_cond,_d,_imm) do { \
NanoAssert(isU16(_imm) || isS16(_imm)); \
underrunProtect(4); \
*(--_nIns) = (NIns)( COND_AL | (0xD<<21) | ((_d)<<12) | (_s) ); \
asm_output("mov %s,%s",gpn(_d),gpn(_s)); } while (0)
*(--_nIns) = (NIns)( (_cond)<<28 | 3<<24 | 0<<20 | (((_imm)>>12)&0xf)<<16 | (_d)<<12 | (_imm)&0xfff ); \
asm_output("movw%s %s, #0x%x", condNames[_cond], gpn(_d), (_imm)); \
} while (0)
#define MOVW(_d,_imm) MOVW_cond(AL, _d, _imm)
#define MR_cond(_d,_s,_cond,_nm) do { \
// MOVT -- writes _imm into top halfword of _d, does not affect bottom halfword
#define MOVT_cond(_cond,_d,_imm) do { \
NanoAssert(isU16(_imm) || isS16(_imm)); \
underrunProtect(4); \
*(--_nIns) = (NIns)( ((_cond)<<28) | (0xD<<21) | ((_d)<<12) | (_s) ); \
asm_output(_nm " %s,%s",gpn(_d),gpn(_s)); } while (0)
*(--_nIns) = (NIns)( (_cond)<<28 | 3<<24 | 4<<20 | (((_imm)>>12)&0xf)<<16 | (_d)<<12 | (_imm)&0xfff ); \
asm_output("movt%s %s, #0x%x", condNames[_cond], gpn(_d), (_imm)); \
} while (0)
#define MREQ(dr,sr) MR_cond(dr, sr, EQ, "moveq")
#define MRNE(dr,sr) MR_cond(dr, sr, NE, "movne")
#define MRL(dr,sr) MR_cond(dr, sr, LT, "movlt")
#define MRLE(dr,sr) MR_cond(dr, sr, LE, "movle")
#define MRG(dr,sr) MR_cond(dr, sr, GT, "movgt")
#define MRGE(dr,sr) MR_cond(dr, sr, GE, "movge")
#define MRB(dr,sr) MR_cond(dr, sr, CC, "movcc")
#define MRBE(dr,sr) MR_cond(dr, sr, LS, "movls")
#define MRA(dr,sr) MR_cond(dr, sr, HI, "movcs")
#define MRAE(dr,sr) MR_cond(dr, sr, CS, "movhi")
#define MRNO(dr,sr) MR_cond(dr, sr, VC, "movvc") // overflow clear
#define MRNC(dr,sr) MR_cond(dr, sr, CC, "movcc") // carry clear
#define LDR_chk(_d,_b,_off,_chk) do { \
if (IsFpReg(_d)) { \
FLDD_chk(_d,_b,_off,_chk); \
} else if ((_off) > -4096 && (_off) < 4096) { \
if (_chk) underrunProtect(4); \
*(--_nIns) = (NIns)( COND_AL | (((_off) < 0 ? 0x51 : 0x59)<<20) | ((_b)<<16) | ((_d)<<12) | (((_off) < 0 ? -(_off) : (_off))&0xFFF) ); \
} else { \
if (_chk) underrunProtect(4+LD32_size); \
NanoAssert((_b) != IP); \
*(--_nIns) = (NIns)( COND_AL | (0x79<<20) | ((_b)<<16) | ((_d)<<12) | Scratch ); \
LD32_nochk(Scratch, _off); \
} \
asm_output("ldr %s, [%s, #%d]",gpn(_d),gpn(_b),(_off)); \
} while(0)
#define LDR(_d,_b,_off) LDR_chk(_d,_b,_off,1)
#define LDR_nochk(_d,_b,_off) LDR_chk(_d,_b,_off,0)
#define MOVT(_d,_imm) MOVT_cond(AL, _d, _imm)
// i386 compat, for Assembler.cpp
#define LD(reg,offset,base) LDR_chk(reg,base,offset,1)
#define MR(d,s) MOV(d,s)
#define LD(reg,offset,base) asm_ldr_chk(reg,base,offset,1)
#define ST(base,offset,reg) STR(reg,base,offset)
#define LDi(_d,_imm) do { \
if ((_imm) == 0) { \
XOR(_d,_d); \
} else if (isS8((_imm)) || isU8((_imm))) { \
underrunProtect(4); \
if ((_imm)<0) *(--_nIns) = (NIns)( COND_AL | (0x3E<<20) | ((_d)<<12) | (((_imm)^0xFFFFFFFF)&0xFF) ); \
else *(--_nIns) = (NIns)( COND_AL | (0x3B<<20) | ((_d)<<12) | ((_imm)&0xFF) ); \
asm_output("ld %s,0x%x",gpn((_d)),(_imm)); \
} else { \
underrunProtect(LD32_size); \
LD32_nochk(_d, (_imm)); \
asm_output("ld %s,0x%x",gpn((_d)),(_imm)); \
} \
} while(0)
// load 8-bit, zero extend (aka LDRB) note, only 5-bit offsets (!) are
// supported for this, but that's all we need at the moment.
// (LDRB/LDRH actually allow a 12-bit offset in ARM mode but
@ -577,11 +535,15 @@ typedef enum {
asm_output("str %s, [%s], %d", gpn(_d), gpn(_n), (_off)); \
} while(0)
// There isn't really a LEA on ARM; this basically computes _r = _b + #_d, either as a
// ADD _r, _b, #_d (if _d < 256)
// or as a if (_d <= 1020)
// MOV _r, #(_d>>2)
// ADD _r, _b, _r << 2
#define LEA(_r,_d,_b) do { \
NanoAssert((_d)<=1020); \
NanoAssert(((_d)&3)==0); \
if (_b!=SP) NanoAssert(0); \
NanoAssert((_b) == FP); \
if ((_d)<256) { \
underrunProtect(4); \
*(--_nIns) = (NIns)( COND_AL | (0x28<<20) | ((_b)<<16) | ((_r)<<12) | ((_d)&0xFF) ); \
@ -625,8 +587,8 @@ typedef enum {
#define PUSHm(_off,_b) do { \
NanoAssert( (int)(_off)>0 ); \
underrunProtect(8); \
*(--_nIns) = (NIns)( COND_AL | (0x92<<20) | (SP<<16) | (1<<(Scratch)) ); \
*(--_nIns) = (NIns)( COND_AL | (0x59<<20) | ((_b)<<16) | ((Scratch)<<12) | ((_off)&0xFFF) ); \
*(--_nIns) = (NIns)( COND_AL | (0x92<<20) | (SP<<16) | (1<<(IP)) ); \
*(--_nIns) = (NIns)( COND_AL | (0x59<<20) | ((_b)<<16) | ((IP)<<12) | ((_off)&0xFFF) ); \
asm_output("push %d(%s)",(_off),gpn(_b)); } while (0)
#define POPr(_r) do { \
@ -654,28 +616,28 @@ typedef enum {
#define JMP_nochk(_t) \
B_cond_chk(AL,_t,0)
#define JA(t) do {B_cond(HI,t); asm_output("ja 0x%08x",(unsigned int)t); } while(0)
#define JNA(t) do {B_cond(LS,t); asm_output("jna 0x%08x",(unsigned int)t); } while(0)
#define JB(t) do {B_cond(CC,t); asm_output("jb 0x%08x",(unsigned int)t); } while(0)
#define JNB(t) do {B_cond(CS,t); asm_output("jnb 0x%08x",(unsigned int)t); } while(0)
#define JE(t) do {B_cond(EQ,t); asm_output("je 0x%08x",(unsigned int)t); } while(0)
#define JNE(t) do {B_cond(NE,t); asm_output("jne 0x%08x",(unsigned int)t); } while(0)
#define JBE(t) do {B_cond(LS,t); asm_output("jbe 0x%08x",(unsigned int)t); } while(0)
#define JNBE(t) do {B_cond(HI,t); asm_output("jnbe 0x%08x",(unsigned int)t); } while(0)
#define JAE(t) do {B_cond(CS,t); asm_output("jae 0x%08x",(unsigned int)t); } while(0)
#define JNAE(t) do {B_cond(CC,t); asm_output("jnae 0x%08x",(unsigned int)t); } while(0)
#define JL(t) do {B_cond(LT,t); asm_output("jl 0x%08x",(unsigned int)t); } while(0)
#define JNL(t) do {B_cond(GE,t); asm_output("jnl 0x%08x",(unsigned int)t); } while(0)
#define JLE(t) do {B_cond(LE,t); asm_output("jle 0x%08x",(unsigned int)t); } while(0)
#define JNLE(t) do {B_cond(GT,t); asm_output("jnle 0x%08x",(unsigned int)t); } while(0)
#define JGE(t) do {B_cond(GE,t); asm_output("jge 0x%08x",(unsigned int)t); } while(0)
#define JNGE(t) do {B_cond(LT,t); asm_output("jnge 0x%08x",(unsigned int)t); } while(0)
#define JG(t) do {B_cond(GT,t); asm_output("jg 0x%08x",(unsigned int)t); } while(0)
#define JNG(t) do {B_cond(LE,t); asm_output("jng 0x%08x",(unsigned int)t); } while(0)
#define JC(t) do {B_cond(CS,t); asm_output("bcs 0x%08x",(unsigned int)t); } while(0)
#define JNC(t) do {B_cond(CC,t); asm_output("bcc 0x%08x",(unsigned int)t); } while(0)
#define JO(t) do {B_cond(VS,t); asm_output("bvs 0x%08x",(unsigned int)t); } while(0)
#define JNO(t) do {B_cond(VC,t); asm_output("bvc 0x%08x",(unsigned int)t); } while(0)
#define JA(t) B_cond(HI,t)
#define JNA(t) B_cond(LS,t)
#define JB(t) B_cond(CC,t)
#define JNB(t) B_cond(CS,t)
#define JE(t) B_cond(EQ,t)
#define JNE(t) B_cond(NE,t)
#define JBE(t) B_cond(LS,t)
#define JNBE(t) B_cond(HI,t)
#define JAE(t) B_cond(CS,t)
#define JNAE(t) B_cond(CC,t)
#define JL(t) B_cond(LT,t)
#define JNL(t) B_cond(GE,t)
#define JLE(t) B_cond(LE,t)
#define JNLE(t) B_cond(GT,t)
#define JGE(t) B_cond(GE,t)
#define JNGE(t) B_cond(LT,t)
#define JG(t) B_cond(GT,t)
#define JNG(t) B_cond(LE,t)
#define JC(t) B_cond(CS,t)
#define JNC(t) B_cond(CC,t)
#define JO(t) B_cond(VS,t)
#define JNO(t) B_cond(VC,t)
// used for testing result of an FP compare on x86; not used on arm.
// JP = comparison false
@ -691,8 +653,8 @@ typedef enum {
underrunProtect(8); \
*(--_nIns) = (NIns)( (_opp<<28) | (1<<21) | ((_r)<<16) | ((_r)<<12) | (_r) ); \
*(--_nIns) = (NIns)( (_cond<<28) | (0x3A<<20) | ((_r)<<12) | (1) ); \
asm_output("mov%s %s, #1", ccName(_cond), gpn(r), gpn(r)); \
asm_output("eor%s %s, %s", ccName(_opp), gpn(r), gpn(r)); \
asm_output("mov%s %s, #1", condNames[_cond], gpn(r), gpn(r)); \
asm_output("eor%s %s, %s", condNames[_opp], gpn(r), gpn(r)); \
} while (0)
@ -763,12 +725,6 @@ typedef enum {
asm_output("ldmia %s!,{0x%x}", gpn(_b), (_mask)); \
} while (0)
#define MRS(_d) do { \
underrunProtect(4); \
*(--_nIns) = (NIns)(COND_AL | (0x10<<20) | (0xF<<16) | ((_d)<<12)); \
asm_output("msr %s", gpn(_d)); \
} while (0)
/*
* VFP
*/
@ -789,11 +745,18 @@ typedef enum {
#define FMRDH(_Rd,_Dn) do { \
underrunProtect(4); \
NanoAssert(IsGpReg(_Rd) && IsFpReg(_Dm)); \
NanoAssert(IsGpReg(_Rd) && IsFpReg(_Dn)); \
*(--_nIns) = (NIns)( COND_AL | (0xE3<<20) | (FpRegNum(_Dn)<<16) | ((_Rd)<<12) | (0xB<<8) | (1<<4) ); \
asm_output("fmrdh %s,%s", gpn(_Rd), gpn(_Dn)); \
} while (0)
#define FMRDL(_Rd,_Dn) do { \
underrunProtect(4); \
NanoAssert(IsGpReg(_Rd) && IsFpReg(_Dn)); \
*(--_nIns) = (NIns)( COND_AL | (0xE1<<20) | (FpRegNum(_Dn)<<16) | ((_Rd)<<12) | (0xB<<8) | (1<<4) ); \
asm_output("fmrdh %s,%s", gpn(_Rd), gpn(_Dn)); \
} while (0)
#define FSTD(_Dd,_Rn,_offs) do { \
underrunProtect(4); \
NanoAssert((((_offs) & 3) == 0) && isS8((_offs) >> 2)); \

Просмотреть файл

@ -834,12 +834,12 @@ namespace nanojit
NIns* at = 0;
LOpcode condop = cond->opcode();
NanoAssert(cond->isCond());
#ifndef NJ_SOFTFLOAT
if (condop >= LIR_feq && condop <= LIR_fge)
{
return asm_jmpcc(branchOnFalse, cond, targ);
}
#endif
// produce the branch
if (branchOnFalse)
{
@ -973,13 +973,11 @@ namespace nanojit
// only want certain regs
Register r = prepResultReg(ins, AllowableFlagRegs);
asm_setcc(r, ins);
#ifdef NJ_ARM_VFP
SETE(r);
#else
// SETcc only sets low 8 bits, so extend
MOVZX8(r,r);
SETNP(r);
#endif
asm_fcmp(ins);
}

Просмотреть файл

@ -333,7 +333,6 @@ namespace avmplus {
sse2 = true;
use_cmov = true;
#endif
tree_opt = 0;
}
uint32_t tree_opt:1;
@ -344,10 +343,32 @@ namespace avmplus {
uint32_t verbose_exits:1;
uint32_t show_stats:1;
#if defined (AVMPLUS_IA32) || defined(AVMPLUS_AMD64)
bool sse2;
bool use_cmov;
#endif
#if defined (AVMPLUS_IA32) || defined(AVMPLUS_AMD64)
bool sse2;
bool use_cmov;
#endif
#if defined (AVMPLUS_ARM)
// whethergenerate VFP instructions
# if defined (NJ_FORCE_SOFTFLOAT)
static const bool vfp = false;
# else
bool vfp;
# endif
// whether generate ARMv6t2 instructions (MOVT/MOVW)
# if defined (NJ_FORCE_NO_ARM_V6T2)
static const bool v6t2 = false;
# else
bool v6t2;
# endif
#endif
#if defined (NJ_FORCE_SOFTFLOAT)
static const bool soft_float = true;
#else
bool soft_float;
#endif
};
static const int kstrconst_emptyString = 0;

Просмотреть файл

@ -4559,6 +4559,9 @@ function testLengthInString()
var res = "length" in s;
for (var i = 0; i < 5; i++)
res = res && ("length" in s);
res = res && s.hasOwnProperty("length");
for (var i = 0; i < 5; i++)
res = res && s.hasOwnProperty("length");
return res;
}
testLengthInString.expected = true;
@ -4655,6 +4658,89 @@ function testNEWINIT_DOUBLE()
testNEWINIT_DOUBLE.expected = "ok";
test(testNEWINIT_DOUBLE);
function testIntOverflow() {
// int32_max - 7
var ival = 2147483647 - 7;
for (var i = 0; i < 30; i++) {
ival += 2;
}
return (ival < 2147483647);
}
testIntOverflow.expected = false;
testIntOverflow.jitstats = {
recorderStarted: 2,
recorderAborted: 0,
traceCompleted: 2,
traceTriggered: 2,
};
test(testIntOverflow);
function testIntUnderflow() {
// int32_min + 8
var ival = -2147483648 + 8;
for (var i = 0; i < 30; i++) {
ival -= 2;
}
return (ival > -2147483648);
}
testIntUnderflow.expected = false;
testIntUnderflow.jitstats = {
recorderStarted: 2,
recorderAborted: 0,
traceCompleted: 2,
traceTriggered: 2,
};
test(testIntUnderflow);
function testCALLELEM()
{
function f() {
return 5;
}
function g() {
return 7;
}
var x = [f,f,f,f,g];
var y = 0;
for (var i = 0; i < 5; ++i)
y = x[i]();
return y;
}
testCALLELEM.expected = 7;
test(testCALLELEM);
function testNewString()
{
var o = { toString: function() { return "string"; } };
var r = [];
for (var i = 0; i < 5; i++)
r.push(typeof new String(o));
for (var i = 0; i < 5; i++)
r.push(typeof new String(3));
for (var i = 0; i < 5; i++)
r.push(typeof new String(2.5));
for (var i = 0; i < 5; i++)
r.push(typeof new String("string"));
for (var i = 0; i < 5; i++)
r.push(typeof new String(null));
for (var i = 0; i < 5; i++)
r.push(typeof new String(true));
for (var i = 0; i < 5; i++)
r.push(typeof new String(undefined));
return r.length === 35 && r.every(function(v) { return v === "object"; });
}
testNewString.expected = true;
testNewString.jitstats = {
recorderStarted: 7,
recorderAborted: 0,
traceCompleted: 7,
sideExitIntoInterpreter: 7
};
test(testNewString);
/*****************************************************************************
* *
* _____ _ _ _____ ______ _____ _______ *

Просмотреть файл

@ -1090,23 +1090,6 @@ XPCJSRuntime::XPCJSRuntime(nsXPConnect* aXPConnect)
// these jsids filled in later when we have a JSContext to work with.
mStrIDs[0] = 0;
// Call XPCPerThreadData::GetData to initialize
// XPCPerThreadData::gTLSIndex before initializing
// JSRuntime::threadTPIndex in JS_NewRuntime.
//
// XPConnect uses a thread local storage (XPCPerThreadData) indexed by
// XPCPerThreadData::gTLSIndex, and SpiderMonkey GC uses a thread local
// storage indexed by JSRuntime::threadTPIndex.
//
// The destructor for XPCPerThreadData::gTLSIndex may access
// thread local storage indexed by JSRuntime::threadTPIndex.
// Thus, the destructor for JSRuntime::threadTPIndex must be called
// later than the one for XPCPerThreadData::gTLSIndex.
//
// We rely on the implementation of NSPR that calls destructors at
// the same order of calling PR_NewThreadPrivateIndex.
XPCPerThreadData::GetData(nsnull);
mJSRuntime = JS_NewRuntime(32L * 1024L * 1024L); // pref ?
if(mJSRuntime)
{

Просмотреть файл

@ -0,0 +1,76 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is JavaScript Engine testing utilities.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s): Peter Seliger
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
var gTestfile = '15.5.4.8-01.js';
//-----------------------------------------------------------------------------
var BUGNUMBER = 480096;
var summary = 'Array.lastIndexOf';
var actual = '';
var expect = '';
//-----------------------------------------------------------------------------
test();
//-----------------------------------------------------------------------------
function test()
{
enterFunc ('test');
printBugNumber(BUGNUMBER);
printStatus (summary);
expect = '-12';
actual = 0;
actual += Array.lastIndexOf([2, 3,, 4, 5, 6]);
actual += [2, 3,, 4, 5, 6].lastIndexOf();
actual += Array.prototype.lastIndexOf.call([2, 3,, 4, 5, 6]);
actual += Array.prototype.lastIndexOf.apply([2, 3,, 4, 5, 6], [, -4]);
actual += Array.prototype.lastIndexOf.apply([2, 3,, 4, 5, 6], [undefined, -4]);
actual += Array.prototype.lastIndexOf.apply([2, 3,, 4, 5, 6], [undefined, -5]);
actual += Array.lastIndexOf([2, 3,, 4, 5, 6], undefined);
actual += Array.lastIndexOf([2, 3,, 4, 5, 6], undefined, 1);
actual += Array.lastIndexOf([2, 3,, 4, 5, 6], undefined, 2);
actual += Array.lastIndexOf([2, 3,, 4, 5, 6], undefined);
actual += Array.lastIndexOf([2, 3,, 4, 5, 6], undefined, 1);
actual += Array.lastIndexOf([2, 3,, 4, 5, 6], undefined, 2);
actual = String(actual);
reportCompare(expect, actual, summary);
exitFunc ('test');
}

Просмотреть файл

@ -0,0 +1,60 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is JavaScript Engine testing utilities.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2007
* the Initial Developer. All Rights Reserved.
*
* Contributor(s): Jesse Ruderman
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
var gTestfile = 'regress-469937.js';
//-----------------------------------------------------------------------------
var BUGNUMBER = 469937;
var summary = 'Properties without DontEnum are sometimes not enumerated';
var actual = false;
var expect = true;
printBugNumber(BUGNUMBER);
printStatus (summary);
(function(){
var o = { }
o.PageLeft = 1;
o.Rect2 = 6;
delete o.Rect2;
for (var p in o);
o.Rect3 = 7;
found = false;
for (var p in o) if (p == 'Rect3') found = true;
actual = found;
})();
reportCompare(expect, actual, summary);

Просмотреть файл

@ -0,0 +1,67 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is JavaScript Engine testing utilities.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s): Gary Kwong
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
var gTestfile = 'regress-457065-03.js';
//-----------------------------------------------------------------------------
var BUGNUMBER = 457065;
var summary = 'Do not assert: !fp->callee || fp->thisp == JSVAL_TO_OBJECT(fp->argv[-1])';
var actual = '';
var expect = '';
//-----------------------------------------------------------------------------
test();
//-----------------------------------------------------------------------------
function test()
{
enterFunc ('test');
printBugNumber(BUGNUMBER);
printStatus (summary);
jit(true);
(function() {
new function (){ for (var x = 0; x < 3; ++x){} };
})();
jit(false);
reportCompare(expect, actual, summary);
exitFunc ('test');
}

Просмотреть файл

@ -0,0 +1,77 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is JavaScript Engine testing utilities.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s): Jesse Ruderman
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
var gTestfile = 'regress-477733.js';
//-----------------------------------------------------------------------------
var BUGNUMBER = 477733;
var summary = 'TM: Do not assert: !(fp->flags & JSFRAME_POP_BLOCKS)';
var actual = '';
var expect = '';
//-----------------------------------------------------------------------------
test();
//-----------------------------------------------------------------------------
function test()
{
enterFunc ('test');
printBugNumber(BUGNUMBER);
printStatus (summary);
jit(true);
function g() {
[];
}
try {
d.d.d;
} catch(e) {
void (function(){});
}
for (var o in [1, 2, 3]) {
g();
}
jit(false);
reportCompare(expect, actual, summary);
exitFunc ('test');
}

Просмотреть файл

@ -0,0 +1,86 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is JavaScript Engine testing utilities.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s): Graydon Hoare
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
var gTestfile = 'regress-480244.js';
//-----------------------------------------------------------------------------
var BUGNUMBER = 480244;
var summary = 'Do not assert: isInt32(*p)';
var actual = '';
var expect = '';
//-----------------------------------------------------------------------------
test();
//-----------------------------------------------------------------------------
function test()
{
enterFunc ('test');
printBugNumber(BUGNUMBER);
printStatus (summary);
jit(true);
function outer() {
var v = 10.234;
for (var i = 0; i < 0xff; ++i) {
inner(v);
}
}
var g = 0;
var h = 0;
function inner() {
var v = 10;
for (var k = 0; k < 0xff; ++k) {
g++;
if (g & 0xff == 0xff)
h++;
}
return h;
}
outer();
print("g=" + g + " h=" + h);
jit(false);
reportCompare(expect, actual, summary);
exitFunc ('test');
}

Просмотреть файл

@ -0,0 +1,68 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is JavaScript Engine testing utilities.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s): Jesse Ruderman
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
var gTestfile = 'regress-483103.js';
//-----------------------------------------------------------------------------
var BUGNUMBER = 483103;
var summary = 'TM: Do not assert: p->isQuad()';
var actual = '';
var expect = '';
//-----------------------------------------------------------------------------
test();
//-----------------------------------------------------------------------------
function test()
{
enterFunc ('test');
printBugNumber(BUGNUMBER);
printStatus (summary);
jit(true);
var t = new String("");
for (var j = 0; j < 3; ++j) {
var e = t["-1"];
}
jit(false);
reportCompare(expect, actual, summary);
exitFunc ('test');
}

Просмотреть файл

@ -0,0 +1,79 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is JavaScript Engine testing utilities.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s): Igor Bukanov
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
var gTestfile = 'regress-479487.js';
//-----------------------------------------------------------------------------
var BUGNUMBER = 479487;
var summary = 'js_Array_dense_setelem can call arbitrary JS code';
var actual = '';
var expect = '';
//-----------------------------------------------------------------------------
test();
//-----------------------------------------------------------------------------
function test()
{
enterFunc ('test');
printBugNumber(BUGNUMBER);
printStatus (summary);
jit(true);
Array.prototype[1] = 2;
Array.prototype.__defineSetter__(32, function() { print("Hello from arbitrary JS");});
Array.prototype.__defineGetter__(32, function() { return 11; });
function f()
{
var a = [];
for (var i = 0; i != 10; ++i) {
a[1 << i] = 9999;
}
return a;
}
f();
jit(false);
reportCompare(expect, actual, summary);
exitFunc ('test');
}

Просмотреть файл

@ -0,0 +1,77 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is JavaScript Engine testing utilities.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s): Jeff Walden
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
var gTestfile = 'regress-479551.js';
//-----------------------------------------------------------------------------
var BUGNUMBER = 479551;
var summary = 'Do not assert: (cx)->requestDepth || (cx)->thread == (cx)->runtime->gcThread';
var actual = '';
var expect = '';
//-----------------------------------------------------------------------------
test();
//-----------------------------------------------------------------------------
function test()
{
enterFunc ('test');
printBugNumber(BUGNUMBER);
printStatus (summary);
if (typeof shapeOf != 'function')
{
print(expect = actual = 'Test skipped: requires shell');
}
else
{
jit(true);
var o = {a:3, b:2};
shapeOf(o);
var p = {};
p.a =3;
p.b=2;
shapeOf(p);
jit(false);
}
reportCompare(expect, actual, summary);
exitFunc ('test');
}

Просмотреть файл

@ -0,0 +1,69 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is JavaScript Engine testing utilities.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s): Jason Orendorff
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
var gTestfile = 'regress-480579.js';
//-----------------------------------------------------------------------------
var BUGNUMBER = 480579;
var summary = 'Do not assert: pobj_ == obj2';
var actual = '';
var expect = '';
//-----------------------------------------------------------------------------
test();
//-----------------------------------------------------------------------------
function test()
{
enterFunc ('test');
printBugNumber(BUGNUMBER);
printStatus (summary);
expect = '12';
a = {x: 1};
b = {__proto__: a};
c = {__proto__: b};
for (i = 0; i < 2; i++) {
print(actual += c.x);
b.x = 2;
}
reportCompare(expect, actual, summary);
exitFunc ('test');
}

Просмотреть файл

@ -0,0 +1,72 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is JavaScript Engine testing utilities.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s): Jason Orendorff
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
var gTestfile = 'regress-481516.js';
//-----------------------------------------------------------------------------
var BUGNUMBER = 481516;
var summary = 'TM: pobj_ == obj2';
var actual = '';
var expect = '';
//-----------------------------------------------------------------------------
test();
//-----------------------------------------------------------------------------
function test()
{
enterFunc ('test');
printBugNumber(BUGNUMBER);
printStatus (summary);
expect = '1111222';
a = {x: 1};
b = {__proto__: a};
c = {__proto__: b};
objs = [{__proto__: a}, {__proto__: a}, {__proto__: a}, b, {__proto__: a},
{__proto__: a}];
for (i = 0; i < 6; i++) {
print(actual += ""+c.x);
objs[i].x = 2;
}
print(actual += c.x);
reportCompare(expect, actual, summary);
exitFunc ('test');
}

Просмотреть файл

@ -0,0 +1,75 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is JavaScript Engine testing utilities.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s): Gary Kwong
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
var gTestfile = 'regress-476655.js';
//-----------------------------------------------------------------------------
var BUGNUMBER = 476655;
var summary = 'TM: Do not assert: count <= (size_t) (fp->regs->sp - StackBase(fp) - depth)';
var actual = '';
var expect = '';
//-----------------------------------------------------------------------------
test();
//-----------------------------------------------------------------------------
function test()
{
enterFunc ('test');
printBugNumber(BUGNUMBER);
printStatus (summary);
jit(true);
try
{
eval(
"(function (){ for (var y in this) {} })();" +
"[''.watch(\"\", function(){}) for each (x in ['', '', eval, '', '']) if " +
"(x)].map(Function)"
);
}
catch(ex)
{
}
jit(false);
reportCompare(expect, actual, summary);
exitFunc ('test');
}

Просмотреть файл

Просмотреть файл

Просмотреть файл

Просмотреть файл

@ -0,0 +1,73 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is JavaScript Engine testing utilities.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s): Igor Bukanov
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
var gTestfile = 'regress-479252.js';
//-----------------------------------------------------------------------------
var BUGNUMBER = 479252;
var summary = 'Avoid watchdog ticks when idle in shell';
var actual = '';
var expect = '';
//-----------------------------------------------------------------------------
test();
//-----------------------------------------------------------------------------
function test()
{
enterFunc ('test');
printBugNumber(BUGNUMBER);
printStatus (summary);
if (typeof sleep != 'function' || typeof scatter != 'function' ||
typeof timeout != 'function')
{
print(expect = actual = 'Test skipped: requires mulithreads and timeout.');
}
else
{
expectExitCode(6);
function f() { sleep(100); }
timeout(1.0);
scatter([f,f,f,f,f]);
}
reportCompare(expect, actual, summary);
exitFunc ('test');
}

Просмотреть файл

@ -0,0 +1,79 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is JavaScript Engine testing utilities.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s): Jason Orendorff
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
var gTestfile = 'regress-479381.js';
//-----------------------------------------------------------------------------
var BUGNUMBER = 479381;
var summary = 'Do not crash @ js_FinalizeStringRT with multi-threads.';
var actual = '';
var expect = '';
//-----------------------------------------------------------------------------
test();
//-----------------------------------------------------------------------------
function test()
{
enterFunc ('test');
printBugNumber(BUGNUMBER);
printStatus (summary);
if (typeof gczeal != 'function' || typeof scatter != 'function')
{
print(expect = actual = 'Test skipped: requires mulithreads');
}
else
{
expect = actual = 'No Crash';
gczeal(2);
function f() {
var s;
for (var i = 0; i < 9999; i++)
s = 'a' + String(i)[3] + 'b';
return s;
}
print(scatter([f, f, f, f]));
}
reportCompare(expect, actual, summary);
exitFunc ('test');
}

Просмотреть файл

Просмотреть файл

Просмотреть файл

@ -0,0 +1,67 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is JavaScript Engine testing utilities.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s): Jesse Ruderman
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
var gTestfile = 'regress-457065-01.js';
//-----------------------------------------------------------------------------
var BUGNUMBER = 457065;
var summary = 'Do not assert: !fp->callee || fp->thisp == JSVAL_TO_OBJECT(fp->argv[-1])';
var actual = '';
var expect = '';
//-----------------------------------------------------------------------------
test();
//-----------------------------------------------------------------------------
function test()
{
enterFunc ('test');
printBugNumber(BUGNUMBER);
printStatus (summary);
jit(true);
var e = eval;
for (var a in this) { }
(function() { eval("this; for (let b in [0,1,2]) { }"); })();
jit(false);
reportCompare(expect, actual, summary);
exitFunc ('test');
}

Просмотреть файл

@ -0,0 +1,65 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is JavaScript Engine testing utilities.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s): Jesse Ruderman
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
var gTestfile = 'regress-457065-02.js';
//-----------------------------------------------------------------------------
var BUGNUMBER = 457065;
var summary = 'Do not assert: !fp->callee || fp->thisp == JSVAL_TO_OBJECT(fp->argv[-1])';
var actual = '';
var expect = '';
//-----------------------------------------------------------------------------
test();
//-----------------------------------------------------------------------------
function test()
{
enterFunc ('test');
printBugNumber(BUGNUMBER);
printStatus (summary);
jit(true);
(function(){ eval('this'); (function(){ for(let y in [0,1,2]) 6;})(); })();
jit(false);
reportCompare(expect, actual, summary);
exitFunc ('test');
}

Просмотреть файл

@ -0,0 +1,78 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is JavaScript Engine testing utilities.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s): Jesse Ruderman
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
var gTestfile = 'regress-471373.js';
//-----------------------------------------------------------------------------
var BUGNUMBER = 471373;
var summary = 'TM: do not assert: (size_t)(regs.pc - script->code) < script->length';
var actual = '';
var expect = '';
//-----------------------------------------------------------------------------
test();
//-----------------------------------------------------------------------------
function test()
{
enterFunc ('test');
printBugNumber(BUGNUMBER);
printStatus (summary);
if (typeof window == 'undefined')
{
expectExitCode(5);
}
jit(true);
function g() {
var x = <x/>;
for (var b = 0; b < 2; ++b) {
yield x;
for (var c = 0; c < 10;++c) {
x.r = x;
}
}
}
for (let y in g()) { }
jit(false);
reportCompare(expect, actual, summary);
exitFunc ('test');
}

Просмотреть файл

@ -0,0 +1,72 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is JavaScript Engine testing utilities.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s): Gary Kwong
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
var gTestfile = 'regress-471660.js';
//-----------------------------------------------------------------------------
var BUGNUMBER = 471660;
var summary = 'TM: Do not assert: !(fp->flags & JSFRAME_POP_BLOCKS)';
var actual = '';
var expect = '';
//-----------------------------------------------------------------------------
test();
//-----------------------------------------------------------------------------
function test()
{
enterFunc ('test');
printBugNumber(BUGNUMBER);
printStatus (summary);
jit(true);
y = <x/>;
for (var w = 0; w < 5; ++w) {
let (y) { do break ; while (true); }
for each (let x in [{}, function(){}]) {y}
}
jit(false);
reportCompare(expect, actual, summary);
exitFunc ('test');
}

Просмотреть файл

@ -0,0 +1,74 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is JavaScript Engine testing utilities.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s): Gary Kwong
* Jesse Ruderman
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
var gTestfile = 'regress-472528-01.js';
//-----------------------------------------------------------------------------
var BUGNUMBER = 472528;
var summary = 'Do not assert: !js_IsActiveWithOrBlock(cx, fp->scopeChain, 0)';
var actual = '';
var expect = '';
//-----------------------------------------------------------------------------
test();
//-----------------------------------------------------------------------------
function test()
{
enterFunc ('test');
printBugNumber(BUGNUMBER);
printStatus (summary);
jit(true);
try
{
for (var i = 0; i < 4; ++i) {
for (let j = 0; j < 2; ++j) { }
let (x) (function(){});
}
}
catch(ex)
{
}
jit(false);
reportCompare(expect, actual, summary);
exitFunc ('test');
}

Просмотреть файл

@ -0,0 +1,74 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is JavaScript Engine testing utilities.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s): Gary Kwong
* Jesse Ruderman
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
var gTestfile = 'regress-472528-02.js';
//-----------------------------------------------------------------------------
var BUGNUMBER = 472528;
var summary = 'Do not assert: !fp->blockChain';
var actual = '';
var expect = '';
//-----------------------------------------------------------------------------
test();
//-----------------------------------------------------------------------------
function test()
{
enterFunc ('test');
printBugNumber(BUGNUMBER);
printStatus (summary);
jit(true);
try
{
for (let i = 0; i < 4; ++i) {
for (let j = 0; j < 2; ++j) { }
let (x) (function(){});
}
}
catch(ex)
{
}
jit(false);
reportCompare(expect, actual, summary);
exitFunc ('test');
}

Просмотреть файл

@ -0,0 +1,73 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is JavaScript Engine testing utilities.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s): Gary Kwong
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
var gTestfile = 'regress-472703.js';
//-----------------------------------------------------------------------------
var BUGNUMBER = 472703;
var summary = 'Do not assert: regs.sp[-1] == OBJECT_TO_JSVAL(fp->scopeChain)';
var actual = '';
var expect = '';
//-----------------------------------------------------------------------------
test();
//-----------------------------------------------------------------------------
function test()
{
enterFunc ('test');
printBugNumber(BUGNUMBER);
printStatus (summary);
jit(true);
try
{
eval(
'for (var z = 0; z < 2; ++z) { with({}) for(let y in [1, null]); let(x)' +
'(function(){})(); }'
);
}
catch(ex)
{
}
jit(false);
reportCompare(expect, actual, summary);
exitFunc ('test');
}

Просмотреть файл

@ -0,0 +1,74 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is JavaScript Engine testing utilities.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s): Gary Kwong
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
var gTestfile = 'regress-476655.js';
//-----------------------------------------------------------------------------
var BUGNUMBER = 476655;
var summary = 'Do not assert: depth <= (size_t) (fp->regs->sp - StackBase(fp))';
var actual = '';
var expect = '';
//-----------------------------------------------------------------------------
test();
//-----------------------------------------------------------------------------
function test()
{
enterFunc ('test');
printBugNumber(BUGNUMBER);
printStatus (summary);
jit(true);
try
{
eval(
"for(let y in ['', '']) try {for(let y in ['', '']) ( /x/g ); } finally {" +
"with({}){} } this.zzz.zzz"
);
}
catch(ex)
{
}
jit(false);
reportCompare(expect, actual, summary);
exitFunc ('test');
}

Просмотреть файл

@ -0,0 +1,60 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is JavaScript Engine testing utilities.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s): Gary Kwong
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
var gTestfile = 'regress-483749.js';
//-----------------------------------------------------------------------------
var BUGNUMBER = 483749;
var summary = 'Do not assert: !js_IsActiveWithOrBlock(cx, fp->scopeChain, 0)';
var actual = '';
var expect = '';
printBugNumber(BUGNUMBER);
printStatus (summary);
jit(true);
for each (let x in ['']) {
for (var b = 0; b < 5; ++b) {
if (b % 5 == 3) {
with([]) this;
}
}
}
jit(false);
reportCompare(expect, actual, summary);

Просмотреть файл

Просмотреть файл

Просмотреть файл

@ -0,0 +1,78 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is JavaScript Engine testing utilities.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s): Andreas Gal
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
var gTestfile = 'regress-452498-006.js';
//-----------------------------------------------------------------------------
var BUGNUMBER = 452498;
var summary = 'TM: upvar2 regression tests';
var actual = '';
var expect = '';
//-----------------------------------------------------------------------------
test();
//-----------------------------------------------------------------------------
function test()
{
enterFunc ('test');
printBugNumber(BUGNUMBER);
printStatus (summary);
// ------- Comment #6 From Andreas Gal :gal
function foo() {
var x = 4;
var f = (function() { return x++; });
var g = (function() { return x++; });
return [f,g];
}
var bar = foo();
expect = '9';
actual = 0;
bar[0]();
bar[1]();
actual = String(expect);
reportCompare(expect, actual, summary);
exitFunc ('test');
}

Просмотреть файл

@ -0,0 +1,71 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is JavaScript Engine testing utilities.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s): Brendan Eich
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
var gTestfile = 'regress-452498-027.js';
//-----------------------------------------------------------------------------
var BUGNUMBER = 452498;
var summary = 'TM: upvar2 regression tests';
var actual = '';
var expect = '';
//-----------------------------------------------------------------------------
test();
//-----------------------------------------------------------------------------
function test()
{
enterFunc ('test');
printBugNumber(BUGNUMBER);
printStatus (summary);
expect = '5';
// ------- Comment #27 From Brendan Eich
function f(x){function g(y)x+y;return g}
g = f(2);
actual = String(g(3));
reportCompare(expect, actual, summary);
exitFunc ('test');
}

Просмотреть файл

@ -0,0 +1,64 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is JavaScript Engine testing utilities.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s): Mike Shaver
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
var gTestfile = 'regress-452498-030.js';
//-----------------------------------------------------------------------------
var BUGNUMBER = 452498;
var summary = 'TM: upvar2 regression tests';
var actual = '';
var expect = '';
//-----------------------------------------------------------------------------
test();
//-----------------------------------------------------------------------------
function test()
{
enterFunc ('test');
printBugNumber(BUGNUMBER);
printStatus (summary);
// ------- Comment #30 From Mike Shaver
function f() { var i = 0; var i = 5; }
f();
reportCompare(expect, actual, summary);
exitFunc ('test');
}

Просмотреть файл

@ -0,0 +1,63 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is JavaScript Engine testing utilities.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s): Jesse Ruderman
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
var gTestfile = 'regress-452498-038.js';
//-----------------------------------------------------------------------------
var BUGNUMBER = 452498;
var summary = 'TM: upvar2 regression tests';
var actual = '';
var expect = '';
//-----------------------------------------------------------------------------
test();
//-----------------------------------------------------------------------------
function test()
{
enterFunc ('test');
printBugNumber(BUGNUMBER);
printStatus (summary);
// ------- Comment #38 From Jesse Ruderman
[0 for (a in [])];
reportCompare(expect, actual, summary);
exitFunc ('test');
}

Просмотреть файл

@ -0,0 +1,68 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is JavaScript Engine testing utilities.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
var gTestfile = 'regress-452498-039.js';
//-----------------------------------------------------------------------------
var BUGNUMBER = 452498;
var summary = 'TM: upvar2 regression tests';
var actual = '';
var expect = '';
//-----------------------------------------------------------------------------
test();
//-----------------------------------------------------------------------------
function test()
{
enterFunc ('test');
printBugNumber(BUGNUMBER);
printStatus (summary);
expect = '10';
// ------- Comment #39 From Jesse Ruderman
const e = 0;
print(actual = ++e);
actual = String(actual) + e;
reportCompare(expect, actual, summary);
exitFunc ('test');
}

Просмотреть файл

@ -0,0 +1,70 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is JavaScript Engine testing utilities.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s): Jesse Ruderman
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
var gTestfile = 'regress-452498-040.js';
//-----------------------------------------------------------------------------
var BUGNUMBER = 452498;
var summary = 'TM: upvar2 regression tests';
var actual = '';
var expect = '';
//-----------------------------------------------------------------------------
test();
//-----------------------------------------------------------------------------
function test()
{
enterFunc ('test');
printBugNumber(BUGNUMBER);
printStatus (summary);
// ------- Comment #40 From Jesse Ruderman
function m()
{
function a() { }
function b() { a(); }
this.c = function () { b(); }
}
(new m).c();
reportCompare(expect, actual, summary);
exitFunc ('test');
}

Просмотреть файл

@ -0,0 +1,77 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is JavaScript Engine testing utilities.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s): Jason Orendorff
* Gary Kwong
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
var gTestfile = 'regress-452498-050.js';
//-----------------------------------------------------------------------------
var BUGNUMBER = 452498;
var summary = 'TM: upvar2 regression tests';
var actual = '';
var expect = '';
//-----------------------------------------------------------------------------
test();
//-----------------------------------------------------------------------------
function test()
{
enterFunc ('test');
printBugNumber(BUGNUMBER);
printStatus (summary);
// ------- Comment #50 From Jason Orendorff
// Do not crash
// compiler bug when a block introduces no names
let ({}={}) {}
try
{
// compiler incorrectly emits GETLOCAL for first `x`,
// triggering decompiler assertion
while (x.y) { let x; }
}
catch(ex)
{
}
reportCompare(expect, actual, summary);
exitFunc ('test');
}

Просмотреть файл

@ -0,0 +1,79 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is JavaScript Engine testing utilities.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s): Jason Orendorff
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
var gTestfile = 'regress-452498-051.js';
//-----------------------------------------------------------------------------
var BUGNUMBER = 452498;
var summary = 'TM: upvar2 regression tests';
var actual = '';
var expect = '';
//-----------------------------------------------------------------------------
test();
//-----------------------------------------------------------------------------
function test()
{
enterFunc ('test');
printBugNumber(BUGNUMBER);
printStatus (summary);
// ------- Comment #51 From Jason Orendorff
// Assertion failure: UPVAR_FRAME_SKIP(uva->vector[i]) == 0
// at ../jsopcode.cpp:2791
//
// when decompiling the eval code, which is:
//
// main:
// 00000: 10 getupvar 0
// 00003: 10 getprop "y"
// 00006: 10 popv
// 00007: 10 stop
try
{
function f() { var x; eval("x.y"); }
f();
}
catch(ex)
{
}
reportCompare(expect, actual, summary);
exitFunc ('test');
}

Просмотреть файл

@ -0,0 +1,72 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is JavaScript Engine testing utilities.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s): Jason Orendorff
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
var gTestfile = 'regress-452498-052-a.js';
//-----------------------------------------------------------------------------
var BUGNUMBER = 452498;
var summary = 'TM: upvar2 regression tests';
var actual = '';
var expect = '';
//-----------------------------------------------------------------------------
test();
//-----------------------------------------------------------------------------
function test()
{
enterFunc ('test');
printBugNumber(BUGNUMBER);
printStatus (summary);
// ------- Comment #52 From Jason Orendorff
// Assertion failure: pn_arity == PN_FUNC || pn_arity == PN_NAME, at ../jsparse.h:444
// Here the function node has been morphed into a JSOP_TRUE node, but we're in
// FindFunArgs poking it anyway.
if (typeof timeout == 'function')
{
expectExitCode(6);
timeout(3);
while(function(){});
}
reportCompare(expect, actual, summary);
exitFunc ('test');
}

Просмотреть файл

@ -0,0 +1,82 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is JavaScript Engine testing utilities.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s): Jason Orendorff
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
var gTestfile = 'regress-452498-052.js';
//-----------------------------------------------------------------------------
var BUGNUMBER = 452498;
var summary = 'TM: upvar2 regression tests';
var actual = '';
var expect = '';
//-----------------------------------------------------------------------------
test();
//-----------------------------------------------------------------------------
function test()
{
enterFunc ('test');
printBugNumber(BUGNUMBER);
printStatus (summary);
// ------- Comment #52 From Jason Orendorff
// Crash in NoteLValue, called from BindDestructuringVar.
// NoteLValue assumes pn->pn_lexdef is non-null, but here
// pn is itself the definition of x.
for (var [x]=0 in null) ;
// This one only crashes when executed from a file.
// Assertion failure: pn != dn->dn_uses, at ../jsparse.cpp:1131
for (var f in null)
;
var f = 1;
(f)
// Assertion failure: pnu->pn_cookie == FREE_UPVAR_COOKIE, at ../jsemit.cpp:1815
// In EmitEnterBlock. x has one use, which is pnu here.
// pnu is indeed a name, but pnu->pn_cookie is 0.
let (x = 1) { var x; }
// Assertion failure: cg->upvars.lookup(atom), at ../jsemit.cpp:1992
// atom="x", upvars is empty.
(1 for each (x in x));
reportCompare(expect, actual, summary);
exitFunc ('test');
}

Просмотреть файл

@ -0,0 +1,111 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is JavaScript Engine testing utilities.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s): Jason Orendorff
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
var gTestfile = 'regress-452498-053.js';
//-----------------------------------------------------------------------------
var BUGNUMBER = 452498;
var summary = 'TM: upvar2 regression tests';
var actual = '';
var expect = '';
//-----------------------------------------------------------------------------
test();
//-----------------------------------------------------------------------------
function test()
{
enterFunc ('test');
printBugNumber(BUGNUMBER);
printStatus (summary);
// ------- Comment #53 From Jason Orendorff
// Assertion failure: (slot) < (uint32)(obj)->dslots[-1]
// at ../jsobj.cpp:5559
// On the last line of BindLet, we have
// JS_SetReservedSlot(cx, blockObj, index, PRIVATE_TO_JSVAL(pn));
// but this uses reserved slots as though they were unlimited.
// blockObj only has 2.
let (a=0, b=1, c=2) {}
// In RecycleTree at ../jsparse.cpp:315, we hit
// JS_NOT_REACHED("RecycleUseDefKids");
// pn->pn_type is TOK_UNARYOP
// pn->pn_op is JSOP_XMLNAME
// pn->pn_defn is 1
// pn->pn_used is 1
try
{
@foo; 0;
}
catch(ex)
{
}
// Calls LinkUseToDef with pn->pn_defn == 1.
//
// If you say "var x;" first, then run this case, it gets further,
// crashing in NoteLValue like the first case in comment 52.
//
try
{
for (var [x] = x in y) var x;
}
catch(ex)
{
}
// Assertion failure: !pn2->pn_defn, at ../jsparse.h:461
// Another case where some optimization is going on.
try
{
if (true && @foo) ;
}
catch(ex)
{
}
// Assertion failure: scope->object == ctor
// in js_FastNewObject at ../jsbuiltins.cpp:237
//
// With the patch, we're new-ing a different function each time, and the
// .prototype property is missing.
//
for (var z = 0; z < 3; z++) { (new function(){}); }
reportCompare(expect, actual, summary);
exitFunc ('test');
}

Просмотреть файл

@ -0,0 +1,73 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is JavaScript Engine testing utilities.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s): Jason Orendorff
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
var gTestfile = 'regress-452498-054.js';
//-----------------------------------------------------------------------------
var BUGNUMBER = 452498;
var summary = 'TM: upvar2 regression tests';
var actual = '';
var expect = '';
//-----------------------------------------------------------------------------
test();
//-----------------------------------------------------------------------------
function test()
{
enterFunc ('test');
printBugNumber(BUGNUMBER);
printStatus (summary);
// ------- Comment #54 From Jason Orendorff
// Assertion failure: cg->flags & TCF_IN_FUNCTION
// at ../jsemit.cpp:1991
//
function f() { var x; eval("let x, x;"); }
f();
// Assertion failure: fp2->fun && fp2->script,
// at ../jsinterp.cpp:5589
//
eval("let(x) function(){ x = this; }()");
reportCompare(expect, actual, summary);
exitFunc ('test');
}

Просмотреть файл

@ -0,0 +1,64 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is JavaScript Engine testing utilities.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s): Gary Kwong
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
var gTestfile = 'regress-452498-058.js';
//-----------------------------------------------------------------------------
var BUGNUMBER = 452498;
var summary = 'TM: upvar2 regression tests';
var actual = '';
var expect = '';
//-----------------------------------------------------------------------------
test();
//-----------------------------------------------------------------------------
function test()
{
enterFunc ('test');
printBugNumber(BUGNUMBER);
printStatus (summary);
// ------- Comment #58 From Gary Kwong [:nth10sd]
function foo(x) { var x = x }
// Assertion failure: dn->kind() == ((data->op == JSOP_DEFCONST) ? JSDefinition::CONST : JSDefinition::VAR), at ../jsparse.cpp:2595
reportCompare(expect, actual, summary);
exitFunc ('test');
}

Просмотреть файл

@ -0,0 +1,77 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is JavaScript Engine testing utilities.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s): Gary Kwong
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
var gTestfile = 'regress-452498-062.js';
//-----------------------------------------------------------------------------
var BUGNUMBER = 452498;
var summary = 'TM: upvar2 regression tests';
var actual = '';
var expect = '';
//-----------------------------------------------------------------------------
test();
//-----------------------------------------------------------------------------
function test()
{
enterFunc ('test');
printBugNumber(BUGNUMBER);
printStatus (summary);
// ------- Comment #62 From Gary Kwong [:nth10sd]
try
{
eval(
'(function(){' +
' var x;' +
' this.init_by_array = function()' +
' x = 0;' +
'})();'
);
}
catch(ex)
{
}
// Assertion failure: ATOM_IS_STRING(atom), at ../jsinterp.cpp:5686
reportCompare(expect, actual, summary);
exitFunc ('test');
}

Просмотреть файл

@ -0,0 +1,68 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is JavaScript Engine testing utilities.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s): Brendan Eich
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
var gTestfile = 'regress-452498-063.js';
//-----------------------------------------------------------------------------
var BUGNUMBER = 452498;
var summary = 'TM: upvar2 regression tests';
var actual = '';
var expect = '';
//-----------------------------------------------------------------------------
test();
//-----------------------------------------------------------------------------
function test()
{
enterFunc ('test');
printBugNumber(BUGNUMBER);
printStatus (summary);
// ------- Comment #63 From Brendan Eich
function f(that) {
for (ix in this)
print(ix);
for (let ix in that)
;
}
reportCompare(expect, actual, summary);
exitFunc ('test');
}

Просмотреть файл

@ -0,0 +1,129 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is JavaScript Engine testing utilities.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s): Gary Kwong
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
var gTestfile = 'regress-452498-068.js';
//-----------------------------------------------------------------------------
var BUGNUMBER = 452498;
var summary = 'TM: upvar2 regression tests';
var actual = '';
var expect = '';
//-----------------------------------------------------------------------------
test();
//-----------------------------------------------------------------------------
function test()
{
enterFunc ('test');
printBugNumber(BUGNUMBER);
printStatus (summary);
// ------- Comment #68 From Gary Kwong [:nth10sd]
try
{
eval("*;", (3/0 ? function(id) { return id } : <><x><y/></x></>));
}
catch(ex)
{
}
// =====
foo = "" + new Function("while(\u3056){let \u3056 = x}");
// =====
function a(){ let c; eval("let c, y"); }
a();
// =====
try
{
{x: 1e+81 ? c : arguments}
}
catch(ex)
{
}
// =====
(function(q){return q;} for each (\u3056 in []))
// =====
try
{
for(let x = <{x}/> in <y/>) x2;
}
catch(ex)
{
}
// =====
for(
const NaN;
this.__defineSetter__("x4", function(){});
(eval("", (p={})))) let ({} = (((x ))(function ([]) {})), x1) y;
// =====
function f(){ var c; eval("{var c = NaN, c;}"); }
f();
// =====
try
{
eval(
' x\n' +
' let(x) {\n' +
' var x\n'
);
}
catch(ex)
{
}
// =====
reportCompare(expect, actual, summary);
exitFunc ('test');
}

Просмотреть файл

@ -0,0 +1,64 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is JavaScript Engine testing utilities.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s): Jesse Ruderman
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
var gTestfile = 'regress-452498-071.js';
//-----------------------------------------------------------------------------
var BUGNUMBER = 452498;
var summary = 'TM: upvar2 regression tests';
var actual = '';
var expect = '';
//-----------------------------------------------------------------------------
test();
//-----------------------------------------------------------------------------
function test()
{
enterFunc ('test');
printBugNumber(BUGNUMBER);
printStatus (summary);
// ------- Comment #71 From Jesse Ruderman
x; var x
// Assertion failure: pn->pn_op == JSOP_NOP, at ../jsparse.cpp:1118
reportCompare(expect, actual, summary);
exitFunc ('test');
}

Просмотреть файл

@ -0,0 +1,64 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is JavaScript Engine testing utilities.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s): Jesse Ruderman
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
var gTestfile = 'regress-452498-072.js';
//-----------------------------------------------------------------------------
var BUGNUMBER = 452498;
var summary = 'TM: upvar2 regression tests';
var actual = '';
var expect = '';
//-----------------------------------------------------------------------------
test();
//-----------------------------------------------------------------------------
function test()
{
enterFunc ('test');
printBugNumber(BUGNUMBER);
printStatus (summary);
// ------- Comment #72 From Jesse Ruderman
v = function p() { delete p; };
// Assertion failure: JOF_OPTYPE(op) == JOF_ATOM, at ../jsemit.cpp:1711
reportCompare(expect, actual, summary);
exitFunc ('test');
}

Просмотреть файл

@ -0,0 +1,71 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is JavaScript Engine testing utilities.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s): Jesse Ruderman
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
var gTestfile = 'regress-452498-073.js';
//-----------------------------------------------------------------------------
var BUGNUMBER = 452498;
var summary = 'TM: upvar2 regression tests';
var actual = '';
var expect = '';
//-----------------------------------------------------------------------------
test();
//-----------------------------------------------------------------------------
function test()
{
enterFunc ('test');
printBugNumber(BUGNUMBER);
printStatus (summary);
// ------- Comment #73 From Jesse Ruderman
try
{
eval('function() { var arguments }');
}
catch(ex)
{
}
// Assertion failure: (uintN)i < ss->top, at ../jsopcode.cpp:2801
reportCompare(expect, actual, summary);
exitFunc ('test');
}

Просмотреть файл

@ -0,0 +1,67 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is JavaScript Engine testing utilities.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
var gTestfile = 'regress-452498-074.js';
//-----------------------------------------------------------------------------
var BUGNUMBER = 452498;
var summary = 'TM: upvar2 regression tests';
var actual = '';
var expect = '';
//-----------------------------------------------------------------------------
test();
//-----------------------------------------------------------------------------
function test()
{
enterFunc ('test');
printBugNumber(BUGNUMBER);
printStatus (summary);
expect = '2';
// ------- Comment #74 From Jesse Ruderman
const [d] = [1]; [d] = [2]; print(actual = d);
actual = String(actual);
reportCompare(expect, actual, summary);
exitFunc ('test');
}

Просмотреть файл

@ -0,0 +1,65 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is JavaScript Engine testing utilities.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s): Jesse Ruderman
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
var gTestfile = 'regress-452498-075.js';
//-----------------------------------------------------------------------------
var BUGNUMBER = 452498;
var summary = 'TM: upvar2 regression tests';
var actual = '';
var expect = '';
//-----------------------------------------------------------------------------
test();
//-----------------------------------------------------------------------------
function test()
{
enterFunc ('test');
printBugNumber(BUGNUMBER);
printStatus (summary);
// ------- Comment #75 From Jesse Ruderman
(function p(){ p = 3; });
(function p(){ p = 3; return p; })()
// Assertion failure: regs.sp == StackBase(fp), at ../jsinterp.cpp:2980
reportCompare(expect, actual, summary);
exitFunc ('test');
}

Просмотреть файл

@ -0,0 +1,64 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is JavaScript Engine testing utilities.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s): Jesse Ruderman
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
var gTestfile = 'regress-452498-076.js';
//-----------------------------------------------------------------------------
var BUGNUMBER = 452498;
var summary = 'TM: upvar2 regression tests';
var actual = '';
var expect = '';
//-----------------------------------------------------------------------------
test();
//-----------------------------------------------------------------------------
function test()
{
enterFunc ('test');
printBugNumber(BUGNUMBER);
printStatus (summary);
// ------- Comment #76 From Jesse Ruderman
for (let d = 0; d < 4; ++d) { d; }
// 1: ReferenceError: d is not defined
reportCompare(expect, actual, summary);
exitFunc ('test');
}

Просмотреть файл

@ -0,0 +1,67 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is JavaScript Engine testing utilities.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
var gTestfile = 'regress-452498-077.js';
//-----------------------------------------------------------------------------
var BUGNUMBER = 452498;
var summary = 'TM: upvar2 regression tests';
var actual = '';
var expect = '';
//-----------------------------------------------------------------------------
test();
//-----------------------------------------------------------------------------
function test()
{
enterFunc ('test');
printBugNumber(BUGNUMBER);
printStatus (summary);
expect = '2';
// ------- Comment #77 From Brendan Eich
(function () { const [d] = [1]; [d] = [2]; print(actual = d);})();
actual = String(actual);
reportCompare(expect, actual, summary);
exitFunc ('test');
}

Просмотреть файл

@ -0,0 +1,65 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is JavaScript Engine testing utilities.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s): Jason Orendorff
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
var gTestfile = 'regress-452498-079.js';
//-----------------------------------------------------------------------------
var BUGNUMBER = 452498;
var summary = 'TM: upvar2 regression tests';
var actual = '';
var expect = '';
//-----------------------------------------------------------------------------
test();
//-----------------------------------------------------------------------------
function test()
{
enterFunc ('test');
printBugNumber(BUGNUMBER);
printStatus (summary);
// ------- Comment #79 From Jason Orendorff
x; var x; function x() 0
// Assertion failure: !(pn->pn_dflags & flag), at ../jsparse.h:635
reportCompare(expect, actual, summary);
exitFunc ('test');
}

Просмотреть файл

@ -0,0 +1,188 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is JavaScript Engine testing utilities.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s): Gary Kwong
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
var gTestfile = 'regress-452498-082.js';
//-----------------------------------------------------------------------------
var BUGNUMBER = 452498;
var summary = 'TM: upvar2 regression tests';
var actual = '';
var expect = '';
//-----------------------------------------------------------------------------
test();
//-----------------------------------------------------------------------------
function test()
{
enterFunc ('test');
printBugNumber(BUGNUMBER);
printStatus (summary);
// ------- Comment #82 From Gary Kwong [:nth10sd]
// =====
(function(){function x(){} {let x = [] }});
// =====
var f = new Function("new function x(){ return x |= function(){} } ([], function(){})");
"" + f;
// =====
var f = new Function("for(let [] = [0]; (y) = *; new (*::*)()) {}");
"" + f;
// =====
uneval(function(){[y] = [x];});
// =====
function g(code)
{
var f = new Function(code);
f();
}
g("for (var x = 0; x < 3; ++x)(new (function(){})());");
// =====
try
{
(function(){new (function ({}, x) { yield (x(1e-81) for (x4 in undefined)) })()})();
}
catch(ex)
{
}
// =====
try
{
(function(){[(function ([y]) { })() for each (x in [])];})();
}
catch(ex)
{
}
// =====
try
{
eval('(function(){for(var x2 = [function(id) { return id } for each (x in []) if ([])] in functional) function(){};})();');
}
catch(ex)
{
}
// =====
if (typeof window == 'undefined')
global = this;
else
global = window;
try
{
eval('(function(){with(global){1e-81; }for(let [x, x3] = global -= x in []) function(){}})();');
}
catch(ex)
{
}
// =====
try
{
eval(
'for(let [\n' +
'function x () { M:if([1,,]) }\n'
);
}
catch(ex)
{
}
// =====
try
{
function foo(code)
{
var c;
eval("const c, x5 = c;");
}
foo();
}
catch(ex)
{
}
// =====
var f = new Function("try { with({}) x = x; } catch(\u3056 if (function(){x = x2;})()) { let([] = [1.2e3.valueOf(\"number\")]) ((function(){})()); } ");
"" + f;
// =====
var f = new Function("[] = [( '' )()];");
"" + f;
// =====
var f = new Function("let ([] = [({ get x5 this (x) {} })]) { for(let y in []) with({}) {} }");
"" + f;
// =====
try
{
for(let x;
([,,,]
.toExponential(new Function(), (function(){}))); [] = {})
for(var [x, x] = * in this.__defineSetter__("", function(){}));
}
catch(ex)
{
}
// =====
reportCompare(expect, actual, summary);
exitFunc ('test');
}

Просмотреть файл

@ -0,0 +1,65 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is JavaScript Engine testing utilities.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s): Jesse Ruderman
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
var gTestfile = 'regress-452498-091.js';
//-----------------------------------------------------------------------------
var BUGNUMBER = 452498;
var summary = 'TM: upvar2 regression tests';
var actual = '';
var expect = '';
//-----------------------------------------------------------------------------
test();
//-----------------------------------------------------------------------------
function test()
{
enterFunc ('test');
printBugNumber(BUGNUMBER);
printStatus (summary);
// ------- Comment #91 From Jesse Ruderman
expect = 'function eval() {\n eval("v");\n}';
f = (function eval() { eval("v"); });
actual = f + '';
reportCompare(expect, actual, summary);
exitFunc ('test');
}

Просмотреть файл

@ -0,0 +1,73 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is JavaScript Engine testing utilities.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s): Jesse Ruderman
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
var gTestfile = 'regress-452498-092.js';
//-----------------------------------------------------------------------------
var BUGNUMBER = 452498;
var summary = 'TM: upvar2 regression tests';
var actual = '';
var expect = '';
//-----------------------------------------------------------------------------
test();
//-----------------------------------------------------------------------------
function test()
{
enterFunc ('test');
printBugNumber(BUGNUMBER);
printStatus (summary);
// ------- Comment #92 From Jesse Ruderman
expect = 'TypeError: redeclaration of formal parameter e';
try
{
eval('(function (e) { var e; const e; });');
}
catch(ex)
{
actual = ex + '';
}
// Without patch: "TypeError: redeclaration of var e"
// expected new behavior // With patch: "TypeError: redeclaration of formal parameter e:"
reportCompare(expect, actual, summary);
exitFunc ('test');
}

Просмотреть файл

@ -0,0 +1,73 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is JavaScript Engine testing utilities.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s): Gary Kwong
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
var gTestfile = 'regress-452498-098.js';
//-----------------------------------------------------------------------------
var BUGNUMBER = 452498;
var summary = 'TM: upvar2 regression tests';
var actual = '';
var expect = '';
//-----------------------------------------------------------------------------
test();
//-----------------------------------------------------------------------------
function test()
{
enterFunc ('test');
printBugNumber(BUGNUMBER);
printStatus (summary);
// ------- Comment #98 From Gary Kwong [:nth10sd]
try
{
for(let [x] = (x) in []) {}
// Assertion failure: !(pnu->pn_dflags & PND_BOUND), at ../jsemit.cpp:1818
}
catch(ex)
{
}
uneval(function(){(Number(0) for each (NaN in []) for each (x4 in this))});
// Assertion failure: pos == 0, at ../jsopcode.cpp:2963
reportCompare(expect, actual, summary);
exitFunc ('test');
}

Просмотреть файл

@ -0,0 +1,72 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is JavaScript Engine testing utilities.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
var gTestfile = 'regress-452498-099-a.js';
//-----------------------------------------------------------------------------
var BUGNUMBER = 452498;
var summary = 'TM: upvar2 regression tests';
var actual = '';
var expect = '';
//-----------------------------------------------------------------------------
test();
//-----------------------------------------------------------------------------
function test()
{
enterFunc ('test');
printBugNumber(BUGNUMBER);
printStatus (summary);
// ------- Comment #99 From Gary Kwong [:nth10sd]
if (typeof timeout == 'function')
{
expectExitCode(6);
timeout(3);
while( getter = function() { return y } for (y in y) )( /x/g );
}
// Assertion failure: lexdep->frameLevel() <= funbox->level, at ../jsparse.cpp:1771
// Crash [@ JSCompiler::setFunctionKinds] near null in opt, -j not required.
reportCompare(expect, actual, summary);
exitFunc ('test');
}

Просмотреть файл

@ -0,0 +1,87 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is JavaScript Engine testing utilities.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
var gTestfile = 'regress-452498-099.js';
//-----------------------------------------------------------------------------
var BUGNUMBER = 452498;
var summary = 'TM: upvar2 regression tests';
var actual = '';
var expect = '';
//-----------------------------------------------------------------------------
test();
//-----------------------------------------------------------------------------
function test()
{
enterFunc ('test');
printBugNumber(BUGNUMBER);
printStatus (summary);
// ------- Comment #99 From Gary Kwong [:nth10sd]
try
{
eval("(function x(){x.(this)} )();");
}
catch(ex)
{
}
// Assertion failure: (uint32)(index_) < atoms_->length, at ../jsinterp.cpp:327
// Crash [@ js_FullTestPropertyCache] at null in opt, -j not required.
// =====
try
{
(function(){try {x} finally {}; ([x in []] for each (x in x))})();
}
catch(ex)
{
}
// Assertion failure: lexdep->frameLevel() <= funbox->level, at ../jsparse.cpp:1735
// Crash [@ BindNameToSlot] near null in opt, -j not required.
// =====
reportCompare(expect, actual, summary);
exitFunc ('test');
}

Просмотреть файл

@ -0,0 +1,64 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is JavaScript Engine testing utilities.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s): Gary Kwong
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
var gTestfile = 'regress-452498-101.js';
//-----------------------------------------------------------------------------
var BUGNUMBER = 452498;
var summary = 'TM: upvar2 regression tests';
var actual = '';
var expect = '';
//-----------------------------------------------------------------------------
test();
//-----------------------------------------------------------------------------
function test()
{
enterFunc ('test');
printBugNumber(BUGNUMBER);
printStatus (summary);
// ------- Comment #101 From Gary Kwong [:nth10sd]
uneval(function(){with({functional: []}){x5, y = this;const y }});
// Assertion failure: strcmp(rval, with_cookie) == 0, at ../jsopcode.cpp:2567
reportCompare(expect, actual, summary);
exitFunc ('test');
}

Просмотреть файл

@ -0,0 +1,120 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is JavaScript Engine testing utilities.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s): Gary Kwong
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
var gTestfile = 'regress-452498-102.js';
//-----------------------------------------------------------------------------
var BUGNUMBER = 452498;
var summary = 'TM: upvar2 regression tests';
var actual = '';
var expect = '';
//-----------------------------------------------------------------------------
test();
//-----------------------------------------------------------------------------
function test()
{
enterFunc ('test');
printBugNumber(BUGNUMBER);
printStatus (summary);
// ------- Comment #102 From Gary Kwong [:nth10sd]
// =====
(function(){function x(){} function x()y})();
// Assertion failure: JOF_OPTYPE(op) == JOF_ATOM, at ../jsemit.cpp:1710
// =====
function f() {
"" + (function(){
for( ; [function(){}] ; x = 0)
with({x: ""})
const x = []
});
}
f();
// Assertion failure: ss->top - saveTop <= 1U, at ../jsopcode.cpp:2156
// =====
try
{
function f() {
var x;
eval("const x = [];");
}
f();
}
catch(ex)
{
}
// Assertion failure: regs.sp == StackBase(fp), at ../jsinterp.cpp:2984
// =====
try
{
do {x} while([[] for (x in []) ]);
}
catch(ex)
{
}
// Assertion failure: !(pnu->pn_dflags & PND_BOUND), at ../jsemit.cpp:1818
// =====
try
{
{x} ((x=[] for (x in []))); x;
}
catch(ex)
{
}
// Assertion failure: cg->staticLevel >= level, at ../jsemit.cpp:2014
// Crash [@ BindNameToSlot] in opt without -j
// =====
reportCompare(expect, actual, summary);
exitFunc ('test');
}

Просмотреть файл

@ -0,0 +1,64 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is JavaScript Engine testing utilities.
*
* The Initial Developer of the Original Code is
* Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s): Jesse Ruderman
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
var gTestfile = 'regress-452498-103.js';
//-----------------------------------------------------------------------------
var BUGNUMBER = 452498;
var summary = 'TM: upvar2 regression tests';
var actual = '';
var expect = '';
//-----------------------------------------------------------------------------
test();
//-----------------------------------------------------------------------------
function test()
{
enterFunc ('test');
printBugNumber(BUGNUMBER);
printStatus (summary);
// ------- Comment #103 From Jesse Ruderman
(function(a) { v = 5; let [v] = [3]; (function(){ v; })(); })();
// Assertion failure: !(pn->pn_dflags & flag), at ../jsparse.h:638
reportCompare(expect, actual, summary);
exitFunc ('test');
}

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше