Rolling out: r253581 is failing tests on a release build.
authormark.lam@apple.com <mark.lam@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 17 Dec 2019 03:26:09 +0000 (03:26 +0000)
committermark.lam@apple.com <mark.lam@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 17 Dec 2019 03:26:09 +0000 (03:26 +0000)
https://bugs.webkit.org/show_bug.cgi?id=205279
<rdar://problem/57971874>

Not reviewed.

* interpreter/Interpreter.cpp:
(JSC::Interpreter::executeProgram):
(JSC::Interpreter::executeCall):
(JSC::Interpreter::executeConstruct):
(JSC::Interpreter::execute):
(JSC::Interpreter::executeModuleProgram):
* interpreter/InterpreterInlines.h:
(JSC::Interpreter::execute):
* jsc.cpp:
(startTimeoutThreadIfNeeded):
(runJSC):
(jscmain):
(startTimeoutTimer): Deleted.
(timeoutCheckCallback): Deleted.
(initializeTimeoutIfNeeded): Deleted.
* runtime/JSCConfig.h:
* runtime/VM.h:
(JSC::VM::notifyNeedDebuggerBreak):
(JSC::VM::notifyNeedShellTimeoutCheck): Deleted.
* runtime/VMTraps.cpp:
(JSC::VMTraps::handleTraps):
* runtime/VMTraps.h:
(JSC::VMTraps::Mask::Mask):
(JSC::VMTraps::Mask::allEventTypes):
(JSC::VMTraps::Mask::init):
(JSC::VMTraps::interruptingTraps): Deleted.
* tools/VMInspector.cpp:
(JSC::VMInspector::forEachVM): Deleted.
* tools/VMInspector.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@253609 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/interpreter/Interpreter.cpp
Source/JavaScriptCore/interpreter/InterpreterInlines.h
Source/JavaScriptCore/jsc.cpp
Source/JavaScriptCore/runtime/JSCConfig.h
Source/JavaScriptCore/runtime/VM.h
Source/JavaScriptCore/runtime/VMTraps.cpp
Source/JavaScriptCore/runtime/VMTraps.h
Source/JavaScriptCore/tools/VMInspector.cpp
Source/JavaScriptCore/tools/VMInspector.h

index fc40525..9a204ae 100644 (file)
@@ -1,3 +1,41 @@
+2019-12-16  Mark Lam  <mark.lam@apple.com>
+
+        Rolling out: r253581 is failing tests on a release build.
+        https://bugs.webkit.org/show_bug.cgi?id=205279
+        <rdar://problem/57971874>
+
+        Not reviewed.
+
+        * interpreter/Interpreter.cpp:
+        (JSC::Interpreter::executeProgram):
+        (JSC::Interpreter::executeCall):
+        (JSC::Interpreter::executeConstruct):
+        (JSC::Interpreter::execute):
+        (JSC::Interpreter::executeModuleProgram):
+        * interpreter/InterpreterInlines.h:
+        (JSC::Interpreter::execute):
+        * jsc.cpp:
+        (startTimeoutThreadIfNeeded):
+        (runJSC):
+        (jscmain):
+        (startTimeoutTimer): Deleted.
+        (timeoutCheckCallback): Deleted.
+        (initializeTimeoutIfNeeded): Deleted.
+        * runtime/JSCConfig.h:
+        * runtime/VM.h:
+        (JSC::VM::notifyNeedDebuggerBreak):
+        (JSC::VM::notifyNeedShellTimeoutCheck): Deleted.
+        * runtime/VMTraps.cpp:
+        (JSC::VMTraps::handleTraps):
+        * runtime/VMTraps.h:
+        (JSC::VMTraps::Mask::Mask):
+        (JSC::VMTraps::Mask::allEventTypes):
+        (JSC::VMTraps::Mask::init):
+        (JSC::VMTraps::interruptingTraps): Deleted.
+        * tools/VMInspector.cpp:
+        (JSC::VMInspector::forEachVM): Deleted.
+        * tools/VMInspector.h:
+
 2019-12-16  Yusuke Suzuki  <ysuzuki@apple.com>
 
         ASSERTION FAILED: length <= maximumLength in js-fixed-array-out-of-memory.js
index daa94c8..e7a3d22 100644 (file)
@@ -820,9 +820,9 @@ failedJSONP:
         codeBlock = jsCast<ProgramCodeBlock*>(tempCodeBlock);
     }
 
-    constexpr auto trapsMask = VMTraps::interruptingTraps();
-    if (UNLIKELY(vm.needTrapHandling(trapsMask))) {
-        vm.handleTraps(globalObject, vm.topCallFrame, trapsMask);
+    VMTraps::Mask mask(VMTraps::NeedTermination, VMTraps::NeedWatchdogCheck);
+    if (UNLIKELY(vm.needTrapHandling(mask))) {
+        vm.handleTraps(globalObject, vm.topCallFrame, mask);
         RETURN_IF_EXCEPTION(throwScope, throwScope.exception());
     }
 
@@ -881,9 +881,9 @@ JSValue Interpreter::executeCall(JSGlobalObject* lexicalGlobalObject, JSObject*
     } else
         newCodeBlock = 0;
 
-    constexpr auto trapsMask = VMTraps::interruptingTraps();
-    if (UNLIKELY(vm.needTrapHandling(trapsMask))) {
-        vm.handleTraps(globalObject, vm.topCallFrame, trapsMask);
+    VMTraps::Mask mask(VMTraps::NeedTermination, VMTraps::NeedWatchdogCheck);
+    if (UNLIKELY(vm.needTrapHandling(mask))) {
+        vm.handleTraps(globalObject, vm.topCallFrame, mask);
         RETURN_IF_EXCEPTION(throwScope, throwScope.exception());
     }
 
@@ -952,9 +952,9 @@ JSObject* Interpreter::executeConstruct(JSGlobalObject* lexicalGlobalObject, JSO
     } else
         newCodeBlock = 0;
 
-    constexpr auto trapsMask = VMTraps::interruptingTraps();
-    if (UNLIKELY(vm.needTrapHandling(trapsMask))) {
-        vm.handleTraps(globalObject, vm.topCallFrame, trapsMask);
+    VMTraps::Mask mask(VMTraps::NeedTermination, VMTraps::NeedWatchdogCheck);
+    if (UNLIKELY(vm.needTrapHandling(mask))) {
+        vm.handleTraps(globalObject, vm.topCallFrame, mask);
         RETURN_IF_EXCEPTION(throwScope, nullptr);
     }
 
@@ -1136,9 +1136,9 @@ JSValue Interpreter::execute(EvalExecutable* eval, JSGlobalObject* lexicalGlobal
         }
     }
 
-    constexpr auto trapsMask = VMTraps::interruptingTraps();
-    if (UNLIKELY(vm.needTrapHandling(trapsMask))) {
-        vm.handleTraps(globalObject, vm.topCallFrame, trapsMask);
+    VMTraps::Mask mask(VMTraps::NeedTermination, VMTraps::NeedWatchdogCheck);
+    if (UNLIKELY(vm.needTrapHandling(mask))) {
+        vm.handleTraps(globalObject, vm.topCallFrame, mask);
         RETURN_IF_EXCEPTION(throwScope, throwScope.exception());
     }
 
@@ -1186,9 +1186,9 @@ JSValue Interpreter::executeModuleProgram(ModuleProgramExecutable* executable, J
         codeBlock = jsCast<ModuleProgramCodeBlock*>(tempCodeBlock);
     }
 
-    constexpr auto trapsMask = VMTraps::interruptingTraps();
-    if (UNLIKELY(vm.needTrapHandling(trapsMask))) {
-        vm.handleTraps(globalObject, vm.topCallFrame, trapsMask);
+    VMTraps::Mask mask(VMTraps::NeedTermination, VMTraps::NeedWatchdogCheck);
+    if (UNLIKELY(vm.needTrapHandling(mask))) {
+        vm.handleTraps(globalObject, vm.topCallFrame, mask);
         RETURN_IF_EXCEPTION(throwScope, throwScope.exception());
     }
 
index e1a9294..e024652 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2016 Yusuke Suzuki <utatane.tea@gmail.com>
- * Copyright (C) 2016-2019 Apple Inc. All rights reserved.
+ * Copyright (C) 2016-2018 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -74,9 +74,9 @@ ALWAYS_INLINE JSValue Interpreter::execute(CallFrameClosure& closure)
 
     StackStats::CheckPoint stackCheckPoint;
 
-    constexpr auto trapsMask = VMTraps::interruptingTraps();
-    if (UNLIKELY(vm.needTrapHandling(trapsMask))) {
-        vm.handleTraps(closure.protoCallFrame->globalObject, closure.oldCallFrame, trapsMask);
+    VMTraps::Mask mask(VMTraps::NeedTermination, VMTraps::NeedWatchdogCheck);
+    if (UNLIKELY(vm.needTrapHandling(mask))) {
+        vm.handleTraps(closure.protoCallFrame->globalObject, closure.oldCallFrame, mask);
         RETURN_IF_EXCEPTION(throwScope, throwScope.exception());
     }
 
index 1ce27c5..663c34c 100644 (file)
@@ -70,7 +70,6 @@
 #include "SuperSampler.h"
 #include "TestRunnerUtils.h"
 #include "TypedArrayInlines.h"
-#include "VMInspector.h"
 #include "WasmCapabilities.h"
 #include "WasmContext.h"
 #include "WasmFaultSignalHandler.h"
@@ -85,7 +84,6 @@
 #include <thread>
 #include <type_traits>
 #include <wtf/Box.h>
-#include <wtf/CPUTime.h>
 #include <wtf/CommaPrinter.h>
 #include <wtf/FileSystem.h>
 #include <wtf/MainThread.h>
@@ -2429,58 +2427,24 @@ int jscmain(int argc, char** argv);
 
 static double s_desiredTimeout;
 static double s_timeoutMultiplier = 1.0;
-static Seconds s_timeoutDuration;
-static Seconds s_maxAllowedCPUTime;
-static VM* s_vm;
-
-static void startTimeoutTimer(Seconds duration)
-{
-    Thread::create("jsc Timeout Thread", [=] () {
-        sleep(duration);
-        VMInspector::forEachVM([&] (VM& vm) -> VMInspector::FunctorStatus {
-            if (&vm != s_vm)
-                return VMInspector::FunctorStatus::Continue;
-            vm.notifyNeedShellTimeoutCheck();
-            return VMInspector::FunctorStatus::Done;
-        });
-    });
-}
-
-static void timeoutCheckCallback(VM& vm)
-{
-    RELEASE_ASSERT(&vm == s_vm);
-    auto cpuTime = CPUTime::forCurrentThread();
-    if (cpuTime >= s_maxAllowedCPUTime) {
-        dataLog("Timed out after ", s_timeoutDuration, " seconds!\n");
-        CRASH();
-    }
-    auto remainingTime = s_maxAllowedCPUTime - cpuTime;
-    startTimeoutTimer(remainingTime);
-}
 
-static void initializeTimeoutIfNeeded()
+static void startTimeoutThreadIfNeeded()
 {
     if (char* timeoutString = getenv("JSCTEST_timeout")) {
         if (sscanf(timeoutString, "%lf", &s_desiredTimeout) != 1) {
             dataLog("WARNING: timeout string is malformed, got ", timeoutString,
                 " but expected a number. Not using a timeout.\n");
-        } else
-            g_jscConfig.shellTimeoutCheckCallback = timeoutCheckCallback;
+        } else {
+            Thread::create("jsc Timeout Thread", [] () {
+                Seconds timeoutDuration(s_desiredTimeout * s_timeoutMultiplier);
+                sleep(timeoutDuration);
+                dataLog("Timed out after ", timeoutDuration, " seconds!\n");
+                CRASH();
+            });
+        }
     }
 }
 
-static void startTimeoutThreadIfNeeded(VM& vm)
-{
-    if (!g_jscConfig.shellTimeoutCheckCallback)
-        return;
-
-    s_vm = &vm;
-    s_timeoutDuration = Seconds(s_desiredTimeout * s_timeoutMultiplier);
-    s_maxAllowedCPUTime = CPUTime::forCurrentThread() + s_timeoutDuration;
-    Seconds timeoutDuration(s_desiredTimeout * s_timeoutMultiplier);
-    startTimeoutTimer(timeoutDuration);
-}
-
 int main(int argc, char** argv)
 {
 #if PLATFORM(IOS_FAMILY) && CPU(ARM_THUMB2)
@@ -3035,7 +2999,6 @@ int runJSC(const CommandLine& options, bool isWorker, const Func& func)
     {
         JSLockHolder locker(vm);
 
-        startTimeoutThreadIfNeeded(vm);
         if (options.m_profile && !vm.m_perBytecodeProfiler)
             vm.m_perBytecodeProfiler = makeUnique<Profiler::Database>(vm);
 
@@ -3136,7 +3099,7 @@ int jscmain(int argc, char** argv)
 
     // Initialize JSC before getting VM.
     JSC::initializeThreading();
-    initializeTimeoutIfNeeded();
+    startTimeoutThreadIfNeeded();
 #if ENABLE(WEBASSEMBLY)
     JSC::Wasm::enableFastMemory();
 #endif
index ea2446f..2f48f75 100644 (file)
@@ -32,7 +32,6 @@ namespace JSC {
 
 class ExecutableAllocator;
 class FixedVMPoolExecutableAllocator;
-class VM;
 
 #if CPU(ARM64) || PLATFORM(WATCHOS)
 constexpr size_t PageSize = 16 * KB;
@@ -83,8 +82,6 @@ struct Config {
 #endif
 
             OptionsStorage options;
-
-            void (*shellTimeoutCheckCallback)(VM&);
         };
         char ensureSize[ConfigSizeToProtect];
     };
index 28086c4..fe1e9bf 100644 (file)
@@ -1067,7 +1067,6 @@ public:
     void* needTrapHandlingAddress() { return m_traps.needTrapHandlingAddress(); }
 
     void notifyNeedDebuggerBreak() { m_traps.fireTrap(VMTraps::NeedDebuggerBreak); }
-    void notifyNeedShellTimeoutCheck() { m_traps.fireTrap(VMTraps::NeedShellTimeoutCheck); }
     void notifyNeedTermination() { m_traps.fireTrap(VMTraps::NeedTermination); }
     void notifyNeedWatchdogCheck() { m_traps.fireTrap(VMTraps::NeedWatchdogCheck); }
 
index f6f550f..bf66092 100644 (file)
@@ -357,18 +357,13 @@ void VMTraps::handleTraps(JSGlobalObject* globalObject, CallFrame* callFrame, VM
             dataLog("VM ", RawPointer(&vm), " on pid ", getCurrentProcessID(), " received NeedDebuggerBreak trap\n");
             invalidateCodeBlocksOnStack(callFrame);
             break;
-
+                
         case NeedWatchdogCheck:
             ASSERT(vm.watchdog());
             if (LIKELY(!vm.watchdog()->shouldTerminate(globalObject)))
                 continue;
             FALLTHROUGH;
 
-        case NeedShellTimeoutCheck:
-            RELEASE_ASSERT(g_jscConfig.shellTimeoutCheckCallback);
-            g_jscConfig.shellTimeoutCheckCallback(vm);
-            break;
-
         case NeedTermination:
             throwException(globalObject, scope, createTerminatedExecutionException(&vm));
             return;
index 72c0716..9ae8ec8 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2017-2019 Apple Inc. All rights reserved.
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -52,7 +52,6 @@ public:
     enum EventType {
         // Sorted in servicing priority order from highest to lowest.
         NeedDebuggerBreak,
-        NeedShellTimeoutCheck,
         NeedTermination,
         NeedWatchdogCheck,
         NumberOfEventTypes, // This entry must be last in this list.
@@ -62,16 +61,13 @@ public:
     class Mask {
     public:
         enum AllEventTypes { AllEventTypesTag };
-        constexpr Mask(AllEventTypes)
+        Mask(AllEventTypes)
             : m_mask(std::numeric_limits<BitField>::max())
         { }
-        static constexpr Mask allEventTypes() { return Mask(AllEventTypesTag); }
-
-        constexpr Mask(const Mask&) = default;
-        constexpr Mask(Mask&&) = default;
+        static Mask allEventTypes() { return Mask(AllEventTypesTag); }
 
         template<typename... Arguments>
-        constexpr Mask(Arguments... args)
+        Mask(Arguments... args)
             : m_mask(0)
         {
             init(args...);
@@ -81,20 +77,18 @@ public:
 
     private:
         template<typename... Arguments>
-        constexpr void init(EventType eventType, Arguments... args)
+        void init(EventType eventType, Arguments... args)
         {
             ASSERT(eventType < NumberOfEventTypes);
             m_mask |= (1 << eventType);
             init(args...);
         }
 
-        constexpr void init() { }
+        void init() { }
 
         BitField m_mask;
     };
 
-    static constexpr Mask interruptingTraps() { return Mask(NeedShellTimeoutCheck, NeedTermination, NeedWatchdogCheck); }
-
     ~VMTraps();
     VMTraps();
 
index 81c9f1f..f03f16f 100644 (file)
@@ -106,13 +106,6 @@ static bool ensureIsSafeToLock(Lock& lock)
 };
 #endif // ENABLE(JIT)
 
-void VMInspector::forEachVM(Function<FunctorStatus(VM&)>&& func)
-{
-    VMInspector& inspector = instance();
-    Locker lock(inspector.getLock());
-    inspector.iterate(func);
-}
-
 auto VMInspector::isValidExecutableMemory(const VMInspector::Locker&, void* machinePC) -> Expected<bool, Error>
 {
 #if ENABLE(JIT)
index 30108bd..5f5c1d8 100644 (file)
@@ -60,8 +60,6 @@ public:
     template <typename Functor>
     void iterate(const Locker&, const Functor& functor) { iterate(functor); }
 
-    JS_EXPORT_PRIVATE static void forEachVM(Function<FunctorStatus(VM&)>&&);
-
     Expected<Locker, Error> lock(Seconds timeout = Seconds::infinity());
 
     Expected<bool, Error> isValidExecutableMemory(const Locker&, void*);