Add Thread::optimize_(stub|entry) to runtime_api.h

Bug: https://github.com/dart-lang/sdk/issues/36839
Change-Id: Iab35c6bb322492872577545aaacc5147a76f2708
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/105920
Auto-Submit: Liam Appelbe <liama@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
diff --git a/runtime/vm/compiler/backend/flow_graph_compiler_arm.cc b/runtime/vm/compiler/backend/flow_graph_compiler_arm.cc
index 7b8e5e8..4c56935 100644
--- a/runtime/vm/compiler/backend/flow_graph_compiler_arm.cc
+++ b/runtime/vm/compiler/backend/flow_graph_compiler_arm.cc
@@ -883,7 +883,8 @@
     }
     __ CompareImmediate(R3, GetOptimizationThreshold());
     ASSERT(function_reg == R8);
-    __ Branch(Address(THR, Thread::optimize_entry_offset()), GE);
+    __ Branch(Address(THR, compiler::target::Thread::optimize_entry_offset()),
+              GE);
   }
   __ Comment("Enter frame");
   if (flow_graph().IsCompiledForOsr()) {
diff --git a/runtime/vm/compiler/runtime_api.h b/runtime/vm/compiler/runtime_api.h
index f6231ce..5f0f76b 100644
--- a/runtime/vm/compiler/runtime_api.h
+++ b/runtime/vm/compiler/runtime_api.h
@@ -626,6 +626,7 @@
   static word dart_stream_offset();
   static word async_stack_trace_offset();
   static word predefined_symbols_address_offset();
+  static word optimize_entry_offset();
   static word deoptimize_entry_offset();
   static word megamorphic_call_checked_entry_offset();
   static word active_exception_offset();
@@ -690,6 +691,7 @@
   static word stack_overflow_shared_with_fpu_regs_stub_offset();
   static word lazy_deopt_from_return_stub_offset();
   static word lazy_deopt_from_throw_stub_offset();
+  static word optimize_stub_offset();
   static word deoptimize_stub_offset();
   static word enter_safepoint_stub_offset();
   static word exit_safepoint_stub_offset();
diff --git a/runtime/vm/compiler/runtime_offsets_extracted.h b/runtime/vm/compiler/runtime_offsets_extracted.h
index 4b1687a..bf791bc 100644
--- a/runtime/vm/compiler/runtime_offsets_extracted.h
+++ b/runtime/vm/compiler/runtime_offsets_extracted.h
@@ -211,6 +211,9 @@
 static constexpr dart::compiler::target::word
     Thread_call_to_runtime_stub_offset = 132;
 static constexpr dart::compiler::target::word Thread_dart_stream_offset = 644;
+static constexpr dart::compiler::target::word Thread_optimize_entry_offset =
+    224;
+static constexpr dart::compiler::target::word Thread_optimize_stub_offset = 156;
 static constexpr dart::compiler::target::word Thread_deoptimize_entry_offset =
     228;
 static constexpr dart::compiler::target::word Thread_deoptimize_stub_offset =
@@ -561,6 +564,9 @@
 static constexpr dart::compiler::target::word
     Thread_call_to_runtime_stub_offset = 256;
 static constexpr dart::compiler::target::word Thread_dart_stream_offset = 1296;
+static constexpr dart::compiler::target::word Thread_optimize_entry_offset =
+    440;
+static constexpr dart::compiler::target::word Thread_optimize_stub_offset = 304;
 static constexpr dart::compiler::target::word Thread_deoptimize_entry_offset =
     448;
 static constexpr dart::compiler::target::word Thread_deoptimize_stub_offset =
@@ -912,6 +918,9 @@
 static constexpr dart::compiler::target::word
     Thread_call_to_runtime_stub_offset = 132;
 static constexpr dart::compiler::target::word Thread_dart_stream_offset = 608;
+static constexpr dart::compiler::target::word Thread_optimize_entry_offset =
+    224;
+static constexpr dart::compiler::target::word Thread_optimize_stub_offset = 156;
 static constexpr dart::compiler::target::word Thread_deoptimize_entry_offset =
     228;
 static constexpr dart::compiler::target::word Thread_deoptimize_stub_offset =
@@ -1258,6 +1267,9 @@
 static constexpr dart::compiler::target::word
     Thread_call_to_runtime_stub_offset = 256;
 static constexpr dart::compiler::target::word Thread_dart_stream_offset = 1384;
+static constexpr dart::compiler::target::word Thread_optimize_entry_offset =
+    440;
+static constexpr dart::compiler::target::word Thread_optimize_stub_offset = 304;
 static constexpr dart::compiler::target::word Thread_deoptimize_entry_offset =
     448;
 static constexpr dart::compiler::target::word Thread_deoptimize_stub_offset =
diff --git a/runtime/vm/compiler/runtime_offsets_list.h b/runtime/vm/compiler/runtime_offsets_list.h
index 3f5ef94..74264ca 100644
--- a/runtime/vm/compiler/runtime_offsets_list.h
+++ b/runtime/vm/compiler/runtime_offsets_list.h
@@ -157,6 +157,8 @@
   NOT_IN_DBC(FIELD(Thread, call_to_runtime_entry_point_offset))                \
   NOT_IN_DBC(FIELD(Thread, call_to_runtime_stub_offset))                       \
   FIELD(Thread, dart_stream_offset)                                            \
+  NOT_IN_DBC(FIELD(Thread, optimize_entry_offset))                             \
+  NOT_IN_DBC(FIELD(Thread, optimize_stub_offset))                              \
   NOT_IN_DBC(FIELD(Thread, deoptimize_entry_offset))                           \
   NOT_IN_DBC(FIELD(Thread, deoptimize_stub_offset))                            \
   FIELD(Thread, double_abs_address_offset)                                     \
diff --git a/runtime/vm/compiler/stub_code_compiler_arm.cc b/runtime/vm/compiler/stub_code_compiler_arm.cc
index f2fcc87..dd3b49f 100644
--- a/runtime/vm/compiler/stub_code_compiler_arm.cc
+++ b/runtime/vm/compiler/stub_code_compiler_arm.cc
@@ -2960,7 +2960,7 @@
 // R8: function to be reoptimized.
 // R4: argument descriptor (preserved).
 void StubCodeCompiler::GenerateOptimizeFunctionStub(Assembler* assembler) {
-  __ ldr(CODE_REG, Address(THR, Thread::optimize_stub_offset()));
+  __ ldr(CODE_REG, Address(THR, target::Thread::optimize_stub_offset()));
   __ EnterStubFrame();
   __ Push(R4);
   __ LoadImmediate(IP, 0);
diff --git a/runtime/vm/compiler/stub_code_compiler_arm64.cc b/runtime/vm/compiler/stub_code_compiler_arm64.cc
index 7bebb69..97dcff4 100644
--- a/runtime/vm/compiler/stub_code_compiler_arm64.cc
+++ b/runtime/vm/compiler/stub_code_compiler_arm64.cc
@@ -3032,7 +3032,7 @@
 // R6: function to be re-optimized.
 // R4: argument descriptor (preserved).
 void StubCodeCompiler::GenerateOptimizeFunctionStub(Assembler* assembler) {
-  __ LoadFromOffset(CODE_REG, THR, Thread::optimize_stub_offset());
+  __ LoadFromOffset(CODE_REG, THR, target::Thread::optimize_stub_offset());
   __ EnterStubFrame();
   __ Push(R4);
   // Setup space on stack for the return value.
diff --git a/runtime/vm/compiler/stub_code_compiler_ia32.cc b/runtime/vm/compiler/stub_code_compiler_ia32.cc
index dc4e3ec..bb5aeccd 100644
--- a/runtime/vm/compiler/stub_code_compiler_ia32.cc
+++ b/runtime/vm/compiler/stub_code_compiler_ia32.cc
@@ -2484,7 +2484,7 @@
 // EBX: function to be reoptimized.
 // EDX: argument descriptor (preserved).
 void StubCodeCompiler::GenerateOptimizeFunctionStub(Assembler* assembler) {
-  __ movl(CODE_REG, Address(THR, Thread::optimize_stub_offset()));
+  __ movl(CODE_REG, Address(THR, target::Thread::optimize_stub_offset()));
   __ EnterStubFrame();
   __ pushl(EDX);
   __ pushl(Immediate(0));  // Setup space on stack for return value.
diff --git a/runtime/vm/compiler/stub_code_compiler_x64.cc b/runtime/vm/compiler/stub_code_compiler_x64.cc
index 0402147..414bedb 100644
--- a/runtime/vm/compiler/stub_code_compiler_x64.cc
+++ b/runtime/vm/compiler/stub_code_compiler_x64.cc
@@ -3046,7 +3046,7 @@
 // RDI: function to be reoptimized.
 // R10: argument descriptor (preserved).
 void StubCodeCompiler::GenerateOptimizeFunctionStub(Assembler* assembler) {
-  __ movq(CODE_REG, Address(THR, Thread::optimize_stub_offset()));
+  __ movq(CODE_REG, Address(THR, target::Thread::optimize_stub_offset()));
   __ EnterStubFrame();
   __ pushq(R10);           // Preserve args descriptor.
   __ pushq(Immediate(0));  // Result slot.