Changeset 259638 in webkit
- Timestamp:
- Apr 7, 2020, 9:04:57 AM (6 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 9 edited
-
JSTests/ChangeLog (modified) (1 diff)
-
JSTests/stress/getter-setter-globalobject-in-ic.js (added)
-
Source/JavaScriptCore/ChangeLog (modified) (1 diff)
-
Source/JavaScriptCore/bytecode/AccessCase.cpp (modified) (4 diffs)
-
Source/JavaScriptCore/bytecode/PolymorphicAccess.cpp (modified) (2 diffs)
-
Source/JavaScriptCore/bytecode/PolymorphicAccess.h (modified) (1 diff)
-
Source/JavaScriptCore/bytecode/StructureStubInfo.cpp (modified) (2 diffs)
-
Source/JavaScriptCore/bytecode/StructureStubInfo.h (modified) (1 diff)
-
Source/JavaScriptCore/jit/Repatch.cpp (modified) (6 diffs)
-
Source/JavaScriptCore/tools/JSDollarVM.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/JSTests/ChangeLog
r259636 r259638 1 2020-04-07 Yusuke Suzuki <ysuzuki@apple.com> 2 3 [JSC] Inlined IC should get right JSGlobalObject 4 https://bugs.webkit.org/show_bug.cgi?id=210092 5 6 Reviewed by Tadeu Zagallo. 7 8 * stress/getter-setter-globalobject-in-ic.js: Added. 9 (shouldBe): 10 (valueFunc): 11 (accessorFunc): 12 (valueTest): 13 (accessorTest): 14 1 15 2020-04-07 Yusuke Suzuki <ysuzuki@apple.com> 2 16 -
trunk/Source/JavaScriptCore/ChangeLog
r259636 r259638 1 2020-04-07 Yusuke Suzuki <ysuzuki@apple.com> 2 3 [JSC] Inlined IC should get right JSGlobalObject 4 https://bugs.webkit.org/show_bug.cgi?id=210092 5 6 Reviewed by Tadeu Zagallo. 7 8 In DFG / FTL, CodeBlock in AccessCase is the DFG / FTL CodeBlock which includes all the inlined CodeBlocks. 9 If inlining happens with CodeBlock which has different JSGlobalObject, CodeBlock->globalObject() is different 10 to the actual lexical JSGlobalObject of the IC. So basically, we should not rely on codeBlock->globalObject() in IC. 11 12 This patch passes the correct lexical JSGlobalObject to IC to use. We do not retain this JSGlobalObject. 13 Since this is lexical JSGlobalObject of that IC, the owner CodeBlock of this IC should already retain it (even if this 14 JSGlobalObject is one of inlined CodeBlock since the owner CodeBlock retains inlined lower-tier CodeBlocks). 15 16 * bytecode/AccessCase.cpp: 17 (JSC::AccessCase::generateImpl): 18 * bytecode/PolymorphicAccess.cpp: 19 (JSC::PolymorphicAccess::regenerate): 20 * bytecode/PolymorphicAccess.h: 21 * bytecode/StructureStubInfo.cpp: 22 (JSC::StructureStubInfo::addAccessCase): 23 * bytecode/StructureStubInfo.h: 24 * jit/Repatch.cpp: 25 (JSC::tryCacheGetBy): 26 (JSC::tryCacheArrayGetByVal): 27 (JSC::tryCachePutByID): 28 (JSC::tryCacheDeleteBy): 29 (JSC::tryCacheInByID): 30 (JSC::tryCacheInstanceOf): 31 * tools/JSDollarVM.cpp: 32 1 33 2020-04-07 Yusuke Suzuki <ysuzuki@apple.com> 2 34 -
trunk/Source/JavaScriptCore/bytecode/AccessCase.cpp
r259583 r259638 1368 1368 VM& vm = state.m_vm; 1369 1369 CodeBlock* codeBlock = jit.codeBlock(); 1370 JSGlobalObject* globalObject = state.m_globalObject; 1370 1371 StructureStubInfo& stubInfo = *state.stubInfo; 1371 1372 JSValueRegs valueRegs = state.valueRegs; … … 1658 1659 done.append(jit.jump()); 1659 1660 1660 // FIXME: Revisit JSGlobalObject.1661 // https://bugs.webkit.org/show_bug.cgi?id=2032041662 1661 slowCase.link(&jit); 1663 1662 jit.move(loadedValueGPR, GPRInfo::regT0); … … 1667 1666 #endif 1668 1667 jit.move(CCallHelpers::TrustedImmPtr(access.callLinkInfo()), GPRInfo::regT2); 1669 jit.move(CCallHelpers::TrustedImmPtr( state.m_globalObject), GPRInfo::regT3);1668 jit.move(CCallHelpers::TrustedImmPtr(globalObject), GPRInfo::regT3); 1670 1669 slowPathCall = jit.nearCall(); 1671 1670 if (m_type == Getter) … … 1711 1710 // https://bugs.webkit.org/show_bug.cgi?id=158014 1712 1711 GPRReg baseForCustom = m_type == CustomValueGetter || m_type == CustomValueSetter ? baseForAccessGPR : baseForCustomGetGPR; 1713 // FIXME: Revisit JSGlobalObject.1714 // https://bugs.webkit.org/show_bug.cgi?id=2032041712 // We do not need to keep globalObject alive since the owner CodeBlock (even if JSGlobalObject* is one of CodeBlock that is inlined and held by DFG CodeBlock) 1713 // must keep it alive. 1715 1714 if (m_type == CustomValueGetter || m_type == CustomAccessorGetter) { 1716 1715 RELEASE_ASSERT(m_identifier); 1717 1716 jit.setupArguments<PropertySlot::GetValueFunc>( 1718 CCallHelpers::TrustedImmPtr( codeBlock->globalObject()),1717 CCallHelpers::TrustedImmPtr(globalObject), 1719 1718 CCallHelpers::CellValue(baseForCustom), 1720 1719 CCallHelpers::TrustedImmPtr(uid())); 1721 1720 } else { 1722 1721 jit.setupArguments<PutPropertySlot::PutValueFunc>( 1723 CCallHelpers::TrustedImmPtr( codeBlock->globalObject()),1722 CCallHelpers::TrustedImmPtr(globalObject), 1724 1723 CCallHelpers::CellValue(baseForCustom), 1725 1724 valueRegs); -
trunk/Source/JavaScriptCore/bytecode/PolymorphicAccess.cpp
r257399 r259638 389 389 390 390 AccessGenerationResult PolymorphicAccess::regenerate( 391 const GCSafeConcurrentJSLocker& locker, VM& vm, CodeBlock* codeBlock, StructureStubInfo& stubInfo)391 const GCSafeConcurrentJSLocker& locker, VM& vm, JSGlobalObject* globalObject, CodeBlock* codeBlock, StructureStubInfo& stubInfo) 392 392 { 393 393 SuperSamplerScope superSamplerScope(false); … … 396 396 dataLog("Regenerate with m_list: ", listDump(m_list), "\n"); 397 397 398 AccessGenerationState state(vm, codeBlock->globalObject());398 AccessGenerationState state(vm, globalObject); 399 399 400 400 state.access = this; -
trunk/Source/JavaScriptCore/bytecode/PolymorphicAccess.h
r254464 r259638 145 145 const GCSafeConcurrentJSLocker&, VM&, CodeBlock*, StructureStubInfo&, std::unique_ptr<AccessCase>); 146 146 147 AccessGenerationResult regenerate(const GCSafeConcurrentJSLocker&, VM&, CodeBlock*, StructureStubInfo&);147 AccessGenerationResult regenerate(const GCSafeConcurrentJSLocker&, VM&, JSGlobalObject*, CodeBlock*, StructureStubInfo&); 148 148 149 149 bool isEmpty() const { return m_list.isEmpty(); } -
trunk/Source/JavaScriptCore/bytecode/StructureStubInfo.cpp
r259175 r259638 141 141 142 142 AccessGenerationResult StructureStubInfo::addAccessCase( 143 const GCSafeConcurrentJSLocker& locker, CodeBlock* codeBlock, CacheableIdentifier ident, std::unique_ptr<AccessCase> accessCase)143 const GCSafeConcurrentJSLocker& locker, JSGlobalObject* globalObject, CodeBlock* codeBlock, CacheableIdentifier ident, std::unique_ptr<AccessCase> accessCase) 144 144 { 145 145 checkConsistency(); … … 220 220 clearBufferedStructures(); 221 221 222 result = u.stub->regenerate(locker, vm, codeBlock, *this);222 result = u.stub->regenerate(locker, vm, globalObject, codeBlock, *this); 223 223 224 224 if (StructureStubInfoInternal::verbose) -
trunk/Source/JavaScriptCore/bytecode/StructureStubInfo.h
r259175 r259638 84 84 void initInByIdSelf(CodeBlock*, Structure* baseObjectStructure, PropertyOffset, CacheableIdentifier); 85 85 86 AccessGenerationResult addAccessCase(const GCSafeConcurrentJSLocker&, CodeBlock*, CacheableIdentifier, std::unique_ptr<AccessCase>);86 AccessGenerationResult addAccessCase(const GCSafeConcurrentJSLocker&, JSGlobalObject*, CodeBlock*, CacheableIdentifier, std::unique_ptr<AccessCase>); 87 87 88 88 void reset(CodeBlock*); -
trunk/Source/JavaScriptCore/jit/Repatch.cpp
r259463 r259638 397 397 LOG_IC((ICEvent::GetByAddAccessCase, baseValue.classInfoOrNull(vm), Identifier::fromUid(vm, propertyName.uid()), slot.slotBase() == baseValue)); 398 398 399 result = stubInfo.addAccessCase(locker, codeBlock, propertyName, WTFMove(newCase));399 result = stubInfo.addAccessCase(locker, globalObject, codeBlock, propertyName, WTFMove(newCase)); 400 400 401 401 if (result.generatedSomeCode()) { … … 496 496 } 497 497 498 result = stubInfo.addAccessCase(locker, codeBlock, nullptr, AccessCase::create(vm, codeBlock, accessType, nullptr));498 result = stubInfo.addAccessCase(locker, globalObject, codeBlock, nullptr, AccessCase::create(vm, codeBlock, accessType, nullptr)); 499 499 500 500 if (result.generatedSomeCode()) { … … 715 715 LOG_IC((ICEvent::PutByIdAddAccessCase, oldStructure->classInfo(), ident, slot.base() == baseValue)); 716 716 717 result = stubInfo.addAccessCase(locker, codeBlock, propertyName, WTFMove(newCase));717 result = stubInfo.addAccessCase(locker, globalObject, codeBlock, propertyName, WTFMove(newCase)); 718 718 719 719 if (result.generatedSomeCode()) { … … 779 779 } 780 780 781 result = stubInfo.addAccessCase(locker, codeBlock, propertyName, WTFMove(newCase));781 result = stubInfo.addAccessCase(locker, globalObject, codeBlock, propertyName, WTFMove(newCase)); 782 782 783 783 if (result.generatedSomeCode()) { … … 897 897 vm, codeBlock, wasFound ? AccessCase::InHit : AccessCase::InMiss, propertyName, wasFound ? slot.cachedOffset() : invalidOffset, structure, conditionSet, WTFMove(prototypeAccessChain)); 898 898 899 result = stubInfo.addAccessCase(locker, codeBlock, propertyName, WTFMove(newCase));899 result = stubInfo.addAccessCase(locker, globalObject, codeBlock, propertyName, WTFMove(newCase)); 900 900 901 901 if (result.generatedSomeCode()) { … … 965 965 LOG_IC((ICEvent::InstanceOfAddAccessCase, structure->classInfo(), Identifier())); 966 966 967 result = stubInfo.addAccessCase(locker, codeBlock, nullptr, WTFMove(newCase));967 result = stubInfo.addAccessCase(locker, globalObject, codeBlock, nullptr, WTFMove(newCase)); 968 968 969 969 if (result.generatedSomeCode()) { -
trunk/Source/JavaScriptCore/tools/JSDollarVM.cpp
r259480 r259638 1345 1345 } 1346 1346 1347 static EncodedJSValue customGetAccessorGlobalObject(JSGlobalObject* globalObject, EncodedJSValue, PropertyName) 1348 { 1349 return JSValue::encode(globalObject); 1350 } 1351 1352 static EncodedJSValue customGetValueGlobalObject(JSGlobalObject* globalObject, EncodedJSValue, PropertyName) 1353 { 1354 return JSValue::encode(globalObject); 1355 } 1356 1347 1357 static bool customSetAccessor(JSGlobalObject* globalObject, EncodedJSValue thisObject, EncodedJSValue encodedValue) 1348 1358 { … … 1384 1394 putDirectCustomAccessor(vm, Identifier::fromString(vm, "customAccessor"), 1385 1395 CustomGetterSetter::create(vm, customGetAccessor, customSetAccessor), static_cast<unsigned>(PropertyAttribute::CustomAccessor)); 1396 putDirectCustomAccessor(vm, Identifier::fromString(vm, "customValueGlobalObject"), 1397 CustomGetterSetter::create(vm, customGetValueGlobalObject, nullptr), 0); 1398 putDirectCustomAccessor(vm, Identifier::fromString(vm, "customAccessorGlobalObject"), 1399 CustomGetterSetter::create(vm, customGetAccessorGlobalObject, nullptr), static_cast<unsigned>(PropertyAttribute::CustomAccessor)); 1400 1386 1401 } 1387 1402
Note:
See TracChangeset
for help on using the changeset viewer.