Reapply "[vm] Add graph intrinsics for ThreadLocal hasValue and getValue methods."

This reverts commit 4d7467abd6.

The fix for the failure that caused revert is in patchset 2.

TEST=ci
Change-Id: I9b7ff0dd049062b086ad43c8368c6ede130edf35
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/465781
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
This commit is contained in:
Alexander Aprelev
2025-12-03 06:30:20 -08:00
committed by Commit Queue
parent 9ac53f780c
commit 6b72a9c0bc
13 changed files with 3733 additions and 3615 deletions
+8 -3
View File
@@ -93,10 +93,10 @@ Thread::Thread(bool is_vm_isolate)
#else
service_extension_stream_(nullptr),
#endif
thread_locals_(Array::null()),
thread_lock_(),
reusable_handles_(),
sticky_error_(Error::null()),
thread_locals_(GrowableObjectArray::null()),
REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_INITIALIZERS)
REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_SCOPE_INIT)
#if !defined(PRODUCT) || defined(FORCE_INCLUDE_SAMPLING_HEAP_PROFILER)
@@ -268,7 +268,7 @@ void Thread::set_default_tag(const UserTag& tag) {
default_tag_ = tag.ptr();
}
void Thread::set_thread_locals(const GrowableObjectArray& thread_locals) {
void Thread::set_thread_locals(const Array& thread_locals) {
thread_locals_ = thread_locals.ptr();
}
@@ -421,6 +421,10 @@ void Thread::EnterIsolate(Isolate* isolate) {
/*bypass_safepoint=*/false);
thread->SetupMutatorState();
thread->SetupDartMutatorState(isolate);
if (!isolate->is_vm_isolate()) {
thread->set_thread_locals(Array::empty_array());
}
}
isolate->scheduled_mutator_thread_ = thread;
@@ -569,6 +573,7 @@ void Thread::EnterIsolateGroupAsMutator(IsolateGroup* isolate_group,
thread->SetStackLimit(OSThread::Current()->overflow_stack_limit());
#endif
thread->set_thread_locals(Array::empty_array());
thread->AssertDartMutatorInvariants();
StackZone zone(thread);
@@ -774,7 +779,7 @@ void Thread::FreeActiveThread(Thread* thread,
thread->ResetStateLocked();
thread->current_tag_ = UserTag::null();
thread->default_tag_ = UserTag::null();
thread->thread_locals_ = GrowableObjectArray::null();
thread->thread_locals_ = Array::null();
thread->AssertEmptyThreadInvariants();
thread_registry->ReturnThreadLocked(thread);