Repository navigation
Upgrade to upstream WebKit 7b485a76e9 - #725
Conversation
https://bugs.webkit.org/show_bug.cgi?id=324695 rdar://187965961 Reviewed by Dan Hecht. State::clobber(Reg) is very frequently called as it is called once per def of regs in Air::Inst. 1. For regConst case, one reg can only have one const. So instead of having Vector of Reg and Const pair, we have std::array for const value with Reg-index. And we have ScalarRegisterSet for set constReg. 2. To quickly know whether we have RegSlot for a particular Reg, we maintain ScalarRegisterSet regSlotRegs bitset. * Source/JavaScriptCore/b3/air/AirFixObviousSpills.cpp: Canonical link: https://commits.webkit.org/321519@main
https://bugs.webkit.org/show_bug.cgi?id=324701 rdar://187977974 Reviewed by Mike Wyrzykowski. The standard webgpu.h uses wgpu*AddRef instead of wgpu*Reference. Use same symbols in WebGPU.h. Since WebGPU.h header exists and mimics webgpu.h, it is logical to match webgpu.h. This makes it simpler to integrate ANGLE WebGPU backend, which already uses webgpu.h signatures. * Source/WebCore/Modules/WebGPU/Implementation/WebGPUPtr.h: * Source/WebGPU/WebGPU/Adapter.mm: (wgpuAdapterAddRef): (wgpuAdapterReference): Deleted. * Source/WebGPU/WebGPU/BindGroup.mm: * Source/WebGPU/WebGPU/BindGroupLayout.mm: (wgpuBindGroupLayoutAddRef): (wgpuBindGroupLayoutReference): Deleted. * Source/WebGPU/WebGPU/Buffer.mm: (wgpuBufferAddRef): (wgpuBufferReference): Deleted. * Source/WebGPU/WebGPU/CommandBuffer.mm: (wgpuCommandBufferAddRef): (wgpuCommandBufferReference): Deleted. * Source/WebGPU/WebGPU/CommandEncoder.mm: (wgpuCommandEncoderAddRef): (wgpuCommandEncoderReference): Deleted. * Source/WebGPU/WebGPU/ComputePassEncoder.mm: (wgpuComputePassEncoderAddRef): (wgpuComputePassEncoderReference): Deleted. * Source/WebGPU/WebGPU/ComputePipeline.mm: (wgpuComputePipelineAddRef): (wgpuComputePipelineReference): Deleted. * Source/WebGPU/WebGPU/Device.mm: * Source/WebGPU/WebGPU/ExternalTexture.mm: (wgpuExternalTextureAddRef): (wgpuExternalTextureReference): Deleted. * Source/WebGPU/WebGPU/Instance.mm: (wgpuInstanceAddRef): (wgpuInstanceReference): Deleted. * Source/WebGPU/WebGPU/PipelineLayout.mm: (wgpuPipelineLayoutAddRef): (wgpuPipelineLayoutReference): Deleted. * Source/WebGPU/WebGPU/PresentationContext.mm: (wgpuSurfaceAddRef): (wgpuSwapChainAddRef): (wgpuSurfaceReference): Deleted. (wgpuSwapChainReference): Deleted. * Source/WebGPU/WebGPU/QuerySet.mm: (wgpuQuerySetAddRef): (wgpuQuerySetReference): Deleted. * Source/WebGPU/WebGPU/Queue.mm: * Source/WebGPU/WebGPU/RenderBundle.mm: (wgpuRenderBundleAddRef): (wgpuRenderBundleReference): Deleted. * Source/WebGPU/WebGPU/RenderBundleEncoder.mm: (wgpuRenderBundleEncoderAddRef): (wgpuRenderBundleEncoderReference): Deleted. * Source/WebGPU/WebGPU/RenderPassEncoder.mm: (wgpuRenderPassEncoderAddRef): (wgpuRenderPassEncoderReference): Deleted. * Source/WebGPU/WebGPU/RenderPipeline.mm: (wgpuRenderPipelineAddRef): (wgpuRenderPipelineReference): Deleted. * Source/WebGPU/WebGPU/Sampler.mm: (wgpuSamplerAddRef): (wgpuSamplerReference): Deleted. * Source/WebGPU/WebGPU/ShaderModule.mm: (wgpuShaderModuleAddRef): (wgpuShaderModuleReference): Deleted. * Source/WebGPU/WebGPU/Texture.mm: (wgpuTextureAddRef): (wgpuTextureReference): Deleted. * Source/WebGPU/WebGPU/TextureView.mm: (wgpuTextureViewAddRef): (wgpuTextureViewReference): Deleted. * Source/WebGPU/WebGPU/WGPUBufferImpl.h: * Source/WebGPU/WebGPU/WGPUQuerySetImpl.h: * Source/WebGPU/WebGPU/WGPUTextureImpl.h: * Source/WebGPU/WebGPU/WGPUTextureViewImpl.h: * Source/WebGPU/WebGPU/WebGPU.h: * Source/WebGPU/WebGPU/WebGPUExt.h: * Source/WebGPU/WebGPU/XRBinding.mm: (wgpuXRBindingAddRef): (wgpuXRBindingReference): Deleted. * Source/WebGPU/WebGPU/XRProjectionLayer.mm: (wgpuXRProjectionLayerAddRef): (wgpuXRProjectionLayerReference): Deleted. * Source/WebGPU/WebGPU/XRSubImage.mm: (wgpuXRSubImageAddRef): (wgpuXRSubImageReference): Deleted. * Source/WebGPU/WebGPU/XRView.mm: (wgpuXRViewAddRef): (wgpuXRViewReference): Deleted. Canonical link: https://commits.webkit.org/321520@main
…sing an image https://bugs.webkit.org/show_bug.cgi?id=324568 rdar://183648577 Reviewed by Pascoe and Abrar Rahman Protyasha. Set the `exportableData` property for context menu preview target elements (e.g. an image that the user is long-pressing), such that the system can extract data from the corresponding drag interaction via item providers. * Source/WebKit/Configurations/AllowedSPI-legacy.toml: * Source/WebKit/UIProcess/Cocoa/TextExtraction/WKWebView+TextExtraction.swift: (ContextMenuSource.createIntelligenceElement(_:contextMenuSource:)): (createIntelligenceElement(_:contextMenuTargetNodeIdentifier:)): Deleted. Canonical link: https://commits.webkit.org/321521@main
https://bugs.webkit.org/show_bug.cgi?id=324332 rdar://problem/187565323 We implement directly in WebCore a H265 encoder using VideoToolbox. It is implemented as WebRTCVideoEncoderVTBH265 with VideoEncoderVTB/WebRTCVideoEncoderVTB as base classes. WebRTCVideoEncoderVTBH265 is instantiated when WebRTCWebCoreVideoEncodersEnabled is set. H264 still goes through libwebrtc. We add support for QP-extraction bitstream parsing and H265 Annex B conversion by introducing routines into HEVCUtilitiesCocoa/HEVCUtilities. These are replacements to libwebrtc's H265CMSampleBufferToAnnexBBuffer and H265BitstreamParser, implemented with safe C++ guidelines. Covered by existing tests and API tests. Reviewed by Jean-Yves Avenard. * Source/WebCore/PAL/pal/cf/CoreMediaSoftLink.cpp: * Source/WebCore/PAL/pal/cf/CoreMediaSoftLink.h: * Source/WebCore/PAL/pal/cf/VideoToolboxSoftLink.cpp: * Source/WebCore/PAL/pal/cf/VideoToolboxSoftLink.h: * Source/WebCore/SourcesCocoa.txt: * Source/WebCore/WebCore.xcodeproj/project.pbxproj: * Source/WebCore/platform/graphics/HEVCUtilities.cpp: (WebCore::findHEVCNaluIndices): (WebCore::hevcNaluType): (WebCore::parseRbsp): (WebCore::HEVCBitstreamParser::parseProfileTierLevel): (WebCore::HEVCBitstreamParser::parseScalingListData): (WebCore::HEVCBitstreamParser::parseShortTermRefPicSet): (WebCore::HEVCBitstreamParser::parseSps): (WebCore::HEVCBitstreamParser::parsePps): (WebCore::HEVCBitstreamParser::parseNonParameterSetNalu): (WebCore::HEVCBitstreamParser::parseSlice): (WebCore::HEVCBitstreamParser::pps const): (WebCore::HEVCBitstreamParser::sps const): (WebCore::HEVCBitstreamParser::parseBitstream): (WebCore::HEVCBitstreamParser::lastSliceQP const): * Source/WebCore/platform/graphics/HEVCUtilities.h: * Source/WebCore/platform/graphics/cocoa/HEVCUtilitiesCocoa.h: * Source/WebCore/platform/graphics/cocoa/HEVCUtilitiesCocoa.mm: (WebCore::convertHEVCCMSampleBufferToAnnexB): * Source/WebCore/platform/video-codecs/BitReader.cpp: (WebCore::BitReader::readBits): (WebCore::BitReader::readFlag): (WebCore::BitReader::consumeBits): (WebCore::BitReader::readExpGolomb): (WebCore::BitReader::readSignedExpGolomb): * Source/WebCore/platform/video-codecs/BitReader.h: (WebCore::BitReader::ok const): * Tools/TestWebKitAPI/CMakeLists.txt: * Tools/TestWebKitAPI/PlatformCocoa.cmake: * Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: * Tools/TestWebKitAPI/Tests/WebCore/HEVCUtilitiesTests.cpp: Added. (TestWebKitAPI::TEST(HEVCBitstreamParser, ReportsNoQpBeforeAnyParsing)): (TestWebKitAPI::TEST(HEVCBitstreamParser, ReportsNoQpAfterParsingOnlyParameterSets)): (TestWebKitAPI::TEST(HEVCBitstreamParser, ReportsQpForImageSlices)): (TestWebKitAPI::TEST(HEVCBitstreamParser, ReportsQpFromShortTermReferencePicSetSlice)): (TestWebKitAPI::TEST(HEVCBitstreamParser, ReportsQpWithPredWeightTable)): (TestWebKitAPI::TEST(HEVCBitstreamParser, RejectsOutOfRangeQp)): * Tools/TestWebKitAPI/Tests/WebCore/cocoa/HEVCUtilitiesCocoaTests.mm: Added. (TestWebKitAPI::appendByte): (TestWebKitAPI::appendBytes): (TestWebKitAPI::makeHVCCData): (TestWebKitAPI::createHEVCFormatDescription): (TestWebKitAPI::createHEVCSampleBuffer): (TestWebKitAPI::annexBStartCode): (TestWebKitAPI::TEST(HEVCUtilitiesCocoa, KeyframePrependsParameterSets)): (TestWebKitAPI::TEST(HEVCUtilitiesCocoa, NonKeyframeOmitsParameterSets)): (TestWebKitAPI::TEST(HEVCUtilitiesCocoa, MultipleNALUsOfDifferentSizesAreAllExtracted)): (TestWebKitAPI::TEST(HEVCUtilitiesCocoa, TruncatedNALULengthReturnsEmpty)): * Source/WebCore/platform/video-codecs/cocoa/GPUVideoEncoder.h: * Source/WebCore/platform/video-codecs/cocoa/GPUVideoEncoder.mm: (WebCore::GPUVideoEncoder::create): * Source/WebCore/platform/video-codecs/cocoa/GPUVideoEncoderVTB.h: Added. (WebCore::GPUVideoEncoderVTB::width const): (WebCore::GPUVideoEncoderVTB::height const): (WebCore::GPUVideoEncoderVTB::useAnnexB const): (WebCore::GPUVideoEncoderVTB::needsToSendDescription const): (WebCore::GPUVideoEncoderVTB::setNeedsToSendDescription): (WebCore::GPUVideoEncoderVTB::creationThreadID const): * Source/WebCore/platform/video-codecs/cocoa/GPUVideoEncoderVTB.mm: Added. (WebCore::GPUVideoEncoderBitrateAdjuster::setTargetBitrateBps): (WebCore::GPUVideoEncoderBitrateAdjuster::adjustedBitrateBps const): (WebCore::GPUVideoEncoderBitrateAdjuster::update): (WebCore::GPUVideoEncoderBitrateAdjuster::isWithinTolerance): (WebCore::GPUVideoEncoderBitrateAdjuster::WTF_REQUIRES_LOCK): (WebCore::GPUVideoEncoderBitrateAdjuster::WTF_GUARDED_BY_LOCK): (WebCore::GPUVideoEncoderVTB::GPUVideoEncoderVTB): (WebCore::GPUVideoEncoderVTB::notifyEncodedFrame): (WebCore::GPUVideoEncoderVTB::notifyDescription): (WebCore::GPUVideoEncoderVTB::notifyError): (WebCore::GPUVideoEncoderVTB::notifyFrameDropped): (WebCore::GPUVideoEncoderVTB::setLowLatency): (WebCore::GPUVideoEncoderVTB::initialize): (WebCore::GPUVideoEncoderVTB::resetCompressionSession): (WebCore::GPUVideoEncoderVTB::configureCompressionSession): (WebCore::GPUVideoEncoderVTB::setEncoderBitrateBps): (WebCore::GPUVideoEncoderVTB::setRates): (WebCore::GPUVideoEncoderVTB::encodeFrame): (WebCore::GPUVideoEncoderVTB::flush): * Source/WebCore/platform/video-codecs/cocoa/GPUVideoEncoderVTBH265.h: Copied from Source/WebCore/platform/graphics/cocoa/HEVCUtilitiesCocoa.h. * Source/WebCore/platform/video-codecs/cocoa/GPUVideoEncoderVTBH265.mm: Added. (WebCore::GPUVideoEncoderVTBH265::GPUVideoEncoderVTBH265): (WebCore::GPUVideoEncoderVTBH265::codecType const): (WebCore::GPUVideoEncoderVTBH265::convertAndNotify): * Source/WebCore/platform/video-codecs/cocoa/VideoEncoderVTBSession.h: Added. (WebCore::VideoEncoderVTBSession::VideoEncoderVTBSession): * Source/WebCore/platform/video-codecs/cocoa/VideoEncoderVTBSession.mm: Added. (WebCore::VideoEncoderVTBSession::create): (WebCore::VideoEncoderVTBSession::~VideoEncoderVTBSession): (WebCore::VideoEncoderVTBSession::isHardwareAccelerated const): (WebCore::VideoEncoderVTBSession::setProperty): (WebCore::VideoEncoderVTBSession::prepareToEncodeFrames): (WebCore::VideoEncoderVTBSession::completeFrames): (WebCore::VideoEncoderVTBSession::encodeFrame): * Source/WebKit/GPUProcess/webrtc/LibWebRTCCodecsProxy.h: * Source/WebKit/GPUProcess/webrtc/LibWebRTCCodecsProxy.mm: (WebKit::LibWebRTCCodecsProxy::createEncoder): Canonical link: https://commits.webkit.org/321522@main
…nput often does not slide https://bugs.webkit.org/show_bug.cgi?id=324408 rdar://186965160 Reviewed by Tim Horton. Restyling a range input's track can produce a hit area that is only as tall as the track itself, which can be just a couple of points. A mouse drag starting on the track, away from the thumb, therefore lands on whatever wraps the control. Position information reports the wrapper, so the WKAppKitGestureController has content to yield to, and mouse tracking does not end up getting recognized. To fix this, we now supply input source to InteractionInformationRequest such that we can perform adjustments appropriate for Automation-sourced requests. Test: AppKitGesturesTests.Basic/mouseDragOverThinRangeInputChangesValue Canonical link: https://commits.webkit.org/321523@main
rdar://187666049 https://bugs.webkit.org/show_bug.cgi?id=324433 Reviewed by Sam Weinig. Currently, Style::CurrentColor is resolved to the current color by supplying the current color to Style::resolveColor(), then it gets plumbed to Style::resolveColor(const CurrentColor&), which simply returns it. To implement AccentColor following the current accent color, we'd have to plumb the current accent color the same way as the current color. The obvious solution is to add another parameter, but we don't want to do that every time a new "current X" color is introduced. This patch introduces Style::ResolvedColors, which acts as a storage of colors needed to resolve "current X" colors like currentColor and AccentColor. A Style::ResolvedColors is created by pulling out the needed colors from a ComputedStyle. Then ResolvedColors is given to Style::resolveColor() to help resolve "current X" colors. For now it only stores the current `color` property, but future patches will add accent color to it, so it can resolve current accent color. No new behaviors, tested by existing test suite. * Source/WebCore/Headers.cmake: * Source/WebCore/Sources.txt: * Source/WebCore/WebCore.xcodeproj/project.pbxproj: * Source/WebCore/style/StyleBuilderCustom.h: (WebCore::Style::BuilderCustom::applyInitialColor): (WebCore::Style::BuilderCustom::applyValueColor): (WebCore::Style::BuilderCustom::applyHighlightInheritColor): * Source/WebCore/style/StyleColorResolver.cpp: (WebCore::Style::ColorResolver::colorResolvingCurrentColor const): (WebCore::Style::ColorResolver::visitedLinkColorResolvingCurrentColor const): * Source/WebCore/style/StyleColorResolver.h: (WebCore::Style::ColorPropertyResolver<ColorTraits>::colorResolvingCurrentColor const): (WebCore::Style::requires): * Source/WebCore/style/computed/StyleComputedStyleProperties+GettersCustomInlines.h: (WebCore::Style::ColorPropertyTraits<PropertyNameConstant<CSSPropertyTextDecorationColor>>::colorResolvingCurrentColor): (WebCore::Style::ColorPropertyTraits<PropertyNameConstant<CSSPropertyTextDecorationColor>>::visitedLinkColorResolvingCurrentColor): * Source/WebCore/style/values/color/StyleColor.cpp: (WebCore::Style::Color::resolveColor const): (WebCore::Style::resolveColor): * Source/WebCore/style/values/color/StyleColor.h: * Source/WebCore/style/values/color/StyleColorLayers.cpp: (WebCore::Style::resolveColor): * Source/WebCore/style/values/color/StyleColorLayers.h: * Source/WebCore/style/values/color/StyleColorMix.cpp: (WebCore::Style::resolveColor): * Source/WebCore/style/values/color/StyleColorMix.h: * Source/WebCore/style/values/color/StyleContrastColor.cpp: (WebCore::Style::resolveColor): * Source/WebCore/style/values/color/StyleContrastColor.h: * Source/WebCore/style/values/color/StyleCurrentAccentColor.h: (WebCore::Style::resolveColor): * Source/WebCore/style/values/color/StyleCurrentColor.h: (WebCore::Style::resolveColor): * Source/WebCore/style/values/color/StyleRelativeAlphaColor.cpp: (WebCore::Style::resolveColor): * Source/WebCore/style/values/color/StyleRelativeAlphaColor.h: * Source/WebCore/style/values/color/StyleRelativeColor.h: (WebCore::Style::resolveColor): * Source/WebCore/style/values/color/StyleResolvedColor.h: (WebCore::Style::resolveColor): * Source/WebCore/style/values/color/StyleResolvedColors.cpp: Copied from Source/WebCore/style/values/color/StyleCurrentColor.h. (WebCore::Style::ResolvedColors::ResolvedColors): (WebCore::Style::ResolvedColors::fromStyle): (WebCore::Style::ResolvedColors::fromVisitedLinkStyle): * Source/WebCore/style/values/color/StyleResolvedColors.h: Copied from Source/WebCore/style/values/color/StyleCurrentColor.h. (WebCore::Style::ResolvedColors::currentColor const): * Source/WebCore/style/values/filter-effects/StyleDropShadowFunction.cpp: (WebCore::Style::Ref<FilterEffect>>::operator): (WebCore::Style::ToPlatform<DropShadow>::operator): * Source/WebCore/style/values/color/StyleCurrentColor.cpp: (WebCore::Style::resolveColor): Canonical link: https://commits.webkit.org/321525@main
https://bugs.webkit.org/show_bug.cgi?id=324383 rdar://187616355 Reviewed by Simon Fraser. CSSOM View defines [1] a `container` member on ScrollIntoViewOptions that controls how far a scroll propagates: "all" (the default) walks every ancestor scroll container up to the viewport, while "nearest" stops at the nearest scroll container of the target. Add the ScrollIntoViewContainer enum and thread it from the options dictionary down through scrollRectToVisible. When "nearest" is requested we stop after scrolling the first scroll container and do not propagate the scroll to ancestor scrollers or out to an embedding frame. [1] https://drafts.csswg.org/cssom-view/#dictdef-scrollintoviewoptions * Source/WebCore/CMakeLists.txt: * Source/WebCore/DerivedSources-input.xcfilelist: * Source/WebCore/DerivedSources-output.xcfilelist: * Source/WebCore/DerivedSources.make: * Source/WebCore/Headers.cmake: * Source/WebCore/Sources.txt: * Source/WebCore/WebCore.xcodeproj/project.pbxproj: Register the new ScrollIntoViewContainer IDL enum and generated bindings. * Source/WebCore/page/ScrollIntoViewContainer.h: Added. * Source/WebCore/page/ScrollIntoViewContainer.idl: Added. New enum with "all" and "nearest" values. * Source/WebCore/page/ScrollIntoViewOptions.h: * Source/WebCore/page/ScrollIntoViewOptions.idl: Add the `container` member, defaulting to "all". * Source/WebCore/rendering/RenderLayer.h: Carry the container option on ScrollRectToVisibleOptions. * Source/WebCore/dom/Element.cpp: (WebCore::Element::scrollIntoView): Pass options.container through. * LayoutTests/imported/w3c/web-platform-tests/css/cssom-view/scrollIntoView-container-expected.txt: Progression * Source/WebCore/page/LocalFrameView.cpp: (WebCore::LocalFrameView::scrollRectToVisible): For "nearest", stop after the nearest scroll container instead of propagating to ancestors. (WebCore::LocalFrameView::scrollRectToVisibleInChildView): For "nearest", don't propagate the scroll out to the embedding frame. Canonical link: https://commits.webkit.org/321526@main
…nderer and call layer() twice https://bugs.webkit.org/show_bug.cgi?id=324666 rdar://187925755 Reviewed by Ryosuke Niwa. Inside `if (CheckedPtr renderer = renderBox())`, both setScrollLeft() and setScrollTop() computed the scrollable area with: if (auto* scrollableArea = renderer && renderer->layer() ? renderer->layer()->scrollableArea() : nullptr) The `renderer &&` guard is dead — renderer is the branch condition and cannot be null here — and layer() is evaluated twice. Replace with a single CheckedPtr guard over layer(). No behavior change. * Source/WebCore/dom/Element.cpp: (WebCore::Element::setScrollLeft): (WebCore::Element::setScrollTop): Canonical link: https://commits.webkit.org/321527@main
https://bugs.webkit.org/show_bug.cgi?id=324704 Reviewed by Sam Weinig. The check compared type names, which are "UNION" for every union, so two different unions under one name compared equal. %typedefs is never reset and generate-bindings-all.pl parses files in batches, so whichever was parsed last won, depending on how the files were distributed across jobs. That found three conflicts, none of which change behavior. VideoFrame's CanvasImageSource leaves out VideoFrame, which has a constructor overload of its own, so it gets a name of its own. WebGL's Float32List, Int32List, and Uint32List are [AllowShared] in the rendering contexts but not in the multi-draw extensions, so the former become AllowSharedFloat32List and so on. CanvasImageSource was declared six times in two member orders, each pinned to a Variant; they now use the HTML standard's order. Canonical link: https://commits.webkit.org/321528@main
https://bugs.webkit.org/show_bug.cgi?id=324565 Reviewed by Devin Rousso. Resizing the Web Inspector window while a table has more rows than currently fit can leave a blank gap at the bottom of the table. Both `WI.Table` and `WI.DataGrid` only render the rows currently on screen, and skip recomputing them unless something relevant changed. The early return condition never checks if the container height has changed since the last computation, so a resize could leave old rows and spacer heights behind. Force a recompute of the visible row window when the container height changes. * Source/WebInspectorUI/UserInterface/Views/DataGrid.js: (WI.DataGrid.prototype.updateVisibleRows): (WI.DataGrid.prototype._calculateOffsetHeight): (WI.DataGrid.prototype._calculateScrollTop): * Source/WebInspectorUI/UserInterface/Views/Table.js: (WI.Table.prototype._updateVisibleRows): Canonical link: https://commits.webkit.org/321529@main
https://bugs.webkit.org/show_bug.cgi?id=324636 rdar://187886280 Reviewed by Ryosuke Niwa and Per Arne Vollan. _allowSharedProcess was named as if the client could veto placing a site in the shared process, but the process decision is made per (browsing context group, site) and is never revisited. Only the first navigation to a site in a group consults the policy, so setting _allowSharedProcess = NO on a later navigation to a site that already joined the shared process has no effect. The scope of the API (per navigation) is finer than the scope of the decision (per browsing context group), which makes any API of this shape order dependent. In practice it expresses a preference, not a guarantee. Rename it to _prefersIsolatedProcess so the name matches what it does. The polarity is inverted along with the name. This does not change the per browsing context group stickiness described above; it only stops the name from promising something the API cannot deliver. * Source/WebKit/Shared/WebsitePoliciesData.h: * Source/WebKit/Shared/WebsitePoliciesData.serialization.in: * Source/WebKit/UIProcess/API/APIWebsitePolicies.h: * Source/WebKit/UIProcess/API/Cocoa/WKWebpagePreferences.mm: (-[WKWebpagePreferences _prefersIsolatedProcess]): (-[WKWebpagePreferences _setPrefersIsolatedProcess:]): (-[WKWebpagePreferences _allowSharedProcess]): Deleted. (-[WKWebpagePreferences _setAllowSharedProcess:]): Deleted. * Source/WebKit/UIProcess/API/Cocoa/WKWebpagePreferencesPrivate.h: * Source/WebKit/UIProcess/BrowsingContextGroup.cpp: (WebKit::BrowsingContextGroup::sharedProcessForSite): * Tools/TestWebKitAPI/Tests/WebKit/WKWebView/SiteIsolation.mm: (TestWebKitAPI::TEST(SiteIsolation, UnresponsiveProcessMousedown)): (TestWebKitAPI::(SiteIsolation, SharedProcessWithWebsitePolicies)): Canonical link: https://commits.webkit.org/321530@main
… (agent is sometimes confused by password change form) https://bugs.webkit.org/show_bug.cgi?id=324709 rdar://187895616 Reviewed by Abrar Rahman Protyasha. Make a targeted adjustment to help the password change agent reason about MEGA's change password form, whose 'Change Password' form submission button only shows up after a new strong password is AutoFilled: 1. If search `text` is specified in the click interaction that targets a button with no rendered text, allow the interaction to happen as long as the `text` is contained within the non-rendered contents of the target and the target is "not very large" (i.e. roughly button/link-sized), or if the target itself is already a form control or link, simply waive the text match altogether. 2. Bump up the character limit for 'fallback human readable class names' slightly, to capture the `change-password-button` class. Test: Tools/TestWebKitAPI/Tests/WebKit/WKWebView/TextExtractionTests.swift * Source/WebCore/page/text-extraction/TextExtraction.cpp: (WebCore::TextExtraction::searchTextMatchesUnrenderedElementText): (WebCore::TextExtraction::textDescription): * Tools/TestWebKitAPI/Tests/WebKit/WKWebView/TextExtractionTests.swift: (TextExtractionTests.interactionDescriptionUsesUnrenderedTextForCollapsedTarget): Canonical link: https://commits.webkit.org/321531@main
https://bugs.webkit.org/show_bug.cgi?id=324473 rdar://187712192 Reviewed by Andy Estes. The element fullscreen window layer keeps whatever lightspill flag we gave it on entry. Only _enterFullScreen: and toggleSceneDimming ever write that flag and neither one runs on the way back from video fullscreen, so turning dimming off in video fullscreen had no effect once you returned. Re-apply it in didExitVideoFullscreen. * Source/WebKit/UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm: (-[WKFullScreenWindowController didExitVideoFullscreen]): Canonical link: https://commits.webkit.org/321532@main
…) of clipped descendant https://bugs.webkit.org/show_bug.cgi?id=324202 rdar://187417053 Reviewed by Simon Fraser. scrollIntoView() of a descendant of a content-visibility:auto element forces the element's viewport proximity to Near (out-of-band, not via the intersection observer) so the skipped content can be scrolled to. When the descendant is clipped and cannot actually be revealed, the element ends up outside the viewport after scrolling and should return to hidden. That never happened: the internal IntersectionObserver's previousThresholdIndex still reflected the pre-scroll non-intersecting state (0), so when it recomputed the still-non-intersecting element it saw no change, never ran its callback, and never reset the proximity to Far. The element stayed relevant forever and the "hidden again" contentvisibilityautostatechange event never fired, hanging the test. Clear the observer's cached threshold index for the target when forcing Near, so the next intersection computation is treated as a first observation and re-syncs the proximity with reality. * LayoutTests/TestExpectations: Progression * LayoutTests/imported/w3c/web-platform-tests/css/css-contain/content-visibility/content-visibility-vs-scrollIntoView-003-expected.txt: Ditto * Source/WebCore/dom/ContentVisibilityDocumentState.cpp: (WebCore::ContentVisibilityDocumentState::updateContentRelevancyForScrollIfNeeded): * Source/WebCore/page/IntersectionObserver.cpp: (WebCore::IntersectionObserver::resetPreviousThresholdIndexForTarget): * Source/WebCore/page/IntersectionObserver.h: Canonical link: https://commits.webkit.org/321533@main
https://bugs.webkit.org/show_bug.cgi?id=324728 rdar://188009726 Reviewed by Jonathan Bedard. Bring up of post-commit macOS 27 Golden Gate build and test queues. * Tools/CISupport/build-webkit-org/config.json: * Tools/CISupport/build-webkit-org/factories_unittest.py: (TestExpectedBuildSteps): * Tools/CISupport/build-webkit-org/public_html/dashboard/Scripts/Dashboard.js: * Tools/CISupport/build-webkit-org/public_html/dashboard/Scripts/WebKitBuildbot.js: (WebKitBuildbot): * Tools/CISupport/build-webkit-org/public_html/dashboard/Styles/Main.css: (table.queue-grid tr.platform.macos-golden-gate img.logo): * Tools/CISupport/build-webkit-org/wkbuild.py: (_should_file_trigger_build): Canonical link: https://commits.webkit.org/321534@main
https://bugs.webkit.org/show_bug.cgi?id=324716 rdar://188002873 Reviewed by Dan Hecht. hasNonArgEffects is costly operation. So calling it only when necessary. * Source/JavaScriptCore/b3/air/AirAllocateStackByGraphColoring.cpp: Canonical link: https://commits.webkit.org/321535@main
…is already simplified https://bugs.webkit.org/show_bug.cgi?id=324694 rdar://187966162 Reviewed by Yusuke Suzuki. simplifyMatchedCharactersToSpace() unconditionally allocated a StringBuffer of the full length and copied every character, only to return *this and discard the buffer when the string turned out to need no simplification -- the common case for prose and attribute values. Add a cheap pre-scan that returns *this without allocating unless the string actually needs work: a leading or trailing matched character, a run of two or more matched characters, or a matched character that is not already a space. The scan uses the same runtime predicate, so every caller benefits regardless of which whitespace definition it passes. Measured ~2x on already-simplified strings and neutral on strings that do need collapsing. The pre-scan verdict was verified against the rewrite exhaustively for all strings of length <= 7 over {a, b, space, newline, tab} and 500000 random strings, with no divergence. Test: Tools/TestWebKitAPI/Tests/WTF/WTFString.cpp * Source/WTF/wtf/text/StringImpl.cpp: (WTF::StringImpl::simplifyMatchedCharactersToSpace): * Tools/TestWebKitAPI/Tests/WTF/WTFString.cpp: (TestWebKitAPI::TEST(WTF, StringSimplifyWhiteSpace)): Canonical link: https://commits.webkit.org/321536@main
https://bugs.webkit.org/show_bug.cgi?id=324587 rdar://187822390 Unreviewed follow-up. * Tools/CISupport/ews-build/steps_unittest.py: Canonical link: https://commits.webkit.org/321537@main
…ests/css/css-cascade/all-prop-initial-xml.html port-specific files https://bugs.webkit.org/show_bug.cgi?id=324739 Unreviewed test gardening. Add missing new message to glib baseline. * LayoutTests/platform/glib/imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt: Canonical link: https://commits.webkit.org/321538@main
https://bugs.webkit.org/show_bug.cgi?id=319842 rdar://182130524 Reviewed by Marcus Plutowski. When lowering B3 to Air, CAS operations with a single Branch consumer can be fused into the Branch or be moved to the Branch site. This motion needs to check for interference. Consider the following wasm snippet: L1: i32.atomic.rmw.cmpxchg L2: memory.grow <some stuff> L3: if The cmpxchg in L1 can be moved past the memory.grow in L2 into L3, which is incorrect as the Air CAS opcode for L1 may have a stale memory input that interferes with the grow in L2. This PR adds interference checks for all CAS motions in B3 to Air lowering. Test: JSTests/wasm/stress/atomic-cmpxchg-motion-interference.js Originally-landed-as: 316606.100@safari-7625-branch (1217ca8). rdar://187506940 Canonical link: https://commits.webkit.org/321539@main
https://bugs.webkit.org/show_bug.cgi?id=321705 rdar://184821678 Reviewed by Keith Miller and Mark Lam. The DFG optimization for spreading a Set depends on the Set iterator protocol being intact. This is guarded by a watchpoint. This watchpoint is armed on the global of the set itself, which is node->child1(). Subsequent optimization passes incorrectly depends on the Set structure of node, which corresponds to the spread operation itself and may be in a different realm than the set. This PR fixes this by using child1() everywhere to determine the global. Test: JSTests/stress/spread-set-cross-realm-symbol-iterator-side-effects.js * JSTests/stress/spread-set-cross-realm-symbol-iterator-side-effects.js: Added. (shouldBe): * Source/JavaScriptCore/dfg/DFGAbstractInterpreterInlines.h: (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects): * Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp: * Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::compileSpread): Originally-landed-as: 316606.361@safari-7625-branch (62860f0). rdar://187507225 Canonical link: https://commits.webkit.org/321540@main
https://bugs.webkit.org/show_bug.cgi?id=324564 rdar://187793434 Reviewed by Yusuke Suzuki. Currently JS parser tracks three pieces of information for each source location (such as the start or the end of a token): source offset, line number, and column number. This is redundant, as a source offset alone uniquely identifies a location. Lines and columns are only needed for human-readable messages. It makes sense to stop tracking and storing them, and reconstruct them lazily from the offset if and when they are needed. This avoids the tracking cost on the fast path and eliminates the complexity of converting lines and columns between multiple frames of reference (html document, script element, function being reparsed). This patch implements that change. It is stage 1 of the entire work, focused on functional changes. After landing, it will be followed by stage 2 with additional refactorings. The work is split this way to make each patch more focused and easier to review, because both patches have a small set of core changes that trigger many cascading changes at dependent use sites. Stage 1 captures all performance gains. Key changes in this patch: 1. Many data structures lose fields for line and column tracking, associated constructor parameters, getters, setters, and computation logic. 2. SourceProvider carries a lazily-built LineStartTable. The table is built the first time a line or column number is required for the provider's source. APIs that used to return stored lines and columns now route to the SourceProvider. 3. Because LineStartTable is now responsible for scanning the source to identify line breaks, most of the related logic is moved from Lexer.h/.cpp to SourceProvider.h/.cpp. Some utility functions and predicates are moved to the new files SourceCharacters.h/.cpp. 4. Line break scanning in LineStartTable includes a fix for a minor latent bug in JSC line tracking: an unquoted Unicode line separator (LS) character inside a string literal is legal and is a LineTerminator (starts a new line, ECMA-262 #11.3). The existing JSC lexer code allows it, but doesn't count it as a start of a new line. The bulk of the patch are mechanical changes cascading from the above. Testing: - Existing tests verify no observable behavior differences. - A new test to verify the line start table is not prematurely built by accident: JSTests/stress/line-start-table-not-built-by-ordinary-parse.js Canonical link: https://commits.webkit.org/321541@main
https://bugs.webkit.org/show_bug.cgi?id=324617 rdar://187851417 Reviewed by Mike Wyrzykowski. drawVideoFrame() took a bare ImageOrientation, so a video frame could not carry the HDR, headroom or dynamic-range-limit options that the drawNativeImage() call it ends in already understands. Replace it with a trailing ImagePaintingOptions, which holds orientation itself, and make shouldDiscardAlpha a ShouldDiscardAlpha enum so the call sites read as something other than a bare true or false. No behavior change. The composite operator is still derived from shouldDiscardAlpha and still overrides the caller's; Added FIXME: drawing a video frame into a canvas ignores its globalCompositeOperation. * Source/WebCore/Modules/mediastream/ImageCapture.cpp: (WebCore::createImageBitmapViaDrawing): * Source/WebCore/html/ImageBitmap.cpp: (WebCore::ImageBitmap::createCompletionHandler): * Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp: (WebCore::CanvasRenderingContext2DBase::drawImage): * Source/WebCore/platform/graphics/BifurcatedGraphicsContext.cpp: (WebCore::BifurcatedGraphicsContext::drawVideoFrame): * Source/WebCore/platform/graphics/BifurcatedGraphicsContext.h: * Source/WebCore/platform/graphics/GraphicsContext.cpp: (WebCore::GraphicsContext::drawVideoFrame): * Source/WebCore/platform/graphics/GraphicsContext.h: (WebCore::GraphicsContext::drawVideoFrame): * Source/WebCore/platform/graphics/GraphicsContextGL.cpp: (WebCore::GraphicsContextGL::videoFrameToNativeImage): * Source/WebCore/platform/graphics/NullGraphicsContext.h: * Source/WebCore/platform/graphics/cairo/CairoOperationRecorder.cpp: (WebCore::Cairo::OperationRecorder::drawVideoFrame): * Source/WebCore/platform/graphics/cairo/CairoOperationRecorder.h: * Source/WebCore/platform/graphics/displaylists/DisplayListRecorderImpl.cpp: (WebCore::DisplayList::RecorderImpl::drawVideoFrame): * Source/WebCore/platform/graphics/displaylists/DisplayListRecorderImpl.h: * Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: (WebCore::MediaPlayerPrivateGStreamer::paint): * Source/WebKit/GPUProcess/graphics/RemoteGraphicsContext.cpp: (WebKit::RemoteGraphicsContext::drawVideoFrame): * Source/WebKit/GPUProcess/graphics/RemoteGraphicsContext.h: * Source/WebKit/GPUProcess/graphics/RemoteGraphicsContext.messages.in: * Source/WebKit/Scripts/webkit/messages.py: (headers_for_type): * Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in: * Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextProxy.cpp: (WebKit::RemoteGraphicsContextProxy::drawVideoFrame): * Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextProxy.h: * Source/WebKit/WebProcess/GPU/media/AudioVideoRendererRemote.cpp: (WebKit::AudioVideoRendererRemote::paintCurrentVideoFrameInContext): * Source/WebKit/WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp: (WebKit::MediaPlayerPrivateRemote::paintCurrentFrameInContext): Canonical link: https://commits.webkit.org/321542@main
https://bugs.webkit.org/show_bug.cgi?id=324734 rdar://188014640 Reviewed by Jonathan Bedard. Because user id was sent as part of the URL, edge firewall could see blocked patterns, and reject such requests before they could reach Bugzilla. Work around this by sending data in body. Refactored the code to have a helper that fetches and decodes JSON for consistent error handling. Additionally, drive-by fix for invalidate_bugzilla_token(), which sent rest/logout?<token> instead of rest/logout?token=<token>, so the session token was never actually invalidated at exit. * Tools/Scripts/block-spammers: (get_json): (get_bugzilla_token): (invalidate_bugzilla_token): (get_user_info): (get_bugs_created_by_user): (get_bugs_commented_on_by_user): (get_comments): (get_bugs_with_attachments_created_by_user): (get_attachments): Canonical link: https://commits.webkit.org/321543@main
…sion prompt <rdar://problem/183281228> https://bugs.webkit.org/show_bug.cgi?id=306286 Reviewed by Chris Dumez. The Geolocation permission prompt derived the origin it displays from the page's active (provisional) navigation URL rather than from the request's origin, so a page could start a navigation to another origin and have the prompt attribute the request to that origin while the requesting document kept running. Use the request's top-level origin (frameInfo.topOrigin) for both the WKUIDelegate prompt and the built-in iOS provider prompt, matching the DeviceOrientation permission prompt. Originally-landed-as: 316606.259@safari-7625-branch (8f8dbbf). rdar://187506915 Canonical link: https://commits.webkit.org/321544@main
https://bugs.webkit.org/show_bug.cgi?id=323240 rdar://186491976 Reviewed by Alan Baradlay. flex-line-count puts a floor under the number of lines a balanced container produces. The line breaker already solves balancing with a dynamic program over suffixes, so the constraint goes in as a second dimension rather than as a bisection over line-break sizes: minScores[start][remaining] is the least total squared free space covering items [start, itemCount) in at least remaining further lines. Scores accumulate in a WTF::UInt128. A column flow with an auto height has a capacity of LayoutUnit::max(), so one line's squared free space reaches (2^31 - 1)^2, and five such lines overflow 64 bits. Saturating there would make every candidate compare equal to the sentinel and collapse the argmin to a single line, so the old accumulator answered one line for a container that asked for five. 128 bits cannot overflow here: it would take more than 7e19 lines, and SIZE_MAX bounds the item count at 1.8e19. The candidate scan keeps its <= comparison deliberately. With end ascending, the last end reaching the minimum wins, which puts as many items as possible on the earliest line which is the tie-break the spec specifies. Eight reftests in css-flexbox/balance come off the failing list. Nine remain, for the intrinsic sizing that is not implemented yet, i.e. the case when we have flex-line-count but no specified width. Test: Tools/TestWebKitAPI/Tests/WebCore/FlexLineBreakerTests.cpp * LayoutTests/TestExpectations: * Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.cpp: (WebCore::FlexFormattingContext::computeFlexLines): * Source/WebCore/layout/formattingContexts/flex/FlexFormattingContext.h: * Source/WebCore/layout/formattingContexts/flex/FlexFormattingUtils.cpp: (WebCore::FlexFormattingUtils::minimumLineCount): * Source/WebCore/layout/formattingContexts/flex/FlexFormattingUtils.h: * Source/WebCore/layout/formattingContexts/flex/FlexLineBreaker.cpp: (WebCore::balancedLineBreaks): * Source/WebCore/layout/formattingContexts/flex/FlexLineBreaker.h: * Source/WebCore/layout/integration/flex/LayoutIntegrationFlexLayout.cpp: (WebCore::LayoutIntegration::FlexLayout::flexLayoutConstraints const): * Tools/TestWebKitAPI/CMakeLists.txt: * Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: * Tools/TestWebKitAPI/Tests/WebCore/FlexLineBreakerTests.cpp: Added. (TestWebKitAPI::itemSizes): (TestWebKitAPI::expectLineBreaks): (TestWebKitAPI::TEST(WebCoreFlexLineBreaker, GreedyFillsEachLineBeforeMovingOn)): (TestWebKitAPI::TEST(WebCoreFlexLineBreaker, NoItemsProducesNoLines)): (TestWebKitAPI::TEST(WebCoreFlexLineBreaker, EverythingOnOneLineWhenNoMinimumApplies)): (TestWebKitAPI::TEST(WebCoreFlexLineBreaker, BalancingBeatsGreedyFilling)): (TestWebKitAPI::TEST(WebCoreFlexLineBreaker, MinimumLineCountSplitsALineThatWouldOtherwiseFit)): (TestWebKitAPI::TEST(WebCoreFlexLineBreaker, MinimumLineCountClampsToTheItemCount)): (TestWebKitAPI::TEST(WebCoreFlexLineBreaker, AnItemWiderThanTheLineGetsALineToItself)): (TestWebKitAPI::TEST(WebCoreFlexLineBreaker, IndefiniteAvailableSpaceStillHonorsTheMinimumLineCount)): Canonical link: https://commits.webkit.org/321545@main
…ase.html is flaky timing out since added https://bugs.webkit.org/show_bug.cgi?id=324746 Unreviewed test gardening. Marking this test as flaky timeout, as it has been for GTK and WPE since it was added in 321170@main. * LayoutTests/platform/glib/TestExpectations: Canonical link: https://commits.webkit.org/321546@main
https://bugs.webkit.org/show_bug.cgi?id=306455 Unreviewed test gardening. Test is also failing on GTK * LayoutTests/platform/glib/TestExpectations: * LayoutTests/platform/wpe/TestExpectations: Canonical link: https://commits.webkit.org/321547@main
https://bugs.webkit.org/show_bug.cgi?id=324603 rdar://187834056 Reviewed by Youenn Fablet. EncodedAudioChunkInit, EncodedVideoChunkInit, AudioDataInit, VideoFrameBufferInit and ImageDecoderInit did not have the transfer member, so a page could not hand ownership of its ArrayBuffers to these objects: the constructors always copied init.data, and the page's buffers stayed alive afterwards holding it a second time. Data in WebCodecsEncodedAudioChunk and WebCodecsEncodedVideoChunk was stored in a Vector<uint8_t> which didn't allow for JS data to be moved into. So data was copied from JSC::SharedBuffer into WebCodecsEncoded{Audio,Video}Chunk and again into the encoder or decoder own's buffers. We amend the related idl files to have the spec mandated sequence<ArrayBuffer> transfer. The ArrayBuffer's data is then moved into a SharedBuffer instead of being copied into a Vector and passed around without a need to copy. We amend DataSegment variant to accept an ArrayBufferContents to ease wrapping the content into a SharedBuffer. We specifically don't use DataSegment::Provider so that in a follow-up change we can detect what content type the SharedBuffer is using. We have the SharedBuffer store an ArrayBufferContent instead of the JSC::ArrayBuffer due to ArrayBuffer lack of thread-safe refcounting and we don't want to modify JSC for this. While ArrayBufferContent is a using a gigacage allocated buffer, its usage for our purpose is safe as it's both immutable and gigacage allocation/free is thread-safe. Following this change, the ArrayBuffer copy is removed when creating the WebCodecsEncodedChunk. However, AudioData and VideoFrame while they are validated like the spec required and detached, we still perform a copy due to how the PlatformRawAudioData and VideoFrame works. They currently take a span that forces a copy. We will amend those classes to take a Ref<SharedBuffer> in a followup change. Test expectations are amended for tests that are now passing, adding API tests to actually check the data is moved rather than copied. Added tests to check that non detachable arrays will cause the code to throw as required. * LayoutTests/http/wpt/webcodecs/transfer-non-detachable-buffer.any-expected.txt: Added. * LayoutTests/http/wpt/webcodecs/transfer-non-detachable-buffer.any.html: Added. * LayoutTests/http/wpt/webcodecs/transfer-non-detachable-buffer.any.js: Added. (nonDetachableBuffer): (test): * LayoutTests/http/wpt/webcodecs/transfer-non-detachable-buffer.any.worker-expected.txt: Added. * LayoutTests/http/wpt/webcodecs/transfer-non-detachable-buffer.any.worker.html: Added. * LayoutTests/imported/w3c/web-platform-tests/webcodecs/transfering.https.any-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/webcodecs/transfering.https.any.worker-expected.txt: * Source/WebCore/Headers.cmake: * Source/WebCore/Modules/webcodecs/WebCodecsAudioData.cpp: (WebCore::WebCodecsAudioData::create): Validates the transfer list, then detaches it once the platform object exists. Also drops a pointless move of init.data.span(), since PlatformRawAudioData::create() takes a plain span. * Source/WebCore/Modules/webcodecs/WebCodecsAudioData.h: * Source/WebCore/Modules/webcodecs/WebCodecsAudioData.idl: * Source/WebCore/Modules/webcodecs/WebCodecsAudioEncoder.cpp: (WebCore::WebCodecsAudioEncoder::configure): Moves the encoded data into the chunk instead of copying it through a JSC::ArrayBuffer. * Source/WebCore/Modules/webcodecs/WebCodecsBufferTransfer.cpp: Added. (WebCore::adoptArrayBufferContents): Wraps detached contents in a SharedBuffer. (WebCore::WebCodecsTransferList::validate): (WebCore::WebCodecsTransferList::detachAll const): (WebCore::WebCodecsTransferList::takeData const): * Source/WebCore/Modules/webcodecs/WebCodecsBufferTransfer.h: Added. (WebCore::WebCodecsTransferList::WebCodecsTransferList): (WebCore::WebCodecsTransferList::isEmpty const): (WebCore::WebCodecsTransferList::contains const): * Source/WebCore/Modules/webcodecs/WebCodecsEncodedAudioChunk.cpp: (WebCore::WebCodecsEncodedAudioChunk::create): Validates and consumes the transfer list; replaces the Init constructor, which could not report an exception. (WebCore::WebCodecsEncodedAudioChunk::WebCodecsEncodedAudioChunk): Deleted. * Source/WebCore/Modules/webcodecs/WebCodecsEncodedAudioChunk.h: (WebCore::WebCodecsEncodedAudioChunkStorage::create): (WebCore::WebCodecsEncodedAudioChunkStorage::memoryCost const): (WebCore::WebCodecsEncodedAudioChunk::create): (WebCore::WebCodecsEncodedAudioChunk::byteLength const): * Source/WebCore/Modules/webcodecs/WebCodecsEncodedAudioChunk.idl: * Source/WebCore/Modules/webcodecs/WebCodecsEncodedAudioChunkData.h: * Source/WebCore/Modules/webcodecs/WebCodecsEncodedVideoChunk.cpp: (WebCore::WebCodecsEncodedVideoChunk::create): Ditto. (WebCore::WebCodecsEncodedVideoChunk::WebCodecsEncodedVideoChunk): Deleted. * Source/WebCore/Modules/webcodecs/WebCodecsEncodedVideoChunk.h: (WebCore::WebCodecsEncodedVideoChunkStorage::create): (WebCore::WebCodecsEncodedVideoChunkStorage::memoryCost const): (WebCore::WebCodecsEncodedVideoChunk::create): (WebCore::WebCodecsEncodedVideoChunk::byteLength const): * Source/WebCore/Modules/webcodecs/WebCodecsEncodedVideoChunk.idl: * Source/WebCore/Modules/webcodecs/WebCodecsEncodedVideoChunkData.h: * Source/WebCore/Modules/webcodecs/WebCodecsImageDecoder.cpp: (WebCore::WebCodecsImageDecoder::create): Validates the transfer list. (WebCore::WebCodecsImageDecoder::WebCodecsImageDecoder): Adopts the transferred contents rather than copying them. Removes a dead local that each lambda shadowed, and two null checks on a SharedBuffer::create() returning Ref. * Source/WebCore/Modules/webcodecs/WebCodecsImageDecoder.h: * Source/WebCore/Modules/webcodecs/WebCodecsImageDecoder.idl: * Source/WebCore/Modules/webcodecs/WebCodecsVideoEncoder.cpp: (WebCore::WebCodecsVideoEncoder::configure): Ditto. * Source/WebCore/Modules/webcodecs/WebCodecsVideoFrame.cpp: (WebCore::WebCodecsVideoFrame::create): Validates the transfer list up front and detaches it after the frame is created. * Source/WebCore/Modules/webcodecs/WebCodecsVideoFrame.h: * Source/WebCore/Modules/webcodecs/WebCodecsVideoFrame.idl: * Source/WebCore/Sources.txt: * Source/WebCore/WebCore.xcodeproj/project.pbxproj: * Source/WebCore/platform/SharedBuffer.cpp: (WebCore::DataSegment::DataSegment): Moved out of line. (WebCore::DataSegment::create): Added an overload taking ArrayBufferContents. * Source/WebCore/platform/SharedBuffer.h: Reshuffling of inline DataSegment constructor had to happen in order to avoid pulling JSC headers in SharedBuffer.h. We moved them to SharedBuffer.cpp near where they are actually called. (WebCore::DataSegment::DataSegment): Deleted. * Source/WebKit/Scripts/webkit/opaque_ipc_types.tracking.in: Moved the two chunk payload records to a Ref<WebCore::SharedBuffer> group, matching their new type. * Source/WebKit/Shared/WebCoreArgumentCodersMedia.serialization.in: * Tools/TestWebKitAPI/CMakeLists.txt: * Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: * Tools/TestWebKitAPI/Tests/WebCore/WebCodecsBufferTransfer.cpp: Added. (TestWebKitAPI::TEST(WebCodecsBufferTransfer, AdoptedContentsAreNotCopied)): (TestWebKitAPI::TEST(WebCodecsBufferTransfer, AdoptedContentsOutliveTheirArrayBuffer)): (TestWebKitAPI::TEST(WebCodecsBufferTransfer, AdoptedContentsCanBeReleasedOffTheMainThread)): (TestWebKitAPI::TEST(WebCodecsBufferTransfer, TransferredArrayBufferIsAdoptedWithoutCopying)): Canonical link: https://commits.webkit.org/321548@main
https://bugs.webkit.org/show_bug.cgi?id=317701 rdar://180458116 Reviewed by Vitor Roriz and Tim Nguyen. Reimport the xml WPT directory. -- Upstream commit: web-platform-tests/wpt@1010efa * LayoutTests/TestExpectations: * LayoutTests/imported/w3c/resources/resource-files.json: * LayoutTests/imported/w3c/web-platform-tests/lint.ignore: * LayoutTests/imported/w3c/web-platform-tests/xml/w3c-import.log: * LayoutTests/imported/w3c/web-platform-tests/xml/xml-doc-innerHTML-crash.html: Added. * LayoutTests/imported/w3c/web-platform-tests/xml/xslt/resources/large_CDATA.xml: * LayoutTests/imported/w3c/web-platform-tests/xml/xslt/resources/test.xml: * LayoutTests/imported/w3c/web-platform-tests/xml/xslt/resources/testu1LINE.xml: * LayoutTests/imported/w3c/web-platform-tests/xml/xslt/w3c-import.log: * LayoutTests/imported/w3c/web-platform-tests/xml/xslt/xslt-attribute-double-free-crash.html: Added. * LayoutTests/imported/w3c/web-platform-tests/xml/xslt/xslt-mutation-crash-import.xsl: Added. * LayoutTests/imported/w3c/web-platform-tests/xml/xslt/xslt-mutation-crash-slow.xsl: Added. * LayoutTests/imported/w3c/web-platform-tests/xml/xslt/xslt-mutation-crash.xhtml: Added. * LayoutTests/imported/w3c/web-platform-tests/xml/xslt/xslt-type-confusion-crash.html: Added. * LayoutTests/imported/w3c/web-platform-tests/xml/xslt/xslt-type-confusion.xml: Added. * LayoutTests/imported/w3c/web-platform-tests/xml/xslt/xslt-type-confusion.xsl: Added. Canonical link: https://commits.webkit.org/321760@main
https://bugs.webkit.org/show_bug.cgi?id=309078 Reviewed by Simon Fraser. Consolidates LazyLoadImageObserver, LazyLoadVideoObserver, LazyLoadFrameObserver, and LazyLoadModelObserver to a single LazyLoadElementObserver. The test progressions assert that a lazy-loaded iframe nested inside a scrollable container does load once it's near the edge of that scroller. Before this PR, `LazyLoadFrameObserver` used a strict 0-margin `IntersectionObserver` for iframes (no `scrollMargin` at all), so on WPE these tests never actually loaded the iframe in time, so the wrong behavior was checked in as the accepted baseline. This PR intentionally unifies iframes onto the same "100%" scrollMargin `IntersectionObserver` used for images/video/model, which is the spec-correct behavior. That means the iframe now correctly loads early and the test passes its real assertion. * LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-iframe-element/iframe-loading-lazy-in-scroller-horizontal-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-iframe-element/iframe-loading-lazy-in-scroller-nested-2-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-iframe-element/iframe-loading-lazy-in-scroller-nested-3-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-iframe-element/iframe-loading-lazy-in-scroller-nested-5-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-iframe-element/iframe-loading-lazy-in-scroller-nested-expected.txt: * Source/WebCore/Modules/model-element/HTMLModelElement.cpp: (WebCore::HTMLModelElement::~HTMLModelElement): (WebCore::HTMLModelElement::model const): (WebCore::HTMLModelElement::stop): (WebCore::HTMLModelElement::insertionSteps): (WebCore::HTMLModelElement::removingSteps): (WebCore::HTMLModelElement::lazyLoadIntersectionCallbackInvoked): (WebCore::HTMLModelElement::viewportIntersectionChanged): Deleted. * Source/WebCore/Modules/model-element/HTMLModelElement.h: * Source/WebCore/Modules/model-element/LazyLoadModelObserver.cpp: Removed. * Source/WebCore/Modules/model-element/LazyLoadModelObserver.h: Removed. * Source/WebCore/Sources.txt: * Source/WebCore/WebCore.xcodeproj/project.pbxproj: * Source/WebCore/dom/Document.cpp: (WebCore::Document::commonTeardown): (WebCore::Document::lazyLoadElementObserver): (WebCore::Document::lazyLoadImageObserver): Deleted. (WebCore::Document::lazyLoadModelObserver): Deleted. (WebCore::Document::lazyLoadVideoObserver): Deleted. * Source/WebCore/dom/Document.h: * Source/WebCore/html/HTMLIFrameElement.cpp: (WebCore::HTMLIFrameElement::attributeChanged): (WebCore::HTMLIFrameElement::referrerPolicy const): (WebCore::HTMLIFrameElement::shouldLoadFrameLazily): (WebCore::HTMLIFrameElement::isLazyLoadObserverActive const): (WebCore::HTMLIFrameElement::loadDeferredFrame): (WebCore::HTMLIFrameElement::lazyLoadIntersectionCallbackInvoked): (WebCore::HTMLIFrameElement::lazyLoadFrameObserver): Deleted. * Source/WebCore/html/HTMLIFrameElement.h: * Source/WebCore/html/HTMLImageElement.cpp: (WebCore::HTMLImageElement::lazyLoadIntersectionCallbackInvoked): * Source/WebCore/html/HTMLImageElement.h: * Source/WebCore/html/HTMLVideoElement.cpp: (WebCore::HTMLVideoElement::~HTMLVideoElement): (WebCore::HTMLVideoElement::create): (WebCore::HTMLVideoElement::didMoveToNewDocument): (WebCore::HTMLVideoElement::lazyLoadIntersectionCallbackInvoked): (WebCore::HTMLVideoElement::viewportIntersectionChanged): Deleted. * Source/WebCore/html/HTMLVideoElement.h: * Source/WebCore/html/LazyLoadElementObserver.cpp: Renamed from Source/WebCore/html/LazyLoadImageObserver.cpp. (WebCore::LazyLoadElementObserver::observe): (WebCore::LazyLoadElementObserver::unobserve): (WebCore::LazyLoadElementObserver::intersectionObserver): (WebCore::LazyLoadElementObserver::isObserved const): * Source/WebCore/html/LazyLoadElementObserver.h: Renamed from Source/WebCore/html/LazyLoadImageObserver.h. * Source/WebCore/html/LazyLoadFrameObserver.cpp: Removed. * Source/WebCore/html/LazyLoadFrameObserver.h: Removed. * Source/WebCore/html/LazyLoadVideoObserver.cpp: Removed. * Source/WebCore/html/LazyLoadVideoObserver.h: Removed. * Source/WebCore/loader/ImageLoader.cpp: (WebCore::ImageLoader::didUpdateCachedImage): (WebCore::ImageLoader::notifyFinished): (WebCore::ImageLoader::resetLazyImageLoading): Canonical link: https://commits.webkit.org/321761@main
https://bugs.webkit.org/show_bug.cgi?id=324965 Reviewed by Tim Nguyen. Create a regular renderer for base appearance list boxes and add a stylesheet for the two box types html.css does not cover, the list box and the multi-select dropdown box, conditional on HTMLEnhancedSelectMultipleAndListBoxEnabled. The list box block size comes from attr(size), the first user agent rule to put attr() inside -internal-auto-base(). That caches its substituted tokens on the CSSValue, so two list boxes with different size attributes would share a block size. To address that we reject a cache hit for attr() tainted tokens. Caveats: * size=0 gives no rows, because attr() falls back only for an absent or unparseable attribute, while preferredSize() treats 0 as absent as well. * The option rules also apply to the options of a native list box, observable through getComputedStyle. They cannot revert, because -internal-auto-base() reads the appearance of the option rather than of its select. (This is not visible though and something we can address subsequently.) Test: fast/forms/select/base/select-base-appearance-list-box-rows.html Canonical link: https://commits.webkit.org/321762@main
…reen coordinates on iOS https://bugs.webkit.org/show_bug.cgi?id=324900 rdar://173883202 Reviewed by Sihui Liu and Abrar Rahman Protyasha. On iOS a mouse event's globalPosition -- what becomes screenX/screenY -- is a point in the top-level page's root view rather than device screen space: globalPointForEvent() in PlatformEventFactoryIOS.mm returns the view point unchanged because iOS WebKit works as if it is full screen. The synthetic click a tap produces is dispatched inside the process owning the tapped frame, from a location already converted to that frame's root view, and passed that same point as both position and globalPosition. With site isolation that frame can be a cross-origin iframe, so a tap inside one reported screenX/screenY relative to the iframe while a tap on the main frame reported page coordinates. Add globalPositionForSyntheticMouseEvent(), which maps the local root view point up to the main frame's root view with FrameView::convertToRootViewAcrossIsolatedFrames(), and use it for the globalPosition argument of the synthetic mouse events a tap dispatches. position is untouched, so clientX/pageX behavior is unchanged. convertToRootViewAcrossIsolatedFrames() walks the ancestor chain through the parent RemoteFrameView and applies each frame's transform and scroll, so unlike WebPage::remoteFrameOffsetInMainFrame() -- a plain translation that does not yet account for scrolling of intermediate ancestor frames -- it stays correct for nested and transformed iframes. It returns the point unchanged when there is no remote ancestor, leaving the main frame's process unaffected. handleDoubleTapForDoubleClickAtPoint() and dispatchSyntheticMouseEventsForSelectionGesture() pass the local point twice as well, but both return early unless Page::localMainFrame() exists, so they never run in a cross-origin iframe process and the offset there is always zero. Pointer events from touch (PointerEventIOS.cpp) and drag (tryToBeginDragAtPoint() in EventHandlerIOS.mm) still use iframe-relative screen coordinates. They will be fixed in a follow up. Test: http/tests/site-isolation/touch-events/tap-screen-coordinates-in-cross-origin-iframe.html * LayoutTests/http/tests/site-isolation/touch-events/resources/post-message-click-screen-coordinates.html: Added. * LayoutTests/http/tests/site-isolation/touch-events/tap-screen-coordinates-in-cross-origin-iframe-expected.txt: Added. * LayoutTests/http/tests/site-isolation/touch-events/tap-screen-coordinates-in-cross-origin-iframe.html: Added. * LayoutTests/platform/ios/TestExpectations: * Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm: (WebKit::globalPositionForSyntheticMouseEvent): (WebKit::dispatchSyntheticMouseMove): (WebKit::WebPage::completeSyntheticClick): Canonical link: https://commits.webkit.org/321763@main
…ll sites https://bugs.webkit.org/show_bug.cgi?id=324411 Reviewed by Yusuke Suzuki. Reflect.construct is implemented as a C++ host function, and a call site reaches it through op_call. Transpilers such as Babel compile classes and inheritance into functions and Reflect.construct, so Reflect.construct still runs often, in library code in particular. The bundles in JetStream 3 contain about 60 call sites of it. This patch makes the parser give a `Reflect.construct(...)` call its own AST node, and makes the bytecode compiler emit op_construct_varargs for it instead of op_call. The call site first checks that the callee is the original Reflect.construct and that the arguments pass the validation Reflect.construct does, and makes the ordinary call otherwise. Baseline Patched reflect-construct-array-literal 70.7964+-0.8957 ^ 40.5625+-0.4576 ^ definitely 1.7454x faster reflect-construct-rest 71.8457+-1.1228 ^ 23.8364+-0.2105 ^ definitely 3.0141x faster reflect-construct-arguments-new-target 108.5354+-0.8155 ^ 31.6552+-0.9397 ^ definitely 3.4287x faster reflect-construct-generic 66.4016+-0.6294 ^ 46.7929+-0.4365 ^ definitely 1.4191x faster Tests: JSTests/microbenchmarks/reflect-construct-arguments-new-target.js JSTests/microbenchmarks/reflect-construct-array-literal.js JSTests/microbenchmarks/reflect-construct-generic.js JSTests/microbenchmarks/reflect-construct-rest.js JSTests/stress/reflect-construct-builtin-targets.js JSTests/stress/reflect-construct-call-site-guard.js JSTests/stress/reflect-construct-constant-array-literal.js JSTests/stress/reflect-construct-fast-path.js JSTests/stress/reflect-construct-new-target.js JSTests/stress/reflect-construct-step-order.js * JSTests/microbenchmarks/reflect-construct-arguments-new-target.js: Added. (Base): (Derived): (test): * JSTests/microbenchmarks/reflect-construct-array-literal.js: Added. (Point): (test): * JSTests/microbenchmarks/reflect-construct-generic.js: Added. (Point): (construct): * JSTests/microbenchmarks/reflect-construct-rest.js: Added. (Point): (create): * JSTests/stress/reflect-construct-builtin-targets.js: Added. (shouldBe): (Other): (array.MyArray): (array.withLength): (array.withLengthAndSameNewTarget): (array.withLengthAndNewTarget): (array.withElements): (array.withElementsAndNewTarget): (array.empty): (array.subclass): (array): (object.withoutNewTarget): (object.sameNewTarget): (object.otherNewTarget): (object.empty): (wrappers.string): (wrappers.stringWithNewTarget): (wrappers.emptyString): (wrappers.number): (wrappers.numberWithNewTarget): (wrappers.boolean): (wrappers.symbol): (wrappers.bigInt): (wrappers): (collections.MyMap): (collections.map): (collections.mapWithNewTarget): (collections.mapWithEntries): (collections.setWithNewTarget): (collections.weakMap): (collections.weakMapWithNewTarget): (collections.weakSet): (collections.weakSetWithNewTarget): (collections.set noInline): (buffersAndTypedArrays.arrayBuffer): (buffersAndTypedArrays.arrayBufferWithNewTarget): (buffersAndTypedArrays.typedArray): (buffersAndTypedArrays.typedArrayWithNewTarget): (buffersAndTypedArrays.typedArrayFromArray): (buffersAndTypedArrays.dataView): (buffersAndTypedArrays): (otherBuiltins.MyError): (otherBuiltins.MyPromise): (otherBuiltins.regExp): (otherBuiltins.regExpWithNewTarget): (otherBuiltins.regExpFromRegExp): (otherBuiltins.date): (otherBuiltins.dateWithNewTarget): (otherBuiltins.error): (otherBuiltins.typeError): (otherBuiltins.promise): (otherBuiltins.functionConstructor): (otherBuiltins.proxy): * JSTests/stress/reflect-construct-call-site-guard.js: Added. (shouldBe): (Point): (Other): (calleeIsNotTheOriginalReflectConstruct.literal): (calleeIsNotTheOriginalReflectConstruct.generic): (calleeIsNotTheOriginalReflectConstruct.let.withGetter.get construct): (calleeIsNotTheOriginalReflectConstruct): (replacedOnTheGlobalReflect.literal): (replacedOnTheGlobalReflect.generic): (replacedOnTheGlobalReflect.Reflect.construct): (optionalChaining.optionalBase): (optionalChaining.optionalCall): (optionalChaining): (argumentEvaluation.record): (argumentEvaluation.literal): (argumentEvaluation.generic): (argumentEvaluation.invalid): (argumentEvaluation.assignsTarget): (argumentEvaluation.assignsList): (argumentEvaluation): (ordinaryCalls.spreadAll): (ordinaryCalls.spreadTail): (ordinaryCalls.oneArgument): (ordinaryCalls.bracket): (ordinaryCalls.throughGlobalThis): (ordinaryCalls.holeyLiteral): (ordinaryCalls.spreadLiteral): (ordinaryCalls): (nesting.Box): (nesting.nested): (nesting.nestedWithApply): (positions.Counter): (positions.tail): (positions.ignoredResult): (positions.inCondition): (positions.Derived): (positions): (withStatement.test): (withStatement): * JSTests/stress/reflect-construct-constant-array-literal.js: Added. (shouldBe): (Other): (int32Literal): (doubleLiteral): (mixedLiteral): (withNewTarget): (storedBeforeCall): (pushedBeforeCall): (usedAfterward): * JSTests/stress/reflect-construct-fast-path.js: Added. (shouldBe): (Point3D): (Other): (arrayLiteral.test): (arrayLiteral.testWithNewTarget): (arrayLiteral.testEmpty): (arrayLiteral.testDerived): (arrayLiteral.testExtraArguments): (arrayLiteral): (listModifiedByLaterArgument.test): (listModifiedByLaterArgument): (argumentsObjects.Base): (argumentsObjects.Sloppy): (argumentsObjects.Strict): (argumentsObjects.Mapped): (argumentsObjects.OverriddenLength): (argumentsObjects.rest): (argumentsObjects.spread): (argumentsObjects.test): (argumentsObjects): (tooManyArguments.construct): (tooManyArguments.let.tooLong.get 0): (tooManyArguments.strictArgumentsWithLongLength): (tooManyArguments): (errors.construct): (errors.constructWithoutNewTarget): (errors.constructLiteral): (errors.checkAll): (errors): (constructorThatThrowsFromConstruct.test): (constructorThatThrowsFromConstruct): (exceptions.Thrower): (exceptions.OverflowThenThrow): (exceptions.literal): (exceptions.literalOverflow): (exceptions.generic): (exceptions.let.throwingArrayLike.get 1): (constructorArgumentTypeChange.Adder): (constructorArgumentTypeChange.test): (constructorArgumentTypeChange.Recorder): (constructorArgumentTypeChange.testIgnoringResult): (constructorArgumentTypeChange): (polymorphicTargets.A): (polymorphicTargets.B): (polymorphicTargets.C): (polymorphicTargets.literal): (polymorphicTargets): (callerAndStack.Sloppy): (callerAndStack.literal): (callerAndStack.generic): (callerAndStack): (genericArguments.construct): (genericArguments.let.arrayLike.get length): (genericArguments.let.arrayLike.get 0): (genericArguments.let.arrayLike.get 1): (genericArguments.get let): (genericArguments.get Eighth): (genericArguments): * JSTests/stress/reflect-construct-new-target.js: Added. (shouldBe): (ClassBase): (Derived): (Other): (prototypeIsReadFromNewTarget.literal): (prototypeIsReadFromNewTarget.generic): (prototypeIsReadFromNewTarget.literalDerived): (prototypeIsReadFromNewTarget.get let): (prototypeIsReadFromNewTarget.let.boundNewTarget): (prototypeIsReadFromNewTarget.get let.list.get length): (prototypeIsReadFromNewTarget.get let.list.get 0): (prototypeIsReadFromNewTarget): (nonObjectPrototypeUsesTheRealmOfNewTarget.literal): (nonObjectPrototypeUsesTheRealmOfNewTarget.generic): (nonObjectPrototypeUsesTheRealmOfNewTarget.literalArray): (nonObjectPrototypeUsesTheRealmOfNewTarget.withPrototype): (nonObjectPrototypeUsesTheRealmOfNewTarget): (prototypeGetterThrows.literal): (prototypeGetterThrows.literalDerived): (prototypeGetterThrows.let.thrower): (prototypeGetterThrows.get for): (prototypeGetterThrows): (returnValues.BaseReturning): (returnValues.DerivedReturning): (returnValues.literalBase): (returnValues.literalDerivedReturning): (returnValues.genericDerivedReturning): (returnValues): (whatIsAConstructor.generic): (whatIsAConstructor.genericNewTarget): (whatIsAConstructor.Base): (whatIsAConstructor): (whatIsAConstructor.async method): (whatIsAConstructor.method): (whatIsAConstructor.prototype.new.Proxy): (boundTargets.literal): (boundTargets.literalWithoutNewTarget): (proxyTargets.literal): (proxyTargets.generic): (proxyTargets.get generic): * JSTests/stress/reflect-construct-step-order.js: Added. (shouldBe): (Other): (loggingList.return.get length): (loggingList.return.get 0): (loggingList.return.get 1): (loggingList): (validationOrder.construct): (validationOrder.constructWithoutNewTarget): (validationOrder.check): (validationOrder): (presentButUndefinedNewTarget.explicitUndefined): (presentButUndefinedNewTarget.explicitNull): (presentButUndefinedNewTarget.missing): (presentButUndefinedNewTarget.missingList): (presentButUndefinedNewTarget.noArguments): (presentButUndefinedNewTarget): (revokedProxies.construct): (revokedProxies): (listMustBeAnObject.construct): (listMustBeAnObject): (lengthConversion.construct): (lengthConversion.listWithLength): (lengthConversion.get shouldBe): (lengthConversion): (elementReads.construct): (elementReads.get let): (elementReads.get shouldBe): (listMutatedWhileItIsRead.construct): (listMutatedWhileItIsRead.show): (listMutatedWhileItIsRead.get shouldBe): (listMutatedWhileItIsRead.let.mapped): (listMutatedWhileItIsRead.let.lengthSideEffect.get length): (listMutatedWhileItIsRead): (constructorMutatesTheList.Mutator): (constructorMutatesTheList.construct): (constructorMutatesTheList.literal): (constructorMutatesTheList): (callForms.viaCall): (callForms.viaApply): (callForms.viaReflectApply): (callForms.viaBind): (callForms.extraArguments): (callForms.nested): (callForms.nestedFunctionConstructor): (callForms.asConstructor): (callForms.selfTarget): (callForms): * Source/JavaScriptCore/builtins/BuiltinNames.h: * Source/JavaScriptCore/bytecode/LinkTimeConstant.h: * Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::emitJumpIfNotReflectConstruct): * Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h: * Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp: (JSC::ApplyFunctionCallDotNode::emitBytecode): (JSC::ReflectConstructFunctionCallDotNode::emitBytecode): * Source/JavaScriptCore/parser/ASTBuilder.h: (JSC::ASTBuilder::makeFunctionCallNode): * Source/JavaScriptCore/parser/NodeConstructors.h: (JSC::HasOwnPropertyFunctionCallDotNode::HasOwnPropertyFunctionCallDotNode): (JSC::ReflectConstructFunctionCallDotNode::ReflectConstructFunctionCallDotNode): * Source/JavaScriptCore/parser/Nodes.h: * Source/JavaScriptCore/runtime/CommonIdentifiers.h: * Source/JavaScriptCore/runtime/JSGlobalObject.cpp: (JSC::JSGlobalObject::init): * Source/JavaScriptCore/runtime/ReflectObject.cpp: (JSC::initializeReflectConstructFunction): * Source/JavaScriptCore/runtime/ReflectObject.h: Canonical link: https://commits.webkit.org/321764@main
970 upstream commits since the previous merge base ccdcb8a. Conflicts (39 files), in short: * Took upstream where the fork's patch landed there in another shape: 418114c (JSScope.cpp and its three module tests, fork #624) and b34e745 (the Linux main-thread detection revert, which makes the USE(BUN_JSC_ADDITIONS) guards in Threading.cpp and ThreadingPOSIX.cpp unnecessary). * c76c52f (source positions are offsets only): the parser files take upstream's side and drop the fork's m_lastTokenEndPosition, which only existed to carry a line number. UnlinkedFunctionExecutable loses its line and column members. Its remaining late-written members (m_parametersStartOffset, m_unlinkedFunctionEnd) keep the mutator-only flag bits they shared a word with. The fork's packed bytecode cache records (CachedTypes.cpp) lose the same fields, the HasLines header bit, and cachedTypesFormatRevision becomes 11. * JSBigInt: kept the fork's Toom-3 and FFT multiplication with its InterruptCheck plumbing and dropped upstream's copies (df94b6c, 9a38124), as the previous merge did for Karatsuba. a89c412 and d2d61f8 apply on top. * 4dbb362: CodeBlock::updatePredictionsConcurrently() takes the fork's ValueProfileSamples argument. * 7f5ab15 (WeakBlock redesign) and the fork's MarkedBlock page decommit both edit MarkedBlock::Handle::sweep(). Upstream's early return for a block that is still swept comes first. * The rest are include lists, CMake lists and $vm functions where both sides add lines. Fork-only code that needed an edit to build against the new upstream: ExpressionInfo::Encoder::rebuild() (no LineColumn argument), SourceProviderCacheItem (no lastTokenEndLine), CodeCache.cpp recordParseFromUnlinkedCodeBlock(), JSDateMath.cpp (isWhiteSpace<char16_t>()), JSGlobalObjectInspectorController (lazyInitialize for the const m_consoleClient), and the sizes in the static_asserts at the end of CachedTypes.cpp. This tree also contains the conflict resolutions of #651 (upstream 6b58d86), which this merge supersedes.
…S(DARWIN) Upstream 8009ddd (321214@main) implements memoryFootprint() in cocoa/MemoryFootprintCocoa.cpp with a call to a new overload, memoryFootprint(mach_port_t), and declares that overload only under PLATFORM(COCOA). PlatformJSCOnly.cmake builds the same file on every Apple target, where PLATFORM(COCOA) is not set, so the JSCOnly port on macOS calls a function with no declaration in scope. * Source/WTF/wtf/MemoryFootprint.h:
|
Preview build of 3a8b1bc: |
There was a problem hiding this comment.
Additional findings (outside the current diff — GitHub can't attach inline comments there):
-
🔴
Source/JavaScriptCore/runtime/ErrorInstance.cpp:160— Bun programs that setError.stackTraceLimit = NaN(e.g.Number(process.env.X)with X unset) or define it as an accessor now abort the process on the next captured stack trace instead of getting an empty trace. Upstream's rewrittenJSGlobalObject::stackTraceLimit()(JSGlobalObject.cpp:3923-3928) returns nullopt for non-numbers and NaN, but the fork-onlyErrorInstance::captureStackTracestill callsstackTraceLimit().value()at ErrorInstance.cpp:160, which terminates on an empty optional under -fno-exceptions. Fix: usevalue_or(0)(or return early when nullopt) like the upstream callers at ErrorConstructor.cpp:100 and Error.cpp:170, so every non-numeric, NaN, deleted or accessor form of the property yields zero frames. … [also at: Source/JavaScriptCore/runtime/JSGlobalObject.cpp:3929 - Embedders calling ErrorInstance::captureStackTrace now abort the process when Error.stackTraceLimit is NaN or was defined as a non-number, where the base branch captured with limit 0. The new JSGlobalObject::stackTraceLimit() at Source/JavaScriptCore/runtime/JSGlobalObject.cpp:3915 reads the…; Source/JavaScriptCore/runtime/JSGlobalObject.cpp:3928 - Embedders that call the fork's ErrorInstance::captureStackTrace() now abort the process when Error.stackTraceLimit is NaN, a non-number or an accessor.]Why this was flagged
…The non-number/deleted forms already crashed on the base branch (pre-existing); NaN and accessor are new triggers from this merge.
Trigger: JS runs
Error.stackTraceLimit = NaN(orObject.defineProperty(Error, 'stackTraceLimit', { get() { return 10; } }), or a non-number/delete) and then something reaches the fork'sErrorInstance::captureStackTrace(JS_EXPORT_PRIVATE, no in-repo caller; it is the embedder's Error.captureStackTrace/stack-capture entry point). After the mergeJSGlobalObject::stackTraceLimit()(Source/JavaScriptCore/runtime/JSGlobalObject.cpp:3915-3930) does…Verification: normal — triggered when the embedder calls the exported ErrorInstance::captureStackTrace after JS has set
Error.stackTraceLimit = NaNor redefined it as an accessor (in-repo Error.captureStackTrace and getStackTrace are guarded; this exported entry point is not). Mechanism verified. The diff replaces the cachedm_stackTraceLimitwith a live read:… | normal — when an embedder calls the… -
🟣
Source/WebCore/style/MatchResultCache.cpp:84— Pages using :has() with sibling/positional pseudo-classes can keep stale styling after a sibling insertion once an element's inline style was edited twice. Source/WebCore/style/MatchResultCache.cpp:84 now stores no Relations in the cache, so the FullWithMatchResultCache path at Source/WebCore/style/StyleTreeResolver.cpp:202 never calls commitRelations for the subject. Descendant flags such as ChildrenAffectedByFirstChildRules are cleared by that descendant's own resetChildStyleRelations (Element.cpp:6016) and only the subject's selector match re-sets them. Fix: on the cached path, re-run relation collection (or cache relations keyed by node identity and re-validate) so descendants regain their invalidation flags; do not rely on the previous pass having left them set.Why this was flagged
An element with a :has()-style rule whose argument uses :nth-last-child (or any sibling relation) is resolved once; matching records a Relation targeting a descendant. The descendant is later re-resolved with DescendantsToResolve::Children, which clears its ChildrenAffectedBy* flags (Source/WebCore/dom/Element.cpp:6016-6023). On the base branch, the next inline-style-only change to the subject took FullWithMatchResultCache at Source/WebCore/style/StyleTreeResolver.cpp:202, and the cached Relations copy was committed at line 215, restoring those flags (the UAF happened only when the target had been freed). After this change the copy at Source/WebCore/style/MatchResultCache.cpp:84 is always empty, so nothing re-sets the flags and later sibling insertions under that descendant do not invalidate the subject; the user sees the old background/style until an unrelated full recalc. The dismissal argued the base loses the flags in the same step, but resetDescendantStyleRelations at line 1481 only clears the resolved element's own flags, not the descendant targets of the subject's relations. Remedy:…
Verification: pre-existing (nit) — the root defect lives in untouched code; this change only removes an accidental, unsound mask on one path. Triggering condition: a
:has()rule whose argument uses:first-childor:last-child(NOT:nth-last-child/sibling relations — see below), the descendant parent of the matched child is later re-resolved with DescendantsToResolve::Children, then the subject's…
…stackTraceLimit is not a number JSGlobalObject::stackTraceLimit() is empty when Error.stackTraceLimit is not a number or was deleted. Since a5bfdb3 it is also empty for NaN and for an accessor. captureStackTrace() called value() on it, and value() on an empty optional aborts the process without exceptions. It now captures zero frames for an empty limit, which is what Error.captureStackTrace does (ErrorConstructor.cpp). m_stackTrace stays non-null, which Bun's Error.appendStackTrace relies on.
There was a problem hiding this comment.
Findings marked 🟡 are optional suggestions and need no follow-up push.
Additional findings (outside the current diff — GitHub can't attach inline comments there):
-
🔴
Source/JavaScriptCore/heap/WeakBlock.h:273— Code that destroys a JSC::Weak<> while the collector is running and without heap access can now corrupt weak-handle blocks and crash the GC. WeakImpl::clear() at WeakBlock.h:273 no longer just tags the slot: it threads the free list through m_jsValue, edits counters, and may unlink or free the block (WeakSet.cpp:80-82) with no synchronization against the collector's weak-block walk (MarkedSpaceInlines.h:100). Fix: make deallocation as safe off-lock as on the base branch (defer free-list, count and list changes to sweep), or require and assert the API lock in WeakSet::deallocate and audit every Weak<> destroyed outside JSLockHolder, e.g. WebCore's JSCallbackData (JSCallbackData.cpp:53 only checks the thread).Why this was flagged
Trigger: a JSC::Weak<> is destroyed by a thread that does not hold the VM's API lock, so it has no heap access (JSLock.cpp:323-324 releases access on unlock); WebCore does this whenever a DOM object holding a Weak<> dies outside a JSLockHolder, e.g. ~JSCallbackData (JSCallbackData.cpp:53-58 asserts only the thread id), and embedder glue that cannot be enumerated from this checkout may do the same. A thread without heap access counts as stopped, so the collector can be in its fixpoint phase running the "Ws" constraint at the same time: MarkedSpace::forEachWeakInParallel walks each WeakSet's m_blocks through next() and hasLiveHandles() (MarkedSpaceInlines.h:100-103) and WeakBlock::visitImpl reads m_liveCount and each slot's state then jsValue (WeakBlock.cpp:172, 138, 145). On the base branch WeakImpl::clear() was one store of the Deallocated tag and the free list was rebuilt only by WeakSet::sweep on the mutator. After this change Weak::~Weak -> WeakSet::deallocate (WeakSet.h:129) -> WeakImpl::clear() (WeakBlock.h:267-273) -> WeakBlock::deallocate (WeakBlock.h:209-223): pushFreeCell…
Verification: normal — triggered when a Weak<> is destroyed by a thread that does not hold heap access (in this checkout: the ObjC API's
-[JSManagedValue dealloc]) while the collector is in its fixpoint phase, or while another thread concurrently allocates/clears handles in the same WeakBlock. Mechanism verified. On the base,WeakImpl::clear()(old WeakImpl.h) was a single tagged store to… | normal —… -
🟡
Source/WebCore/bindings/js/SerializedScriptValue.cpp:3242— Embedders that deserialize into a plain (non-JSDOMGlobalObject) JSGlobalObject, e.g. via the exported SerializedScriptValue::deserialize(JSContextRef, JSValueRef*), now fail to deserialize any ArrayBuffer, resizable ArrayBuffer or typed array/DataView, where the base branch returned the buffer. The deserializer's toJSArrayBuffer at SerializedScriptValue.cpp:3239 returns an empty JSValue when !m_isDOMGlobalObject, and CloneDeserializerBase.h:789 pools that empty value and hands it back, which the walker treats as a failed terminal. …Why this was flagged
…Fix: for a non-DOM global object toJSArrayBuffer should return a wrapper anyway, mirroring the serializer-side fallback at SerializedScriptValue.cpp:1098-1101 (m_wrapper if set, else JSArrayBuffer::create(vm, globalObject->arrayBufferStructure(sharingMode), buffer)), so the same object also covers ResizableArrayBufferTag at CloneDeserializerBase.h:808 and the view path at CloneDeserializerBase.h:508.
Condition: a caller deserializes with a globalObject that does not inherit JSDOMGlobalObject; WebKit itself no longer has a live caller (WKSerializedScriptValueDeserialize is a stub), but SerializedScriptValue::deserialize(JSContextRef, JSValueRef*) at SerializedScriptValue.cpp:4477-4484 is WEBCORE_EXPORTed and passes the JSC API global object, and this fork's embedder may pass its own non-DOM globals. On the base branch the ArrayBufferTag and ResizableArrayBufferTag cases built the object directly with JSArrayBuffer::create(m_lexicalGlobalObject->vm(), structure, WTF::move(arrayBuffer)) using m_globalObject->arrayBufferStructure(), so a non-DOM global worked. After the change…
Verification: nit — triggers only when an embedder calls the exported SerializedScriptValue::deserialize(JSContextRef, JSValueRef*) (Source/WebCore/bindings/js/SerializedScriptValue.cpp:4477-4484, which passes the plain JSC API global as both lexical and target global) or the WEBCORE_EXPORT deserialize(JSGlobalObject&, JSGlobalObject*) with a global that does not inherit JSDOMGlobalObject; no caller inside…
…the constructor A base class constructor calls the instance field initializer before its first statement. The call takes its position from m_scopeNode->position(). Before c76c52f, StatementNode::setLoc() gave a scope node a position with the first line of the function and the offset of its end. A stack frame used the line, so the frame of the constructor was on its first line. Since c76c52f a position is an offset only, and the frame is on the closing brace of the constructor: class Client { endpoint = config.url; // throws constructor() { // the frame was here this.a = 1; } // and moved here } The call now takes the offset where the constructor starts, which is the position that V8 reports for this frame. c76c52f moved the frames of `using` and `await using` disposal in the same way, from the first line of the function to the statement that leaves the scope. V8 reports them there too, so they do not change. Checked with 337 stress tests whose names match class fields, private names, constructors, stack traces, lines and columns. Only the new test changes its result. * JSTests/stress/class-field-initializer-error-is-reported-at-constructor-start.js: Added. * Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::BytecodeGenerator):
There was a problem hiding this comment.
Nothing blocking. The comments below are optional suggestions. There is no need to push a fix for them before merging.
Additional findings (outside the current diff — GitHub can't attach inline comments there):
-
🟡
Source/JavaScriptCore/parser/SourceProvider.cpp:191— nit: for any source whose text ends with a line terminator, the last content line's reported end includes that terminator, contradicting the "excludes the line terminator" contract at SourceProvider.h:88. lineEndFor at SourceProvider.cpp:186 only backs over the terminator when lineEnd < length, but for the last non-final line the next line start equals length, so nothing is backed over. Fix: back over the terminator whenever a next line exists (line0Based + 1 < lineStarts.size()), not only when lineEnd < length, so PositionInfo.lineEnd and offsetForPosition's clamp never point at a '\n' or '\r\n' for any line.Why this was flagged
Text "a\nb\n" builds lineStarts [0, 2, 4] with length 4 (LineStartTable::build, SourceProvider.cpp:148). For line0Based 1, lineEndFor at SourceProvider.cpp:186 sets lineEnd = lineStarts[2] = 4, and the guard
if (lineEnd < length)at SourceProvider.cpp:187 is false, so the terminator is not backed over and lineEnd stays 4 instead of 3. Line 0 in the same text is handled correctly (lineEnd 2 < 4, backed to 1). Consequences: LineStartTable::positionInfoForOffset (SourceProvider.cpp:194) returns lineEnd = 4 for offsets on line 1, and LineStartTable::offsetForPosition (SourceProvider.cpp:218) clamps an over-long column on that line to 4, which positionInfoForOffset then reports as line 2 column 0 (the empty final line) rather than the end of line 1. Readers are Debugger::offsetForInspectorPosition (Debugger.cpp:596) and the shouldEnterFunction range check in DebuggerParseData.cpp:104-105. The base branch had no LineStartTable; this code is new in the diff. Nearly every on-disk JS file ends with a newline, so the last content line of every script hits this.Verification: nit. Trigger: any source text whose last content line is followed by a line terminator (the common case for files ending in "\n"). Mechanism verified in /home/claude/webkit/Source/JavaScriptCore/parser/SourceProvider.cpp:
lineEndFor(new in this diff) computesunsigned lineEnd = (line0Based + 1 < lineStarts.size()) ? lineStarts[line0Based + 1] : length;and only backs over the terminator…
Fixes #25559
Upgrades the WebKit fork to upstream WebKit `7b485a76e9` (2026-09-23):
970 upstream commits since the previous merge base `ccdcb8a026`, about
200 of them in JavaScriptCore, WTF, bmalloc or cmake. Fork PR:
oven-sh/WebKit#725. This PR replaces #42666 (upstream `6b58d86abe`, the
first 216 commits of the range) and contains its source edits.
### Pin
- `WEBKIT_VERSION` is `f20ce77445`, the fork's main. It holds
oven-sh/WebKit#725 (the upgrade) and oven-sh/WebKit#734 (positions).
- oven-sh/WebKit#725 landed as a squash. The tree of `74650443cb` is
identical to the tree of `3a8b1bc93b`, the head that CI tested here
before. The squash has no upstream parent, so `git merge-base` with
upstream is still `ccdcb8a026`. The next upgrade must name `7b485a76e9`
as its base by hand, unless someone first records the merge on the
fork's main (`git merge -s ours` of the branch
`bun/upgrade-to-7b485a76e9`).
### Problem
- The fork is 970 commits behind upstream. #42666 stopped at
`6b58d86abe` and did not land.
- #25559: a `++array.length` loop is quadratic past 100000 elements.
Upstream `ab1caf1170` fixes `JSArray::setLength`. The loop of the issue
takes 5152 ms on the current release build and 726 ms on the debug +
ASAN build of this PR.
### Fix
- `WEBKIT_VERSION` points at the fork's main, with oven-sh/WebKit#725
and oven-sh/WebKit#734.
- `error.stack` costs what it did before the upgrade, within a few
percent (see Downsides). With offsets only, upstream reads a whole
source the first time a position in it is asked for, and decodes the
expression info again for every position. In oven-sh/WebKit#734 the
lexer notes where the lines start while it parses a whole source, the
code and its bytecode carry that table, and each position that was
looked up is kept. Nothing of that is in Bun.
- Upstream no longer stores lines and columns (`c76c52f5b1`).
`SourceCode(provider, firstLine, startColumn)` is gone, and 3 of Bun's 5
call sites would still compile with the integers read as source offsets.
All 5 now pass offsets only, and the provider's start position carries
the node:vm `lineOffset` and `columnOffset`.
- The other source edits follow upstream API changes:
`Error.stackTraceLimit` storage, `CheckedPtr` plumbing for inspector
agents, typed C strings, `ASCIICString` heap names, `char8_t` option
strings. "Notes for Bun" lists each one.
- The builtins share one text, and a `SourceCode` no longer has a first
line, so `at map (native:1:11)` had become `at map (native:3323:11)`.
The source of Bun's builtins, like that of JavaScriptCore's, is now a
`BuiltinsSourceProvider`, which is told where each builtin starts and
counts from there. `processTicksAndRejections (native:7:39)` and the
rest are what they were.
- Verified: `test/js/bun/jsc/webkit-upgrade-7b485a76e9.test.ts` (22
cases, 10 fail on main), 5 cases in `bun-build-compile.test.ts` for the
sources of an executable (fail without oven-sh/WebKit#734), 4
`Error.appendStackTrace` cases in `capture-stack-trace.test.js` (3 fail
on main) and a `SourceTextModule` position case in `vm.test.ts` (fails
on main). `test/bundler/bundler_bytecode_portable.test.ts` has a new
snapshot, because the bytecode cache format changed. 80 outputs with
positions in them are the same as on main: 20 sources, each run from a
file and compiled three ways. The Notes list the other suites.
### Background
- JavaScriptCore used to store a line and a column next to every source
offset in the parser, in `ExpressionInfo` and in the bytecode cache. It
now stores offsets only. `SourceProvider` builds a table of line starts
the first time someone asks for a line or a column, for example when
`Error.stack` is read.
- The bytecode cache (`bun build --bytecode`, `--compile`) has no line
and column fields any more. Payloads in the portability test are 3% to
6% smaller. The cache version is a hash of `WEBKIT_VERSION`, so a new
build rejects old payloads and compiles from source.
- `Error.stackTraceLimit`: JSC kept the limit in a C++ field that only a
`put` on the constructor updated. It now reads the own property of the
`Error` constructor when it captures a stack, as V8 does. Bun's default
of 10 moves to `Options::defaultErrorStackTraceLimit()`.
### Downsides
- Behaviour changes that code could depend on:
`vm.runInNewContext("Error.stackTraceLimit")` is 10 (was 100, Node gives
10). `TypeError.stackTraceLimit = n` and a setter installed on
`Error.stackTraceLimit` no longer change the limit. `BigInt("-")`,
`BigInt("+")` and `BigInt("0x ")` throw `SyntaxError` (were `0n`).
`Intl.DurationFormat("en", { hours: "numeric" }).format({ hours: 1 })`
is `"1:00:00"` (was `"1"`). `Intl.DateTimeFormat`
`resolvedOptions().dayPeriod` is `undefined` for an AM/PM pattern (was
`"short"`). `resize(-1)` and `resize(2 ** 53)` on a detached
`ArrayBuffer` throw `RangeError` (were `TypeError`, and Node throws
`TypeError`): the specification runs `ToIndex` before the detached check
(`223bd0faee`). Of 26 behaviours compared with Node 26.3, 12 changed to
Node's result and this one changed away from it.
- A position now takes a lookup in the source's table of line starts,
which the code did not need when it had its lines and columns. A stack
trace whose call sites are all new executes 3% (1 function deep) to 6%
(10 deep) more instructions than on main. The first `error.stack` in a
file takes 4 to 5 µs longer (20 µs against 15 µs at 100 KB, 27 µs
against 23 µs at 10 MB), where upstream alone takes 2.5 ms at 10 MB.
Repeated reads are 0.95 to 1.05 of main over 22 cases. In a 100 MB
module compiled with `--bytecode` the first read takes 0.03 ms and 0.6
MB of RSS, where upstream alone takes 34.5 ms and 137 MB. Loading a
module of 500 to 12,000 characters executes 2.7% to 3.6% fewer
instructions than on main. The tables are in oven-sh/WebKit#734.
- Positions that change, found by running 37 constructs through
`node:vm` and about 120 scripts of every feature that reports a position
(call sites, uncaught errors, `bun test` output, junit, inline
snapshots, coverage, `--cpu-prof`, the inspector) on main and on this
branch. Everything else was the same.
- The `new X` frame under a field initializer that throws is where the
constructor's parameters start: `4:14` (was `4:15` to `4:17`). Node
gives `4:14`.
- A position in a class field initializer on the same line as the
enclosing function has its true column: `1:45`, and `1:67` with 22
characters before it (was `1:35` for both). That is the shape of
minified code.
- `vm.SourceTextModule` applies `lineOffset` and `columnOffset` as Node
does (both were one short).
- A runtime error in a `vm.Script` with a negative `lineOffset` prints
the source line and a caret, as Node does.
- The frame that disposes a `using` is where its scope ends, `6:2` (was
the first line of the function with a column that meant nothing,
`2:12`). Node gives the last statement, `5:4`.
- The frame of an implicit base-class constructor is `unknown:1:11` (was
`unknown:1:17`). Both are positions in a text that the engine makes up.
- Bytecode holds the line starts of its source, about one byte per line.
It is still smaller than before the upgrade, because it shrank by more
(what TypeScript's `tsc` embeds with `--bytecode`: 16.49 MB to 16.17
MB). An executable without bytecode embeds what it did.
- Upstream's `WeakBlock` redesign (`7f5ab15882`, one week old upstream)
makes `WeakImpl::clear()` edit the free list and the counts of a block
without a lock. A `JSC::Weak` that is destroyed by a thread without the
API lock, or by the lock owner while it has released heap access, now
corrupts the weak blocks. I found no such call: 174,668 probed calls,
and about 4,700 tests with an assertion in `WeakBlock::deallocate`,
child processes included. Not covered: macOS, Windows, native addons
that delete a reference on their own thread, and code that no test runs.
<details><summary>Notes for Bun: every source edit, and what was
verified</summary>
New in this PR (upstream `6b58d86abe..7b485a76e9`):
- `SourceCode` (`c76c52f5b1`). `src/codegen/bundle-functions.ts`,
`JSCommonJSModule.cpp`, `NodeVM.cpp` (two sites) and
`NodeVMSourceTextModule.cpp` drop the line and column arguments. The
three-argument sites in `NodeVM.cpp` and `NodeVMSourceTextModule.cpp`
are the ones that would have compiled with the integers read as
`startOffset` and `endOffset`.
- node:vm start positions. JSC now adds the provider's start position to
every derived line and column, as unsigned numbers. The old `SourceCode`
constructor clamped `firstLine` and `startColumn` to 1. With
`lineOffset: -5`, the unclamped provider gave `e.line === 4294967293`
and broke the arrow header of compile-time errors (2 cases of
`vm.test.ts`). The new `providerStartPosition()` in `NodeVM.cpp` clamps
at zero for `vm.Script`, `vm.compileFunction` and `vm.SourceTextModule`.
`decorateParseErrorStack()` keeps its logic that applies the sign again.
Result: the same output as before this PR for negative offsets. Not
changed by this PR: `vm.compileFunction` reports the first body line one
too high for `lineOffset` 0 and 1 (`vm.js:2`, where Node prints
`vm.js:1` and `vm.js:2`). The 1.4.3 release prints the same lines as
this branch for offsets 0, 1, 5 and -3, and #38240 is the open PR for
it.
- `vm.SourceTextModule` passed zero-based numbers to the one-based
`SourceCode` arguments. With the provider as the only source of the
start position, a module with `lineOffset: n` now reports the same lines
as `vm.Script` with `lineOffset: n`, which is also what Node reports.
`vm.test.ts` has a case for it. #38235 covers the rest of the module
offsets (negative values, the identifier as the file name).
- `Error.appendStackTrace` (fork commit `eacf0ea760`). The fork's
`ErrorInstance::captureStackTrace()` called `value()` on
`JSGlobalObject::stackTraceLimit()`. The limit is empty for a value that
is not a number and for a deleted property, and since `a5bfdb3aaf` also
for `NaN` and for an accessor. `Error.stackTraceLimit = NaN;
Error.appendStackTrace(new Error("a"), new Error("b"))` aborted the
process. The string and the deleted form abort on main too. It now
captures zero frames, like `Error.captureStackTrace`.
- `ErrorStackFrame.cpp`: `ExpressionInfo::Entry` has no `lineColumn`.
`getAdjustedPositionForBytecode()` asks
`SourceProvider::documentLineColumnForOffset()` for the divot.
- `NodeVM.cpp` `decorateParseErrorStack()`: `JSTextPosition::column()`
is gone. The caret column is the distance from the token offset back to
the previous `\n` of the source, which is also how
`nthSourceLineForArrowHeader()` splits lines.
- `Error.stackTraceLimit` (`a5bfdb3aaf`):
`JSGlobalObject::setStackTraceLimit()` is gone. `JSCInitialize` sets
`Options::defaultErrorStackTraceLimit()` to 10. Every realm's `Error`
constructor starts from that option, so node:vm contexts now start at 10
(they started at 100, Node gives 10). `ShadowRealm` already had 10.
- Inspector agents (`9a8a5f7d36`): `InspectorAgentBase` derives from
`AbstractCanMakeCheckedPtr`. `InspectorLifecycleAgent`,
`InspectorTestReporterAgent`, `InspectorHTTPServerAgent` and
`InspectorBunFrontendDevServerAgent` add `CanMakeThreadSafeCheckedPtr`,
`WTF_OVERRIDE_DELETE_FOR_CHECKED_PTR` and
`OVERRIDE_ABSTRACT_CAN_MAKE_CHECKEDPTR`. The thread-safe base is what
upstream uses for agents whose controller can be destroyed on another
thread.
- `BunGCOutputConstraint.cpp`, `BunClientData.cpp` (`9b5592466b`):
marking constraint names are `ASCIICString`, so the literals take `_s`.
- `BunJSCModule.h` (`58e02c19b9`): `Options::samplingProfilerPath()` is
a `const char8_t*`, so the store takes `pathCString.data()`. The edit
adapts the type and nothing else: the statement segfaults on every call,
on main too, because the options are read-only after `Config::finalize`
(#32212), and #41137 replaces it.
- `JSSecrets.cpp` (`29a96fa550`): `CString::mutableSpan()` is protected.
`SecretsJobOptions` holds `UTF8CString`, which keeps `mutableSpan()`
public, so the destructor still zeroes the buffers. The platform
functions keep their `const CString&` parameters.
- `bindings.cpp` (`c17d3df6ec`): includes
`wtf/PlainGregorianDateTime.h`.
- `bundler_bytecode_portable.test.ts`: every hash moves, as the file's
header says for a format change. The bundled JS hashes do not move.
From #42666 (upstream `ccdcb8a026..6b58d86abe`):
- `String::utf8()` returns `UTF8CString` (`00130dc2f3`), whose `data()`
is a `const char8_t*`. 48 calls in 17 files give a NUL-terminated string
to a C function or to a format string, and they call
`legacyCStringPointer()`. The class generator emits the same pattern. 13
calls pass bytes and a length, and they use `span()`.
- `toCString()` is `toUTF8CString()` (`7189f73167`). `WeakGCMap` holds
raw pointers (`8ae0649a80`, `SecureContextCache::set()`).
`String(std::span<const char>)` is private (`74b519d7f9`,
`BunProcess.cpp`). `dataLog()` has no `const char8_t*` overload
(`BunAnalyzeTranspiledModule.cpp`).
- `scripts/verify-baseline-static/allowlist-x64-windows.txt`: this PR no
longer changes it. Its entry `__std_max_8i` was for `5e03b0c541`, which
uses `std::max` over an initializer list of `int64_t` (the MSVC STL
vectorizes that behind an `__isa_available` test). Main now lists the
code of the MSVC STL as `<lib:libcpmt.lib>` (#43704), and the merge of
main (`efdc463da7`) took that entry.
- Tests of #42666. The 5 cases of its
`webkit-upgrade-6b58d86abe.test.ts` are in
`webkit-upgrade-7b485a76e9.test.ts`, some in a longer form (the BigInt
case has its 8 operand shapes plus 6). Its
`webkit-upgrade-ccdcb8a026.test.ts` is carried over as a file: 5 cases
for the previous upstream range, which pass before and after this
upgrade.
Review of this diff (what I checked by hand, and how):
- Stack position of a class field initializer: **a regression, repaired
in the fork.** For a base class with an explicit constructor, `endpoint
= config.url` with `config === null` gave `at new Client (file.ts:7:15)`
on main (the `constructor(` line) and `at new Client (file.ts:9:21)`
with the pin `eacf0ea7` (the last statement of the constructor). Bun's
code frame then puts the caret on a line that did not throw. Cause:
upstream `c76c52f5b1`. The old `StatementNode::setLoc()` gave a scope
node the first line of the function next to the offset of its end, and a
frame used the line. Fork commit `3a8b1bc93b` gives the call the offset
where the constructor starts: `at new Client (file.ts:7:14)`, which is
what Node 26.3 prints. Upstream `main` still has the old call. The
expression info stores that offset, so the bytecode snapshot changes for
the 16 payloads that have a class with instance fields, and the 11
without one keep their hash.
- `using` and `await using`: the frame of the function that owns the
declaration moved from its first line to the statement that leaves the
scope (`work (2:14)` to `work (6:10)`). Node prints `work (6:12)`, so
this stays.
- `SourceCode` call sites: a scan of `src/` for every `SourceCode(...)`
finds 29 calls with one argument and 2 with three,
`bundle-functions.ts:468` and `JSCommonJSModule.cpp:176`. Both pass
`startOffset` and `endOffset`. No call passes a line and a column.
- `ErrorStackFrame.cpp`: `CodeBlock::expressionInfoForBytecodeIndex()`
adds `sourceOffset()` to the divot, so the divot that
`getAdjustedPositionForBytecode()` gives to
`documentLineColumnForOffset()` is an offset in the provider. Upstream's
`CodeBlock::lineColumnForBytecodeIndex()` does the same.
- `allowlist-x64.txt`: in a release build with LTO and the baseline
features, the region that the scanner counts as
`ipint_op_memory_atomic_wait64` is 43,831 bytes and has 8 AVX
instructions. They are the same sequences as in the handlers of
`v128.load8_splat`, `load16_splat`, `load32_splat` and `load64_splat` (3
+ 3 + 1 + 1). The gate is `Options.cpp:943`: `if (isX86_64() &&
!isX86_64_AVX()) Options::useWasmSIMD() = false`.
- `JSSecrets.cpp`: `mutableSpan()` copies a buffer that is shared, so
the destructor would then zero a copy. A breakpoint on
`~SecretsJobOptions()` shows a reference count of 1 for `password`,
`name` and `service` in `set`, `get` and `delete`, so the zeroing is in
place. The container has no keyring, so each call ended with
`ERR_SECRETS_PLATFORM_ERROR`.
- `FuzzilliREPRL.cpp`: no CI lane builds with `FUZZILLI_ENABLED`.
Compiled by hand with that flag, the file of this PR compiles, links and
runs. The file of main does not compile against the new WebKit (`format
specifies type 'char *' but the argument has type 'const char8_t *'`).
- Three worker test files fail on my machine and pass in CI.
`worker.test.ts` and `worker-late-completion.test.ts` hit the 5 second
limit on a host with a load average of 110 (CI, `x64-asan`: 42 of 42 in
3.5 s and 33 of 33 in 7.7 s). The `dns.lookup()` case of
`worker-terminate-lifetime.test.ts` is a LeakSanitizer report at
`node_fs_binding.rs:183` (#39684), in a container without DNS.
Measurements (Linux x64, release builds with LTO of main `8d36bff512`
and of this PR at `701805bae0`, runs interleaved A/B, host load average
about 110, so the quartiles are beside each median):
| | main q1 / median / q3 | this PR q1 / median / q3 |
|---|---|---|
| First `.stack` read, 10 MB source with 90,177 functions (15 runs) |
0.034 / 0.036 / 0.038 ms | 7.31 / 7.63 / 7.79 ms |
| Next 1,000 `.stack` reads, same source | 2.40 / 2.49 / 2.70 ms | 2.72
/ 2.82 / 2.91 ms |
| User CPU of that process | 662 / 684 / 699 ms | 647 / 649 / 665 ms |
| Peak RSS of that process | 105.9 / 106.9 / 107.1 MB | 102.5 / 103.5 /
104.6 MB |
| `new Error().stack`, 2 frames (9 runs) | 2.82 / 3.00 / 3.07 µs | 2.34
/ 3.41 / 3.57 µs |
| `new Error().stack`, 10 frames | 9.04 / 10.04 / 10.53 µs | 9.36 /
11.70 / 12.04 µs |
| `new Error().stack`, 50 frames | 38.2 / 43.3 / 43.7 µs | 39.2 / 46.9 /
49.3 µs |
| `new Error()`, 10 frames, no read of `.stack` | 0.45 / 0.63 / 0.68 µs
| 0.43 / 0.69 / 0.70 µs |
| Startup, `console.log` only, user CPU (25 runs) | 1.95 / 3.02 / 4.05
ms | 1.92 / 2.95 / 3.73 ms |
| Text section of the binary (`size`) | 80,675,832 bytes | 80,452,686
bytes |
The quartiles of the `new Error().stack` rows overlap. The medians are
higher on this PR at every depth (1.14, 1.09, 1.17 and 1.08 times), so
the slowdown is probably real and about 10%. `perf`, `valgrind` and
`strace` are not installed on the machine, so there are no instruction
counts.
`WeakImpl::clear()` and threads. A `Weak` may be destroyed by the thread
that holds the API lock while it has heap access, or by a GC thread
while the world is stopped. `WeakSet::allocate()` asserts the lock, and
nothing asserts it on deallocation. Bun releases heap access in one
place: `us_loop_run_bun_tick` (`epoll_kqueue.c`), between
`Bun__JSC_onBeforeWait` and `Bun__JSC_acquireHeapAccessAfterWait`, when
an idle collection is pending (#43681). In that window the thread runs
the poll and the mimalloc idle hooks. The libuv loop never releases
access.
Measured on Linux x64 with the debug build, with
`BUN_IDLE_GC_SECONDS=1,1,1`:
- A gdb breakpoint on `WeakImpl::clear()` that reads the owner of the
`JSLock`, the `hasAccessBit` of `Heap::m_worldState` and
`Heap::m_worldIsStopped`. 15 runs (12 worker, `MessagePort` and
`BroadcastChannel` test files, `napi.test.ts`, the upgrade test and a
workload with 3 workers, transfers, `fs` and `fetch`): 174,668 calls and
99 parks without heap access. 172,647 calls came from the lock owner
with heap access. 2,021 came from the collector thread with the world
stopped and the JS thread parked, all from `Heap::sweepArrayBuffers()`.
None came from the lock owner without access or from another thread.
- An assertion in `WeakBlock::deallocate` (not in this PR). Two controls
show that it fires: a call from a `Bun Pool` thread gives `ASSERTION
FAILED: m_heap.vm().currentThreadIsHoldingAPILock()`, and a call from a
JS thread that is parked without access gives `ASSERTION FAILED:
m_heap.hasHeapAccess()`. With that build, `test/js/web/workers`,
`test/js/node/worker_threads`, `test/js/web/broadcastchannel`,
`test/napi` and `test/js/web/abort` ran in full, and
`test/js/web/fetch`, `test/js/bun/http` and `test/js/web/streams` ran
for 12 minutes each: about 4,700 passing tests, child processes
included, no assertion failure.
- `napi_delete_reference` in a finalizer stays safe: `WeakSet::sweep`
keeps the block it walks linked (`WeakBlock::IterationScope`) and reads
the next block after the finalizers ran. This PR removes the stale
sentence from the comment there.
- The debug + ASAN `jsc` shell of this WebKit fails
`JSON-parse-reviver.js`: `JSONObject.cpp` and `CloneBase.h` both define
`JSC::WalkerState`, with 4 bytes and 1 byte, and `jsc.cpp` now uses
both. Bun does not have the problem: no file of Bun or of the
JavaScriptCore library includes the clone headers, and the test passes
in Bun (debug + ASAN and release). The fix for the shell is
oven-sh/WebKit#733.
`apply` and `arguments.length` (`a0e2a50e76`): upstream fixed
`sizeOfVarargs()` for a strict `arguments` object only. A sloppy one
with `length = 2 ** 32 + 1` still wraps to 1, before and after this PR
(Node throws `RangeError`). In a CommonJS file Bun drops a
function-level `"use strict"` (#40838), so the function of upstream's
example has a sloppy `arguments` object there.
Checked and unchanged: `runtime/JSType.h`, the fork's
`.github/workflows`, the release tarball names. The WebCore bindings
generator changes do not touch code that Bun's bindings use. JSC
options: `weakBlockPoolDivisor` (16) and `useB3SpecializeSelect` (true)
are new, none is removed.
Verified on Linux x64 with `bun run build:local` (Bun debug + ASAN
against the fork branch at `3a8b1bc93b`): `bun-debug -p 42` prints 42.
These files pass: `webkit-upgrade-7b485a76e9.test.ts` (18),
`webkit-upgrade-ccdcb8a026.test.ts` (5) and the five older
`webkit-upgrade-*.test.ts` files, `node/vm/vm.test.ts`, `vm-sourceUrl`,
`script-leak`, `sourcetextmodule-leak`, `sourcetextmodule-link-gc`,
`vm-script-fetcher-leak`, `happy-dom-vm-16277`,
`node/v8/capture-stack-trace.test.js` (68),
`bun/util/inspect-error.test.js` (39), `inspect.test.js`, `reportError`,
`error-gc-test`, `bun/test/stack.test.ts`, the inline snapshot tests,
`expect-stack-overflow-crash`, `cli/test/coverage.test.ts` (14),
`cli/inspect/` (`inspect`, `bun-inspector-protocol`, `HTTPServerAgent`,
`test-reporter`, `BunFrontendDevServer`, `compile-bytecode-tooling`),
`bun/jsc/bun-jsc.test.ts` (41),
`bun/sourcemap/internal-sourcemap.test.ts`, `bun/cookie/cookie.test.ts`,
`web/workers/worker.test.ts` (42),
`node-inspect-tests/parallel/util-inspect.test.js`, and
`bundler_bytecode_portable.test.ts` (22, with the new snapshot).
`web/fetch/fetch.test.ts` has 6 failures and `bun/http/serve.test.ts`
has 2. The same 8 fail with the release build of main in my container:
it runs as root and has no IPv6.
Not compiled locally: the Windows and macOS code paths. I read every
platform-specific use of `CString`, `utf8()`, `SourceCode` and the other
changed APIs in `src/`. CI builds them for real.
</details>
<details><summary>Upstream changes, 6b58d86abe..7b485a76e9 (754 commits,
154 touch JavaScriptCore, WTF, bmalloc or cmake)</summary>
Each commit appears once, under the most specific heading that applies.
### Needs an embedder-side change, or a check
- `c76c52f5b1` The parser and the bytecode keep source offsets only.
`SourceProvider` derives lines and columns from a lazy `LineStartTable`.
`SourceCode` loses `SourceCode(Ref<SourceProvider>&&, int firstLine, int
startColumn)` and the last two arguments of the five-argument form. An
old three-argument call still compiles, with its integers read as
`startOffset` and `endOffset`. Write `SourceCode(WTF::move(provider))`.
The start position of the provider now carries the line and column
offset. `JSTextPosition` keeps only `offset` and loses `line`,
`lineStartOffset` and `column()`. `ExpressionInfo::Entry::lineColumn`,
`UnlinkedCodeBlock::lineColumnForBytecodeIndex()` and
`CodeBlock::firstLineColumnOffset()` no longer exist. Call
`CodeBlock::lineColumnForBytecodeIndex()`,
`SourceProvider::positionInfoForOffset()` or
`SourceProvider::documentLineColumnForOffset()`.
`SourceCode::firstLine()` and `startColumn()` now build the line table.
`SourceCode::subExpression()`, `ScriptExecutable::recordParse()`,
`parseRootNode()` and `parseFunctionForFunctionConstructor()` lose their
line and column parameters. `Lexer<T>::isWhiteSpace()`,
`isLineTerminator()`, `convertHex()` and `convertUnicode()` become free
functions in `parser/SourceCharacters.h`. The bytecode cache layout is
not compatible: `CachedTypes.cpp` and the `ExpressionInfo` encoding drop
all line and column fields. A raw U+2028 or U+2029 inside a string
literal now starts a new line for reported line numbers.
https://bugs.webkit.org/show_bug.cgi?id=324564
- `a5bfdb3aaf` `JSGlobalObject::setStackTraceLimit()` and
`m_stackTraceLimit` no longer exist. `JSGlobalObject::stackTraceLimit()`
reads the own data property `stackTraceLimit` of the realm `Error`
constructor with `getDirect()`. It returns `std::nullopt` for a value
that is not a number. The initial `Error.stackTraceLimit` comes from
`Options::defaultErrorStackTraceLimit()` (default 100).
`Object.defineProperty(Error, "stackTraceLimit", { value: 3 })` and
inline-cached `Error.stackTraceLimit = n` writes now change the limit.
`TypeError.stackTraceLimit = 2` and a setter installed on
`Error.stackTraceLimit` no longer change it, which matches V8. The
commit message states a cost of about 3 ns per `new Error()`.
https://bugs.webkit.org/show_bug.cgi?id=324314
- `9a8a5f7d36` `Inspector::InspectorAgentBase` now derives from
`WTF::AbstractCanMakeCheckedPtr`. Each concrete agent must add a
`CanMakeCheckedPtr<T>` or `CanMakeThreadSafeCheckedPtr<T>` base,
`WTF_OVERRIDE_DELETE_FOR_CHECKED_PTR(T)` and a public
`OVERRIDE_ABSTRACT_CAN_MAKE_CHECKEDPTR(...)`. Upstream uses the
thread-safe base where teardown can run on another thread.
`JSGlobalObjectInspectorController` now holds agents as `CheckedPtr`
members and declares `m_agents` before them. `m_consoleClient` is now
`const`, so a constructor must call `lazyInitialize(m_consoleClient,
...)`. https://bugs.webkit.org/show_bug.cgi?id=324216
- `9b5592466b` JSC heap names change type from `CString` to
`ASCIICString`. This applies to the constructors of `Subspace`,
`IsoSubspace`, `CompleteSubspace`, `PreciseSubspace`,
`MarkingConstraint`, `SimpleMarkingConstraint`, `SlotVisitor` and
`AbstractSlotVisitor`, and to `MarkingConstraintSet::add()`.
`ASCIICString` has an implicit constructor from `ASCIILiteral`, but its
`const char*` constructor is `explicit`. A caller that passes a plain
literal must add `_s`. `Subspace::name()`, `MarkingConstraint::name()`,
`abbreviatedName()` and `AbstractSlotVisitor::codeName()` now return
`const ASCIICString&`. `ProfilerSupport::markStart()`, `markEnd()`,
`mark()` and `markInterval()` now take `UTF8CString&&`.
`StringPrintStream::toASCIICString()` and `WTF::toASCIICString()` are
new. https://bugs.webkit.org/show_bug.cgi?id=324651
- `58e02c19b9` `OptionsStorage::OptionString` in `runtime/OptionsList.h`
changes from `const char*` to `const char8_t*`. All string option
accessors, for example `Options::samplingProfilerPath()`, now have that
type. The option stores the raw pointer and does not copy the string.
`SourceProvider::sourceCodeDumpFilePath()` takes and returns
`UTF8CString`. WTF adds `String(const char8_t*)` and
`printInternal(PrintStream&, const char8_t*)`. Four sites that decoded
option paths as Latin-1 now decode them as UTF-8.
https://bugs.webkit.org/show_bug.cgi?id=324652
- `c17d3df6ec` `WTF::GregorianDateTime` and `wtf/GregorianDateTime.h` no
longer exist. `PlainGregorianDateTime` moves from
`JavaScriptCore/PlainGregorianDateTime.h` (namespace `JSC`) to
`wtf/PlainGregorianDateTime.h` (namespace `WTF`, with a global `using`).
`PlainGregorianDateTime::fromMilliseconds(double)` and
`currentLocalTime()` replace the old constructor and
`setToCurrentLocalTime()`. The class is a 64-bit payload without
setters, `yearDay()`, `operator tm()` or the `offsetOf...()` functions.
`DateCache::msToGregorianDateTime()`,
`DateInstance::gregorianDateTime()` and `formatDateTime()` already used
`PlainGregorianDateTime`. https://bugs.webkit.org/show_bug.cgi?id=324677
- `29a96fa550` `CString(ASCIILiteral)`, `CString(CStringBuffer*)`,
`CString::mutableSpan()`, `mutableSpanIncludingNullTerminator()` and
`grow()` are now `protected`. `CString(const std::string&)` no longer
exists. `UTF8CString`, `Latin1CString` and `ASCIICString` keep
`mutableSpan()`, `grow()` and the `ASCIILiteral` constructor public.
`safePrintfType(const Latin1CString&)` is deleted.
`JIT::compileTimeStats()` returns `UncheckedKeyHashMap<ASCIICString,
Seconds>`. https://bugs.webkit.org/show_bug.cgi?id=324791
- `99452a3d81` `CString::newUninitialized()` becomes `protected`. Call
`ASCIICString::newUninitialized()`, `UTF8CString::newUninitialized()` or
`Latin1CString::newUninitialized()`. `WTF::setCrashLogMessage()` (Cocoa)
now takes `UTF8CString&&`. `wtf/Forward.h` now exports `ASCIICString`,
`UTF8CString`, `Latin1CString` and `CStringWithEncoding` to the global
namespace. https://bugs.webkit.org/show_bug.cgi?id=324692
- `fd27a24dd1` `StringTypeAdapter<CString>` has a deleted constructor.
`makeString()` and `StringBuilder::append()` reject an untyped `CString`
at compile time. Keep the typed value (`auto s = string.utf8()`), or
pass a span. `TextStream` declares `operator<<(const CString&)` as `=
delete`. `WTF::safeStrerror()` returns `UTF8CString`, and its `length()`
is now the message length.
https://bugs.webkit.org/show_bug.cgi?id=324230
- `eefa5dc4c3` `CString` loses `CString(std::span<const
Latin1Character>)` and `CString(std::span<const char8_t>)`. For bytes
with no known encoding, write `CString(byteCast<char>(bytes))`. For
text, use a typed constructor such as `UTF8CString {
byteCast<char8_t>(bytes) }`. `URLHelpers::userVisibleURL()` now takes
`std::span<const char8_t>`. `TextStream` gains `operator<<` overloads
for the typed strings. https://bugs.webkit.org/show_bug.cgi?id=324082
- `7e37c8055a` `WTF::toHexCString()`, `SHA1::hexDigest()` and
`SHA1::computeHexDigest()` return `ASCIICString`.
`CStringWithEncoding::legacyCStringPointer()` now exists only for
`UTF8CString`. On an `ASCIICString`, call `data()`.
`Wasm::NameSection::setHash()` takes `const
std::optional<ASCIICString>&`.
https://bugs.webkit.org/show_bug.cgi?id=324076
- `8217890851` `SHA1::addBytes(const CString&)` and
`Persistence::Coder<CString>` no longer exist.
`base64EncodeToStringReturnNullIfOverflow(const CString&, ...)` now
takes `const Latin1CString&`.
https://bugs.webkit.org/show_bug.cgi?id=324322
- `f5430ef75d` Intl code carries locale identifiers as `ASCIICString`.
`canonicalizeUnicodeLocaleID()`,
`localeIDBufferForLanguageTagWithNullTerminator()`,
`IntlCache::getBestDateTimePattern()` and
`IntlCache::getFieldDisplayName()` take `const ASCIICString&`. WTF adds
`StringView::ascii()` and `StringImpl::asciiForCharacters()`.
`IntlCache::canonicalizeUnicodeLocaleID()` returns a null `String` for a
non-ASCII tag without an ICU call.
https://bugs.webkit.org/show_bug.cgi?id=324324
- `7f5ab15882` `WeakBlock` now counts its allocated, live and dead
`WeakImpl` slots, so `Heap` no longer scans logically-empty blocks.
`Heap` pools empty blocks for all `WeakSet`s, and block stealing no
longer skips a `MarkedBlock` that had `WeakBlock`s. The new option
`weakBlockPoolDivisor` (default 16) keeps one pooled block per 16
`MarkedBlock`s. `WeakImpl::clear()` moves to `WeakBlock.h`. It now
updates the free list and the counters of the block without a lock, and
it can release the block. The old `clear()` only wrote a tag.
`Heap::addLogicallyEmptyWeakBlock()`, `WeakBlock::SweepResult`,
`takeSweepResult()`, `isLogicallyEmptyButNotFree()` and
`disconnectContainer()` no longer exist. New: `Heap::weakBlockCount()`,
`$vm.weakBlockCount()`, and `alignedMalloc()` plus `tryAlignedMalloc()`
on `FastMalloc` and `FastCompactMalloc`.
https://bugs.webkit.org/show_bug.cgi?id=324140
- `7692eececb` `WeakGCSet<T>` stores raw `T*` values, like `WeakGCMap`
since `8ae0649a80`. `reconcileWeakReferencesAtGCEnd()` removes unmarked
entries in eden and full collections. Iteration yields `T*`, and each
entry is live. `WeakGCSetHash` and `WeakGCSetHashTraits` no longer
exist. `JSGlobalObject::WeakCustomGetterOrSetterHash<T>::hash()` and
`equal()` take `T*`. `WeakGCSet.h` and `WeakGCSetInlines.h` no longer
include `WeakInlines.h`. https://bugs.webkit.org/show_bug.cgi?id=324122
- `aa19dc61a0` The last parameter of the `IsoSubspace` constructor
changes from `std::unique_ptr<AlignedMemoryAllocator>&&` to
`AlignedMemoryAllocator*`, with default `nullptr`. `ISO_SUBSPACE_INIT`
needs no edit. All `IsoSubspace` objects now share
`Heap::fastMallocAllocator`, and structure subspaces share the new
`Heap::structureAllocator`. A `LocalAllocator` can thus steal an empty
`MarkedBlock` from any subspace on the same allocator. The option
`stealEmptyBlocksFromOtherAllocators` (default `true`) still controls
this. `AlignedMemoryAllocator::registerDirectory()`,
`registerSubspace()`, `firstDirectory()` and
`Subspace::findEmptyBlockToSteal()` no longer exist. This is the second
landing of `fe81aba198`, which upstream reverted in the previous range.
https://bugs.webkit.org/show_bug.cgi?id=324020
- `d2cffa902f` JSC's `CloneSerializerBase` and `CloneDeserializerBase`
now handle `ArrayBuffer`, `SharedArrayBuffer`, typed arrays, `DataView`,
`WebAssembly.Module` and shared `WebAssembly.Memory`. The
`CloneDeserializerBase` constructor has a new fourth parameter of type
`CloneDeserializationSideChannels`. `CloneSerializerBase` gets a second
template parameter `SideChannelsType`.
`ArrayBufferContents::shareWith()` and its `operator bool()` become
`const`. Bun's `SerializedScriptValue.cpp` has its own serializer and
does not use these classes.
https://bugs.webkit.org/show_bug.cgi?id=324104
### Runtime, parser and builtins
- `7b485a76e9` The bytecode compiler emits a guarded
`op_construct_varargs` for `Reflect.construct(target, args[,
newTarget])` call sites. The guard makes the ordinary call when the
callee is not the original `Reflect.construct` or the arguments fail its
validation. Microbenchmarks are 1.42x to 3.43x faster. On the fast path,
`Error.stack` has no native `construct` frame between the constructor
and the caller. The new `LinkTimeConstant::reflectConstructFunction`
shifts the values of later `LinkTimeConstant` entries, which cached
bytecode stores. https://bugs.webkit.org/show_bug.cgi?id=324411
- `a89c41295f` `StringToBigInt` now needs at least one digit after a
sign or a radix prefix. `BigInt("-")`, `BigInt(" + ")` and `BigInt("0x
")` throw a `SyntaxError`. They returned `0n` before. `0n == "-"` is now
`false`. https://bugs.webkit.org/show_bug.cgi?id=324127
- `a848db6782` A parenthesized assignment target no longer gives its
name to an anonymous function or class. `(fn) = function () {}` leaves
`fn.name` as `""`. The rule also covers `??=`, `||=`, `&&=` and
destructuring defaults. https://bugs.webkit.org/show_bug.cgi?id=324430
- `ab1caf1170` `JSArray::setLength` skips `countElements()` when the new
length fits in the current vector. A `++array.length` loop past 100000
elements was quadratic. The microbenchmark goes from 2123.65 ms to 5.31
ms. The commit message links
https://github.com/oven-sh/bun/issues/25559.
https://bugs.webkit.org/show_bug.cgi?id=324306
- `433f888ace` `Error.stackTraceLimit = NaN` now clears the internal
limit, and new errors get no `stack`. The old code clamped `NaN` to `0`.
https://bugs.webkit.org/show_bug.cgi?id=323427
- `a0e2a50e76` `sizeOfVarargs()` clamps the `length` of a strict
`arguments` object before it compares it with the argument limit.
`arguments.length = 2 ** 32 + 1; g.apply(null, arguments)` now throws
`RangeError`. https://bugs.webkit.org/show_bug.cgi?id=324226
- `da75c48c45` `ArrayBuffer.prototype.slice` uses the species watchpoint
only when the receiver belongs to the current realm.
`ArrayBuffer.prototype.slice.call(otherRealm.buffer, 0, 8).constructor`
is now `otherRealm.ArrayBuffer`.
https://bugs.webkit.org/show_bug.cgi?id=324619
- `c5c46669ba` `Intl.DateTimeFormat` sets `dayPeriod` only from pattern
characters `b` and `B`, not from the AM/PM marker `a`.
`resolvedOptions().dayPeriod` for `{ hour: "numeric", minute: "2-digit"
}` is now `undefined`. `formatToParts()` still reports the AM/PM marker
as a `dayPeriod` part. https://bugs.webkit.org/show_bug.cgi?id=324559
- `9aea44e083` `Intl.DurationFormat` uses `"always"` as the display
default for minutes and seconds that follow a `"numeric"` or `"2-digit"`
unit. `new Intl.DurationFormat("en", { hours: "numeric" }).format({
hours: 1 })` returns `"1:00:00"`, not `"1"`.
https://bugs.webkit.org/show_bug.cgi?id=324561
- `6319f7420d` `BytecodeGenerator::emitUsingBodyScope()` emits the jump
to `skipSlot` before it ends the try range of each dispose call. DFG
failed in `DFGOSRAvailabilityAnalysisPhase` for some `using` and `await
using` code before. https://bugs.webkit.org/show_bug.cgi?id=324005
- `df94b6ccbb`, `9a38124281` Upstream `JSBigInt` gets Toom-3
multiplication (smaller operand of at least 508 digits) and
Schönhage-Strassen FFT multiplication. Both are ports of V8. The fork
already has both, with the `InterruptCheck` plumbing, so the merge keeps
the fork's versions. https://bugs.webkit.org/show_bug.cgi?id=323587
https://bugs.webkit.org/show_bug.cgi?id=324209
- `d2d61f8871` `JSBigInt` multiplication (`multiplySchoolbook`,
`multiplySpecialLow`, `multiplySpecialHigh`, `multiplyComba` and the
fixed-size variants) uses `std::span` in place of raw pointers. Results
do not change. https://bugs.webkit.org/show_bug.cgi?id=324494
- `ea153e64fb`, `d7240f488f`, `34ccaa804c` `CloneSerializerBase` and
`CloneDeserializerBase` follow JSC throw-scope style and stop at the
first exception. The `jsc` shell adds `structuredClone(value, { transfer
})`. Bun has its own serializer.
https://bugs.webkit.org/show_bug.cgi?id=324423
https://bugs.webkit.org/show_bug.cgi?id=324429
https://bugs.webkit.org/show_bug.cgi?id=324474
- `2a24a9aa7c` `JSClassCreate()` retains
`JSClassDefinition.parentClass`, and the `OpaqueJSClass` destructor
releases it. https://bugs.webkit.org/show_bug.cgi?id=319684
- `8ca47457ed` The new private header `JavaScriptCore/JSStringRefCPP.h`
adds `utf8CString(JSStringRef)` and `createJSString()`.
https://bugs.webkit.org/show_bug.cgi?id=324435
- `18073b9f6c` `JSTypedArrayConstructors.h` declares the explicit
`s_info` specializations for each typed array constructor and for
`JSDataViewConstructor`. Include it before a call to `info()` on these
classes. https://bugs.webkit.org/show_bug.cgi?id=324514
- `125543708a` `TypeProfiler::typeInformationForExpressionAtOffset()` no
longer dereferences a null `TypeLocation`.
https://bugs.webkit.org/show_bug.cgi?id=323314
- `c5fe81278b` `JSObject::crashDueToEmptyValueAtValidOffset` reports new
diagnostic data. The crash reason constant changes to
`0x100900d0ff5e7bad`. https://bugs.webkit.org/show_bug.cgi?id=324194
### RegExp (Yarr)
- `7aeed1e3bd` Non-global `String.prototype.replace(regexp, "")` returns
a substring cell of the subject when the match touches either end.
`string-replace-regexp-strip-prefix` is 2.30x faster.
https://bugs.webkit.org/show_bug.cgi?id=323409
- `ae0a88e6c1` A `\k<name>` back reference in a lookbehind no longer
matches empty when its group is the last group opened.
`/(?<n>.)..(?<=\k<n>.)/.exec("abc")` now returns `null`.
https://bugs.webkit.org/show_bug.cgi?id=324402
- `d8a2cff958` The DFG and FTL anchored first-character filter for
`RegExp.prototype.test` runs only when `lastIndex` is an Int32. Other
`lastIndex` values take the slow path, so the `ToLength(lastIndex)` side
effects stay observable after tier-up.
https://bugs.webkit.org/show_bug.cgi?id=324307
- `d22fa241f1` `SpeculativeJIT::emitRegExpMinimumLengthFilterGuards()`
no longer asserts when base and argument share a register, as in
`re.test(re)`. Debug builds only.
https://bugs.webkit.org/show_bug.cgi?id=324211
### JIT (LLInt, Baseline, DFG, FTL, B3, Air)
- `e57b0d1670` DFG stores OSR exits as a delta-encoded byte stream,
`DFG::OSRExitStream`, and decodes a `DFG::OSRExit` on demand.
`DFG::JITCode::m_osrExit` becomes `m_osrExits`. Exit data in one
JetStream3 run drops from 47.7 MB to 6.3 MB.
https://bugs.webkit.org/show_bug.cgi?id=323407
- `219167e2b4`, `7a5cfe078b` A linked DFG or FTL OSR exit entrance is
now one near call, and the return address identifies the exit. A DFG
entrance shrinks from 8 to 4 bytes on ARM64 and from 11 to 5 bytes on
x86_64. An FTL entrance shrinks from 20 to 4 bytes on ARM64 and from 10
to 5 bytes on x86_64. `DFGOSRExitBase.h` adds `static_assert(isARM64()
|| isX86_64())`. https://bugs.webkit.org/show_bug.cgi?id=324137
https://bugs.webkit.org/show_bug.cgi?id=324407
- `4dbb362ca1` `CodeBlock::updatePredictionsConcurrently()` updates
value profile and array profile predictions without a lock. The Baseline
JIT compiler thread and concurrent GC marking call it, so array profile
updates also move off the main thread.
https://bugs.webkit.org/show_bug.cgi?id=324016
- `418114c05c` `abstractAccess()` calls `entry.prepareToWatch()` when it
resolves a put to a `ClosureVar`. DFG could fold a module variable to a
stale value after an import cycle. This is the upstream form of the
fork's #624, and the merge takes upstream's test files.
https://bugs.webkit.org/show_bug.cgi?id=324124
- `5d1761dffb` DFG SSA lowering emits a separate `CheckInBounds` node
for `StringAt` and `StringCodePointAt`. FTL could remove the bounds
check together with an unused node before. Then `s.codePointAt(i) ===
undefined` stayed `false` for an out-of-bounds `i`.
https://bugs.webkit.org/show_bug.cgi?id=323640
- `54277a51f5` The DFG bytecode parser checks for `BadStringType` exit
sites before it compiles a by-val access as `CheckIdent` plus by-id. A
non-atom key such as `name.toLowerCase()` caused the same OSR exit after
each recompilation. The microbenchmark is 8.03x faster.
https://bugs.webkit.org/show_bug.cgi?id=323839
- `51a07f95fd` The DFG abstract interpreter and the DFG and FTL
`compileSpread()` take the original `Set` structure from the realm of
`node->child1()`. With a cross-realm `Set`, the compiler could treat
`[...set]` as free of side effects.
https://bugs.webkit.org/show_bug.cgi?id=321705
- `4dcc426f83` `B3LowerToAir` checks `crossesInterference()` before it
fuses or moves an `AtomicWeakCAS` or `AtomicStrongCAS` into a later
`Branch` or compare. A wasm `i32.atomic.rmw.cmpxchg` could move past a
`memory.grow` and use a stale memory base.
https://bugs.webkit.org/show_bug.cgi?id=319842
- `9c6d017806` `doneLocation` moves from `PropertyInlineCache` to
`RepatchingPropertyInlineCache`. `HandlerPropertyInlineCache` shrinks
from 88 to 80 bytes. `CodeBlock::findPropertyCache()` no longer exists.
https://bugs.webkit.org/show_bug.cgi?id=324424
- `e87ea0e64e` The specialize-select transform leaves
`B3::ReduceStrength` and becomes the new phase `B3::specializeSelect()`.
The new option `useB3SpecializeSelect` (default `true`) controls it.
https://bugs.webkit.org/show_bug.cgi?id=324673
- `95cec227df`, `7ae08af38b`, `7825a32d2b`, `fda68a8bb0`, `d6cc5eaa35`,
`d7fa43a33f`, `0aad9d201d`, `ba0e7b4024` Compile-time work in Air and
B3: `LiveRange` uses `Vector<Interval, 4>`, `IntervalSet` gets a bulk
constructor, `WTF::Liveness` gets a streaming adapter mode,
`fixObviousSpills` tracks aliased registers in register sets, the dense
liveness budget rises from 4 MB to 8 MB,
`IntervalSet::verifyCoverageConsistency` is a no-op in release builds,
and `B3::Procedure::deleteAllVariables()` is new. Generated code does
not change. https://bugs.webkit.org/show_bug.cgi?id=324009
https://bugs.webkit.org/show_bug.cgi?id=324750
https://bugs.webkit.org/show_bug.cgi?id=324795
https://bugs.webkit.org/show_bug.cgi?id=324695
https://bugs.webkit.org/show_bug.cgi?id=324716
https://bugs.webkit.org/show_bug.cgi?id=324688
https://bugs.webkit.org/show_bug.cgi?id=324759
https://bugs.webkit.org/show_bug.cgi?id=325058
### WebAssembly
- `5ad2bece76` IPInt handler slots shrink from 256 to 128 bytes on
ARM64, and large handlers jump to out-of-line code. offlineasm gains
`bc`, `loadbinc`, `loadbpreinc` and `orlshifti`.
`LowLevelInterpreter.cpp` adds `OFFLINE_ASM_ALIGN_TRAP_128` for Windows
ARM64. The commit message reports about 5% faster IPInt execution.
https://bugs.webkit.org/show_bug.cgi?id=324059
- `b9d477930e` `Heap::finalizeWasmCalleeCleanup()` calls
`WTF::crossModifyingCodeFence()` before it releases Wasm callees.
https://bugs.webkit.org/show_bug.cgi?id=320401
- `778a559d30` Both WasmToJS stubs also store the IPInt `MC` register in
the new `Wasm::WasmToJSIPIntMCSlot`. `Wasm::WasmToJSScratchSpaceSize`
grows from 16 to 32 bytes.
https://bugs.webkit.org/show_bug.cgi?id=324832
- `08f5b5c35e` `JSWebAssemblyInstance::setDebugId()`, `debugId()` and
`m_debugId` exist only under `ENABLE(WEBASSEMBLY_DEBUGGER)`, which
JSCOnly does not set. https://bugs.webkit.org/show_bug.cgi?id=324189
- `f2bd414de3`, `6452e03b9f`, `d8d3577549`, `74efecb8e0`, `a57cde3b59`,
`0aac8dcd47`, `9f9aae3434`, `073031147c` Wasm debugger fixes and the new
`qWasmStackValue` packet. All of this code is under
`ENABLE(WEBASSEMBLY_DEBUGGER)`, which only `PLATFORM(MAC)` sets.
### GC and memory
- `6c0de596d5` `BlockDirectory::findBlockForAllocation()` prefetches the
`MarkedBlock` header before the sweep that builds the free list.
`BlockDirectory::m_blocks` stores `std::pair<MarkedBlock::Handle*,
MarkedBlock*>`. `MarkedBlock::Handle` moves the rarely used `m_weakSet`
behind `m_block`. https://bugs.webkit.org/show_bug.cgi?id=324632
### WTF and bmalloc
- `6c6e928fdc` `WTF::loadLoadFence()` and `WTF::loadStoreFence()` emit
`dmb ishld` on ARM64. They emitted the full `dmb ish` barrier before.
https://bugs.webkit.org/show_bug.cgi?id=324352
- `ce646f1f85`, `3ff034369d`, `2d8b6e5a48`, `95a960a3ae`
`SAFE_WTFLOGALWAYS`, `LOG`, `RELEASE_LOG`, `ASSERT_WITH_MESSAGE` and the
signpost macros convert each argument with `WTF::logPrintfType()`. A
call site can pass a typed C string for `%s`. The helpers move from
`wtf/StdLibExtras.h` to `wtf/Assertions.h`. Existing callers need no
edit. https://bugs.webkit.org/show_bug.cgi?id=324090
https://bugs.webkit.org/show_bug.cgi?id=324142
https://bugs.webkit.org/show_bug.cgi?id=324287
https://bugs.webkit.org/show_bug.cgi?id=324236
- `f83706791b` `CStringWithEncoding::isolatedCopy()` is new.
`CStringBuffer` does not have a thread-safe reference count.
https://bugs.webkit.org/show_bug.cgi?id=319652
- `2d30c8e50c` `StringImpl::simplifyWhiteSpace()` returns `*this`
without allocation when the string is already simplified.
https://bugs.webkit.org/show_bug.cgi?id=324694
- `fbc14a1c5a` `wtf/text/StringCommon.h` adds a SIMD
`countMatchedCharacters()` overload for a compile-time character set.
https://bugs.webkit.org/show_bug.cgi?id=324640
- `77e8645084` `WTF::switchOn()`, `switchOnTupleAtIndex()` and
`WTF::apply()` mark their functor parameters `NOESCAPE`.
https://bugs.webkit.org/show_bug.cgi?id=324320
- `9e74021a2f` `Borrow::~Borrow()` asserts (debug only) that the object
is still borrowed when the borrow ends.
https://bugs.webkit.org/show_bug.cgi?id=324545
- `01f33be1d1` `determineTZoneMallocFallback()` selects
`ForceFastMalloc` when libpas uses MTE (Apple internal SDK on arm64e
only). https://bugs.webkit.org/show_bug.cgi?id=323981
### Build system and platform
- `a2a6f364bf` `WebKitCompilerFlags.cmake` adds `-fwrapv` for GCC, Clang
and `clang-cl` builds when the compiler accepts it. Signed integer
overflow in JSC, WTF and bmalloc code now wraps. Bun compiles its own
C++, which includes JSC inline code, without `-fwrapv`.
https://bugs.webkit.org/show_bug.cgi?id=324351
- `a306abc2c0` `Source/bmalloc/mimalloc/CMakeLists.txt` calls
`add_subdirectory(mimalloc EXCLUDE_FROM_ALL)`. `USE_MIMALLOC=ON` stops
the configure step when CMake is older than 3.25.
https://bugs.webkit.org/show_bug.cgi?id=324458
- `8009ddd215` `wtf/cocoa/MemoryFootprintCocoa.cpp` implements
`memoryFootprint()` with a call to a new overload,
`memoryFootprint(mach_port_t)`. `wtf/MemoryFootprint.h` declares that
overload only under `PLATFORM(COCOA)`, but the JSCOnly port compiles the
file on all Apple targets. The fork widens the guard to `OS(DARWIN)`.
https://bugs.webkit.org/show_bug.cgi?id=323690
- `fd4a9d09bf` `WebKitCommon.cmake` sets
`CMAKE_POSITION_INDEPENDENT_CODE` only when `NOT APPLE`. The fork keeps
its `NOT USE_BUN_JSC_ADDITIONS` condition as well.
https://bugs.webkit.org/show_bug.cgi?id=325064
- `5a819a7b96`, `d00124d9d7`, `6f39f11c5e` `WebKitCommon.cmake` records
the build settings with `set-webkit-configuration` when the build
directory is under the WebKit product directory. The step is not fatal,
and Bun's build directory does not match.
https://bugs.webkit.org/show_bug.cgi?id=324135
https://bugs.webkit.org/show_bug.cgi?id=324558
https://bugs.webkit.org/show_bug.cgi?id=324648
- `5bb1c6d49c` `WebKitCommon.cmake` derives `WTF_CPU_*` from
`CMAKE_OSX_ARCHITECTURES` on Apple hosts when that variable names one
architecture. This corrects an x86_64 build on an arm64 Mac, including
the offlineasm backend choice.
https://bugs.webkit.org/show_bug.cgi?id=319646
- `94ff070fff` `_WEBKIT_ADD_CODE_SIGN` reads entitlements from the
`CODE_SIGN_ENTITLEMENTS` target property. The fork keeps its early
`return()` for `CMAKE_CROSSCOMPILING`.
https://bugs.webkit.org/show_bug.cgi?id=324292
- `5cc3f23625` `WebKitCompilerFlags.cmake` no longer sets
`CMAKE_COMPILE_WARNING_AS_ERROR` for `DEVELOPER_MODE` builds on Windows.
https://bugs.webkit.org/show_bug.cgi?id=324157
- `61b575f0d0`, `2834de45ef`, `78c1083fa2`, `27504b2544` Build fixes and
one removed CMake option (`ENABLE_SWIFT_DEMO_URI_SCHEME`). No effect on
a JSCOnly build.
### Reverted within the range
- `b34e745e23` Upstream reverts the Linux main-thread detection from
317619@main (`getpid() == gettid()`), which aborted hosts that start WTF
on another thread. The fork had disabled that path under
`USE(BUN_JSC_ADDITIONS)`. The merge drops the fork's guards.
https://bugs.webkit.org/show_bug.cgi?id=322394
- `6ba0c9f709` and `d6e6a0fc1f` (`wtf/EscapableByteSpan.h`),
`14d632bf1e`, `0d533fd7f0` and `4dbba08d80` (Xcode PGO settings),
`d6f958d63e`, `e13c60e3d5` and `5a1e7b740f` (a web preference),
`3f7093e05c` (a web preference). No net effect on JSC.
### WebCore-only or no effect on a JSC embedder
`0d729748ef`, `162c4db3f1`, `a91d249a05`, `bf4e2de4fd`, `4ebc2a99c1`,
`3e95a187a1`, `648bbc69d1`, `3e1e77d2ba`, `a0df39e48d`, `fa1ff79d59`,
`27621d5adf`, `56909e17f9`, `d49b603f37`, `55f5311df8`, `13d5142b78`,
`484abf80fd`, `e887d63b22`, `d07436ebd4`, `49649b12d8`, `6307d48da4`,
`1aa6a33856`, `d0755e594a`, `7c5bf4eb1f`, `6b34ce7a2b`, `9c43b4a109`,
`56677f10e9`, `e25f645b0f`, `5fa37cf1fa`, `12a60d1a39`, `88ebf35179`,
`fc260f4e1c`, `263f9383d1`, `a749c7f864`, `d9eaeec654`, `06c8bf6974`,
`1666648452`, `a7c26d671b`, `6c721682be`, `3a633e3e57`, `02ad1221be`,
`36a3ac72aa`, `3113b23fc2`, `9467789fc1`, `41a9dfe94e`, `0ac65b1a46`.
</details>
<details><summary>Upstream changes, ccdcb8a026..6b58d86abe (216 commits,
47 touch JavaScriptCore, WTF, bmalloc, cmake or JSTests)</summary>
#42666 has the full list for this part of the range (runtime, GC,
RegExp, JIT, WebAssembly, WTF and build changes). These are its entries
that need an embedder-side change or a check.
Each entry says what a caller must change. Some entries need a check
only, and say so.
- `74b519d7f9` `WTF::String(std::span<const char>)` is now private, next
to `String(const char*)`, because `char` carries no encoding. Callers
name the encoding: `String::fromLatin1(std::span<const char>)` (new
overload), `String(std::span<const Latin1Character>)`,
`String::fromUTF8(...)` or `String(ASCIILiteral)`. In the same commit
`WTF::enumName()` and `WTF::enumTypeName()` (`wtf/EnumTraits.h`) return
`ASCIILiteral`. They returned `std::span<const char>` before, so callers
now test `isEmpty()` and not `empty()`.
https://bugs.webkit.org/show_bug.cgi?id=323650
- `7bd7b6dfad` `CString` gains `legacyCStringPointer()`, which returns
the same `const char*` as `data()`. Every upstream `utf8().data()` call
site moves to it. `CStringWithEncoding::characters()` (the `const char*`
accessor of `UTF8CString` and `ASCIICString` from `5f14e32e57`) is
renamed to `legacyCStringPointer()`. No type changes in this commit. It
is the mechanical half of the retype of `String::utf8()`. The retype
itself is `00130dc2f3`, the next entry.
https://bugs.webkit.org/show_bug.cgi?id=323722
- `00130dc2f3` `String::utf8()`, `StringImpl::utf8()`,
`StringView::utf8()` and `Identifier::utf8()` now return `UTF8CString`.
They returned `CString` before. `UTF8CString` is the alias
`CStringWithEncoding<char8_t>` (alias in `wtf/Forward.h`, class in
`wtf/text/CString.h`). The siblings are `Latin1CString`
(`Latin1Character`) and `ASCIICString` (`char`). `CStringWithEncoding`
is a final class that derives publicly from `CString` and adds no data
member. It hides the `CString` accessors so that the character type
carries the encoding. `data()` still exists, but for a `UTF8CString` it
returns `const char8_t*`. `span()` and `spanIncludingNullTerminator()`
return `std::span<const char8_t>`, and `mutableSpan()` returns
`std::span<char8_t>`. `legacyCStringPointer()` returns the same address
as `const char*`. It is the accessor for `%s` arguments and C functions,
and `Latin1CString` does not have it. `length()`, `isNull()`,
`isEmpty()`, `hash()` and `toStdString()` come from `CString` and do not
change. A call such as `s.utf8().data()` that feeds a `const char*`
parameter must become `s.utf8().legacyCStringPointer()`. The same
applies to `s.utf8().span().data()`. For a `std::span<const char>`,
write `byteCast<char>(utf8.span())`. A `const void*` parameter
(`fwrite`, `write`) still accepts `data()`. The `SAFE_PRINTF` and
`SAFE_FPRINTF` macros accept the `UTF8CString` itself. `PrintStream` has
no overload for `const char8_t*`, so `dataLog()` must get the
`UTF8CString` itself or the `String`. A `UTF8CString` converts
implicitly to `CString` (derived to base). So `CString c = s.utf8()`
still compiles and `c.data()` is `const char*`, but the encoding is
lost. `String` gains an implicit constructor from `const
CStringWithEncoding<CharacterType>&` that decodes by character type.
`CStringWithEncoding` gains explicit constructors from `const
std::string&` and from a null-terminated `const CharacterType*`.
`wtf/text/StringCommon.h` gains `unsafeSpan(const char8_t*)`.
https://bugs.webkit.org/show_bug.cgi?id=323846
- `9b09294076` Upstream removes about 850 `legacyCStringPointer()` call
sites where the destination already accepts a `String`. `LOG` with `%s`
becomes `LOG_WITH_STREAM`, `EXPECT_STREQ` becomes `EXPECT_EQ` in tests,
and `dataLog()` gets the `String`. Almost all edits are in WebCore,
WebKit and TestWebKitAPI. In JSC and WTF the commit edits two lines.
`Options::dumpAllOptions()` and the truncation path of
`printInternal(PrintStream&, const CString&)` now print a `String`
directly. No WTF or JSC function changes a parameter type or a return
type. No caller edit is needed.
https://bugs.webkit.org/show_bug.cgi?id=323859
- `7189f73167` `StringPrintStream::toCString()` is renamed to
`toUTF8CString()` and returns `UTF8CString`. The function template
`WTF::toCString(...)` is renamed to `WTF::toUTF8CString(...)` in the
same way. The old names have no alias. `printInternal(PrintStream&,
const CString&)` is now `= delete`, and the non-const `CString&`
overload is removed. So `out.print(cstring)`, `dataLog(cstring)` and
`dataLogLn(cstring)` do not compile for an untyped `CString`. New
overloads print `const UTF8CString&`, `const ASCIICString&` and `const
Latin1CString&`. UTF-8 and ASCII bytes go through unchanged, and Latin-1
is transcoded to UTF-8. To replace `out.print(someCString)`, keep the
typed value (`auto s = string.utf8()`, `toUTF8CString(...)`,
`string.ascii()`) and print that. Or print the `String` or `StringView`
itself, or pass `cstring.data()` as `const char*`. These bytecode
helpers now return `UTF8CString`: `CodeBlock::inferredName()`,
`CodeBlock::sourceCodeForTools()`, `CodeBlock::sourceCodeOnOneLine()`,
`InlineCallFrame::inferredName()`, `UnlinkedSourceCode::toUTF8()`,
`reduceWhitespace()`, `ArrayProfile::briefDescription()`,
`ValueProfile::briefDescription()`, `BytecodeDumper::registerName()` and
`constantName()`. These JIT and runtime helpers do the same:
`MacroAssemblerCodeRef::disassembly()`, `Compilation::disassembly()`,
`ExceptionScope::unexpectedExceptionMessage()`, `Air::Special::name()`,
`JITPlan::signpostMessage()`, `Wasm::Plan::signpostMessage()`,
`DFG::nodeListDump()`, `nodeMapDump()` and `nodeValuePairListDump()`. In
WTF, `sortedListDump()`, `sortedMapDump()`, `BackwardsGraph::dump()`,
`SingleRootGraph::dump()` and `StringHashDumpContext::brief()` return
`UTF8CString`. `Identifier::ascii()` and
`StringHashDumpContext::getID()` return `ASCIICString`, and
`Structure::dumpBrief()` takes `const ASCIICString&`. `PerfLog::log()`,
`GdbJIT::log()`, `Profiler::Database::logEvent()` and
`Profiler::Compilation::addDescription()` take `const UTF8CString&`, and
`DFG::validate()` takes a `UTF8CString`. As a side effect
`CodeBlock::inferredNameWithHash()`,
`SamplingProfiler::reportTopBytecodes()` and
`DebuggerCallFrame::functionName()` no longer decode UTF-8 function
names as Latin-1. https://bugs.webkit.org/show_bug.cgi?id=323960
- `25f7ce345a` `FileSystem::fileSystemRepresentation(const String&)`
returns `UTF8CString`. It returned `CString` before. A caller that
passed `.data()` to `open()`, `stat()` or a similar C function must call
`.legacyCStringPointer()`. On Windows the function now converts with
`CP_UTF8`. It converted with `CP_ACP` (the active ANSI code page)
before. The GLib functions `currentExecutablePath()`,
`currentExecutableName()` and `webkitTopLevelDirectory()` also return
`UTF8CString`, and Cocoa gains `currentExecutableName()`.
`createTemporaryFileInDirectory()` (Cocoa only) returns
`std::pair<FileHandle, String>`. `wtf/StdLibExtras.h` gains
`safeNSStringPrintfType()` and the `SAFE_WTFLOGALWAYS` macro.
`CStringWithEncoding` gains `createNSString()` for Objective-C++ code.
The JSC callers (`dumpJITMemory()`, `API/JSScript.mm`) move to
`legacyCStringPointer()`. https://bugs.webkit.org/show_bug.cgi?id=324034
- `8ae0649a80` `WeakGCMap<Key, Value>` now stores a raw `Value*` per
entry. It stored a `Weak<Value>` before, which is a pointer to a
separate `WeakImpl` that the heap reaps in each collection. `ValueType`
is `ValueArg*`. So `set(key, value)` takes a raw pointer, and the
`ensureValue()` functor returns a raw pointer. `find()->value` is a raw
pointer with no `.get()`. `isEmpty()` is removed. `pruneStaleEntries()`
is replaced by `reconcileWeakReferencesAtGCEnd(VM&, CollectionScope)`.
`WeakGCMap.h` no longer includes `Weak.h`, and `WeakGCMapInlines.h` no
longer includes `WeakInlines.h`. A caller that wrote `map.set(key,
Weak<T>(cell))` must write `map.set(key, cell)`. A file that got
`JSC::Weak` through `WeakGCMap.h` must include `<JavaScriptCore/Weak.h>`
itself. Old design: `WeakBlock::reap` cleared each `Weak<>` in every
collection, and `pruneStaleEntries()` removed the cleared entries in
full collections only. New design: `Heap::runEndPhase()` calls
`Heap::reconcileWeakGCHashTables()`, and each table tests its values
with `Heap::isMarked()`. A full collection visits every registered table
and removes each entry whose value is null or not marked. An eden
collection visits only the tables on the new list
`Heap::m_dirtyWeakGCHashTables`. `set()` and `ensureValue()` put the map
on that list through `WeakGCHashTable::markDirty(VM&)`. In an eden
collection the map only sets a dead value to null and does not rehash.
`get()`, `find()`, `contains()` and `ensureValue()` treat the null entry
as absent, and the next full collection removes it. A table that gained
no entry since the last collection is skipped. All its values are old,
and an eden collection cannot free them. `WeakGCHashTable`
(`runtime/WeakGCHashTable.h`) now derives from
`BasicRawSentinelNode<WeakGCHashTable>`. A subclass must override
`reconcileWeakReferencesAtGCEnd(VM&, CollectionScope)` in place of
`pruneStaleEntries()`. It must call `markDirty(vm)` when it adds an
entry, if eden collections must visit it.
`Heap::unregisterWeakGCHashTable()` also takes the table off the dirty
list. `WeakGCSet` keeps `Weak<>` entries and removes them in full
collections only, as before.
https://bugs.webkit.org/show_bug.cgi?id=323958
- `b8d7e24add` The MarkedBlock warm-up (prefault) supply moves from JSC
into libpas. The old code was `WarmUpBlockProvider` in
`heap/FastMallocAlignedMemoryAllocator.cpp`. It ran a `JSCWarmUp`
`AutomaticThread` that allocated blocks with
`tryFastCompactAlignedMalloc()` and wrote one byte per page. It worked
with every `fastMalloc` backend. The new code is
`bmalloc_prefault_supply.c` and `bmalloc_prefault_supply.h` in libpas,
and JSC calls it only under `#if USE(LIBPAS)`. So upstream, a build
whose `fastMalloc` is mimalloc or the system allocator gets no
prefaulted blocks. In that build `tryAllocateAlignedMemory()` calls
`tryFastCompactAlignedMalloc()` directly. With libpas,
`tryAllocateAlignedMemory()` returns
`bmalloc_prefault_supply_try_allocate()` for block-sized requests. The
supply is a fixed array of at most 64 slots
(`BMALLOC_PREFAULT_SUPPLY_MAX_BLOCKS`). Takers and the filler exchange
slots with atomic operations and no lock. A mutex and a condition
variable only wake or start the filler. The filler is a detached
pthread. It allocates with
`bmalloc_try_allocate_with_alignment_inline()` and touches pages with
the new `pas_page_malloc_populate()`. After one idle interval with no
demand it frees all blocks and exits, and a later take starts a new
thread. The options `useWarmUpMarkedBlocks` (true),
`warmUpMarkedBlockCount` (32) and `warmUpMarkedBlockIdleTimeout` (10
seconds) keep their names and defaults. JSC copies them once into
`bmalloc_prefault_supply_target` and
`bmalloc_prefault_supply_idle_timeout_in_milliseconds`.
`$vm.warmUpMarkedBlockState()` is removed.
`$vm.warmUpMarkedBlocksAreEnabled()` and `$vm.warmUpMarkedBlockCount()`
replace it, and `$vm.setWarmUpMarkedBlockAllocationShouldFail()` stays.
In C++, `warmUpMarkedBlockStateForTesting()`, `WarmUpMarkedBlockPhase`
and `WarmUpMarkedBlockState` are removed.
`warmUpMarkedBlocksAreEnabledForTesting()` and
`warmUpMarkedBlockCountForTesting()` are added, and without libpas they
return `false` and 0. `pas_thread.h` (the Windows pthread shim) gains
include guards, `PTHREAD_MUTEX_INITIALIZER`, `PTHREAD_COND_INITIALIZER`,
`extern "C"` and `PAS_API` exports. The new source file is listed in
`Source/bmalloc/CMakeLists.txt` and
`Source/bmalloc/libpas/CMakeLists.txt`.
https://bugs.webkit.org/show_bug.cgi?id=323480
- `2aedf51ba6` `WTF::UUID::emptyValue` and `UUID::deletedValue` become
private. The constructor `UUID(HashTableEmptyValueType)` becomes private
too. Only `HashTraits<UUID>` and `MarkableTraits<UUID>` (now friends)
can build the empty value. `UUID(HashTableDeletedValueType)` stays
public. `UUID(UInt128)` now release-asserts that the value is not 0
(empty) and not 1 (deleted), so `UUID { 0 }` crashes. `UUID(uint64_t
high, uint64_t low)` now rejects the empty value as well as the deleted
value. Code that needs "no UUID" must use `Markable<WTF::UUID>` or
`std::optional<WTF::UUID>`. `createVersion4()`, `createVersion4Weak()`,
`createVersion5()`, `parse()`, `parseVersion4()` and `toString()` do not
change. https://bugs.webkit.org/show_bug.cgi?id=323944
- `a371ed3141` A caller can no longer construct a `WTF::UUID` from raw
bits. `UUID(std::span<const uint8_t, 16>)` and `UUID(UInt128)` become
private. `UUID(std::span<const uint8_t>)` and `UUID(uint64_t, uint64_t)`
are removed. New factories replace them. `static std::optional<UUID>
tryCreate(std::span<const uint8_t>)` returns `std::nullopt` if the size
is not 16 or the value is reserved (0 or 1). `static std::optional<UUID>
tryCreate(uint64_t high, uint64_t low)` does the same for two halves.
`static consteval UUID createConstant(uint64_t high, uint64_t low)` is
for hardcoded constants, and a reserved value is a compile error. The
static `UUID::isValid(uint64_t, uint64_t)` is removed, and the member
`isValid()` stays. The only raw constructor call in JSC
(`jscJITNamespace` in `jit/ExecutableAllocator.cpp`, under
`HAVE(KDEBUG_H)`) moves to `createConstant()`. The random, parse and
string functions do not change. A caller that only uses
`createVersion4()`, `createVersion4UUIDString()`, `parse()` or
`toString()` needs no edit.
https://bugs.webkit.org/show_bug.cgi?id=324032
- `2d4a4717af` `wtf/UUID.h` gains the struct `UUIDCanonicalForm` (two
`uint64_t` fields, `high` and `low`) and
`StringTypeAdapter<UUIDCanonicalForm>`. The adapter holds the 8-4-4-4-12
lowercase hex layout. `StringTypeAdapter<UUID>` now derives from it and
passes `uuid.high()` and `uuid.low()`. The output of `makeString(uuid)`
does not change. The only new user is the FIDO AAGUID logging in WebKit.
No caller edit is needed. https://bugs.webkit.org/show_bug.cgi?id=324075
- `6103d1b95a` `makeStringByJoining(std::span<const String>, …
main has the upgrade to upstream WebKit 7b485a7 (#725) and source positions that are offsets only (321541@main, #734). Positions. A line and column are no longer kept in ExpressionInfo, in a function executable or in a SourceCode. They are worked out from an offset by the SourceProvider's LineStartTable. While a static heap is built its providers do not exist yet, so nothing there can ask one. - StaticHeap::build() has a LineStartTable of its own for each module and builtin, filled from the line starts that come with the code, and passes it down to makePositions(). - Code comes without line starts if its source is under 1,024 characters, because such a text is scanned as cheaply. The heap's builder has no text to scan: VM::BytecodeGenerationOptions::keepLineStartsOfEverySource, for a VM that generates bytecode to be compiled ahead of time. - A module's code block stays in the heap, and gives its line starts to the provider at run time. They are borrowed from the payload, so it gets a copy of them in the heap's data. Without bytecode it needs none: every position then comes from makePositions(). - ExpressionInfo::lineColumnInTextForInstPC() remembers its results, as lineColumnForInstPC() did. It must not when it is in the static heap, which may be read-only. - The SourceCode that is made up for a short-form executable can no longer say where the function starts, so FunctionExecutable::firstLine() asks ScriptExecutable, which knows about the short form. - A builtin is encoded when the embedder is built, so one under 1,024 characters has no line starts in the heap. Its positions are all on its first line. UnlinkedFunctionExecutable is 16 bytes smaller, and whatIsSharedByStaticExecutables() no longer states its size. The rest is names: toCString() is toUTF8CString(), an option that is a string is a const char8_t*, the names of marking constraints are ASCIILiterals.
Upstream range: 7b485a7..4611b64 (672 commits, 153 of them touch JavaScriptCore, WTF, bmalloc or cmake). The previous upgrade (#725) landed as a squash, so the merge base that git finds with upstream was still ccdcb8a. This merge uses 7b485a7 as its base: the tree of the squash commit 7465044 equals the tree of 3a8b1bc, the head of bun/upgrade-to-7b485a76e9. Upstream is a parent of this commit, so the next merge finds the right base without help. 48 files had conflicts. The decisions that are not mechanical: - for-of and destructuring without an iterator object. Upstream landed its own form of the first half of #630 (35637c6, 45d9af5, bb73af4, 5330149, 39f7f21). Upstream's implementation is the only one now. Gone: Options::useUnboxedFastArrayIteration, VM::fastArrayUnboxedSentinel, the fork's LLInt, Baseline and DFG paths, and its op_iterator_close_check (upstream's has metadata). Kept: the second half of #630 (one RegExpObject per /x/.test(s) literal site), the RELEASE_ASSERTs for a sentinel that reaches generic code, and the treatment of op_iterator_close_check in the bytecode optimizer and in CodeBlock::bytecodeCost(). The format revision of the persistent bytecode cache is 13, because opcode numbers changed. - The Collector split (c2fa192 and the series after it). Every fork change in the code that moved out of Heap.cpp is applied where that code lives now: the CodeBlock aging stamp in Collector::runBeginPhase, releaseUnusedSharedBaselineCode() in Heap::pruneDeadReferences, and Heap::isIdleCollection() reads the current request of the Collector. - GCRequest::didFinishEndPhase stays. Upstream removed it as unused (a516249), but Bun sets it on the idle collections it requests. Collector::runEndPhase calls it right after Heap::didFinishCollection(). - Source positions. Upstream's locked cache of decoded ExpressionInfo entries (c59d70e) replaces the fork's unlocked map from instruction to line and column (#734). CodeBlock::lineColumnForBytecodeIndexConcurrently is gone, because upstream's lookup is safe on any thread (93ebfac). Kept from #734: the line starts that come with the code and with the bytecode cache, the encoded table, and BuiltinsSourceProvider. - Error.captureStackTrace builds its string lazily (696c406). ErrorInstance::setStackFrames first settles the frames that such a capture saved. - JSON. JSONAtomStringCache is JSONCache (f62059d). The fork's fallible tryMakeJSString moves there, and JSONCache.h and JSONCacheInlines.h are private framework headers. The new lexer fast path keeps the position that the streaming parse reads. - AvailableMemory. Upstream's rewrite (7cc8fd9), with the fork's cgroup limit on Linux and its FreeBSD branch. - libpas compact reservation (5b0cfbc). The fork's reserve-then-commit path for Windows is applied to the new allocator with two fronts. - AssemblerBuffer. Both limits are checked: upstream's maximumCachedAssemblerDataCapacity (off by default) and the fork's maximumCachedAssemblerBufferSize. Fork-only code is adapted to upstream API changes: ffi/ (CString is a class template, DFG_CRASH takes a UTF8CStringView), the DFG_CRASH call sites in dfg/ and ftl/, and ThreadSuspenderTests.cpp in libpas.
Merges upstream WebKit main at
7b485a76e9(2026-09-23) into the fork: 970 commits since the previous merge baseccdcb8a026(2026-09-09), about 200 of them in JavaScriptCore, WTF, bmalloc or cmake. The merge commitdfc29582afhas the fork's main at35e8970dfd(#718) as its first parent and7b485a76e9as its second parent.This PR contains #651 (upstream
6b58d86abe, the first 216 commits of the range) with its conflict resolutions, plus 754 newer upstream commits. If this PR merges, #651 and #623 are not needed. The Bun side is oven-sh/bun#43882, which also has the list of upstream changes.The upstream changes that shaped this merge
c76c52f5b1(321541@main): the parser and the bytecode keep source offsets only.SourceProviderderives lines and columns from a lazyLineStartTable.SourceCodelosesfirstLineandstartColumn,JSTextPositionkeeps onlyoffset, andExpressionInfo,UnlinkedFunctionExecutableandUnlinkedGlobalCodeBlocklose their line and column fields. The bytecode cache layout changes with them.7f5ab15882(321344@main):WeakBlockredesign. AWeakBlockcounts its slots,WeakImpl::clear()returns the slot to the block's free list at once, andHeappools empty blocks.aa19dc61a0: allIsoSubspaces share oneAlignedMemoryAllocator, so emptyMarkedBlocks move between subspaces (second landing of the change that upstream reverted in the previous range).df94b6ccbb,9a38124281: upstream gets Toom-3 and FFTJSBigIntmultiplication, which the fork already has.CStringtyping series continues (ASCIICStringheap names,char8_toption strings,protectedCStringaccessors).Conflicts and how they were resolved
39 files conflicted.
Took upstream's shape (the fork's version of the same change is dropped):
418114c05c(DFG folds a module variable to a stale value after an import cycle) is the upstream form of [JSC] DFG folds a module variable to a constant when an import cycle links a function that writes it before the module's own code #624.runtime/JSScope.cppand the threeJSTests/modules/import-cycle-function-linked-before-module-code*files take upstream's text.b34e745e23reverts the Linux main-thread detection (getpid() == gettid()) that the fork had disabled underUSE(BUN_JSC_ADDITIONS).wtf/Threading.cppandwtf/posix/ThreadingPOSIX.cpptake upstream's side, so the fork's guards are gone.c76c52f5b1inparser/Parser.handparser/Parser.cpp. The fork'sm_lastTokenEndPositionand thelastTokenEndLine/lastTokenEndLineStartOffsetmembers ofSourceProviderCacheItemonly carried a line number for a template literal that ends an arrow expression body. Offsets need no such fix, so they are removed. Kept from the fork:setEcmaName()in the two async body parsers,containsTaggedTemplatein the function cache, andendLocation = m_lastTokenLocationfor an expression body (it keeps theFunctionMetadataNodeposition equal on the parsed path and theSourceProviderCachepath).Kept the fork's version (upstream's overlapping change is not taken):
runtime/JSBigInt.cpp,runtime/JSBigInt.h: the fork's Toom-3 and Schönhage-Strassen multiplication with theInterruptCheckplumbing stay, and upstream's copies (df94b6ccbb,9a38124281) are dropped. This is the same decision as Upgrade to upstream WebKit ccdcb8a026 #614 made for Karatsuba.a89c41295f(BigInt("-")throws) andd2d61f8871(std::spanin the multiply loops) merged in on top. Upstream's FFT has a squaring shortcut (x.data() == y.data()) that the fork's FFT does not have. It is left for when the two converge.Merged by hand:
bytecode/UnlinkedFunctionExecutable.h,.cpp: upstream removesm_firstLineOffset,m_lineCount,m_unlinkedBodyStartColumnandm_unlinkedBodyEndColumn. The fork writes some scalars late (m_scalarsAreDeferred) and pairs each of them with a flag bit that only the mutator reads. The two that remain (m_parametersStartOffsetwithm_scriptMode,m_unlinkedFunctionEndwithm_needsClassFieldInitializer) keep their words.m_superBindingmoves to the flag group afterm_isBuiltinDefaultClassConstructor.runtime/CachedTypes.cpp: the conflicts take the fork's side, and the fork's packed records then lose the same fields that upstream's records lose.CachedFunctionExecutable: noHasLinesheader bit (the bits after it move down by one), and the varint tail has no body start column, first line offset, body end column or line count. The class source inCachedFunctionExecutableRareDatahas no first line and start column.CachedJSTextPosition,CachedSourceCodeandCachedGlobalCodeBlockfollow upstream.cachedTypesFormatRevisionbecomes 11. Thestatic_asserts on record sizes change forCachedJSTextPosition(12 to 4),CachedClassElementDefinition(24 to 16),CachedEvalCodeBlock(40 to 32) andCachedProgramCodeBlock/CachedModuleCodeBlock(56 to 48).bytecode/CodeBlock.cpp,.h(4dbb362ca1):updatePredictionsConcurrently()takes the fork'sValueProfileSamplesargument. The concurrent marker passesKeeporRecordas before, and now also updates array profiles from there, like upstream. The fork's lazily allocatedArrayProfile(LazyCallLinkInfo::arrayProfile()) andUnlinkedCodeBlock::valueAndArrayProfiles()are both published after astoreStoreFence(), which is what a concurrent reader needs.heap/MarkedBlock.cpp: upstream's early return inHandle::sweep()for a block that is still swept comes first. The fork's first-sweep-after-a-full-collection bookkeeping ([JSC] Decommit a MarkedBlock's dead pages on its first sweep after a full collection, whichever collection finished last #708) follows, then upstream'sSweepingScope. A block that is still swept was swept after the last collection that could change it, so it has nothing to decommit.heap/Heap.cpp: the fork removedprojectedGCRateLimitingValue()and upstream removednotifyIncrementalSweeper(). Both are gone.runtime/JSGlobalObject.h(7692eececb):WeakCustomGetterOrSetterHashtakesT*, and the fork's templatedhash()overload stays.tools/JSDollarVM.cpp,dfg/DFGSSALoweringPhase.cpp,CMakeLists.txt,WebKitCommon.cmake,wtf/NumberOfCores.cpp,wtf/URLParser.cpp,llint/LowLevelInterpreter.cppand seven include lists: both sides add lines, and both are kept (the fork's quoted include style stays).WebKitCommon.cmakesetsCMAKE_POSITION_INDEPENDENT_CODEonly whenNOT APPLE AND NOT USE_BUN_JSC_ADDITIONS.Fork-only code that needed an edit after the merge
Git merges these without a conflict, and the tree does not compile until they change. All of them are in the merge commit.
bytecode/ExpressionInfoInlines.h:Encoder::rebuild()callsencode()without aLineColumn.runtime/CodeCache.cpp:recordParseFromUnlinkedCodeBlock()calls the three-argumentrecordParse().runtime/JSDateMath.cpp:Lexer<char16_t>::isWhiteSpace()is now the free functionisWhiteSpace<char16_t>().inspector/JSGlobalObjectInspectorController.cpp: theUSE(BUN_JSC_ADDITIONS)constructor useslazyInitialize()for the nowconstm_consoleClient.WeakGCMap::set()takes a raw pointer (JSModuleRecord.cpp),PersistentBytecodePayloads::reconcileWeakReferencesAtGCEnd(),UTF8CStringreturn types inMetadataTable.handFunctionExecutable, andlegacyCStringPointer()for%sarguments.Fixes on top of the merge
bc120ee25fwtf/MemoryFootprint.hdeclaresmemoryFootprint(mach_port_t)underOS(DARWIN). Upstream8009ddd215declares it underPLATFORM(COCOA), butPlatformJSCOnly.cmakebuildscocoa/MemoryFootprintCocoa.cpp, which calls it, on every Apple target.eacf0ea760runtime/ErrorInstance.cpp: the fork'sErrorInstance::captureStackTrace()calledvalue()onJSGlobalObject::stackTraceLimit(). The limit was already empty for a value that is not a number and for a deleted property. Sincea5bfdb3aafit is also empty forNaNand for an accessor.value()on an empty optional aborts the process. In Bun,Error.stackTraceLimit = NaN; Error.appendStackTrace(new Error("a"), new Error("b"))reaches it. It now captures zero frames, likeError.captureStackTrace(ErrorConstructor.cpp). The review of this PR found it. Upgrade WebKit to 7b485a76e9 bun#43882 has the test.3a8b1bc93bbytecompiler/BytecodeGenerator.cpp: an error from a class field initializer is reported where the constructor starts. A base class constructor calls the initializer before its first statement, and the call took its position fromm_scopeNode->position(). Before upstreamc76c52f5b1that position had the first line of the function next to the offset of its end, and a stack frame used the line. With offsets only, the frame of the constructor moved to its closing brace, so Bun's code frame for the error pointed at the last statement of the constructor. The call now takesm_scopeNode->startStartOffset(), which is the position that V8 reports. This is upstream behaviour, not a result of the merge:parser/Nodes.cpp,Nodes.handNodeConstructors.hare identical to upstream, and upstreammainhas the same call.usingandawait usingdisposal moved in the same way, to the statement that leaves the scope. V8 reports them there, so they stay. New test:JSTests/stress/class-field-initializer-error-is-reported-at-constructor-start.js. It passes on299c532387, fails oneacf0ea760(expected 10 but got 13) and passes with this commit. 337 stress tests whose names match class fields, private names, constructors, stack traces, lines and columns give the same result before and after, except the new one.3a8b1bc93b: the first run ofTest bun-webkit-linux-arm64-ltofailed one test,stress/sampling-profiler-bound-function-name.js.ftl-eager-no-cjit. That test has no class and no constructor. The same test failed the same evening inTest bun-webkit-linux-amd64-ltoof the branchclaude/module-graph(run 36062428484), which ismainplus 3 commits and has neither this merge nor this commit. I ran the job again once, and it passed.Things to know
WeakImpl::clear()is no longer a single tagged write. It edits the free list and the counters of itsWeakBlockwithout a lock and can hand the block back to the heap. AWeak<>that is cleared or destroyed off the JS thread was harmless before and is not any more.SourceProvideris now added to every derived line and column as an unsigned number.SourceCodeused to clampfirstLineandstartColumnto 1. A negative start position (node:vmlineOffset: -5) now wraps. Bun clamps on its side (Upgrade WebKit to 7b485a76e9 bun#43882)..github/workflowsdid not change.runtime/JSType.hdid not change.Verification
Local, Linux x64, clang 23.1.2:
bun run jsc:build:debug(Debug + ASAN, libpas): builds,jscruns.bun run jsc:build(Release, mimalloc): builds. This configuration compiles the path without libpas ofFastMallocAlignedMemoryAllocator.cpp.run-jsc-stress-tests --quickwith the Releasejscon about 2340 files: everyJSTests/stressandJSTests/modulesfile that upstream or the fork changed since the merge base, plus every file whose name matches bigint, weak, stack trace, line, column, template, arrow function, class field, static block, Function constructor, toString, sampling, Reflect.construct, lookbehind, using, structured clone, steal, decommit, source, eval, lexer, parser or syntax. 9365 runs, 9074 pass. The 291 failing runs are 137 files:Intl,toLocaleStringor Temporal formatting. My localjsclinks the ICU data of the prebuilt tarball without Bun's decompress hook, so every ICU call fails there. Thejscof theautobuild-299c532387lto tarball passes them.stress/shrink-footprint-recovers-code-from-bytecode-cache.jsfails only with my Release build (no LTO). The census in the first timer callback counts theProgramCodeBlockonce more. The Debug + ASANjscof the same tree passes, a heap snapshot has no node for that code block, and it is gone in the next task. So a slot in a native frame of that build keeps it across the callback. CI runs this test on the LTO build.bun run build:local: Bun builds and links against this tree with the edits of Upgrade WebKit to 7b485a76e9 bun#43882. That PR lists the Bun tests.Not compiled locally: macOS, Windows, FreeBSD, Android and musl. The CI of this PR builds them.