Simplify method id handling when recording method trace events

When recording method trace events, we assign a method id to each
newly seen method and use the method index when recording the events
corresponding to that method. We were looking up this id multiple times
when recording events in tracing mode. This CL changes it so we only
look it up once. This improves the performance on golem benchmarks by
around 20%.

This CL also removes unique_methods_ that we maintained. We instead use
a current_method_index_ to assign id to a newly seen method. The reverse
lookups from method id to method would be more expensive but we only do
those for logging which is rarely enabled.

Bug: 259258187
Test: art/test.py
Change-Id: I9049719f88ac41901a1c9cced4b9e9d1971a9eb2
2 files changed