[vm] Access Function::code_ with acquire-release ordering.

TEST=tsan
Bug: https://github.com/dart-lang/sdk/issues/55597
Change-Id: I915dfc6e3ec9e547f50e649b9dd430a5c7c52752
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/364969
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index fe44666..8b891d0 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -7976,7 +7976,7 @@
 }
 
 void Function::SetInstructionsSafe(const Code& value) const {
-  untag()->set_code(value.ptr());
+  untag()->set_code<std::memory_order_release>(value.ptr());
   StoreNonPointer(&untag()->entry_point_, value.EntryPoint());
   StoreNonPointer(&untag()->unchecked_entry_point_,
                   value.UncheckedEntryPoint());
diff --git a/runtime/vm/object.h b/runtime/vm/object.h
index 342d640..f9ce4ff 100644
--- a/runtime/vm/object.h
+++ b/runtime/vm/object.h
@@ -3159,7 +3159,7 @@
   bool SafeToClosurize() const;
 
   static CodePtr CurrentCodeOf(const FunctionPtr function) {
-    return function->untag()->code();
+    return function->untag()->code<std::memory_order_acquire>();
   }
 
   CodePtr unoptimized_code() const {