зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1052491 - Simplify IdToTypeId and add support for symbol-keyed properties. r=bhackett.
--HG-- extra : rebase_source : ee5bfd8e415aa9570e773662889d815c91636f57
This commit is contained in:
Родитель
f57dbeff7d
Коммит
4f932a4821
|
@ -194,28 +194,6 @@ TypeFlagPrimitive(TypeFlags flags)
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Check for numeric strings, as in js_StringIsIndex, but allow negative
|
||||
* and overflowing integers.
|
||||
*/
|
||||
template <class Range>
|
||||
inline bool
|
||||
IdIsNumericTypeId(Range cp)
|
||||
{
|
||||
if (cp.length() == 0)
|
||||
return false;
|
||||
|
||||
if (!JS7_ISDEC(cp[0]) && cp[0] != '-')
|
||||
return false;
|
||||
|
||||
for (size_t i = 1; i < cp.length(); ++i) {
|
||||
if (!JS7_ISDEC(cp[i]))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get the canonical representation of an id to use when doing inference. This
|
||||
* maintains the constraint that if two different jsids map to the same property
|
||||
|
@ -226,23 +204,9 @@ IdToTypeId(jsid id)
|
|||
{
|
||||
JS_ASSERT(!JSID_IS_EMPTY(id));
|
||||
|
||||
/*
|
||||
* All integers must map to the aggregate property for index types, including
|
||||
* negative integers.
|
||||
*/
|
||||
if (JSID_IS_INT(id))
|
||||
return JSID_VOID;
|
||||
|
||||
if (JSID_IS_STRING(id)) {
|
||||
JSAtom *atom = JSID_TO_ATOM(id);
|
||||
JS::AutoCheckCannotGC nogc;
|
||||
bool isNumeric = atom->hasLatin1Chars()
|
||||
? IdIsNumericTypeId(atom->latin1Range(nogc))
|
||||
: IdIsNumericTypeId(atom->twoByteRange(nogc));
|
||||
return isNumeric ? JSID_VOID : id;
|
||||
}
|
||||
|
||||
return JSID_VOID;
|
||||
// All properties which can be stored in an object's dense elements must
|
||||
// map to the aggregate property for index types.
|
||||
return JSID_IS_INT(id) ? JSID_VOID : id;
|
||||
}
|
||||
|
||||
const char * TypeIdStringImpl(jsid id);
|
||||
|
|
Загрузка…
Ссылка в новой задаче