Changeset 188338 in webkit
- Timestamp:
- Aug 12, 2015 11:14:02 AM (9 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/API/JSContextRef.cpp
r188329 r188338 93 93 } 94 94 95 static void createWatchdogIfNeeded(VM& vm)96 {97 if (!vm.watchdog) {98 vm.watchdog = adoptRef(new Watchdog());99 100 // The LLINT peeks into the Watchdog object directly. In order to do that,101 // the LLINT assumes that the internal shape of a std::unique_ptr is the102 // same as a plain C++ pointer, and loads the address of Watchdog from it.103 RELEASE_ASSERT(*reinterpret_cast<Watchdog**>(&vm.watchdog) == vm.watchdog.get());104 }105 }106 107 95 void JSContextGroupSetExecutionTimeLimit(JSContextGroupRef group, double limit, JSShouldTerminateCallback callback, void* callbackData) 108 96 { 109 97 VM& vm = *toJS(group); 110 98 JSLockHolder locker(&vm); 111 createWatchdogIfNeeded(vm); 112 Watchdog& watchdog = *vm.watchdog; 99 Watchdog& watchdog = vm.ensureWatchdog(); 113 100 if (callback) { 114 101 void* callbackPtr = reinterpret_cast<void*>(callback); -
trunk/Source/JavaScriptCore/ChangeLog
r188329 r188338 1 2015-08-12 Mark Lam <mark.lam@apple.com> 2 3 Add a JSC option to enable the watchdog for testing. 4 https://bugs.webkit.org/show_bug.cgi?id=147939 5 6 Reviewed by Michael Saboff. 7 8 * API/JSContextRef.cpp: 9 (JSContextGroupSetExecutionTimeLimit): 10 (createWatchdogIfNeeded): Deleted. 11 * runtime/Options.h: 12 * runtime/VM.cpp: 13 (JSC::VM::VM): 14 (JSC::VM::~VM): 15 (JSC::VM::sharedInstanceInternal): 16 (JSC::VM::ensureWatchdog): 17 (JSC::thunkGeneratorForIntrinsic): 18 * runtime/VM.h: 19 1 20 2015-08-11 Mark Lam <mark.lam@apple.com> 2 21 -
trunk/Source/JavaScriptCore/runtime/Options.h
r187555 r188338 321 321 v(bool, enableDollarVM, false, "installs the $vm debugging tool in global objects") \ 322 322 v(optionString, functionOverrides, nullptr, "file with debugging overrides for function bodies") \ 323 \ 324 v(unsigned, watchdog, 0, "watchdog timeout (0 = Disabled, N = a timeout period of N milliseconds)") \ 323 325 324 326 class Options { -
trunk/Source/JavaScriptCore/runtime/VM.cpp
r188329 r188338 287 287 if (Options::enableControlFlowProfiler()) 288 288 enableControlFlowProfiler(); 289 290 if (Options::watchdog()) { 291 std::chrono::milliseconds timeoutMillis(Options::watchdog()); 292 Watchdog& watchdog = ensureWatchdog(); 293 watchdog.setTimeLimit(*this, timeoutMillis); 294 } 289 295 } 290 296 … … 370 376 static VM* sharedInstance; 371 377 return sharedInstance; 378 } 379 380 Watchdog& VM::ensureWatchdog() 381 { 382 if (!watchdog) { 383 watchdog = adoptRef(new Watchdog()); 384 385 // The LLINT peeks into the Watchdog object directly. In order to do that, 386 // the LLINT assumes that the internal shape of a std::unique_ptr is the 387 // same as a plain C++ pointer, and loads the address of Watchdog from it. 388 RELEASE_ASSERT(*reinterpret_cast<Watchdog**>(&watchdog) == watchdog.get()); 389 } 390 return *watchdog; 372 391 } 373 392 -
trunk/Source/JavaScriptCore/runtime/VM.h
r188329 r188338 238 238 JS_EXPORT_PRIVATE ~VM(); 239 239 240 Watchdog& ensureWatchdog(); 241 240 242 private: 241 243 RefPtr<JSLock> m_apiLock;
Note: See TracChangeset
for help on using the changeset viewer.