For the 32-bit TransferBatch:
- SetFromArray callers have bounds count, so relax the CHECK to DCHECK;
- same for Add;
- mark CopyToArray as const;
For the 32-bit Primary:
- {Dea,A}llocateBatch are only called from places that check class_id, relax the CHECK to DCHECK;
- same for AllocateRegion;
- remove GetRegionBeginBySizeClass that is not used;
- use a local variable for the random shuffle state, so that the compiler can use a register instead of reading and writing to the SizeClassInfo at every iteration;
For the 32-bit local cache:
- pass the count to drain instead of doing a Min everytime which is at times superfluous.
Drain(c, allocator, class_id, c->count / 2); is the same, but reads a bit easier, more logical ("drain half of the elements").