Optimize layout function jit cache flushing