| Index: src/d8.cc
|
| diff --git a/src/d8.cc b/src/d8.cc
|
| index 73bde94aad291cfbe6f20786073841c93d388071..f7d63ce1cd18c7eae9311fb50def7516232a80f2 100644
|
| --- a/src/d8.cc
|
| +++ b/src/d8.cc
|
| @@ -1211,9 +1211,16 @@ void SourceGroup::ExecuteInThread() {
|
| V8::ContextDisposedNotification();
|
| V8::IdleNotification(kLongIdlePauseInMs);
|
| }
|
| + if (Shell::options.invoke_weak_callbacks) {
|
| + // By sending a low memory notifications, we will try hard to collect
|
| + // all garbage and will therefore also invoke all weak callbacks of
|
| + // actually unreachable persistent handles.
|
| + V8::LowMemoryNotification();
|
| + }
|
| }
|
| done_semaphore_.Signal();
|
| } while (!Shell::options.last_run);
|
| +
|
| isolate->Dispose();
|
| }
|
|
|
| @@ -1274,6 +1281,11 @@ bool Shell::SetOptions(int argc, char* argv[]) {
|
| } else if (strcmp(argv[i], "--send-idle-notification") == 0) {
|
| options.send_idle_notification = true;
|
| argv[i] = NULL;
|
| + } else if (strcmp(argv[i], "--invoke-weak-callbacks") == 0) {
|
| + options.invoke_weak_callbacks = true;
|
| + // TODO(jochen) See issue 3351
|
| + options.send_idle_notification = true;
|
| + argv[i] = NULL;
|
| } else if (strcmp(argv[i], "-f") == 0) {
|
| // Ignore any -f flags for compatibility with other stand-alone
|
| // JavaScript engines.
|
| @@ -1367,6 +1379,12 @@ int Shell::RunMain(Isolate* isolate, int argc, char* argv[]) {
|
| V8::ContextDisposedNotification();
|
| V8::IdleNotification(kLongIdlePauseInMs);
|
| }
|
| + if (options.invoke_weak_callbacks) {
|
| + // By sending a low memory notifications, we will try hard to collect all
|
| + // garbage and will therefore also invoke all weak callbacks of actually
|
| + // unreachable persistent handles.
|
| + V8::LowMemoryNotification();
|
| + }
|
|
|
| #ifndef V8_SHARED
|
| for (int i = 1; i < options.num_isolates; ++i) {
|
|
|