Skip to content

Commit d66a7a4

Browse files
committed
Stop using const char* in string concatenation in JSC
https://bugs.webkit.org/show_bug.cgi?id=273756 Reviewed by Tim Nguyen. This is a step towards removing the StringTypeAdapter specializations for `const char*`. * Source/JavaScriptCore/API/JSAPIGlobalObject.mm: (JSC::JSAPIGlobalObject::moduleLoaderFetch): * Source/JavaScriptCore/API/JSContextRef.cpp: (BacktraceFunctor::operator() const): * Source/JavaScriptCore/API/JSScript.mm: (-[JSScript writeCache:]): * Source/JavaScriptCore/API/tests/ExecutionTimeLimitTest.cpp: (testExecutionTimeLimit): * Source/JavaScriptCore/dfg/DFGCFAPhase.cpp: (JSC::DFG::CFAPhase::performBlockCFA): * Source/JavaScriptCore/dfg/DFGGraph.cpp: (JSC::DFG::Graph::opName): * Source/JavaScriptCore/dfg/DFGGraph.h: * Source/JavaScriptCore/heap/HeapSnapshotBuilder.cpp: (JSC::edgeTypeToString): (JSC::snapshotTypeToString): (JSC::HeapSnapshotBuilder::json): * Source/JavaScriptCore/inspector/InspectorBackendDispatcher.cpp: (Inspector::BackendDispatcher::getPropertyValue): (Inspector::BackendDispatcher::getBoolean): (Inspector::BackendDispatcher::getInteger): (Inspector::BackendDispatcher::getDouble): (Inspector::BackendDispatcher::getString): (Inspector::BackendDispatcher::getValue): (Inspector::BackendDispatcher::getObject): (Inspector::BackendDispatcher::getArray): * Source/JavaScriptCore/inspector/InspectorBackendDispatcher.h: * Source/JavaScriptCore/interpreter/StackVisitor.cpp: (JSC::StackVisitor::Frame::toString const): * Source/JavaScriptCore/jsc.cpp: * Source/JavaScriptCore/parser/Parser.h: (JSC::Parser::updateErrorWithNameAndMessage): * Source/JavaScriptCore/runtime/AtomicsObject.cpp: * Source/JavaScriptCore/runtime/BigIntConstructor.cpp: (JSC::JSC_DEFINE_HOST_FUNCTION): * Source/JavaScriptCore/runtime/ConsoleClient.cpp: (JSC::ConsoleClient::printConsoleMessageWithArguments): * Source/JavaScriptCore/runtime/Error.cpp: (JSC::makeDOMAttributeGetterTypeErrorMessage): (JSC::makeDOMAttributeSetterTypeErrorMessage): (JSC::throwConstructorCannotBeCalledAsFunctionTypeError): * Source/JavaScriptCore/runtime/Error.h: * Source/JavaScriptCore/runtime/ErrorPrototype.cpp: (JSC::JSC_DEFINE_HOST_FUNCTION): * Source/JavaScriptCore/runtime/ExceptionHelpers.cpp: (JSC::notAFunctionSourceAppender): (JSC::createErrorForInvalidGlobalFunctionDeclaration): (JSC::createErrorForInvalidGlobalVarDeclaration): * Source/JavaScriptCore/runtime/FinalizationRegistryConstructor.cpp: (JSC::JSC_DEFINE_HOST_FUNCTION): * Source/JavaScriptCore/runtime/FunctionConstructor.cpp: (JSC::stringifyFunction): * Source/JavaScriptCore/runtime/FunctionExecutable.cpp: (JSC::FunctionExecutable::toStringSlow): * Source/JavaScriptCore/runtime/FunctionPrototype.cpp: (JSC::JSC_DEFINE_HOST_FUNCTION): * Source/JavaScriptCore/runtime/IntlDateTimeFormat.cpp: (JSC::IntlDateTimeFormat::initializeDateTimeFormat): (JSC::IntlDateTimeFormat::createDateIntervalFormatIfNecessary): * Source/JavaScriptCore/runtime/IntlDisplayNamesConstructor.cpp: (JSC::JSC_DEFINE_HOST_FUNCTION): * Source/JavaScriptCore/runtime/IntlDurationFormatConstructor.cpp: (JSC::JSC_DEFINE_HOST_FUNCTION): * Source/JavaScriptCore/runtime/IntlListFormatConstructor.cpp: (JSC::JSC_DEFINE_HOST_FUNCTION): * Source/JavaScriptCore/runtime/IntlLocaleConstructor.cpp: (JSC::JSC_DEFINE_HOST_FUNCTION): * Source/JavaScriptCore/runtime/IntlPluralRulesConstructor.cpp: (JSC::JSC_DEFINE_HOST_FUNCTION): * Source/JavaScriptCore/runtime/IntlRelativeTimeFormatConstructor.cpp: (JSC::JSC_DEFINE_HOST_FUNCTION): * Source/JavaScriptCore/runtime/IntlSegmenterConstructor.cpp: (JSC::JSC_DEFINE_HOST_FUNCTION): * Source/JavaScriptCore/runtime/JSArrayBufferConstructor.cpp: (JSC::JSC_DEFINE_HOST_FUNCTION): * Source/JavaScriptCore/runtime/JSCJSValue.h: * Source/JavaScriptCore/runtime/JSCJSValueInlines.h: (JSC::JSValue::toIndex const): * Source/JavaScriptCore/runtime/JSDataViewPrototype.cpp: (JSC::getData): (JSC::setData): * Source/JavaScriptCore/runtime/JSFunction.cpp: (JSC::JSFunction::toString): (JSC::JSFunction::setFunctionName): (JSC::JSFunction::reifyName): * Source/JavaScriptCore/runtime/JSFunctionInlines.h: (JSC::makeNameWithOutOfMemoryCheck): (JSC::JSFunction::originalName): * Source/JavaScriptCore/runtime/JSGenericTypedArrayViewInlines.h: (JSC::JSGenericTypedArrayView<Adaptor>::defineOwnProperty): * Source/JavaScriptCore/runtime/JSModuleRecord.cpp: (JSC::JSModuleRecord::instantiateDeclarations): * Source/JavaScriptCore/runtime/MapConstructor.cpp: (JSC::JSC_DEFINE_HOST_FUNCTION): * Source/JavaScriptCore/runtime/NativeExecutable.cpp: (JSC::NativeExecutable::toStringSlow): * Source/JavaScriptCore/runtime/Options.cpp: (JSC::OptionsHelper::Option::name const): (JSC::OptionsHelper::Option::description const): (JSC::invertBoolOptionValue): (JSC::Options::setAliasedOption): * Source/JavaScriptCore/runtime/OptionsList.h: * Source/JavaScriptCore/runtime/ProxyConstructor.cpp: (JSC::JSC_DEFINE_HOST_FUNCTION): * Source/JavaScriptCore/runtime/ProxyObject.cpp: (JSC::ProxyObject::getHandlerTrap): * Source/JavaScriptCore/runtime/RegExp.cpp: (JSC::RegExp::toSourceString const): * Source/JavaScriptCore/runtime/SamplingProfiler.cpp: (JSC::SamplingProfiler::reportTopBytecodes): * Source/JavaScriptCore/runtime/SetConstructor.cpp: (JSC::JSC_DEFINE_HOST_FUNCTION): * Source/JavaScriptCore/runtime/ShadowRealmConstructor.cpp: (JSC::JSC_DEFINE_HOST_FUNCTION): * Source/JavaScriptCore/runtime/TemporalCalendarConstructor.cpp: (JSC::JSC_DEFINE_HOST_FUNCTION): * Source/JavaScriptCore/runtime/TemporalDurationConstructor.cpp: (JSC::JSC_DEFINE_HOST_FUNCTION): * Source/JavaScriptCore/runtime/TemporalInstantConstructor.cpp: (JSC::JSC_DEFINE_HOST_FUNCTION): * Source/JavaScriptCore/runtime/TemporalPlainDateConstructor.cpp: (JSC::JSC_DEFINE_HOST_FUNCTION): * Source/JavaScriptCore/runtime/TemporalPlainDateTimeConstructor.cpp: (JSC::JSC_DEFINE_HOST_FUNCTION): * Source/JavaScriptCore/runtime/TemporalPlainTimeConstructor.cpp: (JSC::JSC_DEFINE_HOST_FUNCTION): * Source/JavaScriptCore/runtime/TemporalTimeZoneConstructor.cpp: (JSC::JSC_DEFINE_HOST_FUNCTION): * Source/JavaScriptCore/runtime/TypeSet.cpp: (JSC::StructureShape::stringRepresentation): * Source/JavaScriptCore/runtime/WeakMapConstructor.cpp: (JSC::JSC_DEFINE_HOST_FUNCTION): * Source/JavaScriptCore/runtime/WeakObjectRefConstructor.cpp: (JSC::JSC_DEFINE_HOST_FUNCTION): * Source/JavaScriptCore/runtime/WeakSetConstructor.cpp: (JSC::JSC_DEFINE_HOST_FUNCTION): * Source/JavaScriptCore/wasm/WasmBBQDisassembler.cpp: (JSC::Wasm::BBQDisassembler::dumpVectorForInstructions): * Source/JavaScriptCore/wasm/WasmBBQPlan.cpp: (JSC::Wasm::BBQPlan::prepareImpl): * Source/JavaScriptCore/wasm/WasmBranchHintsSectionParser.cpp: (JSC::Wasm::BranchHintsSectionParser::parse): * Source/JavaScriptCore/wasm/WasmCompilationMode.cpp: (JSC::Wasm::makeString): * Source/JavaScriptCore/wasm/WasmCompilationMode.h: * Source/JavaScriptCore/wasm/WasmConstExprGenerator.cpp: (JSC::Wasm::ConstExprGenerator::addArrayNew): (JSC::Wasm::ConstExprGenerator::addArrayNewDefault): (JSC::Wasm::ConstExprGenerator::addArrayNewFixed): (JSC::Wasm::ConstExprGenerator::addStructNewDefault): (JSC::Wasm::ConstExprGenerator::addStructNew): (JSC::Wasm::ConstExprGenerator::addAnyConvertExtern): (JSC::Wasm::ConstExprGenerator::addExternConvertAny): * Source/JavaScriptCore/wasm/WasmEntryPlan.cpp: (JSC::Wasm::EntryPlan::prepare): * Source/JavaScriptCore/wasm/WasmEntryPlan.h: (JSC::Wasm::EntryPlan::tryReserveCapacity): * Source/JavaScriptCore/wasm/WasmFormat.h: (JSC::Wasm::makeString): * Source/JavaScriptCore/wasm/WasmFunctionParser.h: (JSC::Wasm::FunctionParserTypes::TypedExpression::dump const): (JSC::Wasm::FunctionParser::typeToStringModuleRelative const): (JSC::Wasm::FunctionParser<Context>::parse): (JSC::Wasm::FunctionParser<Context>::parseConstantExpression): (JSC::Wasm::FunctionParser<Context>::parseBody): (JSC::Wasm::FunctionParser<Context>::binaryCase): (JSC::Wasm::FunctionParser<Context>::unaryCase): (JSC::Wasm::FunctionParser<Context>::load): (JSC::Wasm::FunctionParser<Context>::store): (JSC::Wasm::FunctionParser<Context>::truncSaturated): (JSC::Wasm::FunctionParser<Context>::atomicLoad): (JSC::Wasm::FunctionParser<Context>::atomicStore): (JSC::Wasm::FunctionParser<Context>::atomicBinaryRMW): (JSC::Wasm::FunctionParser<Context>::atomicCompareExchange): (JSC::Wasm::FunctionParser<Context>::atomicWait): (JSC::Wasm::FunctionParser<Context>::atomicNotify): (JSC::Wasm::FunctionParser<Context>::atomicFence): (JSC::Wasm::FunctionParser<Context>::simd): (JSC::Wasm::FunctionParser<Context>::parseTableIndex): (JSC::Wasm::FunctionParser<Context>::parseIndexForLocal): (JSC::Wasm::FunctionParser<Context>::parseIndexForGlobal): (JSC::Wasm::FunctionParser<Context>::parseFunctionIndex): (JSC::Wasm::FunctionParser<Context>::parseExceptionIndex): (JSC::Wasm::FunctionParser<Context>::parseBranchTarget): (JSC::Wasm::FunctionParser<Context>::parseDelegateTarget): (JSC::Wasm::FunctionParser<Context>::parseElementIndex): (JSC::Wasm::FunctionParser<Context>::parseDataSegmentIndex): (JSC::Wasm::FunctionParser<Context>::parseTableCopyImmediates): (JSC::Wasm::FunctionParser<Context>::parseAnnotatedSelectImmediates): (JSC::Wasm::FunctionParser<Context>::parseMemoryFillImmediate): (JSC::Wasm::FunctionParser<Context>::parseMemoryCopyImmediates): (JSC::Wasm::FunctionParser<Context>::parseMemoryInitImmediates): (JSC::Wasm::FunctionParser<Context>::parseStructTypeIndex): (JSC::Wasm::FunctionParser<Context>::parseStructFieldIndex): (JSC::Wasm::FunctionParser<Context>::parseStructTypeIndexAndFieldIndex): (JSC::Wasm::FunctionParser<Context>::parseStructFieldManipulation): (JSC::Wasm::FunctionParser<Context>::checkBranchTarget): (JSC::Wasm::FunctionParser<Context>::checkLocalInitialized): (JSC::Wasm::FunctionParser<Context>::unify): (JSC::Wasm::FunctionParser<Context>::parseArrayTypeDefinition): (JSC::Wasm::FunctionParser<Context>::parseExpression): (JSC::Wasm::FunctionParser<Context>::parseUnreachableExpression): * Source/JavaScriptCore/wasm/WasmIPIntPlan.cpp: (JSC::Wasm::IPIntPlan::prepareImpl): * Source/JavaScriptCore/wasm/WasmLLIntPlan.cpp: (JSC::Wasm::LLIntPlan::prepareImpl): * Source/JavaScriptCore/wasm/WasmNameSectionParser.cpp: (JSC::Wasm::NameSectionParser::parse): * Source/JavaScriptCore/wasm/WasmOMGIRGenerator.cpp: (JSC::Wasm::OMGIRGenerator::addLocal): (JSC::Wasm::OMGIRGenerator::addArguments): * Source/JavaScriptCore/wasm/WasmParser.h: (JSC::Wasm::ParserBase::parseImmLaneIdx): (JSC::Wasm::ParserBase::parseBlockSignature): (JSC::Wasm::ParserBase::parseReftypeSignature): * Source/JavaScriptCore/wasm/WasmSectionParser.cpp: (JSC::Wasm::SectionParser::parseType): (JSC::Wasm::SectionParser::parseImport): (JSC::Wasm::SectionParser::parseFunction): (JSC::Wasm::SectionParser::parseResizableLimits): (JSC::Wasm::SectionParser::parseTableHelper): (JSC::Wasm::SectionParser::parseTable): (JSC::Wasm::SectionParser::parseMemoryHelper): (JSC::Wasm::SectionParser::parseMemory): (JSC::Wasm::SectionParser::parseGlobal): (JSC::Wasm::SectionParser::parseExport): (JSC::Wasm::SectionParser::parseStart): (JSC::Wasm::SectionParser::parseElement): (JSC::Wasm::SectionParser::parseInitExpr): (JSC::Wasm::SectionParser::validateElementTableIdx): (JSC::Wasm::SectionParser::parseFunctionType): (JSC::Wasm::SectionParser::parsePackedType): (JSC::Wasm::SectionParser::parseStorageType): (JSC::Wasm::SectionParser::parseStructType): (JSC::Wasm::SectionParser::parseArrayType): (JSC::Wasm::SectionParser::parseRecursionGroup): (JSC::Wasm::SectionParser::checkSubtypeValidity): (JSC::Wasm::SectionParser::parseSubtype): (JSC::Wasm::SectionParser::parseElementKind): (JSC::Wasm::SectionParser::parseIndexCountForElementSection): (JSC::Wasm::SectionParser::parseElementSegmentVectorOfExpressions): (JSC::Wasm::SectionParser::parseElementSegmentVectorOfIndexes): (JSC::Wasm::SectionParser::parseGlobalType): (JSC::Wasm::SectionParser::parseData): (JSC::Wasm::SectionParser::parseDataCount): (JSC::Wasm::SectionParser::parseException): (JSC::Wasm::SectionParser::parseCustom): * Source/JavaScriptCore/wasm/WasmSections.h: (JSC::Wasm::makeString): * Source/JavaScriptCore/wasm/WasmStreamingParser.cpp: (JSC::Wasm::StreamingParser::fail): (JSC::Wasm::dumpWasmSource): (JSC::Wasm::StreamingParser::parseModuleHeader): (JSC::Wasm::StreamingParser::parseSectionID): (JSC::Wasm::StreamingParser::parseCodeSectionSize): (JSC::Wasm::StreamingParser::parseFunctionSize): (JSC::Wasm::StreamingParser::parseFunctionPayload): (JSC::Wasm::StreamingParser::parseSectionPayload): (JSC::Wasm::StreamingParser::addBytes): (JSC::Wasm::StreamingParser::failOnState): (JSC::Wasm::StreamingParser::finalize): * Source/JavaScriptCore/wasm/WasmTypeDefinition.h: (JSC::Wasm::makeString): * Source/JavaScriptCore/wasm/generateWasmOpsHeader.py: * Source/JavaScriptCore/wasm/js/WebAssemblyArrayConstructor.cpp: (JSC::JSC_DEFINE_HOST_FUNCTION): * Source/JavaScriptCore/wasm/js/WebAssemblyExceptionConstructor.cpp: (JSC::JSC_DEFINE_HOST_FUNCTION): * Source/JavaScriptCore/wasm/js/WebAssemblyGlobalConstructor.cpp: (JSC::JSC_DEFINE_HOST_FUNCTION): * Source/JavaScriptCore/wasm/js/WebAssemblyInstanceConstructor.cpp: (JSC::JSC_DEFINE_HOST_FUNCTION): * Source/JavaScriptCore/wasm/js/WebAssemblyMemoryConstructor.cpp: (JSC::JSC_DEFINE_HOST_FUNCTION): * Source/JavaScriptCore/wasm/js/WebAssemblyModuleConstructor.cpp: (JSC::JSC_DEFINE_HOST_FUNCTION): * Source/JavaScriptCore/wasm/js/WebAssemblyModuleRecord.cpp: (JSC::WebAssemblyModuleRecord::initializeImports): * Source/JavaScriptCore/wasm/js/WebAssemblyTableConstructor.cpp: (JSC::JSC_DEFINE_HOST_FUNCTION): * Source/JavaScriptCore/wasm/js/WebAssemblyTagConstructor.cpp: (JSC::JSC_DEFINE_HOST_FUNCTION): * Source/WTF/wtf/DateMath.cpp: (WTF::makeRFC2822DateString): * Source/WTF/wtf/FileSystem.cpp: (WTF::FileSystemImpl::encodeForFileName): * Source/WTF/wtf/Logger.cpp: (WTF::Logger::LogSiteIdentifier::toString const): * Source/WTF/wtf/NativePromise.h: (WTF::LogArgument<GenericPromise>::toString): * Source/WTF/wtf/URL.cpp: (WTF::removeQueryParameters): * Source/WTF/wtf/URLParser.cpp: (WTF::URLParser::URLParser): * Source/WTF/wtf/cocoa/ResourceUsageCocoa.cpp: (WTF::logFootprintComparison): * Source/WTF/wtf/text/StringConcatenate.h: * Source/WebGPU/WGSL/AST/ASTStringDumper.cpp: (WGSL::AST::Indent::Indent): * Source/WebGPU/WGSL/AttributeValidator.cpp: (WGSL::AttributeValidator::visit): (WGSL::AttributeValidator::parseBuiltin): (WGSL::AttributeValidator::parseLocation): (WGSL::AttributeValidator::validateInterpolation): (WGSL::AttributeValidator::validateInvariant): (WGSL::AttributeValidator::update): (WGSL::AttributeValidator::set): (WGSL::AttributeValidator::validateIO): (WGSL::AttributeValidator::validateBuiltinIO): (WGSL::AttributeValidator::validateLocationIO): (WGSL::AttributeValidator::validateStructIO): * Source/WebGPU/WGSL/ConstantFunctions.h: (WGSL::CONSTANT_FUNCTION): (WGSL::UNARY_OPERATION): * Source/WebGPU/WGSL/EntryPointRewriter.cpp: (WGSL::EntryPointRewriter::rewrite): (WGSL::EntryPointRewriter::checkReturnType): (WGSL::EntryPointRewriter::visit): * Source/WebGPU/WGSL/GlobalSorting.cpp: (WGSL::reorder): * Source/WebGPU/WGSL/GlobalVariableRewriter.cpp: (WGSL::RewriteGlobalVariables::visitCallee): (WGSL::RewriteGlobalVariables::getPacking): (WGSL::RewriteGlobalVariables::collectGlobals): (WGSL::RewriteGlobalVariables::packStructType): (WGSL::RewriteGlobalVariables::determineUsedGlobals): (WGSL::RewriteGlobalVariables::insertStructs): (WGSL::RewriteGlobalVariables::insertMaterializations): (WGSL::RewriteGlobalVariables::storeInitialValue): (WGSL::RewriteGlobalVariables::argumentBufferParameterName): (WGSL::RewriteGlobalVariables::argumentBufferStructName): (WGSL::RewriteGlobalVariables::dynamicOffsetVariableName): * Source/WebGPU/WGSL/Metal/MetalFunctionWriter.cpp: (WGSL::Metal::serializeAddressSpace): (WGSL::Metal::convertToSampleMode): (WGSL::Metal::FunctionDefinitionWriter::visit): (WGSL::Metal::emitTextureDimensions): (WGSL::Metal::emitTextureGather): (WGSL::Metal::emitTextureLoad): (WGSL::Metal::emitTextureSampleGrad): (WGSL::Metal::emitTextureStore): (WGSL::Metal::atomicFunction): (WGSL::Metal::emitDynamicOffset): (WGSL::Metal::FunctionDefinitionWriter::serializeBinaryExpression): (WGSL::Metal::FunctionDefinitionWriter::serializeConstant): * Source/WebGPU/WGSL/Parser.cpp: (WGSL::TemplateTypes::appendNameTo): (WGSL::Parser<Lexer>::parseStructure): * Source/WebGPU/WGSL/TypeCheck.cpp: (WGSL::TypeChecker::TypeChecker): (WGSL::TypeChecker::visit): (WGSL::TypeChecker::bitcast): (WGSL::TypeChecker::lookupType): (WGSL::TypeChecker::vectorFieldAccess): (WGSL::TypeChecker::chooseOverload): (WGSL::TypeChecker::analyze): (WGSL::TypeChecker::resolve): (WGSL::TypeChecker::introduceType): (WGSL::TypeChecker::convertValue): (WGSL::TypeChecker::introduceValue): (WGSL::TypeChecker::introduceFunction): (WGSL::TypeChecker::allocateSimpleConstructor): (WGSL::TypeChecker::allocateTextureStorageConstructor): (WGSL::TypeChecker::texelFormat): (WGSL::TypeChecker::accessMode): (WGSL::TypeChecker::addressSpace): Canonical link: https://commits.webkit.org/278403@main
1 parent 67855f6 commit d66a7a4

107 files changed

Lines changed: 1507 additions & 1493 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/API/JSAPIGlobalObject.mm‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@
214214
NSURL *sourceURL = [jsScript sourceURL];
215215
String oldModuleKey { [sourceURL absoluteString] };
216216
if (UNLIKELY(Identifier::fromString(vm, oldModuleKey) != moduleKey))
217-
return rejectPromise(makeString("The same JSScript was provided for two different identifiers, previously: ", oldModuleKey, " and now: ", moduleKey.string()));
217+
return rejectPromise(makeString("The same JSScript was provided for two different identifiers, previously: "_s, oldModuleKey, " and now: "_s, moduleKey.string()));
218218

219219
strongPromise.get()->resolve(globalObject, source);
220220
return encodedJSUndefined();

‎Source/JavaScriptCore/API/JSContextRef.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ class BacktraceFunctor {
331331
StringBuilder& builder = m_builder;
332332
if (!builder.isEmpty())
333333
builder.append('\n');
334-
builder.append('#', visitor->index(), ' ', visitor->functionName(), "() at ", visitor->sourceURL());
334+
builder.append('#', visitor->index(), ' ', visitor->functionName(), "() at "_s, visitor->sourceURL());
335335
if (visitor->hasLineAndColumnInfo()) {
336336
auto lineColumn = visitor->computeLineAndColumn();
337337
builder.append(':', lineColumn.line);

‎Source/JavaScriptCore/API/JSScript.mm‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ - (BOOL)writeCache:(String&)error
307307
const char* tempFileName = [cachePathString stringByAppendingString:@".tmp"].UTF8String;
308308
int fd = open(cacheFileName, O_CREAT | O_WRONLY | O_EXLOCK | O_NONBLOCK, 0600);
309309
if (fd == -1) {
310-
error = makeString("Could not open or lock the bytecode cache file. It's likely another VM or process is already using it. Error: ", safeStrerror(errno).data());
310+
error = makeString("Could not open or lock the bytecode cache file. It's likely another VM or process is already using it. Error: "_s, safeStrerror(errno).span());
311311
return NO;
312312
}
313313

@@ -317,7 +317,7 @@ - (BOOL)writeCache:(String&)error
317317

318318
int tempFD = open(tempFileName, O_CREAT | O_RDWR | O_EXLOCK | O_NONBLOCK, 0600);
319319
if (tempFD == -1) {
320-
error = makeString("Could not open or lock the bytecode cache temp file. Error: ", safeStrerror(errno).data());
320+
error = makeString("Could not open or lock the bytecode cache temp file. Error: "_s, safeStrerror(errno).span());
321321
return NO;
322322
}
323323

@@ -340,7 +340,7 @@ - (BOOL)writeCache:(String&)error
340340
if (cacheError.isValid()) {
341341
m_cachedBytecode = JSC::CachedBytecode::create();
342342
FileSystem::truncateFile(fd, 0);
343-
error = makeString("Unable to generate bytecode for this JSScript because: ", cacheError.message());
343+
error = makeString("Unable to generate bytecode for this JSScript because: "_s, cacheError.message());
344344
return NO;
345345
}
346346

‎Source/JavaScriptCore/API/tests/ExecutionTimeLimitTest.cpp‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -501,10 +501,10 @@ int testExecutionTimeLimit()
501501
"var startTime = currentCPUTime();"
502502
"while (true) {"
503503
"for (var i = 0; i < 1000; i++);"
504-
"if (currentCPUTime() - startTime > ", timeAfterWatchdogShouldHaveFired.seconds(), ") break;"
504+
"if (currentCPUTime() - startTime > "_s, timeAfterWatchdogShouldHaveFired.seconds(), ") break;"
505505
"}"
506506
"}"
507-
"foo();"
507+
"foo();"_s
508508
).utf8();
509509

510510
JSStringRef script = JSStringCreateWithUTF8CString(scriptText.data());

‎Source/JavaScriptCore/dfg/DFGCFAPhase.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ class CFAPhase : public Phase {
220220
for (unsigned i = 0; i < block->size(); ++i) {
221221
Node* node = block->at(i);
222222
if (m_verbose) {
223-
dataLogF(" %s @%u: ", Graph::opName(node->op()), node->index());
223+
dataLogF(" %s @%u: ", Graph::opName(node->op()).characters(), node->index());
224224

225225
if (!safeToExecute(m_state, m_graph, node))
226226
dataLog("(UNSAFE) ");

‎Source/JavaScriptCore/dfg/DFGGraph.cpp‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ namespace JSC { namespace DFG {
6363
static constexpr bool dumpOSRAvailabilityData = false;
6464

6565
// Creates an array of stringized names.
66-
static const char* const dfgOpNames[] = {
67-
#define STRINGIZE_DFG_OP_ENUM(opcode, flags) #opcode ,
66+
static constexpr ASCIILiteral dfgOpNames[] = {
67+
#define STRINGIZE_DFG_OP_ENUM(opcode, flags) #opcode ## _s ,
6868
FOR_EACH_DFG_OP(STRINGIZE_DFG_OP_ENUM)
6969
#undef STRINGIZE_DFG_OP_ENUM
7070
};
@@ -98,7 +98,7 @@ Graph::~Graph()
9898
{
9999
}
100100

101-
const char *Graph::opName(NodeType op)
101+
ASCIILiteral Graph::opName(NodeType op)
102102
{
103103
return dfgOpNames[op];
104104
}

‎Source/JavaScriptCore/dfg/DFGGraph.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ class Graph final : public virtual Scannable {
460460
return arithRound->canSpeculateInt32(pass) && !hasExitSite(arithRound->origin.semantic, Overflow) && !hasExitSite(arithRound->origin.semantic, NegativeZero);
461461
}
462462

463-
static const char* opName(NodeType);
463+
static ASCIILiteral opName(NodeType);
464464

465465
RegisteredStructureSet* addStructureSet(const StructureSet& structureSet)
466466
{

‎Source/JavaScriptCore/heap/HeapSnapshotBuilder.cpp‎

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -280,32 +280,32 @@ static uint8_t edgeTypeToNumber(EdgeType type)
280280
return static_cast<uint8_t>(type);
281281
}
282282

283-
static const char* edgeTypeToString(EdgeType type)
283+
static ASCIILiteral edgeTypeToString(EdgeType type)
284284
{
285285
switch (type) {
286286
case EdgeType::Internal:
287-
return "Internal";
287+
return "Internal"_s;
288288
case EdgeType::Property:
289-
return "Property";
289+
return "Property"_s;
290290
case EdgeType::Index:
291-
return "Index";
291+
return "Index"_s;
292292
case EdgeType::Variable:
293-
return "Variable";
293+
return "Variable"_s;
294294
}
295295
ASSERT_NOT_REACHED();
296-
return "Internal";
296+
return "Internal"_s;
297297
}
298298

299-
static const char* snapshotTypeToString(HeapSnapshotBuilder::SnapshotType type)
299+
static ASCIILiteral snapshotTypeToString(HeapSnapshotBuilder::SnapshotType type)
300300
{
301301
switch (type) {
302302
case HeapSnapshotBuilder::SnapshotType::InspectorSnapshot:
303-
return "Inspector";
303+
return "Inspector"_s;
304304
case HeapSnapshotBuilder::SnapshotType::GCDebuggingSnapshot:
305-
return "GCDebugging";
305+
return "GCDebugging"_s;
306306
}
307307
ASSERT_NOT_REACHED();
308-
return "Inspector";
308+
return "Inspector"_s;
309309
}
310310

311311
String HeapSnapshotBuilder::json()
@@ -427,7 +427,7 @@ String HeapSnapshotBuilder::json(Function<bool (const HeapSnapshotNode&)> allowN
427427
// <nodeId>, <sizeInBytes>, <nodeClassNameIndex>, <flags>, [<labelIndex>, <cellAddress>, <wrappedAddress>]
428428
json.append(',', node.identifier, ',', node.cell->estimatedSizeInBytes(vm), ',', classNameIndex, ',', flags);
429429
if (m_snapshotType == SnapshotType::GCDebuggingSnapshot)
430-
json.append(',', labelIndex, ",\"0x", hex(reinterpret_cast<uintptr_t>(node.cell), Lowercase), "\",\"0x", hex(reinterpret_cast<uintptr_t>(wrappedAddress), Lowercase), '"');
430+
json.append(',', labelIndex, ",\"0x"_s, hex(reinterpret_cast<uintptr_t>(node.cell), Lowercase), "\",\"0x"_s, hex(reinterpret_cast<uintptr_t>(wrappedAddress), Lowercase), '"');
431431
};
432432

433433
bool firstEdge = true;

‎Source/JavaScriptCore/inspector/InspectorBackendDispatcher.cpp‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ void BackendDispatcher::reportProtocolError(std::optional<long> relatedRequestId
288288
}
289289

290290
template<typename T>
291-
T BackendDispatcher::getPropertyValue(JSON::Object* params, const String& name, bool required, std::function<T(JSON::Value&)> converter, const char* typeName)
291+
T BackendDispatcher::getPropertyValue(JSON::Object* params, const String& name, bool required, std::function<T(JSON::Value&)> converter, ASCIILiteral typeName)
292292
{
293293
T result;
294294

@@ -315,45 +315,45 @@ T BackendDispatcher::getPropertyValue(JSON::Object* params, const String& name,
315315

316316
std::optional<bool> BackendDispatcher::getBoolean(JSON::Object* params, const String& name, bool required)
317317
{
318-
return getPropertyValue<std::optional<bool>>(params, name, required, &JSON::Value::asBoolean, "Boolean");
318+
return getPropertyValue<std::optional<bool>>(params, name, required, &JSON::Value::asBoolean, "Boolean"_s);
319319
}
320320

321321
std::optional<int> BackendDispatcher::getInteger(JSON::Object* params, const String& name, bool required)
322322
{
323323
// FIXME: <http://webkit.org/b/179847> simplify this when legacy InspectorObject symbols are no longer needed.
324324
std::optional<int> (JSON::Value::*asInteger)() const = &JSON::Value::asInteger;
325-
return getPropertyValue<std::optional<int>>(params, name, required, asInteger, "Integer");
325+
return getPropertyValue<std::optional<int>>(params, name, required, asInteger, "Integer"_s);
326326
}
327327

328328
std::optional<double> BackendDispatcher::getDouble(JSON::Object* params, const String& name, bool required)
329329
{
330330
// FIXME: <http://webkit.org/b/179847> simplify this when legacy InspectorObject symbols are no longer needed.
331331
std::optional<double> (JSON::Value::*asDouble)() const = &JSON::Value::asDouble;
332-
return getPropertyValue<std::optional<double>>(params, name, required, asDouble, "Number");
332+
return getPropertyValue<std::optional<double>>(params, name, required, asDouble, "Number"_s);
333333
}
334334

335335
String BackendDispatcher::getString(JSON::Object* params, const String& name, bool required)
336336
{
337337
// FIXME: <http://webkit.org/b/179847> simplify this when legacy InspectorObject symbols are no longer needed.
338338
String (JSON::Value::*asString)() const = &JSON::Value::asString;
339-
return getPropertyValue<String>(params, name, required, asString, "String");
339+
return getPropertyValue<String>(params, name, required, asString, "String"_s);
340340
}
341341

342342
RefPtr<JSON::Value> BackendDispatcher::getValue(JSON::Object* params, const String& name, bool required)
343343
{
344-
return getPropertyValue<RefPtr<JSON::Value>>(params, name, required, &JSON::Value::asValue, "Value");
344+
return getPropertyValue<RefPtr<JSON::Value>>(params, name, required, &JSON::Value::asValue, "Value"_s);
345345
}
346346

347347
RefPtr<JSON::Object> BackendDispatcher::getObject(JSON::Object* params, const String& name, bool required)
348348
{
349349
return getPropertyValue<RefPtr<JSON::Object>>(params, name, required, [](JSON::Value& value) {
350350
return value.asObject();
351-
}, "Object");
351+
}, "Object"_s);
352352
}
353353

354354
RefPtr<JSON::Array> BackendDispatcher::getArray(JSON::Object* params, const String& name, bool required)
355355
{
356-
return getPropertyValue<RefPtr<JSON::Array>>(params, name, required, &JSON::Value::asArray, "Array");
356+
return getPropertyValue<RefPtr<JSON::Array>>(params, name, required, &JSON::Value::asArray, "Array"_s);
357357
}
358358

359359
} // namespace Inspector

‎Source/JavaScriptCore/inspector/InspectorBackendDispatcher.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ class JS_EXPORT_PRIVATE BackendDispatcher : public RefCounted<BackendDispatcher>
109109
BackendDispatcher(Ref<FrontendRouter>&&);
110110

111111
template<typename T>
112-
WTF_INTERNAL T getPropertyValue(JSON::Object*, const String& name, bool required, std::function<T(JSON::Value&)> converter, const char* typeName);
112+
WTF_INTERNAL T getPropertyValue(JSON::Object*, const String& name, bool required, std::function<T(JSON::Value&)> converter, ASCIILiteral typeName);
113113

114114
Ref<FrontendRouter> m_frontendRouter;
115115
HashMap<String, SupplementalBackendDispatcher*> m_dispatchers;

0 commit comments

Comments
 (0)