Bug 729367 - Add write barrier flag to shell worker class (r=jorendorff)

This commit is contained in:
Bill McCloskey 2012-02-28 10:43:56 -08:00
Родитель 915a11f219
Коммит a91e7f4570
3 изменённых файлов: 19 добавлений и 2 удалений

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

@ -734,6 +734,12 @@ IsIncrementalGCEnabled(JSRuntime *rt)
return rt->gcIncrementalEnabled;
}
extern JS_FRIEND_API(void)
DisableIncrementalGC(JSRuntime *rt)
{
rt->gcIncrementalEnabled = false;
}
JS_FRIEND_API(bool)
IsIncrementalBarrierNeeded(JSRuntime *rt)
{

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

@ -751,6 +751,9 @@ NotifyDidPaint(JSContext *cx);
extern JS_FRIEND_API(bool)
IsIncrementalGCEnabled(JSRuntime *rt);
extern JS_FRIEND_API(void)
DisableIncrementalGC(JSRuntime *rt);
extern JS_FRIEND_API(bool)
IsIncrementalBarrierNeeded(JSRuntime *rt);

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

@ -49,6 +49,7 @@
#include "jsapi.h"
#include "jscntxt.h"
#include "jsdbgapi.h"
#include "jsfriendapi.h"
#include "jslock.h"
#include "jsworkers.h"
@ -863,6 +864,13 @@ class Worker MOZ_FINAL : public WorkerParent
}
static JSBool jsConstruct(JSContext *cx, uintN argc, jsval *vp) {
/*
* We pretend to implement write barriers on shell workers (by setting
* the JSCLASS_IMPLEMENTS_BARRIERS), but we don't. So we immediately
* disable incremental GC if shell workers are ever used.
*/
js::DisableIncrementalGC(JS_GetRuntime(cx));
WorkerParent *parent;
if (!getWorkerParentFromConstructor(cx, JSVAL_TO_OBJECT(JS_CALLEE(cx, vp)), &parent))
return false;
@ -1267,14 +1275,14 @@ Event::trace(JSTracer *trc)
}
JSClass ThreadPool::jsClass = {
"ThreadPool", JSCLASS_HAS_PRIVATE,
"ThreadPool", JSCLASS_HAS_PRIVATE | JSCLASS_IMPLEMENTS_BARRIERS,
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, jsFinalize,
NULL, NULL, NULL, NULL, jsTraceThreadPool
};
JSClass Worker::jsWorkerClass = {
"Worker", JSCLASS_HAS_PRIVATE,
"Worker", JSCLASS_HAS_PRIVATE | JSCLASS_IMPLEMENTS_BARRIERS,
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, jsFinalize,
NULL, NULL, NULL, NULL, jsTraceWorker