Skip to content

Commit

Permalink
Refactor RegisterSet to support 128-bit widths
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=246487
rdar://101148986

Reviewed by Yusuke Suzuki.

In preparation for WASM SIMD support, RegisterSet gains the
ability to model half-included registers.

This is needed because on ARM64, there are 8 64-bit callee-save FPRs.
The upper 64-bits of these registers (the vector portion) can be clobbered
by callees, so calls need to be able to say "I clobber only the upper 64-bits"
or "I preserve only the lower 64-bits."

For the case when we want to ask "how many bits do I need to save," we
now use RegisterSet. It is only capable of thinking about whole
registers and their preserved/included widths.

If we want to do register set math, like StuffIClobber() - StuffIAlreadySaved(),
we use a RegisterSetBuilder. We then convert it into a RegisterSet, so that we
can ask "How much of q0 do I need to save?" The types make sure that we
have to do some kind of explicit conversion if we accidentally confuse the two,
so any bugs will be present in the diff presented here.

ScalarRegisterSet is added for cases when you don't care at all about vectors,
and you potentially need to save the extra 8 bytes.

We also add the .buldAndValidate() method, which debug-asserts that your RegisterSet
was already whole, and the .buildScalar() method, which does that and returns a ScalarRegisterSet.

* JSTests/wasm/wasm.json:
* Source/JavaScriptCore/b3/B3Bank.h:
(JSC::B3::minimumWidth):
(JSC::B3::conservativeWidthWithoutVectors):
(JSC::B3::conservativeWidth):
(JSC::B3::conservativeRegisterBytes):
(JSC::B3::conservativeRegisterBytesWithoutVectors):
* Source/JavaScriptCore/b3/B3ConstrainedValue.h:
(JSC::B3::ArgumentLocation::ArgumentLocation):
(JSC::B3::ConstrainedValue::ConstrainedValue):
* Source/JavaScriptCore/b3/B3LowerMacros.cpp:
* Source/JavaScriptCore/b3/B3LowerToAir.cpp:
* Source/JavaScriptCore/b3/B3MemoryValue.cpp:
(JSC::B3::MemoryValue::accessByteSize const):
* Source/JavaScriptCore/b3/B3MemoryValue.h:
* Source/JavaScriptCore/b3/B3StackmapGenerationParams.cpp:
(JSC::B3::StackmapGenerationParams::unavailableRegisters const):
* Source/JavaScriptCore/b3/B3ValueRep.cpp:
(JSC::B3::ValueRep::addUsedRegistersTo const):
* Source/JavaScriptCore/b3/B3Width.cpp:
(JSC::B3::bestType):
(WTF::printInternal): Deleted.
* Source/JavaScriptCore/b3/B3Width.h:
(): Deleted.
(JSC::B3::pointerWidth): Deleted.
(JSC::B3::canonicalWidth): Deleted.
(JSC::B3::isCanonicalWidth): Deleted.
(JSC::B3::conservativeWidth): Deleted.
(JSC::B3::minimumWidth): Deleted.
(JSC::B3::bytes): Deleted.
(JSC::B3::widthForBytes): Deleted.
(JSC::B3::bytesForWidth): Deleted.
(JSC::B3::mask): Deleted.
* Source/JavaScriptCore/b3/air/AirAllocateRegistersAndStackAndGenerateCode.cpp:
(JSC::B3::Air::GenerateAndAllocateRegisters::checkConsistency):
(JSC::B3::Air::GenerateAndAllocateRegisters::release):
(JSC::B3::Air::GenerateAndAllocateRegisters::flush):
(JSC::B3::Air::GenerateAndAllocateRegisters::alloc):
(JSC::B3::Air::GenerateAndAllocateRegisters::assignTmp):
(JSC::B3::Air::GenerateAndAllocateRegisters::isDisallowedRegister):
(JSC::B3::Air::GenerateAndAllocateRegisters::prepareForGeneration):
(JSC::B3::Air::GenerateAndAllocateRegisters::generate):
* Source/JavaScriptCore/b3/air/AirAllocateRegistersAndStackAndGenerateCode.h:
* Source/JavaScriptCore/b3/air/AirAllocateRegistersAndStackByLinearScan.cpp:
* Source/JavaScriptCore/b3/air/AirAllocateRegistersByGraphColoring.cpp:
* Source/JavaScriptCore/b3/air/AirAllocateStackByGraphColoring.cpp:
* Source/JavaScriptCore/b3/air/AirArg.h:
(JSC::B3::Air::Arg::isValidScale):
(JSC::B3::Air::Arg::widthArg):
(JSC::B3::Air::Arg::isRepresentableAs):
(JSC::B3::Air::Arg::castToType):
(JSC::B3::Air::Arg::width const):
(JSC::B3::Air::Arg::isValidAddrForm):
* Source/JavaScriptCore/b3/air/AirCCallSpecial.cpp:
(JSC::B3::Air::CCallSpecial::CCallSpecial):
(JSC::B3::Air::CCallSpecial::extraEarlyClobberedRegs):
* Source/JavaScriptCore/b3/air/AirCCallSpecial.h:
* Source/JavaScriptCore/b3/air/AirCode.cpp:
(JSC::B3::Air::Code::Code):
(JSC::B3::Air::Code::setRegsInPriorityOrder):
(JSC::B3::Air::Code::pinRegister):
(JSC::B3::Air::Code::mutableGPRs):
(JSC::B3::Air::Code::mutableFPRs):
(JSC::B3::Air::Code::setCalleeSaveRegisterAtOffsetList):
* Source/JavaScriptCore/b3/air/AirCode.h:
(JSC::B3::Air::Code::mutableRegs const):
(JSC::B3::Air::Code::isPinned const):
(JSC::B3::Air::Code::pinnedRegisters const):
* Source/JavaScriptCore/b3/air/AirCustom.cpp:
(JSC::B3::Air::PatchCustom::isValidForm):
* Source/JavaScriptCore/b3/air/AirFixPartialRegisterStalls.cpp:
(JSC::B3::Air::fixPartialRegisterStalls):
* Source/JavaScriptCore/b3/air/AirHandleCalleeSaves.cpp:
(JSC::B3::Air::handleCalleeSaves):
* Source/JavaScriptCore/b3/air/AirInstInlines.h:
(JSC::B3::Air::Inst::forEachDefWithExtraClobberedRegs):
* Source/JavaScriptCore/b3/air/AirLogRegisterPressure.cpp:
(JSC::B3::Air::logRegisterPressure):
* Source/JavaScriptCore/b3/air/AirLowerAfterRegAlloc.cpp:
(JSC::B3::Air::lowerAfterRegAlloc):
* Source/JavaScriptCore/b3/air/AirLowerStackArgs.cpp:
(JSC::B3::Air::lowerStackArgs):
* Source/JavaScriptCore/b3/air/AirRegLiveness.cpp:
(JSC::B3::Air::RegLiveness::RegLiveness):
(JSC::B3::Air::RegLiveness::LocalCalcForUnifiedTmpLiveness::LocalCalcForUnifiedTmpLiveness):
(JSC::B3::Air::RegLiveness::LocalCalcForUnifiedTmpLiveness::execute):
* Source/JavaScriptCore/b3/air/AirRegLiveness.h:
(JSC::B3::Air::RegLiveness::LocalCalcBase::live const):
(JSC::B3::Air::RegLiveness::LocalCalcBase::isLive const):
(JSC::B3::Air::RegLiveness::LocalCalc::execute):
(JSC::B3::Air::RegLiveness::liveAtHead const):
(JSC::B3::Air::RegLiveness::liveAtTail const):
(JSC::B3::Air::RegLiveness::Actions::Actions): Deleted.
* Source/JavaScriptCore/b3/air/AirReportUsedRegisters.cpp:
(JSC::B3::Air::reportUsedRegisters):
* Source/JavaScriptCore/b3/air/AirTmpMap.h:
(JSC::B3::Air::TmpMap::clear):
* Source/JavaScriptCore/b3/air/AirTmpWidth.h:
* Source/JavaScriptCore/b3/air/testair.cpp:
* Source/JavaScriptCore/b3/testb3_3.cpp:
(testStorePartial8BitRegisterOnX86):
* Source/JavaScriptCore/b3/testb3_4.cpp:
(testStoreRelAddFenceLoadAcq8):
(testSimplePatchpointWithOuputClobbersGPArgs):
(testSimplePatchpointWithoutOuputClobbersFPArgs):
(testSimplePatchpointWithOuputClobbersFPArgs):
(testPatchpointGPScratch):
(testPatchpointFPScratch):
(testPatchpointLotsOfLateAnys):
* Source/JavaScriptCore/b3/testb3_5.cpp:
(testPatchpointWithStackArgumentResult):
(testPatchpointWithAnyResult):
* Source/JavaScriptCore/b3/testb3_6.cpp:
(testSpillDefSmallerThanUse):
(testSpillUseLargerThanDef):
(testLateRegister):
(testInterpreter):
(testTerminalPatchpointThatNeedsToBeSpilled):
(testTerminalPatchpointThatNeedsToBeSpilled2):
(testPatchpointTerminalReturnValue):
* Source/JavaScriptCore/b3/testb3_7.cpp:
(testPinRegisters):
(testFastTLSLoad):
(testFastTLSStore):
(testShuffleDoesntTrashCalleeSaves):
(testReportUsedRegistersLateUseFollowedByEarlyDefDoesNotMarkUseAsDead):
(testSimpleTuplePair):
(testSimpleTuplePairUnused):
(testSimpleTuplePairStack):
(tailDupedTuplePair):
(tuplePairVariableLoop):
(tupleNestedLoop):
* Source/JavaScriptCore/b3/testb3_8.cpp:
(testWasmAddressDoesNotCSE):
(testStoreAfterClobberExitsSideways):
(testStoreAfterClobberExitsSidewaysSuccessor):
* Source/JavaScriptCore/bytecode/AccessCase.cpp:
(JSC::AccessCase::generateImpl):
* Source/JavaScriptCore/bytecode/AccessCase.h:
(JSC::SharedJITStubSet::Hash::Key::Key):
* Source/JavaScriptCore/bytecode/AccessCaseSnippetParams.cpp:
* Source/JavaScriptCore/bytecode/GetterSetterAccessCase.cpp:
(JSC::GetterSetterAccessCase::emitDOMJITGetter):
* Source/JavaScriptCore/bytecode/InlineAccess.cpp:
(JSC::getScratchRegister):
* Source/JavaScriptCore/bytecode/PolymorphicAccess.cpp:
(JSC::AccessGenerationState::liveRegistersForCall):
(JSC::AccessGenerationState::liveRegistersToPreserveAtExceptionHandlingCallSite):
(JSC::calleeSaveRegisters):
(JSC::AccessGenerationState::calculateLiveRegistersForCallAndExceptionHandling):
(JSC::AccessGenerationState::preserveLiveRegistersToStackForCall):
(JSC::AccessGenerationState::preserveLiveRegistersToStackForCallWithoutExceptions):
(JSC::AccessGenerationState::restoreLiveRegistersFromStackForCallWithThrownException):
(JSC::AccessGenerationState::restoreLiveRegistersFromStackForCall):
(JSC::AccessGenerationState::makeDefaultScratchAllocator):
* Source/JavaScriptCore/bytecode/PolymorphicAccess.h:
(JSC::AccessGenerationState::SpillState::SpillState):
(JSC::AccessGenerationState::preserveLiveRegistersToStackForCall):
(JSC::AccessGenerationState::restoreLiveRegistersFromStackForCall):
* Source/JavaScriptCore/bytecode/ProxyObjectAccessCase.cpp:
(JSC::ProxyObjectAccessCase::emit):
* Source/JavaScriptCore/bytecode/StructureStubInfo.cpp:
(JSC::StructureStubInfo::initializeFromUnlinkedStructureStubInfo):
* Source/JavaScriptCore/bytecode/StructureStubInfo.h:
* Source/JavaScriptCore/dfg/DFGJITCode.cpp:
(JSC::DFG::JITCode::liveRegistersToPreserveAtExceptionHandlingCallSite):
* Source/JavaScriptCore/dfg/DFGJITCode.h:
* Source/JavaScriptCore/dfg/DFGOSREntry.cpp:
(JSC::DFG::prepareOSREntry):
* Source/JavaScriptCore/dfg/DFGOSRExitCompilerCommon.cpp:
(JSC::DFG::adjustAndJumpToTarget):
* Source/JavaScriptCore/dfg/DFGOSRExitCompilerCommon.h:
(JSC::DFG::adjustFrameAndStackInOSRExitCompilerThunk):
* Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp:
(JSC::DFG::SpeculativeJIT::usedRegisters):
* Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp:
(JSC::DFG::SpeculativeJIT::cachedGetById):
* Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp:
(JSC::DFG::SpeculativeJIT::cachedGetById):
(JSC::DFG::SpeculativeJIT::cachedGetByIdWithThis):
* Source/JavaScriptCore/dfg/DFGThunks.cpp:
(JSC::DFG::osrExitGenerationThunkGenerator):
* Source/JavaScriptCore/ftl/FTLLazySlowPath.cpp:
(JSC::FTL::LazySlowPath::initialize):
* Source/JavaScriptCore/ftl/FTLLazySlowPath.h:
(JSC::FTL::LazySlowPath::usedRegisters const):
* Source/JavaScriptCore/ftl/FTLLocation.cpp:
(JSC::FTL::Location::restoreInto const):
* Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::lower):
(JSC::FTL::DFG::LowerDFGToB3::compileUnaryMathIC):
(JSC::FTL::DFG::LowerDFGToB3::compileBinaryMathIC):
(JSC::FTL::DFG::LowerDFGToB3::compileGetByValWithThis):
(JSC::FTL::DFG::LowerDFGToB3::getPrivateName):
(JSC::FTL::DFG::LowerDFGToB3::compilePrivateBrandAccess):
(JSC::FTL::DFG::LowerDFGToB3::compilePutPrivateName):
(JSC::FTL::DFG::LowerDFGToB3::cachedPutById):
(JSC::FTL::DFG::LowerDFGToB3::compileGetByValImpl):
(JSC::FTL::DFG::LowerDFGToB3::compilePutByVal):
(JSC::FTL::DFG::LowerDFGToB3::compileDelBy):
(JSC::FTL::DFG::LowerDFGToB3::compileCompareStrictEq):
* Source/JavaScriptCore/ftl/FTLOSRExitCompiler.cpp:
(JSC::FTL::compileStub):
* Source/JavaScriptCore/ftl/FTLOutput.h:
* Source/JavaScriptCore/ftl/FTLSaveRestore.cpp:
(JSC::FTL::saveAllRegisters):
(JSC::FTL::restoreAllRegisters):
* Source/JavaScriptCore/ftl/FTLSlowPathCall.cpp:
(JSC::FTL::SlowPathCallContext::SlowPathCallContext):
(JSC::FTL::SlowPathCallContext::~SlowPathCallContext):
* Source/JavaScriptCore/ftl/FTLSlowPathCall.h:
(JSC::FTL::callOperation):
* Source/JavaScriptCore/ftl/FTLSlowPathCallKey.cpp:
(JSC::FTL::SlowPathCallKey::dump const):
* Source/JavaScriptCore/ftl/FTLSlowPathCallKey.h:
(JSC::FTL::SlowPathCallKey::SlowPathCallKey):
(JSC::FTL::SlowPathCallKey::usedRegisters const):
(JSC::FTL::SlowPathCallKey::argumentRegistersIfClobberingCheckIsEnabled const):
* Source/JavaScriptCore/ftl/FTLThunks.cpp:
(JSC::FTL::registerClobberCheck):
(JSC::FTL::slowPathCallThunkGenerator):
* Source/JavaScriptCore/interpreter/Interpreter.cpp:
(JSC::UnwindFunctor::copyCalleeSavesToEntryFrameCalleeSavesBuffer const):
* Source/JavaScriptCore/jit/AssemblyHelpers.cpp:
(JSC::AssemblyHelpers::restoreCalleeSavesFromEntryFrameCalleeSavesBuffer):
(JSC::AssemblyHelpers::restoreCalleeSavesFromVMEntryFrameCalleeSavesBufferImpl):
(JSC::AssemblyHelpers::copyCalleeSavesToEntryFrameCalleeSavesBufferImpl):
(JSC::AssemblyHelpers::emitSaveCalleeSavesFor):
(JSC::AssemblyHelpers::emitRestoreCalleeSavesFor):
(JSC::AssemblyHelpers::copyLLIntBaselineCalleeSavesFromFrameOrRegisterToEntryFrameCalleeSavesBuffer):
(JSC::AssemblyHelpers::emitSaveOrCopyLLIntBaselineCalleeSavesFor):
* Source/JavaScriptCore/jit/AssemblyHelpers.h:
(JSC::AssemblyHelpers::selectScratchGPR):
(JSC::AssemblyHelpers::constructRegisterSet):
* Source/JavaScriptCore/jit/AssemblyHelpersSpoolers.h:
(JSC::AssemblyHelpers::LoadRegSpooler::loadGPR):
(JSC::AssemblyHelpers::LoadRegSpooler::loadFPR):
(JSC::AssemblyHelpers::StoreRegSpooler::storeGPR):
(JSC::AssemblyHelpers::StoreRegSpooler::storeFPR):
* Source/JavaScriptCore/jit/CCallHelpers.cpp:
(JSC::CCallHelpers::ensureShadowChickenPacket):
* Source/JavaScriptCore/jit/CCallHelpers.h:
(JSC::CCallHelpers::setupStubArgs):
(JSC::CCallHelpers::prepareForTailCallSlow):
* Source/JavaScriptCore/jit/CallFrameShuffleData.cpp:
(JSC::CallFrameShuffleData::setupCalleeSaveRegisters):
* Source/JavaScriptCore/jit/CallFrameShuffler.cpp:
(JSC::CallFrameShuffler::CallFrameShuffler):
(JSC::CallFrameShuffler::dump const):
* Source/JavaScriptCore/jit/CallFrameShuffler.h:
(JSC::CallFrameShuffler::lockGPR):
(JSC::CallFrameShuffler::releaseGPR):
(JSC::CallFrameShuffler::restoreGPR):
(JSC::CallFrameShuffler::getFreeRegister const):
(JSC::CallFrameShuffler::ensureRegister):
(JSC::CallFrameShuffler::ensureTempGPR):
(JSC::CallFrameShuffler::ensureGPR):
(JSC::CallFrameShuffler::ensureFPR):
* Source/JavaScriptCore/jit/CallFrameShuffler32_64.cpp:
(JSC::CallFrameShuffler::emitLoad):
(JSC::CallFrameShuffler::canLoad):
(JSC::CallFrameShuffler::emitDisplace):
* Source/JavaScriptCore/jit/CallFrameShuffler64.cpp:
(JSC::CallFrameShuffler::emitBox):
(JSC::CallFrameShuffler::emitLoad):
(JSC::CallFrameShuffler::emitDisplace):
(JSC::CallFrameShuffler::tryAcquireNumberTagRegister):
* Source/JavaScriptCore/jit/JITArithmetic.cpp:
* Source/JavaScriptCore/jit/JITCall.cpp:
(JSC::JIT::emit_op_iterator_next):
* Source/JavaScriptCore/jit/JITInlineCacheGenerator.h:
(JSC::JITInlineCacheGenerator::setUpStubInfoImpl):
* Source/JavaScriptCore/jit/Reg.h:
(JSC::Reg::Reg):
(JSC::Reg::fromIndex):
(JSC::Reg::first):
(JSC::Reg::last):
(JSC::Reg::next const):
(JSC::Reg::isSet const):
(JSC::Reg::operator bool const):
(JSC::Reg::isHashTableDeletedValue const):
(JSC::Reg::isGPR const):
(JSC::Reg::isFPR const):
(JSC::Reg::operator== const):
(JSC::Reg::operator!= const):
(JSC::Reg::operator< const):
(JSC::Reg::operator> const):
(JSC::Reg::operator<= const):
(JSC::Reg::operator>= const):
(JSC::Reg::hash const):
(JSC::Reg::invalid):
(JSC::Reg::deleted):
(JSC::widthForBytes):
(JSC::bytesForWidth):
(JSC::mask):
(JSC::pointerWidth):
(JSC::canonicalWidth):
(JSC::isCanonicalWidth):
(JSC::conservativeWidthWithoutVectors):
(JSC::conservativeWidth):
(JSC::conservativeRegisterBytes):
(JSC::conservativeRegisterBytesWithoutVectors):
(WTF::printInternal):
* Source/JavaScriptCore/jit/RegisterAtOffset.h:
(JSC::RegisterAtOffset::RegisterAtOffset):
(JSC::RegisterAtOffset::operator! const):
(JSC::RegisterAtOffset::reg const):
(JSC::RegisterAtOffset::offset const):
(JSC::RegisterAtOffset::byteSize const):
(JSC::RegisterAtOffset::width const):
(JSC::RegisterAtOffset::operator== const):
* Source/JavaScriptCore/jit/RegisterAtOffsetList.cpp:
(JSC::RegisterAtOffsetList::RegisterAtOffsetList):
* Source/JavaScriptCore/jit/RegisterAtOffsetList.h:
(JSC::RegisterAtOffsetList::adjustOffsets):
* Source/JavaScriptCore/jit/RegisterSet.cpp:
(JSC::RegisterSet::vmCalleeSaveRegisterOffsets):
(JSC::RegisterSet::stackRegisters):
(JSC::RegisterSet::reservedHardwareRegisters):
(JSC::RegisterSet::runtimeTagRegisters):
(JSC::RegisterSet::specialRegisters):
(JSC::RegisterSet::stubUnavailableRegisters):
(JSC::RegisterSet::macroClobberedRegisters):
(JSC::RegisterSet::calleeSaveRegisters):
(JSC::RegisterSet::vmCalleeSaveRegisters):
(JSC::RegisterSet::llintBaselineCalleeSaveRegisters):
(JSC::RegisterSet::dfgCalleeSaveRegisters):
(JSC::RegisterSet::ftlCalleeSaveRegisters):
(JSC::RegisterSet::argumentGPRS):
(JSC::RegisterSet::registersToSaveForJSCall):
(JSC::RegisterSet::registersToSaveForCCall):
(JSC::RegisterSet::allGPRs):
(JSC::RegisterSet::allFPRs):
(JSC::RegisterSet::allRegisters):
(JSC::RegisterSet::allScalarRegisters):
(JSC::RegisterSet::volatileRegistersForJSCall): Deleted.
(JSC::RegisterSet::macroScratchRegisters): Deleted.
(JSC::RegisterSet::registersToNotSaveForJSCall): Deleted.
(JSC::RegisterSet::registersToNotSaveForCCall): Deleted.
(JSC::RegisterSet::numberOfSetGPRs const): Deleted.
(JSC::RegisterSet::numberOfSetFPRs const): Deleted.
(JSC::RegisterSet::dump const): Deleted.
* Source/JavaScriptCore/jit/RegisterSet.h:
(JSC::RegisterSet::RegisterSet):
(JSC::RegisterSet::whole const):
(JSC::RegisterSet::numberOfSetRegisters const):
(JSC::RegisterSet::numberOfSetGPRs const):
(JSC::RegisterSet::numberOfSetFPRs const):
(JSC::RegisterSet::scalar const):
(JSC::WholeRegisterSet::scalar const):
(JSC::RegisterSetHash::hash):
(JSC::RegisterSetHash::equal):
(JSC::RegisterSet::set): Deleted.
(JSC::RegisterSet::clear): Deleted.
(JSC::RegisterSet::get const): Deleted.
(JSC::RegisterSet::setAll): Deleted.
(JSC::RegisterSet::add): Deleted.
(JSC::RegisterSet::remove): Deleted.
(JSC::RegisterSet::contains const): Deleted.
(JSC::RegisterSet::merge): Deleted.
(JSC::RegisterSet::filter): Deleted.
(JSC::RegisterSet::exclude): Deleted.
(JSC::RegisterSet::subsumes const): Deleted.
(JSC::RegisterSet::isEmpty const): Deleted.
(JSC::RegisterSet::operator== const): Deleted.
(JSC::RegisterSet::operator!= const): Deleted.
(JSC::RegisterSet::hash const): Deleted.
(JSC::RegisterSet::forEach const): Deleted.
(JSC::RegisterSet::iterator::iterator): Deleted.
(JSC::RegisterSet::iterator::operator* const): Deleted.
(JSC::RegisterSet::iterator::operator++): Deleted.
(JSC::RegisterSet::iterator::operator== const): Deleted.
(JSC::RegisterSet::iterator::operator!= const): Deleted.
(JSC::RegisterSet::begin const): Deleted.
(JSC::RegisterSet::end const): Deleted.
(JSC::RegisterSet::setAny): Deleted.
(JSC::RegisterSet::setMany): Deleted.
* Source/JavaScriptCore/jit/ScratchRegisterAllocator.cpp:
(JSC::ScratchRegisterAllocator::ScratchRegisterAllocator):
(JSC::ScratchRegisterAllocator::lock):
(JSC::ScratchRegisterAllocator::allocateScratch):
(JSC::ScratchRegisterAllocator::preserveReusedRegistersByPushing):
(JSC::ScratchRegisterAllocator::restoreReusedRegistersByPopping):
(JSC::ScratchRegisterAllocator::usedRegistersForCall const):
(JSC::ScratchRegisterAllocator::desiredScratchBufferSizeForCall const):
(JSC::ScratchRegisterAllocator::preserveRegistersToStackForCall):
(JSC::ScratchRegisterAllocator::restoreRegistersFromStackForCall):
* Source/JavaScriptCore/jit/ScratchRegisterAllocator.h:
(JSC::ScratchRegisterAllocator::usedRegisters const):
(JSC::ScratchRegisterAllocator::ScratchRegisterAllocator): Deleted.
* Source/JavaScriptCore/wasm/WasmAirIRGenerator.cpp:
(JSC::Wasm::ConstrainedTmp::ConstrainedTmp):
(JSC::Wasm::ConstrainedTmp::operator bool const):
(JSC::Wasm::AirIRGenerator::emitPatchpoint):
(JSC::Wasm::AirIRGenerator::emitLoad):
(JSC::Wasm::AirIRGenerator::materializeAddrArg):
(JSC::Wasm::AirIRGenerator::restoreWasmContextInstance):
(JSC::Wasm::AirIRGenerator::AirIRGenerator):
(JSC::Wasm::AirIRGenerator::restoreWebAssemblyGlobalState):
(JSC::Wasm::AirIRGenerator::addCurrentMemory):
(JSC::Wasm::AirIRGenerator::getGlobal):
(JSC::Wasm::AirIRGenerator::setGlobal):
(JSC::Wasm::AirIRGenerator::emitLoadOp):
(JSC::Wasm::AirIRGenerator::emitStoreOp):
(JSC::Wasm::accessWidth):
(JSC::Wasm::AirIRGenerator::fixupPointerPlusOffsetForAtomicOps):
(JSC::Wasm::AirIRGenerator::sanitizeAtomicResult):
(JSC::Wasm::AirIRGenerator::appendGeneralAtomic):
(JSC::Wasm::AirIRGenerator::appendStrongCAS):
(JSC::Wasm::AirIRGenerator::emitAtomicLoadOp):
(JSC::Wasm::AirIRGenerator::emitAtomicStoreOp):
(JSC::Wasm::AirIRGenerator::emitAtomicBinaryRMWOp):
(JSC::Wasm::AirIRGenerator::emitAtomicCompareExchange):
(JSC::Wasm::AirIRGenerator::addUncheckedFloatingPointTruncation):
(JSC::Wasm::AirIRGenerator::emitEntryTierUpCheck):
(JSC::Wasm::AirIRGenerator::emitLoopTierUpCheck):
(JSC::Wasm::AirIRGenerator::emitCatchImpl):
(JSC::Wasm::AirIRGenerator::addThrow):
(JSC::Wasm::AirIRGenerator::addRethrow):
(JSC::Wasm::AirIRGenerator::addReturn):
(JSC::Wasm::AirIRGenerator::addSwitch):
(JSC::Wasm::AirIRGenerator::emitCallPatchpoint):
(JSC::Wasm::AirIRGenerator::addCallIndirect):
(JSC::Wasm::AirIRGenerator::emitIndirectCall):
(JSC::Wasm::AirIRGenerator::addOp<F64ConvertUI64>):
(JSC::Wasm::AirIRGenerator::addOp<OpType::F32ConvertUI64>):
(JSC::Wasm::AirIRGenerator::preparePatchpointForExceptions):
* Source/JavaScriptCore/wasm/WasmB3IRGenerator.cpp:
(JSC::Wasm::B3IRGenerator::restoreWasmContextInstance):
(JSC::Wasm::B3IRGenerator::B3IRGenerator):
(JSC::Wasm::B3IRGenerator::restoreWebAssemblyGlobalState):
(JSC::Wasm::B3IRGenerator::addArguments):
(JSC::Wasm::B3IRGenerator::emitIndirectCall):
(JSC::Wasm::accessWidth):
(JSC::Wasm::B3IRGenerator::sanitizeAtomicResult):
(JSC::Wasm::B3IRGenerator::fixupPointerPlusOffsetForAtomicOps):
(JSC::Wasm::B3IRGenerator::emitAtomicLoadOp):
(JSC::Wasm::B3IRGenerator::emitAtomicStoreOp):
(JSC::Wasm::B3IRGenerator::emitAtomicBinaryRMWOp):
(JSC::Wasm::B3IRGenerator::emitAtomicCompareExchange):
(JSC::Wasm::B3IRGenerator::truncSaturated):
(JSC::Wasm::B3IRGenerator::addConstant):
(JSC::Wasm::B3IRGenerator::emitEntryTierUpCheck):
(JSC::Wasm::B3IRGenerator::emitLoopTierUpCheck):
(JSC::Wasm::B3IRGenerator::emitCatchImpl):
(JSC::Wasm::B3IRGenerator::addThrow):
(JSC::Wasm::B3IRGenerator::addRethrow):
(JSC::Wasm::B3IRGenerator::addReturn):
(JSC::Wasm::B3IRGenerator::createCallPatchpoint):
(JSC::Wasm::B3IRGenerator::addOp<F64ConvertUI64>):
(JSC::Wasm::B3IRGenerator::addOp<OpType::F32ConvertUI64>):
(JSC::Wasm::B3IRGenerator::addOp<OpType::I64TruncUF64>):
(JSC::Wasm::B3IRGenerator::addOp<OpType::I64TruncUF32>):
* Source/JavaScriptCore/wasm/WasmCallee.cpp:
(JSC::Wasm::LLIntCallee::calleeSaveRegistersImpl):
* Source/JavaScriptCore/wasm/WasmCallingConvention.cpp:
(JSC::Wasm::jsCallingConvention):
(JSC::Wasm::wasmCallingConvention):
* Source/JavaScriptCore/wasm/WasmCallingConvention.h:
(JSC::Wasm::ArgumentLocation::ArgumentLocation):
(JSC::Wasm::CallInformation::computeResultsOffsetList):
(JSC::Wasm::WasmCallingConvention::WasmCallingConvention):
(JSC::Wasm::WasmCallingConvention::marshallLocationImpl const):
(JSC::Wasm::WasmCallingConvention::marshallLocation const):
(JSC::Wasm::JSCallingConvention::JSCallingConvention):
(JSC::Wasm::JSCallingConvention::marshallLocationImpl const):
(JSC::Wasm::JSCallingConvention::callInformationFor const):
* Source/JavaScriptCore/wasm/WasmFormat.h:
(JSC::Wasm::typeToString):
* Source/JavaScriptCore/wasm/WasmMemoryInformation.h:
(JSC::Wasm::PinnedRegisterInfo::toSave const):
* Source/JavaScriptCore/wasm/WasmOperations.cpp:
(JSC::Wasm::doOSREntry):
(JSC::Wasm::JSC_DEFINE_JIT_OPERATION):
* Source/JavaScriptCore/wasm/WasmThunks.cpp:
(JSC::Wasm::triggerOMGEntryTierUpThunkGenerator):
* Source/JavaScriptCore/wasm/WasmTypeDefinition.cpp:
(JSC::Wasm::TypeInformation::TypeInformation):
* Source/JavaScriptCore/wasm/generateWasmOpsHeader.py:
(typeMacroizer):
* Source/JavaScriptCore/wasm/js/JSToWasm.cpp:
(JSC::Wasm::marshallJSResult):
(JSC::Wasm::createJSToWasmWrapper):
* Source/JavaScriptCore/wasm/js/WasmToJS.cpp:
(JSC::Wasm::wasmToJS):
* Source/JavaScriptCore/wasm/js/WebAssemblyFunction.cpp:
(JSC::WebAssemblyFunction::calleeSaves const):
(JSC::WebAssemblyFunction::jsCallEntrypointSlow):
* Source/JavaScriptCore/wasm/js/WebAssemblyFunction.h:
* Source/JavaScriptCore/wasm/wasm.json:
* Source/WTF/wtf/Atomics.h:
(WTF::Dependency::Dependency):
* Source/WTF/wtf/Bitmap.h:
(WTF::WordType>::get const):
(WTF::WordType>::concurrentTestAndSet):
(WTF::WordType>::concurrentTestAndClear):
(WTF::WordType>::clearAll):
(WTF::WordType>::setAll):
(WTF::WordType>::findRunOfZeros const):
(WTF::WordType>::count const):
(WTF::WordType>::concurrentFilter):
(WTF::WordType>::forEachSetBit const):
(WTF::WordType>::findBit const):
(WTF::WordType>::hash const):

Canonical link: https://commits.webkit.org/255736@main
  • Loading branch information
justinmichaud committed Oct 19, 2022
1 parent 256a5b8 commit 912bf24
Show file tree
Hide file tree
Showing 143 changed files with 2,381 additions and 1,828 deletions.
4 changes: 2 additions & 2 deletions JSTests/wasm/assert.js
Expand Up @@ -180,11 +180,11 @@ const printExn = (e) => {
print(e.stack);
};

export const asyncTest = (promise) => asyncTestImpl(promise, harnessCall(asyncTestPassed), printExn);
export const asyncTest = (promise) => asyncTestImpl(promise, harnessCall(() => asyncTestPassed()), printExn);
export const asyncTestEq = (promise, expected) => {
const thenCheck = (value) => {
if (value === expected)
return harnessCall(asyncTestPassed);
return harnessCall(() => asyncTestPassed());
print("Failed: got ", value, " but expected ", expected);

}
Expand Down
30 changes: 15 additions & 15 deletions JSTests/wasm/wasm.json
Expand Up @@ -7,21 +7,21 @@
{ "name": "version", "type": "uint32", "value": 1, "description": "Version number" }
],
"type" : {
"i32": { "type": "varint7", "value": -1, "b3type": "B3::Int32" },
"i64": { "type": "varint7", "value": -2, "b3type": "B3::Int64" },
"f32": { "type": "varint7", "value": -3, "b3type": "B3::Float" },
"f64": { "type": "varint7", "value": -4, "b3type": "B3::Double" },
"funcref": { "type": "varint7", "value": -16, "b3type": "B3::Int64" },
"externref": { "type": "varint7", "value": -17, "b3type": "B3::Int64" },
"ref_null": { "type": "varint7", "value": -20, "b3type": "B3::Int64" },
"ref": { "type": "varint7", "value": -21, "b3type": "B3::Int64" },
"i31ref": { "type": "varint7", "value": -22, "b3type": "B3::Void" },
"arrayref": { "type": "varint7", "value": -26, "b3type": "B3::Int64" },
"func": { "type": "varint7", "value": -32, "b3type": "B3::Void" },
"struct": { "type": "varint7", "value": -33, "b3type": "B3::Void" },
"array": { "type": "varint7", "value": -34, "b3type": "B3::Void" },
"rec": { "type": "varint7", "value": -49, "b3type": "B3::Void" },
"void": { "type": "varint7", "value": -64, "b3type": "B3::Void" }
"i32": { "type": "varint7", "value": -1, "b3type": "B3::Int32", "width": 32 },
"i64": { "type": "varint7", "value": -2, "b3type": "B3::Int64", "width": 64 },
"f32": { "type": "varint7", "value": -3, "b3type": "B3::Float", "width": 32 },
"f64": { "type": "varint7", "value": -4, "b3type": "B3::Double", "width": 64 },
"funcref": { "type": "varint7", "value": -16, "b3type": "B3::Int64", "width": 64 },
"externref": { "type": "varint7", "value": -17, "b3type": "B3::Int64", "width": 64 },
"ref_null": { "type": "varint7", "value": -20, "b3type": "B3::Int64", "width": 64 },
"ref": { "type": "varint7", "value": -21, "b3type": "B3::Int64", "width": 64 },
"i31ref": { "type": "varint7", "value": -22, "b3type": "B3::Void", "width": 0 },
"arrayref": { "type": "varint7", "value": -26, "b3type": "B3::Int64", "width": 0 },
"func": { "type": "varint7", "value": -32, "b3type": "B3::Void", "width": 0 },
"struct": { "type": "varint7", "value": -33, "b3type": "B3::Void", "width": 0 },
"array": { "type": "varint7", "value": -34, "b3type": "B3::Void", "width": 0 },
"rec": { "type": "varint7", "value": -49, "b3type": "B3::Void", "width": 0 },
"void": { "type": "varint7", "value": -64, "b3type": "B3::Void", "width": 0 }
},
"value_type": ["i32", "i64", "f32", "f64", "externref", "funcref"],
"block_type": ["i32", "i64", "f32", "f64", "void", "externref", "funcref"],
Expand Down
1 change: 1 addition & 0 deletions Source/JavaScriptCore/CMakeLists.txt
Expand Up @@ -897,6 +897,7 @@ set(JavaScriptCore_PRIVATE_FRAMEWORK_HEADERS
jit/SpillRegistersMode.h
jit/TagRegistersMode.h
jit/ThunkGenerator.h
jit/Width.h

llint/LLIntOpcode.h

Expand Down
16 changes: 11 additions & 5 deletions Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
Expand Up @@ -812,16 +812,16 @@
14CA958B16AB50DE00938A06 /* StaticPropertyAnalyzer.h in Headers */ = {isa = PBXBuildFile; fileRef = 14CA958A16AB50DE00938A06 /* StaticPropertyAnalyzer.h */; settings = {ATTRIBUTES = (Private, ); }; };
14CA958D16AB50FA00938A06 /* ObjectAllocationProfile.h in Headers */ = {isa = PBXBuildFile; fileRef = 14CA958C16AB50FA00938A06 /* ObjectAllocationProfile.h */; settings = {ATTRIBUTES = (Private, ); }; };
14D01A7721FB351F00BC54E9 /* JSScriptSourceProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 14D01A7621FB350300BC54E9 /* JSScriptSourceProvider.h */; };
14D01A7721FBEF3800CAE0D0 /* JSWebAssemblyStruct.h in Headers */ = {isa = PBXBuildFile; fileRef = 14D01BE026DEEF3800CAE0D0 /* JSWebAssemblyStruct.h */; };
14D01BE626DEEF3800CAE0D0 /* WebAssemblyTagConstructor.h in Headers */ = {isa = PBXBuildFile; fileRef = 14D01BDA26DEEF3700CAE0D0 /* WebAssemblyTagConstructor.h */; };
14D01BE726DEEF3800CAE0D0 /* WebAssemblyTagPrototype.h in Headers */ = {isa = PBXBuildFile; fileRef = 14D01BDB26DEEF3700CAE0D0 /* WebAssemblyTagPrototype.h */; };
14D01BE926DEEF3800CAE0D0 /* WebAssemblyExceptionPrototype.h in Headers */ = {isa = PBXBuildFile; fileRef = 14D01BDD26DEEF3700CAE0D0 /* WebAssemblyExceptionPrototype.h */; };
14D01BE926DECC3800CAE0D0 /* WebAssemblyStructPrototype.h in Headers */ = {isa = PBXBuildFile; fileRef = 14D01BDD26DEEF378CCAE0D0 /* WebAssemblyStructPrototype.h */; };
14D01BE926DEEF3800CAE0D0 /* WebAssemblyExceptionPrototype.h in Headers */ = {isa = PBXBuildFile; fileRef = 14D01BDD26DEEF3700CAE0D0 /* WebAssemblyExceptionPrototype.h */; };
14D01BEC26DEEF3800CAE0D0 /* JSWebAssemblyTag.h in Headers */ = {isa = PBXBuildFile; fileRef = 14D01BE026DEEF3700CAE0D0 /* JSWebAssemblyTag.h */; };
14D01BED26DEEF3800CAE0D0 /* JSWebAssemblyException.h in Headers */ = {isa = PBXBuildFile; fileRef = 14D01BE126DEEF3800CAE0D0 /* JSWebAssemblyException.h */; };
14D01A7721FBEF3800CAE0D0 /* JSWebAssemblyStruct.h in Headers */ = {isa = PBXBuildFile; fileRef = 14D01BE026DEEF3800CAE0D0 /* JSWebAssemblyStruct.h */; };
14D01BEF26DEEF3800CAE0D0 /* WebAssemblyExceptionConstructor.h in Headers */ = {isa = PBXBuildFile; fileRef = 14D01BE326DEEF3800CAE0D0 /* WebAssemblyExceptionConstructor.h */; };
14D01DEF26DEEF3800CAE0D0 /* WebAssemblyStructConstructor.h in Headers */ = {isa = PBXBuildFile; fileRef = 14D01BE326DFEF3800CAE0D0 /* WebAssemblyStructConstructor.h */; };
14D01BF526DEEF5300CAE0D0 /* WasmTag.h in Headers */ = {isa = PBXBuildFile; fileRef = 14D01BF326DEEF5200CAE0D0 /* WasmTag.h */; };
14D01DEF26DEEF3800CAE0D0 /* WebAssemblyStructConstructor.h in Headers */ = {isa = PBXBuildFile; fileRef = 14D01BE326DFEF3800CAE0D0 /* WebAssemblyStructConstructor.h */; };
14D2F3DB139F4BE200491031 /* MarkedSpace.h in Headers */ = {isa = PBXBuildFile; fileRef = 14D2F3D9139F4BE200491031 /* MarkedSpace.h */; settings = {ATTRIBUTES = (Private, ); }; };
14DF04DA16B3996D0016A513 /* StaticPropertyAnalysis.h in Headers */ = {isa = PBXBuildFile; fileRef = 14DF04D916B3996D0016A513 /* StaticPropertyAnalysis.h */; settings = {ATTRIBUTES = (Private, ); }; };
14E84F9F14EE1ACC00D6D5D4 /* WeakBlock.h in Headers */ = {isa = PBXBuildFile; fileRef = 14E84F9A14EE1ACC00D6D5D4 /* WeakBlock.h */; settings = {ATTRIBUTES = (Private, ); }; };
Expand Down Expand Up @@ -877,6 +877,7 @@
4B46940328984FA800512FDF /* MacroAssemblerARM64.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FEB137561BB11EEE00CD5100 /* MacroAssemblerARM64.cpp */; };
4B46940428984FEE00512FDF /* MacroAssemblerX86Common.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7A4AE0717973B26005612B1 /* MacroAssemblerX86Common.cpp */; };
4BAA07CEB81F49A296E02203 /* WasmTypeDefinitionInlines.h in Headers */ = {isa = PBXBuildFile; fileRef = 30A5F403F11C4F599CD596D5 /* WasmTypeDefinitionInlines.h */; settings = {ATTRIBUTES = (Private, ); }; };
4BBA4CD528FF5FE5003EBFC4 /* Width.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BBA4CD428FF5FE5003EBFC4 /* Width.h */; settings = {ATTRIBUTES = (Private, ); }; };
4BDF3004289324AC00AE1DE3 /* AssemblyComments.h in Headers */ = {isa = PBXBuildFile; fileRef = 4BDF3002289324AC00AE1DE3 /* AssemblyComments.h */; settings = {ATTRIBUTES = (Private, ); }; };
4BE92D442898522400FA48E1 /* LowLevelInterpreter.asm in Sources */ = {isa = PBXBuildFile; fileRef = 86A054461556451B00445157 /* LowLevelInterpreter.asm */; };
4BE92D452898522400FA48E1 /* LowLevelInterpreter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F4680C714BBB16900BFE272 /* LowLevelInterpreter.cpp */; };
Expand Down Expand Up @@ -3707,19 +3708,19 @@
14CA958C16AB50FA00938A06 /* ObjectAllocationProfile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ObjectAllocationProfile.h; sourceTree = "<group>"; };
14CC3BA12138A238002D58B6 /* InstructionStream.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = InstructionStream.cpp; sourceTree = "<group>"; };
14CC3BA22138A238002D58B6 /* InstructionStream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InstructionStream.h; sourceTree = "<group>"; };
14CC3BA22138F3700CAE0D0D /* JSWebAssemblyStruct.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSWebAssemblyStruct.cpp; path = js/JSWebAssemblyStruct.cpp; sourceTree = "<group>"; };
14D01A7521FB350300BC54E9 /* JSScriptSourceProvider.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = JSScriptSourceProvider.mm; sourceTree = "<group>"; };
14D01A7621FB350300BC54E9 /* JSScriptSourceProvider.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JSScriptSourceProvider.h; sourceTree = "<group>"; };
14D01BDA26DEEF3700CAE0D0 /* WebAssemblyTagConstructor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebAssemblyTagConstructor.h; path = js/WebAssemblyTagConstructor.h; sourceTree = "<group>"; };
14D01BDB26DEEF3700CAE0D0 /* WebAssemblyTagPrototype.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebAssemblyTagPrototype.h; path = js/WebAssemblyTagPrototype.h; sourceTree = "<group>"; };
14D01BDC26DEEF3700CAE0D0 /* JSWebAssemblyException.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSWebAssemblyException.cpp; path = js/JSWebAssemblyException.cpp; sourceTree = "<group>"; };
14CC3BA22138F3700CAE0D0D /* JSWebAssemblyStruct.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSWebAssemblyStruct.cpp; path = js/JSWebAssemblyStruct.cpp; sourceTree = "<group>"; };
14D01BDD26DEEF3700CAE0D0 /* WebAssemblyExceptionPrototype.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebAssemblyExceptionPrototype.h; path = js/WebAssemblyExceptionPrototype.h; sourceTree = "<group>"; };
14D01BDD26DEEF378CCAE0D0 /* WebAssemblyStructPrototype.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebAssemblyStructPrototype.h; path = js/WebAssemblyStructPrototype.h; sourceTree = "<group>"; };
14D01BDE26DEEF3700CAE0D0 /* WebAssemblyTagConstructor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebAssemblyTagConstructor.cpp; path = js/WebAssemblyTagConstructor.cpp; sourceTree = "<group>"; };
14D01BDF26DEEF3700CAE0D0 /* WebAssemblyTagPrototype.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebAssemblyTagPrototype.cpp; path = js/WebAssemblyTagPrototype.cpp; sourceTree = "<group>"; };
14D01BE026DEEF3700CAE0D0 /* JSWebAssemblyTag.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSWebAssemblyTag.h; path = js/JSWebAssemblyTag.h; sourceTree = "<group>"; };
14D01BE126DEEF3800CAE0D0 /* JSWebAssemblyException.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSWebAssemblyException.h; path = js/JSWebAssemblyException.h; sourceTree = "<group>"; };
14D01BE026DEEF3800CAE0D0 /* JSWebAssemblyStruct.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSWebAssemblyStruct.h; path = js/JSWebAssemblyStruct.h; sourceTree = "<group>"; };
14D01BE126DEEF3800CAE0D0 /* JSWebAssemblyException.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSWebAssemblyException.h; path = js/JSWebAssemblyException.h; sourceTree = "<group>"; };
14D01BE226DEEF3800CAE0D0 /* WebAssemblyExceptionPrototype.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebAssemblyExceptionPrototype.cpp; path = js/WebAssemblyExceptionPrototype.cpp; sourceTree = "<group>"; };
14D01BE226DEEF3CFECAE0D0 /* WebAssemblyStructPrototype.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebAssemblyStructPrototype.cpp; path = js/WebAssemblyStructPrototype.cpp; sourceTree = "<group>"; };
14D01BE326DEEF3800CAE0D0 /* WebAssemblyExceptionConstructor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebAssemblyExceptionConstructor.h; path = js/WebAssemblyExceptionConstructor.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -3825,6 +3826,8 @@
442FBD852149D1E00073519C /* hasher.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; name = hasher.py; path = yarr/hasher.py; sourceTree = "<group>"; };
451539B812DC994500EF7AC4 /* Yarr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Yarr.h; path = yarr/Yarr.h; sourceTree = "<group>"; };
45E12D8806A49B0F00E9DF84 /* jsc.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = jsc.cpp; sourceTree = "<group>"; tabWidth = 4; };
4BBA4CD428FF5FE5003EBFC4 /* Width.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Width.h; sourceTree = "<group>"; };
4BDF15B128FF912800D36BA1 /* Width.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = Width.cpp; sourceTree = "<group>"; };
4BDF3001289324AB00AE1DE3 /* AssemblyComments.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AssemblyComments.cpp; sourceTree = "<group>"; };
4BDF3002289324AC00AE1DE3 /* AssemblyComments.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AssemblyComments.h; sourceTree = "<group>"; };
4CE978E385A8498199052153 /* ModuleNamespaceAccessCase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ModuleNamespaceAccessCase.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -6730,6 +6733,8 @@
0F572D4D16879FDB00E57FBD /* ThunkGenerator.h */,
A7386552118697B400540279 /* ThunkGenerators.cpp */,
A7386553118697B400540279 /* ThunkGenerators.h */,
4BDF15B128FF912800D36BA1 /* Width.cpp */,
4BBA4CD428FF5FE5003EBFC4 /* Width.h */,
);
path = jit;
sourceTree = "<group>";
Expand Down Expand Up @@ -11453,6 +11458,7 @@
14D01BE726DEEF3800CAE0D0 /* WebAssemblyTagPrototype.h in Headers */,
52F6C35E1E71EB080081F4CC /* WebAssemblyWrapperFunction.h in Headers */,
BC18C47A0E16F5CD00B34460 /* WebKitAvailability.h in Headers */,
4BBA4CD528FF5FE5003EBFC4 /* Width.h in Headers */,
99DA00A61BD5993100F4575C /* wkbuiltins.py in Headers */,
A7DCB97312E5193F00911940 /* WriteBarrier.h in Headers */,
C2B6D75318A33793004A9301 /* WriteBarrierInlines.h in Headers */,
Expand Down
1 change: 1 addition & 0 deletions Source/JavaScriptCore/Sources.txt
Expand Up @@ -701,6 +701,7 @@ jit/SetupVarargsFrame.cpp
jit/SlowPathCall.cpp
jit/TagRegistersMode.cpp
jit/ThunkGenerators.cpp
jit/Width.cpp

llint/LLIntCLoop.cpp
llint/LLIntData.cpp
Expand Down
25 changes: 25 additions & 0 deletions Source/JavaScriptCore/b3/B3Bank.h
Expand Up @@ -69,6 +69,31 @@ inline Bank bankForReg(Reg reg)
return reg.isGPR() ? GP : FP;
}

inline Width minimumWidth(Bank bank)
{
return bank == GP ? Width8 : Width32;
}

ALWAYS_INLINE constexpr Width conservativeWidthWithoutVectors(Bank bank)
{
return bank == FP ? Width64 : widthForBytes(sizeof(CPURegister));
}

ALWAYS_INLINE constexpr Width conservativeWidth(Bank bank)
{
return bank == FP ? Width64 : widthForBytes(sizeof(CPURegister));
}

ALWAYS_INLINE constexpr unsigned conservativeRegisterBytes(Bank bank)
{
return bytesForWidth(conservativeWidth(bank));
}

ALWAYS_INLINE constexpr unsigned conservativeRegisterBytesWithoutVectors(Bank bank)
{
return bytesForWidth(conservativeWidthWithoutVectors(bank));
}

} } // namespace JSC::B3

namespace WTF {
Expand Down
21 changes: 21 additions & 0 deletions Source/JavaScriptCore/b3/B3ConstrainedValue.h
Expand Up @@ -28,11 +28,26 @@
#if ENABLE(B3_JIT)

#include "B3ValueRep.h"
#include "B3Width.h"
#include "WasmCallingConvention.h"

namespace JSC { namespace B3 {

class Value;

struct ArgumentLocation {
ArgumentLocation(Wasm::ValueLocation loc, Width width)
: location(loc)
, width(width)
{
}

ArgumentLocation() { }

Wasm::ValueLocation location;
Width width;
};

class ConstrainedValue {
public:
ConstrainedValue()
Expand All @@ -51,6 +66,12 @@ class ConstrainedValue {
{
}

ConstrainedValue(Value* value, const Wasm::ArgumentLocation& loc)
: m_value(value)
, m_rep(loc.location)
{
}

explicit operator bool() const { return m_value || m_rep; }

Value* value() const { return m_value; }
Expand Down
2 changes: 1 addition & 1 deletion Source/JavaScriptCore/b3/B3Effects.h
Expand Up @@ -66,7 +66,7 @@ struct Effects {
// having other pinned registers that are mutable, then you can use ArgumentReg. Also note that
// nobody will stop you from making this get out-of-sync with your clobbered register sets in
// Patchpoint. It's recommended that you err on the side of being conservative.
// FIXME: Explore making these be RegisterSets. That's mainly hard because it would be awkward to
// FIXME: Explore making these be RegisterSetBuilders. That's mainly hard because it would be awkward to
// reconcile with StackmapValue's support for clobbered regs.
// https://bugs.webkit.org/show_bug.cgi?id=163173
bool readsPinned { false };
Expand Down
2 changes: 1 addition & 1 deletion Source/JavaScriptCore/b3/B3LowerMacros.cpp
Expand Up @@ -575,7 +575,7 @@ class LowerMacros {
patchpoint->numGPScratchRegisters = 2;
// Technically, we don't have to clobber macro registers on X86_64. This is probably
// OK though.
patchpoint->clobber(RegisterSet::macroScratchRegisters());
patchpoint->clobber(RegisterSetBuilder::macroClobberedRegisters());

BitVector handledIndices;
for (unsigned i = start; i < end; ++i) {
Expand Down

0 comments on commit 912bf24

Please sign in to comment.