Changeset 242123 in webkit
- Timestamp:
- Feb 26, 2019, 9:43:34 PM (6 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 2 deleted
- 55 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/API/JSAPIWrapperObject.h
r232443 r242123 1 1 /* 2 * Copyright (C) 2013-201 8Apple Inc. All rights reserved.2 * Copyright (C) 2013-2019 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 28 28 29 29 #include "JSBase.h" 30 #include "JSCPoison.h"31 30 #include "JSDestructibleObject.h" 32 #include <wtf/Poisoned.h>33 31 34 32 #if JSC_OBJC_API_ENABLED || defined(JSC_GLIB_API_ENABLED) … … 43 41 static void visitChildren(JSCell*, JSC::SlotVisitor&); 44 42 45 void* wrappedObject() { return m_wrappedObject .unpoisoned(); }43 void* wrappedObject() { return m_wrappedObject; } 46 44 void setWrappedObject(void*); 47 45 … … 50 48 51 49 private: 52 Poisoned<JSAPIWrapperObjectPoison, void*> m_wrappedObject;50 void* m_wrappedObject { nullptr }; 53 51 }; 54 52 -
trunk/Source/JavaScriptCore/API/JSCallbackFunction.h
r240965 r242123 1 1 /* 2 * Copyright (C) 2006-201 8Apple Inc. All rights reserved.2 * Copyright (C) 2006-2019 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 28 28 29 29 #include "InternalFunction.h" 30 #include "JSCPoison.h"31 30 #include "JSObjectRef.h" 32 31 … … 59 58 void finishCreation(VM&, const String& name); 60 59 61 JSObjectCallAsFunctionCallback functionCallback() { return m_callback .unpoisoned(); }60 JSObjectCallAsFunctionCallback functionCallback() { return m_callback; } 62 61 63 Poisoned<NativeCodePoison, JSObjectCallAsFunctionCallback> m_callback;62 JSObjectCallAsFunctionCallback m_callback { nullptr }; 64 63 }; 65 64 -
trunk/Source/JavaScriptCore/API/JSCallbackObject.h
r242100 r242123 28 28 #define JSCallbackObject_h 29 29 30 #include "JSCPoison.h"31 30 #include "JSObjectRef.h" 32 31 #include "JSValueRef.h" 33 32 #include "JSObject.h" 34 #include <wtf/PoisonedUniquePtr.h>35 33 36 34 namespace JSC { … … 228 226 static EncodedJSValue callbackGetter(ExecState*, EncodedJSValue, PropertyName); 229 227 230 WTF::PoisonedUniquePtr<JSCallbackObjectPoison,JSCallbackObjectData> m_callbackObjectData;228 std::unique_ptr<JSCallbackObjectData> m_callbackObjectData; 231 229 const ClassInfo* m_classInfo { nullptr }; 232 230 }; -
trunk/Source/JavaScriptCore/API/glib/JSAPIWrapperGlobalObject.h
r234025 r242123 28 28 #include "JSBase.h" 29 29 #include "JSCGLibWrapperObject.h" 30 #include "JSCPoison.h"31 30 #include "JSGlobalObject.h" 32 31 -
trunk/Source/JavaScriptCore/CMakeLists.txt
r242047 r242123 831 831 runtime/JSCJSValue.h 832 832 runtime/JSCJSValueInlines.h 833 runtime/JSCPoison.h834 833 runtime/JSCPtrTag.h 835 834 runtime/JSCallee.h -
trunk/Source/JavaScriptCore/ChangeLog
r242114 r242123 1 2019-02-26 Mark Lam <mark.lam@apple.com> 2 3 Remove poisons in JSCPoison and uses of them. 4 https://bugs.webkit.org/show_bug.cgi?id=195082 5 6 Reviewed by Yusuke Suzuki. 7 8 Also removed unused poisoning code in WriteBarrier, AssemblyHelpers, 9 DFG::SpeculativeJIT, FTLLowerDFGToB3, and FTL::Output. 10 11 * API/JSAPIWrapperObject.h: 12 (JSC::JSAPIWrapperObject::wrappedObject): 13 * API/JSCallbackFunction.h: 14 * API/JSCallbackObject.h: 15 * API/glib/JSAPIWrapperGlobalObject.h: 16 * CMakeLists.txt: 17 * JavaScriptCore.xcodeproj/project.pbxproj: 18 * Sources.txt: 19 * bytecode/AccessCase.cpp: 20 (JSC::AccessCase::generateWithGuard): 21 * dfg/DFGSpeculativeJIT.cpp: 22 (JSC::DFG::SpeculativeJIT::compileGetByValOnScopedArguments): 23 (JSC::DFG::SpeculativeJIT::compileGetArrayLength): 24 (JSC::DFG::SpeculativeJIT::compileNewFunctionCommon): 25 (JSC::DFG::SpeculativeJIT::compileGetExecutable): 26 (JSC::DFG::SpeculativeJIT::compileCreateThis): 27 * dfg/DFGSpeculativeJIT.h: 28 (JSC::DFG::SpeculativeJIT::TrustedImmPtr::weakPoisonedPointer): Deleted. 29 * ftl/FTLLowerDFGToB3.cpp: 30 (JSC::FTL::DFG::LowerDFGToB3::compileGetExecutable): 31 (JSC::FTL::DFG::LowerDFGToB3::compileGetArrayLength): 32 (JSC::FTL::DFG::LowerDFGToB3::compileGetByVal): 33 (JSC::FTL::DFG::LowerDFGToB3::compileNewFunction): 34 (JSC::FTL::DFG::LowerDFGToB3::weakPointer): 35 (JSC::FTL::DFG::LowerDFGToB3::dynamicPoison): Deleted. 36 (JSC::FTL::DFG::LowerDFGToB3::dynamicPoisonOnLoadedType): Deleted. 37 (JSC::FTL::DFG::LowerDFGToB3::dynamicPoisonOnType): Deleted. 38 (JSC::FTL::DFG::LowerDFGToB3::weakPoisonedPointer): Deleted. 39 * ftl/FTLOutput.h: 40 (JSC::FTL::Output::weakPoisonedPointer): Deleted. 41 * jit/AssemblyHelpers.cpp: 42 (JSC::AssemblyHelpers::emitDynamicPoison): Deleted. 43 (JSC::AssemblyHelpers::emitDynamicPoisonOnLoadedType): Deleted. 44 (JSC::AssemblyHelpers::emitDynamicPoisonOnType): Deleted. 45 * jit/AssemblyHelpers.h: 46 * jit/JITOpcodes.cpp: 47 (JSC::JIT::emit_op_create_this): 48 * jit/JITPropertyAccess.cpp: 49 (JSC::JIT::emitScopedArgumentsGetByVal): 50 * jit/Repatch.cpp: 51 (JSC::linkPolymorphicCall): 52 * jit/ThunkGenerators.cpp: 53 (JSC::virtualThunkFor): 54 (JSC::nativeForGenerator): 55 (JSC::boundThisNoArgsFunctionCallGenerator): 56 * parser/UnlinkedSourceCode.h: 57 * runtime/ArrayPrototype.h: 58 * runtime/CustomGetterSetter.h: 59 (JSC::CustomGetterSetter::getter const): 60 (JSC::CustomGetterSetter::setter const): 61 * runtime/InitializeThreading.cpp: 62 (JSC::initializeThreading): 63 * runtime/InternalFunction.cpp: 64 (JSC::InternalFunction::getCallData): 65 (JSC::InternalFunction::getConstructData): 66 * runtime/InternalFunction.h: 67 (JSC::InternalFunction::nativeFunctionFor): 68 * runtime/JSArrayBuffer.h: 69 * runtime/JSBoundFunction.h: 70 * runtime/JSCPoison.cpp: Removed. 71 * runtime/JSCPoison.h: Removed. 72 * runtime/JSFunction.h: 73 * runtime/JSGlobalObject.h: 74 * runtime/JSScriptFetchParameters.h: 75 * runtime/JSScriptFetcher.h: 76 * runtime/JSString.h: 77 * runtime/NativeExecutable.cpp: 78 (JSC::NativeExecutable::hashFor const): 79 * runtime/NativeExecutable.h: 80 * runtime/Options.h: 81 * runtime/ScopedArguments.h: 82 * runtime/Structure.cpp: 83 (JSC::StructureTransitionTable::setSingleTransition): 84 * runtime/StructureTransitionTable.h: 85 (JSC::StructureTransitionTable::map const): 86 (JSC::StructureTransitionTable::weakImpl const): 87 (JSC::StructureTransitionTable::setMap): 88 * runtime/WriteBarrier.h: 89 * wasm/WasmB3IRGenerator.cpp: 90 * wasm/WasmInstance.h: 91 * wasm/js/JSToWasm.cpp: 92 (JSC::Wasm::createJSToWasmWrapper): 93 * wasm/js/JSWebAssemblyCodeBlock.h: 94 * wasm/js/JSWebAssemblyInstance.cpp: 95 (JSC::JSWebAssemblyInstance::JSWebAssemblyInstance): 96 (JSC::JSWebAssemblyInstance::visitChildren): 97 * wasm/js/JSWebAssemblyInstance.h: 98 * wasm/js/JSWebAssemblyMemory.h: 99 * wasm/js/JSWebAssemblyModule.h: 100 * wasm/js/JSWebAssemblyTable.cpp: 101 (JSC::JSWebAssemblyTable::JSWebAssemblyTable): 102 (JSC::JSWebAssemblyTable::grow): 103 (JSC::JSWebAssemblyTable::clearFunction): 104 * wasm/js/JSWebAssemblyTable.h: 105 * wasm/js/WasmToJS.cpp: 106 (JSC::Wasm::materializeImportJSCell): 107 (JSC::Wasm::handleBadI64Use): 108 (JSC::Wasm::wasmToJS): 109 * wasm/js/WebAssemblyFunctionBase.h: 110 * wasm/js/WebAssemblyModuleRecord.cpp: 111 (JSC::WebAssemblyModuleRecord::link): 112 (JSC::WebAssemblyModuleRecord::evaluate): 113 * wasm/js/WebAssemblyModuleRecord.h: 114 * wasm/js/WebAssemblyToJSCallee.h: 115 * wasm/js/WebAssemblyWrapperFunction.h: 116 1 117 2019-02-26 Mark Lam <mark.lam@apple.com> 2 118 -
trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
r242047 r242123 1811 1811 FE20CE9E15F04A9500DF3430 /* LLIntCLoop.h in Headers */ = {isa = PBXBuildFile; fileRef = FE20CE9C15F04A9500DF3430 /* LLIntCLoop.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1812 1812 FE2A87601F02381600EB31B2 /* MinimumReservedZoneSize.h in Headers */ = {isa = PBXBuildFile; fileRef = FE2A875F1F02381600EB31B2 /* MinimumReservedZoneSize.h */; }; 1813 FE2B0B731FD9EF700075DA5F /* JSCPoison.h in Headers */ = {isa = PBXBuildFile; fileRef = FE2B0B701FD8C4630075DA5F /* JSCPoison.h */; settings = {ATTRIBUTES = (Private, ); }; };1814 1813 FE3022D31E3D73A500BAC493 /* SigillCrashAnalyzer.h in Headers */ = {isa = PBXBuildFile; fileRef = FE3022D11E3D739600BAC493 /* SigillCrashAnalyzer.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1815 1814 FE3022D71E42857300BAC493 /* VMInspector.h in Headers */ = {isa = PBXBuildFile; fileRef = FE3022D51E42856700BAC493 /* VMInspector.h */; }; … … 4820 4819 FE20CE9C15F04A9500DF3430 /* LLIntCLoop.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LLIntCLoop.h; path = llint/LLIntCLoop.h; sourceTree = "<group>"; }; 4821 4820 FE2A875F1F02381600EB31B2 /* MinimumReservedZoneSize.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MinimumReservedZoneSize.h; sourceTree = "<group>"; }; 4822 FE2B0B681FD0D2970075DA5F /* JSCPoison.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCPoison.cpp; sourceTree = "<group>"; };4823 FE2B0B701FD8C4630075DA5F /* JSCPoison.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCPoison.h; sourceTree = "<group>"; };4824 4821 FE2E6A7A1D6EA5FE0060F896 /* ThrowScope.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ThrowScope.cpp; sourceTree = "<group>"; }; 4825 4822 FE3022D01E3D739600BAC493 /* SigillCrashAnalyzer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SigillCrashAnalyzer.cpp; sourceTree = "<group>"; }; … … 6872 6869 14ABB36E099C076400E2A24F /* JSCJSValue.h */, 6873 6870 865A30F0135007E100CDB49E /* JSCJSValueInlines.h */, 6874 FE2B0B681FD0D2970075DA5F /* JSCPoison.cpp */,6875 FE2B0B701FD8C4630075DA5F /* JSCPoison.h */,6876 6871 FE7497E5209001B00003565B /* JSCPtrTag.h */, 6877 6872 72AAF7CB1D0D318B005E60BE /* JSCustomGetterSetterFunction.cpp */, … … 9283 9278 A5D2E665195E174000A518E7 /* JSContextRefInternal.h in Headers */, 9284 9279 148CD1D8108CF902008163C6 /* JSContextRefPrivate.h in Headers */, 9285 FE2B0B731FD9EF700075DA5F /* JSCPoison.h in Headers */,9286 9280 FE7497E6209001B10003565B /* JSCPtrTag.h in Headers */, 9287 9281 A72028B81797601E0098028C /* JSCTestRunnerUtils.h in Headers */, -
trunk/Source/JavaScriptCore/Sources.txt
r241769 r242123 803 803 runtime/JSBoundFunction.cpp 804 804 runtime/JSCJSValue.cpp 805 runtime/JSCPoison.cpp806 805 runtime/JSCallee.cpp 807 806 runtime/JSCell.cpp -
trunk/Source/JavaScriptCore/bytecode/AccessCase.cpp
r240023 r242123 1 1 /* 2 * Copyright (C) 2017-201 8Apple Inc. All rights reserved.2 * Copyright (C) 2017-2019 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 512 512 CCallHelpers::Address(baseGPR, ScopedArguments::offsetOfStorage()), 513 513 scratchGPR); 514 jit.xorPtr(CCallHelpers::TrustedImmPtr(ScopedArgumentsPoison::key()), scratchGPR);515 514 fallThrough.append( 516 515 jit.branchTest8( -
trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp
r242100 r242123 6870 6870 m_jit.loadPtr( 6871 6871 MacroAssembler::Address(baseReg, ScopedArguments::offsetOfStorage()), resultRegs.payloadGPR()); 6872 m_jit.xorPtr(TrustedImmPtr(ScopedArgumentsPoison::key()), resultRegs.payloadGPR());6873 6874 6872 m_jit.load32( 6875 6873 MacroAssembler::Address(resultRegs.payloadGPR(), ScopedArguments::offsetOfTotalLengthInStorage()), … … 6883 6881 6884 6882 m_jit.loadPtr(MacroAssembler::Address(baseReg, ScopedArguments::offsetOfTable()), scratchReg); 6885 m_jit.xorPtr(TrustedImmPtr(ScopedArgumentsPoison::key()), scratchReg);6886 6883 m_jit.load32( 6887 6884 MacroAssembler::Address(scratchReg, ScopedArgumentsTable::offsetOfLength()), scratch2Reg); … … 6891 6888 6892 6889 m_jit.loadPtr(MacroAssembler::Address(baseReg, ScopedArguments::offsetOfScope()), scratch2Reg); 6893 m_jit.xorPtr(TrustedImmPtr(ScopedArgumentsPoison::key()), scratch2Reg);6894 6890 6895 6891 m_jit.loadPtr( … … 7041 7037 m_jit.loadPtr( 7042 7038 MacroAssembler::Address(baseReg, ScopedArguments::offsetOfStorage()), resultReg); 7043 m_jit.xorPtr(TrustedImmPtr(ScopedArgumentsPoison::key()), resultReg); 7044 7039 7045 7040 speculationCheck( 7046 7041 ExoticObjectMode, JSValueSource(), 0, … … 7092 7087 7093 7088 m_jit.storePtr(scopeGPR, JITCompiler::Address(resultGPR, JSFunction::offsetOfScopeChain())); 7094 m_jit.storePtr(TrustedImmPtr::weakPoi sonedPointer<JSFunctionPoison>(m_jit.graph(), executable), JITCompiler::Address(resultGPR, JSFunction::offsetOfExecutable()));7089 m_jit.storePtr(TrustedImmPtr::weakPointer(m_jit.graph(), executable), JITCompiler::Address(resultGPR, JSFunction::offsetOfExecutable())); 7095 7090 m_jit.storePtr(TrustedImmPtr(nullptr), JITCompiler::Address(resultGPR, JSFunction::offsetOfRareData())); 7096 7091 … … 12117 12112 speculateCellType(node->child1(), functionGPR, SpecFunction, JSFunctionType); 12118 12113 m_jit.loadPtr(JITCompiler::Address(functionGPR, JSFunction::offsetOfExecutable()), resultGPR); 12119 #if USE(JSVALUE64)12120 m_jit.xorPtr(JITCompiler::TrustedImmPtr(JSFunctionPoison::key()), resultGPR);12121 #endif12122 12114 cellResult(resultGPR, node); 12123 12115 } … … 12491 12483 m_jit.loadPtr(JITCompiler::Address(calleeGPR, JSFunction::offsetOfRareData()), rareDataGPR); 12492 12484 slowPath.append(m_jit.branchTestPtr(MacroAssembler::Zero, rareDataGPR)); 12493 m_jit.xorPtr(JITCompiler::TrustedImmPtr(JSFunctionPoison::key()), rareDataGPR);12494 12485 m_jit.loadPtr(JITCompiler::Address(rareDataGPR, FunctionRareData::offsetOfObjectAllocationProfile() + ObjectAllocationProfile::offsetOfAllocator()), allocatorGPR); 12495 12486 m_jit.loadPtr(JITCompiler::Address(rareDataGPR, FunctionRareData::offsetOfObjectAllocationProfile() + ObjectAllocationProfile::offsetOfStructure()), structureGPR); … … 12499 12490 12500 12491 m_jit.loadPtr(JITCompiler::Address(calleeGPR, JSFunction::offsetOfRareData()), rareDataGPR); 12501 m_jit.xorPtr(JITCompiler::TrustedImmPtr(JSFunctionPoison::key()), rareDataGPR);12502 12492 m_jit.load32(JITCompiler::Address(rareDataGPR, FunctionRareData::offsetOfObjectAllocationProfile() + ObjectAllocationProfile::offsetOfInlineCapacity()), inlineCapacityGPR); 12503 12493 m_jit.emitInitializeInlineStorage(resultGPR, inlineCapacityGPR); -
trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h
r242100 r242123 148 148 graph.m_plan.weakReferences().addLazily(cell); 149 149 return TrustedImmPtr(bitwise_cast<size_t>(cell)); 150 }151 152 template<typename Key>153 static TrustedImmPtr weakPoisonedPointer(Graph& graph, JSCell* cell)154 {155 graph.m_plan.weakReferences().addLazily(cell);156 return TrustedImmPtr(bitwise_cast<size_t>(cell) ^ Key::key());157 150 } 158 151 -
trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp
r242100 r242123 3142 3142 LValue cell = lowCell(m_node->child1()); 3143 3143 speculateFunction(m_node->child1(), cell); 3144 setJSValue( 3145 m_out.bitXor( 3146 m_out.loadPtr(cell, m_heaps.JSFunction_executable), 3147 m_out.constIntPtr(JSFunctionPoison::key()))); 3144 setJSValue(m_out.loadPtr(cell, m_heaps.JSFunction_executable)); 3148 3145 } 3149 3146 … … 3844 3841 case Array::ScopedArguments: { 3845 3842 LValue arguments = lowCell(m_node->child1()); 3846 LValue storage = m_out.bitXor( 3847 m_out.loadPtr(arguments, m_heaps.ScopedArguments_storage), 3848 m_out.constIntPtr(ScopedArgumentsPoison::key())); 3843 LValue storage = m_out.loadPtr(arguments, m_heaps.ScopedArguments_storage); 3849 3844 speculate( 3850 3845 ExoticObjectMode, noValue(), nullptr, … … 4048 4043 4049 4044 LValue storage = m_out.loadPtr(base, m_heaps.ScopedArguments_storage); 4050 storage = m_out.bitXor(storage, m_out.constIntPtr(ScopedArgumentsPoison::key()));4051 4052 4045 LValue totalLength = m_out.load32NonNegative( 4053 4046 storage, m_heaps.ScopedArguments_Storage_totalLength); … … 4057 4050 4058 4051 LValue table = m_out.loadPtr(base, m_heaps.ScopedArguments_table); 4059 table = m_out.bitXor(table, m_out.constIntPtr(ScopedArgumentsPoison::key()));4060 4061 4052 LValue namedLength = m_out.load32(table, m_heaps.ScopedArgumentsTable_length); 4062 4053 … … 4071 4062 4072 4063 LValue scope = m_out.loadPtr(base, m_heaps.ScopedArguments_scope); 4073 scope = m_out.bitXor(scope, m_out.constIntPtr(ScopedArgumentsPoison::key()));4074 4075 4064 LValue arguments = m_out.loadPtr(table, m_heaps.ScopedArgumentsTable_arguments); 4076 4065 … … 5324 5313 // must be young. 5325 5314 m_out.storePtr(scope, fastObject, m_heaps.JSFunction_scope); 5326 m_out.storePtr(weakPoi sonedPointer<JSFunctionPoison>(executable), fastObject, m_heaps.JSFunction_executable);5315 m_out.storePtr(weakPointer(executable), fastObject, m_heaps.JSFunction_executable); 5327 5316 m_out.storePtr(m_out.intPtrZero, fastObject, m_heaps.JSFunction_rareData); 5328 5317 … … 16386 16375 } 16387 16376 16388 LValue dynamicPoison(LValue value, LValue poison)16389 {16390 return m_out.add(16391 value,16392 m_out.shl(16393 m_out.zeroExt(poison, pointerType()),16394 m_out.constInt32(40)));16395 }16396 16397 LValue dynamicPoisonOnLoadedType(LValue value, LValue actualType, JSType expectedType)16398 {16399 return dynamicPoison(16400 value,16401 m_out.bitXor(16402 m_out.opaque(actualType),16403 m_out.constInt32(expectedType)));16404 }16405 16406 LValue dynamicPoisonOnType(LValue value, JSType expectedType)16407 {16408 return dynamicPoisonOnLoadedType(16409 value,16410 m_out.load8ZeroExt32(value, m_heaps.JSCell_typeInfoType),16411 expectedType);16412 }16413 16414 16377 template<typename... Args> 16415 16378 LValue vmCall(LType type, LValue function, Args&&... args) … … 16957 16920 addWeakReference(pointer); 16958 16921 return m_out.weakPointer(m_graph, pointer); 16959 }16960 16961 template<typename Key>16962 LValue weakPoisonedPointer(JSCell* pointer)16963 {16964 addWeakReference(pointer);16965 return m_out.weakPoisonedPointer<Key>(m_graph, pointer);16966 16922 } 16967 16923 -
trunk/Source/JavaScriptCore/ftl/FTLOutput.h
r235935 r242123 1 1 /* 2 * Copyright (C) 2013-201 8Apple Inc. All rights reserved.2 * Copyright (C) 2013-2019 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 112 112 } 113 113 114 template<typename Key>115 LValue weakPoisonedPointer(DFG::Graph& graph, JSCell* cell)116 {117 ASSERT(graph.m_plan.weakReferences().contains(cell));118 119 return constIntPtr(bitwise_cast<intptr_t>(cell) ^ Key::key());120 }121 122 114 LValue weakPointer(DFG::FrozenValue* value) 123 115 { -
trunk/Source/JavaScriptCore/jit/AssemblyHelpers.cpp
r242101 r242123 1003 1003 } 1004 1004 1005 void AssemblyHelpers::emitDynamicPoison(GPRReg base, GPRReg poisonValue)1006 {1007 #if CPU(X86_64) || (CPU(ARM64) && !defined(__ILP32__))1008 lshiftPtr(TrustedImm32(40), poisonValue);1009 addPtr(poisonValue, base);1010 #else1011 UNUSED_PARAM(base);1012 UNUSED_PARAM(poisonValue);1013 #endif1014 }1015 1016 void AssemblyHelpers::emitDynamicPoisonOnLoadedType(GPRReg base, GPRReg actualType, JSType expectedType)1017 {1018 #if CPU(X86_64) || (CPU(ARM64) && !defined(__ILP32__))1019 xor32(TrustedImm32(expectedType), actualType);1020 emitDynamicPoison(base, actualType);1021 #else1022 UNUSED_PARAM(base);1023 UNUSED_PARAM(actualType);1024 UNUSED_PARAM(expectedType);1025 #endif1026 }1027 1028 void AssemblyHelpers::emitDynamicPoisonOnType(GPRReg base, GPRReg scratch, JSType expectedType)1029 {1030 #if CPU(X86_64) || (CPU(ARM64) && !defined(__ILP32__))1031 load8(Address(base, JSCell::typeInfoTypeOffset()), scratch);1032 emitDynamicPoisonOnLoadedType(base, scratch, expectedType);1033 #else1034 UNUSED_PARAM(base);1035 UNUSED_PARAM(scratch);1036 UNUSED_PARAM(expectedType);1037 #endif1038 }1039 1040 1005 } // namespace JSC 1041 1006 -
trunk/Source/JavaScriptCore/jit/AssemblyHelpers.h
r242100 r242123 1832 1832 // permits length and result to be in the same register. 1833 1833 void emitPreparePreciseIndexMask32(GPRReg index, GPRReg length, GPRReg result); 1834 1835 void emitDynamicPoison(GPRReg base, GPRReg poisonValue);1836 void emitDynamicPoisonOnLoadedType(GPRReg base, GPRReg actualType, JSType expectedType);1837 void emitDynamicPoisonOnType(GPRReg base, GPRReg scratch, JSType expectedType);1838 1834 1839 1835 #if ENABLE(WEBASSEMBLY) -
trunk/Source/JavaScriptCore/jit/JITOpcodes.cpp
r240965 r242123 909 909 loadPtr(Address(calleeReg, JSFunction::offsetOfRareData()), rareDataReg); 910 910 addSlowCase(branchTestPtr(Zero, rareDataReg)); 911 xorPtr(TrustedImmPtr(JSFunctionPoison::key()), rareDataReg);912 911 loadPtr(Address(rareDataReg, FunctionRareData::offsetOfObjectAllocationProfile() + ObjectAllocationProfile::offsetOfAllocator()), allocatorReg); 913 912 loadPtr(Address(rareDataReg, FunctionRareData::offsetOfObjectAllocationProfile() + ObjectAllocationProfile::offsetOfStructure()), structureReg); … … 923 922 emitGetVirtualRegister(callee, scratchReg); 924 923 loadPtr(Address(scratchReg, JSFunction::offsetOfRareData()), scratchReg); 925 xorPtr(TrustedImmPtr(JSFunctionPoison::key()), scratchReg);926 924 load32(Address(scratchReg, FunctionRareData::offsetOfObjectAllocationProfile() + ObjectAllocationProfile::offsetOfInlineCapacity()), scratchReg); 927 925 emitInitializeInlineStorage(resultReg, scratchReg); -
trunk/Source/JavaScriptCore/jit/JITPropertyAccess.cpp
r240893 r242123 1610 1610 badType = patchableBranch32(NotEqual, scratch, TrustedImm32(ScopedArgumentsType)); 1611 1611 loadPtr(Address(base, ScopedArguments::offsetOfStorage()), scratch3); 1612 xorPtr(TrustedImmPtr(ScopedArgumentsPoison::key()), scratch3);1613 1612 slowCases.append(branch32(AboveOrEqual, property, Address(scratch3, ScopedArguments::offsetOfTotalLengthInStorage()))); 1614 1613 1615 1614 loadPtr(Address(base, ScopedArguments::offsetOfTable()), scratch); 1616 xorPtr(TrustedImmPtr(ScopedArgumentsPoison::key()), scratch);1617 1615 load32(Address(scratch, ScopedArgumentsTable::offsetOfLength()), scratch2); 1618 1616 Jump overflowCase = branch32(AboveOrEqual, property, scratch2); 1619 1617 loadPtr(Address(base, ScopedArguments::offsetOfScope()), scratch2); 1620 xorPtr(TrustedImmPtr(ScopedArgumentsPoison::key()), scratch2);1621 1618 loadPtr(Address(scratch, ScopedArgumentsTable::offsetOfArguments()), scratch); 1622 1619 load32(BaseIndex(scratch, property, TimesFour), scratch); -
trunk/Source/JavaScriptCore/jit/Repatch.cpp
r241037 r242123 1 1 /* 2 * Copyright (C) 2011-201 8Apple Inc. All rights reserved.2 * Copyright (C) 2011-2019 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 1065 1065 CCallHelpers::Address(calleeGPR, JSFunction::offsetOfExecutable()), 1066 1066 scratchGPR); 1067 stubJit.xorPtr(CCallHelpers::TrustedImmPtr(JSFunctionPoison::key()), scratchGPR);1068 1067 1069 1068 comparisonValueGPR = scratchGPR; -
trunk/Source/JavaScriptCore/jit/ThunkGenerators.cpp
r242100 r242123 204 204 CCallHelpers::Address(GPRInfo::regT0, JSFunction::offsetOfExecutable()), 205 205 GPRInfo::regT4); 206 jit.xorPtr(CCallHelpers::TrustedImmPtr(JSFunctionPoison::key()), GPRInfo::regT4);207 206 jit.loadPtr( 208 207 CCallHelpers::Address( … … 284 283 if (thunkFunctionType == ThunkFunctionType::JSFunction) { 285 284 jit.loadPtr(JSInterfaceJIT::Address(JSInterfaceJIT::regT1, JSFunction::offsetOfExecutable()), JSInterfaceJIT::regT1); 286 jit.xorPtr(JSInterfaceJIT::TrustedImmPtr(JSFunctionPoison::key()), JSInterfaceJIT::regT1);287 285 jit.call(JSInterfaceJIT::Address(JSInterfaceJIT::regT1, executableOffsetToFunction), JSEntryPtrTag); 288 286 } else … … 300 298 if (thunkFunctionType == ThunkFunctionType::JSFunction) { 301 299 jit.loadPtr(JSInterfaceJIT::Address(X86Registers::esi, JSFunction::offsetOfExecutable()), X86Registers::r9); 302 jit.xorPtr(JSInterfaceJIT::TrustedImmPtr(JSFunctionPoison::key()), X86Registers::r9);303 300 jit.loadPtr(JSInterfaceJIT::Address(X86Registers::r9, executableOffsetToFunction), X86Registers::r9); 304 301 } else 305 302 jit.loadPtr(JSInterfaceJIT::Address(X86Registers::esi, InternalFunction::offsetOfNativeFunctionFor(kind)), X86Registers::r9); 306 jit.move(JSInterfaceJIT::TrustedImm64(NativeCodePoison::key()), X86Registers::esi);307 jit.xor64(X86Registers::esi, X86Registers::r9);308 303 jit.call(X86Registers::r9, JSEntryPtrTag); 309 304 … … 320 315 if (thunkFunctionType == ThunkFunctionType::JSFunction) { 321 316 jit.loadPtr(JSInterfaceJIT::Address(X86Registers::edx, JSFunction::offsetOfExecutable()), X86Registers::r9); 322 jit.xorPtr(JSInterfaceJIT::TrustedImmPtr(JSFunctionPoison::key()), X86Registers::r9);323 317 jit.call(JSInterfaceJIT::Address(X86Registers::r9, executableOffsetToFunction), JSEntryPtrTag); 324 318 } else … … 339 333 if (thunkFunctionType == ThunkFunctionType::JSFunction) { 340 334 jit.loadPtr(JSInterfaceJIT::Address(ARM64Registers::x1, JSFunction::offsetOfExecutable()), ARM64Registers::x2); 341 jit.xorPtr(JSInterfaceJIT::TrustedImmPtr(JSFunctionPoison::key()), ARM64Registers::x2);342 335 jit.loadPtr(JSInterfaceJIT::Address(ARM64Registers::x2, executableOffsetToFunction), ARM64Registers::x2); 343 336 } else 344 337 jit.loadPtr(JSInterfaceJIT::Address(ARM64Registers::x1, InternalFunction::offsetOfNativeFunctionFor(kind)), ARM64Registers::x2); 345 jit.move(JSInterfaceJIT::TrustedImm64(NativeCodePoison::key()), ARM64Registers::x1);346 jit.xor64(ARM64Registers::x1, ARM64Registers::x2);347 338 jit.call(ARM64Registers::x2, JSEntryPtrTag); 348 339 … … 360 351 if (thunkFunctionType == ThunkFunctionType::JSFunction) { 361 352 jit.loadPtr(JSInterfaceJIT::Address(JSInterfaceJIT::argumentGPR1, JSFunction::offsetOfExecutable()), JSInterfaceJIT::regT2); 362 jit.xorPtr(JSInterfaceJIT::TrustedImmPtr(JSFunctionPoison::key()), JSInterfaceJIT::regT2);363 353 jit.call(JSInterfaceJIT::Address(JSInterfaceJIT::regT2, executableOffsetToFunction), JSEntryPtrTag); 364 354 } else … … 1238 1228 CCallHelpers::Address(GPRInfo::regT3, JSFunction::offsetOfExecutable()), 1239 1229 GPRInfo::regT0); 1240 jit.xorPtr(CCallHelpers::TrustedImmPtr(JSFunctionPoison::key()), GPRInfo::regT0);1241 1230 jit.loadPtr( 1242 1231 CCallHelpers::Address( -
trunk/Source/JavaScriptCore/parser/UnlinkedSourceCode.h
r240511 r242123 1 1 /* 2 * Copyright (C) 2008-201 8Apple Inc. All rights reserved.2 * Copyright (C) 2008-2019 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 29 29 #pragma once 30 30 31 #include "JSCPoison.h"32 31 #include "SourceProvider.h" 33 32 #include <wtf/RefPtr.h> … … 108 107 109 108 protected: 110 // FIXME: Make it PoisonedRef<SourceProvidier>.109 // FIXME: Make it Ref<SourceProvidier>. 111 110 // https://bugs.webkit.org/show_bug.cgi?id=168325 112 PoisonedRefPtr<UnlinkedSourceCodePoison,SourceProvider> m_provider;111 RefPtr<SourceProvider> m_provider; 113 112 int m_startOffset; 114 113 int m_endOffset; -
trunk/Source/JavaScriptCore/runtime/ArrayPrototype.h
r229413 r242123 1 1 /* 2 2 * Copyright (C) 1999-2000 Harri Porten (porten@kde.org) 3 * Copyright (C) 2007-201 8Apple Inc. All rights reserved.3 * Copyright (C) 2007-2019 Apple Inc. All rights reserved. 4 4 * 5 5 * This library is free software; you can redistribute it and/or … … 22 22 23 23 #include "JSArray.h" 24 #include "JSCPoison.h"25 #include <wtf/PoisonedUniquePtr.h>26 24 27 25 namespace JSC { … … 63 61 // This bit is set if any user modifies the constructor property Array.prototype. This is used to optimize species creation for JSArrays. 64 62 friend ArrayPrototypeAdaptiveInferredPropertyWatchpoint; 65 PoisonedUniquePtr<ArrayPrototypePoison,ArrayPrototypeAdaptiveInferredPropertyWatchpoint> m_constructorWatchpoint;66 PoisonedUniquePtr<ArrayPrototypePoison,ArrayPrototypeAdaptiveInferredPropertyWatchpoint> m_constructorSpeciesWatchpoint;63 std::unique_ptr<ArrayPrototypeAdaptiveInferredPropertyWatchpoint> m_constructorWatchpoint; 64 std::unique_ptr<ArrayPrototypeAdaptiveInferredPropertyWatchpoint> m_constructorSpeciesWatchpoint; 67 65 }; 68 66 -
trunk/Source/JavaScriptCore/runtime/CustomGetterSetter.h
r228500 r242123 1 1 /* 2 * Copyright (C) 2014-201 8Apple Inc. All rights reserved.2 * Copyright (C) 2014-2019 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 26 26 #pragma once 27 27 28 #include "JSCPoison.h"29 28 #include "JSCast.h" 30 29 #include "PropertySlot.h" … … 49 48 } 50 49 51 CustomGetterSetter::CustomGetter getter() const { return m_getter .unpoisoned(); }52 CustomGetterSetter::CustomSetter setter() const { return m_setter .unpoisoned(); }50 CustomGetterSetter::CustomGetter getter() const { return m_getter; } 51 CustomGetterSetter::CustomSetter setter() const { return m_setter; } 53 52 54 53 static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype) … … 68 67 69 68 private: 70 template<typename T> 71 using PoisonedAccessor = Poisoned<NativeCodePoison, T>; 72 73 PoisonedAccessor<CustomGetter> m_getter; 74 PoisonedAccessor<CustomSetter> m_setter; 69 CustomGetter m_getter; 70 CustomSetter m_setter; 75 71 }; 76 72 -
trunk/Source/JavaScriptCore/runtime/InitializeThreading.cpp
r241630 r242123 1 1 /* 2 * Copyright (C) 2008-201 7Apple Inc. All rights reserved.2 * Copyright (C) 2008-2019 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 61 61 WTF::initializeThreading(); 62 62 Options::initialize(); 63 initializePoison();64 63 65 64 #if ENABLE(WRITE_BARRIER_PROFILING) -
trunk/Source/JavaScriptCore/runtime/InternalFunction.cpp
r233245 r242123 2 2 * Copyright (C) 1999-2002 Harri Porten (porten@kde.org) 3 3 * Copyright (C) 2001 Peter Kelly (pmk@post.com) 4 * Copyright (C) 2004 , 2007-2008, 2016-2017Apple Inc. All rights reserved.4 * Copyright (C) 2004-2019 Apple Inc. All rights reserved. 5 5 * 6 6 * This library is free software; you can redistribute it and/or … … 89 89 auto* function = jsCast<InternalFunction*>(cell); 90 90 ASSERT(function->m_functionForCall); 91 callData.native.function = function->m_functionForCall .unpoisoned();91 callData.native.function = function->m_functionForCall; 92 92 return CallType::Host; 93 93 } … … 98 98 if (function->m_functionForConstruct == callHostFunctionAsConstructor) 99 99 return ConstructType::None; 100 constructData.native.function = function->m_functionForConstruct .unpoisoned();100 constructData.native.function = function->m_functionForConstruct; 101 101 return ConstructType::Host; 102 102 } -
trunk/Source/JavaScriptCore/runtime/InternalFunction.h
r240965 r242123 1 1 /* 2 2 * Copyright (C) 1999-2000 Harri Porten (porten@kde.org) 3 * Copyright (C) 2003-201 8Apple Inc. All rights reserved.3 * Copyright (C) 2003-2019 Apple Inc. All rights reserved. 4 4 * Copyright (C) 2007 Cameron Zwarich (cwzwarich@uwaterloo.ca) 5 5 * Copyright (C) 2007 Maks Orlovich … … 25 25 26 26 #include "CodeSpecializationKind.h" 27 #include "JSCPoison.h"28 27 #include "JSDestructibleObject.h" 29 28 … … 64 63 { 65 64 if (kind == CodeForCall) 66 return m_functionForCall .unpoisoned();65 return m_functionForCall; 67 66 ASSERT(kind == CodeForConstruct); 68 return m_functionForConstruct .unpoisoned();67 return m_functionForConstruct; 69 68 } 70 69 … … 78 77 79 78 protected: 80 using PoisonedTaggedNativeFunction = Poisoned<NativeCodePoison, TaggedNativeFunction>;81 82 79 JS_EXPORT_PRIVATE InternalFunction(VM&, Structure*, NativeFunction functionForCall, NativeFunction functionForConstruct); 83 80 … … 90 87 JS_EXPORT_PRIVATE static CallType getCallData(JSCell*, CallData&); 91 88 92 PoisonedTaggedNativeFunction m_functionForCall;93 PoisonedTaggedNativeFunction m_functionForConstruct;89 TaggedNativeFunction m_functionForCall; 90 TaggedNativeFunction m_functionForConstruct; 94 91 WriteBarrier<JSString> m_originalName; 95 92 }; -
trunk/Source/JavaScriptCore/runtime/JSArrayBuffer.h
r233765 r242123 1 1 /* 2 * Copyright (C) 2013-201 8Apple Inc. All rights reserved.2 * Copyright (C) 2013-2019 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 27 27 28 28 #include "ArrayBuffer.h" 29 #include "JSCPoison.h"30 29 #include "JSObject.h" 31 #include <wtf/Poisoned.h>32 30 33 31 namespace JSC { … … 46 44 JS_EXPORT_PRIVATE static JSArrayBuffer* create(VM&, Structure*, RefPtr<ArrayBuffer>&&); 47 45 48 ArrayBuffer* impl() const { return m_impl .unpoisoned(); }46 ArrayBuffer* impl() const { return m_impl; } 49 47 50 48 static Structure* createStructure(VM&, JSGlobalObject*, JSValue prototype); … … 62 60 63 61 private: 64 Poisoned<JSArrayBufferPoison, ArrayBuffer*>m_impl;62 ArrayBuffer* m_impl; 65 63 }; 66 64 -
trunk/Source/JavaScriptCore/runtime/JSBoundFunction.h
r240965 r242123 77 77 void finishCreation(VM&, NativeExecutable*, int length); 78 78 79 // FIXME: Consider poisoning these pointers.80 // https://bugs.webkit.org/show_bug.cgi?id=18271381 79 WriteBarrier<JSObject> m_targetFunction; 82 80 WriteBarrier<Unknown> m_boundThis; -
trunk/Source/JavaScriptCore/runtime/JSFunction.h
r241110 r242123 1 1 /* 2 2 * Copyright (C) 1999-2000 Harri Porten (porten@kde.org) 3 * Copyright (C) 2003-201 8Apple Inc. All rights reserved.3 * Copyright (C) 2003-2019 Apple Inc. All rights reserved. 4 4 * Copyright (C) 2007 Cameron Zwarich (cwzwarich@uwaterloo.ca) 5 5 * Copyright (C) 2007 Maks Orlovich … … 221 221 static EncodedJSValue nameGetter(ExecState*, EncodedJSValue, PropertyName); 222 222 223 template<typename T> 224 using PoisonedBarrier = PoisonedWriteBarrier<JSFunctionPoison, T>; 225 226 PoisonedBarrier<ExecutableBase> m_executable; 227 PoisonedBarrier<FunctionRareData> m_rareData; 223 WriteBarrier<ExecutableBase> m_executable; 224 WriteBarrier<FunctionRareData> m_rareData; 228 225 }; 229 226 -
trunk/Source/JavaScriptCore/runtime/JSGlobalObject.h
r242064 r242123 1 1 /* 2 2 * Copyright (C) 2007 Eric Seidel <eric@webkit.org> 3 * Copyright (C) 2007-201 8Apple Inc. All rights reserved.3 * Copyright (C) 2007-2019 Apple Inc. All rights reserved. 4 4 * 5 5 * This library is free software; you can redistribute it and/or … … 31 31 #include "JSArray.h" 32 32 #include "JSArrayBufferPrototype.h" 33 #include "JSCPoison.h"34 33 #include "JSClassRef.h" 35 34 #include "JSGlobalLexicalEnvironment.h" … … 50 49 #include <array> 51 50 #include <wtf/HashSet.h> 52 #include <wtf/PoisonedUniquePtr.h>53 51 #include <wtf/RetainPtr.h> 54 52 … … 431 429 VM& m_vm; 432 430 433 template<typename T> using PoisonedUniquePtr = WTF::PoisonedUniquePtr<JSGlobalObjectPoison, T>;434 435 431 #if ENABLE(REMOTE_INSPECTOR) 436 PoisonedUniquePtr<Inspector::JSGlobalObjectInspectorController> m_inspectorController;437 PoisonedUniquePtr<JSGlobalObjectDebuggable> m_inspectorDebuggable;432 std::unique_ptr<Inspector::JSGlobalObjectInspectorController> m_inspectorController; 433 std::unique_ptr<JSGlobalObjectDebuggable> m_inspectorDebuggable; 438 434 #endif 439 435 … … 478 474 InlineWatchpointSet m_arraySpeciesWatchpoint; 479 475 InlineWatchpointSet m_numberToStringWatchpoint; 480 PoisonedUniquePtr<ObjectPropertyChangeAdaptiveWatchpoint<InlineWatchpointSet>> m_arrayPrototypeSymbolIteratorWatchpoint;481 PoisonedUniquePtr<ObjectPropertyChangeAdaptiveWatchpoint<InlineWatchpointSet>> m_arrayIteratorPrototypeNext;482 PoisonedUniquePtr<ObjectPropertyChangeAdaptiveWatchpoint<InlineWatchpointSet>> m_mapPrototypeSymbolIteratorWatchpoint;483 PoisonedUniquePtr<ObjectPropertyChangeAdaptiveWatchpoint<InlineWatchpointSet>> m_mapIteratorPrototypeNextWatchpoint;484 PoisonedUniquePtr<ObjectPropertyChangeAdaptiveWatchpoint<InlineWatchpointSet>> m_setPrototypeSymbolIteratorWatchpoint;485 PoisonedUniquePtr<ObjectPropertyChangeAdaptiveWatchpoint<InlineWatchpointSet>> m_setIteratorPrototypeNextWatchpoint;486 PoisonedUniquePtr<ObjectPropertyChangeAdaptiveWatchpoint<InlineWatchpointSet>> m_stringPrototypeSymbolIteratorWatchpoint;487 PoisonedUniquePtr<ObjectPropertyChangeAdaptiveWatchpoint<InlineWatchpointSet>> m_stringIteratorPrototypeNextWatchpoint;488 PoisonedUniquePtr<ObjectPropertyChangeAdaptiveWatchpoint<InlineWatchpointSet>> m_mapPrototypeSetWatchpoint;489 PoisonedUniquePtr<ObjectPropertyChangeAdaptiveWatchpoint<InlineWatchpointSet>> m_setPrototypeAddWatchpoint;490 PoisonedUniquePtr<ObjectPropertyChangeAdaptiveWatchpoint<InlineWatchpointSet>> m_numberPrototypeToStringWatchpoint;476 std::unique_ptr<ObjectPropertyChangeAdaptiveWatchpoint<InlineWatchpointSet>> m_arrayPrototypeSymbolIteratorWatchpoint; 477 std::unique_ptr<ObjectPropertyChangeAdaptiveWatchpoint<InlineWatchpointSet>> m_arrayIteratorPrototypeNext; 478 std::unique_ptr<ObjectPropertyChangeAdaptiveWatchpoint<InlineWatchpointSet>> m_mapPrototypeSymbolIteratorWatchpoint; 479 std::unique_ptr<ObjectPropertyChangeAdaptiveWatchpoint<InlineWatchpointSet>> m_mapIteratorPrototypeNextWatchpoint; 480 std::unique_ptr<ObjectPropertyChangeAdaptiveWatchpoint<InlineWatchpointSet>> m_setPrototypeSymbolIteratorWatchpoint; 481 std::unique_ptr<ObjectPropertyChangeAdaptiveWatchpoint<InlineWatchpointSet>> m_setIteratorPrototypeNextWatchpoint; 482 std::unique_ptr<ObjectPropertyChangeAdaptiveWatchpoint<InlineWatchpointSet>> m_stringPrototypeSymbolIteratorWatchpoint; 483 std::unique_ptr<ObjectPropertyChangeAdaptiveWatchpoint<InlineWatchpointSet>> m_stringIteratorPrototypeNextWatchpoint; 484 std::unique_ptr<ObjectPropertyChangeAdaptiveWatchpoint<InlineWatchpointSet>> m_mapPrototypeSetWatchpoint; 485 std::unique_ptr<ObjectPropertyChangeAdaptiveWatchpoint<InlineWatchpointSet>> m_setPrototypeAddWatchpoint; 486 std::unique_ptr<ObjectPropertyChangeAdaptiveWatchpoint<InlineWatchpointSet>> m_numberPrototypeToStringWatchpoint; 491 487 492 488 bool isArrayPrototypeIteratorProtocolFastAndNonObservable(); -
trunk/Source/JavaScriptCore/runtime/JSScriptFetchParameters.h
r229413 r242123 1 1 /* 2 2 * Copyright (C) 2017 Yusuke Suzuki <utatane.tea@gmail.com> 3 * Copyright (C) 2018 Apple Inc. All rights reserved.3 * Copyright (C) 2018-2019 Apple Inc. All rights reserved. 4 4 * 5 5 * Redistribution and use in source and binary forms, with or without … … 27 27 #pragma once 28 28 29 #include "JSCPoison.h"30 29 #include "JSGlobalObject.h" 31 30 #include "JSObject.h" … … 75 74 } 76 75 77 PoisonedRef<JSScriptFetchParametersPoison,ScriptFetchParameters> m_parameters;76 Ref<ScriptFetchParameters> m_parameters; 78 77 }; 79 78 -
trunk/Source/JavaScriptCore/runtime/JSScriptFetcher.h
r229413 r242123 1 1 /* 2 2 * Copyright (C) 2017 Yusuke Suzuki <utatane.tea@gmail.com> 3 * Copyright (C) 2018 Apple Inc. All rights reserved.3 * Copyright (C) 2018-2019 Apple Inc. All rights reserved. 4 4 * 5 5 * Redistribution and use in source and binary forms, with or without … … 27 27 #pragma once 28 28 29 #include "JSCPoison.h"30 29 #include "JSGlobalObject.h" 31 30 #include "JSObject.h" … … 75 74 } 76 75 77 PoisonedRefPtr<JSScriptFetcherPoison,ScriptFetcher> m_fetcher;76 RefPtr<ScriptFetcher> m_fetcher; 78 77 }; 79 78 -
trunk/Source/JavaScriptCore/runtime/JSString.h
r241849 r242123 223 223 unsigned m_length { 0 }; 224 224 mutable uint16_t m_flags { 0 }; 225 // The poison is strategically placed and holds a value such that the first226 // 64 bits of JSString look like a double JSValue.227 225 mutable String m_value; 228 226 -
trunk/Source/JavaScriptCore/runtime/NativeExecutable.cpp
r241037 r242123 1 1 /* 2 * Copyright (C) 2009-201 8Apple Inc. All rights reserved.2 * Copyright (C) 2009-2019 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 95 95 { 96 96 if (kind == CodeForCall) 97 return CodeBlockHash( m_function.bits());97 return CodeBlockHash(bitwise_cast<uintptr_t>(m_function)); 98 98 99 99 RELEASE_ASSERT(kind == CodeForConstruct); 100 return CodeBlockHash( m_constructor.bits());100 return CodeBlockHash(bitwise_cast<uintptr_t>(m_constructor)); 101 101 } 102 102 -
trunk/Source/JavaScriptCore/runtime/NativeExecutable.h
r241037 r242123 1 1 /* 2 * Copyright (C) 2009-201 8Apple Inc. All rights reserved.2 * Copyright (C) 2009-2019 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 27 27 28 28 #include "ExecutableBase.h" 29 #include "JSCPoison.h"30 29 31 30 namespace JSC { … … 50 49 CodeBlockHash hashFor(CodeSpecializationKind) const; 51 50 52 TaggedNativeFunction function() { return m_function .unpoisoned(); }53 TaggedNativeFunction constructor() { return m_constructor .unpoisoned(); }51 TaggedNativeFunction function() { return m_function; } 52 TaggedNativeFunction constructor() { return m_constructor; } 54 53 55 54 TaggedNativeFunction nativeFunctionFor(CodeSpecializationKind kind) … … 82 81 83 82 private: 84 friend class ExecutableBase;85 using PoisonedTaggedNativeFunction = Poisoned<NativeCodePoison, TaggedNativeFunction>;86 87 83 NativeExecutable(VM&, TaggedNativeFunction, TaggedNativeFunction constructor); 88 84 89 PoisonedTaggedNativeFunction m_function;90 PoisonedTaggedNativeFunction m_constructor;85 TaggedNativeFunction m_function; 86 TaggedNativeFunction m_constructor; 91 87 92 88 String m_name; -
trunk/Source/JavaScriptCore/runtime/Options.h
r241579 r242123 476 476 v(bool, enableSpectreMitigations, true, Restricted, "Enable Spectre mitigations.") \ 477 477 v(bool, enableSpectreGadgets, false, Restricted, "enable gadgets to test Spectre mitigations.") \ 478 v(bool, usePoisoning, true, Normal, "Poison is randomized at load time when true, and initialized to 0 if false which defeats some Spectre and type confusion mitigations, but allows tools such as leak detectors to function better.") \479 478 v(bool, zeroStackFrame, false, Normal, "Zero stack frame on entry to a function.") \ 480 479 \ -
trunk/Source/JavaScriptCore/runtime/ScopedArguments.h
r240965 r242123 1 1 /* 2 * Copyright (C) 2015-201 8Apple Inc. All rights reserved.2 * Copyright (C) 2015-2019 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 181 181 WriteBarrier<Unknown>* overflowStorage() const 182 182 { 183 return m_storage.get() .unpoisoned();183 return m_storage.get(); 184 184 } 185 185 … … 195 195 } 196 196 197 template<typename T> 198 using PoisonedBarrier = PoisonedWriteBarrier<ScopedArgumentsPoison, T>; 199 200 PoisonedBarrier<JSFunction> m_callee; 201 PoisonedBarrier<ScopedArgumentsTable> m_table; 202 PoisonedBarrier<JSLexicalEnvironment> m_scope; 203 204 AuxiliaryBarrier<Poisoned<ScopedArgumentsPoison, WriteBarrier<Unknown>*>> m_storage; 197 WriteBarrier<JSFunction> m_callee; 198 WriteBarrier<ScopedArgumentsTable> m_table; 199 WriteBarrier<JSLexicalEnvironment> m_scope; 200 201 AuxiliaryBarrier<WriteBarrier<Unknown>*> m_storage; 205 202 }; 206 203 -
trunk/Source/JavaScriptCore/runtime/Structure.cpp
r241655 r242123 85 85 WeakSet::deallocate(impl); 86 86 WeakImpl* impl = WeakSet::allocate(structure, &singleSlotTransitionWeakOwner(), this); 87 m_data = PoisonedWeakImplPtr(impl).bits() | UsingSingleSlotFlag;87 m_data = bitwise_cast<intptr_t>(impl) | UsingSingleSlotFlag; 88 88 } 89 89 -
trunk/Source/JavaScriptCore/runtime/StructureTransitionTable.h
r232070 r242123 1 1 /* 2 * Copyright (C) 2008-201 8Apple Inc. All rights reserved.2 * Copyright (C) 2008-2019 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 27 27 28 28 #include "IndexingType.h" 29 #include "JSCPoison.h"30 29 #include "WeakGCMap.h" 31 30 #include <wtf/HashFunctions.h> … … 188 187 private: 189 188 friend class SingleSlotTransitionWeakOwner; 190 using PoisonedTransitionMapPtr = Poisoned<StructureTransitionTablePoison, TransitionMap*>;191 using PoisonedWeakImplPtr = Poisoned<StructureTransitionTablePoison, WeakImpl*>;192 189 193 190 bool isUsingSingleSlot() const … … 199 196 { 200 197 ASSERT(!isUsingSingleSlot()); 201 return PoisonedTransitionMapPtr(AlreadyPoisoned, m_data).unpoisoned();198 return bitwise_cast<TransitionMap*>(m_data); 202 199 } 203 200 … … 205 202 { 206 203 ASSERT(isUsingSingleSlot()); 207 return PoisonedWeakImplPtr(AlreadyPoisoned, m_data & ~UsingSingleSlotFlag).unpoisoned();204 return bitwise_cast<WeakImpl*>(m_data & ~UsingSingleSlotFlag); 208 205 } 209 206 … … 216 213 217 214 // This implicitly clears the flag that indicates we're using a single transition 218 m_data = PoisonedTransitionMapPtr(map).bits();215 m_data = bitwise_cast<intptr_t>(map); 219 216 220 217 ASSERT(!isUsingSingleSlot()); -
trunk/Source/JavaScriptCore/runtime/WriteBarrier.h
r227527 r242123 28 28 #include "GCAssertions.h" 29 29 #include "HandleTypes.h" 30 #include "JSCPoison.h"31 30 #include <type_traits> 32 31 #include <wtf/DumbPtrTraits.h> 33 32 #include <wtf/DumbValueTraits.h> 34 #include <wtf/Poisoned.h>35 33 36 34 namespace JSC { … … 251 249 } 252 250 253 template<typename Poison, class T>254 using PoisonedWriteBarrierTraitsSelect = typename std::conditional<std::is_same<T, Unknown>::value,255 WTF::PoisonedValueTraits<Poison, T>, WTF::PoisonedPtrTraits<Poison, T>256 >::type;257 258 template <typename Poison, typename T>259 using PoisonedWriteBarrier = WriteBarrier<T, PoisonedWriteBarrierTraitsSelect<Poison, T>>;260 261 251 } // namespace JSC -
trunk/Source/JavaScriptCore/wasm/WasmB3IRGenerator.cpp
r242100 r242123 49 49 #include "B3WasmBoundsCheckValue.h" 50 50 #include "JSCInlines.h" 51 #include "JSCPoison.h"52 51 #include "ScratchRegisterAllocator.h" 53 52 #include "VirtualRegister.h" -
trunk/Source/JavaScriptCore/wasm/WasmInstance.h
r232613 r242123 118 118 WasmToWasmImportableFunction::LoadLocation wasmEntrypointLoadLocation { nullptr }; 119 119 MacroAssemblerCodePtr<WasmEntryPtrTag> wasmToEmbedderStub; 120 void* importFunction { nullptr }; // In a JS embedding, this is a PoisonedBarrier<JSObject>.120 void* importFunction { nullptr }; // In a JS embedding, this is a WriteBarrier<JSObject>. 121 121 }; 122 122 unsigned numImportFunctions() const { return m_numImportFunctions; } -
trunk/Source/JavaScriptCore/wasm/js/JSToWasm.cpp
r238376 r242123 1 1 /* 2 * Copyright (C) 2016-201 8Apple Inc. All rights reserved.2 * Copyright (C) 2016-2019 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 117 117 // Wasm::Context*'s instance. 118 118 jit.loadPtr(CCallHelpers::Address(GPRInfo::callFrameRegister, CallFrameSlot::thisArgument * sizeof(EncodedJSValue)), GPRInfo::argumentGPR2); 119 jit.loadPtr(CCallHelpers::Address(GPRInfo::argumentGPR2, JSWebAssemblyInstance::offsetOfPoisonedInstance()), GPRInfo::argumentGPR2); 120 jit.move(CCallHelpers::TrustedImm64(JSWebAssemblyInstancePoison::key()), GPRInfo::argumentGPR0); 121 jit.xor64(GPRInfo::argumentGPR0, GPRInfo::argumentGPR2); 119 jit.loadPtr(CCallHelpers::Address(GPRInfo::argumentGPR2, JSWebAssemblyInstance::offsetOfInstance()), GPRInfo::argumentGPR2); 122 120 } 123 121 … … 156 154 if (!Context::useFastTLS()) { 157 155 jit.loadPtr(CCallHelpers::Address(GPRInfo::callFrameRegister, jsOffset), wasmContextInstanceGPR); 158 jit.loadPtr(CCallHelpers::Address(wasmContextInstanceGPR, JSWebAssemblyInstance::offsetOfPoisonedInstance()), wasmContextInstanceGPR); 159 jit.move(CCallHelpers::TrustedImm64(JSWebAssemblyInstancePoison::key()), scratchReg); 160 jit.xor64(scratchReg, wasmContextInstanceGPR); 156 jit.loadPtr(CCallHelpers::Address(wasmContextInstanceGPR, JSWebAssemblyInstance::offsetOfInstance()), wasmContextInstanceGPR); 161 157 jsOffset += sizeof(EncodedJSValue); 162 158 } -
trunk/Source/JavaScriptCore/wasm/js/JSWebAssemblyCodeBlock.h
r240965 r242123 1 1 /* 2 * Copyright (C) 2017-201 8Apple Inc. All rights reserved.2 * Copyright (C) 2017-2019 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 29 29 30 30 #include "CallLinkInfo.h" 31 #include "JSCPoison.h"32 31 #include "JSCast.h" 33 32 #include "PromiseDeferredTimer.h" … … 37 36 #include "WasmModule.h" 38 37 #include <wtf/Bag.h> 39 #include <wtf/PoisonedUniquePtr.h>40 38 #include <wtf/Ref.h> 41 39 #include <wtf/Vector.h> … … 91 89 static void visitChildren(JSCell*, SlotVisitor&); 92 90 93 PoisonedRef<JSWebAssemblyCodeBlockPoison,Wasm::CodeBlock> m_codeBlock;91 Ref<Wasm::CodeBlock> m_codeBlock; 94 92 Vector<MacroAssemblerCodeRef<WasmEntryPtrTag>> m_wasmToJSExitStubs; 95 93 Bag<CallLinkInfo> m_callLinkInfos; -
trunk/Source/JavaScriptCore/wasm/js/JSWebAssemblyInstance.cpp
r237009 r242123 1 1 /* 2 * Copyright (C) 2016-201 8Apple Inc. All rights reserved.2 * Copyright (C) 2016-2019 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 55 55 { 56 56 for (unsigned i = 0; i < this->instance().numImportFunctions(); ++i) 57 new (this->instance().importFunction< PoisonedBarrier<JSObject>>(i)) PoisonedBarrier<JSObject>();57 new (this->instance().importFunction<WriteBarrier<JSObject>>(i)) WriteBarrier<JSObject>(); 58 58 } 59 59 … … 89 89 visitor.reportExtraMemoryVisited(thisObject->m_instance->extraMemoryAllocated()); 90 90 for (unsigned i = 0; i < thisObject->instance().numImportFunctions(); ++i) 91 visitor.append(*thisObject->instance().importFunction< PoisonedBarrier<JSObject>>(i)); // This also keeps the functions' JSWebAssemblyInstance alive.91 visitor.append(*thisObject->instance().importFunction<WriteBarrier<JSObject>>(i)); // This also keeps the functions' JSWebAssemblyInstance alive. 92 92 } 93 93 -
trunk/Source/JavaScriptCore/wasm/js/JSWebAssemblyInstance.h
r230759 r242123 1 1 /* 2 * Copyright (C) 2016-201 8Apple Inc. All rights reserved.2 * Copyright (C) 2016-2019 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 28 28 #if ENABLE(WEBASSEMBLY) 29 29 30 #include "JSCPoison.h"31 30 #include "JSDestructibleObject.h" 32 31 #include "JSObject.h" … … 82 81 JSWebAssemblyModule* module() const { return m_module.get(); } 83 82 84 static size_t offsetOfPoisonedInstance() { return OBJECT_OFFSETOF(JSWebAssemblyInstance, m_instance); } 85 static size_t offsetOfPoisonedCallee() { return OBJECT_OFFSETOF(JSWebAssemblyInstance, m_callee); } 86 87 template<typename T> 88 using PoisonedBarrier = PoisonedWriteBarrier<JSWebAssemblyInstancePoison, T>; 83 static size_t offsetOfInstance() { return OBJECT_OFFSETOF(JSWebAssemblyInstance, m_instance); } 84 static size_t offsetOfCallee() { return OBJECT_OFFSETOF(JSWebAssemblyInstance, m_callee); } 89 85 90 86 protected: … … 95 91 96 92 private: 97 PoisonedRef<JSWebAssemblyInstancePoison,Wasm::Instance> m_instance;93 Ref<Wasm::Instance> m_instance; 98 94 99 PoisonedBarrier<JSWebAssemblyModule> m_module;100 PoisonedBarrier<JSWebAssemblyCodeBlock> m_codeBlock;101 PoisonedBarrier<JSModuleNamespaceObject> m_moduleNamespaceObject;102 PoisonedBarrier<JSWebAssemblyMemory> m_memory;103 PoisonedBarrier<JSWebAssemblyTable> m_table;104 PoisonedBarrier<WebAssemblyToJSCallee> m_callee;95 WriteBarrier<JSWebAssemblyModule> m_module; 96 WriteBarrier<JSWebAssemblyCodeBlock> m_codeBlock; 97 WriteBarrier<JSModuleNamespaceObject> m_moduleNamespaceObject; 98 WriteBarrier<JSWebAssemblyMemory> m_memory; 99 WriteBarrier<JSWebAssemblyTable> m_table; 100 WriteBarrier<WebAssemblyToJSCallee> m_callee; 105 101 }; 106 102 -
trunk/Source/JavaScriptCore/wasm/js/JSWebAssemblyMemory.h
r240965 r242123 1 1 /* 2 * Copyright (C) 2016-201 8Apple Inc. All rights reserved.2 * Copyright (C) 2016-2019 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 28 28 #if ENABLE(WEBASSEMBLY) 29 29 30 #include "JSCPoison.h"31 30 #include "JSDestructibleObject.h" 32 31 #include "JSObject.h" … … 68 67 static void visitChildren(JSCell*, SlotVisitor&); 69 68 70 PoisonedRef<JSWebAssemblyMemoryPoison,Wasm::Memory> m_memory;71 PoisonedWriteBarrier<JSWebAssemblyMemoryPoison,JSArrayBuffer> m_bufferWrapper;72 PoisonedRefPtr<JSWebAssemblyMemoryPoison,ArrayBuffer> m_buffer;69 Ref<Wasm::Memory> m_memory; 70 WriteBarrier<JSArrayBuffer> m_bufferWrapper; 71 RefPtr<ArrayBuffer> m_buffer; 73 72 }; 74 73 -
trunk/Source/JavaScriptCore/wasm/js/JSWebAssemblyModule.h
r235786 r242123 1 1 /* 2 * Copyright (C) 2016-201 8Apple Inc. All rights reserved.2 * Copyright (C) 2016-2019 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 28 28 #if ENABLE(WEBASSEMBLY) 29 29 30 #include "JSCPoison.h"31 30 #include "JSDestructibleObject.h" 32 31 #include "JSObject.h" … … 79 78 static void visitChildren(JSCell*, SlotVisitor&); 80 79 81 PoisonedRef<JSWebAssemblyModulePoison, Wasm::Module> m_module; 82 83 template<typename T> 84 using PoisonedBarrier = PoisonedWriteBarrier<JSWebAssemblyModulePoison, T>; 85 86 PoisonedBarrier<SymbolTable> m_exportSymbolTable; 87 PoisonedBarrier<JSWebAssemblyCodeBlock> m_codeBlocks[Wasm::NumberOfMemoryModes]; 88 PoisonedBarrier<WebAssemblyToJSCallee> m_callee; 80 Ref<Wasm::Module> m_module; 81 WriteBarrier<SymbolTable> m_exportSymbolTable; 82 WriteBarrier<JSWebAssemblyCodeBlock> m_codeBlocks[Wasm::NumberOfMemoryModes]; 83 WriteBarrier<WebAssemblyToJSCallee> m_callee; 89 84 }; 90 85 -
trunk/Source/JavaScriptCore/wasm/js/JSWebAssemblyTable.cpp
r230096 r242123 1 1 /* 2 * Copyright (C) 2016-201 8Apple Inc. All rights reserved.2 * Copyright (C) 2016-2019 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 64 64 // But for now, we're not doing that. 65 65 // FIXME this over-allocates and could be smarter about not committing all of that memory https://bugs.webkit.org/show_bug.cgi?id=181425 66 m_jsFunctions = MallocPtr< PoisonedBarrier<JSObject>>::malloc((sizeof(PoisonedBarrier<JSObject>) * Checked<size_t>(allocatedLength())).unsafeGet());66 m_jsFunctions = MallocPtr<WriteBarrier<JSObject>>::malloc((sizeof(WriteBarrier<JSObject>) * Checked<size_t>(allocatedLength())).unsafeGet()); 67 67 for (uint32_t i = 0; i < allocatedLength(); ++i) 68 new(&m_jsFunctions.get()[i]) PoisonedBarrier<JSObject>();68 new(&m_jsFunctions.get()[i]) WriteBarrier<JSObject>(); 69 69 } 70 70 … … 105 105 if (newLength > m_table->allocatedLength(oldLength)) 106 106 // FIXME this over-allocates and could be smarter about not committing all of that memory https://bugs.webkit.org/show_bug.cgi?id=181425 107 m_jsFunctions.realloc((sizeof( PoisonedBarrier<JSObject>) * Checked<size_t>(m_table->allocatedLength(newLength))).unsafeGet());107 m_jsFunctions.realloc((sizeof(WriteBarrier<JSObject>) * Checked<size_t>(m_table->allocatedLength(newLength))).unsafeGet()); 108 108 109 109 for (size_t i = oldLength; i < m_table->allocatedLength(newLength); ++i) 110 new (&m_jsFunctions.get()[i]) PoisonedBarrier<JSObject>();110 new (&m_jsFunctions.get()[i]) WriteBarrier<JSObject>(); 111 111 112 112 return true; … … 122 122 { 123 123 m_table->clearFunction(index); 124 m_jsFunctions.get()[index & m_table->mask()] = PoisonedBarrier<JSObject>();124 m_jsFunctions.get()[index & m_table->mask()] = WriteBarrier<JSObject>(); 125 125 } 126 126 -
trunk/Source/JavaScriptCore/wasm/js/JSWebAssemblyTable.h
r239427 r242123 1 1 /* 2 * Copyright (C) 2016-201 8Apple Inc. All rights reserved.2 * Copyright (C) 2016-2019 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 28 28 #if ENABLE(WEBASSEMBLY) 29 29 30 #include "JSCPoison.h"31 30 #include "JSDestructibleObject.h" 32 31 #include "JSObject.h" … … 67 66 static void visitChildren(JSCell*, SlotVisitor&); 68 67 69 PoisonedRef<JSWebAssemblyTablePoison, Wasm::Table> m_table; 70 71 template<typename T> 72 using PoisonedBarrier = PoisonedWriteBarrier<JSWebAssemblyTablePoison, T>; 73 74 MallocPtr<PoisonedBarrier<JSObject>> m_jsFunctions; 68 Ref<Wasm::Table> m_table; 69 MallocPtr<WriteBarrier<JSObject>> m_jsFunctions; 75 70 }; 76 71 -
trunk/Source/JavaScriptCore/wasm/js/WasmToJS.cpp
r242114 r242123 48 48 using JIT = CCallHelpers; 49 49 50 static void materializeImportJSCell(JIT& jit, unsigned importIndex, GPRReg poison, GPRRegresult)50 static void materializeImportJSCell(JIT& jit, unsigned importIndex, GPRReg result) 51 51 { 52 52 // We're calling out of the current WebAssembly.Instance. That Instance has a list of all its import functions. 53 53 jit.loadWasmContextInstance(result); 54 54 jit.loadPtr(JIT::Address(result, Instance::offsetOfImportFunction(importIndex)), result); 55 jit.xor64(poison, result);56 55 } 57 56 … … 87 86 // Store Callee. 88 87 jit.loadPtr(CCallHelpers::Address(GPRInfo::argumentGPR1, Instance::offsetOfOwner()), GPRInfo::argumentGPR1); 89 jit.loadPtr(CCallHelpers::Address(GPRInfo::argumentGPR1, JSWebAssemblyInstance::offsetOfPoisonedCallee()), GPRInfo::argumentGPR2); 90 jit.move(CCallHelpers::TrustedImm64(JSWebAssemblyInstancePoison::key()), GPRInfo::argumentGPR3); 91 jit.xor64(GPRInfo::argumentGPR3, GPRInfo::argumentGPR2); 88 jit.loadPtr(CCallHelpers::Address(GPRInfo::argumentGPR1, JSWebAssemblyInstance::offsetOfCallee()), GPRInfo::argumentGPR2); 92 89 jit.storePtr(GPRInfo::argumentGPR2, JIT::Address(GPRInfo::callFrameRegister, CallFrameSlot::callee * static_cast<int>(sizeof(Register)))); 93 94 // Let's be paranoid on the exception path and zero out the poison instead of leaving it in an argument GPR.95 jit.move(CCallHelpers::TrustedImm32(0), GPRInfo::argumentGPR3);96 90 97 91 auto call = jit.call(OperationPtrTag); … … 292 286 jit.loadWasmContextInstance(GPRInfo::argumentGPR0); 293 287 jit.loadPtr(CCallHelpers::Address(GPRInfo::argumentGPR0, Instance::offsetOfOwner()), GPRInfo::argumentGPR0); 294 jit.loadPtr(CCallHelpers::Address(GPRInfo::argumentGPR0, JSWebAssemblyInstance::offsetOfPoisonedCallee()), GPRInfo::argumentGPR0); 295 jit.move(CCallHelpers::TrustedImm64(JSWebAssemblyInstancePoison::key()), GPRInfo::argumentGPR3); 296 jit.xor64(GPRInfo::argumentGPR3, GPRInfo::argumentGPR0); 288 jit.loadPtr(CCallHelpers::Address(GPRInfo::argumentGPR0, JSWebAssemblyInstance::offsetOfCallee()), GPRInfo::argumentGPR0); 297 289 jit.storePtr(GPRInfo::argumentGPR0, JIT::Address(GPRInfo::callFrameRegister, CallFrameSlot::callee * static_cast<int>(sizeof(Register)))); 298 290 299 materializeImportJSCell(jit, importIndex, GPRInfo::argumentGPR 3, GPRInfo::argumentGPR1);291 materializeImportJSCell(jit, importIndex, GPRInfo::argumentGPR1); 300 292 301 // Let's be paranoid before the call and zero out the poison instead of leaving it in an argument GPR.302 jit.move(CCallHelpers::TrustedImm32(0), GPRInfo::argumentGPR3);303 304 293 static_assert(GPRInfo::numberOfArgumentRegisters >= 4, "We rely on this with the call below."); 305 294 static_assert(sizeof(SignatureIndex) == sizeof(uint64_t), "Following code assumes SignatureIndex is 64bit."); … … 480 469 } 481 470 482 GPRReg poison = GPRInfo::argumentGPR1;483 ASSERT(poison != GPRInfo::argumentGPR0); // Both are used at the same time below.484 485 471 jit.loadWasmContextInstance(GPRInfo::argumentGPR0); 486 472 jit.loadPtr(CCallHelpers::Address(GPRInfo::argumentGPR0, Instance::offsetOfOwner()), GPRInfo::argumentGPR0); 487 jit.loadPtr(CCallHelpers::Address(GPRInfo::argumentGPR0, JSWebAssemblyInstance::offsetOfPoisonedCallee()), GPRInfo::argumentGPR0); 488 jit.move(CCallHelpers::TrustedImm64(JSWebAssemblyInstancePoison::key()), poison); 489 jit.xor64(poison, GPRInfo::argumentGPR0); 473 jit.loadPtr(CCallHelpers::Address(GPRInfo::argumentGPR0, JSWebAssemblyInstance::offsetOfCallee()), GPRInfo::argumentGPR0); 490 474 jit.storePtr(GPRInfo::argumentGPR0, JIT::Address(GPRInfo::callFrameRegister, CallFrameSlot::callee * static_cast<int>(sizeof(Register)))); 491 475 492 476 GPRReg importJSCellGPRReg = GPRInfo::regT0; // Callee needs to be in regT0 for slow path below. 493 ASSERT(poison != importJSCellGPRReg);494 477 495 478 ASSERT(!wasmCC.m_calleeSaveRegisters.get(importJSCellGPRReg)); 496 materializeImportJSCell(jit, importIndex, poison, importJSCellGPRReg); 497 498 // Let's be paranoid zero out the poison instead of leaving it in an argument GPR. 499 jit.move(CCallHelpers::TrustedImm32(0), poison); 479 materializeImportJSCell(jit, importIndex, importJSCellGPRReg); 500 480 501 481 jit.store64(importJSCellGPRReg, calleeFrame.withOffset(CallFrameSlot::callee * static_cast<int>(sizeof(Register)))); -
trunk/Source/JavaScriptCore/wasm/js/WebAssemblyFunctionBase.h
r227527 r242123 51 51 WebAssemblyFunctionBase(VM&, JSGlobalObject*, Structure*); 52 52 53 PoisonedWriteBarrier<WebAssemblyFunctionBasePoison,JSWebAssemblyInstance> m_instance;53 WriteBarrier<JSWebAssemblyInstance> m_instance; 54 54 }; 55 55 -
trunk/Source/JavaScriptCore/wasm/js/WebAssemblyModuleRecord.cpp
r239461 r242123 1 1 /* 2 * Copyright (C) 2016-201 8Apple Inc. All rights reserved.2 * Copyright (C) 2016-2019 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 225 225 info->targetInstance = calleeInstance; 226 226 info->wasmEntrypointLoadLocation = entrypointLoadLocation; 227 m_instance->instance().importFunction< JSWebAssemblyInstance::PoisonedBarrier<JSObject>>(import.kindIndex)->set(vm, m_instance.get(), function);227 m_instance->instance().importFunction<WriteBarrier<JSObject>>(import.kindIndex)->set(vm, m_instance.get(), function); 228 228 break; 229 229 } … … 339 339 if (exp.kindIndex < functionImportCount) { 340 340 unsigned functionIndex = exp.kindIndex; 341 JSObject* functionImport = m_instance->instance().importFunction< JSWebAssemblyInstance::PoisonedBarrier<JSObject>>(functionIndex)->get();341 JSObject* functionImport = m_instance->instance().importFunction<WriteBarrier<JSObject>>(functionIndex)->get(); 342 342 if (isWebAssemblyHostFunction(vm, functionImport)) 343 343 exportedValue = functionImport; … … 420 420 ASSERT(signature.returnType() == Wasm::Void); 421 421 if (startFunctionIndexSpace < codeBlock->functionImportCount()) { 422 JSObject* startFunction = m_instance->instance().importFunction< JSWebAssemblyInstance::PoisonedBarrier<JSObject>>(startFunctionIndexSpace)->get();422 JSObject* startFunction = m_instance->instance().importFunction<WriteBarrier<JSObject>>(startFunctionIndexSpace)->get(); 423 423 m_startFunction.set(vm, this, startFunction); 424 424 } else { … … 521 521 Wasm::SignatureIndex signatureIndex = module.signatureIndexFromFunctionIndexSpace(functionIndex); 522 522 if (functionIndex < codeBlock->functionImportCount()) { 523 JSObject* functionImport = m_instance->instance().importFunction< JSWebAssemblyInstance::PoisonedBarrier<JSObject>>(functionIndex)->get();523 JSObject* functionImport = m_instance->instance().importFunction<WriteBarrier<JSObject>>(functionIndex)->get(); 524 524 if (isWebAssemblyHostFunction(vm, functionImport)) { 525 525 WebAssemblyFunction* wasmFunction = jsDynamicCast<WebAssemblyFunction*>(vm, functionImport); -
trunk/Source/JavaScriptCore/wasm/js/WebAssemblyModuleRecord.h
r230759 r242123 1 1 /* 2 * Copyright (C) 2016-201 8Apple Inc. All rights reserved.2 * Copyright (C) 2016-2019 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 62 62 static void visitChildren(JSCell*, SlotVisitor&); 63 63 64 template<typename T> 65 using PoisonedBarrier = PoisonedWriteBarrier<WebAssemblyModuleRecordPoison, T>; 66 67 PoisonedBarrier<JSWebAssemblyInstance> m_instance; 68 PoisonedBarrier<JSObject> m_startFunction; 64 WriteBarrier<JSWebAssemblyInstance> m_instance; 65 WriteBarrier<JSObject> m_startFunction; 69 66 }; 70 67 -
trunk/Source/JavaScriptCore/wasm/js/WebAssemblyToJSCallee.h
r227527 r242123 1 1 /* 2 * Copyright (C) 2016-201 8Apple Inc. All rights reserved.2 * Copyright (C) 2016-2019 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 52 52 WebAssemblyToJSCallee(VM&, Structure*); 53 53 54 PoisonedWriteBarrier<WebAssemblyToJSCalleePoison,JSWebAssemblyModule> m_module;54 WriteBarrier<JSWebAssemblyModule> m_module; 55 55 }; 56 56 -
trunk/Source/JavaScriptCore/wasm/js/WebAssemblyWrapperFunction.h
r240965 r242123 1 1 /* 2 * Copyright (C) 2017-201 8Apple Inc. All rights reserved.2 * Copyright (C) 2017-2019 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 65 65 WebAssemblyWrapperFunction(VM&, JSGlobalObject*, Structure*, WasmToWasmImportableFunction); 66 66 67 PoisonedWriteBarrier<WebAssemblyWrapperFunctionPoison,JSObject> m_function;67 WriteBarrier<JSObject> m_function; 68 68 // It's safe to just hold the raw WasmToWasmImportableFunction because we have a reference 69 69 // to our Instance, which points to the CodeBlock, which points to the Module
Note:
See TracChangeset
for help on using the changeset viewer.