Ignore:
Timestamp:
Jun 1, 2021, 10:21:13 PM (4 years ago)
Author:
Chris Dumez
Message:

Rename Checked::unsafeGet() to Checked::value()
https://bugs.webkit.org/show_bug.cgi?id=226514

Reviewed by Darin Adler.

Rename Checked::unsafeGet() to Checked::value(). The "unsafeGet" naming is confusing as this
function isn't really unsafe since it will crash if the value has overflowed. Also add an
operator T() to implicitly convert a Checked to its underlying type without needing to
call value().

Source/JavaScriptCore:

  • b3/B3Const32Value.cpp:

(JSC::B3::Const32Value::checkAddConstant const):
(JSC::B3::Const32Value::checkSubConstant const):
(JSC::B3::Const32Value::checkMulConstant const):

  • b3/B3Const64Value.cpp:

(JSC::B3::Const64Value::checkAddConstant const):
(JSC::B3::Const64Value::checkSubConstant const):
(JSC::B3::Const64Value::checkMulConstant const):

  • bytecompiler/BytecodeGenerator.h:

(JSC::FinallyContext::numberOfBreaksOrContinues const):

  • dfg/DFGConstantFoldingPhase.cpp:

(JSC::DFG::ConstantFoldingPhase::foldConstants):

  • dfg/DFGOperations.cpp:

(JSC::DFG::JSC_DEFINE_JIT_OPERATION):

  • ftl/FTLLowerDFGToB3.cpp:

(JSC::FTL::DFG::LowerDFGToB3::compileNewArrayWithSpread):
(JSC::FTL::DFG::LowerDFGToB3::compileSpread):
(JSC::FTL::DFG::LowerDFGToB3::compileCallOrConstructVarargsSpread):
(JSC::FTL::DFG::LowerDFGToB3::compileForwardVarargsWithSpread):

  • ftl/FTLOperations.cpp:

(JSC::FTL::JSC_DEFINE_JIT_OPERATION):

  • heap/Heap.cpp:

(JSC::Heap::deprecatedReportExtraMemorySlowCase):
(JSC::Heap::extraMemorySize):
(JSC::Heap::updateAllocationLimits):
(JSC::Heap::reportExtraMemoryVisited):

  • heap/SlotVisitor.cpp:

(JSC::SlotVisitor::propagateExternalMemoryVisitedIfNecessary):

  • runtime/ArgList.cpp:

(JSC::MarkedArgumentBuffer::slowEnsureCapacity):
(JSC::MarkedArgumentBuffer::expandCapacity):

  • runtime/ArrayPrototype.cpp:

(JSC::concatAppendOne):
(JSC::JSC_DEFINE_HOST_FUNCTION):

  • runtime/CommonSlowPaths.cpp:

(JSC::JSC_DEFINE_COMMON_SLOW_PATH):

  • runtime/DirectArguments.h:
  • runtime/HashMapImpl.h:

(JSC::HashMapBuffer::allocationSize):
(JSC::HashMapImpl::HashMapImpl):

  • runtime/HashMapImplInlines.h:

(JSC::nextCapacity):
(JSC::HashMapImpl<HashMapBucketType>::finishCreation):

  • runtime/JSBigInt.cpp:

(JSC::JSBigInt::parseInt):

  • runtime/JSImmutableButterfly.h:

(JSC::JSImmutableButterfly::tryCreate):

  • runtime/JSLexicalEnvironment.h:

(JSC::JSLexicalEnvironment::offsetOfVariable):
(JSC::JSLexicalEnvironment::allocationSizeForScopeSize):

  • runtime/JSObject.h:
  • runtime/JSPropertyNameEnumerator.cpp:

(JSC::JSPropertyNameEnumerator::create):

  • runtime/JSString.h:
  • runtime/ScopedArguments.cpp:

(JSC::ScopedArguments::createUninitialized):

  • runtime/StringPrototype.cpp:

(JSC::jsSpliceSubstrings):
(JSC::jsSpliceSubstringsWithSeparators):

  • runtime/StructureChain.cpp:

(JSC::StructureChain::create):

  • runtime/VM.h:

(JSC::ScratchBuffer::allocationSize):

  • runtime/WeakMapImpl.h:

(JSC::WeakMapBuffer::allocationSize):

  • wasm/WasmAirIRGenerator.cpp:

(JSC::Wasm::AirIRGenerator::AirIRGenerator):
(JSC::Wasm::AirIRGenerator::emitCallPatchpoint):

  • wasm/WasmB3IRGenerator.cpp:

(JSC::Wasm::B3IRGenerator::B3IRGenerator):

  • wasm/WasmInstance.cpp:
  • wasm/WasmInstance.h:

(JSC::Wasm::Instance::allocationSize):

  • wasm/WasmLLIntGenerator.cpp:

(JSC::Wasm::LLIntGenerator::push):
(JSC::Wasm::LLIntGenerator::getDropKeepCount):
(JSC::Wasm::LLIntGenerator::walkExpressionStack):
(JSC::Wasm::LLIntGenerator::finalize):
(JSC::Wasm::LLIntGenerator::callInformationForCaller):
(JSC::Wasm::LLIntGenerator::addLoop):
(JSC::Wasm::LLIntGenerator::addTopLevel):
(JSC::Wasm::LLIntGenerator::addBlock):
(JSC::Wasm::LLIntGenerator::addIf):
(JSC::Wasm::LLIntGenerator::addElseToUnreachable):

  • wasm/WasmSignature.h:

(JSC::Wasm::Signature::allocatedSize):

  • wasm/WasmStreamingParser.cpp:

(JSC::Wasm::StreamingParser::addBytes):

  • wasm/WasmTable.cpp:

(JSC::Wasm::Table::Table):
(JSC::Wasm::Table::grow):
(JSC::Wasm::FuncRefTable::FuncRefTable):

  • yarr/YarrInterpreter.cpp:

(JSC::Yarr::Interpreter::DisjunctionContext::allocationSize):
(JSC::Yarr::Interpreter::ParenthesesDisjunctionContext::allocationSize):
(JSC::Yarr::Interpreter::allocParenthesesDisjunctionContext):
(JSC::Yarr::ByteCompiler::atomCharacterClass):
(JSC::Yarr::ByteCompiler::atomBackReference):
(JSC::Yarr::ByteCompiler::atomParentheticalAssertionEnd):
(JSC::Yarr::ByteCompiler::atomParenthesesSubpatternEnd):
(JSC::Yarr::ByteCompiler::atomParenthesesOnceEnd):
(JSC::Yarr::ByteCompiler::atomParenthesesTerminalEnd):
(JSC::Yarr::ByteCompiler::emitDisjunction):

  • yarr/YarrInterpreter.h:

(JSC::Yarr::ByteTerm::ByteTerm):
(JSC::Yarr::ByteTerm::CheckInput):
(JSC::Yarr::ByteTerm::UncheckInput):

  • yarr/YarrJIT.cpp:
  • yarr/YarrParser.h:

(JSC::Yarr::Parser::consumeNumber):

  • yarr/YarrPattern.cpp:

(JSC::Yarr::PatternTerm::dumpQuantifier):

Source/WebCore:

  • bindings/js/SerializedScriptValue.cpp:

(WebCore::CloneDeserializer::readTerminal):

  • dom/TextEncoderStreamEncoder.cpp:

(WebCore::TextEncoderStreamEncoder::encode):

  • editing/markup.cpp:

(WebCore::StyledMarkupAccumulator::takeResults):

  • html/FileInputType.cpp:

(WebCore::FileInputType::saveFormControlState const):

  • html/ImageData.cpp:

(WebCore::ImageData::create):
(WebCore::ImageData::createUninitialized):

  • html/MediaElementSession.cpp:

(WebCore::isElementRectMostlyInMainFrame):

  • html/canvas/WebGL2RenderingContext.cpp:

(WebCore::WebGL2RenderingContext::sliceArrayBufferView):
(WebCore::WebGL2RenderingContext::copyBufferSubData):
(WebCore::WebGL2RenderingContext::getBufferSubData):
(WebCore::WebGL2RenderingContext::validateClearBuffer):

  • html/canvas/WebGLBuffer.cpp:

(WebCore::WebGLBuffer::associateBufferSubDataImpl):
(WebCore::WebGLBuffer::associateCopyBufferSubData):

  • html/canvas/WebGLRenderingContextBase.cpp:

(WebCore::clip2D):
(WebCore::WebGLRenderingContextBase::validateDrawArrays):
(WebCore::WebGLRenderingContextBase::validateDrawElements):
(WebCore::WebGLRenderingContextBase::validateTexFuncData):
(WebCore::WebGLRenderingContextBase::validateCompressedTexFuncData):
(WebCore::WebGLRenderingContextBase::validateSimulatedVertexAttrib0):

  • html/canvas/WebGLRenderingContextBase.h:

(WebCore::WebGLRenderingContextBase::validateTexImageSubRectangle):
(WebCore::WebGLRenderingContextBase::checkedAddAndMultiply):

  • page/FrameView.h:

(WebCore::FrameView::incrementVisuallyNonEmptyPixelCount):

  • page/History.cpp:

(WebCore::History::stateObjectAdded):

  • platform/audio/AudioArray.h:

(WebCore::AudioArray::resize):

  • platform/audio/cocoa/AudioFileReaderCocoa.cpp:

(WebCore::tryCreateAudioBufferList):

  • platform/audio/cocoa/CARingBuffer.cpp:

(WebCore::CARingBuffer::adoptStorage):
(WebCore::CARingBuffer::initializeAfterAllocation):
(WebCore::CARingBuffer::allocate):

  • platform/audio/cocoa/WebAudioBufferList.cpp:

(WebCore::WebAudioBufferList::WebAudioBufferList):

  • platform/graphics/FormatConverter.h:

(WebCore::FormatConverter::FormatConverter):

  • platform/graphics/GraphicsContextGL.cpp:

(WebCore::GraphicsContextGL::computeImageSizeInBytes):

  • platform/graphics/ImageBackingStore.h:

(WebCore::ImageBackingStore::setSize):
(WebCore::ImageBackingStore::clear):

  • platform/graphics/ImageBufferBackend.cpp:

(WebCore::ImageBufferBackend::calculateMemoryCost):

  • platform/graphics/ImageFrame.h:

(WebCore::ImageFrame::frameBytes const):

  • platform/graphics/ImageSource.cpp:

(WebCore::ImageSource::maximumSubsamplingLevel):

  • platform/graphics/PixelBuffer.cpp:

(WebCore::PixelBuffer::tryCreateForDecoding):
(WebCore::PixelBuffer::tryCreate):

  • platform/graphics/PixelBuffer.h:

(WebCore::PixelBuffer::encode const):
(WebCore::PixelBuffer::decode):

  • platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm:

(WebCore::ImageDecoderAVFObjC::frameBytesAtIndex const):

  • platform/graphics/avfoundation/objc/MediaSampleAVFObjC.mm:

(WebCore::MediaSampleAVFObjC::setByteRangeOffset):
(WebCore::MediaSampleAVFObjC::byteRangeForAttachment const):

  • platform/graphics/ca/GraphicsLayerCA.cpp:

(WebCore::GraphicsLayerCA::updateBackdropFilters):

  • platform/graphics/ca/LayerPool.cpp:

(WebCore::LayerPool::backingStoreBytesForSize):

  • platform/graphics/cg/GraphicsContextGLCG.cpp:

(WebCore::GraphicsContextGLImageExtractor::extractImage):

  • platform/graphics/cg/ImageBufferCGBackend.cpp:

(WebCore::ImageBufferCGBackend::calculateBytesPerRow):

  • platform/graphics/cg/ImageDecoderCG.cpp:

(WebCore::ImageDecoderCG::frameBytesAtIndex const):

  • platform/graphics/cocoa/SourceBufferParser.cpp:

(WebCore::SourceBufferParser::Segment::read const):

  • platform/graphics/filters/FEColorMatrix.cpp:

(WebCore::effectApplyAccelerated):

  • platform/graphics/filters/FEGaussianBlur.cpp:

(WebCore::FEGaussianBlur::platformApplySoftware):

  • platform/graphics/filters/FETurbulence.cpp:

(WebCore::FETurbulence::platformApplySoftware):

  • platform/graphics/filters/FilterEffect.cpp:

(WebCore::FilterEffect::unmultipliedResult):
(WebCore::FilterEffect::premultipliedResult):
(WebCore::copyPremultiplyingAlpha):
(WebCore::copyUnpremultiplyingAlpha):

  • platform/graphics/gpu/cocoa/GPUBindGroupAllocatorMetal.mm:

(WebCore::GPUBindGroupAllocator::allocateAndSetEncoders):
(WebCore::GPUBindGroupAllocator::reallocate):

  • platform/graphics/gpu/cocoa/GPUCommandBufferMetal.mm:

(WebCore::GPUCommandBuffer::copyBufferToBuffer):

  • platform/graphics/gpu/cocoa/GPURenderPassEncoderMetal.mm:

(WebCore::GPURenderPassEncoder::drawIndexed):

  • platform/graphics/gstreamer/ImageDecoderGStreamer.cpp:

(WebCore::ImageDecoderGStreamer::frameBytesAtIndex const):

  • platform/graphics/nicosia/NicosiaBuffer.cpp:

(Nicosia::Buffer::Buffer):

  • platform/graphics/win/Direct2DUtilities.cpp:

(WebCore::Direct2D::createDirect2DImageSurfaceWithData):

  • platform/graphics/win/ImageBufferDirect2DBackend.cpp:

(WebCore::ImageBufferDirect2DBackend::compatibleBitmap):

  • platform/graphics/win/ImageDecoderDirect2D.cpp:

(WebCore::ImageDecoderDirect2D::frameBytesAtIndex const):

  • platform/image-decoders/ScalableImageDecoder.cpp:

(WebCore::ScalableImageDecoder::frameBytesAtIndex const):

  • platform/image-decoders/jpeg2000/JPEG2000ImageDecoder.cpp:

(WebCore::sycc444ToRGB):
(WebCore::sycc422ToRGB):
(WebCore::sycc420ToRGB):

  • platform/ios/LegacyTileLayerPool.mm:

(WebCore::LegacyTileLayerPool::bytesBackingLayerWithPixelSize):

  • platform/text/TextCodecUTF16.cpp:

(WebCore::TextCodecUTF16::encode const):

  • platform/text/TextCodecUTF8.cpp:

(WebCore::TextCodecUTF8::encodeUTF8):

  • rendering/RenderLayerCompositor.cpp:

(WebCore::RenderLayerCompositor::requiresCompositingForCanvas const):

  • rendering/shapes/Shape.cpp:

(WebCore::Shape::createRasterShape):

  • storage/StorageMap.cpp:

(WebCore::StorageMap::setItem):

  • xml/XSLStyleSheetLibxslt.cpp:

(WebCore::XSLStyleSheet::parseString):

  • xml/XSLTProcessorLibxslt.cpp:

(WebCore::xsltParamArrayFromParameterMap):

  • xml/parser/CharacterReferenceParserInlines.h:

(WebCore::consumeCharacterReference):

Source/WebKit:

  • GPUProcess/graphics/RemoteRenderingBackend.cpp:

(WebKit::RemoteRenderingBackend::nextDestinationImageBufferAfterApplyingDisplayLists):

  • NetworkProcess/WebStorage/LocalStorageDatabase.cpp:

(WebKit::LocalStorageDatabase::setItem):

  • NetworkProcess/cache/CacheStorageEngineCache.cpp:

(WebKit::CacheStorage::Cache::put):

  • Platform/IPC/ArgumentCoders.h:
  • Platform/IPC/cocoa/ConnectionCocoa.mm:

(IPC::Connection::sendOutgoingMessage):
(IPC::createMessageDecoder):

  • Platform/IPC/cocoa/MachMessage.cpp:

(IPC::MachMessage::create):

  • Shared/ShareableBitmap.cpp:

(WebKit::ShareableBitmap::Handle::encode const):
(WebKit::ShareableBitmap::create):
(WebKit::ShareableBitmap::createShareable):

  • Shared/ShareableBitmap.h:

(WebKit::ShareableBitmap::bytesPerRow const):
(WebKit::ShareableBitmap::sizeInBytes const):

  • Shared/ShareableResource.cpp:

(WebKit::ShareableResource::create):

  • Shared/cg/ShareableBitmapCG.cpp:

(WebKit::ShareableBitmap::calculateBytesPerRow):
(WebKit::ShareableBitmap::createGraphicsContext):
(WebKit::ShareableBitmap::createCGImage const):

  • Shared/mac/MediaFormatReader/MediaFormatReader.cpp:

(WebKit::MediaFormatReader::copyTrackArray):

  • Shared/mac/MediaFormatReader/MediaSampleCursor.cpp:

(WebKit::MediaSampleCursor::copySampleLocation const):

  • WebProcess/GPU/graphics/DisplayListWriterHandle.cpp:

(WebKit::DisplayListWriterHandle::advance):

  • WebProcess/GPU/graphics/ImageBufferShareableBitmapBackend.cpp:

(WebKit::ImageBufferShareableBitmapBackend::calculateBytesPerRow):

  • WebProcess/GPU/media/RemoteImageDecoderAVF.cpp:

(WebKit::RemoteImageDecoderAVF::frameBytesAtIndex const):

  • WebProcess/Network/WebSocketChannel.cpp:

(WebKit::WebSocketChannel::increaseBufferedAmount):

  • WebProcess/WebPage/ios/WebPageIOS.mm:

(WebKit::WebPage::requestEvasionRectsAboveSelection):
(WebKit::WebPage::updateSelectionWithDelta):

Source/WTF:

  • wtf/CheckedArithmetic.h:

(WTF::Checked::operator! const):
(WTF::Checked::operator bool const):
(WTF::Checked::operator T const):
(WTF::Checked::value const):
(WTF::Checked::operator==):
(WTF::Checked::operator< const):
(WTF::Checked::operator<= const):
(WTF::Checked::operator> const):
(WTF::Checked::operator>= const):

  • wtf/ConcurrentBuffer.h:
  • wtf/FastMalloc.cpp:

(WTF::fastCalloc):
(WTF::tryFastCalloc):

  • wtf/Gigacage.cpp:

(Gigacage::tryMallocArray):

  • wtf/URLHelpers.cpp:

(WTF::URLHelpers::userVisibleURL):

  • wtf/URLParser.cpp:

(WTF::URLParser::parseIPv4Piece):

  • wtf/UniqueArray.h:
  • wtf/cocoa/NSURLExtras.mm:

(WTF::dataWithUserTypedString):

  • wtf/glib/SocketConnection.cpp:

(WTF::SocketConnection::readMessage):
(WTF::SocketConnection::sendMessage):

  • wtf/text/CString.cpp:

(WTF::CStringBuffer::createUninitialized):

  • wtf/text/StringBuffer.h:

(WTF::StringBuffer::StringBuffer):

  • wtf/text/StringBuilderJSON.cpp:

(WTF::StringBuilder::appendQuotedJSONString):

  • wtf/text/StringConcatenate.h:

(WTF::tryMakeStringFromAdapters):

  • wtf/text/StringImpl.h:

(WTF::StringImpl::allocationSize):

  • wtf/text/StringToIntegerConversion.h:

(WTF::parseInteger):

Tools:

  • TestWebKitAPI/Tests/WTF/CheckedArithmeticOperations.cpp:

(TestWebKitAPI::CheckedArithmeticTester::run):
(TestWebKitAPI::AllowMixedSignednessTest::run):
(TestWebKitAPI::TEST):

  • TestWebKitAPI/Tests/WebCore/IntRectTests.cpp:

(TestWebKitAPI::TEST):

  • TestWebKitAPI/Tests/WebCore/IntSizeTests.cpp:

(TestWebKitAPI::TEST):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h

    r278253 r278338  
    208208        RegisterID* completionValueRegister() const { return m_completionRecord.valueRegister.get(); }
    209209
    210         uint32_t numberOfBreaksOrContinues() const { return m_numberOfBreaksOrContinues.unsafeGet(); }
     210        uint32_t numberOfBreaksOrContinues() const { return m_numberOfBreaksOrContinues; }
    211211        void incNumberOfBreaksOrContinues() { m_numberOfBreaksOrContinues++; }
    212212
Note: See TracChangeset for help on using the changeset viewer.