This API is used by Blink to inform V8 about HTML frames being disposed.
Using the optional parameter, Blink can tell V8 whether the disposed
frame was a main frame. In that case, we might want to reset GC
parameters
BUG=none
R=hpayer@chromium.org
LOG=y
Review URL: https://codereview.chromium.org/
823583003
Cr-Commit-Position: refs/heads/master@{#25926}
* these notifications to guide the GC heuristic. Returns the number
* of context disposals - including this one - since the last time
* V8 had a chance to clean up.
+ *
+ * The optional parameter |dependant_context| specifies whether the disposed
+ * context was depending on state from other contexts or not.
*/
- int ContextDisposedNotification();
+ int ContextDisposedNotification(bool dependant_context = true);
/**
* Allows the host application to provide the address of a function that is
}
-int Isolate::ContextDisposedNotification() {
+int Isolate::ContextDisposedNotification(bool dependant_context) {
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
- return isolate->heap()->NotifyContextDisposed();
+ return isolate->heap()->NotifyContextDisposed(dependant_context);
}
}
-int Heap::NotifyContextDisposed() {
+int Heap::NotifyContextDisposed(bool dependant_context) {
+ // TODO(hpayer): Reset heap shrinking if dependant_context is false.
if (isolate()->concurrent_recompilation_enabled()) {
// Flush the queued recompilation tasks.
isolate()->optimizing_compiler_thread()->Flush();
bool IsHeapIterable();
// Notify the heap that a context has been disposed.
- int NotifyContextDisposed();
+ int NotifyContextDisposed(bool dependant_context);
inline void increment_scan_on_scavenge_pages() {
scan_on_scavenge_pages_++;
RUNTIME_FUNCTION(Runtime_NotifyContextDisposed) {
HandleScope scope(isolate);
DCHECK(args.length() == 0);
- isolate->heap()->NotifyContextDisposed();
+ isolate->heap()->NotifyContextDisposed(true);
return isolate->heap()->undefined_value();
}
}
// Force compilation cache cleanup.
- CcTest::heap()->NotifyContextDisposed();
+ CcTest::heap()->NotifyContextDisposed(true);
CcTest::heap()->CollectAllGarbage(Heap::kNoGCFlags);
// Dispose the native contexts one by one.