Changeset 225768 in webkit
- Timestamp:
- Dec 11, 2017 7:24:43 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JSTests/ChangeLog
r225550 r225768 1 2017-12-11 Saam Barati <sbarati@apple.com> 2 3 We need to disableCaching() in ErrorInstance when we materialize properties 4 https://bugs.webkit.org/show_bug.cgi?id=180343 5 <rdar://problem/35833002> 6 7 Reviewed by Mark Lam. 8 9 * stress/disable-caching-when-lazy-materializing-error-property-on-put.js: Added. 10 (assert): 11 (makeError): 12 (storeToStack): 13 (storeToStackAlreadyMaterialized): 14 1 15 2017-12-05 JF Bastien <jfbastien@apple.com> 2 16 -
trunk/Source/JavaScriptCore/ChangeLog
r225767 r225768 1 2017-12-11 Saam Barati <sbarati@apple.com> 2 3 We need to disableCaching() in ErrorInstance when we materialize properties 4 https://bugs.webkit.org/show_bug.cgi?id=180343 5 <rdar://problem/35833002> 6 7 Reviewed by Mark Lam. 8 9 This patch fixes a bug in ErrorInstance where we forgot to call PutPropertySlot::disableCaching 10 on puts() to a property that we lazily materialized. Forgetting to do this goes against the 11 PutPropertySlot's caching API. This lazy materialization caused the ErrorInstance to transition 12 from a Structure A to a Structure B. However, we were telling the IC that we were caching an 13 existing property only found on Structure B. This is obviously wrong as it would lead to an 14 OOB store if we didn't already crash when generating the IC. 15 16 * jit/Repatch.cpp: 17 (JSC::tryCachePutByID): 18 * runtime/ErrorInstance.cpp: 19 (JSC::ErrorInstance::materializeErrorInfoIfNeeded): 20 (JSC::ErrorInstance::put): 21 * runtime/ErrorInstance.h: 22 * runtime/Structure.cpp: 23 (JSC::Structure::didCachePropertyReplacement): 24 1 25 2017-12-11 Fujii Hironori <Hironori.Fujii@sony.com> 2 26 -
trunk/Source/JavaScriptCore/jit/Repatch.cpp
r225363 r225768 423 423 if (slot.base() == baseValue && slot.isCacheablePut()) { 424 424 if (slot.type() == PutPropertySlot::ExistingProperty) { 425 // This assert helps catch bugs if we accidentally forget to disable caching 426 // when we transition then store to an existing property. This is common among 427 // paths that reify lazy properties. If we reify a lazy property and forget 428 // to disable caching, we may come down this path. The Replace IC does not 429 // know how to model these types of structure transitions (or any structure 430 // transition for that matter). 431 RELEASE_ASSERT(baseValue.asCell()->structure(vm) == structure); 432 425 433 structure->didCachePropertyReplacement(vm, slot.cachedOffset()); 426 434 -
trunk/Source/JavaScriptCore/runtime/ErrorInstance.cpp
r223746 r225768 203 203 } 204 204 205 voidErrorInstance::materializeErrorInfoIfNeeded(VM& vm)205 bool ErrorInstance::materializeErrorInfoIfNeeded(VM& vm) 206 206 { 207 207 if (m_errorInfoMaterialized) 208 return ;208 return false; 209 209 210 210 addErrorInfo(vm, m_stackTrace.get(), this); … … 215 215 216 216 m_errorInfoMaterialized = true; 217 } 218 219 void ErrorInstance::materializeErrorInfoIfNeeded(VM& vm, PropertyName propertyName) 217 return true; 218 } 219 220 bool ErrorInstance::materializeErrorInfoIfNeeded(VM& vm, PropertyName propertyName) 220 221 { 221 222 if (propertyName == vm.propertyNames->line … … 223 224 || propertyName == vm.propertyNames->sourceURL 224 225 || propertyName == vm.propertyNames->stack) 225 materializeErrorInfoIfNeeded(vm); 226 return materializeErrorInfoIfNeeded(vm); 227 return false; 226 228 } 227 229 … … 277 279 VM& vm = exec->vm(); 278 280 ErrorInstance* thisObject = jsCast<ErrorInstance*>(cell); 279 thisObject->materializeErrorInfoIfNeeded(vm, propertyName); 281 bool materializedProperties = thisObject->materializeErrorInfoIfNeeded(vm, propertyName); 282 if (materializedProperties) 283 slot.disableCaching(); 280 284 return Base::put(thisObject, exec, propertyName, value, slot); 281 285 } -
trunk/Source/JavaScriptCore/runtime/ErrorInstance.h
r222186 r225768 70 70 Vector<StackFrame>* stackTrace() { return m_stackTrace.get(); } 71 71 72 voidmaterializeErrorInfoIfNeeded(VM&);73 voidmaterializeErrorInfoIfNeeded(VM&, PropertyName);72 bool materializeErrorInfoIfNeeded(VM&); 73 bool materializeErrorInfoIfNeeded(VM&, PropertyName); 74 74 75 75 protected: -
trunk/Source/JavaScriptCore/runtime/Structure.cpp
r225659 r225768 874 874 void Structure::didCachePropertyReplacement(VM& vm, PropertyOffset offset) 875 875 { 876 RELEASE_ASSERT(isValidOffset(offset)); 876 877 ensurePropertyReplacementWatchpointSet(vm, offset)->fireAll(vm, "Did cache property replacement"); 877 878 }
Note: See TracChangeset
for help on using the changeset viewer.