From 479b7c3785491b1f4e5b89ada0284fae1317e733 Mon Sep 17 00:00:00 2001 From: xujie Date: Mon, 21 Mar 2022 17:09:19 +0800 Subject: [PATCH] Clean Code For CodeHub Issues #96-#123 And #250-#264 According to the problems pointed out by the issuer and the specifications compiled by Huawei, modify the non-compliant parts of jsruntime. Issue:https://gitee.com/openharmony/ark_js_runtime/issues/I4YLCQ Signed-off-by: xujie Change-Id: Iceb771dfd9f3aa9017205068fc50ab1a63aae08b --- ecmascript/builtins.cpp | 2 +- ecmascript/builtins/builtins_object.cpp | 4 ++-- ecmascript/builtins/builtins_object.h | 2 +- .../builtins/tests/builtins_object_test.cpp | 4 ++-- .../builtins/tests/builtins_set_test.cpp | 2 +- ecmascript/compiler/tests/stub_tests.cpp | 2 +- ecmascript/dfx/vm_thread_control.cpp | 4 ++-- ecmascript/dfx/vm_thread_control.h | 2 +- ecmascript/ecma_exceptions.h | 2 +- ecmascript/ecma_global_storage.h | 6 +++--- ecmascript/ecma_isa.yaml | 4 ++-- ecmascript/ecma_vm.cpp | 2 +- ecmascript/global_env_constants.cpp | 2 +- ecmascript/global_env_constants.h | 2 +- ecmascript/interpreter/interpreter-inl.h | 2 +- ecmascript/js_collator.h | 2 +- ecmascript/js_date_time_format.cpp | 4 ++-- ecmascript/js_function.cpp | 2 +- ecmascript/js_function.h | 6 +++--- ecmascript/js_hclass-inl.h | 8 ++++---- ecmascript/js_hclass.h | 2 +- ecmascript/js_locale.cpp | 7 ++++--- ecmascript/js_number_format.cpp | 4 ++-- ecmascript/js_number_format.h | 6 +++--- ecmascript/js_object.h | 2 +- ecmascript/js_plural_rules.cpp | 6 +++--- ecmascript/js_plural_rules.h | 4 ++-- ecmascript/js_serializer.cpp | 2 +- ecmascript/js_serializer.h | 4 ++-- ecmascript/js_tagged_value-inl.h | 4 ++-- .../jspandafile/class_info_extractor.cpp | 20 +++++++++---------- ecmascript/jspandafile/class_info_extractor.h | 8 ++++---- ecmascript/mem/space.h | 2 +- ecmascript/mem/sparse_space.cpp | 2 +- ecmascript/runtime_call_id.h | 6 +++--- .../snapshot/mem/snapshot_serialize.cpp | 2 +- ecmascript/tooling/base/pt_params.cpp | 2 +- ecmascript/tooling/test/utils/test_util.h | 2 +- 38 files changed, 75 insertions(+), 74 deletions(-) diff --git a/ecmascript/builtins.cpp b/ecmascript/builtins.cpp index 64899ce9..42d3f976 100644 --- a/ecmascript/builtins.cpp +++ b/ecmascript/builtins.cpp @@ -465,7 +465,7 @@ void Builtins::InitializeObject(const JSHandle &env, const JSHandleGetThread(), Object, GetOwnPropertyDesciptor); + BUILTINS_API_TRACE(argv->GetThread(), Object, GetOwnPropertyDescriptor); JSThread *thread = argv->GetThread(); [[maybe_unused]] EcmaHandleScope handleScope(thread); diff --git a/ecmascript/builtins/builtins_object.h b/ecmascript/builtins/builtins_object.h index d2ab9a00..5db0c4a4 100644 --- a/ecmascript/builtins/builtins_object.h +++ b/ecmascript/builtins/builtins_object.h @@ -43,7 +43,7 @@ public: // 19.1.2.5Object.freeze ( O ) static JSTaggedValue Freeze(EcmaRuntimeCallInfo *argv); // 19.1.2.6Object.getOwnPropertyDescriptor ( O, P ) - static JSTaggedValue GetOwnPropertyDesciptor(EcmaRuntimeCallInfo *argv); + static JSTaggedValue GetOwnPropertyDescriptor(EcmaRuntimeCallInfo *argv); // 19.1.2.7Object.getOwnPropertyNames ( O ) static JSTaggedValue GetOwnPropertyNames(EcmaRuntimeCallInfo *argv); // 19.1.2.8Object.getOwnPropertySymbols ( O ) diff --git a/ecmascript/builtins/tests/builtins_object_test.cpp b/ecmascript/builtins/tests/builtins_object_test.cpp index 509993ac..af5f3c71 100644 --- a/ecmascript/builtins/tests/builtins_object_test.cpp +++ b/ecmascript/builtins/tests/builtins_object_test.cpp @@ -355,7 +355,7 @@ HWTEST_F_L0(BuiltinsObjectTest, Freeze) } // 19.1.2.6 Object.getOwnPropertyDescriptor ( O, P ) -HWTEST_F_L0(BuiltinsObjectTest, GetOwnPropertyDesciptor) +HWTEST_F_L0(BuiltinsObjectTest, GetOwnPropertyDescriptor) { JSHandle function(thread, BuiltinsObjectTestCreate(thread)); JSHandle objHandle = @@ -374,7 +374,7 @@ HWTEST_F_L0(BuiltinsObjectTest, GetOwnPropertyDesciptor) objCallInfo->SetCallArg(1, key.GetTaggedValue()); [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, objCallInfo.get()); - JSTaggedValue result = BuiltinsObject::GetOwnPropertyDesciptor(objCallInfo.get()); + JSTaggedValue result = BuiltinsObject::GetOwnPropertyDescriptor(objCallInfo.get()); TestHelper::TearDownFrame(thread, prev); ASSERT_TRUE(result.IsECMAObject()); diff --git a/ecmascript/builtins/tests/builtins_set_test.cpp b/ecmascript/builtins/tests/builtins_set_test.cpp index e7658f2b..b53b2a6c 100644 --- a/ecmascript/builtins/tests/builtins_set_test.cpp +++ b/ecmascript/builtins/tests/builtins_set_test.cpp @@ -354,7 +354,7 @@ HWTEST_F_L0(BuiltinsSetTest, GetIterator) EXPECT_EQ(IterationKind::VALUE, IterationKind(iter->GetIterationKind())); EXPECT_EQ(JSSet::Cast(set.GetTaggedValue().GetTaggedObject())->GetLinkedSet(), iter->GetIteratedSet()); - // test entrys() + // test entries() JSTaggedValue result2 = BuiltinsSet::Entries(ecmaRuntimeCallInfo.get()); JSHandle iter2(thread, result2); EXPECT_TRUE(iter2->IsJSSetIterator()); diff --git a/ecmascript/compiler/tests/stub_tests.cpp b/ecmascript/compiler/tests/stub_tests.cpp index 1e518893..4a9df101 100644 --- a/ecmascript/compiler/tests/stub_tests.cpp +++ b/ecmascript/compiler/tests/stub_tests.cpp @@ -682,7 +682,7 @@ HWTEST_F_L0(StubTest, JSEntryTest) } /* -verify modify llvm prologue : call main ok means don't destory c abi +verify modify llvm prologue : call main ok means don't destroy c abi test: main push rbp push type diff --git a/ecmascript/dfx/vm_thread_control.cpp b/ecmascript/dfx/vm_thread_control.cpp index 560c1153..25065b19 100644 --- a/ecmascript/dfx/vm_thread_control.cpp +++ b/ecmascript/dfx/vm_thread_control.cpp @@ -32,12 +32,12 @@ bool VmThreadControl::NotifyVMThreadSuspension() // block caller thread void VmThreadControl::SuspendVM() // block vm thread { os::memory::LockHolder lock(vmThreadSuspensionMutex_); - SetVMSuspened(true); + SetVMSuspended(true); vmThreadNeedSuspensionCV_.Signal(); // wake up the thread who needs suspend vmthread while (VMNeedSuspension()) { vmThreadHasSuspendedCV_.Wait(&vmThreadSuspensionMutex_); } - SetVMSuspened(false); + SetVMSuspended(false); } void VmThreadControl::ResumeVM() diff --git a/ecmascript/dfx/vm_thread_control.h b/ecmascript/dfx/vm_thread_control.h index 0c8bce21..0a0a2a6e 100644 --- a/ecmascript/dfx/vm_thread_control.h +++ b/ecmascript/dfx/vm_thread_control.h @@ -44,7 +44,7 @@ public: bool NotifyVMThreadSuspension(); - void SetVMSuspened(bool flag) + void SetVMSuspended(bool flag) { uint64_t newVal = VMHasSuspendedBit::Update(threadStateBitField_, flag); threadStateBitField_ = newVal; diff --git a/ecmascript/ecma_exceptions.h b/ecmascript/ecma_exceptions.h index 9590f727..12f88e7a 100644 --- a/ecmascript/ecma_exceptions.h +++ b/ecmascript/ecma_exceptions.h @@ -16,7 +16,7 @@ #ifndef ECMASCRIPT_ECMA_EXCEPTIONS_H #define ECMASCRIPT_ECMA_EXCEPTIONS_H -/* Do not add ecma special header's here */ +/* Do not add ecma special header files here */ #include "ecmascript/js_thread.h" namespace panda::ecmascript { diff --git a/ecmascript/ecma_global_storage.h b/ecmascript/ecma_global_storage.h index 2c5fb511..6c7eb257 100644 --- a/ecmascript/ecma_global_storage.h +++ b/ecmascript/ecma_global_storage.h @@ -13,8 +13,8 @@ * limitations under the License. */ -#ifndef ECMASCRIPT_ECMA_GLOABL_STORAGE_H -#define ECMASCRIPT_ECMA_GLOABL_STORAGE_H +#ifndef ECMASCRIPT_ECMA_GLOBAL_STORAGE_H +#define ECMASCRIPT_ECMA_GLOBAL_STORAGE_H #include "ecmascript/js_tagged_value.h" @@ -264,4 +264,4 @@ private: NodeList *weakFreeListNodes_ {nullptr}; }; } // namespace panda::ecmascript -#endif // ECMASCRIPT_ECMA_GLOABL_STORAGE_H +#endif // ECMASCRIPT_ECMA_GLOBAL_STORAGE_H diff --git a/ecmascript/ecma_isa.yaml b/ecmascript/ecma_isa.yaml index fe41d3d7..273161e9 100644 --- a/ecmascript/ecma_isa.yaml +++ b/ecmascript/ecma_isa.yaml @@ -16,8 +16,8 @@ prefixes: description: Extension for ecma support. groups: - - title: Ecma extension intrunctions - description: Ecma extension intrunctions with prefix ecam + - title: Ecma extension instructions + description: Ecma extension instructions with prefix ecma verification: - none exceptions: diff --git a/ecmascript/ecma_vm.cpp b/ecmascript/ecma_vm.cpp index ad898b5a..50799790 100644 --- a/ecmascript/ecma_vm.cpp +++ b/ecmascript/ecma_vm.cpp @@ -233,7 +233,7 @@ void EcmaVM::InitializeEcmaScriptRunStat() #undef INTERPRETER_CALLER_NAME // NOLINTNEXTLINE(cppcoreguidelines-macro-usage) #define BUILTINS_API_NAME(class, name) "BuiltinsApi::" #class "_" #name, - BUITINS_API_LIST(BUILTINS_API_NAME) + BUILTINS_API_LIST(BUILTINS_API_NAME) #undef BUILTINS_API_NAME #define ABSTRACT_OPERATION_NAME(class, name) "AbstractOperation::" #class "_" #name, ABSTRACT_OPERATION_LIST(ABSTRACT_OPERATION_NAME) diff --git a/ecmascript/global_env_constants.cpp b/ecmascript/global_env_constants.cpp index 072fbd97..5c0f6fc6 100644 --- a/ecmascript/global_env_constants.cpp +++ b/ecmascript/global_env_constants.cpp @@ -77,7 +77,7 @@ void GlobalEnvConstants::InitRootsClass([[maybe_unused]] JSThread *thread, JSHCl SetConstant(ConstantIndex::ENV_CLASS_INDEX, factory->NewEcmaDynClass(dynClassClass, 0, JSType::TAGGED_ARRAY)); SetConstant(ConstantIndex::SYMBOL_CLASS_INDEX, factory->NewEcmaDynClass(dynClassClass, JSSymbol::SIZE, JSType::SYMBOL)); - SetConstant(ConstantIndex::ACCESSOE_DATA_CLASS_INDEX, + SetConstant(ConstantIndex::ACCESSOR_DATA_CLASS_INDEX, factory->NewEcmaDynClass(dynClassClass, AccessorData::SIZE, JSType::ACCESSOR_DATA)); SetConstant(ConstantIndex::INTERNAL_ACCESSOR_CLASS_INDEX, factory->NewEcmaDynClass(dynClassClass, AccessorData::SIZE, JSType::INTERNAL_ACCESSOR)); diff --git a/ecmascript/global_env_constants.h b/ecmascript/global_env_constants.h index fec04daa..a9483aa9 100644 --- a/ecmascript/global_env_constants.h +++ b/ecmascript/global_env_constants.h @@ -43,7 +43,7 @@ class JSThread; V(JSTaggedValue, FreeObjectWithOneFieldClass, FREE_OBJECT_WITH_ONE_FIELD_CLASS_INDEX, ecma_roots_class) \ V(JSTaggedValue, FreeObjectWithTwoFieldClass, FREE_OBJECT_WITH_TWO_FIELD_CLASS_INDEX, ecma_roots_class) \ V(JSTaggedValue, SymbolClass, SYMBOL_CLASS_INDEX, ecma_roots_class) \ - V(JSTaggedValue, AccessorDataClass, ACCESSOE_DATA_CLASS_INDEX, ecma_roots_class) \ + V(JSTaggedValue, AccessorDataClass, ACCESSOR_DATA_CLASS_INDEX, ecma_roots_class) \ V(JSTaggedValue, InternalAccessorClass, INTERNAL_ACCESSOR_CLASS_INDEX, ecma_roots_class) \ V(JSTaggedValue, JSProxyOrdinaryClass, JS_PROXY_ORDINARY_CLASS_INDEX, ecma_roots_class) \ V(JSTaggedValue, CompletionRecordClass, COMPLETION_RECORD_CLASS_INDEX, ecma_roots_class) \ diff --git a/ecmascript/interpreter/interpreter-inl.h b/ecmascript/interpreter/interpreter-inl.h index 7235400b..107661cc 100644 --- a/ecmascript/interpreter/interpreter-inl.h +++ b/ecmascript/interpreter/interpreter-inl.h @@ -3882,7 +3882,7 @@ JSTaggedValue EcmaInterpreter::GetThisObjectFromFastNewFrame(JSTaggedType *sp) JSMethod *method = ECMAObject::Cast(state->function.GetTaggedObject())->GetCallTarget(); ASSERT(method->OnlyHaveThisWithCallField()); uint32_t numVregs = method->GetNumVregsWithCallField(); - uint32_t numDeclaredArgs = method->GetNumArgsWithCallField() + 1; // 1: explict this object + uint32_t numDeclaredArgs = method->GetNumArgsWithCallField() + 1; // 1: explicit this object uint32_t hiddenThisObjectIndex = numVregs + numDeclaredArgs; // hidden this object in the end of fast new frame return JSTaggedValue(sp[hiddenThisObjectIndex]); } diff --git a/ecmascript/js_collator.h b/ecmascript/js_collator.h index baeb1747..c54cf275 100644 --- a/ecmascript/js_collator.h +++ b/ecmascript/js_collator.h @@ -93,7 +93,7 @@ public: const JSHandle &string2); private: - static CaseFirstOption StringToCaseForstOption(const std::string &str); + static CaseFirstOption StringToCaseFirstOption(const std::string &str); static UColAttributeValue OptionToUColAttribute(CaseFirstOption caseFirstOption); diff --git a/ecmascript/js_date_time_format.cpp b/ecmascript/js_date_time_format.cpp index ca92fc26..85aa7b43 100644 --- a/ecmascript/js_date_time_format.cpp +++ b/ecmascript/js_date_time_format.cpp @@ -1224,7 +1224,7 @@ std::unique_ptr JSDateTimeFormat::ConstructTimeZone(const std::st std::map JSDateTimeFormat::GetSpecialTimeZoneMap() { - std::vector specicalTimeZones = { + std::vector specialTimeZones = { "America/Argentina/ComodRivadavia" "America/Knox_IN" "Antarctica/McMurdo" @@ -1257,7 +1257,7 @@ std::map JSDateTimeFormat::GetSpecialTimeZoneMap() "W-SU" "WET"}; std::map map; - for (const auto &item : specicalTimeZones) { + for (const auto &item : specialTimeZones) { std::string upper(item); transform(upper.begin(), upper.end(), upper.begin(), toupper); map.insert({upper, item}); diff --git a/ecmascript/js_function.cpp b/ecmascript/js_function.cpp index 68c82b91..d2f33cd7 100644 --- a/ecmascript/js_function.cpp +++ b/ecmascript/js_function.cpp @@ -127,7 +127,7 @@ bool JSFunction::PrototypeSetter(JSThread *thread, const JSHandle &sel JSHandle func(self); JSTaggedValue protoOrDyn = func->GetProtoOrDynClass(); if (protoOrDyn.IsJSHClass()) { - // need transtion + // need transition JSHandle dynclass(thread, protoOrDyn); JSHandle newDynclass = JSHClass::TransitionProto(thread, dynclass, value); if (value->IsECMAObject()) { diff --git a/ecmascript/js_function.h b/ecmascript/js_function.h index 9a406f1b..208d9c5f 100644 --- a/ecmascript/js_function.h +++ b/ecmascript/js_function.h @@ -13,8 +13,8 @@ * limitations under the License. */ -#ifndef ECMASCRIPT_JSFUCNTION_H -#define ECMASCRIPT_JSFUCNTION_H +#ifndef ECMASCRIPT_JSFUNCTION_H +#define ECMASCRIPT_JSFUNCTION_H #include "ecmascript/accessor_data.h" #include "ecmascript/ecma_macros.h" @@ -355,4 +355,4 @@ public: }; } // namespace panda::ecmascript -#endif // ECMASCRIPT_JSFUCNTION_H +#endif // ECMASCRIPT_JSFUNCTION_H diff --git a/ecmascript/js_hclass-inl.h b/ecmascript/js_hclass-inl.h index d3556a2f..540bea87 100644 --- a/ecmascript/js_hclass-inl.h +++ b/ecmascript/js_hclass-inl.h @@ -196,14 +196,14 @@ inline size_t JSHClass::SizeFromJSHClass(TaggedObject *header) return size; } -inline void JSHClass::Copy(const JSThread *thread, const JSHClass *jshcalss) +inline void JSHClass::Copy(const JSThread *thread, const JSHClass *jshclass) { DISALLOW_GARBAGE_COLLECTION; // copy jshclass - SetPrototype(thread, jshcalss->GetPrototype()); - SetBitField(jshcalss->GetBitField()); - SetNumberOfProps(jshcalss->NumberOfProps()); + SetPrototype(thread, jshclass->GetPrototype()); + SetBitField(jshclass->GetBitField()); + SetNumberOfProps(jshclass->NumberOfProps()); } } // namespace panda::ecmascript diff --git a/ecmascript/js_hclass.h b/ecmascript/js_hclass.h index 6ec8fcb9..8aab840c 100644 --- a/ecmascript/js_hclass.h +++ b/ecmascript/js_hclass.h @@ -1181,7 +1181,7 @@ private: inline JSHClass *FindTransitions(const JSTaggedValue &key, const JSTaggedValue &attributes); inline JSHClass *FindProtoTransitions(const JSTaggedValue &key, const JSTaggedValue &proto); - inline void Copy(const JSThread *thread, const JSHClass *jshcalss); + inline void Copy(const JSThread *thread, const JSHClass *jshclass); uint32_t *GetBitFieldAddr() const { diff --git a/ecmascript/js_locale.cpp b/ecmascript/js_locale.cpp index c34157f4..de5e1129 100644 --- a/ecmascript/js_locale.cpp +++ b/ecmascript/js_locale.cpp @@ -24,6 +24,7 @@ #include "unicode/localematcher.h" namespace panda::ecmascript { +const std::string LATN_STRING = "latn"; // 6.2.2 IsStructurallyValidLanguageTag( locale ) bool JSLocale::IsStructurallyValidLanguageTag(const JSHandle &tag) { @@ -159,8 +160,8 @@ JSLocale::ParsedLocale JSLocale::HandleLocale(const JSHandle &locale return parsedResult; } // Let privateIndex be Call(%StringProto_indexOf%, foundLocale, « "-x-" »). - size_t praviteIndex = result.find("-x-"); - if (praviteIndex != std::string::npos && praviteIndex < foundExtension) { + size_t privateIndex = result.find("-x-"); + if (privateIndex != std::string::npos && privateIndex < foundExtension) { parsedResult.base = result; return parsedResult; } @@ -955,7 +956,7 @@ std::string JSLocale::GetNumberingSystem(const icu::Locale &icuLocale) if (U_SUCCESS(status) != 0) { return numberingSystem->getName(); } - return "latn"; + return LATN_STRING; } bool JSLocale::IsWellFormedCurrencyCode(const std::string ¤cy) diff --git a/ecmascript/js_number_format.cpp b/ecmascript/js_number_format.cpp index aef91ac7..b0cb1443 100644 --- a/ecmascript/js_number_format.cpp +++ b/ecmascript/js_number_format.cpp @@ -835,14 +835,14 @@ JSHandle JSNumberFormat::UnwrapNumberFormat(JSThread *thread, con // 2. If nf does not have an [[InitializedNumberFormat]] internal slot and ? // InstanceofOperator(nf, %NumberFormat%) is true, then Let nf be ? Get(nf, %Intl%.[[FallbackSymbol]]). JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); - bool hasIstance = JSObject::InstanceOf(thread, nf, env->GetNumberFormatFunction()); + bool hasInstance = JSObject::InstanceOf(thread, nf, env->GetNumberFormatFunction()); RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, JSHandle(thread, JSTaggedValue::Undefined())); bool isJSNumberFormat = nf->IsJSNumberFormat(); // If nf does not have an [[InitializedNumberFormat]] internal slot and ? // InstanceofOperator(nf, %NumberFormat%) is true, then // a. Let nf be ? Get(nf, %Intl%.[[FallbackSymbol]]). - if (!isJSNumberFormat && hasIstance) { + if (!isJSNumberFormat && hasInstance) { JSHandle key(thread, JSHandle::Cast(env->GetIntlFunction())->GetFallbackSymbol()); OperationResult operationResult = JSTaggedValue::GetProperty(thread, nf, key); RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, JSHandle(thread, JSTaggedValue::Undefined())); diff --git a/ecmascript/js_number_format.h b/ecmascript/js_number_format.h index 58590e91..80ad89bb 100644 --- a/ecmascript/js_number_format.h +++ b/ecmascript/js_number_format.h @@ -60,9 +60,9 @@ public: ACCESSORS(Unit, UNIT_OFFSET, MINIMUM_INTEGER_DIGITS_OFFSET) ACCESSORS(MinimumIntegerDigits, MINIMUM_INTEGER_DIGITS_OFFSET, MINIMUM_FRACTION_DIGITS_OFFSET) ACCESSORS(MinimumFractionDigits, MINIMUM_FRACTION_DIGITS_OFFSET, MAXIMUM_FRACTION_DIGITS_OFFSET) - ACCESSORS(MaximumFractionDigits, MAXIMUM_FRACTION_DIGITS_OFFSET, MININUM_SIGNIFICANT_DIGITS_OFFSET) - ACCESSORS(MinimumSignificantDigits, MININUM_SIGNIFICANT_DIGITS_OFFSET, MAXINUM_SIGNIFICANT_DIGITS_OFFSET) - ACCESSORS(MaximumSignificantDigits, MAXINUM_SIGNIFICANT_DIGITS_OFFSET, USER_GROUPING_OFFSET) + ACCESSORS(MaximumFractionDigits, MAXIMUM_FRACTION_DIGITS_OFFSET, MINIMUM_SIGNIFICANT_DIGITS_OFFSET) + ACCESSORS(MinimumSignificantDigits, MINIMUM_SIGNIFICANT_DIGITS_OFFSET, MAXIMUM_SIGNIFICANT_DIGITS_OFFSET) + ACCESSORS(MaximumSignificantDigits, MAXIMUM_SIGNIFICANT_DIGITS_OFFSET, USER_GROUPING_OFFSET) ACCESSORS(UseGrouping, USER_GROUPING_OFFSET, BOUND_FORMAT_OFFSET) ACCESSORS(BoundFormat, BOUND_FORMAT_OFFSET, ICU_FIELD_OFFSET) ACCESSORS(IcuField, ICU_FIELD_OFFSET, BIT_FIELD_OFFSET) diff --git a/ecmascript/js_object.h b/ecmascript/js_object.h index 344575cf..f6d01340 100644 --- a/ecmascript/js_object.h +++ b/ecmascript/js_object.h @@ -415,7 +415,7 @@ public: template static JSHandle CreateListFromArrayLike(JSThread *thread, const JSHandle &obj); - // emca6 9.1 + // ecma6 9.1 // [[GetPrototypeOf]] JSTaggedValue GetPrototype(JSThread *thread) const; diff --git a/ecmascript/js_plural_rules.cpp b/ecmascript/js_plural_rules.cpp index 30b30e62..5feac969 100644 --- a/ecmascript/js_plural_rules.cpp +++ b/ecmascript/js_plural_rules.cpp @@ -195,7 +195,7 @@ JSHandle JSPluralRules::InitializePluralRules(JSThread *thread, icu::number::LocalizedNumberFormatter icuNumberFormatter = icu::number::NumberFormatter::withLocale(icuLocale).roundingMode(UNUM_ROUND_HALFUP); - bool sucess = true; + bool success = true; UErrorCode status = U_ZERO_ERROR; UPluralType icuType = UPLURAL_TYPE_CARDINAL; // Trans typeOption to ICU typeOption @@ -211,11 +211,11 @@ JSHandle JSPluralRules::InitializePluralRules(JSThread *thread, } std::unique_ptr icuPluralRules(icu::PluralRules::forLocale(icuLocale, icuType, status)); if (U_FAILURE(status)) { // NOLINT(readability-implicit-bool-conversion) - sucess = false; + success = false; } // Trans typeOption to ICU typeOption - if (!sucess || icuPluralRules == nullptr) { + if (!success || icuPluralRules == nullptr) { icu::Locale noExtensionLocale(icuLocale.getBaseName()); status = U_ZERO_ERROR; icuType = UPLURAL_TYPE_CARDINAL; diff --git a/ecmascript/js_plural_rules.h b/ecmascript/js_plural_rules.h index 873be7da..2e5cdc46 100644 --- a/ecmascript/js_plural_rules.h +++ b/ecmascript/js_plural_rules.h @@ -45,9 +45,9 @@ public: DEFINE_ALIGN_SIZE(LAST_OFFSET); // define BitField - static constexpr size_t ROUDING_TYPE_BITS = 3; + static constexpr size_t ROUNDING_TYPE_BITS = 3; static constexpr size_t TYPE_BITS = 2; - FIRST_BIT_FIELD(BitField, RoundingType, RoundingType, ROUDING_TYPE_BITS) + FIRST_BIT_FIELD(BitField, RoundingType, RoundingType, ROUNDING_TYPE_BITS) NEXT_BIT_FIELD(BitField, Type, TypeOption, TYPE_BITS, RoundingType) DECL_VISIT_OBJECT_FOR_JS_OBJECT(JSObject, LOCALE_OFFSET, BIT_FIELD_OFFSET) diff --git a/ecmascript/js_serializer.cpp b/ecmascript/js_serializer.cpp index 13bb4443..5e9a333f 100644 --- a/ecmascript/js_serializer.cpp +++ b/ecmascript/js_serializer.cpp @@ -583,7 +583,7 @@ bool JSSerializer::WriteJSArrayBuffer(const JSHandle &value) return false; } - // write Accessor shared which indicate the C memeory is shared + // write Accessor shared which indicate the C memory is shared bool shared = arrayBuffer->GetShared(); if (!WriteBoolean(shared)) { bufferSize_ = oldSize; diff --git a/ecmascript/js_serializer.h b/ecmascript/js_serializer.h index c3f893b0..e5074874 100644 --- a/ecmascript/js_serializer.h +++ b/ecmascript/js_serializer.h @@ -46,7 +46,7 @@ enum class SerializationUID : uint8_t { C_FALSE, // Tagged object reference mark TAGGED_OBJECT_REFERNCE, - // Support tagged objct id reference begin + // Support tagged object id reference begin JS_DATE, JS_REG_EXP, JS_PLAIN_OBJECT, @@ -65,7 +65,7 @@ enum class SerializationUID : uint8_t { JS_FLOAT32_ARRAY, JS_FLOAT64_ARRAY, // TypedArray end - // Support tagged objct id reference end + // Support tagged object id reference end // Error UIDs JS_ERROR, EVAL_ERROR, diff --git a/ecmascript/js_tagged_value-inl.h b/ecmascript/js_tagged_value-inl.h index eab5a6d1..28223787 100644 --- a/ecmascript/js_tagged_value-inl.h +++ b/ecmascript/js_tagged_value-inl.h @@ -826,8 +826,8 @@ inline bool JSTaggedValue::IsInternalAccessor() const inline bool JSTaggedValue::IsAccessor() const { if (IsHeapObject()) { - auto *jshcalss = GetTaggedObject()->GetClass(); - return jshcalss->IsAccessorData() || jshcalss->IsInternalAccessor(); + auto *jshclass = GetTaggedObject()->GetClass(); + return jshclass->IsAccessorData() || jshclass->IsInternalAccessor(); } return false; diff --git a/ecmascript/jspandafile/class_info_extractor.cpp b/ecmascript/jspandafile/class_info_extractor.cpp index 3ed90f44..7329973e 100644 --- a/ecmascript/jspandafile/class_info_extractor.cpp +++ b/ecmascript/jspandafile/class_info_extractor.cpp @@ -304,8 +304,8 @@ JSHandle ClassHelper::DefineClassTemplate(JSThread *thread, JSHandle } } else { JSHandle nonStaticKeys(thread, extractor->GetNonStaticKeys()); - JSHandle dict = BuildDictionaryPropeties(thread, prototype, nonStaticKeys, nonStaticProperties, - ClassPropertyType::NON_STATIC, constantpool); + JSHandle dict = BuildDictionaryProperties(thread, prototype, nonStaticKeys, nonStaticProperties, + ClassPropertyType::NON_STATIC, constantpool); prototype->SetProperties(thread, dict); } @@ -331,9 +331,9 @@ JSHandle ClassHelper::DefineClassTemplate(JSThread *thread, JSHandle } } else { JSHandle staticKeys(thread, extractor->GetStaticKeys()); - JSHandle dict = BuildDictionaryPropeties(thread, JSHandle(constructor), staticKeys, - staticProperties, ClassPropertyType::STATIC, - constantpool); + JSHandle dict = BuildDictionaryProperties(thread, JSHandle(constructor), staticKeys, + staticProperties, ClassPropertyType::STATIC, + constantpool); constructor->SetProperties(thread, dict); } @@ -348,11 +348,11 @@ JSHandle ClassHelper::DefineClassTemplate(JSThread *thread, JSHandle return constructor; } -JSHandle ClassHelper::BuildDictionaryPropeties(JSThread *thread, const JSHandle &object, - JSHandle &keys, - JSHandle &properties, - ClassPropertyType type, - const JSHandle &constantpool) +JSHandle ClassHelper::BuildDictionaryProperties(JSThread *thread, const JSHandle &object, + JSHandle &keys, + JSHandle &properties, + ClassPropertyType type, + const JSHandle &constantpool) { uint32_t length = keys->GetLength(); ASSERT(length > PropertyAttributes::MAX_CAPACITY_OF_PROPERTIES); diff --git a/ecmascript/jspandafile/class_info_extractor.h b/ecmascript/jspandafile/class_info_extractor.h index 63c392d0..e8393cd6 100644 --- a/ecmascript/jspandafile/class_info_extractor.h +++ b/ecmascript/jspandafile/class_info_extractor.h @@ -88,10 +88,10 @@ public: const JSHandle &constantpool); private: - static JSHandle BuildDictionaryPropeties(JSThread *thread, const JSHandle &object, - JSHandle &keys, - JSHandle &properties, ClassPropertyType type, - const JSHandle &constantpool); + static JSHandle BuildDictionaryProperties(JSThread *thread, const JSHandle &object, + JSHandle &keys, + JSHandle &properties, ClassPropertyType type, + const JSHandle &constantpool); static void HandleElementsProperties(JSThread *thread, const JSHandle &object, JSHandle &elements, const JSHandle &constantpool); diff --git a/ecmascript/mem/space.h b/ecmascript/mem/space.h index 35e4ab66..d4bd348d 100644 --- a/ecmascript/mem/space.h +++ b/ecmascript/mem/space.h @@ -68,7 +68,7 @@ static inline std::string ToSpaceTypeName(MemSpaceType type) case COMPRESS_SPACE: return "compress space"; default: - return "unknow space"; + return "unknown space"; } } diff --git a/ecmascript/mem/sparse_space.cpp b/ecmascript/mem/sparse_space.cpp index e7b8ef8c..3e775bc6 100644 --- a/ecmascript/mem/sparse_space.cpp +++ b/ecmascript/mem/sparse_space.cpp @@ -319,7 +319,7 @@ void OldSpace::SelectCSet() return; } CheckRegionSize(); - // 1、Select region which alive object largger than 80% + // 1、Select region which alive object larger than 80% EnumerateRegions([this](Region *region) { if (!region->MostObjectAlive()) { collectRegionSet_.emplace_back(region); diff --git a/ecmascript/runtime_call_id.h b/ecmascript/runtime_call_id.h index ad2f71e7..a2181590 100644 --- a/ecmascript/runtime_call_id.h +++ b/ecmascript/runtime_call_id.h @@ -229,7 +229,7 @@ namespace panda::ecmascript { V(GreaterEqDynWithIC) \ V(LdBigInt) // NOLINTNEXTLINE(cppcoreguidelines-macro-usage) -#define BUITINS_API_LIST(V) \ +#define BUILTINS_API_LIST(V) \ V(Array, Constructor) \ V(Array, From) \ V(Array, Of) \ @@ -386,7 +386,7 @@ namespace panda::ecmascript { V(Object, DefineProperties) \ V(Object, DefineProperty) \ V(Object, Freeze) \ - V(Object, GetOwnPropertyDesciptor) \ + V(Object, GetOwnPropertyDescriptor) \ V(Object, GetOwnPropertyKeys) \ V(Object, GetOwnPropertyNames) \ V(Object, GetOwnPropertySymbols) \ @@ -629,7 +629,7 @@ namespace panda::ecmascript { #define MEM_ALLOCATE_AND_GC_ID(name) MEM_ID##name, enum EcmaRuntimeCallerId { - INTERPRETER_CALLER_LIST(INTERPRETER_CALLER_ID) BUITINS_API_LIST(BUILTINS_API_ID) + INTERPRETER_CALLER_LIST(INTERPRETER_CALLER_ID) BUILTINS_API_LIST(BUILTINS_API_ID) ABSTRACT_OPERATION_LIST(ABSTRACT_OPERATION_ID) MEM_ALLOCATE_AND_GC_LIST(MEM_ALLOCATE_AND_GC_ID) #define DEF_RUNTIME_ID(name, c) RUNTIME_CALL_ID_##name, diff --git a/ecmascript/snapshot/mem/snapshot_serialize.cpp b/ecmascript/snapshot/mem/snapshot_serialize.cpp index aa0c22f7..4ab79562 100644 --- a/ecmascript/snapshot/mem/snapshot_serialize.cpp +++ b/ecmascript/snapshot/mem/snapshot_serialize.cpp @@ -238,7 +238,7 @@ static uintptr_t g_nativeTable[] = { reinterpret_cast(Object::DefineProperties), reinterpret_cast(Object::DefineProperty), reinterpret_cast(Object::Freeze), - reinterpret_cast(Object::GetOwnPropertyDesciptor), + reinterpret_cast(Object::GetOwnPropertyDescriptor), reinterpret_cast(Object::GetOwnPropertyNames), reinterpret_cast(Object::GetOwnPropertySymbols), reinterpret_cast(Object::GetPrototypeOf), diff --git a/ecmascript/tooling/base/pt_params.cpp b/ecmascript/tooling/base/pt_params.cpp index b29d7a20..6d95269a 100644 --- a/ecmascript/tooling/base/pt_params.cpp +++ b/ecmascript/tooling/base/pt_params.cpp @@ -511,7 +511,7 @@ std::unique_ptr StepOverParams::Create(const EcmaVM *ecmaVm, con if (obj != nullptr) { paramsObject->skipList_->emplace_back(std::move(obj)); } else { - error += "'skipList' items LocationRange is invaild;"; + error += "'skipList' items LocationRange is invalid;"; } } else { error += "'skipList' items should be an Object;"; diff --git a/ecmascript/tooling/test/utils/test_util.h b/ecmascript/tooling/test/utils/test_util.h index 69a89d23..cf385850 100644 --- a/ecmascript/tooling/test/utils/test_util.h +++ b/ecmascript/tooling/test/utils/test_util.h @@ -94,7 +94,7 @@ public: static void Event(DebugEvent event, PtThread thread = PtThread::NONE, PtLocation location = PtLocation("", EntityId(0), 0)) { - LOG(DEBUG, DEBUGGER) << "Occured event " << event << " in thread with id " << thread.GetId(); + LOG(DEBUG, DEBUGGER) << "Occurred event " << event << " in thread with id " << thread.GetId(); os::memory::LockHolder holder(eventMutex_); lastEvent_ = event; lastEventThread_ = thread;