Changeset 201180 in webkit
- Timestamp:
- May 19, 2016 2:02:44 PM (8 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r201176 r201180 1 2016-05-19 Mark Lam <mark.lam@apple.com> 2 3 Code that null checks the VM pointer before any use should ref the VM. 4 https://bugs.webkit.org/show_bug.cgi?id=157864 5 6 Reviewed by Filip Pizlo and Keith Miller. 7 8 JSLock::willReleaseLock() and HeapTimer::timerDidFire() need to reference the VM 9 through a RefPtr. Otherwise, there's no guarantee that the VM won't be deleted 10 after their null checks. 11 12 * bytecode/CodeBlock.h: 13 (JSC::CodeBlock::vm): 14 (JSC::CodeBlock::setVM): Deleted. 15 - Not used, and suggests that it can be changed during the lifetime of the 16 CodeBlock (which should not be). 17 18 * heap/HeapTimer.cpp: 19 (JSC::HeapTimer::timerDidFire): 20 * runtime/JSLock.cpp: 21 (JSC::JSLock::willReleaseLock): 22 - Store the VM pointer in a RefPtr first, and null check the RefPtr instead of 23 the raw VM pointer. This makes the null check a strong guarantee that the 24 VM pointer is valid while these functions are using it. 25 1 26 2016-05-19 Saam barati <sbarati@apple.com> 2 27 -
trunk/Source/JavaScriptCore/bytecode/CodeBlock.h
r200981 r201180 341 341 ScriptExecutable* ownerScriptExecutable() const { return jsCast<ScriptExecutable*>(m_ownerExecutable.get()); } 342 342 343 void setVM(VM* vm) { m_vm = vm; } 344 VM* vm() { return m_vm; } 343 VM* vm() const { return m_vm; } 345 344 346 345 void setThisRegister(VirtualRegister thisRegister) { m_thisRegister = thisRegister; } -
trunk/Source/JavaScriptCore/heap/HeapTimer.cpp
r192773 r201180 81 81 apiLock->lock(); 82 82 83 VM* vm = apiLock->vm(); 84 // The VM has been destroyed, so we should just give up. 83 RefPtr<VM> vm = apiLock->vm(); 85 84 if (!vm) { 85 // The VM has been destroyed, so we should just give up. 86 86 apiLock->unlock(); 87 87 return; … … 99 99 100 100 { 101 JSLockHolder locker(vm );101 JSLockHolder locker(vm.get()); 102 102 heapTimer->doWork(); 103 103 } -
trunk/Source/JavaScriptCore/runtime/JSLock.cpp
r194840 r201180 178 178 void JSLock::willReleaseLock() 179 179 { 180 if (m_vm) { 181 m_vm->drainMicrotasks(); 182 183 m_vm->heap.releaseDelayedReleasedObjects(); 184 m_vm->setStackPointerAtVMEntry(nullptr); 180 RefPtr<VM> vm = m_vm; 181 if (vm) { 182 vm->drainMicrotasks(); 183 184 vm->heap.releaseDelayedReleasedObjects(); 185 vm->setStackPointerAtVMEntry(nullptr); 185 186 } 186 187
Note: See TracChangeset
for help on using the changeset viewer.