mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-06 07:48:38 +09:00
1370210 - obj_propertyIsEnumerable calls non-inlined IsSymbolOrSymbolWrapper
1370210 - Optimize ValueToId and ValueToIdPure to check the common cases first
This commit is contained in:
parent
35ca1152a7
commit
e6b7d6698b
1 changed files with 24 additions and 14 deletions
|
|
@ -49,6 +49,13 @@ AtomToId(JSAtom* atom)
|
|||
inline bool
|
||||
ValueToIdPure(const Value& v, jsid* id)
|
||||
{
|
||||
if (v.isString()) {
|
||||
if (v.toString()->isAtom()) {
|
||||
*id = AtomToId(&v.toString()->asAtom());
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
int32_t i;
|
||||
if (ValueFitsInInt32(v, &i) && INT_FITS_IN_JSID(i)) {
|
||||
*id = INT_TO_JSID(i);
|
||||
|
|
@ -60,11 +67,7 @@ ValueToIdPure(const Value& v, jsid* id)
|
|||
return true;
|
||||
}
|
||||
|
||||
if (!v.isString() || !v.toString()->isAtom())
|
||||
return false;
|
||||
|
||||
*id = AtomToId(&v.toString()->asAtom());
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
template <AllowGC allowGC>
|
||||
|
|
@ -72,15 +75,22 @@ inline bool
|
|||
ValueToId(ExclusiveContext* cx, typename MaybeRooted<Value, allowGC>::HandleType v,
|
||||
typename MaybeRooted<jsid, allowGC>::MutableHandleType idp)
|
||||
{
|
||||
int32_t i;
|
||||
if (ValueFitsInInt32(v, &i) && INT_FITS_IN_JSID(i)) {
|
||||
idp.set(INT_TO_JSID(i));
|
||||
return true;
|
||||
}
|
||||
if (v.isString()) {
|
||||
if (v.toString()->isAtom()) {
|
||||
idp.set(AtomToId(&v.toString()->asAtom()));
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
int32_t i;
|
||||
if (ValueFitsInInt32(v, &i) && INT_FITS_IN_JSID(i)) {
|
||||
idp.set(INT_TO_JSID(i));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (js::IsSymbolOrSymbolWrapper(v)) {
|
||||
idp.set(SYMBOL_TO_JSID(js::ToSymbolPrimitive(v)));
|
||||
return true;
|
||||
if (js::IsSymbolOrSymbolWrapper(v)) {
|
||||
idp.set(SYMBOL_TO_JSID(js::ToSymbolPrimitive(v)));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
JSAtom* atom = ToAtom<allowGC>(cx, v);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue