зеркало из https://github.com/mozilla/gecko-dev.git
Bug 931812: Remove unnecessary postbarriering of watchpoint map r=terrence
This commit is contained in:
Родитель
1682288b4c
Коммит
aa1b1891eb
|
@ -50,31 +50,6 @@ class AutoEntryHolder {
|
|||
|
||||
} /* anonymous namespace */
|
||||
|
||||
/*
|
||||
* Watchpoint contains a RelocatablePtrObject member, which is conceptually a
|
||||
* heap-only class. It's preferable not to allocate these on the stack as they
|
||||
* cause unnecessary adding and removal of store buffer entries, so
|
||||
* WatchpointStackValue can be used instead.
|
||||
*/
|
||||
struct js::WatchpointStackValue {
|
||||
JSWatchPointHandler handler;
|
||||
HandleObject closure;
|
||||
bool held;
|
||||
|
||||
WatchpointStackValue(JSWatchPointHandler handler, HandleObject closure, bool held)
|
||||
: handler(handler), closure(closure), held(held) {}
|
||||
};
|
||||
|
||||
inline js::Watchpoint::Watchpoint(const js::WatchpointStackValue& w)
|
||||
: handler(w.handler), closure(w.closure), held(w.held) {}
|
||||
|
||||
inline js::Watchpoint &js::Watchpoint::operator=(const js::WatchpointStackValue& w) {
|
||||
handler = w.handler;
|
||||
closure = w.closure;
|
||||
held = w.held;
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool
|
||||
WatchpointMap::init()
|
||||
{
|
||||
|
@ -90,7 +65,7 @@ WatchpointMap::watch(JSContext *cx, HandleObject obj, HandleId id,
|
|||
if (!obj->setWatched(cx))
|
||||
return false;
|
||||
|
||||
WatchpointStackValue w(handler, closure, false);
|
||||
Watchpoint w(handler, closure, false);
|
||||
if (!map.put(WatchKey(obj, id), w)) {
|
||||
js_ReportOutOfMemory(cx);
|
||||
return false;
|
||||
|
|
|
@ -29,14 +29,12 @@ struct WatchKey {
|
|||
}
|
||||
};
|
||||
|
||||
struct WatchpointStackValue;
|
||||
struct Watchpoint {
|
||||
JSWatchPointHandler handler;
|
||||
RelocatablePtrObject closure;
|
||||
EncapsulatedPtrObject closure; /* This is always marked in minor GCs and so doesn't require a postbarrier. */
|
||||
bool held; /* true if currently running handler */
|
||||
|
||||
inline Watchpoint(const WatchpointStackValue& w);
|
||||
inline Watchpoint &operator=(const WatchpointStackValue& w);
|
||||
Watchpoint(JSWatchPointHandler handler, JSObject* closure, bool held)
|
||||
: handler(handler), closure(closure), held(held) {}
|
||||
};
|
||||
|
||||
template <>
|
||||
|
|
Загрузка…
Ссылка в новой задаче