mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 888338 - 2 - give post barrier callback function an extra data argument r=terrence
This commit is contained in:
parent
1bb7f2a908
commit
d8798632f1
@ -356,17 +356,18 @@ class StoreBuffer
|
||||
class CallbackRef : public BufferableRef
|
||||
{
|
||||
public:
|
||||
typedef void (*MarkCallback)(JSTracer *trc, void *key);
|
||||
typedef void (*MarkCallback)(JSTracer *trc, void *key, void *data);
|
||||
|
||||
CallbackRef(MarkCallback cb, void *k) : callback(cb), key(k) {}
|
||||
CallbackRef(MarkCallback cb, void *k, void *d) : callback(cb), key(k), data(d) {}
|
||||
|
||||
virtual void mark(JSTracer *trc) {
|
||||
callback(trc, key);
|
||||
callback(trc, key, data);
|
||||
}
|
||||
|
||||
private:
|
||||
MarkCallback callback;
|
||||
void *key;
|
||||
void *data;
|
||||
};
|
||||
|
||||
MonoTypeBuffer<ValueEdge> bufferVal;
|
||||
@ -451,8 +452,9 @@ class StoreBuffer
|
||||
}
|
||||
|
||||
/* Insert or update a callback entry. */
|
||||
void putCallback(CallbackRef::MarkCallback callback, void *key) {
|
||||
bufferGeneric.put(CallbackRef(callback, key));
|
||||
void putCallback(CallbackRef::MarkCallback callback, Cell *key, void *data) {
|
||||
if (!key->isTenured())
|
||||
bufferGeneric.put(CallbackRef(callback, key, data));
|
||||
}
|
||||
|
||||
/* Mark the source of all edges in the store buffer. */
|
||||
|
@ -1121,8 +1121,18 @@ js::IsInRequest(JSContext *cx)
|
||||
|
||||
#ifdef JSGC_GENERATIONAL
|
||||
JS_FRIEND_API(void)
|
||||
JS_StorePostBarrierCallback(JSContext* cx, void (*callback)(JSTracer *trc, void *key), void *key)
|
||||
JS_StoreObjectPostBarrierCallback(JSContext* cx,
|
||||
void (*callback)(JSTracer *trc, void *key, void *data),
|
||||
JSObject *key, void *data)
|
||||
{
|
||||
cx->runtime()->gcStoreBuffer.putCallback(callback, key);
|
||||
cx->runtime()->gcStoreBuffer.putCallback(callback, key, data);
|
||||
}
|
||||
|
||||
extern JS_FRIEND_API(void)
|
||||
JS_StoreStringPostBarrierCallback(JSContext* cx,
|
||||
void (*callback)(JSTracer *trc, void *key, void *data),
|
||||
JSString *key, void *data)
|
||||
{
|
||||
cx->runtime()->gcStoreBuffer.putCallback(callback, key, data);
|
||||
}
|
||||
#endif /* JSGC_GENERATIONAL */
|
||||
|
@ -1794,10 +1794,24 @@ js_ReportIsNotFunction(JSContext *cx, const JS::Value& v);
|
||||
|
||||
#ifdef JSGC_GENERATIONAL
|
||||
extern JS_FRIEND_API(void)
|
||||
JS_StorePostBarrierCallback(JSContext* cx, void (*callback)(JSTracer *trc, void *key), void *key);
|
||||
JS_StoreObjectPostBarrierCallback(JSContext* cx,
|
||||
void (*callback)(JSTracer *trc, void *key, void *data),
|
||||
JSObject *key, void *data);
|
||||
|
||||
extern JS_FRIEND_API(void)
|
||||
JS_StoreStringPostBarrierCallback(JSContext* cx,
|
||||
void (*callback)(JSTracer *trc, void *key, void *data),
|
||||
JSString *key, void *data);
|
||||
#else
|
||||
inline void
|
||||
JS_StorePostBarrierCallback(JSContext* cx, void (*callback)(JSTracer *trc, void *key), void *key) {}
|
||||
JS_StoreObjectPostBarrierCallback(JSContext* cx,
|
||||
void (*callback)(JSTracer *trc, void *key, void *data),
|
||||
JSObject *key, void *data) {}
|
||||
|
||||
inline void
|
||||
JS_StoreStringPostBarrierCallback(JSContext* cx,
|
||||
void (*callback)(JSTracer *trc, void *key, void *data),
|
||||
JSString *key, void *data) {}
|
||||
#endif /* JSGC_GENERATIONAL */
|
||||
|
||||
#endif /* jsfriendapi_h */
|
||||
|
@ -54,7 +54,7 @@ public:
|
||||
return p->value;
|
||||
if (!mTable.add(p, obj, wrapper))
|
||||
return nullptr;
|
||||
JS_StorePostBarrierCallback(cx, KeyMarkCallback, obj);
|
||||
JS_StoreObjectPostBarrierCallback(cx, KeyMarkCallback, obj, this);
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
@ -87,12 +87,11 @@ private:
|
||||
* This function is called during minor GCs for each key in the HashMap that
|
||||
* has been moved.
|
||||
*/
|
||||
static void KeyMarkCallback(JSTracer *trc, void *k) {
|
||||
static void KeyMarkCallback(JSTracer *trc, void *k, void *d) {
|
||||
JSObject *key = static_cast<JSObject*>(k);
|
||||
JSObject2WrappedJSMap* self = static_cast<JSObject2WrappedJSMap*>(d);
|
||||
JSObject *prior = key;
|
||||
JS_CallObjectTracer(trc, &key, "XPCJSRuntime::mWrappedJSMap key");
|
||||
XPCJSRuntime* rt = nsXPConnect::GetRuntimeInstance();
|
||||
JSObject2WrappedJSMap* self = rt->GetWrappedJSMap();
|
||||
self->mTable.rekey(prior, key);
|
||||
}
|
||||
|
||||
@ -650,7 +649,7 @@ public:
|
||||
if (!mTable.add(p, key, value))
|
||||
return nullptr;
|
||||
MOZ_ASSERT(xpc::GetObjectScope(key)->mWaiverWrapperMap == this);
|
||||
JS_StorePostBarrierCallback(cx, KeyMarkCallback, key);
|
||||
JS_StoreObjectPostBarrierCallback(cx, KeyMarkCallback, key, this);
|
||||
return value;
|
||||
}
|
||||
|
||||
@ -697,11 +696,11 @@ private:
|
||||
* This function is called during minor GCs for each key in the HashMap that
|
||||
* has been moved.
|
||||
*/
|
||||
static void KeyMarkCallback(JSTracer *trc, void *k) {
|
||||
static void KeyMarkCallback(JSTracer *trc, void *k, void *d) {
|
||||
JSObject *key = static_cast<JSObject*>(k);
|
||||
JSObject2JSObjectMap *self = static_cast<JSObject2JSObjectMap *>(d);
|
||||
JSObject *prior = key;
|
||||
JS_CallObjectTracer(trc, &key, "XPCWrappedNativeScope::mWaiverWrapperMap key");
|
||||
JSObject2JSObjectMap *self = xpc::GetObjectScope(key)->mWaiverWrapperMap;
|
||||
self->mTable.rekey(prior, key);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user