Bug 1694685 part 1 - Add static_assert for JSPropertySpec size. r=tcampbell

There are multiple (nested) unions so the size isn't obvious.
Adding a sanity check helps catch regressions.

Differential Revision: https://phabricator.services.mozilla.com/D106406
This commit is contained in:
Jan de Mooij 2021-03-08 12:07:13 +00:00
Родитель 30d171d273
Коммит 8fed47db9b
1 изменённых файлов: 8 добавлений и 0 удалений

Просмотреть файл

@ -339,6 +339,14 @@ struct JSPropertySpec {
}
};
// There can be many JSPropertySpec instances so verify the size is what we
// expect:
//
// - Name (1 word)
// - Flags (1 word)
// - AccessorsOrValue (4 words, native + JSJitInfo for both getter and setter)
static_assert(sizeof(JSPropertySpec) == 6 * sizeof(uintptr_t));
#define JS_CHECK_ACCESSOR_FLAGS(flags) \
(static_cast<std::enable_if_t<((flags) & ~(JSPROP_ENUMERATE | \
JSPROP_PERMANENT)) == 0>>(0), \