Ignore:
Timestamp:
Jan 13, 2018, 10:11:55 PM (7 years ago)
Author:
[email protected]
Message:

Replace all use of ConstExprPoisoned with Poisoned.
https://bugs.webkit.org/show_bug.cgi?id=181542
<rdar://problem/36442138>

Reviewed by JF Bastien.

Source/JavaScriptCore:

  1. All JSC poisons are now defined in JSCPoison.h.
  1. Change all clients to use the new poison values via the POISON() macro.
  1. The LLInt code has been updated to handle CodeBlock poison. Some of this code uses the t5 temp register, which is not available on the Windows port. Fortunately, we don't currently do poisoning on the Windows port yet. So, it will just work for now.

When poisoning is enabled for the Windows port, this LLInt code will need a
Windows specific implementation to workaround its lack of a t5 register.

  • API/JSAPIWrapperObject.h:
  • API/JSCallbackFunction.h:
  • API/JSCallbackObject.h:
  • JavaScriptCore.xcodeproj/project.pbxproj:
  • Sources.txt:
  • assembler/MacroAssemblerCodeRef.h:

(JSC::MacroAssemblerCodePtr::emptyValue):
(JSC::MacroAssemblerCodePtr::deletedValue):

  • b3/B3LowerMacros.cpp:
  • b3/testb3.cpp:

(JSC::B3::testInterpreter):

  • bytecode/CodeBlock.h:

(JSC::CodeBlock::instructions):
(JSC::CodeBlock::instructions const):
(JSC::CodeBlock::makePoisonedUnique):

  • dfg/DFGOSRExitCompilerCommon.h:

(JSC::DFG::adjustFrameAndStackInOSRExitCompilerThunk):

  • dfg/DFGSpeculativeJIT.cpp:

(JSC::DFG::SpeculativeJIT::compileCheckSubClass):
(JSC::DFG::SpeculativeJIT::emitSwitchIntJump):

  • ftl/FTLLowerDFGToB3.cpp:

(JSC::FTL::DFG::LowerDFGToB3::compileCheckSubClass):

  • jit/JIT.h:
  • jit/ThunkGenerators.cpp:

(JSC::virtualThunkFor):
(JSC::nativeForGenerator):
(JSC::boundThisNoArgsFunctionCallGenerator):

  • llint/LowLevelInterpreter.asm:
  • llint/LowLevelInterpreter32_64.asm:
  • llint/LowLevelInterpreter64.asm:
  • parser/UnlinkedSourceCode.h:
  • runtime/ArrayPrototype.h:
  • runtime/CustomGetterSetter.h:
  • runtime/DateInstance.h:
  • runtime/InternalFunction.h:
  • runtime/JSArrayBuffer.h:
  • runtime/JSCPoison.cpp: Copied from Source/JavaScriptCore/runtime/JSCPoisonedPtr.cpp.

(JSC::initializePoison):

  • runtime/JSCPoison.h:

(): Deleted.

  • runtime/JSCPoisonedPtr.cpp: Removed.
  • runtime/JSCPoisonedPtr.h: Removed.
  • runtime/JSGlobalObject.h:

(JSC::JSGlobalObject::makePoisonedUnique):

  • runtime/JSScriptFetchParameters.h:
  • runtime/JSScriptFetcher.h:
  • runtime/NativeExecutable.h:
  • runtime/StructureTransitionTable.h:

(JSC::StructureTransitionTable::map const):
(JSC::StructureTransitionTable::weakImpl const):

  • runtime/WriteBarrier.h:

(JSC::WriteBarrier::poison):

  • wasm/js/JSToWasm.cpp:

(JSC::Wasm::createJSToWasmWrapper):

  • wasm/js/JSWebAssemblyCodeBlock.cpp:

(JSC::JSWebAssemblyCodeBlock::JSWebAssemblyCodeBlock):

  • wasm/js/JSWebAssemblyCodeBlock.h:
  • wasm/js/JSWebAssemblyInstance.h:
  • wasm/js/JSWebAssemblyMemory.h:
  • wasm/js/JSWebAssemblyModule.h:
  • wasm/js/JSWebAssemblyTable.h:
  • wasm/js/WasmToJS.cpp:

(JSC::Wasm::handleBadI64Use):
(JSC::Wasm::wasmToJS):

  • wasm/js/WebAssemblyFunctionBase.h:
  • wasm/js/WebAssemblyModuleRecord.h:
  • wasm/js/WebAssemblyToJSCallee.h:
  • wasm/js/WebAssemblyWrapperFunction.h:

Source/WTF:

  1. Removed ConstExprPoisoned and its artifacts.
  1. Consolidated Poisoned into PoisonedImpl. PoisonedImpl is not more.
  1. Changed all clients of ConstExprPoisoned to use Poisoned instead.
  1. Worked around the GCC and Clang compiler bug that confuses an intptr_t& template arg with intptr_t. See use of std::enable_if_t<Other::isPoisoned> in Poisoned.h.
  1. Removed ENABLE(MIXED_POISON) since we now have a workaround (3) that makes it possible to use the mixed poison code.
  1. Also fixed broken implementation of comparison operators in Poisoned.
  • wtf/Bag.h:
  • wtf/DumbPtrTraits.h:

(WTF::DumbPtrTraits::poison):

  • wtf/DumbValueTraits.h:

(WTF::DumbValueTraits::poison):

  • wtf/Poisoned.h:

(WTF::Poisoned::Poisoned):
(WTF::Poisoned::operator== const):
(WTF::Poisoned::operator!= const):
(WTF::Poisoned::operator< const):
(WTF::Poisoned::operator<= const):
(WTF::Poisoned::operator> const):
(WTF::Poisoned::operator>= const):
(WTF::Poisoned::operator=):
(WTF::Poisoned::swap):
(WTF::swap):
(WTF::PoisonedPtrTraits::poison):
(WTF::PoisonedPtrTraits::swap):
(WTF::PoisonedValueTraits::poison):
(WTF::PoisonedValueTraits::swap):
(WTF::PoisonedImpl::PoisonedImpl): Deleted.
(WTF::PoisonedImpl::assertIsPoisoned const): Deleted.
(WTF::PoisonedImpl::assertIsNotPoisoned const): Deleted.
(WTF::PoisonedImpl::unpoisoned const): Deleted.
(WTF::PoisonedImpl::clear): Deleted.
(WTF::PoisonedImpl::operator* const): Deleted.
(WTF::PoisonedImpl::operator-> const): Deleted.
(WTF::PoisonedImpl::bits const): Deleted.
(WTF::PoisonedImpl::operator! const): Deleted.
(WTF::PoisonedImpl::operator bool const): Deleted.
(WTF::PoisonedImpl::operator== const): Deleted.
(WTF::PoisonedImpl::operator!= const): Deleted.
(WTF::PoisonedImpl::operator< const): Deleted.
(WTF::PoisonedImpl::operator<= const): Deleted.
(WTF::PoisonedImpl::operator> const): Deleted.
(WTF::PoisonedImpl::operator>= const): Deleted.
(WTF::PoisonedImpl::operator=): Deleted.
(WTF::PoisonedImpl::swap): Deleted.
(WTF::PoisonedImpl::exchange): Deleted.
(WTF::PoisonedImpl::poison): Deleted.
(WTF::PoisonedImpl::unpoison): Deleted.
(WTF::constExprPoisonRandom): Deleted.
(WTF::makeConstExprPoison): Deleted.
(WTF::ConstExprPoisonedPtrTraits::exchange): Deleted.
(WTF::ConstExprPoisonedPtrTraits::swap): Deleted.
(WTF::ConstExprPoisonedPtrTraits::unwrap): Deleted.
(WTF::ConstExprPoisonedValueTraits::exchange): Deleted.
(WTF::ConstExprPoisonedValueTraits::swap): Deleted.
(WTF::ConstExprPoisonedValueTraits::unwrap): Deleted.

  • wtf/PoisonedUniquePtr.h:

(WTF::PoisonedUniquePtr::PoisonedUniquePtr):
(WTF::PoisonedUniquePtr::operator=):

  • wtf/Ref.h:
  • wtf/RefCountedArray.h:

(WTF::RefCountedArray::RefCountedArray):

  • wtf/RefPtr.h:
  • wtf/WTFAssertions.cpp:

Tools:

  1. Converted tests to using new uintptr_t& poison type.
  2. Added tests for Poisoned comparison operators.
  • TestWebKitAPI/CMakeLists.txt:
  • TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
  • TestWebKitAPI/Tests/WTF/ConstExprPoisoned.cpp: Removed.
  • TestWebKitAPI/Tests/WTF/Poisoned.cpp:

(TestWebKitAPI::TEST):
(TestWebKitAPI::initializeTestPoison): Deleted.

  • TestWebKitAPI/Tests/WTF/PoisonedRef.cpp:

(TestWebKitAPI::TEST):
(TestWebKitAPI::passWithRef):

  • TestWebKitAPI/Tests/WTF/PoisonedRefPtr.cpp:

(TestWebKitAPI::TEST):
(TestWebKitAPI::f1):

  • TestWebKitAPI/Tests/WTF/PoisonedUniquePtr.cpp:

(TestWebKitAPI::TEST):
(TestWebKitAPI::poisonedPtrFoo):

  • TestWebKitAPI/Tests/WTF/PoisonedUniquePtrForNonTriviallyDestructibleArrays.cpp:

(TestWebKitAPI::TEST):

  • TestWebKitAPI/Tests/WTF/PoisonedUniquePtrForTriviallyDestructibleArrays.cpp:

(TestWebKitAPI::TEST):

File:
1 edited

Legend:

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

    r226556 r226940  
    4646    loadp CodeBlock[cfr], PB
    4747    loadp CodeBlock::m_instructions[PB], PB
    48     unpoison(CodeBlockPoison, PB)
     48    unpoison(_g_CodeBlockPoison, PB, t1)
    4949    loadisFromInstruction(1, t1)
    5050    storeq r0, [cfr, t1, 8]
     
    481481end
    482482
    483 macro structureIDToStructureWithScratch(structureIDThenStructure, scratch)
     483macro structureIDToStructureWithScratch(structureIDThenStructure, scratch, scratch2)
    484484    loadp CodeBlock[cfr], scratch
    485485    loadp CodeBlock::m_poisonedVM[scratch], scratch
    486     unpoison(CodeBlockPoison, scratch)
     486    unpoison(_g_CodeBlockPoison, scratch, scratch2)
    487487    loadp VM::heap + Heap::m_structureIDTable + StructureIDTable::m_table[scratch], scratch
    488488    loadp [scratch, structureIDThenStructure, 8], structureIDThenStructure
    489489end
    490490
    491 macro loadStructureWithScratch(cell, structure, scratch)
     491macro loadStructureWithScratch(cell, structure, scratch, scratch2)
    492492    loadi JSCell::m_structureID[cell], structure
    493     structureIDToStructureWithScratch(structure, scratch)
    494 end
    495 
    496 macro loadStructureAndClobberFirstArg(cell, structure)
    497     loadi JSCell::m_structureID[cell], structure
    498     loadp CodeBlock[cfr], cell
    499     loadp CodeBlock::m_poisonedVM[cell], cell
    500     unpoison(CodeBlockPoison, cell)
    501     loadp VM::heap + Heap::m_structureIDTable + StructureIDTable::m_table[cell], cell
    502     loadp [cell, structure, 8], structure
     493    structureIDToStructureWithScratch(structure, scratch, scratch2)
    503494end
    504495
     
    563554    loadp CodeBlock[cfr], t1
    564555    loadp CodeBlock::m_instructions[t1], PB
    565     unpoison(CodeBlockPoison, PB)
     556    unpoison(_g_CodeBlockPoison, PB, t2)
    566557    move 0, PC
    567558    jmp doneLabel
     
    642633    btqnz t0, tagMask, .opToThisSlow
    643634    bbneq JSCell::m_type[t0], FinalObjectType, .opToThisSlow
    644     loadStructureWithScratch(t0, t1, t2)
     635    loadStructureWithScratch(t0, t1, t2, t3)
    645636    loadpFromInstruction(2, t2)
    646637    bpneq t1, t2, .opToThisSlow
     
    725716    jmp .done
    726717.masqueradesAsUndefined:
    727     loadStructureWithScratch(t0, t2, t1)
     718    loadStructureWithScratch(t0, t2, t1, t3)
    728719    loadp CodeBlock[cfr], t0
    729720    loadp CodeBlock::m_globalObject[t0], t0
     
    11641155    dispatch(constexpr op_is_undefined_length)
    11651156.masqueradesAsUndefined:
    1166     loadStructureWithScratch(t0, t3, t1)
     1157    loadStructureWithScratch(t0, t3, t1, t5)
    11671158    loadp CodeBlock[cfr], t1
    11681159    loadp CodeBlock::m_globalObject[t1], t1
     
    14341425    assert(macro (ok) btpnz t3, ok end)
    14351426
    1436     structureIDToStructureWithScratch(t2, t1)
     1427    structureIDToStructureWithScratch(t2, t1, t5)
    14371428    loadq Structure::m_prototype[t2], t2
    14381429    bqeq t2, ValueNull, .opPutByIdTransitionChainDone
     
    17411732    loadq [cfr, t0, 8], t0
    17421733    btqnz t0, tagMask, .immediate
    1743     loadStructureWithScratch(t0, t2, t1)
     1734    loadStructureWithScratch(t0, t2, t1, t3)
    17441735    cellHandler(t2, JSCell::m_flags[t0], .target)
    17451736    dispatch(3)
     
    19551946    move t3, sp
    19561947    if POISON
    1957         loadp _g_jitCodePoison, t2
     1948        loadp _g_JITCodePoison, t2
    19581949        xorp LLIntCallLinkInfo::machineCodeTarget[t1], t2
    19591950        prepareCall(t2, t1, t3, t4)
     
    20081999    loadp CodeBlock[cfr], PB
    20092000    loadp CodeBlock::m_instructions[PB], PB
    2010     unpoison(CodeBlockPoison, PB)
     2001    unpoison(_g_CodeBlockPoison, PB, t2)
    20112002    loadp VM::targetInterpreterPCForThrow[t3], PC
    20122003    subp PB, PC
     
    20852076    checkStackPointerAlignment(t3, 0xdead0001)
    20862077    if C_LOOP
    2087         loadp _g_nativeCodePoison, t2
     2078        loadp _g_NativeCodePoison, t2
    20882079        xorp executableOffsetToFunction[t1], t2
    20892080        cloopCallNative t2
     
    20942085            addp 32, sp
    20952086        else
    2096             loadp _g_nativeCodePoison, t2
     2087            loadp _g_NativeCodePoison, t2
    20972088            xorp executableOffsetToFunction[t1], t2
    20982089            call t2
     
    21282119    checkStackPointerAlignment(t3, 0xdead0001)
    21292120    if C_LOOP
    2130         loadp _g_nativeCodePoison, t2
     2121        loadp _g_NativeCodePoison, t2
    21312122        xorp offsetOfFunction[t1], t2
    21322123        cloopCallNative t2
     
    21372128            addp 32, sp
    21382129        else
    2139             loadp _g_nativeCodePoison, t2
     2130            loadp _g_NativeCodePoison, t2
    21402131            xorp offsetOfFunction[t1], t2
    21412132            call t2
     
    22482239    loadisFromInstruction(operand, t0)
    22492240    loadq [cfr, t0, 8], t0
    2250     loadStructureWithScratch(t0, t2, t1)
     2241    loadStructureWithScratch(t0, t2, t1, t3)
    22512242    loadpFromInstruction(5, t1)
    22522243    bpneq t2, t1, slowPath
     
    25012492    loadp CodeBlock[cfr], t1
    25022493    loadp CodeBlock::m_poisonedVM[t1], t1
    2503     unpoison(CodeBlockPoison, t1)
     2494    unpoison(_g_CodeBlockPoison, t1, t3)
    25042495    # t1 is holding the pointer to the typeProfilerLog.
    25052496    loadp VM::m_typeProfilerLog[t1], t1
Note: See TracChangeset for help on using the changeset viewer.