Changeset 253609 in webkit
- Timestamp:
- Dec 16, 2019, 7:26:09 PM (5 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r253608 r253609 1 2019-12-16 Mark Lam <mark.lam@apple.com> 2 3 Rolling out: r253581 is failing tests on a release build. 4 https://bugs.webkit.org/show_bug.cgi?id=205279 5 <rdar://problem/57971874> 6 7 Not reviewed. 8 9 * interpreter/Interpreter.cpp: 10 (JSC::Interpreter::executeProgram): 11 (JSC::Interpreter::executeCall): 12 (JSC::Interpreter::executeConstruct): 13 (JSC::Interpreter::execute): 14 (JSC::Interpreter::executeModuleProgram): 15 * interpreter/InterpreterInlines.h: 16 (JSC::Interpreter::execute): 17 * jsc.cpp: 18 (startTimeoutThreadIfNeeded): 19 (runJSC): 20 (jscmain): 21 (startTimeoutTimer): Deleted. 22 (timeoutCheckCallback): Deleted. 23 (initializeTimeoutIfNeeded): Deleted. 24 * runtime/JSCConfig.h: 25 * runtime/VM.h: 26 (JSC::VM::notifyNeedDebuggerBreak): 27 (JSC::VM::notifyNeedShellTimeoutCheck): Deleted. 28 * runtime/VMTraps.cpp: 29 (JSC::VMTraps::handleTraps): 30 * runtime/VMTraps.h: 31 (JSC::VMTraps::Mask::Mask): 32 (JSC::VMTraps::Mask::allEventTypes): 33 (JSC::VMTraps::Mask::init): 34 (JSC::VMTraps::interruptingTraps): Deleted. 35 * tools/VMInspector.cpp: 36 (JSC::VMInspector::forEachVM): Deleted. 37 * tools/VMInspector.h: 38 1 39 2019-12-16 Yusuke Suzuki <ysuzuki@apple.com> 2 40 -
trunk/Source/JavaScriptCore/interpreter/Interpreter.cpp
r253581 r253609 821 821 } 822 822 823 constexpr auto trapsMask = VMTraps::interruptingTraps();824 if (UNLIKELY(vm.needTrapHandling( trapsMask))) {825 vm.handleTraps(globalObject, vm.topCallFrame, trapsMask);823 VMTraps::Mask mask(VMTraps::NeedTermination, VMTraps::NeedWatchdogCheck); 824 if (UNLIKELY(vm.needTrapHandling(mask))) { 825 vm.handleTraps(globalObject, vm.topCallFrame, mask); 826 826 RETURN_IF_EXCEPTION(throwScope, throwScope.exception()); 827 827 } … … 882 882 newCodeBlock = 0; 883 883 884 constexpr auto trapsMask = VMTraps::interruptingTraps();885 if (UNLIKELY(vm.needTrapHandling( trapsMask))) {886 vm.handleTraps(globalObject, vm.topCallFrame, trapsMask);884 VMTraps::Mask mask(VMTraps::NeedTermination, VMTraps::NeedWatchdogCheck); 885 if (UNLIKELY(vm.needTrapHandling(mask))) { 886 vm.handleTraps(globalObject, vm.topCallFrame, mask); 887 887 RETURN_IF_EXCEPTION(throwScope, throwScope.exception()); 888 888 } … … 953 953 newCodeBlock = 0; 954 954 955 constexpr auto trapsMask = VMTraps::interruptingTraps();956 if (UNLIKELY(vm.needTrapHandling( trapsMask))) {957 vm.handleTraps(globalObject, vm.topCallFrame, trapsMask);955 VMTraps::Mask mask(VMTraps::NeedTermination, VMTraps::NeedWatchdogCheck); 956 if (UNLIKELY(vm.needTrapHandling(mask))) { 957 vm.handleTraps(globalObject, vm.topCallFrame, mask); 958 958 RETURN_IF_EXCEPTION(throwScope, nullptr); 959 959 } … … 1137 1137 } 1138 1138 1139 constexpr auto trapsMask = VMTraps::interruptingTraps();1140 if (UNLIKELY(vm.needTrapHandling( trapsMask))) {1141 vm.handleTraps(globalObject, vm.topCallFrame, trapsMask);1139 VMTraps::Mask mask(VMTraps::NeedTermination, VMTraps::NeedWatchdogCheck); 1140 if (UNLIKELY(vm.needTrapHandling(mask))) { 1141 vm.handleTraps(globalObject, vm.topCallFrame, mask); 1142 1142 RETURN_IF_EXCEPTION(throwScope, throwScope.exception()); 1143 1143 } … … 1187 1187 } 1188 1188 1189 constexpr auto trapsMask = VMTraps::interruptingTraps();1190 if (UNLIKELY(vm.needTrapHandling( trapsMask))) {1191 vm.handleTraps(globalObject, vm.topCallFrame, trapsMask);1189 VMTraps::Mask mask(VMTraps::NeedTermination, VMTraps::NeedWatchdogCheck); 1190 if (UNLIKELY(vm.needTrapHandling(mask))) { 1191 vm.handleTraps(globalObject, vm.topCallFrame, mask); 1192 1192 RETURN_IF_EXCEPTION(throwScope, throwScope.exception()); 1193 1193 } -
trunk/Source/JavaScriptCore/interpreter/InterpreterInlines.h
r253581 r253609 1 1 /* 2 2 * Copyright (C) 2016 Yusuke Suzuki <utatane.tea@gmail.com> 3 * Copyright (C) 2016-201 9Apple Inc. All rights reserved.3 * Copyright (C) 2016-2018 Apple Inc. All rights reserved. 4 4 * 5 5 * Redistribution and use in source and binary forms, with or without … … 75 75 StackStats::CheckPoint stackCheckPoint; 76 76 77 constexpr auto trapsMask = VMTraps::interruptingTraps();78 if (UNLIKELY(vm.needTrapHandling( trapsMask))) {79 vm.handleTraps(closure.protoCallFrame->globalObject, closure.oldCallFrame, trapsMask);77 VMTraps::Mask mask(VMTraps::NeedTermination, VMTraps::NeedWatchdogCheck); 78 if (UNLIKELY(vm.needTrapHandling(mask))) { 79 vm.handleTraps(closure.protoCallFrame->globalObject, closure.oldCallFrame, mask); 80 80 RETURN_IF_EXCEPTION(throwScope, throwScope.exception()); 81 81 } -
trunk/Source/JavaScriptCore/jsc.cpp
r253581 r253609 71 71 #include "TestRunnerUtils.h" 72 72 #include "TypedArrayInlines.h" 73 #include "VMInspector.h"74 73 #include "WasmCapabilities.h" 75 74 #include "WasmContext.h" … … 86 85 #include <type_traits> 87 86 #include <wtf/Box.h> 88 #include <wtf/CPUTime.h>89 87 #include <wtf/CommaPrinter.h> 90 88 #include <wtf/FileSystem.h> … … 2430 2428 static double s_desiredTimeout; 2431 2429 static double s_timeoutMultiplier = 1.0; 2432 static Seconds s_timeoutDuration; 2433 static Seconds s_maxAllowedCPUTime; 2434 static VM* s_vm; 2435 2436 static void startTimeoutTimer(Seconds duration) 2437 { 2438 Thread::create("jsc Timeout Thread", [=] () { 2439 sleep(duration); 2440 VMInspector::forEachVM([&] (VM& vm) -> VMInspector::FunctorStatus { 2441 if (&vm != s_vm) 2442 return VMInspector::FunctorStatus::Continue; 2443 vm.notifyNeedShellTimeoutCheck(); 2444 return VMInspector::FunctorStatus::Done; 2445 }); 2446 }); 2447 } 2448 2449 static void timeoutCheckCallback(VM& vm) 2450 { 2451 RELEASE_ASSERT(&vm == s_vm); 2452 auto cpuTime = CPUTime::forCurrentThread(); 2453 if (cpuTime >= s_maxAllowedCPUTime) { 2454 dataLog("Timed out after ", s_timeoutDuration, " seconds!\n"); 2455 CRASH(); 2456 } 2457 auto remainingTime = s_maxAllowedCPUTime - cpuTime; 2458 startTimeoutTimer(remainingTime); 2459 } 2460 2461 static void initializeTimeoutIfNeeded() 2430 2431 static void startTimeoutThreadIfNeeded() 2462 2432 { 2463 2433 if (char* timeoutString = getenv("JSCTEST_timeout")) { … … 2465 2435 dataLog("WARNING: timeout string is malformed, got ", timeoutString, 2466 2436 " but expected a number. Not using a timeout.\n"); 2467 } else 2468 g_jscConfig.shellTimeoutCheckCallback = timeoutCheckCallback; 2469 } 2470 } 2471 2472 static void startTimeoutThreadIfNeeded(VM& vm) 2473 { 2474 if (!g_jscConfig.shellTimeoutCheckCallback) 2475 return; 2476 2477 s_vm = &vm; 2478 s_timeoutDuration = Seconds(s_desiredTimeout * s_timeoutMultiplier); 2479 s_maxAllowedCPUTime = CPUTime::forCurrentThread() + s_timeoutDuration; 2480 Seconds timeoutDuration(s_desiredTimeout * s_timeoutMultiplier); 2481 startTimeoutTimer(timeoutDuration); 2437 } else { 2438 Thread::create("jsc Timeout Thread", [] () { 2439 Seconds timeoutDuration(s_desiredTimeout * s_timeoutMultiplier); 2440 sleep(timeoutDuration); 2441 dataLog("Timed out after ", timeoutDuration, " seconds!\n"); 2442 CRASH(); 2443 }); 2444 } 2445 } 2482 2446 } 2483 2447 … … 3036 3000 JSLockHolder locker(vm); 3037 3001 3038 startTimeoutThreadIfNeeded(vm);3039 3002 if (options.m_profile && !vm.m_perBytecodeProfiler) 3040 3003 vm.m_perBytecodeProfiler = makeUnique<Profiler::Database>(vm); … … 3137 3100 // Initialize JSC before getting VM. 3138 3101 JSC::initializeThreading(); 3139 initializeTimeoutIfNeeded();3102 startTimeoutThreadIfNeeded(); 3140 3103 #if ENABLE(WEBASSEMBLY) 3141 3104 JSC::Wasm::enableFastMemory(); -
trunk/Source/JavaScriptCore/runtime/JSCConfig.h
r253581 r253609 33 33 class ExecutableAllocator; 34 34 class FixedVMPoolExecutableAllocator; 35 class VM;36 35 37 36 #if CPU(ARM64) || PLATFORM(WATCHOS) … … 84 83 85 84 OptionsStorage options; 86 87 void (*shellTimeoutCheckCallback)(VM&);88 85 }; 89 86 char ensureSize[ConfigSizeToProtect]; -
trunk/Source/JavaScriptCore/runtime/VM.h
r253598 r253609 1068 1068 1069 1069 void notifyNeedDebuggerBreak() { m_traps.fireTrap(VMTraps::NeedDebuggerBreak); } 1070 void notifyNeedShellTimeoutCheck() { m_traps.fireTrap(VMTraps::NeedShellTimeoutCheck); }1071 1070 void notifyNeedTermination() { m_traps.fireTrap(VMTraps::NeedTermination); } 1072 1071 void notifyNeedWatchdogCheck() { m_traps.fireTrap(VMTraps::NeedWatchdogCheck); } -
trunk/Source/JavaScriptCore/runtime/VMTraps.cpp
r253581 r253609 358 358 invalidateCodeBlocksOnStack(callFrame); 359 359 break; 360 360 361 361 case NeedWatchdogCheck: 362 362 ASSERT(vm.watchdog()); … … 364 364 continue; 365 365 FALLTHROUGH; 366 367 case NeedShellTimeoutCheck:368 RELEASE_ASSERT(g_jscConfig.shellTimeoutCheckCallback);369 g_jscConfig.shellTimeoutCheckCallback(vm);370 break;371 366 372 367 case NeedTermination: -
trunk/Source/JavaScriptCore/runtime/VMTraps.h
r253581 r253609 1 1 /* 2 * Copyright (C) 2017 -2019Apple Inc. All rights reserved.2 * Copyright (C) 2017 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 53 53 // Sorted in servicing priority order from highest to lowest. 54 54 NeedDebuggerBreak, 55 NeedShellTimeoutCheck,56 55 NeedTermination, 57 56 NeedWatchdogCheck, … … 63 62 public: 64 63 enum AllEventTypes { AllEventTypesTag }; 65 constexprMask(AllEventTypes)64 Mask(AllEventTypes) 66 65 : m_mask(std::numeric_limits<BitField>::max()) 67 66 { } 68 static constexpr Mask allEventTypes() { return Mask(AllEventTypesTag); } 69 70 constexpr Mask(const Mask&) = default; 71 constexpr Mask(Mask&&) = default; 67 static Mask allEventTypes() { return Mask(AllEventTypesTag); } 72 68 73 69 template<typename... Arguments> 74 constexprMask(Arguments... args)70 Mask(Arguments... args) 75 71 : m_mask(0) 76 72 { … … 82 78 private: 83 79 template<typename... Arguments> 84 constexprvoid init(EventType eventType, Arguments... args)80 void init(EventType eventType, Arguments... args) 85 81 { 86 82 ASSERT(eventType < NumberOfEventTypes); … … 89 85 } 90 86 91 constexprvoid init() { }87 void init() { } 92 88 93 89 BitField m_mask; 94 90 }; 95 96 static constexpr Mask interruptingTraps() { return Mask(NeedShellTimeoutCheck, NeedTermination, NeedWatchdogCheck); }97 91 98 92 ~VMTraps(); -
trunk/Source/JavaScriptCore/tools/VMInspector.cpp
r253581 r253609 107 107 #endif // ENABLE(JIT) 108 108 109 void VMInspector::forEachVM(Function<FunctorStatus(VM&)>&& func)110 {111 VMInspector& inspector = instance();112 Locker lock(inspector.getLock());113 inspector.iterate(func);114 }115 116 109 auto VMInspector::isValidExecutableMemory(const VMInspector::Locker&, void* machinePC) -> Expected<bool, Error> 117 110 { -
trunk/Source/JavaScriptCore/tools/VMInspector.h
r253581 r253609 61 61 void iterate(const Locker&, const Functor& functor) { iterate(functor); } 62 62 63 JS_EXPORT_PRIVATE static void forEachVM(Function<FunctorStatus(VM&)>&&);64 65 63 Expected<Locker, Error> lock(Seconds timeout = Seconds::infinity()); 66 64
Note:
See TracChangeset
for help on using the changeset viewer.