From 35f46fb6bc8eb20d82728d07aafd930f222773b5 Mon Sep 17 00:00:00 2001 From: J8118 Date: Thu, 9 Apr 2026 10:21:26 +0400 Subject: [PATCH 1/2] Fix typos in doc comments across codebase Fix common misspellings in comments: "teh" -> "the", "paramter" -> "parameter", "accomodate" -> "accommodate", "occured" -> "occurred", "overriden" -> "overridden", "propery" -> "property", "destoryed" -> "destroyed". --- API/hermes/hermes.cpp | 2 +- include/hermes/BCGen/HBC/BCProviderFromSrc.h | 2 +- include/hermes/BCGen/HBC/HBC.h | 2 +- include/hermes/CompilerDriver/CompilerDriver.h | 4 ++-- include/hermes/IR/IR.h | 4 ++-- include/hermes/VM/PropertyDescriptor.h | 2 +- include/hermes/VM/StackFrame.h | 2 +- lib/BCGen/HBC/HBC.cpp | 2 +- lib/BCGen/HBC/Passes.cpp | 2 +- lib/BCGen/SH/LoadConstants.cpp | 2 +- lib/VM/JSLib/JSONLexer.cpp | 2 +- public/hermes/Public/GCConfig.h | 2 +- 12 files changed, 14 insertions(+), 14 deletions(-) diff --git a/API/hermes/hermes.cpp b/API/hermes/hermes.cpp index 81c648315cc..ccf5bf93256 100644 --- a/API/hermes/hermes.cpp +++ b/API/hermes/hermes.cpp @@ -365,7 +365,7 @@ class HermesRuntimeImpl final : public HermesRuntime, return make(&weakHermesValues_.add(wr)); } - // overriden from jsi::Instrumentation + // overridden from jsi::Instrumentation std::string getRecordedGCStats() override { std::string s; llvh::raw_string_ostream os(s); diff --git a/include/hermes/BCGen/HBC/BCProviderFromSrc.h b/include/hermes/BCGen/HBC/BCProviderFromSrc.h index b29ae99c685..a9fb1d0e673 100644 --- a/include/hermes/BCGen/HBC/BCProviderFromSrc.h +++ b/include/hermes/BCGen/HBC/BCProviderFromSrc.h @@ -99,7 +99,7 @@ class BCProviderFromSrc final : public BCProviderBase { /// whether to link all optimizations to the caller. /// \param defaultBytecodeGenerationOptions the starting bytecode generation /// options that will be used during the bytecode generation phase. - /// Some options will be overriden depending on other arguments passed in. + /// Some options will be overridden depending on other arguments passed in. /// /// \return a BCProvider and an empty error, or a null BCProvider and an error /// message (if diagHandler was provided, the error message is "error"). diff --git a/include/hermes/BCGen/HBC/HBC.h b/include/hermes/BCGen/HBC/HBC.h index 986cec9c4c7..6923647d837 100644 --- a/include/hermes/BCGen/HBC/HBC.h +++ b/include/hermes/BCGen/HBC/HBC.h @@ -103,7 +103,7 @@ void fullOptimizationPipeline(Module &M); /// whether to link all optimizations to the caller. /// \param defaultBytecodeGenerationOptions the starting bytecode generation /// options that will be used during the bytecode generation phase. -/// Some options will be overriden depending on other arguments passed in. +/// Some options will be overridden depending on other arguments passed in. /// /// \return a BCProvider and an empty error, or a null BCProvider and an error /// message (if diagHandler was provided, the error message is "error"). diff --git a/include/hermes/CompilerDriver/CompilerDriver.h b/include/hermes/CompilerDriver/CompilerDriver.h index 708df065b9c..4940003f412 100644 --- a/include/hermes/CompilerDriver/CompilerDriver.h +++ b/include/hermes/CompilerDriver/CompilerDriver.h @@ -31,9 +31,9 @@ enum CompileStatus { InputFileError, /// An output file could not be written. OutputFileError, - /// An error occured during optimization. + /// An error occurred during optimization. OptimizationFailed, - /// An error occured in the backend during/after IR lowering. + /// An error occurred in the backend during/after IR lowering. BackendError, }; diff --git a/include/hermes/IR/IR.h b/include/hermes/IR/IR.h index ecb45a6f70d..59e5fb24627 100644 --- a/include/hermes/IR/IR.h +++ b/include/hermes/IR/IR.h @@ -861,7 +861,7 @@ class Parameter : public Value { Parameter(const Parameter &) = delete; void operator=(const Parameter &) = delete; - /// The function that contains this paramter. + /// The function that contains this parameter. Function *parent_; /// The formal name of the parameter @@ -900,7 +900,7 @@ class JSParam : public Value { assert(parent_ && "Invalid parent"); } - /// The function that contains this paramter. + /// The function that contains this parameter. Function *parent_; public: diff --git a/include/hermes/VM/PropertyDescriptor.h b/include/hermes/VM/PropertyDescriptor.h index bebf6278566..30c260a0f5b 100644 --- a/include/hermes/VM/PropertyDescriptor.h +++ b/include/hermes/VM/PropertyDescriptor.h @@ -54,7 +54,7 @@ struct PropertyFlags { uint16_t hostObject : 1; /// This property is a builtin method or object, and it could be /// accessed by the CallBuiltin instruction. The property is made - /// read-only and is not allowed to be overriden. + /// read-only and is not allowed to be overridden. uint16_t staticBuiltin : 1; /// This flag indicates this is a proxy exotic Object. This flag /// should only be used as a marker for certain temporary diff --git a/include/hermes/VM/StackFrame.h b/include/hermes/VM/StackFrame.h index b03002cd750..1ef311afe33 100644 --- a/include/hermes/VM/StackFrame.h +++ b/include/hermes/VM/StackFrame.h @@ -292,7 +292,7 @@ void dumpStackFrame( /// Dump information about this frame to llvh::errs(). void dumpStackFrame(ConstStackFramePtr frame); /// Dump information about this frame to llvh::errs(). This overload is only -/// needed for calls directly from teh debugger. +/// needed for calls directly from the debugger. void dumpStackFrame(StackFramePtr frame); static_assert( diff --git a/lib/BCGen/HBC/HBC.cpp b/lib/BCGen/HBC/HBC.cpp index 36dca123042..7958fcdde31 100644 --- a/lib/BCGen/HBC/HBC.cpp +++ b/lib/BCGen/HBC/HBC.cpp @@ -607,7 +607,7 @@ VariableInfoAtDepth getVariableInfoAtDepth( sema::SemContext *semCtx = providerFromSrc->getSemCtx(); if (!semCtx->customData2) { // The lifetime of this cache has to be tied to the lifetime of the - // SemContext. A SemContext could be destoryed and allocated again. there's + // SemContext. A SemContext could be destroyed and allocated again. there's // then a potential for a new LexicalScope in the same place but with // different data. Use shared_ptr to make sure it isn't accessible after the // SemContext is freed. diff --git a/lib/BCGen/HBC/Passes.cpp b/lib/BCGen/HBC/Passes.cpp index e4b8b3ac737..48cbbddad66 100644 --- a/lib/BCGen/HBC/Passes.cpp +++ b/lib/BCGen/HBC/Passes.cpp @@ -91,7 +91,7 @@ bool LoadConstants::operandMustBeLiteral(Instruction *Inst, unsigned opIndex) { if (auto *SOP = llvh::dyn_cast(Inst)) { if (opIndex == DefineOwnPropertyInst::PropertyIdx) { - // If the propery is a LiteralNumber, the property is enumerable, and it + // If the property is a LiteralNumber, the property is enumerable, and it // is a valid array index, it is coming from an array initialization and // we will emit it as DefineOwnByIndex. if (auto *LN = llvh::dyn_cast(Inst->getOperand(opIndex))) { diff --git a/lib/BCGen/SH/LoadConstants.cpp b/lib/BCGen/SH/LoadConstants.cpp index 830215370bc..7b6f40d9c9a 100644 --- a/lib/BCGen/SH/LoadConstants.cpp +++ b/lib/BCGen/SH/LoadConstants.cpp @@ -46,7 +46,7 @@ bool operandMustBeLiteral(Instruction *Inst, unsigned opIndex) { if (auto *SOP = llvh::dyn_cast(Inst)) { if (opIndex == DefineOwnPropertyInst::PropertyIdx) { - // If the propery is a LiteralNumber, the property is enumerable, and it + // If the property is a LiteralNumber, the property is enumerable, and it // is a valid array index, it is coming from an array initialization and // we will emit it as DefineOwnByIndex. if (auto *LN = llvh::dyn_cast(Inst->getOperand(opIndex))) { diff --git a/lib/VM/JSLib/JSONLexer.cpp b/lib/VM/JSLib/JSONLexer.cpp index b4b3de681ea..98ad04fc420 100644 --- a/lib/VM/JSLib/JSONLexer.cpp +++ b/lib/VM/JSLib/JSONLexer.cpp @@ -302,7 +302,7 @@ ExecutionStatus JSONLexer::scanString() { break; } - // We reach this point after an escape has occured. This means that the + // We reach this point after an escape has occurred. This means that the // contents of the string we are parsing don't actually exist byte for byte in // the input string. Instead, we must build the contents of the string from // scratch. The contents of the string are placed into escapedStr. diff --git a/public/hermes/Public/GCConfig.h b/public/hermes/Public/GCConfig.h index 419305af8a9..6b2219364ed 100644 --- a/public/hermes/Public/GCConfig.h +++ b/public/hermes/Public/GCConfig.h @@ -23,7 +23,7 @@ namespace hermes { namespace vm { -/// A type big enough to accomodate the entire allocated address space. +/// A type big enough to accommodate the entire allocated address space. /// Individual allocations are always 'uint32_t', but on a 64-bit machine, when /// compressed pointer is OFF, we want to accommodate a larger total heap. using gcheapsize_t = size_t; From 887c9c208572339896adab110560468ff57dd529 Mon Sep 17 00:00:00 2001 From: J8118 Date: Thu, 9 Apr 2026 10:37:06 +0400 Subject: [PATCH 2/2] Fix additional typos and duplicate words across codebase Fix duplicate words: "the the" (19 instances), "to to" (4 instances), "is is" (2 instances), "of of" (1 instance), "it it" -> "if it" (1 instance). Fix misspellings: "identifer" -> "identifier", "occurence" -> "occurrence", "constuctor" -> "constructor", "begining" -> "beginning", "writting" -> "writing", "paramters" -> "parameters", "seperates" -> "separates", "suviving" -> "surviving", "povided" -> "provided". Fix misspelled variable names: "countOccurences" -> "countOccurrences", "occurences" -> "occurrences", "lastOccurence" -> "lastOccurrence" in testlib.cpp (all file-local). --- API/hermes/SynthTrace.h | 2 +- API/hermes_abi/hermes_abi.h | 2 +- API/jsi/jsi/test/testlib.cpp | 16 ++++++++-------- doc/Modules.md | 4 ++-- doc/Strings.md | 2 +- include/hermes/ADT/ManagedChunkedList.h | 2 +- include/hermes/AST/ESTree.h | 2 +- include/hermes/BCGen/HBC/BytecodeList.def | 4 ++-- include/hermes/BCGen/HBC/StringKind.h | 2 +- include/hermes/VM/GCBase.h | 2 +- include/hermes/VM/GCConcurrency.h | 2 +- include/hermes/VM/HiddenClass.h | 2 +- include/hermes/VM/IdentifierTable.h | 4 ++-- include/hermes/VM/JSLib/DateCache.h | 2 +- include/hermes/VM/JSWeakMapImpl.h | 2 +- include/hermes/VM/Runtime.h | 2 +- include/hermes/VM/RuntimeModule.h | 2 +- include/hermes/VM/TwineChar16.h | 2 +- lib/BCGen/HBC/HBC.cpp | 2 +- lib/BCGen/HBC/ISel.cpp | 4 ++-- lib/BCGen/LiteralBufferBuilder.cpp | 4 ++-- lib/IRGen/ESTreeIRGen-stmt.cpp | 2 +- lib/IRGen/ESTreeIRGen.h | 2 +- lib/Optimizer/Scalar/FunctionAnalysis.cpp | 2 +- lib/Optimizer/Scalar/LowerGeneratorFunction.cpp | 2 +- lib/Sema/SemanticResolver.cpp | 2 +- lib/Support/UTF16Stream.cpp | 2 +- lib/VM/Debugger/Debugger.cpp | 2 +- lib/VM/JIT/arm64/JitEmitter.h | 2 +- lib/VM/JSLib/Object.cpp | 2 +- lib/VM/JSObject.cpp | 4 ++-- lib/VM/StringPrimitive.cpp | 2 +- .../src/utils/mutateESTreeASTForPrettier.js | 2 +- .../src/transform/comments/comments.js | 2 +- .../Instrumentation/ApproxIntegralTest.cpp | 2 +- 35 files changed, 48 insertions(+), 48 deletions(-) diff --git a/API/hermes/SynthTrace.h b/API/hermes/SynthTrace.h index d9f327a8f69..fdc25becb86 100644 --- a/API/hermes/SynthTrace.h +++ b/API/hermes/SynthTrace.h @@ -356,7 +356,7 @@ class SynthTrace { /// If we're tracing to a file, pointer to a stream onto /// traceFilename_. Null otherwise. std::unique_ptr traceStream_; - /// If we're tracing to a file, pointer to a JSONEmitter writting + /// If we're tracing to a file, pointer to a JSONEmitter writing /// into *traceStream_. Null otherwise. std::unique_ptr<::hermes::JSONEmitter> json_; /// The records accumulated in the trace. Only used when not tracing diff --git a/API/hermes_abi/hermes_abi.h b/API/hermes_abi/hermes_abi.h index def45a00a9e..6b39de214f5 100644 --- a/API/hermes_abi/hermes_abi.h +++ b/API/hermes_abi/hermes_abi.h @@ -443,7 +443,7 @@ struct HermesABIRuntimeVTable { struct HermesABIPropNameID a, struct HermesABIPropNameID b); - /// Call the function \p fn with \p arg_count \p args, and with the the this + /// Call the function \p fn with \p arg_count \p args, and with the this /// parameter set to \p js_this. struct HermesABIValueOrError (*call)( struct HermesABIRuntime *rt, diff --git a/API/jsi/jsi/test/testlib.cpp b/API/jsi/jsi/test/testlib.cpp index b11b2d8d707..79627663aae 100644 --- a/API/jsi/jsi/test/testlib.cpp +++ b/API/jsi/jsi/test/testlib.cpp @@ -1027,14 +1027,14 @@ TEST_P(JSITest, PreparedJavaScriptURLInBacktrace) { namespace { -unsigned countOccurences(const std::string& of, const std::string& in) { - unsigned occurences = 0; - std::string::size_type lastOccurence = -1; - while ((lastOccurence = in.find(of, lastOccurence + 1)) != +unsigned countOccurrences(const std::string& of, const std::string& in) { + unsigned occurrences = 0; + std::string::size_type lastOccurrence = -1; + while ((lastOccurrence = in.find(of, lastOccurrence + 1)) != std::string::npos) { - occurences++; + occurrences++; } - return occurences; + return occurrences; } } // namespace @@ -1063,10 +1063,10 @@ TEST_P(JSITest, JSErrorsArePropagatedNicely) { sometimesThrows.call(rt, false, callback); } catch (JSError& error) { EXPECT_EQ(error.getMessage(), "Omg, what a nasty exception"); - EXPECT_EQ(countOccurences("sometimesThrows", error.getStack()), 6); + EXPECT_EQ(countOccurrences("sometimesThrows", error.getStack()), 6); // system JSC JSI does not implement host function names - // EXPECT_EQ(countOccurences("callback", error.getStack(rt)), 5); + // EXPECT_EQ(countOccurrences("callback", error.getStack(rt)), 5); } } diff --git a/doc/Modules.md b/doc/Modules.md index d964e18ab7e..dd77cd863ff 100644 --- a/doc/Modules.md +++ b/doc/Modules.md @@ -90,7 +90,7 @@ This allows lookup of the CJS modules either via `hermes::Function *` or by stri If the caller of the Hermes CLI passes `-static-require`, then we attempt to resolve all `require` calls at compilation time. -This occurs in `ResolveStaticRequire.cpp`, which is able to resolve files if they were povided +This occurs in `ResolveStaticRequire.cpp`, which is able to resolve files if they were provided by the user at invocation time and if all `require` calls only take string literals as arguments. If every `require` call is able to be resolved, every one of these `require` calls is replaced with a call to `HermesBuiltin_requireFast` with an ID for the CJS module, @@ -102,7 +102,7 @@ This requires two special bits of logic in `hbc::generateBytecodeModule`. - We add a mapping from a CJS module to the HBC function ID. This allows us to actually run `require` when JS execution demands it. If `require`s have been resolved, we add to the `cjsModulesStatic_` table in the HBC file, - else we add to to the `cjsModules_` table in the HBC file (which maps from strings instead of IDs). + else we add to the `cjsModules_` table in the HBC file (which maps from strings instead of IDs). - To accommodate bundle splitting, we also pass a `SegmentRange` to the function. This allows us to only compile the functions which are needed by the CJS modules in the segment. We then set a `cjsModuleOffset_` field in the HBC file, diff --git a/doc/Strings.md b/doc/Strings.md index c0a28a650e7..c50bf860d7a 100644 --- a/doc/Strings.md +++ b/doc/Strings.md @@ -96,7 +96,7 @@ The key bottleneck of the algorithm is step 2: identifying overlapping strings. Recall that an overlap is a pair (left, right) where there is some string that is simultaneously a suffix of left, and a prefix of right. For example, `splitpea` and `peasoup` has overlap of 3. We wish to find all parents and all overlaps. We are armed with a suffix array: a sorted list of suffixes of all our strings, where each suffix points back to the string(s) that contain it. -We loop over the right strings, and find all overlapping left mates. For each right string, we loop over its prefixes in increasing length. For example, given `peasoup` we loop over `p`, `pe`, `pea`... Call this the test prefix. We use binary search in our suffix array to identify suffixes that are prefixed by the the test prefix. This set of suffixes is necessarily contiguous, because the suffix array is sorted. If a suffix is exactly equal to that prefix, then we have an overlap. This is necessarily the leftmost element of our range, because our range is sorted. +We loop over the right strings, and find all overlapping left mates. For each right string, we loop over its prefixes in increasing length. For example, given `peasoup` we loop over `p`, `pe`, `pea`... Call this the test prefix. We use binary search in our suffix array to identify suffixes that are prefixed by the test prefix. This set of suffixes is necessarily contiguous, because the suffix array is sorted. If a suffix is exactly equal to that prefix, then we have an overlap. This is necessarily the leftmost element of our range, because our range is sorted. A key idea is that moving to the next prefix can only narrow the matching suffixes. For example, only suffixes that have `pe` as a prefix may have `pea` as a prefix. Therefore we do not need to reset the binary search range across iterations. Furthermore, for each iteration, we only need to consider one character in each suffix, since we know all previous characters necessarily match. This is key to performance. diff --git a/include/hermes/ADT/ManagedChunkedList.h b/include/hermes/ADT/ManagedChunkedList.h index effc06f9b36..9823245ae47 100644 --- a/include/hermes/ADT/ManagedChunkedList.h +++ b/include/hermes/ADT/ManagedChunkedList.h @@ -168,7 +168,7 @@ class ManagedChunkedList { chunk = nextChunk; } - // Schedule the next collection at a multiple of the the number of suviving + // Schedule the next collection at a multiple of the number of surviving // elements (using the occupancy ratio), averaged with previous target to // avoid drastic jumps. targetChunkCount_.update( diff --git a/include/hermes/AST/ESTree.h b/include/hermes/AST/ESTree.h index 7463fb0f397..8f26c1c5703 100644 --- a/include/hermes/AST/ESTree.h +++ b/include/hermes/AST/ESTree.h @@ -496,7 +496,7 @@ class IdentifierDecoration { }; namespace detail { -/// We need to to be able customize some ESTree types when passing them through +/// We need to be able to customize some ESTree types when passing them through /// a constructor, so we create a simple template type mapper. Specifically, a /// NodeList has to be passed by RValue-reference and moved into place. /// In the default case, the type is unmodified. diff --git a/include/hermes/BCGen/HBC/BytecodeList.def b/include/hermes/BCGen/HBC/BytecodeList.def index 8fc6baddaa5..a6083f23a13 100644 --- a/include/hermes/BCGen/HBC/BytecodeList.def +++ b/include/hermes/BCGen/HBC/BytecodeList.def @@ -693,7 +693,7 @@ DEFINE_OPCODE_0(AsyncBreakCheck) DEFINE_OPCODE_1(ProfilePoint, UInt16) /// Create a base class. -/// Arg1 is the output register for the the closure. +/// Arg1 is the output register for the closure. /// Arg2 is the output register for the home object. /// Arg3 is the current environment. /// Arg4 is index in the function table. @@ -701,7 +701,7 @@ DEFINE_OPCODE_4(CreateBaseClass, Reg8, Reg8, Reg8, UInt16) DEFINE_OPCODE_4(CreateBaseClassLongIndex, Reg8, Reg8, Reg8, UInt32) /// Create a derived class. -/// Arg1 is the output register for the the closure. +/// Arg1 is the output register for the closure. /// Arg2 is the output register for the home object. /// Arg3 is the current environment. /// Arg4 is the superClass. diff --git a/include/hermes/BCGen/HBC/StringKind.h b/include/hermes/BCGen/HBC/StringKind.h index fad49ebd727..c8498facfe5 100644 --- a/include/hermes/BCGen/HBC/StringKind.h +++ b/include/hermes/BCGen/HBC/StringKind.h @@ -30,7 +30,7 @@ class StringKind { StringKind() = delete; enum Kind : uint32_t { - /// Not been used as an identifer. + /// Not been used as an identifier. String = 0u << CountBits, /// Used as an identifier. diff --git a/include/hermes/VM/GCBase.h b/include/hermes/VM/GCBase.h index 02dac56140a..2fe1608666e 100644 --- a/include/hermes/VM/GCBase.h +++ b/include/hermes/VM/GCBase.h @@ -196,7 +196,7 @@ enum XorPtrKeyID { /// void symbolAllocationBarrier(SymbolID sym); /// /// We copied HermesValues into the given region. Note that \p numHVs is -/// the number of HermesValues in the the range, not the char length. +/// the number of HermesValues in the range, not the char length. /// Do any necessary barriers. /// void writeBarrierRange(GCHermesValue* start, uint32_t numHVs); /// void writeBarrierRange( diff --git a/include/hermes/VM/GCConcurrency.h b/include/hermes/VM/GCConcurrency.h index d79b0ca70c6..4d123879a77 100644 --- a/include/hermes/VM/GCConcurrency.h +++ b/include/hermes/VM/GCConcurrency.h @@ -128,7 +128,7 @@ class DebugMutex { private: std::recursive_mutex inner_; - // Sometimes we want to assert that the the current thread does not hold the + // Sometimes we want to assert that the current thread does not hold the // mutex. Since the mutex is not held, TSAN complains that the access to tid_ // is not thread safe. It is safe to use this atomic with any memory ordering // because all we care about is the last value assigned to tid_ by the diff --git a/include/hermes/VM/HiddenClass.h b/include/hermes/VM/HiddenClass.h index d8c558814e9..3ba4efb64b6 100644 --- a/include/hermes/VM/HiddenClass.h +++ b/include/hermes/VM/HiddenClass.h @@ -721,7 +721,7 @@ inline ClassFlags HiddenClass::computeFlags( PropertyFlags pf, bool addedIndexLike) { flags.hasIndexLikeProperties |= addedIndexLike; - // Carry over the the existing mayHaveAccessor flag. Once an accessor property + // Carry over the existing mayHaveAccessor flag. Once an accessor property // has been set, all subsequent classes must have this property marked. flags.mayHaveAccessor |= pf.accessor; return flags; diff --git a/include/hermes/VM/IdentifierTable.h b/include/hermes/VM/IdentifierTable.h index 24e7703b47e..495d666b1e0 100644 --- a/include/hermes/VM/IdentifierTable.h +++ b/include/hermes/VM/IdentifierTable.h @@ -403,7 +403,7 @@ class IdentifierTable { /// Create or lookup a SymbolID from a string \str. If \p primHandle is not /// null, it is assumed to be backing str. - /// \param str Required. The string to to use. + /// \param str Required. The string to use. /// \param primHandle optional StringPrimitive. If this is specified, then /// \p str must refer to its contents. /// \param hash the hash of the string \p str. @@ -443,7 +443,7 @@ class IdentifierTable { /// whether \p primHandle is available, assigning it the given \p strId. /// If \p primHandle is not null, it is assumed to be backing str. /// \tparam Unique indicates that this string should be uniqued. - /// \param str Required. The string to to use. + /// \param str Required. The string to use. /// \param primHandle optional StringPrimitive. If this is specified, then /// \p str must refer to its contents. /// \return the new allocated string. diff --git a/include/hermes/VM/JSLib/DateCache.h b/include/hermes/VM/JSLib/DateCache.h index 404b6ab1ed9..1f81be9827e 100644 --- a/include/hermes/VM/JSLib/DateCache.h +++ b/include/hermes/VM/JSLib/DateCache.h @@ -46,7 +46,7 @@ enum class TimeType : int8_t { /// If one interval is not found, let it point to an empty interval in the /// cache array (if no empty interval in it, reset the least recently used /// one to empty and use it). Assign before to candidate_. -/// 4. Check if the the before interval is empty, if yes, compute the DST of t, +/// 4. Check if the before interval is empty, if yes, compute the DST of t, /// and set its interval to [t, t]. Otherwise, go to step 5. /// 5. Check if t is included in the new non-empty before interval, if yes, /// return its DST. Otherwise, go to step 6. diff --git a/include/hermes/VM/JSWeakMapImpl.h b/include/hermes/VM/JSWeakMapImpl.h index 35728e6bbbf..5e026b6ed10 100644 --- a/include/hermes/VM/JSWeakMapImpl.h +++ b/include/hermes/VM/JSWeakMapImpl.h @@ -59,7 +59,7 @@ class WeakRefKey { return gc.getObjectID(slot_->key.getSymbolNoBarrierUnsafe()); } - /// \return The mapped value by the the key object. + /// \return The mapped value by the key object. HermesValue getMappedValue(GC &gc) const { // During marking phase in Hades, mutator thread may read a mapped value A // and store it to a marked object B, then deletes the entry. In diff --git a/include/hermes/VM/Runtime.h b/include/hermes/VM/Runtime.h index 828b4279e80..0ad12d26e40 100644 --- a/include/hermes/VM/Runtime.h +++ b/include/hermes/VM/Runtime.h @@ -1007,7 +1007,7 @@ class Runtime : public RuntimeBase, public HandleRootOwner { /// Returns a string representation of the JS stack. Does no operations /// that allocate on the JS heap, so safe to use for an out-of-memory /// exception. - /// \p ip specifies the the IP of the leaf frame. + /// \p ip specifies the IP of the leaf frame. std::string getCallStackNoAlloc(const Inst *ip); /// \return a string representation of the JS stack without knowing the leaf diff --git a/include/hermes/VM/RuntimeModule.h b/include/hermes/VM/RuntimeModule.h index 3fc0a7efebc..30020e07fb9 100644 --- a/include/hermes/VM/RuntimeModule.h +++ b/include/hermes/VM/RuntimeModule.h @@ -463,7 +463,7 @@ class RuntimeModule final : public llvh::ilist_node { /// the array size will remain unchanged. void setModuleExport(Runtime &runtime, uint32_t modIndex, Handle<> modExport); - /// The \p cases pointer points the the start of the string switch + /// The \p cases pointer points to the start of the string switch /// table for a StringSwitchImm instruction; \p size is the size of that /// table. Initializes \p table, which must be the runtime table dedicated to /// this instruction, to map the case labels to the right (bytecode) branch diff --git a/include/hermes/VM/TwineChar16.h b/include/hermes/VM/TwineChar16.h index 34b9064bfa6..e7c578ad6f2 100644 --- a/include/hermes/VM/TwineChar16.h +++ b/include/hermes/VM/TwineChar16.h @@ -45,7 +45,7 @@ class StringPrimitive; /// Each TwineChar16 has two child nodes, which can either be leaves or other /// twines. If they are leaves, then they contain some form of string directly /// (char *, char16_t *, UTF16Ref, or StringPrimitive *). We also store the size -/// of the strings stored in the the left and right nodes, allowing for constant +/// of the strings stored in the left and right nodes, allowing for constant /// time size() calls. The resultant string can be read by visiting the leaves /// in preorder. /// diff --git a/lib/BCGen/HBC/HBC.cpp b/lib/BCGen/HBC/HBC.cpp index 7958fcdde31..d91ff8f0cdc 100644 --- a/lib/BCGen/HBC/HBC.cpp +++ b/lib/BCGen/HBC/HBC.cpp @@ -117,7 +117,7 @@ class LazyCompilationThreadData { /// Worker function for the compileLazyFunction, intended to be run in a /// thread with a fresh stack to prevent stack overflows. -/// \param argPtr[in/out] pointer to the the LazyCompilationThreadData to use as +/// \param argPtr[in/out] pointer to the LazyCompilationThreadData to use as /// input/output. static void compileLazyFunctionWorker(void *argPtr) { LazyCompilationThreadData *data = diff --git a/lib/BCGen/HBC/ISel.cpp b/lib/BCGen/HBC/ISel.cpp index b00c7d19284..e397e9ae55a 100644 --- a/lib/BCGen/HBC/ISel.cpp +++ b/lib/BCGen/HBC/ISel.cpp @@ -467,7 +467,7 @@ void HBCISel::generateJumpTable() { } BCFGen_->updateTableOffset( - // Offset is located two bytes from begining of instruction. + // Offset is located two bytes from beginning of instruction. entry.offset + 1 + 1, startOfTable * sizeof(uint32_t), entry.offset); @@ -506,7 +506,7 @@ void HBCISel::generateStringSwitchTable() { basicBlockMap_[stringSwitchCase.target].first - entry.offset); } BCFGen_->updateTableOffset( - // Offset is located 6 bytes from begining of instruction. + // Offset is located 6 bytes from beginning of instruction. // (Opcode, value register, global index). entry.offset + 1 + 1 + 4, // baseOffset is the byte size of the jump table. diff --git a/lib/BCGen/LiteralBufferBuilder.cpp b/lib/BCGen/LiteralBufferBuilder.cpp index 200dd4b9a41..18f3e019e8e 100644 --- a/lib/BCGen/LiteralBufferBuilder.cpp +++ b/lib/BCGen/LiteralBufferBuilder.cpp @@ -16,7 +16,7 @@ #include "hermes/VM/ObjectAllocKind.h" namespace hermes::LiteralBufferBuilder::detail { -/// The key with which to to deduplicate shape table entries in coordToIdx. +/// The key with which to deduplicate shape table entries in coordToIdx. struct ShapeTableDedupKey { /// The offset of the first key in the key buffer. uint32_t keyBufferOffset; @@ -160,7 +160,7 @@ class Builder { void serializeLiteralFor(LIRAllocTypedObjectFromBufferInst *AOFB); void serializeLiteralFor(LIRAllocTypedNonEnumObjectFromBufferInst *AOFB); - /// Serialize the the input literals \p elements into the UniquedStringVector + /// Serialize the input literals \p elements into the UniquedStringVector /// \p dest. /// \p isKeyBuffer: whether this is generating object literal key buffer or /// not. diff --git a/lib/IRGen/ESTreeIRGen-stmt.cpp b/lib/IRGen/ESTreeIRGen-stmt.cpp index d15a7978cef..e7cc879f763 100644 --- a/lib/IRGen/ESTreeIRGen-stmt.cpp +++ b/lib/IRGen/ESTreeIRGen-stmt.cpp @@ -1354,7 +1354,7 @@ void ESTreeIRGen::genConstSwitchStmt( } else { auto *lit = caseLiterals[caseIndex]; - // Only generate the case and block if this is the first occurence of the + // Only generate the case and block if this is the first occurrence of the // value. if (valueSet.insert(lit).second) { values.push_back(lit); diff --git a/lib/IRGen/ESTreeIRGen.h b/lib/IRGen/ESTreeIRGen.h index 89823b746b2..6eb7180fc65 100644 --- a/lib/IRGen/ESTreeIRGen.h +++ b/lib/IRGen/ESTreeIRGen.h @@ -1554,7 +1554,7 @@ class ESTreeIRGen { BuiltinMethod::Enum builtinIndex, ArrayRef args); - /// Generate code to ensure that \p value is an object and it it isn't, throw + /// Generate code to ensure that \p value is an object and if it isn't, throw /// a type error with the specified message. void emitEnsureObject(Value *value, llvh::StringRef message); diff --git a/lib/Optimizer/Scalar/FunctionAnalysis.cpp b/lib/Optimizer/Scalar/FunctionAnalysis.cpp index 5fcfa35bce0..0400ee39264 100644 --- a/lib/Optimizer/Scalar/FunctionAnalysis.cpp +++ b/lib/Optimizer/Scalar/FunctionAnalysis.cpp @@ -77,7 +77,7 @@ bool canEscapeThroughCall(Instruction *C, Function *F, BaseCallInst *CI) { /// Check if the variable \p V, which is known to be stored to with closure /// \p val, can be analyzed such that a call to a value loaded from \p V is /// known to call \p val. -/// \return a pair of of [storeIsOnlyClosure, noOtherValues]. The first +/// \return a pair of [storeIsOnlyClosure, noOtherValues]. The first /// indicates whether any successful call to a value loaded from \p V is known /// to invoke \p val. The second indicates whether \p V has no stores of values /// that will throw when called (e.g. undefined, null, etc.). This can be used diff --git a/lib/Optimizer/Scalar/LowerGeneratorFunction.cpp b/lib/Optimizer/Scalar/LowerGeneratorFunction.cpp index 2b3f069ca01..346f4c90571 100644 --- a/lib/Optimizer/Scalar/LowerGeneratorFunction.cpp +++ b/lib/Optimizer/Scalar/LowerGeneratorFunction.cpp @@ -34,7 +34,7 @@ // All 'local' instructions must be removed from the inner function and lifted // into the outer function as a variable. Local here means any instructions that // refer to stack values, such as AllocStackInst or instructions that read -// paramters. +// parameters. // // The creation of the switch changes the dominance structure between the // existing blocks. Values that now cross blocks without proper dominance need diff --git a/lib/Sema/SemanticResolver.cpp b/lib/Sema/SemanticResolver.cpp index 45696214211..745e845d46b 100644 --- a/lib/Sema/SemanticResolver.cpp +++ b/lib/Sema/SemanticResolver.cpp @@ -989,7 +989,7 @@ void SemanticResolver::visit(ClassPrivatePropertyNode *node) { // initializers are not allowed to reference `arguments`. If we didn't do // this then a class in the global scope would allow a field initializer to // reference `arguments`, since it would treat it as a normal identifier. - // This will insert the `arguments` identifer into the binding table scope + // This will insert the `arguments` identifier into the binding table scope // which is created by the class declaration / expression node. declareArguments(); visitESTreeNode(*this, node->_value, node); diff --git a/lib/Support/UTF16Stream.cpp b/lib/Support/UTF16Stream.cpp index c6d624ea244..248d1a7a8cb 100644 --- a/lib/Support/UTF16Stream.cpp +++ b/lib/Support/UTF16Stream.cpp @@ -47,7 +47,7 @@ void UTF16Stream::makeRoomForCapture() { assert(beginCapture_ && "no active capture"); assert(cur_ == end_ && "there is still room left for the capture"); size_t beginCaptureOffset = beginCapture_ - &storage_.front(); - // We only grow the conversion buffer if the the beginning of the capture is + // We only grow the conversion buffer if the beginning of the capture is // in the first half of the buffer. Otherwise, we just copy the current // capture into the beginning of the storage. if (beginCaptureOffset < storage_.size() / 2) { diff --git a/lib/VM/Debugger/Debugger.cpp b/lib/VM/Debugger/Debugger.cpp index 58cc688ae86..27db40c49f5 100644 --- a/lib/VM/Debugger/Debugger.cpp +++ b/lib/VM/Debugger/Debugger.cpp @@ -1327,7 +1327,7 @@ HermesValue Debugger::evalInFrame( bool singleFunction = false; - // If we are debugging inside of a class constuctor, we make an arrow + // If we are debugging inside of a class constructor, we make an arrow // function for the eval expression. It would be invalid to call that arrow // function with a non-undefined new.target. Handle<> newTarget = diff --git a/lib/VM/JIT/arm64/JitEmitter.h b/lib/VM/JIT/arm64/JitEmitter.h index bf56671743d..9608c280f40 100644 --- a/lib/VM/JIT/arm64/JitEmitter.h +++ b/lib/VM/JIT/arm64/JitEmitter.h @@ -707,7 +707,7 @@ class Emitter { struct StringSwitchCase { // The string id of the case label. uint32_t caseLabelStringId; - // A JIT label for the start of JITted code for the the basic block + // A JIT label for the start of JITted code for the basic block // corresponding to the case. const asmjit::Label *target; diff --git a/lib/VM/JSLib/Object.cpp b/lib/VM/JSLib/Object.cpp index ee3c12db10e..586604e0378 100644 --- a/lib/VM/JSLib/Object.cpp +++ b/lib/VM/JSLib/Object.cpp @@ -1190,7 +1190,7 @@ CallResult objectAssign(void *, Runtime &runtime) { // 5.c.iii.1. Let propValue be Get(from, nextKey). // getComputed_RJS would work here in all cases. But, just - // changing it to make proxy work is is a surprisingly large + // changing it to make proxy work is a surprisingly large // regression if used always, even with no Proxy objects. So we // check if we can use getComputedPropertyValue_RJS and do so. CallResult> propRes = fromHandle->isProxyObject() diff --git a/lib/VM/JSObject.cpp b/lib/VM/JSObject.cpp index 86e269bda8a..47f2dd78856 100644 --- a/lib/VM/JSObject.cpp +++ b/lib/VM/JSObject.cpp @@ -1160,7 +1160,7 @@ CallResult> JSObject::getNamedWithReceiver_RJS( if (selfHandle->getParent(runtime) == propObj && !selfHandle->getClass(runtime)->isDictionary()) { // Property found on an object in the prototype chain. The proto - // cache only works for the immediate proto of the the object, + // cache only works for the immediate proto of the object, // so don't cache for deeper prototypes. We also don't cache // if the object HC is a dictionary; those may gain properties without // changing the HC value, which breaks the "negative caching" of @@ -3602,7 +3602,7 @@ ExecutionStatus setProtoClasses( /// Verifies that the classes of obj's prototype chain still matches those /// previously prefixed to arr by setProtoClasses. /// Assumes that the first elements are the count of HiddenClasses and the count -/// of the object's own properties, and element 2 is is the object's own +/// of the object's own properties, and element 2 is the object's own /// HiddenClass, so it doesn't check those. /// /// \param obj The object whose prototype chain should be verified diff --git a/lib/VM/StringPrimitive.cpp b/lib/VM/StringPrimitive.cpp index 5bf0eb3faa6..691fbaea412 100644 --- a/lib/VM/StringPrimitive.cpp +++ b/lib/VM/StringPrimitive.cpp @@ -617,7 +617,7 @@ PseudoHandle BufferedStringPrimitive::create( } #ifndef NDEBUG -/// Assert the the combined length of the two strings is valid. +/// Assert the combined length of the two strings is valid. static void assertValidLength(StringPrimitive *a, StringPrimitive *b) { SafeUInt32 len(a->getStringLength()); len.add(b->getStringLength()); diff --git a/tools/hermes-parser/js/hermes-parser/src/utils/mutateESTreeASTForPrettier.js b/tools/hermes-parser/js/hermes-parser/src/utils/mutateESTreeASTForPrettier.js index 4b2b171ab59..825208c822f 100644 --- a/tools/hermes-parser/js/hermes-parser/src/utils/mutateESTreeASTForPrettier.js +++ b/tools/hermes-parser/js/hermes-parser/src/utils/mutateESTreeASTForPrettier.js @@ -94,7 +94,7 @@ export default function mutate( return node; } - // Prettier currently relies on comparing the the start positions to know if the import/export specifier should have a + // Prettier currently relies on comparing the start positions to know if the import/export specifier should have a // rename (eg `Name` vs `Name as Name`) when the name is exactly the same // So we need to ensure that the range is always the same to avoid the useless code printing if (node.type === 'ImportSpecifier') { diff --git a/tools/hermes-parser/js/hermes-transform/src/transform/comments/comments.js b/tools/hermes-parser/js/hermes-transform/src/transform/comments/comments.js index 51fd2e680dc..f6d5f4c67b5 100644 --- a/tools/hermes-parser/js/hermes-transform/src/transform/comments/comments.js +++ b/tools/hermes-parser/js/hermes-transform/src/transform/comments/comments.js @@ -265,7 +265,7 @@ export function appendCommentToSource( switch (comment.type) { case 'Block': { // Prettier decides if a newline is necessary between the comment and its node by looking - // to see if a newline seperates them in the source text. We can trick prettier into + // to see if a newline separates them in the source text. We can trick prettier into // formatting how we want for new comments by placing the range such that a newline // will (OWN_LINE) or will not (INLINE) be found when searching from the specified range // position. diff --git a/unittests/VMRuntime/Instrumentation/ApproxIntegralTest.cpp b/unittests/VMRuntime/Instrumentation/ApproxIntegralTest.cpp index de34abae547..7dab15d26a3 100644 --- a/unittests/VMRuntime/Instrumentation/ApproxIntegralTest.cpp +++ b/unittests/VMRuntime/Instrumentation/ApproxIntegralTest.cpp @@ -94,7 +94,7 @@ TEST(ApproxIntegralTest, ErrorConvergence) { } /// When the estimated area is not a whole number, its value is rounded down. -/// When the the area of the estimate's constituent trapezoids are not +/// When the area of the estimate's constituent trapezoids are not /// necessarily whole, the contribution of integer rounding error to the overall /// error term should not grow with the number of samples, but should remain /// constant.