Skip to content

Commit a5554dc

Browse files
rmacnak-googleCommit Bot
authored and
Commit Bot
committed
[vm] Remove disused Dart_HintFreed.
Uses of this API were replaced with explicit disposal. TEST=ci Change-Id: Id6c391c74d77e6a6c6b5b70e446a8abe92294b7a Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/228081 Reviewed-by: Siva Annamalai <[email protected]> Commit-Queue: Ryan Macnak <[email protected]>
1 parent 91154e7 commit a5554dc

File tree

7 files changed

+0
-74
lines changed

7 files changed

+0
-74
lines changed

runtime/include/dart_api.h

-12
Original file line numberDiff line numberDiff line change
@@ -1251,18 +1251,6 @@ DART_EXPORT void Dart_EnterIsolate(Dart_Isolate isolate);
12511251
*/
12521252
DART_EXPORT void Dart_KillIsolate(Dart_Isolate isolate);
12531253

1254-
/**
1255-
* Notifies the VM that the embedder expects |size| bytes of memory have become
1256-
* unreachable. The VM may use this hint to adjust the garbage collector's
1257-
* growth policy.
1258-
*
1259-
* Multiple calls are interpreted as increasing, not replacing, the estimate of
1260-
* unreachable memory.
1261-
*
1262-
* Requires there to be a current isolate.
1263-
*/
1264-
DART_EXPORT void Dart_HintFreed(intptr_t size);
1265-
12661254
/**
12671255
* Notifies the VM that the embedder expects to be idle until |deadline|. The VM
12681256
* may use this time to perform garbage collection or other tasks to avoid

runtime/vm/dart_api_impl.cc

-11
Original file line numberDiff line numberDiff line change
@@ -1811,17 +1811,6 @@ DART_EXPORT Dart_Handle Dart_GetStickyError() {
18111811
return Api::NewHandle(T, I->sticky_error());
18121812
}
18131813

1814-
DART_EXPORT void Dart_HintFreed(intptr_t size) {
1815-
if (size < 0) {
1816-
FATAL1("%s requires a non-negative size", CURRENT_FUNC);
1817-
}
1818-
Thread* T = Thread::Current();
1819-
CHECK_ISOLATE(T->isolate());
1820-
API_TIMELINE_BEGIN_END(T);
1821-
TransitionNativeToVM transition(T);
1822-
T->heap()->HintFreed(size);
1823-
}
1824-
18251814
DART_EXPORT void Dart_NotifyIdle(int64_t deadline) {
18261815
Thread* T = Thread::Current();
18271816
CHECK_ISOLATE(T->isolate());

runtime/vm/dart_api_impl_test.cc

-33
Original file line numberDiff line numberDiff line change
@@ -9525,39 +9525,6 @@ TEST_CASE(DartAPI_TimelineCategories) {
95259525
}
95269526
}
95279527

9528-
static void HintFreedNative(Dart_NativeArguments args) {
9529-
int64_t size = 0;
9530-
EXPECT_VALID(Dart_GetNativeIntegerArgument(args, 0, &size));
9531-
Dart_HintFreed(size);
9532-
}
9533-
9534-
static Dart_NativeFunction HintFreed_native_lookup(Dart_Handle name,
9535-
int argument_count,
9536-
bool* auto_setup_scope) {
9537-
return HintFreedNative;
9538-
}
9539-
9540-
TEST_CASE(DartAPI_HintFreed) {
9541-
const char* kScriptChars = R"(
9542-
@pragma("vm:external-name", "Test_nativeFunc")
9543-
external void hintFreed(int size);
9544-
void main() {
9545-
var v;
9546-
for (var i = 0; i < 100; i++) {
9547-
var t = [];
9548-
for (var j = 0; j < 10000; j++) {
9549-
t.add(List.filled(100, null));
9550-
}
9551-
v = t;
9552-
hintFreed(100 * 10000 * 4);
9553-
}
9554-
})";
9555-
Dart_Handle lib =
9556-
TestCase::LoadTestScript(kScriptChars, &HintFreed_native_lookup);
9557-
Dart_Handle result = Dart_Invoke(lib, NewString("main"), 0, NULL);
9558-
EXPECT_VALID(result);
9559-
}
9560-
95619528
static void NotifyIdleShortNative(Dart_NativeArguments args) {
95629529
Dart_NotifyIdle(Dart_TimelineGetMicros() + 10 * kMicrosecondsPerMillisecond);
95639530
}

runtime/vm/heap/heap.cc

-4
Original file line numberDiff line numberDiff line change
@@ -356,10 +356,6 @@ ObjectPtr Heap::FindObject(FindObjectVisitor* visitor) {
356356
return raw_obj;
357357
}
358358

359-
void Heap::HintFreed(intptr_t size) {
360-
old_space_.HintFreed(size);
361-
}
362-
363359
void Heap::NotifyIdle(int64_t deadline) {
364360
Thread* thread = Thread::Current();
365361
TIMELINE_FUNCTION_GC_DURATION(thread, "NotifyIdle");

runtime/vm/heap/heap.h

-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@ class Heap {
104104
ObjectPtr FindNewObject(FindObjectVisitor* visitor);
105105
ObjectPtr FindObject(FindObjectVisitor* visitor);
106106

107-
void HintFreed(intptr_t size);
108107
void NotifyIdle(int64_t deadline);
109108
void NotifyLowMemory();
110109

runtime/vm/heap/pages.cc

-11
Original file line numberDiff line numberDiff line change
@@ -1692,17 +1692,6 @@ void PageSpaceController::RecordUpdate(SpaceUsage before,
16921692
}
16931693
}
16941694

1695-
void PageSpaceController::HintFreed(intptr_t size) {
1696-
intptr_t size_in_words = size << kWordSizeLog2;
1697-
if (size_in_words > idle_gc_threshold_in_words_) {
1698-
idle_gc_threshold_in_words_ = 0;
1699-
} else {
1700-
idle_gc_threshold_in_words_ -= size_in_words;
1701-
}
1702-
1703-
// TODO(rmacnak): Hasten the soft threshold at some discount?
1704-
}
1705-
17061695
void PageSpaceGarbageCollectionHistory::AddGarbageCollectionTime(int64_t start,
17071696
int64_t end) {
17081697
Entry entry;

runtime/vm/heap/pages.h

-2
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,6 @@ class PageSpaceController {
265265
int64_t start,
266266
int64_t end);
267267
void EvaluateAfterLoading(SpaceUsage after);
268-
void HintFreed(intptr_t size);
269268

270269
void set_last_usage(SpaceUsage current) { last_usage_ = current; }
271270

@@ -359,7 +358,6 @@ class PageSpace {
359358
void EvaluateAfterLoading() {
360359
page_space_controller_.EvaluateAfterLoading(usage_);
361360
}
362-
void HintFreed(intptr_t size) { page_space_controller_.HintFreed(size); }
363361

364362
int64_t UsedInWords() const { return usage_.used_in_words; }
365363
int64_t CapacityInWords() const {

0 commit comments

Comments
 (0)