зеркало из https://github.com/mozilla/gecko-dev.git
Bug 949183 - Fix jsid static constructor explosion. r=Waldo
This commit is contained in:
Родитель
78bf04b8e2
Коммит
59305924cb
|
@ -573,15 +573,15 @@ nsIScriptSecurityManager *nsDOMClassInfo::sSecMan = nullptr;
|
|||
bool nsDOMClassInfo::sIsInitialized = false;
|
||||
|
||||
|
||||
jsid nsDOMClassInfo::sLocation_id = JSID_VOID;
|
||||
jsid nsDOMClassInfo::sConstructor_id = JSID_VOID;
|
||||
jsid nsDOMClassInfo::sLength_id = JSID_VOID;
|
||||
jsid nsDOMClassInfo::sItem_id = JSID_VOID;
|
||||
jsid nsDOMClassInfo::sNamedItem_id = JSID_VOID;
|
||||
jsid nsDOMClassInfo::sEnumerate_id = JSID_VOID;
|
||||
jsid nsDOMClassInfo::sTop_id = JSID_VOID;
|
||||
jsid nsDOMClassInfo::sDocument_id = JSID_VOID;
|
||||
jsid nsDOMClassInfo::sWrappedJSObject_id = JSID_VOID;
|
||||
jsid nsDOMClassInfo::sLocation_id = jsid::voidId();
|
||||
jsid nsDOMClassInfo::sConstructor_id = jsid::voidId();
|
||||
jsid nsDOMClassInfo::sLength_id = jsid::voidId();
|
||||
jsid nsDOMClassInfo::sItem_id = jsid::voidId();
|
||||
jsid nsDOMClassInfo::sNamedItem_id = jsid::voidId();
|
||||
jsid nsDOMClassInfo::sEnumerate_id = jsid::voidId();
|
||||
jsid nsDOMClassInfo::sTop_id = jsid::voidId();
|
||||
jsid nsDOMClassInfo::sDocument_id = jsid::voidId();
|
||||
jsid nsDOMClassInfo::sWrappedJSObject_id = jsid::voidId();
|
||||
|
||||
static const JSClass *sObjectClass = nullptr;
|
||||
|
||||
|
@ -1945,14 +1945,14 @@ nsDOMClassInfo::ShutDown()
|
|||
}
|
||||
}
|
||||
|
||||
sLocation_id = JSID_VOID;
|
||||
sConstructor_id = JSID_VOID;
|
||||
sLength_id = JSID_VOID;
|
||||
sItem_id = JSID_VOID;
|
||||
sEnumerate_id = JSID_VOID;
|
||||
sTop_id = JSID_VOID;
|
||||
sDocument_id = JSID_VOID;
|
||||
sWrappedJSObject_id = JSID_VOID;
|
||||
sLocation_id = jsid::voidId();
|
||||
sConstructor_id = jsid::voidId();
|
||||
sLength_id = jsid::voidId();
|
||||
sItem_id = jsid::voidId();
|
||||
sEnumerate_id = jsid::voidId();
|
||||
sTop_id = jsid::voidId();
|
||||
sDocument_id = jsid::voidId();
|
||||
sWrappedJSObject_id = jsid::voidId();
|
||||
|
||||
NS_IF_RELEASE(sXPConnect);
|
||||
NS_IF_RELEASE(sSecMan);
|
||||
|
|
|
@ -941,7 +941,7 @@ XrayResolveAttribute(JSContext* cx, JS::Handle<JSObject*> wrapper,
|
|||
// Set i to be the index into our full list of ids/specs that we're
|
||||
// looking at now.
|
||||
size_t i = attributes->specs - attributeSpecs;
|
||||
for ( ; attributeIds[i] != JSID_VOID; ++i) {
|
||||
for ( ; attributeIds[i] != jsid::voidId(); ++i) {
|
||||
if (id == attributeIds[i]) {
|
||||
const JSPropertySpec& attrSpec = attributeSpecs[i];
|
||||
// Because of centralization, we need to make sure we fault in the
|
||||
|
@ -1020,7 +1020,7 @@ XrayResolveProperty(JSContext* cx, JS::Handle<JSObject*> wrapper,
|
|||
// Set i to be the index into our full list of ids/specs that we're
|
||||
// looking at now.
|
||||
size_t i = method->specs - methodsSpecs;
|
||||
for ( ; methodIds[i] != JSID_VOID; ++i) {
|
||||
for ( ; methodIds[i] != jsid::voidId(); ++i) {
|
||||
if (id == methodIds[i]) {
|
||||
const JSFunctionSpec& methodSpec = methodsSpecs[i];
|
||||
JSFunction *fun;
|
||||
|
@ -1084,7 +1084,7 @@ XrayResolveProperty(JSContext* cx, JS::Handle<JSObject*> wrapper,
|
|||
// Set i to be the index into our full list of ids/specs that we're
|
||||
// looking at now.
|
||||
size_t i = constant->specs - nativeProperties->constantSpecs;
|
||||
for ( ; nativeProperties->constantIds[i] != JSID_VOID; ++i) {
|
||||
for ( ; nativeProperties->constantIds[i] != jsid::voidId(); ++i) {
|
||||
if (id == nativeProperties->constantIds[i]) {
|
||||
desc.setAttributes(JSPROP_ENUMERATE | JSPROP_READONLY | JSPROP_PERMANENT);
|
||||
desc.object().set(wrapper);
|
||||
|
@ -1226,7 +1226,7 @@ XrayEnumerateAttributes(JSContext* cx, JS::Handle<JSObject*> wrapper,
|
|||
// Set i to be the index into our full list of ids/specs that we're
|
||||
// looking at now.
|
||||
size_t i = attributes->specs - attributeSpecs;
|
||||
for ( ; attributeIds[i] != JSID_VOID; ++i) {
|
||||
for ( ; attributeIds[i] != jsid::voidId(); ++i) {
|
||||
if (((flags & JSITER_HIDDEN) ||
|
||||
(attributeSpecs[i].flags & JSPROP_ENUMERATE)) &&
|
||||
!props.append(attributeIds[i])) {
|
||||
|
@ -1264,7 +1264,7 @@ XrayEnumerateProperties(JSContext* cx, JS::Handle<JSObject*> wrapper,
|
|||
// Set i to be the index into our full list of ids/specs that we're
|
||||
// looking at now.
|
||||
size_t i = method->specs - methodsSpecs;
|
||||
for ( ; methodIds[i] != JSID_VOID; ++i) {
|
||||
for ( ; methodIds[i] != jsid::voidId(); ++i) {
|
||||
if (((flags & JSITER_HIDDEN) ||
|
||||
(methodsSpecs[i].flags & JSPROP_ENUMERATE)) &&
|
||||
!props.append(methodIds[i])) {
|
||||
|
@ -1310,7 +1310,7 @@ XrayEnumerateProperties(JSContext* cx, JS::Handle<JSObject*> wrapper,
|
|||
// Set i to be the index into our full list of ids/specs that we're
|
||||
// looking at now.
|
||||
size_t i = constant->specs - nativeProperties->constantSpecs;
|
||||
for ( ; nativeProperties->constantIds[i] != JSID_VOID; ++i) {
|
||||
for ( ; nativeProperties->constantIds[i] != jsid::voidId(); ++i) {
|
||||
if (!props.append(nativeProperties->constantIds[i])) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -1408,9 +1408,9 @@ InitIds(JSContext* cx, const Prefable<Spec>* prefableSpecs, jsid* ids)
|
|||
}
|
||||
} while (++ids, (++spec)->name);
|
||||
|
||||
// We ran out of ids for that pref. Put a JSID_VOID in on the id
|
||||
// We ran out of ids for that pref. Put a jsid::voidId() in on the id
|
||||
// corresponding to the list terminator for the pref.
|
||||
*ids = JSID_VOID;
|
||||
*ids = jsid::voidId();
|
||||
++ids;
|
||||
} while ((++prefableSpecs)->specs);
|
||||
|
||||
|
|
|
@ -1426,7 +1426,7 @@ class PropertyDefiner:
|
|||
',\n'.join(prefableSpecs) + "\n" +
|
||||
"};\n\n") % (specType, name, specType, name))
|
||||
if doIdArrays:
|
||||
arrays += ("static jsid %s_ids[%i] = { JSID_VOID };\n\n" %
|
||||
arrays += ("static jsid %s_ids[%i] = { jsid::voidId() };\n\n" %
|
||||
(name, len(specs)))
|
||||
return arrays
|
||||
|
||||
|
@ -1832,14 +1832,14 @@ class CGCreateInterfaceObjectsMethod(CGAbstractMethod):
|
|||
if len(idsToInit) > 1:
|
||||
initIds = CGWrapper(initIds, pre="(", post=")", reindent=True)
|
||||
initIds = CGList(
|
||||
[CGGeneric("%s_ids[0] == JSID_VOID &&" % idsToInit[0]),
|
||||
[CGGeneric("%s_ids[0] == jsid::voidId() &&" % idsToInit[0]),
|
||||
CGGeneric("NS_IsMainThread() &&"),
|
||||
initIds],
|
||||
"\n")
|
||||
initIds = CGWrapper(initIds, pre="if (", post=") {", reindent=True)
|
||||
initIds = CGList(
|
||||
[initIds,
|
||||
CGGeneric((" %s_ids[0] = JSID_VOID;\n"
|
||||
CGGeneric((" %s_ids[0] = jsid::voidId();\n"
|
||||
" return;") % idsToInit[0]),
|
||||
CGGeneric("}")],
|
||||
"\n")
|
||||
|
@ -11297,7 +11297,7 @@ class GlobalGenRoots():
|
|||
classMembers = [ClassMember(m.identifier.name + "_id",
|
||||
"jsid",
|
||||
visibility="public",
|
||||
body="JSID_VOID") for m in dictMembers]
|
||||
body="jsid::voidId()") for m in dictMembers]
|
||||
|
||||
structName = dict.identifier.name + "Atoms"
|
||||
structs.append((structName,
|
||||
|
|
|
@ -21,7 +21,7 @@ using namespace JS;
|
|||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
jsid s_length_id = JSID_VOID;
|
||||
jsid s_length_id = jsid::voidId();
|
||||
|
||||
bool
|
||||
DefineStaticJSVals(JSContext* cx)
|
||||
|
|
|
@ -141,7 +141,7 @@ NPStringIdentifierIsPermanent(NPP npp, NPIdentifier id)
|
|||
return JS_StringHasBeenInterned(cx, NPIdentifierToString(id));
|
||||
}
|
||||
|
||||
#define NPIdentifier_VOID (JSIdToNPIdentifier(JSID_VOID))
|
||||
#define NPIdentifier_VOID (JSIdToNPIdentifier(jsid::voidId()))
|
||||
|
||||
NPObject* NP_CALLBACK
|
||||
_getwindowobject(NPP npp);
|
||||
|
|
|
@ -167,7 +167,7 @@ enum {
|
|||
};
|
||||
|
||||
// These are jsids for the main runtime. Only touched on the main thread.
|
||||
jsid gStringIDs[ID_COUNT] = { JSID_VOID };
|
||||
jsid gStringIDs[ID_COUNT] = { jsid::voidId() };
|
||||
|
||||
const char* gStringChars[] = {
|
||||
"Worker",
|
||||
|
@ -1050,7 +1050,7 @@ ResolveWorkerClasses(JSContext* aCx, JS::Handle<JSObject*> aObj, JS::Handle<jsid
|
|||
JSString* str = JS_InternString(aCx, gStringChars[i]);
|
||||
if (!str) {
|
||||
while (i) {
|
||||
gStringIDs[--i] = JSID_VOID;
|
||||
gStringIDs[--i] = jsid::voidId();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ SPECIALID_TO_JSID(const SpecialId &sid);
|
|||
* (PropertyName, see vm/String.h); and by various special values.
|
||||
*
|
||||
* Special values are encoded using SpecialId, which is layout-compatible but
|
||||
* non-interconvertible with jsid. A SpecialId is used for JSID_VOID, which
|
||||
* non-interconvertible with jsid. A SpecialId is used for jsid::voidId(), which
|
||||
* does not occur in JS scripts but may be used to indicate the absence of a
|
||||
* valid identifier. In the future, a SpecialId may also be an object used by
|
||||
* Harmony-proposed private names.
|
||||
|
|
|
@ -10,16 +10,17 @@
|
|||
// A jsid is an identifier for a property or method of an object which is
|
||||
// either a 31-bit signed integer, interned string or object.
|
||||
//
|
||||
// Also, there is an additional jsid value, JSID_VOID, which does not occur in
|
||||
// Also, there is an additional jsid value, jsid::voidId(), which does not occur in
|
||||
// JS scripts but may be used to indicate the absence of a valid jsid. A void
|
||||
// jsid is not a valid id and only arises as an exceptional API return value,
|
||||
// such as in JS_NextProperty. Embeddings must not pass JSID_VOID into JSAPI
|
||||
// entry points expecting a jsid and do not need to handle JSID_VOID in hooks
|
||||
// such as in JS_NextProperty. Embeddings must not pass jsid::voidId() into JSAPI
|
||||
// entry points expecting a jsid and do not need to handle jsid::voidId() in hooks
|
||||
// receiving a jsid except when explicitly noted in the API contract.
|
||||
//
|
||||
// A jsid is not implicitly convertible to or from a jsval; JS_ValueToId or
|
||||
// JS_IdToValue must be used instead.
|
||||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/NullPtr.h"
|
||||
|
||||
#include "jstypes.h"
|
||||
|
@ -28,20 +29,35 @@
|
|||
#include "js/TypeDecls.h"
|
||||
#include "js/Utility.h"
|
||||
|
||||
struct jsid
|
||||
{
|
||||
size_t asBits;
|
||||
bool operator==(jsid rhs) const { return asBits == rhs.asBits; }
|
||||
bool operator!=(jsid rhs) const { return asBits != rhs.asBits; }
|
||||
};
|
||||
#define JSID_BITS(id) (id.asBits)
|
||||
|
||||
#define JSID_TYPE_STRING 0x0
|
||||
#define JSID_TYPE_INT 0x1
|
||||
#define JSID_TYPE_VOID 0x2
|
||||
#define JSID_TYPE_OBJECT 0x4
|
||||
#define JSID_TYPE_MASK 0x7
|
||||
|
||||
struct jsid
|
||||
{
|
||||
size_t asBits;
|
||||
|
||||
jsid() {}
|
||||
|
||||
#if !defined(_MSC_VER) && !defined(__sparc)
|
||||
// jsid must be POD so that MSVC and SPARC will pass it and return it by
|
||||
// value. (See also bug 689101 and bug 737344, for this problem with
|
||||
// respect to JS::Value, which also has a comment like this next to it.)
|
||||
private:
|
||||
#endif
|
||||
MOZ_CONSTEXPR jsid(size_t bits) : asBits(bits) {}
|
||||
|
||||
public:
|
||||
static MOZ_CONSTEXPR jsid voidId() { return jsid(JSID_TYPE_VOID); }
|
||||
static MOZ_CONSTEXPR jsid emptyId() { return jsid(JSID_TYPE_OBJECT); }
|
||||
|
||||
bool operator==(jsid rhs) const { return asBits == rhs.asBits; }
|
||||
bool operator!=(jsid rhs) const { return asBits != rhs.asBits; }
|
||||
};
|
||||
#define JSID_BITS(id) (id.asBits)
|
||||
|
||||
// Avoid using canonical 'id' for jsid parameters since this is a magic word in
|
||||
// Objective-C++ which, apparently, wants to be able to #include jsapi.h.
|
||||
#define id iden
|
||||
|
@ -148,9 +164,6 @@ JSID_IS_EMPTY(const jsid id)
|
|||
|
||||
#undef id
|
||||
|
||||
extern JS_PUBLIC_DATA(const jsid) JSID_VOID;
|
||||
extern JS_PUBLIC_DATA(const jsid) JSID_EMPTY;
|
||||
|
||||
extern JS_PUBLIC_DATA(const JS::Handle<jsid>) JSID_VOIDHANDLE;
|
||||
extern JS_PUBLIC_DATA(const JS::Handle<jsid>) JSID_EMPTYHANDLE;
|
||||
|
||||
|
@ -168,7 +181,7 @@ IsPoisonedId(jsid iden)
|
|||
|
||||
template <> struct GCMethods<jsid>
|
||||
{
|
||||
static jsid initial() { return JSID_VOID; }
|
||||
static jsid initial() { return jsid::voidId(); }
|
||||
static ThingRootKind kind() { return THING_ROOT_ID; }
|
||||
static bool poisoned(jsid id) { return IsPoisonedId(id); }
|
||||
static bool needsPostBarrier(jsid id) { return false; }
|
||||
|
|
|
@ -605,7 +605,7 @@ obj_unwatch(JSContext *cx, unsigned argc, Value *vp)
|
|||
if (!ValueToId<CanGC>(cx, args[0], &id))
|
||||
return false;
|
||||
} else {
|
||||
id = JSID_VOID;
|
||||
id = jsid::voidId();
|
||||
}
|
||||
|
||||
if (!JSObject::unwatch(cx, obj, id))
|
||||
|
|
|
@ -995,7 +995,7 @@ class EncapsulatedId : public BarrieredId
|
|||
{
|
||||
public:
|
||||
explicit EncapsulatedId(jsid id) : BarrieredId(id) {}
|
||||
explicit EncapsulatedId() : BarrieredId(JSID_VOID) {}
|
||||
explicit EncapsulatedId() : BarrieredId(jsid::voidId()) {}
|
||||
|
||||
EncapsulatedId &operator=(const EncapsulatedId &v) {
|
||||
if (v.value != value)
|
||||
|
@ -1009,7 +1009,7 @@ class EncapsulatedId : public BarrieredId
|
|||
class RelocatableId : public BarrieredId
|
||||
{
|
||||
public:
|
||||
explicit RelocatableId() : BarrieredId(JSID_VOID) {}
|
||||
explicit RelocatableId() : BarrieredId(jsid::voidId()) {}
|
||||
explicit inline RelocatableId(jsid id) : BarrieredId(id) {}
|
||||
~RelocatableId() { pre(); }
|
||||
|
||||
|
@ -1046,7 +1046,7 @@ class RelocatableId : public BarrieredId
|
|||
class HeapId : public BarrieredId
|
||||
{
|
||||
public:
|
||||
explicit HeapId() : BarrieredId(JSID_VOID) {}
|
||||
explicit HeapId() : BarrieredId(jsid::voidId()) {}
|
||||
|
||||
explicit HeapId(jsid id)
|
||||
: BarrieredId(id)
|
||||
|
|
|
@ -46,7 +46,7 @@ class jsid(object):
|
|||
elif tag & jsid.TYPE_INT:
|
||||
body = bits >> 1
|
||||
elif tag == jsid.TYPE_VOID:
|
||||
return "JSID_VOID"
|
||||
return "jsid::voidId()"
|
||||
elif tag == jsid.TYPE_OBJECT:
|
||||
body = ((bits & ~jsid.TYPE_MASK)
|
||||
.cast(self.cache.JSObject_ptr_t))
|
||||
|
|
|
@ -6,7 +6,7 @@ FRAGMENT(jsid, simple) {
|
|||
JS::Rooted<JSString *> interned(cx, JS_InternJSString(cx, string));
|
||||
JS::Rooted<jsid> string_id(cx, INTERNED_STRING_TO_JSID(cx, interned));
|
||||
jsid int_id = INT_TO_JSID(1729);
|
||||
jsid void_id = JSID_VOID;
|
||||
jsid void_id = jsid::voidId();
|
||||
JS::Rooted<jsid> object_id(cx, OBJECT_TO_JSID(JS::CurrentGlobalOrNull(cx)));
|
||||
|
||||
breakpoint();
|
||||
|
|
|
@ -6,7 +6,7 @@ run_fragment('jsid.simple')
|
|||
|
||||
assert_pretty('string_id', '$jsid("moon")')
|
||||
assert_pretty('int_id', '$jsid(1729)')
|
||||
assert_pretty('void_id', 'JSID_VOID')
|
||||
assert_pretty('void_id', 'jsid::voidId()')
|
||||
assert_pretty('object_id', '$jsid((JSObject *) [object global] delegate)')
|
||||
|
||||
run_fragment('jsid.handles')
|
||||
|
|
|
@ -1469,7 +1469,7 @@ DoTypeUpdateFallback(JSContext *cx, BaselineFrame *frame, ICUpdatedStub *stub, H
|
|||
case ICStub::SetElem_Dense:
|
||||
case ICStub::SetElem_DenseAdd: {
|
||||
JS_ASSERT(obj->isNative());
|
||||
id = JSID_VOID;
|
||||
id = jsid::voidId();
|
||||
types::AddTypePropertyId(cx, obj, id, value);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -2013,7 +2013,7 @@ AnalyzePoppedThis(JSContext *cx, types::TypeObject *type,
|
|||
|
||||
// Don't use GetAtomId here, we need to watch for SETPROP on
|
||||
// integer properties and bail out. We can't mark the aggregate
|
||||
// JSID_VOID type property as being in a definite slot.
|
||||
// jsid::voidId() type property as being in a definite slot.
|
||||
if (setprop->name() == cx->names().prototype ||
|
||||
setprop->name() == cx->names().proto ||
|
||||
setprop->name() == cx->names().constructor)
|
||||
|
|
|
@ -5522,7 +5522,7 @@ IonBuilder::jsop_initelem_array()
|
|||
if (!initializer->hasFlags(constraints(), types::OBJECT_FLAG_NON_PACKED))
|
||||
needStub = true;
|
||||
} else if (!initializer->unknownProperties()) {
|
||||
types::HeapTypeSetKey elemTypes = initializer->property(JSID_VOID);
|
||||
types::HeapTypeSetKey elemTypes = initializer->property(jsid::voidId());
|
||||
if (!TypeSetIncludes(elemTypes.maybeTypes(), value->type(), value->resultTypeSet())) {
|
||||
elemTypes.freeze(constraints());
|
||||
needStub = true;
|
||||
|
@ -7627,7 +7627,7 @@ IonBuilder::jsop_setelem_dense(types::TemporaryTypeSet::DoubleConversion convers
|
|||
}
|
||||
|
||||
// Determine whether a write barrier is required.
|
||||
if (obj->resultTypeSet()->propertyNeedsBarrier(constraints(), JSID_VOID))
|
||||
if (obj->resultTypeSet()->propertyNeedsBarrier(constraints(), jsid::voidId()))
|
||||
store->setNeedsBarrier();
|
||||
|
||||
if (elementType != MIRType_None && packed)
|
||||
|
|
|
@ -213,7 +213,7 @@ IonBuilder::inlineArray(CallInfo &callInfo)
|
|||
|
||||
types::TypeObjectKey *type = types::TypeObjectKey::get(templateObject);
|
||||
if (!type->unknownProperties()) {
|
||||
types::HeapTypeSetKey elemTypes = type->property(JSID_VOID);
|
||||
types::HeapTypeSetKey elemTypes = type->property(jsid::voidId());
|
||||
|
||||
for (uint32_t i = 0; i < initLength; i++) {
|
||||
MDefinition *value = callInfo.getArg(i);
|
||||
|
@ -468,7 +468,7 @@ IonBuilder::inlineArrayConcat(CallInfo &callInfo)
|
|||
// Constraints modeling this concat have not been generated by inference,
|
||||
// so check that type information already reflects possible side effects of
|
||||
// this call.
|
||||
types::HeapTypeSetKey thisElemTypes = thisType->property(JSID_VOID);
|
||||
types::HeapTypeSetKey thisElemTypes = thisType->property(jsid::voidId());
|
||||
|
||||
types::TemporaryTypeSet *resTypes = getInlineReturnTypeSet();
|
||||
if (!resTypes->hasType(types::Type::ObjectType(thisType)))
|
||||
|
@ -482,7 +482,7 @@ IonBuilder::inlineArrayConcat(CallInfo &callInfo)
|
|||
if (argType->unknownProperties())
|
||||
return InliningStatus_NotInlined;
|
||||
|
||||
types::HeapTypeSetKey elemTypes = argType->property(JSID_VOID);
|
||||
types::HeapTypeSetKey elemTypes = argType->property(jsid::voidId());
|
||||
if (!elemTypes.knownSubset(constraints(), thisElemTypes))
|
||||
return InliningStatus_NotInlined;
|
||||
}
|
||||
|
@ -958,7 +958,7 @@ IonBuilder::inlineStringSplit(CallInfo &callInfo)
|
|||
if (retType->unknownProperties())
|
||||
return InliningStatus_NotInlined;
|
||||
|
||||
types::HeapTypeSetKey key = retType->property(JSID_VOID);
|
||||
types::HeapTypeSetKey key = retType->property(jsid::voidId());
|
||||
if (!key.maybeTypes())
|
||||
return InliningStatus_NotInlined;
|
||||
|
||||
|
@ -1178,7 +1178,7 @@ IonBuilder::inlineUnsafeSetDenseArrayElement(CallInfo &callInfo, uint32_t base)
|
|||
// - arr is a dense array
|
||||
// - idx < initialized length
|
||||
// Furthermore, note that inlineUnsafePutElements ensures the type of the
|
||||
// value is reflected in the JSID_VOID property of the array.
|
||||
// value is reflected in the jsid::voidId() property of the array.
|
||||
|
||||
MDefinition *obj = callInfo.getArg(base + 0);
|
||||
MDefinition *id = callInfo.getArg(base + 1);
|
||||
|
|
|
@ -2870,7 +2870,7 @@ jit::DenseNativeElementType(types::CompilerConstraintList *constraints, MDefinit
|
|||
if (object->unknownProperties())
|
||||
return MIRType_None;
|
||||
|
||||
types::HeapTypeSetKey elementTypes = object->property(JSID_VOID);
|
||||
types::HeapTypeSetKey elementTypes = object->property(jsid::voidId());
|
||||
|
||||
MIRType type = MIRTypeFromValueType(elementTypes.knownTypeTag(constraints));
|
||||
if (type == MIRType_None)
|
||||
|
@ -2899,7 +2899,7 @@ PropertyReadNeedsTypeBarrier(types::CompilerConstraintList *constraints,
|
|||
if (object->unknownProperties() || observed->empty())
|
||||
return true;
|
||||
|
||||
jsid id = name ? NameToId(name) : JSID_VOID;
|
||||
jsid id = name ? NameToId(name) : jsid::voidId();
|
||||
types::HeapTypeSetKey property = object->property(id);
|
||||
if (property.maybeTypes() && !TypeSetIncludes(observed, MIRType_Value, property.maybeTypes()))
|
||||
return true;
|
||||
|
@ -3073,7 +3073,7 @@ jit::AddObjectsForPropertyRead(MDefinition *obj, PropertyName *name,
|
|||
if (object->unknownProperties())
|
||||
return observed->addType(types::Type::AnyObjectType(), alloc);
|
||||
|
||||
jsid id = name ? NameToId(name) : JSID_VOID;
|
||||
jsid id = name ? NameToId(name) : jsid::voidId();
|
||||
types::HeapTypeSetKey property = object->property(id);
|
||||
types::HeapTypeSet *types = property.maybeTypes();
|
||||
if (!types)
|
||||
|
@ -3114,7 +3114,7 @@ TryAddTypeBarrierForWrite(TempAllocator &alloc, types::CompilerConstraintList *c
|
|||
if (object->unknownProperties())
|
||||
return false;
|
||||
|
||||
jsid id = name ? NameToId(name) : JSID_VOID;
|
||||
jsid id = name ? NameToId(name) : jsid::voidId();
|
||||
types::HeapTypeSetKey property = object->property(id);
|
||||
if (!property.maybeTypes())
|
||||
return false;
|
||||
|
@ -3224,7 +3224,7 @@ jit::PropertyWriteNeedsTypeBarrier(TempAllocator &alloc, types::CompilerConstrai
|
|||
if (IsTypedArrayClass(object->clasp()))
|
||||
continue;
|
||||
|
||||
jsid id = name ? NameToId(name) : JSID_VOID;
|
||||
jsid id = name ? NameToId(name) : jsid::voidId();
|
||||
types::HeapTypeSetKey property = object->property(id);
|
||||
if (!TypeSetIncludes(property.maybeTypes(), (*pvalue)->type(), (*pvalue)->resultTypeSet())) {
|
||||
// Either pobj or pvalue needs to be modified to filter out the
|
||||
|
@ -3256,7 +3256,7 @@ jit::PropertyWriteNeedsTypeBarrier(TempAllocator &alloc, types::CompilerConstrai
|
|||
if (IsTypedArrayClass(object->clasp()))
|
||||
continue;
|
||||
|
||||
jsid id = name ? NameToId(name) : JSID_VOID;
|
||||
jsid id = name ? NameToId(name) : jsid::voidId();
|
||||
types::HeapTypeSetKey property = object->property(id);
|
||||
if (TypeSetIncludes(property.maybeTypes(), (*pvalue)->type(), (*pvalue)->resultTypeSet()))
|
||||
continue;
|
||||
|
|
|
@ -3753,7 +3753,7 @@ JS_NextProperty(JSContext *cx, JSObject *iterobjArg, jsid *idp)
|
|||
|
||||
if (!shape->previous()) {
|
||||
JS_ASSERT(shape->isEmptyShape());
|
||||
*idp = JSID_VOID;
|
||||
*idp = jsid::voidId();
|
||||
} else {
|
||||
iterobj->setPrivateGCThing(const_cast<Shape *>(shape->previous().get()));
|
||||
*idp = shape->propid();
|
||||
|
@ -3764,7 +3764,7 @@ JS_NextProperty(JSContext *cx, JSObject *iterobjArg, jsid *idp)
|
|||
JS_ASSERT(i <= ida->length);
|
||||
STATIC_ASSUME(i <= ida->length);
|
||||
if (i == 0) {
|
||||
*idp = JSID_VOID;
|
||||
*idp = jsid::voidId();
|
||||
} else {
|
||||
*idp = ida->vector[--i];
|
||||
iterobj->setSlot(JSSLOT_ITER_INDEX, Int32Value(i));
|
||||
|
|
|
@ -1200,7 +1200,7 @@ InitArrayTypes(JSContext *cx, TypeObject *type, const Value *vector, unsigned co
|
|||
if (cx->typeInferenceEnabled() && !type->unknownProperties()) {
|
||||
AutoEnterAnalysis enter(cx);
|
||||
|
||||
HeapTypeSet *types = type->getProperty(cx, JSID_VOID);
|
||||
HeapTypeSet *types = type->getProperty(cx, jsid::voidId());
|
||||
if (!types)
|
||||
return false;
|
||||
|
||||
|
|
|
@ -373,7 +373,7 @@ JSCompartment::wrap(JSContext *cx, MutableHandleObject obj, HandleObject existin
|
|||
bool
|
||||
JSCompartment::wrapId(JSContext *cx, jsid *idp)
|
||||
{
|
||||
MOZ_ASSERT(*idp != JSID_VOID, "JSID_VOID is an out-of-band sentinel value");
|
||||
MOZ_ASSERT(*idp != jsid::voidId(), "jsid::voidId() is an out-of-band sentinel value");
|
||||
if (JSID_IS_INT(*idp))
|
||||
return true;
|
||||
RootedValue value(cx, IdToValue(*idp));
|
||||
|
|
|
@ -1255,7 +1255,7 @@ TypeObjectKey::hasFlags(CompilerConstraintList *constraints, TypeObjectFlags fla
|
|||
return true;
|
||||
}
|
||||
|
||||
HeapTypeSetKey objectProperty = property(JSID_EMPTY);
|
||||
HeapTypeSetKey objectProperty = property(jsid::emptyId());
|
||||
LifoAlloc *alloc = constraints->alloc();
|
||||
|
||||
typedef CompilerConstraintInstance<ConstraintDataFreezeObjectFlags> T;
|
||||
|
@ -1299,7 +1299,7 @@ TypeObject::initialHeap(CompilerConstraintList *constraints)
|
|||
if (!canPreTenure())
|
||||
return gc::DefaultHeap;
|
||||
|
||||
HeapTypeSetKey objectProperty = TypeObjectKey::get(this)->property(JSID_EMPTY);
|
||||
HeapTypeSetKey objectProperty = TypeObjectKey::get(this)->property(jsid::emptyId());
|
||||
LifoAlloc *alloc = constraints->alloc();
|
||||
|
||||
typedef CompilerConstraintInstance<ConstraintDataFreezeObjectFlags> T;
|
||||
|
@ -1406,7 +1406,7 @@ class ConstraintDataFreezeObjectForTypedArrayBuffer
|
|||
void
|
||||
TypeObjectKey::watchStateChangeForInlinedCall(CompilerConstraintList *constraints)
|
||||
{
|
||||
HeapTypeSetKey objectProperty = property(JSID_EMPTY);
|
||||
HeapTypeSetKey objectProperty = property(jsid::emptyId());
|
||||
LifoAlloc *alloc = constraints->alloc();
|
||||
|
||||
typedef CompilerConstraintInstance<ConstraintDataFreezeObjectForInlinedCall> T;
|
||||
|
@ -1417,7 +1417,7 @@ void
|
|||
TypeObjectKey::watchStateChangeForNewScriptTemplate(CompilerConstraintList *constraints)
|
||||
{
|
||||
JSObject *templateObject = asTypeObject()->newScript()->templateObject;
|
||||
HeapTypeSetKey objectProperty = property(JSID_EMPTY);
|
||||
HeapTypeSetKey objectProperty = property(jsid::emptyId());
|
||||
LifoAlloc *alloc = constraints->alloc();
|
||||
|
||||
typedef CompilerConstraintInstance<ConstraintDataFreezeObjectForNewScriptTemplate> T;
|
||||
|
@ -1429,7 +1429,7 @@ void
|
|||
TypeObjectKey::watchStateChangeForTypedArrayBuffer(CompilerConstraintList *constraints)
|
||||
{
|
||||
void *viewData = asSingleObject()->as<TypedArrayObject>().viewData();
|
||||
HeapTypeSetKey objectProperty = property(JSID_EMPTY);
|
||||
HeapTypeSetKey objectProperty = property(jsid::emptyId());
|
||||
LifoAlloc *alloc = constraints->alloc();
|
||||
|
||||
typedef CompilerConstraintInstance<ConstraintDataFreezeObjectForTypedArrayBuffer> T;
|
||||
|
@ -1444,7 +1444,7 @@ ObjectStateChange(ExclusiveContext *cxArg, TypeObject *object, bool markingUnkno
|
|||
return;
|
||||
|
||||
/* All constraints listening to state changes are on the empty id. */
|
||||
HeapTypeSet *types = object->maybeGetProperty(JSID_EMPTY);
|
||||
HeapTypeSet *types = object->maybeGetProperty(jsid::emptyId());
|
||||
|
||||
/* Mark as unknown after getting the types, to avoid assertion. */
|
||||
if (markingUnknown) {
|
||||
|
@ -1556,7 +1556,7 @@ TemporaryTypeSet::convertDoubleElements(CompilerConstraintList *constraints)
|
|||
continue;
|
||||
}
|
||||
|
||||
HeapTypeSetKey property = type->property(JSID_VOID);
|
||||
HeapTypeSetKey property = type->property(jsid::voidId());
|
||||
property.freeze(constraints);
|
||||
|
||||
// We can't convert to double elements for objects which do not have
|
||||
|
@ -2035,7 +2035,7 @@ PrototypeHasIndexedProperty(CompilerConstraintList *constraints, JSObject *obj)
|
|||
return true;
|
||||
if (type->unknownProperties())
|
||||
return true;
|
||||
HeapTypeSetKey index = type->property(JSID_VOID);
|
||||
HeapTypeSetKey index = type->property(jsid::voidId());
|
||||
if (index.configured(constraints) || index.isOwnProperty(constraints))
|
||||
return true;
|
||||
if (!obj->hasTenuredProto())
|
||||
|
@ -2366,7 +2366,7 @@ TypeCompartment::setTypeToHomogenousArray(ExclusiveContext *cx,
|
|||
obj->setType(objType);
|
||||
|
||||
if (!objType->unknownProperties())
|
||||
objType->addPropertyType(cx, JSID_VOID, elementType);
|
||||
objType->addPropertyType(cx, jsid::voidId(), elementType);
|
||||
|
||||
key.proto = objProto;
|
||||
if (!p.add(*arrayTypeTable, key, objType)) {
|
||||
|
@ -2716,7 +2716,7 @@ UpdatePropertyType(ExclusiveContext *cx, HeapTypeSet *types, JSObject *obj, Shap
|
|||
|
||||
/*
|
||||
* Don't add initial undefined types for properties of global objects
|
||||
* that are not collated into the JSID_VOID property (see propertySet
|
||||
* that are not collated into the jsid::voidId() property (see propertySet
|
||||
* comment).
|
||||
*/
|
||||
if (indexed || !value.isUndefined() || !CanHaveEmptyPropertyTypesForOwnProperty(obj)) {
|
||||
|
@ -2872,7 +2872,7 @@ TypeObject::addPropertyType(ExclusiveContext *cx, jsid id, const Value &value)
|
|||
void
|
||||
TypeObject::addPropertyType(ExclusiveContext *cx, const char *name, Type type)
|
||||
{
|
||||
jsid id = JSID_VOID;
|
||||
jsid id = jsid::voidId();
|
||||
if (name) {
|
||||
JSAtom *atom = Atomize(cx, name, strlen(name));
|
||||
if (!atom) {
|
||||
|
@ -2919,7 +2919,7 @@ TypeObject::markStateChange(ExclusiveContext *cxArg)
|
|||
return;
|
||||
|
||||
AutoEnterAnalysis enter(cxArg);
|
||||
HeapTypeSet *types = maybeGetProperty(JSID_EMPTY);
|
||||
HeapTypeSet *types = maybeGetProperty(jsid::emptyId());
|
||||
if (types) {
|
||||
if (JSContext *cx = cxArg->maybeJSContext()) {
|
||||
TypeConstraint *constraint = types->constraintList;
|
||||
|
|
|
@ -330,7 +330,7 @@ public:
|
|||
virtual void newPropertyState(JSContext *cx, TypeSet *source) {}
|
||||
|
||||
/*
|
||||
* For constraints attached to the JSID_EMPTY type set on an object,
|
||||
* For constraints attached to the jsid::emptyId() type set on an object,
|
||||
* indicate a change in one of the object's dynamic property flags or other
|
||||
* state.
|
||||
*/
|
||||
|
@ -731,7 +731,7 @@ inline bool isInlinableCall(jsbytecode *pc);
|
|||
/* Type information about a property. */
|
||||
struct Property
|
||||
{
|
||||
/* Identifier for this property, JSID_VOID for the aggregate integer index property. */
|
||||
/* Identifier for this property, jsid::voidId() for the aggregate integer index property. */
|
||||
HeapId id;
|
||||
|
||||
/* Possible types for this property, including types inherited from prototypes. */
|
||||
|
@ -1005,8 +1005,8 @@ struct TypeObject : gc::BarrieredCell<TypeObject>
|
|||
|
||||
private:
|
||||
/*
|
||||
* Properties of this object. This may contain JSID_VOID, representing the
|
||||
* types of all integer indexes of the object, and/or JSID_EMPTY, holding
|
||||
* Properties of this object. This may contain jsid::voidId(), representing the
|
||||
* types of all integer indexes of the object, and/or jsid::emptyId(), holding
|
||||
* constraints listening to changes to the object's state.
|
||||
*
|
||||
* The type sets in the properties of a type object describe the possible
|
||||
|
@ -1381,7 +1381,7 @@ class HeapTypeSetKey
|
|||
|
||||
public:
|
||||
HeapTypeSetKey()
|
||||
: object_(nullptr), id_(JSID_EMPTY), maybeTypes_(nullptr)
|
||||
: object_(nullptr), id_(jsid::emptyId()), maybeTypes_(nullptr)
|
||||
{}
|
||||
|
||||
TypeObjectKey *object() const { return object_; }
|
||||
|
|
|
@ -170,7 +170,7 @@ IdToTypeId(jsid id)
|
|||
* negative integers.
|
||||
*/
|
||||
if (JSID_IS_INT(id))
|
||||
return JSID_VOID;
|
||||
return jsid::voidId();
|
||||
|
||||
/*
|
||||
* Check for numeric strings, as in js_StringIsIndex, but allow negative
|
||||
|
@ -184,12 +184,12 @@ IdToTypeId(jsid id)
|
|||
if (!JS7_ISDEC(cp[i]))
|
||||
return id;
|
||||
}
|
||||
return JSID_VOID;
|
||||
return jsid::voidId();
|
||||
}
|
||||
return id;
|
||||
}
|
||||
|
||||
return JSID_VOID;
|
||||
return jsid::voidId();
|
||||
}
|
||||
|
||||
const char * TypeIdStringImpl(jsid id);
|
||||
|
|
|
@ -153,7 +153,7 @@ JSObject::setShouldConvertDoubleElements()
|
|||
inline bool
|
||||
JSObject::setDenseElementIfHasType(uint32_t index, const js::Value &val)
|
||||
{
|
||||
if (!js::types::HasTypePropertyId(this, JSID_VOID, val))
|
||||
if (!js::types::HasTypePropertyId(this, jsid::voidId(), val))
|
||||
return false;
|
||||
setDenseElementMaybeConvertDouble(index, val);
|
||||
return true;
|
||||
|
@ -167,7 +167,7 @@ JSObject::setDenseElementWithType(js::ExclusiveContext *cx, uint32_t index,
|
|||
// of the previous element.
|
||||
js::types::Type thisType = js::types::GetValueType(val);
|
||||
if (index == 0 || js::types::GetValueType(elements[index - 1]) != thisType)
|
||||
js::types::AddTypePropertyId(cx, this, JSID_VOID, thisType);
|
||||
js::types::AddTypePropertyId(cx, this, jsid::voidId(), thisType);
|
||||
setDenseElementMaybeConvertDouble(index, val);
|
||||
}
|
||||
|
||||
|
@ -176,7 +176,7 @@ JSObject::initDenseElementWithType(js::ExclusiveContext *cx, uint32_t index,
|
|||
const js::Value &val)
|
||||
{
|
||||
JS_ASSERT(!shouldConvertDoubleElements());
|
||||
js::types::AddTypePropertyId(cx, this, JSID_VOID, val);
|
||||
js::types::AddTypePropertyId(cx, this, jsid::voidId(), val);
|
||||
initDenseElement(index, val);
|
||||
}
|
||||
|
||||
|
|
|
@ -226,7 +226,7 @@ BaseProxyHandler::set(JSContext *cx, HandleObject proxy, HandleObject receiver,
|
|||
bool
|
||||
BaseProxyHandler::keys(JSContext *cx, HandleObject proxy, AutoIdVector &props)
|
||||
{
|
||||
assertEnteredPolicy(cx, proxy, JSID_VOID);
|
||||
assertEnteredPolicy(cx, proxy, jsid::voidId());
|
||||
JS_ASSERT(props.length() == 0);
|
||||
|
||||
if (!getOwnPropertyNames(cx, proxy, props))
|
||||
|
@ -255,7 +255,7 @@ BaseProxyHandler::keys(JSContext *cx, HandleObject proxy, AutoIdVector &props)
|
|||
bool
|
||||
BaseProxyHandler::iterate(JSContext *cx, HandleObject proxy, unsigned flags, MutableHandleValue vp)
|
||||
{
|
||||
assertEnteredPolicy(cx, proxy, JSID_VOID);
|
||||
assertEnteredPolicy(cx, proxy, jsid::voidId());
|
||||
|
||||
AutoIdVector props(cx);
|
||||
if ((flags & JSITER_OWNONLY)
|
||||
|
@ -318,7 +318,7 @@ BaseProxyHandler::nativeCall(JSContext *cx, IsAcceptableThis test, NativeImpl im
|
|||
bool
|
||||
BaseProxyHandler::hasInstance(JSContext *cx, HandleObject proxy, MutableHandleValue v, bool *bp)
|
||||
{
|
||||
assertEnteredPolicy(cx, proxy, JSID_VOID);
|
||||
assertEnteredPolicy(cx, proxy, jsid::voidId());
|
||||
RootedValue val(cx, ObjectValue(*proxy.get()));
|
||||
js_ReportValueError(cx, JSMSG_BAD_INSTANCEOF_RHS,
|
||||
JSDVG_SEARCH_STACK, val, NullPtr());
|
||||
|
@ -376,7 +376,7 @@ bool
|
|||
BaseProxyHandler::slice(JSContext *cx, HandleObject proxy, uint32_t begin, uint32_t end,
|
||||
HandleObject result)
|
||||
{
|
||||
assertEnteredPolicy(cx, proxy, JSID_VOID);
|
||||
assertEnteredPolicy(cx, proxy, jsid::voidId());
|
||||
|
||||
RootedId id(cx);
|
||||
RootedValue value(cx);
|
||||
|
@ -451,7 +451,7 @@ bool
|
|||
DirectProxyHandler::getOwnPropertyNames(JSContext *cx, HandleObject proxy,
|
||||
AutoIdVector &props)
|
||||
{
|
||||
assertEnteredPolicy(cx, proxy, JSID_VOID);
|
||||
assertEnteredPolicy(cx, proxy, jsid::voidId());
|
||||
RootedObject target(cx, proxy->as<ProxyObject>().target());
|
||||
return GetPropertyNames(cx, target, JSITER_OWNONLY | JSITER_HIDDEN, &props);
|
||||
}
|
||||
|
@ -468,7 +468,7 @@ bool
|
|||
DirectProxyHandler::enumerate(JSContext *cx, HandleObject proxy,
|
||||
AutoIdVector &props)
|
||||
{
|
||||
assertEnteredPolicy(cx, proxy, JSID_VOID);
|
||||
assertEnteredPolicy(cx, proxy, jsid::voidId());
|
||||
JS_ASSERT(!hasPrototype()); // Should never be called if there's a prototype.
|
||||
RootedObject target(cx, proxy->as<ProxyObject>().target());
|
||||
return GetPropertyNames(cx, target, 0, &props);
|
||||
|
@ -477,7 +477,7 @@ DirectProxyHandler::enumerate(JSContext *cx, HandleObject proxy,
|
|||
bool
|
||||
DirectProxyHandler::call(JSContext *cx, HandleObject proxy, const CallArgs &args)
|
||||
{
|
||||
assertEnteredPolicy(cx, proxy, JSID_VOID);
|
||||
assertEnteredPolicy(cx, proxy, jsid::voidId());
|
||||
RootedValue target(cx, proxy->as<ProxyObject>().private_());
|
||||
return Invoke(cx, args.thisv(), target, args.length(), args.array(), args.rval());
|
||||
}
|
||||
|
@ -485,7 +485,7 @@ DirectProxyHandler::call(JSContext *cx, HandleObject proxy, const CallArgs &args
|
|||
bool
|
||||
DirectProxyHandler::construct(JSContext *cx, HandleObject proxy, const CallArgs &args)
|
||||
{
|
||||
assertEnteredPolicy(cx, proxy, JSID_VOID);
|
||||
assertEnteredPolicy(cx, proxy, jsid::voidId());
|
||||
RootedValue target(cx, proxy->as<ProxyObject>().private_());
|
||||
return InvokeConstructor(cx, target, args.length(), args.array(), args.rval().address());
|
||||
}
|
||||
|
@ -507,7 +507,7 @@ bool
|
|||
DirectProxyHandler::hasInstance(JSContext *cx, HandleObject proxy, MutableHandleValue v,
|
||||
bool *bp)
|
||||
{
|
||||
assertEnteredPolicy(cx, proxy, JSID_VOID);
|
||||
assertEnteredPolicy(cx, proxy, jsid::voidId());
|
||||
bool b;
|
||||
RootedObject target(cx, proxy->as<ProxyObject>().target());
|
||||
if (!JS_HasInstance(cx, target, v, &b))
|
||||
|
@ -541,7 +541,7 @@ DirectProxyHandler::objectClassIs(HandleObject proxy, ESClassValue classValue,
|
|||
const char *
|
||||
DirectProxyHandler::className(JSContext *cx, HandleObject proxy)
|
||||
{
|
||||
assertEnteredPolicy(cx, proxy, JSID_VOID);
|
||||
assertEnteredPolicy(cx, proxy, jsid::voidId());
|
||||
RootedObject target(cx, proxy->as<ProxyObject>().target());
|
||||
return JSObject::className(cx, target);
|
||||
}
|
||||
|
@ -550,7 +550,7 @@ JSString *
|
|||
DirectProxyHandler::fun_toString(JSContext *cx, HandleObject proxy,
|
||||
unsigned indent)
|
||||
{
|
||||
assertEnteredPolicy(cx, proxy, JSID_VOID);
|
||||
assertEnteredPolicy(cx, proxy, jsid::voidId());
|
||||
RootedObject target(cx, proxy->as<ProxyObject>().target());
|
||||
return fun_toStringHelper(cx, target, indent);
|
||||
}
|
||||
|
@ -620,7 +620,7 @@ DirectProxyHandler::set(JSContext *cx, HandleObject proxy, HandleObject receiver
|
|||
bool
|
||||
DirectProxyHandler::keys(JSContext *cx, HandleObject proxy, AutoIdVector &props)
|
||||
{
|
||||
assertEnteredPolicy(cx, proxy, JSID_VOID);
|
||||
assertEnteredPolicy(cx, proxy, jsid::voidId());
|
||||
RootedObject target(cx, proxy->as<ProxyObject>().target());
|
||||
return GetPropertyNames(cx, target, JSITER_OWNONLY, &props);
|
||||
}
|
||||
|
@ -629,7 +629,7 @@ bool
|
|||
DirectProxyHandler::iterate(JSContext *cx, HandleObject proxy, unsigned flags,
|
||||
MutableHandleValue vp)
|
||||
{
|
||||
assertEnteredPolicy(cx, proxy, JSID_VOID);
|
||||
assertEnteredPolicy(cx, proxy, jsid::voidId());
|
||||
JS_ASSERT(!hasPrototype()); // Should never be called if there's a prototype.
|
||||
RootedObject target(cx, proxy->as<ProxyObject>().target());
|
||||
return GetIterator(cx, target, flags, vp);
|
||||
|
@ -1046,7 +1046,7 @@ ScriptedIndirectProxyHandler::iterate(JSContext *cx, HandleObject proxy, unsigne
|
|||
bool
|
||||
ScriptedIndirectProxyHandler::call(JSContext *cx, HandleObject proxy, const CallArgs &args)
|
||||
{
|
||||
assertEnteredPolicy(cx, proxy, JSID_VOID);
|
||||
assertEnteredPolicy(cx, proxy, jsid::voidId());
|
||||
RootedObject ccHolder(cx, &proxy->as<ProxyObject>().extra(0).toObject());
|
||||
JS_ASSERT(ccHolder->getClass() == &CallConstructHolder);
|
||||
RootedValue call(cx, ccHolder->getReservedSlot(0));
|
||||
|
@ -1057,7 +1057,7 @@ ScriptedIndirectProxyHandler::call(JSContext *cx, HandleObject proxy, const Call
|
|||
bool
|
||||
ScriptedIndirectProxyHandler::construct(JSContext *cx, HandleObject proxy, const CallArgs &args)
|
||||
{
|
||||
assertEnteredPolicy(cx, proxy, JSID_VOID);
|
||||
assertEnteredPolicy(cx, proxy, jsid::voidId());
|
||||
RootedObject ccHolder(cx, &proxy->as<ProxyObject>().extra(0).toObject());
|
||||
JS_ASSERT(ccHolder->getClass() == &CallConstructHolder);
|
||||
RootedValue construct(cx, ccHolder->getReservedSlot(1));
|
||||
|
@ -1076,7 +1076,7 @@ ScriptedIndirectProxyHandler::nativeCall(JSContext *cx, IsAcceptableThis test, N
|
|||
JSString *
|
||||
ScriptedIndirectProxyHandler::fun_toString(JSContext *cx, HandleObject proxy, unsigned indent)
|
||||
{
|
||||
assertEnteredPolicy(cx, proxy, JSID_VOID);
|
||||
assertEnteredPolicy(cx, proxy, jsid::voidId());
|
||||
if (!proxy->isCallable()) {
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr,
|
||||
JSMSG_INCOMPATIBLE_PROTO,
|
||||
|
|
|
@ -130,7 +130,7 @@ class JS_FRIEND_API(BaseProxyHandler)
|
|||
*
|
||||
* enter() allows the policy to specify whether the caller may perform |act|
|
||||
* on the proxy's |id| property. In the case when |act| is CALL, |id| is
|
||||
* generally JSID_VOID.
|
||||
* generally jsid::voidId().
|
||||
*
|
||||
* The |act| parameter to enter() specifies the action being performed.
|
||||
* If |bp| is false, the trap suggests that the caller throw (though it
|
||||
|
|
|
@ -4996,7 +4996,7 @@ DebuggerObject_defineProperties(JSContext *cx, unsigned argc, Value *vp)
|
|||
ac.construct(cx, obj);
|
||||
RootedId id(cx);
|
||||
for (size_t i = 0; i < n; i++) {
|
||||
if (!rewrappedIds.append(JSID_VOID) || !rewrappedDescs.append())
|
||||
if (!rewrappedIds.append(jsid::voidId()) || !rewrappedDescs.append())
|
||||
return false;
|
||||
id = ids[i];
|
||||
if (!unwrappedDescs[i].wrapInto(cx, obj, id, &rewrappedIds[i], &rewrappedDescs[i]))
|
||||
|
|
|
@ -7,11 +7,9 @@
|
|||
#include "js/Id.h"
|
||||
#include "js/RootingAPI.h"
|
||||
|
||||
const jsid JSID_VOID = { size_t(JSID_TYPE_VOID) };
|
||||
const jsid JSID_EMPTY = { size_t(JSID_TYPE_OBJECT) };
|
||||
static MOZ_CONSTEXPR_VAR jsid voidIdValue = jsid::voidId();
|
||||
static MOZ_CONSTEXPR_VAR jsid emptyIdValue = jsid::emptyId();
|
||||
|
||||
static const jsid voidIdValue = JSID_VOID;
|
||||
static const jsid emptyIdValue = JSID_EMPTY;
|
||||
const JS::HandleId JSID_VOIDHANDLE = JS::HandleId::fromMarkedLocation(&voidIdValue);
|
||||
const JS::HandleId JSID_EMPTYHANDLE = JS::HandleId::fromMarkedLocation(&emptyIdValue);
|
||||
|
||||
|
|
|
@ -688,7 +688,7 @@ js::NewReshapedObject(JSContext *cx, HandleTypeObject type, JSObject *parent,
|
|||
js::AutoIdVector ids(cx);
|
||||
{
|
||||
for (unsigned i = 0; i <= shape->slot(); i++) {
|
||||
if (!ids.append(JSID_VOID))
|
||||
if (!ids.append(jsid::voidId()))
|
||||
return nullptr;
|
||||
}
|
||||
Shape *nshape = shape;
|
||||
|
|
|
@ -1594,7 +1594,7 @@ Shape::Shape(const StackShape &other, uint32_t nfixed)
|
|||
inline
|
||||
Shape::Shape(UnownedBaseShape *base, uint32_t nfixed)
|
||||
: base_(base),
|
||||
propid_(JSID_EMPTY),
|
||||
propid_(jsid::emptyId()),
|
||||
slotInfo(SHAPE_INVALID_SLOT | (nfixed << FIXED_SLOTS_SHIFT)),
|
||||
attrs(JSPROP_SHARED),
|
||||
flags(0),
|
||||
|
|
|
@ -957,7 +957,7 @@ class StaticStrings
|
|||
* - uint32_t indexes,
|
||||
* - PropertyName strings which don't encode uint32_t indexes, and
|
||||
* - jsspecial special properties (non-ES5 properties like object-valued
|
||||
* jsids, JSID_EMPTY, JSID_VOID, and maybe in the future Harmony-proposed
|
||||
* jsids, EmptyId(), VoidId(), and maybe in the future Harmony-proposed
|
||||
* private names).
|
||||
*/
|
||||
class PropertyName : public JSAtom
|
||||
|
|
|
@ -1456,7 +1456,7 @@ JSStructuredCloneReader::readId(jsid *idp)
|
|||
return true;
|
||||
}
|
||||
if (tag == SCTAG_NULL) {
|
||||
*idp = JSID_VOID;
|
||||
*idp = jsid::voidId();
|
||||
return true;
|
||||
}
|
||||
JS_ReportErrorNumber(context(), js_GetErrorMessage, nullptr,
|
||||
|
|
|
@ -20,7 +20,7 @@ XPCCallContext::XPCCallContext(XPCContext::LangType callerLanguage,
|
|||
JSContext* cx /* = GetDefaultJSContext() */,
|
||||
HandleObject obj /* = nullptr */,
|
||||
HandleObject funobj /* = nullptr */,
|
||||
HandleId name /* = JSID_VOID */,
|
||||
HandleId name /* = jsid::voidId() */,
|
||||
unsigned argc /* = NO_ARGS */,
|
||||
jsval *argv /* = nullptr */,
|
||||
jsval *rval /* = nullptr */)
|
||||
|
|
|
@ -2908,7 +2908,7 @@ XPCJSRuntime::XPCJSRuntime(nsXPConnect* aXPConnect)
|
|||
mJSContextStack(new XPCJSContextStack()),
|
||||
mCallContext(nullptr),
|
||||
mAutoRoots(nullptr),
|
||||
mResolveName(JSID_VOID),
|
||||
mResolveName(jsid::voidId()),
|
||||
mResolvingWrapper(nullptr),
|
||||
mWrappedJSMap(JSObject2WrappedJSMap::newMap(XPC_JS_MAP_SIZE)),
|
||||
mWrappedJSClassMap(IID2WrappedJSClassMap::newMap(XPC_JS_CLASS_MAP_SIZE)),
|
||||
|
@ -2933,7 +2933,7 @@ XPCJSRuntime::XPCJSRuntime(nsXPConnect* aXPConnect)
|
|||
DOM_InitInterfaces();
|
||||
|
||||
// these jsids filled in later when we have a JSContext to work with.
|
||||
mStrIDs[0] = JSID_VOID;
|
||||
mStrIDs[0] = jsid::voidId();
|
||||
|
||||
MOZ_ASSERT(Runtime());
|
||||
JSRuntime* runtime = Runtime();
|
||||
|
@ -3134,7 +3134,7 @@ XPCJSRuntime::OnJSContextNew(JSContext *cx)
|
|||
for (unsigned i = 0; i < IDX_TOTAL_COUNT; i++) {
|
||||
str = JS_InternString(cx, mStrings[i]);
|
||||
if (!str) {
|
||||
mStrIDs[0] = JSID_VOID;
|
||||
mStrIDs[0] = jsid::voidId();
|
||||
return false;
|
||||
}
|
||||
mStrIDs[i] = INTERNED_STRING_TO_JSID(cx, str);
|
||||
|
|
|
@ -209,7 +209,7 @@ GetMethodInfo(JSContext *cx, jsval *vp, const char **ifaceNamep, jsid *memberIdp
|
|||
MOZ_ASSERT(JS_ObjectIsFunction(cx, funobj),
|
||||
"JSNative callee should be Function object");
|
||||
RootedString str(cx, JS_GetFunctionId(JS_GetObjectFunction(funobj)));
|
||||
RootedId methodId(cx, str ? INTERNED_STRING_TO_JSID(cx, str) : JSID_VOID);
|
||||
RootedId methodId(cx, str ? INTERNED_STRING_TO_JSID(cx, str) : jsid::voidId());
|
||||
GetMemberInfo(JSVAL_TO_OBJECT(vp[1]), methodId, ifaceNamep);
|
||||
*memberIdp = methodId;
|
||||
}
|
||||
|
@ -353,7 +353,7 @@ void
|
|||
xpc_qsThrowBadArgWithDetails(JSContext *cx, nsresult rv, unsigned paramnum,
|
||||
const char *ifaceName, const char *memberName)
|
||||
{
|
||||
ThrowBadArg(cx, rv, ifaceName, JSID_VOID, memberName, paramnum);
|
||||
ThrowBadArg(cx, rv, ifaceName, jsid::voidId(), memberName, paramnum);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -196,7 +196,7 @@ def print_cpp_file(fd, conf):
|
|||
fd.write("\nusing namespace mozilla::idl;\n\n")
|
||||
|
||||
for a in attrnames:
|
||||
fd.write("static jsid %s = JSID_VOID;\n"% get_jsid(a))
|
||||
fd.write("static jsid %s = jsid::voidId();\n"% get_jsid(a))
|
||||
|
||||
fd.write("\n"
|
||||
"static bool\n"
|
||||
|
|
|
@ -3448,7 +3448,7 @@ public:
|
|||
CreateObjectInOptions(JSContext *cx = xpc_GetSafeJSContext(),
|
||||
JSObject* options = nullptr)
|
||||
: OptionsBase(cx, options)
|
||||
, defineAs(cx, JSID_VOID)
|
||||
, defineAs(cx, jsid::voidId())
|
||||
{ }
|
||||
|
||||
virtual bool Parse() { return ParseId("defineAs", &defineAs); };
|
||||
|
@ -3461,7 +3461,7 @@ public:
|
|||
ExportOptions(JSContext *cx = xpc_GetSafeJSContext(),
|
||||
JSObject* options = nullptr)
|
||||
: OptionsBase(cx, options)
|
||||
, defineAs(cx, JSID_VOID)
|
||||
, defineAs(cx, jsid::voidId())
|
||||
{ }
|
||||
|
||||
virtual bool Parse() { return ParseId("defineAs", &defineAs); };
|
||||
|
|
|
@ -217,12 +217,12 @@ AccessCheck::isCrossOriginAccessPermitted(JSContext *cx, JSObject *wrapperArg, j
|
|||
RootedObject wrapper(cx, wrapperArg);
|
||||
RootedObject obj(cx, Wrapper::wrappedObject(wrapper));
|
||||
|
||||
// Enumerate-like operations pass JSID_VOID to |enter|, since there isn't
|
||||
// Enumerate-like operations pass jsid::voidId() to |enter|, since there isn't
|
||||
// another sane value to pass. For XOWs, we generally want to deny such
|
||||
// operations but fail silently (see CrossOriginAccessiblePropertiesOnly::
|
||||
// deny). We could just fall through here and rely on the fact that none
|
||||
// of the whitelisted properties below will match JSID_VOID, but EIBTI.
|
||||
if (id == JSID_VOID)
|
||||
// of the whitelisted properties below will match jsid::voidId(), but EIBTI.
|
||||
if (id == jsid::voidId())
|
||||
return false;
|
||||
|
||||
const char *name;
|
||||
|
@ -315,7 +315,7 @@ ExposedPropertiesOnly::check(JSContext *cx, JSObject *wrapperArg, jsid idArg, Wr
|
|||
return false;
|
||||
}
|
||||
|
||||
if (id == JSID_VOID)
|
||||
if (id == jsid::voidId())
|
||||
return true;
|
||||
|
||||
RootedValue exposedProps(cx);
|
||||
|
|
|
@ -178,7 +178,7 @@ ChromeObjectWrapper::enter(JSContext *cx, HandleObject wrapper,
|
|||
// COWs fail silently for GETs, and that also happens to be the only case
|
||||
// where we might want to redirect the lookup to the home prototype chain.
|
||||
*bp = (act == Wrapper::GET);
|
||||
if (!*bp || id == JSID_VOID)
|
||||
if (!*bp || id == jsid::voidId())
|
||||
return false;
|
||||
|
||||
// Note that PropIsFromStandardPrototype needs to invoke getPropertyDescriptor
|
||||
|
|
|
@ -87,7 +87,7 @@ bool
|
|||
FilteringWrapper<Base, Policy>::getOwnPropertyNames(JSContext *cx, HandleObject wrapper,
|
||||
AutoIdVector &props)
|
||||
{
|
||||
assertEnteredPolicy(cx, wrapper, JSID_VOID);
|
||||
assertEnteredPolicy(cx, wrapper, jsid::voidId());
|
||||
return Base::getOwnPropertyNames(cx, wrapper, props) &&
|
||||
Filter<Policy>(cx, wrapper, props);
|
||||
}
|
||||
|
@ -97,7 +97,7 @@ bool
|
|||
FilteringWrapper<Base, Policy>::enumerate(JSContext *cx, HandleObject wrapper,
|
||||
AutoIdVector &props)
|
||||
{
|
||||
assertEnteredPolicy(cx, wrapper, JSID_VOID);
|
||||
assertEnteredPolicy(cx, wrapper, jsid::voidId());
|
||||
return Base::enumerate(cx, wrapper, props) &&
|
||||
Filter<Policy>(cx, wrapper, props);
|
||||
}
|
||||
|
@ -107,7 +107,7 @@ bool
|
|||
FilteringWrapper<Base, Policy>::keys(JSContext *cx, HandleObject wrapper,
|
||||
AutoIdVector &props)
|
||||
{
|
||||
assertEnteredPolicy(cx, wrapper, JSID_VOID);
|
||||
assertEnteredPolicy(cx, wrapper, jsid::voidId());
|
||||
return Base::keys(cx, wrapper, props) &&
|
||||
Filter<Policy>(cx, wrapper, props);
|
||||
}
|
||||
|
@ -117,7 +117,7 @@ bool
|
|||
FilteringWrapper<Base, Policy>::iterate(JSContext *cx, HandleObject wrapper,
|
||||
unsigned flags, MutableHandleValue vp)
|
||||
{
|
||||
assertEnteredPolicy(cx, wrapper, JSID_VOID);
|
||||
assertEnteredPolicy(cx, wrapper, jsid::voidId());
|
||||
// We refuse to trigger the iterator hook across chrome wrappers because
|
||||
// we don't know how to censor custom iterator objects. Instead we trigger
|
||||
// the default proxy iterate trap, which will ask enumerate() for the list
|
||||
|
|
|
@ -1648,7 +1648,7 @@ bool
|
|||
XrayWrapper<Base, Traits>::getOwnPropertyNames(JSContext *cx, HandleObject wrapper,
|
||||
AutoIdVector &props)
|
||||
{
|
||||
assertEnteredPolicy(cx, wrapper, JSID_VOID);
|
||||
assertEnteredPolicy(cx, wrapper, jsid::voidId());
|
||||
return enumerate(cx, wrapper, JSITER_OWNONLY | JSITER_HIDDEN, props);
|
||||
}
|
||||
|
||||
|
@ -1675,7 +1675,7 @@ bool
|
|||
XrayWrapper<Base, Traits>::enumerate(JSContext *cx, HandleObject wrapper, unsigned flags,
|
||||
AutoIdVector &props)
|
||||
{
|
||||
assertEnteredPolicy(cx, wrapper, JSID_VOID);
|
||||
assertEnteredPolicy(cx, wrapper, jsid::voidId());
|
||||
if (!AccessCheck::wrapperSubsumes(wrapper)) {
|
||||
JS_ReportError(cx, "Not allowed to enumerate cross origin objects");
|
||||
return false;
|
||||
|
@ -1768,7 +1768,7 @@ template <typename Base, typename Traits>
|
|||
bool
|
||||
XrayWrapper<Base, Traits>::call(JSContext *cx, HandleObject wrapper, const JS::CallArgs &args)
|
||||
{
|
||||
assertEnteredPolicy(cx, wrapper, JSID_VOID);
|
||||
assertEnteredPolicy(cx, wrapper, jsid::voidId());
|
||||
return Traits::call(cx, wrapper, args, Base::singleton);
|
||||
}
|
||||
|
||||
|
@ -1776,7 +1776,7 @@ template <typename Base, typename Traits>
|
|||
bool
|
||||
XrayWrapper<Base, Traits>::construct(JSContext *cx, HandleObject wrapper, const JS::CallArgs &args)
|
||||
{
|
||||
assertEnteredPolicy(cx, wrapper, JSID_VOID);
|
||||
assertEnteredPolicy(cx, wrapper, jsid::voidId());
|
||||
return Traits::construct(cx, wrapper, args, Base::singleton);
|
||||
}
|
||||
|
||||
|
|
|
@ -785,7 +785,7 @@ struct ClearJSHolder : TraceCallbacks
|
|||
|
||||
virtual void Trace(JS::Heap<jsid>* aPtr, const char*, void*) const MOZ_OVERRIDE
|
||||
{
|
||||
*aPtr = JSID_VOID;
|
||||
*aPtr = jsid::voidId();
|
||||
}
|
||||
|
||||
virtual void Trace(JS::Heap<JSObject*>* aPtr, const char*, void*) const MOZ_OVERRIDE
|
||||
|
|
Загрузка…
Ссылка в новой задаче