Changeset 284664 in webkit
- Timestamp:
- Oct 21, 2021, 9:31:45 PM (5 years ago)
- Location:
- trunk/Source
- Files:
-
- 11 edited
-
JavaScriptCore/ChangeLog (modified) (1 diff)
-
JavaScriptCore/bytecode/Watchpoint.h (modified) (3 diffs)
-
JavaScriptCore/dfg/DFGAbstractInterpreterInlines.h (modified) (2 diffs)
-
JavaScriptCore/dfg/DFGByteCodeParser.cpp (modified) (3 diffs)
-
JavaScriptCore/dfg/DFGConstantFoldingPhase.cpp (modified) (4 diffs)
-
JavaScriptCore/runtime/ArrayPrototype.cpp (modified) (2 diffs)
-
JavaScriptCore/runtime/InferredValue.h (modified) (3 diffs)
-
JavaScriptCore/runtime/JSArrayBufferPrototypeInlines.h (modified) (1 diff)
-
JavaScriptCore/runtime/ObjectPropertyChangeAdaptiveWatchpoint.h (modified) (1 diff)
-
WebCore/ChangeLog (modified) (1 diff)
-
WebCore/bindings/js/JSDOMWindowCustom.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r284663 r284664 1 2021-10-21 Saam Barati <sbarati@apple.com> 2 3 Clean up some code around checking the state of Watchpoints 4 https://bugs.webkit.org/show_bug.cgi?id=232111 5 6 Reviewed by Yusuke Suzuki. 7 8 No need to have state() and stateOnJSThread(), since they're now the same. 9 Also, there is no need to check the allocation watchpoint twice for the 10 function/internal function allocation profiles. 11 12 * bytecode/Watchpoint.h: 13 (JSC::WatchpointSet::isStillValid const): 14 (JSC::WatchpointSet::stateOnJSThread const): Deleted. 15 (JSC::WatchpointSet::isStillValidOnJSThread const): Deleted. 16 (JSC::InlineWatchpointSet::stateOnJSThread const): Deleted. 17 * dfg/DFGAbstractInterpreterInlines.h: 18 (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects): 19 * dfg/DFGByteCodeParser.cpp: 20 (JSC::DFG::ByteCodeParser::parseBlock): 21 (JSC::DFG::ByteCodeParser::handleCreateInternalFieldObject): 22 * dfg/DFGConstantFoldingPhase.cpp: 23 (JSC::DFG::ConstantFoldingPhase::foldConstants): 24 * runtime/ArrayPrototype.cpp: 25 (JSC::speciesWatchpointIsValid): 26 (JSC::canUseDefaultArrayJoinForToString): 27 * runtime/InferredValue.h: 28 (JSC::InferredValue::notifyWrite): 29 (JSC::InferredValue::stateOnJSThread const): Deleted. 30 * runtime/JSArrayBufferPrototypeInlines.h: 31 (JSC::speciesWatchpointIsValid): 32 * runtime/ObjectPropertyChangeAdaptiveWatchpoint.h: 33 1 34 2021-10-21 Mark Lam <mark.lam@apple.com> 2 35 -
trunk/Source/JavaScriptCore/bytecode/Watchpoint.h
r282014 r284664 191 191 } 192 192 193 // Fast way of getting the state, which only works from the main thread. 194 WatchpointState stateOnJSThread() const 195 { 196 return static_cast<WatchpointState>(m_state); 197 } 198 199 // It is safe to call this from another thread. It may return an old 200 // state. Guarantees that if *first* read the state() of the thing being 201 // watched and it returned IsWatched and *second* you actually read its 202 // value then it's safe to assume that if the state being watched changes 203 // then also the watchpoint state() will change to IsInvalidated. 193 // It is always safe to call this from the main thread. 194 // It is also safe to call this from another thread. It may return an old 195 // state. Generally speaking, a safe pattern to use in a concurrent compiler 196 // thread is: 197 // if (watchpoint.isValid()) { 198 // watch(watchpoint); 199 // do optimizations; 200 // } 204 201 WatchpointState state() const 205 202 { … … 217 214 { 218 215 return state() != IsInvalidated; 219 }220 // Fast way of testing isStillValid(), which only works from the main thread.221 bool isStillValidOnJSThread() const222 {223 return stateOnJSThread() != IsInvalidated;224 216 } 225 217 // Like isStillValid(), may be called from another thread. … … 341 333 } 342 334 343 // Fast way of getting the state, which only works from the main thread. 344 WatchpointState stateOnJSThread() const 345 { 346 uintptr_t data = m_data; 347 if (isFat(data)) 348 return fat(data)->stateOnJSThread(); 349 return decodeState(data); 350 } 351 352 // It is safe to call this from another thread. It may return a prior state, 353 // but that should be fine since you should only perform actions based on the 354 // state if you also add a watchpoint. 335 // See comment about state() in Watchpoint above. 355 336 WatchpointState state() const 356 337 { -
trunk/Source/JavaScriptCore/dfg/DFGAbstractInterpreterInlines.h
r284590 r284664 3043 3043 if (structure 3044 3044 && structure->classInfo() == (node->isInternalPromise() ? JSInternalPromise::info() : JSPromise::info()) 3045 && structure->globalObject() == globalObject 3046 && rareData->allocationProfileWatchpointSet().isStillValid()) { 3045 && structure->globalObject() == globalObject) { 3047 3046 m_graph.freeze(rareData); 3048 3047 m_graph.watchpoints().addLazily(rareData->allocationProfileWatchpointSet()); … … 3072 3071 if (structure 3073 3072 && structure->classInfo() == classInfo 3074 && structure->globalObject() == globalObject 3075 && rareData->allocationProfileWatchpointSet().isStillValid()) { 3073 && structure->globalObject() == globalObject) { 3076 3074 m_graph.freeze(rareData); 3077 3075 m_graph.watchpoints().addLazily(rareData->allocationProfileWatchpointSet()); -
trunk/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp
r284590 r284664 5547 5547 JSObject* prototype = rareData->objectAllocationPrototype(); 5548 5548 if (structure 5549 && (structure->hasMonoProto() || prototype) 5550 && rareData->allocationProfileWatchpointSet().isStillValid()) { 5549 && (structure->hasMonoProto() || prototype)) { 5551 5550 5552 5551 m_graph.freeze(rareData); … … 5629 5628 if (structure 5630 5629 && structure->classInfo() == (bytecode.m_isInternalPromise ? JSInternalPromise::info() : JSPromise::info()) 5631 && structure->globalObject() == globalObject 5632 && rareData->allocationProfileWatchpointSet().isStillValid()) { 5630 && structure->globalObject() == globalObject) { 5633 5631 m_graph.freeze(rareData); 5634 5632 m_graph.watchpoints().addLazily(rareData->allocationProfileWatchpointSet()); … … 9013 9011 if (structure 9014 9012 && structure->classInfo() == classInfo 9015 && structure->globalObject() == globalObject 9016 && rareData->allocationProfileWatchpointSet().isStillValid()) { 9013 && structure->globalObject() == globalObject) { 9017 9014 m_graph.freeze(rareData); 9018 9015 m_graph.watchpoints().addLazily(rareData->allocationProfileWatchpointSet()); -
trunk/Source/JavaScriptCore/dfg/DFGConstantFoldingPhase.cpp
r284576 r284664 737 737 JSObject* prototype = rareData->objectAllocationPrototype(); 738 738 if (structure 739 && (structure->hasMonoProto() || prototype) 740 && rareData->allocationProfileWatchpointSet().isStillValid()) { 741 739 && (structure->hasMonoProto() || prototype)) { 742 740 m_graph.freeze(rareData); 743 741 m_graph.watchpoints().addLazily(rareData->allocationProfileWatchpointSet()); … … 759 757 changed = true; 760 758 break; 761 762 759 } 763 760 } … … 782 779 if (structure 783 780 && structure->classInfo() == (node->isInternalPromise() ? JSInternalPromise::info() : JSPromise::info()) 784 && structure->globalObject() == globalObject 785 && rareData->allocationProfileWatchpointSet().isStillValid()) { 781 && structure->globalObject() == globalObject) { 786 782 m_graph.freeze(rareData); 787 783 m_graph.watchpoints().addLazily(rareData->allocationProfileWatchpointSet()); … … 808 804 if (structure 809 805 && structure->classInfo() == classInfo 810 && structure->globalObject() == globalObject 811 && rareData->allocationProfileWatchpointSet().isStillValid()) { 806 && structure->globalObject() == globalObject) { 812 807 m_graph.freeze(rareData); 813 808 m_graph.watchpoints().addLazily(rareData->allocationProfileWatchpointSet()); -
trunk/Source/JavaScriptCore/runtime/ArrayPrototype.cpp
r281369 r284664 187 187 ArrayPrototype* arrayPrototype = globalObject->arrayPrototype(); 188 188 189 if (globalObject->arraySpeciesWatchpointSet().state OnJSThread() == ClearWatchpoint) {189 if (globalObject->arraySpeciesWatchpointSet().state() == ClearWatchpoint) { 190 190 dataLogLnIf(ArrayPrototypeInternal::verbose, "Initializing Array species watchpoints for Array.prototype: ", pointerDump(arrayPrototype), " with structure: ", pointerDump(arrayPrototype->structure(vm)), "\nand Array: ", pointerDump(globalObject->arrayConstructor()), " with structure: ", pointerDump(globalObject->arrayConstructor()->structure(vm))); 191 191 globalObject->tryInstallArraySpeciesWatchpoint(); 192 ASSERT(globalObject->arraySpeciesWatchpointSet().state OnJSThread() != ClearWatchpoint);192 ASSERT(globalObject->arraySpeciesWatchpointSet().state() != ClearWatchpoint); 193 193 } 194 194 195 195 return !thisObject->hasCustomProperties(vm) 196 196 && arrayPrototype == thisObject->getPrototypeDirect(vm) 197 && globalObject->arraySpeciesWatchpointSet().state OnJSThread() == IsWatched;197 && globalObject->arraySpeciesWatchpointSet().state() == IsWatched; 198 198 } 199 199 … … 584 584 JSGlobalObject* globalObject = thisObject->globalObject(); 585 585 586 if (globalObject->arrayJoinWatchpointSet().state OnJSThread() != IsWatched)586 if (globalObject->arrayJoinWatchpointSet().state() != IsWatched) 587 587 return false; 588 588 -
trunk/Source/JavaScriptCore/runtime/InferredValue.h
r277117 r284664 68 68 } 69 69 70 // Fast way of getting the state, which only works from the main thread.71 WatchpointState stateOnJSThread() const72 {73 uintptr_t data = m_data;74 if (isFat(data))75 return fat(data)->stateOnJSThread();76 return decodeState(data);77 }78 79 70 // It is safe to call this from another thread. It may return a prior state, 80 71 // but that should be fine since you should only perform actions based on the … … 121 112 void notifyWrite(VM& vm, JSCell* owner, JSCellType* value, const FireDetail& detail) 122 113 { 123 if (LIKELY(state OnJSThread() == IsInvalidated))114 if (LIKELY(state() == IsInvalidated)) 124 115 return; 125 116 notifyWriteSlow(vm, owner, value, detail); … … 128 119 void notifyWrite(VM& vm, JSCell* owner, JSCellType* value, const char* reason) 129 120 { 130 if (LIKELY(state OnJSThread() == IsInvalidated))121 if (LIKELY(state() == IsInvalidated)) 131 122 return; 132 123 notifyWriteSlow(vm, owner, value, reason); -
trunk/Source/JavaScriptCore/runtime/JSArrayBufferPrototypeInlines.h
r278253 r284664 40 40 auto* prototype = globalObject->arrayBufferPrototype(mode); 41 41 42 if (globalObject->arrayBufferSpeciesWatchpointSet(mode).state OnJSThread() == ClearWatchpoint) {42 if (globalObject->arrayBufferSpeciesWatchpointSet(mode).state() == ClearWatchpoint) { 43 43 dataLogLnIf(JSArrayBufferPrototypeInternal::verbose, "Initializing ArrayBuffer species watchpoints for ArrayBuffer.prototype: ", pointerDump(prototype), " with structure: ", pointerDump(prototype->structure(vm)), "\nand ArrayBuffer: ", pointerDump(globalObject->arrayBufferConstructor(mode)), " with structure: ", pointerDump(globalObject->arrayBufferConstructor(mode)->structure(vm))); 44 44 globalObject->tryInstallArrayBufferSpeciesWatchpoint(mode); 45 ASSERT(globalObject->arrayBufferSpeciesWatchpointSet(mode).state OnJSThread() != ClearWatchpoint);45 ASSERT(globalObject->arrayBufferSpeciesWatchpointSet(mode).state() != ClearWatchpoint); 46 46 } 47 47 48 48 return !thisObject->hasCustomProperties(vm) 49 49 && prototype == thisObject->getPrototypeDirect(vm) 50 && globalObject->arrayBufferSpeciesWatchpointSet(mode).state OnJSThread() == IsWatched;50 && globalObject->arrayBufferSpeciesWatchpointSet(mode).state() == IsWatched; 51 51 } 52 52 -
trunk/Source/JavaScriptCore/runtime/ObjectPropertyChangeAdaptiveWatchpoint.h
r261569 r284664 39 39 , m_watchpointSet(watchpointSet) 40 40 { 41 RELEASE_ASSERT(watchpointSet.state OnJSThread() == IsWatched);41 RELEASE_ASSERT(watchpointSet.state() == IsWatched); 42 42 } 43 43 -
trunk/Source/WebCore/ChangeLog
r284660 r284664 1 2021-10-21 Saam Barati <sbarati@apple.com> 2 3 Clean up some code around checking the state of Watchpoints 4 https://bugs.webkit.org/show_bug.cgi?id=232111 5 6 Reviewed by Yusuke Suzuki. 7 8 * bindings/js/JSDOMWindowCustom.cpp: 9 (WebCore::JSDOMWindow::getOwnPropertySlot): 10 1 11 2021-10-21 Chris Dumez <cdumez@apple.com> 2 12 -
trunk/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp
r280280 r284664 205 205 // We use m_windowCloseWatchpoints to clear any inline caches once the frame is cleared. 206 206 // This is sound because DOMWindow can be associated with at most one frame in its lifetime. 207 if (thisObject->m_windowCloseWatchpoints->isStillValid OnJSThread())207 if (thisObject->m_windowCloseWatchpoints->isStillValid()) 208 208 slot.setWatchpointSet(*thisObject->m_windowCloseWatchpoints); 209 209
Note:
See TracChangeset
for help on using the changeset viewer.