Ignore:
Timestamp:
Jun 21, 2017, 11:42:44 AM (8 years ago)
Author:
[email protected]
Message:

Make it clear that regenerating ICs are holding the CodeBlock's lock by passing the locker as a parameter
https://bugs.webkit.org/show_bug.cgi?id=173609

Reviewed by Keith Miller.

This patch makes many of the IC generating functions require a locker as
a parameter. We do this in other places in JSC to indicate that
a particular API is only valid while a particular lock is held.
This is the case when generating ICs. This patch just makes it
explicit in the IC generating interface.

  • bytecode/PolymorphicAccess.cpp:

(JSC::PolymorphicAccess::addCases):
(JSC::PolymorphicAccess::addCase):
(JSC::PolymorphicAccess::commit):
(JSC::PolymorphicAccess::regenerate):

  • bytecode/PolymorphicAccess.h:
  • bytecode/StructureStubInfo.cpp:

(JSC::StructureStubInfo::addAccessCase):
(JSC::StructureStubInfo::initStub): Deleted.

  • bytecode/StructureStubInfo.h:
  • jit/Repatch.cpp:

(JSC::tryCacheGetByID):
(JSC::repatchGetByID):
(JSC::tryCachePutByID):
(JSC::repatchPutByID):
(JSC::tryRepatchIn):
(JSC::repatchIn):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/jit/Repatch.cpp

    r218552 r218641  
    158158}
    159159
    160 static InlineCacheAction tryCacheGetByID(ExecState* exec, JSValue baseValue, const Identifier& propertyName, const PropertySlot& slot, StructureStubInfo& stubInfo, GetByIDKind kind)
     160static InlineCacheAction tryCacheGetByID(const GCSafeConcurrentJSLocker& locker, ExecState* exec, JSValue baseValue, const Identifier& propertyName, const PropertySlot& slot, StructureStubInfo& stubInfo, GetByIDKind kind)
    161161{
    162162    if (forceICFailure(exec))
     
    324324    LOG_IC((ICEvent::GetByIdAddAccessCase, baseValue.classInfoOrNull(vm), propertyName));
    325325
    326     AccessGenerationResult result = stubInfo.addAccessCase(codeBlock, propertyName, WTFMove(newCase));
     326    AccessGenerationResult result = stubInfo.addAccessCase(locker, codeBlock, propertyName, WTFMove(newCase));
    327327
    328328    if (result.generatedSomeCode()) {
     
    341341    GCSafeConcurrentJSLocker locker(exec->codeBlock()->m_lock, exec->vm().heap);
    342342   
    343     if (tryCacheGetByID(exec, baseValue, propertyName, slot, stubInfo, kind) == GiveUpOnCache)
     343    if (tryCacheGetByID(locker, exec, baseValue, propertyName, slot, stubInfo, kind) == GiveUpOnCache)
    344344        ftlThunkAwareRepatchCall(exec->codeBlock(), stubInfo.slowPathCallLocation(), appropriateGenericGetByIdFunction(kind));
    345345}
     
    369369}
    370370
    371 static InlineCacheAction tryCachePutByID(ExecState* exec, JSValue baseValue, Structure* structure, const Identifier& ident, const PutPropertySlot& slot, StructureStubInfo& stubInfo, PutKind putKind)
     371static InlineCacheAction tryCachePutByID(const GCSafeConcurrentJSLocker& locker, ExecState* exec, JSValue baseValue, Structure* structure, const Identifier& ident, const PutPropertySlot& slot, StructureStubInfo& stubInfo, PutKind putKind)
    372372{
    373373    if (forceICFailure(exec))
     
    477477    LOG_IC((ICEvent::PutByIdAddAccessCase, structure->classInfo(), ident));
    478478   
    479     AccessGenerationResult result = stubInfo.addAccessCase(codeBlock, ident, WTFMove(newCase));
     479    AccessGenerationResult result = stubInfo.addAccessCase(locker, codeBlock, ident, WTFMove(newCase));
    480480   
    481481    if (result.generatedSomeCode()) {
     
    495495    GCSafeConcurrentJSLocker locker(exec->codeBlock()->m_lock, exec->vm().heap);
    496496   
    497     if (tryCachePutByID(exec, baseValue, structure, propertyName, slot, stubInfo, putKind) == GiveUpOnCache)
     497    if (tryCachePutByID(locker, exec, baseValue, structure, propertyName, slot, stubInfo, putKind) == GiveUpOnCache)
    498498        ftlThunkAwareRepatchCall(exec->codeBlock(), stubInfo.slowPathCallLocation(), appropriateGenericPutByIdFunction(slot, putKind));
    499499}
    500500
    501501static InlineCacheAction tryRepatchIn(
    502     ExecState* exec, JSCell* base, const Identifier& ident, bool wasFound,
    503     const PropertySlot& slot, StructureStubInfo& stubInfo)
     502    const GCSafeConcurrentJSLocker& locker, ExecState* exec, JSCell* base, const Identifier& ident,
     503    bool wasFound, const PropertySlot& slot, StructureStubInfo& stubInfo)
    504504{
    505505    if (forceICFailure(exec))
     
    536536        vm, codeBlock, wasFound ? AccessCase::InHit : AccessCase::InMiss, invalidOffset, structure, conditionSet);
    537537
    538     AccessGenerationResult result = stubInfo.addAccessCase(codeBlock, ident, WTFMove(newCase));
     538    AccessGenerationResult result = stubInfo.addAccessCase(locker, codeBlock, ident, WTFMove(newCase));
    539539   
    540540    if (result.generatedSomeCode()) {
     
    557557    SuperSamplerScope superSamplerScope(false);
    558558    GCSafeConcurrentJSLocker locker(exec->codeBlock()->m_lock, exec->vm().heap);
    559     if (tryRepatchIn(exec, base, ident, wasFound, slot, stubInfo) == GiveUpOnCache)
     559    if (tryRepatchIn(locker, exec, base, ident, wasFound, slot, stubInfo) == GiveUpOnCache)
    560560        ftlThunkAwareRepatchCall(exec->codeBlock(), stubInfo.slowPathCallLocation(), operationIn);
    561561}
Note: See TracChangeset for help on using the changeset viewer.