зеркало из https://github.com/mozilla/pjs.git
Backed out changeset 0b36bddcefe4 for bug 485178 to fix compiletaion errors on some platforms.
This commit is contained in:
Родитель
8907bff6d5
Коммит
0b45f43e1b
|
@ -110,12 +110,7 @@ size_t gStackChunkSize = 8192;
|
|||
|
||||
/* Assume that we can not use more than 5e5 bytes of C stack by default. */
|
||||
static size_t gMaxStackSize = 500000;
|
||||
|
||||
#ifdef JS_THREADSAFE
|
||||
static uint32 gStackBaseThreadIndex;
|
||||
#else
|
||||
static jsuword gStackBase;
|
||||
#endif
|
||||
|
||||
static size_t gScriptStackQuota = JS_DEFAULT_SCRIPT_STACK_QUOTA;
|
||||
|
||||
|
@ -319,7 +314,7 @@ ShellOperationCallback(JSContext *cx)
|
|||
}
|
||||
|
||||
static void
|
||||
SetThreadStackLimit(JSContext *cx)
|
||||
SetContextOptions(JSContext *cx)
|
||||
{
|
||||
jsuword stackLimit;
|
||||
|
||||
|
@ -329,27 +324,13 @@ SetThreadStackLimit(JSContext *cx)
|
|||
*/
|
||||
stackLimit = 0;
|
||||
} else {
|
||||
jsuword stackBase;
|
||||
#ifdef JS_THREADSAFE
|
||||
stackBase = (jsuword) PR_GetThreadPrivate(gStackBaseThreadIndex);
|
||||
#else
|
||||
stackBase = gStackBase;
|
||||
#endif
|
||||
JS_ASSERT(stackBase != 0);
|
||||
#if JS_STACK_GROWTH_DIRECTION > 0
|
||||
stackLimit = stackBase + gMaxStackSize;
|
||||
stackLimit = gStackBase + gMaxStackSize;
|
||||
#else
|
||||
stackLimit = stackBase - gMaxStackSize;
|
||||
stackLimit = gStackBase - gMaxStackSize;
|
||||
#endif
|
||||
}
|
||||
JS_SetThreadStackLimit(cx, stackLimit);
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
SetContextOptions(JSContext *cx)
|
||||
{
|
||||
SetThreadStackLimit(cx);
|
||||
JS_SetScriptStackQuota(cx, gScriptStackQuota);
|
||||
JS_SetOperationCallback(cx, ShellOperationCallback);
|
||||
}
|
||||
|
@ -2993,14 +2974,10 @@ DoScatteredWork(JSContext *cx, ScatterThreadData *td)
|
|||
static void
|
||||
RunScatterThread(void *arg)
|
||||
{
|
||||
int stackDummy;
|
||||
ScatterThreadData *td;
|
||||
ScatterStatus st;
|
||||
JSContext *cx;
|
||||
|
||||
if (PR_FAILURE == PR_SetThreadPrivate(gStackBaseThreadIndex, &stackDummy))
|
||||
return;
|
||||
|
||||
td = (ScatterThreadData *)arg;
|
||||
cx = td->cx;
|
||||
|
||||
|
@ -3015,7 +2992,7 @@ RunScatterThread(void *arg)
|
|||
|
||||
/* We are good to go. */
|
||||
JS_SetContextThread(cx);
|
||||
SetThreadStackLimit(cx);
|
||||
JS_SetThreadStackLimit(cx, 0);
|
||||
JS_BeginRequest(cx);
|
||||
DoScatteredWork(cx, td);
|
||||
JS_EndRequest(cx);
|
||||
|
@ -4595,15 +4572,7 @@ main(int argc, char **argv, char **envp)
|
|||
#ifdef HAVE_SETLOCALE
|
||||
setlocale(LC_ALL, "");
|
||||
#endif
|
||||
|
||||
#ifdef JS_THREADSAFE
|
||||
if (PR_FAILURE == PR_NewThreadPrivateIndex(&gStackBaseThreadIndex, NULL) ||
|
||||
PR_FAILURE == PR_SetThreadPrivate(gStackBaseThreadIndex, &stackDummy)) {
|
||||
return 1;
|
||||
}
|
||||
#else
|
||||
gStackBase = (jsuword) &stackDummy;
|
||||
#endif
|
||||
gStackBase = (jsuword)&stackDummy;
|
||||
|
||||
#ifdef XP_OS2
|
||||
/* these streams are normally line buffered on OS/2 and need a \n, *
|
||||
|
|
Загрузка…
Ссылка в новой задаче