Changeset 190215 in webkit
- Timestamp:
- Sep 24, 2015, 12:23:58 PM (10 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r190213 r190215 1 2015-09-23 Filip Pizlo <fpizlo@apple.com> 2 3 PolymorphicAccess should remember that it checked an ObjectPropertyCondition with a check on some structure 4 https://bugs.webkit.org/show_bug.cgi?id=149514 5 6 Reviewed by Oliver Hunt. 7 8 When we checked an ObjectPropertyCondition using an explicit structure check, we would forget to 9 note the structure in any weak reference table and we would attempt to regenerate the condition 10 check even if the condition became invalid. 11 12 We need to account for this better and we need to prune AccessCases that have an invalid condition 13 set. This change does both. 14 15 * bytecode/PolymorphicAccess.cpp: 16 (JSC::AccessGenerationState::addWatchpoint): 17 (JSC::AccessCase::alternateBase): 18 (JSC::AccessCase::couldStillSucceed): 19 (JSC::AccessCase::canReplace): 20 (JSC::AccessCase::generate): 21 (JSC::PolymorphicAccess::regenerateWithCases): 22 (JSC::PolymorphicAccess::visitWeak): 23 (JSC::PolymorphicAccess::regenerate): 24 * bytecode/PolymorphicAccess.h: 25 (JSC::AccessCase::callLinkInfo): 26 * tests/stress/make-dictionary-repatch.js: Added. This used to crash on a release assert. If we removed the release assert, this would return bad results. 27 1 28 2015-09-24 Mark Lam <mark.lam@apple.com> 2 29 -
trunk/Source/JavaScriptCore/bytecode/PolymorphicAccess.cpp
r190129 r190215 62 62 const Identifier* ident; 63 63 std::unique_ptr<WatchpointsOnStructureStubInfo> watchpoints; 64 Vector<WriteBarrier<JSCell>> weakReferences; 64 65 65 66 Watchpoint* addWatchpoint(const ObjectPropertyCondition& condition = ObjectPropertyCondition()) … … 252 253 } 253 254 255 bool AccessCase::couldStillSucceed() const 256 { 257 return m_conditionSet.structuresEnsureValidityAssumingImpurePropertyWatchpoint(); 258 } 259 254 260 bool AccessCase::canReplace(const AccessCase& other) 255 261 { … … 376 382 CCallHelpers& jit = *state.jit; 377 383 VM& vm = *jit.vm(); 384 CodeBlock* codeBlock = jit.codeBlock(); 378 385 StructureStubInfo& stubInfo = *state.stubInfo; 379 386 const Identifier& ident = *state.ident; … … 399 406 } 400 407 401 RELEASE_ASSERT(condition.structureEnsuresValidityAssumingImpurePropertyWatchpoint(structure)); 408 if (!condition.structureEnsuresValidityAssumingImpurePropertyWatchpoint(structure)) { 409 dataLog("This condition is no longer met: ", condition, "\n"); 410 RELEASE_ASSERT_NOT_REACHED(); 411 } 412 413 // We will emit code that has a weak reference that isn't otherwise listed anywhere. 414 state.weakReferences.append(WriteBarrier<JSCell>(vm, codeBlock->ownerExecutable(), structure)); 415 402 416 jit.move(CCallHelpers::TrustedImmPtr(condition.object()), scratchGPR); 403 417 state.failAndRepatch.append( … … 978 992 ListType newCases; 979 993 for (auto& oldCase : m_list) { 994 // Ignore old cases that cannot possibly succeed anymore. 995 if (!oldCase->couldStillSucceed()) 996 continue; 997 998 // Figure out if this is replaced by any new cases. 980 999 bool found = false; 981 1000 for (auto& caseToAdd : casesToAdd) { … … 985 1004 } 986 1005 } 987 if (!found) 988 newCases.append(oldCase->clone()); 1006 if (found) 1007 continue; 1008 1009 newCases.append(oldCase->clone()); 989 1010 } 990 1011 for (auto& caseToAdd : casesToAdd) … … 1022 1043 if (!at(i).visitWeak(vm)) 1023 1044 return false; 1045 } 1046 if (Vector<WriteBarrier<JSCell>>* weakReferences = m_weakReferences.get()) { 1047 for (WriteBarrier<JSCell>& weakReference : *weakReferences) { 1048 if (!Heap::isMarked(weakReference.get())) 1049 return false; 1050 } 1024 1051 } 1025 1052 return true; … … 1146 1173 m_stubRoutine = createJITStubRoutine(code, vm, codeBlock->ownerExecutable(), doesCalls); 1147 1174 m_watchpoints = WTF::move(state.watchpoints); 1175 if (!state.weakReferences.isEmpty()) 1176 m_weakReferences = std::make_unique<Vector<WriteBarrier<JSCell>>>(WTF::move(state.weakReferences)); 1148 1177 if (verbose) 1149 1178 dataLog("Returning: ", code.code(), "\n"); -
trunk/Source/JavaScriptCore/bytecode/PolymorphicAccess.h
r189586 r190215 207 207 } 208 208 209 // Is it still possible for this case to ever be taken? 210 bool couldStillSucceed() const; 211 209 212 // If this method returns true, then it's a good idea to remove 'other' from the access once 'this' 210 213 // is added. This method assumes that in case of contradictions, 'this' represents a newer, and so … … 302 305 RefPtr<JITStubRoutine> m_stubRoutine; 303 306 std::unique_ptr<WatchpointsOnStructureStubInfo> m_watchpoints; 307 std::unique_ptr<Vector<WriteBarrier<JSCell>>> m_weakReferences; 304 308 }; 305 309
Note:
See TracChangeset
for help on using the changeset viewer.