mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-01 22:07:41 +00:00
Bug 888338 - 6 - more browser post barriers r=mccr8
This commit is contained in:
parent
d89b7ac583
commit
a0056f5fa0
@ -656,10 +656,10 @@ nsXULPrototypeCache::MarkInCCGeneration(uint32_t aGeneration)
|
||||
}
|
||||
|
||||
static PLDHashOperator
|
||||
MarkScriptsInGC(nsIURI* aKey, JSScript*& aScript, void* aClosure)
|
||||
MarkScriptsInGC(nsIURI* aKey, JS::Heap<JSScript*>& aScript, void* aClosure)
|
||||
{
|
||||
JSTracer* trc = static_cast<JSTracer*>(aClosure);
|
||||
JS_CallScriptTracer(trc, &aScript, "nsXULPrototypeCache script");
|
||||
JS_CallHeapScriptTracer(trc, &aScript, "nsXULPrototypeCache script");
|
||||
return PL_DHASH_NEXT;
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIObserver.h"
|
||||
#include "nsXBLDocumentInfo.h"
|
||||
#include "nsDataHashtable.h"
|
||||
#include "nsJSThingHashtable.h"
|
||||
#include "nsInterfaceHashtable.h"
|
||||
#include "nsRefPtrHashtable.h"
|
||||
#include "nsURIHashKey.h"
|
||||
@ -123,14 +123,14 @@ protected:
|
||||
|
||||
void FlushSkinFiles();
|
||||
|
||||
nsRefPtrHashtable<nsURIHashKey,nsXULPrototypeDocument> mPrototypeTable; // owns the prototypes
|
||||
nsRefPtrHashtable<nsURIHashKey,nsCSSStyleSheet> mStyleSheetTable;
|
||||
nsDataHashtable<nsURIHashKey, JSScript*> mScriptTable;
|
||||
nsRefPtrHashtable<nsURIHashKey,nsXBLDocumentInfo> mXBLDocTable;
|
||||
nsRefPtrHashtable<nsURIHashKey,nsXULPrototypeDocument> mPrototypeTable; // owns the prototypes
|
||||
nsRefPtrHashtable<nsURIHashKey,nsCSSStyleSheet> mStyleSheetTable;
|
||||
nsJSThingHashtable<nsURIHashKey, JSScript*> mScriptTable;
|
||||
nsRefPtrHashtable<nsURIHashKey,nsXBLDocumentInfo> mXBLDocTable;
|
||||
|
||||
nsTHashtable<nsURIHashKey> mCacheURITable;
|
||||
nsTHashtable<nsURIHashKey> mCacheURITable;
|
||||
|
||||
nsInterfaceHashtable<nsURIHashKey, nsIStorageStream> mOutputStreamTable;
|
||||
nsInterfaceHashtable<nsURIHashKey, nsIStorageStream> mOutputStreamTable;
|
||||
nsInterfaceHashtable<nsURIHashKey, nsIObjectInputStream> mInputStreamTable;
|
||||
|
||||
// Bootstrap caching service
|
||||
|
@ -553,11 +553,11 @@ CreateInterfacePrototypeObject(JSContext* cx, JS::Handle<JSObject*> global,
|
||||
void
|
||||
CreateInterfaceObjects(JSContext* cx, JS::Handle<JSObject*> global,
|
||||
JS::Handle<JSObject*> protoProto,
|
||||
JSClass* protoClass, JSObject** protoCache,
|
||||
JSClass* protoClass, JS::Heap<JSObject*>* protoCache,
|
||||
JS::Handle<JSObject*> constructorProto,
|
||||
JSClass* constructorClass, const JSNativeHolder* constructor,
|
||||
unsigned ctorNargs, const NamedConstructor* namedConstructors,
|
||||
JSObject** constructorCache, const DOMClass* domClass,
|
||||
JS::Heap<JSObject*>* constructorCache, const DOMClass* domClass,
|
||||
const NativeProperties* properties,
|
||||
const NativeProperties* chromeOnlyProperties,
|
||||
const char* name)
|
||||
@ -990,7 +990,7 @@ ResolvePrototypeOrConstructor(JSContext* cx, JS::Handle<JSObject*> wrapper,
|
||||
JS::Rooted<JSObject*> global(cx, js::GetGlobalForObjectCrossCompartment(obj));
|
||||
{
|
||||
JSAutoCompartment ac(cx, global);
|
||||
JSObject** protoAndIfaceArray = GetProtoAndIfaceArray(global);
|
||||
JS::Heap<JSObject*>* protoAndIfaceArray = GetProtoAndIfaceArray(global);
|
||||
JSObject* protoOrIface = protoAndIfaceArray[protoAndIfaceArrayIndex];
|
||||
if (!protoOrIface) {
|
||||
return false;
|
||||
|
@ -277,8 +277,7 @@ AllocateProtoAndIfaceCache(JSObject* obj)
|
||||
MOZ_ASSERT(js::GetObjectClass(obj)->flags & JSCLASS_DOM_GLOBAL);
|
||||
MOZ_ASSERT(js::GetReservedSlot(obj, DOM_PROTOTYPE_SLOT).isUndefined());
|
||||
|
||||
// Important: The () at the end ensure zero-initialization
|
||||
JSObject** protoAndIfaceArray = new JSObject*[kProtoAndIfaceCacheCount]();
|
||||
JS::Heap<JSObject*>* protoAndIfaceArray = new JS::Heap<JSObject*>[kProtoAndIfaceCacheCount];
|
||||
|
||||
js::SetReservedSlot(obj, DOM_PROTOTYPE_SLOT,
|
||||
JS::PrivateValue(protoAndIfaceArray));
|
||||
@ -291,10 +290,10 @@ TraceProtoAndIfaceCache(JSTracer* trc, JSObject* obj)
|
||||
|
||||
if (!HasProtoAndIfaceArray(obj))
|
||||
return;
|
||||
JSObject** protoAndIfaceArray = GetProtoAndIfaceArray(obj);
|
||||
JS::Heap<JSObject*>* protoAndIfaceArray = GetProtoAndIfaceArray(obj);
|
||||
for (size_t i = 0; i < kProtoAndIfaceCacheCount; ++i) {
|
||||
if (protoAndIfaceArray[i]) {
|
||||
JS_CallObjectTracer(trc, &protoAndIfaceArray[i], "protoAndIfaceArray[i]");
|
||||
JS_CallHeapObjectTracer(trc, &protoAndIfaceArray[i], "protoAndIfaceArray[i]");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -304,7 +303,7 @@ DestroyProtoAndIfaceCache(JSObject* obj)
|
||||
{
|
||||
MOZ_ASSERT(js::GetObjectClass(obj)->flags & JSCLASS_DOM_GLOBAL);
|
||||
|
||||
JSObject** protoAndIfaceArray = GetProtoAndIfaceArray(obj);
|
||||
JS::Heap<JSObject*>* protoAndIfaceArray = GetProtoAndIfaceArray(obj);
|
||||
|
||||
delete [] protoAndIfaceArray;
|
||||
}
|
||||
@ -371,11 +370,11 @@ struct NamedConstructor
|
||||
void
|
||||
CreateInterfaceObjects(JSContext* cx, JS::Handle<JSObject*> global,
|
||||
JS::Handle<JSObject*> protoProto,
|
||||
JSClass* protoClass, JSObject** protoCache,
|
||||
JSClass* protoClass, JS::Heap<JSObject*>* protoCache,
|
||||
JS::Handle<JSObject*> interfaceProto,
|
||||
JSClass* constructorClass, const JSNativeHolder* constructor,
|
||||
unsigned ctorNargs, const NamedConstructor* namedConstructors,
|
||||
JSObject** constructorCache, const DOMClass* domClass,
|
||||
JS::Heap<JSObject*>* constructorCache, const DOMClass* domClass,
|
||||
const NativeProperties* regularProperties,
|
||||
const NativeProperties* chromeOnlyProperties,
|
||||
const char* name);
|
||||
@ -2048,7 +2047,7 @@ ReportLenientThisUnwrappingFailure(JSContext* cx, JS::Handle<JSObject*> obj);
|
||||
inline JSObject*
|
||||
GetUnforgeableHolder(JSObject* aGlobal, prototypes::ID aId)
|
||||
{
|
||||
JSObject** protoAndIfaceArray = GetProtoAndIfaceArray(aGlobal);
|
||||
JS::Heap<JSObject*>* protoAndIfaceArray = GetProtoAndIfaceArray(aGlobal);
|
||||
JSObject* interfaceProto = protoAndIfaceArray[aId];
|
||||
return &js::GetReservedSlot(interfaceProto,
|
||||
DOM_INTERFACE_PROTO_SLOTS_BASE).toObject();
|
||||
|
@ -1684,7 +1684,7 @@ class CGCreateInterfaceObjectsMethod(CGAbstractMethod):
|
||||
def __init__(self, descriptor, properties):
|
||||
args = [Argument('JSContext*', 'aCx'),
|
||||
Argument('JS::Handle<JSObject*>', 'aGlobal'),
|
||||
Argument('JSObject**', 'protoAndIfaceArray')]
|
||||
Argument('JS::Heap<JSObject*>*', 'protoAndIfaceArray')]
|
||||
CGAbstractMethod.__init__(self, descriptor, 'CreateInterfaceObjects', 'void', args)
|
||||
self.properties = properties
|
||||
def definition_body(self):
|
||||
@ -1887,13 +1887,13 @@ class CGGetPerInterfaceObject(CGAbstractMethod):
|
||||
return JS::NullPtr();
|
||||
}
|
||||
/* Check to see whether the interface objects are already installed */
|
||||
JSObject** protoAndIfaceArray = GetProtoAndIfaceArray(aGlobal);
|
||||
JS::Heap<JSObject*>* protoAndIfaceArray = GetProtoAndIfaceArray(aGlobal);
|
||||
if (!protoAndIfaceArray[%s]) {
|
||||
CreateInterfaceObjects(aCx, aGlobal, protoAndIfaceArray);
|
||||
}
|
||||
|
||||
/* The object might _still_ be null, but that's OK */
|
||||
return JS::Handle<JSObject*>::fromMarkedLocation(&protoAndIfaceArray[%s]);""" %
|
||||
return JS::Handle<JSObject*>(protoAndIfaceArray[%s]);""" %
|
||||
(self.id, self.id))
|
||||
|
||||
class CGGetProtoObjectMethod(CGGetPerInterfaceObject):
|
||||
|
@ -260,11 +260,11 @@ HasProtoAndIfaceArray(JSObject* global)
|
||||
return !js::GetReservedSlot(global, DOM_PROTOTYPE_SLOT).isUndefined();
|
||||
}
|
||||
|
||||
inline JSObject**
|
||||
inline JS::Heap<JSObject*>*
|
||||
GetProtoAndIfaceArray(JSObject* global)
|
||||
{
|
||||
MOZ_ASSERT(js::GetObjectClass(global)->flags & JSCLASS_DOM_GLOBAL);
|
||||
return static_cast<JSObject**>(
|
||||
return static_cast<JS::Heap<JSObject*>*>(
|
||||
js::GetReservedSlot(global, DOM_PROTOTYPE_SLOT).toPrivate());
|
||||
}
|
||||
|
||||
|
@ -164,9 +164,9 @@ JSClass sNPObjectJSWrapperClass =
|
||||
};
|
||||
|
||||
typedef struct NPObjectMemberPrivate {
|
||||
JSObject *npobjWrapper;
|
||||
JS::Value fieldValue;
|
||||
NPIdentifier methodName;
|
||||
JS::Heap<JSObject *> npobjWrapper;
|
||||
JS::Heap<JS::Value> fieldValue;
|
||||
JS::Heap<jsid> methodName;
|
||||
NPP npp;
|
||||
} NPObjectMemberPrivate;
|
||||
|
||||
@ -2017,7 +2017,7 @@ CreateNPObjectMember(NPP npp, JSContext *cx, JSObject *obj, NPObject* npobj,
|
||||
memberPrivate->npobjWrapper = obj;
|
||||
|
||||
memberPrivate->fieldValue = fieldValue;
|
||||
memberPrivate->methodName = identifier;
|
||||
memberPrivate->methodName = id;
|
||||
memberPrivate->npp = npp;
|
||||
|
||||
::JS_RemoveValueRoot(cx, vp);
|
||||
@ -2124,7 +2124,7 @@ NPObjectMember_Call(JSContext *cx, unsigned argc, JS::Value *vp)
|
||||
|
||||
NPVariant npv;
|
||||
JSBool ok;
|
||||
ok = npobj->_class->invoke(npobj, memberPrivate->methodName,
|
||||
ok = npobj->_class->invoke(npobj, JSIdToNPIdentifier(memberPrivate->methodName),
|
||||
npargs, argc, &npv);
|
||||
|
||||
// Release arguments.
|
||||
@ -2162,20 +2162,18 @@ NPObjectMember_Trace(JSTracer *trc, JSObject *obj)
|
||||
return;
|
||||
|
||||
// Our NPIdentifier is not always interned, so we must root it explicitly.
|
||||
jsid id = NPIdentifierToJSId(memberPrivate->methodName);
|
||||
JS_CallIdTracer(trc, &id, "NPObjectMemberPrivate.methodName");
|
||||
memberPrivate->methodName = JSIdToNPIdentifier(id);
|
||||
JS_CallHeapIdTracer(trc, &memberPrivate->methodName, "NPObjectMemberPrivate.methodName");
|
||||
|
||||
if (!JSVAL_IS_PRIMITIVE(memberPrivate->fieldValue)) {
|
||||
JS_CallValueTracer(trc, &memberPrivate->fieldValue,
|
||||
"NPObject Member => fieldValue");
|
||||
JS_CallHeapValueTracer(trc, &memberPrivate->fieldValue,
|
||||
"NPObject Member => fieldValue");
|
||||
}
|
||||
|
||||
// There's no strong reference from our private data to the
|
||||
// NPObject, so make sure to mark the NPObject wrapper to keep the
|
||||
// NPObject alive as long as this NPObjectMember is alive.
|
||||
if (memberPrivate->npobjWrapper) {
|
||||
JS_CallObjectTracer(trc, &memberPrivate->npobjWrapper,
|
||||
"NPObject Member => npobjWrapper");
|
||||
JS_CallHeapObjectTracer(trc, &memberPrivate->npobjWrapper,
|
||||
"NPObject Member => npobjWrapper");
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user