mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 810679 - Move rt->debuggerList to mozilla::LinkedList; r=Waldo
This commit is contained in:
parent
7482762720
commit
412cfbba34
@ -886,7 +886,6 @@ JSRuntime::JSRuntime(JSUseHelperThreads useHelperThreads)
|
||||
requestedHelperThreadCount(-1)
|
||||
{
|
||||
/* Initialize infallibly first, so we can goto bad and JS_DestroyRuntime. */
|
||||
JS_INIT_CLIST(&debuggerList);
|
||||
JS_INIT_CLIST(&onNewGlobalObjectWatchers);
|
||||
|
||||
PodZero(&debugHooks);
|
||||
|
@ -896,7 +896,7 @@ struct JSRuntime : js::RuntimeFriendFields
|
||||
* Linked list of all js::Debugger objects. This may be accessed by the GC
|
||||
* thread, if any, or a thread that is in a request and holds gcLock.
|
||||
*/
|
||||
JSCList debuggerList;
|
||||
mozilla::LinkedList<js::Debugger> debuggerList;
|
||||
|
||||
/*
|
||||
* Head of circular list of all enabled Debuggers that have
|
||||
|
@ -916,7 +916,7 @@ JSCompartment::sweepBreakpoints(FreeOp *fop)
|
||||
{
|
||||
gcstats::AutoPhase ap(rt->gcStats, gcstats::PHASE_SWEEP_TABLES_BREAKPOINT);
|
||||
|
||||
if (JS_CLIST_IS_EMPTY(&rt->debuggerList))
|
||||
if (rt->debuggerList.isEmpty())
|
||||
return;
|
||||
|
||||
for (CellIterUnderGC i(this, FINALIZE_SCRIPT); !i.done(); i.next()) {
|
||||
|
@ -360,7 +360,6 @@ Breakpoint::nextInSite()
|
||||
return (link == &site->breakpoints) ? NULL : fromSiteLinks(link);
|
||||
}
|
||||
|
||||
|
||||
/*** Debugger hook dispatch **********************************************************************/
|
||||
|
||||
Debugger::Debugger(JSContext *cx, JSObject *dbg)
|
||||
@ -369,8 +368,7 @@ Debugger::Debugger(JSContext *cx, JSObject *dbg)
|
||||
{
|
||||
assertSameCompartment(cx, dbg);
|
||||
|
||||
JSRuntime *rt = cx->runtime;
|
||||
JS_APPEND_LINK(&link, &rt->debuggerList);
|
||||
cx->runtime->debuggerList.insertBack(this);
|
||||
JS_INIT_CLIST(&breakpoints);
|
||||
JS_INIT_CLIST(&onNewGlobalObjectWatchersLink);
|
||||
}
|
||||
@ -381,7 +379,6 @@ Debugger::~Debugger()
|
||||
|
||||
/* This always happens in the GC thread, so no locking is required. */
|
||||
JS_ASSERT(object->compartment()->rt->isHeapBusy());
|
||||
JS_REMOVE_LINK(&link);
|
||||
|
||||
/*
|
||||
* Since the inactive state for this link is a singleton cycle, it's always
|
||||
@ -1399,8 +1396,7 @@ Debugger::markCrossCompartmentDebuggerObjectReferents(JSTracer *tracer)
|
||||
* Mark all objects in comp that are referents of Debugger.Objects in other
|
||||
* compartments.
|
||||
*/
|
||||
for (JSCList *p = &rt->debuggerList; (p = JS_NEXT_LINK(p)) != &rt->debuggerList;) {
|
||||
Debugger *dbg = Debugger::fromLinks(p);
|
||||
for (Debugger *dbg = rt->debuggerList.getFirst(); dbg; dbg = dbg->getNext()) {
|
||||
if (!dbg->object->compartment()->isCollecting())
|
||||
dbg->markKeysInCompartment(tracer);
|
||||
}
|
||||
@ -1528,9 +1524,7 @@ Debugger::sweepAll(FreeOp *fop)
|
||||
{
|
||||
JSRuntime *rt = fop->runtime();
|
||||
|
||||
for (JSCList *p = &rt->debuggerList; (p = JS_NEXT_LINK(p)) != &rt->debuggerList;) {
|
||||
Debugger *dbg = Debugger::fromLinks(p);
|
||||
|
||||
for (Debugger *dbg = rt->debuggerList.getFirst(); dbg; dbg = dbg->getNext()) {
|
||||
if (IsObjectAboutToBeFinalized(&dbg->object)) {
|
||||
/*
|
||||
* dbg is being GC'd. Detach it from its debuggees. The debuggee
|
||||
@ -1574,9 +1568,7 @@ Debugger::findCompartmentEdges(JSCompartment *comp, js::gc::ComponentFinder &fin
|
||||
* This ensure that debuggers and their debuggees are finalized in the same
|
||||
* group.
|
||||
*/
|
||||
JSRuntime *rt = comp->rt;
|
||||
for (JSCList *p = &rt->debuggerList; (p = JS_NEXT_LINK(p)) != &rt->debuggerList;) {
|
||||
Debugger *dbg = Debugger::fromLinks(p);
|
||||
for (Debugger *dbg = comp->rt->debuggerList.getFirst(); dbg; dbg = dbg->getNext()) {
|
||||
JSCompartment *w = dbg->object->compartment();
|
||||
if (w == comp || !w->isGCMarking())
|
||||
continue;
|
||||
|
@ -9,6 +9,7 @@
|
||||
#define Debugger_h__
|
||||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/LinkedList.h"
|
||||
|
||||
#include "jsapi.h"
|
||||
#include "jsclist.h"
|
||||
@ -147,8 +148,10 @@ class DebuggerWeakMap : private WeakMap<Key, Value, DefaultHasher<Key> >
|
||||
}
|
||||
};
|
||||
|
||||
class Debugger {
|
||||
class Debugger : private mozilla::LinkedListElement<Debugger>
|
||||
{
|
||||
friend class Breakpoint;
|
||||
friend class mozilla::LinkedListElement<Debugger>;
|
||||
friend JSBool (::JS_DefineDebuggerObject)(JSContext *cx, JSObject *obj);
|
||||
|
||||
public:
|
||||
@ -174,7 +177,6 @@ class Debugger {
|
||||
};
|
||||
|
||||
private:
|
||||
JSCList link; /* See JSRuntime::debuggerList. */
|
||||
HeapPtrObject object; /* The Debugger object. Strong reference. */
|
||||
GlobalObjectSet debuggees; /* Debuggee globals. Cross-compartment weak references. */
|
||||
js::HeapPtrObject uncaughtExceptionHook; /* Strong reference. */
|
||||
@ -338,7 +340,6 @@ class Debugger {
|
||||
*/
|
||||
void fireNewScript(JSContext *cx, HandleScript script);
|
||||
|
||||
static inline Debugger *fromLinks(JSCList *links);
|
||||
inline Breakpoint *firstBreakpoint() const;
|
||||
|
||||
static inline Debugger *fromOnNewGlobalObjectWatchersLink(JSCList *link);
|
||||
@ -563,13 +564,6 @@ class Breakpoint {
|
||||
HeapPtrObject &getHandlerRef() { return handler; }
|
||||
};
|
||||
|
||||
Debugger *
|
||||
Debugger::fromLinks(JSCList *links)
|
||||
{
|
||||
char *p = reinterpret_cast<char *>(links);
|
||||
return reinterpret_cast<Debugger *>(p - offsetof(Debugger, link));
|
||||
}
|
||||
|
||||
Breakpoint *
|
||||
Debugger::firstBreakpoint() const
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user