Title: [275924] trunk/Source/_javascript_Core
Revision
275924
Author
mark....@apple.com
Date
2021-04-13 19:19:29 -0700 (Tue, 13 Apr 2021)

Log Message

The watchdog should not fire when it's not active.
https://bugs.webkit.org/show_bug.cgi?id=224494
rdar://76581259

Reviewed by Saam Barati and Yusuke Suzuki.

The watchdog is only active when we have entered the VM.  If we haven't entered
the VM, we postpone starting the watchdog.  For example, see Watchdog::enteredVM()
and Watchdog::exitedVM().

The underlying timer may still fire the NeedWatchdogCheck event after
Watchdog::stopTimer() is called.  So, we need to just ignore the event if the
watchdog isn't active.

* runtime/VMTraps.cpp:
(JSC::VMTraps::handleTraps):
* runtime/Watchdog.h:
(JSC::Watchdog::isActive const):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (275923 => 275924)


--- trunk/Source/_javascript_Core/ChangeLog	2021-04-14 01:48:33 UTC (rev 275923)
+++ trunk/Source/_javascript_Core/ChangeLog	2021-04-14 02:19:29 UTC (rev 275924)
@@ -1,3 +1,24 @@
+2021-04-13  Mark Lam  <mark....@apple.com>
+
+        The watchdog should not fire when it's not active.
+        https://bugs.webkit.org/show_bug.cgi?id=224494
+        rdar://76581259
+
+        Reviewed by Saam Barati and Yusuke Suzuki.
+
+        The watchdog is only active when we have entered the VM.  If we haven't entered
+        the VM, we postpone starting the watchdog.  For example, see Watchdog::enteredVM()
+        and Watchdog::exitedVM().
+
+        The underlying timer may still fire the NeedWatchdogCheck event after
+        Watchdog::stopTimer() is called.  So, we need to just ignore the event if the
+        watchdog isn't active.
+
+        * runtime/VMTraps.cpp:
+        (JSC::VMTraps::handleTraps):
+        * runtime/Watchdog.h:
+        (JSC::Watchdog::isActive const):
+
 2021-04-13  Ross Kirsling  <ross.kirsl...@sony.com>
 
         Move cloneUBreakIterator declaration to IntlWorkaround.h

Modified: trunk/Source/_javascript_Core/runtime/VMTraps.cpp (275923 => 275924)


--- trunk/Source/_javascript_Core/runtime/VMTraps.cpp	2021-04-14 01:48:33 UTC (rev 275923)
+++ trunk/Source/_javascript_Core/runtime/VMTraps.cpp	2021-04-14 02:19:29 UTC (rev 275924)
@@ -380,8 +380,7 @@
 
         case NeedWatchdogCheck:
             ASSERT(vm.watchdog());
-            ASSERT(vm.entryScope->globalObject());
-            if (LIKELY(!vm.watchdog()->shouldTerminate(vm.entryScope->globalObject())))
+            if (LIKELY(!vm.watchdog()->isActive() || !vm.watchdog()->shouldTerminate(vm.entryScope->globalObject())))
                 continue;
             vm.setTerminationInProgress(true);
             FALLTHROUGH;

Modified: trunk/Source/_javascript_Core/runtime/Watchdog.h (275923 => 275924)


--- trunk/Source/_javascript_Core/runtime/Watchdog.h	2021-04-14 01:48:33 UTC (rev 275923)
+++ trunk/Source/_javascript_Core/runtime/Watchdog.h	2021-04-14 02:19:29 UTC (rev 275924)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2013-2017 Apple Inc. All rights reserved.
+ * Copyright (C) 2013-2021 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -50,6 +50,8 @@
 
     bool shouldTerminate(JSGlobalObject*);
 
+    bool isActive() const { return m_hasEnteredVM; }
+
     bool hasTimeLimit();
     void enteredVM();
     void exitedVM();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to