mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 927516 - Bump Ion script size limit for DOM workers. r=bhackett
This commit is contained in:
parent
6eeb0d3c51
commit
ed37da0a3d
@ -805,6 +805,8 @@ CreateJSContextForWorker(WorkerPrivate* aWorkerPrivate, JSRuntime* aRuntime)
|
||||
}
|
||||
}
|
||||
|
||||
JS_SetIsWorkerRuntime(aRuntime);
|
||||
|
||||
JS_SetNativeStackQuota(aRuntime, WORKER_CONTEXT_NATIVE_STACK_LIMIT);
|
||||
|
||||
// Security policy:
|
||||
|
@ -1740,10 +1740,15 @@ CheckScript(JSContext *cx, JSScript *script, bool osr)
|
||||
|
||||
// Longer scripts can only be compiled off thread, as these compilations
|
||||
// can be expensive and stall the main thread for too long.
|
||||
static const uint32_t MAX_OFF_THREAD_SCRIPT_SIZE = 100000;
|
||||
static const uint32_t MAX_MAIN_THREAD_SCRIPT_SIZE = 2000;
|
||||
static const uint32_t MAX_OFF_THREAD_SCRIPT_SIZE = 100 * 1000;
|
||||
static const uint32_t MAX_MAIN_THREAD_SCRIPT_SIZE = 2 * 1000;
|
||||
static const uint32_t MAX_MAIN_THREAD_LOCALS_AND_ARGS = 256;
|
||||
|
||||
// DOM Worker runtimes don't have off thread compilation, but can also compile
|
||||
// larger scripts since this doesn't stall the main thread.
|
||||
static const uint32_t MAX_DOM_WORKER_SCRIPT_SIZE = 16 * 1000;
|
||||
static const uint32_t MAX_DOM_WORKER_LOCALS_AND_ARGS = 2048;
|
||||
|
||||
static MethodStatus
|
||||
CheckScriptSize(JSContext *cx, JSScript* script)
|
||||
{
|
||||
@ -1757,6 +1762,21 @@ CheckScriptSize(JSContext *cx, JSScript* script)
|
||||
}
|
||||
|
||||
uint32_t numLocalsAndArgs = analyze::TotalSlots(script);
|
||||
if (cx->runtime()->isWorkerRuntime()) {
|
||||
// DOM Workers don't have off thread compilation enabled. Since workers
|
||||
// don't block the browser's event loop, allow them to compile larger
|
||||
// scripts.
|
||||
JS_ASSERT(!OffThreadIonCompilationEnabled(cx->runtime()));
|
||||
|
||||
if (script->length > MAX_DOM_WORKER_SCRIPT_SIZE ||
|
||||
numLocalsAndArgs > MAX_DOM_WORKER_LOCALS_AND_ARGS)
|
||||
{
|
||||
return Method_CantCompile;
|
||||
}
|
||||
|
||||
return Method_Compiled;
|
||||
}
|
||||
|
||||
if (script->length > MAX_MAIN_THREAD_SCRIPT_SIZE ||
|
||||
numLocalsAndArgs > MAX_MAIN_THREAD_LOCALS_AND_ARGS)
|
||||
{
|
||||
|
@ -73,6 +73,12 @@ JS_GetAnonymousString(JSRuntime *rt)
|
||||
return rt->atomState.anonymous;
|
||||
}
|
||||
|
||||
JS_FRIEND_API(void)
|
||||
JS_SetIsWorkerRuntime(JSRuntime *rt)
|
||||
{
|
||||
rt->setIsWorkerRuntime();
|
||||
}
|
||||
|
||||
JS_FRIEND_API(JSObject *)
|
||||
JS_FindCompilationScope(JSContext *cx, JSObject *objArg)
|
||||
{
|
||||
|
@ -48,6 +48,9 @@ JS_SetGrayGCRootsTracer(JSRuntime *rt, JSTraceDataOp traceOp, void *data);
|
||||
extern JS_FRIEND_API(JSString *)
|
||||
JS_GetAnonymousString(JSRuntime *rt);
|
||||
|
||||
extern JS_FRIEND_API(void)
|
||||
JS_SetIsWorkerRuntime(JSRuntime *rt);
|
||||
|
||||
extern JS_FRIEND_API(JSObject *)
|
||||
JS_FindCompilationScope(JSContext *cx, JSObject *obj);
|
||||
|
||||
|
@ -286,7 +286,8 @@ JSRuntime::JSRuntime(JSUseHelperThreads useHelperThreads)
|
||||
useHelperThreads_(useHelperThreads),
|
||||
requestedHelperThreadCount(-1),
|
||||
useHelperThreadsForIonCompilation_(true),
|
||||
useHelperThreadsForParsing_(true)
|
||||
useHelperThreadsForParsing_(true),
|
||||
isWorkerRuntime_(false)
|
||||
#ifdef DEBUG
|
||||
, enteredPolicy(nullptr)
|
||||
#endif
|
||||
|
@ -1695,6 +1695,9 @@ struct JSRuntime : public JS::shadow::Runtime,
|
||||
bool useHelperThreadsForIonCompilation_;
|
||||
bool useHelperThreadsForParsing_;
|
||||
|
||||
// True iff this is a DOM Worker runtime.
|
||||
bool isWorkerRuntime_;
|
||||
|
||||
public:
|
||||
|
||||
bool useHelperThreads() const {
|
||||
@ -1735,6 +1738,12 @@ struct JSRuntime : public JS::shadow::Runtime,
|
||||
bool useHelperThreadsForParsing() const {
|
||||
return useHelperThreadsForParsing_;
|
||||
}
|
||||
void setIsWorkerRuntime() {
|
||||
isWorkerRuntime_ = true;
|
||||
}
|
||||
bool isWorkerRuntime() const {
|
||||
return isWorkerRuntime_;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
public:
|
||||
|
Loading…
Reference in New Issue
Block a user