arm64: Implement VarHandle CAS intrinsics.

And refactor Unsafe CAS intrinsics for code reuse.

Add extra tests to the 160-read-barrier-stress to test the
slow paths. The main path is sufficiently exercised by the
712-varhandle-invocations test. The refactored Unsafe CAS is
already covered by 004-Unsafe and 160-read-barrier-stress.

Using benchmarks provided by
    https://android-review.googlesource.com/1420959
on blueline little cores with fixed frequency 1420800:
                                           before after
CompareAndSetStaticFieldInt                24.721 0.026
CompareAndSetStaticFieldString             29.015 0.032
CompareAndSetFieldInt                      27.237 0.028
CompareAndSetFieldString                   31.326 0.033
WeakCompareAndSetStaticFieldInt            24.735 0.027
WeakCompareAndSetStaticFieldString         28.970 0.031
WeakCompareAndSetFieldInt                  27.252 0.028
WeakCompareAndSetFieldString               31.309 0.036
WeakCompareAndSetPlainStaticFieldInt       24.738 0.026
WeakCompareAndSetPlainStaticFieldString    29.004 0.030
WeakCompareAndSetPlainFieldInt             27.252 0.027
WeakCompareAndSetPlainFieldString          31.326 0.035
WeakCompareAndSetAcquireStaticFieldInt     24.728 0.026
WeakCompareAndSetAcquireStaticFieldString  28.977 0.030
WeakCompareAndSetAcquireFieldInt           27.250 0.027
WeakCompareAndSetAcquireFieldString        31.306 0.034
WeakCompareAndSetReleaseStaticFieldInt     24.738 0.026
WeakCompareAndSetReleaseStaticFieldString  28.994 0.032
WeakCompareAndSetReleaseFieldInt           27.250 0.028
WeakCompareAndSetReleaseFieldString        31.312 0.035
CompareAndExchangeStaticFieldInt           23.898 0.026
CompareAndExchangeStaticFieldString        28.544 0.032
CompareAndExchangeFieldInt                 26.787 0.027
CompareAndExchangeFieldString              31.022 0.034
CompareAndExchangeAcquireStaticFieldInt    23.957 0.026
CompareAndExchangeAcquireStaticFieldString 28.586 0.031
CompareAndExchangeAcquireFieldInt          26.785 0.026
CompareAndExchangeAcquireFieldString       31.011 0.033
CompareAndExchangeReleaseStaticFieldInt    23.963 0.026
CompareAndExchangeReleaseStaticFieldString 28.511 0.032
CompareAndExchangeReleaseFieldInt          26.729 0.027
CompareAndExchangeReleaseFieldString       30.938 0.034

Test: testrunner.py --target --64 --optimizing
Test: Repeat with ART_USE_READ_BARRIER=false ART_HEAP_POISONING=true.
Test: Repeat with ART_READ_BARRIER_TYPE=TABLELOOKUP.
      (Ignore two pre-existing checker test failures.)
Bug: 71781600
Change-Id: I01b2218bb812bc636a941f9bd67c844aee5f8b41
10 files changed