Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion API/hermes/SynthTrace.h
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ class SynthTrace {
/// If we're tracing to a file, pointer to a stream onto
/// traceFilename_. Null otherwise.
std::unique_ptr<llvh::raw_ostream> 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
Expand Down
2 changes: 1 addition & 1 deletion API/hermes/hermes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ class HermesRuntimeImpl final : public HermesRuntime,
return make<jsi::WeakObject>(&weakHermesValues_.add(wr));
}

// overriden from jsi::Instrumentation
// overridden from jsi::Instrumentation
std::string getRecordedGCStats() override {
std::string s;
llvh::raw_string_ostream os(s);
Expand Down
2 changes: 1 addition & 1 deletion API/hermes_abi/hermes_abi.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
16 changes: 8 additions & 8 deletions API/jsi/jsi/test/testlib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1103,14 +1103,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
Expand Down Expand Up @@ -1139,10 +1139,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);
}
}

Expand Down
4 changes: 2 additions & 2 deletions doc/Modules.md
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion doc/Strings.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
2 changes: 1 addition & 1 deletion include/hermes/ADT/ManagedChunkedList.h
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion include/hermes/AST/ESTree.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion include/hermes/BCGen/HBC/BCProviderFromSrc.h
Original file line number Diff line number Diff line change
Expand Up @@ -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").
Expand Down
4 changes: 2 additions & 2 deletions include/hermes/BCGen/HBC/BytecodeList.def
Original file line number Diff line number Diff line change
Expand Up @@ -693,15 +693,15 @@ 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.
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.
Expand Down
2 changes: 1 addition & 1 deletion include/hermes/BCGen/HBC/HBC.h
Original file line number Diff line number Diff line change
Expand Up @@ -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").
Expand Down
2 changes: 1 addition & 1 deletion include/hermes/BCGen/HBC/StringKind.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions include/hermes/CompilerDriver/CompilerDriver.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};

Expand Down
4 changes: 2 additions & 2 deletions include/hermes/IR/IR.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion include/hermes/VM/GCBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion include/hermes/VM/GCConcurrency.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion include/hermes/VM/HiddenClass.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions include/hermes/VM/IdentifierTable.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion include/hermes/VM/JSLib/DateCache.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion include/hermes/VM/JSWeakMapImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion include/hermes/VM/PropertyDescriptor.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion include/hermes/VM/Runtime.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion include/hermes/VM/RuntimeModule.h
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ class RuntimeModule final : public llvh::ilist_node<RuntimeModule> {
/// 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
Expand Down
2 changes: 1 addition & 1 deletion include/hermes/VM/StackFrame.h
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion include/hermes/VM/TwineChar16.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
///
Expand Down
4 changes: 2 additions & 2 deletions lib/BCGen/HBC/HBC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions lib/BCGen/HBC/ISel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion lib/BCGen/HBC/Passes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ bool LoadConstants::operandMustBeLiteral(Instruction *Inst, unsigned opIndex) {

if (auto *SOP = llvh::dyn_cast<DefineOwnPropertyInst>(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<LiteralNumber>(Inst->getOperand(opIndex))) {
Expand Down
4 changes: 2 additions & 2 deletions lib/BCGen/LiteralBufferBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion lib/BCGen/SH/LoadConstants.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ bool operandMustBeLiteral(Instruction *Inst, unsigned opIndex) {

if (auto *SOP = llvh::dyn_cast<DefineOwnPropertyInst>(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<LiteralNumber>(Inst->getOperand(opIndex))) {
Expand Down
2 changes: 1 addition & 1 deletion lib/IRGen/ESTreeIRGen-stmt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion lib/IRGen/ESTreeIRGen.h
Original file line number Diff line number Diff line change
Expand Up @@ -1554,7 +1554,7 @@ class ESTreeIRGen {
BuiltinMethod::Enum builtinIndex,
ArrayRef<Value *> 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);

Expand Down
Loading