Bug 910823 - Constify static js::Class/JSClass instances. r=waldo

This commit is contained in:
Dan Gohman 2013-09-11 05:49:05 -07:00
parent 81fa3b1f3f
commit 8b7074b6dc
163 changed files with 565 additions and 574 deletions

View File

@ -2004,7 +2004,7 @@ nsScriptSecurityManager::old_doGetObjectPrincipal(JS::Handle<JSObject*> aObj,
}
}
js::Class *jsClass = js::GetObjectClass(obj);
const js::Class *jsClass = js::GetObjectClass(obj);
do {
// Note: jsClass is set before this loop, and also at the

View File

@ -81,7 +81,7 @@ nsSecurityNameSet::InitializeNameSet(nsIScriptContext* aScriptContext)
break;
obj = proto;
}
JSClass *objectClass = JS_GetClass(obj);
const JSClass *objectClass = JS_GetClass(obj);
JS::Rooted<JS::Value> v(cx);
if (!JS_GetProperty(cx, global, "netscape", &v))

View File

@ -786,7 +786,7 @@ nsXBLBinding::ChangeDocument(nsIDocument* aOldDocument, nsIDocument* aNewDocumen
break;
}
JSClass* clazz = ::JS_GetClass(proto);
const JSClass* clazz = ::JS_GetClass(proto);
if (!clazz ||
(~clazz->flags &
(JSCLASS_HAS_PRIVATE | JSCLASS_PRIVATE_IS_NSISUPPORTS)) ||

View File

@ -60,7 +60,7 @@ public:
void ClearGlobalObjectOwner();
static JSClass gSharedGlobalClass;
static const JSClass gSharedGlobalClass;
protected:
virtual ~nsXBLDocGlobalObject();
@ -151,7 +151,7 @@ nsXBLDocGlobalObject_resolve(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handl
}
JSClass nsXBLDocGlobalObject::gSharedGlobalClass = {
const JSClass nsXBLDocGlobalObject::gSharedGlobalClass = {
"nsXBLPrototypeScript compilation scope",
JSCLASS_HAS_PRIVATE | JSCLASS_PRIVATE_IS_NSISUPPORTS |
JSCLASS_IMPLEMENTS_BARRIERS | JSCLASS_GLOBAL_FLAGS_WITH_SLOTS(0),

View File

@ -116,7 +116,7 @@ ValueHasISupportsPrivate(JS::Handle<JS::Value> v)
return domClass->mDOMObjectIsISupports;
}
JSClass* clasp = ::JS_GetClass(&v.toObject());
const JSClass* clasp = ::JS_GetClass(&v.toObject());
const uint32_t HAS_PRIVATE_NSISUPPORTS =
JSCLASS_HAS_PRIVATE | JSCLASS_PRIVATE_IS_NSISUPPORTS;
return (clasp->flags & HAS_PRIVATE_NSISUPPORTS) == HAS_PRIVATE_NSISUPPORTS;

View File

@ -162,11 +162,19 @@ public:
nsrefcnt AddRef() { return Hold(); }
nsrefcnt Release() { return Drop(); }
// Downcast from a pointer to JSClass to a pointer to nsXBLJSClass.
// Downcast from a pointer to const JSClass to a pointer to non-const
// nsXBLJSClass.
//
// The const_cast is safe because nsXBLJSClass instances are never actually
// const. It's necessary because we pass pointers to nsXBLJSClass to code
// which uses pointers to const JSClass, and returns them back to us that
// way, and we need to convert them back to pointers to non-const
// nsXBLJSClass so that we can modify the reference count and add them to
// the gClassLRUList list.
static nsXBLJSClass*
fromJSClass(JSClass* c)
fromJSClass(const JSClass* c)
{
nsXBLJSClass* x = static_cast<nsXBLJSClass*>(c);
nsXBLJSClass* x = const_cast<nsXBLJSClass*>(static_cast<const nsXBLJSClass*>(c));
MOZ_ASSERT(nsXBLService::getClass(x->mKey) == x);
return x;
}

View File

@ -70,7 +70,7 @@ protected:
JS::Heap<JSObject*> mJSObject;
bool mDestroyed; // Probably not necessary, but let's be safe.
static JSClass gSharedGlobalClass;
static const JSClass gSharedGlobalClass;
};
nsIPrincipal* nsXULPrototypeDocument::gSystemPrincipal;
@ -98,7 +98,7 @@ nsXULPDGlobalObject_resolve(JSContext *cx, JS::Handle<JSObject*> obj, JS::Handle
}
JSClass nsXULPDGlobalObject::gSharedGlobalClass = {
const JSClass nsXULPDGlobalObject::gSharedGlobalClass = {
"nsXULPrototypeScript compilation scope",
JSCLASS_HAS_PRIVATE | JSCLASS_PRIVATE_IS_NSISUPPORTS |
JSCLASS_IMPLEMENTS_BARRIERS | JSCLASS_GLOBAL_FLAGS_WITH_SLOTS(0),

View File

@ -853,7 +853,7 @@ NS_INTERFACE_MAP_BEGIN(nsDOMClassInfo)
NS_INTERFACE_MAP_END
static JSClass sDOMConstructorProtoClass = {
static const JSClass sDOMConstructorProtoClass = {
"DOM Constructor.prototype", 0,
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, nullptr
@ -2623,7 +2623,7 @@ nsDOMConstructor::HasInstance(nsIXPConnectWrappedNative *wrapper,
if (wrapped_obj)
dom_obj = wrapped_obj;
JSClass *dom_class = JS_GetClass(dom_obj);
const JSClass *dom_class = JS_GetClass(dom_obj);
if (!dom_class) {
NS_ERROR("nsDOMConstructor::HasInstance can't get class.");
return NS_ERROR_UNEXPECTED;
@ -4163,7 +4163,7 @@ nsStringListSH::GetStringAt(nsISupports *aNative, int32_t aIndex,
// HTMLAllCollection
JSClass sHTMLDocumentAllClass = {
const JSClass sHTMLDocumentAllClass = {
"HTML document.all class",
JSCLASS_HAS_PRIVATE | JSCLASS_PRIVATE_IS_NSISUPPORTS | JSCLASS_NEW_RESOLVE |
JSCLASS_EMULATES_UNDEFINED | JSCLASS_HAS_RESERVED_SLOTS(1),

View File

@ -431,7 +431,7 @@ private:
// HTMLAllCollection
extern JSClass sHTMLDocumentAllClass;
extern const JSClass sHTMLDocumentAllClass;
class nsHTMLDocumentSH
{

View File

@ -1124,7 +1124,7 @@ nsJSContext::GetGlobalObject()
}
#endif
JSClass *c = JS_GetClass(global);
const JSClass *c = JS_GetClass(global);
// Whenever we end up with globals that are JSCLASS_IS_DOMJSCLASS
// and have an nsISupports DOM object, we will need to modify this

View File

@ -47,7 +47,7 @@ nsJSUtils::GetCallingLocation(JSContext* aContext, const char* *aFilename,
nsIScriptGlobalObject *
nsJSUtils::GetStaticScriptGlobal(JSObject* aObj)
{
JSClass* clazz;
const JSClass* clazz;
JSObject* glob = aObj; // starting point for search
if (!glob)

View File

@ -328,7 +328,7 @@ InterfaceObjectToString(JSContext* cx, unsigned argc, JS::Value *vp)
JS::Value v = js::GetFunctionNativeReserved(callee,
TOSTRING_CLASS_RESERVED_SLOT);
JSClass* clasp = static_cast<JSClass*>(JSVAL_TO_PRIVATE(v));
const JSClass* clasp = static_cast<const JSClass*>(JSVAL_TO_PRIVATE(v));
v = js::GetFunctionNativeReserved(callee, TOSTRING_NAME_RESERVED_SLOT);
JSString* jsname = static_cast<JSString*>(JSVAL_TO_STRING(v));
@ -402,7 +402,7 @@ DefineConstructor(JSContext* cx, JS::Handle<JSObject*> global, const char* name,
static JSObject*
CreateInterfaceObject(JSContext* cx, JS::Handle<JSObject*> global,
JS::Handle<JSObject*> constructorProto,
JSClass* constructorClass,
const JSClass* constructorClass,
const JSNativeHolder* constructorNative,
unsigned ctorNargs, const NamedConstructor* namedConstructors,
JS::Handle<JSObject*> proto,
@ -442,7 +442,7 @@ CreateInterfaceObject(JSContext* cx, JS::Handle<JSObject*> global,
}
JSObject* toStringObj = JS_GetFunctionObject(toString);
js::SetFunctionNativeReserved(toStringObj, TOSTRING_CLASS_RESERVED_SLOT,
PRIVATE_TO_JSVAL(constructorClass));
PRIVATE_TO_JSVAL(const_cast<JSClass *>(constructorClass)));
js::SetFunctionNativeReserved(toStringObj, TOSTRING_NAME_RESERVED_SLOT,
STRING_TO_JSVAL(str));
@ -543,7 +543,7 @@ DefineWebIDLBindingPropertiesOnXPCProto(JSContext* cx,
static JSObject*
CreateInterfacePrototypeObject(JSContext* cx, JS::Handle<JSObject*> global,
JS::Handle<JSObject*> parentProto,
JSClass* protoClass,
const JSClass* protoClass,
const NativeProperties* properties,
const NativeProperties* chromeOnlyProperties)
{
@ -593,9 +593,9 @@ CreateInterfacePrototypeObject(JSContext* cx, JS::Handle<JSObject*> global,
void
CreateInterfaceObjects(JSContext* cx, JS::Handle<JSObject*> global,
JS::Handle<JSObject*> protoProto,
JSClass* protoClass, JS::Heap<JSObject*>* protoCache,
const JSClass* protoClass, JS::Heap<JSObject*>* protoCache,
JS::Handle<JSObject*> constructorProto,
JSClass* constructorClass, const JSNativeHolder* constructor,
const JSClass* constructorClass, const JSNativeHolder* constructor,
unsigned ctorNargs, const NamedConstructor* namedConstructors,
JS::Heap<JSObject*>* constructorCache, const DOMClass* domClass,
const NativeProperties* properties,
@ -735,7 +735,7 @@ bool
InstanceClassHasProtoAtDepth(JS::Handle<JSObject*> protoObject, uint32_t protoID,
uint32_t depth)
{
const DOMClass* domClass = static_cast<DOMClass*>(
const DOMClass* domClass = static_cast<const DOMClass*>(
js::GetReservedSlot(protoObject, DOM_PROTO_INSTANCE_CLASS_SLOT).toPrivate());
return (uint32_t)domClass->mInterfaceChain[depth] == protoID;
}
@ -1440,7 +1440,7 @@ AppendNamedPropertyIds(JSContext* cx, JS::Handle<JSObject*> proxy,
JSObject*
GetXrayExpandoChain(JSObject* obj)
{
js::Class* clasp = js::GetObjectClass(obj);
const js::Class* clasp = js::GetObjectClass(obj);
JS::Value v;
if (IsDOMClass(clasp) || IsDOMIfaceAndProtoClass(clasp)) {
v = js::GetReservedSlot(obj, DOM_XRAY_EXPANDO_SLOT);
@ -1458,7 +1458,7 @@ void
SetXrayExpandoChain(JSObject* obj, JSObject* chain)
{
JS::Value v = chain ? JS::ObjectValue(*chain) : JSVAL_VOID;
js::Class* clasp = js::GetObjectClass(obj);
const js::Class* clasp = js::GetObjectClass(obj);
if (IsDOMClass(clasp) || IsDOMIfaceAndProtoClass(clasp)) {
js::SetReservedSlot(obj, DOM_XRAY_EXPANDO_SLOT, v);
} else if (js::IsProxyClass(clasp)) {
@ -1542,7 +1542,7 @@ NativeToString(JSContext* cx, JS::Handle<JSObject*> wrapper,
if (IsDOMProxy(obj)) {
str = JS_BasicObjectToString(cx, obj);
} else {
js::Class* clasp = js::GetObjectClass(obj);
const js::Class* clasp = js::GetObjectClass(obj);
if (IsDOMClass(clasp)) {
str = ConcatJSString(cx, "[object ",
JS_NewStringCopyZ(cx, clasp->name), "]");

View File

@ -138,7 +138,7 @@ UnwrapDOMObject(JSObject* obj)
inline const DOMClass*
GetDOMClass(JSObject* obj)
{
js::Class* clasp = js::GetObjectClass(obj);
const js::Class* clasp = js::GetObjectClass(obj);
if (IsDOMClass(clasp)) {
return &DOMJSClass::FromJSClass(clasp)->mClass;
}
@ -167,7 +167,7 @@ UnwrapDOMObjectToISupports(JSObject* aObject)
inline bool
IsDOMObject(JSObject* obj)
{
js::Class* clasp = js::GetObjectClass(obj);
const js::Class* clasp = js::GetObjectClass(obj);
return IsDOMClass(clasp) || IsDOMProxy(obj, clasp);
}
@ -364,9 +364,9 @@ struct NamedConstructor
void
CreateInterfaceObjects(JSContext* cx, JS::Handle<JSObject*> global,
JS::Handle<JSObject*> protoProto,
JSClass* protoClass, JS::Heap<JSObject*>* protoCache,
const JSClass* protoClass, JS::Heap<JSObject*>* protoCache,
JS::Handle<JSObject*> interfaceProto,
JSClass* constructorClass, const JSNativeHolder* constructor,
const JSClass* constructorClass, const JSNativeHolder* constructor,
unsigned ctorNargs, const NamedConstructor* namedConstructors,
JS::Heap<JSObject*>* constructorCache, const DOMClass* domClass,
const NativeProperties* regularProperties,
@ -483,7 +483,7 @@ SetSystemOnlyWrapperSlot(JSObject* obj, const JS::Value& v)
inline bool
GetSameCompartmentWrapperForDOMBinding(JSObject*& obj)
{
js::Class* clasp = js::GetObjectClass(obj);
const js::Class* clasp = js::GetObjectClass(obj);
if (dom::IsDOMClass(clasp)) {
if (!(clasp->flags & JSCLASS_DOM_GLOBAL)) {
JS::Value v = GetSystemOnlyWrapperSlot(obj);

View File

@ -189,7 +189,7 @@ class CGDOMJSClass(CGThing):
newResolveHook = "JS_ResolveStub"
enumerateHook = "JS_EnumerateStub"
return """
static DOMJSClass Class = {
static const DOMJSClass Class = {
{ "%s",
%s,
%s, /* addProperty */
@ -1011,7 +1011,7 @@ class CGAbstractClassHook(CGAbstractStaticMethod):
class CGGetJSClassMethod(CGAbstractMethod):
def __init__(self, descriptor):
CGAbstractMethod.__init__(self, descriptor, 'GetJSClass', 'JSClass*',
CGAbstractMethod.__init__(self, descriptor, 'GetJSClass', 'const JSClass*',
[])
def definition_body(self):

View File

@ -168,27 +168,20 @@ struct DOMJSClass
// It would be nice to just inherit from JSClass, but that precludes pure
// compile-time initialization of the form |DOMJSClass = {...};|, since C++
// only allows brace initialization for aggregate/POD types.
JSClass mBase;
const JSClass mBase;
DOMClass mClass;
const DOMClass mClass;
static DOMJSClass* FromJSClass(JSClass* base) {
MOZ_ASSERT(base->flags & JSCLASS_IS_DOMJSCLASS);
return reinterpret_cast<DOMJSClass*>(base);
}
static const DOMJSClass* FromJSClass(const JSClass* base) {
MOZ_ASSERT(base->flags & JSCLASS_IS_DOMJSCLASS);
return reinterpret_cast<const DOMJSClass*>(base);
}
static DOMJSClass* FromJSClass(js::Class* base) {
return FromJSClass(Jsvalify(base));
}
static const DOMJSClass* FromJSClass(const js::Class* base) {
return FromJSClass(Jsvalify(base));
}
JSClass* ToJSClass() { return &mBase; }
const JSClass* ToJSClass() const { return &mBase; }
};
// Special JSClass for DOM interface and interface prototype objects.
@ -198,7 +191,7 @@ struct DOMIfaceAndProtoJSClass
// compile-time initialization of the form
// |DOMJSInterfaceAndPrototypeClass = {...};|, since C++ only allows brace
// initialization for aggregate/POD types.
JSClass mBase;
const JSClass mBase;
// Either eInterface or eInterfacePrototype
DOMObjectType mType;
@ -220,7 +213,7 @@ struct DOMIfaceAndProtoJSClass
return FromJSClass(Jsvalify(base));
}
JSClass* ToJSClass() { return &mBase; }
const JSClass* ToJSClass() const { return &mBase; }
};
inline bool

View File

@ -511,7 +511,7 @@ class ThreadLocalJSRuntime
JSContext* mContext;
JSObject* mGlobal;
static JSClass sGlobalClass;
static const JSClass sGlobalClass;
static const unsigned sRuntimeHeapSize = 768 * 1024;
ThreadLocalJSRuntime()
@ -582,7 +582,7 @@ class ThreadLocalJSRuntime
}
};
JSClass ThreadLocalJSRuntime::sGlobalClass = {
const JSClass ThreadLocalJSRuntime::sGlobalClass = {
"IndexedDBTransactionThreadGlobal",
JSCLASS_GLOBAL_FLAGS,
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
@ -852,7 +852,7 @@ public:
} // anonymous namespace
JSClass IDBObjectStore::sDummyPropJSClass = {
const JSClass IDBObjectStore::sDummyPropJSClass = {
"dummy", 0,
JS_PropertyStub, JS_DeletePropertyStub,
JS_PropertyStub, JS_StrictPropertyStub,

View File

@ -244,7 +244,7 @@ public:
void
SetInfo(ObjectStoreInfo* aInfo);
static JSClass sDummyPropJSClass;
static const JSClass sDummyPropJSClass;
// nsWrapperCache
virtual JSObject*

View File

@ -144,7 +144,7 @@ static bool
CreateNPObjectMember(NPP npp, JSContext *cx, JSObject *obj, NPObject *npobj,
JS::Handle<jsid> id, NPVariant* getPropertyResult, JS::Value *vp);
JSClass sNPObjectJSWrapperClass =
const JSClass sNPObjectJSWrapperClass =
{
NPRUNTIME_JSCLASS_NAME,
JSCLASS_HAS_PRIVATE | JSCLASS_IMPLEMENTS_BARRIERS | JSCLASS_NEW_RESOLVE | JSCLASS_NEW_ENUMERATE,
@ -181,7 +181,7 @@ NPObjectMember_Call(JSContext *cx, unsigned argc, JS::Value *vp);
static void
NPObjectMember_Trace(JSTracer *trc, JSObject *obj);
static JSClass sNPObjectMemberClass =
static const JSClass sNPObjectMemberClass =
{
"NPObject Ambiguous Member class", JSCLASS_HAS_PRIVATE | JSCLASS_IMPLEMENTS_BARRIERS,
JS_PropertyStub, JS_DeletePropertyStub,
@ -968,7 +968,7 @@ nsJSObjWrapper::GetNewOrUsed(NPP npp, JSContext *cx, JS::Handle<JSObject*> obj)
// class and private from the JSObject, neither of which cares about
// compartments.
JSClass *clazz = JS_GetClass(obj);
const JSClass *clazz = JS_GetClass(obj);
if (clazz == &sNPObjectJSWrapperClass) {
// obj is one of our own, its private data is the NPObject we're

View File

@ -30,7 +30,7 @@ public:
const NPP mNpp;
};
extern JSClass sNPObjectJSWrapperClass;
extern const JSClass sNPObjectJSWrapperClass;
class nsJSObjWrapper : public NPObject,
public nsJSObjWrapperKey

View File

@ -36,7 +36,7 @@ struct WrapPrototypeTraits
template <> \
struct WrapPrototypeTraits<_class> \
{ \
static inline JSClass* \
static inline const JSClass* \
GetJSClass() \
{ \
using namespace mozilla::dom; \

View File

@ -27,8 +27,8 @@ namespace {
class Event : public PrivatizableBase
{
static JSClass sClass;
static JSClass sMainRuntimeClass;
static const JSClass sClass;
static const JSClass sMainRuntimeClass;
static const JSPropertySpec sProperties[];
static const JSFunctionSpec sFunctions[];
@ -40,7 +40,7 @@ protected:
public:
static bool
IsThisClass(JSClass* aClass)
IsThisClass(const JSClass* aClass)
{
return aClass == &sClass || aClass == &sMainRuntimeClass;
}
@ -69,7 +69,7 @@ public:
}
}
JSClass* clasp = parentProto ? &sMainRuntimeClass : &sClass;
const JSClass* clasp = parentProto ? &sMainRuntimeClass : &sClass;
JS::Rooted<JSObject*> proto(aCx, JS_InitClass(aCx, aObj, parentProto, clasp, Construct, 0,
sProperties, sFunctions, nullptr, nullptr));
@ -94,7 +94,7 @@ public:
Create(JSContext* aCx, JS::Handle<JSObject*> aParent, JS::Handle<JSString*> aType,
bool aBubbles, bool aCancelable, bool aMainRuntime)
{
JSClass* clasp = aMainRuntime ? &sMainRuntimeClass : &sClass;
const JSClass* clasp = aMainRuntime ? &sMainRuntimeClass : &sClass;
JSObject* obj = JS_NewObject(aCx, clasp, NULL, aParent);
if (obj) {
@ -334,7 +334,7 @@ private:
};
#define DECL_EVENT_CLASS(_varname, _name) \
JSClass _varname = { \
const JSClass _varname = { \
_name, \
JSCLASS_HAS_PRIVATE | JSCLASS_HAS_RESERVED_SLOTS(SLOT_COUNT), \
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub, \
@ -385,8 +385,8 @@ const dom::ConstantSpec Event::sStaticConstants[] = {
class MessageEvent : public Event
{
static JSClass sClass;
static JSClass sMainRuntimeClass;
static const JSClass sClass;
static const JSClass sMainRuntimeClass;
static const JSPropertySpec sProperties[];
static const JSFunctionSpec sFunctions[];
@ -398,7 +398,7 @@ protected:
public:
static bool
IsThisClass(JSClass* aClass)
IsThisClass(const JSClass* aClass)
{
return aClass == &sClass || aClass == &sMainRuntimeClass;
}
@ -407,7 +407,7 @@ public:
InitClass(JSContext* aCx, JSObject* aObj, JSObject* aParentProto,
bool aMainRuntime)
{
JSClass* clasp = aMainRuntime ? &sMainRuntimeClass : &sClass;
const JSClass* clasp = aMainRuntime ? &sMainRuntimeClass : &sClass;
return JS_InitClass(aCx, aObj, aParentProto, clasp, Construct, 0,
sProperties, sFunctions, NULL, NULL);
@ -422,7 +422,7 @@ public:
return NULL;
}
JSClass* clasp = aMainRuntime ? &sMainRuntimeClass : &sClass;
const JSClass* clasp = aMainRuntime ? &sMainRuntimeClass : &sClass;
JS::Rooted<JSObject*> obj(aCx, JS_NewObject(aCx, clasp, NULL, aParent));
if (!obj) {
@ -464,7 +464,7 @@ private:
static MessageEvent*
GetInstancePrivate(JSContext* aCx, JSObject* aObj, const char* aFunctionName)
{
JSClass* classPtr = JS_GetClass(aObj);
const JSClass* classPtr = JS_GetClass(aObj);
if (IsThisClass(classPtr)) {
return GetJSPrivateSafeish<MessageEvent>(aObj);
}
@ -597,7 +597,7 @@ private:
};
#define DECL_MESSAGEEVENT_CLASS(_varname, _name) \
JSClass _varname = { \
const JSClass _varname = { \
_name, \
JSCLASS_HAS_PRIVATE | JSCLASS_HAS_RESERVED_SLOTS(SLOT_COUNT), \
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub, \
@ -626,15 +626,15 @@ const JSFunctionSpec MessageEvent::sFunctions[] = {
class ErrorEvent : public Event
{
static JSClass sClass;
static JSClass sMainRuntimeClass;
static const JSClass sClass;
static const JSClass sMainRuntimeClass;
static const JSPropertySpec sProperties[];
static const JSFunctionSpec sFunctions[];
public:
static bool
IsThisClass(JSClass* aClass)
IsThisClass(const JSClass* aClass)
{
return aClass == &sClass || aClass == &sMainRuntimeClass;
}
@ -643,7 +643,7 @@ public:
InitClass(JSContext* aCx, JSObject* aObj, JSObject* aParentProto,
bool aMainRuntime)
{
JSClass* clasp = aMainRuntime ? &sMainRuntimeClass : &sClass;
const JSClass* clasp = aMainRuntime ? &sMainRuntimeClass : &sClass;
return JS_InitClass(aCx, aObj, aParentProto, clasp, Construct, 0,
sProperties, sFunctions, NULL, NULL);
@ -658,7 +658,7 @@ public:
return NULL;
}
JSClass* clasp = aMainRuntime ? &sMainRuntimeClass : &sClass;
const JSClass* clasp = aMainRuntime ? &sMainRuntimeClass : &sClass;
JS::Rooted<JSObject*> obj(aCx, JS_NewObject(aCx, clasp, NULL, aParent));
if (!obj) {
@ -696,7 +696,7 @@ private:
static ErrorEvent*
GetInstancePrivate(JSContext* aCx, JSObject* aObj, const char* aFunctionName)
{
JSClass* classPtr = JS_GetClass(aObj);
const JSClass* classPtr = JS_GetClass(aObj);
if (IsThisClass(classPtr)) {
return GetJSPrivateSafeish<ErrorEvent>(aObj);
}
@ -797,7 +797,7 @@ private:
};
#define DECL_ERROREVENT_CLASS(_varname, _name) \
JSClass _varname = { \
const JSClass _varname = { \
_name, \
JSCLASS_HAS_PRIVATE | JSCLASS_HAS_RESERVED_SLOTS(SLOT_COUNT), \
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub, \
@ -826,11 +826,11 @@ const JSFunctionSpec ErrorEvent::sFunctions[] = {
class ProgressEvent : public Event
{
static JSClass sClass;
static const JSClass sClass;
static const JSPropertySpec sProperties[];
public:
static JSClass*
static const JSClass*
Class()
{
return &sClass;
@ -888,7 +888,7 @@ private:
static ProgressEvent*
GetInstancePrivate(JSContext* aCx, JSObject* aObj, const char* aFunctionName)
{
JSClass* classPtr = JS_GetClass(aObj);
const JSClass* classPtr = JS_GetClass(aObj);
if (classPtr == &sClass) {
return GetJSPrivateSafeish<ProgressEvent>(aObj);
}
@ -962,7 +962,7 @@ private:
};
};
JSClass ProgressEvent::sClass = {
const JSClass ProgressEvent::sClass = {
"WorkerProgressEvent",
JSCLASS_HAS_PRIVATE | JSCLASS_HAS_RESERVED_SLOTS(SLOT_COUNT),
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
@ -983,7 +983,7 @@ Event*
Event::GetPrivate(JSObject* aObj)
{
if (aObj) {
JSClass* classPtr = JS_GetClass(aObj);
const JSClass* classPtr = JS_GetClass(aObj);
if (IsThisClass(classPtr) ||
MessageEvent::IsThisClass(classPtr) ||
ErrorEvent::IsThisClass(classPtr) ||

View File

@ -31,7 +31,7 @@ class Blob
Blob();
~Blob();
static JSClass sClass;
static const JSClass sClass;
static const JSPropertySpec sProperties[];
static const JSFunctionSpec sFunctions[];
@ -208,7 +208,7 @@ private:
}
};
JSClass Blob::sClass = {
const JSClass Blob::sClass = {
"Blob",
JSCLASS_HAS_PRIVATE,
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
@ -232,7 +232,7 @@ class File : public Blob
File();
~File();
static JSClass sClass;
static const JSClass sClass;
static const JSPropertySpec sProperties[];
public:
@ -260,7 +260,7 @@ public:
GetPrivate(JSObject* aObj)
{
if (aObj) {
JSClass* classPtr = JS_GetClass(aObj);
const JSClass* classPtr = JS_GetClass(aObj);
if (classPtr == &sClass) {
nsISupports* priv = static_cast<nsISupports*>(JS_GetPrivate(aObj));
nsCOMPtr<nsIDOMFile> file = do_QueryInterface(priv);
@ -271,7 +271,7 @@ public:
return NULL;
}
static JSClass*
static const JSClass*
Class()
{
return &sClass;
@ -426,7 +426,7 @@ private:
}
};
JSClass File::sClass = {
const JSClass File::sClass = {
"File",
JSCLASS_HAS_PRIVATE,
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
@ -446,7 +446,7 @@ nsIDOMBlob*
Blob::GetPrivate(JSObject* aObj)
{
if (aObj) {
JSClass* classPtr = JS_GetClass(aObj);
const JSClass* classPtr = JS_GetClass(aObj);
if (classPtr == &sClass || classPtr == File::Class()) {
nsISupports* priv = static_cast<nsISupports*>(JS_GetPrivate(aObj));
nsCOMPtr<nsIDOMBlob> blob = do_QueryInterface(priv);

View File

@ -27,8 +27,8 @@ namespace {
class Worker
{
static DOMJSClass sClass;
static DOMIfaceAndProtoJSClass sProtoClass;
static const DOMJSClass sClass;
static const DOMIfaceAndProtoJSClass sProtoClass;
static const JSPropertySpec sProperties[];
static const JSFunctionSpec sFunctions[];
@ -40,19 +40,19 @@ protected:
};
public:
static JSClass*
static const JSClass*
Class()
{
return sClass.ToJSClass();
}
static JSClass*
static const JSClass*
ProtoClass()
{
return sProtoClass.ToJSClass();
}
static DOMClass*
static const DOMClass*
DOMClassStruct()
{
return &sClass.mClass;
@ -71,7 +71,7 @@ public:
}
js::SetReservedSlot(proto, DOM_PROTO_INSTANCE_CLASS_SLOT,
JS::PrivateValue(DOMClassStruct()));
JS::PrivateValue(const_cast<DOMClass *>(DOMClassStruct())));
if (!aMainRuntime) {
WorkerPrivate* parent = GetWorkerPrivateFromContext(aCx);
@ -93,7 +93,7 @@ public:
protected:
static bool
ConstructInternal(JSContext* aCx, unsigned aArgc, jsval* aVp,
bool aIsChromeWorker, JSClass* aClass)
bool aIsChromeWorker, const JSClass* aClass)
{
if (!aArgc) {
JS_ReportError(aCx, "Constructor requires at least one argument!");
@ -346,7 +346,7 @@ private:
}
};
DOMJSClass Worker::sClass = {
const DOMJSClass Worker::sClass = {
{
"Worker",
JSCLASS_IS_DOMJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(3) |
@ -362,7 +362,7 @@ DOMJSClass Worker::sClass = {
}
};
DOMIfaceAndProtoJSClass Worker::sProtoClass = {
const DOMIfaceAndProtoJSClass Worker::sProtoClass = {
{
// XXXbz we use "Worker" here to match sClass so that we can
// js::InitClassWithReserved this JSClass and then call
@ -406,23 +406,23 @@ const JSFunctionSpec Worker::sFunctions[] = {
class ChromeWorker : public Worker
{
static DOMJSClass sClass;
static DOMIfaceAndProtoJSClass sProtoClass;
static const DOMJSClass sClass;
static const DOMIfaceAndProtoJSClass sProtoClass;
public:
static JSClass*
static const JSClass*
Class()
{
return sClass.ToJSClass();
}
static JSClass*
static const JSClass*
ProtoClass()
{
return sProtoClass.ToJSClass();
}
static DOMClass*
static const DOMClass*
DOMClassStruct()
{
return &sClass.mClass;
@ -440,7 +440,7 @@ public:
}
js::SetReservedSlot(proto, DOM_PROTO_INSTANCE_CLASS_SLOT,
JS::PrivateValue(DOMClassStruct()));
JS::PrivateValue(const_cast<DOMClass *>(DOMClassStruct())));
if (!aMainRuntime) {
WorkerPrivate* parent = GetWorkerPrivateFromContext(aCx);
@ -467,7 +467,7 @@ private:
GetInstancePrivate(JSContext* aCx, JSObject* aObj, const char* aFunctionName)
{
if (aObj) {
JSClass* classPtr = JS_GetClass(aObj);
const JSClass* classPtr = JS_GetClass(aObj);
if (classPtr == Class()) {
return UnwrapDOMObject<WorkerPrivate>(aObj);
}
@ -503,7 +503,7 @@ private:
}
};
DOMJSClass ChromeWorker::sClass = {
const DOMJSClass ChromeWorker::sClass = {
{ "ChromeWorker",
JSCLASS_IS_DOMJSCLASS | JSCLASS_HAS_RESERVED_SLOTS(3) |
JSCLASS_IMPLEMENTS_BARRIERS,
@ -518,7 +518,7 @@ DOMJSClass ChromeWorker::sClass = {
}
};
DOMIfaceAndProtoJSClass ChromeWorker::sProtoClass = {
const DOMIfaceAndProtoJSClass ChromeWorker::sProtoClass = {
{
// XXXbz we use "ChromeWorker" here to match sClass so that we can
// js::InitClassWithReserved this JSClass and then call
@ -552,7 +552,7 @@ WorkerPrivate*
Worker::GetInstancePrivate(JSContext* aCx, JSObject* aObj,
const char* aFunctionName)
{
JSClass* classPtr = JS_GetClass(aObj);
const JSClass* classPtr = JS_GetClass(aObj);
if (ClassIsWorker(classPtr)) {
return UnwrapDOMObject<WorkerPrivate>(aObj);
}
@ -606,7 +606,7 @@ InitClass(JSContext* aCx, JSObject* aGlobal, JSObject* aProto,
} // namespace chromeworker
bool
ClassIsWorker(JSClass* aClass)
ClassIsWorker(const JSClass* aClass)
{
return Worker::Class() == aClass || ChromeWorker::Class() == aClass;
}

View File

@ -27,7 +27,7 @@ InitClass(JSContext* aCx, JSObject* aGlobal, JSObject* aProto,
} // namespace chromeworker
bool
ClassIsWorker(JSClass* aClass);
ClassIsWorker(const JSClass* aClass);
END_WORKERS_NAMESPACE

View File

@ -61,7 +61,7 @@ namespace {
class WorkerGlobalScope : public workers::EventTarget,
public nsIGlobalObject
{
static JSClass sClass;
static const JSClass sClass;
static const JSPropertySpec sProperties[];
static const JSFunctionSpec sFunctions[];
@ -96,7 +96,7 @@ protected:
WorkerPrivate* mWorker;
public:
static JSClass*
static const JSClass*
Class()
{
return &sClass;
@ -653,7 +653,7 @@ NS_INTERFACE_MAP_BEGIN(WorkerGlobalScope)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, DOMBindingBase)
NS_INTERFACE_MAP_END
JSClass WorkerGlobalScope::sClass = {
const JSClass WorkerGlobalScope::sClass = {
"WorkerGlobalScope",
0,
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
@ -691,8 +691,8 @@ const char* const WorkerGlobalScope::sEventStrings[STRING_COUNT] = {
class DedicatedWorkerGlobalScope : public WorkerGlobalScope
{
static DOMJSClass sClass;
static DOMIfaceAndProtoJSClass sProtoClass;
static const DOMJSClass sClass;
static const DOMIfaceAndProtoJSClass sProtoClass;
static const JSPropertySpec sProperties[];
static const JSFunctionSpec sFunctions[];
@ -706,19 +706,19 @@ class DedicatedWorkerGlobalScope : public WorkerGlobalScope
static const char* const sEventStrings[STRING_COUNT];
public:
static JSClass*
static const JSClass*
Class()
{
return sClass.ToJSClass();
}
static JSClass*
static const JSClass*
ProtoClass()
{
return sProtoClass.ToJSClass();
}
static DOMClass*
static const DOMClass*
DOMClassStruct()
{
return &sClass.mClass;
@ -732,7 +732,7 @@ public:
sProperties, sFunctions, NULL, NULL);
if (proto) {
js::SetReservedSlot(proto, DOM_PROTO_INSTANCE_CLASS_SLOT,
JS::PrivateValue(DOMClassStruct()));
JS::PrivateValue(const_cast<DOMClass *>(DOMClassStruct())));
}
return proto;
}
@ -845,7 +845,7 @@ private:
static DedicatedWorkerGlobalScope*
GetInstancePrivate(JSContext* aCx, JSObject* aObj, const char* aFunctionName)
{
JSClass* classPtr = JS_GetClass(aObj);
const JSClass* classPtr = JS_GetClass(aObj);
if (classPtr == Class()) {
return UnwrapDOMObject<DedicatedWorkerGlobalScope>(aObj);
}
@ -931,7 +931,7 @@ private:
}
};
DOMJSClass DedicatedWorkerGlobalScope::sClass = {
const DOMJSClass DedicatedWorkerGlobalScope::sClass = {
{
// We don't have to worry about Xray expando slots here because we'll never
// have an Xray wrapper to a worker global scope.
@ -949,7 +949,7 @@ DOMJSClass DedicatedWorkerGlobalScope::sClass = {
}
};
DOMIfaceAndProtoJSClass DedicatedWorkerGlobalScope::sProtoClass = {
const DOMIfaceAndProtoJSClass DedicatedWorkerGlobalScope::sProtoClass = {
{
// XXXbz we use "DedicatedWorkerGlobalScope" here to match sClass
// so that we can JS_InitClass this JSClass and then
@ -998,7 +998,7 @@ WorkerGlobalScope*
WorkerGlobalScope::GetInstancePrivate(JSContext* aCx, JSObject* aObj,
const char* aFunctionName)
{
JSClass* classPtr = JS_GetClass(aObj);
const JSClass* classPtr = JS_GetClass(aObj);
// We can only make DedicatedWorkerGlobalScope, not WorkerGlobalScope, so this
// should never happen.
@ -1121,7 +1121,7 @@ CreateDedicatedWorkerGlobalScope(JSContext* aCx)
}
bool
ClassIsWorkerGlobalScope(JSClass* aClass)
ClassIsWorkerGlobalScope(const JSClass* aClass)
{
return WorkerGlobalScope::Class() == aClass ||
DedicatedWorkerGlobalScope::Class() == aClass;

View File

@ -14,7 +14,7 @@ JSObject*
CreateDedicatedWorkerGlobalScope(JSContext* aCx);
bool
ClassIsWorkerGlobalScope(JSClass* aClass);
ClassIsWorkerGlobalScope(const JSClass* aClass);
END_WORKERS_NAMESPACE

View File

@ -47,12 +47,12 @@ extern void
global_finalize(JSFreeOp* fop, JSObject* obj);
extern JSObject*
CreateJSDGlobal(JSContext *cx, JSClass *clasp);
CreateJSDGlobal(JSContext *cx, const JSClass *clasp);
/***************************************************************************/
static JSClass global_class = {
static const JSClass global_class = {
"JSDGlobal", JSCLASS_GLOBAL_FLAGS |
JSCLASS_HAS_PRIVATE | JSCLASS_PRIVATE_IS_NSISUPPORTS,
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,

View File

@ -3343,7 +3343,7 @@ global_finalize(JSFreeOp *aFop, JSObject *aObj)
}
JSObject *
CreateJSDGlobal(JSContext *aCx, JSClass *aClasp)
CreateJSDGlobal(JSContext *aCx, const JSClass *aClasp)
{
nsresult rv;
nsCOMPtr<nsIPrincipal> nullPrin = do_CreateInstance("@mozilla.org/nullprincipal;1", &rv);

View File

@ -41,7 +41,7 @@ CallMethodIfWrapped(JSContext *cx, IsAcceptableThis test, NativeImpl impl, CallA
// and indicates whether the provided value is an acceptable |this| for the
// method; it must be a pure function only of its argument.
//
// static JSClass AnswerClass = { ... };
// static const JSClass AnswerClass = { ... };
//
// static bool
// IsAnswerObject(const Value &v)

View File

@ -35,7 +35,7 @@ class SpecialId;
// This is equal to JSFunction::class_. Use it in places where you don't want
// to #include jsfun.h.
extern JS_FRIEND_DATA(js::Class* const) FunctionClassPtr;
extern JS_FRIEND_DATA(const js::Class* const) FunctionClassPtr;
static JS_ALWAYS_INLINE jsid
SPECIALID_TO_JSID(const SpecialId &sid);
@ -629,22 +629,12 @@ JS_STATIC_ASSERT(offsetof(JSClass, hasInstance) == offsetof(Class, hasInstance))
JS_STATIC_ASSERT(offsetof(JSClass, trace) == offsetof(Class, trace));
JS_STATIC_ASSERT(sizeof(JSClass) == sizeof(Class));
static JS_ALWAYS_INLINE JSClass *
Jsvalify(Class *c)
{
return (JSClass *)c;
}
static JS_ALWAYS_INLINE const JSClass *
Jsvalify(const Class *c)
{
return (const JSClass *)c;
}
static JS_ALWAYS_INLINE Class *
Valueify(JSClass *c)
{
return (Class *)c;
}
static JS_ALWAYS_INLINE const Class *
Valueify(const JSClass *c)
{

View File

@ -547,7 +547,7 @@ static void collator_finalize(FreeOp *fop, JSObject *obj);
static const uint32_t UCOLLATOR_SLOT = 0;
static const uint32_t COLLATOR_SLOTS_COUNT = 1;
static Class CollatorClass = {
static const Class CollatorClass = {
js_Object_str,
JSCLASS_HAS_RESERVED_SLOTS(COLLATOR_SLOTS_COUNT),
JS_PropertyStub, /* addProperty */
@ -1030,7 +1030,7 @@ static void numberFormat_finalize(FreeOp *fop, JSObject *obj);
static const uint32_t UNUMBER_FORMAT_SLOT = 0;
static const uint32_t NUMBER_FORMAT_SLOTS_COUNT = 1;
static Class NumberFormatClass = {
static const Class NumberFormatClass = {
js_Object_str,
JSCLASS_HAS_RESERVED_SLOTS(NUMBER_FORMAT_SLOTS_COUNT),
JS_PropertyStub, /* addProperty */
@ -1486,7 +1486,7 @@ static void dateTimeFormat_finalize(FreeOp *fop, JSObject *obj);
static const uint32_t UDATE_FORMAT_SLOT = 0;
static const uint32_t DATE_TIME_FORMAT_SLOTS_COUNT = 1;
static Class DateTimeFormatClass = {
static const Class DateTimeFormatClass = {
js_Object_str,
JSCLASS_HAS_RESERVED_SLOTS(DATE_TIME_FORMAT_SLOTS_COUNT),
JS_PropertyStub, /* addProperty */
@ -1968,7 +1968,7 @@ js::intl_FormatDateTime(JSContext *cx, unsigned argc, Value *vp)
/******************** Intl ********************/
Class js::IntlClass = {
const Class js::IntlClass = {
js_Object_str,
JSCLASS_HAS_CACHED_PROTO(JSProto_Intl),
JS_PropertyStub, /* addProperty */

View File

@ -855,7 +855,7 @@ namespace {
class MapIteratorObject : public JSObject
{
public:
static Class class_;
static const Class class_;
enum { TargetSlot, KindSlot, RangeSlot, SlotCount };
static const JSFunctionSpec methods[];
@ -873,7 +873,7 @@ class MapIteratorObject : public JSObject
} /* anonymous namespace */
Class MapIteratorObject::class_ = {
const Class MapIteratorObject::class_ = {
"Map Iterator",
JSCLASS_IMPLEMENTS_BARRIERS |
JSCLASS_HAS_RESERVED_SLOTS(MapIteratorObject::SlotCount),
@ -1006,7 +1006,7 @@ MapIteratorObject::next(JSContext *cx, unsigned argc, Value *vp)
/*** Map *****************************************************************************************/
Class MapObject::class_ = {
const Class MapObject::class_ = {
"Map",
JSCLASS_HAS_PRIVATE | JSCLASS_IMPLEMENTS_BARRIERS |
JSCLASS_HAS_CACHED_PROTO(JSProto_Map),
@ -1043,7 +1043,7 @@ const JSFunctionSpec MapObject::methods[] = {
};
static JSObject *
InitClass(JSContext *cx, Handle<GlobalObject*> global, Class *clasp, JSProtoKey key, Native construct,
InitClass(JSContext *cx, Handle<GlobalObject*> global, const Class *clasp, JSProtoKey key, Native construct,
const JSPropertySpec *properties, const JSFunctionSpec *methods)
{
Rooted<JSObject*> proto(cx, global->createBlankPrototype(cx, clasp));
@ -1422,7 +1422,7 @@ namespace {
class SetIteratorObject : public JSObject
{
public:
static Class class_;
static const Class class_;
enum { TargetSlot, KindSlot, RangeSlot, SlotCount };
static const JSFunctionSpec methods[];
@ -1440,7 +1440,7 @@ class SetIteratorObject : public JSObject
} /* anonymous namespace */
Class SetIteratorObject::class_ = {
const Class SetIteratorObject::class_ = {
"Set Iterator",
JSCLASS_IMPLEMENTS_BARRIERS |
JSCLASS_HAS_RESERVED_SLOTS(SetIteratorObject::SlotCount),
@ -1569,7 +1569,7 @@ SetIteratorObject::next(JSContext *cx, unsigned argc, Value *vp)
/*** Set *****************************************************************************************/
Class SetObject::class_ = {
const Class SetObject::class_ = {
"Set",
JSCLASS_HAS_PRIVATE | JSCLASS_IMPLEMENTS_BARRIERS |
JSCLASS_HAS_CACHED_PROTO(JSProto_Set),

View File

@ -88,7 +88,7 @@ class MapObject : public JSObject {
enum IteratorKind { Keys, Values, Entries };
static JSObject *initClass(JSContext *cx, JSObject *obj);
static Class class_;
static const Class class_;
private:
static const JSPropertySpec properties[];
static const JSFunctionSpec methods[];
@ -126,7 +126,7 @@ class SetObject : public JSObject {
public:
enum IteratorKind { Values, Entries };
static JSObject *initClass(JSContext *cx, JSObject *obj);
static Class class_;
static const Class class_;
private:
static const JSPropertySpec properties[];
static const JSFunctionSpec methods[];

View File

@ -14,7 +14,7 @@ namespace js {
typedef Rooted<Module*> RootedModule;
}
Class Module::class_ = {
const Class Module::class_ = {
"Module",
JSCLASS_HAS_RESERVED_SLOTS(2) | JSCLASS_IS_ANONYMOUS,
JS_PropertyStub, /* addProperty */

View File

@ -23,7 +23,7 @@ class Module : public JSObject {
return (JSScript *) getReservedSlot(SCRIPT_SLOT).toPrivate();
}
static Class class_;
static const Class class_;
private:
inline void setAtom(JSAtom *atom);

View File

@ -44,7 +44,7 @@ const JSFunctionSpec ParallelArrayObject::methods[] = {
JS_FS_END
};
Class ParallelArrayObject::protoClass = {
const Class ParallelArrayObject::protoClass = {
"ParallelArray",
JSCLASS_HAS_CACHED_PROTO(JSProto_ParallelArray),
JS_PropertyStub, // addProperty
@ -56,7 +56,7 @@ Class ParallelArrayObject::protoClass = {
JS_ConvertStub
};
Class ParallelArrayObject::class_ = {
const Class ParallelArrayObject::class_ = {
"ParallelArray",
JSCLASS_HAS_CACHED_PROTO(JSProto_ParallelArray),
JS_PropertyStub, // addProperty

View File

@ -15,7 +15,7 @@ namespace js {
class ParallelArrayObject : public JSObject
{
static Class protoClass;
static const Class protoClass;
static const JSFunctionSpec methods[];
static const uint32_t NumFixedSlots = 4;
static const uint32_t NumCtors = 4;
@ -24,7 +24,7 @@ class ParallelArrayObject : public JSObject
static bool initProps(JSContext *cx, HandleObject obj);
public:
static Class class_;
static const Class class_;
static bool construct(JSContext *cx, unsigned argc, Value *vp);
static bool constructHelper(JSContext *cx, MutableHandleFunction ctor, CallArgs &args);

View File

@ -790,7 +790,7 @@ finalize_counter_finalize(JSFreeOp *fop, JSObject *obj)
++finalizeCount;
}
static JSClass FinalizeCounterClass = {
static const JSClass FinalizeCounterClass = {
"FinalizeCounter", JSCLASS_IS_ANONYMOUS,
JS_PropertyStub, /* addProperty */
JS_DeletePropertyStub, /* delProperty */

View File

@ -25,7 +25,7 @@ using namespace mozilla;
///////////////////////////////////////////////////////////////////////////
// Class def'n for the owner object
Class TypeRepresentation::class_ = {
const Class TypeRepresentation::class_ = {
"TypeRepresentation",
JSCLASS_IMPLEMENTS_BARRIERS |
JSCLASS_HAS_PRIVATE,

View File

@ -105,7 +105,7 @@ class TypeRepresentation {
JSObject *addToTableOrFree(JSContext *cx, TypeRepresentationSet::AddPtr &p);
private:
static Class class_;
static const Class class_;
static void obj_trace(JSTracer *trace, JSObject *object);
static void obj_finalize(js::FreeOp *fop, JSObject *object);

View File

@ -243,7 +243,7 @@ IsBinaryStruct(JSContext *cx, HandleObject obj)
return IsBlockOfKind(cx, obj, TypeRepresentation::Struct);
}
Class js::DataClass = {
const Class js::DataClass = {
"Data",
JSCLASS_HAS_CACHED_PROTO(JSProto_Data),
JS_PropertyStub,
@ -255,7 +255,7 @@ Class js::DataClass = {
JS_ConvertStub
};
Class js::TypeClass = {
const Class js::TypeClass = {
"Type",
JSCLASS_HAS_CACHED_PROTO(JSProto_Type),
JS_PropertyStub,
@ -319,7 +319,7 @@ TypeEquivalent(JSContext *cx, unsigned int argc, Value *vp)
NULL \
},
Class js::NumericTypeClasses[ScalarTypeRepresentation::TYPE_MAX] = {
const Class js::NumericTypeClasses[ScalarTypeRepresentation::TYPE_MAX] = {
JS_FOR_EACH_SCALAR_TYPE_REPR(BINARYDATA_NUMERIC_CLASSES)
};
@ -365,7 +365,7 @@ InRange<double, double>(double x)
#define BINARYDATA_TYPE_TO_CLASS(constant_, type_, name_) \
template <> \
Class * \
const Class * \
NumericType<constant_, type_>::typeToClass() \
{ \
return &NumericTypeClasses[constant_]; \
@ -554,7 +554,7 @@ SetupAndGetPrototypeObjectForComplexTypeInstance(JSContext *cx,
return prototypeObj;
}
Class ArrayType::class_ = {
const Class ArrayType::class_ = {
"ArrayType",
JSCLASS_HAS_RESERVED_SLOTS(ARRAY_TYPE_RESERVED_SLOTS) |
JSCLASS_HAS_CACHED_PROTO(JSProto_ArrayType),
@ -1028,7 +1028,7 @@ ArrayType::construct(JSContext *cx, unsigned argc, Value *vp)
/*********************************
* Structs
*********************************/
Class StructType::class_ = {
const Class StructType::class_ = {
"StructType",
JSCLASS_HAS_RESERVED_SLOTS(STRUCT_TYPE_RESERVED_SLOTS) |
JSCLASS_HAS_PRIVATE | // used to store FieldList
@ -1572,7 +1572,7 @@ DefineNumericClass(JSContext *cx,
RootedObject numFun(
cx,
JS_DefineObject(cx, global, name,
(JSClass *) &NumericTypeClasses[type],
(const JSClass *) &NumericTypeClasses[type],
globalProto, 0));
if (!numFun)
return false;
@ -1624,7 +1624,7 @@ js_InitTypedObjectClasses(JSContext *cx, HandleObject obj)
///////////////////////////////////////////////////////////////////////////
// Binary blocks
Class BinaryBlock::class_ = {
const Class BinaryBlock::class_ = {
"BinaryBlock",
Class::NON_NATIVE |
JSCLASS_HAS_RESERVED_SLOTS(BLOCK_RESERVED_SLOTS) |

View File

@ -47,22 +47,22 @@ enum BlockCommonSlots {
BLOCK_RESERVED_SLOTS
};
extern Class DataClass;
extern const Class DataClass;
extern Class TypeClass;
extern const Class TypeClass;
template <ScalarTypeRepresentation::Type type, typename T>
class NumericType
{
private:
static Class * typeToClass();
static const Class * typeToClass();
public:
static bool convert(JSContext *cx, HandleValue val, T* converted);
static bool reify(JSContext *cx, void *mem, MutableHandleValue vp);
static bool call(JSContext *cx, unsigned argc, Value *vp);
};
extern Class NumericTypeClasses[ScalarTypeRepresentation::TYPE_MAX];
extern const Class NumericTypeClasses[ScalarTypeRepresentation::TYPE_MAX];
/*
* Type descriptor created by `new ArrayType(...)`
@ -71,7 +71,7 @@ class ArrayType : public JSObject
{
private:
public:
static Class class_;
static const Class class_;
static JSObject *create(JSContext *cx, HandleObject arrayTypeGlobal,
HandleObject elementType, size_t length);
@ -99,7 +99,7 @@ class StructType : public JSObject
HandleObject fields);
public:
static Class class_;
static const Class class_;
static bool toSource(JSContext *cx, unsigned int argc, jsval *vp);
@ -195,7 +195,7 @@ class BinaryBlock
MutableHandleValue statep, MutableHandleId idp);
public:
static Class class_;
static const Class class_;
static bool isBlock(HandleObject val);
static uint8_t *mem(HandleObject val);

View File

@ -447,14 +447,14 @@ namespace UInt64 {
// Class representing the 'ctypes' object itself. This exists to contain the
// JSCTypesCallbacks set of function pointers.
static JSClass sCTypesGlobalClass = {
static const JSClass sCTypesGlobalClass = {
"ctypes",
JSCLASS_HAS_RESERVED_SLOTS(CTYPESGLOBAL_SLOTS),
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub
};
static JSClass sCABIClass = {
static const JSClass sCABIClass = {
"CABI",
JSCLASS_HAS_RESERVED_SLOTS(CABI_SLOTS),
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
@ -464,7 +464,7 @@ static JSClass sCABIClass = {
// Class representing ctypes.{C,Pointer,Array,Struct,Function}Type.prototype.
// This exists to give said prototypes a class of "CType", and to provide
// reserved slots for stashing various other prototype objects.
static JSClass sCTypeProtoClass = {
static const JSClass sCTypeProtoClass = {
"CType",
JSCLASS_HAS_RESERVED_SLOTS(CTYPEPROTO_SLOTS),
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
@ -474,14 +474,14 @@ static JSClass sCTypeProtoClass = {
// Class representing ctypes.CData.prototype and the 'prototype' properties
// of CTypes. This exists to give said prototypes a class of "CData".
static JSClass sCDataProtoClass = {
static const JSClass sCDataProtoClass = {
"CData",
0,
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub
};
static JSClass sCTypeClass = {
static const JSClass sCTypeClass = {
"CType",
JSCLASS_IMPLEMENTS_BARRIERS | JSCLASS_HAS_RESERVED_SLOTS(CTYPE_SLOTS),
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
@ -490,7 +490,7 @@ static JSClass sCTypeClass = {
CType::Trace
};
static JSClass sCDataClass = {
static const JSClass sCDataClass = {
"CData",
JSCLASS_HAS_RESERVED_SLOTS(CDATA_SLOTS),
JS_PropertyStub, JS_DeletePropertyStub, ArrayType::Getter, ArrayType::Setter,
@ -498,7 +498,7 @@ static JSClass sCDataClass = {
NULL, FunctionType::Call, NULL, FunctionType::Call
};
static JSClass sCClosureClass = {
static const JSClass sCClosureClass = {
"CClosure",
JSCLASS_IMPLEMENTS_BARRIERS | JSCLASS_HAS_RESERVED_SLOTS(CCLOSURE_SLOTS),
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
@ -509,7 +509,7 @@ static JSClass sCClosureClass = {
/*
* Class representing the prototype of CDataFinalizer.
*/
static JSClass sCDataFinalizerProtoClass = {
static const JSClass sCDataFinalizerProtoClass = {
"CDataFinalizer",
0,
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
@ -522,7 +522,7 @@ static JSClass sCDataFinalizerProtoClass = {
* Instances of CDataFinalizer have both private data (with type
* |CDataFinalizer::Private|) and slots (see |CDataFinalizerSlots|).
*/
static JSClass sCDataFinalizerClass = {
static const JSClass sCDataFinalizerClass = {
"CDataFinalizer",
JSCLASS_HAS_PRIVATE | JSCLASS_HAS_RESERVED_SLOTS(CDATAFINALIZER_SLOTS),
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
@ -682,28 +682,28 @@ static const JSFunctionSpec sFunctionInstanceFunctions[] = {
JS_FS_END
};
static JSClass sInt64ProtoClass = {
static const JSClass sInt64ProtoClass = {
"Int64",
0,
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub
};
static JSClass sUInt64ProtoClass = {
static const JSClass sUInt64ProtoClass = {
"UInt64",
0,
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub
};
static JSClass sInt64Class = {
static const JSClass sInt64Class = {
"Int64",
JSCLASS_HAS_RESERVED_SLOTS(INT64_SLOTS),
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, Int64Base::Finalize
};
static JSClass sUInt64Class = {
static const JSClass sUInt64Class = {
"UInt64",
JSCLASS_HAS_RESERVED_SLOTS(INT64_SLOTS),
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
@ -1013,7 +1013,7 @@ InitTypeConstructor(JSContext* cx,
static JSObject*
InitInt64Class(JSContext* cx,
HandleObject parent,
JSClass* clasp,
const JSClass* clasp,
JSNative construct,
const JSFunctionSpec* fs,
const JSFunctionSpec* static_fs)
@ -7287,7 +7287,7 @@ Int64Base::Construct(JSContext* cx,
uint64_t data,
bool isUnsigned)
{
JSClass* clasp = isUnsigned ? &sUInt64Class : &sInt64Class;
const JSClass* clasp = isUnsigned ? &sUInt64Class : &sInt64Class;
RootedObject parent(cx, JS_GetParent(proto));
RootedObject result(cx, JS_NewObject(cx, clasp, proto, parent));
if (!result)

View File

@ -33,7 +33,7 @@ namespace Library
typedef Rooted<JSFlatString*> RootedFlatString;
static JSClass sLibraryClass = {
static const JSClass sLibraryClass = {
"Library",
JSCLASS_HAS_RESERVED_SLOTS(LIBRARY_SLOTS),
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,

View File

@ -1463,7 +1463,7 @@ GCMarker::processMarkStackTop(SliceBudget &budget)
PushMarkStack(this, shape);
/* Call the trace hook if necessary. */
Class *clasp = type->clasp;
const Class *clasp = type->clasp;
if (clasp->trace) {
JS_ASSERT_IF(runtime->gcMode == JSGC_MODE_INCREMENTAL &&
runtime->gcIncrementalEnabled,

View File

@ -361,7 +361,7 @@ js::Nursery::collectToFixedPoint(MinorCollectionTracer *trc)
JS_ALWAYS_INLINE void
js::Nursery::traceObject(MinorCollectionTracer *trc, JSObject *obj)
{
Class *clasp = obj->getClass();
const Class *clasp = obj->getClass();
if (clasp->trace)
clasp->trace(trc, obj);

View File

@ -13,7 +13,7 @@
using namespace JS;
/* The class of the global object. */
JSClass global_class = {
const JSClass global_class = {
"global", JSCLASS_GLOBAL_FLAGS,
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub

View File

@ -165,7 +165,7 @@ AsmJSModuleObject_trace(JSTracer *trc, JSObject *obj)
obj->as<AsmJSModuleObject>().module().trace(trc);
}
Class AsmJSModuleObject::class_ = {
const Class AsmJSModuleObject::class_ = {
"AsmJSModuleObject",
JSCLASS_IS_ANONYMOUS | JSCLASS_IMPLEMENTS_BARRIERS |
JSCLASS_HAS_RESERVED_SLOTS(AsmJSModuleObject::RESERVED_SLOTS),

View File

@ -732,7 +732,7 @@ class AsmJSModuleObject : public JSObject
module().sizeOfMisc(mallocSizeOf, asmJSModuleCode, asmJSModuleData);
}
static Class class_;
static const Class class_;
};
} // namespace js

View File

@ -4434,7 +4434,7 @@ ICGetElem_Arguments::Compiler::generateStubCode(MacroAssembler &masm)
which_ == ICGetElem_Arguments::Normal);
bool isStrict = which_ == ICGetElem_Arguments::Strict;
Class *clasp = isStrict ? &StrictArgumentsObject::class_ : &NormalArgumentsObject::class_;
const Class *clasp = isStrict ? &StrictArgumentsObject::class_ : &NormalArgumentsObject::class_;
GeneralRegisterSet regs(availableGeneralRegs(2));
Register scratchReg = regs.takeAny();
@ -6638,7 +6638,7 @@ ICGetProp_ArgumentsLength::Compiler::generateStubCode(MacroAssembler &masm)
which_ == ICGetProp_ArgumentsLength::Normal);
bool isStrict = which_ == ICGetProp_ArgumentsLength::Strict;
Class *clasp = isStrict ? &StrictArgumentsObject::class_ : &NormalArgumentsObject::class_;
const Class *clasp = isStrict ? &StrictArgumentsObject::class_ : &NormalArgumentsObject::class_;
Register scratchReg = R1.scratchReg();

View File

@ -7672,7 +7672,7 @@ IonBuilder::jsop_not()
}
inline bool
TestClassHasAccessorHook(Class *clasp, bool isGetter)
TestClassHasAccessorHook(const Class *clasp, bool isGetter)
{
if (isGetter && clasp->ops.getGeneric)
return true;

View File

@ -1621,8 +1621,8 @@ GetPropertyIC::tryAttachArgumentsLength(JSContext *cx, IonScript *ion, HandleObj
}
JS_ASSERT(object() != tmpReg);
Class *clasp = obj->is<StrictArgumentsObject>() ? &StrictArgumentsObject::class_
: &NormalArgumentsObject::class_;
const Class *clasp = obj->is<StrictArgumentsObject>() ? &StrictArgumentsObject::class_
: &NormalArgumentsObject::class_;
Label fail;
Label pass;
@ -3068,8 +3068,8 @@ GetElementIC::attachArgumentsElement(JSContext *cx, IonScript *ion, JSObject *ob
Register tmpReg = output().scratchReg().gpr();
JS_ASSERT(tmpReg != InvalidReg);
Class *clasp = obj->is<StrictArgumentsObject>() ? &StrictArgumentsObject::class_
: &NormalArgumentsObject::class_;
const Class *clasp = obj->is<StrictArgumentsObject>() ? &StrictArgumentsObject::class_
: &NormalArgumentsObject::class_;
Label fail;
Label pass;

View File

@ -181,7 +181,7 @@ class MacroAssembler : public MacroAssemblerSpecific
loadPtr(Address(objReg, JSObject::offsetOfType()), dest);
loadPtr(Address(dest, offsetof(types::TypeObject, clasp)), dest);
}
void branchTestObjClass(Condition cond, Register obj, Register scratch, js::Class *clasp,
void branchTestObjClass(Condition cond, Register obj, Register scratch, const js::Class *clasp,
Label *label) {
loadPtr(Address(obj, JSObject::offsetOfType()), scratch);
branchPtr(cond, Address(scratch, offsetof(types::TypeObject, clasp)), ImmWord(clasp), label);

View File

@ -1002,7 +1002,7 @@ IonBuilder::inlineRegExpTest(CallInfo &callInfo)
if (callInfo.thisArg()->type() != MIRType_Object)
return InliningStatus_NotInlined;
types::StackTypeSet *thisTypes = callInfo.thisArg()->resultTypeSet();
Class *clasp = thisTypes ? thisTypes->getKnownClass() : NULL;
const Class *clasp = thisTypes ? thisTypes->getKnownClass() : NULL;
if (clasp != &RegExpObject::class_)
return InliningStatus_NotInlined;
if (callInfo.getArg(0)->type() != MIRType_String)
@ -1478,8 +1478,8 @@ IonBuilder::inlineHaveSameClass(CallInfo &callInfo)
types::StackTypeSet *arg1Types = callInfo.getArg(0)->resultTypeSet();
types::StackTypeSet *arg2Types = callInfo.getArg(1)->resultTypeSet();
Class *arg1Clasp = arg1Types ? arg1Types->getKnownClass() : NULL;
Class *arg2Clasp = arg2Types ? arg2Types->getKnownClass() : NULL;
const Class *arg1Clasp = arg1Types ? arg1Types->getKnownClass() : NULL;
const Class *arg2Clasp = arg2Types ? arg2Types->getKnownClass() : NULL;
if (arg1Clasp && arg2Clasp) {
MConstant *constant = MConstant::New(BooleanValue(arg1Clasp == arg2Clasp));
current->add(constant);
@ -1516,7 +1516,7 @@ IonBuilder::inlineIsCallable(CallInfo &callInfo)
isCallableConstant = false;
} else {
types::StackTypeSet *types = callInfo.getArg(0)->resultTypeSet();
Class *clasp = types ? types->getKnownClass() : NULL;
const Class *clasp = types ? types->getKnownClass() : NULL;
if (clasp) {
isCallableKnown = true;
isCallableConstant = clasp->isCallable();

View File

@ -2640,7 +2640,7 @@ jit::ElementAccessIsDenseNative(MDefinition *obj, MDefinition *id)
if (!types)
return false;
Class *clasp = types->getKnownClass();
const Class *clasp = types->getKnownClass();
return clasp && clasp->isNative();
}

View File

@ -129,7 +129,7 @@ function, which populates the rt, cx, and global member variables.
A test can customize the test setup process by overloading virtual member
functions, like this:
JSClass globalClassWithResolve = { ... };
const JSClass globalClassWithResolve = { ... };
BEGIN_TEST(testGlobalResolveHook)
{

View File

@ -19,7 +19,7 @@ addProperty(JSContext *cx, JS::HandleObject obj, JS::HandleId id, JS::MutableHan
return true;
}
JSClass addPropertyClass = {
const JSClass addPropertyClass = {
"AddPropertyTester",
0,
addProperty,

View File

@ -6,7 +6,7 @@
using namespace JS;
static JSClass CustomClass = {
static const JSClass CustomClass = {
"CustomClass",
JSCLASS_HAS_RESERVED_SLOTS(1),
JS_PropertyStub,

View File

@ -10,7 +10,7 @@ JSPrincipals system_principals = {
1
};
JSClass global_class = {
const JSClass global_class = {
"global",
JSCLASS_IS_GLOBAL | JSCLASS_GLOBAL_FLAGS,
JS_PropertyStub,

View File

@ -21,7 +21,7 @@ static bool test_prop_get( JSContext *cx, JS::HandleObject obj, JS::HandleId id,
static bool
PTest(JSContext* cx, unsigned argc, jsval *vp);
static JSClass ptestClass = {
static const JSClass ptestClass = {
"PTest",
JSCLASS_HAS_PRIVATE,

View File

@ -27,7 +27,7 @@ IterHook(JSContext *cx, JS::HandleObject obj, bool keysonly)
return iterObj;
}
js::Class HasCustomIterClass = {
const js::Class HasCustomIterClass = {
"HasCustomIter",
0,
JS_PropertyStub,

View File

@ -37,7 +37,7 @@ BEGIN_TEST(testLookup_bug522590)
}
END_TEST(testLookup_bug522590)
static JSClass DocumentAllClass = {
static const JSClass DocumentAllClass = {
"DocumentAll",
JSCLASS_EMULATES_UNDEFINED,
JS_PropertyStub,
@ -76,7 +76,7 @@ document_resolve(JSContext *cx, JS::HandleObject obj, JS::HandleId id, unsigned
return true;
}
static JSClass document_class = {
static const JSClass document_class = {
"document", JSCLASS_NEW_RESOLVE,
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, (JSResolveOp) document_resolve, JS_ConvertStub

View File

@ -92,7 +92,7 @@ BEGIN_TEST(testNewObject_1)
CHECK_SAME(v, INT_TO_JSVAL(N - 1));
// With JSClass.construct.
static JSClass cls = {
static const JSClass cls = {
"testNewObject_1",
0,
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,

View File

@ -4,7 +4,7 @@
#include "jsapi-tests/tests.h"
static JSClass ObjectEmulatingUndefinedClass = {
static const JSClass ObjectEmulatingUndefinedClass = {
"ObjectEmulatingUndefined",
JSCLASS_EMULATES_UNDEFINED,
JS_PropertyStub,

View File

@ -19,7 +19,7 @@ my_convert(JSContext* context, JS::HandleObject obj, JSType type, JS::MutableHan
return false;
}
static JSClass myClass = {
static const JSClass myClass = {
"MyClass",
0,
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,

View File

@ -25,7 +25,7 @@ reset(JSContext *cx)
js::EnableRuntimeProfilingStack(cx->runtime(), true);
}
static JSClass ptestClass = {
static const JSClass ptestClass = {
"Prof", 0, JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub,
JS_StrictPropertyStub, JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub
};

View File

@ -16,7 +16,7 @@ CounterAdd(JSContext *cx, JS::HandleObject obj, JS::HandleId id, JS::MutableHand
return true;
}
static JSClass CounterClass = {
static const JSClass CounterClass = {
"Counter", /* name */
0, /* flags */
CounterAdd, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,

View File

@ -14,7 +14,7 @@
BEGIN_TEST(testResolveRecursion)
{
static JSClass my_resolve_class = {
static const JSClass my_resolve_class = {
"MyResolve",
JSCLASS_NEW_RESOLVE | JSCLASS_HAS_PRIVATE,

View File

@ -225,8 +225,8 @@ class JSAPITest
JSAPITestString messages() const { return msgs; }
static JSClass * basicGlobalClass() {
static JSClass c = {
static const JSClass * basicGlobalClass() {
static const JSClass c = {
"global", JSCLASS_GLOBAL_FLAGS,
JS_PropertyStub, JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub
@ -306,7 +306,7 @@ class JSAPITest
return cx;
}
virtual JSClass * getGlobalClass() {
virtual const JSClass * getGlobalClass() {
return basicGlobalClass();
}

View File

@ -1328,7 +1328,7 @@ JS_InitStandardClasses(JSContext *cx, JSObject *objArg)
typedef struct JSStdName {
ClassInitializerOp init;
size_t atomOffset; /* offset of atom pointer in JSAtomState */
Class *clasp;
const Class *clasp;
} JSStdName;
static Handle<PropertyName*>
@ -2492,7 +2492,7 @@ JS_ConvertStub(JSContext *cx, HandleObject obj, JSType type, MutableHandleValue
JS_PUBLIC_API(JSObject *)
JS_InitClass(JSContext *cx, JSObject *objArg, JSObject *parent_protoArg,
JSClass *clasp, JSNative constructor, unsigned nargs,
const JSClass *clasp, JSNative constructor, unsigned nargs,
const JSPropertySpec *ps, const JSFunctionSpec *fs,
const JSPropertySpec *static_ps, const JSFunctionSpec *static_fs)
{
@ -2513,14 +2513,14 @@ JS_LinkConstructorAndPrototype(JSContext *cx, JSObject *ctorArg, JSObject *proto
return LinkConstructorAndPrototype(cx, ctor, proto);
}
JS_PUBLIC_API(JSClass *)
JS_PUBLIC_API(const JSClass *)
JS_GetClass(JSObject *obj)
{
return obj->getJSClass();
}
JS_PUBLIC_API(bool)
JS_InstanceOf(JSContext *cx, JSObject *objArg, JSClass *clasp, jsval *argv)
JS_InstanceOf(JSContext *cx, JSObject *objArg, const JSClass *clasp, jsval *argv)
{
RootedObject obj(cx, objArg);
AssertHeapIsIdle(cx);
@ -2565,7 +2565,7 @@ JS_SetPrivate(JSObject *obj, void *data)
}
JS_PUBLIC_API(void *)
JS_GetInstancePrivate(JSContext *cx, JSObject *objArg, JSClass *clasp, jsval *argv)
JS_GetInstancePrivate(JSContext *cx, JSObject *objArg, const JSClass *clasp, jsval *argv)
{
RootedObject obj(cx, objArg);
if (!JS_InstanceOf(cx, obj, clasp, argv))
@ -2667,7 +2667,7 @@ class AutoHoldZone
} /* anonymous namespace */
JS_PUBLIC_API(JSObject *)
JS_NewGlobalObject(JSContext *cx, JSClass *clasp, JSPrincipals *principals,
JS_NewGlobalObject(JSContext *cx, const JSClass *clasp, JSPrincipals *principals,
JS::OnNewGlobalHookOption hookOption,
const JS::CompartmentOptions &options)
{
@ -2724,7 +2724,7 @@ JS_FireOnNewGlobalObject(JSContext *cx, JS::HandleObject global)
}
JS_PUBLIC_API(JSObject *)
JS_NewObject(JSContext *cx, JSClass *jsclasp, JSObject *protoArg, JSObject *parentArg)
JS_NewObject(JSContext *cx, const JSClass *jsclasp, JSObject *protoArg, JSObject *parentArg)
{
RootedObject proto(cx, protoArg);
RootedObject parent(cx, parentArg);
@ -2733,7 +2733,7 @@ JS_NewObject(JSContext *cx, JSClass *jsclasp, JSObject *protoArg, JSObject *pare
CHECK_REQUEST(cx);
assertSameCompartment(cx, proto, parent);
Class *clasp = Valueify(jsclasp);
const Class *clasp = Valueify(jsclasp);
if (!clasp)
clasp = &JSObject::class_; /* default class is Object */
@ -2754,7 +2754,7 @@ JS_NewObject(JSContext *cx, JSClass *jsclasp, JSObject *protoArg, JSObject *pare
}
JS_PUBLIC_API(JSObject *)
JS_NewObjectWithGivenProto(JSContext *cx, JSClass *jsclasp, JSObject *protoArg, JSObject *parentArg)
JS_NewObjectWithGivenProto(JSContext *cx, const JSClass *jsclasp, JSObject *protoArg, JSObject *parentArg)
{
RootedObject proto(cx, protoArg);
RootedObject parent(cx, parentArg);
@ -2763,7 +2763,7 @@ JS_NewObjectWithGivenProto(JSContext *cx, JSClass *jsclasp, JSObject *protoArg,
CHECK_REQUEST(cx);
assertSameCompartment(cx, proto, parent);
Class *clasp = Valueify(jsclasp);
const Class *clasp = Valueify(jsclasp);
if (!clasp)
clasp = &JSObject::class_; /* default class is Object */
@ -2777,7 +2777,7 @@ JS_NewObjectWithGivenProto(JSContext *cx, JSClass *jsclasp, JSObject *protoArg,
}
JS_PUBLIC_API(JSObject *)
JS_NewObjectForConstructor(JSContext *cx, JSClass *clasp, const jsval *vp)
JS_NewObjectForConstructor(JSContext *cx, const JSClass *clasp, const jsval *vp)
{
AssertHeapIsIdle(cx);
CHECK_REQUEST(cx);
@ -3290,7 +3290,7 @@ JS_DefineOwnProperty(JSContext *cx, JSObject *objArg, jsid idArg, jsval descript
}
JS_PUBLIC_API(JSObject *)
JS_DefineObject(JSContext *cx, JSObject *objArg, const char *name, JSClass *jsclasp,
JS_DefineObject(JSContext *cx, JSObject *objArg, const char *name, const JSClass *jsclasp,
JSObject *protoArg, unsigned attrs)
{
RootedObject obj(cx, objArg);
@ -3299,7 +3299,7 @@ JS_DefineObject(JSContext *cx, JSObject *objArg, const char *name, JSClass *jscl
CHECK_REQUEST(cx);
assertSameCompartment(cx, obj, proto);
Class *clasp = Valueify(jsclasp);
const Class *clasp = Valueify(jsclasp);
if (!clasp)
clasp = &JSObject::class_; /* default class is Object */
@ -3716,7 +3716,7 @@ JS_SetAllNonReservedSlotsToUndefined(JSContext *cx, JSObject *objArg)
if (!obj->isNative())
return;
Class *clasp = obj->getClass();
const Class *clasp = obj->getClass();
unsigned numReserved = JSCLASS_RESERVED_SLOTS(clasp);
unsigned numSlots = obj->slotSpan();
for (unsigned i = numReserved; i < numSlots; i++)
@ -3784,7 +3784,7 @@ prop_iter_trace(JSTracer *trc, JSObject *obj)
}
}
static Class prop_iter_class = {
static const Class prop_iter_class = {
"PropertyIterator",
JSCLASS_HAS_PRIVATE | JSCLASS_IMPLEMENTS_BARRIERS | JSCLASS_HAS_RESERVED_SLOTS(1),
JS_PropertyStub, /* addProperty */

View File

@ -2418,7 +2418,7 @@ struct JSFunctionSpec {
extern JS_PUBLIC_API(JSObject *)
JS_InitClass(JSContext *cx, JSObject *obj, JSObject *parent_proto,
JSClass *clasp, JSNative constructor, unsigned nargs,
const JSClass *clasp, JSNative constructor, unsigned nargs,
const JSPropertySpec *ps, const JSFunctionSpec *fs,
const JSPropertySpec *static_ps, const JSFunctionSpec *static_fs);
@ -2429,11 +2429,11 @@ JS_InitClass(JSContext *cx, JSObject *obj, JSObject *parent_proto,
extern JS_PUBLIC_API(bool)
JS_LinkConstructorAndPrototype(JSContext *cx, JSObject *ctor, JSObject *proto);
extern JS_PUBLIC_API(JSClass *)
extern JS_PUBLIC_API(const JSClass *)
JS_GetClass(JSObject *obj);
extern JS_PUBLIC_API(bool)
JS_InstanceOf(JSContext *cx, JSObject *obj, JSClass *clasp, jsval *argv);
JS_InstanceOf(JSContext *cx, JSObject *obj, const JSClass *clasp, jsval *argv);
extern JS_PUBLIC_API(bool)
JS_HasInstance(JSContext *cx, JSObject *obj, jsval v, bool *bp);
@ -2445,7 +2445,7 @@ extern JS_PUBLIC_API(void)
JS_SetPrivate(JSObject *obj, void *data);
extern JS_PUBLIC_API(void *)
JS_GetInstancePrivate(JSContext *cx, JSObject *obj, JSClass *clasp,
JS_GetInstancePrivate(JSContext *cx, JSObject *obj, const JSClass *clasp,
jsval *argv);
extern JS_PUBLIC_API(bool)
@ -2543,7 +2543,7 @@ enum OnNewGlobalHookOption {
} /* namespace JS */
extern JS_PUBLIC_API(JSObject *)
JS_NewGlobalObject(JSContext *cx, JSClass *clasp, JSPrincipals *principals,
JS_NewGlobalObject(JSContext *cx, const JSClass *clasp, JSPrincipals *principals,
JS::OnNewGlobalHookOption hookOption,
const JS::CompartmentOptions &options = JS::CompartmentOptions());
@ -2551,7 +2551,7 @@ extern JS_PUBLIC_API(void)
JS_FireOnNewGlobalObject(JSContext *cx, JS::HandleObject global);
extern JS_PUBLIC_API(JSObject *)
JS_NewObject(JSContext *cx, JSClass *clasp, JSObject *proto, JSObject *parent);
JS_NewObject(JSContext *cx, const JSClass *clasp, JSObject *proto, JSObject *parent);
/* Queries the [[Extensible]] property of the object. */
extern JS_PUBLIC_API(bool)
@ -2568,7 +2568,7 @@ JS_GetObjectRuntime(JSObject *obj);
* proto if proto's actual parameter value is null.
*/
extern JS_PUBLIC_API(JSObject *)
JS_NewObjectWithGivenProto(JSContext *cx, JSClass *clasp, JSObject *proto,
JS_NewObjectWithGivenProto(JSContext *cx, const JSClass *clasp, JSObject *proto,
JSObject *parent);
/*
@ -2592,7 +2592,7 @@ extern JS_PUBLIC_API(JSObject *)
JS_New(JSContext *cx, JSObject *ctor, unsigned argc, jsval *argv);
extern JS_PUBLIC_API(JSObject *)
JS_DefineObject(JSContext *cx, JSObject *obj, const char *name, JSClass *clasp,
JS_DefineObject(JSContext *cx, JSObject *obj, const char *name, const JSClass *clasp,
JSObject *proto, unsigned attrs);
extern JS_PUBLIC_API(bool)
@ -4245,7 +4245,7 @@ JS_IsConstructing(JSContext *cx, const jsval *vp)
* [[Prototype]].
*/
extern JS_PUBLIC_API(JSObject *)
JS_NewObjectForConstructor(JSContext *cx, JSClass *clasp, const jsval *vp);
JS_NewObjectForConstructor(JSContext *cx, const JSClass *clasp, const jsval *vp);
/************************************************************************/

View File

@ -767,7 +767,7 @@ js::ObjectMayHaveExtraIndexedProperties(JSObject *obj)
return false;
}
Class ArrayObject::class_ = {
const Class ArrayObject::class_ = {
"Array",
JSCLASS_HAS_CACHED_PROTO(JSProto_Array),
array_addProperty,

View File

@ -25,7 +25,7 @@
using namespace js;
using namespace js::types;
Class BooleanObject::class_ = {
const Class BooleanObject::class_ = {
"Boolean",
JSCLASS_HAS_RESERVED_SLOTS(1) | JSCLASS_HAS_CACHED_PROTO(JSProto_Boolean),
JS_PropertyStub, /* addProperty */

View File

@ -355,8 +355,8 @@ class ExclusiveContext : public ThreadSafeContext
// Zone local methods that can be used freely from an ExclusiveContext.
inline bool typeInferenceEnabled() const;
types::TypeObject *getNewType(Class *clasp, TaggedProto proto, JSFunction *fun = NULL);
types::TypeObject *getLazyType(Class *clasp, TaggedProto proto);
types::TypeObject *getNewType(const Class *clasp, TaggedProto proto, JSFunction *fun = NULL);
types::TypeObject *getLazyType(const Class *clasp, TaggedProto proto);
inline js::LifoAlloc &typeLifoAlloc();
// Current global. This is only safe to use within the scope of the

View File

@ -524,7 +524,7 @@ date_convert(JSContext *cx, HandleObject obj, JSType hint, MutableHandleValue vp
* Other Support routines and definitions
*/
Class DateObject::class_ = {
const Class DateObject::class_ = {
js_Date_str,
JSCLASS_HAS_RESERVED_SLOTS(RESERVED_SLOTS) |
JSCLASS_HAS_CACHED_PROTO(JSProto_Date),

View File

@ -54,7 +54,7 @@ static bool
exn_resolve(JSContext *cx, HandleObject obj, HandleId id, unsigned flags,
MutableHandleObject objp);
Class ErrorObject::class_ = {
const Class ErrorObject::class_ = {
js_Error_str,
JSCLASS_HAS_PRIVATE | JSCLASS_IMPLEMENTS_BARRIERS | JSCLASS_NEW_RESOLVE |
JSCLASS_HAS_CACHED_PROTO(JSProto_Error),

View File

@ -119,7 +119,7 @@ JS_SplicePrototype(JSContext *cx, JSObject *objArg, JSObject *protoArg)
}
JS_FRIEND_API(JSObject *)
JS_NewObjectWithUniqueType(JSContext *cx, JSClass *clasp, JSObject *protoArg, JSObject *parentArg)
JS_NewObjectWithUniqueType(JSContext *cx, const JSClass *clasp, JSObject *protoArg, JSObject *parentArg)
{
RootedObject proto(cx, protoArg);
RootedObject parent(cx, parentArg);
@ -129,7 +129,7 @@ JS_NewObjectWithUniqueType(JSContext *cx, JSClass *clasp, JSObject *protoArg, JS
* TypeObject attached to our proto with information about our object, since
* we're not going to be using that TypeObject anyway.
*/
RootedObject obj(cx, NewObjectWithGivenProto(cx, (js::Class *)clasp, NULL, parent, SingletonObject));
RootedObject obj(cx, NewObjectWithGivenProto(cx, (const js::Class *)clasp, NULL, parent, SingletonObject));
if (!obj)
return NULL;
if (!JS_SplicePrototype(cx, obj, proto))
@ -494,7 +494,7 @@ js::NewFunctionByIdWithReserved(JSContext *cx, JSNative native, unsigned nargs,
JS_FRIEND_API(JSObject *)
js::InitClassWithReserved(JSContext *cx, JSObject *objArg, JSObject *parent_protoArg,
JSClass *clasp, JSNative constructor, unsigned nargs,
const JSClass *clasp, JSNative constructor, unsigned nargs,
const JSPropertySpec *ps, const JSFunctionSpec *fs,
const JSPropertySpec *static_ps, const JSFunctionSpec *static_fs)
{
@ -524,7 +524,7 @@ js::SetFunctionNativeReserved(JSObject *fun, size_t which, const Value &val)
JS_FRIEND_API(bool)
js::GetObjectProto(JSContext *cx, JS::Handle<JSObject*> obj, JS::MutableHandle<JSObject*> proto)
{
js::Class *clasp = GetObjectClass(obj);
const js::Class *clasp = GetObjectClass(obj);
if (clasp == js::ObjectProxyClassPtr ||
clasp == js::OuterWindowProxyClassPtr ||
clasp == js::FunctionProxyClassPtr)

View File

@ -58,7 +58,7 @@ extern JS_FRIEND_API(bool)
JS_SplicePrototype(JSContext *cx, JSObject *obj, JSObject *proto);
extern JS_FRIEND_API(JSObject *)
JS_NewObjectWithUniqueType(JSContext *cx, JSClass *clasp, JSObject *proto, JSObject *parent);
JS_NewObjectWithUniqueType(JSContext *cx, const JSClass *clasp, JSObject *proto, JSObject *parent);
extern JS_FRIEND_API(uint32_t)
JS_ObjectCountDynamicSlots(JS::HandleObject obj);
@ -337,12 +337,12 @@ GetAnyCompartmentInZone(JS::Zone *zone);
namespace shadow {
struct TypeObject {
Class *clasp;
const Class *clasp;
JSObject *proto;
};
struct BaseShape {
js::Class *clasp;
const js::Class *clasp;
JSObject *parent;
JSObject *_1;
JSCompartment *compartment;
@ -396,15 +396,15 @@ struct Atom {
// This is equal to |&JSObject::class_|. Use it in places where you don't want
// to #include jsobj.h.
extern JS_FRIEND_DATA(js::Class* const) ObjectClassPtr;
extern JS_FRIEND_DATA(const js::Class* const) ObjectClassPtr;
inline js::Class *
inline const js::Class *
GetObjectClass(JSObject *obj)
{
return reinterpret_cast<const shadow::Object*>(obj)->type->clasp;
}
inline JSClass *
inline const JSClass *
GetObjectJSClass(JSObject *obj)
{
return js::Jsvalify(GetObjectClass(obj));
@ -487,7 +487,7 @@ NewFunctionByIdWithReserved(JSContext *cx, JSNative native, unsigned nargs, unsi
JS_FRIEND_API(JSObject *)
InitClassWithReserved(JSContext *cx, JSObject *obj, JSObject *parent_proto,
JSClass *clasp, JSNative constructor, unsigned nargs,
const JSClass *clasp, JSNative constructor, unsigned nargs,
const JSPropertySpec *ps, const JSFunctionSpec *fs,
const JSPropertySpec *static_ps, const JSFunctionSpec *static_fs);

View File

@ -214,7 +214,7 @@ ResolveInterpretedFunctionPrototype(JSContext *cx, HandleObject obj)
objProto = obj->global().getOrCreateObjectPrototype(cx);
if (!objProto)
return NULL;
Class *clasp = &JSObject::class_;
const Class *clasp = &JSObject::class_;
RootedObject proto(cx, NewObjectWithGivenProto(cx, clasp, objProto, NULL, SingletonObject));
if (!proto)
@ -523,7 +523,7 @@ fun_trace(JSTracer *trc, JSObject *obj)
obj->as<JSFunction>().trace(trc);
}
Class JSFunction::class_ = {
const Class JSFunction::class_ = {
js_Function_str,
JSCLASS_NEW_RESOLVE | JSCLASS_IMPLEMENTS_BARRIERS |
JSCLASS_HAS_CACHED_PROTO(JSProto_Function),
@ -542,7 +542,7 @@ Class JSFunction::class_ = {
fun_trace
};
Class* const js::FunctionClassPtr = &JSFunction::class_;
const Class* const js::FunctionClassPtr = &JSFunction::class_;
/* Find the body of a function (not including braces). */
static bool
@ -1799,7 +1799,7 @@ js::IsConstructor(const Value &v)
}
void
js::ReportIncompatibleMethod(JSContext *cx, CallReceiver call, Class *clasp)
js::ReportIncompatibleMethod(JSContext *cx, CallReceiver call, const Class *clasp)
{
RootedValue thisv(cx, call.thisv());

View File

@ -25,7 +25,7 @@ typedef JSThreadSafeNative ThreadSafeNative;
class JSFunction : public JSObject
{
public:
static js::Class class_;
static const js::Class class_;
enum Flags {
INTERPRETED = 0x0001, /* function has a JSScript and environment. */
@ -559,7 +559,7 @@ CloneFunctionAndScript(JSContext *cx, HandleObject enclosingScope, HandleFunctio
* is what was called.
*/
extern void
ReportIncompatibleMethod(JSContext *cx, CallReceiver call, Class *clasp);
ReportIncompatibleMethod(JSContext *cx, CallReceiver call, const Class *clasp);
/*
* Report an error that call.thisv is not an acceptable this for the callee

View File

@ -212,7 +212,7 @@ IsBackgroundFinalized(AllocKind kind)
}
static inline bool
CanBeFinalizedInBackground(gc::AllocKind kind, Class *clasp)
CanBeFinalizedInBackground(gc::AllocKind kind, const Class *clasp)
{
JS_ASSERT(kind <= gc::FINALIZE_OBJECT_LAST);
/* If the class has no finalizer or a finalizer that is safe to call on
@ -318,7 +318,7 @@ GetGCKindSlots(AllocKind thingKind)
}
static inline size_t
GetGCKindSlots(AllocKind thingKind, Class *clasp)
GetGCKindSlots(AllocKind thingKind, const Class *clasp)
{
size_t nslots = GetGCKindSlots(thingKind);

View File

@ -52,7 +52,7 @@ ThreadSafeContext::allocator()
namespace gc {
static inline AllocKind
GetGCObjectKind(Class *clasp)
GetGCObjectKind(const Class *clasp)
{
if (clasp == FunctionClassPtr)
return JSFunction::FinalizeKind;

View File

@ -1045,17 +1045,17 @@ HeapTypeSet::knownSubset(JSContext *cx, TypeSet *other)
return true;
}
Class *
const Class *
StackTypeSet::getKnownClass()
{
if (unknownObject())
return NULL;
Class *clasp = NULL;
const Class *clasp = NULL;
unsigned count = getObjectCount();
for (unsigned i = 0; i < count; i++) {
Class *nclasp;
const Class *nclasp;
if (JSObject *object = getSingleObject(i))
nclasp = object->getClass();
else if (TypeObject *object = getTypeObject(i))
@ -1074,7 +1074,7 @@ StackTypeSet::getKnownClass()
int
StackTypeSet::getTypedArrayType()
{
Class *clasp = getKnownClass();
const Class *clasp = getKnownClass();
if (clasp && IsTypedArrayClass(clasp))
return clasp - &TypedArrayObject::classes[0];
@ -1089,7 +1089,7 @@ StackTypeSet::isDOMClass()
unsigned count = getObjectCount();
for (unsigned i = 0; i < count; i++) {
Class *clasp;
const Class *clasp;
if (JSObject *object = getSingleObject(i))
clasp = object->getClass();
else if (TypeObject *object = getTypeObject(i))
@ -1115,7 +1115,7 @@ StackTypeSet::maybeCallable()
unsigned count = getObjectCount();
for (unsigned i = 0; i < count; i++) {
Class *clasp;
const Class *clasp;
if (JSObject *object = getSingleObject(i))
clasp = object->getClass();
else if (TypeObject *object = getTypeObject(i))
@ -1285,7 +1285,7 @@ TypeZone::init(JSContext *cx)
}
TypeObject *
TypeCompartment::newTypeObject(ExclusiveContext *cx, Class *clasp, Handle<TaggedProto> proto, bool unknown)
TypeCompartment::newTypeObject(ExclusiveContext *cx, const Class *clasp, Handle<TaggedProto> proto, bool unknown)
{
JS_ASSERT_IF(proto.isObject(), cx->isInsideCurrentCompartment(proto.toObject()));
@ -1530,13 +1530,13 @@ types::UseNewTypeForInitializer(JSContext *cx, JSScript *script, jsbytecode *pc,
}
NewObjectKind
types::UseNewTypeForInitializer(JSContext *cx, JSScript *script, jsbytecode *pc, Class *clasp)
types::UseNewTypeForInitializer(JSContext *cx, JSScript *script, jsbytecode *pc, const Class *clasp)
{
return UseNewTypeForInitializer(cx, script, pc, JSCLASS_CACHED_PROTO_KEY(clasp));
}
static inline bool
ClassCanHaveExtraProperties(Class *clasp)
ClassCanHaveExtraProperties(const Class *clasp)
{
JS_ASSERT(clasp->resolve);
return clasp->resolve != JS_ResolveStub || clasp->ops.lookupGeneric || clasp->ops.getGeneric;
@ -1578,7 +1578,7 @@ types::ArrayPrototypeHasIndexedProperty(JSContext *cx, HandleScript script)
bool
types::TypeCanHaveExtraIndexedProperties(JSContext *cx, StackTypeSet *types)
{
Class *clasp = types->getKnownClass();
const Class *clasp = types->getKnownClass();
// Note: typed arrays have indexed properties not accounted for by type
// information, though these are all in bounds and will be accounted for
@ -3482,7 +3482,7 @@ JSObject::shouldSplicePrototype(JSContext *cx)
}
bool
JSObject::splicePrototype(JSContext *cx, Class *clasp, Handle<TaggedProto> proto)
JSObject::splicePrototype(JSContext *cx, const Class *clasp, Handle<TaggedProto> proto)
{
JS_ASSERT(cx->compartment() == compartment());
@ -3611,7 +3611,7 @@ JSObject::makeLazyType(JSContext *cx, HandleObject obj)
TypeObjectEntry::hash(const Lookup &lookup)
{
return PointerHasher<JSObject *, 3>::hash(lookup.proto.raw()) ^
PointerHasher<Class *, 3>::hash(lookup.clasp);
PointerHasher<const Class *, 3>::hash(lookup.clasp);
}
/* static */ inline bool
@ -3622,7 +3622,7 @@ TypeObjectEntry::match(TypeObject *key, const Lookup &lookup)
#ifdef DEBUG
bool
JSObject::hasNewType(Class *clasp, TypeObject *type)
JSObject::hasNewType(const Class *clasp, TypeObject *type)
{
TypeObjectSet &table = compartment()->newTypeObjects;
@ -3635,7 +3635,7 @@ JSObject::hasNewType(Class *clasp, TypeObject *type)
#endif /* DEBUG */
/* static */ bool
JSObject::setNewTypeUnknown(JSContext *cx, Class *clasp, HandleObject obj)
JSObject::setNewTypeUnknown(JSContext *cx, const Class *clasp, HandleObject obj)
{
if (!obj->setFlag(cx, js::BaseShape::NEW_TYPE_UNKNOWN))
return false;
@ -3655,7 +3655,7 @@ JSObject::setNewTypeUnknown(JSContext *cx, Class *clasp, HandleObject obj)
}
TypeObject *
ExclusiveContext::getNewType(Class *clasp, TaggedProto proto_, JSFunction *fun_)
ExclusiveContext::getNewType(const Class *clasp, TaggedProto proto_, JSFunction *fun_)
{
JS_ASSERT_IF(fun_, proto_.isObject());
JS_ASSERT_IF(proto_.isObject(), isInsideCurrentCompartment(proto_.toObject()));
@ -3758,7 +3758,7 @@ ExclusiveContext::getNewType(Class *clasp, TaggedProto proto_, JSFunction *fun_)
}
TypeObject *
ExclusiveContext::getLazyType(Class *clasp, TaggedProto proto)
ExclusiveContext::getLazyType(const Class *clasp, TaggedProto proto)
{
JS_ASSERT_IF(proto.isObject(), compartment() == proto.toObject()->compartment());

View File

@ -614,7 +614,7 @@ class StackTypeSet : public TypeSet
bool hasObjectFlags(JSContext *cx, TypeObjectFlags flags);
/* Get the class shared by all objects in this set, or NULL. */
Class *getKnownClass();
const Class *getKnownClass();
/* Get the prototype shared by all objects in this set, or NULL. */
JSObject *getCommonPrototype();
@ -981,7 +981,7 @@ struct TypeTypedObject : public TypeObjectAddendum
struct TypeObject : gc::Cell
{
/* Class shared by objects using this type. */
Class *clasp;
const Class *clasp;
/* Prototype shared by objects using this type. */
HeapPtrObject proto;
@ -1081,7 +1081,7 @@ struct TypeObject : gc::Cell
uint32_t padding;
#endif
inline TypeObject(Class *clasp, TaggedProto proto, bool isFunction, bool unknown);
inline TypeObject(const Class *clasp, TaggedProto proto, bool isFunction, bool unknown);
bool isFunction() { return !!(flags & OBJECT_FLAG_FUNCTION); }
@ -1204,10 +1204,10 @@ struct TypeObject : gc::Cell
struct TypeObjectEntry : DefaultHasher<ReadBarriered<TypeObject> >
{
struct Lookup {
Class *clasp;
const Class *clasp;
TaggedProto proto;
Lookup(Class *clasp, TaggedProto proto) : clasp(clasp), proto(proto) {}
Lookup(const Class *clasp, TaggedProto proto) : clasp(clasp), proto(proto) {}
};
static inline HashNumber hash(const Lookup &lookup);
@ -1497,7 +1497,7 @@ struct TypeCompartment
* or JSProto_Object to indicate a type whose class is unknown (not just
* js_ObjectClass).
*/
TypeObject *newTypeObject(ExclusiveContext *cx, Class *clasp, Handle<TaggedProto> proto,
TypeObject *newTypeObject(ExclusiveContext *cx, const Class *clasp, Handle<TaggedProto> proto,
bool unknown = false);
/* Get or make an object for an allocation site, and add to the allocation site table. */

View File

@ -429,7 +429,7 @@ struct AutoEnterCompilation
* a type function on JSScript to perform inference operations.
*/
inline Class *
inline const Class *
GetClassForProtoKey(JSProtoKey key)
{
switch (key) {
@ -788,7 +788,7 @@ js::NewObjectKind
UseNewTypeForInitializer(JSContext *cx, JSScript *script, jsbytecode *pc, JSProtoKey key);
js::NewObjectKind
UseNewTypeForInitializer(JSContext *cx, JSScript *script, jsbytecode *pc, Class *clasp);
UseNewTypeForInitializer(JSContext *cx, JSScript *script, jsbytecode *pc, const Class *clasp);
/* static */ inline TypeObject *
TypeScript::InitObject(JSContext *cx, JSScript *script, jsbytecode *pc, JSProtoKey kind)
@ -1449,7 +1449,7 @@ TypeCallsite::TypeCallsite(JSContext *cx, JSScript *script, jsbytecode *pc,
// TypeObject
/////////////////////////////////////////////////////////////////////
inline TypeObject::TypeObject(Class *clasp, TaggedProto proto, bool function, bool unknown)
inline TypeObject::TypeObject(const Class *clasp, TaggedProto proto, bool function, bool unknown)
{
mozilla::PodZero(this);

View File

@ -196,7 +196,7 @@ Snapshot(JSContext *cx, JSObject *pobj_, unsigned flags, AutoIdVector *props)
RootedObject pobj(cx, pobj_);
do {
Class *clasp = pobj->getClass();
const Class *clasp = pobj->getClass();
if (pobj->isNative() &&
!pobj->getOps()->enumerate &&
!(clasp->flags & JSCLASS_NEW_ENUMERATE)) {
@ -382,7 +382,7 @@ NewPropertyIteratorObject(JSContext *cx, unsigned flags)
if (!NewObjectMetadata(cx, &metadata))
return NULL;
Class *clasp = &PropertyIteratorObject::class_;
const Class *clasp = &PropertyIteratorObject::class_;
RootedShape shape(cx, EmptyShape::getInitialShape(cx, clasp, NULL, NULL, metadata,
ITERATOR_FINALIZE_KIND));
if (!shape)
@ -832,7 +832,7 @@ PropertyIteratorObject::finalize(FreeOp *fop, JSObject *obj)
fop->free_(ni);
}
Class PropertyIteratorObject::class_ = {
const Class PropertyIteratorObject::class_ = {
"Iterator",
JSCLASS_IMPLEMENTS_BARRIERS |
JSCLASS_HAS_CACHED_PROTO(JSProto_Iterator) |
@ -937,7 +937,7 @@ ElementIteratorObject::next_impl(JSContext *cx, CallArgs args)
return false;
}
Class ElementIteratorObject::class_ = {
const Class ElementIteratorObject::class_ = {
"Array Iterator",
JSCLASS_IMPLEMENTS_BARRIERS |
JSCLASS_HAS_RESERVED_SLOTS(ElementIteratorObject::NumSlots),
@ -1300,7 +1300,7 @@ stopiter_hasInstance(JSContext *cx, HandleObject obj, MutableHandleValue v, bool
return true;
}
Class StopIterationObject::class_ = {
const Class StopIterationObject::class_ = {
"StopIteration",
JSCLASS_HAS_CACHED_PROTO(JSProto_StopIteration) |
JSCLASS_FREEZE_PROTO,
@ -1453,7 +1453,7 @@ GeneratorState::pushInterpreterFrame(JSContext *cx, FrameGuard *)
return gen_->fp;
}
Class LegacyGeneratorObject::class_ = {
const Class LegacyGeneratorObject::class_ = {
"Generator",
JSCLASS_HAS_PRIVATE | JSCLASS_IMPLEMENTS_BARRIERS,
JS_PropertyStub, /* addProperty */
@ -1476,7 +1476,7 @@ Class LegacyGeneratorObject::class_ = {
}
};
Class StarGeneratorObject::class_ = {
const Class StarGeneratorObject::class_ = {
"Generator",
JSCLASS_HAS_PRIVATE | JSCLASS_IMPLEMENTS_BARRIERS,
JS_PropertyStub, /* addProperty */
@ -1874,7 +1874,7 @@ GlobalObject::initIteratorClasses(JSContext *cx, Handle<GlobalObject *> global)
RootedObject proto(cx);
if (global->getSlot(ELEMENT_ITERATOR_PROTO).isUndefined()) {
Class *cls = &ElementIteratorObject::class_;
const Class *cls = &ElementIteratorObject::class_;
proto = global->createBlankPrototypeInheriting(cx, cls, *iteratorProto);
if (!proto || !DefinePropertiesAndBrand(cx, proto, NULL, ElementIteratorObject::methods))
return false;

View File

@ -117,7 +117,7 @@ struct NativeIterator
class PropertyIteratorObject : public JSObject
{
public:
static Class class_;
static const Class class_;
NativeIterator *getNativeIterator() const {
return static_cast<js::NativeIterator *>(getPrivate());
@ -147,7 +147,7 @@ class PropertyIteratorObject : public JSObject
class ElementIteratorObject : public JSObject
{
public:
static Class class_;
static const Class class_;
static JSObject *create(JSContext *cx, Handle<Value> target);
static const JSFunctionSpec methods[];

View File

@ -101,7 +101,7 @@ MathCache::sizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf)
return mallocSizeOf(this);
}
Class js::MathClass = {
const Class js::MathClass = {
js_Math_str,
JSCLASS_HAS_CACHED_PROTO(JSProto_Math),
JS_PropertyStub, /* addProperty */

View File

@ -446,7 +446,7 @@ static const JSFunctionSpec number_functions[] = {
JS_FS_END
};
Class NumberObject::class_ = {
const Class NumberObject::class_ = {
js_Number_str,
JSCLASS_HAS_RESERVED_SLOTS(1) | JSCLASS_HAS_CACHED_PROTO(JSProto_Number),
JS_PropertyStub, /* addProperty */

View File

@ -70,7 +70,7 @@ using mozilla::RoundUpPow2;
JS_STATIC_ASSERT(int32_t((JSObject::NELEMENTS_LIMIT - 1) * sizeof(Value)) == int64_t((JSObject::NELEMENTS_LIMIT - 1) * sizeof(Value)));
Class JSObject::class_ = {
const Class JSObject::class_ = {
js_Object_str,
JSCLASS_HAS_CACHED_PROTO(JSProto_Object),
JS_PropertyStub, /* addProperty */
@ -82,7 +82,7 @@ Class JSObject::class_ = {
JS_ConvertStub
};
Class* const js::ObjectClassPtr = &JSObject::class_;
const Class* const js::ObjectClassPtr = &JSObject::class_;
JS_FRIEND_API(JSObject *)
JS_ObjectToInnerObject(JSContext *cx, JSObject *objArg)
@ -1246,7 +1246,7 @@ JSObject::className(JSContext *cx, HandleObject obj)
* FIXME bug 547327: estimate the size from the allocation site.
*/
static inline gc::AllocKind
NewObjectGCKind(js::Class *clasp)
NewObjectGCKind(const js::Class *clasp)
{
if (clasp == &ArrayObject::class_)
return gc::FINALIZE_OBJECT8;
@ -1256,7 +1256,7 @@ NewObjectGCKind(js::Class *clasp)
}
static inline JSObject *
NewObject(ExclusiveContext *cx, Class *clasp, types::TypeObject *type_, JSObject *parent,
NewObject(ExclusiveContext *cx, const Class *clasp, types::TypeObject *type_, JSObject *parent,
gc::AllocKind kind, NewObjectKind newKind)
{
JS_ASSERT(clasp != &ArrayObject::class_);
@ -1302,7 +1302,7 @@ NewObject(ExclusiveContext *cx, Class *clasp, types::TypeObject *type_, JSObject
}
void
NewObjectCache::fillProto(EntryIndex entry, Class *clasp, js::TaggedProto proto,
NewObjectCache::fillProto(EntryIndex entry, const Class *clasp, js::TaggedProto proto,
gc::AllocKind kind, JSObject *obj)
{
JS_ASSERT_IF(proto.isObject(), !proto.toObject()->is<GlobalObject>());
@ -1311,7 +1311,7 @@ NewObjectCache::fillProto(EntryIndex entry, Class *clasp, js::TaggedProto proto,
}
JSObject *
js::NewObjectWithGivenProto(ExclusiveContext *cxArg, js::Class *clasp,
js::NewObjectWithGivenProto(ExclusiveContext *cxArg, const js::Class *clasp,
js::TaggedProto proto_, JSObject *parent_,
gc::AllocKind allocKind, NewObjectKind newKind)
{
@ -1363,7 +1363,7 @@ js::NewObjectWithGivenProto(ExclusiveContext *cxArg, js::Class *clasp,
JSObject *
js::NewObjectWithClassProtoCommon(ExclusiveContext *cxArg,
js::Class *clasp, JSObject *protoArg, JSObject *parentArg,
const js::Class *clasp, JSObject *protoArg, JSObject *parentArg,
gc::AllocKind allocKind, NewObjectKind newKind)
{
if (protoArg)
@ -1528,7 +1528,7 @@ js::NewReshapedObject(JSContext *cx, HandleTypeObject type, JSObject *parent,
}
JSObject*
js::CreateThis(JSContext *cx, Class *newclasp, HandleObject callee)
js::CreateThis(JSContext *cx, const Class *newclasp, HandleObject callee)
{
RootedValue protov(cx);
if (!JSObject::getProperty(cx, callee, callee, cx->names().classPrototype, &protov))
@ -1899,8 +1899,8 @@ JSObject::ReserveForTradeGuts(JSContext *cx, JSObject *aArg, JSObject *bArg,
* Swap prototypes and classes on the two objects, so that TradeGuts can
* preserve the types of the two objects.
*/
Class *aClass = a->getClass();
Class *bClass = b->getClass();
const Class *aClass = a->getClass();
const Class *bClass = b->getClass();
Rooted<TaggedProto> aProto(cx, a->getTaggedProto());
Rooted<TaggedProto> bProto(cx, b->getTaggedProto());
if (!SetClassAndProto(cx, a, bClass, bProto, false))
@ -2214,7 +2214,7 @@ ClearClassObject(JSObject *obj, JSProtoKey key)
JSObject *
js::DefineConstructorAndPrototype(JSContext *cx, HandleObject obj, JSProtoKey key, HandleAtom atom,
JSObject *protoProto, Class *clasp,
JSObject *protoProto, const Class *clasp,
Native constructor, unsigned nargs,
const JSPropertySpec *ps, const JSFunctionSpec *fs,
const JSPropertySpec *static_ps, const JSFunctionSpec *static_fs,
@ -2359,7 +2359,7 @@ bad:
* whether a class is initialized by calling IsStandardClassResolved().
*/
bool
js::IsStandardClassResolved(JSObject *obj, js::Class *clasp)
js::IsStandardClassResolved(JSObject *obj, const js::Class *clasp)
{
JSProtoKey key = JSCLASS_CACHED_PROTO_KEY(clasp);
@ -2368,7 +2368,7 @@ js::IsStandardClassResolved(JSObject *obj, js::Class *clasp)
}
void
js::MarkStandardClassInitializedNoProto(JSObject *obj, js::Class *clasp)
js::MarkStandardClassInitializedNoProto(JSObject *obj, const js::Class *clasp)
{
JSProtoKey key = JSCLASS_CACHED_PROTO_KEY(clasp);
@ -2382,7 +2382,7 @@ js::MarkStandardClassInitializedNoProto(JSObject *obj, js::Class *clasp)
JSObject *
js_InitClass(JSContext *cx, HandleObject obj, JSObject *protoProto_,
Class *clasp, Native constructor, unsigned nargs,
const Class *clasp, Native constructor, unsigned nargs,
const JSPropertySpec *ps, const JSFunctionSpec *fs,
const JSPropertySpec *static_ps, const JSFunctionSpec *static_fs,
JSObject **ctorp, AllocKind ctorKind)
@ -2938,7 +2938,7 @@ js_InitNullClass(JSContext *cx, HandleObject obj)
JS_FOR_EACH_PROTOTYPE(DECLARE_PROTOTYPE_CLASS_INIT)
#undef DECLARE_PROTOTYPE_CLASS_INIT
static ClassInitializerOp lazy_prototype_init[JSProto_LIMIT] = {
static const ClassInitializerOp lazy_prototype_init[JSProto_LIMIT] = {
#define LAZY_PROTOTYPE_INIT(name,code,init) init,
JS_FOR_EACH_PROTOTYPE(LAZY_PROTOTYPE_INIT)
#undef LAZY_PROTOTYPE_INIT
@ -2946,7 +2946,7 @@ static ClassInitializerOp lazy_prototype_init[JSProto_LIMIT] = {
bool
js::SetClassAndProto(JSContext *cx, HandleObject obj,
Class *clasp, Handle<js::TaggedProto> proto, bool checkForCycles)
const Class *clasp, Handle<js::TaggedProto> proto, bool checkForCycles)
{
JS_ASSERT_IF(!checkForCycles, obj.get() != proto.raw());
@ -3098,7 +3098,7 @@ js_IdentifyClassPrototype(JSObject *obj)
}
bool
js_FindClassObject(ExclusiveContext *cx, JSProtoKey protoKey, MutableHandleValue vp, Class *clasp)
js_FindClassObject(ExclusiveContext *cx, JSProtoKey protoKey, MutableHandleValue vp, const Class *clasp)
{
RootedId id(cx);
@ -3396,7 +3396,7 @@ JSObject::addDataProperty(ExclusiveContext *cx, HandlePropertyName name,
* both while saving cycles for classes that stub their addProperty hook.
*/
static inline bool
CallAddPropertyHook(ExclusiveContext *cx, Class *clasp, HandleObject obj, HandleShape shape,
CallAddPropertyHook(ExclusiveContext *cx, const Class *clasp, HandleObject obj, HandleShape shape,
HandleValue nominal)
{
if (clasp->addProperty != JS_PropertyStub) {
@ -3420,7 +3420,7 @@ CallAddPropertyHook(ExclusiveContext *cx, Class *clasp, HandleObject obj, Handle
}
static inline bool
CallAddPropertyHookDense(ExclusiveContext *cx, Class *clasp, HandleObject obj, uint32_t index,
CallAddPropertyHookDense(ExclusiveContext *cx, const Class *clasp, HandleObject obj, uint32_t index,
HandleValue nominal)
{
/* Inline addProperty for array objects. */
@ -3601,7 +3601,7 @@ js::DefineNativeProperty(ExclusiveContext *cx, HandleObject obj, HandleId id, Ha
}
/* Use the object's class getter and setter by default. */
Class *clasp = obj->getClass();
const Class *clasp = obj->getClass();
if (!getter && !(attrs & JSPROP_GETTER))
getter = clasp->getProperty;
if (!setter && !(attrs & JSPROP_SETTER))
@ -3652,7 +3652,7 @@ static JS_ALWAYS_INLINE bool
CallResolveOp(JSContext *cx, HandleObject obj, HandleId id, unsigned flags,
MutableHandleObject objp, MutableHandleShape propp, bool *recursedp)
{
Class *clasp = obj->getClass();
const Class *clasp = obj->getClass();
JSResolveOp resolve = clasp->resolve;
/*
@ -4613,7 +4613,7 @@ baseops::SetPropertyHelper(JSContext *cx, HandleObject obj, HandleObject receive
unsigned attrs = JSPROP_ENUMERATE;
unsigned flags = 0;
int shortid = 0;
Class *clasp = obj->getClass();
const Class *clasp = obj->getClass();
PropertyOp getter = clasp->getProperty;
StrictPropertyOp setter = clasp->setProperty;
@ -4891,7 +4891,7 @@ js::DefaultValue(JSContext *cx, HandleObject obj, JSType hint, MutableHandleValu
Rooted<jsid> id(cx);
Class *clasp = obj->getClass();
const Class *clasp = obj->getClass();
if (hint == JSTYPE_STRING) {
id = NameToId(cx->names().toString);
@ -4967,7 +4967,7 @@ JS_EnumerateState(JSContext *cx, HandleObject obj, JSIterateOp enum_op,
MutableHandleValue statep, JS::MutableHandleId idp)
{
/* If the class has a custom JSCLASS_NEW_ENUMERATE hook, call it. */
Class *clasp = obj->getClass();
const Class *clasp = obj->getClass();
JSEnumerateOp enumerate = clasp->enumerate;
if (clasp->flags & JSCLASS_NEW_ENUMERATE) {
JS_ASSERT(enumerate != JS_EnumerateStub);
@ -5103,7 +5103,7 @@ js::GetClassPrototypePure(GlobalObject *global, JSProtoKey protoKey)
*/
bool
js_GetClassPrototype(ExclusiveContext *cx, JSProtoKey protoKey,
MutableHandleObject protop, Class *clasp)
MutableHandleObject protop, const Class *clasp)
{
if (JSObject *proto = GetClassPrototypePure(cx->global(), protoKey)) {
protop.set(proto);
@ -5297,7 +5297,7 @@ dumpValue(const Value &v)
fprintf(stderr, " at %p>", (void *) fun);
} else if (v.isObject()) {
JSObject *obj = &v.toObject();
Class *clasp = obj->getClass();
const Class *clasp = obj->getClass();
fprintf(stderr, "<%s%s at %p>",
clasp->name,
(clasp == &JSObject::class_) ? "" : " object",
@ -5390,8 +5390,8 @@ JSObject::dump()
{
JSObject *obj = this;
fprintf(stderr, "object %p\n", (void *) obj);
Class *clasp = obj->getClass();
fprintf(stderr, "class %p %s\n", (void *)clasp, clasp->name);
const Class *clasp = obj->getClass();
fprintf(stderr, "class %p %s\n", (const void *)clasp, clasp->name);
fprintf(stderr, "flags:");
if (obj->isDelegate()) fprintf(stderr, " delegate");

View File

@ -152,9 +152,9 @@ DeleteGeneric(JSContext *cx, HandleObject obj, HandleId id, bool *succeeded);
} /* namespace js::baseops */
extern Class IntlClass;
extern Class JSONClass;
extern Class MathClass;
extern const Class IntlClass;
extern const Class JSONClass;
extern const Class MathClass;
class ArrayBufferObject;
class GlobalObject;
@ -223,7 +223,7 @@ class JSObject : public js::ObjectImpl
static js::types::TypeObject *makeLazyType(JSContext *cx, js::HandleObject obj);
public:
static js::Class class_;
static const js::Class class_;
/*
* Update the last property, keeping the number of allocated slots in sync
@ -467,7 +467,7 @@ class JSObject : public js::ObjectImpl
void uninlinedSetType(js::types::TypeObject *newType);
#ifdef DEBUG
bool hasNewType(js::Class *clasp, js::types::TypeObject *newType);
bool hasNewType(const js::Class *clasp, js::types::TypeObject *newType);
#endif
/*
@ -483,10 +483,10 @@ class JSObject : public js::ObjectImpl
* Mark an object as requiring its default 'new' type to have unknown
* properties.
*/
static bool setNewTypeUnknown(JSContext *cx, js::Class *clasp, JS::HandleObject obj);
static bool setNewTypeUnknown(JSContext *cx, const js::Class *clasp, JS::HandleObject obj);
/* Set a new prototype for an object with a singleton type. */
bool splicePrototype(JSContext *cx, js::Class *clasp, js::Handle<js::TaggedProto> proto);
bool splicePrototype(JSContext *cx, const js::Class *clasp, js::Handle<js::TaggedProto> proto);
/*
* For bootstrapping, whether to splice a prototype for Function.prototype
@ -1194,10 +1194,10 @@ HasOwnProperty(JSContext *cx, LookupGenericOp lookup,
typename MaybeRooted<Shape*, allowGC>::MutableHandleType propp);
bool
IsStandardClassResolved(JSObject *obj, js::Class *clasp);
IsStandardClassResolved(JSObject *obj, const js::Class *clasp);
void
MarkStandardClassInitializedNoProto(JSObject *obj, js::Class *clasp);
MarkStandardClassInitializedNoProto(JSObject *obj, const js::Class *clasp);
typedef JSObject *(*ClassInitializerOp)(JSContext *cx, JS::HandleObject obj);
@ -1242,7 +1242,7 @@ js_IdentifyClassPrototype(JSObject *obj);
*/
bool
js_FindClassObject(js::ExclusiveContext *cx, JSProtoKey protoKey, js::MutableHandleValue vp,
js::Class *clasp = NULL);
const js::Class *clasp = NULL);
/*
* Find or create a property named by id in obj's scope, with the given getter
@ -1313,7 +1313,7 @@ CreateThisForFunction(JSContext *cx, js::HandleObject callee, bool newType);
// Generic call for constructing |this|.
extern JSObject *
CreateThis(JSContext *cx, js::Class *clasp, js::HandleObject callee);
CreateThis(JSContext *cx, const js::Class *clasp, js::HandleObject callee);
extern JSObject *
CloneObject(JSContext *cx, HandleObject obj, Handle<js::TaggedProto> proto, HandleObject parent);
@ -1533,7 +1533,7 @@ js_InferFlags(JSContext *cx, unsigned defaultFlags);
*/
extern bool
js_GetClassPrototype(js::ExclusiveContext *cx, JSProtoKey protoKey, js::MutableHandleObject protop,
js::Class *clasp = NULL);
const js::Class *clasp = NULL);
namespace js {
@ -1542,7 +1542,7 @@ GetClassPrototypePure(GlobalObject *global, JSProtoKey protoKey);
extern bool
SetClassAndProto(JSContext *cx, HandleObject obj,
Class *clasp, Handle<TaggedProto> proto, bool checkForCycles);
const Class *clasp, Handle<TaggedProto> proto, bool checkForCycles);
extern JSObject *
NonNullObject(JSContext *cx, const Value &v);

View File

@ -84,7 +84,7 @@ JSObject::finalize(js::FreeOp *fop)
JS_ASSERT(CurrentThreadCanAccessRuntime(fop->runtime()));
}
#endif
js::Class *clasp = getClass();
const js::Class *clasp = getClass();
if (clasp->finalize)
clasp->finalize(fop, this);
@ -654,7 +654,7 @@ IsNativeFunction(const js::Value &v, JSNative native)
* TODO: a per-thread shape-based cache would be faster and simpler.
*/
static JS_ALWAYS_INLINE bool
ClassMethodIsNative(JSContext *cx, JSObject *obj, Class *clasp, jsid methodid, JSNative native)
ClassMethodIsNative(JSContext *cx, JSObject *obj, const Class *clasp, jsid methodid, JSNative native)
{
JS_ASSERT(!obj->is<ProxyObject>());
JS_ASSERT(obj->getClass() == clasp);
@ -757,11 +757,11 @@ class AutoPropDescArrayRooter : private AutoGCRooter
* default to the prototype's global if the prototype is non-null.
*/
JSObject *
NewObjectWithGivenProto(ExclusiveContext *cx, js::Class *clasp, TaggedProto proto, JSObject *parent,
NewObjectWithGivenProto(ExclusiveContext *cx, const js::Class *clasp, TaggedProto proto, JSObject *parent,
gc::AllocKind allocKind, NewObjectKind newKind);
inline JSObject *
NewObjectWithGivenProto(ExclusiveContext *cx, js::Class *clasp, TaggedProto proto, JSObject *parent,
NewObjectWithGivenProto(ExclusiveContext *cx, const js::Class *clasp, TaggedProto proto, JSObject *parent,
NewObjectKind newKind = GenericObject)
{
gc::AllocKind allocKind = gc::GetGCObjectKind(clasp);
@ -769,14 +769,14 @@ NewObjectWithGivenProto(ExclusiveContext *cx, js::Class *clasp, TaggedProto prot
}
inline JSObject *
NewObjectWithGivenProto(ExclusiveContext *cx, js::Class *clasp, JSObject *proto, JSObject *parent,
NewObjectWithGivenProto(ExclusiveContext *cx, const js::Class *clasp, JSObject *proto, JSObject *parent,
NewObjectKind newKind = GenericObject)
{
return NewObjectWithGivenProto(cx, clasp, TaggedProto(proto), parent, newKind);
}
inline JSProtoKey
GetClassProtoKey(js::Class *clasp)
GetClassProtoKey(const js::Class *clasp)
{
JSProtoKey key = JSCLASS_CACHED_PROTO_KEY(clasp);
if (key != JSProto_Null)
@ -787,7 +787,7 @@ GetClassProtoKey(js::Class *clasp)
}
inline bool
FindProto(ExclusiveContext *cx, js::Class *clasp, MutableHandleObject proto)
FindProto(ExclusiveContext *cx, const js::Class *clasp, MutableHandleObject proto)
{
JSProtoKey protoKey = GetClassProtoKey(clasp);
if (!js_GetClassPrototype(cx, protoKey, proto, clasp))
@ -815,18 +815,18 @@ FindProto(ExclusiveContext *cx, js::Class *clasp, MutableHandleObject proto)
* parent will be that global.
*/
JSObject *
NewObjectWithClassProtoCommon(ExclusiveContext *cx, js::Class *clasp, JSObject *proto, JSObject *parent,
NewObjectWithClassProtoCommon(ExclusiveContext *cx, const js::Class *clasp, JSObject *proto, JSObject *parent,
gc::AllocKind allocKind, NewObjectKind newKind);
inline JSObject *
NewObjectWithClassProto(ExclusiveContext *cx, js::Class *clasp, JSObject *proto, JSObject *parent,
NewObjectWithClassProto(ExclusiveContext *cx, const js::Class *clasp, JSObject *proto, JSObject *parent,
gc::AllocKind allocKind, NewObjectKind newKind = GenericObject)
{
return NewObjectWithClassProtoCommon(cx, clasp, proto, parent, allocKind, newKind);
}
inline JSObject *
NewObjectWithClassProto(ExclusiveContext *cx, js::Class *clasp, JSObject *proto, JSObject *parent,
NewObjectWithClassProto(ExclusiveContext *cx, const js::Class *clasp, JSObject *proto, JSObject *parent,
NewObjectKind newKind = GenericObject)
{
gc::AllocKind allocKind = gc::GetGCObjectKind(clasp);
@ -838,14 +838,14 @@ NewObjectWithClassProto(ExclusiveContext *cx, js::Class *clasp, JSObject *proto,
* according to the context's active global.
*/
inline JSObject *
NewBuiltinClassInstance(ExclusiveContext *cx, Class *clasp, gc::AllocKind allocKind,
NewBuiltinClassInstance(ExclusiveContext *cx, const Class *clasp, gc::AllocKind allocKind,
NewObjectKind newKind = GenericObject)
{
return NewObjectWithClassProto(cx, clasp, NULL, NULL, allocKind, newKind);
}
inline JSObject *
NewBuiltinClassInstance(ExclusiveContext *cx, Class *clasp, NewObjectKind newKind = GenericObject)
NewBuiltinClassInstance(ExclusiveContext *cx, const Class *clasp, NewObjectKind newKind = GenericObject)
{
gc::AllocKind allocKind = gc::GetGCObjectKind(clasp);
return NewBuiltinClassInstance(cx, clasp, allocKind, newKind);
@ -974,7 +974,7 @@ ValueIsSpecial(JSObject *obj, MutableHandleValue propval, MutableHandle<SpecialI
JSObject *
DefineConstructorAndPrototype(JSContext *cx, HandleObject obj, JSProtoKey key, HandleAtom atom,
JSObject *protoProto, Class *clasp,
JSObject *protoProto, const Class *clasp,
Native constructor, unsigned nargs,
const JSPropertySpec *ps, const JSFunctionSpec *fs,
const JSPropertySpec *static_ps, const JSFunctionSpec *static_fs,
@ -1041,7 +1041,7 @@ DefineProperty(ExclusiveContext *cx, HandleObject obj, PropertyName *name, Handl
extern JSObject *
js_InitClass(JSContext *cx, js::HandleObject obj, JSObject *parent_proto,
js::Class *clasp, JSNative constructor, unsigned nargs,
const js::Class *clasp, JSNative constructor, unsigned nargs,
const JSPropertySpec *ps, const JSFunctionSpec *fs,
const JSPropertySpec *static_ps, const JSFunctionSpec *static_fs,
JSObject **ctorp = NULL,

View File

@ -33,7 +33,7 @@ using namespace js::types;
using mozilla::IsFinite;
using mozilla::Maybe;
Class js::JSONClass = {
const Class js::JSONClass = {
js_JSON_str,
JSCLASS_HAS_CACHED_PROTO(JSProto_JSON),
JS_PropertyStub, /* addProperty */

View File

@ -3022,7 +3022,7 @@ proxy_HasInstance(JSContext *cx, HandleObject proxy, MutableHandleValue v, bool
proxy_WeakmapKeyDelegate \
}
Class js::ObjectProxyObject::class_ = {
const Class js::ObjectProxyObject::class_ = {
"Proxy",
Class::NON_NATIVE | JSCLASS_IMPLEMENTS_BARRIERS | JSCLASS_HAS_RESERVED_SLOTS(4) |
JSCLASS_HAS_CACHED_PROTO(JSProto_Proxy),
@ -3068,9 +3068,9 @@ Class js::ObjectProxyObject::class_ = {
}
};
Class* const js::ObjectProxyClassPtr = &ObjectProxyObject::class_;
const Class* const js::ObjectProxyClassPtr = &ObjectProxyObject::class_;
Class js::OuterWindowProxyObject::class_ = {
const Class js::OuterWindowProxyObject::class_ = {
"Proxy",
Class::NON_NATIVE | JSCLASS_IMPLEMENTS_BARRIERS | JSCLASS_HAS_RESERVED_SLOTS(4),
JS_PropertyStub, /* addProperty */
@ -3121,7 +3121,7 @@ Class js::OuterWindowProxyObject::class_ = {
}
};
Class* const js::OuterWindowProxyClassPtr = &OuterWindowProxyObject::class_;
const Class* const js::OuterWindowProxyClassPtr = &OuterWindowProxyObject::class_;
static bool
proxy_Call(JSContext *cx, unsigned argc, Value *vp)
@ -3141,7 +3141,7 @@ proxy_Construct(JSContext *cx, unsigned argc, Value *vp)
return Proxy::construct(cx, proxy, args);
}
Class js::FunctionProxyObject::class_ = {
const Class js::FunctionProxyObject::class_ = {
"Proxy",
Class::NON_NATIVE | JSCLASS_IMPLEMENTS_BARRIERS | JSCLASS_HAS_RESERVED_SLOTS(6),
JS_PropertyStub, /* addProperty */
@ -3186,7 +3186,7 @@ Class js::FunctionProxyObject::class_ = {
}
};
Class* const js::FunctionProxyClassPtr = &FunctionProxyObject::class_;
const Class* const js::FunctionProxyClassPtr = &FunctionProxyObject::class_;
/* static */ ProxyObject *
ProxyObject::New(JSContext *cx, BaseProxyHandler *handler, HandleValue priv, TaggedProto proto_,
@ -3197,7 +3197,7 @@ ProxyObject::New(JSContext *cx, BaseProxyHandler *handler, HandleValue priv, Tag
JS_ASSERT_IF(proto.isObject(), cx->compartment() == proto.toObject()->compartment());
JS_ASSERT_IF(parent, cx->compartment() == parent->compartment());
Class *clasp;
const Class *clasp;
if (callable)
clasp = &FunctionProxyObject::class_;
else

View File

@ -280,9 +280,9 @@ class Proxy
// These are equal to |&{Function,Object,OuterWindow}ProxyObject::class_|. Use
// them in places where you don't want to #include vm/ProxyObject.h.
extern JS_FRIEND_DATA(js::Class* const) FunctionProxyClassPtr;
extern JS_FRIEND_DATA(js::Class* const) ObjectProxyClassPtr;
extern JS_FRIEND_DATA(js::Class* const) OuterWindowProxyClassPtr;
extern JS_FRIEND_DATA(const js::Class* const) FunctionProxyClassPtr;
extern JS_FRIEND_DATA(const js::Class* const) ObjectProxyClassPtr;
extern JS_FRIEND_DATA(const js::Class* const) OuterWindowProxyClassPtr;
inline bool IsObjectProxyClass(const Class *clasp)
{

View File

@ -942,7 +942,7 @@ ScriptSourceObject::finalize(FreeOp *fop, JSObject *obj)
obj->as<ScriptSourceObject>().setSource(NULL);
}
Class ScriptSourceObject::class_ = {
const Class ScriptSourceObject::class_ = {
"ScriptSource",
JSCLASS_HAS_RESERVED_SLOTS(1) | JSCLASS_IS_ANONYMOUS,
JS_PropertyStub, /* addProperty */

View File

@ -402,7 +402,7 @@ class ScriptSourceHolder
class ScriptSourceObject : public JSObject
{
public:
static Class class_;
static const Class class_;
static void finalize(FreeOp *fop, JSObject *obj);
static ScriptSourceObject *create(ExclusiveContext *cx, ScriptSource *source);

View File

@ -407,7 +407,7 @@ str_resolve(JSContext *cx, HandleObject obj, HandleId id, unsigned flags,
return true;
}
Class StringObject::class_ = {
const Class StringObject::class_ = {
js_String_str,
JSCLASS_HAS_RESERVED_SLOTS(StringObject::RESERVED_SLOTS) |
JSCLASS_NEW_RESOLVE | JSCLASS_HAS_CACHED_PROTO(JSProto_String),
@ -2805,7 +2805,7 @@ LambdaIsGetElem(JSContext *cx, JSObject &lambda, MutableHandleObject pobj)
return true;
JSObject &bobj = b.toObject();
Class *clasp = bobj.getClass();
const Class *clasp = bobj.getClass();
if (!clasp->isNative() || clasp->ops.lookupProperty || clasp->ops.getProperty)
return true;

View File

@ -388,7 +388,7 @@ WeakMap_construct(JSContext *cx, unsigned argc, Value *vp)
return true;
}
Class WeakMapObject::class_ = {
const Class WeakMapObject::class_ = {
"WeakMap",
JSCLASS_HAS_PRIVATE | JSCLASS_IMPLEMENTS_BARRIERS |
JSCLASS_HAS_CACHED_PROTO(JSProto_WeakMap),

View File

@ -166,7 +166,7 @@ js::CancelOffThreadIonCompile(JSCompartment *compartment, JSScript *script)
}
}
static JSClass workerGlobalClass = {
static const JSClass workerGlobalClass = {
"internal-worker-global", JSCLASS_GLOBAL_FLAGS,
JS_PropertyStub, JS_DeletePropertyStub,
JS_PropertyStub, JS_StrictPropertyStub,

Some files were not shown because too many files have changed in this diff Show More