зеркало из https://github.com/mozilla/gecko-dev.git
Bug 942453 - Handlify IndexToId. r=terrence
This commit is contained in:
Родитель
068d38b770
Коммит
56d2495c20
|
@ -2336,7 +2336,7 @@ TypedDatum::obj_deleteElement(JSContext *cx, HandleObject obj, uint32_t index,
|
|||
bool *succeeded)
|
||||
{
|
||||
RootedId id(cx);
|
||||
if (!IndexToId(cx, index, id.address()))
|
||||
if (!IndexToId(cx, index, &id))
|
||||
return false;
|
||||
|
||||
if (IsOwnId(cx, obj, id))
|
||||
|
|
|
@ -2805,7 +2805,7 @@ JS_LookupElement(JSContext *cx, JSObject *objArg, uint32_t index, MutableHandleV
|
|||
RootedObject obj(cx, objArg);
|
||||
CHECK_REQUEST(cx);
|
||||
RootedId id(cx);
|
||||
if (!IndexToId(cx, index, id.address()))
|
||||
if (!IndexToId(cx, index, &id))
|
||||
return false;
|
||||
return JS_LookupPropertyById(cx, obj, id, vp);
|
||||
}
|
||||
|
@ -2880,7 +2880,7 @@ JS_HasElement(JSContext *cx, JSObject *objArg, uint32_t index, bool *foundp)
|
|||
AssertHeapIsIdle(cx);
|
||||
CHECK_REQUEST(cx);
|
||||
RootedId id(cx);
|
||||
if (!IndexToId(cx, index, id.address()))
|
||||
if (!IndexToId(cx, index, &id))
|
||||
return false;
|
||||
return JS_HasPropertyById(cx, obj, id, foundp);
|
||||
}
|
||||
|
@ -2936,7 +2936,7 @@ JS_AlreadyHasOwnElement(JSContext *cx, JSObject *objArg, uint32_t index, bool *f
|
|||
AssertHeapIsIdle(cx);
|
||||
CHECK_REQUEST(cx);
|
||||
RootedId id(cx);
|
||||
if (!IndexToId(cx, index, id.address()))
|
||||
if (!IndexToId(cx, index, &id))
|
||||
return false;
|
||||
return JS_AlreadyHasOwnPropertyById(cx, obj, id, foundp);
|
||||
}
|
||||
|
@ -3078,7 +3078,7 @@ JS_DefineElement(JSContext *cx, JSObject *objArg, uint32_t index, jsval valueArg
|
|||
AssertHeapIsIdle(cx);
|
||||
CHECK_REQUEST(cx);
|
||||
RootedId id(cx);
|
||||
if (!IndexToId(cx, index, id.address()))
|
||||
if (!IndexToId(cx, index, &id))
|
||||
return false;
|
||||
return DefinePropertyById(cx, obj, id, value, GetterWrapper(getter),
|
||||
SetterWrapper(setter), attrs, 0, 0);
|
||||
|
@ -6049,7 +6049,7 @@ BOOL WINAPI DllMain (HINSTANCE hDLL, DWORD dwReason, LPVOID lpReserved)
|
|||
JS_PUBLIC_API(bool)
|
||||
JS_IndexToId(JSContext *cx, uint32_t index, MutableHandleId id)
|
||||
{
|
||||
return IndexToId(cx, index, id.address());
|
||||
return IndexToId(cx, index, id);
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(bool)
|
||||
|
|
|
@ -137,7 +137,7 @@ static bool
|
|||
ToId(JSContext *cx, double index, MutableHandleId id)
|
||||
{
|
||||
if (index == uint32_t(index))
|
||||
return IndexToId(cx, uint32_t(index), id.address());
|
||||
return IndexToId(cx, uint32_t(index), id);
|
||||
|
||||
Value tmp = DoubleValue(index);
|
||||
return ValueToId<CanGC>(cx, HandleValue::fromMarkedLocation(&tmp), id);
|
||||
|
@ -146,7 +146,7 @@ ToId(JSContext *cx, double index, MutableHandleId id)
|
|||
static bool
|
||||
ToId(JSContext *cx, uint32_t index, MutableHandleId id)
|
||||
{
|
||||
return IndexToId(cx, index, id.address());
|
||||
return IndexToId(cx, index, id);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -161,7 +161,6 @@ DoGetElement(JSContext *cx, HandleObject obj, HandleObject receiver,
|
|||
IndexType index, bool *hole, MutableHandleValue vp)
|
||||
{
|
||||
RootedId id(cx);
|
||||
|
||||
if (!ToId(cx, index, &id))
|
||||
return false;
|
||||
|
||||
|
@ -718,7 +717,7 @@ js::ArraySetLength(typename ExecutionModeTraits<mode>::ContextType cxArg,
|
|||
// returned from the function before step 15 above.
|
||||
JSContext *cx = cxArg->asJSContext();
|
||||
RootedId elementId(cx);
|
||||
if (!IndexToId(cx, newLen - 1, elementId.address()))
|
||||
if (!IndexToId(cx, newLen - 1, &elementId))
|
||||
return false;
|
||||
return arr->reportNotConfigurable(cx, elementId);
|
||||
}
|
||||
|
|
|
@ -391,7 +391,7 @@ js::AtomizeChars(ExclusiveContext *cx, const jschar *chars, size_t length, Inter
|
|||
}
|
||||
|
||||
bool
|
||||
js::IndexToIdSlow(ExclusiveContext *cx, uint32_t index, jsid *idp)
|
||||
js::IndexToIdSlow(ExclusiveContext *cx, uint32_t index, MutableHandleId idp)
|
||||
{
|
||||
JS_ASSERT(index > JSID_INT_MAX);
|
||||
|
||||
|
@ -403,7 +403,7 @@ js::IndexToIdSlow(ExclusiveContext *cx, uint32_t index, jsid *idp)
|
|||
if (!atom)
|
||||
return false;
|
||||
|
||||
*idp = JSID_FROM_BITS((size_t)atom);
|
||||
idp.set(JSID_FROM_BITS((size_t)atom));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -105,30 +105,19 @@ BackfillIndexInCharBuffer(uint32_t index, mozilla::RangedPtr<T> end)
|
|||
}
|
||||
|
||||
bool
|
||||
IndexToIdSlow(ExclusiveContext *cx, uint32_t index, jsid *idp);
|
||||
IndexToIdSlow(ExclusiveContext *cx, uint32_t index, MutableHandleId idp);
|
||||
|
||||
inline bool
|
||||
IndexToId(ExclusiveContext *cx, uint32_t index, jsid *idp)
|
||||
IndexToId(ExclusiveContext *cx, uint32_t index, MutableHandleId idp)
|
||||
{
|
||||
if (index <= JSID_INT_MAX) {
|
||||
*idp = INT_TO_JSID(index);
|
||||
idp.set(INT_TO_JSID(index));
|
||||
return true;
|
||||
}
|
||||
|
||||
return IndexToIdSlow(cx, index, idp);
|
||||
}
|
||||
|
||||
inline bool
|
||||
IndexToIdPure(uint32_t index, jsid *idp)
|
||||
{
|
||||
if (index <= JSID_INT_MAX) {
|
||||
*idp = INT_TO_JSID(index);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static JS_ALWAYS_INLINE JSFlatString *
|
||||
IdToString(JSContext *cx, jsid id)
|
||||
{
|
||||
|
|
|
@ -1124,7 +1124,7 @@ bool
|
|||
js_SuppressDeletedElement(JSContext *cx, HandleObject obj, uint32_t index)
|
||||
{
|
||||
RootedId id(cx);
|
||||
if (!IndexToId(cx, index, id.address()))
|
||||
if (!IndexToId(cx, index, &id))
|
||||
return false;
|
||||
return js_SuppressDeletedProperty(cx, obj, id);
|
||||
}
|
||||
|
|
|
@ -1685,7 +1685,7 @@ JSObject::nonNativeSetElement(JSContext *cx, HandleObject obj,
|
|||
{
|
||||
if (JS_UNLIKELY(obj->watched())) {
|
||||
RootedId id(cx);
|
||||
if (!IndexToId(cx, index, id.address()))
|
||||
if (!IndexToId(cx, index, &id))
|
||||
return false;
|
||||
|
||||
WatchpointMap *wpmap = cx->compartment()->watchpointMap;
|
||||
|
@ -3269,7 +3269,7 @@ bool
|
|||
baseops::DefineElement(ExclusiveContext *cx, HandleObject obj, uint32_t index, HandleValue value,
|
||||
PropertyOp getter, StrictPropertyOp setter, unsigned attrs)
|
||||
{
|
||||
Rooted<jsid> id(cx);
|
||||
RootedId id(cx);
|
||||
if (index <= JSID_INT_MAX) {
|
||||
id = INT_TO_JSID(index);
|
||||
return DefineNativeProperty(cx, obj, id, value, getter, setter, attrs, 0, 0);
|
||||
|
@ -3277,7 +3277,7 @@ baseops::DefineElement(ExclusiveContext *cx, HandleObject obj, uint32_t index, H
|
|||
|
||||
AutoRooterGetterSetter gsRoot(cx, attrs, &getter, &setter);
|
||||
|
||||
if (!IndexToId(cx, index, id.address()))
|
||||
if (!IndexToId(cx, index, &id))
|
||||
return false;
|
||||
|
||||
return DefineNativeProperty(cx, obj, id, value, getter, setter, attrs, 0, 0);
|
||||
|
@ -3867,7 +3867,7 @@ baseops::LookupElement(JSContext *cx, HandleObject obj, uint32_t index,
|
|||
MutableHandleObject objp, MutableHandleShape propp)
|
||||
{
|
||||
RootedId id(cx);
|
||||
if (!IndexToId(cx, index, id.address()))
|
||||
if (!IndexToId(cx, index, &id))
|
||||
return false;
|
||||
|
||||
return LookupPropertyWithFlagsInline<CanGC>(cx, obj, id, cx->resolveFlags, objp, propp);
|
||||
|
@ -4406,11 +4406,9 @@ static bool
|
|||
JS_ALWAYS_INLINE
|
||||
GetElementPure(ThreadSafeContext *cx, JSObject *obj, uint32_t index, Value *vp)
|
||||
{
|
||||
jsid id;
|
||||
if (!IndexToIdPure(index, &id))
|
||||
return false;
|
||||
|
||||
return GetPropertyPure(cx, obj, id, vp);
|
||||
if (index <= JSID_INT_MAX)
|
||||
return GetPropertyPure(cx, obj, INT_TO_JSID(index), vp);
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -4442,7 +4440,7 @@ baseops::GetElement(JSContext *cx, HandleObject obj, HandleObject receiver, uint
|
|||
MutableHandleValue vp)
|
||||
{
|
||||
RootedId id(cx);
|
||||
if (!IndexToId(cx, index, id.address()))
|
||||
if (!IndexToId(cx, index, &id))
|
||||
return false;
|
||||
|
||||
/* This call site is hot -- use the always-inlined variant of js_GetPropertyHelper(). */
|
||||
|
@ -4823,7 +4821,7 @@ baseops::SetElementHelper(JSContext *cx, HandleObject obj, HandleObject receiver
|
|||
unsigned defineHow, MutableHandleValue vp, bool strict)
|
||||
{
|
||||
RootedId id(cx);
|
||||
if (!IndexToId(cx, index, id.address()))
|
||||
if (!IndexToId(cx, index, &id))
|
||||
return false;
|
||||
return baseops::SetPropertyHelper<SequentialExecution>(cx, obj, receiver, id, defineHow, vp,
|
||||
strict);
|
||||
|
@ -4928,7 +4926,7 @@ bool
|
|||
baseops::DeleteElement(JSContext *cx, HandleObject obj, uint32_t index, bool *succeeded)
|
||||
{
|
||||
RootedId id(cx);
|
||||
if (!IndexToId(cx, index, id.address()))
|
||||
if (!IndexToId(cx, index, &id))
|
||||
return false;
|
||||
return baseops::DeleteGeneric(cx, obj, id, succeeded);
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ JSObject::deleteProperty(JSContext *cx, js::HandleObject obj, js::HandleProperty
|
|||
/* static */ inline bool
|
||||
JSObject::deleteElement(JSContext *cx, js::HandleObject obj, uint32_t index, bool *succeeded)
|
||||
{
|
||||
jsid id;
|
||||
JS::RootedId id(cx);
|
||||
if (!js::IndexToId(cx, index, &id))
|
||||
return false;
|
||||
js::types::MarkTypePropertyConfigured(cx, obj, id);
|
||||
|
@ -621,7 +621,7 @@ JSObject::getElement(JSContext *cx, js::HandleObject obj, js::HandleObject recei
|
|||
return op(cx, obj, receiver, index, vp);
|
||||
|
||||
JS::RootedId id(cx);
|
||||
if (!js::IndexToId(cx, index, id.address()))
|
||||
if (!js::IndexToId(cx, index, &id))
|
||||
return false;
|
||||
return getGeneric(cx, obj, receiver, id, vp);
|
||||
}
|
||||
|
@ -634,10 +634,9 @@ JSObject::getElementNoGC(JSContext *cx, JSObject *obj, JSObject *receiver,
|
|||
if (op)
|
||||
return false;
|
||||
|
||||
jsid id;
|
||||
if (!js::IndexToId(cx, index, &id))
|
||||
if (index > JSID_INT_MAX)
|
||||
return false;
|
||||
return getGenericNoGC(cx, obj, receiver, id, vp);
|
||||
return getGenericNoGC(cx, obj, receiver, INT_TO_JSID(index), vp);
|
||||
}
|
||||
|
||||
inline js::GlobalObject &
|
||||
|
|
|
@ -688,7 +688,7 @@ Walk(JSContext *cx, HandleObject holder, HandleId name, HandleValue reviver, Mut
|
|||
RootedId id(cx);
|
||||
RootedValue newElement(cx);
|
||||
for (uint32_t i = 0; i < length; i++) {
|
||||
if (!IndexToId(cx, i, id.address()))
|
||||
if (!IndexToId(cx, i, &id))
|
||||
return false;
|
||||
|
||||
/* Step 2a(iii)(1). */
|
||||
|
|
|
@ -381,7 +381,7 @@ BaseProxyHandler::slice(JSContext *cx, HandleObject proxy, uint32_t begin, uint3
|
|||
RootedId id(cx);
|
||||
RootedValue value(cx);
|
||||
for (uint32_t index = begin; index < end; index++) {
|
||||
if (!IndexToId(cx, index, id.address()))
|
||||
if (!IndexToId(cx, index, &id))
|
||||
return false;
|
||||
|
||||
bool present;
|
||||
|
@ -2820,7 +2820,7 @@ static bool
|
|||
proxy_LookupProperty(JSContext *cx, HandleObject obj, HandlePropertyName name,
|
||||
MutableHandleObject objp, MutableHandleShape propp)
|
||||
{
|
||||
Rooted<jsid> id(cx, NameToId(name));
|
||||
RootedId id(cx, NameToId(name));
|
||||
return proxy_LookupGeneric(cx, obj, id, objp, propp);
|
||||
}
|
||||
|
||||
|
@ -2829,7 +2829,7 @@ proxy_LookupElement(JSContext *cx, HandleObject obj, uint32_t index,
|
|||
MutableHandleObject objp, MutableHandleShape propp)
|
||||
{
|
||||
RootedId id(cx);
|
||||
if (!IndexToId(cx, index, id.address()))
|
||||
if (!IndexToId(cx, index, &id))
|
||||
return false;
|
||||
return proxy_LookupGeneric(cx, obj, id, objp, propp);
|
||||
}
|
||||
|
@ -2838,7 +2838,7 @@ static bool
|
|||
proxy_LookupSpecial(JSContext *cx, HandleObject obj, HandleSpecialId sid,
|
||||
MutableHandleObject objp, MutableHandleShape propp)
|
||||
{
|
||||
Rooted<jsid> id(cx, SPECIALID_TO_JSID(sid));
|
||||
RootedId id(cx, SPECIALID_TO_JSID(sid));
|
||||
return proxy_LookupGeneric(cx, obj, id, objp, propp);
|
||||
}
|
||||
|
||||
|
@ -2869,7 +2869,7 @@ proxy_DefineElement(JSContext *cx, HandleObject obj, uint32_t index, HandleValue
|
|||
PropertyOp getter, StrictPropertyOp setter, unsigned attrs)
|
||||
{
|
||||
RootedId id(cx);
|
||||
if (!IndexToId(cx, index, id.address()))
|
||||
if (!IndexToId(cx, index, &id))
|
||||
return false;
|
||||
return proxy_DefineGeneric(cx, obj, id, value, getter, setter, attrs);
|
||||
}
|
||||
|
@ -2902,7 +2902,7 @@ proxy_GetElement(JSContext *cx, HandleObject obj, HandleObject receiver, uint32_
|
|||
MutableHandleValue vp)
|
||||
{
|
||||
RootedId id(cx);
|
||||
if (!IndexToId(cx, index, id.address()))
|
||||
if (!IndexToId(cx, index, &id))
|
||||
return false;
|
||||
return proxy_GetGeneric(cx, obj, receiver, id, vp);
|
||||
}
|
||||
|
@ -2935,7 +2935,7 @@ proxy_SetElement(JSContext *cx, HandleObject obj, uint32_t index,
|
|||
MutableHandleValue vp, bool strict)
|
||||
{
|
||||
RootedId id(cx);
|
||||
if (!IndexToId(cx, index, id.address()))
|
||||
if (!IndexToId(cx, index, &id))
|
||||
return false;
|
||||
return proxy_SetGeneric(cx, obj, id, vp, strict);
|
||||
}
|
||||
|
@ -2982,7 +2982,7 @@ proxy_DeleteGeneric(JSContext *cx, HandleObject obj, HandleId id, bool *succeede
|
|||
static bool
|
||||
proxy_DeleteProperty(JSContext *cx, HandleObject obj, HandlePropertyName name, bool *succeeded)
|
||||
{
|
||||
Rooted<jsid> id(cx, NameToId(name));
|
||||
RootedId id(cx, NameToId(name));
|
||||
return proxy_DeleteGeneric(cx, obj, id, succeeded);
|
||||
}
|
||||
|
||||
|
@ -2990,7 +2990,7 @@ static bool
|
|||
proxy_DeleteElement(JSContext *cx, HandleObject obj, uint32_t index, bool *succeeded)
|
||||
{
|
||||
RootedId id(cx);
|
||||
if (!IndexToId(cx, index, id.address()))
|
||||
if (!IndexToId(cx, index, &id))
|
||||
return false;
|
||||
return proxy_DeleteGeneric(cx, obj, id, succeeded);
|
||||
}
|
||||
|
@ -2998,7 +2998,7 @@ proxy_DeleteElement(JSContext *cx, HandleObject obj, uint32_t index, bool *succe
|
|||
static bool
|
||||
proxy_DeleteSpecial(JSContext *cx, HandleObject obj, HandleSpecialId sid, bool *succeeded)
|
||||
{
|
||||
Rooted<jsid> id(cx, SPECIALID_TO_JSID(sid));
|
||||
RootedId id(cx, SPECIALID_TO_JSID(sid));
|
||||
return proxy_DeleteGeneric(cx, obj, id, succeeded);
|
||||
}
|
||||
|
||||
|
|
|
@ -396,7 +396,7 @@ with_LookupElement(JSContext *cx, HandleObject obj, uint32_t index,
|
|||
MutableHandleObject objp, MutableHandleShape propp)
|
||||
{
|
||||
RootedId id(cx);
|
||||
if (!IndexToId(cx, index, id.address()))
|
||||
if (!IndexToId(cx, index, &id))
|
||||
return false;
|
||||
return with_LookupGeneric(cx, obj, id, objp, propp);
|
||||
}
|
||||
|
@ -405,7 +405,7 @@ static bool
|
|||
with_LookupSpecial(JSContext *cx, HandleObject obj, HandleSpecialId sid,
|
||||
MutableHandleObject objp, MutableHandleShape propp)
|
||||
{
|
||||
Rooted<jsid> id(cx, SPECIALID_TO_JSID(sid));
|
||||
RootedId id(cx, SPECIALID_TO_JSID(sid));
|
||||
return with_LookupGeneric(cx, obj, id, objp, propp);
|
||||
}
|
||||
|
||||
|
@ -421,7 +421,7 @@ static bool
|
|||
with_GetProperty(JSContext *cx, HandleObject obj, HandleObject receiver, HandlePropertyName name,
|
||||
MutableHandleValue vp)
|
||||
{
|
||||
Rooted<jsid> id(cx, NameToId(name));
|
||||
RootedId id(cx, NameToId(name));
|
||||
return with_GetGeneric(cx, obj, receiver, id, vp);
|
||||
}
|
||||
|
||||
|
@ -430,7 +430,7 @@ with_GetElement(JSContext *cx, HandleObject obj, HandleObject receiver, uint32_t
|
|||
MutableHandleValue vp)
|
||||
{
|
||||
RootedId id(cx);
|
||||
if (!IndexToId(cx, index, id.address()))
|
||||
if (!IndexToId(cx, index, &id))
|
||||
return false;
|
||||
return with_GetGeneric(cx, obj, receiver, id, vp);
|
||||
}
|
||||
|
@ -439,7 +439,7 @@ static bool
|
|||
with_GetSpecial(JSContext *cx, HandleObject obj, HandleObject receiver, HandleSpecialId sid,
|
||||
MutableHandleValue vp)
|
||||
{
|
||||
Rooted<jsid> id(cx, SPECIALID_TO_JSID(sid));
|
||||
RootedId id(cx, SPECIALID_TO_JSID(sid));
|
||||
return with_GetGeneric(cx, obj, receiver, id, vp);
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче