Optimizing: Introduce {Increase,Decrease}Frame().

And use it to clean up code generators.

Also fix CFI in MaybeIncrementHotness() for arm/arm64/x86.

Test: m test-art-host-gtest
Test: testrunner.py --host --optimizing
Test: testrunner.py --host --debuggable --ndebuggable \
          --optimizing --jit --jit-on-first-use -t 178
Test: aosp_cf_x86_phone-userdebug boots.
Test: aosp_cf_x86_phone-userdebug/jitzygote boots.
Test: # On blueline:
      testrunner.py --target --debuggable --ndebuggable \
          --optimizing --jit --jit-on-first-use -t 178
Bug: 112189621
Change-Id: I524e6c3054ffe1b05e2860fd7988cd9995df2963
diff --git a/compiler/optimizing/code_generator.h b/compiler/optimizing/code_generator.h
index 4bfc14a..12e2e97 100644
--- a/compiler/optimizing/code_generator.h
+++ b/compiler/optimizing/code_generator.h
@@ -573,12 +573,12 @@
   template <typename CriticalNativeCallingConventionVisitor,
             size_t kNativeStackAlignment,
             size_t GetCriticalNativeDirectCallFrameSize(const char* shorty, uint32_t shorty_len)>
-  static size_t PrepareCriticalNativeCall(HInvokeStaticOrDirect* invoke,
-                                          /*out*/HParallelMove* parallel_move) {
+  size_t PrepareCriticalNativeCall(HInvokeStaticOrDirect* invoke) {
       DCHECK(!invoke->GetLocations()->Intrinsified());
       CriticalNativeCallingConventionVisitor calling_convention_visitor(
           /*for_register_allocation=*/ false);
-      PrepareCriticalNativeArgumentMoves(invoke, &calling_convention_visitor, parallel_move);
+      HParallelMove parallel_move(GetGraph()->GetAllocator());
+      PrepareCriticalNativeArgumentMoves(invoke, &calling_convention_visitor, &parallel_move);
       size_t out_frame_size =
           RoundUp(calling_convention_visitor.GetStackOffset(), kNativeStackAlignment);
       if (kIsDebugBuild) {
@@ -587,7 +587,7 @@
         DCHECK_EQ(GetCriticalNativeDirectCallFrameSize(shorty, shorty_len), out_frame_size);
       }
       if (out_frame_size != 0u) {
-        AdjustCriticalNativeArgumentMoves(out_frame_size, parallel_move);
+        FinishCriticalNativeFrameSetup(out_frame_size, &parallel_move);
       }
       return out_frame_size;
   }
@@ -690,6 +690,9 @@
   // Copy the result of a call into the given target.
   virtual void MoveFromReturnRegister(Location trg, DataType::Type type) = 0;
 
+  virtual void IncreaseFrame(size_t adjustment) = 0;
+  virtual void DecreaseFrame(size_t adjustment) = 0;
+
   virtual void GenerateNop() = 0;
 
   static QuickEntrypointEnum GetArrayAllocationEntrypoint(HNewArray* new_array);
@@ -826,8 +829,7 @@
       /*inout*/InvokeDexCallingConventionVisitor* visitor,
       /*out*/HParallelMove* parallel_move);
 
-  static void AdjustCriticalNativeArgumentMoves(size_t out_frame_size,
-                                                /*inout*/HParallelMove* parallel_move);
+  void FinishCriticalNativeFrameSetup(size_t out_frame_size, /*inout*/HParallelMove* parallel_move);
 
   static const char* GetCriticalNativeShorty(HInvokeStaticOrDirect* invoke, uint32_t* shorty_len);