Collect array classes in profiles.

Collect array classes including primitive array classes for
boot class path profile. Do not exclude resolved erroneous
classes, they can still be useful as resolved even if the
runtime intialization fails.

Optimize the performance, especially the time we need to
hold the mutator lock. Use that fact that most `ArtMethod`
members can be queried without the mutator lock.
Remove the GC critical section as it is unnecessary.

(cherry picked from commit dd446b17bedb28838f5866f7c29fb47265f332fc)

Test: Collect a profile by manually running steps from
      BootImageProfileTest#testSystemServerProfile,
      pull and dump the profile and check that there are
      many array classes, including "[[[B" and "[[[I".
Test: m test-art-host-gtest
Test: testrunner.py --host --optimizing --speed-profile
Bug: 148067697
Merged-In: I76276d61551c16f532a0e34289bab4acb61b30c6
Change-Id: I0156b5ce27d14248606b5587505edb278a2a9c86
7 files changed