Bug 711563 - reduce space required by hash entry chains; r=jorendorff

This commit is contained in:
Nathan Froyd 2011-12-16 14:49:53 -05:00
Родитель 0a1c43dbd0
Коммит b19568f2e7
2 изменённых файлов: 6 добавлений и 3 удалений

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

@ -49,7 +49,7 @@
class XPCCallContext;
#define XPC_QS_NULL_INDEX ((size_t) -1)
#define XPC_QS_NULL_INDEX ((uint16_t) -1)
struct xpc_qsPropertySpec {
const char *name;
@ -76,8 +76,8 @@ struct xpc_qsHashEntry {
const xpc_qsFunctionSpec *functions;
// These last two fields index to other entries in the same table.
// XPC_QS_NULL_ENTRY indicates there are no more entries in the chain.
size_t parentInterface;
size_t chain;
uint16_t parentInterface;
uint16_t chain;
};
inline nsISupports*

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

@ -1235,6 +1235,9 @@ def writeDefiner(f, conf, interfaces):
f.write("static const xpc_qsHashEntry tableData[] = {\n")
f.write(",\n".join(entries))
f.write("\n };\n\n")
f.write("// Make sure our table indices aren't overflowed\n"
"PR_STATIC_ASSERT((sizeof(tableData) / sizeof(tableData[0])) < (1 << (8 * sizeof(tableData[0].parentInterface))));\n"
"PR_STATIC_ASSERT((sizeof(tableData) / sizeof(tableData[0])) < (1 << (8 * sizeof(tableData[0].chain))));\n\n")
# the definer function (entry point to this quick stubs file)
f.write("JSBool %s_DefineQuickStubs(" % conf.name)