The code for s::jit::AssemblerBufferWithConstantPools::hasSpaceForInsts is being executed every time we call vixl::MozBaseAssembler::nextInstrOffset, which implies that we do it for every instruction. The problem is that this logic is quite complex and adds a lot of code to be executed for each instruction. I suspect that we could simplify this logic by computing ahead the offset at which a pool should be inserted to satisfy all the registered constants. Therefore replacing all the math of hasSpaceForInsts and moving them to the point where a constant is registered in the constant pool. At the end hasSpaceForInsts should look something along the lines of: inline bool hasSpaceForInsts(size_t numInsts) { return nextOffset + numInsts * InstSize < nextPoolOffset; } Additionally, we should also move largest/slow functions of AssemblerBufferWithConstantPools to some cpp files.
Bug 1518214 Comment 0 Edit History
Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.
The code for s::jit::AssemblerBufferWithConstantPools::hasSpaceForInsts is being executed every time we call vixl::MozBaseAssembler::nextInstrOffset, which implies that we do it for every instruction. The problem is that this logic is quite complex and adds a lot of code to be executed for each instruction. I suspect that we could simplify this logic by computing ahead the offset at which a pool should be inserted to satisfy all the registered constants. Therefore replacing all the math of hasSpaceForInsts and moving them to the point where a constant is registered in the constant pool. At the end hasSpaceForInsts should look something along the lines of: ```c++ inline bool hasSpaceForInsts(size_t numInsts) { return nextOffset + numInsts * InstSize < nextPoolOffset; } ``` Additionally, we should also move largest/slow functions of AssemblerBufferWithConstantPools to some cpp files.