[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 <asiva@google.com> Commit-Queue: Ryan Macnak <rmacnak@google.com>
This commit is contained in:
@@ -1251,18 +1251,6 @@ DART_EXPORT void Dart_EnterIsolate(Dart_Isolate isolate);
|
||||
*/
|
||||
DART_EXPORT void Dart_KillIsolate(Dart_Isolate isolate);
|
||||
|
||||
/**
|
||||
* Notifies the VM that the embedder expects |size| bytes of memory have become
|
||||
* unreachable. The VM may use this hint to adjust the garbage collector's
|
||||
* growth policy.
|
||||
*
|
||||
* Multiple calls are interpreted as increasing, not replacing, the estimate of
|
||||
* unreachable memory.
|
||||
*
|
||||
* Requires there to be a current isolate.
|
||||
*/
|
||||
DART_EXPORT void Dart_HintFreed(intptr_t size);
|
||||
|
||||
/**
|
||||
* Notifies the VM that the embedder expects to be idle until |deadline|. The VM
|
||||
* may use this time to perform garbage collection or other tasks to avoid
|
||||
|
||||
@@ -1811,17 +1811,6 @@ DART_EXPORT Dart_Handle Dart_GetStickyError() {
|
||||
return Api::NewHandle(T, I->sticky_error());
|
||||
}
|
||||
|
||||
DART_EXPORT void Dart_HintFreed(intptr_t size) {
|
||||
if (size < 0) {
|
||||
FATAL1("%s requires a non-negative size", CURRENT_FUNC);
|
||||
}
|
||||
Thread* T = Thread::Current();
|
||||
CHECK_ISOLATE(T->isolate());
|
||||
API_TIMELINE_BEGIN_END(T);
|
||||
TransitionNativeToVM transition(T);
|
||||
T->heap()->HintFreed(size);
|
||||
}
|
||||
|
||||
DART_EXPORT void Dart_NotifyIdle(int64_t deadline) {
|
||||
Thread* T = Thread::Current();
|
||||
CHECK_ISOLATE(T->isolate());
|
||||
|
||||
@@ -9525,39 +9525,6 @@ TEST_CASE(DartAPI_TimelineCategories) {
|
||||
}
|
||||
}
|
||||
|
||||
static void HintFreedNative(Dart_NativeArguments args) {
|
||||
int64_t size = 0;
|
||||
EXPECT_VALID(Dart_GetNativeIntegerArgument(args, 0, &size));
|
||||
Dart_HintFreed(size);
|
||||
}
|
||||
|
||||
static Dart_NativeFunction HintFreed_native_lookup(Dart_Handle name,
|
||||
int argument_count,
|
||||
bool* auto_setup_scope) {
|
||||
return HintFreedNative;
|
||||
}
|
||||
|
||||
TEST_CASE(DartAPI_HintFreed) {
|
||||
const char* kScriptChars = R"(
|
||||
@pragma("vm:external-name", "Test_nativeFunc")
|
||||
external void hintFreed(int size);
|
||||
void main() {
|
||||
var v;
|
||||
for (var i = 0; i < 100; i++) {
|
||||
var t = [];
|
||||
for (var j = 0; j < 10000; j++) {
|
||||
t.add(List.filled(100, null));
|
||||
}
|
||||
v = t;
|
||||
hintFreed(100 * 10000 * 4);
|
||||
}
|
||||
})";
|
||||
Dart_Handle lib =
|
||||
TestCase::LoadTestScript(kScriptChars, &HintFreed_native_lookup);
|
||||
Dart_Handle result = Dart_Invoke(lib, NewString("main"), 0, NULL);
|
||||
EXPECT_VALID(result);
|
||||
}
|
||||
|
||||
static void NotifyIdleShortNative(Dart_NativeArguments args) {
|
||||
Dart_NotifyIdle(Dart_TimelineGetMicros() + 10 * kMicrosecondsPerMillisecond);
|
||||
}
|
||||
|
||||
@@ -356,10 +356,6 @@ ObjectPtr Heap::FindObject(FindObjectVisitor* visitor) {
|
||||
return raw_obj;
|
||||
}
|
||||
|
||||
void Heap::HintFreed(intptr_t size) {
|
||||
old_space_.HintFreed(size);
|
||||
}
|
||||
|
||||
void Heap::NotifyIdle(int64_t deadline) {
|
||||
Thread* thread = Thread::Current();
|
||||
TIMELINE_FUNCTION_GC_DURATION(thread, "NotifyIdle");
|
||||
|
||||
@@ -104,7 +104,6 @@ class Heap {
|
||||
ObjectPtr FindNewObject(FindObjectVisitor* visitor);
|
||||
ObjectPtr FindObject(FindObjectVisitor* visitor);
|
||||
|
||||
void HintFreed(intptr_t size);
|
||||
void NotifyIdle(int64_t deadline);
|
||||
void NotifyLowMemory();
|
||||
|
||||
|
||||
@@ -1692,17 +1692,6 @@ void PageSpaceController::RecordUpdate(SpaceUsage before,
|
||||
}
|
||||
}
|
||||
|
||||
void PageSpaceController::HintFreed(intptr_t size) {
|
||||
intptr_t size_in_words = size << kWordSizeLog2;
|
||||
if (size_in_words > idle_gc_threshold_in_words_) {
|
||||
idle_gc_threshold_in_words_ = 0;
|
||||
} else {
|
||||
idle_gc_threshold_in_words_ -= size_in_words;
|
||||
}
|
||||
|
||||
// TODO(rmacnak): Hasten the soft threshold at some discount?
|
||||
}
|
||||
|
||||
void PageSpaceGarbageCollectionHistory::AddGarbageCollectionTime(int64_t start,
|
||||
int64_t end) {
|
||||
Entry entry;
|
||||
|
||||
@@ -265,7 +265,6 @@ class PageSpaceController {
|
||||
int64_t start,
|
||||
int64_t end);
|
||||
void EvaluateAfterLoading(SpaceUsage after);
|
||||
void HintFreed(intptr_t size);
|
||||
|
||||
void set_last_usage(SpaceUsage current) { last_usage_ = current; }
|
||||
|
||||
@@ -359,7 +358,6 @@ class PageSpace {
|
||||
void EvaluateAfterLoading() {
|
||||
page_space_controller_.EvaluateAfterLoading(usage_);
|
||||
}
|
||||
void HintFreed(intptr_t size) { page_space_controller_.HintFreed(size); }
|
||||
|
||||
int64_t UsedInWords() const { return usage_.used_in_words; }
|
||||
int64_t CapacityInWords() const {
|
||||
|
||||
Reference in New Issue
Block a user