Skip to content

Commit 2283824

Browse files
committed
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): Canonical link: https://commits.webkit.org/238371@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@278338 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent 84d1028 commit 2283824

134 files changed

Lines changed: 834 additions & 457 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎Source/JavaScriptCore/ChangeLog‎

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,128 @@
1+
2021-06-01 Chris Dumez <cdumez@apple.com>
2+
3+
Rename Checked::unsafeGet() to Checked::value()
4+
https://bugs.webkit.org/show_bug.cgi?id=226514
5+
6+
Reviewed by Darin Adler.
7+
8+
Rename Checked::unsafeGet() to Checked::value(). The "unsafeGet" naming is confusing as this
9+
function isn't really unsafe since it will crash if the value has overflowed. Also add an
10+
`operator T()` to implicitly convert a Checked to its underlying type without needing to
11+
call value().
12+
13+
* b3/B3Const32Value.cpp:
14+
(JSC::B3::Const32Value::checkAddConstant const):
15+
(JSC::B3::Const32Value::checkSubConstant const):
16+
(JSC::B3::Const32Value::checkMulConstant const):
17+
* b3/B3Const64Value.cpp:
18+
(JSC::B3::Const64Value::checkAddConstant const):
19+
(JSC::B3::Const64Value::checkSubConstant const):
20+
(JSC::B3::Const64Value::checkMulConstant const):
21+
* bytecompiler/BytecodeGenerator.h:
22+
(JSC::FinallyContext::numberOfBreaksOrContinues const):
23+
* dfg/DFGConstantFoldingPhase.cpp:
24+
(JSC::DFG::ConstantFoldingPhase::foldConstants):
25+
* dfg/DFGOperations.cpp:
26+
(JSC::DFG::JSC_DEFINE_JIT_OPERATION):
27+
* ftl/FTLLowerDFGToB3.cpp:
28+
(JSC::FTL::DFG::LowerDFGToB3::compileNewArrayWithSpread):
29+
(JSC::FTL::DFG::LowerDFGToB3::compileSpread):
30+
(JSC::FTL::DFG::LowerDFGToB3::compileCallOrConstructVarargsSpread):
31+
(JSC::FTL::DFG::LowerDFGToB3::compileForwardVarargsWithSpread):
32+
* ftl/FTLOperations.cpp:
33+
(JSC::FTL::JSC_DEFINE_JIT_OPERATION):
34+
* heap/Heap.cpp:
35+
(JSC::Heap::deprecatedReportExtraMemorySlowCase):
36+
(JSC::Heap::extraMemorySize):
37+
(JSC::Heap::updateAllocationLimits):
38+
(JSC::Heap::reportExtraMemoryVisited):
39+
* heap/SlotVisitor.cpp:
40+
(JSC::SlotVisitor::propagateExternalMemoryVisitedIfNecessary):
41+
* runtime/ArgList.cpp:
42+
(JSC::MarkedArgumentBuffer::slowEnsureCapacity):
43+
(JSC::MarkedArgumentBuffer::expandCapacity):
44+
* runtime/ArrayPrototype.cpp:
45+
(JSC::concatAppendOne):
46+
(JSC::JSC_DEFINE_HOST_FUNCTION):
47+
* runtime/CommonSlowPaths.cpp:
48+
(JSC::JSC_DEFINE_COMMON_SLOW_PATH):
49+
* runtime/DirectArguments.h:
50+
* runtime/HashMapImpl.h:
51+
(JSC::HashMapBuffer::allocationSize):
52+
(JSC::HashMapImpl::HashMapImpl):
53+
* runtime/HashMapImplInlines.h:
54+
(JSC::nextCapacity):
55+
(JSC::HashMapImpl<HashMapBucketType>::finishCreation):
56+
* runtime/JSBigInt.cpp:
57+
(JSC::JSBigInt::parseInt):
58+
* runtime/JSImmutableButterfly.h:
59+
(JSC::JSImmutableButterfly::tryCreate):
60+
* runtime/JSLexicalEnvironment.h:
61+
(JSC::JSLexicalEnvironment::offsetOfVariable):
62+
(JSC::JSLexicalEnvironment::allocationSizeForScopeSize):
63+
* runtime/JSObject.h:
64+
* runtime/JSPropertyNameEnumerator.cpp:
65+
(JSC::JSPropertyNameEnumerator::create):
66+
* runtime/JSString.h:
67+
* runtime/ScopedArguments.cpp:
68+
(JSC::ScopedArguments::createUninitialized):
69+
* runtime/StringPrototype.cpp:
70+
(JSC::jsSpliceSubstrings):
71+
(JSC::jsSpliceSubstringsWithSeparators):
72+
* runtime/StructureChain.cpp:
73+
(JSC::StructureChain::create):
74+
* runtime/VM.h:
75+
(JSC::ScratchBuffer::allocationSize):
76+
* runtime/WeakMapImpl.h:
77+
(JSC::WeakMapBuffer::allocationSize):
78+
* wasm/WasmAirIRGenerator.cpp:
79+
(JSC::Wasm::AirIRGenerator::AirIRGenerator):
80+
(JSC::Wasm::AirIRGenerator::emitCallPatchpoint):
81+
* wasm/WasmB3IRGenerator.cpp:
82+
(JSC::Wasm::B3IRGenerator::B3IRGenerator):
83+
* wasm/WasmInstance.cpp:
84+
* wasm/WasmInstance.h:
85+
(JSC::Wasm::Instance::allocationSize):
86+
* wasm/WasmLLIntGenerator.cpp:
87+
(JSC::Wasm::LLIntGenerator::push):
88+
(JSC::Wasm::LLIntGenerator::getDropKeepCount):
89+
(JSC::Wasm::LLIntGenerator::walkExpressionStack):
90+
(JSC::Wasm::LLIntGenerator::finalize):
91+
(JSC::Wasm::LLIntGenerator::callInformationForCaller):
92+
(JSC::Wasm::LLIntGenerator::addLoop):
93+
(JSC::Wasm::LLIntGenerator::addTopLevel):
94+
(JSC::Wasm::LLIntGenerator::addBlock):
95+
(JSC::Wasm::LLIntGenerator::addIf):
96+
(JSC::Wasm::LLIntGenerator::addElseToUnreachable):
97+
* wasm/WasmSignature.h:
98+
(JSC::Wasm::Signature::allocatedSize):
99+
* wasm/WasmStreamingParser.cpp:
100+
(JSC::Wasm::StreamingParser::addBytes):
101+
* wasm/WasmTable.cpp:
102+
(JSC::Wasm::Table::Table):
103+
(JSC::Wasm::Table::grow):
104+
(JSC::Wasm::FuncRefTable::FuncRefTable):
105+
* yarr/YarrInterpreter.cpp:
106+
(JSC::Yarr::Interpreter::DisjunctionContext::allocationSize):
107+
(JSC::Yarr::Interpreter::ParenthesesDisjunctionContext::allocationSize):
108+
(JSC::Yarr::Interpreter::allocParenthesesDisjunctionContext):
109+
(JSC::Yarr::ByteCompiler::atomCharacterClass):
110+
(JSC::Yarr::ByteCompiler::atomBackReference):
111+
(JSC::Yarr::ByteCompiler::atomParentheticalAssertionEnd):
112+
(JSC::Yarr::ByteCompiler::atomParenthesesSubpatternEnd):
113+
(JSC::Yarr::ByteCompiler::atomParenthesesOnceEnd):
114+
(JSC::Yarr::ByteCompiler::atomParenthesesTerminalEnd):
115+
(JSC::Yarr::ByteCompiler::emitDisjunction):
116+
* yarr/YarrInterpreter.h:
117+
(JSC::Yarr::ByteTerm::ByteTerm):
118+
(JSC::Yarr::ByteTerm::CheckInput):
119+
(JSC::Yarr::ByteTerm::UncheckInput):
120+
* yarr/YarrJIT.cpp:
121+
* yarr/YarrParser.h:
122+
(JSC::Yarr::Parser::consumeNumber):
123+
* yarr/YarrPattern.cpp:
124+
(JSC::Yarr::PatternTerm::dumpQuantifier):
125+
1126
2021-06-01 Adrian Perez de Castro <aperez@igalia.com>
2127

3128
[WPE][GTK] Support building against uClibc

‎Source/JavaScriptCore/b3/B3Const32Value.cpp‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ Value* Const32Value::checkAddConstant(Procedure& proc, const Value* other) const
7575
CheckedInt32 result = CheckedInt32(m_value) + CheckedInt32(other->asInt32());
7676
if (result.hasOverflowed())
7777
return nullptr;
78-
return proc.add<Const32Value>(origin(), result.unsafeGet());
78+
return proc.add<Const32Value>(origin(), result);
7979
}
8080

8181
Value* Const32Value::checkSubConstant(Procedure& proc, const Value* other) const
@@ -85,7 +85,7 @@ Value* Const32Value::checkSubConstant(Procedure& proc, const Value* other) const
8585
CheckedInt32 result = CheckedInt32(m_value) - CheckedInt32(other->asInt32());
8686
if (result.hasOverflowed())
8787
return nullptr;
88-
return proc.add<Const32Value>(origin(), result.unsafeGet());
88+
return proc.add<Const32Value>(origin(), result);
8989
}
9090

9191
Value* Const32Value::checkMulConstant(Procedure& proc, const Value* other) const
@@ -95,7 +95,7 @@ Value* Const32Value::checkMulConstant(Procedure& proc, const Value* other) const
9595
CheckedInt32 result = CheckedInt32(m_value) * CheckedInt32(other->asInt32());
9696
if (result.hasOverflowed())
9797
return nullptr;
98-
return proc.add<Const32Value>(origin(), result.unsafeGet());
98+
return proc.add<Const32Value>(origin(), result);
9999
}
100100

101101
Value* Const32Value::checkNegConstant(Procedure& proc) const

‎Source/JavaScriptCore/b3/B3Const64Value.cpp‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ Value* Const64Value::checkAddConstant(Procedure& proc, const Value* other) const
7575
CheckedInt64 result = CheckedInt64(m_value) + CheckedInt64(other->asInt64());
7676
if (result.hasOverflowed())
7777
return nullptr;
78-
return proc.add<Const64Value>(origin(), result.unsafeGet());
78+
return proc.add<Const64Value>(origin(), result);
7979
}
8080

8181
Value* Const64Value::checkSubConstant(Procedure& proc, const Value* other) const
@@ -85,7 +85,7 @@ Value* Const64Value::checkSubConstant(Procedure& proc, const Value* other) const
8585
CheckedInt64 result = CheckedInt64(m_value) - CheckedInt64(other->asInt64());
8686
if (result.hasOverflowed())
8787
return nullptr;
88-
return proc.add<Const64Value>(origin(), result.unsafeGet());
88+
return proc.add<Const64Value>(origin(), result);
8989
}
9090

9191
Value* Const64Value::checkMulConstant(Procedure& proc, const Value* other) const
@@ -95,7 +95,7 @@ Value* Const64Value::checkMulConstant(Procedure& proc, const Value* other) const
9595
CheckedInt64 result = CheckedInt64(m_value) * CheckedInt64(other->asInt64());
9696
if (result.hasOverflowed())
9797
return nullptr;
98-
return proc.add<Const64Value>(origin(), result.unsafeGet());
98+
return proc.add<Const64Value>(origin(), result);
9999
}
100100

101101
Value* Const64Value::checkNegConstant(Procedure& proc) const

‎Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ namespace JSC {
207207
RegisterID* completionTypeRegister() const { return m_completionRecord.typeRegister.get(); }
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

213213
bool handlesReturns() const { return m_handlesReturns; }

‎Source/JavaScriptCore/dfg/DFGConstantFoldingPhase.cpp‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -394,12 +394,12 @@ class ConstantFoldingPhase : public Phase {
394394
if (!indexValue || !indexValue.isUInt32())
395395
break;
396396

397-
Checked<unsigned, RecordOverflow> checkedIndex = indexValue.asUInt32();
397+
CheckedUint32 checkedIndex = indexValue.asUInt32();
398398
checkedIndex += node->numberOfArgumentsToSkip();
399399
if (checkedIndex.hasOverflowed())
400400
break;
401401

402-
unsigned index = checkedIndex.unsafeGet();
402+
unsigned index = checkedIndex;
403403
Node* arguments = node->child1().node();
404404
InlineCallFrame* inlineCallFrame = arguments->origin.semantic.inlineCallFrame();
405405

‎Source/JavaScriptCore/dfg/DFGOperations.cpp‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3033,7 +3033,7 @@ JSC_DEFINE_JIT_OPERATION(operationNewArrayWithSpreadSlow, JSCell*, (JSGlobalObje
30333033
auto scope = DECLARE_THROW_SCOPE(vm);
30343034

30353035
EncodedJSValue* values = static_cast<EncodedJSValue*>(buffer);
3036-
Checked<unsigned, RecordOverflow> checkedLength = 0;
3036+
CheckedUint32 checkedLength = 0;
30373037
for (unsigned i = 0; i < numItems; i++) {
30383038
JSValue value = JSValue::decode(values[i]);
30393039
if (JSImmutableButterfly* array = jsDynamicCast<JSImmutableButterfly*>(vm, value))
@@ -3047,7 +3047,7 @@ JSC_DEFINE_JIT_OPERATION(operationNewArrayWithSpreadSlow, JSCell*, (JSGlobalObje
30473047
return nullptr;
30483048
}
30493049

3050-
unsigned length = checkedLength.unsafeGet();
3050+
unsigned length = checkedLength;
30513051
if (UNLIKELY(length >= MIN_ARRAY_STORAGE_CONSTRUCTION_LENGTH)) {
30523052
throwOutOfMemoryError(globalObject, scope);
30533053
return nullptr;

‎Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7284,7 +7284,7 @@ class LowerDFGToB3 {
72847284
return;
72857285
}
72867286

7287-
LValue length = m_out.constInt32(startLength.unsafeGet());
7287+
LValue length = m_out.constInt32(startLength);
72887288

72897289
for (unsigned i = 0; i < m_node->numChildren(); ++i) {
72907290
if (bitVector->get(i)) {
@@ -7331,7 +7331,7 @@ class LowerDFGToB3 {
73317331
// Because resulted array from NewArrayWithSpread is always contiguous, we should not generate value
73327332
// in Double form even if PhantomNewArrayBuffer's indexingType is ArrayWithDouble.
73337333
int64_t value = JSValue::encode(array->get(i));
7334-
m_out.store64(m_out.constInt64(value), m_out.baseIndex(heap, storage, index, JSValue(), (Checked<int32_t>(sizeof(JSValue)) * i).unsafeGet()));
7334+
m_out.store64(m_out.constInt64(value), m_out.baseIndex(heap, storage, index, JSValue(), Checked<int32_t>(sizeof(JSValue)) * i));
73357335
}
73367336
index = m_out.add(index, m_out.constIntPtr(array->length()));
73377337
} else {
@@ -7625,7 +7625,7 @@ class LowerDFGToB3 {
76257625
ASSERT(immutableButterfly->length() <= MAX_STORAGE_VECTOR_LENGTH);
76267626

76277627
LValue fastImmutableButterflyValue = allocateVariableSizedCell<JSImmutableButterfly>(
7628-
m_out.constIntPtr(JSImmutableButterfly::allocationSize(immutableButterfly->length()).unsafeGet()),
7628+
m_out.constIntPtr(JSImmutableButterfly::allocationSize(immutableButterfly->length())),
76297629
m_graph.m_vm.immutableButterflyStructures[arrayIndexFromIndexingType(CopyOnWriteArrayWithContiguous) - NumberOfIndexingShapes].get(), slowAllocation);
76307630
LValue fastImmutableButterflyStorage = toButterfly(fastImmutableButterflyValue);
76317631
m_out.store32(m_out.constInt32(immutableButterfly->length()), fastImmutableButterflyStorage, m_heaps.Butterfly_publicLength);
@@ -10237,7 +10237,7 @@ class LowerDFGToB3 {
1023710237
Checked<int32_t> currentStoreOffset { storeOffset };
1023810238
currentStoreOffset -= (offsetCount * static_cast<int32_t>(sizeof(Register)));
1023910239
jit.store64(scratchGPR3,
10240-
CCallHelpers::BaseIndex(scratchGPR1, scratchGPR2, CCallHelpers::TimesEight, currentStoreOffset.unsafeGet()));
10240+
CCallHelpers::BaseIndex(scratchGPR1, scratchGPR2, CCallHelpers::TimesEight, currentStoreOffset));
1024110241
}
1024210242
jit.subPtr(CCallHelpers::TrustedImmPtr(static_cast<size_t>(array->length())), scratchGPR2);
1024310243
return;
@@ -10885,7 +10885,7 @@ class LowerDFGToB3 {
1088510885
// Because forwarded values are drained as JSValue, we should not generate value
1088610886
// in Double form even if PhantomNewArrayBuffer's indexingType is ArrayWithDouble.
1088710887
int64_t value = JSValue::encode(array->get(i));
10888-
m_out.store64(m_out.constInt64(value), m_out.baseIndex(m_heaps.variables, targetStart, storeIndex, JSValue(), (Checked<int32_t>(sizeof(Register)) * i).unsafeGet()));
10888+
m_out.store64(m_out.constInt64(value), m_out.baseIndex(m_heaps.variables, targetStart, storeIndex, JSValue(), Checked<int32_t>(sizeof(Register)) * i));
1088910889
}
1089010890
return m_out.add(m_out.constIntPtr(array->length()), storeIndex);
1089110891
}

‎Source/JavaScriptCore/ftl/FTLOperations.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,7 @@ JSC_DEFINE_JIT_OPERATION(operationMaterializeObjectInOSR, JSCell*, (JSGlobalObje
628628

629629
// FIXME: we should throw an out of memory error here if checkedArraySize has hasOverflowed() or tryCreate() fails.
630630
// https://bugs.webkit.org/show_bug.cgi?id=169784
631-
unsigned arraySize = checkedArraySize.unsafeGet(); // Crashes if overflowed.
631+
unsigned arraySize = checkedArraySize; // Crashes if overflowed.
632632
JSArray* result = JSArray::tryCreate(vm, structure, arraySize);
633633
RELEASE_ASSERT(result);
634634

‎Source/JavaScriptCore/heap/Heap.cpp‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,7 @@ void Heap::deprecatedReportExtraMemorySlowCase(size_t size)
517517
// https://bugs.webkit.org/show_bug.cgi?id=170411
518518
CheckedSize checkedNewSize = m_deprecatedExtraMemorySize;
519519
checkedNewSize += size;
520-
m_deprecatedExtraMemorySize = UNLIKELY(checkedNewSize.hasOverflowed()) ? std::numeric_limits<size_t>::max() : checkedNewSize.unsafeGet();
520+
m_deprecatedExtraMemorySize = UNLIKELY(checkedNewSize.hasOverflowed()) ? std::numeric_limits<size_t>::max() : checkedNewSize.value();
521521
reportExtraMemoryAllocatedSlowCase(size);
522522
}
523523

@@ -826,7 +826,7 @@ size_t Heap::extraMemorySize()
826826
CheckedSize checkedTotal = m_extraMemorySize;
827827
checkedTotal += m_deprecatedExtraMemorySize;
828828
checkedTotal += m_arrayBuffers.size();
829-
size_t total = UNLIKELY(checkedTotal.hasOverflowed()) ? std::numeric_limits<size_t>::max() : checkedTotal.unsafeGet();
829+
size_t total = UNLIKELY(checkedTotal.hasOverflowed()) ? std::numeric_limits<size_t>::max() : checkedTotal.value();
830830

831831
ASSERT(m_objectSpace.capacity() >= m_objectSpace.size());
832832
return std::min(total, std::numeric_limits<size_t>::max() - m_objectSpace.capacity());
@@ -2255,7 +2255,7 @@ void Heap::updateAllocationLimits()
22552255
if (ASSERT_ENABLED) {
22562256
CheckedSize checkedCurrentHeapSize = m_totalBytesVisited;
22572257
checkedCurrentHeapSize += extraMemorySize();
2258-
ASSERT(!checkedCurrentHeapSize.hasOverflowed() && checkedCurrentHeapSize.unsafeGet() == currentHeapSize);
2258+
ASSERT(!checkedCurrentHeapSize.hasOverflowed() && checkedCurrentHeapSize == currentHeapSize);
22592259
}
22602260

22612261
if (verbose)
@@ -2558,7 +2558,7 @@ void Heap::reportExtraMemoryVisited(size_t size)
25582558
// https://bugs.webkit.org/show_bug.cgi?id=170411
25592559
CheckedSize checkedNewSize = oldSize;
25602560
checkedNewSize += size;
2561-
size_t newSize = UNLIKELY(checkedNewSize.hasOverflowed()) ? std::numeric_limits<size_t>::max() : checkedNewSize.unsafeGet();
2561+
size_t newSize = UNLIKELY(checkedNewSize.hasOverflowed()) ? std::numeric_limits<size_t>::max() : checkedNewSize.value();
25622562
if (WTF::atomicCompareExchangeWeakRelaxed(counter, oldSize, newSize))
25632563
return;
25642564
}

‎Source/JavaScriptCore/heap/SlotVisitor.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ inline void SlotVisitor::propagateExternalMemoryVisitedIfNecessary()
415415
if (m_extraMemorySize.hasOverflowed())
416416
heap()->reportExtraMemoryVisited(std::numeric_limits<size_t>::max());
417417
else if (m_extraMemorySize)
418-
heap()->reportExtraMemoryVisited(m_extraMemorySize.unsafeGet());
418+
heap()->reportExtraMemoryVisited(m_extraMemorySize);
419419
m_extraMemorySize = 0;
420420
}
421421
}

0 commit comments

Comments
 (0)