[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 <rmacnak@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Auto-Submit: Alexander Markov <alexmarkov@google.com>
This commit is contained in:
Alexander Markov 2022-08-25 16:57:15 +00:00 committed by Commit Bot
parent 857a0d2e66
commit 4c1235caab
2 changed files with 0 additions and 65 deletions

View file

@ -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<bool(const Function&)> callback) {
auto thread = Thread::Current();

View file

@ -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