Skip to content

Conversation

AZero13
Copy link
Contributor

@AZero13 AZero13 commented Mar 15, 2023

bb990589d735c8e0c6bd0049c1f6f8f78c7f4fd2

Prefer std::ceil, std::floor, and std::round over their C counterparts
https://bugs.webkit.org/show_bug.cgi?id=253963

Reviewed by NOBODY (OOPS!).

Unlike the C library versions, these std functions have overloads for
every type, so one does not need to worry about which version of the
function to call.

Continuation of https://commits.webkit.org/261584@main

* Source/JavaScriptCore/b3/B3ConstFloatValue.cpp:
(JSC::B3::ConstFloatValue::ceilConstant const):
(JSC::B3::ConstFloatValue::floorConstant const):
* Source/JavaScriptCore/b3/B3Value.cpp:
(JSC::B3::Value::isRounded const):
* Source/JavaScriptCore/b3/testb3_3.cpp:
(testCeilArg):
(testCeilImm):
(testCeilMem):
(testCeilCeilArg):
(testFloorCeilArg):
(testCeilArgWithUselessDoubleConversion):
(testCeilArgWithEffectfulDoubleConversion):
(testFloorArg):
(testFloorImm):
(testFloorMem):
(testFloorFloorArg):
(testCeilFloorArg):
(testFloorArgWithUselessDoubleConversion):
(testFloorArgWithEffectfulDoubleConversion):
* Source/JavaScriptCore/inspector/scripts/tests/expected/command-targetType-matching-domain-debuggableType.json-result:
* Source/JavaScriptCore/inspector/scripts/tests/expected/commands-with-async-attribute.json-result:
* Source/JavaScriptCore/inspector/scripts/tests/expected/commands-with-optional-call-return-parameters.json-result:
* Source/JavaScriptCore/inspector/scripts/tests/expected/definitions-with-mac-platform.json-result:
* Source/JavaScriptCore/inspector/scripts/tests/expected/domain-debuggableTypes.json-result:
* Source/JavaScriptCore/inspector/scripts/tests/expected/domain-targetType-matching-domain-debuggableType.json-result:
* Source/JavaScriptCore/inspector/scripts/tests/expected/domain-targetTypes.json-result:
* Source/JavaScriptCore/inspector/scripts/tests/expected/domains-with-varying-command-sizes.json-result:
* Source/JavaScriptCore/inspector/scripts/tests/expected/enum-values.json-result:
* Source/JavaScriptCore/inspector/scripts/tests/expected/event-targetType-matching-domain-debuggableType.json-result:
* Source/JavaScriptCore/inspector/scripts/tests/expected/events-with-optional-parameters.json-result:
* Source/JavaScriptCore/inspector/scripts/tests/expected/generate-domains-with-feature-guards.json-result:
* Source/JavaScriptCore/inspector/scripts/tests/expected/same-type-id-different-domain.json-result:
* Source/JavaScriptCore/inspector/scripts/tests/expected/shadowed-optional-type-setters.json-result:
* Source/JavaScriptCore/inspector/scripts/tests/expected/should-strip-comments.json-result:
* Source/JavaScriptCore/inspector/scripts/tests/expected/type-declaration-aliased-primitive-type.json-result:
* Source/JavaScriptCore/inspector/scripts/tests/expected/type-declaration-array-type.json-result:
* Source/JavaScriptCore/inspector/scripts/tests/expected/type-declaration-enum-type.json-result:
* Source/JavaScriptCore/inspector/scripts/tests/expected/type-declaration-object-type.json-result:
* Source/JavaScriptCore/inspector/scripts/tests/expected/type-requiring-runtime-casts.json-result:
* Source/JavaScriptCore/inspector/scripts/tests/expected/type-with-open-parameters.json-result:
* Source/JavaScriptCore/inspector/scripts/tests/expected/version.json-result:
* Source/WTF/wtf/DateMath.h:
(WTF::jsCurrentTime):
(WTF::daysFrom1970ToYear):
(WTF::msToDays):
(WTF::dateToDaysFrom1970):
(WTF::msToMinutes):
(WTF::msToHours):
(WTF::msToSeconds):
* Source/WebCore/Modules/webaudio/AudioBufferSourceNode.cpp:
(WebCore::AudioBufferSourceNode::renderFromBuffer):
* Source/WebCore/Modules/webaudio/OscillatorNode.cpp:
(WebCore::OscillatorNode::processARate):
(WebCore::OscillatorNode::processKRate):
* Source/WebCore/css/typedom/CSSUnitValue.cpp:
(WebCore::isValueOutOfRangeForProperty):
* Source/WebCore/dom/ios/PointerEventIOS.cpp:
(WebCore::PointerEvent::PointerEvent):
* Source/WebCore/inspector/InspectorFrontendClientLocal.cpp:
(WebCore::InspectorFrontendClientLocal::constrainedAttachedWindowHeight):
(WebCore::InspectorFrontendClientLocal::constrainedAttachedWindowWidth):
* Source/WebCore/layout/formattingContexts/inline/InlineLevelBox.h:
(WebCore::Layout::InlineLevelBox::preferredLineHeight const):
(WebCore::Layout::InlineLevelBox::AscentAndDescent::round):
* Source/WebCore/layout/formattingContexts/inline/InlineLineBoxBuilder.cpp:
(WebCore::Layout::LineBoxBuilder::enclosingAscentDescentWithFallbackFonts const):
(WebCore::Layout::LineBoxBuilder::setLayoutBoundsForInlineBox const):
(WebCore::Layout::LineBoxBuilder::adjustInlineBoxHeightsForLineBoxContainIfApplicable):
* Source/WebCore/layout/formattingContexts/inline/display/InlineDisplayContentBuilder.cpp:
(WebCore::Layout::InlineDisplayContentBuilder::appendTextDisplayBox):
* Source/WebCore/layout/formattingContexts/inline/text/TextUtil.cpp:
(WebCore::Layout::TextUtil::breakWord):
* Source/WebCore/page/FrameSnapshotting.cpp:
(WebCore::snapshotFrameRectWithClip):
* Source/WebCore/page/LocalFrame.cpp:
(WebCore::LocalFrame::resizePageRectsKeepingRatio):
* Source/WebCore/page/LocalFrameView.cpp:
(WebCore::LocalFrameView::forceLayoutForPagination):
(WebCore::LocalFrameView::adjustPageHeightDeprecated):
* Source/WebCore/page/PrintContext.cpp:
(WebCore::PrintContext::computePageRectsWithPageSizeInternal):
* Source/WebCore/page/SpatialNavigation.cpp:
(WebCore::distanceDataForNode):
* Source/WebCore/page/ViewportConfiguration.cpp:
(WebCore::ViewportConfiguration::updateMinimumLayoutSize):
* Source/WebCore/page/ios/FrameIOS.mm:
(WebCore::LocalFrame::renderRectForPoint const):
* Source/WebCore/page/scrolling/ThreadedScrollingTreeScrollingNodeDelegate.cpp:
(WebCore::ThreadedScrollingTreeScrollingNodeDelegate::adjustedScrollPosition const):
* Source/WebCore/platform/DateComponents.cpp:
(WebCore::DateComponents::setMillisecondsSinceMidnightInternal):
(WebCore::DateComponents::setMillisecondsSinceEpochForDate):
(WebCore::DateComponents::setMillisecondsSinceEpochForDateTimeLocal):
(WebCore::DateComponents::setMillisecondsSinceEpochForMonth):
(WebCore::DateComponents::setMillisecondsSinceMidnight):
(WebCore::DateComponents::setMonthsSinceEpoch):
(WebCore::DateComponents::setMillisecondsSinceEpochForWeek):
* Source/WebCore/platform/LayoutUnit.h:
(WebCore::LayoutUnit::fromFloatCeil):
(WebCore::LayoutUnit::fromFloatFloor):
(WebCore::roundToDevicePixel):
(WebCore::floorToDevicePixel):
(WebCore::ceilToDevicePixel):
* Source/WebCore/platform/ScrollAnimationKinetic.cpp:
(WebCore::ScrollAnimationKinetic::PerAxisData::animateScroll):
* Source/WebCore/platform/ScrollbarThemeComposite.cpp:
(WebCore::ScrollbarThemeComposite::thumbLength):
* Source/WebCore/platform/cocoa/DragImageCocoa.mm:
(WebCore::scaleDragImage):
* Source/WebCore/platform/graphics/FloatPoint.h:
(WebCore::flooredIntSize):
(WebCore::roundedIntPoint):
(WebCore::flooredIntPoint):
(WebCore::ceiledIntPoint):
(WebCore::floorPointToDevicePixels):
(WebCore::ceilPointToDevicePixels):
* Source/WebCore/platform/graphics/FloatSize.h:
(WebCore::roundedIntSize):
(WebCore::flooredIntSize):
(WebCore::expandedIntSize):
(WebCore::flooredIntPoint):
* Source/WebCore/platform/graphics/FontCascade.cpp:
(WebCore::FontCascade::fastAverageCharWidthIfAvailable const):
(WebCore::FontCascade::floatWidthForSimpleText const):
(WebCore::FontCascade::floatWidthForComplexText const):
* Source/WebCore/platform/graphics/FontCascade.h:
(WebCore::GlyphOverflow::extendTop):
(WebCore::GlyphOverflow::extendBottom):
* Source/WebCore/platform/graphics/GeometryUtilities.cpp:
(WebCore::normalizeAngleInRadians):
* Source/WebCore/platform/graphics/GraphicsContext.cpp:
(WebCore::GraphicsContext::computeLineBoundsAndAntialiasingModeForText):
* Source/WebCore/platform/graphics/Image.cpp:
(WebCore::Image::drawTiled):
* Source/WebCore/platform/graphics/ImageBuffer.cpp:
(WebCore::ImageBuffer::sizeNeedsClamping):
* Source/WebCore/platform/graphics/ImageBufferBackend.cpp:
(WebCore::ImageBufferBackend::calculateBackendSize):
* Source/WebCore/platform/graphics/ShadowBlur.cpp:
(WebCore::calculateLobes):
* Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::getStartDate const):
* Source/WebCore/platform/graphics/ca/TileController.cpp:
(WebCore::TileController::computeTileSize):
* Source/WebCore/platform/graphics/ca/TileGrid.cpp:
(WebCore::TileGrid::getTileIndexRangeForRect const):
* Source/WebCore/platform/graphics/cairo/CairoOperations.cpp:
(WebCore::Cairo::computeLineBoundsAndAntialiasingModeForText):
(WebCore::Cairo::drawSurface):
* Source/WebCore/platform/graphics/cairo/ImageBufferCairoBackend.cpp:
(WebCore::ImageBufferCairoBackend::transformToColorSpace):
* Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp:
(WebCore::GraphicsContextCG::strokePath):
(WebCore::GraphicsContextCG::strokeRect):
(WebCore::GraphicsContextCG::roundToDevicePixels const):
* Source/WebCore/platform/graphics/cg/IntRectCG.cpp:
(WebCore::enclosingIntRect):
* Source/WebCore/platform/graphics/controls/SliderTrackPart.cpp:
(WebCore::SliderTrackPart::drawTicks const):
* Source/WebCore/platform/graphics/coretext/FontCoreText.cpp:
(WebCore::Font::platformInit):
* Source/WebCore/platform/graphics/filters/FEGaussianBlur.cpp:
(WebCore::clampedToKernelSize):
* Source/WebCore/platform/graphics/filters/software/FEColorMatrixSoftwareApplier.cpp:
(WebCore::FEColorMatrixSoftwareApplier::applyPlatformAccelerated const):
* Source/WebCore/platform/graphics/filters/software/FETurbulenceSoftwareApplier.cpp:
(WebCore::FETurbulenceSoftwareApplier::computeStitching):
* Source/WebCore/platform/graphics/harfbuzz/ComplexTextControllerHarfBuzz.cpp:
(WebCore::ComplexTextController::collectComplexTextRunsForCharacters):
* Source/WebCore/platform/graphics/mac/LegacyDisplayRefreshMonitorMac.cpp:
(WebCore::LegacyDisplayRefreshMonitorMac::nominalFramesPerSecondFromDisplayLink):
* Source/WebCore/platform/graphics/mac/controls/MenuListButtonMac.mm:
(WebCore::MenuListButtonMac::draw):
* Source/WebCore/platform/graphics/transforms/TransformationMatrix.cpp:
(WebCore::TransformationMatrix::clampedBoundsOfProjectedQuad const):
* Source/WebCore/platform/graphics/win/ComplexTextControllerUniscribe.cpp:
(WebCore::ComplexTextController::collectComplexTextRunsForCharacters):
* Source/WebCore/platform/ios/WidgetIOS.mm:
(WebCore::Widget::convertFromRootToContainingWindow):
(WebCore::Widget::convertFromContainingWindowToRoot):
* Source/WebCore/platform/ios/wak/WAKScrollView.mm:
(-[WAKScrollView scrollWheel:]):
* Source/WebCore/platform/ios/wak/WKView.mm:
(_WKViewAutoresizeCoord):
* Source/WebCore/platform/mac/PasteboardMac.mm:
(WebCore::setDragImageImpl):
* Source/WebCore/platform/mac/ScrollAnimationRubberBand.mm:
(WebCore::roundTowardZero):
(WebCore::roundToDevicePixelTowardZero):
* Source/WebCore/platform/mac/ScrollingEffectsController.mm:
(WebCore::ScrollingEffectsController::applyScrollDeltaWithStretching):
* Source/WebCore/rendering/AttachmentLayout.mm:
(WebCore::AttachmentLayout::layOutTitle):
(WebCore::AttachmentLayout::AttachmentLayout):
* Source/WebCore/rendering/BorderEdge.cpp:
(WebCore::BorderEdge::BorderEdge):
* Source/WebCore/rendering/CaretRectComputation.cpp:
(WebCore::computeCaretRectForLinePosition):
* Source/WebCore/rendering/LegacyInlineFlowBox.cpp:
(WebCore::LegacyInlineFlowBox::computeLogicalBoxHeights):
* Source/WebCore/rendering/LegacyInlineFlowBox.h:
(WebCore::LegacyInlineFlowBox::logicalRightVisualOverflow const):
* Source/WebCore/rendering/LegacyRootInlineBox.cpp:
(WebCore::LegacyRootInlineBox::lineSnapAdjustment const):
* Source/WebCore/rendering/RenderBlock.cpp:
(WebCore::RenderBlock::adjustLogicalRightOffsetForLine const):
* Source/WebCore/rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::adjustComputedFontSizes):
* Source/WebCore/rendering/RenderEmbeddedObject.cpp:
(WebCore::RenderEmbeddedObject::paintReplaced):
(WebCore::RenderEmbeddedObject::getReplacementTextGeometry const):
* Source/WebCore/rendering/RenderFileUploadControl.cpp:
(WebCore::RenderFileUploadControl::computeIntrinsicLogicalWidths const):
* Source/WebCore/rendering/RenderImage.cpp:
(WebCore::RenderImage::setImageSizeForAltText):
* Source/WebCore/rendering/RenderMenuList.cpp:
(RenderMenuList::updateOptionsWidth):
* Source/WebCore/rendering/RenderMultiColumnSet.cpp:
(WebCore::RenderMultiColumnSet::columnCount const):
* Source/WebCore/rendering/RenderMultiColumnSet.h:
* Source/WebCore/rendering/RenderTextControl.cpp:
(WebCore::RenderTextControl::scaleEmToUnits const):
* Source/WebCore/rendering/RenderTextControlMultiLine.cpp:
(WebCore::RenderTextControlMultiLine::preferredContentLogicalWidth const):
* Source/WebCore/rendering/RenderTextControlSingleLine.cpp:
(WebCore::RenderTextControlSingleLine::preferredContentLogicalWidth const):
* Source/WebCore/rendering/RenderTheme.cpp:
(WebCore::RenderTheme::paintSliderTicks):
* Source/WebCore/rendering/RenderThemeIOS.mm:
(WebCore::RenderThemeIOS::paintMenuListButtonDecorations):
* Source/WebCore/rendering/RenderThemeMac.mm:
(WebCore::RenderThemeMac::popupInternalPaddingBox const):
* Source/WebCore/rendering/RenderTreeAsText.cpp:
(WebCore::write):
* Source/WebCore/rendering/RenderView.cpp:
(WebCore::RenderView::viewHeight const):
(WebCore::RenderView::viewWidth const):
* Source/WebCore/rendering/mathml/RenderMathMLFraction.cpp:
(WebCore::RenderMathMLFraction::firstLineBaseline const):
* Source/WebCore/rendering/mathml/RenderMathMLScripts.cpp:
(WebCore::RenderMathMLScripts::firstLineBaseline const):
* Source/WebCore/rendering/style/ShadowData.h:
(WebCore::ShadowData::paintingExtent const):
* Source/WebCore/rendering/svg/LegacyRenderSVGForeignObject.cpp:
(WebCore::LegacyRenderSVGForeignObject::updateLogicalWidth):
(WebCore::LegacyRenderSVGForeignObject::computeLogicalHeight const):
* Source/WebCore/svg/SVGAnimationElement.cpp:
(WebCore::SVGAnimationElement::currentValuesForValuesAnimation):
* Source/WebCore/svg/SVGFEConvolveMatrixElement.cpp:
(WebCore::SVGFEConvolveMatrixElement::isValidTargetXOffset const):
(WebCore::SVGFEConvolveMatrixElement::isValidTargetYOffset const):
(WebCore::SVGFEConvolveMatrixElement::createFilterEffect const):
* Source/WebCore/svg/SVGFontFaceElement.cpp:
(WebCore::SVGFontFaceElement::unitsPerEm const):
(WebCore::SVGFontFaceElement::xHeight const):
(WebCore::SVGFontFaceElement::capHeight const):
(WebCore::SVGFontFaceElement::ascent const):
(WebCore::SVGFontFaceElement::descent const):
* Source/WebCore/svg/SVGPathParser.cpp:
(WebCore::SVGPathParser::decomposeArcToCubic):
* Source/WebCore/svg/animation/SVGSMILElement.cpp:
(WebCore::SVGSMILElement::calculateAnimationPercentAndRepeat const):
* Source/WebCore/svg/properties/SVGAnimationAdditiveValueFunctionImpl.h:
* Source/WebCore/xml/XPathFunctions.cpp:
(WebCore::XPath::FunFloor::evaluate const):
(WebCore::XPath::FunCeiling::evaluate const):
* Source/WebKit/Shared/CoordinatedGraphics/SimpleViewportController.cpp:
(WebKit::SimpleViewportController::boundContentsPositionAtScale const):
* Source/WebKit/Shared/RemoteLayerTree/CGDisplayListImageBufferBackend.mm:
(WebKit::GraphicsContextCGDisplayList::GraphicsContextCGDisplayList):
* Source/WebKit/UIProcess/API/glib/IconDatabase.cpp:
(WebKit::IconDatabase::populatePageURLToIconURLMap):
(WebKit::IconDatabase::pruneTimerFired):
(WebKit::IconDatabase::iconIDForIconURL):
* Source/WebKit/UIProcess/_WKTouchEventGenerator.mm:
(-[_WKTouchEventGenerator _createIOHIDEventType:]):
* Source/WebKit/UIProcess/gtk/ViewGestureControllerGtk.cpp:
(WebKit::ViewGestureController::snapshot):
(WebKit::ViewGestureController::draw):
* Source/WebKit/UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
(-[WKFullScreenWindowController enterFullScreen:]):
* Source/WebKit/UIProcess/mac/DisplayLink.cpp:
(WebKit::DisplayLink::nominalFramesPerSecondFromDisplayLink):
* Source/WebKit/UIProcess/mac/ViewGestureControllerMac.mm:
(WebKit::ViewGestureController::handleSwipeGesture):
* Source/WebKit/UIProcess/mac/WebPopupMenuProxyMac.mm:
(WebKit::WebPopupMenuProxyMac::showPopupMenu):
* Source/WebKit/WebProcess/WebCoreSupport/win/WebPopupMenuWin.cpp:
(WebKit::WebPopupMenu::setUpPlatformData):
* Source/WebKit/WebProcess/WebPage/MomentumEventDispatcher.cpp:
(WebKit::MomentumEventDispatcher::offsetAtTime):
* Source/WebKit/WebProcess/WebPage/ViewGestureGeometryCollector.cpp:
(WebKit::ViewGestureGeometryCollector::computeTextLegibilityScales):
* Source/WebKit/WebProcess/WebPage/mac/WebPageMac.mm:
(WebKit::WebPage::computePagesForPrintingPDFDocument):
(WebKit::drawPDFPage):
(WebKit::WebPage::drawPDFDocument):
(WebKit::roundCGFloat): Deleted.
* Source/WebKitLegacy/ios/WebView/WebPDFViewIOS.mm:
(-[WebPDFView _computePageRects]):
* Source/WebKitLegacy/ios/WebView/WebPDFViewPlaceholder.mm:
(-[WebPDFViewPlaceholder _getPDFPageBounds:]):
(-[WebPDFViewPlaceholder _computePageRects:]):
* Source/WebKitLegacy/mac/WebCoreSupport/PopupMenuMac.mm:
(PopupMenuMac::show):
* Source/WebKitLegacy/mac/WebView/WebDynamicScrollBarsView.mm:
(-[WebDynamicScrollBarsView scrollClipView:toPoint:]):
(-[WebDynamicScrollBarsView updateScrollers]):
* Source/WebKitLegacy/mac/WebView/WebHTMLView.mm:
(-[WebHTMLView knowsPageRange:]):
(imageFromRect):
* Source/WebKitLegacy/mac/WebView/WebTextCompletionController.mm:
(-[WebTextCompletionController _placePopupWindow:]):
* Tools/DumpRenderTree/mac/DumpRenderTree.mm:
(-[ScrollViewResizerDelegate view:didSetFrame:oldFrame:asResultOfZoom:]):
* Tools/TestWebKitAPI/Tests/ios/TextAutosizingBoost.mm:
(TEST):
* Tools/WebKitTestRunner/ios/HIDEventGenerator.mm:
(-[HIDEventGenerator _createIOHIDEventType:]):

0eb313d

Misc iOS, tvOS & watchOS macOS Linux Windows
❌ 🧪 style ✅ 🛠 ios ✅ 🛠 mac ✅ 🛠 wpe ✅ 🛠 wincairo
✅ 🧪 bindings ✅ 🛠 ios-sim ✅ 🛠 mac-AS-debug ✅ 🧪 wpe-wk2
✅ 🧪 webkitperl ❌ 🧪 ios-wk2 ✅ 🧪 api-mac ✅ 🛠 gtk
✅ 🧪 ios-wk2-wpt ✅ 🧪 mac-wk1 ✅ 🧪 gtk-wk2
✅ 🛠 🧪 jsc ✅ 🧪 api-ios ✅ 🧪 mac-wk2 ✅ 🧪 api-gtk
❌ 🛠 🧪 jsc-arm64 ✅ 🛠 tv ❌ 🧪 mac-AS-debug-wk2 ✅ 🛠 jsc-armv7
✅ 🛠 tv-sim ✅ 🧪 jsc-armv7-tests
✅ 🛠 watch ✅ 🛠 jsc-mips
✅ 🛠 watch-sim ✅ 🧪 jsc-mips-tests

@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Mar 15, 2023
@AZero13 AZero13 force-pushed the eng/Prefer-stdceil-stdfloor-and-stdround-over-their-C-counterparts branch from 55612b2 to a901e7e Compare March 15, 2023 15:31
@AZero13 AZero13 force-pushed the eng/Prefer-stdceil-stdfloor-and-stdround-over-their-C-counterparts branch from a901e7e to 7f047e6 Compare March 15, 2023 16:30
@Jarred-Sumner
Copy link

I wonder if there are performance implications

For example, using std::fill for zeroing memory is about 15x slower than memset

@AZero13 AZero13 force-pushed the eng/Prefer-stdceil-stdfloor-and-stdround-over-their-C-counterparts branch from 7f047e6 to 338b9e2 Compare March 16, 2023 14:18
Copy link
Member

@JonWBedard JonWBedard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is already quite a large PR. The most recent update changed 30+ files, none of which (as far as I can tell) have anything to do with std::ceil, std::floor and std::round.

@AZero13 AZero13 force-pushed the eng/Prefer-stdceil-stdfloor-and-stdround-over-their-C-counterparts branch from eb85330 to be7e1d3 Compare May 31, 2023 22:30
@AZero13 AZero13 force-pushed the eng/Prefer-stdceil-stdfloor-and-stdround-over-their-C-counterparts branch from be7e1d3 to 17b6fa0 Compare May 31, 2023 23:27
@AZero13 AZero13 force-pushed the eng/Prefer-stdceil-stdfloor-and-stdround-over-their-C-counterparts branch from 17b6fa0 to 405b8a5 Compare June 1, 2023 13:59
@mcatanzaro
Copy link
Contributor

Why does this pull request change web inspector test results?

@AZero13 AZero13 force-pushed the eng/Prefer-stdceil-stdfloor-and-stdround-over-their-C-counterparts branch from 987765e to 328092b Compare June 1, 2023 16:32
@AZero13 AZero13 force-pushed the eng/Prefer-stdceil-stdfloor-and-stdround-over-their-C-counterparts branch from 328092b to 5b0703f Compare June 4, 2023 16:16
@AZero13 AZero13 force-pushed the eng/Prefer-stdceil-stdfloor-and-stdround-over-their-C-counterparts branch from 778d1b1 to 46a011f Compare June 6, 2023 16:47
@AZero13 AZero13 force-pushed the eng/Prefer-stdceil-stdfloor-and-stdround-over-their-C-counterparts branch from 46a011f to 33567b3 Compare June 12, 2023 16:21
@AZero13 AZero13 force-pushed the eng/Prefer-stdceil-stdfloor-and-stdround-over-their-C-counterparts branch from 33567b3 to 01f83a9 Compare June 12, 2023 19:01
@AZero13 AZero13 force-pushed the eng/Prefer-stdceil-stdfloor-and-stdround-over-their-C-counterparts branch from 26419c9 to abc7e21 Compare June 12, 2023 19:46
@mcatanzaro mcatanzaro marked this pull request as draft June 12, 2023 21:38
@mcatanzaro
Copy link
Contributor

I'm moving this back to Draft status because it adds hundreds of lines of code, including lots of unexplained changes to test results. The only way we'll ever accept this is if it really only switches to std::ceil, std::floor, and std::round and does nothing else.

@AZero13 AZero13 force-pushed the eng/Prefer-stdceil-stdfloor-and-stdround-over-their-C-counterparts branch from abc7e21 to df2f965 Compare June 13, 2023 23:00
https://bugs.webkit.org/show_bug.cgi?id=253963

Reviewed by NOBODY (OOPS!).

Unlike the C library versions, these std functions have overloads for
every type, so one does not need to worry about which version of the
function to call.

Continuation of https://commits.webkit.org/261584@main

* Source/JavaScriptCore/b3/B3ConstFloatValue.cpp:
(JSC::B3::ConstFloatValue::ceilConstant const):
(JSC::B3::ConstFloatValue::floorConstant const):
* Source/JavaScriptCore/b3/B3Value.cpp:
(JSC::B3::Value::isRounded const):
* Source/JavaScriptCore/b3/testb3_3.cpp:
(testCeilArg):
(testCeilImm):
(testCeilMem):
(testCeilCeilArg):
(testFloorCeilArg):
(testCeilArgWithUselessDoubleConversion):
(testCeilArgWithEffectfulDoubleConversion):
(testFloorArg):
(testFloorImm):
(testFloorMem):
(testFloorFloorArg):
(testCeilFloorArg):
(testFloorArgWithUselessDoubleConversion):
(testFloorArgWithEffectfulDoubleConversion):
* Source/JavaScriptCore/inspector/scripts/tests/expected/command-targetType-matching-domain-debuggableType.json-result:
* Source/JavaScriptCore/inspector/scripts/tests/expected/commands-with-async-attribute.json-result:
* Source/JavaScriptCore/inspector/scripts/tests/expected/commands-with-optional-call-return-parameters.json-result:
* Source/JavaScriptCore/inspector/scripts/tests/expected/definitions-with-mac-platform.json-result:
* Source/JavaScriptCore/inspector/scripts/tests/expected/domain-debuggableTypes.json-result:
* Source/JavaScriptCore/inspector/scripts/tests/expected/domain-targetType-matching-domain-debuggableType.json-result:
* Source/JavaScriptCore/inspector/scripts/tests/expected/domain-targetTypes.json-result:
* Source/JavaScriptCore/inspector/scripts/tests/expected/domains-with-varying-command-sizes.json-result:
* Source/JavaScriptCore/inspector/scripts/tests/expected/enum-values.json-result:
* Source/JavaScriptCore/inspector/scripts/tests/expected/event-targetType-matching-domain-debuggableType.json-result:
* Source/JavaScriptCore/inspector/scripts/tests/expected/events-with-optional-parameters.json-result:
* Source/JavaScriptCore/inspector/scripts/tests/expected/generate-domains-with-feature-guards.json-result:
* Source/JavaScriptCore/inspector/scripts/tests/expected/same-type-id-different-domain.json-result:
* Source/JavaScriptCore/inspector/scripts/tests/expected/shadowed-optional-type-setters.json-result:
* Source/JavaScriptCore/inspector/scripts/tests/expected/should-strip-comments.json-result:
* Source/JavaScriptCore/inspector/scripts/tests/expected/type-declaration-aliased-primitive-type.json-result:
* Source/JavaScriptCore/inspector/scripts/tests/expected/type-declaration-array-type.json-result:
* Source/JavaScriptCore/inspector/scripts/tests/expected/type-declaration-enum-type.json-result:
* Source/JavaScriptCore/inspector/scripts/tests/expected/type-declaration-object-type.json-result:
* Source/JavaScriptCore/inspector/scripts/tests/expected/type-requiring-runtime-casts.json-result:
* Source/JavaScriptCore/inspector/scripts/tests/expected/type-with-open-parameters.json-result:
* Source/JavaScriptCore/inspector/scripts/tests/expected/version.json-result:
* Source/WTF/wtf/DateMath.h:
(WTF::jsCurrentTime):
(WTF::daysFrom1970ToYear):
(WTF::msToDays):
(WTF::dateToDaysFrom1970):
(WTF::msToMinutes):
(WTF::msToHours):
(WTF::msToSeconds):
* Source/WebCore/Modules/webaudio/AudioBufferSourceNode.cpp:
(WebCore::AudioBufferSourceNode::renderFromBuffer):
* Source/WebCore/Modules/webaudio/OscillatorNode.cpp:
(WebCore::OscillatorNode::processARate):
(WebCore::OscillatorNode::processKRate):
* Source/WebCore/css/typedom/CSSUnitValue.cpp:
(WebCore::isValueOutOfRangeForProperty):
* Source/WebCore/dom/ios/PointerEventIOS.cpp:
(WebCore::PointerEvent::PointerEvent):
* Source/WebCore/inspector/InspectorFrontendClientLocal.cpp:
(WebCore::InspectorFrontendClientLocal::constrainedAttachedWindowHeight):
(WebCore::InspectorFrontendClientLocal::constrainedAttachedWindowWidth):
* Source/WebCore/layout/formattingContexts/inline/InlineLevelBox.h:
(WebCore::Layout::InlineLevelBox::preferredLineHeight const):
(WebCore::Layout::InlineLevelBox::AscentAndDescent::round):
* Source/WebCore/layout/formattingContexts/inline/InlineLineBoxBuilder.cpp:
(WebCore::Layout::LineBoxBuilder::enclosingAscentDescentWithFallbackFonts const):
(WebCore::Layout::LineBoxBuilder::setLayoutBoundsForInlineBox const):
(WebCore::Layout::LineBoxBuilder::adjustInlineBoxHeightsForLineBoxContainIfApplicable):
* Source/WebCore/layout/formattingContexts/inline/display/InlineDisplayContentBuilder.cpp:
(WebCore::Layout::InlineDisplayContentBuilder::appendTextDisplayBox):
* Source/WebCore/layout/formattingContexts/inline/text/TextUtil.cpp:
(WebCore::Layout::TextUtil::breakWord):
* Source/WebCore/page/FrameSnapshotting.cpp:
(WebCore::snapshotFrameRectWithClip):
* Source/WebCore/page/LocalFrame.cpp:
(WebCore::LocalFrame::resizePageRectsKeepingRatio):
* Source/WebCore/page/LocalFrameView.cpp:
(WebCore::LocalFrameView::forceLayoutForPagination):
(WebCore::LocalFrameView::adjustPageHeightDeprecated):
* Source/WebCore/page/PrintContext.cpp:
(WebCore::PrintContext::computePageRectsWithPageSizeInternal):
* Source/WebCore/page/SpatialNavigation.cpp:
(WebCore::distanceDataForNode):
* Source/WebCore/page/ViewportConfiguration.cpp:
(WebCore::ViewportConfiguration::updateMinimumLayoutSize):
* Source/WebCore/page/ios/FrameIOS.mm:
(WebCore::LocalFrame::renderRectForPoint const):
* Source/WebCore/page/scrolling/ThreadedScrollingTreeScrollingNodeDelegate.cpp:
(WebCore::ThreadedScrollingTreeScrollingNodeDelegate::adjustedScrollPosition const):
* Source/WebCore/platform/DateComponents.cpp:
(WebCore::DateComponents::setMillisecondsSinceMidnightInternal):
(WebCore::DateComponents::setMillisecondsSinceEpochForDate):
(WebCore::DateComponents::setMillisecondsSinceEpochForDateTimeLocal):
(WebCore::DateComponents::setMillisecondsSinceEpochForMonth):
(WebCore::DateComponents::setMillisecondsSinceMidnight):
(WebCore::DateComponents::setMonthsSinceEpoch):
(WebCore::DateComponents::setMillisecondsSinceEpochForWeek):
* Source/WebCore/platform/LayoutUnit.h:
(WebCore::LayoutUnit::fromFloatCeil):
(WebCore::LayoutUnit::fromFloatFloor):
(WebCore::roundToDevicePixel):
(WebCore::floorToDevicePixel):
(WebCore::ceilToDevicePixel):
* Source/WebCore/platform/ScrollAnimationKinetic.cpp:
(WebCore::ScrollAnimationKinetic::PerAxisData::animateScroll):
* Source/WebCore/platform/ScrollbarThemeComposite.cpp:
(WebCore::ScrollbarThemeComposite::thumbLength):
* Source/WebCore/platform/cocoa/DragImageCocoa.mm:
(WebCore::scaleDragImage):
* Source/WebCore/platform/graphics/FloatPoint.h:
(WebCore::flooredIntSize):
(WebCore::roundedIntPoint):
(WebCore::flooredIntPoint):
(WebCore::ceiledIntPoint):
(WebCore::floorPointToDevicePixels):
(WebCore::ceilPointToDevicePixels):
* Source/WebCore/platform/graphics/FloatSize.h:
(WebCore::roundedIntSize):
(WebCore::flooredIntSize):
(WebCore::expandedIntSize):
(WebCore::flooredIntPoint):
* Source/WebCore/platform/graphics/FontCascade.cpp:
(WebCore::FontCascade::fastAverageCharWidthIfAvailable const):
(WebCore::FontCascade::floatWidthForSimpleText const):
(WebCore::FontCascade::floatWidthForComplexText const):
* Source/WebCore/platform/graphics/FontCascade.h:
(WebCore::GlyphOverflow::extendTop):
(WebCore::GlyphOverflow::extendBottom):
* Source/WebCore/platform/graphics/GeometryUtilities.cpp:
(WebCore::normalizeAngleInRadians):
* Source/WebCore/platform/graphics/GraphicsContext.cpp:
(WebCore::GraphicsContext::computeLineBoundsAndAntialiasingModeForText):
* Source/WebCore/platform/graphics/Image.cpp:
(WebCore::Image::drawTiled):
* Source/WebCore/platform/graphics/ImageBuffer.cpp:
(WebCore::ImageBuffer::sizeNeedsClamping):
* Source/WebCore/platform/graphics/ImageBufferBackend.cpp:
(WebCore::ImageBufferBackend::calculateBackendSize):
* Source/WebCore/platform/graphics/ShadowBlur.cpp:
(WebCore::calculateLobes):
* Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
(WebCore::MediaPlayerPrivateAVFoundationObjC::getStartDate const):
* Source/WebCore/platform/graphics/ca/TileController.cpp:
(WebCore::TileController::computeTileSize):
* Source/WebCore/platform/graphics/ca/TileGrid.cpp:
(WebCore::TileGrid::getTileIndexRangeForRect const):
* Source/WebCore/platform/graphics/cairo/CairoOperations.cpp:
(WebCore::Cairo::computeLineBoundsAndAntialiasingModeForText):
(WebCore::Cairo::drawSurface):
* Source/WebCore/platform/graphics/cairo/ImageBufferCairoBackend.cpp:
(WebCore::ImageBufferCairoBackend::transformToColorSpace):
* Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp:
(WebCore::GraphicsContextCG::strokePath):
(WebCore::GraphicsContextCG::strokeRect):
(WebCore::GraphicsContextCG::roundToDevicePixels const):
* Source/WebCore/platform/graphics/cg/IntRectCG.cpp:
(WebCore::enclosingIntRect):
* Source/WebCore/platform/graphics/controls/SliderTrackPart.cpp:
(WebCore::SliderTrackPart::drawTicks const):
* Source/WebCore/platform/graphics/coretext/FontCoreText.cpp:
(WebCore::Font::platformInit):
* Source/WebCore/platform/graphics/filters/FEGaussianBlur.cpp:
(WebCore::clampedToKernelSize):
* Source/WebCore/platform/graphics/filters/software/FEColorMatrixSoftwareApplier.cpp:
(WebCore::FEColorMatrixSoftwareApplier::applyPlatformAccelerated const):
* Source/WebCore/platform/graphics/filters/software/FETurbulenceSoftwareApplier.cpp:
(WebCore::FETurbulenceSoftwareApplier::computeStitching):
* Source/WebCore/platform/graphics/harfbuzz/ComplexTextControllerHarfBuzz.cpp:
(WebCore::ComplexTextController::collectComplexTextRunsForCharacters):
* Source/WebCore/platform/graphics/mac/LegacyDisplayRefreshMonitorMac.cpp:
(WebCore::LegacyDisplayRefreshMonitorMac::nominalFramesPerSecondFromDisplayLink):
* Source/WebCore/platform/graphics/mac/controls/MenuListButtonMac.mm:
(WebCore::MenuListButtonMac::draw):
* Source/WebCore/platform/graphics/transforms/TransformationMatrix.cpp:
(WebCore::TransformationMatrix::clampedBoundsOfProjectedQuad const):
* Source/WebCore/platform/graphics/win/ComplexTextControllerUniscribe.cpp:
(WebCore::ComplexTextController::collectComplexTextRunsForCharacters):
* Source/WebCore/platform/ios/WidgetIOS.mm:
(WebCore::Widget::convertFromRootToContainingWindow):
(WebCore::Widget::convertFromContainingWindowToRoot):
* Source/WebCore/platform/ios/wak/WAKScrollView.mm:
(-[WAKScrollView scrollWheel:]):
* Source/WebCore/platform/ios/wak/WKView.mm:
(_WKViewAutoresizeCoord):
* Source/WebCore/platform/mac/PasteboardMac.mm:
(WebCore::setDragImageImpl):
* Source/WebCore/platform/mac/ScrollAnimationRubberBand.mm:
(WebCore::roundTowardZero):
(WebCore::roundToDevicePixelTowardZero):
* Source/WebCore/platform/mac/ScrollingEffectsController.mm:
(WebCore::ScrollingEffectsController::applyScrollDeltaWithStretching):
* Source/WebCore/rendering/AttachmentLayout.mm:
(WebCore::AttachmentLayout::layOutTitle):
(WebCore::AttachmentLayout::AttachmentLayout):
* Source/WebCore/rendering/BorderEdge.cpp:
(WebCore::BorderEdge::BorderEdge):
* Source/WebCore/rendering/CaretRectComputation.cpp:
(WebCore::computeCaretRectForLinePosition):
* Source/WebCore/rendering/LegacyInlineFlowBox.cpp:
(WebCore::LegacyInlineFlowBox::computeLogicalBoxHeights):
* Source/WebCore/rendering/LegacyInlineFlowBox.h:
(WebCore::LegacyInlineFlowBox::logicalRightVisualOverflow const):
* Source/WebCore/rendering/LegacyRootInlineBox.cpp:
(WebCore::LegacyRootInlineBox::lineSnapAdjustment const):
* Source/WebCore/rendering/RenderBlock.cpp:
(WebCore::RenderBlock::adjustLogicalRightOffsetForLine const):
* Source/WebCore/rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::adjustComputedFontSizes):
* Source/WebCore/rendering/RenderEmbeddedObject.cpp:
(WebCore::RenderEmbeddedObject::paintReplaced):
(WebCore::RenderEmbeddedObject::getReplacementTextGeometry const):
* Source/WebCore/rendering/RenderFileUploadControl.cpp:
(WebCore::RenderFileUploadControl::computeIntrinsicLogicalWidths const):
* Source/WebCore/rendering/RenderImage.cpp:
(WebCore::RenderImage::setImageSizeForAltText):
* Source/WebCore/rendering/RenderMenuList.cpp:
(RenderMenuList::updateOptionsWidth):
* Source/WebCore/rendering/RenderMultiColumnSet.cpp:
(WebCore::RenderMultiColumnSet::columnCount const):
* Source/WebCore/rendering/RenderMultiColumnSet.h:
* Source/WebCore/rendering/RenderTextControl.cpp:
(WebCore::RenderTextControl::scaleEmToUnits const):
* Source/WebCore/rendering/RenderTextControlMultiLine.cpp:
(WebCore::RenderTextControlMultiLine::preferredContentLogicalWidth const):
* Source/WebCore/rendering/RenderTextControlSingleLine.cpp:
(WebCore::RenderTextControlSingleLine::preferredContentLogicalWidth const):
* Source/WebCore/rendering/RenderTheme.cpp:
(WebCore::RenderTheme::paintSliderTicks):
* Source/WebCore/rendering/RenderThemeIOS.mm:
(WebCore::RenderThemeIOS::paintMenuListButtonDecorations):
* Source/WebCore/rendering/RenderThemeMac.mm:
(WebCore::RenderThemeMac::popupInternalPaddingBox const):
* Source/WebCore/rendering/RenderTreeAsText.cpp:
(WebCore::write):
* Source/WebCore/rendering/RenderView.cpp:
(WebCore::RenderView::viewHeight const):
(WebCore::RenderView::viewWidth const):
* Source/WebCore/rendering/mathml/RenderMathMLFraction.cpp:
(WebCore::RenderMathMLFraction::firstLineBaseline const):
* Source/WebCore/rendering/mathml/RenderMathMLScripts.cpp:
(WebCore::RenderMathMLScripts::firstLineBaseline const):
* Source/WebCore/rendering/style/ShadowData.h:
(WebCore::ShadowData::paintingExtent const):
* Source/WebCore/rendering/svg/LegacyRenderSVGForeignObject.cpp:
(WebCore::LegacyRenderSVGForeignObject::updateLogicalWidth):
(WebCore::LegacyRenderSVGForeignObject::computeLogicalHeight const):
* Source/WebCore/svg/SVGAnimationElement.cpp:
(WebCore::SVGAnimationElement::currentValuesForValuesAnimation):
* Source/WebCore/svg/SVGFEConvolveMatrixElement.cpp:
(WebCore::SVGFEConvolveMatrixElement::isValidTargetXOffset const):
(WebCore::SVGFEConvolveMatrixElement::isValidTargetYOffset const):
(WebCore::SVGFEConvolveMatrixElement::createFilterEffect const):
* Source/WebCore/svg/SVGFontFaceElement.cpp:
(WebCore::SVGFontFaceElement::unitsPerEm const):
(WebCore::SVGFontFaceElement::xHeight const):
(WebCore::SVGFontFaceElement::capHeight const):
(WebCore::SVGFontFaceElement::ascent const):
(WebCore::SVGFontFaceElement::descent const):
* Source/WebCore/svg/SVGPathParser.cpp:
(WebCore::SVGPathParser::decomposeArcToCubic):
* Source/WebCore/svg/animation/SVGSMILElement.cpp:
(WebCore::SVGSMILElement::calculateAnimationPercentAndRepeat const):
* Source/WebCore/svg/properties/SVGAnimationAdditiveValueFunctionImpl.h:
* Source/WebCore/xml/XPathFunctions.cpp:
(WebCore::XPath::FunFloor::evaluate const):
(WebCore::XPath::FunCeiling::evaluate const):
* Source/WebKit/Shared/CoordinatedGraphics/SimpleViewportController.cpp:
(WebKit::SimpleViewportController::boundContentsPositionAtScale const):
* Source/WebKit/Shared/RemoteLayerTree/CGDisplayListImageBufferBackend.mm:
(WebKit::GraphicsContextCGDisplayList::GraphicsContextCGDisplayList):
* Source/WebKit/UIProcess/API/glib/IconDatabase.cpp:
(WebKit::IconDatabase::populatePageURLToIconURLMap):
(WebKit::IconDatabase::pruneTimerFired):
(WebKit::IconDatabase::iconIDForIconURL):
* Source/WebKit/UIProcess/_WKTouchEventGenerator.mm:
(-[_WKTouchEventGenerator _createIOHIDEventType:]):
* Source/WebKit/UIProcess/gtk/ViewGestureControllerGtk.cpp:
(WebKit::ViewGestureController::snapshot):
(WebKit::ViewGestureController::draw):
* Source/WebKit/UIProcess/ios/fullscreen/WKFullScreenWindowControllerIOS.mm:
(-[WKFullScreenWindowController enterFullScreen:]):
* Source/WebKit/UIProcess/mac/DisplayLink.cpp:
(WebKit::DisplayLink::nominalFramesPerSecondFromDisplayLink):
* Source/WebKit/UIProcess/mac/ViewGestureControllerMac.mm:
(WebKit::ViewGestureController::handleSwipeGesture):
* Source/WebKit/UIProcess/mac/WebPopupMenuProxyMac.mm:
(WebKit::WebPopupMenuProxyMac::showPopupMenu):
* Source/WebKit/WebProcess/WebCoreSupport/win/WebPopupMenuWin.cpp:
(WebKit::WebPopupMenu::setUpPlatformData):
* Source/WebKit/WebProcess/WebPage/MomentumEventDispatcher.cpp:
(WebKit::MomentumEventDispatcher::offsetAtTime):
* Source/WebKit/WebProcess/WebPage/ViewGestureGeometryCollector.cpp:
(WebKit::ViewGestureGeometryCollector::computeTextLegibilityScales):
* Source/WebKit/WebProcess/WebPage/mac/WebPageMac.mm:
(WebKit::WebPage::computePagesForPrintingPDFDocument):
(WebKit::drawPDFPage):
(WebKit::WebPage::drawPDFDocument):
(WebKit::roundCGFloat): Deleted.
* Source/WebKitLegacy/ios/WebView/WebPDFViewIOS.mm:
(-[WebPDFView _computePageRects]):
* Source/WebKitLegacy/ios/WebView/WebPDFViewPlaceholder.mm:
(-[WebPDFViewPlaceholder _getPDFPageBounds:]):
(-[WebPDFViewPlaceholder _computePageRects:]):
* Source/WebKitLegacy/mac/WebCoreSupport/PopupMenuMac.mm:
(PopupMenuMac::show):
* Source/WebKitLegacy/mac/WebView/WebDynamicScrollBarsView.mm:
(-[WebDynamicScrollBarsView scrollClipView:toPoint:]):
(-[WebDynamicScrollBarsView updateScrollers]):
* Source/WebKitLegacy/mac/WebView/WebHTMLView.mm:
(-[WebHTMLView knowsPageRange:]):
(imageFromRect):
* Source/WebKitLegacy/mac/WebView/WebTextCompletionController.mm:
(-[WebTextCompletionController _placePopupWindow:]):
* Tools/DumpRenderTree/mac/DumpRenderTree.mm:
(-[ScrollViewResizerDelegate view:didSetFrame:oldFrame:asResultOfZoom:]):
* Tools/TestWebKitAPI/Tests/ios/TextAutosizingBoost.mm:
(TEST):
* Tools/WebKitTestRunner/ios/HIDEventGenerator.mm:
(-[HIDEventGenerator _createIOHIDEventType:]):
@AZero13 AZero13 force-pushed the eng/Prefer-stdceil-stdfloor-and-stdround-over-their-C-counterparts branch from df2f965 to 0eb313d Compare June 13, 2023 23:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merging-blocked Applied to prevent a change from being merged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants