2022-04-02 Keith Miller AI should do int32 optimization in ValueRep https://bugs.webkit.org/show_bug.cgi?id=238699 Reviewed by Saam Barati. When constant folding an int52 into a ValueRep AI doesn't do our normal int32 boxing optimization. I'm not sure if it matters since I couldn't find a test but it probably doesn't hurt. * dfg/DFGAbstractInterpreterInlines.h: (JSC::DFG::AbstractInterpreter::executeEffects): 2022-03-21 Saam Barati Fix bug in Relationship::mergeImpl https://bugs.webkit.org/show_bug.cgi?id=238183 Reviewed by Yusuke Suzuki. * dfg/DFGIntegerRangeOptimizationPhase.cpp: 2022-03-21 Saam Barati AirFixObviousSpills needs to consider a PreIndex and PostIndex as clobbering the Reg used for indexing https://bugs.webkit.org/show_bug.cgi?id=238178 Reviewed by Mark Lam. Inside AirFixObviousSpills, we run a basic alias analysis for StackSlots and registers. For example, when we overwrite a register, we clear anything it's aliased with. However, the way we were doing this was by looking at each Arg that was Defd. However, this iteration was missing that PostIndex/PreIndex mutate the register that feeds into the address Arg. This patch fixes the issue by walking the instruction in such a way that we visit all the Defs we care about, both Regs and StackSlots. * b3/air/AirFixObviousSpills.cpp: 2022-05-13 Adrian Perez de Castro Non-unified build broken in debug mode https://bugs.webkit.org/show_bug.cgi?id=240378 Unreviewed non-unified build fixes. * heap/StructureAlignedMemoryAllocator.cpp: Include if needed. 2022-05-13 Lauro Moura Unreviewed, non-unified build fixes https://bugs.webkit.org/show_bug.cgi?id=240369 * runtime/DateConversion.cpp: 2022-03-24 Yusuke Suzuki [JSC] JSRemoteFunction thunk should materialize code-pointer https://bugs.webkit.org/show_bug.cgi?id=238313 Reviewed by Mark Lam. When invoking a JSRemoteFunction, we must first wrap the arguments passed to it. The wrapping operation may trigger a GC, and GC can jettison JIT code. As a result, even though we know that the target JSFunction has JIT code that we want to execute, the JIT code may be jettisoned (while wrapping the arguments for it) before we get to the call. This resulted in occasional crashes on the JSTests/stress/shadow-realm-evaluate.js test. This patch fixes this by doing a null check on the JIT code just before calling it, and if null (i.e. the JIT code has been jettisoned), re-materializing the JIT code first before making the call. * jit/JITOperations.cpp: (JSC::JSC_DEFINE_JIT_OPERATION): * jit/JITOperations.h: * jit/ThunkGenerators.cpp: (JSC::remoteFunctionCallGenerator): 2022-03-23 Geza Lore [JSC] Fix remoteFunctionCallGenerator on MIPS https://bugs.webkit.org/show_bug.cgi?id=238274 Reviewed by Yusuke Suzuki. Eliminate register conflict (nonArgGPR0 == regT4, which is used in valueRegs) * jit/ThunkGenerators.cpp: (JSC::remoteFunctionCallGenerator): 2022-03-03 Saam Barati Add a DeferTraps scope https://bugs.webkit.org/show_bug.cgi?id=237306 Reviewed by Mark Lam. * bytecode/CodeBlock.cpp: (JSC::CodeBlock::CodeBlock): (JSC::CodeBlock::jettison): (JSC::CodeBlock::noticeIncomingCall): * bytecode/CodeBlock.h: * bytecode/RepatchInlines.h: (JSC::linkFor): (JSC::virtualForWithFunction): * dfg/DFGOperations.cpp: (JSC::DFG::JSC_DEFINE_JIT_OPERATION): * interpreter/Interpreter.cpp: (JSC::Interpreter::executeProgram): (JSC::Interpreter::executeCall): (JSC::Interpreter::executeConstruct): (JSC::Interpreter::execute): (JSC::Interpreter::executeModuleProgram): * interpreter/InterpreterInlines.h: (JSC::Interpreter::execute): * llint/LLIntSlowPaths.cpp: (JSC::LLInt::setUpCall): * runtime/ExceptionScope.h: * runtime/ScriptExecutable.cpp: (JSC::ScriptExecutable::installCode): * runtime/VMTraps.cpp: (JSC::VMTraps::handleTraps): (JSC::VMTraps::takeTopPriorityTrap): * runtime/VMTraps.h: (JSC::VMTraps::needHandling const): (JSC::VMTraps::maybeNeedHandling const): (JSC::VMTraps::hasTrapBit): (JSC::VMTraps::setTrapBit): * runtime/VMTrapsInlines.h: (JSC::DeferTraps::DeferTraps): (JSC::DeferTraps::~DeferTraps): 2022-03-01 Michael Catanzaro Misc compiler warnings, late Feb 2022 edition https://bugs.webkit.org/show_bug.cgi?id=237275 Reviewed by Adrian Perez de Castro. Suppress suspected false-positive -Wstringop-overflow and -Wformat-overflow warnings. Also, remove an unused variable. * API/tests/MultithreadedMultiVMExecutionTest.cpp: (startMultithreadedMultiVMExecutionTest): * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::compileCompareStrictEq): * ftl/FTLOSRExit.cpp: (JSC::FTL::OSRExitDescriptor::prepareOSRExitHandle): * yarr/YarrJIT.cpp: 2022-02-23 Adrian Perez de Castro Ensure generated inline assembler that setups segments returns to previous state https://bugs.webkit.org/show_bug.cgi?id=236976 Reviewed by Yusuke Suzuki. Use .previous in inline assembler in order to ensure that mixed emission of assembler functions and other definitions correctly puts each of them in their rightful sections in the output object code. * assembler/MacroAssemblerARM64.cpp: * assembler/MacroAssemblerARMv7.cpp: * assembler/MacroAssemblerMIPS.cpp: * assembler/MacroAssemblerX86Common.cpp: 2022-02-22 Alexander Kanavin When building introspection files, add CMAKE_C_FLAGS to the compiler flags. https://bugs.webkit.org/show_bug.cgi?id=232936 Reviewed by Michael Catanzaro. g-ir-compiler is using a C compiler internally, so it needs to set the proper flags for it. * PlatformGTK.cmake: 2022-02-21 Robin Morisset [JSC] Format the output of --reportTotalPhaseTimes=1 more nicely https://bugs.webkit.org/show_bug.cgi?id=237005 Reviewed by Saam Barati. Before this patch: [B3] moveConstants total ms: 64.307583 max ms: 1.703167 [B3] lowerToAir total ms: 151.297782 max ms: 5.426375 [B3] generateToAir total ms: 1623.987166 max ms: 92.826750 [B3] simplifyCFG total ms: 11.760463 max ms: 1.088083 [B3] Air::lowerMacros total ms: 5.975679 max ms: 0.382000 After this patch: total ms: 66.328 max ms: 2.283 [B3] moveConstants total ms: 148.097 max ms: 5.361 [B3] lowerToAir total ms: 1619.115 max ms: 96.307 [Total B3] generateToAir total ms: 11.959 max ms: 1.185 [Air] simplifyCFG total ms: 6.519 max ms: 0.697 [Air] Air::lowerMacros Concretely there are two changes: - use FixedWidthDouble (also introduced to WTF in this patch) to line-up the total times. This makes it possible to see at a glance which phases are worth optimizing and which aren't. - Tag phases more precisely, and in particular replace [B3] by [Air] where relevant, and give different tags to measurements that correspond to groups of phases instead of a single phase (e.g. generateToAir). * JavaScriptCore.xcodeproj/project.pbxproj: * b3/B3Compile.cpp: (JSC::B3::compile): * b3/B3FixSSA.cpp: * b3/B3Generate.cpp: (JSC::B3::prepareForGeneration): (JSC::B3::generateToAir): * b3/B3PhaseScope.cpp: (JSC::B3::PhaseScope::PhaseScope): * b3/B3PhaseScope.h: * b3/B3TimingScope.h: Removed. (JSC::B3::TimingScope::TimingScope): Deleted. * b3/B3VariableLiveness.cpp: (JSC::B3::VariableLiveness::VariableLiveness): * b3/air/AirAllocateRegistersAndStackAndGenerateCode.cpp: (JSC::B3::Air::GenerateAndAllocateRegisters::generate): * b3/air/AirAllocateRegistersAndStackByLinearScan.cpp: * b3/air/AirGenerate.cpp: (JSC::B3::Air::prepareForGeneration): (JSC::B3::Air::generateWithAlreadyAllocatedRegisters): * b3/air/AirLiveness.h: (JSC::B3::Air::Liveness::Liveness): * b3/air/AirPhaseScope.cpp: (JSC::B3::Air::PhaseScope::PhaseScope): * b3/air/AirPhaseScope.h: * tools/CompilerTimingScope.cpp: 2022-02-21 Yusuke Suzuki [JSC] Fix ShadowRealm unwinding https://bugs.webkit.org/show_bug.cgi?id=237001 Reviewed by Saam Barati. This patch fixes a crash bug found by test262. Regardless of it is RemoteFunction, we should handle it as the same way to the other normal host functions except for setting m_seenRemoteFunction = true flag. Previously, we are early returning, this is wrong since we should stop unwinding if the caller is entry frame. * interpreter/Interpreter.cpp: (JSC::UnwindFunctor::operator() const): 2022-02-21 Yusuke Suzuki [JSC] Temporal.PlainDate should validate input range https://bugs.webkit.org/show_bug.cgi?id=236936 Reviewed by Darin Adler. Implement https://tc39.es/proposal-temporal/#sec-temporal-isodatetimewithinlimits check in PlainDate to validate input range. For example, 0x7fffffff year should be rejected since it is larger than ECMAScript datetime representation value. This is checked via ISODateTimeWithinLimits in the spec. We also remove isValid assertions in ExactTime. This should not be checked in these accessors, rather, we should call that function when we would like to check, since PlainDate can represent a bit smaller value than ExactTime's minValue (minValue - nsPerDay). We also extend ExactTime::fromISOPartsAndOffset to handle values via Int128 to accept int32_t range years. By using Int128 for nanoseconds, we can even represent int32_t max / min years. And we remove `ASSERT(y >= -999999 && y <= 999999)` check since this is not necessary. * runtime/ISO8601.cpp: (JSC::ISO8601::ExactTime::fromISOPartsAndOffset): (JSC::ISO8601::isDateTimeWithinLimits): * runtime/ISO8601.h: (JSC::ISO8601::ExactTime::ExactTime): Deleted. (JSC::ISO8601::ExactTime::fromEpochSeconds): Deleted. (JSC::ISO8601::ExactTime::fromEpochMilliseconds): Deleted. (JSC::ISO8601::ExactTime::fromEpochMicroseconds): Deleted. (JSC::ISO8601::ExactTime::epochSeconds const): Deleted. (JSC::ISO8601::ExactTime::epochMilliseconds const): Deleted. (JSC::ISO8601::ExactTime::epochMicroseconds const): Deleted. (JSC::ISO8601::ExactTime::epochNanoseconds const): Deleted. (JSC::ISO8601::ExactTime::nanosecondsFraction const): Deleted. (JSC::ISO8601::ExactTime::asString const): Deleted. (JSC::ISO8601::ExactTime::isValid const): Deleted. (JSC::ISO8601::ExactTime::operator< const): Deleted. (JSC::ISO8601::ExactTime::operator<= const): Deleted. (JSC::ISO8601::ExactTime::operator== const): Deleted. (JSC::ISO8601::ExactTime::operator!= const): Deleted. (JSC::ISO8601::ExactTime::operator>= const): Deleted. (JSC::ISO8601::ExactTime::operator> const): Deleted. * runtime/TemporalPlainDate.cpp: (JSC::toPlainDate): == Rolled over to ChangeLog-2022-02-22 ==