Skip to content

Commit 3fa0a2f

Browse files
alexmarkovCommit Queue
authored and
Commit Queue
committed
Reland "[vm] Cleanup unused code in ClosureFunctionsCache"
This is a reland of commit 4c1235c The underlying problem is addressed in https://dart-review.googlesource.com/c/sdk/+/262429. Original change's description: > [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 <[email protected]> > Reviewed-by: Ryan Macnak <[email protected]> > Auto-Submit: Alexander Markov <[email protected]> TEST=ci Change-Id: I96bd99174e68818ca8024e72836ebd1c99cdecd5 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/263141 Reviewed-by: Tess Strickland <[email protected]> Reviewed-by: Ryan Macnak <[email protected]> Commit-Queue: Alexander Markov <[email protected]>
1 parent 5923b88 commit 3fa0a2f

File tree

2 files changed

+0
-65
lines changed

2 files changed

+0
-65
lines changed

runtime/vm/closure_functions_cache.cc

Lines changed: 0 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -10,37 +10,6 @@
1010

1111
namespace dart {
1212

13-
FunctionPtr ClosureFunctionsCache::LookupClosureFunction(
14-
const Class& owner,
15-
TokenPosition token_pos) {
16-
auto thread = Thread::Current();
17-
SafepointReadRwLocker ml(thread, thread->isolate_group()->program_lock());
18-
return LookupClosureFunctionLocked(owner, token_pos);
19-
}
20-
21-
FunctionPtr ClosureFunctionsCache::LookupClosureFunctionLocked(
22-
const Class& owner,
23-
TokenPosition token_pos) {
24-
auto thread = Thread::Current();
25-
auto zone = thread->zone();
26-
auto object_store = thread->isolate_group()->object_store();
27-
28-
DEBUG_ASSERT(
29-
thread->isolate_group()->program_lock()->IsCurrentThreadReader());
30-
31-
const auto& closures =
32-
GrowableObjectArray::Handle(zone, object_store->closure_functions());
33-
auto& closure = Function::Handle(zone);
34-
intptr_t num_closures = closures.Length();
35-
for (intptr_t i = 0; i < num_closures; i++) {
36-
closure ^= closures.At(i);
37-
if (closure.token_pos() == token_pos && closure.Owner() == owner.ptr()) {
38-
return closure.ptr();
39-
}
40-
}
41-
return Function::null();
42-
}
43-
4413
FunctionPtr ClosureFunctionsCache::LookupClosureFunction(
4514
const Function& parent,
4615
TokenPosition token_pos) {
@@ -126,33 +95,6 @@ FunctionPtr ClosureFunctionsCache::ClosureFunctionFromIndex(intptr_t idx) {
12695
return Function::RawCast(closures_array.At(idx));
12796
}
12897

129-
FunctionPtr ClosureFunctionsCache::GetUniqueInnerClosure(
130-
const Function& outer) {
131-
auto thread = Thread::Current();
132-
auto zone = thread->zone();
133-
auto object_store = thread->isolate_group()->object_store();
134-
135-
SafepointReadRwLocker ml(thread, thread->isolate_group()->program_lock());
136-
137-
const auto& closures =
138-
GrowableObjectArray::Handle(zone, object_store->closure_functions());
139-
auto& entry = Function::Handle(zone);
140-
for (intptr_t i = (closures.Length() - 1); i >= 0; i--) {
141-
entry ^= closures.At(i);
142-
if (entry.parent_function() == outer.ptr()) {
143-
#if defined(DEBUG)
144-
auto& other = Function::Handle(zone);
145-
for (intptr_t j = i - 1; j >= 0; j--) {
146-
other ^= closures.At(j);
147-
ASSERT(other.parent_function() != outer.ptr());
148-
}
149-
#endif
150-
return entry.ptr();
151-
}
152-
}
153-
return Function::null();
154-
}
155-
15698
void ClosureFunctionsCache::ForAllClosureFunctions(
15799
std::function<bool(const Function&)> callback) {
158100
auto thread = Thread::Current();

runtime/vm/closure_functions_cache.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,6 @@ class FunctionPtr;
3939
// requirements above).
4040
class ClosureFunctionsCache : public AllStatic {
4141
public:
42-
static FunctionPtr LookupClosureFunction(const Class& owner,
43-
TokenPosition pos);
44-
static FunctionPtr LookupClosureFunctionLocked(const Class& owner,
45-
TokenPosition pos);
46-
4742
static FunctionPtr LookupClosureFunction(const Function& parent,
4843
TokenPosition token_pos);
4944
static FunctionPtr LookupClosureFunctionLocked(const Function& parent,
@@ -60,8 +55,6 @@ class ClosureFunctionsCache : public AllStatic {
6055
static intptr_t FindClosureIndex(const Function& needle);
6156
static FunctionPtr ClosureFunctionFromIndex(intptr_t idx);
6257

63-
static FunctionPtr GetUniqueInnerClosure(const Function& outer);
64-
6558
// Visits all closure functions registered in the object store.
6659
//
6760
// Iterates in-order, thereby allowing new closures being added during the

0 commit comments

Comments
 (0)