For register-rich ABIs (e.g. x86-64 and ARM), QueryInterface's incoming
registers are going to look like:
arg register 1: |this|
arg register 2: the IID of interest
arg register 3: the outparam instance pointer
Most of our QI implementations call NS_TableDrivenQI, which expects
arguments like so:
arg register 1: |this|
arg register 2: the QITableEntry table
arg register 3: the IID of interest
arg register 4: the outparam instance pointer
So we're going to have to do a register shuffle of the IID and the
outparam to be able to load the QITableEntry pointer before calling into
NS_TableDrivenQI.
This patch reorders the argument list of NS_TableDrivenQI so that the
first three arguments match the order that QueryInterface receives them
in. Then your typical QueryInterface implementation becomes:
- load local |table|
- tail-call NS_TableDrivenQI
Eliminating the register shuffling reduces text size by 12K on an
Android ARM build.