[vm] Remove unneeded HandleScope immediately after StackZone.

There's no point in unwinding the zone's scoped handle blocks just before deleting the entire zone.

TEST=ci
Change-Id: I364c717bffd16f727d6f2427a7b9693a83d74c13
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/499400
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
This commit is contained in:
Ryan Macnak
2026-04-29 15:36:54 -07:00
committed by dart-scoped@luci-project-accounts.iam.gserviceaccount.com
parent be63771661
commit 55f91b69a5
13 changed files with 0 additions and 29 deletions
-1
View File
@@ -885,7 +885,6 @@ class SpawnIsolateTask : public ThreadPool::Task {
auto thread = Thread::Current();
TransitionNativeToVM transition(thread);
StackZone zone(thread);
HandleScope hs(thread);
success = EnqueueEntrypointInvocationAndNotifySpawner(thread);
-1
View File
@@ -171,7 +171,6 @@ class CidCheckerForRanges : public ValueObject {
subtype_ = to_check_.RareType();
// Create local zone because deep hierarchies may allocate lots of handles.
StackZone stack_zone(thread_);
HANDLESCOPE(thread_);
return subtype_.IsSubtypeOf(supertype_, Heap::kNew);
}
-1
View File
@@ -1015,7 +1015,6 @@ void BackgroundCompiler::Run() {
Thread* thread = Thread::Current();
StackZone stack_zone(thread);
Zone* zone = stack_zone.GetZone();
HANDLESCOPE(thread);
Function& function = Function::Handle(zone);
QueueElement* element = nullptr;
{
-1
View File
@@ -406,7 +406,6 @@ char* Dart::DartInit(const Dart_InitializeParams* params) {
Thread* T = Thread::Current();
ASSERT(T != nullptr);
StackZone zone(T);
HandleScope handle_scope(T);
Object::InitNullAndBool(vm_isolate_->group());
vm_isolate_->isolate_group_->set_object_store(new ObjectStore());
vm_isolate_->isolate_object_store()->Init();
-2
View File
@@ -1208,7 +1208,6 @@ static Dart_Isolate CreateIsolate(IsolateGroup* group,
bool success = false;
{
StackZone zone(T);
HandleScope handle_scope(T);
#if defined(SUPPORT_TIMELINE)
TimelineBeginEndScope tbes(T, Timeline::GetIsolateStream(),
@@ -1408,7 +1407,6 @@ DART_EXPORT void Dart_ShutdownIsolate() {
{
StackZone zone(T);
HandleScope handle_scope(T);
Dart::RunShutdownCallback();
}
Dart::ShutdownIsolate(T);
-5
View File
@@ -87,7 +87,6 @@ VM_UNIT_TEST_CASE(FfiCallbackMetadata_CreateSyncFfiCallback) {
ASSERT(isolate == isolate_scope.isolate());
TransitionNativeToVM transition(thread);
StackZone stack_zone(thread);
HandleScope handle_scope(thread);
auto* zone = thread->zone();
@@ -182,7 +181,6 @@ VM_UNIT_TEST_CASE(FfiCallbackMetadata_CreateAsyncFfiCallback) {
ASSERT(thread->isolate() == isolate_scope.isolate());
TransitionNativeToVM transition(thread);
StackZone stack_zone(thread);
HandleScope handle_scope(thread);
auto* zone = thread->zone();
@@ -279,7 +277,6 @@ VM_UNIT_TEST_CASE(FfiCallbackMetadata_CreateIsolateLocalFfiCallback) {
ASSERT(thread->isolate() == isolate_scope.isolate());
TransitionNativeToVM transition(thread);
StackZone stack_zone(thread);
HandleScope handle_scope(thread);
auto* zone = thread->zone();
@@ -439,7 +436,6 @@ VM_UNIT_TEST_CASE(FfiCallbackMetadata_DeleteTrampolines) {
ASSERT(isolate == isolate_scope.isolate());
TransitionNativeToVM transition(thread);
StackZone stack_zone(thread);
HandleScope handle_scope(thread);
auto* fcm = FfiCallbackMetadata::Instance();
std::unordered_set<FfiCallbackMetadata::Trampoline> tramps;
@@ -513,7 +509,6 @@ static void RunBigRandomMultithreadedTest(uint64_t seed) {
ASSERT(isolate == isolate_scope.isolate());
TransitionNativeToVM transition(thread);
StackZone stack_zone(thread);
HandleScope handle_scope(thread);
struct TrampolineWithPort {
FfiCallbackMetadata::Trampoline tramp;
-6
View File
@@ -1446,7 +1446,6 @@ MessageHandler::MessageStatus IsolateMessageHandler::HandleMessage(
Thread* thread = Thread::Current();
StackZone stack_zone(thread);
Zone* zone = stack_zone.GetZone();
HandleScope handle_scope(thread);
#if defined(SUPPORT_TIMELINE)
TimelineBeginEndScope tbes(
thread, Timeline::GetIsolateStream(),
@@ -1575,7 +1574,6 @@ void IsolateMessageHandler::NotifyPauseOnStart() {
if (Service::debug_stream.enabled() || FLAG_warn_on_pause_with_no_debugger) {
StartIsolateScope start_isolate(I);
StackZone zone(T);
HandleScope handle_scope(T);
ServiceEvent pause_event(I, ServiceEvent::kPauseStart);
Service::HandleEvent(&pause_event);
} else if (FLAG_trace_service) {
@@ -1591,7 +1589,6 @@ void IsolateMessageHandler::NotifyPauseOnExit() {
if (Service::debug_stream.enabled() || FLAG_warn_on_pause_with_no_debugger) {
StartIsolateScope start_isolate(I);
StackZone zone(T);
HandleScope handle_scope(T);
ServiceEvent pause_event(I, ServiceEvent::kPauseExit);
Service::HandleEvent(&pause_event);
} else if (FLAG_trace_service) {
@@ -2478,7 +2475,6 @@ void Isolate::RunAndCleanupFinalizersOnShutdown() {
// but we no longer allocate new heap objects.
Thread* thread = Thread::Current();
StackZone stack_zone(thread);
HandleScope handle_scope(thread);
NoSafepointScope no_safepoint_scope;
// Set live finalizers isolate to null, before deleting the message handler.
@@ -2526,7 +2522,6 @@ void Isolate::LowLevelShutdown() {
// but we no longer allocate new heap objects.
Thread* thread = Thread::Current();
StackZone stack_zone(thread);
HandleScope handle_scope(thread);
NoSafepointScope no_safepoint_scope;
// Notify exit listeners that this isolate is shutting down.
@@ -2612,7 +2607,6 @@ void Isolate::Shutdown() {
StackZone zone(thread);
ServiceIsolate::SendIsolateShutdownMessage();
#if !defined(PRODUCT)
HandleScope handle_scope(thread);
debugger()->Shutdown();
#endif
-1
View File
@@ -125,7 +125,6 @@ class RunKernelTask : public ThreadPool::Task {
auto T = Thread::Current();
TransitionNativeToVM transition(T);
StackZone zone(T);
HandleScope handle_scope(T);
auto I = T->isolate();
ASSERT(I->is_kernel_isolate());
-1
View File
@@ -419,7 +419,6 @@ class RunServiceTask : public ThreadPool::Task {
auto T = Thread::Current();
TransitionNativeToVM transition(T);
StackZone zone(T);
HandleScope handle_scope(T);
auto I = T->isolate();
ASSERT(I->is_service_isolate());
-6
View File
@@ -752,7 +752,6 @@ VM_UNIT_TEST_CASE(FullSnapshot) {
Thread* thread = Thread::Current();
TransitionNativeToVM transition(thread);
StackZone zone(thread);
HandleScope scope(thread);
Dart_Handle result = Api::CheckAndFinalizePendingClasses(thread);
{
@@ -1010,7 +1009,6 @@ VM_UNIT_TEST_CASE(DartGeneratedListMessages) {
{
CHECK_API_SCOPE(thread);
TransitionNativeToVM transition(thread);
HANDLESCOPE(thread);
StackZone zone(thread);
{
// Generate a list of nulls from Dart code.
@@ -1134,7 +1132,6 @@ VM_UNIT_TEST_CASE(DartGeneratedArrayLiteralMessages) {
{
CHECK_API_SCOPE(thread);
TransitionNativeToVM transition(thread);
HANDLESCOPE(thread);
StackZone zone(thread);
{
// Generate a list of nulls from Dart code.
@@ -1367,7 +1364,6 @@ VM_UNIT_TEST_CASE(DartGeneratedListMessagesWithBackref) {
{
CHECK_API_SCOPE(thread);
TransitionNativeToVM transition(thread);
HANDLESCOPE(thread);
StackZone zone(thread);
{
// Generate a list of strings from Dart code.
@@ -1566,7 +1562,6 @@ VM_UNIT_TEST_CASE(DartGeneratedArrayLiteralMessagesWithBackref) {
{
CHECK_API_SCOPE(thread);
TransitionNativeToVM transition(thread);
HANDLESCOPE(thread);
StackZone zone(thread);
{
// Generate a list of strings from Dart code.
@@ -1807,7 +1802,6 @@ VM_UNIT_TEST_CASE(DartGeneratedListMessagesWithTypedData) {
{
CHECK_API_SCOPE(thread);
TransitionNativeToVM transition(thread);
HANDLESCOPE(thread);
StackZone zone(thread);
{
// Generate a list of Uint8Lists from Dart code.
-1
View File
@@ -583,7 +583,6 @@ void Thread::EnterIsolateGroupAsMutator(IsolateGroup* isolate_group,
thread->AssertDartMutatorInvariants();
StackZone zone(thread);
HANDLESCOPE(thread);
if (isolate_group->object_store()->tag_table() !=
GrowableObjectArray::null()) {
// Set up default UserTag.
-1
View File
@@ -2703,7 +2703,6 @@ void Timeline::DrainCompletedSampleBlocksIntoRecorder(
DisableThreadInterruptsScope dtis(thread);
StackZone zone(thread);
HandleScope handle_scope(thread);
Profile profile;
NoAllocationSampleFilter filter(isolate->main_port(), Thread::kMutatorTask,
streaming_start_micros,
-2
View File
@@ -56,7 +56,6 @@
ASSERT(__thread__->isolate() == __test_isolate__.isolate()); \
TransitionNativeToVM transition(__thread__); \
StackZone __zone__(__thread__); \
HandleScope __hs__(__thread__); \
Dart_TestHelper##name(__thread__); \
} \
static void Dart_TestHelper##name(Thread* thread)
@@ -76,7 +75,6 @@
ASSERT(__thread__->isolate() == __test_isolate__.isolate()); \
TransitionNativeToVM transition1(__thread__); \
StackZone __zone__(__thread__); \
HandleScope __hs__(__thread__); \
TransitionVMToNative transition2(__thread__); \
Dart_TestHelper##name(__thread__); \
} \