From 4c1235caabe11e7c0a508d36322a623525d0e4d2 Mon Sep 17 00:00:00 2001 From: Alexander Markov Date: Thu, 25 Aug 2022 16:57:15 +0000 Subject: [PATCH] [vm] Cleanup unused code in ClosureFunctionsCache TEST=ci Change-Id: Ia6f24545c7e2d5b0df81cab52585d17556b36c16 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256363 Commit-Queue: Ryan Macnak Reviewed-by: Ryan Macnak Auto-Submit: Alexander Markov --- runtime/vm/closure_functions_cache.cc | 58 --------------------------- runtime/vm/closure_functions_cache.h | 7 ---- 2 files changed, 65 deletions(-) diff --git a/runtime/vm/closure_functions_cache.cc b/runtime/vm/closure_functions_cache.cc index 49badbb4b9b..82c6499b84b 100644 --- a/runtime/vm/closure_functions_cache.cc +++ b/runtime/vm/closure_functions_cache.cc @@ -10,37 +10,6 @@ namespace dart { -FunctionPtr ClosureFunctionsCache::LookupClosureFunction( - const Class& owner, - TokenPosition token_pos) { - auto thread = Thread::Current(); - SafepointReadRwLocker ml(thread, thread->isolate_group()->program_lock()); - return LookupClosureFunctionLocked(owner, token_pos); -} - -FunctionPtr ClosureFunctionsCache::LookupClosureFunctionLocked( - const Class& owner, - TokenPosition token_pos) { - auto thread = Thread::Current(); - auto zone = thread->zone(); - auto object_store = thread->isolate_group()->object_store(); - - DEBUG_ASSERT( - thread->isolate_group()->program_lock()->IsCurrentThreadReader()); - - const auto& closures = - GrowableObjectArray::Handle(zone, object_store->closure_functions()); - auto& closure = Function::Handle(zone); - intptr_t num_closures = closures.Length(); - for (intptr_t i = 0; i < num_closures; i++) { - closure ^= closures.At(i); - if (closure.token_pos() == token_pos && closure.Owner() == owner.ptr()) { - return closure.ptr(); - } - } - return Function::null(); -} - FunctionPtr ClosureFunctionsCache::LookupClosureFunction( const Function& parent, TokenPosition token_pos) { @@ -126,33 +95,6 @@ FunctionPtr ClosureFunctionsCache::ClosureFunctionFromIndex(intptr_t idx) { return Function::RawCast(closures_array.At(idx)); } -FunctionPtr ClosureFunctionsCache::GetUniqueInnerClosure( - const Function& outer) { - auto thread = Thread::Current(); - auto zone = thread->zone(); - auto object_store = thread->isolate_group()->object_store(); - - SafepointReadRwLocker ml(thread, thread->isolate_group()->program_lock()); - - const auto& closures = - GrowableObjectArray::Handle(zone, object_store->closure_functions()); - auto& entry = Function::Handle(zone); - for (intptr_t i = (closures.Length() - 1); i >= 0; i--) { - entry ^= closures.At(i); - if (entry.parent_function() == outer.ptr()) { -#if defined(DEBUG) - auto& other = Function::Handle(zone); - for (intptr_t j = i - 1; j >= 0; j--) { - other ^= closures.At(j); - ASSERT(other.parent_function() != outer.ptr()); - } -#endif - return entry.ptr(); - } - } - return Function::null(); -} - void ClosureFunctionsCache::ForAllClosureFunctions( std::function callback) { auto thread = Thread::Current(); diff --git a/runtime/vm/closure_functions_cache.h b/runtime/vm/closure_functions_cache.h index c52c2e6acba..e8d83e1da7a 100644 --- a/runtime/vm/closure_functions_cache.h +++ b/runtime/vm/closure_functions_cache.h @@ -39,11 +39,6 @@ class FunctionPtr; // requirements above). class ClosureFunctionsCache : public AllStatic { public: - static FunctionPtr LookupClosureFunction(const Class& owner, - TokenPosition pos); - static FunctionPtr LookupClosureFunctionLocked(const Class& owner, - TokenPosition pos); - static FunctionPtr LookupClosureFunction(const Function& parent, TokenPosition token_pos); static FunctionPtr LookupClosureFunctionLocked(const Function& parent, @@ -60,8 +55,6 @@ class ClosureFunctionsCache : public AllStatic { static intptr_t FindClosureIndex(const Function& needle); static FunctionPtr ClosureFunctionFromIndex(intptr_t idx); - static FunctionPtr GetUniqueInnerClosure(const Function& outer); - // Visits all closure functions registered in the object store. // // Iterates in-order, thereby allowing new closures being added during the