--- a/js/public/Class.h
+++ b/js/public/Class.h
@@ -4,16 +4,18 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* JSClass definition and its component types, plus related interfaces. */
#ifndef js_Class_h
#define js_Class_h
+#include "mozilla/Attributes.h"
+
#include "jstypes.h"
#include "js/CallArgs.h"
#include "js/Id.h"
#include "js/TypeDecls.h"
/*
* A JSClass acts as a vtable for JS objects that allows JSAPI clients to
@@ -606,22 +608,17 @@ typedef void
MOZ_ASSERT(cOps && cOps->finalize); \
cOps->finalize(fop, obj); \
} \
void doTrace(JSTracer* trc, JSObject* obj) const { \
MOZ_ASSERT(cOps && cOps->trace); \
cOps->trace(trc, obj); \
}
-// XXX: MOZ_NONHEAP_CLASS allows objects to be created statically or on the
-// stack. We actually want to ban stack objects too, but that's currently not
-// possible. So we define JS_STATIC_CLASS to make the intention clearer.
-#define JS_STATIC_CLASS MOZ_NONHEAP_CLASS
-
-struct JS_STATIC_CLASS ClassOps
+struct MOZ_STATIC_CLASS ClassOps
{
/* Function pointer members (may be null). */
JSAddPropertyOp addProperty;
JSDeletePropertyOp delProperty;
JSEnumerateOp enumerate;
JSNewEnumerateOp newEnumerate;
JSResolveOp resolve;
JSMayResolveOp mayResolve;
@@ -636,17 +633,17 @@ struct JS_STATIC_CLASS ClassOps
typedef JSObject* (*ClassObjectCreationOp)(JSContext* cx, JSProtoKey key);
/** Callback for custom post-processing after class initialization via ClassSpec. */
typedef bool (*FinishClassInitOp)(JSContext* cx, JS::HandleObject ctor,
JS::HandleObject proto);
const size_t JSCLASS_CACHED_PROTO_WIDTH = 6;
-struct JS_STATIC_CLASS ClassSpec
+struct MOZ_STATIC_CLASS ClassSpec
{
ClassObjectCreationOp createConstructor;
ClassObjectCreationOp createPrototype;
const JSFunctionSpec* constructorFunctions;
const JSPropertySpec* constructorProperties;
const JSFunctionSpec* prototypeFunctions;
const JSPropertySpec* prototypeProperties;
FinishClassInitOp finishInit;
@@ -672,17 +669,17 @@ struct JS_STATIC_CLASS ClassSpec
}
bool shouldDefineConstructor() const {
MOZ_ASSERT(defined());
return !(flags & DontDefineConstructor);
}
};
-struct JS_STATIC_CLASS ClassExtension
+struct MOZ_STATIC_CLASS ClassExtension
{
/**
* If an object is used as a key in a weakmap, it may be desirable for the
* garbage collector to keep that object around longer than it otherwise
* would. A common case is when the key is a wrapper around an object in
* another compartment, and we want to avoid collecting the wrapper (and
* removing the weakmap entry) as long as the wrapped object is alive. In
* that case, the wrapped object is returned by the wrapper's
@@ -711,17 +708,17 @@ struct JS_STATIC_CLASS ClassExtension
* This is used to compute the nursery promotion rate.
*/
JSObjectMovedOp objectMovedOp;
};
#define JS_NULL_CLASS_SPEC nullptr
#define JS_NULL_CLASS_EXT nullptr
-struct JS_STATIC_CLASS ObjectOps
+struct MOZ_STATIC_CLASS ObjectOps
{
LookupPropertyOp lookupProperty;
DefinePropertyOp defineProperty;
HasPropertyOp hasProperty;
GetPropertyOp getProperty;
SetPropertyOp setProperty;
GetOwnPropertyOp getOwnPropertyDescriptor;
DeletePropertyOp deleteProperty;
@@ -732,17 +729,17 @@ struct JS_STATIC_CLASS ObjectOps
#define JS_NULL_OBJECT_OPS nullptr
} // namespace js
// Classes, objects, and properties.
typedef void (*JSClassInternal)();
-struct JS_STATIC_CLASS JSClassOps
+struct MOZ_STATIC_CLASS JSClassOps
{
/* Function pointer members (may be null). */
JSAddPropertyOp addProperty;
JSDeletePropertyOp delProperty;
JSEnumerateOp enumerate;
JSNewEnumerateOp newEnumerate;
JSResolveOp resolve;
JSMayResolveOp mayResolve;
@@ -862,17 +859,17 @@ static const uint32_t JSCLASS_CACHED_PRO
& JSCLASS_CACHED_PROTO_MASK))
// Initializer for unused members of statically initialized JSClass structs.
#define JSCLASS_NO_INTERNAL_MEMBERS {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
#define JSCLASS_NO_OPTIONAL_MEMBERS 0,0,0,0,0,JSCLASS_NO_INTERNAL_MEMBERS
namespace js {
-struct JS_STATIC_CLASS Class
+struct MOZ_STATIC_CLASS Class
{
JS_CLASS_MEMBERS(js::ClassOps, FreeOp);
const ClassSpec* spec;
const ClassExtension* ext;
const ObjectOps* oOps;
/*
* Objects of this class aren't native objects. They don't have Shapes that