Changeset 275924 in webkit


Ignore:
Timestamp:
Apr 13, 2021 7:19:29 PM (3 years ago)
Author:
mark.lam@apple.com
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):

Location:
trunk/Source/JavaScriptCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r275920 r275924  
     12021-04-13  Mark Lam  <mark.lam@apple.com>
     2
     3        The watchdog should not fire when it's not active.
     4        https://bugs.webkit.org/show_bug.cgi?id=224494
     5        rdar://76581259
     6
     7        Reviewed by Saam Barati and Yusuke Suzuki.
     8
     9        The watchdog is only active when we have entered the VM.  If we haven't entered
     10        the VM, we postpone starting the watchdog.  For example, see Watchdog::enteredVM()
     11        and Watchdog::exitedVM().
     12
     13        The underlying timer may still fire the NeedWatchdogCheck event after
     14        Watchdog::stopTimer() is called.  So, we need to just ignore the event if the
     15        watchdog isn't active.
     16
     17        * runtime/VMTraps.cpp:
     18        (JSC::VMTraps::handleTraps):
     19        * runtime/Watchdog.h:
     20        (JSC::Watchdog::isActive const):
     21
    1222021-04-13  Ross Kirsling  <ross.kirsling@sony.com>
    223
  • trunk/Source/JavaScriptCore/runtime/VMTraps.cpp

    r275797 r275924  
    381381        case NeedWatchdogCheck:
    382382            ASSERT(vm.watchdog());
    383             ASSERT(vm.entryScope->globalObject());
    384             if (LIKELY(!vm.watchdog()->shouldTerminate(vm.entryScope->globalObject())))
     383            if (LIKELY(!vm.watchdog()->isActive() || !vm.watchdog()->shouldTerminate(vm.entryScope->globalObject())))
    385384                continue;
    386385            vm.setTerminationInProgress(true);
  • trunk/Source/JavaScriptCore/runtime/Watchdog.h

    r261464 r275924  
    11/*
    2  * Copyright (C) 2013-2017 Apple Inc. All rights reserved.
     2 * Copyright (C) 2013-2021 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    5151    bool shouldTerminate(JSGlobalObject*);
    5252
     53    bool isActive() const { return m_hasEnteredVM; }
     54
    5355    bool hasTimeLimit();
    5456    void enteredVM();
Note: See TracChangeset for help on using the changeset viewer.