Ignore:
Timestamp:
Oct 24, 2019, 1:27:38 PM (6 years ago)
Author:
[email protected]
Message:

[JSC] Remove LLInt's Callee size assumption
https://bugs.webkit.org/show_bug.cgi?id=203282

Reviewed by Mark Lam.

LLInt code still assumes that Callee is always allocated in non-LargeAllocation.
This patch removes this assumption by following three changes.

  1. If we can get CodeBlock, we get VM& from CodeBlock.
  2. In nativeCallTrampoline and internalFunctionCallTrampoline, we get VM& from JSGlobalObject. It involves one more pointer-chasing but it is OK since this JSGlobalObject's VM* field will be touched in called native functions anyway. And this code is only used when we are not using JIT.
  3. In exception handling code in LLInt, we get VM& from callee by checking LargeAllocation possibility. This is OK since it is only executed when exception unwinding happens, and which is an expensive operation anyway.
  • heap/LargeAllocation.h:

(JSC::LargeAllocation::headerSize):

  • heap/WeakSet.h:

(JSC::WeakSet::WeakSet):
(JSC::WeakSet::vm const):

  • llint/LowLevelInterpreter.asm:
  • llint/LowLevelInterpreter32_64.asm:
  • llint/LowLevelInterpreter64.asm:
  • runtime/JSGlobalObject.cpp:

(JSC::JSGlobalObject::JSGlobalObject):
(JSC::JSGlobalObject::init):

  • runtime/JSGlobalObject.h:

(JSC::JSGlobalObject::vm const):
(JSC::JSGlobalObject::defaultCodeGenerationMode const):

  • runtime/VM.h:

(JSC::WeakSet::heap const):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/llint/LowLevelInterpreter.asm

    r251425 r251556  
    540540const MarkedBlockMask = ~(MarkedBlockSize - 1)
    541541const MarkedBlockFooterOffset = constexpr MarkedBlock::offsetOfFooter
     542const LargeAllocationHeaderSize = constexpr (LargeAllocation::headerSize())
     543const LargeAllocationVMOffset = (LargeAllocation::m_weakSet + WeakSet::m_vm - LargeAllocationHeaderSize)
    542544
    543545const BlackThreshold = constexpr blackThreshold
     
    11291131macro notFunctionCodeBlockSetter(sourceRegister)
    11301132    # Nothing to do!
     1133end
     1134
     1135macro convertCalleeToVM(callee)
     1136    btpnz callee, (constexpr LargeAllocation::halfAlignment), .largeAllocation
     1137    andp MarkedBlockMask, callee
     1138    loadp MarkedBlockFooterOffset + MarkedBlock::Footer::m_vm[callee], callee
     1139    jmp .done
     1140.largeAllocation:
     1141    loadp LargeAllocationVMOffset[callee], callee
     1142.done:
    11311143end
    11321144
     
    17831795macro doCallVarargs(opcodeName, size, opcodeStruct, dispatch, frameSlowPath, slowPath, prepareCall)
    17841796    callSlowPath(frameSlowPath)
    1785     branchIfException(_llint_throw_from_slow_path_trampoline)
     1797    loadp CodeBlock[cfr], t3
     1798    loadp CodeBlock::m_vm[t3], t3
     1799    btpz VM::m_exception[t3], .noException
     1800    jmp _llint_throw_from_slow_path_trampoline
     1801.noException:
    17861802    # calleeFrame in r1
    17871803    if JSVALUE64
Note: See TracChangeset for help on using the changeset viewer.