Replace all use of ConstExprPoisoned with Poisoned.
authormark.lam@apple.com <mark.lam@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 14 Jan 2018 06:11:55 +0000 (06:11 +0000)
committermark.lam@apple.com <mark.lam@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 14 Jan 2018 06:11:55 +0000 (06:11 +0000)
commit392f42f13ee143fb13bd1979b33601cdf6239c85
tree8c6f0fd429a01cc2e84d1ad37265b61cf3ff08f2
parentbb85fb1cf575858b2508808dbfb8706c39fe86bf
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.

2. Change all clients to use the new poison values via the POISON() macro.

3. 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.

2. Consolidated Poisoned into PoisonedImpl.  PoisonedImpl is not more.

3. Changed all clients of ConstExprPoisoned to use Poisoned instead.

4. 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.

5. Removed ENABLE(MIXED_POISON) since we now have a workaround (3) that makes it
   possible to use the mixed poison code.

6. 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):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@226940 268f45cc-cd09-0410-ab3c-d52691b4dbfc
65 files changed:
Source/JavaScriptCore/API/JSAPIWrapperObject.h
Source/JavaScriptCore/API/JSCallbackFunction.h
Source/JavaScriptCore/API/JSCallbackObject.h
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
Source/JavaScriptCore/Sources.txt
Source/JavaScriptCore/assembler/MacroAssemblerCodeRef.h
Source/JavaScriptCore/b3/B3LowerMacros.cpp
Source/JavaScriptCore/b3/testb3.cpp
Source/JavaScriptCore/bytecode/CodeBlock.h
Source/JavaScriptCore/dfg/DFGOSRExitCompilerCommon.h
Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp
Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp
Source/JavaScriptCore/jit/JIT.h
Source/JavaScriptCore/jit/ThunkGenerators.cpp
Source/JavaScriptCore/llint/LowLevelInterpreter.asm
Source/JavaScriptCore/llint/LowLevelInterpreter32_64.asm
Source/JavaScriptCore/llint/LowLevelInterpreter64.asm
Source/JavaScriptCore/parser/UnlinkedSourceCode.h
Source/JavaScriptCore/runtime/ArrayPrototype.h
Source/JavaScriptCore/runtime/CustomGetterSetter.h
Source/JavaScriptCore/runtime/DateInstance.h
Source/JavaScriptCore/runtime/InternalFunction.h
Source/JavaScriptCore/runtime/JSArrayBuffer.h
Source/JavaScriptCore/runtime/JSCPoison.cpp [moved from Source/JavaScriptCore/runtime/JSCPoisonedPtr.cpp with 81% similarity]
Source/JavaScriptCore/runtime/JSCPoison.h
Source/JavaScriptCore/runtime/JSCPoisonedPtr.h [deleted file]
Source/JavaScriptCore/runtime/JSGlobalObject.h
Source/JavaScriptCore/runtime/JSScriptFetchParameters.h
Source/JavaScriptCore/runtime/JSScriptFetcher.h
Source/JavaScriptCore/runtime/NativeExecutable.h
Source/JavaScriptCore/runtime/StructureTransitionTable.h
Source/JavaScriptCore/runtime/WriteBarrier.h
Source/JavaScriptCore/wasm/js/JSToWasm.cpp
Source/JavaScriptCore/wasm/js/JSWebAssemblyCodeBlock.cpp
Source/JavaScriptCore/wasm/js/JSWebAssemblyCodeBlock.h
Source/JavaScriptCore/wasm/js/JSWebAssemblyInstance.h
Source/JavaScriptCore/wasm/js/JSWebAssemblyMemory.h
Source/JavaScriptCore/wasm/js/JSWebAssemblyModule.h
Source/JavaScriptCore/wasm/js/JSWebAssemblyTable.h
Source/JavaScriptCore/wasm/js/WasmToJS.cpp
Source/JavaScriptCore/wasm/js/WebAssemblyFunctionBase.h
Source/JavaScriptCore/wasm/js/WebAssemblyModuleRecord.h
Source/JavaScriptCore/wasm/js/WebAssemblyToJSCallee.h
Source/JavaScriptCore/wasm/js/WebAssemblyWrapperFunction.h
Source/WTF/ChangeLog
Source/WTF/wtf/Bag.h
Source/WTF/wtf/DumbPtrTraits.h
Source/WTF/wtf/DumbValueTraits.h
Source/WTF/wtf/Poisoned.h
Source/WTF/wtf/PoisonedUniquePtr.h
Source/WTF/wtf/Ref.h
Source/WTF/wtf/RefCountedArray.h
Source/WTF/wtf/RefPtr.h
Source/WTF/wtf/WTFAssertions.cpp
Tools/ChangeLog
Tools/TestWebKitAPI/CMakeLists.txt
Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
Tools/TestWebKitAPI/Tests/WTF/ConstExprPoisoned.cpp [deleted file]
Tools/TestWebKitAPI/Tests/WTF/Poisoned.cpp
Tools/TestWebKitAPI/Tests/WTF/PoisonedRef.cpp
Tools/TestWebKitAPI/Tests/WTF/PoisonedRefPtr.cpp
Tools/TestWebKitAPI/Tests/WTF/PoisonedUniquePtr.cpp
Tools/TestWebKitAPI/Tests/WTF/PoisonedUniquePtrForNonTriviallyDestructibleArrays.cpp
Tools/TestWebKitAPI/Tests/WTF/PoisonedUniquePtrForTriviallyDestructibleArrays.cpp