From ac9a987e1f7e6068fc1af6c9c7140e5e07d70e63 Mon Sep 17 00:00:00 2001 From: Nazarov Konstantin Date: Fri, 30 Sep 2022 18:44:37 +0300 Subject: [PATCH 1/2] fix naming runtime Signed-off-by: Nazarov Konstantin --- ecmastdlib/ecmastdlib.pa | 2 +- irtoc_scripts/interpreter_main_loop.irt | 2 +- runtime/accessor_data.h | 10 +- runtime/base/error_helper.cpp | 10 +- runtime/base/error_helper.h | 6 +- runtime/base/number_helper.cpp | 54 +- runtime/base/number_helper.h | 2 +- runtime/base/string_helper.cpp | 93 +- runtime/base/string_helper.h | 95 +- runtime/base/utf_helper.cpp | 30 +- runtime/base/utf_helper.h | 16 +- runtime/builtins/builtins_array.cpp | 2 +- runtime/builtins/builtins_object.cpp | 8 +- runtime/builtins/builtins_typedarray.cpp | 2 +- runtime/class_info_extractor.cpp | 2 +- .../class_linker/panda_file_translator.cpp | 290 +- runtime/class_linker/panda_file_translator.h | 26 +- runtime/dump.cpp | 8 +- runtime/ecma_global_storage-inl.h | 58 +- runtime/ecma_global_storage.h | 65 +- runtime/ecma_handle_scope-inl.h | 22 +- runtime/ecma_handle_scope.h | 6 +- runtime/ecma_runtime.yaml | 4106 ++++++++--------- runtime/ecma_runtime_call_info.h | 12 +- runtime/ecma_string-inl.h | 50 +- runtime/ecma_string.cpp | 275 +- runtime/ecma_string.h | 85 +- runtime/ecma_string_table.cpp | 48 +- runtime/ecma_string_table.h | 10 +- runtime/ecma_vm.cpp | 277 +- runtime/ecma_vm.h | 133 +- runtime/frames.h | 22 +- runtime/global_dictionary-inl.h | 108 +- runtime/global_dictionary.h | 18 +- runtime/global_env_constants.cpp | 180 +- runtime/global_env_constants.h | 2 +- runtime/ic/ic_runtime.cpp | 26 +- runtime/ic/ic_runtime.h | 24 +- runtime/ic/ic_runtime_stub-inl.h | 295 +- runtime/ic/ic_runtime_stub.h | 44 +- runtime/ic/profile_type_info.cpp | 66 +- runtime/ic/profile_type_info.h | 8 +- runtime/ic/properties_cache-inl.h | 26 +- runtime/ic/properties_cache.h | 22 +- runtime/internal_call_params.cpp | 32 +- runtime/internal_call_params.h | 2 +- runtime/interpreter/ecma-interpreter-inl.h | 2 +- runtime/interpreter/js_decode_call_instr.h | 14 +- runtime/interpreter/slow_runtime_helper.cpp | 6 +- runtime/interpreter/slow_runtime_stub.cpp | 2 +- runtime/intrinsics-inl.h | 272 +- runtime/js_array.cpp | 198 +- runtime/js_array.h | 10 +- runtime/js_arraylist.cpp | 8 +- runtime/js_arraylist.h | 8 +- runtime/js_async_generator_object.cpp | 2 +- runtime/js_function.cpp | 89 +- runtime/js_function.h | 62 +- runtime/js_generator_object.cpp | 20 +- runtime/js_generator_object.h | 6 +- runtime/js_handle.h | 16 +- runtime/js_hclass-inl.h | 52 +- runtime/js_hclass.cpp | 78 +- runtime/js_hclass.h | 93 +- runtime/js_invoker.cpp | 2 +- runtime/js_method.cpp | 4 +- runtime/js_method.h | 47 +- runtime/js_native_pointer.h | 10 +- runtime/js_object-inl.h | 20 +- runtime/js_object.cpp | 178 +- runtime/js_object.h | 100 +- runtime/js_proxy.cpp | 24 +- runtime/js_proxy.h | 10 +- runtime/js_symbol.h | 10 +- runtime/js_tagged_number.h | 16 +- runtime/js_tagged_value-inl.h | 68 +- runtime/js_tagged_value.cpp | 25 +- runtime/js_tagged_value.h | 10 +- runtime/js_thread.cpp | 96 +- runtime/js_thread.h | 118 +- runtime/js_typed_array.cpp | 10 +- runtime/js_typed_array.h | 8 +- runtime/layout_info-inl.h | 76 +- runtime/layout_info.cpp | 48 +- runtime/layout_info.h | 24 +- runtime/lexical_env.h | 4 +- runtime/object_factory-inl.h | 34 +- runtime/object_factory.cpp | 206 +- runtime/object_factory.h | 217 +- runtime/object_operator.cpp | 44 +- runtime/object_operator.h | 28 +- runtime/property_attributes.h | 36 +- runtime/tagged_array-inl.h | 54 +- runtime/tagged_array.h | 20 +- runtime/tagged_dictionary.h | 28 +- runtime/tagged_hash_table-inl.h | 212 +- runtime/tagged_hash_table.h | 28 +- runtime/tagged_queue-inl.h | 4 +- runtime/tagged_queue.h | 38 +- runtime/template_string.h | 2 +- runtime/tooling/pt_js_extractor.h | 10 +- runtime/transitions_dictionary.h | 34 +- runtime/vmstat/caller_stat.cpp | 2 +- runtime/vmstat/caller_stat.h | 36 +- runtime/vmstat/runtime_stat.cpp | 30 +- runtime/vmstat/runtime_stat.h | 24 +- runtime/weak_vector.h | 2 +- tests/runtime/builtins/builtins_date_test.cpp | 2 +- tests/runtime/common/ecma_string_test.cpp | 36 +- tests/runtime/common/test_helper.cpp | 2 +- tests/runtime/common/test_helper.h | 2 +- 111 files changed, 4841 insertions(+), 4816 deletions(-) diff --git a/ecmastdlib/ecmastdlib.pa b/ecmastdlib/ecmastdlib.pa index e2111886d..502be2d99 100644 --- a/ecmastdlib/ecmastdlib.pa +++ b/ecmastdlib/ecmastdlib.pa @@ -82,7 +82,7 @@ .function void Ecmascript.Intrinsics.StLexVarDyn(u16 a0, u16 a1, any a2) .function any Ecmascript.Intrinsics.LdLexVarDyn(u16 a0, u16 a1) .function any Ecmascript.Intrinsics.ldlexenvDyn() -.function void Ecmascript.Intrinsics.popLexenvDyn() +.function void Ecmascript.Intrinsics.PopLexenvDyn() .function any Ecmascript.Intrinsics.getUnmappedArgs() .function any Ecmascript.Intrinsics.getUnmappedArgsInterp() .function any Ecmascript.Intrinsics.toboolean(any a0) diff --git a/irtoc_scripts/interpreter_main_loop.irt b/irtoc_scripts/interpreter_main_loop.irt index b24c2f363..de6368ec5 100644 --- a/irtoc_scripts/interpreter_main_loop.irt +++ b/irtoc_scripts/interpreter_main_loop.irt @@ -201,7 +201,7 @@ when "ECMA_LDLEXENVDYN_PREF_NONE" acc := handle_ecma_ldlexenvdyn() when "ECMA_POPLEXENVDYN_PREF_NONE" - ecma_intrinsic_invoke("popLexenvDyn") + ecma_intrinsic_invoke("PopLexenvDyn") when "ECMA_NEWLEXENVDYN_PREF_IMM16" ecma_intrinsic_setacc("NewlexenvDyn", as_imm(op[0])) when "ECMA_COPYLEXENVDYN_PREF_NONE" diff --git a/runtime/accessor_data.h b/runtime/accessor_data.h index 86bb5be8b..c03eb1e11 100644 --- a/runtime/accessor_data.h +++ b/runtime/accessor_data.h @@ -48,17 +48,17 @@ public: { ASSERT(GetGetter().IsJSNativePointer()); JSNativePointer *getter = JSNativePointer::Cast(GetGetter().GetTaggedObject()); - auto getFunc = reinterpret_cast(getter->GetExternalPointer()); - return getFunc(thread, obj); + auto get_func = reinterpret_cast(getter->GetExternalPointer()); + return get_func(thread, obj); } bool CallInternalSet(JSThread *thread, const JSHandle &obj, const JSHandle &value, - bool mayThrow = false) const + bool may_throw = false) const { ASSERT(GetSetter().IsJSNativePointer()); JSNativePointer *setter = JSNativePointer::Cast(GetSetter().GetTaggedObject()); - auto setFunc = reinterpret_cast(setter->GetExternalPointer()); - return setFunc(thread, obj, value, mayThrow); + auto set_func = reinterpret_cast(setter->GetExternalPointer()); + return set_func(thread, obj, value, may_throw); } static constexpr size_t GETTER_OFFSET = Record::SIZE; diff --git a/runtime/base/error_helper.cpp b/runtime/base/error_helper.cpp index f6453e33d..2b97adb5e 100644 --- a/runtime/base/error_helper.cpp +++ b/runtime/base/error_helper.cpp @@ -29,7 +29,7 @@ namespace panda::ecmascript::base { using panda::tooling::ecmascript::PtJSExtractor; -JSTaggedValue ErrorHelper::ErrorCommonToString(EcmaRuntimeCallInfo *argv, const ErrorType &errorType) +JSTaggedValue ErrorHelper::ErrorCommonToString(EcmaRuntimeCallInfo *argv, const ErrorType &error_type) { ASSERT(argv); JSThread *thread = argv->GetThread(); @@ -50,7 +50,7 @@ JSTaggedValue ErrorHelper::ErrorCommonToString(EcmaRuntimeCallInfo *argv, const // 5. If name is undefined, let name be "Error"; otherwise let name be ToString(name). // 6. ReturnIfAbrupt(name). - name = ErrorHelper::GetErrorName(thread, name, errorType); + name = ErrorHelper::GetErrorName(thread, name, error_type); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); // 7. Let msg be Get(O, "message"). @@ -89,11 +89,11 @@ JSTaggedValue ErrorHelper::ErrorCommonToString(EcmaRuntimeCallInfo *argv, const } JSHandle ErrorHelper::GetErrorName(JSThread *thread, const JSHandle &name, - const ErrorType &errorType) + const ErrorType &error_type) { auto globalConst = thread->GlobalConstants(); if (name->IsUndefined()) { - switch (errorType) { + switch (error_type) { case ErrorType::RANGE_ERROR: return globalConst->GetHandledRangeErrorString(); case ErrorType::EVAL_ERROR: @@ -114,7 +114,7 @@ JSHandle ErrorHelper::GetErrorName(JSThread *thread, const JSHand } JSTaggedValue ErrorHelper::ErrorCommonConstructor(EcmaRuntimeCallInfo *argv, - [[maybe_unused]] const ErrorType &errorType) + [[maybe_unused]] const ErrorType &error_type) { JSThread *thread = argv->GetThread(); [[maybe_unused]] EcmaHandleScope handleScope(thread); diff --git a/runtime/base/error_helper.h b/runtime/base/error_helper.h index c6e9420c9..155bd7817 100644 --- a/runtime/base/error_helper.h +++ b/runtime/base/error_helper.h @@ -27,9 +27,9 @@ constexpr char INTRINSIC_METHOD_NAME[] = "Intrinsic method"; // NOLINT (moder class ErrorHelper { public: - static JSTaggedValue ErrorCommonToString(EcmaRuntimeCallInfo *argv, const ErrorType &errorType); + static JSTaggedValue ErrorCommonToString(EcmaRuntimeCallInfo *argv, const ErrorType &error_type); - static JSTaggedValue ErrorCommonConstructor(EcmaRuntimeCallInfo *argv, const ErrorType &errorType); + static JSTaggedValue ErrorCommonConstructor(EcmaRuntimeCallInfo *argv, const ErrorType &error_type); static PandaString BuildNativeEcmaStackTrace(JSThread *thread); @@ -38,7 +38,7 @@ private: static JSHandle BuildEcmaStackTrace(JSThread *thread); static JSHandle GetErrorName(JSThread *thread, const JSHandle &name, - const ErrorType &errorType); + const ErrorType &error_type); }; } // namespace panda::ecmascript::base diff --git a/runtime/base/number_helper.cpp b/runtime/base/number_helper.cpp index 991862cc3..47a7003a8 100644 --- a/runtime/base/number_helper.cpp +++ b/runtime/base/number_helper.cpp @@ -72,10 +72,10 @@ bool NumberHelper::GotoNonspace(uint8_t **ptr, const uint8_t *end) size_t size = 1; if (c > INT8_MAX) { size = 0; - uint16_t utf8Bit = INT8_MAX + 1; // equal 0b1000'0000 - while (utf8Bit > 0 && (c & utf8Bit) == utf8Bit) { + uint16_t utf8_bit = INT8_MAX + 1; // equal 0b1000'0000 + while (utf8_bit > 0 && (c & utf8_bit) == utf8_bit) { ++size; - utf8Bit >>= 1UL; + utf8_bit >>= 1UL; } if (base::utf_helper::ConvertRegionUtf8ToUtf16(*ptr, &c, end - *ptr, 1, 0) <= 0) { return true; @@ -108,20 +108,20 @@ JSTaggedValue NumberHelper::DoubleToString(JSThread *thread, double number, int number = -number; } - double numberInteger = std::floor(number); - double numberFraction = number - numberInteger; + double number_integer = std::floor(number); + double number_fraction = number - number_integer; auto value = bit_cast(number); value += 1; double delta = HALF * (bit_cast(value) - number); PandaString result; - if (numberFraction != 0 && numberFraction >= delta) { + if (number_fraction != 0 && number_fraction >= delta) { result += "."; - result += DecimalsToString(&numberInteger, numberFraction, radix, delta); + result += DecimalsToString(&number_integer, number_fraction, radix, delta); } - result = IntegerToString(numberInteger, radix) + result; + result = IntegerToString(number_integer, radix) + result; if (negative) { result = "-" + result; @@ -174,11 +174,11 @@ JSTaggedValue NumberHelper::DoubleToPrecision(JSThread *thread, double number, i } PandaStringStream ss; double positiveNumber = number > 0 ? number : -number; - int logDigit = std::floor(log10(positiveNumber)); - int radixDigit = digit - logDigit - 1; + int log_digit = std::floor(log10(positiveNumber)); + int radix_digit = digit - log_digit - 1; const int MAX_EXPONENT_DIGIT = 6; - if ((logDigit >= 0 && radixDigit >= 0) || (logDigit < 0 && radixDigit <= MAX_EXPONENT_DIGIT)) { - return DoubleToFixed(thread, number, std::abs(radixDigit)); + if ((log_digit >= 0 && radix_digit >= 0) || (log_digit < 0 && radix_digit <= MAX_EXPONENT_DIGIT)) { + return DoubleToFixed(thread, number, std::abs(radix_digit)); } return DoubleToExponential(thread, number, digit - 1); } @@ -201,22 +201,22 @@ JSTaggedValue NumberHelper::StringToDoubleWithRadix(const uint8_t *start, const RETURN_IF_CONVERSION_END(++p, end, nanResult); } // 3. 0x or 0X - bool stripPrefix = true; + bool strip_prefix = true; // 4. If R  0, then // a. If R < 2 or R > 36, return NaN. - // b. If R  16, let stripPrefix be false. + // b. If R  16, let strip_prefix be false. if (radix != 0) { if (radix < MIN_RADIX || radix > MAX_RADIX) { return nanResult; } if (radix != HEXADECIMAL) { - stripPrefix = false; + strip_prefix = false; } } else { radix = DECIMAL; } int size = 0; - if (stripPrefix) { + if (strip_prefix) { if (*p == '0') { size++; if (++p != end && (*p == 'x' || *p == 'X')) { @@ -239,13 +239,13 @@ JSTaggedValue NumberHelper::StringToDoubleWithRadix(const uint8_t *start, const break; } - int currentBit = ToDigit(*p); - if (currentBit >= radix) { + int current_bit = ToDigit(*p); + if (current_bit >= radix) { isDone = true; break; } size++; - part = part * radix + currentBit; + part = part * radix + current_bit; multiplier = m; } result = result * multiplier + part; @@ -287,7 +287,7 @@ PandaString NumberHelper::IntegerToString(double number, int radix) return result; } -PandaString NumberHelper::DecimalsToString(double *numberInteger, double fraction, int radix, double delta) +PandaString NumberHelper::DecimalsToString(double *number_integer, double fraction, int radix, double delta) { PandaString result; while (fraction >= delta) { @@ -297,17 +297,17 @@ PandaString NumberHelper::DecimalsToString(double *numberInteger, double fractio fraction -= integer; result += CHARS[integer]; if (fraction > HALF && fraction + delta > 1) { - size_t fractionEnd = result.size() - 1; - result[fractionEnd] = Carry(*result.rbegin(), radix); - for (; fractionEnd > 0; fractionEnd--) { - if (result[fractionEnd] == '0') { - result[fractionEnd - 1] = Carry(result[fractionEnd - 1], radix); + size_t fraction_end = result.size() - 1; + result[fraction_end] = Carry(*result.rbegin(), radix); + for (; fraction_end > 0; fraction_end--) { + if (result[fraction_end] == '0') { + result[fraction_end - 1] = Carry(result[fraction_end - 1], radix); } else { break; } } - if (fractionEnd == 0) { - (*numberInteger)++; + if (fraction_end == 0) { + (*number_integer)++; } break; } diff --git a/runtime/base/number_helper.h b/runtime/base/number_helper.h index 2bc505c3e..3b26925d1 100644 --- a/runtime/base/number_helper.h +++ b/runtime/base/number_helper.h @@ -96,7 +96,7 @@ private: static char Carry(char current, int radix); static double Strtod(const char *str, int exponent, uint8_t radix); static PandaString IntegerToString(double number, int radix); - static PandaString DecimalsToString(double *numberInteger, double fraction, int radix, double delta); + static PandaString DecimalsToString(double *number_integer, double fraction, int radix, double delta); static bool IsNonspace(uint16_t c); static bool GotoNonspace(uint8_t **ptr, const uint8_t *end); }; diff --git a/runtime/base/string_helper.cpp b/runtime/base/string_helper.cpp index 9a009b185..c06d62266 100644 --- a/runtime/base/string_helper.cpp +++ b/runtime/base/string_helper.cpp @@ -42,31 +42,32 @@ bool StringHelper::CheckDuplicate(EcmaString *string) return false; } -EcmaString *StringHelper::Repeat(JSThread *thread, const std::u16string &thisStr, int32_t repeatLen, bool canBeCompress) +EcmaString *StringHelper::Repeat(JSThread *thread, const std::u16string &this_str, int32_t repeat_len, + bool can_be_compress) { ecmascript::ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - if (repeatLen == 0) { + if (repeat_len == 0) { return *factory->GetEmptyString(); // Create empty EcmaString. } - std::u16string tmpStr = thisStr; - for (int32_t i = 1; i < repeatLen; i++) { - tmpStr.append(thisStr); + std::u16string tmp_str = this_str; + for (int32_t i = 1; i < repeat_len; i++) { + tmp_str.append(this_str); } - const char16_t *constChar16tData = tmpStr.data(); - auto *char16tData = const_cast(constChar16tData); - auto *uint16tData = reinterpret_cast(char16tData); - int32_t length = tmpStr.size(); - return *factory->NewFromUtf16UnCheck(uint16tData, length, canBeCompress); + const char16_t *const_char16_t_data = tmp_str.data(); + auto *char16_t_data = const_cast(const_char16_t_data); + auto *uint16_t_data = reinterpret_cast(char16_t_data); + int32_t length = tmp_str.size(); + return *factory->NewFromUtf16UnCheck(uint16_t_data, length, can_be_compress); } -EcmaString *StringHelper::Trim(JSThread *thread, const std::u16string &thisStr, TrimKind kind) +EcmaString *StringHelper::Trim(JSThread *thread, const std::u16string &this_str, TrimKind kind) { ecmascript::ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - std::u16string tmpStr = thisStr; - if (tmpStr.empty()) { + std::u16string tmp_str = this_str; + if (tmp_str.empty()) { return *factory->GetEmptyString(); } - std::string str = U16stringToString(tmpStr); + std::string str = U16stringToString(tmp_str); std::wstring wstr = StringToWstring(str); std::wregex r; if (kind == TrimKind::TRIM_START) { @@ -90,18 +91,18 @@ EcmaString *StringHelper::Trim(JSThread *thread, const std::u16string &thisStr, } wstr = regex_replace(wstr, r, L""); str = WstringToString(wstr); - tmpStr = StringToU16string(str); - const char16_t *constChar16tData = tmpStr.data(); - auto *char16tData = const_cast(constChar16tData); - auto *uint16tData = reinterpret_cast(char16tData); - int32_t length = tmpStr.size(); - return *factory->NewFromUtf16(uint16tData, length); + tmp_str = StringToU16string(str); + const char16_t *const_char16_t_data = tmp_str.data(); + auto *char16_t_data = const_cast(const_char16_t_data); + auto *uint16_t_data = reinterpret_cast(char16_t_data); + int32_t length = tmp_str.size(); + return *factory->NewFromUtf16(uint16_t_data, length); } -// ES2021 22.1.3.15.1 StringPad ( O, maxLength, fillString, placement ) +// ES2021 22.1.3.15.1 StringPad ( O, max_length, fill_string, placement ) panda::ecmascript::JSTaggedValue StringHelper::StringPad(JSThread *thread, JSHandle obj, - JSHandle maxLength, - JSHandle fillString, PadPlacement placement) + JSHandle max_length, + JSHandle fill_string, PadPlacement placement) { // 1. Assert: placement is start or end. ASSERT(placement == PadPlacement::START || placement == PadPlacement::END); @@ -110,26 +111,26 @@ panda::ecmascript::JSTaggedValue StringHelper::StringPad(JSThread *thread, JSHan JSHandle string = JSTaggedValue::ToString(thread, obj); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); - // 4. Let stringLength be the length of S. - size_t stringLength = string->GetLength(); + // 4. Let string_length be the length of S. + size_t string_length = string->GetLength(); - // 3. Let intMaxLength be ? ToLength(maxLength). - size_t intMaxLength = JSTaggedValue::ToLength(thread, maxLength).ToUint32(); + // 3. Let int_max_length be ? ToLength(max_length). + size_t int_max_length = JSTaggedValue::ToLength(thread, max_length).ToUint32(); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); - // 5. If intMaxLength ≤ stringLength, return S. - if (intMaxLength <= stringLength) { + // 5. If int_max_length ≤ string_length, return S. + if (int_max_length <= string_length) { return string.GetTaggedValue(); } - // 6. If fillString is undefined, let filler be the String value consisting solely of the code unit 0x0020 (SPACE). - // 7. Else, let filler be ? ToString(fillString). + // 6. If fill_string is undefined, let filler be the String value consisting solely of the code unit 0x0020 (SPACE). + // 7. Else, let filler be ? ToString(fill_string). ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); JSHandle filler; - if (fillString->IsUndefined()) { + if (fill_string->IsUndefined()) { filler = factory->NewFromString(" "); } else { - filler = JSTaggedValue::ToString(thread, fillString); + filler = JSTaggedValue::ToString(thread, fill_string); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); } @@ -139,24 +140,24 @@ panda::ecmascript::JSTaggedValue StringHelper::StringPad(JSThread *thread, JSHan return string.GetTaggedValue(); } - // 9. Let fillLen be intMaxLength - stringLength. - uint32_t fillLen = intMaxLength - stringLength; + // 9. Let fill_len be int_max_length - string_length. + uint32_t fill_len = int_max_length - string_length; - // 10. Let truncatedStringFiller be the String value consisting of repeated concatenations of filler truncated to - // length fillLen. - std::string truncatedString; - std::string fillerString = ToStdString(filler.GetObject()); - for (size_t i = 0; i < fillLen; i++) { - truncatedString += fillerString[i % fillerLength]; + // 10. Let truncated_string_filler be the String value consisting of repeated concatenations of filler truncated to + // length fill_len. + std::string truncated_string; + std::string filler_string = ToStdString(filler.GetObject()); + for (size_t i = 0; i < fill_len; i++) { + truncated_string += filler_string[i % fillerLength]; } - JSHandle truncatedStringFiller = factory->NewFromStdString(truncatedString); + JSHandle truncated_string_filler = factory->NewFromStdString(truncated_string); - // 11. If placement is start, return the string-concatenation of truncatedStringFiller and S. + // 11. If placement is start, return the string-concatenation of truncated_string_filler and S. if (placement == PadPlacement::START) { - return factory->ConcatFromString(truncatedStringFiller, string).GetTaggedValue(); + return factory->ConcatFromString(truncated_string_filler, string).GetTaggedValue(); } - // 12. Else, return the string-concatenation of S and truncatedStringFiller. - return factory->ConcatFromString(string, truncatedStringFiller).GetTaggedValue(); + // 12. Else, return the string-concatenation of S and truncated_string_filler. + return factory->ConcatFromString(string, truncated_string_filler).GetTaggedValue(); } } // namespace panda::ecmascript::base diff --git a/runtime/base/string_helper.h b/runtime/base/string_helper.h index b2c2920b9..30248b1f2 100644 --- a/runtime/base/string_helper.h +++ b/runtime/base/string_helper.h @@ -65,15 +65,15 @@ public: return (index != PandaString::npos); } - static inline PandaString RepalceAll(PandaString str, const PandaString &oldValue, const PandaString &newValue) + static inline PandaString RepalceAll(PandaString str, const PandaString &old_value, const PandaString &new_value) { - if (oldValue.empty() || oldValue == newValue) { + if (old_value.empty() || old_value == new_value) { return str; } PandaString::size_type pos(0); - while ((pos = str.find(oldValue, pos)) != PandaString::npos) { - str.replace(pos, oldValue.length(), newValue); - pos += newValue.length(); + while ((pos = str.find(old_value, pos)) != PandaString::npos) { + str.replace(pos, old_value.length(), new_value); + pos += new_value.length(); } return str; } @@ -84,24 +84,24 @@ public: ConvertToPandaString(string.GetObject(), start, length, StringConvertedUsage::LOGICOPERATION)); } - static inline std::u16string Utf16ToU16String(const uint16_t *utf16Data, uint32_t dataLen) + static inline std::u16string Utf16ToU16String(const uint16_t *utf16_data, uint32_t data_len) { - auto *char16tData = reinterpret_cast(utf16Data); - std::u16string u16str(char16tData, dataLen); + auto *char16t_data = reinterpret_cast(utf16_data); + std::u16string u16str(char16t_data, data_len); return u16str; } - static inline std::string Utf8ToString(const uint8_t *utf8Data, uint32_t dataLen) + static inline std::string Utf8ToString(const uint8_t *utf8_data, uint32_t data_len) { - auto *charData = reinterpret_cast(utf8Data); - std::string str(charData, dataLen); + auto *char_data = reinterpret_cast(utf8_data); + std::string str(char_data, data_len); return str; } - static inline std::u16string Utf8ToU16String(const uint8_t *utf8Data, uint32_t dataLen) + static inline std::u16string Utf8ToU16String(const uint8_t *utf8_data, uint32_t data_len) { - auto *charData = reinterpret_cast(utf8Data); - std::string str(charData, dataLen); + auto *char_data = reinterpret_cast(utf8_data); + std::string str(char_data, data_len); std::u16string u16str = std::wstring_convert, char16_t> {}.from_bytes(str); return u16str; } @@ -126,31 +126,31 @@ public: return std::wstring_convert, char16_t> {}.from_bytes(str); } - static inline size_t Find(const std::string &thisStr, const std::string &searchStr, int32_t pos) + static inline size_t Find(const std::string &this_str, const std::string &search_str, int32_t pos) { - size_t idx = thisStr.find(searchStr, pos); + size_t idx = this_str.find(search_str, pos); return idx; } - static inline size_t Find(const std::u16string &thisStr, const std::u16string &searchStr, int32_t pos) + static inline size_t Find(const std::u16string &this_str, const std::u16string &search_str, int32_t pos) { - size_t idx = thisStr.find(searchStr, pos); + size_t idx = this_str.find(search_str, pos); return idx; } - static inline size_t RFind(const std::u16string &thisStr, const std::u16string &searchStr, int32_t pos) + static inline size_t RFind(const std::u16string &this_str, const std::u16string &search_str, int32_t pos) { - size_t idx = thisStr.rfind(searchStr, pos); + size_t idx = this_str.rfind(search_str, pos); return idx; } static inline EcmaString *ToUpper(JSThread *thread, const std::u16string &str) { ecmascript::ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - std::u16string tmpStr = str; - const char16_t *constChar16tData = tmpStr.data(); - icu::UnicodeString uString(constChar16tData); - icu::UnicodeString up = uString.toUpper(); + std::u16string tmp_str = str; + const char16_t *const_char16t_data = tmp_str.data(); + icu::UnicodeString u_string(const_char16t_data); + icu::UnicodeString up = u_string.toUpper(); std::string res; up.toUTF8String(res); return *factory->NewFromStdString(res); @@ -159,31 +159,32 @@ public: static inline EcmaString *ToLower(JSThread *thread, const std::u16string &str) { ecmascript::ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - std::u16string tmpStr = str; - const char16_t *constChar16tData = tmpStr.data(); - icu::UnicodeString uString(constChar16tData); - icu::UnicodeString low = uString.toLower(); + std::u16string tmp_str = str; + const char16_t *const_char16t_data = tmp_str.data(); + icu::UnicodeString u_string(const_char16t_data); + icu::UnicodeString low = u_string.toLower(); std::string res; low.toUTF8String(res); return *factory->NewFromStdString(res); } - static inline size_t FindFromU16ToUpper(const std::u16string &thisStr, uint16_t *u16Data) + static inline size_t FindFromU16ToUpper(const std::u16string &this_str, uint16_t *u16_data) { - std::u16string tmpStr = Utf16ToU16String(u16Data, 1); - const char16_t *constChar16tData = tmpStr.data(); - icu::UnicodeString uString(constChar16tData); - icu::UnicodeString up = uString.toUpper(); + std::u16string tmp_str = Utf16ToU16String(u16_data, 1); + const char16_t *const_char16t_data = tmp_str.data(); + icu::UnicodeString u_string(const_char16t_data); + icu::UnicodeString up = u_string.toUpper(); std::string res; up.toUTF8String(res); - std::u16string searchStr = StringToU16string(res); - size_t idx = Find(thisStr, searchStr, 0); + std::u16string search_str = StringToU16string(res); + size_t idx = Find(this_str, search_str, 0); return idx; } - static EcmaString *Repeat(JSThread *thread, const std::u16string &thisStr, int32_t repeatLen, bool canBeCompress); + static EcmaString *Repeat(JSThread *thread, const std::u16string &this_str, int32_t repeat_len, + bool can_be_compress); - static int UnicodeFromUtf8(const uint8_t *p, int maxLen, const uint8_t **pp) + static int UnicodeFromUtf8(const uint8_t *p, int max_len, const uint8_t **pp) { // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) int c = *p++; @@ -207,7 +208,7 @@ public: return INVALID_UNICODE_FROM_UTF8; } /* check that we have enough characters */ - if (l > (maxLen - 1)) { + if (l > (max_len - 1)) { return INVALID_UNICODE_FROM_UTF8; } return FromUtf8(c, l, p, pp); @@ -234,16 +235,16 @@ public: return c; } - static EcmaString *Trim(JSThread *thread, const std::u16string &thisStr, TrimKind kind); + static EcmaString *Trim(JSThread *thread, const std::u16string &this_str, TrimKind kind); static panda::ecmascript::JSTaggedValue StringPad(JSThread *thread, JSHandle obj, - JSHandle maxLength, - JSHandle fillString, PadPlacement placement); + JSHandle max_length, + JSHandle fill_string, PadPlacement placement); static inline std::u16string Append(const std::u16string &str1, const std::u16string &str2) { - std::u16string tmpStr = str1; - return tmpStr.append(str2); + std::u16string tmp_str = str1; + return tmp_str.append(str2); } static inline uint32_t Utf8ToU32String(const std::vector &data) @@ -254,12 +255,12 @@ public: return *u32data; } - static inline std::string Utf32ToString(uint32_t u32Data) + static inline std::string Utf32ToString(uint32_t u32_data) { - UChar32 charData = u32Data; - icu::UnicodeString uString(charData); + UChar32 char_data = u32_data; + icu::UnicodeString u_string(char_data); std::string res; - uString.toUTF8String(res); + u_string.toUTF8String(res); return res; } }; diff --git a/runtime/base/utf_helper.cpp b/runtime/base/utf_helper.cpp index b79260ce2..c98f70d7a 100644 --- a/runtime/base/utf_helper.cpp +++ b/runtime/base/utf_helper.cpp @@ -151,33 +151,33 @@ size_t Utf16ToUtf8Size(const uint16_t *utf16, uint32_t length, bool modify) return res; } -size_t ConvertRegionUtf16ToUtf8(const uint16_t *utf16In, uint8_t *utf8Out, size_t utf16Len, size_t utf8Len, +size_t ConvertRegionUtf16ToUtf8(const uint16_t *utf16_in, uint8_t *utf8_out, size_t utf16_len, size_t utf8_len, size_t start, bool modify) { - size_t utf8Pos = 0; - if (utf16In == nullptr || utf8Out == nullptr || utf8Len == 0) { + size_t utf8_pos = 0; + if (utf16_in == nullptr || utf8_out == nullptr || utf8_len == 0) { return 0; } - size_t end = start + utf16Len; + size_t end = start + utf16_len; for (size_t i = start; i < end; ++i) { - uint16_t next16Code = 0; + uint16_t next16_code = 0; // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) - if ((i + 1) != end && utf::IsAvailableNextUtf16Code(utf16In[i + 1])) { - next16Code = utf16In[i + 1]; // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic) + if ((i + 1) != end && utf::IsAvailableNextUtf16Code(utf16_in[i + 1])) { + next16_code = utf16_in[i + 1]; // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic) } // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) - Utf8Char ch = ConvertUtf16ToUtf8(utf16In[i], next16Code, modify); - if (utf8Pos + ch.n > utf8Len) { + Utf8Char ch = ConvertUtf16ToUtf8(utf16_in[i], next16_code, modify); + if (utf8_pos + ch.n > utf8_len) { break; } for (size_t c = 0; c < ch.n; ++c) { - utf8Out[utf8Pos++] = ch.ch[c]; // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic) + utf8_out[utf8_pos++] = ch.ch[c]; // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic) } if (ch.n == UtfLength::FOUR) { // Two UTF-16 chars are used ++i; } } - return utf8Pos; + return utf8_pos; } std::pair ConvertUtf8ToUtf16Pair(const uint8_t *data, bool combine) @@ -216,15 +216,15 @@ std::pair ConvertUtf8ToUtf16Pair(const uint8_t *data, bool com return {pair, UtfLength::FOUR}; } -size_t Utf8ToUtf16Size(const uint8_t *utf8, size_t utf8Len) +size_t Utf8ToUtf16Size(const uint8_t *utf8, size_t utf8_len) { - return utf::MUtf8ToUtf16Size(utf8, utf8Len); + return utf::MUtf8ToUtf16Size(utf8, utf8_len); } -size_t ConvertRegionUtf8ToUtf16(const uint8_t *utf8In, uint16_t *utf16Out, size_t utf8Len, size_t utf16Len, +size_t ConvertRegionUtf8ToUtf16(const uint8_t *utf8_in, uint16_t *utf16_out, size_t utf8_len, size_t utf16_len, size_t start) { - return utf::ConvertRegionMUtf8ToUtf16(utf8In, utf16Out, utf8Len, utf16Len, start); + return utf::ConvertRegionMUtf8ToUtf16(utf8_in, utf16_out, utf8_len, utf16_len, start); } bool IsUTF16SurrogatePair(const uint16_t lead) diff --git a/runtime/base/utf_helper.h b/runtime/base/utf_helper.h index 5798e2c9a..b166ddc3a 100644 --- a/runtime/base/utf_helper.h +++ b/runtime/base/utf_helper.h @@ -65,25 +65,25 @@ Utf8Char ConvertUtf16ToUtf8(uint16_t d0, uint16_t d1, bool modify); size_t Utf16ToUtf8Size(const uint16_t *utf16, uint32_t length, bool modify = true); -size_t ConvertRegionUtf16ToUtf8(const uint16_t *utf16In, uint8_t *utf8Out, size_t utf16Len, size_t utf8Len, +size_t ConvertRegionUtf16ToUtf8(const uint16_t *utf16_in, uint8_t *utf8_out, size_t utf16_len, size_t utf8_len, size_t start, bool modify = true); std::pair ConvertUtf8ToUtf16Pair(const uint8_t *data, bool combine = false); -size_t Utf8ToUtf16Size(const uint8_t *utf8, size_t utf8Len); +size_t Utf8ToUtf16Size(const uint8_t *utf8, size_t utf8_len); -size_t ConvertRegionUtf8ToUtf16(const uint8_t *utf8In, uint16_t *utf16Out, size_t utf8Len, size_t utf16Len, +size_t ConvertRegionUtf8ToUtf16(const uint8_t *utf8_in, uint16_t *utf16_out, size_t utf8_len, size_t utf16_len, size_t start); bool IsUTF16SurrogatePair(uint16_t lead); static inline uint32_t CombineTwoU16(uint16_t d0, uint16_t d1) { - uint32_t codePoint = d0 - utf::HI_SURROGATE_MIN; - codePoint <<= UtfOffset::TEN; - codePoint |= d1 - utf::LO_SURROGATE_MIN; - codePoint += utf::LO_SUPPLEMENTS_MIN; - return codePoint; + uint32_t code_point = d0 - utf::HI_SURROGATE_MIN; + code_point <<= UtfOffset::TEN; + code_point |= d1 - utf::LO_SURROGATE_MIN; + code_point += utf::LO_SUPPLEMENTS_MIN; + return code_point; } } // namespace panda::ecmascript::base::utf_helper diff --git a/runtime/builtins/builtins_array.cpp b/runtime/builtins/builtins_array.cpp index 0d226be5c..dfdb06991 100644 --- a/runtime/builtins/builtins_array.cpp +++ b/runtime/builtins/builtins_array.cpp @@ -1243,7 +1243,7 @@ JSTaggedValue BuiltinsArray::Includes(EcmaRuntimeCallInfo *argv) return GetTaggedBoolean(false); } - array_size_t argc = argv->GetArgsNumber(); + ArraySizeT argc = argv->GetArgsNumber(); double fromIndex = 0; if (argc > 1) { diff --git a/runtime/builtins/builtins_object.cpp b/runtime/builtins/builtins_object.cpp index 9fe71f76e..3475bb38b 100644 --- a/runtime/builtins/builtins_object.cpp +++ b/runtime/builtins/builtins_object.cpp @@ -411,7 +411,7 @@ JSTaggedValue BuiltinsObject::GetOwnPropertyDesciptors(EcmaRuntimeCallInfo *argv thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(constructor), constructor)); // 4. For each element key of ownKeys, do - for (array_size_t i = 0; i < ownKeys->GetLength(); i++) { + for (ArraySizeT i = 0; i < ownKeys->GetLength(); i++) { // a. Let desc be ? obj.[[GetOwnProperty]](key). JSHandle key(thread, ownKeys->Get(i)); PropertyDescriptor desc(thread); @@ -612,7 +612,7 @@ JSTaggedValue BuiltinsObject::Keys(EcmaRuntimeCallInfo *argv) RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); // 2. Let nameList be ? EnumerableOwnPropertyNames(obj, key) - array_size_t count = 0; + ArraySizeT count = 0; JSHandle nameList = JSObject::EnumerableOwnPropertyNames(thread, obj, PropertyKind::KEY, &count); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); @@ -1149,7 +1149,7 @@ JSTaggedValue BuiltinsObject::Entries(EcmaRuntimeCallInfo *argv) JSHandle object = JSTaggedValue::ToObject(thread, obj); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); // 2. Let nameList be ? EnumerableOwnPropertyNames(obj, key+value). - array_size_t length = 0; + ArraySizeT length = 0; JSHandle nameList = JSObject::EnumerableOwnPropertyNames(thread, object, PropertyKind::KEY_VALUE, &length); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); @@ -1170,7 +1170,7 @@ JSTaggedValue BuiltinsObject::Values(EcmaRuntimeCallInfo *argv) JSHandle object = JSTaggedValue::ToObject(thread, obj); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); // 2. Let nameList be ? EnumerableOwnPropertyNames(obj, value). - array_size_t length = 0; + ArraySizeT length = 0; JSHandle nameList = JSObject::EnumerableOwnPropertyNames(thread, object, PropertyKind::VALUE, &length); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); // 3. Return CreateArrayFromList(nameList). diff --git a/runtime/builtins/builtins_typedarray.cpp b/runtime/builtins/builtins_typedarray.cpp index 5b112b1fd..7a6cfc9a3 100644 --- a/runtime/builtins/builtins_typedarray.cpp +++ b/runtime/builtins/builtins_typedarray.cpp @@ -691,7 +691,7 @@ JSTaggedValue BuiltinsTypedArray::Includes(EcmaRuntimeCallInfo *argv) return GetTaggedBoolean(false); } - array_size_t argc = argv->GetArgsNumber(); + ArraySizeT argc = argv->GetArgsNumber(); double fromIndex = 0; if (argc > 1) { diff --git a/runtime/class_info_extractor.cpp b/runtime/class_info_extractor.cpp index 81f00ae84..ed075cd46 100644 --- a/runtime/class_info_extractor.cpp +++ b/runtime/class_info_extractor.cpp @@ -251,7 +251,7 @@ JSHandle ClassInfoExtractor::CreateConstructorHClass(JSThread *thread, layout->AddKey(thread, index, key.GetTaggedValue(), attributes); } - hclass = factory->NewEcmaDynClass(factory->hclassClass_, JSFunction::SIZE, JSType::JS_FUNCTION, + hclass = factory->NewEcmaDynClass(factory->hclass_class_, JSFunction::SIZE, JSType::JS_FUNCTION, HClass::IS_CALLABLE, length); // Not need set proto here hclass->SetLayout(thread, layout); diff --git a/runtime/class_linker/panda_file_translator.cpp b/runtime/class_linker/panda_file_translator.cpp index 0c1b3909a..163b5ffed 100644 --- a/runtime/class_linker/panda_file_translator.cpp +++ b/runtime/class_linker/panda_file_translator.cpp @@ -41,15 +41,15 @@ namespace panda::ecmascript { PandaFileTranslator::PandaFileTranslator(EcmaVM *vm) - : ecmaVm_(vm), factory_(vm->GetFactory()), thread_(vm->GetJSThread()) + : ecma_vm_(vm), factory_(vm->GetFactory()), thread_(vm->GetJSThread()) { } JSHandle PandaFileTranslator::TranslatePandaFile(EcmaVM *vm, const panda_file::File &pf, - const PandaString &methodName) + const PandaString &method_name) { PandaFileTranslator translator(vm); - translator.TranslateClasses(pf, methodName); + translator.TranslateClasses(pf, method_name); auto result = translator.GenerateProgram(pf); return JSHandle(translator.thread_, result); } @@ -76,13 +76,13 @@ const JSMethod *PandaFileTranslator::FindMethods(uint32_t offset) const return nullptr; } -void PandaFileTranslator::TranslateClasses(const panda_file::File &pf, const PandaString &methodName) +void PandaFileTranslator::TranslateClasses(const panda_file::File &pf, const PandaString &method_name) { Span classIndexes = pf.GetClasses(); methods_ = MakePandaUnique>(); - panda_file::File::StringData sd = {static_cast(methodName.size()), - reinterpret_cast(methodName.c_str())}; + panda_file::File::StringData sd = {static_cast(method_name.size()), + reinterpret_cast(method_name.c_str())}; auto aot_manager = Runtime::GetCurrent()->GetClassLinker()->GetAotManager(); auto filename = os::GetAbsolutePath(pf.GetFilename()); @@ -115,8 +115,8 @@ void PandaFileTranslator::TranslateMethod(const compiler::AotClass &aot_class, c panda_file::CodeDataAccessor codeDataAccessor(pf, codeId.value()); uint32_t codeSize = codeDataAccessor.GetCodeSize(); - if (mainMethodIndex_ == 0 && pf.GetStringData(mda.GetNameId()) == sd) { - mainMethodIndex_ = mda.GetMethodId().GetOffset(); + if (main_method_index_ == 0 && pf.GetStringData(mda.GetNameId()) == sd) { + main_method_index_ = mda.GetMethodId().GetOffset(); } panda_file::ProtoDataAccessor pda(pf, mda.GetProtoId()); @@ -167,18 +167,18 @@ Program *PandaFileTranslator::GenerateProgram(const panda_file::File &pf) JSHandle location = factory_->NewFromStdStringUnCheck(pf.GetFilename(), true); // +1 for program - JSHandle constpool = factory_->NewConstantPool(constpoolIndex_ + 1); + JSHandle constpool = factory_->NewConstantPool(constpool_index_ + 1); program->SetConstantPool(thread_, constpool.GetTaggedValue()); program->SetLocation(thread_, location.GetTaggedValue()); - JSHandle env = ecmaVm_->GetGlobalEnv(); + JSHandle env = ecma_vm_->GetGlobalEnv(); JSHandle dynclass = JSHandle::Cast(env->GetFunctionClassWithProto()); JSHandle normalDynclass = JSHandle::Cast(env->GetFunctionClassWithoutProto()); JSHandle asyncDynclass = JSHandle::Cast(env->GetAsyncFunctionClass()); JSHandle generatorDynclass = JSHandle::Cast(env->GetGeneratorFunctionClass()); JSHandle asyncgeneratorDynclass = JSHandle::Cast(env->GetAsyncGeneratorFunctionClass()); - for (const auto &it : constpoolMap_) { + for (const auto &it : constpool_map_) { ConstPoolValue value(it.second); if (value.GetConstpoolType() == ConstPoolType::STRING) { panda_file::File::EntityId id(it.first); @@ -190,81 +190,81 @@ Program *PandaFileTranslator::GenerateProgram(const panda_file::File &pf) } constpool->Set(thread_, value.GetConstpoolIndex(), JSTaggedValue(string)); } else if (value.GetConstpoolType() == ConstPoolType::BASE_FUNCTION) { - ASSERT(mainMethodIndex_ != it.first); + ASSERT(main_method_index_ != it.first); panda_file::File::EntityId id(it.first); auto method = const_cast(FindMethods(it.first)); ASSERT(method != nullptr); - JSHandle jsFunc = + JSHandle js_func = factory_->NewJSFunctionByDynClass(method, dynclass, FunctionKind::BASE_CONSTRUCTOR); - constpool->Set(thread_, value.GetConstpoolIndex(), jsFunc.GetTaggedValue()); - jsFunc->SetConstantPool(thread_, constpool.GetTaggedValue()); + constpool->Set(thread_, value.GetConstpoolIndex(), js_func.GetTaggedValue()); + js_func->SetConstantPool(thread_, constpool.GetTaggedValue()); } else if (value.GetConstpoolType() == ConstPoolType::NC_FUNCTION) { - ASSERT(mainMethodIndex_ != it.first); + ASSERT(main_method_index_ != it.first); panda_file::File::EntityId id(it.first); auto method = const_cast(FindMethods(it.first)); ASSERT(method != nullptr); - JSHandle jsFunc = + JSHandle js_func = factory_->NewJSFunctionByDynClass(method, normalDynclass, FunctionKind::NORMAL_FUNCTION); - constpool->Set(thread_, value.GetConstpoolIndex(), jsFunc.GetTaggedValue()); - jsFunc->SetConstantPool(thread_, constpool.GetTaggedValue()); + constpool->Set(thread_, value.GetConstpoolIndex(), js_func.GetTaggedValue()); + js_func->SetConstantPool(thread_, constpool.GetTaggedValue()); } else if (value.GetConstpoolType() == ConstPoolType::GENERATOR_FUNCTION) { - ASSERT(mainMethodIndex_ != it.first); + ASSERT(main_method_index_ != it.first); panda_file::File::EntityId id(it.first); auto method = const_cast(FindMethods(it.first)); ASSERT(method != nullptr); - JSHandle jsFunc = + JSHandle js_func = factory_->NewJSFunctionByDynClass(method, generatorDynclass, FunctionKind::GENERATOR_FUNCTION); // 26.3.4.3 prototype // Whenever a GeneratorFunction instance is created another ordinary object is also created and // is the initial value of the generator function's "prototype" property. - JSHandle objFun = env->GetObjectFunction(); - JSHandle initialGeneratorFuncPrototype = - factory_->NewJSObjectByConstructor(JSHandle(objFun), objFun); - JSObject::SetPrototype(thread_, initialGeneratorFuncPrototype, env->GetGeneratorPrototype()); - jsFunc->SetProtoOrDynClass(thread_, initialGeneratorFuncPrototype); - - constpool->Set(thread_, value.GetConstpoolIndex(), jsFunc.GetTaggedValue()); - jsFunc->SetConstantPool(thread_, constpool.GetTaggedValue()); + JSHandle obj_fun = env->GetObjectFunction(); + JSHandle initial_generator_func_prototype = + factory_->NewJSObjectByConstructor(JSHandle(obj_fun), obj_fun); + JSObject::SetPrototype(thread_, initial_generator_func_prototype, env->GetGeneratorPrototype()); + js_func->SetProtoOrDynClass(thread_, initial_generator_func_prototype); + + constpool->Set(thread_, value.GetConstpoolIndex(), js_func.GetTaggedValue()); + js_func->SetConstantPool(thread_, constpool.GetTaggedValue()); } else if (value.GetConstpoolType() == ConstPoolType::ASYNC_FUNCTION) { - ASSERT(mainMethodIndex_ != it.first); + ASSERT(main_method_index_ != it.first); panda_file::File::EntityId id(it.first); auto method = const_cast(FindMethods(it.first)); ASSERT(method != nullptr); - JSHandle jsFunc = + JSHandle js_func = factory_->NewJSFunctionByDynClass(method, asyncDynclass, FunctionKind::ASYNC_FUNCTION); - constpool->Set(thread_, value.GetConstpoolIndex(), jsFunc.GetTaggedValue()); - jsFunc->SetConstantPool(thread_, constpool.GetTaggedValue()); + constpool->Set(thread_, value.GetConstpoolIndex(), js_func.GetTaggedValue()); + js_func->SetConstantPool(thread_, constpool.GetTaggedValue()); } else if (value.GetConstpoolType() == ConstPoolType::ASYNC_GENERATOR_FUNCTION) { - ASSERT(mainMethodIndex_ != it.first); + ASSERT(main_method_index_ != it.first); panda_file::File::EntityId id(it.first); auto method = const_cast(FindMethods(it.first)); ASSERT(method != nullptr); - JSHandle jsFunc = factory_->NewJSFunctionByDynClass(method, asyncgeneratorDynclass, - FunctionKind::ASYNC_GENERATOR_FUNCTION); - constpool->Set(thread_, value.GetConstpoolIndex(), jsFunc.GetTaggedValue()); - jsFunc->SetConstantPool(thread_, constpool.GetTaggedValue()); + JSHandle js_func = factory_->NewJSFunctionByDynClass(method, asyncgeneratorDynclass, + FunctionKind::ASYNC_GENERATOR_FUNCTION); + constpool->Set(thread_, value.GetConstpoolIndex(), js_func.GetTaggedValue()); + js_func->SetConstantPool(thread_, constpool.GetTaggedValue()); } else if (value.GetConstpoolType() == ConstPoolType::CLASS_FUNCTION) { - ASSERT(mainMethodIndex_ != it.first); + ASSERT(main_method_index_ != it.first); panda_file::File::EntityId id(it.first); auto method = const_cast(FindMethods(it.first)); ASSERT(method != nullptr); JSHandle classInfoExtractor = factory_->NewClassInfoExtractor(method); constpool->Set(thread_, value.GetConstpoolIndex(), classInfoExtractor.GetTaggedValue()); } else if (value.GetConstpoolType() == ConstPoolType::METHOD) { - ASSERT(mainMethodIndex_ != it.first); + ASSERT(main_method_index_ != it.first); panda_file::File::EntityId id(it.first); auto method = const_cast(FindMethods(it.first)); ASSERT(method != nullptr); - JSHandle jsFunc = + JSHandle js_func = factory_->NewJSFunctionByDynClass(method, normalDynclass, FunctionKind::NORMAL_FUNCTION); - constpool->Set(thread_, value.GetConstpoolIndex(), jsFunc.GetTaggedValue()); - jsFunc->SetConstantPool(thread_, constpool.GetTaggedValue()); + constpool->Set(thread_, value.GetConstpoolIndex(), js_func.GetTaggedValue()); + js_func->SetConstantPool(thread_, constpool.GetTaggedValue()); } else if (value.GetConstpoolType() == ConstPoolType::OBJECT_LITERAL) { size_t index = it.first; JSMutableHandle elements(thread_, JSTaggedValue::Undefined()); @@ -301,7 +301,7 @@ Program *PandaFileTranslator::GenerateProgram(const panda_file::File &pf) } } { - auto method = const_cast(FindMethods(mainMethodIndex_)); + auto method = const_cast(FindMethods(main_method_index_)); ASSERT(method != nullptr); JSHandle mainFunc = factory_->NewJSFunctionByDynClass(method, dynclass, FunctionKind::BASE_CONSTRUCTOR); @@ -309,20 +309,20 @@ Program *PandaFileTranslator::GenerateProgram(const panda_file::File &pf) program->SetMainFunction(thread_, mainFunc.GetTaggedValue()); program->SetMethodsData(methods_.release()); // link program - constpool->Set(thread_, constpoolIndex_, program.GetTaggedValue()); + constpool->Set(thread_, constpool_index_, program.GetTaggedValue()); } DefineClassInConstPool(constpool); return *program; } -template +template void PandaFileTranslator::FixInstructionId32(const BytecodeInstruction &inst, [[maybe_unused]] uint32_t index, - uint32_t fixOrder) const + uint32_t fix_order) const { - using EnumT = std::conditional_t; - using R = BytecodeInstructionResolver; - constexpr int payloadOffset = IsQuickened ? 1 : 2; + using EnumT = std::conditional_t; + using R = BytecodeInstructionResolver; + constexpr int payload_offset = IS_QUICKENED ? 1 : 2; // NOLINTNEXTLINE(hicpp-use-auto) auto pc = const_cast(inst.GetAddress()); @@ -349,7 +349,7 @@ void PandaFileTranslator::FixInstructionId32(const BytecodeInstruction &inst, [[ case R::template Get(): { uint8_t size = sizeof(uint16_t); // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) - if (memcpy_s(pc + payloadOffset, size, &index, size) != EOK) { + if (memcpy_s(pc + payload_offset, size, &index, size) != EOK) { LOG_ECMA(FATAL) << "memcpy_s failed"; UNREACHABLE(); } @@ -358,7 +358,7 @@ void PandaFileTranslator::FixInstructionId32(const BytecodeInstruction &inst, [[ case R::template Get(): { uint8_t size = sizeof(uint32_t); // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) - if (memcpy_s(pc + payloadOffset, size, &index, size) != EOK) { + if (memcpy_s(pc + payload_offset, size, &index, size) != EOK) { LOG_ECMA(FATAL) << "memcpy_s failed"; UNREACHABLE(); } @@ -367,10 +367,10 @@ void PandaFileTranslator::FixInstructionId32(const BytecodeInstruction &inst, [[ case R::template Get(): case R::template Get(): { ASSERT(static_cast(index) == index); - uint16_t u16Index = index; + uint16_t u16_index = index; uint8_t size = sizeof(uint16_t); // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) - if (memcpy_s(pc + payloadOffset, size, &u16Index, size) != EOK) { + if (memcpy_s(pc + payload_offset, size, &u16_index, size) != EOK) { LOG_ECMA(FATAL) << "memcpy_s failed"; UNREACHABLE(); } @@ -378,23 +378,23 @@ void PandaFileTranslator::FixInstructionId32(const BytecodeInstruction &inst, [[ } case R::template Get(): { // Usually, we fix one part of instruction one time. But as for instruction DefineClassWithBuffer, - // which use both method id and literal buffer id.Using fixOrder indicates fix Location. - if (fixOrder == 0) { + // which use both method id and literal buffer id.Using fix_order indicates fix Location. + if (fix_order == 0) { uint8_t size = sizeof(uint16_t); ASSERT(static_cast(index) == index); // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) - if (memcpy_s(pc + payloadOffset, size, &index, size) != EOK) { + if (memcpy_s(pc + payload_offset, size, &index, size) != EOK) { LOG_ECMA(FATAL) << "memcpy_s failed"; UNREACHABLE(); } break; } - if (fixOrder == 1) { + if (fix_order == 1) { ASSERT(static_cast(index) == index); - uint16_t u16Index = index; + uint16_t u16_index = index; uint8_t size = sizeof(uint16_t); // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) - if (memcpy_s(pc + payloadOffset + 2, size, &u16Index, size) != EOK) { + if (memcpy_s(pc + payload_offset + 2, size, &u16_index, size) != EOK) { LOG_ECMA(FATAL) << "memcpy_s failed"; UNREACHABLE(); } @@ -407,111 +407,111 @@ void PandaFileTranslator::FixInstructionId32(const BytecodeInstruction &inst, [[ } } -template -void PandaFileTranslator::TranslateBytecode(uint32_t insSz, const uint8_t *insArr, const panda_file::File &pf, +template +void PandaFileTranslator::TranslateBytecode(uint32_t ins_sz, const uint8_t *ins_arr, const panda_file::File &pf, const JSMethod *method) { - using EnumT = std::conditional_t; - using R = BytecodeInstructionResolver; + using EnumT = std::conditional_t; + using R = BytecodeInstructionResolver; - auto bcIns = BytecodeInstruction(insArr); - auto bcInsLast = bcIns.JumpTo(insSz); + auto bc_ins = BytecodeInstruction(ins_arr); + auto bc_ins_last = bc_ins.JumpTo(ins_sz); - while (bcIns.GetAddress() != bcInsLast.GetAddress()) { - if (bcIns.HasFlag(BytecodeInstruction::Flags::STRING_ID) && - BytecodeInstruction::HasId(bcIns.GetFormat(), 0)) { - auto index = GetOrInsertConstantPool(ConstPoolType::STRING, bcIns.GetId().AsFileId().GetOffset()); - FixInstructionId32(bcIns, index); + while (bc_ins.GetAddress() != bc_ins_last.GetAddress()) { + if (bc_ins.HasFlag(BytecodeInstruction::Flags::STRING_ID) && + BytecodeInstruction::HasId(bc_ins.GetFormat(), 0)) { + auto index = GetOrInsertConstantPool(ConstPoolType::STRING, bc_ins.GetId().AsFileId().GetOffset()); + FixInstructionId32(bc_ins, index); } else { - auto opcode = bcIns.GetOpcode(); + auto opcode = bc_ins.GetOpcode(); switch (opcode) { uint32_t index; - uint32_t methodId; + uint32_t method_id; case R::template Get(): - methodId = pf.ResolveMethodIndex(method->GetFileId(), bcIns.GetId().AsIndex()).GetOffset(); - index = GetOrInsertConstantPool(ConstPoolType::BASE_FUNCTION, methodId); - FixInstructionId32(bcIns, index); + method_id = pf.ResolveMethodIndex(method->GetFileId(), bc_ins.GetId().AsIndex()).GetOffset(); + index = GetOrInsertConstantPool(ConstPoolType::BASE_FUNCTION, method_id); + FixInstructionId32(bc_ins, index); break; case R::template Get(): - methodId = pf.ResolveMethodIndex(method->GetFileId(), bcIns.GetId().AsIndex()).GetOffset(); - index = GetOrInsertConstantPool(ConstPoolType::NC_FUNCTION, methodId); - FixInstructionId32(bcIns, index); + method_id = pf.ResolveMethodIndex(method->GetFileId(), bc_ins.GetId().AsIndex()).GetOffset(); + index = GetOrInsertConstantPool(ConstPoolType::NC_FUNCTION, method_id); + FixInstructionId32(bc_ins, index); break; case R::template Get(): - methodId = pf.ResolveMethodIndex(method->GetFileId(), bcIns.GetId().AsIndex()).GetOffset(); - index = GetOrInsertConstantPool(ConstPoolType::GENERATOR_FUNCTION, methodId); - FixInstructionId32(bcIns, index); + method_id = pf.ResolveMethodIndex(method->GetFileId(), bc_ins.GetId().AsIndex()).GetOffset(); + index = GetOrInsertConstantPool(ConstPoolType::GENERATOR_FUNCTION, method_id); + FixInstructionId32(bc_ins, index); break; case R::template Get(): - methodId = pf.ResolveMethodIndex(method->GetFileId(), bcIns.GetId().AsIndex()).GetOffset(); - index = GetOrInsertConstantPool(ConstPoolType::ASYNC_FUNCTION, methodId); - FixInstructionId32(bcIns, index); + method_id = pf.ResolveMethodIndex(method->GetFileId(), bc_ins.GetId().AsIndex()).GetOffset(); + index = GetOrInsertConstantPool(ConstPoolType::ASYNC_FUNCTION, method_id); + FixInstructionId32(bc_ins, index); break; case R::template Get(): - methodId = pf.ResolveMethodIndex(method->GetFileId(), bcIns.GetId().AsIndex()).GetOffset(); - index = GetOrInsertConstantPool(ConstPoolType::ASYNC_GENERATOR_FUNCTION, methodId); - FixInstructionId32(bcIns, index); + method_id = pf.ResolveMethodIndex(method->GetFileId(), bc_ins.GetId().AsIndex()).GetOffset(); + index = GetOrInsertConstantPool(ConstPoolType::ASYNC_GENERATOR_FUNCTION, method_id); + FixInstructionId32(bc_ins, index); break; case R::template Get(): - methodId = pf.ResolveMethodIndex(method->GetFileId(), bcIns.GetId().AsIndex()).GetOffset(); - index = GetOrInsertConstantPool(ConstPoolType::METHOD, methodId); - FixInstructionId32(bcIns, index); + method_id = pf.ResolveMethodIndex(method->GetFileId(), bc_ins.GetId().AsIndex()).GetOffset(); + index = GetOrInsertConstantPool(ConstPoolType::METHOD, method_id); + FixInstructionId32(bc_ins, index); break; case R::template Get(): case R::template Get(): index = GetOrInsertConstantPool(ConstPoolType::OBJECT_LITERAL, - bcIns.GetId().AsFileId().GetOffset()); - FixInstructionId32(bcIns, index); + bc_ins.GetId().AsFileId().GetOffset()); + FixInstructionId32(bc_ins, index); break; case R::template Get(): index = GetOrInsertConstantPool(ConstPoolType::ARRAY_LITERAL, - bcIns.GetId().AsFileId().GetOffset()); - FixInstructionId32(bcIns, index); + bc_ins.GetId().AsFileId().GetOffset()); + FixInstructionId32(bc_ins, index); break; case R::template Get(): - methodId = pf.ResolveMethodIndex(method->GetFileId(), bcIns.GetId().AsIndex()).GetOffset(); - index = GetOrInsertConstantPool(ConstPoolType::CLASS_FUNCTION, methodId); - FixInstructionId32(bcIns, index); + method_id = pf.ResolveMethodIndex(method->GetFileId(), bc_ins.GetId().AsIndex()).GetOffset(); + index = GetOrInsertConstantPool(ConstPoolType::CLASS_FUNCTION, method_id); + FixInstructionId32(bc_ins, index); index = GetOrInsertConstantPool( ConstPoolType::CLASS_LITERAL, - bcIns.GetImm()>()); - FixInstructionId32(bcIns, index, 1); + bc_ins.GetImm()>()); + FixInstructionId32(bc_ins, index, 1); break; default: break; } } - UpdateICOffset(const_cast(method), insSz, bcIns); - bcIns = bcIns.GetNext(); + UpdateICOffset(const_cast(method), ins_sz, bc_ins); + bc_ins = bc_ins.GetNext(); } } -template -void PandaFileTranslator::UpdateICOffset(JSMethod *method, uint32_t insSz, const BytecodeInstruction &inst) const +template +void PandaFileTranslator::UpdateICOffset(JSMethod *method, uint32_t ins_sz, const BytecodeInstruction &inst) const { - using EnumT = std::conditional_t; - using R = BytecodeInstructionResolver; + using EnumT = std::conditional_t; + using R = BytecodeInstructionResolver; auto opcode = inst.GetOpcode(); uint32_t bc_offset = inst.GetAddress() - method->GetInstructions(); - uint32_t slotSize = 0; + uint32_t slot_size = 0; switch (opcode) { case R::template Get(): case R::template Get(): case R::template Get(): case R::template Get(): - slotSize = ICRuntimeStub::SlotSizeForGlobalICByName(); + slot_size = ICRuntimeStub::SlotSizeForGlobalICByName(); break; case R::template Get(): case R::template Get(): case R::template Get(): - slotSize = ICRuntimeStub::SlotSizeForICByValue(); + slot_size = ICRuntimeStub::SlotSizeForICByValue(); break; case R::template Get(): case R::template Get(): case R::template Get(): - slotSize = ICRuntimeStub::SlotSizeForICByName(); + slot_size = ICRuntimeStub::SlotSizeForICByName(); break; default: return; @@ -519,63 +519,63 @@ void PandaFileTranslator::UpdateICOffset(JSMethod *method, uint32_t insSz, const using ICMappingType = JSMethod::ICMappingType; static_assert(std::is_pointer::value); using ICMappingElementType = std::remove_pointer::type; - ICMappingType icMapping = method->GetICMapping(); - if (icMapping == nullptr && insSz < ProfileTypeInfo::MAX_FUNCTION_SIZE) { - icMapping = - mem::InternalAllocator<>::GetInternalAllocatorFromRuntime()->AllocArray(insSz); - memset_s(icMapping, insSz, 0, insSz); - method->SetICMapping(icMapping); + ICMappingType ic_mapping = method->GetICMapping(); + if (ic_mapping == nullptr && ins_sz < ProfileTypeInfo::MAX_FUNCTION_SIZE) { + ic_mapping = + mem::InternalAllocator<>::GetInternalAllocatorFromRuntime()->AllocArray(ins_sz); + memset_s(ic_mapping, ins_sz, 0, ins_sz); + method->SetICMapping(ic_mapping); } - if (icMapping != nullptr) { + if (ic_mapping != nullptr) { // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) - icMapping[bc_offset] = method->GetSlotSize(); - method->AddSlotSize(slotSize); + ic_mapping[bc_offset] = method->GetSlotSize(); + method->AddSlotSize(slot_size); } } uint32_t PandaFileTranslator::GetOrInsertConstantPool(ConstPoolType type, uint32_t offset) { - auto it = constpoolMap_.find(offset); - if (it != constpoolMap_.cend()) { + auto it = constpool_map_.find(offset); + if (it != constpool_map_.cend()) { ConstPoolValue value(it->second); return value.GetConstpoolIndex(); } - ASSERT(constpoolIndex_ != UINT32_MAX); - uint32_t index = constpoolIndex_++; + ASSERT(constpool_index_ != UINT32_MAX); + uint32_t index = constpool_index_++; ConstPoolValue value(type, index); - constpoolMap_.insert({offset, value.GetValue()}); + constpool_map_.insert({offset, value.GetValue()}); return index; } -JSHandle PandaFileTranslator::DefineMethodInLiteral(uint32_t methodId, FunctionKind kind) const +JSHandle PandaFileTranslator::DefineMethodInLiteral(uint32_t method_id, FunctionKind kind) const { - auto method = const_cast(FindMethods(methodId)); + auto method = const_cast(FindMethods(method_id)); ASSERT(method != nullptr); JSHandle env = thread_->GetEcmaVM()->GetGlobalEnv(); - JSHandle functionClass; + JSHandle function_class; if (kind == FunctionKind::NORMAL_FUNCTION) { - functionClass = JSHandle::Cast(env->GetFunctionClassWithoutProto()); + function_class = JSHandle::Cast(env->GetFunctionClassWithoutProto()); } else { - functionClass = JSHandle::Cast(env->GetGeneratorFunctionClass()); + function_class = JSHandle::Cast(env->GetGeneratorFunctionClass()); } - JSHandle jsFunc = factory_->NewJSFunctionByDynClass(method, functionClass, kind); + JSHandle js_func = factory_->NewJSFunctionByDynClass(method, function_class, kind); if (kind == FunctionKind::GENERATOR_FUNCTION) { - JSHandle objFun = env->GetObjectFunction(); - JSHandle initialGeneratorFuncPrototype = - factory_->NewJSObjectByConstructor(JSHandle(objFun), objFun); - JSObject::SetPrototype(thread_, initialGeneratorFuncPrototype, env->GetGeneratorPrototype()); - jsFunc->SetProtoOrDynClass(thread_, initialGeneratorFuncPrototype); + JSHandle obj_fun = env->GetObjectFunction(); + JSHandle initial_generator_func_prototype = + factory_->NewJSObjectByConstructor(JSHandle(obj_fun), obj_fun); + JSObject::SetPrototype(thread_, initial_generator_func_prototype, env->GetGeneratorPrototype()); + js_func->SetProtoOrDynClass(thread_, initial_generator_func_prototype); } else if (kind == FunctionKind::ASYNC_GENERATOR_FUNCTION) { - JSHandle objFun = env->GetObjectFunction(); - JSHandle initialAsyncGeneratorFuncPrototype = - factory_->NewJSObjectByConstructor(JSHandle(objFun), objFun); - JSObject::SetPrototype(thread_, initialAsyncGeneratorFuncPrototype, env->GetAsyncGeneratorPrototype()); - jsFunc->SetProtoOrDynClass(thread_, initialAsyncGeneratorFuncPrototype); + JSHandle obj_fun = env->GetObjectFunction(); + JSHandle initial_async_generator_func_prototype = + factory_->NewJSObjectByConstructor(JSHandle(obj_fun), obj_fun); + JSObject::SetPrototype(thread_, initial_async_generator_func_prototype, env->GetAsyncGeneratorPrototype()); + js_func->SetProtoOrDynClass(thread_, initial_async_generator_func_prototype); } - jsFunc->SetupFunctionLength(thread_); - return jsFunc; + js_func->SetupFunctionLength(thread_); + return js_func; } void PandaFileTranslator::DefineClassInConstPool(const JSHandle &constpool) const @@ -591,11 +591,11 @@ void PandaFileTranslator::DefineClassInConstPool(const JSHandle &c // Here, using a law: when inserting ctor in index of constantpool, the index + 1 location will be inserted by // corresponding class literal. Because translator fixes ECMA_DEFINECLASSWITHBUFFER two consecutive times. - JSTaggedValue nextValue = constpool->Get(index + 1); - ASSERT(nextValue.IsTaggedArray()); + JSTaggedValue next_value = constpool->Get(index + 1); + ASSERT(next_value.IsTaggedArray()); JSHandle extractor(thread_, value); - JSHandle literal(thread_, nextValue); + JSHandle literal(thread_, next_value); ClassInfoExtractor::BuildClassInfoExtractorFromLiteral(thread_, extractor, literal); JSHandle cls = ClassHelper::DefineClassTemplate(thread_, extractor, constpool); constpool->Set(thread_, index, cls); diff --git a/runtime/class_linker/panda_file_translator.h b/runtime/class_linker/panda_file_translator.h index 9f66b9b4e..536f2b235 100644 --- a/runtime/class_linker/panda_file_translator.h +++ b/runtime/class_linker/panda_file_translator.h @@ -35,8 +35,8 @@ public: ~PandaFileTranslator() = default; NO_COPY_SEMANTIC(PandaFileTranslator); NO_MOVE_SEMANTIC(PandaFileTranslator); - static JSHandle TranslatePandaFile(EcmaVM *vm, const panda_file::File &pf, const PandaString &methodName); - JSHandle DefineMethodInLiteral(uint32_t methodId, FunctionKind kind) const; + static JSHandle TranslatePandaFile(EcmaVM *vm, const panda_file::File &pf, const PandaString &method_name); + JSHandle DefineMethodInLiteral(uint32_t method_id, FunctionKind kind) const; static void QuickPandaFile(EcmaVM *vm, const panda_file::File &pf); private: @@ -92,25 +92,25 @@ private: uint32_t GetOrInsertConstantPool(ConstPoolType type, uint32_t offset); const JSMethod *FindMethods(uint32_t offset) const; Program *GenerateProgram(const panda_file::File &pf); - void TranslateClasses(const panda_file::File &pf, const PandaString &methodName); + void TranslateClasses(const panda_file::File &pf, const PandaString &method_name); void TranslateMethod(const compiler::AotClass &aot_class, const panda_file::File::StringData &sd, const panda_file::File &pf, const uint8_t *descriptor, panda_file::MethodDataAccessor &mda); - template - void TranslateBytecode(uint32_t insSz, const uint8_t *insArr, const panda_file::File &pf, const JSMethod *method); - template - void FixInstructionId32(const BytecodeInstruction &inst, uint32_t index, uint32_t fixOrder = 0) const; - template - void UpdateICOffset(JSMethod *method, uint32_t insSz, const BytecodeInstruction &inst) const; + template + void TranslateBytecode(uint32_t ins_sz, const uint8_t *ins_arr, const panda_file::File &pf, const JSMethod *method); + template + void FixInstructionId32(const BytecodeInstruction &inst, uint32_t index, uint32_t fix_order = 0) const; + template + void UpdateICOffset(JSMethod *method, uint32_t ins_sz, const BytecodeInstruction &inst) const; void DefineClassInConstPool(const JSHandle &constpool) const; - EcmaVM *ecmaVm_; + EcmaVM *ecma_vm_; ObjectFactory *factory_; JSThread *thread_; - uint32_t constpoolIndex_ {0}; - uint32_t mainMethodIndex_ {0}; + uint32_t constpool_index_ {0}; + uint32_t main_method_index_ {0}; PandaUniquePtr> methods_; - std::unordered_map constpoolMap_; + std::unordered_map constpool_map_; std::set translated_code_; }; } // namespace panda::ecmascript diff --git a/runtime/dump.cpp b/runtime/dump.cpp index ef3370fc0..2f5c10280 100644 --- a/runtime/dump.cpp +++ b/runtime/dump.cpp @@ -2032,7 +2032,7 @@ static void DumpDynClass([[maybe_unused]] JSThread *thread, TaggedObject *obj, // NOLINTNEXTLINE(readability-function-size) static void DumpObject(JSThread *thread, TaggedObject *obj, std::vector> &vec, - bool isVmMode) + bool is_vm_mode) { auto jsHclass = obj->GetClass(); JSType type = jsHclass->GetObjectType(); @@ -2233,7 +2233,7 @@ static void DumpObject(JSThread *thread, TaggedObject *obj, std::vectorDumpForSnapshot(thread, vec); @@ -2305,10 +2305,10 @@ static void KeyToStd(PandaString &res, JSTaggedValue key) } void JSTaggedValue::DumpForSnapshot(JSThread *thread, std::vector> &vec, - bool isVmMode) const + bool is_vm_mode) const { if (IsHeapObject()) { - return DumpObject(thread, GetTaggedObject(), vec, isVmMode); + return DumpObject(thread, GetTaggedObject(), vec, is_vm_mode); } UNREACHABLE(); diff --git a/runtime/ecma_global_storage-inl.h b/runtime/ecma_global_storage-inl.h index 695c6f64d..a1b475955 100644 --- a/runtime/ecma_global_storage-inl.h +++ b/runtime/ecma_global_storage-inl.h @@ -29,16 +29,16 @@ EcmaGlobalStorage::Node *EcmaGlobalStorage::NodeList::NewNode(JSTaggedType value if (IsFull()) { return nullptr; } - Node *node = &nodeList_[index_++]; + Node *node = &node_list_[index_++]; node->SetPrev(nullptr); - node->SetNext(usedList_); + node->SetNext(used_list_); node->SetObject(value); node->SetFree(false); - if (usedList_ != nullptr) { - usedList_->SetPrev(node); + if (used_list_ != nullptr) { + used_list_->SetPrev(node); } - usedList_ = node; + used_list_ = node; return node; } @@ -50,35 +50,35 @@ void EcmaGlobalStorage::NodeList::FreeNode(EcmaGlobalStorage::Node *node) if (node->GetNext() != nullptr) { node->GetNext()->SetPrev(node->GetPrev()); } - if (node == usedList_) { - usedList_ = node->GetNext(); + if (node == used_list_) { + used_list_ = node->GetNext(); } node->SetPrev(nullptr); - node->SetNext(freeList_); + node->SetNext(free_list_); node->SetObject(JSTaggedValue::Undefined().GetRawData()); node->SetFree(true); - if (freeList_ != nullptr) { - freeList_->SetPrev(node); + if (free_list_ != nullptr) { + free_list_->SetPrev(node); } - freeList_ = node; + free_list_ = node; } EcmaGlobalStorage::Node *EcmaGlobalStorage::NodeList::GetFreeNode(JSTaggedType value) { - Node *node = freeList_; + Node *node = free_list_; if (node != nullptr) { - freeList_ = node->GetNext(); + free_list_ = node->GetNext(); node->SetPrev(nullptr); - node->SetNext(usedList_); + node->SetNext(used_list_); node->SetObject(value); node->SetFree(false); - if (usedList_ != nullptr) { - usedList_->SetPrev(node); + if (used_list_ != nullptr) { + used_list_->SetPrev(node); } - usedList_ = node; + used_list_ = node; } return node; } @@ -98,11 +98,11 @@ void EcmaGlobalStorage::NodeList::RemoveList() if (prev_ != nullptr) { prev_->SetNext(next_); } - if (freeNext_ != nullptr) { - freeNext_->SetFreePrev(freePrev_); + if (free_next_ != nullptr) { + free_next_->SetFreePrev(free_prev_); } - if (freePrev_ != nullptr) { - freePrev_->SetFreeNext(freeNext_); + if (free_prev_ != nullptr) { + free_prev_->SetFreeNext(free_next_); } } @@ -145,7 +145,7 @@ uintptr_t EcmaGlobalStorage::NewGlobalHandleImplement(NodeList **storage, NodeLi inline uintptr_t EcmaGlobalStorage::NewGlobalHandle(JSTaggedType value) { - return NewGlobalHandleImplement(&lastGlobalNodes_, &freeListNodes_, false, value); + return NewGlobalHandleImplement(&last_global_nodes_, &free_list_nodes_, false, value); } inline void EcmaGlobalStorage::DisposeGlobalHandle(uintptr_t nodeAddr) @@ -163,13 +163,13 @@ inline void EcmaGlobalStorage::DisposeGlobalHandle(uintptr_t nodeAddr) NodeList **top = nullptr; NodeList **last = nullptr; if (list->IsWeak()) { - freeList = &weakFreeListNodes_; - top = &topWeakGlobalNodes_; - last = &lastWeakGlobalNodes_; + freeList = &weak_free_list_nodes_; + top = &top_weak_global_nodes_; + last = &last_weak_global_nodes_; } else { - freeList = &freeListNodes_; - top = &topGlobalNodes_; - last = &lastGlobalNodes_; + freeList = &free_list_nodes_; + top = &top_global_nodes_; + last = &last_global_nodes_; } if (!list->HasUsagedNode() && (*top != *last)) { list->RemoveList(); @@ -199,7 +199,7 @@ inline uintptr_t EcmaGlobalStorage::SetWeak(uintptr_t nodeAddr) { auto value = reinterpret_cast(nodeAddr)->GetObject(); DisposeGlobalHandle(nodeAddr); - return NewGlobalHandleImplement(&lastWeakGlobalNodes_, &weakFreeListNodes_, true, value); + return NewGlobalHandleImplement(&last_weak_global_nodes_, &weak_free_list_nodes_, true, value); } inline bool EcmaGlobalStorage::IsWeak(uintptr_t addr) const diff --git a/runtime/ecma_global_storage.h b/runtime/ecma_global_storage.h index 5cf95918e..b3c7ee774 100644 --- a/runtime/ecma_global_storage.h +++ b/runtime/ecma_global_storage.h @@ -27,14 +27,14 @@ public: explicit EcmaGlobalStorage() { auto allocator = Runtime::GetCurrent()->GetInternalAllocator(); - topGlobalNodes_ = lastGlobalNodes_ = allocator->New(false); - topWeakGlobalNodes_ = lastWeakGlobalNodes_ = allocator->New(true); + top_global_nodes_ = last_global_nodes_ = allocator->New(false); + top_weak_global_nodes_ = last_weak_global_nodes_ = allocator->New(true); } ~EcmaGlobalStorage() { auto allocator = Runtime::GetCurrent()->GetInternalAllocator(); - NodeList *next = topGlobalNodes_; + NodeList *next = top_global_nodes_; NodeList *current = nullptr; while (next != nullptr) { current = next; @@ -42,7 +42,7 @@ public: allocator->Delete(current); } - next = topWeakGlobalNodes_; + next = top_weak_global_nodes_; while (next != nullptr) { current = next; next = current->GetNext(); @@ -94,12 +94,12 @@ public: void SetFree(bool free) { - isFree_ = free; + is_free_ = free; } bool IsFree() const { - return isFree_; + return is_free_; } uintptr_t GetObjectAddress() const @@ -112,15 +112,15 @@ public: Node *next_ {nullptr}; Node *prev_ {nullptr}; int32_t index_ {-1}; - bool isFree_ {false}; + bool is_free_ {false}; }; class NodeList { public: - explicit NodeList(bool isWeak) : isWeak_(isWeak) + explicit NodeList(bool is_weak) : is_weak_(is_weak) { for (int i = 0; i < GLOBAL_BLOCK_SIZE; i++) { - nodeList_[i].SetIndex(i); + node_list_[i].SetIndex(i); } } ~NodeList() = default; @@ -141,17 +141,17 @@ public: inline bool IsWeak() { - return isWeak_; + return is_weak_; } inline bool HasFreeNode() { - return freeList_ != nullptr; + return free_list_ != nullptr; } inline bool HasUsagedNode() { - return !IsFull() || usedList_ != nullptr; + return !IsFull() || used_list_ != nullptr; } inline void SetNext(NodeList *next) @@ -174,26 +174,26 @@ public: inline void SetFreeNext(NodeList *next) { - freeNext_ = next; + free_next_ = next; } inline NodeList *GetFreeNext() const { - return freeNext_; + return free_next_; } inline void SetFreePrev(NodeList *prev) { - freePrev_ = prev; + free_prev_ = prev; } inline NodeList *GetFreePrev() const { - return freePrev_; + return free_prev_; } template inline void IterateUsageGlobal(Callback callback) { - Node *next = usedList_; + Node *next = used_list_; Node *current = nullptr; while (next != nullptr) { current = next; @@ -207,15 +207,15 @@ public: DEFAULT_COPY_SEMANTIC(NodeList); private: - std::array nodeList_; // all - Node *freeList_ {nullptr}; // dispose node - Node *usedList_ {nullptr}; // usage node + std::array node_list_; // all + Node *free_list_ {nullptr}; // dispose node + Node *used_list_ {nullptr}; // usage node int32_t index_ {0}; - bool isWeak_ {false}; + bool is_weak_ {false}; NodeList *next_ {nullptr}; NodeList *prev_ {nullptr}; - NodeList *freeNext_ {nullptr}; - NodeList *freePrev_ {nullptr}; + NodeList *free_next_ {nullptr}; + NodeList *free_prev_ {nullptr}; }; inline uintptr_t NewGlobalHandle(JSTaggedType value); @@ -226,7 +226,7 @@ public: template void IterateUsageGlobal(Callback callback) { - NodeList *next = topGlobalNodes_; + NodeList *next = top_global_nodes_; NodeList *current = nullptr; while (next != nullptr) { current = next; @@ -239,7 +239,7 @@ public: template void IterateWeakUsageGlobal(Callback callback) { - NodeList *next = topWeakGlobalNodes_; + NodeList *next = top_weak_global_nodes_; NodeList *current = nullptr; while (next != nullptr) { current = next; @@ -253,15 +253,16 @@ private: NO_COPY_SEMANTIC(EcmaGlobalStorage); NO_MOVE_SEMANTIC(EcmaGlobalStorage); - inline uintptr_t NewGlobalHandleImplement(NodeList **storage, NodeList **freeList, bool isWeak, JSTaggedType value); + inline uintptr_t NewGlobalHandleImplement(NodeList **storage, NodeList **free_list, bool is_weak, + JSTaggedType value); - NodeList *topGlobalNodes_ {nullptr}; - NodeList *lastGlobalNodes_ {nullptr}; - NodeList *freeListNodes_ {nullptr}; + NodeList *top_global_nodes_ {nullptr}; + NodeList *last_global_nodes_ {nullptr}; + NodeList *free_list_nodes_ {nullptr}; - NodeList *topWeakGlobalNodes_ {nullptr}; - NodeList *lastWeakGlobalNodes_ {nullptr}; - NodeList *weakFreeListNodes_ {nullptr}; + NodeList *top_weak_global_nodes_ {nullptr}; + NodeList *last_weak_global_nodes_ {nullptr}; + NodeList *weak_free_list_nodes_ {nullptr}; }; } // namespace panda::ecmascript #endif // ECMASCRIPT_ECMA_GLOABL_STORAGE_H diff --git a/runtime/ecma_handle_scope-inl.h b/runtime/ecma_handle_scope-inl.h index d183a49fa..557b5ff30 100644 --- a/runtime/ecma_handle_scope-inl.h +++ b/runtime/ecma_handle_scope-inl.h @@ -22,9 +22,9 @@ namespace panda::ecmascript { inline EcmaHandleScope::EcmaHandleScope(JSThread *thread) : thread_(thread), - prevNext_(thread->handleScopeStorageNext_), - prevEnd_(thread->handleScopeStorageEnd_), - prevHandleStorageIndex_(thread->currentHandleStorageIndex_) + prev_next_(thread->handle_scope_storage_next_), + prev_end_(thread->handle_scope_storage_end_), + prev_handle_storage_index_(thread->current_handle_storage_index_) { thread->HandleScopeCountAdd(); } @@ -32,23 +32,23 @@ inline EcmaHandleScope::EcmaHandleScope(JSThread *thread) inline EcmaHandleScope::~EcmaHandleScope() { thread_->HandleScopeCountDec(); - thread_->handleScopeStorageNext_ = prevNext_; - if (thread_->handleScopeStorageEnd_ != prevEnd_) { - thread_->handleScopeStorageEnd_ = prevEnd_; - thread_->ShrinkHandleStorage(prevHandleStorageIndex_); + thread_->handle_scope_storage_next_ = prev_next_; + if (thread_->handle_scope_storage_end_ != prev_end_) { + thread_->handle_scope_storage_end_ = prev_end_; + thread_->ShrinkHandleStorage(prev_handle_storage_index_); } } uintptr_t EcmaHandleScope::NewHandle(JSThread *thread, JSTaggedType value) { // Each Handle must be managed by HandleScope, otherwise it may cause Handle leakage. - ASSERT(thread->handleScopeCount_ > 0); - auto result = thread->handleScopeStorageNext_; - if (result == thread->handleScopeStorageEnd_) { + ASSERT(thread->handle_scope_count_ > 0); + auto result = thread->handle_scope_storage_next_; + if (result == thread->handle_scope_storage_end_) { result = reinterpret_cast(thread->ExpandHandleStorage()); } // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) - thread->handleScopeStorageNext_ = result + 1; + thread->handle_scope_storage_next_ = result + 1; *result = value; return reinterpret_cast(result); } diff --git a/runtime/ecma_handle_scope.h b/runtime/ecma_handle_scope.h index 1709fc7c1..c79b806c6 100644 --- a/runtime/ecma_handle_scope.h +++ b/runtime/ecma_handle_scope.h @@ -40,9 +40,9 @@ public: private: JSThread *thread_; - JSTaggedType *prevNext_; - JSTaggedType *prevEnd_; - int prevHandleStorageIndex_ {-1}; + JSTaggedType *prev_next_; + JSTaggedType *prev_end_; + int prev_handle_storage_index_ {-1}; NO_COPY_SEMANTIC(EcmaHandleScope); NO_MOVE_SEMANTIC(EcmaHandleScope); diff --git a/runtime/ecma_runtime.yaml b/runtime/ecma_runtime.yaml index 255ea9f89..96fd8f8aa 100644 --- a/runtime/ecma_runtime.yaml +++ b/runtime/ecma_runtime.yaml @@ -14,2056 +14,2056 @@ intrinsics_namespace: panda::ecmascript::intrinsics intrinsics: -- name: Ldnan - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: ldnan - static: true - signature: - ret: any - args: [] - impl: panda::ecmascript::intrinsics::Ldnan - clear_flags: [no_dce] - use_thread: false - -- name: Ldinfinity - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: ldinfinity - static: true - signature: - ret: any - args: [] - impl: panda::ecmascript::intrinsics::Ldinfinity - clear_flags: [no_dce] - use_thread: false - -- name: Ldglobalthis - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: ldglobalthis - static: true - signature: - ret: any - args: [] - impl: panda::ecmascript::intrinsics::Ldglobalthis - clear_flags: [no_dce] - -- name: Ldundefined - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: ldundefined - static: true - signature: - ret: any - args: [] - impl: panda::ecmascript::intrinsics::Ldundefined - clear_flags: [no_dce] - use_thread: false - -- name: Ldboolean - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: ldboolean - static: true - signature: - ret: any - args: [any] - impl: panda::ecmascript::intrinsics::Ldboolean - -- name: Ldnumber - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: ldnumber - static: true - signature: - ret: any - args: [any] - impl: panda::ecmascript::intrinsics::Ldnumber - -- name: Ldstring - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: ldstring - static: true - signature: - ret: any - args: [any] - impl: panda::ecmascript::intrinsics::Ldstring - -- name: Ldbigint - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: ldbigint - static: true - signature: - ret: any - args: [any] - impl: panda::ecmascript::intrinsics::Ldbigint - -- name: Ldnull - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: ldnull - static: true - signature: - ret: any - args: [] - impl: panda::ecmascript::intrinsics::Ldnull - clear_flags: [no_dce] - use_thread: false - -- name: Ldsymbol - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: ldsymbol - static: true - signature: - ret: any - args: [] - impl: panda::ecmascript::intrinsics::Ldsymbol - clear_flags: [no_dce] - -- name: Ldobject - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: ldobject - static: true - signature: - ret: any - args: [any, any] - impl: panda::ecmascript::intrinsics::Ldobject - -- name: Ldfunction - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: ldfunction - static: true - signature: - ret: any - args: [any, any] - impl: panda::ecmascript::intrinsics::Ldfunction - -- name: Ldglobal - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: ldglobal - static: true - signature: - ret: any - args: [] - impl: panda::ecmascript::intrinsics::Ldglobal - clear_flags: [no_dce] - -- name: Ldtrue - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: ldtrue - static: true - signature: - ret: any - args: [] - impl: panda::ecmascript::intrinsics::Ldtrue - clear_flags: [no_dce] - use_thread: false - -- name: Ldfalse - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: ldfalse - static: true - signature: - ret: any - args: [] - impl: panda::ecmascript::intrinsics::Ldfalse - clear_flags: [no_dce] - use_thread: false - -- name: Add2Dyn - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: add2Dyn - static: true - exception: true - signature: - ret: any - args: [any, acc] - impl: panda::ecmascript::intrinsics::Add2Dyn - set_flags: [heap_inv] - fast_path: FastPathEcmaAdd - -- name: Sub2Dyn - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: sub2Dyn - static: true - exception: true - signature: - ret: any - args: [any, acc] - impl: panda::ecmascript::intrinsics::Sub2Dyn - set_flags: [heap_inv] - fast_path: FastPathEcmaSub - -- name: Mul2Dyn - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: mul2Dyn - static: true - exception: true - signature: - ret: any - args: [any, acc] - impl: panda::ecmascript::intrinsics::Mul2Dyn - set_flags: [heap_inv] - fast_path: FastPathEcmaMul - -- name: Div2Dyn - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: div2Dyn - static: true - exception: true - signature: - ret: any - args: [any, acc] - impl: panda::ecmascript::intrinsics::Div2Dyn - set_flags: [heap_inv] - fast_path: FastPathEcmaDiv - -- name: Mod2Dyn - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: mod2Dyn - static: true - exception: true - signature: - ret: any - args: [any, acc] - impl: panda::ecmascript::intrinsics::Mod2Dyn - set_flags: [heap_inv] - -- name: EqDyn - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: eqDyn - static: true - exception: true - signature: - ret: any - args: [any, acc] - impl: panda::ecmascript::intrinsics::EqDyn - set_flags: [heap_inv] - -- name: NotEqDyn - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: noteqDyn - static: true - exception: true - signature: - ret: any - args: [any, acc] - impl: panda::ecmascript::intrinsics::NotEqDyn - set_flags: [heap_inv] - -- name: LessDyn - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: lessDyn - static: true - exception: true - signature: - ret: any - args: [any, acc] - impl: panda::ecmascript::intrinsics::LessDyn - set_flags: [heap_inv] - -- name: LessEqDyn - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: lesseqDyn - static: true - exception: true - signature: - ret: any - args: [any, acc] - impl: panda::ecmascript::intrinsics::LessEqDyn - set_flags: [heap_inv] - -- name: GreaterDyn - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: greaterDyn - static: true - exception: true - signature: - ret: any - args: [any, acc] - impl: panda::ecmascript::intrinsics::GreaterDyn - set_flags: [heap_inv] - -- name: GreaterEqDyn - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: greatereqDyn - static: true - exception: true - signature: - ret: any - args: [any, acc] - impl: panda::ecmascript::intrinsics::GreaterEqDyn - set_flags: [heap_inv] - -- name: LdObjByValue - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: ldObjByValue - static: true - exception: true - signature: - ret: any - args: [any, any, u16] - impl: panda::ecmascript::intrinsics::LdObjByValue - fast_path: FastPathLdObjByValue - set_flags: [heap_inv] - -- name: TryLdGlobalByValue - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: tryLdGlobalByValue - static: true - exception: true - signature: - ret: any - args: [u16, any] - impl: panda::ecmascript::intrinsics::TryLdGlobalByValue - set_flags: [heap_inv] - -- name: StObjByValue - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: stObjByValue - static: true - exception: true - signature: - ret: any - args: [any, any, acc, u16] - impl: panda::ecmascript::intrinsics::StObjByValue - fast_path: FastPathStObjByValue - set_flags: [heap_inv] - -- name: Shl2Dyn - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: shl2Dyn - static: true - exception: true - signature: - ret: any - args: [any, acc] - impl: panda::ecmascript::intrinsics::Shl2Dyn - set_flags: [heap_inv] - fast_path: FastPathEcmaShl - -- name: Shr2Dyn - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: shr2Dyn - static: true - exception: true - signature: - ret: any - args: [any, acc] - impl: panda::ecmascript::intrinsics::Shr2Dyn - set_flags: [heap_inv] - fast_path: FastPathEcmaShr - -- name: Ashr2Dyn - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: ashr2Dyn - static: true - exception: true - signature: - ret: any - args: [any, acc] - impl: panda::ecmascript::intrinsics::Ashr2Dyn - set_flags: [heap_inv] - -- name: And2Dyn - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: and2Dyn - static: true - exception: true - signature: - ret: any - args: [any, acc] - impl: panda::ecmascript::intrinsics::And2Dyn - set_flags: [heap_inv] - fast_path: FastPathEcmaAnd - -- name: Or2Dyn - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: or2Dyn - static: true - exception: true - signature: - ret: any - args: [any, acc] - impl: panda::ecmascript::intrinsics::Or2Dyn - set_flags: [heap_inv] - fast_path: FastPathEcmaOr - -- name: Xor2Dyn - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: xor2Dyn - static: true - exception: true - signature: - ret: any - args: [any, acc] - impl: panda::ecmascript::intrinsics::Xor2Dyn - set_flags: [heap_inv] - fast_path: FastPathEcmaXor - -- name: Tonumber - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: tonumber - static: true - exception: true - signature: - ret: any - args: [any] - impl: panda::ecmascript::intrinsics::Tonumber - set_flags: [heap_inv] - -- name: NegDyn - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: negDyn - static: true - exception: true - signature: - ret: any - args: [any] - impl: panda::ecmascript::intrinsics::NegDyn - set_flags: [heap_inv] - fast_path: FastPathEcmaNeg - -- name: NotDyn - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: notDyn - static: true - exception: true - signature: - ret: any - args: [any] - impl: panda::ecmascript::intrinsics::NotDyn - set_flags: [heap_inv] - fast_path: FastPathEcmaNot - -- name: IncDyn - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: incDyn - static: true - exception: true - signature: - ret: any - args: [any] - impl: panda::ecmascript::intrinsics::IncDyn - set_flags: [heap_inv] - fast_path: FastPathEcmaInc - -- name: DecDyn - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: decDyn - static: true - exception: true - signature: - ret: any - args: [any] - impl: panda::ecmascript::intrinsics::DecDyn - set_flags: [heap_inv] - fast_path: FastPathEcmaDec - -- name: RethrowDyn - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: rethrowDyn - static: true - exception: true - signature: - ret: any - args: [acc] - impl: panda::ecmascript::intrinsics::RethrowDyn - set_flags: [heap_inv] - -- name: ThrowDyn - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: throwDyn - static: true - exception: true - signature: - ret: void - args: [acc] - impl: panda::ecmascript::intrinsics::ThrowDyn - -- name: Delobjprop - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: delobjprop - static: true - exception: true - signature: - ret: any - args: [any, any] - impl: panda::ecmascript::intrinsics::Delobjprop - set_flags: [heap_inv] - -- name: Defineglobalvar - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: defineglobalvar - static: true - signature: - ret: any - args: [any, any] - impl: panda::ecmascript::intrinsics::Defineglobalvar - -- name: Definelocalvar - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: definelocalvar - static: true - signature: - ret: any - args: [any, any] - impl: panda::ecmascript::intrinsics::Definelocalvar - -- name: Definefuncexpr - class_name: Ecmascript.Intrinsics - space: ecmascript - method_name: definefuncexpr - static: true - signature: - ret: any - args: [any, any] - impl: panda::ecmascript::intrinsics::Definefuncexpr - -- name: DefinefuncDyn - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: definefuncDyn - static: true - exception: true - signature: - ret: any - args: [method_id, any] - impl: panda::ecmascript::intrinsics::DefinefuncDyn - -- name: DefineNCFuncDyn - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: defineNCFuncDyn - static: true - exception: true - signature: - ret: any - args: [method_id, any, acc] - impl: panda::ecmascript::intrinsics::DefineNCFuncDyn - -- name: NewobjDynrange - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: newobjDynrange - static: true - exception: true - signature: - ret: any - args: [u16, any, any] - stackrange: true - impl: panda::ecmascript::intrinsics::NewobjDynrange - set_flags: [heap_inv] - -- name: NewobjDynrangeInterp - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: newobjDynrangeInterp - static: true - exception: true - signature: - ret: any - args: [u16, any] - impl: panda::ecmascript::intrinsics::NewobjDynrangeInterp - set_flags: [heap_inv] - -- name: RefeqDyn - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: refeqDyn - static: true - signature: - ret: any - args: [any, any] - impl: panda::ecmascript::intrinsics::RefeqDyn - -- name: ExpDyn - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: expDyn - static: true - exception: true - signature: - ret: any - args: [any, acc] - impl: panda::ecmascript::intrinsics::ExpDyn - set_flags: [heap_inv] - -- name: TypeofDyn - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: typeofDyn - static: true - signature: - ret: any - args: [acc] - impl: panda::ecmascript::intrinsics::TypeofDyn - clear_flags: [no_dce] - -- name: Callruntimerange - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: callruntimerange - static: true - signature: - ret: any - args: [any, any] - impl: panda::ecmascript::intrinsics::Callruntimerange - -- name: IsinDyn - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: isinDyn - static: true - exception: true - signature: - ret: any - args: [any, acc] - impl: panda::ecmascript::intrinsics::IsinDyn - set_flags: [heap_inv] - -- name: InstanceofDyn - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: instanceofDyn - static: true - exception: true - signature: - ret: any - args: [any, acc] - impl: panda::ecmascript::intrinsics::InstanceofDyn - set_flags: [heap_inv] - -- name: StrictNotEqDyn - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: strictNotEqDyn - static: true - signature: - ret: any - args: [any, acc] - impl: panda::ecmascript::intrinsics::StrictNotEqDyn - set_flags: [heap_inv] - clear_flags: [no_dce] - use_thread: false - -- name: StrictEqDyn - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: strictEqDyn - static: true - signature: - ret: any - args: [any, acc] - impl: panda::ecmascript::intrinsics::StrictEqDyn - set_flags: [heap_inv] - use_thread: false - -- name: NewobjspreadDyn - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: newobjspreadDyn - static: true - exception: true - signature: - ret: any - args: [any, any, acc] - impl: panda::ecmascript::intrinsics::NewobjspreadDyn - set_flags: [heap_inv] - -- name: CallspreadDyn - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: callspreadDyn - static: true - exception: true - signature: - ret: any - args: [any, any, any] - impl: panda::ecmascript::intrinsics::CallspreadDyn - set_flags: [heap_inv] - -- name: JfalseDyn - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: jfalseDyn - static: true - signature: - ret: void - args: [u16, acc] - impl: panda::ecmascript::intrinsics::JfalseDyn - -- name: JtrueDyn - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: jtrueDyn - static: true - signature: - ret: void - args: [u16, acc] - impl: panda::ecmascript::intrinsics::JtrueDyn - -- name: ReturnDyn - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: returnDyn - static: true - signature: - ret: any - args: [any] - impl: panda::ecmascript::intrinsics::ReturnDyn - -- name: NewlexenvDyn - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: newlexenvDyn - static: true - exception: true - signature: - ret: any - args: [u16] - impl: panda::ecmascript::intrinsics::NewlexenvDyn - -- name: CopylexenvDyn - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: copylexenvDyn - static: true - signature: - ret: any - args: [] - impl: panda::ecmascript::intrinsics::CopylexenvDyn - -- name: StLexVarDyn - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: StLexVarDyn - static: true - exception: true - signature: - ret: void - args: [u16, u16, acc] - impl: panda::ecmascript::intrinsics::StLexVarDyn - -- name: LdLexVarDyn - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: LdLexVarDyn - static: true - exception: true - signature: - ret: any - args: [u16, u16] - impl: panda::ecmascript::intrinsics::LdLexVarDyn - set_flags: [require_tmp] - clear_flags: [no_dce] - codegen_func: LdLexVarDyn - -- name: LdlexenvDyn - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: ldlexenvDyn - static: true - exception: true - signature: - ret: any - args: [] - impl: panda::ecmascript::intrinsics::LdlexenvDyn - clear_flags: [no_dce] - codegen_func: LdlexenvDyn - -- name: PopLexenvDyn - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: popLexenvDyn - static: true - signature: - ret: void - args: [] - impl: panda::ecmascript::intrinsics::popLexenvDyn - -- name: GetUnmappedArgs - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: getUnmappedArgs - static: true - exception: true - signature: - ret: any - args: [] - impl: panda::ecmascript::intrinsics::GetUnmappedArgs - -- name: GetUnmappedArgsInterp - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: getUnmappedArgsInterp - static: true - exception: true - signature: - ret: any - args: [] - impl: panda::ecmascript::intrinsics::GetUnmappedArgsInterp - -- name: Toboolean - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: toboolean - static: true - signature: - ret: any - args: [acc] - impl: panda::ecmascript::intrinsics::Toboolean - set_flags: [heap_inv] - clear_flags: [no_dce] - use_thread: false - -- name: Negate - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: negate - static: true - exception: true - signature: - ret: any - args: [acc] - impl: panda::ecmascript::intrinsics::Negate - clear_flags: [no_dce] - use_thread: false - -- name: IsUndefined - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: isUndefined - static: true - exception: true - signature: - ret: any - args: [acc] - impl: panda::ecmascript::intrinsics::IsUndefined - clear_flags: [no_dce] - use_thread: false - -- name: IsTrue - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: isTrue - static: true - exception: true - signature: - ret: any - args: [acc] - impl: panda::ecmascript::intrinsics::IsTrue - clear_flags: [no_dce] - use_thread: false - -- name: IsFalse - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: isFalse - static: true - exception: true - signature: - ret: any - args: [acc] - impl: panda::ecmascript::intrinsics::IsFalse - clear_flags: [no_dce] - use_thread: false - -- name: IsCoercible - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: isCoercible - static: true - exception: true - signature: - ret: any - args: [acc] - impl: panda::ecmascript::intrinsics::IsCoercible - clear_flags: [no_dce] - use_thread: false - -- name: GetPropIterator - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: getPropIterator - static: true - exception: true - signature: - ret: any - args: [acc] - impl: panda::ecmascript::intrinsics::GetPropIterator - -- name: DefineGeneratorFunc - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: defineGeneratorFunc - static: true - exception: true - signature: - ret: any - args: [method_id, any] - impl: panda::ecmascript::intrinsics::DefineGeneratorFunc - -- name: CreateIterResultObj - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: createIterResultObj - static: true - exception: true - signature: - ret: any - args: [acc, u8] - impl: panda::ecmascript::intrinsics::CreateIterResultObj - -- name: suspendGenerator - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: suspendGenerator - static: true - exception: true - signature: - ret: any - args: [any, acc] - impl: panda::ecmascript::intrinsics::SuspendGenerator - -- name: suspendGeneratorInterp - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: suspendGeneratorInterp - static: true - exception: true - signature: - ret: any - args: [any, acc, any] - impl: panda::ecmascript::intrinsics::SuspendGeneratorInterp - -- name: SuspendAsyncGenerator - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: suspendAsyncGenerator - static: true - exception: true - signature: - ret: any - args: [any, acc] - impl: panda::ecmascript::intrinsics::SuspendAsyncGenerator - -- name: SuspendAsyncGeneratorInterp - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: suspendAsyncGeneratorInterp - static: true - exception: true - signature: - ret: any - args: [any, acc, any] - impl: panda::ecmascript::intrinsics::SuspendAsyncGeneratorInterp - -- name: ResumeGenerator - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: resumeGenerator - static: true - exception: true - signature: - ret: any - args: [any] - impl: panda::ecmascript::intrinsics::ResumeGenerator - clear_flags: [no_dce] - use_thread: false - -- name: GetResumeMode - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: getResumeMode - static: true - exception: true - signature: - ret: any - args: [any] - impl: panda::ecmascript::intrinsics::GetResumeMode - clear_flags: [no_dce] - use_thread: false - -- name: CreateGeneratorObj - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: createGeneratorObj - static: true - exception: true - signature: - ret: any - args: [any] - impl: panda::ecmascript::intrinsics::CreateGeneratorObj - -- name: SetGeneratorState - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: setGeneratorState - static: true - exception: true - signature: - ret: any - args: [any, u8] - impl: panda::ecmascript::intrinsics::SetGeneratorState - -- name: CreateAsyncGeneratorObj - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: createAsyncGeneratorObj - static: true - exception: true - signature: - ret: any - args: [any] - impl: panda::ecmascript::intrinsics::CreateAsyncGeneratorObj - -- name: DefineAsyncGeneratorFunc - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: defineAsyncGeneratorFunc - static: true - exception: true - signature: - ret: any - args: [method_id, any] - impl: panda::ecmascript::intrinsics::DefineAsyncGeneratorFunc - -- name: DefineAsyncFunc - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: defineAsyncFunc - static: true - exception: true - signature: - ret: any - args: [method_id, any] - impl: panda::ecmascript::intrinsics::DefineAsyncFunc - -- name: AsyncFunctionEnter - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: asyncFunctionEnter - static: true - exception: true - signature: - ret: any - args: [] - impl: panda::ecmascript::intrinsics::AsyncFunctionEnter - -- name: AsyncFunctionAwait - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: asyncFunctionAwait - static: true - exception: true - signature: - ret: any - args: [any, acc] - set_flags: [heap_inv] - impl: panda::ecmascript::intrinsics::AsyncFunctionAwait - -- name: AsyncFunctionResolve - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: asyncFunctionResolve - static: true - exception: true - signature: - ret: any - args: [any, acc] - set_flags: [heap_inv] - impl: panda::ecmascript::intrinsics::AsyncFunctionResolve - -- name: AsyncFunctionReject - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: asyncFunctionReject - exception: true - static: true - signature: - ret: any - args: [any, acc] - set_flags: [heap_inv] - impl: panda::ecmascript::intrinsics::AsyncFunctionReject - -- name: AsyncGeneratorResolve - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: asyncGeneratorResolve - static: true - exception: true - signature: - ret: any - args: [any, acc] - set_flags: [heap_inv] - impl: panda::ecmascript::intrinsics::AsyncGeneratorResolve - -- name: AsyncGeneratorReject - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: asyncGeneratorReject - exception: true - static: true - signature: - ret: any - args: [any, acc] - set_flags: [heap_inv] - impl: panda::ecmascript::intrinsics::AsyncGeneratorReject - -- name: ThrowUndefined - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: throwUndefined - static: true - exception: true - signature: - ret: void - args: [any] - impl: panda::ecmascript::intrinsics::ThrowUndefined - -- name: ThrowConstAssignment - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: throwConstAssignment - static: true - exception: true - signature: - ret: void - args: [string_id] - impl: panda::ecmascript::intrinsics::ThrowConstAssignment - -- name: ThrowUndefinedIfHole - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: throwUndefinedIfHole - static: true - exception: true - signature: - ret: any - args: [string_id, acc] - impl: panda::ecmascript::intrinsics::ThrowUndefinedIfHole - -- name: Copyrestargs - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: copyrestargs - static: true - exception: true - signature: - ret: any - args: [u16] - impl: panda::ecmascript::intrinsics::Copyrestargs - -- name: CopyrestargsInterp - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: copyrestargsInterp - static: true - exception: true - signature: - ret: any - args: [u16] - impl: panda::ecmascript::intrinsics::CopyrestargsInterp - -- name: Ldhole - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: ldHole - static: true - signature: - ret: any - args: [] - clear_flags: [no_dce] - impl: panda::ecmascript::intrinsics::Ldhole - use_thread: false - -- name: TryStGlobalByValue - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: tryStGlobalByValue - exception: true - static: true - signature: - ret: void - args: [u16, any, acc] - impl: panda::ecmascript::intrinsics::TryStGlobalByValue - set_flags: [heap_inv] - -- name: GetMethod - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: getMethod - static: true - exception: true - signature: - ret: any - args: [string_id, any] - impl: panda::ecmascript::intrinsics::GetMethod - set_flags: [heap_inv] - -- name: GetTemplateObject - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: getTemplateObject - static: true - exception: true - signature: - ret: any - args: [any] - impl: panda::ecmascript::intrinsics::GetTemplateObject - set_flags: [heap_inv] - -- name: TryLdGlobalByName - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: TryLdGlobalByName - static: true - exception: true - signature: - ret: any - args: [string_id, u16] - impl: panda::ecmascript::intrinsics::TryLdGlobalByName - set_flags: [heap_inv] - -- name: TryStGlobalByName - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: TryStGlobalByName - static: true - exception: true - signature: - ret: any - args: [string_id, acc, u16] - impl: panda::ecmascript::intrinsics::TryStGlobalByName - set_flags: [heap_inv] - -- name: LdGlobalVar - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: LdGlobalVar - static: true - exception: true - signature: - ret: any - args: [string_id, u16] - impl: panda::ecmascript::intrinsics::LdGlobalVar - fast_path: FastPathLdGlobalVar - set_flags: [heap_inv] - -- name: StGlobalVar - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: StGlobalVar - static: true - exception: true - signature: - ret: any - args: [string_id, acc, u16] - impl: panda::ecmascript::intrinsics::StGlobalVar - fast_path: FastPathStGlobalVar - set_flags: [heap_inv] - -- name: StGlobalLet - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: StGlobalLet - static: true - exception: true - signature: - ret: any - args: [string_id, acc] - impl: panda::ecmascript::intrinsics::StGlobalLet - set_flags: [heap_inv] - -- name: LdObjByName - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: LdObjByName - static: true - exception: true - signature: - ret: any - args: [string_id, any, u16] - impl: panda::ecmascript::intrinsics::LdObjByName - fast_path: FastPathLdObjByName - set_flags: [heap_inv] - -- name: StObjByName - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: StObjByName - static: true - exception: true - signature: - ret: any - args: [string_id, any, acc, u16] - impl: panda::ecmascript::intrinsics::StObjByName - fast_path: FastPathStObjByName - set_flags: [heap_inv] - -- name: LdObjByIndex - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: LdObjByIndex - static: true - exception: true - signature: - ret: any - args: [u32, any] - impl: panda::ecmascript::intrinsics::LdObjByIndex - set_flags: [heap_inv] - -- name: StObjByIndex - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: StObjByIndex - static: true - exception: true - signature: - ret: any - args: [u32, any, acc] - impl: panda::ecmascript::intrinsics::StObjByIndex - set_flags: [heap_inv] - -- name: GetNextPropName - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: getnextpropname - static: true - exception: true - signature: - ret: any - args: [any] - impl: panda::ecmascript::intrinsics::GetNextPropName - set_flags: [heap_inv] - -- name: ReturnUndefined - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: ReturnUndefined - static: true - signature: - ret: void - args: [] - impl: panda::ecmascript::intrinsics::ReturnUndefined - -- name: Call0Dyn - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: Call0Dyn - static: true - exception: true - signature: - ret: any - args: [any] - impl: panda::ecmascript::intrinsics::Call0Dyn - set_flags: [heap_inv] - -- name: Call1Dyn - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: Call1Dyn - static: true - exception: true - signature: - ret: any - args: [any, any] - impl: panda::ecmascript::intrinsics::Call1Dyn - set_flags: [heap_inv] - -- name: Call2Dyn - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: Call2Dyn - static: true - exception: true - signature: - ret: any - args: [any, any, any] - impl: panda::ecmascript::intrinsics::Call2Dyn - set_flags: [heap_inv] - -- name: Call3Dyn - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: Call3Dyn - static: true - exception: true - signature: - ret: any - args: [any, any, any, any] - impl: panda::ecmascript::intrinsics::Call3Dyn - set_flags: [heap_inv] - -- name: CalliRangeDyn - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: CalliRangeDyn - static: true - exception: true - signature: - ret: any - args: [u16, any] - impl: panda::ecmascript::intrinsics::CalliRangeDyn - set_flags: [heap_inv] - -- name: CalliRangeDynInterp - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: CalliRangeDynInterp - static: true - exception: true - signature: - ret: any - args: [u16, any] - impl: panda::ecmascript::intrinsics::CalliRangeDynInterp - set_flags: [heap_inv] - -- name: CalliThisRangeDyn - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: CalliThisRangeDyn - static: true - exception: true - signature: - ret: any - args: [u16, any] - impl: panda::ecmascript::intrinsics::CalliThisRangeDyn - set_flags: [heap_inv] - -- name: CreateEmptyObject - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: createemptyobject - static: true - exception: true - signature: - ret: any - args: [] - impl: panda::ecmascript::intrinsics::CreateEmptyObject - clear_flags: [no_dce] - -- name: CreateObjectWithBuffer - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: createobjectwithbuffer - static: true - exception: true - signature: - ret: any - args: [u16] - impl: panda::ecmascript::intrinsics::CreateObjectWithBuffer - -- name: CopyDataProperties - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: copydataproperties - static: true - exception: true - signature: - ret: any - args: [any, any] - impl: panda::ecmascript::intrinsics::CopyDataProperties - set_flags: [heap_inv] - -- name: DefineGetterSetterByValue - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: definegettersetterbyvalue - static: true - exception: true - signature: - ret: any - args: [any, any, any, any, acc] - impl: panda::ecmascript::intrinsics::DefineGetterSetterByValue - set_flags: [heap_inv] - -- name: CreateEmptyArray - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: createemptyarray - static: true - exception: true - signature: - ret: any - args: [] - impl: panda::ecmascript::intrinsics::CreateEmptyArray - clear_flags: [no_dce] - -- name: CreateArrayWithBuffer - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: createarraywithbuffer - static: true - exception: true - signature: - ret: any - args: [u16] - impl: panda::ecmascript::intrinsics::CreateArrayWithBuffer - -- name: StOwnByName - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: StOwnByName - static: true - exception: true - signature: - ret: any - args: [string_id, any, acc] - impl: panda::ecmascript::intrinsics::StOwnByName - set_flags: [heap_inv] - -- name: StOwnByIndex - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: StOwnByIndex - static: true - exception: true - signature: - ret: any - args: [u32, any, acc] - impl: panda::ecmascript::intrinsics::StOwnByIndex - set_flags: [heap_inv] - -- name: StOwnByValue - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: StOwnByValue - static: true - exception: true - signature: - ret: any - args: [any, any, acc] - impl: panda::ecmascript::intrinsics::StOwnByValue - set_flags: [heap_inv] - -- name: StArraySpread - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: starrayspread - static: true - exception: true - signature: - ret: any - args: [any, any, acc] - impl: panda::ecmascript::intrinsics::StArraySpread - set_flags: [heap_inv] - -- name: GetIterator - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: GetIterator - static: true - exception: true - signature: - ret: any - args: [acc] - impl: panda::ecmascript::intrinsics::GetIterator - set_flags: [heap_inv] - -- name: GetAsyncIterator - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: GetAsyncIterator - static: true - exception: true - signature: - ret: any - args: [acc] - impl: panda::ecmascript::intrinsics::GetAsyncIterator - set_flags: [heap_inv] - -- name: ThrowIfNotObject - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: ThrowIfNotObject - static: true - exception: true - signature: - ret: any - args: [acc] - impl: panda::ecmascript::intrinsics::ThrowIfNotObject - -- name: ThrowThrowNotExists - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: ThrowThrowNotExists - static: true - exception: true - signature: - ret: void - args: [] - impl: panda::ecmascript::intrinsics::ThrowThrowNotExists - -- name: CreateObjectWithExcludedKeys - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: CreateObjectWithExcludedKeys - static: true - exception: true - range: true - signature: - ret: any - args: [u16, any, any] - impl: panda::ecmascript::intrinsics::CreateObjectWithExcludedKeys - -- name: ThrowPatternNonCoercible - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: ThrowPatternNonCoercible - static: true - exception: true - signature: - ret: void - args: [] - impl: panda::ecmascript::intrinsics::ThrowPatternNonCoercible - -- name: CloseIterator - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: CloseIterator - static: true - exception: true - signature: - ret: any - args: [any, acc] - impl: panda::ecmascript::intrinsics::CloseIterator - set_flags: [heap_inv] - -- name: ImportModule - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: ImportModule - static: true - exception: true - signature: - ret: any - args: [string_id] - impl: panda::ecmascript::intrinsics::ImportModule - clear_flags: [no_dce] - -- name: StModuleVar - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: StModuleVar - static: true - exception: true - signature: - ret: void - args: [string_id, acc] - impl: panda::ecmascript::intrinsics::StModuleVar - -- name: CopyModule - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: CopyModule - static: true - exception: true - signature: - ret: void - args: [any] - impl: panda::ecmascript::intrinsics::CopyModule - -- name: LdModvarByName - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: LdModvarByName - static: true - exception: true - signature: - ret: any - args: [string_id, any] - impl: panda::ecmascript::intrinsics::LdModvarByName - clear_flags: [no_dce] - set_flags: [heap_inv] - -- name: DefineClassWithBuffer - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: DefineClassWithBuffer - static: true - exception: true - signature: - ret: any - args: [method_id, u16, any, any] - impl: panda::ecmascript::intrinsics::DefineClassWithBuffer - -- name: SuperCall - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: SuperCall - static: true - exception: true - signature: - ret: any - args: [u16, any, any, acc] - impl: panda::ecmascript::intrinsics::SuperCall - set_flags: [heap_inv] - -- name: SuperCallSpread - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: SuperCallSpread - static: true - exception: true - signature: - ret: any - args: [any, any, acc] - impl: panda::ecmascript::intrinsics::SuperCallSpread - set_flags: [heap_inv] - -- name: DefineMethod - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: defineMethod - static: true - exception: true - signature: - ret: any - args: [method_id, any, acc] - impl: panda::ecmascript::intrinsics::DefineMethod - -- name: LdSuperByName - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: LdSuperByName - static: true - exception: true - signature: - ret: any - args: [string_id, any] - impl: panda::ecmascript::intrinsics::LdSuperByName - set_flags: [heap_inv] - -- name: StSuperByName - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: StSuperByName - static: true - exception: true - signature: - ret: any - args: [string_id, any, any] - impl: panda::ecmascript::intrinsics::StSuperByName - set_flags: [heap_inv] - -- name: StSuperByValue - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: StSuperByValue - static: true - exception: true - signature: - ret: any - args: [any, any, acc] - impl: panda::ecmascript::intrinsics::StSuperByValue - set_flags: [heap_inv] - -- name: LdSuperByValue - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: LdSuperByValue - static: true - exception: true - signature: - ret: any - args: [any, any] - impl: panda::ecmascript::intrinsics::LdSuperByValue - set_flags: [heap_inv] - -- name: CreateObjectHavingMethod - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: createobjecthavingmethod - static: true - exception: true - signature: - ret: any - args: [u16, acc] - impl: panda::ecmascript::intrinsics::CreateObjectHavingMethod - -- name: ThrowIfSuperNotCorrectCall - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: ThrowIfSuperNotCorrectCall - static: true - exception: true - signature: - ret: any - args: [u16, acc] - impl: panda::ecmascript::intrinsics::ThrowIfSuperNotCorrectCall - -- name: LdHomeObject - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: LdHomeObject - static: true - signature: - ret: any - args: [] - impl: panda::ecmascript::intrinsics::LdHomeObject - clear_flags: [no_dce] - -- name: SetObjectWithProto - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: setobjectwithproto - static: true - exception: true - signature: - ret: any - args: [any, any] - impl: panda::ecmascript::intrinsics::SetObjectWithProto - -- name: ThrowDeleteSuperProperty - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: ThrowDeleteSuperProperty - static: true - exception: true - signature: - ret: void - args: [] - impl: panda::ecmascript::intrinsics::ThrowDeleteSuperProperty - -- name: Debugger - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: debugger - static: true - signature: - ret: void - args: [] - impl: panda::ecmascript::intrinsics::Debugger - use_thread: false - -- name: NativeMethodWrapper - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: NativeMethodWrapper - static: true - exception: true - signature: - ret: void - args: [any] - impl: panda::ecmascript::intrinsics::NativeMethodWrapper - use_thread: false - -- name: GetObjectClassType - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: GetObjectClassType - static: true - codegen_func: GetObjectClassTypeIntrinsic - signature: - ret: u8 - args: [any] - impl: panda::ecmascript::intrinsics::GetObjectClassType - use_thread: false - clear_flags: [no_dce, barrier, require_state, runtime_call] - -- name: IsNan - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: IsNan - static: true - signature: - ret: any - args: [f64] - impl: panda::ecmascript::intrinsics::IsNan - use_thread: false - -- name: GetEcmaConstantPool - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: GetEcmaConstantPool - static: true - codegen_func: GetEcmaConstantPool - signature: - ret: any - args: [] - impl: panda::ecmascript::intrinsics::GetEcmaConstantPool - clear_flags: [no_dce, barrier, require_state, runtime_call] - -- name: GetEcmaThisFunc - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: GetEcmaThisFunc - static: true - codegen_func: GetEcmaThisFunc - signature: - ret: any - args: [] - impl: panda::ecmascript::intrinsics::GetEcmaThisFunc - clear_flags: [no_dce, barrier, require_state, runtime_call] - -- name: GetWeakReferent - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: GetWeakReferent - static: true - codegen_func: GetWeakReferent - signature: - ret: any - args: [any] - impl: panda::ecmascript::intrinsics::GetWeakReferent - use_thread: false - clear_flags: [no_dce, barrier, require_state, runtime_call] - -- name: DynClassIsDictionaryElement - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: DynClassIsDictionaryElement - static: true - signature: - ret: u1 - args: [any] - impl: panda::ecmascript::intrinsics::DynClassIsDictionaryElement - codegen_func: CreateDynClassIsDictionaryElement - use_thread: false - clear_flags: [no_dce, barrier, require_state, runtime_call] - -- name: DynClassIsExtensible - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: DynClassIsExtensible - static: true - signature: - ret: u1 - args: [any] - impl: panda::ecmascript::intrinsics::DynClassIsExtensible - codegen_func: CreateDynClassIsExtensible - use_thread: false - clear_flags: [no_dce, barrier, require_state, runtime_call] - -- name: DynObjectGetClass - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: DynObjectGetClass - static: true - signature: - ret: any - args: [any] - impl: panda::ecmascript::intrinsics::DynObjectGetClass - codegen_func: CreateDynObjectGetClass - use_thread: false - clear_flags: [no_dce, barrier, require_state, runtime_call] - -- name: DynObjectSetClass - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: DynObjectSetClass - static: true - signature: - ret: void - args: [any, any] - impl: panda::ecmascript::intrinsics::DynObjectSetClass - codegen_func: CreateDynObjectSetClass - use_thread: false - clear_flags: [require_state, runtime_call] - -- name: DynCallCheck - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: CreateDynCallCheck - static: true - signature: - ret: void - args: [any] - codegen_func: CreateDynCallCheck - use_thread: false - clear_flags: [] - -- name: DynClassNumberOfProps - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: DynClassNumberOfProps - static: true - signature: - ret: u32 - args: [any] - impl: panda::ecmascript::intrinsics::DynClassNumberOfProps - codegen_func: CreateDynClassNumberOfProps - use_thread: false - clear_flags: [no_dce, barrier, require_state, runtime_call] - -- name: DynClassGetHash - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: DynClassGetHash - static: true - signature: - ret: u32 - args: [any] - impl: panda::ecmascript::intrinsics::DynClassGetHash - codegen_func: CreateDynClassGetHash - use_thread: false - clear_flags: [no_dce, barrier, require_state, runtime_call] - -- name: LdObjDynByName - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: LdObjDynByName - static: true - signature: - ret: any - args: [any, any, u16] - impl: panda::ecmascript::intrinsics::LdObjDynByName - codegen_func: CreateLdObjDynByName - use_thread: false - is_fastpath: true - clear_flags: [barrier, require_state] - -- name: StObjDynByName - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: StObjDynByName - static: true - signature: - ret: any - args: [any, any, any, u16] - impl: panda::ecmascript::intrinsics::StObjDynByName - codegen_func: CreateStObjDynByName - use_thread: false - is_fastpath: true - clear_flags: [barrier, require_state] + - name: Ldnan + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: ldnan + static: true + signature: + ret: any + args: [] + impl: panda::ecmascript::intrinsics::Ldnan + clear_flags: [no_dce] + use_thread: false + + - name: Ldinfinity + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: ldinfinity + static: true + signature: + ret: any + args: [] + impl: panda::ecmascript::intrinsics::Ldinfinity + clear_flags: [no_dce] + use_thread: false + + - name: Ldglobalthis + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: ldglobalthis + static: true + signature: + ret: any + args: [] + impl: panda::ecmascript::intrinsics::Ldglobalthis + clear_flags: [no_dce] + + - name: Ldundefined + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: ldundefined + static: true + signature: + ret: any + args: [] + impl: panda::ecmascript::intrinsics::Ldundefined + clear_flags: [no_dce] + use_thread: false + + - name: Ldboolean + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: ldboolean + static: true + signature: + ret: any + args: [any] + impl: panda::ecmascript::intrinsics::Ldboolean + + - name: Ldnumber + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: ldnumber + static: true + signature: + ret: any + args: [any] + impl: panda::ecmascript::intrinsics::Ldnumber + + - name: Ldstring + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: ldstring + static: true + signature: + ret: any + args: [any] + impl: panda::ecmascript::intrinsics::Ldstring + + - name: Ldbigint + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: ldbigint + static: true + signature: + ret: any + args: [any] + impl: panda::ecmascript::intrinsics::Ldbigint + + - name: Ldnull + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: ldnull + static: true + signature: + ret: any + args: [] + impl: panda::ecmascript::intrinsics::Ldnull + clear_flags: [no_dce] + use_thread: false + + - name: Ldsymbol + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: ldsymbol + static: true + signature: + ret: any + args: [] + impl: panda::ecmascript::intrinsics::Ldsymbol + clear_flags: [no_dce] + + - name: Ldobject + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: ldobject + static: true + signature: + ret: any + args: [any, any] + impl: panda::ecmascript::intrinsics::Ldobject + + - name: Ldfunction + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: ldfunction + static: true + signature: + ret: any + args: [any, any] + impl: panda::ecmascript::intrinsics::Ldfunction + + - name: Ldglobal + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: ldglobal + static: true + signature: + ret: any + args: [] + impl: panda::ecmascript::intrinsics::Ldglobal + clear_flags: [no_dce] + + - name: Ldtrue + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: ldtrue + static: true + signature: + ret: any + args: [] + impl: panda::ecmascript::intrinsics::Ldtrue + clear_flags: [no_dce] + use_thread: false + + - name: Ldfalse + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: ldfalse + static: true + signature: + ret: any + args: [] + impl: panda::ecmascript::intrinsics::Ldfalse + clear_flags: [no_dce] + use_thread: false + + - name: Add2Dyn + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: add2Dyn + static: true + exception: true + signature: + ret: any + args: [any, acc] + impl: panda::ecmascript::intrinsics::Add2Dyn + set_flags: [heap_inv] + fast_path: FastPathEcmaAdd + + - name: Sub2Dyn + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: sub2Dyn + static: true + exception: true + signature: + ret: any + args: [any, acc] + impl: panda::ecmascript::intrinsics::Sub2Dyn + set_flags: [heap_inv] + fast_path: FastPathEcmaSub + + - name: Mul2Dyn + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: mul2Dyn + static: true + exception: true + signature: + ret: any + args: [any, acc] + impl: panda::ecmascript::intrinsics::Mul2Dyn + set_flags: [heap_inv] + fast_path: FastPathEcmaMul + + - name: Div2Dyn + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: div2Dyn + static: true + exception: true + signature: + ret: any + args: [any, acc] + impl: panda::ecmascript::intrinsics::Div2Dyn + set_flags: [heap_inv] + fast_path: FastPathEcmaDiv + + - name: Mod2Dyn + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: mod2Dyn + static: true + exception: true + signature: + ret: any + args: [any, acc] + impl: panda::ecmascript::intrinsics::Mod2Dyn + set_flags: [heap_inv] + + - name: EqDyn + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: eqDyn + static: true + exception: true + signature: + ret: any + args: [any, acc] + impl: panda::ecmascript::intrinsics::EqDyn + set_flags: [heap_inv] + + - name: NotEqDyn + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: noteqDyn + static: true + exception: true + signature: + ret: any + args: [any, acc] + impl: panda::ecmascript::intrinsics::NotEqDyn + set_flags: [heap_inv] + + - name: LessDyn + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: lessDyn + static: true + exception: true + signature: + ret: any + args: [any, acc] + impl: panda::ecmascript::intrinsics::LessDyn + set_flags: [heap_inv] + + - name: LessEqDyn + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: lesseqDyn + static: true + exception: true + signature: + ret: any + args: [any, acc] + impl: panda::ecmascript::intrinsics::LessEqDyn + set_flags: [heap_inv] + + - name: GreaterDyn + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: greaterDyn + static: true + exception: true + signature: + ret: any + args: [any, acc] + impl: panda::ecmascript::intrinsics::GreaterDyn + set_flags: [heap_inv] + + - name: GreaterEqDyn + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: greatereqDyn + static: true + exception: true + signature: + ret: any + args: [any, acc] + impl: panda::ecmascript::intrinsics::GreaterEqDyn + set_flags: [heap_inv] + + - name: LdObjByValue + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: ldObjByValue + static: true + exception: true + signature: + ret: any + args: [any, any, u16] + impl: panda::ecmascript::intrinsics::LdObjByValue + fast_path: FastPathLdObjByValue + set_flags: [heap_inv] + + - name: TryLdGlobalByValue + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: tryLdGlobalByValue + static: true + exception: true + signature: + ret: any + args: [u16, any] + impl: panda::ecmascript::intrinsics::TryLdGlobalByValue + set_flags: [heap_inv] + + - name: StObjByValue + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: stObjByValue + static: true + exception: true + signature: + ret: any + args: [any, any, acc, u16] + impl: panda::ecmascript::intrinsics::StObjByValue + fast_path: FastPathStObjByValue + set_flags: [heap_inv] + + - name: Shl2Dyn + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: shl2Dyn + static: true + exception: true + signature: + ret: any + args: [any, acc] + impl: panda::ecmascript::intrinsics::Shl2Dyn + set_flags: [heap_inv] + fast_path: FastPathEcmaShl + + - name: Shr2Dyn + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: shr2Dyn + static: true + exception: true + signature: + ret: any + args: [any, acc] + impl: panda::ecmascript::intrinsics::Shr2Dyn + set_flags: [heap_inv] + fast_path: FastPathEcmaShr + + - name: Ashr2Dyn + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: ashr2Dyn + static: true + exception: true + signature: + ret: any + args: [any, acc] + impl: panda::ecmascript::intrinsics::Ashr2Dyn + set_flags: [heap_inv] + + - name: And2Dyn + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: and2Dyn + static: true + exception: true + signature: + ret: any + args: [any, acc] + impl: panda::ecmascript::intrinsics::And2Dyn + set_flags: [heap_inv] + fast_path: FastPathEcmaAnd + + - name: Or2Dyn + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: or2Dyn + static: true + exception: true + signature: + ret: any + args: [any, acc] + impl: panda::ecmascript::intrinsics::Or2Dyn + set_flags: [heap_inv] + fast_path: FastPathEcmaOr + + - name: Xor2Dyn + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: xor2Dyn + static: true + exception: true + signature: + ret: any + args: [any, acc] + impl: panda::ecmascript::intrinsics::Xor2Dyn + set_flags: [heap_inv] + fast_path: FastPathEcmaXor + + - name: Tonumber + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: tonumber + static: true + exception: true + signature: + ret: any + args: [any] + impl: panda::ecmascript::intrinsics::Tonumber + set_flags: [heap_inv] + + - name: NegDyn + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: negDyn + static: true + exception: true + signature: + ret: any + args: [any] + impl: panda::ecmascript::intrinsics::NegDyn + set_flags: [heap_inv] + fast_path: FastPathEcmaNeg + + - name: NotDyn + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: notDyn + static: true + exception: true + signature: + ret: any + args: [any] + impl: panda::ecmascript::intrinsics::NotDyn + set_flags: [heap_inv] + fast_path: FastPathEcmaNot + + - name: IncDyn + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: incDyn + static: true + exception: true + signature: + ret: any + args: [any] + impl: panda::ecmascript::intrinsics::IncDyn + set_flags: [heap_inv] + fast_path: FastPathEcmaInc + + - name: DecDyn + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: decDyn + static: true + exception: true + signature: + ret: any + args: [any] + impl: panda::ecmascript::intrinsics::DecDyn + set_flags: [heap_inv] + fast_path: FastPathEcmaDec + + - name: RethrowDyn + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: rethrowDyn + static: true + exception: true + signature: + ret: any + args: [acc] + impl: panda::ecmascript::intrinsics::RethrowDyn + set_flags: [heap_inv] + + - name: ThrowDyn + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: throwDyn + static: true + exception: true + signature: + ret: void + args: [acc] + impl: panda::ecmascript::intrinsics::ThrowDyn + + - name: Delobjprop + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: delobjprop + static: true + exception: true + signature: + ret: any + args: [any, any] + impl: panda::ecmascript::intrinsics::Delobjprop + set_flags: [heap_inv] + + - name: Defineglobalvar + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: defineglobalvar + static: true + signature: + ret: any + args: [any, any] + impl: panda::ecmascript::intrinsics::Defineglobalvar + + - name: Definelocalvar + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: definelocalvar + static: true + signature: + ret: any + args: [any, any] + impl: panda::ecmascript::intrinsics::Definelocalvar + + - name: Definefuncexpr + class_name: Ecmascript.Intrinsics + space: ecmascript + method_name: definefuncexpr + static: true + signature: + ret: any + args: [any, any] + impl: panda::ecmascript::intrinsics::Definefuncexpr + + - name: DefinefuncDyn + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: definefuncDyn + static: true + exception: true + signature: + ret: any + args: [method_id, any] + impl: panda::ecmascript::intrinsics::DefinefuncDyn + + - name: DefineNCFuncDyn + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: defineNCFuncDyn + static: true + exception: true + signature: + ret: any + args: [method_id, any, acc] + impl: panda::ecmascript::intrinsics::DefineNCFuncDyn + + - name: NewobjDynrange + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: newobjDynrange + static: true + exception: true + signature: + ret: any + args: [u16, any, any] + stackrange: true + impl: panda::ecmascript::intrinsics::NewobjDynrange + set_flags: [heap_inv] + + - name: NewobjDynrangeInterp + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: newobjDynrangeInterp + static: true + exception: true + signature: + ret: any + args: [u16, any] + impl: panda::ecmascript::intrinsics::NewobjDynrangeInterp + set_flags: [heap_inv] + + - name: RefeqDyn + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: refeqDyn + static: true + signature: + ret: any + args: [any, any] + impl: panda::ecmascript::intrinsics::RefeqDyn + + - name: ExpDyn + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: expDyn + static: true + exception: true + signature: + ret: any + args: [any, acc] + impl: panda::ecmascript::intrinsics::ExpDyn + set_flags: [heap_inv] + + - name: TypeofDyn + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: typeofDyn + static: true + signature: + ret: any + args: [acc] + impl: panda::ecmascript::intrinsics::TypeofDyn + clear_flags: [no_dce] + + - name: Callruntimerange + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: callruntimerange + static: true + signature: + ret: any + args: [any, any] + impl: panda::ecmascript::intrinsics::Callruntimerange + + - name: IsinDyn + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: isinDyn + static: true + exception: true + signature: + ret: any + args: [any, acc] + impl: panda::ecmascript::intrinsics::IsinDyn + set_flags: [heap_inv] + + - name: InstanceofDyn + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: instanceofDyn + static: true + exception: true + signature: + ret: any + args: [any, acc] + impl: panda::ecmascript::intrinsics::InstanceofDyn + set_flags: [heap_inv] + + - name: StrictNotEqDyn + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: strictNotEqDyn + static: true + signature: + ret: any + args: [any, acc] + impl: panda::ecmascript::intrinsics::StrictNotEqDyn + set_flags: [heap_inv] + clear_flags: [no_dce] + use_thread: false + + - name: StrictEqDyn + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: strictEqDyn + static: true + signature: + ret: any + args: [any, acc] + impl: panda::ecmascript::intrinsics::StrictEqDyn + set_flags: [heap_inv] + use_thread: false + + - name: NewobjspreadDyn + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: newobjspreadDyn + static: true + exception: true + signature: + ret: any + args: [any, any, acc] + impl: panda::ecmascript::intrinsics::NewobjspreadDyn + set_flags: [heap_inv] + + - name: CallspreadDyn + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: callspreadDyn + static: true + exception: true + signature: + ret: any + args: [any, any, any] + impl: panda::ecmascript::intrinsics::CallspreadDyn + set_flags: [heap_inv] + + - name: JfalseDyn + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: jfalseDyn + static: true + signature: + ret: void + args: [u16, acc] + impl: panda::ecmascript::intrinsics::JfalseDyn + + - name: JtrueDyn + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: jtrueDyn + static: true + signature: + ret: void + args: [u16, acc] + impl: panda::ecmascript::intrinsics::JtrueDyn + + - name: ReturnDyn + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: returnDyn + static: true + signature: + ret: any + args: [any] + impl: panda::ecmascript::intrinsics::ReturnDyn + + - name: NewlexenvDyn + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: newlexenvDyn + static: true + exception: true + signature: + ret: any + args: [u16] + impl: panda::ecmascript::intrinsics::NewlexenvDyn + + - name: CopylexenvDyn + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: copylexenvDyn + static: true + signature: + ret: any + args: [] + impl: panda::ecmascript::intrinsics::CopylexenvDyn + + - name: StLexVarDyn + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: StLexVarDyn + static: true + exception: true + signature: + ret: void + args: [u16, u16, acc] + impl: panda::ecmascript::intrinsics::StLexVarDyn + + - name: LdLexVarDyn + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: LdLexVarDyn + static: true + exception: true + signature: + ret: any + args: [u16, u16] + impl: panda::ecmascript::intrinsics::LdLexVarDyn + set_flags: [require_tmp] + clear_flags: [no_dce] + codegen_func: LdLexVarDyn + + - name: LdlexenvDyn + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: ldlexenvDyn + static: true + exception: true + signature: + ret: any + args: [] + impl: panda::ecmascript::intrinsics::LdlexenvDyn + clear_flags: [no_dce] + codegen_func: LdlexenvDyn + + - name: PopLexenvDyn + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: PopLexenvDyn + static: true + signature: + ret: void + args: [] + impl: panda::ecmascript::intrinsics::PopLexenvDyn + + - name: GetUnmappedArgs + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: getUnmappedArgs + static: true + exception: true + signature: + ret: any + args: [] + impl: panda::ecmascript::intrinsics::GetUnmappedArgs + + - name: GetUnmappedArgsInterp + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: getUnmappedArgsInterp + static: true + exception: true + signature: + ret: any + args: [] + impl: panda::ecmascript::intrinsics::GetUnmappedArgsInterp + + - name: Toboolean + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: toboolean + static: true + signature: + ret: any + args: [acc] + impl: panda::ecmascript::intrinsics::Toboolean + set_flags: [heap_inv] + clear_flags: [no_dce] + use_thread: false + + - name: Negate + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: negate + static: true + exception: true + signature: + ret: any + args: [acc] + impl: panda::ecmascript::intrinsics::Negate + clear_flags: [no_dce] + use_thread: false + + - name: IsUndefined + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: isUndefined + static: true + exception: true + signature: + ret: any + args: [acc] + impl: panda::ecmascript::intrinsics::IsUndefined + clear_flags: [no_dce] + use_thread: false + + - name: IsTrue + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: isTrue + static: true + exception: true + signature: + ret: any + args: [acc] + impl: panda::ecmascript::intrinsics::IsTrue + clear_flags: [no_dce] + use_thread: false + + - name: IsFalse + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: isFalse + static: true + exception: true + signature: + ret: any + args: [acc] + impl: panda::ecmascript::intrinsics::IsFalse + clear_flags: [no_dce] + use_thread: false + + - name: IsCoercible + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: isCoercible + static: true + exception: true + signature: + ret: any + args: [acc] + impl: panda::ecmascript::intrinsics::IsCoercible + clear_flags: [no_dce] + use_thread: false + + - name: GetPropIterator + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: getPropIterator + static: true + exception: true + signature: + ret: any + args: [acc] + impl: panda::ecmascript::intrinsics::GetPropIterator + + - name: DefineGeneratorFunc + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: defineGeneratorFunc + static: true + exception: true + signature: + ret: any + args: [method_id, any] + impl: panda::ecmascript::intrinsics::DefineGeneratorFunc + + - name: CreateIterResultObj + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: createIterResultObj + static: true + exception: true + signature: + ret: any + args: [acc, u8] + impl: panda::ecmascript::intrinsics::CreateIterResultObj + + - name: suspendGenerator + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: suspendGenerator + static: true + exception: true + signature: + ret: any + args: [any, acc] + impl: panda::ecmascript::intrinsics::SuspendGenerator + + - name: suspendGeneratorInterp + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: suspendGeneratorInterp + static: true + exception: true + signature: + ret: any + args: [any, acc, any] + impl: panda::ecmascript::intrinsics::SuspendGeneratorInterp + + - name: SuspendAsyncGenerator + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: suspendAsyncGenerator + static: true + exception: true + signature: + ret: any + args: [any, acc] + impl: panda::ecmascript::intrinsics::SuspendAsyncGenerator + + - name: SuspendAsyncGeneratorInterp + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: suspendAsyncGeneratorInterp + static: true + exception: true + signature: + ret: any + args: [any, acc, any] + impl: panda::ecmascript::intrinsics::SuspendAsyncGeneratorInterp + + - name: ResumeGenerator + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: resumeGenerator + static: true + exception: true + signature: + ret: any + args: [any] + impl: panda::ecmascript::intrinsics::ResumeGenerator + clear_flags: [no_dce] + use_thread: false + + - name: GetResumeMode + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: getResumeMode + static: true + exception: true + signature: + ret: any + args: [any] + impl: panda::ecmascript::intrinsics::GetResumeMode + clear_flags: [no_dce] + use_thread: false + + - name: CreateGeneratorObj + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: createGeneratorObj + static: true + exception: true + signature: + ret: any + args: [any] + impl: panda::ecmascript::intrinsics::CreateGeneratorObj + + - name: SetGeneratorState + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: setGeneratorState + static: true + exception: true + signature: + ret: any + args: [any, u8] + impl: panda::ecmascript::intrinsics::SetGeneratorState + + - name: CreateAsyncGeneratorObj + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: createAsyncGeneratorObj + static: true + exception: true + signature: + ret: any + args: [any] + impl: panda::ecmascript::intrinsics::CreateAsyncGeneratorObj + + - name: DefineAsyncGeneratorFunc + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: defineAsyncGeneratorFunc + static: true + exception: true + signature: + ret: any + args: [method_id, any] + impl: panda::ecmascript::intrinsics::DefineAsyncGeneratorFunc + + - name: DefineAsyncFunc + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: defineAsyncFunc + static: true + exception: true + signature: + ret: any + args: [method_id, any] + impl: panda::ecmascript::intrinsics::DefineAsyncFunc + + - name: AsyncFunctionEnter + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: asyncFunctionEnter + static: true + exception: true + signature: + ret: any + args: [] + impl: panda::ecmascript::intrinsics::AsyncFunctionEnter + + - name: AsyncFunctionAwait + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: asyncFunctionAwait + static: true + exception: true + signature: + ret: any + args: [any, acc] + set_flags: [heap_inv] + impl: panda::ecmascript::intrinsics::AsyncFunctionAwait + + - name: AsyncFunctionResolve + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: asyncFunctionResolve + static: true + exception: true + signature: + ret: any + args: [any, acc] + set_flags: [heap_inv] + impl: panda::ecmascript::intrinsics::AsyncFunctionResolve + + - name: AsyncFunctionReject + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: asyncFunctionReject + exception: true + static: true + signature: + ret: any + args: [any, acc] + set_flags: [heap_inv] + impl: panda::ecmascript::intrinsics::AsyncFunctionReject + + - name: AsyncGeneratorResolve + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: asyncGeneratorResolve + static: true + exception: true + signature: + ret: any + args: [any, acc] + set_flags: [heap_inv] + impl: panda::ecmascript::intrinsics::AsyncGeneratorResolve + + - name: AsyncGeneratorReject + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: asyncGeneratorReject + exception: true + static: true + signature: + ret: any + args: [any, acc] + set_flags: [heap_inv] + impl: panda::ecmascript::intrinsics::AsyncGeneratorReject + + - name: ThrowUndefined + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: throwUndefined + static: true + exception: true + signature: + ret: void + args: [any] + impl: panda::ecmascript::intrinsics::ThrowUndefined + + - name: ThrowConstAssignment + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: throwConstAssignment + static: true + exception: true + signature: + ret: void + args: [string_id] + impl: panda::ecmascript::intrinsics::ThrowConstAssignment + + - name: ThrowUndefinedIfHole + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: throwUndefinedIfHole + static: true + exception: true + signature: + ret: any + args: [string_id, acc] + impl: panda::ecmascript::intrinsics::ThrowUndefinedIfHole + + - name: Copyrestargs + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: copyrestargs + static: true + exception: true + signature: + ret: any + args: [u16] + impl: panda::ecmascript::intrinsics::Copyrestargs + + - name: CopyrestargsInterp + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: copyrestargsInterp + static: true + exception: true + signature: + ret: any + args: [u16] + impl: panda::ecmascript::intrinsics::CopyrestargsInterp + + - name: Ldhole + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: ldHole + static: true + signature: + ret: any + args: [] + clear_flags: [no_dce] + impl: panda::ecmascript::intrinsics::Ldhole + use_thread: false + + - name: TryStGlobalByValue + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: tryStGlobalByValue + exception: true + static: true + signature: + ret: void + args: [u16, any, acc] + impl: panda::ecmascript::intrinsics::TryStGlobalByValue + set_flags: [heap_inv] + + - name: GetMethod + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: getMethod + static: true + exception: true + signature: + ret: any + args: [string_id, any] + impl: panda::ecmascript::intrinsics::GetMethod + set_flags: [heap_inv] + + - name: GetTemplateObject + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: getTemplateObject + static: true + exception: true + signature: + ret: any + args: [any] + impl: panda::ecmascript::intrinsics::GetTemplateObject + set_flags: [heap_inv] + + - name: TryLdGlobalByName + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: TryLdGlobalByName + static: true + exception: true + signature: + ret: any + args: [string_id, u16] + impl: panda::ecmascript::intrinsics::TryLdGlobalByName + set_flags: [heap_inv] + + - name: TryStGlobalByName + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: TryStGlobalByName + static: true + exception: true + signature: + ret: any + args: [string_id, acc, u16] + impl: panda::ecmascript::intrinsics::TryStGlobalByName + set_flags: [heap_inv] + + - name: LdGlobalVar + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: LdGlobalVar + static: true + exception: true + signature: + ret: any + args: [string_id, u16] + impl: panda::ecmascript::intrinsics::LdGlobalVar + fast_path: FastPathLdGlobalVar + set_flags: [heap_inv] + + - name: StGlobalVar + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: StGlobalVar + static: true + exception: true + signature: + ret: any + args: [string_id, acc, u16] + impl: panda::ecmascript::intrinsics::StGlobalVar + fast_path: FastPathStGlobalVar + set_flags: [heap_inv] + + - name: StGlobalLet + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: StGlobalLet + static: true + exception: true + signature: + ret: any + args: [string_id, acc] + impl: panda::ecmascript::intrinsics::StGlobalLet + set_flags: [heap_inv] + + - name: LdObjByName + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: LdObjByName + static: true + exception: true + signature: + ret: any + args: [string_id, any, u16] + impl: panda::ecmascript::intrinsics::LdObjByName + fast_path: FastPathLdObjByName + set_flags: [heap_inv] + + - name: StObjByName + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: StObjByName + static: true + exception: true + signature: + ret: any + args: [string_id, any, acc, u16] + impl: panda::ecmascript::intrinsics::StObjByName + fast_path: FastPathStObjByName + set_flags: [heap_inv] + + - name: LdObjByIndex + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: LdObjByIndex + static: true + exception: true + signature: + ret: any + args: [u32, any] + impl: panda::ecmascript::intrinsics::LdObjByIndex + set_flags: [heap_inv] + + - name: StObjByIndex + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: StObjByIndex + static: true + exception: true + signature: + ret: any + args: [u32, any, acc] + impl: panda::ecmascript::intrinsics::StObjByIndex + set_flags: [heap_inv] + + - name: GetNextPropName + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: getnextpropname + static: true + exception: true + signature: + ret: any + args: [any] + impl: panda::ecmascript::intrinsics::GetNextPropName + set_flags: [heap_inv] + + - name: ReturnUndefined + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: ReturnUndefined + static: true + signature: + ret: void + args: [] + impl: panda::ecmascript::intrinsics::ReturnUndefined + + - name: Call0Dyn + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: Call0Dyn + static: true + exception: true + signature: + ret: any + args: [any] + impl: panda::ecmascript::intrinsics::Call0Dyn + set_flags: [heap_inv] + + - name: Call1Dyn + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: Call1Dyn + static: true + exception: true + signature: + ret: any + args: [any, any] + impl: panda::ecmascript::intrinsics::Call1Dyn + set_flags: [heap_inv] + + - name: Call2Dyn + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: Call2Dyn + static: true + exception: true + signature: + ret: any + args: [any, any, any] + impl: panda::ecmascript::intrinsics::Call2Dyn + set_flags: [heap_inv] + + - name: Call3Dyn + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: Call3Dyn + static: true + exception: true + signature: + ret: any + args: [any, any, any, any] + impl: panda::ecmascript::intrinsics::Call3Dyn + set_flags: [heap_inv] + + - name: CalliRangeDyn + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: CalliRangeDyn + static: true + exception: true + signature: + ret: any + args: [u16, any] + impl: panda::ecmascript::intrinsics::CalliRangeDyn + set_flags: [heap_inv] + + - name: CalliRangeDynInterp + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: CalliRangeDynInterp + static: true + exception: true + signature: + ret: any + args: [u16, any] + impl: panda::ecmascript::intrinsics::CalliRangeDynInterp + set_flags: [heap_inv] + + - name: CalliThisRangeDyn + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: CalliThisRangeDyn + static: true + exception: true + signature: + ret: any + args: [u16, any] + impl: panda::ecmascript::intrinsics::CalliThisRangeDyn + set_flags: [heap_inv] + + - name: CreateEmptyObject + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: createemptyobject + static: true + exception: true + signature: + ret: any + args: [] + impl: panda::ecmascript::intrinsics::CreateEmptyObject + clear_flags: [no_dce] + + - name: CreateObjectWithBuffer + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: createobjectwithbuffer + static: true + exception: true + signature: + ret: any + args: [u16] + impl: panda::ecmascript::intrinsics::CreateObjectWithBuffer + + - name: CopyDataProperties + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: copydataproperties + static: true + exception: true + signature: + ret: any + args: [any, any] + impl: panda::ecmascript::intrinsics::CopyDataProperties + set_flags: [heap_inv] + + - name: DefineGetterSetterByValue + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: definegettersetterbyvalue + static: true + exception: true + signature: + ret: any + args: [any, any, any, any, acc] + impl: panda::ecmascript::intrinsics::DefineGetterSetterByValue + set_flags: [heap_inv] + + - name: CreateEmptyArray + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: createemptyarray + static: true + exception: true + signature: + ret: any + args: [] + impl: panda::ecmascript::intrinsics::CreateEmptyArray + clear_flags: [no_dce] + + - name: CreateArrayWithBuffer + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: createarraywithbuffer + static: true + exception: true + signature: + ret: any + args: [u16] + impl: panda::ecmascript::intrinsics::CreateArrayWithBuffer + + - name: StOwnByName + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: StOwnByName + static: true + exception: true + signature: + ret: any + args: [string_id, any, acc] + impl: panda::ecmascript::intrinsics::StOwnByName + set_flags: [heap_inv] + + - name: StOwnByIndex + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: StOwnByIndex + static: true + exception: true + signature: + ret: any + args: [u32, any, acc] + impl: panda::ecmascript::intrinsics::StOwnByIndex + set_flags: [heap_inv] + + - name: StOwnByValue + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: StOwnByValue + static: true + exception: true + signature: + ret: any + args: [any, any, acc] + impl: panda::ecmascript::intrinsics::StOwnByValue + set_flags: [heap_inv] + + - name: StArraySpread + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: starrayspread + static: true + exception: true + signature: + ret: any + args: [any, any, acc] + impl: panda::ecmascript::intrinsics::StArraySpread + set_flags: [heap_inv] + + - name: GetIterator + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: GetIterator + static: true + exception: true + signature: + ret: any + args: [acc] + impl: panda::ecmascript::intrinsics::GetIterator + set_flags: [heap_inv] + + - name: GetAsyncIterator + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: GetAsyncIterator + static: true + exception: true + signature: + ret: any + args: [acc] + impl: panda::ecmascript::intrinsics::GetAsyncIterator + set_flags: [heap_inv] + + - name: ThrowIfNotObject + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: ThrowIfNotObject + static: true + exception: true + signature: + ret: any + args: [acc] + impl: panda::ecmascript::intrinsics::ThrowIfNotObject + + - name: ThrowThrowNotExists + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: ThrowThrowNotExists + static: true + exception: true + signature: + ret: void + args: [] + impl: panda::ecmascript::intrinsics::ThrowThrowNotExists + + - name: CreateObjectWithExcludedKeys + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: CreateObjectWithExcludedKeys + static: true + exception: true + range: true + signature: + ret: any + args: [u16, any, any] + impl: panda::ecmascript::intrinsics::CreateObjectWithExcludedKeys + + - name: ThrowPatternNonCoercible + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: ThrowPatternNonCoercible + static: true + exception: true + signature: + ret: void + args: [] + impl: panda::ecmascript::intrinsics::ThrowPatternNonCoercible + + - name: CloseIterator + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: CloseIterator + static: true + exception: true + signature: + ret: any + args: [any, acc] + impl: panda::ecmascript::intrinsics::CloseIterator + set_flags: [heap_inv] + + - name: ImportModule + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: ImportModule + static: true + exception: true + signature: + ret: any + args: [string_id] + impl: panda::ecmascript::intrinsics::ImportModule + clear_flags: [no_dce] + + - name: StModuleVar + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: StModuleVar + static: true + exception: true + signature: + ret: void + args: [string_id, acc] + impl: panda::ecmascript::intrinsics::StModuleVar + + - name: CopyModule + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: CopyModule + static: true + exception: true + signature: + ret: void + args: [any] + impl: panda::ecmascript::intrinsics::CopyModule + + - name: LdModvarByName + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: LdModvarByName + static: true + exception: true + signature: + ret: any + args: [string_id, any] + impl: panda::ecmascript::intrinsics::LdModvarByName + clear_flags: [no_dce] + set_flags: [heap_inv] + + - name: DefineClassWithBuffer + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: DefineClassWithBuffer + static: true + exception: true + signature: + ret: any + args: [method_id, u16, any, any] + impl: panda::ecmascript::intrinsics::DefineClassWithBuffer + + - name: SuperCall + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: SuperCall + static: true + exception: true + signature: + ret: any + args: [u16, any, any, acc] + impl: panda::ecmascript::intrinsics::SuperCall + set_flags: [heap_inv] + + - name: SuperCallSpread + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: SuperCallSpread + static: true + exception: true + signature: + ret: any + args: [any, any, acc] + impl: panda::ecmascript::intrinsics::SuperCallSpread + set_flags: [heap_inv] + + - name: DefineMethod + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: defineMethod + static: true + exception: true + signature: + ret: any + args: [method_id, any, acc] + impl: panda::ecmascript::intrinsics::DefineMethod + + - name: LdSuperByName + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: LdSuperByName + static: true + exception: true + signature: + ret: any + args: [string_id, any] + impl: panda::ecmascript::intrinsics::LdSuperByName + set_flags: [heap_inv] + + - name: StSuperByName + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: StSuperByName + static: true + exception: true + signature: + ret: any + args: [string_id, any, any] + impl: panda::ecmascript::intrinsics::StSuperByName + set_flags: [heap_inv] + + - name: StSuperByValue + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: StSuperByValue + static: true + exception: true + signature: + ret: any + args: [any, any, acc] + impl: panda::ecmascript::intrinsics::StSuperByValue + set_flags: [heap_inv] + + - name: LdSuperByValue + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: LdSuperByValue + static: true + exception: true + signature: + ret: any + args: [any, any] + impl: panda::ecmascript::intrinsics::LdSuperByValue + set_flags: [heap_inv] + + - name: CreateObjectHavingMethod + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: createobjecthavingmethod + static: true + exception: true + signature: + ret: any + args: [u16, acc] + impl: panda::ecmascript::intrinsics::CreateObjectHavingMethod + + - name: ThrowIfSuperNotCorrectCall + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: ThrowIfSuperNotCorrectCall + static: true + exception: true + signature: + ret: any + args: [u16, acc] + impl: panda::ecmascript::intrinsics::ThrowIfSuperNotCorrectCall + + - name: LdHomeObject + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: LdHomeObject + static: true + signature: + ret: any + args: [] + impl: panda::ecmascript::intrinsics::LdHomeObject + clear_flags: [no_dce] + + - name: SetObjectWithProto + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: setobjectwithproto + static: true + exception: true + signature: + ret: any + args: [any, any] + impl: panda::ecmascript::intrinsics::SetObjectWithProto + + - name: ThrowDeleteSuperProperty + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: ThrowDeleteSuperProperty + static: true + exception: true + signature: + ret: void + args: [] + impl: panda::ecmascript::intrinsics::ThrowDeleteSuperProperty + + - name: Debugger + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: debugger + static: true + signature: + ret: void + args: [] + impl: panda::ecmascript::intrinsics::Debugger + use_thread: false + + - name: NativeMethodWrapper + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: NativeMethodWrapper + static: true + exception: true + signature: + ret: void + args: [any] + impl: panda::ecmascript::intrinsics::NativeMethodWrapper + use_thread: false + + - name: GetObjectClassType + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: GetObjectClassType + static: true + codegen_func: GetObjectClassTypeIntrinsic + signature: + ret: u8 + args: [any] + impl: panda::ecmascript::intrinsics::GetObjectClassType + use_thread: false + clear_flags: [no_dce, barrier, require_state, runtime_call] + + - name: IsNan + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: IsNan + static: true + signature: + ret: any + args: [f64] + impl: panda::ecmascript::intrinsics::IsNan + use_thread: false + + - name: GetEcmaConstantPool + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: GetEcmaConstantPool + static: true + codegen_func: GetEcmaConstantPool + signature: + ret: any + args: [] + impl: panda::ecmascript::intrinsics::GetEcmaConstantPool + clear_flags: [no_dce, barrier, require_state, runtime_call] + + - name: GetEcmaThisFunc + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: GetEcmaThisFunc + static: true + codegen_func: GetEcmaThisFunc + signature: + ret: any + args: [] + impl: panda::ecmascript::intrinsics::GetEcmaThisFunc + clear_flags: [no_dce, barrier, require_state, runtime_call] + + - name: GetWeakReferent + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: GetWeakReferent + static: true + codegen_func: GetWeakReferent + signature: + ret: any + args: [any] + impl: panda::ecmascript::intrinsics::GetWeakReferent + use_thread: false + clear_flags: [no_dce, barrier, require_state, runtime_call] + + - name: DynClassIsDictionaryElement + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: DynClassIsDictionaryElement + static: true + signature: + ret: u1 + args: [any] + impl: panda::ecmascript::intrinsics::DynClassIsDictionaryElement + codegen_func: CreateDynClassIsDictionaryElement + use_thread: false + clear_flags: [no_dce, barrier, require_state, runtime_call] + + - name: DynClassIsExtensible + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: DynClassIsExtensible + static: true + signature: + ret: u1 + args: [any] + impl: panda::ecmascript::intrinsics::DynClassIsExtensible + codegen_func: CreateDynClassIsExtensible + use_thread: false + clear_flags: [no_dce, barrier, require_state, runtime_call] + + - name: DynObjectGetClass + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: DynObjectGetClass + static: true + signature: + ret: any + args: [any] + impl: panda::ecmascript::intrinsics::DynObjectGetClass + codegen_func: CreateDynObjectGetClass + use_thread: false + clear_flags: [no_dce, barrier, require_state, runtime_call] + + - name: DynObjectSetClass + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: DynObjectSetClass + static: true + signature: + ret: void + args: [any, any] + impl: panda::ecmascript::intrinsics::DynObjectSetClass + codegen_func: CreateDynObjectSetClass + use_thread: false + clear_flags: [require_state, runtime_call] + + - name: DynCallCheck + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: CreateDynCallCheck + static: true + signature: + ret: void + args: [any] + codegen_func: CreateDynCallCheck + use_thread: false + clear_flags: [] + + - name: DynClassNumberOfProps + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: DynClassNumberOfProps + static: true + signature: + ret: u32 + args: [any] + impl: panda::ecmascript::intrinsics::DynClassNumberOfProps + codegen_func: CreateDynClassNumberOfProps + use_thread: false + clear_flags: [no_dce, barrier, require_state, runtime_call] + + - name: DynClassGetHash + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: DynClassGetHash + static: true + signature: + ret: u32 + args: [any] + impl: panda::ecmascript::intrinsics::DynClassGetHash + codegen_func: CreateDynClassGetHash + use_thread: false + clear_flags: [no_dce, barrier, require_state, runtime_call] + + - name: LdObjDynByName + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: LdObjDynByName + static: true + signature: + ret: any + args: [any, any, u16] + impl: panda::ecmascript::intrinsics::LdObjDynByName + codegen_func: CreateLdObjDynByName + use_thread: false + is_fastpath: true + clear_flags: [barrier, require_state] + + - name: StObjDynByName + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: StObjDynByName + static: true + signature: + ret: any + args: [any, any, any, u16] + impl: panda::ecmascript::intrinsics::StObjDynByName + codegen_func: CreateStObjDynByName + use_thread: false + is_fastpath: true + clear_flags: [barrier, require_state] diff --git a/runtime/ecma_runtime_call_info.h b/runtime/ecma_runtime_call_info.h index 4098c4c01..d53c89602 100644 --- a/runtime/ecma_runtime_call_info.h +++ b/runtime/ecma_runtime_call_info.h @@ -29,10 +29,10 @@ using EcmaEntrypoint = JSTaggedValue (*)(EcmaRuntimeCallInfo *); class EcmaRuntimeCallInfo { public: - EcmaRuntimeCallInfo(JSThread *thread, uint32_t numArgs, JSTaggedValue *args) - : thread_(thread), args_(args), numArgs_(numArgs) + EcmaRuntimeCallInfo(JSThread *thread, uint32_t num_args, JSTaggedValue *args) + : thread_(thread), args_(args), num_args_(num_args) { - ASSERT(numArgs >= NUM_MANDATORY_JSFUNC_ARGS); + ASSERT(num_args >= NUM_MANDATORY_JSFUNC_ARGS); } ~EcmaRuntimeCallInfo() = default; @@ -90,12 +90,12 @@ public: */ inline uint32_t GetArgsNumber() const { - return numArgs_ - NUM_MANDATORY_JSFUNC_ARGS; + return num_args_ - NUM_MANDATORY_JSFUNC_ARGS; } inline uintptr_t GetArgAddress(uint32_t idx) const { - ASSERT(idx < numArgs_); + ASSERT(idx < num_args_); // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) return reinterpret_cast(&args_[idx]); } @@ -120,7 +120,7 @@ private: private: JSThread *thread_; JSTaggedValue *args_ {nullptr}; - uint32_t numArgs_; + uint32_t num_args_; }; } // namespace panda::ecmascript diff --git a/runtime/ecma_string-inl.h b/runtime/ecma_string-inl.h index 1bff12ab0..9c7deea79 100644 --- a/runtime/ecma_string-inl.h +++ b/runtime/ecma_string-inl.h @@ -47,48 +47,48 @@ inline EcmaString *EcmaString::CreateEmptyString(const EcmaVM *vm) } /* static */ -inline EcmaString *EcmaString::CreateFromUtf8(const uint8_t *utf8Data, uint32_t utf8Len, const EcmaVM *vm, - bool canBeCompress) +inline EcmaString *EcmaString::CreateFromUtf8(const uint8_t *utf8_data, uint32_t utf8_len, const EcmaVM *vm, + bool can_be_compress) { - if (utf8Len == 0) { + if (utf8_len == 0) { return vm->GetFactory()->GetEmptyString().GetObject(); } EcmaString *string = nullptr; - if (canBeCompress) { - string = AllocStringObject(utf8Len, true, vm); + if (can_be_compress) { + string = AllocStringObject(utf8_len, true, vm); ASSERT(string != nullptr); - if (memcpy_s(string->GetDataUtf8Writable(), utf8Len, utf8Data, utf8Len) != EOK) { + if (memcpy_s(string->GetDataUtf8Writable(), utf8_len, utf8_data, utf8_len) != EOK) { LOG_ECMA(FATAL) << "memcpy_s failed"; UNREACHABLE(); } } else { - auto utf16Len = base::utf_helper::Utf8ToUtf16Size(utf8Data, utf8Len); - string = AllocStringObject(utf16Len, false, vm); + auto utf16_len = base::utf_helper::Utf8ToUtf16Size(utf8_data, utf8_len); + string = AllocStringObject(utf16_len, false, vm); ASSERT(string != nullptr); - [[maybe_unused]] auto len = - base::utf_helper::ConvertRegionUtf8ToUtf16(utf8Data, string->GetDataUtf16Writable(), utf8Len, utf16Len, 0); - ASSERT(len == utf16Len); + [[maybe_unused]] auto len = base::utf_helper::ConvertRegionUtf8ToUtf16( + utf8_data, string->GetDataUtf16Writable(), utf8_len, utf16_len, 0); + ASSERT(len == utf16_len); } return string; } -inline EcmaString *EcmaString::CreateFromUtf16(const uint16_t *utf16Data, uint32_t utf16Len, const EcmaVM *vm, - bool canBeCompress) +inline EcmaString *EcmaString::CreateFromUtf16(const uint16_t *utf16_data, uint32_t utf16_len, const EcmaVM *vm, + bool can_be_compress) { - if (utf16Len == 0) { + if (utf16_len == 0) { return vm->GetFactory()->GetEmptyString().GetObject(); } - auto string = AllocStringObject(utf16Len, canBeCompress, vm); + auto string = AllocStringObject(utf16_len, can_be_compress, vm); ASSERT(string != nullptr); - if (canBeCompress) { - CopyUtf16AsUtf8(utf16Data, string->GetDataUtf8Writable(), utf16Len); + if (can_be_compress) { + CopyUtf16AsUtf8(utf16_data, string->GetDataUtf8Writable(), utf16_len); } else { - uint32_t len = utf16Len * (sizeof(uint16_t) / sizeof(uint8_t)); - if (memcpy_s(string->GetDataUtf16Writable(), len, utf16Data, len) != EOK) { + uint32_t len = utf16_len * (sizeof(uint16_t) / sizeof(uint8_t)); + if (memcpy_s(string->GetDataUtf16Writable(), len, utf16_data, len) != EOK) { LOG_ECMA(FATAL) << "memcpy_s failed"; UNREACHABLE(); } @@ -97,11 +97,11 @@ inline EcmaString *EcmaString::CreateFromUtf16(const uint16_t *utf16Data, uint32 return string; } -template +template inline uint16_t EcmaString::At(int32_t index) const { int32_t length = GetLength(); - if (verify) { + if (VERIFY) { if ((index < 0) || (index >= length)) { return 0; } @@ -124,12 +124,12 @@ inline EcmaString *EcmaString::AllocStringObject(size_t length, bool compressed, return reinterpret_cast(string); } -void EcmaString::WriteData(EcmaString *src, uint32_t start, uint32_t destSize, uint32_t length) +void EcmaString::WriteData(EcmaString *src, uint32_t start, uint32_t dest_size, uint32_t length) { if (IsUtf8()) { ASSERT(src->IsUtf8()); // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) - if (length != 0 && memcpy_s(GetDataUtf8Writable() + start, destSize, src->GetDataUtf8(), length) != EOK) { + if (length != 0 && memcpy_s(GetDataUtf8Writable() + start, dest_size, src->GetDataUtf8(), length) != EOK) { LOG_ECMA(FATAL) << "memcpy_s failed"; UNREACHABLE(); } @@ -142,8 +142,8 @@ void EcmaString::WriteData(EcmaString *src, uint32_t start, uint32_t destSize, u } } else { // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) - if (length != 0 && memcpy_s(GetDataUtf16Writable() + start, ComputeDataSizeUtf16(destSize), src->GetDataUtf16(), - ComputeDataSizeUtf16(length)) != EOK) { + if (length != 0 && memcpy_s(GetDataUtf16Writable() + start, ComputeDataSizeUtf16(dest_size), + src->GetDataUtf16(), ComputeDataSizeUtf16(length)) != EOK) { LOG_ECMA(FATAL) << "memcpy_s failed"; UNREACHABLE(); } diff --git a/runtime/ecma_string.cpp b/runtime/ecma_string.cpp index e50c20bea..d2cdf0c12 100644 --- a/runtime/ecma_string.cpp +++ b/runtime/ecma_string.cpp @@ -18,46 +18,46 @@ #include "plugins/ecmascript/runtime/js_symbol.h" namespace panda::ecmascript { -bool EcmaString::compressedStringsEnabled = true; +bool EcmaString::compressed_strings_enabled_ = true; static constexpr int SMALL_STRING_SIZE = 128; -EcmaString *EcmaString::Concat(const JSHandle &str1Handle, const JSHandle &str2Handle, +EcmaString *EcmaString::Concat(const JSHandle &str1_handle, const JSHandle &str2_handle, const EcmaVM *vm) { // allocator may trig gc and move src, need to hold it - EcmaString *string1 = *str1Handle; - EcmaString *string2 = *str2Handle; + EcmaString *string1 = *str1_handle; + EcmaString *string2 = *str2_handle; uint32_t length1 = string1->GetLength(); uint32_t length2 = string2->GetLength(); - uint32_t newLength = length1 + length2; - if (newLength == 0) { + uint32_t new_length = length1 + length2; + if (new_length == 0) { return vm->GetFactory()->GetEmptyString().GetObject(); } bool compressed = GetCompressedStringsEnabled() && (!string1->IsUtf16() && !string2->IsUtf16()); - auto newString = AllocStringObject(newLength, compressed, vm); + auto new_string = AllocStringObject(new_length, compressed, vm); // retrieve strings after gc - string1 = *str1Handle; - string2 = *str2Handle; + string1 = *str1_handle; + string2 = *str2_handle; if (compressed) { - Span sp(newString->GetDataUtf8Writable(), newLength); + Span sp(new_string->GetDataUtf8Writable(), new_length); Span src1(string1->GetDataUtf8(), length1); - EcmaString::StringCopy(sp, newLength, src1, length1); + EcmaString::StringCopy(sp, new_length, src1, length1); sp = sp.SubSpan(length1); Span src2(string2->GetDataUtf8(), length2); - EcmaString::StringCopy(sp, newLength - length1, src2, length2); + EcmaString::StringCopy(sp, new_length - length1, src2, length2); } else { - Span sp(newString->GetDataUtf16Writable(), newLength); + Span sp(new_string->GetDataUtf16Writable(), new_length); if (!string1->IsUtf16()) { for (uint32_t i = 0; i < length1; ++i) { sp[i] = string1->At(i); } } else { Span src1(string1->GetDataUtf16(), length1); - EcmaString::StringCopy(sp, newLength << 1U, src1, length1 << 1U); + EcmaString::StringCopy(sp, new_length << 1U, src1, length1 << 1U); } sp = sp.SubSpan(length1); if (!string2->IsUtf16()) { @@ -71,48 +71,48 @@ EcmaString *EcmaString::Concat(const JSHandle &str1Handle, const JSH } } - return newString; + return new_string; } /* static */ -EcmaString *EcmaString::FastSubString(const JSHandle &src, uint32_t start, uint32_t utf16Len, +EcmaString *EcmaString::FastSubString(const JSHandle &src, uint32_t start, uint32_t utf16_len, const EcmaVM *vm) { - if (utf16Len == 0) { + if (utf16_len == 0) { return vm->GetFactory()->GetEmptyString().GetObject(); } // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) - bool canBeCompressed = !src->IsUtf16(); + bool can_be_compressed = !src->IsUtf16(); // allocator may trig gc and move src, need to hold it - auto string = AllocStringObject(utf16Len, canBeCompressed, vm); + auto string = AllocStringObject(utf16_len, can_be_compressed, vm); if (src->IsUtf16()) { - if (canBeCompressed) { + if (can_be_compressed) { // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) - CopyUtf16AsUtf8(src->GetDataUtf16() + start, string->GetDataUtf8Writable(), utf16Len); + CopyUtf16AsUtf8(src->GetDataUtf16() + start, string->GetDataUtf8Writable(), utf16_len); } else { - uint32_t len = utf16Len * (sizeof(uint16_t) / sizeof(uint8_t)); - Span dst(string->GetDataUtf16Writable(), utf16Len); + uint32_t len = utf16_len * (sizeof(uint16_t) / sizeof(uint8_t)); + Span dst(string->GetDataUtf16Writable(), utf16_len); // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) - Span source(src->GetDataUtf16() + start, utf16Len); + Span source(src->GetDataUtf16() + start, utf16_len); EcmaString::StringCopy(dst, len, source, len); } } else { - Span dst(string->GetDataUtf8Writable(), utf16Len); + Span dst(string->GetDataUtf8Writable(), utf16_len); // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) - Span source(src->GetDataUtf8() + start, utf16Len); - EcmaString::StringCopy(dst, utf16Len, source, utf16Len); + Span source(src->GetDataUtf8() + start, utf16_len); + EcmaString::StringCopy(dst, utf16_len, source, utf16_len); } return string; } template -int32_t CompareStringSpan(Span &lhsSp, Span &rhsSp, int32_t count) +int32_t CompareStringSpan(Span &lhs_sp, Span &rhs_sp, int32_t count) { for (int32_t i = 0; i < count; ++i) { - auto left = static_cast(lhsSp[i]); - auto right = static_cast(rhsSp[i]); + auto left = static_cast(lhs_sp[i]); + auto right = static_cast(rhs_sp[i]); if (left != right) { return left - right; } @@ -126,62 +126,62 @@ int32_t EcmaString::Compare(const EcmaString *rhs) const if (lhs == rhs) { return 0; } - int32_t lhsCount = lhs->GetLength(); - int32_t rhsCount = rhs->GetLength(); - int32_t countDiff = lhsCount - rhsCount; - int32_t minCount = (countDiff < 0) ? lhsCount : rhsCount; + int32_t lhs_count = lhs->GetLength(); + int32_t rhs_count = rhs->GetLength(); + int32_t count_diff = lhs_count - rhs_count; + int32_t min_count = (count_diff < 0) ? lhs_count : rhs_count; if (!lhs->IsUtf16() && !rhs->IsUtf16()) { - Span lhsSp(lhs->GetDataUtf8(), lhsCount); - Span rhsSp(rhs->GetDataUtf8(), rhsCount); - int32_t charDiff = CompareStringSpan(lhsSp, rhsSp, minCount); - if (charDiff != 0) { - return charDiff; + Span lhs_sp(lhs->GetDataUtf8(), lhs_count); + Span rhs_sp(rhs->GetDataUtf8(), rhs_count); + int32_t char_diff = CompareStringSpan(lhs_sp, rhs_sp, min_count); + if (char_diff != 0) { + return char_diff; } } else if (!lhs->IsUtf16()) { - Span lhsSp(lhs->GetDataUtf8(), lhsCount); - Span rhsSp(rhs->GetDataUtf16(), rhsCount); - int32_t charDiff = CompareStringSpan(lhsSp, rhsSp, minCount); - if (charDiff != 0) { - return charDiff; + Span lhs_sp(lhs->GetDataUtf8(), lhs_count); + Span rhs_sp(rhs->GetDataUtf16(), rhs_count); + int32_t char_diff = CompareStringSpan(lhs_sp, rhs_sp, min_count); + if (char_diff != 0) { + return char_diff; } } else if (!rhs->IsUtf16()) { - Span lhsSp(lhs->GetDataUtf16(), rhsCount); - Span rhsSp(rhs->GetDataUtf8(), lhsCount); - int32_t charDiff = CompareStringSpan(lhsSp, rhsSp, minCount); - if (charDiff != 0) { - return charDiff; + Span lhs_sp(lhs->GetDataUtf16(), rhs_count); + Span rhs_sp(rhs->GetDataUtf8(), lhs_count); + int32_t char_diff = CompareStringSpan(lhs_sp, rhs_sp, min_count); + if (char_diff != 0) { + return char_diff; } } else { - Span lhsSp(lhs->GetDataUtf16(), lhsCount); - Span rhsSp(rhs->GetDataUtf16(), rhsCount); - int32_t charDiff = CompareStringSpan(lhsSp, rhsSp, minCount); - if (charDiff != 0) { - return charDiff; + Span lhs_sp(lhs->GetDataUtf16(), lhs_count); + Span rhs_sp(rhs->GetDataUtf16(), rhs_count); + int32_t char_diff = CompareStringSpan(lhs_sp, rhs_sp, min_count); + if (char_diff != 0) { + return char_diff; } } - return countDiff; + return count_diff; } /* static */ template -int32_t EcmaString::IndexOf(Span &lhsSp, Span &rhsSp, int32_t pos, int32_t max) +int32_t EcmaString::IndexOf(Span &lhs_sp, Span &rhs_sp, int32_t pos, int32_t max) { - ASSERT(!rhsSp.empty()); - auto first = static_cast(rhsSp[0]); + ASSERT(!rhs_sp.empty()); + auto first = static_cast(rhs_sp[0]); int32_t i; for (i = pos; i <= max; i++) { - if (static_cast(lhsSp[i]) != first) { + if (static_cast(lhs_sp[i]) != first) { i++; - while (i <= max && static_cast(lhsSp[i]) != first) { + while (i <= max && static_cast(lhs_sp[i]) != first) { i++; } } - /* Found first character, now look at the rest of rhsSp */ + /* Found first character, now look at the rest of rhs_sp */ if (i <= max) { int j = i + 1; - int end = j + rhsSp.size() - 1; + int end = j + rhs_sp.size() - 1; - for (int k = 1; j < end && static_cast(lhsSp[j]) == static_cast(rhsSp[k]); j++, k++) { + for (int k = 1; j < end && static_cast(lhs_sp[j]) == static_cast(rhs_sp[k]); j++, k++) { } if (j == end) { /* Found whole string. */ @@ -198,14 +198,14 @@ int32_t EcmaString::IndexOf(const EcmaString *rhs, int32_t pos) const return -1; } const EcmaString *lhs = this; - int32_t lhsCount = lhs->GetLength(); - int32_t rhsCount = rhs->GetLength(); + int32_t lhs_count = lhs->GetLength(); + int32_t rhs_count = rhs->GetLength(); - if (pos > lhsCount) { + if (pos > lhs_count) { return -1; } - if (rhsCount == 0) { + if (rhs_count == 0) { return pos; } @@ -213,75 +213,75 @@ int32_t EcmaString::IndexOf(const EcmaString *rhs, int32_t pos) const pos = 0; } - int32_t max = lhsCount - rhsCount; + int32_t max = lhs_count - rhs_count; if (max < 0) { return -1; } if (rhs->IsUtf8() && lhs->IsUtf8()) { - Span lhsSp(lhs->GetDataUtf8(), lhsCount); - Span rhsSp(rhs->GetDataUtf8(), rhsCount); - return EcmaString::IndexOf(lhsSp, rhsSp, pos, max); + Span lhs_sp(lhs->GetDataUtf8(), lhs_count); + Span rhs_sp(rhs->GetDataUtf8(), rhs_count); + return EcmaString::IndexOf(lhs_sp, rhs_sp, pos, max); } if (rhs->IsUtf16() && lhs->IsUtf16()) { // NOLINT(readability-else-after-return) - Span lhsSp(lhs->GetDataUtf16(), lhsCount); - Span rhsSp(rhs->GetDataUtf16(), rhsCount); - return EcmaString::IndexOf(lhsSp, rhsSp, pos, max); + Span lhs_sp(lhs->GetDataUtf16(), lhs_count); + Span rhs_sp(rhs->GetDataUtf16(), rhs_count); + return EcmaString::IndexOf(lhs_sp, rhs_sp, pos, max); } if (rhs->IsUtf16()) { - Span lhsSp(lhs->GetDataUtf8(), lhsCount); - Span rhsSp(rhs->GetDataUtf16(), rhsCount); - return EcmaString::IndexOf(lhsSp, rhsSp, pos, max); + Span lhs_sp(lhs->GetDataUtf8(), lhs_count); + Span rhs_sp(rhs->GetDataUtf16(), rhs_count); + return EcmaString::IndexOf(lhs_sp, rhs_sp, pos, max); } - Span lhsSp(lhs->GetDataUtf16(), lhsCount); - Span rhsSp(rhs->GetDataUtf8(), rhsCount); - return EcmaString::IndexOf(lhsSp, rhsSp, pos, max); + Span lhs_sp(lhs->GetDataUtf16(), lhs_count); + Span rhs_sp(rhs->GetDataUtf8(), rhs_count); + return EcmaString::IndexOf(lhs_sp, rhs_sp, pos, max); return -1; } // static -bool EcmaString::CanBeCompressed(const uint8_t *utf8Data, uint32_t utf8Len) +bool EcmaString::CanBeCompressed(const uint8_t *utf8_data, uint32_t utf8_len) { - if (!compressedStringsEnabled) { + if (!compressed_strings_enabled_) { return false; } - bool isCompressed = true; + bool is_compressed = true; uint32_t index = 0; // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) - while (index < utf8Len) { + while (index < utf8_len) { // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) - if (!IsASCIICharacter(utf8Data[index])) { - isCompressed = false; + if (!IsASCIICharacter(utf8_data[index])) { + is_compressed = false; break; } ++index; } - return isCompressed; + return is_compressed; } /* static */ -bool EcmaString::CanBeCompressed(const uint16_t *utf16Data, uint32_t utf16Len) +bool EcmaString::CanBeCompressed(const uint16_t *utf16_data, uint32_t utf16_len) { - if (!compressedStringsEnabled) { + if (!compressed_strings_enabled_) { return false; } - bool isCompressed = true; - Span data(utf16Data, utf16Len); - for (uint32_t i = 0; i < utf16Len; i++) { + bool is_compressed = true; + Span data(utf16_data, utf16_len); + for (uint32_t i = 0; i < utf16_len; i++) { if (!IsASCIICharacter(data[i])) { - isCompressed = false; + is_compressed = false; break; } } - return isCompressed; + return is_compressed; } /* static */ -void EcmaString::CopyUtf16AsUtf8(const uint16_t *utf16From, uint8_t *utf8To, uint32_t utf16Len) +void EcmaString::CopyUtf16AsUtf8(const uint16_t *utf16_from, uint8_t *utf8_to, uint32_t utf16_len) { - Span from(utf16From, utf16Len); - Span to(utf8To, utf16Len); - for (uint32_t i = 0; i < utf16Len; i++) { + Span from(utf16_from, utf16_len); + Span to(utf8_to, utf16_len); + for (uint32_t i = 0; i < utf16_len; i++) { to[i] = from[i]; } } @@ -305,36 +305,36 @@ bool EcmaString::StringsAreEqual(EcmaString *str1, EcmaString *str2) } /* static */ -bool EcmaString::StringsAreEqualUtf8(const EcmaString *str1, const uint8_t *utf8Data, uint32_t utf8Len, - bool canBeCompress) +bool EcmaString::StringsAreEqualUtf8(const EcmaString *str1, const uint8_t *utf8_data, uint32_t utf8_len, + bool can_be_compress) { - if (canBeCompress != str1->IsUtf8()) { + if (can_be_compress != str1->IsUtf8()) { return false; } - if (canBeCompress && str1->GetLength() != utf8Len) { + if (can_be_compress && str1->GetLength() != utf8_len) { return false; } - if (canBeCompress) { - Span data1(str1->GetDataUtf8(), utf8Len); - Span data2(utf8Data, utf8Len); + if (can_be_compress) { + Span data1(str1->GetDataUtf8(), utf8_len); + Span data2(utf8_data, utf8_len); return EcmaString::StringsAreEquals(data1, data2); } - return IsUtf8EqualsUtf16(utf8Data, utf8Len, str1->GetDataUtf16(), str1->GetLength()); + return IsUtf8EqualsUtf16(utf8_data, utf8_len, str1->GetDataUtf16(), str1->GetLength()); } /* static */ -bool EcmaString::StringsAreEqualUtf16(const EcmaString *str1, const uint16_t *utf16Data, uint32_t utf16Len) +bool EcmaString::StringsAreEqualUtf16(const EcmaString *str1, const uint16_t *utf16_data, uint32_t utf16_len) { bool result = false; - if (str1->GetLength() != utf16Len) { + if (str1->GetLength() != utf16_len) { result = false; } else if (!str1->IsUtf16()) { - result = IsUtf8EqualsUtf16(str1->GetDataUtf8(), str1->GetLength(), utf16Data, utf16Len); + result = IsUtf8EqualsUtf16(str1->GetDataUtf8(), str1->GetLength(), utf16_data, utf16_len); } else { Span data1(str1->GetDataUtf16(), str1->GetLength()); - Span data2(utf16Data, utf16Len); + Span data2(utf16_data, utf16_len); result = EcmaString::StringsAreEquals(data1, data2); } return result; @@ -358,9 +358,9 @@ bool EcmaString::StringsAreEquals(Span &str1, Span &str2) } template -bool EcmaString::StringCopy(Span &dst, size_t dstMax, Span &src, size_t count) +bool EcmaString::StringCopy(Span &dst, size_t dst_max, Span &src, size_t count) { - ASSERT(dstMax >= count); + ASSERT(dst_max >= count); ASSERT(dst.Size() >= src.Size()); if (src.Size() < SMALL_STRING_SIZE) { for (size_t i = 0; i < src.Size(); i++) { @@ -368,22 +368,22 @@ bool EcmaString::StringCopy(Span &dst, size_t dstMax, Span &src, siz } return true; } - if (memcpy_s(dst.data(), dstMax, src.data(), count) != EOK) { + if (memcpy_s(dst.data(), dst_max, src.data(), count) != EOK) { LOG_ECMA(FATAL) << "memcpy_s failed"; UNREACHABLE(); } return true; } -static int32_t ComputeHashForUtf8(const uint8_t *utf8Data, size_t utf8Len) +static int32_t ComputeHashForUtf8(const uint8_t *utf8_data, size_t utf8_len) { - if (utf8Data == nullptr) { + if (utf8_data == nullptr) { return 0; } uint32_t hash = 0; - while (utf8Len-- > 0) { + while (utf8_len-- > 0) { constexpr size_t SHIFT = 5; - hash = (hash << SHIFT) - hash + *utf8Data++; // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic) + hash = (hash << SHIFT) - hash + *utf8_data++; // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic) } return static_cast(hash); } @@ -391,7 +391,7 @@ static int32_t ComputeHashForUtf8(const uint8_t *utf8Data, size_t utf8Len) uint32_t EcmaString::ComputeHashcode() const { uint32_t hash; - if (compressedStringsEnabled) { + if (compressed_strings_enabled_) { if (!IsUtf16()) { hash = ComputeHashForData(GetDataUtf8(), GetLength()); } else { @@ -405,42 +405,43 @@ uint32_t EcmaString::ComputeHashcode() const } /* static */ -uint32_t EcmaString::ComputeHashcodeUtf8(const uint8_t *utf8Data, size_t utf8Len, bool canBeCompress) +uint32_t EcmaString::ComputeHashcodeUtf8(const uint8_t *utf8_data, size_t utf8_len, bool can_be_compress) { uint32_t hash; - if (canBeCompress) { - hash = ComputeHashForUtf8(utf8Data, utf8Len); + if (can_be_compress) { + hash = ComputeHashForUtf8(utf8_data, utf8_len); } else { - auto utf16Len = base::utf_helper::Utf8ToUtf16Size(utf8Data, utf8Len); - PandaVector tmpBuffer(utf16Len); + auto utf16_len = base::utf_helper::Utf8ToUtf16Size(utf8_data, utf8_len); + PandaVector tmp_buffer(utf16_len); [[maybe_unused]] auto len = - base::utf_helper::ConvertRegionUtf8ToUtf16(utf8Data, tmpBuffer.data(), utf8Len, utf16Len, 0); - ASSERT(len == utf16Len); - hash = ComputeHashForData(tmpBuffer.data(), utf16Len); + base::utf_helper::ConvertRegionUtf8ToUtf16(utf8_data, tmp_buffer.data(), utf8_len, utf16_len, 0); + ASSERT(len == utf16_len); + hash = ComputeHashForData(tmp_buffer.data(), utf16_len); } return hash; } /* static */ -uint32_t EcmaString::ComputeHashcodeUtf16(const uint16_t *utf16Data, uint32_t length) +uint32_t EcmaString::ComputeHashcodeUtf16(const uint16_t *utf16_data, uint32_t length) { - return ComputeHashForData(utf16Data, length); + return ComputeHashForData(utf16_data, length); } /* static */ -bool EcmaString::IsUtf8EqualsUtf16(const uint8_t *utf8Data, size_t utf8Len, const uint16_t *utf16Data, - uint32_t utf16Len) +bool EcmaString::IsUtf8EqualsUtf16(const uint8_t *utf8_data, size_t utf8_len, const uint16_t *utf16_data, + uint32_t utf16_len) { - // length is one more than compared utf16Data, don't need convert all utf8Data to utf16Data - uint32_t utf8ConvertLength = utf16Len + 1; - PandaVector tmpBuffer(utf8ConvertLength); - auto len = base::utf_helper::ConvertRegionUtf8ToUtf16(utf8Data, tmpBuffer.data(), utf8Len, utf8ConvertLength, 0); - if (len != utf16Len) { + // length is one more than compared utf16_data, don't need convert all utf8_data to utf16_data + uint32_t utf8_convert_length = utf16_len + 1; + PandaVector tmp_buffer(utf8_convert_length); + auto len = + base::utf_helper::ConvertRegionUtf8ToUtf16(utf8_data, tmp_buffer.data(), utf8_len, utf8_convert_length, 0); + if (len != utf16_len) { return false; } - Span data1(tmpBuffer.data(), len); - Span data2(utf16Data, utf16Len); + Span data1(tmp_buffer.data(), len); + Span data2(utf16_data, utf16_len); return EcmaString::StringsAreEquals(data1, data2); } } // namespace panda::ecmascript diff --git a/runtime/ecma_string.h b/runtime/ecma_string.h index b49a488bb..431a118d3 100644 --- a/runtime/ecma_string.h +++ b/runtime/ecma_string.h @@ -53,12 +53,13 @@ public: static const EcmaString *ConstCast(const TaggedObject *object); static EcmaString *CreateEmptyString(const EcmaVM *vm); - static EcmaString *CreateFromUtf8(const uint8_t *utf8Data, uint32_t utf8Len, const EcmaVM *vm, bool canBeCompress); - static EcmaString *CreateFromUtf16(const uint16_t *utf16Data, uint32_t utf16Len, const EcmaVM *vm, - bool canBeCompress); - static EcmaString *Concat(const JSHandle &str1Handle, const JSHandle &str2Handle, + static EcmaString *CreateFromUtf8(const uint8_t *utf8_data, uint32_t utf8_len, const EcmaVM *vm, + bool can_be_compress); + static EcmaString *CreateFromUtf16(const uint16_t *utf16_data, uint32_t utf16_len, const EcmaVM *vm, + bool can_be_compress); + static EcmaString *Concat(const JSHandle &str1_handle, const JSHandle &str2_handle, const EcmaVM *vm); - static EcmaString *FastSubString(const JSHandle &src, uint32_t start, uint32_t utf16Len, + static EcmaString *FastSubString(const JSHandle &src, uint32_t start, uint32_t utf16_len, const EcmaVM *vm); static constexpr uint32_t STRING_COMPRESSED_BIT = 0x1; @@ -68,19 +69,19 @@ public: STRING_UNCOMPRESSED, }; - template + template uint16_t At(int32_t index) const; int32_t Compare(const EcmaString *rhs) const; bool IsUtf16() const { - return compressedStringsEnabled ? ((GetMixLength() & STRING_COMPRESSED_BIT) == STRING_UNCOMPRESSED) : true; + return compressed_strings_enabled_ ? ((GetMixLength() & STRING_COMPRESSED_BIT) == STRING_UNCOMPRESSED) : true; } bool IsUtf8() const { - return compressedStringsEnabled ? ((GetMixLength() & STRING_COMPRESSED_BIT) == STRING_COMPRESSED) : false; + return compressed_strings_enabled_ ? ((GetMixLength() & STRING_COMPRESSED_BIT) == STRING_COMPRESSED) : false; } static size_t ComputeDataSizeUtf16(uint32_t length) @@ -91,9 +92,9 @@ public: /** * Methods for uncompressed strings (UTF16): */ - static size_t ComputeSizeUtf16(uint32_t utf16Len) + static size_t ComputeSizeUtf16(uint32_t utf16_len) { - return DATA_OFFSET + ComputeDataSizeUtf16(utf16Len); + return DATA_OFFSET + ComputeDataSizeUtf16(utf16_len); } inline uint16_t *GetData() const @@ -110,9 +111,9 @@ public: /** * Methods for compresses strings (UTF8 or LATIN1): */ - static size_t ComputeSizeUtf8(uint32_t utf8Len) + static size_t ComputeSizeUtf8(uint32_t utf8_len) { - return DATA_OFFSET + utf8Len; + return DATA_OFFSET + utf8_len; } /** @@ -137,17 +138,17 @@ public: return GetLength(); } - inline size_t CopyDataUtf8(uint8_t *buf, size_t maxLength) const + inline size_t CopyDataUtf8(uint8_t *buf, size_t max_length) const { - ASSERT(maxLength > 0); + ASSERT(max_length > 0); // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) - buf[maxLength - 1] = '\0'; - return CopyDataRegionUtf8(buf, 0, GetLength(), maxLength) + 1; // add place for zero in the end + buf[max_length - 1] = '\0'; + return CopyDataRegionUtf8(buf, 0, GetLength(), max_length) + 1; // add place for zero in the end } - size_t CopyDataRegionUtf8(uint8_t *buf, size_t start, size_t length, size_t maxLength) const + size_t CopyDataRegionUtf8(uint8_t *buf, size_t start, size_t length, size_t max_length) const { - if (length > maxLength) { + if (length > max_length) { return 0; } uint32_t len = GetLength(); @@ -160,23 +161,23 @@ public: UNREACHABLE(); } // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) - if (memcpy_s(buf, maxLength, GetDataUtf8() + start, length) != EOK) { + if (memcpy_s(buf, max_length, GetDataUtf8() + start, length) != EOK) { LOG(FATAL, RUNTIME) << "memcpy_s failed"; UNREACHABLE(); } return length; } - return base::utf_helper::ConvertRegionUtf16ToUtf8(GetDataUtf16(), buf, length, maxLength - 1, start); + return base::utf_helper::ConvertRegionUtf16ToUtf8(GetDataUtf16(), buf, length, max_length - 1, start); } - inline uint32_t CopyDataUtf16(uint16_t *buf, uint32_t maxLength) const + inline uint32_t CopyDataUtf16(uint16_t *buf, uint32_t max_length) const { - return CopyDataRegionUtf16(buf, 0, GetLength(), maxLength); + return CopyDataRegionUtf16(buf, 0, GetLength(), max_length); } - uint32_t CopyDataRegionUtf16(uint16_t *buf, uint32_t start, uint32_t length, uint32_t maxLength) const + uint32_t CopyDataRegionUtf16(uint16_t *buf, uint32_t start, uint32_t length, uint32_t max_length) const { - if (length > maxLength) { + if (length > max_length) { return 0; } uint32_t len = GetLength(); @@ -185,14 +186,14 @@ public: } if (IsUtf16()) { // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) - if (memcpy_s(buf, ComputeDataSizeUtf16(maxLength), GetDataUtf16() + start, ComputeDataSizeUtf16(length)) != + if (memcpy_s(buf, ComputeDataSizeUtf16(max_length), GetDataUtf16() + start, ComputeDataSizeUtf16(length)) != EOK) { LOG(FATAL, RUNTIME) << "memcpy_s failed"; UNREACHABLE(); } return length; } - return base::utf_helper::ConvertRegionUtf8ToUtf16(GetDataUtf8(), buf, len, maxLength, start); + return base::utf_helper::ConvertRegionUtf8ToUtf16(GetDataUtf8(), buf, len, max_length, start); } // NOLINTNEXTLINE(modernize-avoid-c-arrays) @@ -205,7 +206,7 @@ public: return std::unique_ptr(buf); } - inline void WriteData(EcmaString *src, uint32_t start, uint32_t destSize, uint32_t length); + inline void WriteData(EcmaString *src, uint32_t start, uint32_t dest_size, uint32_t length); inline void WriteData(char src, uint32_t start); uint32_t GetLength() const { @@ -252,29 +253,29 @@ public: /** * Compares strings by bytes, It doesn't check canonical unicode equivalence. */ - static bool StringsAreEqualUtf8(const EcmaString *str1, const uint8_t *utf8Data, uint32_t utf8Len, - bool canBeCompress); + static bool StringsAreEqualUtf8(const EcmaString *str1, const uint8_t *utf8_data, uint32_t utf8_len, + bool can_be_compress); /** * Compares strings by bytes, It doesn't check canonical unicode equivalence. */ - static bool StringsAreEqualUtf16(const EcmaString *str1, const uint16_t *utf16Data, uint32_t utf16Len); - static uint32_t ComputeHashcodeUtf8(const uint8_t *utf8Data, size_t utf8Len, bool canBeCompress); - static uint32_t ComputeHashcodeUtf16(const uint16_t *utf16Data, uint32_t length); + static bool StringsAreEqualUtf16(const EcmaString *str1, const uint16_t *utf16_data, uint32_t utf16_len); + static uint32_t ComputeHashcodeUtf8(const uint8_t *utf8_data, size_t utf8_len, bool can_be_compress); + static uint32_t ComputeHashcodeUtf16(const uint16_t *utf16_data, uint32_t length); static void SetCompressedStringsEnabled(bool val) { - compressedStringsEnabled = val; + compressed_strings_enabled_ = val; } static bool GetCompressedStringsEnabled() { - return compressedStringsEnabled; + return compressed_strings_enabled_; } static EcmaString *AllocStringObject(size_t length, bool compressed, const EcmaVM *vm); - static bool CanBeCompressed(const uint8_t *utf8Data, uint32_t utf8Len); - static bool CanBeCompressed(const uint16_t *utf16Data, uint32_t utf16Len); + static bool CanBeCompressed(const uint8_t *utf8_data, uint32_t utf8_len); + static bool CanBeCompressed(const uint16_t *utf16_data, uint32_t utf16_len); static constexpr size_t MIX_LENGTH_OFFSET = TaggedObjectSize(); // In last bit of mix_length we store if this string is compressed or not. @@ -305,9 +306,9 @@ private: } uint32_t ComputeHashcode() const; - static void CopyUtf16AsUtf8(const uint16_t *utf16From, uint8_t *utf8To, uint32_t utf16Len); + static void CopyUtf16AsUtf8(const uint16_t *utf16_from, uint8_t *utf8_to, uint32_t utf16_len); - static bool compressedStringsEnabled; + static bool compressed_strings_enabled_; static bool IsASCIICharacter(uint16_t data) { @@ -319,8 +320,8 @@ private: * str1 should have the same length as utf16_data. * Converts utf8Data to utf16 and compare it with given utf16_data. */ - static bool IsUtf8EqualsUtf16(const uint8_t *utf8Data, size_t utf8Len, const uint16_t *utf16Data, - uint32_t utf16Len); + static bool IsUtf8EqualsUtf16(const uint8_t *utf8_data, size_t utf8_len, const uint16_t *utf16_data, + uint32_t utf16_len); template /** @@ -332,10 +333,10 @@ private: /** * Copy String from src to dst * */ - static bool StringCopy(Span &dst, size_t dstMax, Span &src, size_t count); + static bool StringCopy(Span &dst, size_t dst_max, Span &src, size_t count); template - static int32_t IndexOf(Span &lhsSp, Span &rhsSp, int32_t pos, int32_t max); + static int32_t IndexOf(Span &lhs_sp, Span &rhs_sp, int32_t pos, int32_t max); }; } // namespace panda::ecmascript #endif // ECMASCRIPT_STRING_H diff --git a/runtime/ecma_string_table.cpp b/runtime/ecma_string_table.cpp index 6b754c340..790cdf08d 100644 --- a/runtime/ecma_string_table.cpp +++ b/runtime/ecma_string_table.cpp @@ -24,27 +24,27 @@ namespace panda::ecmascript { EcmaStringTable::EcmaStringTable(const EcmaVM *vm) : vm_(vm) {} -EcmaString *EcmaStringTable::GetString(const uint8_t *utf8Data, uint32_t utf8Len, bool canBeCompress) const +EcmaString *EcmaStringTable::GetString(const uint8_t *utf8_data, uint32_t utf8_len, bool can_be_compress) const { - uint32_t hashCode = EcmaString::ComputeHashcodeUtf8(utf8Data, utf8Len, canBeCompress); + uint32_t hash_code = EcmaString::ComputeHashcodeUtf8(utf8_data, utf8_len, can_be_compress); os::memory::ReadLockHolder holder(table_lock_); - for (auto it = table_.find(hashCode); it != table_.end(); it++) { - auto foundedString = it->second; - if (EcmaString::StringsAreEqualUtf8(foundedString, utf8Data, utf8Len, canBeCompress)) { - return foundedString; + for (auto it = table_.find(hash_code); it != table_.end(); it++) { + auto founded_string = it->second; + if (EcmaString::StringsAreEqualUtf8(founded_string, utf8_data, utf8_len, can_be_compress)) { + return founded_string; } } return nullptr; } -EcmaString *EcmaStringTable::GetString(const uint16_t *utf16Data, uint32_t utf16Len) const +EcmaString *EcmaStringTable::GetString(const uint16_t *utf16_data, uint32_t utf16_len) const { - uint32_t hashCode = EcmaString::ComputeHashcodeUtf16(const_cast(utf16Data), utf16Len); + uint32_t hash_code = EcmaString::ComputeHashcodeUtf16(const_cast(utf16_data), utf16_len); os::memory::ReadLockHolder holder(table_lock_); - for (auto it = table_.find(hashCode); it != table_.end(); it++) { - auto foundedString = it->second; - if (EcmaString::StringsAreEqualUtf16(foundedString, utf16Data, utf16Len)) { - return foundedString; + for (auto it = table_.find(hash_code); it != table_.end(); it++) { + auto founded_string = it->second; + if (EcmaString::StringsAreEqualUtf16(founded_string, utf16_data, utf16_len)) { + return founded_string; } } return nullptr; @@ -55,9 +55,9 @@ EcmaString *EcmaStringTable::GetString(EcmaString *string) const auto hash = string->GetHashcode(); os::memory::ReadLockHolder holder(table_lock_); for (auto it = table_.find(hash); it != table_.end(); it++) { - auto foundedString = it->second; - if (EcmaString::StringsAreEqual(foundedString, string)) { - return foundedString; + auto founded_string = it->second; + if (EcmaString::StringsAreEqual(founded_string, string)) { + return founded_string; } } return nullptr; @@ -65,14 +65,14 @@ EcmaString *EcmaStringTable::GetString(EcmaString *string) const ObjectHeader *EcmaStringTable::ResolveString(const panda_file::File &pf, panda_file::File::EntityId id) { - auto foundStr = pf.GetStringData(id); + auto found_str = pf.GetStringData(id); const auto factory = vm_->GetFactory(); - if (UNLIKELY(foundStr.utf16_length == 0)) { + if (UNLIKELY(found_str.utf16_length == 0)) { return *(factory->GetEmptyString()); } - return EcmaString::Cast(this->GetOrInternString(foundStr.data, foundStr.utf16_length, foundStr.is_ascii)); + return EcmaString::Cast(this->GetOrInternString(found_str.data, found_str.utf16_length, found_str.is_ascii)); } void EcmaStringTable::InternString(EcmaString *string) @@ -90,26 +90,26 @@ void EcmaStringTable::InternEmptyString(EcmaString *emptyStr) InternString(emptyStr); } -EcmaString *EcmaStringTable::GetOrInternString(const uint8_t *utf8Data, uint32_t utf8Len, bool canBeCompress) +EcmaString *EcmaStringTable::GetOrInternString(const uint8_t *utf8_data, uint32_t utf8_len, bool can_be_compress) { - EcmaString *result = GetString(utf8Data, utf8Len, canBeCompress); + EcmaString *result = GetString(utf8_data, utf8_len, can_be_compress); if (result != nullptr) { return result; } - result = EcmaString::CreateFromUtf8(utf8Data, utf8Len, vm_, canBeCompress); + result = EcmaString::CreateFromUtf8(utf8_data, utf8_len, vm_, can_be_compress); InternString(result); return result; } -EcmaString *EcmaStringTable::GetOrInternString(const uint16_t *utf16Data, uint32_t utf16Len, bool canBeCompress) +EcmaString *EcmaStringTable::GetOrInternString(const uint16_t *utf16_data, uint32_t utf16_len, bool can_be_compress) { - EcmaString *result = GetString(utf16Data, utf16Len); + EcmaString *result = GetString(utf16_data, utf16_len); if (result != nullptr) { return result; } - result = EcmaString::CreateFromUtf16(utf16Data, utf16Len, vm_, canBeCompress); + result = EcmaString::CreateFromUtf16(utf16_data, utf16_len, vm_, can_be_compress); InternString(result); return result; } diff --git a/runtime/ecma_string_table.h b/runtime/ecma_string_table.h index 335c22f42..02f508e8b 100644 --- a/runtime/ecma_string_table.h +++ b/runtime/ecma_string_table.h @@ -33,9 +33,9 @@ public: table_.clear(); } - void InternEmptyString(EcmaString *emptyStr); - EcmaString *GetOrInternString(const uint8_t *utf8Data, uint32_t utf8Len, bool canBeCompress); - EcmaString *GetOrInternString(const uint16_t *utf16Data, uint32_t utf16Len, bool canBeCompress); + void InternEmptyString(EcmaString *empty_str); + EcmaString *GetOrInternString(const uint8_t *utf8_data, uint32_t utf8_len, bool can_be_compress); + EcmaString *GetOrInternString(const uint16_t *utf16_data, uint32_t utf16_len, bool can_be_compress); EcmaString *GetOrInternString(EcmaString *string); void SweepWeakReference(const WeakRootVisitor &visitor); @@ -52,8 +52,8 @@ private: NO_COPY_SEMANTIC(EcmaStringTable); NO_MOVE_SEMANTIC(EcmaStringTable); - EcmaString *GetString(const uint8_t *utf8Data, uint32_t utf8Len, bool canBeCompress) const; - EcmaString *GetString(const uint16_t *utf16Data, uint32_t utf16Len) const; + EcmaString *GetString(const uint8_t *utf8_data, uint32_t utf8_len, bool can_be_compress) const; + EcmaString *GetString(const uint16_t *utf16_data, uint32_t utf16_len) const; EcmaString *GetString(EcmaString *string) const; void InternString(EcmaString *string); diff --git a/runtime/ecma_vm.cpp b/runtime/ecma_vm.cpp index 903f18c08..a99af3799 100644 --- a/runtime/ecma_vm.cpp +++ b/runtime/ecma_vm.cpp @@ -156,19 +156,19 @@ Expected EcmaVM::Create(Runtime *runtime, const JSRuntime return vm; } -EcmaVM::EcmaVM(JSRuntimeOptions options) : stringTable_(new EcmaStringTable(this)) +EcmaVM::EcmaVM(JSRuntimeOptions options) : string_table_(new EcmaStringTable(this)) { auto runtime = Runtime::GetCurrent(); options_ = std::move(options); - icEnable_ = options_.IsIcEnable(); - optionalLogEnabled_ = options_.IsEnableOptionalLog(); - frameworkAbcFileName_ = options_.GetFrameworkAbcFile(); + ic_enable_ = options_.IsIcEnable(); + optional_log_enabled_ = options_.IsEnableOptionalLog(); + framework_abc_file_name_ = options_.GetFrameworkAbcFile(); auto allocator = runtime->GetInternalAllocator(); thread_manager_ = allocator->New(); rendezvous_ = allocator->New(this); - notificationManager_ = allocator->New(runtime->GetInternalAllocator()); - notificationManager_->SetRendezvous(rendezvous_); + notification_manager_ = allocator->New(runtime->GetInternalAllocator()); + notification_manager_->SetRendezvous(rendezvous_); LanguageContext ctx = Runtime::GetCurrent()->GetLanguageContext(panda_file::SourceLang::ECMASCRIPT); mm_ = CreateMM(ctx, Runtime::GetCurrent()->GetInternalAllocator(), options_); @@ -212,7 +212,7 @@ bool EcmaVM::Initialize() auto runtime = Runtime::GetCurrent(); auto globalConst = const_cast(thread_->GlobalConstants()); - regExpParserCache_ = new RegExpParserCache(); + reg_exp_parser_cache_ = new RegExpParserCache(); factory_ = runtime->GetInternalAllocator()->New(thread_); if (UNLIKELY(factory_ == nullptr)) { LOG_ECMA(FATAL) << "alloc factory_ failed"; @@ -238,7 +238,7 @@ bool EcmaVM::Initialize() factory_->NewEcmaDynClass(*dynClassClassHandle, GlobalEnv::SIZE, JSType::GLOBAL_ENV); JSHandle globalEnvHandle = factory_->NewGlobalEnv(*globalEnvClass); - globalEnv_ = globalEnvHandle.GetTaggedValue(); + global_env_ = globalEnvHandle.GetTaggedValue(); // init global env globalConst->InitRootsClass(thread_, *dynClassClassHandle); @@ -250,16 +250,16 @@ bool EcmaVM::Initialize() globalEnvHandle->SetRegisterSymbols(thread_, SymbolTable::Create(thread_)); globalEnvHandle->SetGlobalRecord(thread_, GlobalDictionary::Create(thread_)); JSTaggedValue emptyStr = thread_->GlobalConstants()->GetEmptyString(); - stringTable_->InternEmptyString(EcmaString::Cast(emptyStr.GetTaggedObject())); + string_table_->InternEmptyString(EcmaString::Cast(emptyStr.GetTaggedObject())); globalEnvHandle->SetEmptyTaggedQueue(thread_, factory_->NewTaggedQueue(0)); globalEnvHandle->SetTemplateMap(thread_, TemplateMap::Create(thread_)); globalEnvHandle->SetRegisterSymbols(GetJSThread(), SymbolTable::Create(GetJSThread())); #ifdef ECMASCRIPT_ENABLE_STUB_AOT - std::string moduleFile = options_.GetStubModuleFile(); - thread_->LoadFastStubModule(moduleFile.c_str()); + std::string module_file = options_.GetStubModuleFile(); + thread_->LoadFastStubModule(module_file.c_str()); #endif SetupRegExpResultCache(); - microJobQueue_ = factory_->NewMicroJobQueue().GetTaggedValue(); + micro_job_queue_ = factory_->NewMicroJobQueue().GetTaggedValue(); { Builtins builtins; @@ -268,11 +268,11 @@ bool EcmaVM::Initialize() thread_->SetGlobalObject(globalEnvHandle->GetGlobalObject()); - moduleManager_ = new ModuleManager(this); + module_manager_ = new ModuleManager(this); InitializeFinish(); - notificationManager_->VmStartEvent(); - notificationManager_->VmInitializationEvent(thread_->GetThreadId()); + notification_manager_->VmStartEvent(); + notification_manager_->VmInitializationEvent(thread_->GetThreadId()); return true; } @@ -296,9 +296,9 @@ void EcmaVM::InitializeEcmaScriptRunStat() static_assert(sizeof(runtimeCallerNames) == sizeof(const char *) * ecmascript::RUNTIME_CALLER_NUMBER, "Invalid runtime caller number"); auto allocator = Runtime::GetCurrent()->GetInternalAllocator(); - runtimeStat_ = allocator->New(runtimeCallerNames, ecmascript::RUNTIME_CALLER_NUMBER); - if (UNLIKELY(runtimeStat_ == nullptr)) { - LOG_ECMA(FATAL) << "alloc runtimeStat_ failed"; + runtime_stat_ = allocator->New(runtimeCallerNames, ecmascript::RUNTIME_CALLER_NUMBER); + if (UNLIKELY(runtime_stat_ == nullptr)) { + LOG_ECMA(FATAL) << "alloc runtime_stat_ failed"; UNREACHABLE(); } } @@ -306,21 +306,21 @@ void EcmaVM::InitializeEcmaScriptRunStat() void EcmaVM::SetRuntimeStatEnable(bool flag) { if (flag) { - if (runtimeStat_ == nullptr) { + if (runtime_stat_ == nullptr) { InitializeEcmaScriptRunStat(); } } else { - if (runtimeStatEnabled_) { - runtimeStat_->Print(); - runtimeStat_->ResetAllCount(); + if (runtime_stat_enabled_) { + runtime_stat_->Print(); + runtime_stat_->ResetAllCount(); } } - runtimeStatEnabled_ = flag; + runtime_stat_enabled_ = flag; } bool EcmaVM::InitializeFinish() { - vmInitialized_ = true; + vm_initialized_ = true; return true; } @@ -371,7 +371,7 @@ void EcmaVM::UninitializeThreads() EcmaVM::~EcmaVM() { - vmInitialized_ = false; + vm_initialized_ = false; ClearNativeMethodsData(); if (panda::plugins::RuntimeTypeToLang(Runtime::GetCurrent()->GetRuntimeType()) != @@ -380,24 +380,24 @@ EcmaVM::~EcmaVM() Runtime::GetCurrent()->GetClassLinker()->ResetExtension(panda_file::SourceLang::ECMASCRIPT); } - if (runtimeStat_ != nullptr && runtimeStatEnabled_) { - runtimeStat_->Print(); + if (runtime_stat_ != nullptr && runtime_stat_enabled_) { + runtime_stat_->Print(); } // clear c_address: c++ pointer delete ClearBufferData(); - delete regExpParserCache_; - regExpParserCache_ = nullptr; + delete reg_exp_parser_cache_; + reg_exp_parser_cache_ = nullptr; - if (stringTable_ != nullptr) { - delete stringTable_; - stringTable_ = nullptr; + if (string_table_ != nullptr) { + delete string_table_; + string_table_ = nullptr; } - if (moduleManager_ != nullptr) { - delete moduleManager_; - moduleManager_ = nullptr; + if (module_manager_ != nullptr) { + delete module_manager_; + module_manager_ = nullptr; } if (thread_ != nullptr) { @@ -406,13 +406,13 @@ EcmaVM::~EcmaVM() thread_ = nullptr; } - extractorCache_.clear(); - frameworkProgramMethods_.clear(); + extractor_cache_.clear(); + framework_program_methods_.clear(); mem::InternalAllocatorPtr allocator = mm_->GetHeapManager()->GetInternalAllocator(); - allocator->Delete(notificationManager_); + allocator->Delete(notification_manager_); allocator->Delete(factory_); - allocator->Delete(runtimeStat_); + allocator->Delete(runtime_stat_); allocator->Delete(rendezvous_); allocator->Delete(thread_manager_); allocator->Delete(runtime_iface_); @@ -422,25 +422,25 @@ EcmaVM::~EcmaVM() mem::MemoryManager::Destroy(mm_); } -bool EcmaVM::ExecuteFromPf(std::string_view filename, std::string_view entryPoint, const std::vector &args, - bool isModule) +bool EcmaVM::ExecuteFromPf(std::string_view filename, std::string_view entry_point, + const std::vector &args, bool is_module) { std::unique_ptr pf; - if (frameworkPandaFile_ == nullptr || !IsFrameworkPandaFile(filename)) { + if (framework_panda_file_ == nullptr || !IsFrameworkPandaFile(filename)) { pf = panda_file::OpenPandaFileOrZip(filename, panda_file::File::READ_WRITE); if (pf == nullptr) { return false; } - AddPandaFile(pf.get(), isModule); // Store here prevent from being automatically cleared - notificationManager_->LoadModuleEvent(pf->GetFilename()); + AddPandaFile(pf.get(), is_module); // Store here prevent from being automatically cleared + notification_manager_->LoadModuleEvent(pf->GetFilename()); } else { - pf.reset(frameworkPandaFile_); + pf.reset(framework_panda_file_); } - return Execute(std::move(pf), entryPoint, args, isModule); + return Execute(std::move(pf), entry_point, args, is_module); } -bool EcmaVM::ExecuteFromBuffer(const void *buffer, size_t size, std::string_view entryPoint, +bool EcmaVM::ExecuteFromBuffer(const void *buffer, size_t size, std::string_view entry_point, const std::vector &args) { auto pf = panda_file::OpenPandaFileFromMemory(buffer, size); @@ -448,27 +448,27 @@ bool EcmaVM::ExecuteFromBuffer(const void *buffer, size_t size, std::string_view return false; } AddPandaFile(pf.get(), false); // Store here prevent from being automatically cleared - notificationManager_->LoadModuleEvent(pf->GetFilename()); + notification_manager_->LoadModuleEvent(pf->GetFilename()); - return Execute(std::move(pf), entryPoint, args); + return Execute(std::move(pf), entry_point, args); } tooling::ecmascript::PtJSExtractor *EcmaVM::GetDebugInfoExtractor(const panda_file::File *file) { tooling::ecmascript::PtJSExtractor *res = nullptr; - auto it = extractorCache_.find(file); - if (it == extractorCache_.end()) { + auto it = extractor_cache_.find(file); + if (it == extractor_cache_.end()) { auto extractor = std::make_unique(file); res = extractor.get(); - extractorCache_[file] = std::move(extractor); + extractor_cache_[file] = std::move(extractor); } else { res = it->second.get(); } return res; } -bool EcmaVM::Execute(std::unique_ptr pf, std::string_view entryPoint, - const std::vector &args, bool isModule) +bool EcmaVM::Execute(std::unique_ptr pf, std::string_view entry_point, + const std::vector &args, bool is_module) { if (pf == nullptr) { return false; @@ -477,19 +477,19 @@ bool EcmaVM::Execute(std::unique_ptr pf, std::string_vie const panda_file::File *pf_ptr = pf.get(); Runtime::GetCurrent()->GetClassLinker()->AddPandaFile(std::move(pf)); // Get ClassName and MethodName - size_t pos = entryPoint.find_last_of("::"); + size_t pos = entry_point.find_last_of("::"); if (pos == std::string_view::npos) { - LOG_ECMA(ERROR) << "EntryPoint:" << entryPoint << " is illegal"; + LOG_ECMA(ERROR) << "EntryPoint:" << entry_point << " is illegal"; return false; } - PandaString methodName(entryPoint.substr(pos + 1)); + PandaString method_name(entry_point.substr(pos + 1)); // For Ark application startup - if (!isModule) { + if (!is_module) { thread_->ManagedCodeBegin(); } - InvokeEcmaEntrypoint(*pf_ptr, methodName, args); - if (!isModule) { + InvokeEcmaEntrypoint(*pf_ptr, method_name, args); + if (!is_module) { thread_->ManagedCodeEnd(); } return true; @@ -517,18 +517,18 @@ void EcmaVM::SweepVmRefs(const GCObjectVisitor &gc_object_visitor) JSHandle EcmaVM::GetGlobalEnv() const { - return JSHandle(reinterpret_cast(&globalEnv_)); + return JSHandle(reinterpret_cast(&global_env_)); } JSHandle EcmaVM::GetMicroJobQueue() const { - return JSHandle(reinterpret_cast(µJobQueue_)); + return JSHandle(reinterpret_cast(µ_job_queue_)); } Method *EcmaVM::GetNativeMethodWrapper() { - if (nativeMethodWrapper_ != nullptr) { - return nativeMethodWrapper_; + if (native_method_wrapper_ != nullptr) { + return native_method_wrapper_; } auto mutf8_name = reinterpret_cast("LEcmascript/Intrinsics;"); auto klass = @@ -545,8 +545,8 @@ Method *EcmaVM::GetNativeMethodWrapper() shorty.emplace_back(panda_file::Type::TypeId::VOID); shorty.emplace_back(panda_file::Type::TypeId::TAGGED); - nativeMethodWrapper_ = klass->GetDirectMethod(mutf8_name, proto); - return nativeMethodWrapper_; + native_method_wrapper_ = klass->GetDirectMethod(mutf8_name, proto); + return native_method_wrapper_; } JSMethod *EcmaVM::GetMethodForNativeFunction(const void *func) @@ -558,13 +558,13 @@ JSMethod *EcmaVM::GetMethodForNativeFunction(const void *func) method->SetNativePointer(const_cast(func)); method->SetCompiledEntryPoint(reinterpret_cast(CompiledCodeToBuiltinBridge)); - nativeMethods_.push_back(method); - return nativeMethods_.back(); + native_methods_.push_back(method); + return native_methods_.back(); } void EcmaVM::RedirectMethod(const panda_file::File &pf) { - for (auto method : frameworkProgramMethods_) { + for (auto method : framework_program_methods_) { method->SetPandaFile(&pf); } } @@ -583,16 +583,16 @@ Expected EcmaVM::InvokeEntrypointImpl(Method *entrypoint, c return InvokeEcmaEntrypoint(*file, utf::Mutf8AsCString(entrypoint->GetName().data), args); } -Expected EcmaVM::InvokeEcmaEntrypoint(const panda_file::File &pf, const PandaString &methodName, +Expected EcmaVM::InvokeEcmaEntrypoint(const panda_file::File &pf, const PandaString &method_name, const std::vector &args) { [[maybe_unused]] EcmaHandleScope scope(thread_); JSHandle program; - if (&pf != frameworkPandaFile_) { - program = PandaFileTranslator::TranslatePandaFile(this, pf, methodName); + if (&pf != framework_panda_file_) { + program = PandaFileTranslator::TranslatePandaFile(this, pf, method_name); } else { JSHandle string = factory_->NewFromStdStringUnCheck(pf.GetFilename(), true); - program = JSHandle(thread_, frameworkProgram_); + program = JSHandle(thread_, framework_program_); program->SetLocation(thread_, string); RedirectMethod(pf); } @@ -604,7 +604,7 @@ Expected EcmaVM::InvokeEcmaEntrypoint(const panda_file::Fil } JSHandle func = JSHandle(thread_, program->GetMainFunction()); - JSHandle global = GlobalEnv::Cast(globalEnv_.GetTaggedObject())->GetJSGlobalObject(); + JSHandle global = GlobalEnv::Cast(global_env_.GetTaggedObject())->GetJSGlobalObject(); JSHandle newTarget(thread_, JSTaggedValue::Undefined()); JSHandle jsargs = factory_->NewTaggedArray(args.size()); uint32_t i = 0; @@ -624,26 +624,26 @@ Expected EcmaVM::InvokeEcmaEntrypoint(const panda_file::Fil return 0; } -void EcmaVM::AddPandaFile(const panda_file::File *pf, bool isModule) +void EcmaVM::AddPandaFile(const panda_file::File *pf, bool is_module) { ASSERT(pf != nullptr); - os::memory::LockHolder lock(pandaFileWithProgramLock_); - pandaFileWithProgram_.push_back(std::make_tuple(nullptr, pf, isModule)); + os::memory::LockHolder lock(panda_file_with_program_lock_); + panda_file_with_program_.push_back(std::make_tuple(nullptr, pf, is_module)); } void EcmaVM::SetProgram(Program *program, const panda_file::File *pf) { - os::memory::LockHolder lock(pandaFileWithProgramLock_); - auto it = std::find_if(pandaFileWithProgram_.begin(), pandaFileWithProgram_.end(), + os::memory::LockHolder lock(panda_file_with_program_lock_); + auto it = std::find_if(panda_file_with_program_.begin(), panda_file_with_program_.end(), [pf](auto entry) { return std::get<1>(entry) == pf; }); - ASSERT(it != pandaFileWithProgram_.end()); + ASSERT(it != panda_file_with_program_.end()); std::get<0>(*it) = program; } bool EcmaVM::IsFrameworkPandaFile(std::string_view filename) const { - return filename.size() >= frameworkAbcFileName_.size() && - filename.substr(filename.size() - frameworkAbcFileName_.size()) == frameworkAbcFileName_; + return filename.size() >= framework_abc_file_name_.size() && + filename.substr(filename.size() - framework_abc_file_name_.size()) == framework_abc_file_name_; } JSHandle EcmaVM::GetEcmaUncaughtException() const @@ -664,12 +664,12 @@ JSHandle EcmaVM::GetEcmaUncaughtException() const void EcmaVM::EnableUserUncaughtErrorHandler() { - isUncaughtExceptionRegistered_ = true; + is_uncaught_exception_registered_ = true; } void EcmaVM::HandleUncaughtException() { - if (isUncaughtExceptionRegistered_) { + if (is_uncaught_exception_registered_) { return; } ScopedManagedCodeThread s(thread_); @@ -694,14 +694,14 @@ void EcmaVM::HandleUncaughtException() } } -void EcmaVM::PrintJSErrorInfo(const JSHandle &exceptionInfo) +void EcmaVM::PrintJSErrorInfo(const JSHandle &exception_info) { JSHandle nameKey = thread_->GlobalConstants()->GetHandledNameString(); - JSHandle name(JSObject::GetProperty(thread_, exceptionInfo, nameKey).GetValue()); + JSHandle name(JSObject::GetProperty(thread_, exception_info, nameKey).GetValue()); JSHandle msgKey = thread_->GlobalConstants()->GetHandledMessageString(); - JSHandle msg(JSObject::GetProperty(thread_, exceptionInfo, msgKey).GetValue()); + JSHandle msg(JSObject::GetProperty(thread_, exception_info, msgKey).GetValue()); JSHandle stackKey = thread_->GlobalConstants()->GetHandledStackString(); - JSHandle stack(JSObject::GetProperty(thread_, exceptionInfo, stackKey).GetValue()); + JSHandle stack(JSObject::GetProperty(thread_, exception_info, stackKey).GetValue()); PandaString nameBuffer = ConvertToPandaString(*name); PandaString msgBuffer = ConvertToPandaString(*msg); @@ -711,17 +711,17 @@ void EcmaVM::PrintJSErrorInfo(const JSHandle &exceptionInfo) void EcmaVM::ProcessReferences(const WeakRootVisitor &v0) { - if (regExpParserCache_ != nullptr) { - regExpParserCache_->Clear(); + if (reg_exp_parser_cache_ != nullptr) { + reg_exp_parser_cache_->Clear(); } // array buffer - for (auto iter = arrayBufferDataList_.begin(); iter != arrayBufferDataList_.end();) { + for (auto iter = array_buffer_data_list_.begin(); iter != array_buffer_data_list_.end();) { JSNativePointer *object = *iter; auto fwd = v0(reinterpret_cast(object)); if (fwd == nullptr) { object->Destroy(); - iter = arrayBufferDataList_.erase(iter); + iter = array_buffer_data_list_.erase(iter); } else if (fwd != reinterpret_cast(object)) { *iter = JSNativePointer::Cast(fwd); ++iter; @@ -733,29 +733,29 @@ void EcmaVM::ProcessReferences(const WeakRootVisitor &v0) ProcessPrograms(v0); // framework program - if (!frameworkProgram_.IsHole()) { - auto fwd = v0(frameworkProgram_.GetTaggedObject()); + if (!framework_program_.IsHole()) { + auto fwd = v0(framework_program_.GetTaggedObject()); if (fwd == nullptr) { - frameworkProgram_ = JSTaggedValue::Undefined(); - } else if (fwd != frameworkProgram_.GetTaggedObject()) { - frameworkProgram_ = JSTaggedValue(fwd); + framework_program_ = JSTaggedValue::Undefined(); + } else if (fwd != framework_program_.GetTaggedObject()) { + framework_program_ = JSTaggedValue(fwd); } } } void EcmaVM::ProcessPrograms(const WeakRootVisitor &v0) { - os::memory::LockHolder lock(pandaFileWithProgramLock_); + os::memory::LockHolder lock(panda_file_with_program_lock_); // program vector - for (auto iter = pandaFileWithProgram_.begin(); iter != pandaFileWithProgram_.end();) { + for (auto iter = panda_file_with_program_.begin(); iter != panda_file_with_program_.end();) { auto object = std::get<0>(*iter); if (object != nullptr) { auto fwd = v0(object); if (fwd == nullptr) { object->FreeMethodData(); auto pf = std::get<1>(*iter); - extractorCache_.erase(pf); - iter = pandaFileWithProgram_.erase(iter); + extractor_cache_.erase(pf); + iter = panda_file_with_program_.erase(iter); } else if (fwd != object) { *iter = std::make_tuple(reinterpret_cast(fwd), std::get<1>(*iter), std::get<2>(*iter)); // 2: index @@ -784,28 +784,29 @@ void EcmaVM::HandleEnqueueReferences() void EcmaVM::PushToArrayDataList(JSNativePointer *array) { - if (std::find(arrayBufferDataList_.begin(), arrayBufferDataList_.end(), array) != arrayBufferDataList_.end()) { + if (std::find(array_buffer_data_list_.begin(), array_buffer_data_list_.end(), array) != + array_buffer_data_list_.end()) { return; } - arrayBufferDataList_.emplace_back(array); + array_buffer_data_list_.emplace_back(array); } void EcmaVM::RemoveArrayDataList(JSNativePointer *array) { - auto iter = std::find(arrayBufferDataList_.begin(), arrayBufferDataList_.end(), array); - if (iter != arrayBufferDataList_.end()) { - arrayBufferDataList_.erase(iter); + auto iter = std::find(array_buffer_data_list_.begin(), array_buffer_data_list_.end(), array); + if (iter != array_buffer_data_list_.end()) { + array_buffer_data_list_.erase(iter); } } -bool EcmaVM::VerifyFilePath(const PandaString &filePath) const +bool EcmaVM::VerifyFilePath(const PandaString &file_path) const { - if (filePath.size() > PATH_MAX) { + if (file_path.size() > PATH_MAX) { return false; } PandaVector resolvedPath(PATH_MAX); - auto result = realpath(filePath.c_str(), resolvedPath.data()); + auto result = realpath(file_path.c_str(), resolvedPath.data()); if (result == nullptr) { return false; } @@ -819,17 +820,17 @@ bool EcmaVM::VerifyFilePath(const PandaString &filePath) const void EcmaVM::ClearBufferData() { - for (auto iter : arrayBufferDataList_) { + for (auto iter : array_buffer_data_list_) { iter->Destroy(); } - arrayBufferDataList_.clear(); + array_buffer_data_list_.clear(); - os::memory::LockHolder lock(pandaFileWithProgramLock_); - for (auto iter = pandaFileWithProgram_.begin(); iter != pandaFileWithProgram_.end();) { + os::memory::LockHolder lock(panda_file_with_program_lock_); + for (auto iter = panda_file_with_program_.begin(); iter != panda_file_with_program_.end();) { std::get<0>(*iter)->FreeMethodData(); - iter = pandaFileWithProgram_.erase(iter); + iter = panda_file_with_program_.erase(iter); } - pandaFileWithProgram_.clear(); + panda_file_with_program_.clear(); } bool EcmaVM::ExecutePromisePendingJob() const @@ -848,28 +849,28 @@ void EcmaVM::CollectGarbage() const void EcmaVM::Iterate(const RootVisitor &v) { - v(Root::ROOT_VM, ObjectSlot(ToUintPtr(&globalEnv_))); - v(Root::ROOT_VM, ObjectSlot(ToUintPtr(µJobQueue_))); - v(Root::ROOT_VM, ObjectSlot(ToUintPtr(&moduleManager_->ecmaModules_))); - v(Root::ROOT_VM, ObjectSlot(ToUintPtr(®expCache_))); + v(Root::ROOT_VM, ObjectSlot(ToUintPtr(&global_env_))); + v(Root::ROOT_VM, ObjectSlot(ToUintPtr(µ_job_queue_))); + v(Root::ROOT_VM, ObjectSlot(ToUintPtr(&module_manager_->ecmaModules_))); + v(Root::ROOT_VM, ObjectSlot(ToUintPtr(®exp_cache_))); } void EcmaVM::SetGlobalEnv(GlobalEnv *global) { ASSERT(global != nullptr); - globalEnv_ = JSTaggedValue(global); + global_env_ = JSTaggedValue(global); } void EcmaVM::SetMicroJobQueue(job::MicroJobQueue *queue) { ASSERT(queue != nullptr); - microJobQueue_ = JSTaggedValue(queue); + micro_job_queue_ = JSTaggedValue(queue); } const panda_file::File *EcmaVM::GetLastLoadedPandaFile() { - os::memory::LockHolder lock(pandaFileWithProgramLock_); - auto currentFileTuple = pandaFileWithProgram_.back(); + os::memory::LockHolder lock(panda_file_with_program_lock_); + auto currentFileTuple = panda_file_with_program_.back(); return std::get<1>(currentFileTuple); } @@ -879,43 +880,43 @@ JSHandle EcmaVM::GetModuleByName(JSHandle moduleNa PandaString relativeFile = ConvertToPandaString(EcmaString::Cast(moduleName->GetTaggedObject())); // generate full path - PandaString abcPath = moduleManager_->GenerateModuleFullPath(currentPathFile, relativeFile); + PandaString abcPath = module_manager_->GenerateModuleFullPath(currentPathFile, relativeFile); // Uniform module name JSHandle abcModuleName = factory_->NewFromString(abcPath); - JSHandle module = moduleManager_->GetModule(thread_, JSHandle::Cast(abcModuleName)); + JSHandle module = module_manager_->GetModule(thread_, JSHandle::Cast(abcModuleName)); if (module->IsUndefined()) { PandaString file = ConvertToPandaString(abcModuleName.GetObject()); std::vector argv; ExecuteModule(file, ENTRY_POINTER, argv); - module = moduleManager_->GetModule(thread_, JSHandle::Cast(abcModuleName)); + module = module_manager_->GetModule(thread_, JSHandle::Cast(abcModuleName)); } return module; } -void EcmaVM::ExecuteModule(std::string_view moduleFile, std::string_view entryPoint, +void EcmaVM::ExecuteModule(std::string_view module_file, std::string_view entry_point, const std::vector &args) { - moduleManager_->SetCurrentExportModuleName(moduleFile); + module_manager_->SetCurrentExportModuleName(module_file); // Update Current Module - EcmaVM::ExecuteFromPf(moduleFile, entryPoint, args, true); + EcmaVM::ExecuteFromPf(module_file, entry_point, args, true); // Restore Current Module - moduleManager_->RestoreCurrentExportModuleName(); + module_manager_->RestoreCurrentExportModuleName(); } void EcmaVM::ClearNativeMethodsData() { auto allocator = Runtime::GetCurrent()->GetInternalAllocator(); - for (auto iter : nativeMethods_) { + for (auto iter : native_methods_) { allocator->Delete(iter); } - nativeMethods_.clear(); + native_methods_.clear(); } void EcmaVM::SetupRegExpResultCache() { - regexpCache_ = builtins::RegExpExecResultCache::CreateCacheTable(thread_); + regexp_cache_ = builtins::RegExpExecResultCache::CreateCacheTable(thread_); } void EcmaVM::HandleLdaStr(Frame *frame, BytecodeId string_id) @@ -940,8 +941,8 @@ std::unique_ptr EcmaVM::OpenPandaFile(std::string_view l [[maybe_unused]] EcmaHandleScope handleScope(GetJSThread()); auto program = PandaFileTranslator::TranslatePandaFile(this, *pf, ENTRY_METHOD_POINTER.data()); { - os::memory::LockHolder lock(pandaFileWithProgramLock_); - pandaFileWithProgram_.emplace_back(program.GetObject(), pf.get(), false); + os::memory::LockHolder lock(panda_file_with_program_lock_); + panda_file_with_program_.emplace_back(program.GetObject(), pf.get(), false); } return pf; } @@ -1011,12 +1012,12 @@ void EcmaVM::UpdateVmRefs() }; rootManager.VisitVMRoots(single_visitor, range_visitor); - // Special handling of arrayBufferDataList_ + // Special handling of array_buffer_data_list_ // Don't handle it in ObjectXRay because these refs shouldn't be marked // as gc roots // NOLINTNEXTLINE(modernize-loop-convert) - for (size_t i = 0; i < arrayBufferDataList_.size(); ++i) { - single_visitor(Root::ROOT_VM, ObjectSlot(ToUintPtr(&arrayBufferDataList_[i]))); + for (size_t i = 0; i < array_buffer_data_list_.size(); ++i) { + single_visitor(Root::ROOT_VM, ObjectSlot(ToUintPtr(&array_buffer_data_list_[i]))); } for (auto &entry : finalization_registries_) { diff --git a/runtime/ecma_vm.h b/runtime/ecma_vm.h index 77778ca11..604f728a6 100644 --- a/runtime/ecma_vm.h +++ b/runtime/ecma_vm.h @@ -95,17 +95,17 @@ public: ~EcmaVM() override; - bool ExecuteFromPf(std::string_view filename, std::string_view entryPoint, const std::vector &args, - bool isModule = false); + bool ExecuteFromPf(std::string_view filename, std::string_view entry_point, const std::vector &args, + bool is_module = false); - bool ExecuteFromBuffer(const void *buffer, size_t size, std::string_view entryPoint, + bool ExecuteFromBuffer(const void *buffer, size_t size, std::string_view entry_point, const std::vector &args); PtJSExtractor *GetDebugInfoExtractor(const panda_file::File *file); bool IsInitialized() const { - return vmInitialized_; + return vm_initialized_; } void HandleLdaStr(Frame *frame, BytecodeId string_id) override; @@ -187,8 +187,8 @@ public: coretypes::String *ResolveString(const panda_file::File &pf, panda_file::File::EntityId id) override { - ASSERT(stringTable_ != nullptr); - auto str = stringTable_->ResolveString(pf, id); + ASSERT(string_table_ != nullptr); + auto str = string_table_->ResolveString(pf, id); return coretypes::String::Cast(str); } @@ -278,16 +278,16 @@ public: RegExpParserCache *GetRegExpParserCache() const { - ASSERT(regExpParserCache_ != nullptr); - return regExpParserCache_; + ASSERT(reg_exp_parser_cache_ != nullptr); + return reg_exp_parser_cache_; } JSMethod *GetMethodForNativeFunction(const void *func); EcmaStringTable *GetEcmaStringTable() const { - ASSERT(stringTable_ != nullptr); - return stringTable_; + ASSERT(string_table_ != nullptr); + return string_table_; } JSThread *GetJSThread() const @@ -297,7 +297,7 @@ public: bool ICEnable() const { - return icEnable_; + return ic_enable_; } void HandleReferences([[maybe_unused]] const GCTask &task, const mem::GC::ReferenceClearPredicateT &pred) override @@ -316,8 +316,8 @@ public: template void EnumeratePandaFiles(Callback cb) const { - os::memory::LockHolder lock(pandaFileWithProgramLock_); - for (const auto &iter : pandaFileWithProgram_) { + os::memory::LockHolder lock(panda_file_with_program_lock_); + for (const auto &iter : panda_file_with_program_) { if (!cb(std::get<0>(iter), std::get<1>(iter))) { break; } @@ -325,11 +325,11 @@ public: } template - void EnumerateProgram(Callback cb, const std::string &pandaFile) const + void EnumerateProgram(Callback cb, const std::string &panda_file) const { - os::memory::LockHolder lock(pandaFileWithProgramLock_); - for (const auto &iter : pandaFileWithProgram_) { - if (pandaFile == std::get<1>(iter)->GetFilename()) { + os::memory::LockHolder lock(panda_file_with_program_lock_); + for (const auto &iter : panda_file_with_program_) { + if (panda_file == std::get<1>(iter)->GetFilename()) { cb(std::get<0>(iter)); break; } @@ -338,19 +338,19 @@ public: EcmaRuntimeStat *GetRuntimeStat() const { - return runtimeStat_; + return runtime_stat_; } void SetRuntimeStatEnable(bool flag); bool IsRuntimeStatEnabled() const { - return runtimeStatEnabled_; + return runtime_stat_enabled_; } bool IsOptionalLogEnabled() const { - return optionalLogEnabled_; + return optional_log_enabled_; } void Iterate(const RootVisitor &v); @@ -360,30 +360,31 @@ public: void ProcessReferences(const WeakRootVisitor &v0); void HandleEnqueueReferences() override; - JSHandle GetModuleByName(JSHandle moduleName); + JSHandle GetModuleByName(JSHandle module_name); - void ExecuteModule(std::string_view moduleFile, std::string_view entryPoint, const std::vector &args); + void ExecuteModule(std::string_view module_file, std::string_view entry_point, + const std::vector &args); ModuleManager *GetModuleManager() const { - return moduleManager_; + return module_manager_; } void SetupRegExpResultCache(); JSHandle GetRegExpCache() const { - return JSHandle(reinterpret_cast(®expCache_)); + return JSHandle(reinterpret_cast(®exp_cache_)); } - void SetRegExpCache(JSTaggedValue newCache) + void SetRegExpCache(JSTaggedValue new_cache) { - regexpCache_ = newCache; + regexp_cache_ = new_cache; } RuntimeNotificationManager *GetNotificationManager() const { - return notificationManager_; + return notification_manager_; } std::unique_ptr OpenPandaFile(std::string_view location) override; @@ -392,7 +393,7 @@ public: const PandaVector &GetNativeMethods() const { - return nativeMethods_; + return native_methods_; } void SetEnableForceGC(bool enable) @@ -407,24 +408,24 @@ public: void SetPromiseRejectCallback(PromiseRejectCallback cb) { - promiseRejectCallback_ = cb; + promise_reject_callback_ = cb; } PromiseRejectCallback GetPromiseRejectCallback() const { - return promiseRejectCallback_; + return promise_reject_callback_; } void SetHostPromiseRejectionTracker(HostPromiseRejectionTracker cb) { - hostPromiseRejectionTracker_ = cb; + host_promise_rejection_tracker_ = cb; } void PromiseRejectionTracker(const JSHandle &promise, const JSHandle &reason, const PromiseRejectionEvent operation) { - if (hostPromiseRejectionTracker_ != nullptr) { - hostPromiseRejectionTracker_(this, promise, reason, operation, data_); + if (host_promise_rejection_tracker_ != nullptr) { + host_promise_rejection_tracker_(this, promise, reason, operation, data_); } } @@ -446,13 +447,13 @@ protected: void HandleUncaughtException() override; - void PrintJSErrorInfo(const JSHandle &exceptionInfo); + void PrintJSErrorInfo(const JSHandle &exception_info); private: static constexpr uint32_t THREAD_SLEEP_TIME = 16 * 1000; static constexpr uint32_t THREAD_SLEEP_COUNT = 100; - void AddPandaFile(const panda_file::File *pf, bool isModule); + void AddPandaFile(const panda_file::File *pf, bool is_module); void SetProgram(Program *program, const panda_file::File *pf); bool IsFrameworkPandaFile(std::string_view filename) const; @@ -460,17 +461,17 @@ private: void SetMicroJobQueue(job::MicroJobQueue *queue); - bool Execute(std::unique_ptr pf, std::string_view entryPoint, - const std::vector &args, bool isModule = false); + bool Execute(std::unique_ptr pf, std::string_view entry_point, + const std::vector &args, bool is_module = false); - Expected InvokeEcmaEntrypoint(const panda_file::File &pf, const PandaString &methodName, + Expected InvokeEcmaEntrypoint(const panda_file::File &pf, const PandaString &method_name, const std::vector &args); void InitializeEcmaScriptRunStat(); void RedirectMethod(const panda_file::File &pf); - bool VerifyFilePath(const PandaString &filePath) const; + bool VerifyFilePath(const PandaString &file_path) const; void ClearBufferData(); @@ -489,57 +490,57 @@ private: SingleThreadManager *thread_manager_ {nullptr}; Rendezvous *rendezvous_ {nullptr}; - bool isTestMode_ {false}; + bool is_test_mode_ {false}; PandaSet profiles_methods_; // VM startup states. static JSRuntimeOptions options_; - bool icEnable_ {true}; - bool vmInitialized_ {false}; - bool isUncaughtExceptionRegistered_ {false}; + bool ic_enable_ {true}; + bool vm_initialized_ {false}; + bool is_uncaught_exception_registered_ {false}; // VM memory management. - EcmaStringTable *stringTable_ {nullptr}; + EcmaStringTable *string_table_ {nullptr}; ObjectFactory *factory_ {nullptr}; - PandaVector arrayBufferDataList_; + PandaVector array_buffer_data_list_; // VM execution states. JSThread *thread_ {nullptr}; - RegExpParserCache *regExpParserCache_ {nullptr}; - JSTaggedValue globalEnv_ {JSTaggedValue::Hole()}; - JSTaggedValue regexpCache_ {JSTaggedValue::Hole()}; - JSTaggedValue microJobQueue_ {JSTaggedValue::Hole()}; - bool runtimeStatEnabled_ {false}; - EcmaRuntimeStat *runtimeStat_ {nullptr}; + RegExpParserCache *reg_exp_parser_cache_ {nullptr}; + JSTaggedValue global_env_ {JSTaggedValue::Hole()}; + JSTaggedValue regexp_cache_ {JSTaggedValue::Hole()}; + JSTaggedValue micro_job_queue_ {JSTaggedValue::Hole()}; + bool runtime_stat_enabled_ {false}; + EcmaRuntimeStat *runtime_stat_ {nullptr}; // App framework resources. - JSTaggedValue frameworkProgram_ {JSTaggedValue::Hole()}; - PandaString frameworkAbcFileName_; - const panda_file::File *frameworkPandaFile_ {nullptr}; - PandaVector frameworkProgramMethods_; + JSTaggedValue framework_program_ {JSTaggedValue::Hole()}; + PandaString framework_abc_file_name_; + const panda_file::File *framework_panda_file_ {nullptr}; + PandaVector framework_program_methods_; // VM resources. - PandaVector nativeMethods_ {}; - ModuleManager *moduleManager_ {nullptr}; - bool optionalLogEnabled_ {false}; + PandaVector native_methods_ {}; + ModuleManager *module_manager_ {nullptr}; + bool optional_log_enabled_ {false}; // weak reference need Redirect address - PandaVector> pandaFileWithProgram_ - GUARDED_BY(pandaFileWithProgramLock_); - mutable os::memory::Mutex pandaFileWithProgramLock_; + PandaVector> panda_file_with_program_ + GUARDED_BY(panda_file_with_program_lock_); + mutable os::memory::Mutex panda_file_with_program_lock_; PandaMap>> functions_arg_type_cache_; - Method *nativeMethodWrapper_ {nullptr}; + Method *native_method_wrapper_ {nullptr}; CompilerInterface *compiler_ {nullptr}; compiler::RuntimeInterface *runtime_iface_ {nullptr}; // Debugger - RuntimeNotificationManager *notificationManager_ {nullptr}; - PandaUnorderedMap> extractorCache_; + RuntimeNotificationManager *notification_manager_ {nullptr}; + PandaUnorderedMap> extractor_cache_; // Registered Callbacks - PromiseRejectCallback promiseRejectCallback_ {nullptr}; - HostPromiseRejectionTracker hostPromiseRejectionTracker_ {nullptr}; + PromiseRejectCallback promise_reject_callback_ {nullptr}; + HostPromiseRejectionTracker host_promise_rejection_tracker_ {nullptr}; void *data_ {nullptr}; PandaList finalization_registries_; diff --git a/runtime/frames.h b/runtime/frames.h index e4135d53c..b56668d24 100644 --- a/runtime/frames.h +++ b/runtime/frames.h @@ -190,7 +190,7 @@ struct InterpretedFrame { // aligned with 8 bits alignas(sizeof(uint64_t)) JSTaggedValue constpool; JSTaggedValue function; - JSTaggedValue profileTypeInfo; + JSTaggedValue profile_type_info; JSTaggedValue acc; JSTaggedValue env; InterpretedFrameBase base; @@ -199,34 +199,34 @@ struct InterpretedFrame { // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) return reinterpret_cast(sp) - 1; } - static constexpr uint32_t kSizeOn64Platform = + static constexpr uint32_t K_SIZE_ON64_PLATFORM = 2 * sizeof(int64_t) + 5 * sizeof(JSTaggedValue) + 2 * sizeof(uint64_t); - static constexpr uint32_t kSizeOn32Platform = + static constexpr uint32_t K_SIZE_ON32_PLATFORM = 2 * sizeof(int32_t) + 5 * sizeof(JSTaggedValue) + 2 * sizeof(uint64_t); }; static_assert(sizeof(InterpretedFrame) % sizeof(uint64_t) == 0U); struct OptLeaveFrame { FrameType type; - JSTaggedType *prevFp; // set cursp here + JSTaggedType *prev_fp; // set cursp here uintptr_t sp; uintptr_t fp; - uint64_t patchId; + uint64_t patch_id; static OptLeaveFrame *GetFrameFromSp(JSTaggedType *sp) { return reinterpret_cast(reinterpret_cast(sp) - - MEMBER_OFFSET(OptLeaveFrame, prevFp)); + MEMBER_OFFSET(OptLeaveFrame, prev_fp)); } - static constexpr uint32_t kSizeOn64Platform = sizeof(FrameType) + 4 * sizeof(uint64_t); - static constexpr uint32_t kSizeOn32Platform = sizeof(FrameType) + 3 * sizeof(int32_t) + sizeof(uint64_t); - static constexpr uint32_t kPrevFpOffset = sizeof(FrameType); + static constexpr uint32_t K_SIZE_ON64_PLATFORM = sizeof(FrameType) + 4 * sizeof(uint64_t); + static constexpr uint32_t K_SIZE_ON32_PLATFORM = sizeof(FrameType) + 3 * sizeof(int32_t) + sizeof(uint64_t); + static constexpr uint32_t K_PREV_FP_OFFSET = sizeof(FrameType); }; #ifdef PANDA_TARGET_64 -static_assert(InterpretedFrame::kSizeOn64Platform == sizeof(InterpretedFrame)); +static_assert(InterpretedFrame::K_SIZE_ON64_PLATFORM == sizeof(InterpretedFrame)); #endif #ifdef PANDA_TARGET_32 -static_assert(InterpretedFrame::kSizeOn32Platform == sizeof(InterpretedFrame)); +static_assert(InterpretedFrame::K_SIZE_ON32_PLATFORM == sizeof(InterpretedFrame)); #endif } // namespace panda::ecmascript #endif // ECMASCRIPT_FRAMES_H diff --git a/runtime/global_dictionary-inl.h b/runtime/global_dictionary-inl.h index c974ceb93..2a32125b4 100644 --- a/runtime/global_dictionary-inl.h +++ b/runtime/global_dictionary-inl.h @@ -25,12 +25,12 @@ int GlobalDictionary::Hash(const JSTaggedValue &key) { if (key.IsHeapObject()) { if (key.IsSymbol()) { - auto symbolString = JSSymbol::Cast(key.GetTaggedObject()); - return static_cast(symbolString->GetHashField()).GetInt(); + auto symbol_string = JSSymbol::Cast(key.GetTaggedObject()); + return static_cast(symbol_string->GetHashField()).GetInt(); } if (key.IsString()) { - auto keyString = EcmaString::Cast(key.GetTaggedObject()); - return keyString->GetHashcode(); + auto key_string = EcmaString::Cast(key.GetTaggedObject()); + return key_string->GetHashcode(); } } // key must be object @@ -80,21 +80,21 @@ void GlobalDictionary::SetEntry(const JSThread *thread, int entry, const JSTagge void GlobalDictionary::ClearEntry(const JSThread *thread, int entry) { JSTaggedValue hole = JSTaggedValue::Hole(); - PropertyAttributes metaData; - SetEntry(thread, entry, hole, hole, metaData); + PropertyAttributes meta_data; + SetEntry(thread, entry, hole, hole, meta_data); } void GlobalDictionary::UpdateValueAndAttributes(const JSThread *thread, int entry, const JSTaggedValue &value, - const PropertyAttributes &metaData) + const PropertyAttributes &meta_data) { UpdateValue(thread, entry, value); - SetAttributes(thread, entry, metaData); + SetAttributes(thread, entry, meta_data); } -void GlobalDictionary::SetAttributes(const JSThread *thread, int entry, const PropertyAttributes &metaData) +void GlobalDictionary::SetAttributes(const JSThread *thread, int entry, const PropertyAttributes &meta_data) { int index = GetEntryIndex(entry) + ENTRY_DETAILS_INDEX; - Set(thread, index, metaData.GetTaggedValue()); + Set(thread, index, meta_data.GetTaggedValue()); } void GlobalDictionary::UpdateValue(const JSThread *thread, int entry, const JSTaggedValue &value) @@ -102,55 +102,55 @@ void GlobalDictionary::UpdateValue(const JSThread *thread, int entry, const JSTa SetValue(thread, entry, value); } -void GlobalDictionary::GetAllKeys(const JSThread *thread, int offset, TaggedArray *keyArray) const +void GlobalDictionary::GetAllKeys(const JSThread *thread, int offset, TaggedArray *key_array) const { - ASSERT_PRINT(offset + EntriesCount() <= static_cast(keyArray->GetLength()), + ASSERT_PRINT(offset + EntriesCount() <= static_cast(key_array->GetLength()), "keyArray capacity is not enough for dictionary"); - int arrayIndex = 0; + int array_index = 0; int size = Size(); - PandaVector> sortArr; - for (int hashIndex = 0; hashIndex < size; hashIndex++) { - JSTaggedValue key = GetKey(hashIndex); + PandaVector> sort_arr; + for (int hash_index = 0; hash_index < size; hash_index++) { + JSTaggedValue key = GetKey(hash_index); if (!key.IsUndefined() && !key.IsHole()) { - PropertyAttributes attr = GetAttributes(hashIndex); + PropertyAttributes attr = GetAttributes(hash_index); std::pair pair(key, attr.GetOffset()); - sortArr.push_back(pair); + sort_arr.push_back(pair); } } - std::sort(sortArr.begin(), sortArr.end(), CompKey); - for (auto entry : sortArr) { - JSTaggedValue nameKey = entry.first; - keyArray->Set(thread, arrayIndex + offset, nameKey); - arrayIndex++; + std::sort(sort_arr.begin(), sort_arr.end(), CompKey); + for (auto entry : sort_arr) { + JSTaggedValue name_key = entry.first; + key_array->Set(thread, array_index + offset, name_key); + array_index++; } } -void GlobalDictionary::GetEnumAllKeys(const JSThread *thread, int offset, TaggedArray *keyArray, uint32_t *keys) const +void GlobalDictionary::GetEnumAllKeys(const JSThread *thread, int offset, TaggedArray *key_array, uint32_t *keys) const { - ASSERT_PRINT(offset + EntriesCount() <= static_cast(keyArray->GetLength()), + ASSERT_PRINT(offset + EntriesCount() <= static_cast(key_array->GetLength()), "keyArray capacity is not enough for dictionary"); - int arrayIndex = 0; + int array_index = 0; int size = Size(); - PandaVector> sortArr; - for (int hashIndex = 0; hashIndex < size; hashIndex++) { - JSTaggedValue key = GetKey(hashIndex); + PandaVector> sort_arr; + for (int hash_index = 0; hash_index < size; hash_index++) { + JSTaggedValue key = GetKey(hash_index); if (key.IsString()) { - PropertyAttributes attr = GetAttributes(hashIndex); + PropertyAttributes attr = GetAttributes(hash_index); if (attr.IsEnumerable()) { std::pair pair(key, attr.GetOffset()); - sortArr.push_back(pair); + sort_arr.push_back(pair); } } } - std::sort(sortArr.begin(), sortArr.end(), CompKey); - for (const auto &entry : sortArr) { - JSTaggedValue nameKey = entry.first; - keyArray->Set(thread, arrayIndex + offset, nameKey); - arrayIndex++; + std::sort(sort_arr.begin(), sort_arr.end(), CompKey); + for (const auto &entry : sort_arr) { + JSTaggedValue name_key = entry.first; + key_array->Set(thread, array_index + offset, name_key); + array_index++; } - *keys += arrayIndex; + *keys += array_index; } bool GlobalDictionary::CompKey(const std::pair &a, const std::pair &b) @@ -158,35 +158,35 @@ bool GlobalDictionary::CompKey(const std::pair &a, cons return a.second < b.second; } -void GlobalDictionary::InvalidatePropertyBox(JSThread *thread, const JSHandle &dictHandle, int entry, - const PropertyAttributes &metaData) +void GlobalDictionary::InvalidatePropertyBox(JSThread *thread, const JSHandle &dict_handle, int entry, + const PropertyAttributes &meta_data) { - PropertyBox *box = dictHandle->GetBox(entry); - PropertyAttributes originAttr = dictHandle->GetAttributes(entry); - PropertyAttributes newAttr(metaData); + PropertyBox *box = dict_handle->GetBox(entry); + PropertyAttributes origin_attr = dict_handle->GetAttributes(entry); + PropertyAttributes new_attr(meta_data); ASSERT(!box->GetValue().IsHole()); - int index = originAttr.GetDictionaryOrder(); - JSHandle oldValue(thread, box->GetValue()); - GlobalDictionary::InvalidateAndReplaceEntry(thread, dictHandle, index, oldValue); - dictHandle->SetAttributes(thread, entry, newAttr); + int index = origin_attr.GetDictionaryOrder(); + JSHandle old_value(thread, box->GetValue()); + GlobalDictionary::InvalidateAndReplaceEntry(thread, dict_handle, index, old_value); + dict_handle->SetAttributes(thread, entry, new_attr); } -void GlobalDictionary::InvalidateAndReplaceEntry(JSThread *thread, const JSHandle &dictHandle, - int entry, const JSHandle &oldValue) +void GlobalDictionary::InvalidateAndReplaceEntry(JSThread *thread, const JSHandle &dict_handle, + int entry, const JSHandle &old_value) { ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - PropertyAttributes attr = dictHandle->GetAttributes(entry); + PropertyAttributes attr = dict_handle->GetAttributes(entry); ASSERT_PRINT(attr.IsConfigurable(), "property must be configurable"); - ASSERT_PRINT(!dictHandle->GetBox(entry)->GetValue().IsHole(), "value must not be hole"); + ASSERT_PRINT(!dict_handle->GetBox(entry)->GetValue().IsHole(), "value must not be hole"); // Swap with a copy. - JSHandle newBox = factory->NewPropertyBox(oldValue); + JSHandle new_box = factory->NewPropertyBox(old_value); // Cell is officially mutable henceforth. attr.SetBoxType(PropertyBoxType::MUTABLE); - dictHandle->SetAttributes(thread, entry, attr); - dictHandle->UpdateValue(thread, entry, newBox.GetTaggedValue()); - dictHandle->GetBox(entry)->Clear(thread); + dict_handle->SetAttributes(thread, entry, attr); + dict_handle->UpdateValue(thread, entry, new_box.GetTaggedValue()); + dict_handle->GetBox(entry)->Clear(thread); } } // namespace panda::ecmascript diff --git a/runtime/global_dictionary.h b/runtime/global_dictionary.h index 94615863f..c4d071dae 100644 --- a/runtime/global_dictionary.h +++ b/runtime/global_dictionary.h @@ -46,11 +46,11 @@ public: static inline bool IsMatch(const JSTaggedValue &key, const JSTaggedValue &other); static inline int Hash(const JSTaggedValue &key); - inline static void InvalidatePropertyBox(JSThread *thread, const JSHandle &dictHandle, int entry, - const PropertyAttributes &metaData); + inline static void InvalidatePropertyBox(JSThread *thread, const JSHandle &dict_handle, int entry, + const PropertyAttributes &meta_data); - inline static void InvalidateAndReplaceEntry(JSThread *thread, const JSHandle &dictHandle, - int entry, const JSHandle &oldValue); + inline static void InvalidateAndReplaceEntry(JSThread *thread, const JSHandle &dict_handle, + int entry, const JSHandle &old_value); inline PropertyBox *GetBox(int entry) const; @@ -66,22 +66,22 @@ public: inline void ClearEntry([[maybe_unused]] const JSThread *thread, int entry); inline void UpdateValueAndAttributes(const JSThread *thread, int entry, const JSTaggedValue &value, - const PropertyAttributes &metaData); + const PropertyAttributes &meta_data); inline void UpdateValue(const JSThread *thread, int entry, const JSTaggedValue &value); - inline void SetAttributes(const JSThread *thread, int entry, const PropertyAttributes &metaData); + inline void SetAttributes(const JSThread *thread, int entry, const PropertyAttributes &meta_data); - inline void GetAllKeys(const JSThread *thread, int offset, TaggedArray *keyArray) const; + inline void GetAllKeys(const JSThread *thread, int offset, TaggedArray *key_array) const; - inline void GetEnumAllKeys(const JSThread *thread, int offset, TaggedArray *keyArray, uint32_t *keys) const; + inline void GetEnumAllKeys(const JSThread *thread, int offset, TaggedArray *key_array, uint32_t *keys) const; static bool inline CompKey(const std::pair &a, const std::pair &b); DECL_DUMP() private: - inline int GetKeysWithFilter(const JSThread *thread, int offset, TaggedArray *keyArray, + inline int GetKeysWithFilter(const JSThread *thread, int offset, TaggedArray *key_array, const std::function &filter) const; static constexpr int ENTRY_KEY_INDEX = 0; diff --git a/runtime/global_env_constants.cpp b/runtime/global_env_constants.cpp index eea1fcc3c..8223769f0 100644 --- a/runtime/global_env_constants.cpp +++ b/runtime/global_env_constants.cpp @@ -57,147 +57,151 @@ #include "plugins/ecmascript/runtime/object_wrapper.h" namespace panda::ecmascript { -void GlobalEnvConstants::InitRootsClass([[maybe_unused]] JSThread *thread, JSHClass *dynClassClass) +void GlobalEnvConstants::InitRootsClass([[maybe_unused]] JSThread *thread, JSHClass *dyn_class_class) { // Global constants are readonly. ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - SetConstant(ConstantIndex::HCLASS_CLASS_INDEX, JSTaggedValue(dynClassClass)); + SetConstant(ConstantIndex::HCLASS_CLASS_INDEX, JSTaggedValue(dyn_class_class)); SetConstant(ConstantIndex::STRING_CLASS_INDEX, - factory->NewEcmaDynClass(dynClassClass, 0, JSType::STRING, HClass::STRING).GetTaggedValue()); + factory->NewEcmaDynClass(dyn_class_class, 0, JSType::STRING, HClass::STRING).GetTaggedValue()); SetConstant(ConstantIndex::ARRAY_CLASS_INDEX, - factory->NewEcmaDynClass(dynClassClass, 0, JSType::TAGGED_ARRAY, HClass::ARRAY).GetTaggedValue()); - JSHClass *weak_array_class = *factory->NewEcmaDynClass(dynClassClass, 0, JSType::TAGGED_ARRAY, HClass::ARRAY); + factory->NewEcmaDynClass(dyn_class_class, 0, JSType::TAGGED_ARRAY, HClass::ARRAY).GetTaggedValue()); + JSHClass *weak_array_class = *factory->NewEcmaDynClass(dyn_class_class, 0, JSType::TAGGED_ARRAY, HClass::ARRAY); weak_array_class->SetWeakContainer(true); SetConstant(ConstantIndex::WEAK_ARRAY_CLASS_INDEX, JSTaggedValue(weak_array_class)); - SetConstant( - ConstantIndex::DICTIONARY_CLASS_INDEX, - factory - ->NewEcmaDynClass(dynClassClass, 0, JSType::TAGGED_DICTIONARY, HClass::ARRAY | HClass::IS_DICTIONARY_ARRAY) - .GetTaggedValue()); + SetConstant(ConstantIndex::DICTIONARY_CLASS_INDEX, + factory + ->NewEcmaDynClass(dyn_class_class, 0, JSType::TAGGED_DICTIONARY, + HClass::ARRAY | HClass::IS_DICTIONARY_ARRAY) + .GetTaggedValue()); SetConstant( ConstantIndex::JS_NATIVE_POINTER_CLASS_INDEX, factory - ->NewEcmaDynClass(dynClassClass, JSNativePointer::SIZE, JSType::JS_NATIVE_POINTER, HClass::NATIVE_POINTER) + ->NewEcmaDynClass(dyn_class_class, JSNativePointer::SIZE, JSType::JS_NATIVE_POINTER, HClass::NATIVE_POINTER) .GetTaggedValue()); SetConstant(ConstantIndex::ENV_CLASS_INDEX, - factory->NewEcmaDynClass(dynClassClass, 0, JSType::TAGGED_ARRAY, HClass::ARRAY).GetTaggedValue()); + factory->NewEcmaDynClass(dyn_class_class, 0, JSType::TAGGED_ARRAY, HClass::ARRAY).GetTaggedValue()); SetConstant(ConstantIndex::FREE_OBJECT_WITH_NONE_FIELD_CLASS_INDEX, - factory->NewEcmaDynClass(dynClassClass, FreeObject::NEXT_OFFSET, JSType::FREE_OBJECT_WITH_NONE_FIELD) + factory->NewEcmaDynClass(dyn_class_class, FreeObject::NEXT_OFFSET, JSType::FREE_OBJECT_WITH_NONE_FIELD) .GetTaggedValue()); - JSHClass *freeObject1Class = - *factory->NewEcmaDynClass(dynClassClass, FreeObject::SIZE_OFFSET, JSType::FREE_OBJECT_WITH_ONE_FIELD); - freeObject1Class->GetHClass()->MarkFieldAsNative(FreeObject::NEXT_OFFSET); - SetConstant(ConstantIndex::FREE_OBJECT_WITH_ONE_FIELD_CLASS_INDEX, JSTaggedValue(freeObject1Class)); - JSHClass *freeObject2Class = *factory->NewEcmaDynClass(dynClassClass, FreeObject::SIZE, - JSType::FREE_OBJECT_WITH_TWO_FIELD, HClass::IS_FREE_OBJECT); - freeObject2Class->GetHClass()->MarkFieldAsNative(FreeObject::SIZE_OFFSET); - SetConstant(ConstantIndex::FREE_OBJECT_WITH_TWO_FIELD_CLASS_INDEX, JSTaggedValue(freeObject2Class)); + JSHClass *free_object1_class = + *factory->NewEcmaDynClass(dyn_class_class, FreeObject::SIZE_OFFSET, JSType::FREE_OBJECT_WITH_ONE_FIELD); + free_object1_class->GetHClass()->MarkFieldAsNative(FreeObject::NEXT_OFFSET); + SetConstant(ConstantIndex::FREE_OBJECT_WITH_ONE_FIELD_CLASS_INDEX, JSTaggedValue(free_object1_class)); + JSHClass *free_object2_class = *factory->NewEcmaDynClass( + dyn_class_class, FreeObject::SIZE, JSType::FREE_OBJECT_WITH_TWO_FIELD, HClass::IS_FREE_OBJECT); + free_object2_class->GetHClass()->MarkFieldAsNative(FreeObject::SIZE_OFFSET); + SetConstant(ConstantIndex::FREE_OBJECT_WITH_TWO_FIELD_CLASS_INDEX, JSTaggedValue(free_object2_class)); SetConstant(ConstantIndex::SYMBOL_CLASS_INDEX, - factory->NewEcmaDynClass(dynClassClass, JSSymbol::SIZE, JSType::SYMBOL).GetTaggedValue()); + factory->NewEcmaDynClass(dyn_class_class, JSSymbol::SIZE, JSType::SYMBOL).GetTaggedValue()); SetConstant(ConstantIndex::ACCESSOE_DATA_CLASS_INDEX, - factory->NewEcmaDynClass(dynClassClass, AccessorData::SIZE, JSType::ACCESSOR_DATA).GetTaggedValue()); + factory->NewEcmaDynClass(dyn_class_class, AccessorData::SIZE, JSType::ACCESSOR_DATA).GetTaggedValue()); SetConstant( ConstantIndex::INTERNAL_ACCESSOR_CLASS_INDEX, - factory->NewEcmaDynClass(dynClassClass, AccessorData::SIZE, JSType::INTERNAL_ACCESSOR).GetTaggedValue()); - JSHClass *jsProxyOrdinaryClass = *factory->NewEcmaDynClass(dynClassClass, JSProxy::SIZE, JSType::JS_PROXY); - jsProxyOrdinaryClass->GetHClass()->MarkFieldAsNative(JSProxy::METHOD_OFFSET); - SetConstant(ConstantIndex::JS_PROXY_ORDINARY_CLASS_INDEX, JSTaggedValue(jsProxyOrdinaryClass)); - SetConstant(ConstantIndex::OBJECT_WRAPPER_CLASS_INDEX, - factory->NewEcmaDynClass(dynClassClass, ObjectWrapper::SIZE, JSType::OBJECT_WRAPPER).GetTaggedValue()); - SetConstant( - ConstantIndex::COMPLETION_RECORD_CLASS_INDEX, - factory->NewEcmaDynClass(dynClassClass, CompletionRecord::SIZE, JSType::COMPLETION_RECORD).GetTaggedValue()); + factory->NewEcmaDynClass(dyn_class_class, AccessorData::SIZE, JSType::INTERNAL_ACCESSOR).GetTaggedValue()); + JSHClass *js_proxy_ordinary_class = *factory->NewEcmaDynClass(dyn_class_class, JSProxy::SIZE, JSType::JS_PROXY); + js_proxy_ordinary_class->GetHClass()->MarkFieldAsNative(JSProxy::METHOD_OFFSET); + SetConstant(ConstantIndex::JS_PROXY_ORDINARY_CLASS_INDEX, JSTaggedValue(js_proxy_ordinary_class)); SetConstant( - ConstantIndex::GENERATOR_CONTEST_INDEX, - factory->NewEcmaDynClass(dynClassClass, GeneratorContext::SIZE, JSType::JS_GENERATOR_CONTEXT).GetTaggedValue()); + ConstantIndex::OBJECT_WRAPPER_CLASS_INDEX, + factory->NewEcmaDynClass(dyn_class_class, ObjectWrapper::SIZE, JSType::OBJECT_WRAPPER).GetTaggedValue()); SetConstant( - ConstantIndex::CAPABILITY_RECORD_CLASS_INDEX, - factory->NewEcmaDynClass(dynClassClass, PromiseCapability::SIZE, JSType::PROMISE_CAPABILITY).GetTaggedValue()); + ConstantIndex::COMPLETION_RECORD_CLASS_INDEX, + factory->NewEcmaDynClass(dyn_class_class, CompletionRecord::SIZE, JSType::COMPLETION_RECORD).GetTaggedValue()); + SetConstant(ConstantIndex::GENERATOR_CONTEST_INDEX, + factory->NewEcmaDynClass(dyn_class_class, GeneratorContext::SIZE, JSType::JS_GENERATOR_CONTEXT) + .GetTaggedValue()); + SetConstant(ConstantIndex::CAPABILITY_RECORD_CLASS_INDEX, + factory->NewEcmaDynClass(dyn_class_class, PromiseCapability::SIZE, JSType::PROMISE_CAPABILITY) + .GetTaggedValue()); SetConstant( ConstantIndex::REACTIONS_RECORD_CLASS_INDEX, - factory->NewEcmaDynClass(dynClassClass, PromiseReaction::SIZE, JSType::PROMISE_REACTIONS).GetTaggedValue()); + factory->NewEcmaDynClass(dyn_class_class, PromiseReaction::SIZE, JSType::PROMISE_REACTIONS).GetTaggedValue()); SetConstant(ConstantIndex::PROMISE_ITERATOR_RECORD_CLASS_INDEX, - factory->NewEcmaDynClass(dynClassClass, PromiseIteratorRecord::SIZE, JSType::PROMISE_ITERATOR_RECORD) + factory->NewEcmaDynClass(dyn_class_class, PromiseIteratorRecord::SIZE, JSType::PROMISE_ITERATOR_RECORD) .GetTaggedValue()); - SetConstant(ConstantIndex::PROMISE_RECORD_CLASS_INDEX, - factory->NewEcmaDynClass(dynClassClass, PromiseRecord::SIZE, JSType::PROMISE_RECORD).GetTaggedValue()); + SetConstant( + ConstantIndex::PROMISE_RECORD_CLASS_INDEX, + factory->NewEcmaDynClass(dyn_class_class, PromiseRecord::SIZE, JSType::PROMISE_RECORD).GetTaggedValue()); SetConstant( ConstantIndex::PROMISE_RESOLVING_FUNCTIONS_CLASS_INDEX, - factory->NewEcmaDynClass(dynClassClass, ResolvingFunctionsRecord::SIZE, JSType::RESOLVING_FUNCTIONS_RECORD) + factory->NewEcmaDynClass(dyn_class_class, ResolvingFunctionsRecord::SIZE, JSType::RESOLVING_FUNCTIONS_RECORD) .GetTaggedValue()); SetConstant( ConstantIndex::MICRO_JOB_QUEUE_CLASS_INDEX, - factory->NewEcmaDynClass(dynClassClass, job::MicroJobQueue::SIZE, JSType::MICRO_JOB_QUEUE).GetTaggedValue()); + factory->NewEcmaDynClass(dyn_class_class, job::MicroJobQueue::SIZE, JSType::MICRO_JOB_QUEUE).GetTaggedValue()); SetConstant(ConstantIndex::PENDING_JOB_CLASS_INDEX, - factory->NewEcmaDynClass(dynClassClass, job::PendingJob::SIZE, JSType::PENDING_JOB).GetTaggedValue()); - JSHClass *protoChangeMarkerClass = - *factory->NewEcmaDynClass(dynClassClass, ProtoChangeMarker::SIZE, JSType::PROTO_CHANGE_MARKER); - protoChangeMarkerClass->GetHClass()->MarkFieldAsNative(ProtoChangeMarker::HAS_CHANGED_OFFSET); - SetConstant(ConstantIndex::PROTO_CHANGE_MARKER_CLASS_INDEX, JSTaggedValue(protoChangeMarkerClass)); + factory->NewEcmaDynClass(dyn_class_class, job::PendingJob::SIZE, JSType::PENDING_JOB).GetTaggedValue()); + JSHClass *proto_change_marker_class = + *factory->NewEcmaDynClass(dyn_class_class, ProtoChangeMarker::SIZE, JSType::PROTO_CHANGE_MARKER); + proto_change_marker_class->GetHClass()->MarkFieldAsNative(ProtoChangeMarker::HAS_CHANGED_OFFSET); + SetConstant(ConstantIndex::PROTO_CHANGE_MARKER_CLASS_INDEX, JSTaggedValue(proto_change_marker_class)); SetConstant( ConstantIndex::PROTO_CHANGE_DETAILS_CLASS_INDEX, - factory->NewEcmaDynClass(dynClassClass, ProtoChangeDetails::SIZE, JSType::PROTOTYPE_INFO).GetTaggedValue()); + factory->NewEcmaDynClass(dyn_class_class, ProtoChangeDetails::SIZE, JSType::PROTOTYPE_INFO).GetTaggedValue()); SetConstant( ConstantIndex::PROTOTYPE_HANDLER_CLASS_INDEX, - factory->NewEcmaDynClass(dynClassClass, PrototypeHandler::SIZE, JSType::PROTOTYPE_HANDLER).GetTaggedValue()); - SetConstant( - ConstantIndex::TRANSITION_HANDLER_CLASS_INDEX, - factory->NewEcmaDynClass(dynClassClass, TransitionHandler::SIZE, JSType::TRANSITION_HANDLER).GetTaggedValue()); + factory->NewEcmaDynClass(dyn_class_class, PrototypeHandler::SIZE, JSType::PROTOTYPE_HANDLER).GetTaggedValue()); + SetConstant(ConstantIndex::TRANSITION_HANDLER_CLASS_INDEX, + factory->NewEcmaDynClass(dyn_class_class, TransitionHandler::SIZE, JSType::TRANSITION_HANDLER) + .GetTaggedValue()); SetConstant(ConstantIndex::PROPERTY_BOX_CLASS_INDEX, - factory->NewEcmaDynClass(dynClassClass, PropertyBox::SIZE, JSType::PROPERTY_BOX).GetTaggedValue()); + factory->NewEcmaDynClass(dyn_class_class, PropertyBox::SIZE, JSType::PROPERTY_BOX).GetTaggedValue()); SetConstant(ConstantIndex::FUNCTION_EXTRA_INFO_INDEX, - factory->NewEcmaDynClass(dynClassClass, JSFunctionExtraInfo::SIZE, JSType::FUNCTION_EXTRA_INFO) + factory->NewEcmaDynClass(dyn_class_class, JSFunctionExtraInfo::SIZE, JSType::FUNCTION_EXTRA_INFO) .GetTaggedValue()); - JSHClass *programClass = *factory->NewEcmaDynClass(dynClassClass, Program::SIZE, JSType::PROGRAM); - programClass->GetHClass()->MarkFieldAsNative(Program::METHODS_DATA_OFFSET); - SetConstant(ConstantIndex::PROGRAM_CLASS_INDEX, JSTaggedValue(programClass)); + JSHClass *program_class = *factory->NewEcmaDynClass(dyn_class_class, Program::SIZE, JSType::PROGRAM); + program_class->GetHClass()->MarkFieldAsNative(Program::METHODS_DATA_OFFSET); + SetConstant(ConstantIndex::PROGRAM_CLASS_INDEX, JSTaggedValue(program_class)); SetConstant(ConstantIndex::ECMA_MODULE_CLASS_INDEX, - factory->NewEcmaDynClass(dynClassClass, EcmaModule::SIZE, JSType::ECMA_MODULE).GetTaggedValue()); + factory->NewEcmaDynClass(dyn_class_class, EcmaModule::SIZE, JSType::ECMA_MODULE).GetTaggedValue()); - JSHClass *jsProxyCallableClass = - *factory->NewEcmaDynClass(dynClassClass, JSProxy::SIZE, JSType::JS_PROXY, HClass::IS_CALLABLE); + JSHClass *js_proxy_callable_class = + *factory->NewEcmaDynClass(dyn_class_class, JSProxy::SIZE, JSType::JS_PROXY, HClass::IS_CALLABLE); - jsProxyCallableClass->GetHClass()->MarkFieldAsNative(JSProxy::METHOD_OFFSET); - SetConstant(ConstantIndex::JS_PROXY_CALLABLE_CLASS_INDEX, JSTaggedValue(jsProxyCallableClass)); + js_proxy_callable_class->GetHClass()->MarkFieldAsNative(JSProxy::METHOD_OFFSET); + SetConstant(ConstantIndex::JS_PROXY_CALLABLE_CLASS_INDEX, JSTaggedValue(js_proxy_callable_class)); - JSHClass *jsProxyConstructClass = - *factory->NewEcmaDynClass(dynClassClass, JSProxy::SIZE, JSType::JS_PROXY, HClass::IS_CALLABLE); + JSHClass *js_proxy_construct_class = + *factory->NewEcmaDynClass(dyn_class_class, JSProxy::SIZE, JSType::JS_PROXY, HClass::IS_CALLABLE); - jsProxyConstructClass->SetConstructor(true); - jsProxyConstructClass->GetHClass()->MarkFieldAsNative(JSProxy::METHOD_OFFSET); - SetConstant(ConstantIndex::JS_PROXY_CONSTRUCT_CLASS_INDEX, JSTaggedValue(jsProxyConstructClass)); + js_proxy_construct_class->SetConstructor(true); + js_proxy_construct_class->GetHClass()->MarkFieldAsNative(JSProxy::METHOD_OFFSET); + SetConstant(ConstantIndex::JS_PROXY_CONSTRUCT_CLASS_INDEX, JSTaggedValue(js_proxy_construct_class)); SetConstant(ConstantIndex::JS_REALM_CLASS_INDEX, - factory->NewEcmaDynClass(dynClassClass, JSRealm::SIZE, JSType::JS_REALM).GetTaggedValue()); + factory->NewEcmaDynClass(dyn_class_class, JSRealm::SIZE, JSType::JS_REALM).GetTaggedValue()); - JSHClass *classInfoExtractorClass = - *factory->NewEcmaDynClass(dynClassClass, ClassInfoExtractor::SIZE, JSType::CLASS_INFO_EXTRACTOR); - classInfoExtractorClass->GetHClass()->MarkFieldAsNative(ClassInfoExtractor::BIT_FIELD_OFFSET); - classInfoExtractorClass->GetHClass()->MarkFieldAsNative(ClassInfoExtractor::CONSTRUCTOR_METHOD_OFFSET); - SetConstant(ConstantIndex::CLASS_INFO_EXTRACTOR_HCLASS_INDEX, JSTaggedValue(classInfoExtractorClass)); + JSHClass *class_info_extractor_class = + *factory->NewEcmaDynClass(dyn_class_class, ClassInfoExtractor::SIZE, JSType::CLASS_INFO_EXTRACTOR); + class_info_extractor_class->GetHClass()->MarkFieldAsNative(ClassInfoExtractor::BIT_FIELD_OFFSET); + class_info_extractor_class->GetHClass()->MarkFieldAsNative(ClassInfoExtractor::CONSTRUCTOR_METHOD_OFFSET); + SetConstant(ConstantIndex::CLASS_INFO_EXTRACTOR_HCLASS_INDEX, JSTaggedValue(class_info_extractor_class)); - JSHClass *jsRegexpIteratorClass = - *factory->NewEcmaDynClass(dynClassClass, JSRegExpIterator::SIZE, JSType::JS_REG_EXP_ITERATOR, 0); - jsRegexpIteratorClass->GetHClass()->MarkFieldAsNative(JSRegExpIterator::BIT_FIELD_OFFSET); - SetConstant(ConstantIndex::JS_REGEXP_ITERATOR_CLASS_INDEX, JSTaggedValue(jsRegexpIteratorClass)); + JSHClass *js_regexp_iterator_class = + *factory->NewEcmaDynClass(dyn_class_class, JSRegExpIterator::SIZE, JSType::JS_REG_EXP_ITERATOR, 0); + js_regexp_iterator_class->GetHClass()->MarkFieldAsNative(JSRegExpIterator::BIT_FIELD_OFFSET); + SetConstant(ConstantIndex::JS_REGEXP_ITERATOR_CLASS_INDEX, JSTaggedValue(js_regexp_iterator_class)); SetConstant(ConstantIndex::LINKED_HASH_SET_CLASS_INDEX, - factory->NewEcmaDynClass(dynClassClass, 0, JSType::LINKED_HASH_SET, HClass::ARRAY).GetTaggedValue()); + factory->NewEcmaDynClass(dyn_class_class, 0, JSType::LINKED_HASH_SET, HClass::ARRAY).GetTaggedValue()); SetConstant(ConstantIndex::LINKED_HASH_MAP_CLASS_INDEX, - factory->NewEcmaDynClass(dynClassClass, 0, JSType::LINKED_HASH_MAP, HClass::ARRAY).GetTaggedValue()); + factory->NewEcmaDynClass(dyn_class_class, 0, JSType::LINKED_HASH_MAP, HClass::ARRAY).GetTaggedValue()); - JSHClass *weakRefClass = *factory->NewEcmaDynClass(dynClassClass, JSWeakRef::SIZE, JSType::JS_WEAK_REF, 0, 0); - weakRefClass->SetWeakContainer(true); - SetConstant(ConstantIndex::WEAK_REF_CLASS_INDEX, JSTaggedValue(weakRefClass)); + JSHClass *weak_ref_class = *factory->NewEcmaDynClass(dyn_class_class, JSWeakRef::SIZE, JSType::JS_WEAK_REF, 0, 0); + weak_ref_class->SetWeakContainer(true); + SetConstant(ConstantIndex::WEAK_REF_CLASS_INDEX, JSTaggedValue(weak_ref_class)); - JSHClass *weakHashSetClass = *factory->NewEcmaDynClass(dynClassClass, 0, JSType::LINKED_HASH_SET, HClass::ARRAY); - weakHashSetClass->SetWeakContainer(true); - SetConstant(ConstantIndex::WEAK_LINKED_HASH_SET_CLASS_INDEX, JSTaggedValue(weakHashSetClass)); + JSHClass *weak_hash_set_class = + *factory->NewEcmaDynClass(dyn_class_class, 0, JSType::LINKED_HASH_SET, HClass::ARRAY); + weak_hash_set_class->SetWeakContainer(true); + SetConstant(ConstantIndex::WEAK_LINKED_HASH_SET_CLASS_INDEX, JSTaggedValue(weak_hash_set_class)); - JSHClass *weakHashMapClass = *factory->NewEcmaDynClass(dynClassClass, 0, JSType::LINKED_HASH_MAP, HClass::ARRAY); - weakHashMapClass->SetWeakContainer(true); - SetConstant(ConstantIndex::WEAK_LINKED_HASH_MAP_CLASS_INDEX, JSTaggedValue(weakHashMapClass)); + JSHClass *weak_hash_map_class = + *factory->NewEcmaDynClass(dyn_class_class, 0, JSType::LINKED_HASH_MAP, HClass::ARRAY); + weak_hash_map_class->SetWeakContainer(true); + SetConstant(ConstantIndex::WEAK_LINKED_HASH_MAP_CLASS_INDEX, JSTaggedValue(weak_hash_map_class)); } // NOLINTNEXTLINE(readability-function-size) diff --git a/runtime/global_env_constants.h b/runtime/global_env_constants.h index 7f153ccb1..1d0cc3270 100644 --- a/runtime/global_env_constants.h +++ b/runtime/global_env_constants.h @@ -350,7 +350,7 @@ public: const JSTaggedValue *EndSlot() const; - void InitRootsClass(JSThread *thread, JSHClass *dynClassClass); + void InitRootsClass(JSThread *thread, JSHClass *dyn_class_class); void InitGlobalConstant(JSThread *thread); diff --git a/runtime/ic/ic_runtime.cpp b/runtime/ic/ic_runtime.cpp index 3c72fc28d..5338d6a7c 100644 --- a/runtime/ic/ic_runtime.cpp +++ b/runtime/ic/ic_runtime.cpp @@ -58,15 +58,15 @@ void ICRuntime::UpdateLoadHandler(const ObjectOperator &op, JSHandle::Cast(hclass), handlerValue); + ic_accessor_.AddHandlerWithoutKey(JSHandle::Cast(hclass), handlerValue); } else if (op.IsElement()) { // do not support global element ic if (IsGlobalLoadIC(GetICKind())) { return; } - icAccessor_.AddElementHandler(JSHandle::Cast(hclass), handlerValue); + ic_accessor_.AddElementHandler(JSHandle::Cast(hclass), handlerValue); } else { - icAccessor_.AddHandlerWithKey(key, JSHandle::Cast(hclass), handlerValue); + ic_accessor_.AddHandlerWithKey(key, JSHandle::Cast(hclass), handlerValue); } } @@ -96,15 +96,15 @@ void ICRuntime::UpdateStoreHandler(const ObjectOperator &op, JSHandle receiver, { #if TRACE_IC auto kind = ICKindToString(GetICKind()); - auto state = ProfileTypeAccessor::ICStateToString(icAccessor_.GetICState()); + auto state = ProfileTypeAccessor::ICStateToString(ic_accessor_.GetICState()); if (key->IsString()) { LOG(ERROR, RUNTIME) << kind << " miss key is: " << JSHandle::Cast(key)->GetCString().get() << ", receiver is " << receiver->GetHeapObject()->GetClass()->IsDictionaryMode() @@ -138,7 +138,7 @@ JSTaggedValue LoadICRuntime::LoadMiss(JSHandle receiver, JSHandle JSTaggedValue box = SlowRuntimeStub::LdGlobalRecord(thread_, key.GetTaggedValue(), &found); if (found) { ASSERT(box.IsPropertyBox()); - icAccessor_.AddGlobalRecordHandler(JSHandle(thread_, box)); + ic_accessor_.AddGlobalRecordHandler(JSHandle(thread_, box)); return PropertyBox::Cast(box.GetTaggedObject())->GetValue(); } } @@ -152,7 +152,7 @@ JSTaggedValue LoadICRuntime::LoadMiss(JSHandle receiver, JSHandle RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(GetThread()); // ic-switch if (!GetThread()->GetEcmaVM()->ICEnable()) { - icAccessor_.SetAsMega(); + ic_accessor_.SetAsMega(); return result.GetTaggedValue(); } #ifndef NDEBUG @@ -160,7 +160,7 @@ JSTaggedValue LoadICRuntime::LoadMiss(JSHandle receiver, JSHandle #endif // do not cache element if (!op.IsFastMode() && op.IsFound()) { - icAccessor_.SetAsMega(); + ic_accessor_.SetAsMega(); return result.GetTaggedValue(); } @@ -193,7 +193,7 @@ JSTaggedValue StoreICRuntime::StoreMiss(JSHandle receiver, JSHand // In this case the next line will not be executed because we check the exception in the previous line // and return. // SUPPRESS_CSA_NEXTLINE(alpha.core.WasteObjHeader) - icAccessor_.AddGlobalRecordHandler(JSHandle(thread_, box)); + ic_accessor_.AddGlobalRecordHandler(JSHandle(thread_, box)); return JSTaggedValue::Undefined(); } FastRuntimeStub::GetGlobalOwnProperty(receiver.GetTaggedValue(), key.GetTaggedValue(), &found); @@ -220,7 +220,7 @@ JSTaggedValue StoreICRuntime::StoreMiss(JSHandle receiver, JSHand } // ic-switch if (!GetThread()->GetEcmaVM()->ICEnable()) { - icAccessor_.SetAsMega(); + ic_accessor_.SetAsMega(); return success ? JSTaggedValue::Undefined() : JSTaggedValue::Exception(); } #ifndef NDEBUG @@ -228,7 +228,7 @@ JSTaggedValue StoreICRuntime::StoreMiss(JSHandle receiver, JSHand #endif // do not cache element if (!op.IsFastMode()) { - icAccessor_.SetAsMega(); + ic_accessor_.SetAsMega(); return success ? JSTaggedValue::Undefined() : JSTaggedValue::Exception(); } if (success) { diff --git a/runtime/ic/ic_runtime.h b/runtime/ic/ic_runtime.h index 67a097272..066a37d97 100644 --- a/runtime/ic/ic_runtime.h +++ b/runtime/ic/ic_runtime.h @@ -29,8 +29,8 @@ class ObjectOperator; class ICRuntime { public: - ICRuntime(JSThread *thread, JSHandle profileTypeInfo, uint32_t slotId, ICKind kind) - : thread_(thread), icAccessor_(thread, profileTypeInfo, slotId, kind) + ICRuntime(JSThread *thread, JSHandle profile_type_info, uint32_t slot_id, ICKind kind) + : thread_(thread), ic_accessor_(thread, profile_type_info, slot_id, kind) { } @@ -44,14 +44,14 @@ public: return thread_; } - void UpdateReceiverHClass(JSHandle receiverHClass) + void UpdateReceiverHClass(JSHandle receiver_h_class) { - receiverHClass_ = receiverHClass; + receiver_h_class_ = receiver_h_class; } ICKind GetICKind() const { - return icAccessor_.GetKind(); + return ic_accessor_.GetKind(); } void TraceIC(JSHandle receiver, JSHandle key) const; @@ -60,15 +60,15 @@ public: NO_COPY_SEMANTIC(ICRuntime); protected: - JSThread *thread_; // NOLINT(misc-non-private-member-variables-in-classes) - JSHandle receiverHClass_ {}; // NOLINT(misc-non-private-member-variables-in-classes) - ProfileTypeAccessor icAccessor_; // NOLINT(misc-non-private-member-variables-in-classes) + JSThread *thread_; // NOLINT(misc-non-private-member-variables-in-classes) + JSHandle receiver_h_class_ {}; // NOLINT(misc-non-private-member-variables-in-classes) + ProfileTypeAccessor ic_accessor_; // NOLINT(misc-non-private-member-variables-in-classes) }; class LoadICRuntime : public ICRuntime { public: - LoadICRuntime(JSThread *thread, JSHandle profileTypeInfo, uint32_t slotId, ICKind kind) - : ICRuntime(thread, profileTypeInfo, slotId, kind) + LoadICRuntime(JSThread *thread, JSHandle profile_type_info, uint32_t slot_id, ICKind kind) + : ICRuntime(thread, profile_type_info, slot_id, kind) { } @@ -82,8 +82,8 @@ public: class StoreICRuntime : public ICRuntime { public: - StoreICRuntime(JSThread *thread, JSHandle profileTypeInfo, uint32_t slotId, ICKind kind) - : ICRuntime(thread, profileTypeInfo, slotId, kind) + StoreICRuntime(JSThread *thread, JSHandle profile_type_info, uint32_t slot_id, ICKind kind) + : ICRuntime(thread, profile_type_info, slot_id, kind) { } diff --git a/runtime/ic/ic_runtime_stub-inl.h b/runtime/ic/ic_runtime_stub-inl.h index 1340d676e..38c294ed2 100644 --- a/runtime/ic/ic_runtime_stub-inl.h +++ b/runtime/ic/ic_runtime_stub-inl.h @@ -42,30 +42,30 @@ bool ICRuntimeStub::HaveICForFunction(JSThread *thread) return !func->GetProfileTypeInfo().IsUndefined(); } -uint32_t ICRuntimeStub::MapSlotId(JSThread *thread, uint32_t slotId) +uint32_t ICRuntimeStub::MapSlotId(JSThread *thread, uint32_t slot_id) { auto *func = JSFunction::Cast(GetThisFunc(thread).GetHeapObject()); uint8_t *mapping = func->GetMethod()->GetICMapping(); ASSERT(mapping != nullptr); // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) - return mapping[slotId]; + return mapping[slot_id]; } ProfileTypeInfo *ICRuntimeStub::GetRuntimeProfileTypeInfo(JSThread *thread) { auto *func = JSFunction::Cast(GetThisFunc(thread).GetHeapObject()); - JSTaggedValue profileTypeInfo = func->GetProfileTypeInfo(); - return ProfileTypeInfo::Cast(profileTypeInfo.GetTaggedObject()); + JSTaggedValue profile_type_info = func->GetProfileTypeInfo(); + return ProfileTypeInfo::Cast(profile_type_info.GetTaggedObject()); } -JSTaggedValue ICRuntimeStub::LoadGlobalICByName(JSThread *thread, JSTaggedValue globalValue, JSTaggedValue key, - uint32_t slotId, bool isTryLoad) +JSTaggedValue ICRuntimeStub::LoadGlobalICByName(JSThread *thread, JSTaggedValue global_value, JSTaggedValue key, + uint32_t slot_id, bool is_try_load) { INTERPRETER_TRACE(thread, LoadGlobalICByName); ASSERT(HaveICForFunction(thread)); - slotId = MapSlotId(thread, slotId); - ProfileTypeInfo *profileTypeInfo = GetRuntimeProfileTypeInfo(thread); - JSTaggedValue handler = profileTypeInfo->Get(slotId); + slot_id = MapSlotId(thread, slot_id); + ProfileTypeInfo *profile_type_info = GetRuntimeProfileTypeInfo(thread); + JSTaggedValue handler = profile_type_info->Get(slot_id); if (handler.IsHeapObject()) { auto result = LoadGlobal(handler); if (!result.IsHole()) { @@ -73,23 +73,23 @@ JSTaggedValue ICRuntimeStub::LoadGlobalICByName(JSThread *thread, JSTaggedValue } } - [[maybe_unused]] EcmaHandleScope handleScope(thread); - auto keyHandle = JSHandle(thread, key); - auto receiverHandle = JSHandle(thread, globalValue); - auto profileInfoHandle = JSHandle(thread, profileTypeInfo); - LoadICRuntime icRuntime(thread, JSHandle::Cast(profileInfoHandle), slotId, - isTryLoad ? ICKind::TRY_NAMED_GLOBAL_LOAD_IC : ICKind::NAMED_GLOBAL_LOAD_IC); - return icRuntime.LoadMiss(receiverHandle, keyHandle); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); + auto key_handle = JSHandle(thread, key); + auto receiver_handle = JSHandle(thread, global_value); + auto profile_info_handle = JSHandle(thread, profile_type_info); + LoadICRuntime ic_runtime(thread, JSHandle::Cast(profile_info_handle), slot_id, + is_try_load ? ICKind::TRY_NAMED_GLOBAL_LOAD_IC : ICKind::NAMED_GLOBAL_LOAD_IC); + return ic_runtime.LoadMiss(receiver_handle, key_handle); } -JSTaggedValue ICRuntimeStub::StoreGlobalICByName(JSThread *thread, JSTaggedValue globalValue, JSTaggedValue key, - JSTaggedValue value, uint32_t slotId, bool isTryStore) +JSTaggedValue ICRuntimeStub::StoreGlobalICByName(JSThread *thread, JSTaggedValue global_value, JSTaggedValue key, + JSTaggedValue value, uint32_t slot_id, bool is_try_store) { INTERPRETER_TRACE(thread, StoreGlobalICByName); ASSERT(HaveICForFunction(thread)); - slotId = MapSlotId(thread, slotId); - ProfileTypeInfo *profileTypeInfo = GetRuntimeProfileTypeInfo(thread); - JSTaggedValue handler = profileTypeInfo->Get(slotId); + slot_id = MapSlotId(thread, slot_id); + ProfileTypeInfo *profile_type_info = GetRuntimeProfileTypeInfo(thread); + JSTaggedValue handler = profile_type_info->Get(slot_id); if (handler.IsHeapObject()) { auto result = StoreGlobal(thread, value, handler); if (!result.IsHole()) { @@ -97,21 +97,21 @@ JSTaggedValue ICRuntimeStub::StoreGlobalICByName(JSThread *thread, JSTaggedValue } } - [[maybe_unused]] EcmaHandleScope handleScope(thread); - auto keyHandle = JSHandle(thread, key); - auto receiverHandle = JSHandle(thread, globalValue); - auto valueHandle = JSHandle(thread, value); - auto profileInfoHandle = JSHandle(thread, profileTypeInfo); - StoreICRuntime icRuntime(thread, JSHandle::Cast(profileInfoHandle), slotId, - isTryStore ? ICKind::TRY_NAMED_GLOBAL_STORE_IC : ICKind::NAMED_GLOBAL_STORE_IC); - return icRuntime.StoreMiss(receiverHandle, keyHandle, valueHandle); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); + auto key_handle = JSHandle(thread, key); + auto receiver_handle = JSHandle(thread, global_value); + auto value_handle = JSHandle(thread, value); + auto profile_info_handle = JSHandle(thread, profile_type_info); + StoreICRuntime ic_runtime(thread, JSHandle::Cast(profile_info_handle), slot_id, + is_try_store ? ICKind::TRY_NAMED_GLOBAL_STORE_IC : ICKind::NAMED_GLOBAL_STORE_IC); + return ic_runtime.StoreMiss(receiver_handle, key_handle, value_handle); } -JSTaggedValue ICRuntimeStub::CheckPolyHClass(JSTaggedValue cachedValue, JSHClass *hclass) +JSTaggedValue ICRuntimeStub::CheckPolyHClass(JSTaggedValue cached_value, JSHClass *hclass) { - if (!cachedValue.IsWeak()) { - ASSERT(cachedValue.IsTaggedArray()); - TaggedArray *array = TaggedArray::Cast(cachedValue.GetHeapObject()); + if (!cached_value.IsWeak()) { + ASSERT(cached_value.IsTaggedArray()); + TaggedArray *array = TaggedArray::Cast(cached_value.GetHeapObject()); uint32_t length = array->GetLength(); for (uint32_t i = 0; i < length; i += 2) { // 2 means one ic, two slot auto result = array->Get(i); @@ -123,126 +123,127 @@ JSTaggedValue ICRuntimeStub::CheckPolyHClass(JSTaggedValue cachedValue, JSHClass return JSTaggedValue::Hole(); } -JSTaggedValue ICRuntimeStub::LoadICByName(JSThread *thread, JSTaggedValue receiver, JSTaggedValue key, uint32_t slotId) +JSTaggedValue ICRuntimeStub::LoadICByName(JSThread *thread, JSTaggedValue receiver, JSTaggedValue key, uint32_t slot_id) { INTERPRETER_TRACE(thread, LoadICByName); ASSERT(HaveICForFunction(thread)); - slotId = MapSlotId(thread, slotId); - ProfileTypeInfo *profileTypeInfo = GetRuntimeProfileTypeInfo(thread); - JSTaggedValue hclassValue = profileTypeInfo->Get(slotId); - if (hclassValue.IsHole()) { + slot_id = MapSlotId(thread, slot_id); + ProfileTypeInfo *profile_type_info = GetRuntimeProfileTypeInfo(thread); + JSTaggedValue hclass_value = profile_type_info->Get(slot_id); + if (hclass_value.IsHole()) { return JSTaggedValue::Hole(); } if (LIKELY(receiver.IsHeapObject())) { auto hclass = receiver.GetTaggedObject()->GetClass(); - size_t index = slotId; + size_t index = slot_id; do { - if (!hclassValue.IsHeapObject()) { + if (!hclass_value.IsHeapObject()) { break; } - if (LIKELY(hclassValue.GetTaggedObject() == hclass)) { - JSTaggedValue handler = profileTypeInfo->Get(index + 1); + if (LIKELY(hclass_value.GetTaggedObject() == hclass)) { + JSTaggedValue handler = profile_type_info->Get(index + 1); if (handler.IsUndefined()) { break; } return LoadICWithHandler(thread, receiver, receiver, handler); } index += 2U; - hclassValue = profileTypeInfo->Get(index); - } while (index < slotId + SlotSizeForICByName()); + hclass_value = profile_type_info->Get(index); + } while (index < slot_id + SlotSizeForICByName()); } - return LoadMissedICByName(thread, profileTypeInfo, receiver, key, slotId); + return LoadMissedICByName(thread, profile_type_info, receiver, key, slot_id); } -JSTaggedValue ICRuntimeStub::LoadICByValue(JSThread *thread, JSTaggedValue receiver, JSTaggedValue key, uint32_t slotId) +JSTaggedValue ICRuntimeStub::LoadICByValue(JSThread *thread, JSTaggedValue receiver, JSTaggedValue key, + uint32_t slot_id) { INTERPRETER_TRACE(thread, LoadICByValue); ASSERT(HaveICForFunction(thread)); - slotId = MapSlotId(thread, slotId); - ProfileTypeInfo *profileTypeInfo = GetRuntimeProfileTypeInfo(thread); - JSTaggedValue firstValue = profileTypeInfo->Get(slotId); - if (firstValue.IsHole()) { + slot_id = MapSlotId(thread, slot_id); + ProfileTypeInfo *profile_type_info = GetRuntimeProfileTypeInfo(thread); + JSTaggedValue first_value = profile_type_info->Get(slot_id); + if (first_value.IsHole()) { return JSTaggedValue::Hole(); } - if (receiver.IsHeapObject() && firstValue.IsHeapObject()) { + if (receiver.IsHeapObject() && first_value.IsHeapObject()) { auto hclass = receiver.GetTaggedObject()->GetClass(); - if (firstValue.GetTaggedObject() == hclass) { - ASSERT(HandlerBase::IsElement(profileTypeInfo->Get(slotId + 1).GetInt())); + if (first_value.GetTaggedObject() == hclass) { + ASSERT(HandlerBase::IsElement(profile_type_info->Get(slot_id + 1).GetInt())); return LoadElement(JSObject::Cast(receiver.GetHeapObject()), key); } // Check key - if (firstValue == key) { - JSTaggedValue hclassValue = profileTypeInfo->Get(slotId + 1); - if (hclassValue.GetTaggedObject() == hclass) { - JSTaggedValue handler = profileTypeInfo->Get(slotId + 2); + if (first_value == key) { + JSTaggedValue hclass_value = profile_type_info->Get(slot_id + 1); + if (hclass_value.GetTaggedObject() == hclass) { + JSTaggedValue handler = profile_type_info->Get(slot_id + 2); return LoadICWithHandler(thread, receiver, receiver, handler); } } } - return LoadMissedICByValue(thread, profileTypeInfo, receiver, key, slotId); + return LoadMissedICByValue(thread, profile_type_info, receiver, key, slot_id); } JSTaggedValue ICRuntimeStub::StoreICByValue(JSThread *thread, JSTaggedValue receiver, JSTaggedValue key, - JSTaggedValue value, uint32_t slotId) + JSTaggedValue value, uint32_t slot_id) { INTERPRETER_TRACE(thread, StoreICByValue); ASSERT(HaveICForFunction(thread)); - slotId = MapSlotId(thread, slotId); - ProfileTypeInfo *profileTypeInfo = GetRuntimeProfileTypeInfo(thread); - JSTaggedValue firstValue = profileTypeInfo->Get(slotId); - if (firstValue.IsHole()) { + slot_id = MapSlotId(thread, slot_id); + ProfileTypeInfo *profile_type_info = GetRuntimeProfileTypeInfo(thread); + JSTaggedValue first_value = profile_type_info->Get(slot_id); + if (first_value.IsHole()) { return JSTaggedValue::Hole(); } - if (receiver.IsHeapObject() && firstValue.IsHeapObject()) { + if (receiver.IsHeapObject() && first_value.IsHeapObject()) { auto hclass = receiver.GetTaggedObject()->GetClass(); - if (firstValue.GetTaggedObject() == hclass) { - JSTaggedValue handler = profileTypeInfo->Get(slotId + 1); - auto handlerInfo = static_cast(handler.GetInt()); - return StoreElement(thread, JSObject::Cast(receiver.GetHeapObject()), key, value, handlerInfo); + if (first_value.GetTaggedObject() == hclass) { + JSTaggedValue handler = profile_type_info->Get(slot_id + 1); + auto handler_info = static_cast(handler.GetInt()); + return StoreElement(thread, JSObject::Cast(receiver.GetHeapObject()), key, value, handler_info); } // Check key - if (firstValue == key) { - JSTaggedValue hclassValue = profileTypeInfo->Get(slotId + 1); - if (hclassValue.GetTaggedObject() == hclass) { - JSTaggedValue handler = profileTypeInfo->Get(slotId + 2); + if (first_value == key) { + JSTaggedValue hclass_value = profile_type_info->Get(slot_id + 1); + if (hclass_value.GetTaggedObject() == hclass) { + JSTaggedValue handler = profile_type_info->Get(slot_id + 2); return StoreICWithHandler(thread, receiver, receiver, value, handler); } } } - return StoreMissedICByValue(thread, profileTypeInfo, receiver, key, value, slotId); + return StoreMissedICByValue(thread, profile_type_info, receiver, key, value, slot_id); } JSTaggedValue ICRuntimeStub::StoreICByName(JSThread *thread, JSTaggedValue receiver, JSTaggedValue key, - JSTaggedValue value, uint32_t slotId) + JSTaggedValue value, uint32_t slot_id) { INTERPRETER_TRACE(thread, StoreICByName); ASSERT(HaveICForFunction(thread)); - slotId = MapSlotId(thread, slotId); - ProfileTypeInfo *profileTypeInfo = GetRuntimeProfileTypeInfo(thread); - JSTaggedValue hclassValue = profileTypeInfo->Get(slotId); - if (hclassValue.IsHole()) { + slot_id = MapSlotId(thread, slot_id); + ProfileTypeInfo *profile_type_info = GetRuntimeProfileTypeInfo(thread); + JSTaggedValue hclass_value = profile_type_info->Get(slot_id); + if (hclass_value.IsHole()) { return JSTaggedValue::Hole(); } if (receiver.IsHeapObject()) { auto hclass = receiver.GetTaggedObject()->GetClass(); - size_t index = slotId; + size_t index = slot_id; do { - if (!hclassValue.IsHeapObject()) { + if (!hclass_value.IsHeapObject()) { break; } - if (LIKELY(hclassValue.GetTaggedObject() == hclass)) { - JSTaggedValue handler = profileTypeInfo->Get(index + 1); + if (LIKELY(hclass_value.GetTaggedObject() == hclass)) { + JSTaggedValue handler = profile_type_info->Get(index + 1); if (handler.IsUndefined()) { break; } return StoreICWithHandler(thread, receiver, receiver, value, handler); } index += 2U; - hclassValue = profileTypeInfo->Get(index); - } while (index < slotId + SlotSizeForICByName()); + hclass_value = profile_type_info->Get(index); + } while (index < slot_id + SlotSizeForICByName()); } - return StoreMissedICByName(thread, profileTypeInfo, receiver, key, value, slotId); + return StoreMissedICByName(thread, profile_type_info, receiver, key, value, slot_id); } JSTaggedValue ICRuntimeStub::StoreICWithHandler(JSThread *thread, JSTaggedValue receiver, JSTaggedValue holder, @@ -250,13 +251,13 @@ JSTaggedValue ICRuntimeStub::StoreICWithHandler(JSThread *thread, JSTaggedValue { INTERPRETER_TRACE(thread, StoreICWithHandler); if (handler.IsInt()) { - auto handlerInfo = static_cast(handler.GetInt()); - if (HandlerBase::IsField(handlerInfo)) { - StoreField(thread, JSObject::Cast(receiver.GetHeapObject()), value, handlerInfo); + auto handler_info = static_cast(handler.GetInt()); + if (HandlerBase::IsField(handler_info)) { + StoreField(thread, JSObject::Cast(receiver.GetHeapObject()), value, handler_info); return JSTaggedValue::Undefined(); } - ASSERT(HandlerBase::IsAccessor(handlerInfo) || HandlerBase::IsInternalAccessor(handlerInfo)); - auto accessor = LoadFromField(JSObject::Cast(holder.GetHeapObject()), handlerInfo); + ASSERT(HandlerBase::IsAccessor(handler_info) || HandlerBase::IsInternalAccessor(handler_info)); + auto accessor = LoadFromField(JSObject::Cast(holder.GetHeapObject()), handler_info); return FastRuntimeStub::CallSetter(thread, JSTaggedValue(receiver), value, accessor); } if (handler.IsTransitionHandler()) { @@ -277,52 +278,52 @@ JSTaggedValue ICRuntimeStub::StorePrototype(JSThread *thread, JSTaggedValue rece { INTERPRETER_TRACE(thread, StorePrototype); ASSERT(handler.IsPrototypeHandler()); - PrototypeHandler *prototypeHandler = PrototypeHandler::Cast(handler.GetTaggedObject()); - auto cellValue = prototypeHandler->GetProtoCell(); - ASSERT(cellValue.IsProtoChangeMarker()); - ProtoChangeMarker *cell = ProtoChangeMarker::Cast(cellValue.GetHeapObject()); + PrototypeHandler *prototype_handler = PrototypeHandler::Cast(handler.GetTaggedObject()); + auto cell_value = prototype_handler->GetProtoCell(); + ASSERT(cell_value.IsProtoChangeMarker()); + ProtoChangeMarker *cell = ProtoChangeMarker::Cast(cell_value.GetHeapObject()); if (cell->GetHasChanged()) { return JSTaggedValue::Hole(); } - auto holder = prototypeHandler->GetHolder(); - JSTaggedValue handlerInfo = prototypeHandler->GetHandlerInfo(); - return StoreICWithHandler(thread, receiver, holder, value, handlerInfo); + auto holder = prototype_handler->GetHolder(); + JSTaggedValue handler_info = prototype_handler->GetHandlerInfo(); + return StoreICWithHandler(thread, receiver, holder, value, handler_info); } void ICRuntimeStub::StoreWithTransition(JSThread *thread, JSObject *receiver, JSTaggedValue value, JSTaggedValue handler) { INTERPRETER_TRACE(thread, StoreWithTransition); - TransitionHandler *transitionHandler = TransitionHandler::Cast(handler.GetTaggedObject()); - JSHClass *newHClass = JSHClass::Cast(transitionHandler->GetTransitionHClass().GetTaggedObject()); - receiver->SetClass(newHClass); - uint32_t handlerInfo = transitionHandler->GetHandlerInfo().GetInt(); - ASSERT(HandlerBase::IsField(handlerInfo)); + TransitionHandler *transition_handler = TransitionHandler::Cast(handler.GetTaggedObject()); + JSHClass *new_h_class = JSHClass::Cast(transition_handler->GetTransitionHClass().GetTaggedObject()); + receiver->SetClass(new_h_class); + uint32_t handler_info = transition_handler->GetHandlerInfo().GetInt(); + ASSERT(HandlerBase::IsField(handler_info)); - if (!HandlerBase::IsInlinedProps(handlerInfo)) { + if (!HandlerBase::IsInlinedProps(handler_info)) { TaggedArray *array = TaggedArray::Cast(receiver->GetProperties().GetHeapObject()); int capacity = array->GetLength(); - int index = HandlerBase::GetOffset(handlerInfo); + int index = HandlerBase::GetOffset(handler_info); if (index >= capacity) { ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); JSHandle properties; - JSHandle objHandle(thread, receiver); - JSHandle valueHandle(thread, value); + JSHandle obj_handle(thread, receiver); + JSHandle value_handle(thread, value); if (capacity == 0) { capacity = JSObject::MIN_PROPERTIES_LENGTH; properties = factory->NewTaggedArray(capacity); } else { - auto arrayHandle = JSHandle(thread, array); - properties = factory->CopyArray(arrayHandle, capacity, JSObject::ComputePropertyCapacity(capacity)); + auto array_handle = JSHandle(thread, array); + properties = factory->CopyArray(array_handle, capacity, JSObject::ComputePropertyCapacity(capacity)); } - properties->Set(thread, index, valueHandle); - objHandle->SetProperties(thread, properties); + properties->Set(thread, index, value_handle); + obj_handle->SetProperties(thread, properties); return; } array->Set(thread, index, value); return; } - StoreField(thread, receiver, value, handlerInfo); + StoreField(thread, receiver, value, handler_info); } void ICRuntimeStub::StoreField(JSThread *thread, JSObject *receiver, JSTaggedValue value, uint32_t handler) @@ -338,10 +339,10 @@ void ICRuntimeStub::StoreField(JSThread *thread, JSObject *receiver, JSTaggedVal array->Set(thread, index, value); } -JSTaggedValue ICRuntimeStub::LoadFromField(JSObject *receiver, uint32_t handlerInfo) +JSTaggedValue ICRuntimeStub::LoadFromField(JSObject *receiver, uint32_t handler_info) { - int index = HandlerBase::GetOffset(handlerInfo); - if (HandlerBase::IsInlinedProps(handlerInfo)) { + int index = HandlerBase::GetOffset(handler_info); + if (HandlerBase::IsInlinedProps(handler_info)) { return JSTaggedValue(GET_VALUE(receiver, index * JSTaggedValue::TaggedTypeSize())); } return TaggedArray::Cast(receiver->GetProperties().GetHeapObject())->Get(index); @@ -376,16 +377,16 @@ JSTaggedValue ICRuntimeStub::LoadPrototype(JSThread *thread, JSTaggedValue recei { INTERPRETER_TRACE(thread, LoadPrototype); ASSERT(handler.IsPrototypeHandler()); - PrototypeHandler *prototypeHandler = PrototypeHandler::Cast(handler.GetTaggedObject()); - auto cellValue = prototypeHandler->GetProtoCell(); - ASSERT(cellValue.IsProtoChangeMarker()); - ProtoChangeMarker *cell = ProtoChangeMarker::Cast(cellValue.GetHeapObject()); + PrototypeHandler *prototype_handler = PrototypeHandler::Cast(handler.GetTaggedObject()); + auto cell_value = prototype_handler->GetProtoCell(); + ASSERT(cell_value.IsProtoChangeMarker()); + ProtoChangeMarker *cell = ProtoChangeMarker::Cast(cell_value.GetHeapObject()); if (cell->GetHasChanged()) { return JSTaggedValue::Hole(); } - auto holder = prototypeHandler->GetHolder(); - JSTaggedValue handlerInfo = prototypeHandler->GetHandlerInfo(); - return LoadICWithHandler(thread, receiver, holder, handlerInfo); + auto holder = prototype_handler->GetHolder(); + JSTaggedValue handler_info = prototype_handler->GetHandlerInfo(); + return LoadICWithHandler(thread, receiver, holder, handler_info); } JSTaggedValue ICRuntimeStub::LoadICWithHandler(JSThread *thread, JSTaggedValue receiver, JSTaggedValue holder, @@ -393,15 +394,15 @@ JSTaggedValue ICRuntimeStub::LoadICWithHandler(JSThread *thread, JSTaggedValue r { INTERPRETER_TRACE(thread, LoadICWithHandler); if (LIKELY(handler.IsInt())) { - auto handlerInfo = static_cast(handler.GetInt()); - if (LIKELY(HandlerBase::IsField(handlerInfo))) { - return LoadFromField(JSObject::Cast(holder.GetHeapObject()), handlerInfo); + auto handler_info = static_cast(handler.GetInt()); + if (LIKELY(HandlerBase::IsField(handler_info))) { + return LoadFromField(JSObject::Cast(holder.GetHeapObject()), handler_info); } - if (HandlerBase::IsNonExist(handlerInfo)) { + if (HandlerBase::IsNonExist(handler_info)) { return JSTaggedValue::Hole(); } - ASSERT(HandlerBase::IsAccessor(handlerInfo) || HandlerBase::IsInternalAccessor(handlerInfo)); - auto accessor = LoadFromField(JSObject::Cast(holder.GetHeapObject()), handlerInfo); + ASSERT(HandlerBase::IsAccessor(handler_info) || HandlerBase::IsInternalAccessor(handler_info)); + auto accessor = LoadFromField(JSObject::Cast(holder.GetHeapObject()), handler_info); return FastRuntimeStub::CallGetter(thread, receiver, holder, accessor); } @@ -418,50 +419,50 @@ JSTaggedValue ICRuntimeStub::LoadElement(JSObject *receiver, JSTaggedValue key) if (index >= JSObject::MAX_ELEMENT_INDEX) { return JSTaggedValue::Hole(); } - uint32_t elementIndex = index; + uint32_t element_index = index; TaggedArray *elements = TaggedArray::Cast(receiver->GetElements().GetHeapObject()); - if (elements->GetLength() <= elementIndex) { + if (elements->GetLength() <= element_index) { return JSTaggedValue::Hole(); } - JSTaggedValue value = elements->Get(elementIndex); + JSTaggedValue value = elements->Get(element_index); // TaggedArray elements return value; } JSTaggedValue ICRuntimeStub::StoreElement(JSThread *thread, JSObject *receiver, JSTaggedValue key, JSTaggedValue value, - uint32_t handlerInfo) + uint32_t handler_info) { INTERPRETER_TRACE(thread, StoreElement); - ASSERT(HandlerBase::IsElement(handlerInfo)); + ASSERT(HandlerBase::IsElement(handler_info)); auto index = TryToElementsIndex(key); if (index >= JSObject::MAX_ELEMENT_INDEX) { return JSTaggedValue::Hole(); } - uint32_t elementIndex = index; - if (HandlerBase::IsJSArray(handlerInfo)) { + uint32_t element_index = index; + if (HandlerBase::IsJSArray(handler_info)) { JSArray *arr = JSArray::Cast(receiver); - uint32_t oldLength = arr->GetArrayLength(); - if (elementIndex >= oldLength) { - arr->SetArrayLength(thread, elementIndex + 1); + uint32_t old_length = arr->GetArrayLength(); + if (element_index >= old_length) { + arr->SetArrayLength(thread, element_index + 1); } } TaggedArray *elements = TaggedArray::Cast(receiver->GetElements().GetHeapObject()); uint32_t capacity = elements->GetLength(); - if (elementIndex >= capacity) { - if (JSObject::ShouldTransToDict(capacity, elementIndex)) { + if (element_index >= capacity) { + if (JSObject::ShouldTransToDict(capacity, element_index)) { return JSTaggedValue::Hole(); } - [[maybe_unused]] EcmaHandleScope handleScope(thread); - JSHandle receiverHandle(thread, receiver); - JSHandle valueHandle(thread, value); - elements = - *JSObject::GrowElementsCapacity(thread, receiverHandle, JSObject::ComputeElementCapacity(elementIndex + 1)); - receiverHandle->SetElements(thread, JSTaggedValue(elements)); - elements->Set(thread, elementIndex, valueHandle); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); + JSHandle receiver_handle(thread, receiver); + JSHandle value_handle(thread, value); + elements = *JSObject::GrowElementsCapacity(thread, receiver_handle, + JSObject::ComputeElementCapacity(element_index + 1)); + receiver_handle->SetElements(thread, JSTaggedValue(elements)); + elements->Set(thread, element_index, value_handle); return JSTaggedValue::Undefined(); } - elements->Set(thread, elementIndex, value); + elements->Set(thread, element_index, value); return JSTaggedValue::Undefined(); } diff --git a/runtime/ic/ic_runtime_stub.h b/runtime/ic/ic_runtime_stub.h index 811e4d1fb..bd191a5e1 100644 --- a/runtime/ic/ic_runtime_stub.h +++ b/runtime/ic/ic_runtime_stub.h @@ -41,17 +41,17 @@ public: } ARK_INLINE static inline bool HaveICForFunction(JSThread *thread); - ARK_INLINE static inline JSTaggedValue LoadGlobalICByName(JSThread *thread, JSTaggedValue globalValue, - JSTaggedValue key, uint32_t slotId, - bool isTryLoad = false); - ARK_INLINE static inline JSTaggedValue StoreGlobalICByName(JSThread *thread, JSTaggedValue globalValue, - JSTaggedValue key, JSTaggedValue value, uint32_t slotId, - bool isTryStore = false); + ARK_INLINE static inline JSTaggedValue LoadGlobalICByName(JSThread *thread, JSTaggedValue global_value, + JSTaggedValue key, uint32_t slot_id, + bool is_try_load = false); + ARK_INLINE static inline JSTaggedValue StoreGlobalICByName(JSThread *thread, JSTaggedValue global_value, + JSTaggedValue key, JSTaggedValue value, uint32_t slot_id, + bool is_try_store = false); ARK_INLINE static inline JSTaggedValue LoadICByName(JSThread *thread, JSTaggedValue receiver, JSTaggedValue key, - uint32_t slotId); + uint32_t slot_id); ARK_INLINE static inline JSTaggedValue StoreICByName(JSThread *thread, JSTaggedValue receiver, JSTaggedValue key, - JSTaggedValue value, uint32_t slotId); - ARK_INLINE static inline JSTaggedValue CheckPolyHClass(JSTaggedValue cachedValue, JSHClass *hclass); + JSTaggedValue value, uint32_t slot_id); + ARK_INLINE static inline JSTaggedValue CheckPolyHClass(JSTaggedValue cached_value, JSHClass *hclass); static inline JSTaggedValue LoadICWithHandler(JSThread *thread, JSTaggedValue receiver, JSTaggedValue holder, JSTaggedValue handler); static inline JSTaggedValue StoreICWithHandler(JSThread *thread, JSTaggedValue receiver, JSTaggedValue holder, @@ -60,7 +60,7 @@ public: JSTaggedValue handler); ARK_INLINE static inline JSTaggedValue StorePrototype(JSThread *thread, JSTaggedValue receiver, JSTaggedValue value, JSTaggedValue handler); - ARK_INLINE static inline JSTaggedValue LoadFromField(JSObject *receiver, uint32_t handlerInfo); + ARK_INLINE static inline JSTaggedValue LoadFromField(JSObject *receiver, uint32_t handler_info); ARK_INLINE static inline void StoreField(JSThread *thread, JSObject *receiver, JSTaggedValue value, uint32_t handler); ARK_INLINE static inline JSTaggedValue LoadGlobal(JSTaggedValue handler); @@ -68,27 +68,27 @@ public: ARK_INLINE static inline JSTaggedValue LoadPrototype(JSThread *thread, JSTaggedValue receiver, JSTaggedValue handler); ARK_INLINE static inline JSTaggedValue LoadICByValue(JSThread *thread, JSTaggedValue receiver, JSTaggedValue key, - uint32_t slotId); + uint32_t slot_id); ARK_INLINE static inline JSTaggedValue StoreICByValue(JSThread *thread, JSTaggedValue receiver, JSTaggedValue key, - JSTaggedValue value, uint32_t slotId); + JSTaggedValue value, uint32_t slot_id); ARK_INLINE static inline JSTaggedValue LoadElement(JSObject *receiver, JSTaggedValue key); ARK_INLINE static inline JSTaggedValue StoreElement(JSThread *thread, JSObject *receiver, JSTaggedValue key, - JSTaggedValue value, uint32_t handlerInfo); + JSTaggedValue value, uint32_t handler_info); ARK_INLINE static inline uint32_t TryToElementsIndex(JSTaggedValue key); private: - static inline uint32_t MapSlotId(JSThread *thread, uint32_t slotId); + static inline uint32_t MapSlotId(JSThread *thread, uint32_t slot_id); static inline ProfileTypeInfo *GetRuntimeProfileTypeInfo(JSThread *thread); - ARK_NOINLINE static JSTaggedValue LoadMissedICByName(JSThread *thread, ProfileTypeInfo *profileTypeArray, - JSTaggedValue receiver, JSTaggedValue key, uint32_t slotId); - ARK_NOINLINE static JSTaggedValue StoreMissedICByName(JSThread *thread, ProfileTypeInfo *profileTypeInfo, + ARK_NOINLINE static JSTaggedValue LoadMissedICByName(JSThread *thread, ProfileTypeInfo *profile_type_array, + JSTaggedValue receiver, JSTaggedValue key, uint32_t slot_id); + ARK_NOINLINE static JSTaggedValue StoreMissedICByName(JSThread *thread, ProfileTypeInfo *profile_type_info, JSTaggedValue receiver, JSTaggedValue key, - JSTaggedValue value, uint32_t slotId); - ARK_NOINLINE static JSTaggedValue LoadMissedICByValue(JSThread *thread, ProfileTypeInfo *profileTypeInfo, - JSTaggedValue receiver, JSTaggedValue key, uint32_t slotId); - ARK_NOINLINE static JSTaggedValue StoreMissedICByValue(JSThread *thread, ProfileTypeInfo *profileTypeInfo, + JSTaggedValue value, uint32_t slot_id); + ARK_NOINLINE static JSTaggedValue LoadMissedICByValue(JSThread *thread, ProfileTypeInfo *profile_type_info, + JSTaggedValue receiver, JSTaggedValue key, uint32_t slot_id); + ARK_NOINLINE static JSTaggedValue StoreMissedICByValue(JSThread *thread, ProfileTypeInfo *profile_type_info, JSTaggedValue receiver, JSTaggedValue key, - JSTaggedValue value, uint32_t slotId); + JSTaggedValue value, uint32_t slot_id); }; } // namespace panda::ecmascript diff --git a/runtime/ic/profile_type_info.cpp b/runtime/ic/profile_type_info.cpp index 3f72ad55e..a7e9cc569 100644 --- a/runtime/ic/profile_type_info.cpp +++ b/runtime/ic/profile_type_info.cpp @@ -21,20 +21,20 @@ namespace panda::ecmascript { void ProfileTypeAccessor::AddElementHandler(JSHandle dynclass, JSHandle handler) const { - auto profileData = profileTypeInfo_->Get(slotId_); + auto profileData = profile_type_info_->Get(slot_id_); if (profileData.IsHole()) { return; } - auto index = slotId_; + auto index = slot_id_; if (profileData.IsUndefined()) { - profileTypeInfo_->Set(thread_, index, dynclass.GetTaggedValue()); - profileTypeInfo_->Set(thread_, index + 1, handler.GetTaggedValue()); + profile_type_info_->Set(thread_, index, dynclass.GetTaggedValue()); + profile_type_info_->Set(thread_, index + 1, handler.GetTaggedValue()); return; } // clear key ic if (profileData.IsString() || profileData.IsSymbol()) { - profileTypeInfo_->Set(thread_, index, dynclass.GetTaggedValue()); - profileTypeInfo_->Set(thread_, index + 1, handler.GetTaggedValue()); + profile_type_info_->Set(thread_, index, dynclass.GetTaggedValue()); + profile_type_info_->Set(thread_, index + 1, handler.GetTaggedValue()); return; } AddHandlerWithoutKey(dynclass, handler); @@ -43,23 +43,23 @@ void ProfileTypeAccessor::AddElementHandler(JSHandle dynclass, JS void ProfileTypeAccessor::AddHandlerWithoutKey(JSHandle dynclass, JSHandle handler) const { if (IsNamedGlobalIC(GetKind())) { - profileTypeInfo_->Set(thread_, slotId_, handler.GetTaggedValue()); + profile_type_info_->Set(thread_, slot_id_, handler.GetTaggedValue()); return; } - auto index = slotId_; - auto profileData = profileTypeInfo_->Get(index); + auto index = slot_id_; + auto profileData = profile_type_info_->Get(index); if (profileData.IsHole()) { return; } - while (!profileData.IsUndefined() && index < slotId_ + 4U) { + while (!profileData.IsUndefined() && index < slot_id_ + 4U) { index += 2U; } - if (index == slotId_ + 4U) { - profileTypeInfo_->Set(thread_, slotId_, JSTaggedValue::Hole()); + if (index == slot_id_ + 4U) { + profile_type_info_->Set(thread_, slot_id_, JSTaggedValue::Hole()); return; } - profileTypeInfo_->Set(thread_, index, dynclass.GetTaggedValue()); - profileTypeInfo_->Set(thread_, index + 1, handler.GetTaggedValue()); + profile_type_info_->Set(thread_, index, dynclass.GetTaggedValue()); + profile_type_info_->Set(thread_, index + 1, handler.GetTaggedValue()); } void ProfileTypeAccessor::AddHandlerWithKey(JSHandle key, JSHandle dynclass, @@ -69,48 +69,48 @@ void ProfileTypeAccessor::AddHandlerWithKey(JSHandle key, JSHandl AddGlobalHandlerKey(key, handler); return; } - auto profileData = profileTypeInfo_->Get(slotId_); - if (profileData.IsUndefined() && profileTypeInfo_->Get(slotId_ + 1).IsUndefined()) { - profileTypeInfo_->Set(thread_, slotId_, key.GetTaggedValue()); - profileTypeInfo_->Set(thread_, slotId_ + 1U, dynclass.GetTaggedValue()); - profileTypeInfo_->Set(thread_, slotId_ + 2U, handler.GetTaggedValue()); + auto profileData = profile_type_info_->Get(slot_id_); + if (profileData.IsUndefined() && profile_type_info_->Get(slot_id_ + 1).IsUndefined()) { + profile_type_info_->Set(thread_, slot_id_, key.GetTaggedValue()); + profile_type_info_->Set(thread_, slot_id_ + 1U, dynclass.GetTaggedValue()); + profile_type_info_->Set(thread_, slot_id_ + 2U, handler.GetTaggedValue()); return; } // for element ic, profileData may dynclass or taggedarray if (key.GetTaggedValue() != profileData) { - profileTypeInfo_->Set(thread_, slotId_, JSTaggedValue::Hole()); + profile_type_info_->Set(thread_, slot_id_, JSTaggedValue::Hole()); return; } } void ProfileTypeAccessor::AddGlobalHandlerKey(JSHandle key, JSHandle handler) const { - uint32_t index = slotId_; - JSTaggedValue indexVal = profileTypeInfo_->Get(index); + uint32_t index = slot_id_; + JSTaggedValue indexVal = profile_type_info_->Get(index); if (indexVal.IsUndefined()) { - profileTypeInfo_->Set(thread_, index, key.GetTaggedValue()); - profileTypeInfo_->Set(thread_, index + 1, handler.GetTaggedValue()); + profile_type_info_->Set(thread_, index, key.GetTaggedValue()); + profile_type_info_->Set(thread_, index + 1, handler.GetTaggedValue()); return; } index += 2U; if (indexVal.IsUndefined()) { - profileTypeInfo_->Set(thread_, index, key.GetTaggedValue()); - profileTypeInfo_->Set(thread_, index + 1, handler.GetTaggedValue()); + profile_type_info_->Set(thread_, index, key.GetTaggedValue()); + profile_type_info_->Set(thread_, index + 1, handler.GetTaggedValue()); return; } - profileTypeInfo_->Set(thread_, slotId_, JSTaggedValue::Hole()); + profile_type_info_->Set(thread_, slot_id_, JSTaggedValue::Hole()); } void ProfileTypeAccessor::AddGlobalRecordHandler(JSHandle handler) const { - uint32_t index = slotId_; - profileTypeInfo_->Set(thread_, index, handler.GetTaggedValue()); + uint32_t index = slot_id_; + profile_type_info_->Set(thread_, index, handler.GetTaggedValue()); } void ProfileTypeAccessor::SetAsMega() const { - profileTypeInfo_->Set(thread_, slotId_, JSTaggedValue::Hole()); - profileTypeInfo_->Set(thread_, slotId_ + 1, JSTaggedValue::Hole()); + profile_type_info_->Set(thread_, slot_id_, JSTaggedValue::Hole()); + profile_type_info_->Set(thread_, slot_id_ + 1, JSTaggedValue::Hole()); } std::string ICKindToString(ICKind kind) @@ -161,7 +161,7 @@ std::string ProfileTypeAccessor::ICStateToString(ProfileTypeAccessor::ICState st ProfileTypeAccessor::ICState ProfileTypeAccessor::GetICState() const { - auto profileData = profileTypeInfo_->Get(slotId_); + auto profileData = profile_type_info_->Get(slot_id_); if (profileData.IsUndefined()) { return ICState::UNINIT; } @@ -187,7 +187,7 @@ ProfileTypeAccessor::ICState ProfileTypeAccessor::GetICState() const TaggedArray *array = TaggedArray::Cast(profileData.GetHeapObject()); return array->GetLength() == MONO_CASE_NUM ? ICState::MONO : ICState::POLY; // 2 : test case } - profileData = profileTypeInfo_->Get(slotId_ + 1); + profileData = profile_type_info_->Get(slot_id_ + 1); TaggedArray *array = TaggedArray::Cast(profileData.GetHeapObject()); return array->GetLength() == MONO_CASE_NUM ? ICState::MONO : ICState::POLY; // 2 : test case } diff --git a/runtime/ic/profile_type_info.h b/runtime/ic/profile_type_info.h index 55910ebe9..d6dc8a205 100644 --- a/runtime/ic/profile_type_info.h +++ b/runtime/ic/profile_type_info.h @@ -109,8 +109,8 @@ public: MEGA, }; - ProfileTypeAccessor(JSThread *thread, JSHandle profileTypeInfo, uint32_t slotId, ICKind kind) - : thread_(thread), profileTypeInfo_(profileTypeInfo), slotId_(slotId), kind_(kind) + ProfileTypeAccessor(JSThread *thread, JSHandle profile_type_info, uint32_t slot_id, ICKind kind) + : thread_(thread), profile_type_info_(profile_type_info), slot_id_(slot_id), kind_(kind) { } ~ProfileTypeAccessor() = default; @@ -136,8 +136,8 @@ public: private: JSThread *thread_; - JSHandle profileTypeInfo_; - uint32_t slotId_; + JSHandle profile_type_info_; + uint32_t slot_id_; ICKind kind_; }; } // namespace panda::ecmascript diff --git a/runtime/ic/properties_cache-inl.h b/runtime/ic/properties_cache-inl.h index 534b31e0c..8224a727b 100644 --- a/runtime/ic/properties_cache-inl.h +++ b/runtime/ic/properties_cache-inl.h @@ -20,37 +20,37 @@ #include "plugins/ecmascript/runtime/js_tagged_value-inl.h" namespace panda::ecmascript { -int PropertiesCache::Get(JSHClass *jsHclass, JSTaggedValue key) +int PropertiesCache::Get(JSHClass *js_hclass, JSTaggedValue key) { - int hash = Hash(jsHclass, key); + int hash = Hash(js_hclass, key); PropertyKey &prop = keys_[hash]; - if ((prop.hclass_ == jsHclass) && (prop.key_ == key)) { - return keys_[hash].results_; + if ((prop.hclass == js_hclass) && (prop.key == key)) { + return keys_[hash].results; } return NOT_FOUND; } -void PropertiesCache::Set(JSHClass *jsHclass, JSTaggedValue key, int index) +void PropertiesCache::Set(JSHClass *js_hclass, JSTaggedValue key, int index) { - int hash = Hash(jsHclass, key); + int hash = Hash(js_hclass, key); PropertyKey &prop = keys_[hash]; - prop.hclass_ = jsHclass; - prop.key_ = key; - keys_[hash].results_ = index; + prop.hclass = js_hclass; + prop.key = key; + keys_[hash].results = index; } void PropertiesCache::Clear() { for (auto &key : keys_) { - key.hclass_ = nullptr; + key.hclass = nullptr; } } int PropertiesCache::Hash(JSHClass *cls, JSTaggedValue key) { - uint32_t clsHash = JSHClass::Hash(cls); - uint32_t keyHash = key.GetKeyHashCode(); - return static_cast((clsHash ^ keyHash) & CACHE_LENGTH_MASK); + uint32_t cls_hash = JSHClass::Hash(cls); + uint32_t key_hash = key.GetKeyHashCode(); + return static_cast((cls_hash ^ key_hash) & CACHE_LENGTH_MASK); } } // namespace panda::ecmascript #endif // ECMASCRIPT_IC_PROPERTIES_CACHE_INL_H diff --git a/runtime/ic/properties_cache.h b/runtime/ic/properties_cache.h index 1c43e738f..19d5a6221 100644 --- a/runtime/ic/properties_cache.h +++ b/runtime/ic/properties_cache.h @@ -26,8 +26,8 @@ namespace panda::ecmascript { class EcmaVM; class PropertiesCache { public: - inline int Get(JSHClass *jsHclass, JSTaggedValue key); - inline void Set(JSHClass *jsHclass, JSTaggedValue key, int index); + inline int Get(JSHClass *js_hclass, JSTaggedValue key); + inline void Set(JSHClass *js_hclass, JSTaggedValue key, int index); inline void Clear(); static const int NOT_FOUND = -1; @@ -36,23 +36,23 @@ public: static const uint32_t CACHE_LENGTH_MASK = CACHE_LENGTH - 1; struct PropertyKey { - JSHClass *hclass_ {nullptr}; - JSTaggedValue key_ {JSTaggedValue::Hole()}; - int results_ {NOT_FOUND}; + JSHClass *hclass {nullptr}; + JSTaggedValue key {JSTaggedValue::Hole()}; + int results {NOT_FOUND}; static constexpr uint32_t GetHClassOffset() { - return MEMBER_OFFSET(PropertyKey, hclass_); + return MEMBER_OFFSET(PropertyKey, hclass); } static constexpr uint32_t GetKeyOffset() { - return MEMBER_OFFSET(PropertyKey, key_); + return MEMBER_OFFSET(PropertyKey, key); } static constexpr uint32_t GetResultsOffset() { - return MEMBER_OFFSET(PropertyKey, results_); + return MEMBER_OFFSET(PropertyKey, results); } }; @@ -63,9 +63,9 @@ private: PropertiesCache() { for (uint32_t i = 0; i < CACHE_LENGTH; ++i) { - keys_[i].hclass_ = nullptr; - keys_[i].key_ = JSTaggedValue::Hole(); - keys_[i].results_ = NOT_FOUND; + keys_[i].hclass = nullptr; + keys_[i].key = JSTaggedValue::Hole(); + keys_[i].results = NOT_FOUND; } } ~PropertiesCache() = default; diff --git a/runtime/internal_call_params.cpp b/runtime/internal_call_params.cpp index c3faa22d1..d305ad648 100644 --- a/runtime/internal_call_params.cpp +++ b/runtime/internal_call_params.cpp @@ -18,8 +18,8 @@ namespace panda::ecmascript { void InternalCallParams::MakeArgv(const EcmaRuntimeCallInfo *info, uint32_t position) { - int32_t mayLenth = info->GetArgsNumber() - position; - uint32_t length = mayLenth > 0 ? mayLenth : 0; + int32_t may_lenth = info->GetArgsNumber() - position; + uint32_t length = may_lenth > 0 ? may_lenth : 0; if (LIKELY(length <= InternalCallParams::RESERVE_INTERNAL_CALL_PARAMS_FIXED_LENGTH)) { EnableFixedModeAndSetLength(length); for (uint32_t index = 0; index < length; ++index) { @@ -73,21 +73,21 @@ void InternalCallParams::MakeArgList(const TaggedArray *argv) } } -void InternalCallParams::MakeBoundArgv(const JSThread *thread, const JSHandle &boundFunc) +void InternalCallParams::MakeBoundArgv(const JSThread *thread, const JSHandle &bound_func) { - JSHandle boundArgs(thread, boundFunc->GetBoundArguments()); - uint32_t boundLength = boundArgs->GetLength(); - uint32_t length = IsFixedMode() ? boundLength + GetFixedLength() : boundLength + GetVariableLength(); + JSHandle bound_args(thread, bound_func->GetBoundArguments()); + uint32_t bound_length = bound_args->GetLength(); + uint32_t length = IsFixedMode() ? bound_length + GetFixedLength() : bound_length + GetVariableLength(); if (LIKELY(length <= InternalCallParams::RESERVE_INTERNAL_CALL_PARAMS_FIXED_LENGTH)) { EnableFixedModeAndSetLength(length); // Prevent override, reverse write order - for (array_ssize_t index = length - 1; index >= static_cast(boundLength); --index) { - SetFixedBuffer(index, GetFixedBuffer(index - boundLength)); + for (ArraySsizeT index = length - 1; index >= static_cast(bound_length); --index) { + SetFixedBuffer(index, GetFixedBuffer(index - bound_length)); } - for (uint32_t index = 0; index < boundLength; ++index) { - SetFixedBuffer(index, boundArgs->Get(index)); + for (uint32_t index = 0; index < bound_length; ++index) { + SetFixedBuffer(index, bound_args->Get(index)); } return; } @@ -96,19 +96,19 @@ void InternalCallParams::MakeBoundArgv(const JSThread *thread, const JSHandleGet(index)); + for (uint32_t index = 0; index < bound_length; ++index) { + SetVariableBuffer(index, bound_args->Get(index)); } - for (uint32_t index = boundLength; index < length; ++index) { - SetVariableBuffer(index, GetFixedBuffer(index - boundLength)); + for (uint32_t index = bound_length; index < length; ++index) { + SetVariableBuffer(index, GetFixedBuffer(index - bound_length)); } return; } EnableVariableModeAndSetLength(length); - for (array_ssize_t index = boundLength - 1; index >= 0; --index) { - InsertVariableBuffer(boundArgs->Get(index)); + for (ArraySsizeT index = bound_length - 1; index >= 0; --index) { + InsertVariableBuffer(bound_args->Get(index)); } } diff --git a/runtime/internal_call_params.h b/runtime/internal_call_params.h index d707522de..dccb6791a 100644 --- a/runtime/internal_call_params.h +++ b/runtime/internal_call_params.h @@ -126,7 +126,7 @@ public: void MakeArgList(const TaggedArray *argv); void MakeArgListWithHole(const TaggedArray *argv, uint32_t length); - void MakeBoundArgv(const JSThread *thread, const JSHandle &boundFunc); + void MakeBoundArgv(const JSThread *thread, const JSHandle &bound_func); void Iterate(const RootRangeVisitor &v) const; diff --git a/runtime/interpreter/ecma-interpreter-inl.h b/runtime/interpreter/ecma-interpreter-inl.h index b2174dde4..b083fd5d0 100644 --- a/runtime/interpreter/ecma-interpreter-inl.h +++ b/runtime/interpreter/ecma-interpreter-inl.h @@ -2252,7 +2252,7 @@ public: template ALWAYS_INLINE void HandleEcmaPoplexenvdyn() { - intrinsics::popLexenvDyn(this->GetJSThread()); + intrinsics::PopLexenvDyn(this->GetJSThread()); this->template MoveToNextInst(); } diff --git a/runtime/interpreter/js_decode_call_instr.h b/runtime/interpreter/js_decode_call_instr.h index 8d38b15ee..9fc599ae5 100644 --- a/runtime/interpreter/js_decode_call_instr.h +++ b/runtime/interpreter/js_decode_call_instr.h @@ -15,24 +15,24 @@ template ; - constexpr auto op = R::template Get(); - if constexpr (op == R::template Get()) { + constexpr auto OP = R::template Get(); + if constexpr (OP == R::template Get()) { static_assert(FORMAT == R::template Get()); return NUM_MANDATORY_JSFUNC_ARGS + 0; - } else if constexpr (op == R::template Get()) { + } else if constexpr (OP == R::template Get()) { static_assert(FORMAT == R::template Get()); return NUM_MANDATORY_JSFUNC_ARGS + 1; - } else if constexpr (op == R::template Get()) { + } else if constexpr (OP == R::template Get()) { static_assert(FORMAT == R::template Get()); return NUM_MANDATORY_JSFUNC_ARGS + 2; - } else if constexpr (op == R::template Get()) { + } else if constexpr (OP == R::template Get()) { static_assert(FORMAT == R::template Get()); return NUM_MANDATORY_JSFUNC_ARGS + 3; - } else if constexpr (op == R::template Get()) { + } else if constexpr (OP == R::template Get()) { static_assert(FORMAT == R::template Get()); auto imm = inst.GetImm(); return NUM_MANDATORY_JSFUNC_ARGS + imm; - } else if constexpr (op == R::template Get()) { + } else if constexpr (OP == R::template Get()) { static_assert(FORMAT == R::template Get()); auto imm = inst.GetImm(); ASSERT(imm >= 1); // 'this' is always passed to the function diff --git a/runtime/interpreter/slow_runtime_helper.cpp b/runtime/interpreter/slow_runtime_helper.cpp index 088fe533b..aab07b22e 100644 --- a/runtime/interpreter/slow_runtime_helper.cpp +++ b/runtime/interpreter/slow_runtime_helper.cpp @@ -147,12 +147,12 @@ JSTaggedValue ConstructGeneric(JSThread *thread, JSHandle ctor, JSHa for (uint32_t i = 0; i < pre_args_size; ++i) { values.emplace_back(tga_pre_args->Get(i).GetRawData()); } - for (array_size_t i = 0; i < args_count; ++i) { + for (ArraySizeT i = 0; i < args_count; ++i) { // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) values.emplace_back(stkargs[i]); } } else { - for (array_size_t i = 0; i < args_count; ++i) { + for (ArraySizeT i = 0; i < args_count; ++i) { // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) values.emplace_back(stkargs[i]); } @@ -232,7 +232,7 @@ JSTaggedValue ConstructProxy(JSThread *thread, JSHandle ctor, JSHandle< args->Set(thread, i, value); } } - for (array_size_t i = 0; i < args_count; ++i) { + for (ArraySizeT i = 0; i < args_count; ++i) { // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) args->Set(thread, i + pre_args_size, JSTaggedValue(stkargs[i])); } diff --git a/runtime/interpreter/slow_runtime_stub.cpp b/runtime/interpreter/slow_runtime_stub.cpp index 64bfe2a84..97d1cc7bc 100644 --- a/runtime/interpreter/slow_runtime_stub.cpp +++ b/runtime/interpreter/slow_runtime_stub.cpp @@ -461,7 +461,7 @@ JSTaggedValue SlowRuntimeStub::CreateObjectWithExcludedKeys(JSThread *thread, ui if (!excluded_key.IsUndefined()) { num_excluded_keys = num_keys + 1; excluded_keys->Set(thread, 0, excluded_key); - for (array_size_t i = 1; i < num_excluded_keys; i++) { + for (ArraySizeT i = 1; i < num_excluded_keys; i++) { // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) excluded_key = JSTaggedValue(stkargs[i]); excluded_keys->Set(thread, i, excluded_key); diff --git a/runtime/intrinsics-inl.h b/runtime/intrinsics-inl.h index 734b65ba7..863830052 100644 --- a/runtime/intrinsics-inl.h +++ b/runtime/intrinsics-inl.h @@ -45,7 +45,7 @@ static inline JSTaggedValue GetRuntimeProfileTypeInfo(JSThread *thread) } #endif -template +template static inline JSTaggedValue HandlerCall(JSThread *thread, JSTaggedValue fn_object, JSTaggedValue *args, uint32_t num_args) { @@ -60,7 +60,7 @@ static inline JSTaggedValue HandlerCall(JSThread *thread, JSTaggedValue fn_objec ECMAObject *js_object = ECMAObject::Cast(fn_object.GetHeapObject()); Method *method = js_object->GetCallTarget(); - if constexpr (!this_call) { + if constexpr (!THIS_CALL) { ASSERT(args[2] == JSTaggedValue::Undefined()); // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic) if (fn_object.IsJSFunction() && !JSFunction::Cast(js_object)->IsStrict()) { // Set this=GlobalObject for sloppy function @@ -202,12 +202,12 @@ INLINE_ECMA_INTRINSICS uint64_t Add2Dyn(JSThread *thread, uint64_t lhs, uint64_t return JSTaggedValue(a0 + a1).GetRawData(); } if (left.IsNumber() && right.IsNumber()) { - double a0Double = left.IsInt() ? left.GetInt() : left.GetDouble(); - double a1Double = right.IsInt() ? right.GetInt() : right.GetDouble(); - return JSTaggedValue(a0Double + a1Double).GetRawData(); + double a0_double = left.IsInt() ? left.GetInt() : left.GetDouble(); + double a1_double = right.IsInt() ? right.GetInt() : right.GetDouble(); + return JSTaggedValue(a0_double + a1_double).GetRawData(); } - auto ecmaVm = thread->GetEcmaVM(); - return SlowRuntimeStub::Add2Dyn(thread, ecmaVm, left, right).GetRawData(); + auto ecma_vm = thread->GetEcmaVM(); + return SlowRuntimeStub::Add2Dyn(thread, ecma_vm, left, right).GetRawData(); } // NOLINTNEXTLINE(misc-definitions-in-headers) @@ -226,9 +226,9 @@ INLINE_ECMA_INTRINSICS uint64_t Sub2Dyn(JSThread *thread, uint64_t lhs, uint64_t return JSTaggedValue(a0 + a1).GetRawData(); } if (left.IsNumber() && right.IsNumber()) { - double a0Double = left.IsInt() ? left.GetInt() : left.GetDouble(); - double a1Double = right.IsInt() ? right.GetInt() : right.GetDouble(); - return JSTaggedValue(a0Double - a1Double).GetRawData(); + double a0_double = left.IsInt() ? left.GetInt() : left.GetDouble(); + double a1_double = right.IsInt() ? right.GetInt() : right.GetDouble(); + return JSTaggedValue(a0_double - a1_double).GetRawData(); } return SlowRuntimeStub::Sub2Dyn(thread, left, right).GetRawData(); } @@ -284,9 +284,9 @@ INLINE_ECMA_INTRINSICS uint64_t ExpDyn(JSThread *thread, uint64_t base_exp, uint JSTaggedValue res; if (base.IsNumber() && exponent.IsNumber()) { - double doubleBase = base.IsInt() ? base.GetInt() : base.GetDouble(); - double doubleExponent = exponent.IsInt() ? exponent.GetInt() : exponent.GetDouble(); - res = base::NumberHelper::Pow(doubleBase, doubleExponent); + double double_base = base.IsInt() ? base.GetInt() : base.GetDouble(); + double double_exponent = exponent.IsInt() ? exponent.GetInt() : exponent.GetDouble(); + res = base::NumberHelper::Pow(double_base, double_exponent); } else { res = SlowRuntimeStub::ExpDyn(thread, base, exponent); } @@ -342,9 +342,9 @@ INLINE_ECMA_INTRINSICS uint64_t LessDyn(JSThread *thread, uint64_t lhs, uint64_t auto right = JSTaggedValue(rhs); if (left.IsNumber() && right.IsNumber()) { - double valueA = left.IsInt() ? static_cast(left.GetInt()) : left.GetDouble(); - double valueB = right.IsInt() ? static_cast(right.GetInt()) : right.GetDouble(); - bool ret = JSTaggedValue::StrictNumberCompare(valueA, valueB) == ComparisonResult::LESS; + double value_a = left.IsInt() ? static_cast(left.GetInt()) : left.GetDouble(); + double value_b = right.IsInt() ? static_cast(right.GetInt()) : right.GetDouble(); + bool ret = JSTaggedValue::StrictNumberCompare(value_a, value_b) == ComparisonResult::LESS; return ret ? JSTaggedValue::True().GetRawData() : JSTaggedValue::False().GetRawData(); } return SlowRuntimeStub::LessDyn(thread, left, right).GetRawData(); @@ -357,9 +357,9 @@ INLINE_ECMA_INTRINSICS uint64_t LessEqDyn(JSThread *thread, uint64_t lhs, uint64 auto right = JSTaggedValue(rhs); if (left.IsNumber() && right.IsNumber()) { - double valueA = left.IsInt() ? static_cast(left.GetInt()) : left.GetDouble(); - double valueB = right.IsInt() ? static_cast(right.GetInt()) : right.GetDouble(); - bool ret = JSTaggedValue::StrictNumberCompare(valueA, valueB) <= ComparisonResult::EQUAL; + double value_a = left.IsInt() ? static_cast(left.GetInt()) : left.GetDouble(); + double value_b = right.IsInt() ? static_cast(right.GetInt()) : right.GetDouble(); + bool ret = JSTaggedValue::StrictNumberCompare(value_a, value_b) <= ComparisonResult::EQUAL; return ret ? JSTaggedValue::True().GetRawData() : JSTaggedValue::False().GetRawData(); } return SlowRuntimeStub::LessEqDyn(thread, left, right).GetRawData(); @@ -372,9 +372,9 @@ INLINE_ECMA_INTRINSICS uint64_t GreaterDyn(JSThread *thread, uint64_t lhs, uint6 auto right = JSTaggedValue(rhs); if (left.IsNumber() && right.IsNumber()) { - double valueA = left.IsInt() ? static_cast(left.GetInt()) : left.GetDouble(); - double valueB = right.IsInt() ? static_cast(right.GetInt()) : right.GetDouble(); - bool ret = JSTaggedValue::StrictNumberCompare(valueA, valueB) == ComparisonResult::GREAT; + double value_a = left.IsInt() ? static_cast(left.GetInt()) : left.GetDouble(); + double value_b = right.IsInt() ? static_cast(right.GetInt()) : right.GetDouble(); + bool ret = JSTaggedValue::StrictNumberCompare(value_a, value_b) == ComparisonResult::GREAT; return ret ? JSTaggedValue::True().GetRawData() : JSTaggedValue::False().GetRawData(); } return SlowRuntimeStub::GreaterDyn(thread, left, right).GetRawData(); @@ -387,9 +387,9 @@ INLINE_ECMA_INTRINSICS uint64_t GreaterEqDyn(JSThread *thread, uint64_t lhs, uin auto right = JSTaggedValue(rhs); if (left.IsNumber() && right.IsNumber()) { - double valueA = left.IsInt() ? static_cast(left.GetInt()) : left.GetDouble(); - double valueB = right.IsInt() ? static_cast(right.GetInt()) : right.GetDouble(); - ComparisonResult comparison = JSTaggedValue::StrictNumberCompare(valueA, valueB); + double value_a = left.IsInt() ? static_cast(left.GetInt()) : left.GetDouble(); + double value_b = right.IsInt() ? static_cast(right.GetInt()) : right.GetDouble(); + ComparisonResult comparison = JSTaggedValue::StrictNumberCompare(value_a, value_b); bool ret = (comparison == ComparisonResult::GREAT) || (comparison == ComparisonResult::EQUAL); return ret ? JSTaggedValue::True().GetRawData() : JSTaggedValue::False().GetRawData(); } @@ -397,30 +397,32 @@ INLINE_ECMA_INTRINSICS uint64_t GreaterEqDyn(JSThread *thread, uint64_t lhs, uin } // NOLINTNEXTLINE(misc-definitions-in-headers) -INLINE_ECMA_INTRINSICS uint64_t TryLdGlobalByValue([[maybe_unused]] JSThread *thread, [[maybe_unused]] uint16_t slotId, - [[maybe_unused]] uint64_t propValue) +INLINE_ECMA_INTRINSICS uint64_t TryLdGlobalByValue([[maybe_unused]] JSThread *thread, [[maybe_unused]] uint16_t slot_id, + [[maybe_unused]] uint64_t prop_value) { UNREACHABLE(); } // NOLINTNEXTLINE(misc-definitions-in-headers) -INLINE_ECMA_INTRINSICS void TryStGlobalByValue([[maybe_unused]] JSThread *thread, [[maybe_unused]] uint16_t slotId, - [[maybe_unused]] uint64_t propValue, [[maybe_unused]] uint64_t valValue) +INLINE_ECMA_INTRINSICS void TryStGlobalByValue([[maybe_unused]] JSThread *thread, [[maybe_unused]] uint16_t slot_id, + [[maybe_unused]] uint64_t prop_value, + [[maybe_unused]] uint64_t val_value) { UNREACHABLE(); } // NOLINTNEXTLINE(misc-definitions-in-headers) -INLINE_ECMA_INTRINSICS uint64_t TryLdGlobalByName(JSThread *thread, uint32_t stringId, [[maybe_unused]] uint16_t slotId) +INLINE_ECMA_INTRINSICS uint64_t TryLdGlobalByName(JSThread *thread, uint32_t string_id, + [[maybe_unused]] uint16_t slot_id) { auto constpool = GetConstantPool(thread); auto global_obj = GetGlobalObject(thread); - auto prop = constpool->GetObjectFromCache(stringId); + auto prop = constpool->GetObjectFromCache(string_id); JSTaggedValue result = JSTaggedValue::Hole(); #if ECMASCRIPT_ENABLE_IC if (ICRuntimeStub::HaveICForFunction(thread)) { - result = ICRuntimeStub::LoadGlobalICByName(thread, global_obj, prop, slotId, true); + result = ICRuntimeStub::LoadGlobalICByName(thread, global_obj, prop, slot_id, true); if (!result.IsHole()) { return result.GetRawData(); } @@ -543,10 +545,10 @@ INLINE_ECMA_INTRINSICS uint64_t Definefuncexpr([[maybe_unused]] JSThread *thread } // NOLINTNEXTLINE(misc-definitions-in-headers) -INLINE_ECMA_INTRINSICS uint64_t DefinefuncDyn(JSThread *thread, uint32_t methodId, uint64_t env) +INLINE_ECMA_INTRINSICS uint64_t DefinefuncDyn(JSThread *thread, uint32_t method_id, uint64_t env) { JSHandle constpool(thread, GetConstantPool(thread)); - JSMutableHandle result(thread, constpool->GetObjectFromCache(methodId)); + JSMutableHandle result(thread, constpool->GetObjectFromCache(method_id)); JSHandle lex_env(thread, JSTaggedValue(env)); ASSERT(!result.IsEmpty()); if (!result->GetLexicalEnv().IsUndefined()) { @@ -562,10 +564,10 @@ INLINE_ECMA_INTRINSICS uint64_t DefinefuncDyn(JSThread *thread, uint32_t methodI INLINE_ECMA_INTRINSICS uint64_t NewobjDynrange(JSThread *thread, uint16_t num_args, uint64_t func, uint64_t new_target, void *stkargs_raw) { - JSSpanHandle argsHandle(thread, Span(reinterpret_cast(stkargs_raw), num_args)); + JSSpanHandle args_handle(thread, Span(reinterpret_cast(stkargs_raw), num_args)); return SlowRuntimeStub::NewObjDynRange(thread, num_args, JSTaggedValue(func), JSTaggedValue(new_target), - argsHandle.dataTaggedType()) + args_handle.DataTaggedType()) .GetRawData(); } @@ -691,7 +693,7 @@ INLINE_ECMA_INTRINSICS uint64_t SuspendAsyncGeneratorInterp(JSThread *thread, ui } // NOLINTNEXTLINE(misc-definitions-in-headers) -INLINE_ECMA_INTRINSICS void ThrowUndefined([[maybe_unused]] JSThread *thread, [[maybe_unused]] uint64_t objValue) +INLINE_ECMA_INTRINSICS void ThrowUndefined([[maybe_unused]] JSThread *thread, [[maybe_unused]] uint64_t obj_value) { UNREACHABLE(); } @@ -778,7 +780,7 @@ INLINE_ECMA_INTRINSICS uint64_t Call3Dyn(JSThread *thread, uint64_t raw_fn_objec // Just declared here, not used // NOLINTNEXTLINE(misc-definitions-in-headers) INLINE_ECMA_INTRINSICS uint64_t CalliRangeDyn([[maybe_unused]] JSThread *thread, [[maybe_unused]] uint16_t num, - [[maybe_unused]] uint64_t objValue) + [[maybe_unused]] uint64_t obj_value) { UNREACHABLE(); } @@ -844,10 +846,10 @@ INLINE_ECMA_INTRINSICS uint64_t Ldglobal(JSThread *thread) // NOLINTNEXTLINE(misc-definitions-in-headers) INLINE_ECMA_INTRINSICS uint64_t LdObjByValue(JSThread *thread, uint64_t rec, uint64_t pkey, - [[maybe_unused]] uint16_t slotId) + [[maybe_unused]] uint16_t slot_id) { - [[maybe_unused]] EcmaHandleScope handleScope(thread); - JSHandle receiverHandle(thread, JSTaggedValue(rec)); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); + JSHandle receiver_handle(thread, JSTaggedValue(rec)); auto receiver = JSTaggedValue(rec); auto prop_key = JSTaggedValue(pkey); @@ -855,7 +857,7 @@ INLINE_ECMA_INTRINSICS uint64_t LdObjByValue(JSThread *thread, uint64_t rec, uin JSTaggedValue res = JSTaggedValue::Hole(); #if ECMASCRIPT_ENABLE_IC if (ICRuntimeStub::HaveICForFunction(thread)) { - res = ICRuntimeStub::LoadICByValue(thread, receiver, prop_key, slotId); + res = ICRuntimeStub::LoadICByValue(thread, receiver, prop_key, slot_id); if (LIKELY(!res.IsHole())) { return res.GetRawData(); } @@ -875,9 +877,9 @@ INLINE_ECMA_INTRINSICS uint64_t LdObjByValue(JSThread *thread, uint64_t rec, uin // NOLINTNEXTLINE(misc-definitions-in-headers) INLINE_ECMA_INTRINSICS uint64_t StObjByValue(JSThread *thread, uint64_t rec, uint64_t pkey, uint64_t val, - [[maybe_unused]] uint16_t slotId) + [[maybe_unused]] uint16_t slot_id) { - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); auto receiver = JSTaggedValue(rec); auto prop_key = JSTaggedValue(pkey); @@ -886,16 +888,16 @@ INLINE_ECMA_INTRINSICS uint64_t StObjByValue(JSThread *thread, uint64_t rec, uin JSTaggedValue res = JSTaggedValue::Hole(); #if ECMASCRIPT_ENABLE_IC if (ICRuntimeStub::HaveICForFunction(thread)) { - res = ICRuntimeStub::StoreICByValue(thread, receiver, prop_key, value, slotId); + res = ICRuntimeStub::StoreICByValue(thread, receiver, prop_key, value, slot_id); if (LIKELY(!res.IsHole())) { return res.GetRawData(); } } #endif - JSHandle receiverHandle(thread, receiver); - JSHandle propKeyHandle(thread, prop_key); - JSHandle valueHandle(thread, value); + JSHandle receiver_handle(thread, receiver); + JSHandle prop_key_handle(thread, prop_key); + JSHandle value_handle(thread, value); if (receiver.IsHeapObject()) { res = FastRuntimeStub::SetPropertyByValue(thread, receiver, prop_key, value); @@ -905,16 +907,16 @@ INLINE_ECMA_INTRINSICS uint64_t StObjByValue(JSThread *thread, uint64_t rec, uin } // slow path - receiver = receiverHandle.GetTaggedValue(); // May be moved by GC - prop_key = propKeyHandle.GetTaggedValue(); // May be moved by GC - value = valueHandle.GetTaggedValue(); // May be moved by GC + receiver = receiver_handle.GetTaggedValue(); // May be moved by GC + prop_key = prop_key_handle.GetTaggedValue(); // May be moved by GC + value = value_handle.GetTaggedValue(); // May be moved by GC return SlowRuntimeStub::StObjByValue(thread, receiver, prop_key, value).GetRawData(); } // NOLINTNEXTLINE(misc-definitions-in-headers) INLINE_ECMA_INTRINSICS uint64_t TryStGlobalByName(JSThread *thread, uint32_t string_id, uint64_t value, - [[maybe_unused]] uint16_t slotId) + [[maybe_unused]] uint16_t slot_id) { JSTaggedValue prop_key = GetConstantPool(thread)->GetObjectFromCache(string_id); auto global_obj = GetGlobalObject(thread); @@ -922,7 +924,7 @@ INLINE_ECMA_INTRINSICS uint64_t TryStGlobalByName(JSThread *thread, uint32_t str JSTaggedValue result = JSTaggedValue::Hole(); #if ECMASCRIPT_ENABLE_IC if (ICRuntimeStub::HaveICForFunction(thread)) { - result = ICRuntimeStub::StoreGlobalICByName(thread, global_obj, prop_key, JSTaggedValue(value), slotId, true); + result = ICRuntimeStub::StoreGlobalICByName(thread, global_obj, prop_key, JSTaggedValue(value), slot_id, true); if (!result.IsHole()) { return result.GetRawData(); } @@ -947,7 +949,7 @@ INLINE_ECMA_INTRINSICS uint64_t TryStGlobalByName(JSThread *thread, uint32_t str } // NOLINTNEXTLINE(misc-definitions-in-headers) -INLINE_ECMA_INTRINSICS uint64_t LdGlobalVar(JSThread *thread, uint32_t string_id, [[maybe_unused]] uint16_t slotId) +INLINE_ECMA_INTRINSICS uint64_t LdGlobalVar(JSThread *thread, uint32_t string_id, [[maybe_unused]] uint16_t slot_id) { auto global_obj = thread->GetGlobalObject(); auto prop_key = GetConstantPool(thread)->GetObjectFromCache(string_id); @@ -955,7 +957,7 @@ INLINE_ECMA_INTRINSICS uint64_t LdGlobalVar(JSThread *thread, uint32_t string_id JSTaggedValue result = JSTaggedValue::Hole(); #if ECMASCRIPT_ENABLE_IC if (ICRuntimeStub::HaveICForFunction(thread)) { - result = ICRuntimeStub::LoadGlobalICByName(thread, global_obj, prop_key, slotId); + result = ICRuntimeStub::LoadGlobalICByName(thread, global_obj, prop_key, slot_id); if (!result.IsHole()) { return result.GetRawData(); } @@ -972,7 +974,7 @@ INLINE_ECMA_INTRINSICS uint64_t LdGlobalVar(JSThread *thread, uint32_t string_id // NOLINTNEXTLINE(misc-definitions-in-headers) INLINE_ECMA_INTRINSICS uint64_t StGlobalVar(JSThread *thread, uint32_t string_id, uint64_t value, - [[maybe_unused]] uint16_t slotId) + [[maybe_unused]] uint16_t slot_id) { auto global_obj = thread->GetGlobalObject(); JSTaggedValue prop = GetConstantPool(thread)->GetObjectFromCache(string_id); @@ -980,7 +982,7 @@ INLINE_ECMA_INTRINSICS uint64_t StGlobalVar(JSThread *thread, uint32_t string_id #if ECMASCRIPT_ENABLE_IC if (ICRuntimeStub::HaveICForFunction(thread)) { JSTaggedValue result = - ICRuntimeStub::StoreGlobalICByName(thread, global_obj, prop, JSTaggedValue(value), slotId); + ICRuntimeStub::StoreGlobalICByName(thread, global_obj, prop, JSTaggedValue(value), slot_id); if (!result.IsHole()) { return result.GetRawData(); } @@ -998,16 +1000,16 @@ INLINE_ECMA_INTRINSICS uint64_t StGlobalLet(JSThread *thread, uint32_t string_id } // NOLINTNEXTLINE(misc-definitions-in-headers) -INLINE_ECMA_INTRINSICS uint64_t LdObjByName(JSThread *thread, uint32_t stringId, uint64_t object, - [[maybe_unused]] uint16_t slotId) +INLINE_ECMA_INTRINSICS uint64_t LdObjByName(JSThread *thread, uint32_t string_id, uint64_t object, + [[maybe_unused]] uint16_t slot_id) { auto obj = JSTaggedValue(object); - auto prop_key = GetConstantPool(thread)->GetObjectFromCache(stringId); + auto prop_key = GetConstantPool(thread)->GetObjectFromCache(string_id); JSTaggedValue res = JSTaggedValue::Hole(); #if ECMASCRIPT_ENABLE_IC if (ICRuntimeStub::HaveICForFunction(thread)) { - res = ICRuntimeStub::LoadICByName(thread, obj, prop_key, slotId); + res = ICRuntimeStub::LoadICByName(thread, obj, prop_key, slot_id); if (LIKELY(!res.IsHole())) { return res.GetRawData(); } @@ -1025,7 +1027,7 @@ INLINE_ECMA_INTRINSICS uint64_t LdObjByName(JSThread *thread, uint32_t stringId, // NOLINTNEXTLINE(misc-definitions-in-headers) INLINE_ECMA_INTRINSICS uint64_t StObjByName(JSThread *thread, uint32_t string_id, uint64_t object, uint64_t val, - [[maybe_unused]] uint16_t slotId) + [[maybe_unused]] uint16_t slot_id) { auto obj = JSTaggedValue(object); auto value = JSTaggedValue(val); @@ -1035,7 +1037,7 @@ INLINE_ECMA_INTRINSICS uint64_t StObjByName(JSThread *thread, uint32_t string_id JSTaggedValue res = JSTaggedValue::Hole(); #if ECMASCRIPT_ENABLE_IC if (ICRuntimeStub::HaveICForFunction(thread)) { - res = ICRuntimeStub::StoreICByName(thread, obj, prop_key, value, slotId); + res = ICRuntimeStub::StoreICByName(thread, obj, prop_key, value, slot_id); if (LIKELY(!res.IsHole())) { return res.GetRawData(); } @@ -1085,8 +1087,8 @@ INLINE_ECMA_INTRINSICS uint64_t StObjByIndex(JSThread *thread, uint32_t idx, uin return SlowRuntimeStub::StObjByIndex(thread, obj, idx, val).GetRawData(); } -ARK_INLINE inline static bool GetLeftRightInt(JSThread *thread, uint64_t lhs, uint64_t rhs, bool isULeft, bool isURight, - int32_t &left, int32_t &right) +ARK_INLINE inline static bool GetLeftRightInt(JSThread *thread, uint64_t lhs, uint64_t rhs, bool is_u_left, + bool is_u_right, int32_t &left, int32_t &right) { auto jleft = JSTaggedValue(lhs); auto jright = JSTaggedValue(rhs); @@ -1104,18 +1106,18 @@ ARK_INLINE inline static bool GetLeftRightInt(JSThread *thread, uint64_t lhs, ui return true; } - [[maybe_unused]] EcmaHandleScope handleScope(thread); - JSHandle rightHandle(thread, jright); - jleft = isULeft ? SlowRuntimeStub::ToJSTaggedValueWithUint32(thread, jleft) - : SlowRuntimeStub::ToJSTaggedValueWithInt32(thread, jleft); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); + JSHandle right_handle(thread, jright); + jleft = is_u_left ? SlowRuntimeStub::ToJSTaggedValueWithUint32(thread, jleft) + : SlowRuntimeStub::ToJSTaggedValueWithInt32(thread, jleft); if (jleft.IsException()) { return false; } - jright = rightHandle.GetTaggedValue(); // Maybe moved by GC - jright = isURight ? SlowRuntimeStub::ToJSTaggedValueWithUint32(thread, jright) - : SlowRuntimeStub::ToJSTaggedValueWithInt32(thread, jright); + jright = right_handle.GetTaggedValue(); // Maybe moved by GC + jright = is_u_right ? SlowRuntimeStub::ToJSTaggedValueWithUint32(thread, jright) + : SlowRuntimeStub::ToJSTaggedValueWithInt32(thread, jright); if (jright.IsException()) { return false; @@ -1180,8 +1182,8 @@ INLINE_ECMA_INTRINSICS uint64_t Shl2Dyn(JSThread *thread, uint64_t lhs, uint64_t } uint32_t shift = static_cast(right) & 0x1f; // NOLINT(hicpp-signed-bitwise, readability-magic-numbers) - using unsigned_type = std::make_unsigned_t; - return JSTaggedValue(static_cast(static_cast(left) << shift)) + using UnsignedType = std::make_unsigned_t; + return JSTaggedValue(static_cast(static_cast(left) << shift)) .GetRawData(); // NOLINT(hicpp-signed-bitwise) } @@ -1210,21 +1212,21 @@ INLINE_ECMA_INTRINSICS uint64_t Ashr2Dyn(JSThread *thread, uint64_t lhs, uint64_ } uint32_t shift = static_cast(right) & 0x1f; // NOLINT(hicpp-signed-bitwise, readability-magic-numbers) - using unsigned_type = std::make_unsigned_t; - return JSTaggedValue(static_cast(static_cast(left) >> shift)) + using UnsignedType = std::make_unsigned_t; + return JSTaggedValue(static_cast(static_cast(left) >> shift)) .GetRawData(); // NOLINT(hicpp-signed-bitwise) } // NOLINTNEXTLINE(misc-definitions-in-headers) INLINE_ECMA_INTRINSICS uint64_t RethrowDyn(JSThread *thread, uint64_t obj) { - JSTaggedValue objValue(obj); + JSTaggedValue obj_value(obj); if (JSTaggedValue(obj).IsHole()) { - return objValue.GetRawData(); + return obj_value.GetRawData(); } - SlowRuntimeStub::ThrowDyn(thread, objValue); + SlowRuntimeStub::ThrowDyn(thread, obj_value); return JSTaggedValue(JSTaggedValue::VALUE_EXCEPTION).GetRawData(); } @@ -1242,11 +1244,11 @@ INLINE_ECMA_INTRINSICS uint64_t Delobjprop(JSThread *thread, uint64_t obj, uint6 // define not constructor function // NOLINTNEXTLINE(misc-definitions-in-headers) -INLINE_ECMA_INTRINSICS uint64_t DefineNCFuncDyn(JSThread *thread, uint32_t methodId, uint64_t env, uint64_t home_obj) +INLINE_ECMA_INTRINSICS uint64_t DefineNCFuncDyn(JSThread *thread, uint32_t method_id, uint64_t env, uint64_t home_obj) { JSHandle home_obj_handle(thread, JSTaggedValue(home_obj)); JSHandle constpool(thread, GetConstantPool(thread)); - JSMutableHandle result(thread, constpool->GetObjectFromCache(methodId)); + JSMutableHandle result(thread, constpool->GetObjectFromCache(method_id)); JSHandle lex_env(thread, JSTaggedValue(env)); ASSERT(!result.IsEmpty()); if (!result->GetLexicalEnv().IsUndefined()) { @@ -1268,15 +1270,15 @@ INLINE_ECMA_INTRINSICS uint64_t LdLexVarDyn(JSThread *thread, uint16_t level, ui LexicalEnv *env = GetLexicalEnv(thread); for (int i = 0; i < level; i++) { - JSTaggedValue taggedParentEnv = env->GetParentEnv(); - ASSERT(!taggedParentEnv.IsUndefined()); - env = LexicalEnv::Cast(taggedParentEnv.GetHeapObject()); + JSTaggedValue tagged_parent_env = env->GetParentEnv(); + ASSERT(!tagged_parent_env.IsUndefined()); + env = LexicalEnv::Cast(tagged_parent_env.GetHeapObject()); } return env->GetProperties(slot).GetRawData(); } // NOLINTNEXTLINE(misc-definitions-in-headers) -INLINE_ECMA_INTRINSICS void popLexenvDyn(JSThread *thread) +INLINE_ECMA_INTRINSICS void PopLexenvDyn(JSThread *thread) { SetLexicalEnv(thread, GetLexicalEnv(thread)->GetParentEnv()); } @@ -1350,23 +1352,23 @@ INLINE_ECMA_INTRINSICS uint64_t CopylexenvDyn(JSThread *thread) { [[maybe_unused]] EcmaHandleScope handleScope(thread); auto factory = thread->GetEcmaVM()->GetFactory(); - JSHandle oldEnv(thread, GetLexicalEnv(thread)); - JSHandle parentEnv(thread, oldEnv->GetParentEnv()); - SetLexicalEnv(thread, parentEnv.GetTaggedValue()); - array_size_t numOfSlots = oldEnv->GetLength(); + JSHandle old_env(thread, GetLexicalEnv(thread)); + JSHandle parent_env(thread, old_env->GetParentEnv()); + SetLexicalEnv(thread, parent_env.GetTaggedValue()); + array_size_t numOfSlots = old_env->GetLength(); - JSTaggedValue res = FastRuntimeStub::NewLexicalEnvDyn(thread, factory, numOfSlots); + JSTaggedValue res = FastRuntimeStub::NewLexicalEnvDyn(thread, factory, num_of_slots); if (res.IsHole()) { - res = SlowRuntimeStub::NewLexicalEnvDyn(thread, numOfSlots); + res = SlowRuntimeStub::NewLexicalEnvDyn(thread, num_of_slots); if (res.IsException()) { return res.GetRawData(); } } - LexicalEnv::Cast(res.GetHeapObject())->SetParentEnv(thread, parentEnv.GetTaggedValue()); + LexicalEnv::Cast(res.GetHeapObject())->SetParentEnv(thread, parent_env.GetTaggedValue()); SetLexicalEnv(thread, res); - for (array_size_t i = 0; i < numOfSlots; i++) { - LexicalEnv::Cast(res.GetHeapObject())->Set(thread, i, oldEnv->Get(i)); + for (ArraySizeT i = 0; i < num_of_slots; i++) { + LexicalEnv::Cast(res.GetHeapObject())->Set(thread, i, old_env->Get(i)); } return res.GetRawData(); } @@ -1374,13 +1376,13 @@ INLINE_ECMA_INTRINSICS uint64_t CopylexenvDyn(JSThread *thread) // NOLINTNEXTLINE(misc-definitions-in-headers) INLINE_ECMA_INTRINSICS void StLexVarDyn(JSThread *thread, uint16_t level, uint16_t slot, uint64_t value) { - JSTaggedValue currentLexenv(GetLexicalEnv(thread)); - JSTaggedValue env(currentLexenv); + JSTaggedValue current_lexenv(GetLexicalEnv(thread)); + JSTaggedValue env(current_lexenv); for (int i = 0; i < level; i++) { - JSTaggedValue taggedParentEnv = LexicalEnv::Cast(env.GetHeapObject())->GetParentEnv(); - ASSERT(!taggedParentEnv.IsUndefined()); - env = taggedParentEnv; + JSTaggedValue tagged_parent_env = LexicalEnv::Cast(env.GetHeapObject())->GetParentEnv(); + ASSERT(!tagged_parent_env.IsUndefined()); + env = tagged_parent_env; } LexicalEnv::Cast(env.GetHeapObject())->SetProperties(thread, slot, JSTaggedValue(value)); } @@ -1551,10 +1553,10 @@ INLINE_ECMA_INTRINSICS uint64_t ThrowUndefinedIfHole(JSThread *thread, uint32_t } // NOLINTNEXTLINE(misc-definitions-in-headers) -INLINE_ECMA_INTRINSICS uint64_t GetMethod(JSThread *thread, uint32_t stringId, uint64_t object) +INLINE_ECMA_INTRINSICS uint64_t GetMethod(JSThread *thread, uint32_t string_id, uint64_t object) { return SlowRuntimeStub::GetMethod(thread, JSTaggedValue(object), - GetConstantPool(thread)->GetObjectFromCache(stringId)) + GetConstantPool(thread)->GetObjectFromCache(string_id)) .GetRawData(); } @@ -1626,9 +1628,9 @@ INLINE_ECMA_INTRINSICS uint64_t CreateArrayWithBuffer(JSThread *thread, uint16_t // NOLINTNEXTLINE(misc-definitions-in-headers) INLINE_ECMA_INTRINSICS uint64_t StOwnByIndex(JSThread *thread, uint64_t object, uint64_t idx, uint64_t val) { - [[maybe_unused]] EcmaHandleScope handleScope(thread); - JSHandle objHandle(thread, JSTaggedValue(object)); - JSHandle valueHandle(thread, JSTaggedValue(val)); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); + JSHandle obj_handle(thread, JSTaggedValue(object)); + JSHandle value_handle(thread, JSTaggedValue(val)); auto obj = JSTaggedValue(object); auto value = JSTaggedValue(val); @@ -1640,20 +1642,20 @@ INLINE_ECMA_INTRINSICS uint64_t StOwnByIndex(JSThread *thread, uint64_t object, } } - obj = objHandle.GetTaggedValue(); // Maybe moved by GC - value = valueHandle.GetTaggedValue(); // Maybe moved by GC + obj = obj_handle.GetTaggedValue(); // Maybe moved by GC + value = value_handle.GetTaggedValue(); // Maybe moved by GC return SlowRuntimeStub::StOwnByIndex(thread, obj, idx, value).GetRawData(); } // NOLINTNEXTLINE(misc-definitions-in-headers) INLINE_ECMA_INTRINSICS uint64_t StOwnByName(JSThread *thread, uint32_t string_id, uint64_t object, uint64_t val) { - [[maybe_unused]] EcmaHandleScope handleScope(thread); - JSHandle objHandle(thread, JSTaggedValue(object)); - JSHandle valueHandle(thread, JSTaggedValue(val)); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); + JSHandle obj_handle(thread, JSTaggedValue(object)); + JSHandle value_handle(thread, JSTaggedValue(val)); - auto obj = objHandle.GetTaggedValue(); - auto value = valueHandle.GetTaggedValue(); + auto obj = obj_handle.GetTaggedValue(); + auto value = value_handle.GetTaggedValue(); JSTaggedValue prop = GetConstantPool(thread)->GetObjectFromCache(string_id); @@ -1664,8 +1666,8 @@ INLINE_ECMA_INTRINSICS uint64_t StOwnByName(JSThread *thread, uint32_t string_id } } - obj = objHandle.GetTaggedValue(); // Maybe moved by GC - value = valueHandle.GetTaggedValue(); // Maybe moved by GC + obj = obj_handle.GetTaggedValue(); // Maybe moved by GC + value = value_handle.GetTaggedValue(); // Maybe moved by GC GetConstantPool(thread)->GetObjectFromCache(string_id); // Maybe moved by GC return SlowRuntimeStub::StOwnByName(thread, obj, prop, value).GetRawData(); } @@ -1673,20 +1675,20 @@ INLINE_ECMA_INTRINSICS uint64_t StOwnByName(JSThread *thread, uint32_t string_id // NOLINTNEXTLINE(misc-definitions-in-headers) INLINE_ECMA_INTRINSICS uint64_t StOwnByValue(JSThread *thread, uint64_t rec, uint64_t pkey, uint64_t val) { - [[maybe_unused]] EcmaHandleScope handleScope(thread); + [[maybe_unused]] EcmaHandleScope handle_scope(thread); auto receiver = JSTaggedValue(rec); auto prop_key = JSTaggedValue(pkey); auto value = JSTaggedValue(val); - JSHandle receiverHandle(thread, receiver); - JSHandle propHandle(thread, prop_key); - JSHandle valueHandle(thread, value); + JSHandle receiver_handle(thread, receiver); + JSHandle prop_handle(thread, prop_key); + JSHandle value_handle(thread, value); if (receiver.IsHeapObject() && !receiver.IsClassConstructor() && !receiver.IsClassPrototype()) { JSTaggedValue res = FastRuntimeStub::SetPropertyByValue(thread, receiver, prop_key, value); - prop_key = propHandle.GetTaggedValue(); // Maybe moved by GC - value = valueHandle.GetTaggedValue(); // Maybe moved by GC + prop_key = prop_handle.GetTaggedValue(); // Maybe moved by GC + value = value_handle.GetTaggedValue(); // Maybe moved by GC if (!res.IsHole()) { if (value.IsJSFunction()) { JSFunction::SetFunctionNameNoPrefix(thread, JSFunction::Cast(value.GetHeapObject()), prop_key); @@ -1694,7 +1696,7 @@ INLINE_ECMA_INTRINSICS uint64_t StOwnByValue(JSThread *thread, uint64_t rec, uin return res.GetRawData(); } } - return SlowRuntimeStub::StOwnByValue(thread, receiverHandle, propHandle, valueHandle).GetRawData(); + return SlowRuntimeStub::StOwnByValue(thread, receiver_handle, prop_handle, value_handle).GetRawData(); } // NOLINTNEXTLINE(misc-definitions-in-headers) @@ -1733,10 +1735,10 @@ INLINE_ECMA_INTRINSICS void ThrowThrowNotExists(JSThread *thread) } // NOLINTNEXTLINE(misc-definitions-in-headers) -INLINE_ECMA_INTRINSICS uint64_t CreateObjectWithExcludedKeys(JSThread *thread, uint16_t numKeys, uint64_t obj_value, +INLINE_ECMA_INTRINSICS uint64_t CreateObjectWithExcludedKeys(JSThread *thread, uint16_t num_keys, uint64_t obj_value, uint64_t excluded_keys) { - return SlowRuntimeStub::CreateObjectWithExcludedKeys(thread, numKeys, JSTaggedValue(obj_value), + return SlowRuntimeStub::CreateObjectWithExcludedKeys(thread, num_keys, JSTaggedValue(obj_value), reinterpret_cast(excluded_keys)) .GetRawData(); } @@ -1750,10 +1752,10 @@ INLINE_ECMA_INTRINSICS void ThrowPatternNonCoercible(JSThread *thread) // NOLINTNEXTLINE(misc-definitions-in-headers) INLINE_ECMA_INTRINSICS uint64_t CloseIterator(JSThread *thread, uint64_t iter, uint64_t completion) { - JSTaggedValue completionValue(completion); + JSTaggedValue completion_value(completion); - if (!completionValue.IsHole()) { - SlowRuntimeStub::ThrowDyn(thread, completionValue); + if (!completion_value.IsHole()) { + SlowRuntimeStub::ThrowDyn(thread, completion_value); } return SlowRuntimeStub::CloseIterator(thread, JSTaggedValue(iter)).GetRawData(); @@ -1792,16 +1794,16 @@ INLINE_ECMA_INTRINSICS uint64_t DefineClassWithBuffer(JSThread *thread, uint32_t { auto *constpool = GetConstantPool(thread); JSHandle lex_env(thread, JSTaggedValue(lexenv)); - JSFunction *classTemplate = JSFunction::Cast(constpool->GetObjectFromCache(method_id).GetTaggedObject()); - ASSERT(classTemplate != nullptr); + JSFunction *class_template = JSFunction::Cast(constpool->GetObjectFromCache(method_id).GetTaggedObject()); + ASSERT(class_template != nullptr); - TaggedArray *literalBuffer = TaggedArray::Cast(constpool->GetObjectFromCache(imm).GetTaggedObject()); + TaggedArray *literal_buffer = TaggedArray::Cast(constpool->GetObjectFromCache(imm).GetTaggedObject()); JSTaggedValue res; - if (LIKELY(!classTemplate->IsResolved())) { - res = SlowRuntimeStub::ResolveClass(thread, JSTaggedValue(classTemplate), literalBuffer, JSTaggedValue(proto), + if (LIKELY(!class_template->IsResolved())) { + res = SlowRuntimeStub::ResolveClass(thread, JSTaggedValue(class_template), literal_buffer, JSTaggedValue(proto), JSTaggedValue(lexenv), constpool); } else { - res = SlowRuntimeStub::CloneClassFromTemplate(thread, JSTaggedValue(classTemplate), JSTaggedValue(proto), + res = SlowRuntimeStub::CloneClassFromTemplate(thread, JSTaggedValue(class_template), JSTaggedValue(proto), JSTaggedValue(lexenv), constpool); } @@ -1835,11 +1837,11 @@ INLINE_ECMA_INTRINSICS uint64_t SuperCallSpread(JSThread *thread, uint64_t array } // NOLINTNEXTLINE(misc-definitions-in-headers) -INLINE_ECMA_INTRINSICS uint64_t DefineMethod(JSThread *thread, uint32_t methodId, uint64_t tagged_cur_env, +INLINE_ECMA_INTRINSICS uint64_t DefineMethod(JSThread *thread, uint32_t method_id, uint64_t tagged_cur_env, uint64_t home_object) { JSHandle constpool(thread, GetConstantPool(thread)); - JSMutableHandle result(thread, constpool->GetObjectFromCache(methodId)); + JSMutableHandle result(thread, constpool->GetObjectFromCache(method_id)); JSHandle home(thread, JSTaggedValue(home_object)); JSHandle env(thread, JSTaggedValue(tagged_cur_env)); ASSERT(!result.IsEmpty()); @@ -1903,9 +1905,9 @@ INLINE_ECMA_INTRINSICS uint64_t CreateObjectHavingMethod(JSThread *thread, uint1 // NOLINTNEXTLINE(misc-definitions-in-headers) INLINE_ECMA_INTRINSICS uint64_t ThrowIfSuperNotCorrectCall(JSThread *thread, uint16_t index, - [[maybe_unused]] uint64_t thisValue) + [[maybe_unused]] uint64_t this_value) { - return SlowRuntimeStub::ThrowIfSuperNotCorrectCall(thread, index, JSTaggedValue(thisValue)).GetRawData(); + return SlowRuntimeStub::ThrowIfSuperNotCorrectCall(thread, index, JSTaggedValue(this_value)).GetRawData(); } // NOLINTNEXTLINE(misc-definitions-in-headers) diff --git a/runtime/js_array.cpp b/runtime/js_array.cpp index 5c493bd5b..2282a185e 100644 --- a/runtime/js_array.cpp +++ b/runtime/js_array.cpp @@ -30,22 +30,22 @@ JSTaggedValue JSArray::LengthGetter([[maybe_unused]] JSThread *thread, const JSH } bool JSArray::LengthSetter(JSThread *thread, const JSHandle &self, const JSHandle &value, - bool mayThrow) + bool may_throw) { - uint32_t newLen = 0; - if (!JSTaggedValue::ToArrayLength(thread, value, &newLen) && mayThrow) { + uint32_t new_len = 0; + if (!JSTaggedValue::ToArrayLength(thread, value, &new_len) && may_throw) { THROW_RANGE_ERROR_AND_RETURN(thread, "array length must less than 2^32 - 1", false); } if (!IsArrayLengthWritable(thread, self)) { - if (mayThrow) { + if (may_throw) { THROW_TYPE_ERROR_AND_RETURN(thread, "Cannot assign to read only property", false); } return false; } - uint32_t oldLen = JSArray::Cast(*self)->GetArrayLength(); - JSArray::SetCapacity(thread, self, oldLen, newLen); + uint32_t old_len = JSArray::Cast(*self)->GetArrayLength(); + JSArray::SetCapacity(thread, self, old_len, new_len); return true; } @@ -58,62 +58,62 @@ JSHandle JSArray::ArrayCreate(JSThread *thread, JSTaggedNumber le // 9.4.2.2 ArrayCreate(length, proto) JSHandle JSArray::ArrayCreate(JSThread *thread, JSTaggedNumber length, - const JSHandle &newTarget) + const JSHandle &new_target) { ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); // Assert: length is an integer Number ≥ 0. ASSERT_PRINT(length.IsInteger() && length.GetNumber() >= 0, "length must be positive integer"); // 2. If length is −0, let length be +0. - double arrayLength = JSTaggedValue::ToInteger(thread, JSHandle(thread, length)).GetDouble(); - if (arrayLength > MAX_ARRAY_INDEX) { + double array_length = JSTaggedValue::ToInteger(thread, JSHandle(thread, length)).GetDouble(); + if (array_length > MAX_ARRAY_INDEX) { JSHandle exception(thread, JSTaggedValue::Exception()); THROW_RANGE_ERROR_AND_RETURN(thread, "array length must less than 2^32 - 1", exception); } - uint32_t normalArrayLength = length.ToUint32(); + uint32_t normal_array_length = length.ToUint32(); // 8. Set the [[Prototype]] internal slot of A to proto. JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); - JSHandle arrayFunc = env->GetArrayFunction(); - JSHandle obj = factory->NewJSObjectByConstructor(JSHandle(arrayFunc), newTarget); + JSHandle array_func = env->GetArrayFunction(); + JSHandle obj = factory->NewJSObjectByConstructor(JSHandle(array_func), new_target); // 9. Set the [[Extensible]] internal slot of A to true. obj->GetJSHClass()->SetExtensible(true); // 10. Perform OrdinaryDefineOwnProperty(A, "length", PropertyDescriptor{[[Value]]: length, [[Writable]]: // true, [[Enumerable]]: false, [[Configurable]]: false}). - JSArray::Cast(*obj)->SetArrayLength(thread, normalArrayLength); + JSArray::Cast(*obj)->SetArrayLength(thread, normal_array_length); return JSHandle(obj); } -// 9.4.2.3 ArraySpeciesCreate(originalArray, length) -JSTaggedValue JSArray::ArraySpeciesCreate(JSThread *thread, const JSHandle &originalArray, +// 9.4.2.3 ArraySpeciesCreate(original_array, length) +JSTaggedValue JSArray::ArraySpeciesCreate(JSThread *thread, const JSHandle &original_array, JSTaggedNumber length) { JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); - const GlobalEnvConstants *globalConst = thread->GlobalConstants(); + const GlobalEnvConstants *global_const = thread->GlobalConstants(); // Assert: length is an integer Number ≥ 0. ASSERT_PRINT(length.IsInteger() && length.GetNumber() >= 0, "length must be positive integer"); // If length is −0, let length be +0. - double arrayLength = JSTaggedValue::ToInteger(thread, JSHandle(thread, length)).GetDouble(); - if (arrayLength == -0) { - arrayLength = +0; + double array_length = JSTaggedValue::ToInteger(thread, JSHandle(thread, length)).GetDouble(); + if (array_length == -0) { + array_length = +0; } // Let C be undefined. - // Let isArray be IsArray(originalArray). - JSHandle originalValue(originalArray); - bool isArray = originalValue->IsArray(thread); - // ReturnIfAbrupt(isArray). + // Let is_array be IsArray(original_array). + JSHandle original_value(original_array); + bool is_array = original_value->IsArray(thread); + // ReturnIfAbrupt(is_array). RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); - // If isArray is true, then + // If is_array is true, then JSHandle constructor(thread, JSTaggedValue::Undefined()); - if (isArray) { - // Let C be Get(originalArray, "constructor"). - auto *hclass = originalArray->GetJSHClass(); + if (is_array) { + // Let C be Get(original_array, "constructor"). + auto *hclass = original_array->GetJSHClass(); if (hclass->IsJSArray() && !hclass->HasConstructor()) { return JSArray::ArrayCreate(thread, length).GetTaggedValue(); } - JSHandle constructorKey = globalConst->GetHandledConstructorString(); - constructor = JSTaggedValue::GetProperty(thread, originalValue, constructorKey).GetValue(); + JSHandle constructor_key = global_const->GetHandledConstructorString(); + constructor = JSTaggedValue::GetProperty(thread, original_value, constructor_key).GetValue(); // ReturnIfAbrupt(C). RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); // If IsConstructor(C) is true, then @@ -125,9 +125,9 @@ JSTaggedValue JSArray::ArraySpeciesCreate(JSThread *thread, const JSHandleGetArrayFunction().GetTaggedValue(); + JSTaggedValue realm_array_constructor = realmC->GetArrayFunction().GetTaggedValue(); // If SameValue(C, realmC.[[intrinsics]].[[%Array%]]) is true, let C be undefined. - if (JSTaggedValue::SameValue(constructor.GetTaggedValue(), realmArrayConstructor)) { + if (JSTaggedValue::SameValue(constructor.GetTaggedValue(), realm_array_constructor)) { return JSArray::ArrayCreate(thread, length).GetTaggedValue(); } } @@ -136,8 +136,8 @@ JSTaggedValue JSArray::ArraySpeciesCreate(JSThread *thread, const JSHandleIsECMAObject()) { // Let C be Get(C, @@species). - JSHandle speciesSymbol = env->GetSpeciesSymbol(); - constructor = JSTaggedValue::GetProperty(thread, constructor, speciesSymbol).GetValue(); + JSHandle species_symbol = env->GetSpeciesSymbol(); + constructor = JSTaggedValue::GetProperty(thread, constructor, species_symbol).GetValue(); // ReturnIfAbrupt(C). RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); // If C is null, let C be undefined. @@ -156,12 +156,12 @@ JSTaggedValue JSArray::ArraySpeciesCreate(JSThread *thread, const JSHandle newTarget(thread, JSTaggedValue::Undefined()); + JSHandle new_target(thread, JSTaggedValue::Undefined()); InternalCallParams *arguments = thread->GetInternalCallParams(); - arguments->MakeArgv(JSTaggedValue(arrayLength)); - JSTaggedValue result = JSFunction::Construct(thread, constructor, 1, arguments->GetArgv(), newTarget); + arguments->MakeArgv(JSTaggedValue(array_length)); + JSTaggedValue result = JSFunction::Construct(thread, constructor, 1, arguments->GetArgv(), new_target); - // NOTEIf originalArray was created using the standard built-in Array constructor for + // NOTEIf original_array was created using the standard built-in Array constructor for // a Realm that is not the Realm of the running execution context, then a new Array is // created using the Realm of the running execution context. This maintains compatibility // with Web browsers that have historically had that behaviour for the Array.prototype methods @@ -169,124 +169,124 @@ JSTaggedValue JSArray::ArraySpeciesCreate(JSThread *thread, const JSHandle &array, uint32_t oldLen, uint32_t newLen) +void JSArray::SetCapacity(JSThread *thread, const JSHandle &array, uint32_t old_len, uint32_t new_len) { TaggedArray *element = TaggedArray::Cast(array->GetElements().GetTaggedObject()); if (element->IsDictionaryMode()) { ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - int32_t numOfElements = array->GetNumberOfElements(); - uint32_t newNumOfElements = newLen; - if (newLen < oldLen && numOfElements != 0) { - JSHandle dictHandle(thread, element); - JSHandle newArr = factory->NewTaggedArray(numOfElements); - GetAllElementKeys(thread, array, 0, newArr); - for (uint32_t i = numOfElements - 1; i >= newLen; i--) { - JSTaggedValue value = newArr->Get(i); + int32_t num_of_elements = array->GetNumberOfElements(); + uint32_t new_num_of_elements = new_len; + if (new_len < old_len && num_of_elements != 0) { + JSHandle dict_handle(thread, element); + JSHandle new_arr = factory->NewTaggedArray(num_of_elements); + GetAllElementKeys(thread, array, 0, new_arr); + for (uint32_t i = num_of_elements - 1; i >= new_len; i--) { + JSTaggedValue value = new_arr->Get(i); uint32_t output = 0; JSTaggedValue::StringToElementIndex(value, &output); JSTaggedValue key(static_cast(output)); - int entry = dictHandle->FindEntry(key); - uint32_t attr = dictHandle->GetAttributes(entry).GetValue(); + int entry = dict_handle->FindEntry(key); + uint32_t attr = dict_handle->GetAttributes(entry).GetValue(); PropertyAttributes propAttr(attr); if (propAttr.IsConfigurable()) { - JSHandle newDict = NumberDictionary::Remove(thread, dictHandle, entry); - array->SetElements(thread, newDict); + JSHandle new_dict = NumberDictionary::Remove(thread, dict_handle, entry); + array->SetElements(thread, new_dict); if (i == 0) { - newNumOfElements = i; + new_num_of_elements = i; break; } } else { - newNumOfElements = i + 1; + new_num_of_elements = i + 1; break; } } } - JSArray::Cast(*array)->SetArrayLength(thread, newNumOfElements); + JSArray::Cast(*array)->SetArrayLength(thread, new_num_of_elements); return; } uint32_t capacity = element->GetLength(); - if (newLen <= capacity) { + if (new_len <= capacity) { // judge if need to cut down the array size, else fill the unused tail with holes - array->FillElementsWithHoles(thread, newLen, oldLen < capacity ? oldLen : capacity); + array->FillElementsWithHoles(thread, new_len, old_len < capacity ? old_len : capacity); } - if (JSObject::ShouldTransToDict(oldLen, newLen)) { + if (JSObject::ShouldTransToDict(old_len, new_len)) { JSObject::ElementsToDictionary(thread, array); - } else if (newLen > capacity) { - JSObject::GrowElementsCapacity(thread, array, newLen); + } else if (new_len > capacity) { + JSObject::GrowElementsCapacity(thread, array, new_len); } - JSArray::Cast(*array)->SetArrayLength(thread, newLen); + JSArray::Cast(*array)->SetArrayLength(thread, new_len); } bool JSArray::ArraySetLength(JSThread *thread, const JSHandle &array, const PropertyDescriptor &desc) { - JSHandle lengthKeyHandle(thread->GlobalConstants()->GetHandledLengthString()); + JSHandle length_key_handle(thread->GlobalConstants()->GetHandledLengthString()); // 1. If the [[Value]] field of Desc is absent, then if (!desc.HasValue()) { // 1a. Return OrdinaryDefineOwnProperty(A, "length", Desc). - return JSObject::OrdinaryDefineOwnProperty(thread, array, lengthKeyHandle, desc); + return JSObject::OrdinaryDefineOwnProperty(thread, array, length_key_handle, desc); } - // 2. Let newLenDesc be a copy of Desc. + // 2. Let new_len_desc be a copy of Desc. // (Actual copying is not necessary.) - PropertyDescriptor newLenDesc = desc; - // 3. - 7. Convert Desc.[[Value]] to newLen. - uint32_t newLen = 0; - if (!JSTaggedValue::ToArrayLength(thread, desc.GetValue(), &newLen)) { + PropertyDescriptor new_len_desc = desc; + // 3. - 7. Convert Desc.[[Value]] to new_len. + uint32_t new_len = 0; + if (!JSTaggedValue::ToArrayLength(thread, desc.GetValue(), &new_len)) { THROW_RANGE_ERROR_AND_RETURN(thread, "array length must less than 2^32 - 1", false); } - // 8. Set newLenDesc.[[Value]] to newLen. + // 8. Set new_len_desc.[[Value]] to new_len. // (Done below, if needed.) - // 9. Let oldLenDesc be OrdinaryGetOwnProperty(A, "length"). - PropertyDescriptor oldLenDesc(thread); - [[maybe_unused]] bool success = GetOwnProperty(thread, array, lengthKeyHandle, oldLenDesc); + // 9. Let old_len_desc be OrdinaryGetOwnProperty(A, "length"). + PropertyDescriptor old_len_desc(thread); + [[maybe_unused]] bool success = GetOwnProperty(thread, array, length_key_handle, old_len_desc); // 10. (Assert) ASSERT(success); - // 11. Let oldLen be oldLenDesc.[[Value]]. - uint32_t oldLen = 0; - JSTaggedValue::ToArrayLength(thread, oldLenDesc.GetValue(), &oldLen); - // 12. If newLen >= oldLen, then - if (newLen >= oldLen) { - // 8. Set newLenDesc.[[Value]] to newLen. - // 12a. Return OrdinaryDefineOwnProperty(A, "length", newLenDesc). - newLenDesc.SetValue(JSHandle(thread, JSTaggedValue(newLen))); - return JSObject::OrdinaryDefineOwnProperty(thread, array, lengthKeyHandle, newLenDesc); + // 11. Let old_len be old_len_desc.[[Value]]. + uint32_t old_len = 0; + JSTaggedValue::ToArrayLength(thread, old_len_desc.GetValue(), &old_len); + // 12. If new_len >= old_len, then + if (new_len >= old_len) { + // 8. Set new_len_desc.[[Value]] to new_len. + // 12a. Return OrdinaryDefineOwnProperty(A, "length", new_len_desc). + new_len_desc.SetValue(JSHandle(thread, JSTaggedValue(new_len))); + return JSObject::OrdinaryDefineOwnProperty(thread, array, length_key_handle, new_len_desc); } - // 13. If oldLenDesc.[[Writable]] is false, return false. - if (!oldLenDesc.IsWritable() || + // 13. If old_len_desc.[[Writable]] is false, return false. + if (!old_len_desc.IsWritable() || // Also handle the {configurable: true} case since we later use // JSArray::SetLength instead of OrdinaryDefineOwnProperty to change // the length, and it doesn't have access to the descriptor anymore. - newLenDesc.IsConfigurable()) { + new_len_desc.IsConfigurable()) { return false; } - // 14. If newLenDesc.[[Writable]] is absent or has the value true, - // let newWritable be true. - bool newWritable = false; - if (!newLenDesc.HasWritable() || newLenDesc.IsWritable()) { - newWritable = true; + // 14. If new_len_desc.[[Writable]] is absent or has the value true, + // let new_writable be true. + bool new_writable = false; + if (!new_len_desc.HasWritable() || new_len_desc.IsWritable()) { + new_writable = true; } // 15. Else, // 15a. Need to defer setting the [[Writable]] attribute to false in case // any elements cannot be deleted. - // 15b. Let newWritable be false. (It's initialized as "false" anyway.) - // 15c. Set newLenDesc.[[Writable]] to true. + // 15b. Let new_writable be false. (It's initialized as "false" anyway.) + // 15c. Set new_len_desc.[[Writable]] to true. // (Not needed.) // Most of steps 16 through 19 is implemented by JSArray::SetCapacity. - JSArray::SetCapacity(thread, array, oldLen, newLen); + JSArray::SetCapacity(thread, array, old_len, new_len); // Steps 19d-ii, 20. - if (!newWritable) { + if (!new_writable) { PropertyDescriptor readonly(thread); readonly.SetWritable(false); - success = JSObject::DefineOwnProperty(thread, array, lengthKeyHandle, readonly); + success = JSObject::DefineOwnProperty(thread, array, length_key_handle, readonly); ASSERT_PRINT(success, "DefineOwnProperty of length must be success here!"); } // Steps 19d-v, 21. Return false if there were non-deletable elements. - uint32_t arrayLength = JSArray::Cast(*array)->GetArrayLength(); - return arrayLength == newLen; + uint32_t array_length = JSArray::Cast(*array)->GetArrayLength(); + return array_length == new_len; } bool JSArray::PropertyKeyToArrayIndex(JSThread *thread, const JSHandle &key, uint32_t *output) @@ -310,8 +310,8 @@ bool JSArray::DefineOwnProperty(JSThread *thread, const JSHandle &arra // 4. Return OrdinaryDefineOwnProperty(A, P, Desc). bool success = JSObject::OrdinaryDefineOwnProperty(thread, array, key, desc); if (success) { - JSTaggedValue constructorKey = thread->GlobalConstants()->GetConstructorString(); - if (key.GetTaggedValue() == constructorKey) { + JSTaggedValue constructor_key = thread->GlobalConstants()->GetConstructorString(); + if (key.GetTaggedValue() == constructor_key) { array->GetJSHClass()->SetHasConstructor(true); return true; } @@ -332,7 +332,7 @@ bool JSArray::IsLengthString(JSThread *thread, const JSHandle &ke // ecma6 7.3 Operations on Objects JSHandle JSArray::CreateArrayFromList(JSThread *thread, const JSHandle &elements, - array_size_t length) + ArraySizeT length) { // Assert: elements is a List whose elements are all ECMAScript language values. // 2. Let array be ArrayCreate(0) (see 9.4.2.2). @@ -340,8 +340,8 @@ JSHandle JSArray::CreateArrayFromList(JSThread *thread, const JSHandle< // 4. For each element e of elements auto env = thread->GetEcmaVM()->GetGlobalEnv(); ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - JSHandle arrayFunc = env->GetArrayFunction(); - JSHandle obj = factory->NewJSObjectByConstructor(JSHandle(arrayFunc), arrayFunc); + JSHandle array_func = env->GetArrayFunction(); + JSHandle obj = factory->NewJSObjectByConstructor(JSHandle(array_func), array_func); obj->GetJSHClass()->SetExtensible(true); JSArray::Cast(*obj)->SetArrayLength(thread, length); diff --git a/runtime/js_array.h b/runtime/js_array.h index d15ac9ba7..d6148dda6 100644 --- a/runtime/js_array.h +++ b/runtime/js_array.h @@ -32,8 +32,8 @@ public: static JSHandle ArrayCreate(JSThread *thread, JSTaggedNumber length); static JSHandle ArrayCreate(JSThread *thread, JSTaggedNumber length, - const JSHandle &newTarget); - static JSTaggedValue ArraySpeciesCreate(JSThread *thread, const JSHandle &originalArray, + const JSHandle &new_target); + static JSTaggedValue ArraySpeciesCreate(JSThread *thread, const JSHandle &original_array, JSTaggedNumber length); static bool ArraySetLength(JSThread *thread, const JSHandle &array, const PropertyDescriptor &desc); static bool DefineOwnProperty(JSThread *thread, const JSHandle &array, const JSHandle &key, @@ -49,7 +49,7 @@ public: } static JSHandle CreateArrayFromList(JSThread *thread, const JSHandle &elements, - array_size_t length); + ArraySizeT length); // use first inlined property slot for array length inline uint32_t GetArrayLength() const { @@ -79,7 +79,7 @@ public: static JSTaggedValue LengthGetter(JSThread *thread, const JSHandle &self); static bool LengthSetter(JSThread *thread, const JSHandle &self, const JSHandle &value, - bool mayThrow = false); + bool may_throw = false); static JSHandle FastGetPropertyByValue(JSThread *thread, const JSHandle &obj, uint32_t index); @@ -94,7 +94,7 @@ public: const JSHandle &key, const JSHandle &value); private: - static void SetCapacity(JSThread *thread, const JSHandle &array, uint32_t oldLen, uint32_t newLen); + static void SetCapacity(JSThread *thread, const JSHandle &array, uint32_t old_len, uint32_t new_len); }; } // namespace panda::ecmascript diff --git a/runtime/js_arraylist.cpp b/runtime/js_arraylist.cpp index 2982c83fe..126155e3a 100644 --- a/runtime/js_arraylist.cpp +++ b/runtime/js_arraylist.cpp @@ -19,15 +19,15 @@ #include "plugins/ecmascript/runtime/object_factory.h" namespace panda::ecmascript { -void JSArrayList::Add(JSThread *thread, const JSHandle &arrayList, const JSHandle &value) +void JSArrayList::Add(JSThread *thread, const JSHandle &array_list, const JSHandle &value) { // GrowCapacity - uint32_t length = arrayList->GetLength().GetArrayLength(); - JSHandle elements = GrowCapacity(thread, arrayList, length + 1); + uint32_t length = array_list->GetLength().GetArrayLength(); + JSHandle elements = GrowCapacity(thread, array_list, length + 1); ASSERT(!elements->IsDictionaryMode()); elements->Set(thread, length, value); - arrayList->SetLength(thread, JSTaggedValue(++length)); + array_list->SetLength(thread, JSTaggedValue(++length)); } JSHandle JSArrayList::GrowCapacity(const JSThread *thread, const JSHandle &obj, diff --git a/runtime/js_arraylist.h b/runtime/js_arraylist.h index 23e2fe247..f2147bf04 100644 --- a/runtime/js_arraylist.h +++ b/runtime/js_arraylist.h @@ -28,7 +28,7 @@ public: return static_cast(object); } - static void Add(JSThread *thread, const JSHandle &arrayList, const JSHandle &value); + static void Add(JSThread *thread, const JSHandle &array_list, const JSHandle &value); JSTaggedValue Get(JSThread *thread, uint32_t index); @@ -51,10 +51,10 @@ public: DECL_VISIT_OBJECT_FOR_JS_OBJECT(JSObject, LENGTH_OFFSET, SIZE) DECL_DUMP() private: - inline static uint32_t ComputeCapacity(uint32_t oldCapacity) + inline static uint32_t ComputeCapacity(uint32_t old_capacity) { - uint32_t newCapacity = oldCapacity + (oldCapacity >> 1U); - return newCapacity > DEFAULT_CAPACITY_LENGTH ? newCapacity : DEFAULT_CAPACITY_LENGTH; + uint32_t new_capacity = old_capacity + (old_capacity >> 1U); + return new_capacity > DEFAULT_CAPACITY_LENGTH ? new_capacity : DEFAULT_CAPACITY_LENGTH; } static JSHandle GrowCapacity(const JSThread *thread, const JSHandle &obj, uint32_t capacity); diff --git a/runtime/js_async_generator_object.cpp b/runtime/js_async_generator_object.cpp index 395acb70c..e0f1b090d 100644 --- a/runtime/js_async_generator_object.cpp +++ b/runtime/js_async_generator_object.cpp @@ -12,7 +12,7 @@ #include "plugins/ecmascript/runtime/generator_helper.h" namespace panda::ecmascript { -enum class AsyncGeneratorRequest : panda::array_size_t { COMPLETION, PROMISE_CAPABILITY }; +enum class AsyncGeneratorRequest : panda::ArraySizeT { COMPLETION, PROMISE_CAPABILITY }; using BuiltinsPromise = builtins::BuiltinsPromise; JSTaggedValue JSAsyncGeneratorResolveNextFunction::AsyncGeneratorResolveNextFulfilled(EcmaRuntimeCallInfo *argv) diff --git a/runtime/js_function.cpp b/runtime/js_function.cpp index 7d659ae37..c33b4792a 100644 --- a/runtime/js_function.cpp +++ b/runtime/js_function.cpp @@ -127,7 +127,7 @@ JSTaggedValue JSFunction::PrototypeGetter(JSThread *thread, const JSHandle &self, const JSHandle &value, - [[maybe_unused]] bool mayThrow) + [[maybe_unused]] bool may_throw) { JSHandle func(self); JSTaggedValue protoOrDyn = func->GetProtoOrDynClass(); @@ -254,7 +254,7 @@ bool JSFunction::MakeConstructor(JSThread *thread, const JSHandle &f } JSTaggedValue JSFunction::Call(JSThread *thread, const JSHandle &func, - const JSHandle &thisArg, uint32_t argc, + const JSHandle &this_arg, uint32_t argc, const JSTaggedType argv[] // NOLINT(modernize-avoid-c-arrays) ) { @@ -267,7 +267,7 @@ JSTaggedValue JSFunction::Call(JSThread *thread, const JSHandle & } if (func->IsJSFunction()) { - return JSFunction::CallInternal(thread, JSHandle(func), thisArg, argc, argv); + return JSFunction::CallInternal(thread, JSHandle(func), this_arg, argc, argv); } if (func->IsBoundFunction()) { @@ -275,7 +275,7 @@ JSTaggedValue JSFunction::Call(JSThread *thread, const JSHandle & } if (func->IsJSProxy()) { - return JSProxy::CallInternal(thread, JSHandle(func), thisArg, argc, argv); + return JSProxy::CallInternal(thread, JSHandle(func), this_arg, argc, argv); } THROW_TYPE_ERROR_AND_RETURN(thread, "Call NonCallable", JSTaggedValue::Exception()); @@ -283,9 +283,9 @@ JSTaggedValue JSFunction::Call(JSThread *thread, const JSHandle & JSTaggedValue JSFunction::Construct(JSThread *thread, const JSHandle &func, uint32_t argc, const JSTaggedType argv[], // NOLINT(modernize-avoid-c-arrays) - const JSHandle &newTarget) + const JSHandle &new_target) { - JSMutableHandle target(thread, newTarget.GetTaggedValue()); + JSMutableHandle target(thread, new_target.GetTaggedValue()); if (target->IsUndefined()) { target.Update(func.GetTaggedValue()); } @@ -304,19 +304,19 @@ JSTaggedValue JSFunction::Construct(JSThread *thread, const JSHandle &thisArg, +JSTaggedValue JSFunction::Invoke(JSThread *thread, const JSHandle &this_arg, const JSHandle &key, uint32_t argc, const JSTaggedType argv[] // NOLINT(modernize-avoid-c-arrays) ) { ASSERT(JSTaggedValue::IsPropertyKey(key)); - JSHandle func(JSTaggedValue::GetProperty(thread, thisArg, key).GetValue()); - return JSFunction::Call(thread, func, thisArg, argc, argv); + JSHandle func(JSTaggedValue::GetProperty(thread, this_arg, key).GetValue()); + return JSFunction::Call(thread, func, this_arg, argc, argv); } // [[Call]] JSTaggedValue JSFunction::CallInternal(JSThread *thread, const JSHandle &func, - const JSHandle &thisArg, uint32_t argc, + const JSHandle &this_arg, uint32_t argc, const JSTaggedType argv[] // NOLINT(modernize-avoid-c-arrays) ) { @@ -325,7 +325,7 @@ JSTaggedValue JSFunction::CallInternal(JSThread *thread, const JSHandle values; values.reserve(size); values.clear(); @@ -335,9 +335,9 @@ JSTaggedValue JSFunction::CallInternal(JSThread *thread, const JSHandle &func, uint32_t argc, const JSTaggedType argv[], // NOLINT(modernize-avoid-c-arrays) - const JSHandle &newTarget) + const JSHandle &new_target) { - ASSERT(newTarget->IsECMAObject()); + ASSERT(new_target->IsECMAObject()); if (!func->IsConstructor()) { THROW_TYPE_ERROR_AND_RETURN(thread, "Constructor is false", JSTaggedValue::Exception()); } @@ -358,11 +358,11 @@ JSTaggedValue JSFunction::ConstructInternal(JSThread *thread, const JSHandle obj(thread, JSTaggedValue::Undefined()); if (!func->IsBuiltinsConstructor() && func->IsBase()) { ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - obj = JSHandle(factory->NewJSObjectByConstructor(func, newTarget)); + obj = JSHandle(factory->NewJSObjectByConstructor(func, new_target)); } constexpr uint32_t firstArgIndex = 3; - const array_size_t size = argc + firstArgIndex; + const ArraySizeT size = argc + firstArgIndex; thread_local std::vector values; values.reserve(size); values.clear(); @@ -370,10 +370,10 @@ JSTaggedValue JSFunction::ConstructInternal(JSThread *thread, const JSHandleGetCallTarget() != nullptr); values.emplace_back(func.GetTaggedType()); - values.emplace_back(newTarget.GetTaggedType()); + values.emplace_back(new_target.GetTaggedType()); values.emplace_back(obj.GetTaggedType()); - for (array_size_t i = 0; i < argc; ++i) { + for (ArraySizeT i = 0; i < argc; ++i) { // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) values.emplace_back(argv[i]); } @@ -381,7 +381,7 @@ JSTaggedValue JSFunction::ConstructInternal(JSThread *thread, const JSHandle::Cast(func), values.size(), values.data()); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); - // 9.3.2 [[Construct]] (argumentsList, newTarget) + // 9.3.2 [[Construct]] (argumentsList, new_target) if (func->IsBuiltinsConstructor() || resultValue.IsECMAObject()) { return resultValue; } @@ -477,14 +477,14 @@ JSTaggedValue JSBoundFunction::CallInternal(JSThread *thread, const JSHandleGetLength(), params->GetArgv()); } -// 9.4.1.2[[Construct]](argumentsList, newTarget) +// 9.4.1.2[[Construct]](argumentsList, new_target) JSTaggedValue JSBoundFunction::ConstructInternal(JSThread *thread, const JSHandle &func, - const JSHandle &newTarget) + const JSHandle &new_target) { JSHandle target(thread, func->GetBoundTarget()); ASSERT(target->IsConstructor()); - JSMutableHandle newTargetMutable(thread, newTarget.GetTaggedValue()); - if (JSTaggedValue::SameValue(func.GetTaggedValue(), newTarget.GetTaggedValue())) { + JSMutableHandle newTargetMutable(thread, new_target.GetTaggedValue()); + if (JSTaggedValue::SameValue(func.GetTaggedValue(), new_target.GetTaggedValue())) { newTargetMutable.Update(target.GetTaggedValue()); } InternalCallParams *params = thread->GetInternalCallParams(); @@ -558,29 +558,29 @@ void JSFunction::SetFunctionNameNoPrefix(JSThread *thread, JSFunction *func, JST } JSHandle JSFunction::GetInstanceJSHClass(JSThread *thread, JSHandle constructor, - JSHandle newTarget) + JSHandle new_target) { - JSHandle ctorInitialJSHClass(thread, JSFunction::GetOrCreateInitialJSHClass(thread, constructor)); - // newTarget is construct itself - if (newTarget.GetTaggedValue() == constructor.GetTaggedValue()) { - return ctorInitialJSHClass; + JSHandle ctor_initial_js_hclass(thread, JSFunction::GetOrCreateInitialJSHClass(thread, constructor)); + // new_target is construct itself + if (new_target.GetTaggedValue() == constructor.GetTaggedValue()) { + return ctor_initial_js_hclass; } - // newTarget is derived-class of constructor - if (newTarget->IsJSFunction()) { - JSHandle newTargetFunc = JSHandle::Cast(newTarget); + // new_target is derived-class of constructor + if (new_target->IsJSFunction()) { + JSHandle newTargetFunc = JSHandle::Cast(new_target); if (newTargetFunc->IsDerivedConstructor()) { - JSTaggedValue newTargetProto = JSHandle::Cast(newTarget)->GetPrototype(thread); + JSTaggedValue newTargetProto = JSHandle::Cast(new_target)->GetPrototype(thread); if (newTargetProto == constructor.GetTaggedValue()) { - return GetOrCreateDerivedJSHClass(thread, newTargetFunc, constructor, ctorInitialJSHClass); + return GetOrCreateDerivedJSHClass(thread, newTargetFunc, constructor, ctor_initial_js_hclass); } } } // ECMA2015 9.1.15 3.Let proto be Get(constructor, "prototype"). JSMutableHandle prototype(thread, JSTaggedValue::Undefined()); - if (newTarget->IsJSFunction()) { - JSHandle newTargetFunc = JSHandle::Cast(newTarget); + if (new_target->IsJSFunction()) { + JSHandle newTargetFunc = JSHandle::Cast(new_target); FunctionKind kind = newTargetFunc->GetFunctionKind(); if (HasPrototype(kind)) { prototype.Update(PrototypeGetter(thread, JSHandle::Cast(newTargetFunc))); @@ -588,19 +588,20 @@ JSHandle JSFunction::GetInstanceJSHClass(JSThread *thread, JSHandle customizePrototype = - JSTaggedValue::GetProperty(thread, newTarget, thread->GlobalConstants()->GetHandledPrototypeString()) + JSTaggedValue::GetProperty(thread, new_target, thread->GlobalConstants()->GetHandledPrototypeString()) .GetValue(); RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSHClass, thread); prototype.Update(customizePrototype.GetTaggedValue()); // Reload JSHClass of constructor, where the lookup of 'prototype' property may change it. - ctorInitialJSHClass = JSHandle(thread, JSFunction::GetOrCreateInitialJSHClass(thread, constructor)); + ctor_initial_js_hclass = + JSHandle(thread, JSFunction::GetOrCreateInitialJSHClass(thread, constructor)); } if (!prototype->IsECMAObject()) { prototype.Update(constructor->GetFunctionPrototype()); } - JSHandle newJSHClass = JSHClass::Clone(thread, ctorInitialJSHClass); + JSHandle newJSHClass = JSHClass::Clone(thread, ctor_initial_js_hclass); newJSHClass->SetPrototype(thread, prototype); return newJSHClass; @@ -608,7 +609,7 @@ JSHandle JSFunction::GetInstanceJSHClass(JSThread *thread, JSHandle JSFunction::GetOrCreateDerivedJSHClass(JSThread *thread, JSHandle derived, [[maybe_unused]] JSHandle constructor, - JSHandle ctorInitialJSHClass) + JSHandle ctor_initial_js_hclass) { JSTaggedValue protoOrDyn(derived->GetProtoOrDynClass()); // has cached JSHClass, return directly @@ -616,7 +617,7 @@ JSHandle JSFunction::GetOrCreateDerivedJSHClass(JSThread *thread, JSHa return JSHandle(thread, protoOrDyn); } - JSHandle newJSHClass = JSHClass::Clone(thread, ctorInitialJSHClass); + JSHandle newJSHClass = JSHClass::Clone(thread, ctor_initial_js_hclass); // guarante derived has function prototype JSHandle prototype(thread, derived->GetProtoOrDynClass()); ASSERT(!prototype->IsHole()); @@ -643,13 +644,13 @@ DynClass *JSFunction::GetOrCreateInitialDynClass(JSThread *thread, const JSHandl } JSHandle JSFunction::GetInstanceDynClass(JSThread *thread, JSHandle constructor, - JSHandle newTarget) + JSHandle new_target) { - return JSHandle(JSFunction::GetInstanceJSHClass(thread, constructor, newTarget)); + return JSHandle(JSFunction::GetInstanceJSHClass(thread, constructor, new_target)); } bool JSFunction::NameSetter(JSThread *thread, const JSHandle &self, const JSHandle &value, - [[maybe_unused]] bool mayThrow) + [[maybe_unused]] bool may_throw) { if (self->IsPropertiesDict()) { // replace setter with value diff --git a/runtime/js_function.h b/runtime/js_function.h index 731025035..1e541974c 100644 --- a/runtime/js_function.h +++ b/runtime/js_function.h @@ -70,34 +70,34 @@ public: const JSHandle &obj); static JSTaggedValue SpeciesConstructor(const JSHandle &func, - const JSHandle &defaultConstructor); + const JSHandle &default_constructor); // ecma6 9.2 // 7.3.12 Call(F, V, argumentsList) static JSTaggedValue Call(JSThread *thread, const JSHandle &func, - const JSHandle &thisArg, uint32_t argc, + const JSHandle &this_arg, uint32_t argc, const JSTaggedType argv[] // NOLINT(modernize-avoid-c-arrays) ); static JSTaggedValue Construct(JSThread *thread, const JSHandle &func, uint32_t argc, const JSTaggedType argv[], // NOLINT(modernize-avoid-c-arrays) - const JSHandle &newTarget); - static JSTaggedValue Invoke(JSThread *thread, const JSHandle &thisArg, + const JSHandle &new_target); + static JSTaggedValue Invoke(JSThread *thread, const JSHandle &this_arg, const JSHandle &key, uint32_t argc, const JSTaggedType argv[] // NOLINT(modernize-avoid-c-arrays) ); // 9.2.1[[Call]](thisArgument, argumentsList) // 9.3.1[[Call]](thisArgument, argumentsList) static JSTaggedValue CallInternal(JSThread *thread, const JSHandle &func, - const JSHandle &thisArg, uint32_t argc, + const JSHandle &this_arg, uint32_t argc, const JSTaggedType argv[] // NOLINT(modernize-avoid-c-arrays) ); // 9.2.2[[Construct]](argumentsList, newTarget) // 9.3.2[[Construct]](argumentsList, newTarget) static JSTaggedValue ConstructInternal(JSThread *thread, const JSHandle &func, uint32_t argc, const JSTaggedType argv[], // NOLINT(modernize-avoid-c-arrays) - const JSHandle &newTarget); + const JSHandle &new_target); static bool AddRestrictedFunctionProperties(const JSHandle &func, const JSHandle &realm); static bool MakeConstructor(JSThread *thread, const JSHandle &func, @@ -111,26 +111,26 @@ public: static bool IsDynClass(JSTaggedValue object); static JSTaggedValue PrototypeGetter(JSThread *thread, const JSHandle &self); static bool PrototypeSetter(JSThread *thread, const JSHandle &self, const JSHandle &value, - bool mayThrow); + bool may_throw); static JSTaggedValue NameGetter(JSThread *thread, const JSHandle &self); static bool NameSetter(JSThread *thread, const JSHandle &self, const JSHandle &value, - bool mayThrow); + bool may_throw); static JSTaggedValue LengthGetter(JSThread *thread, const JSHandle &self); static bool LengthSetter(JSThread *thread, const JSHandle &self, const JSHandle &value, - bool mayThrow); + bool may_throw); static void SetFunctionNameNoPrefix(JSThread *thread, JSFunction *func, JSTaggedValue name); static JSHandle GetInstanceDynClass(JSThread *thread, JSHandle constructor, - JSHandle newTarget); + JSHandle new_target); inline JSTaggedValue GetFunctionPrototype() const { ASSERT(HasFunctionPrototype()); - JSTaggedValue protoOrDyn = GetProtoOrDynClass(); - if (protoOrDyn.IsJSHClass()) { - return JSHClass::Cast(protoOrDyn.GetTaggedObject())->GetPrototype(); + JSTaggedValue proto_or_dyn = GetProtoOrDynClass(); + if (proto_or_dyn.IsJSHClass()) { + return JSHClass::Cast(proto_or_dyn.GetTaggedObject())->GetPrototype(); } - return protoOrDyn; + return proto_or_dyn; } inline void SetFunctionPrototype(const JSThread *thread, JSTaggedValue proto) @@ -146,21 +146,21 @@ public: inline bool HasInitialDynClass() const { - JSTaggedValue protoOrDyn = GetProtoOrDynClass(); - return protoOrDyn.IsJSHClass(); + JSTaggedValue proto_or_dyn = GetProtoOrDynClass(); + return proto_or_dyn.IsJSHClass(); } inline bool HasFunctionPrototype() const { - JSTaggedValue protoOrDyn = GetProtoOrDynClass(); - return !protoOrDyn.IsHole(); + JSTaggedValue proto_or_dyn = GetProtoOrDynClass(); + return !proto_or_dyn.IsHole(); } inline DynClass *GetInitialDynClass() const { ASSERT(HasInitialDynClass()); - JSTaggedValue protoOrDyn = GetProtoOrDynClass(); - return reinterpret_cast(protoOrDyn.GetTaggedObject()); + JSTaggedValue proto_or_dyn = GetProtoOrDynClass(); + return reinterpret_cast(proto_or_dyn.GetTaggedObject()); } inline void SetFunctionLength(const JSThread *thread, JSTaggedValue length) @@ -188,20 +188,20 @@ public: inline void SetFunctionKind(const JSThread *thread, FunctionKind kind) { - JSTaggedType oldValue = GetFunctionInfoFlag().GetRawData(); - SetFunctionInfoFlag(thread, JSTaggedValue(FunctionKindBit::Update(oldValue, kind))); + JSTaggedType old_value = GetFunctionInfoFlag().GetRawData(); + SetFunctionInfoFlag(thread, JSTaggedValue(FunctionKindBit::Update(old_value, kind))); } inline void SetStrict(const JSThread *thread, bool flag) { - JSTaggedType oldValue = GetFunctionInfoFlag().GetRawData(); - SetFunctionInfoFlag(thread, JSTaggedValue(StrictBit::Update(oldValue, flag))); + JSTaggedType old_value = GetFunctionInfoFlag().GetRawData(); + SetFunctionInfoFlag(thread, JSTaggedValue(StrictBit::Update(old_value, flag))); } inline void SetResolved(const JSThread *thread) { - TaggedType oldValue = GetFunctionInfoFlag().GetRawData(); - SetFunctionInfoFlag(thread, JSTaggedValue(ResolvedBit::Update(oldValue, true))); + TaggedType old_value = GetFunctionInfoFlag().GetRawData(); + SetFunctionInfoFlag(thread, JSTaggedValue(ResolvedBit::Update(old_value, true))); } inline bool IsResolved() const @@ -211,8 +211,8 @@ public: inline void SetFunctionMode(const JSThread *thread, FunctionMode mode) { - JSTaggedType oldValue = GetFunctionInfoFlag().GetRawData(); - SetFunctionInfoFlag(thread, JSTaggedValue(ThisModeBit::Update(oldValue, mode))); + JSTaggedType old_value = GetFunctionInfoFlag().GetRawData(); + SetFunctionInfoFlag(thread, JSTaggedValue(ThisModeBit::Update(old_value, mode))); } inline FunctionKind GetFunctionKind() const @@ -275,7 +275,7 @@ public: FunctionKind kind = FunctionKind::NORMAL_FUNCTION, bool strict = true); static JSHClass *GetOrCreateInitialJSHClass(JSThread *thread, const JSHandle &fun); static JSHandle GetInstanceJSHClass(JSThread *thread, JSHandle constructor, - JSHandle newTarget); + JSHandle new_target); static constexpr size_t PROTO_OR_DYNCLASS_OFFSET = JSFunctionBase::SIZE; ACCESSORS(ProtoOrDynClass, PROTO_OR_DYNCLASS_OFFSET, LEXICAL_ENV_OFFSET) @@ -300,7 +300,7 @@ public: private: static JSHandle GetOrCreateDerivedJSHClass(JSThread *thread, JSHandle derived, JSHandle constructor, - JSHandle ctorInitialJSHClass); + JSHandle ctor_initial_js_hclass); }; class JSGeneratorFunction : public JSFunction { @@ -345,7 +345,7 @@ public: // 9.4.1.2[[Construct]](argumentsList, newTarget) static JSTaggedValue ConstructInternal(JSThread *thread, const JSHandle &func, - const JSHandle &newTarget); + const JSHandle &new_target); static constexpr size_t BOUND_TARGET_OFFSET = JSFunctionBase::SIZE; ACCESSORS(BoundTarget, BOUND_TARGET_OFFSET, BOUND_THIS_OFFSET); diff --git a/runtime/js_generator_object.cpp b/runtime/js_generator_object.cpp index 87d087522..e0fd7f49f 100644 --- a/runtime/js_generator_object.cpp +++ b/runtime/js_generator_object.cpp @@ -84,7 +84,7 @@ JSHandle JSGeneratorObject::GeneratorResume(JSThread *thread, JSHandle JSGeneratorObject::GeneratorResumeAbrupt(JSThread *thread, const JSHandle &generator, - const JSHandle &abruptCompletion) + const JSHandle &abrupt_completion) { // 1.Let state be ? GeneratorValidate(generator). JSHandle gen(thread, generator.GetTaggedValue()); @@ -102,15 +102,15 @@ JSHandle JSGeneratorObject::GeneratorResumeAbrupt(JSThread *threa } // 3.If state is completed, then - // a.If abruptCompletion.[[Type]] is return, then - // i.Return CreateIterResultObject(abruptCompletion.[[Value]], true). - // b.Return Completion(abruptCompletion). + // a.If abrupt_completion.[[Type]] is return, then + // i.Return CreateIterResultObject(abrupt_completion.[[Value]], true). + // b.Return Completion(abrupt_completion). if (JSGeneratorObject::IsState(state, JSGeneratorState::COMPLETED)) { - JSHandle valueHandle(thread, abruptCompletion->GetValue()); + JSHandle valueHandle(thread, abrupt_completion->GetValue()); JSHandle result = JSHandle::Cast(JSIterator::CreateIterResultObject(thread, valueHandle, true)); - if (abruptCompletion->IsReturn()) { + if (abrupt_completion->IsReturn()) { return result; } THROW_NEW_ERROR_AND_RETURN_VALUE(thread, valueHandle.GetTaggedValue(), result); @@ -129,18 +129,18 @@ JSHandle JSGeneratorObject::GeneratorResumeAbrupt(JSThread *threa generator->SetState(thread, JSGeneratorState::EXECUTING); // 9.Push genContext onto the execution context stack; genContext is now the running execution context. - // 10.Resume the suspended evaluation of genContext using abruptCompletion as the result of the operation that + // 10.Resume the suspended evaluation of genContext using abrupt_completion as the result of the operation that // suspended it. Let result be the completion record returned by the resumed computation. // 11.Assert: When we return here, genContext has already been removed from the execution context stack and // methodContext is the currently running execution context. // 12.Return Completion(result). JSHandle result; - if (abruptCompletion->IsReturn()) { + if (abrupt_completion->IsReturn()) { result = - GeneratorHelper::Continue(thread, genContext, GeneratorResumeMode::RETURN, abruptCompletion->GetValue()); + GeneratorHelper::Continue(thread, genContext, GeneratorResumeMode::RETURN, abrupt_completion->GetValue()); } else { result = - GeneratorHelper::Continue(thread, genContext, GeneratorResumeMode::THROW, abruptCompletion->GetValue()); + GeneratorHelper::Continue(thread, genContext, GeneratorResumeMode::THROW, abrupt_completion->GetValue()); } return result; } diff --git a/runtime/js_generator_object.h b/runtime/js_generator_object.h index a00641643..de3edea80 100644 --- a/runtime/js_generator_object.h +++ b/runtime/js_generator_object.h @@ -64,16 +64,16 @@ public: // 26.4.3.4 GeneratorResumeAbrupt(generator, abruptCompletion) static JSHandle GeneratorResumeAbrupt(JSThread *thread, const JSHandle &generator, - const JSHandle &abruptCompletion); + const JSHandle &abrupt_completion); inline bool IsSuspendYield() const { return GetGeneratorState() == JSTaggedValue(static_cast(JSGeneratorState::SUSPENDED_YIELD)); } - static inline bool IsState(JSTaggedValue stateValue, JSGeneratorState state) + static inline bool IsState(JSTaggedValue state_value, JSGeneratorState state) { - return stateValue == JSTaggedValue(static_cast(state)); + return state_value == JSTaggedValue(static_cast(state)); } inline bool IsExecuting() const diff --git a/runtime/js_handle.h b/runtime/js_handle.h index 1c0776692..b3096cb08 100644 --- a/runtime/js_handle.h +++ b/runtime/js_handle.h @@ -207,18 +207,18 @@ public: ~JSSpanHandle() { - ASSERT(thread_->spanHandle_ == this); - thread_->spanHandle_ = prev_; + ASSERT(thread_->span_handle_ == this); + thread_->span_handle_ = prev_; } - JSTaggedValue *data() + JSTaggedValue *Data() { return sp_.data(); } - JSTaggedType *dataTaggedType() + JSTaggedType *DataTaggedType() { - return reinterpret_cast(data()); + return reinterpret_cast(Data()); } JSTaggedValue &operator[](size_t idx) @@ -228,7 +228,7 @@ public: static void IterateChain(JSThread *thread, const RootRangeVisitor &v0) { - for (auto head = thread->spanHandle_; head != nullptr; head = head->prev_) { + for (auto head = thread->span_handle_; head != nullptr; head = head->prev_) { auto &sp = head->sp_; v0(Root::ROOT_HANDLE, ObjectSlot(ToUintPtr(sp.begin())), ObjectSlot(ToUintPtr(sp.end()))); } @@ -240,8 +240,8 @@ private: void AddToChain() { - prev_ = thread_->spanHandle_; - thread_->spanHandle_ = this; + prev_ = thread_->span_handle_; + thread_->span_handle_ = this; } JSSpanHandle *prev_ {nullptr}; diff --git a/runtime/js_hclass-inl.h b/runtime/js_hclass-inl.h index e72c04820..20ea139da 100644 --- a/runtime/js_hclass-inl.h +++ b/runtime/js_hclass-inl.h @@ -39,14 +39,14 @@ void JSHClass::AddTransitions(const JSThread *thread, const JSHandle & } JSMutableHandle dict(thread, JSTaggedValue::Undefined()); if (transitions.IsJSHClass()) { - auto cachedHClass = JSHClass::Cast(transitions.GetTaggedObject()); - int32_t last = cachedHClass->NumberOfProps() - 1; - LayoutInfo *layoutInfo = LayoutInfo::Cast(cachedHClass->GetLayout().GetTaggedObject()); - auto attr = JSHandle(thread, JSTaggedValue(layoutInfo->GetAttr(last).GetPropertyMetaData())); - auto lastKey = JSHandle(thread, layoutInfo->GetKey(last)); - auto lastHClass = JSHandle(thread, cachedHClass); + auto cached_h_class = JSHClass::Cast(transitions.GetTaggedObject()); + int32_t last = cached_h_class->NumberOfProps() - 1; + LayoutInfo *layout_info = LayoutInfo::Cast(cached_h_class->GetLayout().GetTaggedObject()); + auto attr = JSHandle(thread, JSTaggedValue(layout_info->GetAttr(last).GetPropertyMetaData())); + auto last_key = JSHandle(thread, layout_info->GetKey(last)); + auto last_h_class = JSHandle(thread, cached_h_class); dict.Update(TransitionsDictionary::Create(thread)); - transitions = TransitionsDictionary::PutIfAbsent(thread, dict, lastKey, lastHClass, attr).GetTaggedValue(); + transitions = TransitionsDictionary::PutIfAbsent(thread, dict, last_key, last_h_class, attr).GetTaggedValue(); } auto attr = JSHandle(thread, JSTaggedValue(attributes.GetPropertyMetaData())); dict.Update(transitions); @@ -72,14 +72,14 @@ void JSHClass::AddProtoTransitions(const JSThread *thread, const JSHandleNumberOfProps() - 1; - LayoutInfo *layoutInfo = LayoutInfo::Cast(cachedHClass->GetLayout().GetTaggedObject()); - auto attr = JSHandle(thread, JSTaggedValue(layoutInfo->GetAttr(last).GetPropertyMetaData())); - auto lastKey = JSHandle(thread, layoutInfo->GetKey(last)); - auto lastHClass = JSHandle(thread, cachedHClass); + auto cached_h_class = JSHClass::Cast(transitions.GetTaggedObject()); + int32_t last = cached_h_class->NumberOfProps() - 1; + LayoutInfo *layout_info = LayoutInfo::Cast(cached_h_class->GetLayout().GetTaggedObject()); + auto attr = JSHandle(thread, JSTaggedValue(layout_info->GetAttr(last).GetPropertyMetaData())); + auto last_key = JSHandle(thread, layout_info->GetKey(last)); + auto last_h_class = JSHandle(thread, cached_h_class); dict.Update(TransitionsDictionary::Create(thread)); - transitions = TransitionsDictionary::PutIfAbsent(thread, dict, lastKey, lastHClass, attr).GetTaggedValue(); + transitions = TransitionsDictionary::PutIfAbsent(thread, dict, last_key, last_h_class, attr).GetTaggedValue(); } dict.Update(transitions); @@ -96,13 +96,13 @@ inline JSHClass *JSHClass::FindTransitions(const JSTaggedValue &key, const JSTag return nullptr; } if (transitions.IsJSHClass()) { - auto cachedHClass = JSHClass::Cast(transitions.GetTaggedObject()); - int32_t last = cachedHClass->NumberOfProps() - 1; - LayoutInfo *layoutInfo = LayoutInfo::Cast(cachedHClass->GetLayout().GetTaggedObject()); - auto attr = layoutInfo->GetAttr(last).GetPropertyMetaData(); - auto cachedKey = layoutInfo->GetKey(last); - if (attr == attributes.GetInt() && key == cachedKey) { - return cachedHClass; + auto cached_h_class = JSHClass::Cast(transitions.GetTaggedObject()); + int32_t last = cached_h_class->NumberOfProps() - 1; + LayoutInfo *layout_info = LayoutInfo::Cast(cached_h_class->GetLayout().GetTaggedObject()); + auto attr = layout_info->GetAttr(last).GetPropertyMetaData(); + auto cached_key = layout_info->GetKey(last); + if (attr == attributes.GetInt() && key == cached_key) { + return cached_h_class; } return nullptr; } @@ -133,14 +133,14 @@ inline JSHClass *JSHClass::FindProtoTransitions(const JSTaggedValue &key, const } inline void JSHClass::UpdatePropertyMetaData(const JSThread *thread, [[maybe_unused]] const JSTaggedValue &key, - const PropertyAttributes &metaData) + const PropertyAttributes &meta_data) { ASSERT(!GetLayout().IsNull()); - LayoutInfo *layoutInfo = LayoutInfo::Cast(GetLayout().GetTaggedObject()); - ASSERT(layoutInfo->GetLength() != 0); - int32_t entry = metaData.GetOffset(); + LayoutInfo *layout_info = LayoutInfo::Cast(GetLayout().GetTaggedObject()); + ASSERT(layout_info->GetLength() != 0); + int32_t entry = meta_data.GetOffset(); - layoutInfo->SetNormalAttr(thread, entry, metaData); + layout_info->SetNormalAttr(thread, entry, meta_data); } inline bool JSHClass::HasReferenceField() diff --git a/runtime/js_hclass.cpp b/runtime/js_hclass.cpp index 72f610e98..25f864efb 100644 --- a/runtime/js_hclass.cpp +++ b/runtime/js_hclass.cpp @@ -31,12 +31,12 @@ JSHandle TransitionsDictionary::PutIfAbsent(const JSThrea const JSHandle &dictionary, const JSHandle &key, const JSHandle &value, - const JSHandle &metaData) + const JSHandle &meta_data) { - int hash = TransitionsDictionary::Hash(key.GetTaggedValue(), metaData.GetTaggedValue()); + int hash = TransitionsDictionary::Hash(key.GetTaggedValue(), meta_data.GetTaggedValue()); /* no need to add key if exist */ - int entry = dictionary->FindEntry(key.GetTaggedValue(), metaData.GetTaggedValue()); + int entry = dictionary->FindEntry(key.GetTaggedValue(), meta_data.GetTaggedValue()); if (entry != -1) { return dictionary; } @@ -45,17 +45,17 @@ JSHandle TransitionsDictionary::PutIfAbsent(const JSThrea JSHandle newDictionary(HashTableT::GrowHashTable(thread, dictionary)); // Compute the key object. entry = newDictionary->FindInsertIndex(hash); - newDictionary->SetEntry(thread, entry, key.GetTaggedValue(), value.GetTaggedValue(), metaData.GetTaggedValue()); + newDictionary->SetEntry(thread, entry, key.GetTaggedValue(), value.GetTaggedValue(), meta_data.GetTaggedValue()); newDictionary->IncreaseEntries(thread); return newDictionary; } -int TransitionsDictionary::FindEntry(const JSTaggedValue &key, const JSTaggedValue &metaData) +int TransitionsDictionary::FindEntry(const JSTaggedValue &key, const JSTaggedValue &meta_data) { size_t size = Size(); uint32_t count = 1; - uint32_t hash = TransitionsDictionary::Hash(key, metaData); + uint32_t hash = TransitionsDictionary::Hash(key, meta_data); // GrowHashTable will guarantee the hash table is never full. for (int entry = GetFirstPosition(hash, size);; entry = GetNextPosition(entry, count++, size)) { JSTaggedValue element = GetKey(entry); @@ -66,7 +66,7 @@ int TransitionsDictionary::FindEntry(const JSTaggedValue &key, const JSTaggedVal return -1; } - if (TransitionsDictionary::IsMatch(key, metaData, element, GetAttributes(entry))) { + if (TransitionsDictionary::IsMatch(key, meta_data, element, GetAttributes(entry))) { return entry; } } @@ -76,9 +76,9 @@ int TransitionsDictionary::FindEntry(const JSTaggedValue &key, const JSTaggedVal JSHandle TransitionsDictionary::Remove(const JSThread *thread, const JSHandle &table, const JSHandle &key, - const JSTaggedValue &metaData) + const JSTaggedValue &meta_data) { - int entry = table->FindEntry(key.GetTaggedValue(), metaData); + int entry = table->FindEntry(key.GetTaggedValue(), meta_data); if (entry == -1) { return table; } @@ -87,9 +87,9 @@ JSHandle TransitionsDictionary::Remove(const JSThread *th return TransitionsDictionary::Shrink(thread, table); } -void TransitionsDictionary::Rehash(const JSThread *thread, TransitionsDictionary *newTable) +void TransitionsDictionary::Rehash(const JSThread *thread, TransitionsDictionary *new_table) { - if ((newTable == nullptr) || (newTable->Size() < EntriesCount())) { + if ((new_table == nullptr) || (new_table->Size() < EntriesCount())) { return; } int size = this->Size(); @@ -101,27 +101,27 @@ void TransitionsDictionary::Rehash(const JSThread *thread, TransitionsDictionary continue; } int hash = TransitionsDictionary::Hash(k, this->GetAttributes(i)); - int insertionIndex = GetEntryIndex(newTable->FindInsertIndex(hash)); + int insertionIndex = GetEntryIndex(new_table->FindInsertIndex(hash)); JSTaggedValue tv = Get(fromIndex); - newTable->Set(thread, insertionIndex, tv); + new_table->Set(thread, insertionIndex, tv); for (int j = 1; j < TransitionsDictionary::ENTRY_SIZE; j++) { tv = Get(fromIndex + j); - newTable->Set(thread, insertionIndex + j, tv); + new_table->Set(thread, insertionIndex + j, tv); } } - newTable->SetEntriesCount(thread, EntriesCount()); - newTable->SetHoleEntriesCount(thread, 0); + new_table->SetEntriesCount(thread, EntriesCount()); + new_table->SetHoleEntriesCount(thread, 0); } // class JSHClass -void JSHClass::Initialize(const JSThread *thread, uint32_t size, JSType type, uint32_t inlinedProps, uint32_t flags) +void JSHClass::Initialize(const JSThread *thread, uint32_t size, JSType type, uint32_t inlined_props, uint32_t flags) { new (&hclass_) HClass(flags, panda_file::SourceLang::ECMASCRIPT); hclass_.SetManagedObject(this); ClearBitField(); if (JSType::JS_OBJECT_BEGIN <= type && type <= JSType::JS_OBJECT_END) { - SetObjectSize(size + inlinedProps * JSTaggedValue::TaggedTypeSize()); + SetObjectSize(size + inlined_props * JSTaggedValue::TaggedTypeSize()); SetInlinedPropsStart(size); auto env = thread->GetEcmaVM()->GetGlobalEnv(); SetLayout(thread, env->GetEmptyLayoutInfo()); @@ -152,15 +152,15 @@ void JSHClass::Copy(const JSThread *thread, const JSHClass *jshclass) } JSHandle JSHClass::Clone(const JSThread *thread, const JSHandle &jshclass, - bool withoutInlinedProperties) + bool without_inlined_properties) { JSType type = jshclass->GetObjectType(); uint32_t size = jshclass->IsJSObject() ? jshclass->GetInlinedPropsStartSize() : jshclass->GetObjectSize(); - uint32_t numInlinedProps = withoutInlinedProperties ? 0 : jshclass->GetInlinedProperties(); + uint32_t numInlinedProps = without_inlined_properties ? 0 : jshclass->GetInlinedProperties(); ASSERT(jshclass->IsJSObject() || numInlinedProps == 0); auto factory = thread->GetEcmaVM()->GetFactory(); - JSHandle newJshclass = - factory->NewEcmaDynClass(factory->hclassClass_, size, type, jshclass->GetHClass()->GetFlags(), numInlinedProps); + JSHandle newJshclass = factory->NewEcmaDynClass(factory->hclass_class_, size, type, + jshclass->GetHClass()->GetFlags(), numInlinedProps); // Copy all newJshclass->Copy(thread, *jshclass); newJshclass->SetParent(thread, JSTaggedValue::Null()); @@ -207,7 +207,7 @@ void JSHClass::AddProperty(const JSThread *thread, const JSHandle &obj // 2. Create hclass JSHandle newJshclass = JSHClass::Clone(thread, jshclass); - // 3. Add Property and metaData + // 3. Add Property and meta_data int offset = attr.GetOffset(); newJshclass->IncNumberOfProps(); @@ -350,18 +350,18 @@ JSHandle JSHClass::EnableProtoChangeMarker(const JSThread *thread return JSHandle(markerHandle); } -void JSHClass::NotifyHclassChanged(const JSThread *thread, JSHandle oldHclass, JSHandle newHclass) +void JSHClass::NotifyHclassChanged(const JSThread *thread, JSHandle old_hclass, JSHandle new_hclass) { - if (!oldHclass->IsPrototype()) { + if (!old_hclass->IsPrototype()) { return; } // The old hclass is the same as new one - if (oldHclass.GetTaggedValue() == newHclass.GetTaggedValue()) { + if (old_hclass.GetTaggedValue() == new_hclass.GetTaggedValue()) { return; } - newHclass->SetIsPrototype(true); - JSHClass::NoticeThroughChain(thread, oldHclass); - JSHClass::RefreshUsers(thread, oldHclass, newHclass); + new_hclass->SetIsPrototype(true); + JSHClass::NoticeThroughChain(thread, old_hclass); + JSHClass::RefreshUsers(thread, old_hclass, new_hclass); } void JSHClass::RegisterOnProtoChain(const JSThread *thread, const JSHandle &jshclass) @@ -478,21 +478,21 @@ void JSHClass::NoticeThroughChain(const JSThread *thread, const JSHandle &oldHclass, - const JSHandle &newHclass) +void JSHClass::RefreshUsers(const JSThread *thread, const JSHandle &old_hclass, + const JSHandle &new_hclass) { - ASSERT(oldHclass->IsPrototype()); - ASSERT(newHclass->IsPrototype()); - bool onceRegistered = UnregisterOnProtoChain(thread, oldHclass); + ASSERT(old_hclass->IsPrototype()); + ASSERT(new_hclass->IsPrototype()); + bool onceRegistered = UnregisterOnProtoChain(thread, old_hclass); - newHclass->SetProtoChangeDetails(thread, oldHclass->GetProtoChangeDetails()); - oldHclass->SetProtoChangeDetails(thread, JSTaggedValue(0)); + new_hclass->SetProtoChangeDetails(thread, old_hclass->GetProtoChangeDetails()); + old_hclass->SetProtoChangeDetails(thread, JSTaggedValue(0)); if (onceRegistered) { - if (newHclass->GetProtoChangeDetails().IsProtoChangeDetails()) { - ProtoChangeDetails::Cast(newHclass->GetProtoChangeDetails().GetTaggedObject()) + if (new_hclass->GetProtoChangeDetails().IsProtoChangeDetails()) { + ProtoChangeDetails::Cast(new_hclass->GetProtoChangeDetails().GetTaggedObject()) ->SetRegisterIndex(thread, JSTaggedValue(ProtoChangeDetails::UNREGISTERED)); } - RegisterOnProtoChain(thread, newHclass); + RegisterOnProtoChain(thread, new_hclass); } } } // namespace panda::ecmascript diff --git a/runtime/js_hclass.h b/runtime/js_hclass.h index 5912f9bf1..66aba5172 100644 --- a/runtime/js_hclass.h +++ b/runtime/js_hclass.h @@ -247,10 +247,10 @@ public: inline bool HasReferenceField(); // size need to add inlined property numbers - void Initialize(const JSThread *thread, uint32_t size, JSType type, uint32_t inlinedProps, uint32_t flags = 0); + void Initialize(const JSThread *thread, uint32_t size, JSType type, uint32_t inlined_props, uint32_t flags = 0); static JSHandle Clone(const JSThread *thread, const JSHandle &jshclass, - bool withoutInlinedProperties = false); + bool without_inlined_properties = false); static JSHandle CloneWithoutInlinedProperties(const JSThread *thread, const JSHandle &jshclass); static void TransitionElementsToDictionary(const JSThread *thread, const JSHandle &obj); @@ -264,7 +264,8 @@ public: static JSHandle EnableProtoChangeMarker(const JSThread *thread, const JSHandle &jshclass); - static void NotifyHclassChanged(const JSThread *thread, JSHandle oldHclass, JSHandle newHclass); + static void NotifyHclassChanged(const JSThread *thread, JSHandle old_hclass, + JSHandle new_hclass); static void RegisterOnProtoChain(const JSThread *thread, const JSHandle &jshclass); @@ -276,14 +277,14 @@ public: static JSHandle GetProtoChangeDetails(const JSThread *thread, const JSHandle &obj); inline void UpdatePropertyMetaData(const JSThread *thread, const JSTaggedValue &key, - const PropertyAttributes &metaData); + const PropertyAttributes &meta_data); static void NoticeRegisteredUser(const JSThread *thread, const JSHandle &jshclass); static void NoticeThroughChain(const JSThread *thread, const JSHandle &jshclass); - static void RefreshUsers(const JSThread *thread, const JSHandle &oldHclass, - const JSHandle &newHclass); + static void RefreshUsers(const JSThread *thread, const JSHandle &old_hclass, + const JSHandle &new_hclass); inline void ClearBitField() { @@ -300,8 +301,8 @@ public: inline void SetObjectType(JSType type) { uint32_t bits = GetBitField(); - uint32_t newVal = ObjectTypeBits::Update(bits, type); - SetBitField(newVal); + uint32_t new_val = ObjectTypeBits::Update(bits, type); + SetBitField(new_val); } inline void SetConstructor(bool flag) const @@ -345,14 +346,14 @@ public: inline bool IsJSObject() const { - JSType jsType = GetObjectType(); - return (JSType::JS_OBJECT_BEGIN <= jsType && jsType <= JSType::JS_OBJECT_END); + JSType js_type = GetObjectType(); + return (JSType::JS_OBJECT_BEGIN <= js_type && js_type <= JSType::JS_OBJECT_END); } inline bool IsECMAObject() const { - JSType jsType = GetObjectType(); - return (JSType::ECMA_OBJECT_BEGIN <= jsType && jsType <= JSType::ECMA_OBJECT_END); + JSType js_type = GetObjectType(); + return (JSType::ECMA_OBJECT_BEGIN <= js_type && js_type <= JSType::ECMA_OBJECT_END); } inline bool IsRealm() const @@ -377,14 +378,14 @@ public: inline bool IsStringOrSymbol() const { - JSType jsType = GetObjectType(); - return (jsType == JSType::STRING) || (jsType == JSType::SYMBOL); + JSType js_type = GetObjectType(); + return (js_type == JSType::STRING) || (js_type == JSType::SYMBOL); } inline bool IsTaggedArray() const { - JSType jsType = GetObjectType(); - return (JSType::TAGGED_ARRAY_BEGIN <= jsType && jsType <= JSType::TAGGED_ARRAY_END); + JSType js_type = GetObjectType(); + return (JSType::TAGGED_ARRAY_BEGIN <= js_type && js_type <= JSType::TAGGED_ARRAY_END); } inline bool IsDictionary() const @@ -409,8 +410,8 @@ public: inline bool IsTypedArray() const { - JSType jsType = GetObjectType(); - return (JSType::JS_TYPED_ARRAY_BEGIN < jsType && jsType <= JSType::JS_TYPED_ARRAY_END); + JSType js_type = GetObjectType(); + return (JSType::JS_TYPED_ARRAY_BEGIN < js_type && js_type <= JSType::JS_TYPED_ARRAY_END); } inline bool IsJSTypedArray() const @@ -470,8 +471,8 @@ public: inline bool IsJSFunctionBase() const { - JSType jsType = GetObjectType(); - return jsType >= JSType::JS_FUNCTION_BASE && jsType <= JSType::JS_BOUND_FUNCTION; + JSType js_type = GetObjectType(); + return js_type >= JSType::JS_FUNCTION_BASE && js_type <= JSType::JS_BOUND_FUNCTION; } inline bool IsJsBoundFunction() const @@ -581,8 +582,8 @@ public: inline bool IsJSError() const { - JSType jsType = GetObjectType(); - return jsType >= JSType::JS_ERROR_BEGIN && jsType <= JSType::JS_ERROR_END; + JSType js_type = GetObjectType(); + return js_type >= JSType::JS_ERROR_BEGIN && js_type <= JSType::JS_ERROR_END; } inline bool IsArguments() const @@ -667,8 +668,8 @@ public: inline bool IsIterator() const { - JSType jsType = GetObjectType(); - return jsType >= JSType::JS_ITERATOR_BEGIN && jsType <= JSType::JS_ITERATOR_END; + JSType js_type = GetObjectType(); + return js_type >= JSType::JS_ITERATOR_BEGIN && js_type <= JSType::JS_ITERATOR_END; } inline bool IsForinIterator() const @@ -902,8 +903,8 @@ public: inline bool IsRecord() const { - JSType jsType = GetObjectType(); - return jsType >= JSType::JS_RECORD_BEGIN && jsType <= JSType::JS_RECORD_END; + JSType js_type = GetObjectType(); + return js_type >= JSType::JS_RECORD_BEGIN && js_type <= JSType::JS_RECORD_END; } inline bool IsTemplateMap() const @@ -929,8 +930,8 @@ public: inline void SetElementRepresentation(Representation representation) { uint32_t bits = GetBitField(); - uint32_t newVal = ElementRepresentationBits::Update(bits, representation); - SetBitField(newVal); + uint32_t new_val = ElementRepresentationBits::Update(bits, representation); + SetBitField(new_val); } inline Representation GetElementRepresentation() const @@ -947,8 +948,8 @@ public: inline void SetIsDictionaryElement(bool value) { - JSTaggedType newVal = DictionaryElementBits::Update(GetBitField(), value); - SetBitField(newVal); + JSTaggedType new_val = DictionaryElementBits::Update(GetBitField(), value); + SetBitField(new_val); } inline bool IsDictionaryElement() const { @@ -956,8 +957,8 @@ public: } inline void SetIsStableElements(bool value) { - JSTaggedType newVal = IsStableElementsBit::Update(GetBitField(), value); - SetBitField(newVal); + JSTaggedType new_val = IsStableElementsBit::Update(GetBitField(), value); + SetBitField(new_val); } inline bool IsStableElements() const { @@ -977,8 +978,8 @@ public: } inline void SetHasConstructor(bool value) { - TaggedType newVal = HasConstructorBits::Update(GetBitField(), value); - SetBitField(newVal); + TaggedType new_val = HasConstructorBits::Update(GetBitField(), value); + SetBitField(new_val); } inline bool HasConstructor() const { @@ -988,8 +989,8 @@ public: inline void SetNumberOfProps(uint32_t num) { uint32_t bits = GetBitField1(); - uint32_t newVal = NumberOfPropsBits::Update(bits, num); - SetBitField1(newVal); + uint32_t new_val = NumberOfPropsBits::Update(bits, num); + SetBitField1(new_val); } inline void IncNumberOfProps() @@ -1006,20 +1007,20 @@ public: inline int32_t GetNextInlinedPropsIndex() const { - uint32_t inlinedProperties = GetInlinedProperties(); - uint32_t numberOfProps = NumberOfProps(); - if (numberOfProps < inlinedProperties) { - return numberOfProps; + uint32_t inlined_properties = GetInlinedProperties(); + uint32_t number_of_props = NumberOfProps(); + if (number_of_props < inlined_properties) { + return number_of_props; } return -1; } inline int32_t GetNextNonInlinedPropsIndex() const { - uint32_t inlinedProperties = GetInlinedProperties(); - uint32_t numberOfProps = NumberOfProps(); - if (numberOfProps >= inlinedProperties) { - return numberOfProps - inlinedProperties; + uint32_t inlined_properties = GetInlinedProperties(); + uint32_t number_of_props = NumberOfProps(); + if (number_of_props >= inlined_properties) { + return number_of_props - inlined_properties; } return -1; } @@ -1040,8 +1041,8 @@ public: inline void SetInlinedPropsStart(uint32_t num) { uint32_t bits = GetBitField1(); - uint32_t newVal = InlinedPropsStartBits::Update(bits, num / JSTaggedValue::TaggedTypeSize()); - SetBitField1(newVal); + uint32_t new_val = InlinedPropsStartBits::Update(bits, num / JSTaggedValue::TaggedTypeSize()); + SetBitField1(new_val); } inline uint32_t GetInlinedPropsStartSize() const diff --git a/runtime/js_invoker.cpp b/runtime/js_invoker.cpp index 85f2975ed..06bfb3ef2 100644 --- a/runtime/js_invoker.cpp +++ b/runtime/js_invoker.cpp @@ -70,7 +70,7 @@ JSTaggedValue InvokeJsFunction(JSThread *thread, const JSHandle &fun argArray.emplace_back(newTgt.GetTaggedType()); argArray.emplace_back(obj.GetTaggedType()); - for (array_size_t i = 0; i < length; ++i) { + for (ArraySizeT i = 0; i < length; ++i) { // // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) argArray.emplace_back(arguments->GetArgv()[i]); } diff --git a/runtime/js_method.cpp b/runtime/js_method.cpp index 399d13321..c44ed2ee9 100644 --- a/runtime/js_method.cpp +++ b/runtime/js_method.cpp @@ -20,7 +20,7 @@ namespace panda::ecmascript { JSMethod::~JSMethod() { - mem::InternalAllocator<>::GetInternalAllocatorFromRuntime()->Free(icMapping_); + mem::InternalAllocator<>::GetInternalAllocatorFromRuntime()->Free(ic_mapping_); } // It's not allowed '#' token appear in ECMA function(method) name, which discriminates same names in panda methods. @@ -47,7 +47,7 @@ void JSMethod::SetCallTypeFromAnnotation() panda_file::AnnotationDataAccessor::Elem adae = ada.GetElement(i); auto *elem_name = reinterpret_cast(pandaFile->GetStringData(adae.GetNameId()).data); if (::strcmp("callType", elem_name) == 0) { - callType_ = adae.GetScalarValue().GetValue(); + call_type_ = adae.GetScalarValue().GetValue(); } } } diff --git a/runtime/js_method.h b/runtime/js_method.h index dead95f63..19811c1f1 100644 --- a/runtime/js_method.h +++ b/runtime/js_method.h @@ -43,18 +43,19 @@ public: return static_cast(method); } - explicit JSMethod(Class *klass, const panda_file::File *pf, panda_file::File::EntityId fileId, - panda_file::File::EntityId codeId, uint32_t accessFlags, uint32_t numArgs, const uint16_t *shorty) - : Method(klass, pf, fileId, codeId, accessFlags, numArgs, shorty) + explicit JSMethod(Class *klass, const panda_file::File *pf, panda_file::File::EntityId file_id, + panda_file::File::EntityId code_id, uint32_t access_flags, uint32_t num_args, + const uint16_t *shorty) + : Method(klass, pf, file_id, code_id, access_flags, num_args, shorty) { - bytecodeArray_ = JSMethod::GetInstructions(); - bytecodeArraySize_ = JSMethod::GetCodeSize(); + bytecode_array_ = JSMethod::GetInstructions(); + bytecode_array_size_ = JSMethod::GetCodeSize(); } explicit JSMethod(const Method *method) : Method(method) { - bytecodeArray_ = JSMethod::GetInstructions(); - bytecodeArraySize_ = JSMethod::GetCodeSize(); + bytecode_array_ = JSMethod::GetInstructions(); + bytecode_array_size_ = JSMethod::GetCodeSize(); } JSMethod() = delete; @@ -66,57 +67,57 @@ public: static constexpr uint32_t GetBytecodeArrayOffset() { - return MEMBER_OFFSET(JSMethod, bytecodeArray_); + return MEMBER_OFFSET(JSMethod, bytecode_array_); } const uint8_t *GetBytecodeArray() const { - return bytecodeArray_; + return bytecode_array_; } uint32_t GetBytecodeArraySize() const { - return bytecodeArraySize_; + return bytecode_array_size_; } void SetBytecodeArray(const uint8_t *bc) { - bytecodeArray_ = bc; + bytecode_array_ = bc; } uint32_t GetSlotSize() const { - return slotSize_; + return slot_size_; } void AddSlotSize(uint32_t size) { - slotSize_ += size; + slot_size_ += size; } ICMappingType GetICMapping() { - return icMapping_; + return ic_mapping_; } ConstICMappingType GetICMapping() const { - return icMapping_; + return ic_mapping_; } void SetICMapping(ICMappingType mapping) { - icMapping_ = mapping; + ic_mapping_ = mapping; } static constexpr size_t GetICMappingOffset() { - return MEMBER_OFFSET(JSMethod, icMapping_); + return MEMBER_OFFSET(JSMethod, ic_mapping_); } uint32_t GetCallType() const { - return callType_; + return call_type_; } PandaString ParseFunctionName() const; @@ -138,13 +139,13 @@ public: } private: - const uint8_t *bytecodeArray_ {nullptr}; + const uint8_t *bytecode_array_ {nullptr}; // NOLINTNEXTLINE(modernize-avoid-c-arrays) PandaUniquePtr profiling_data_; - uint32_t bytecodeArraySize_ {0}; - uint32_t slotSize_ {0}; - ICMappingType icMapping_ {nullptr}; - uint32_t callType_ {UINT32_MAX}; // UINT32_MAX means not found + uint32_t bytecode_array_size_ {0}; + uint32_t slot_size_ {0}; + ICMappingType ic_mapping_ {nullptr}; + uint32_t call_type_ {UINT32_MAX}; // UINT32_MAX means not found uint32_t profile_size_ {0}; }; } // namespace panda::ecmascript diff --git a/runtime/js_native_pointer.h b/runtime/js_native_pointer.h index 519ed980a..4f572d662 100644 --- a/runtime/js_native_pointer.h +++ b/runtime/js_native_pointer.h @@ -31,10 +31,10 @@ public: return reinterpret_cast(object); } - inline void ResetExternalPointer(void *externalPointer) + inline void ResetExternalPointer(void *external_pointer) { DeleteExternalPointer(); - SetExternalPointer(externalPointer); + SetExternalPointer(external_pointer); } inline void Destroy() @@ -53,11 +53,11 @@ public: private: inline void DeleteExternalPointer() { - void *externalPointer = GetExternalPointer(); - if (externalPointer != nullptr) { + void *external_pointer = GetExternalPointer(); + if (external_pointer != nullptr) { DeleteEntryPoint deleter = GetDeleter(); if (deleter != nullptr) { - deleter(externalPointer, GetData()); + deleter(external_pointer, GetData()); } } } diff --git a/runtime/js_object-inl.h b/runtime/js_object-inl.h index 7ab71cddd..88e283ea1 100644 --- a/runtime/js_object-inl.h +++ b/runtime/js_object-inl.h @@ -249,20 +249,20 @@ inline bool JSObject::ShouldTransToDict(uint32_t capacity, uint32_t index) return false; } -inline uint32_t JSObject::ComputeElementCapacity(uint32_t oldCapacity) +inline uint32_t JSObject::ComputeElementCapacity(uint32_t old_capacity) { - uint32_t newCapacity = oldCapacity + (oldCapacity >> 1U); - return newCapacity > MIN_ELEMENTS_LENGTH ? newCapacity : MIN_ELEMENTS_LENGTH; + uint32_t new_capacity = old_capacity + (old_capacity >> 1U); + return new_capacity > MIN_ELEMENTS_LENGTH ? new_capacity : MIN_ELEMENTS_LENGTH; } -inline uint32_t JSObject::ComputePropertyCapacity(uint32_t oldCapacity) +inline uint32_t JSObject::ComputePropertyCapacity(uint32_t old_capacity) { - uint32_t newCapacity = oldCapacity + PROPERTIES_GROW_SIZE; - return newCapacity > JSHClass::MAX_CAPACITY_OF_OUT_OBJECTS ? JSHClass::MAX_CAPACITY_OF_OUT_OBJECTS : newCapacity; + uint32_t new_capacity = old_capacity + PROPERTIES_GROW_SIZE; + return new_capacity > JSHClass::MAX_CAPACITY_OF_OUT_OBJECTS ? JSHClass::MAX_CAPACITY_OF_OUT_OBJECTS : new_capacity; } // static -template +template JSHandle JSObject::CreateListFromArrayLike(JSThread *thread, const JSHandle &obj) { // 3. If Type(obj) is not Object, throw a TypeError exception. @@ -271,9 +271,9 @@ JSHandle JSObject::CreateListFromArrayLike(JSThread *thread, cons JSHandle(thread, JSTaggedValue::Exception())); } // 4. Let len be ToLength(Get(obj, "length")). - JSHandle lengthKeyHandle = thread->GlobalConstants()->GetHandledLengthString(); + JSHandle length_key_handle = thread->GlobalConstants()->GetHandledLengthString(); - JSHandle value = GetProperty(thread, obj, lengthKeyHandle).GetValue(); + JSHandle value = GetProperty(thread, obj, length_key_handle).GetValue(); JSTaggedNumber number = JSTaggedValue::ToLength(thread, value); // 5. ReturnIfAbrupt(len). RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSTaggedValue, thread); @@ -299,7 +299,7 @@ JSHandle JSObject::CreateListFromArrayLike(JSThread *thread, cons RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSTaggedValue, thread); // NOLINTNEXTLINE(readability-braces-around-statements, bugprone-suspicious-semicolon) - if constexpr (types == ElementTypes::STRING_AND_SYMBOL) { + if constexpr (TYPES == ElementTypes::STRING_AND_SYMBOL) { if (!next.IsString() && !next.IsSymbol()) { THROW_TYPE_ERROR_AND_RETURN(thread, "CreateListFromArrayLike: not an element of elementTypes", JSHandle(thread, JSTaggedValue::Exception())); diff --git a/runtime/js_object.cpp b/runtime/js_object.cpp index 2cbb9f167..d85b55297 100644 --- a/runtime/js_object.cpp +++ b/runtime/js_object.cpp @@ -249,7 +249,7 @@ void JSObject::DeletePropertyInternal(JSThread *thread, const JSHandle } void JSObject::GetAllKeys(const JSThread *thread, const JSHandle &obj, int offset, - const JSHandle &keyArray) + const JSHandle &key_array) { TaggedArray *array = TaggedArray::Cast(obj->GetProperties().GetTaggedObject()); @@ -257,75 +257,75 @@ void JSObject::GetAllKeys(const JSThread *thread, const JSHandle &obj, int end = obj->GetJSHClass()->NumberOfProps(); if (end > 0) { LayoutInfo::Cast(obj->GetJSHClass()->GetLayout().GetTaggedObject()) - ->GetAllKeys(thread, end, offset, *keyArray); + ->GetAllKeys(thread, end, offset, *key_array); } return; } if (obj->IsJSGlobalObject()) { GlobalDictionary *dict = GlobalDictionary::Cast(array); - return dict->GetAllKeys(thread, offset, *keyArray); + return dict->GetAllKeys(thread, offset, *key_array); } NameDictionary *dict = NameDictionary::Cast(obj->GetProperties().GetTaggedObject()); - dict->GetAllKeys(thread, offset, *keyArray); + dict->GetAllKeys(thread, offset, *key_array); } // For Serialization use. Does not support JSGlobalObject -void JSObject::GetAllKeys(const JSThread *thread, const JSHandle &obj, std::vector &keyVector) +void JSObject::GetAllKeys(const JSThread *thread, const JSHandle &obj, std::vector &key_vector) { ASSERT_PRINT(!obj->IsJSGlobalObject(), "Do not support get key of JSGlobal Object"); TaggedArray *array = TaggedArray::Cast(obj->GetProperties().GetTaggedObject()); if (!array->IsDictionaryMode()) { int end = obj->GetJSHClass()->NumberOfProps(); if (end > 0) { - LayoutInfo::Cast(obj->GetJSHClass()->GetLayout().GetTaggedObject())->GetAllKeys(thread, end, keyVector); + LayoutInfo::Cast(obj->GetJSHClass()->GetLayout().GetTaggedObject())->GetAllKeys(thread, end, key_vector); } } else { NameDictionary *dict = NameDictionary::Cast(obj->GetProperties().GetTaggedObject()); - dict->GetAllKeysIntoVector(thread, keyVector); + dict->GetAllKeysIntoVector(thread, key_vector); } } JSHandle JSObject::GetAllEnumKeys(const JSThread *thread, const JSHandle &obj, int offset, - uint32_t numOfKeys, uint32_t *keys) + uint32_t num_of_keys, uint32_t *keys) { ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); if (obj->IsJSGlobalObject()) { - JSHandle keyArray = factory->NewTaggedArray(numOfKeys); + JSHandle key_array = factory->NewTaggedArray(num_of_keys); GlobalDictionary *dict = GlobalDictionary::Cast(obj->GetProperties().GetTaggedObject()); - dict->GetEnumAllKeys(thread, offset, *keyArray, keys); - return keyArray; + dict->GetEnumAllKeys(thread, offset, *key_array, keys); + return key_array; } TaggedArray *array = TaggedArray::Cast(obj->GetProperties().GetTaggedObject()); if (!array->IsDictionaryMode()) { JSTaggedValue enumCache = obj->GetJSHClass()->GetEnumCache(); if (!enumCache.IsNull()) { - auto keyArray = JSHandle(thread, enumCache); - *keys = keyArray->GetLength(); - return keyArray; + auto key_array = JSHandle(thread, enumCache); + *keys = key_array->GetLength(); + return key_array; } - JSHandle keyArray = factory->NewTaggedArray(numOfKeys); + JSHandle key_array = factory->NewTaggedArray(num_of_keys); int end = obj->GetJSHClass()->NumberOfProps(); if (end > 0) { LayoutInfo::Cast(obj->GetJSHClass()->GetLayout().GetTaggedObject()) - ->GetAllEnumKeys(thread, end, offset, *keyArray, keys); - if (*keys == keyArray->GetLength()) { - obj->GetJSHClass()->SetEnumCache(thread, keyArray.GetTaggedValue()); + ->GetAllEnumKeys(thread, end, offset, *key_array, keys); + if (*keys == key_array->GetLength()) { + obj->GetJSHClass()->SetEnumCache(thread, key_array.GetTaggedValue()); } } - return keyArray; + return key_array; } - JSHandle keyArray = factory->NewTaggedArray(numOfKeys); + JSHandle key_array = factory->NewTaggedArray(num_of_keys); NameDictionary *dict = NameDictionary::Cast(obj->GetProperties().GetTaggedObject()); - dict->GetAllEnumKeys(thread, offset, *keyArray, keys); - return keyArray; + dict->GetAllEnumKeys(thread, offset, *key_array, keys); + return key_array; } void JSObject::GetAllElementKeys(JSThread *thread, const JSHandle &obj, int offset, - const JSHandle &keyArray) + const JSHandle &key_array) { uint32_t elementIndex = 0; @@ -333,7 +333,7 @@ void JSObject::GetAllElementKeys(JSThread *thread, const JSHandle &obj elementIndex = JSPrimitiveRef::Cast(*obj)->GetStringLength() + offset; for (uint32_t i = offset; i < elementIndex; ++i) { auto key = base::NumberHelper::NumberToString(thread, JSTaggedValue(i)); - keyArray->Set(thread, i, key); + key_array->Set(thread, i, key); } } @@ -343,36 +343,36 @@ void JSObject::GetAllElementKeys(JSThread *thread, const JSHandle &obj for (uint32_t i = 0, j = elementIndex; i < elementsLen; ++i) { if (!elements->Get(i).IsHole()) { auto key = base::NumberHelper::NumberToString(thread, JSTaggedValue(i)); - keyArray->Set(thread, j++, key); + key_array->Set(thread, j++, key); } } } else { - NumberDictionary::GetAllKeys(thread, JSHandle(elements), elementIndex, keyArray); + NumberDictionary::GetAllKeys(thread, JSHandle(elements), elementIndex, key_array); } } void JSObject::GetALLElementKeysIntoVector(const JSThread *thread, const JSHandle &obj, - std::vector &keyVector) + std::vector &key_vector) { JSHandle elements(thread, obj->GetElements()); if (!elements->IsDictionaryMode()) { uint32_t elementsLen = elements->GetLength(); for (uint32_t i = 0; i < elementsLen; ++i) { if (!elements->Get(i).IsHole()) { - keyVector.emplace_back(JSTaggedValue(i)); + key_vector.emplace_back(JSTaggedValue(i)); } } } else { JSHandle dict = JSHandle::Cast(elements); - dict->GetAllKeysIntoVector(thread, keyVector); + dict->GetAllKeysIntoVector(thread, key_vector); } } JSHandle JSObject::GetEnumElementKeys(JSThread *thread, const JSHandle &obj, int offset, - uint32_t numOfElements, uint32_t *keys) + uint32_t num_of_elements, uint32_t *keys) { ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - JSHandle elementArray = factory->NewTaggedArray(numOfElements); + JSHandle elementArray = factory->NewTaggedArray(num_of_elements); uint32_t elementIndex = 0; JSMutableHandle keyHandle(thread, JSTaggedValue::Undefined()); @@ -417,7 +417,7 @@ uint32_t JSObject::GetNumberOfKeys() } bool JSObject::GlobalSetProperty(JSThread *thread, const JSHandle &key, - const JSHandle &value, bool mayThrow) + const JSHandle &value, bool may_throw) { ASSERT_PRINT(JSTaggedValue::IsPropertyKey(key), "Key is not a property key"); @@ -426,14 +426,14 @@ bool JSObject::GlobalSetProperty(JSThread *thread, const JSHandle PropertyAttributes attr = PropertyAttributes::Default(true, true, false); op.SetAttr(attr); } - return SetProperty(&op, value, mayThrow); + return SetProperty(&op, value, may_throw); } uint32_t JSObject::GetNumberOfElements() { - uint32_t numOfElements = 0; + uint32_t num_of_elements = 0; if (IsJSPrimitiveRef() && JSPrimitiveRef::Cast(this)->IsString()) { - numOfElements = JSPrimitiveRef::Cast(this)->GetStringLength(); + num_of_elements = JSPrimitiveRef::Cast(this)->GetStringLength(); } TaggedArray *elements = TaggedArray::Cast(GetElements().GetTaggedObject()); @@ -441,59 +441,60 @@ uint32_t JSObject::GetNumberOfElements() uint32_t elementsLen = elements->GetLength(); for (uint32_t i = 0; i < elementsLen; ++i) { if (!elements->Get(i).IsHole()) { - numOfElements++; + num_of_elements++; } } } else { - numOfElements += NumberDictionary::Cast(elements)->EntriesCount(); + num_of_elements += NumberDictionary::Cast(elements)->EntriesCount(); } - return numOfElements; + return num_of_elements; } // 9.1.9 [[Set]] ( P, V, Receiver) bool JSObject::SetProperty(JSThread *thread, const JSHandle &obj, const JSHandle &key, - const JSHandle &value, const JSHandle &receiver, bool mayThrow) + const JSHandle &value, const JSHandle &receiver, + bool may_throw) { ASSERT_PRINT(!(obj->IsUndefined() || obj->IsNull() || obj->IsHole()), "Obj is not a valid object"); ASSERT_PRINT(JSTaggedValue::IsPropertyKey(key), "Key is not a property key"); // 2 ~ 4 findProperty in Receiver, Obj and its parents ObjectOperator op(thread, obj, receiver, key); - return SetProperty(&op, value, mayThrow); + return SetProperty(&op, value, may_throw); } bool JSObject::SetProperty(JSThread *thread, const JSHandle &obj, const JSHandle &key, - const JSHandle &value, bool mayThrow) + const JSHandle &value, bool may_throw) { ASSERT_PRINT(obj->IsECMAObject(), "Obj is not a valid JSObject"); ASSERT_PRINT(JSTaggedValue::IsPropertyKey(key), "Key is not a property key"); ObjectOperator op(thread, obj, key); - return SetProperty(&op, value, mayThrow); + return SetProperty(&op, value, may_throw); } bool JSObject::SetProperty(JSThread *thread, const JSHandle &obj, const JSHandle &key, - const JSHandle &value, bool mayThrow) + const JSHandle &value, bool may_throw) { ASSERT_PRINT(!(obj->IsUndefined() || obj->IsNull() || obj->IsHole()), "Obj is not a valid object"); ASSERT_PRINT(JSTaggedValue::IsPropertyKey(key), "Key is not a property key"); // 2 ~ 4 findProperty in Receiver, Obj and its parents ObjectOperator op(thread, obj, key); - return SetProperty(&op, value, mayThrow); + return SetProperty(&op, value, may_throw); } bool JSObject::SetProperty(JSThread *thread, const JSHandle &obj, uint32_t index, - const JSHandle &value, bool mayThrow) + const JSHandle &value, bool may_throw) { ASSERT_PRINT(!(obj->IsUndefined() || obj->IsNull() || obj->IsHole()), "Obj is not a valid object"); ObjectOperator op(thread, obj, index); - return SetProperty(&op, value, mayThrow); + return SetProperty(&op, value, may_throw); } -bool JSObject::SetProperty(ObjectOperator *op, const JSHandle &value, bool mayThrow) +bool JSObject::SetProperty(ObjectOperator *op, const JSHandle &value, bool may_throw) { JSThread *thread = op->GetThread(); @@ -502,9 +503,9 @@ bool JSObject::SetProperty(ObjectOperator *op, const JSHandle &va if (holder->IsJSProxy()) { if (op->IsElement()) { JSHandle key(thread, JSTaggedValue(op->GetElementIndex())); - return JSProxy::SetProperty(thread, JSHandle::Cast(holder), key, value, receiver, mayThrow); + return JSProxy::SetProperty(thread, JSHandle::Cast(holder), key, value, receiver, may_throw); } - return JSProxy::SetProperty(thread, JSHandle::Cast(holder), op->GetKey(), value, receiver, mayThrow); + return JSProxy::SetProperty(thread, JSHandle::Cast(holder), op->GetKey(), value, receiver, may_throw); } // When op is not found and is not set extra attributes @@ -521,14 +522,14 @@ bool JSObject::SetProperty(ObjectOperator *op, const JSHandle &va if (!op->IsAccessorDescriptor() || isInternalAccessor) { bool isSuccess = true; if (!op->IsWritable()) { - if (mayThrow) { + if (may_throw) { THROW_TYPE_ERROR_AND_RETURN(thread, "Cannot assign to read only property", false); } return false; } if (!receiver->IsECMAObject()) { - if (mayThrow) { + if (may_throw) { THROW_TYPE_ERROR_AND_RETURN(thread, "Receiver is not a JSObject", false); } return false; @@ -560,7 +561,7 @@ bool JSObject::SetProperty(ObjectOperator *op, const JSHandle &va isSuccess = CreateDataProperty(thread, JSHandle(receiver), key, value); - if (!isSuccess && mayThrow) { + if (!isSuccess && may_throw) { THROW_TYPE_ERROR_AND_RETURN(thread, "", false); } return isSuccess; @@ -581,17 +582,17 @@ bool JSObject::SetProperty(ObjectOperator *op, const JSHandle &va // ii. If existingDescriptor.[[Writable]] is false, return false. if (!op->IsWritable()) { - if (mayThrow) { + if (may_throw) { THROW_TYPE_ERROR_AND_RETURN(thread, "Cannot assign to read only property", false); } return false; } - isSuccess = op->UpdateDataValue(JSHandle(receiver), value, isInternalAccessor, mayThrow); + isSuccess = op->UpdateDataValue(JSHandle(receiver), value, isInternalAccessor, may_throw); RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, isSuccess); } else { // 5f. Else if Receiver does not currently have a property P, Return CreateDataProperty(Receiver, P, V). if (!receiver->IsExtensible(thread)) { - if (mayThrow) { + if (may_throw) { THROW_TYPE_ERROR_AND_RETURN(thread, "receiver is not Extensible", false); } return false; @@ -609,19 +610,19 @@ bool JSObject::SetProperty(ObjectOperator *op, const JSHandle &va ASSERT(op->IsAccessorDescriptor()); // 8. If setter is undefined, return false. AccessorData *accessor = AccessorData::Cast(op->GetValue().GetTaggedObject()); - return CallSetter(thread, *accessor, receiver, value, mayThrow); + return CallSetter(thread, *accessor, receiver, value, may_throw); } bool JSObject::CallSetter(JSThread *thread, const AccessorData &accessor, const JSHandle &receiver, - const JSHandle &value, bool mayThrow) + const JSHandle &value, bool may_throw) { if (UNLIKELY(accessor.IsInternal())) { - return accessor.CallInternalSet(thread, JSHandle::Cast(receiver), value, mayThrow); + return accessor.CallInternalSet(thread, JSHandle::Cast(receiver), value, may_throw); } JSTaggedValue setter = accessor.GetSetter(); // 8. If setter is undefined, return false. if (setter.IsUndefined()) { - if (mayThrow) { + if (may_throw) { THROW_TYPE_ERROR_AND_RETURN(thread, "Cannot set property when setter is undefined", false); } return false; @@ -1071,16 +1072,16 @@ bool JSObject::PreventExtensions(JSThread *thread, const JSHandle &obj JSHandle JSObject::GetOwnPropertyKeys(JSThread *thread, const JSHandle &obj) { [[maybe_unused]] uint32_t elementIndex = 0; - uint32_t numOfElements = obj->GetNumberOfElements(); - uint32_t keyLen = numOfElements + obj->GetNumberOfKeys(); + uint32_t num_of_elements = obj->GetNumberOfElements(); + uint32_t keyLen = num_of_elements + obj->GetNumberOfKeys(); - JSHandle keyArray = thread->GetEcmaVM()->GetFactory()->NewTaggedArray(keyLen); + JSHandle key_array = thread->GetEcmaVM()->GetFactory()->NewTaggedArray(keyLen); - if (numOfElements > 0) { - GetAllElementKeys(thread, obj, 0, keyArray); + if (num_of_elements > 0) { + GetAllElementKeys(thread, obj, 0, key_array); } - GetAllKeys(thread, obj, static_cast(numOfElements), keyArray); - return keyArray; + GetAllKeys(thread, obj, static_cast(num_of_elements), key_array); + return key_array; } JSHandle JSObject::ObjectCreate(JSThread *thread, const JSHandle &proto) @@ -1284,23 +1285,23 @@ JSHandle JSObject::EnumerableOwnNames(JSThread *thread, const JSHan uint32_t copyLength = 0; // fast mode if (tagObj->IsJSObject() && !tagObj->IsTypedArray()) { - uint32_t numOfKeys = obj->GetNumberOfKeys(); - uint32_t numOfElements = obj->GetNumberOfElements(); + uint32_t num_of_keys = obj->GetNumberOfKeys(); + uint32_t num_of_elements = obj->GetNumberOfElements(); JSHandle elementArray; - if (numOfElements > 0) { - elementArray = JSObject::GetEnumElementKeys(thread, obj, 0, numOfElements, ©Length); + if (num_of_elements > 0) { + elementArray = JSObject::GetEnumElementKeys(thread, obj, 0, num_of_elements, ©Length); } - JSHandle keyArray; - if (numOfKeys > 0) { - keyArray = JSObject::GetAllEnumKeys(thread, obj, 0, numOfKeys, ©Length); + JSHandle key_array; + if (num_of_keys > 0) { + key_array = JSObject::GetAllEnumKeys(thread, obj, 0, num_of_keys, ©Length); } - if (numOfKeys != 0 && numOfElements != 0) { - keys = TaggedArray::AppendSkipHole(thread, elementArray, keyArray, copyLength); - } else if (numOfKeys != 0) { - keys = factory->CopyArray(keyArray, copyLength, copyLength); - } else if (numOfElements != 0) { + if (num_of_keys != 0 && num_of_elements != 0) { + keys = TaggedArray::AppendSkipHole(thread, elementArray, key_array, copyLength); + } else if (num_of_keys != 0) { + keys = factory->CopyArray(key_array, copyLength, copyLength); + } else if (num_of_elements != 0) { keys = factory->CopyArray(elementArray, copyLength, copyLength); } else { keys = factory->EmptyArray(); @@ -1332,7 +1333,7 @@ JSHandle JSObject::EnumerableOwnNames(JSThread *thread, const JSHan } JSHandle JSObject::EnumerableOwnPropertyNames(JSThread *thread, const JSHandle &obj, - PropertyKind kind, array_size_t *length_out) + PropertyKind kind, ArraySizeT *length_out) { // 1. Assert: Type(O) is Object. ASSERT_PRINT(obj->IsECMAObject(), "obj is not object"); @@ -1675,7 +1676,7 @@ void JSObject::ToPropertyDescriptor(JSThread *thread, const JSHandle JSObject::SpeciesConstructor(JSThread *thread, const JSHandle &obj, - const JSHandle &defaultConstructort) + const JSHandle &default_constructort) { JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); const GlobalEnvConstants *globalConst = thread->GlobalConstants(); @@ -1689,7 +1690,7 @@ JSHandle JSObject::SpeciesConstructor(JSThread *thread, const JSH RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSTaggedValue, thread); // If C is undefined, return defaultConstructor. if (objConstructor->IsUndefined()) { - return defaultConstructort; + return default_constructort; } // If Type(C) is not Object, throw a TypeError exception. if (!objConstructor->IsECMAObject()) { @@ -1703,7 +1704,7 @@ JSHandle JSObject::SpeciesConstructor(JSThread *thread, const JSH RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSTaggedValue, thread); // If S is either undefined or null, return defaultConstructor. if (speciesConstructor->IsUndefined() || speciesConstructor->IsNull()) { - return defaultConstructort; + return default_constructort; } // If IsConstructor(S) is true, return S. if (speciesConstructor->IsConstructor()) { @@ -1766,12 +1767,12 @@ JSHandle JSObject::EnumerateObjectProperties(JSThread *thread, void JSObject::DefinePropertyByLiteral(JSThread *thread, const JSHandle &obj, const JSHandle &key, const JSHandle &value, - bool useForClass) + bool use_for_class) { ASSERT_PRINT(obj->IsECMAObject(), "Obj is not a valid object"); ASSERT_PRINT(JSTaggedValue::IsPropertyKey(key), "Key is not a property key"); PropertyAttributes attr = - useForClass ? PropertyAttributes::Default(true, false, true) : PropertyAttributes::Default(); + use_for_class ? PropertyAttributes::Default(true, false, true) : PropertyAttributes::Default(); if (value->IsAccessorData()) { attr.SetIsAccessor(true); @@ -1917,7 +1918,8 @@ void *ECMAObject::GetNativePointerField(int32_t index) const return nullptr; } -void ECMAObject::SetNativePointerField(int32_t index, void *nativePointer, const DeleteEntryPoint &callBack, void *data) +void ECMAObject::SetNativePointerField(int32_t index, void *native_pointer, const DeleteEntryPoint &call_back, + void *data) { auto hashField = Barriers::GetDynValue(this, HASH_OFFSET); JSTaggedValue value(hashField); @@ -1934,15 +1936,15 @@ void ECMAObject::SetNativePointerField(int32_t index, void *nativePointer, const EcmaVM *vm = thread->GetEcmaVM(); JSHandle current = JSHandle(thread, array->Get(thread, index + 1)); - if (!current->IsHole() && nativePointer == nullptr) { + if (!current->IsHole() && native_pointer == nullptr) { // Try to remove native pointer if exists. vm->RemoveArrayDataList(*JSHandle(current)); array->Set(thread, index + 1, JSTaggedValue::Hole()); return; } - JSHandle pointer = vm->GetFactory()->NewJSNativePointer(nativePointer, callBack, data); - if (callBack != nullptr) { + JSHandle pointer = vm->GetFactory()->NewJSNativePointer(native_pointer, call_back, data); + if (call_back != nullptr) { vm->PushToArrayDataList(*pointer); } array->Set(thread, index + 1, pointer.GetTaggedValue()); diff --git a/runtime/js_object.h b/runtime/js_object.h index 40b610f73..094eb29d3 100644 --- a/runtime/js_object.h +++ b/runtime/js_object.h @@ -71,9 +71,9 @@ public: writable_(w), enumerable_(e), configurable_(c), - hasWritable_(true), - hasEnumerable_(true), - hasConfigurable_(true), + has_writable_(true), + has_enumerable_(true), + has_configurable_(true), value_(v) { } @@ -104,7 +104,7 @@ public: inline void SetWritable(bool flag) { writable_ = flag; - hasWritable_ = true; + has_writable_ = true; } inline bool IsEnumerable() const @@ -115,7 +115,7 @@ public: inline void SetEnumerable(bool flag) { enumerable_ = flag; - hasEnumerable_ = true; + has_enumerable_ = true; } inline bool IsConfigurable() const @@ -126,7 +126,7 @@ public: inline void SetConfigurable(bool flag) { configurable_ = flag; - hasConfigurable_ = true; + has_configurable_ = true; } inline bool HasValue() const @@ -136,17 +136,17 @@ public: inline bool HasWritable() const { - return hasWritable_; + return has_writable_; } inline bool HasConfigurable() const { - return hasConfigurable_; + return has_configurable_; } inline bool HasEnumerable() const { - return hasEnumerable_; + return has_enumerable_; } inline bool HasGetter() const @@ -195,7 +195,7 @@ public: inline bool IsDataDescriptor() const { // 2. If both Desc.[[Value]] and Desc.[[Writable]] are absent, return false. - return !(value_.IsEmpty() && !hasWritable_); + return !(value_.IsEmpty() && !has_writable_); } inline bool IsGenericDescriptor() const @@ -206,7 +206,7 @@ public: inline bool IsEmpty() const { - return !hasWritable_ && !hasEnumerable_ && !hasConfigurable_ && !HasValue() && !HasGetter() && !HasSetter(); + return !has_writable_ && !has_enumerable_ && !has_configurable_ && !HasValue() && !HasGetter() && !HasSetter(); } static void CompletePropertyDescriptor(const JSThread *thread, PropertyDescriptor &desc); @@ -217,9 +217,9 @@ private: bool writable_ {false}; bool enumerable_ {false}; bool configurable_ {false}; - bool hasWritable_ {false}; - bool hasEnumerable_ {false}; - bool hasConfigurable_ {false}; + bool has_writable_ {false}; + bool has_enumerable_ {false}; + bool has_configurable_ {false}; JSHandle value_ {}; JSHandle getter_ {}; @@ -235,65 +235,65 @@ public: using RepresentationField = IsInlinedPropsField::NextField; using OffsetField = RepresentationField::NextField; - explicit PropertyMetaData(uint32_t metaData) : metaData_(metaData) {} + explicit PropertyMetaData(uint32_t meta_data) : meta_data_(meta_data) {} ~PropertyMetaData() = default; DEFAULT_NOEXCEPT_MOVE_SEMANTIC(PropertyMetaData); DEFAULT_COPY_SEMANTIC(PropertyMetaData); - explicit PropertyMetaData(bool isFound) + explicit PropertyMetaData(bool is_found) { - SetFound(isFound); + SetFound(is_found); } inline bool IsFound() const { - return IsFoundField::Get(metaData_); + return IsFoundField::Get(meta_data_); } inline void SetFound(bool flag) { - IsFoundField::Set(flag, &metaData_); + IsFoundField::Set(flag, &meta_data_); } inline bool GetIsInlinedProps() const { - return IsInlinedPropsField::Get(metaData_); + return IsInlinedPropsField::Get(meta_data_); } inline void SetIsInlinedProps(bool flag) { - IsInlinedPropsField::Set(flag, &metaData_); + IsInlinedPropsField::Set(flag, &meta_data_); } inline Representation GetRepresentation() const { - return RepresentationField::Get(metaData_); + return RepresentationField::Get(meta_data_); } inline void SetRepresentation(Representation representation) { - RepresentationField::Set(representation, &metaData_); + RepresentationField::Set(representation, &meta_data_); } inline void SetOffset(uint32_t offset) { - OffsetField::Set(offset, &metaData_); + OffsetField::Set(offset, &meta_data_); } inline uint32_t GetOffset() const { - return OffsetField::Get(metaData_); + return OffsetField::Get(meta_data_); } private: - uint32_t metaData_ {0}; + uint32_t meta_data_ {0}; }; class OperationResult { public: - explicit OperationResult(const JSThread *thread, JSTaggedValue value, PropertyMetaData metaData) - : metaData_(metaData) + explicit OperationResult(const JSThread *thread, JSTaggedValue value, PropertyMetaData meta_data) + : meta_data_(meta_data) { thread_ = thread; value_ = JSHandle(thread_, value); @@ -319,13 +319,13 @@ public: const PropertyMetaData &GetPropertyMetaData() const { - return metaData_; + return meta_data_; } private: const JSThread *thread_ {nullptr}; JSHandle value_ {}; - PropertyMetaData metaData_ {0U}; + PropertyMetaData meta_data_ {0U}; }; class ECMAObject : public TaggedObject { @@ -350,7 +350,7 @@ public: } void *GetNativePointerField(int32_t index) const; - void SetNativePointerField(int32_t index, void *nativePointer, const DeleteEntryPoint &callBack, void *data); + void SetNativePointerField(int32_t index, void *native_pointer, const DeleteEntryPoint &call_back, void *data); int32_t GetNativePointerFieldCount() const; void SetNativePointerFieldCount(int32_t count); @@ -407,7 +407,7 @@ public: // 7.3.23 EnumerableOwnPropertyNames ( O, kind ) static JSHandle EnumerableOwnPropertyNames(JSThread *thread, const JSHandle &obj, - PropertyKind kind, array_size_t *length_out); + PropertyKind kind, ArraySizeT *length_out); static JSHandle GetFunctionRealm(JSThread *thread, const JSHandle &object); @@ -416,9 +416,9 @@ public: static bool TestIntegrityLevel(JSThread *thread, const JSHandle &obj, IntegrityLevel level); static JSHandle SpeciesConstructor(JSThread *thread, const JSHandle &obj, - const JSHandle &defaultConstructort); + const JSHandle &default_constructort); // 7.3.17 - template + template static JSHandle CreateListFromArrayLike(JSThread *thread, const JSHandle &obj); // emca6 9.1 @@ -476,20 +476,20 @@ public: static OperationResult GetPropertyFromGlobal(JSThread *thread, const JSHandle &key); static bool SetProperty(JSThread *thread, const JSHandle &obj, const JSHandle &key, - const JSHandle &value, bool mayThrow = false); + const JSHandle &value, bool may_throw = false); static bool SetProperty(JSThread *thread, const JSHandle &obj, const JSHandle &key, - const JSHandle &value, bool mayThrow = false); + const JSHandle &value, bool may_throw = false); static bool SetProperty(JSThread *thread, const JSHandle &obj, const JSHandle &key, const JSHandle &value, const JSHandle &receiver, - bool mayThrow = false); + bool may_throw = false); static bool SetProperty(JSThread *thread, const JSHandle &obj, uint32_t index, - const JSHandle &value, bool mayThrow = false); + const JSHandle &value, bool may_throw = false); static bool GlobalSetProperty(JSThread *thread, const JSHandle &key, - const JSHandle &value, bool mayThrow); + const JSHandle &value, bool may_throw); // [[HasProperty]] static bool HasProperty(JSThread *thread, const JSHandle &obj, const JSHandle &key); @@ -517,7 +517,7 @@ public: static JSTaggedValue CallGetter(JSThread *thread, const AccessorData *accessor, const JSHandle &receiver); static bool CallSetter(JSThread *thread, const AccessorData &accessor, const JSHandle &receiver, - const JSHandle &value, bool mayThrow = false); + const JSHandle &value, bool may_throw = false); void FillElementsWithHoles(const JSThread *thread, uint32_t start, uint32_t end); @@ -552,7 +552,7 @@ public: static void DefinePropertyByLiteral(JSThread *thread, const JSHandle &obj, const JSHandle &key, const JSHandle &value, - bool useForClass = false); + bool use_for_class = false); static void DefineSetter(JSThread *thread, const JSHandle &obj, const JSHandle &key, const JSHandle &value); static void DefineGetter(JSThread *thread, const JSHandle &obj, const JSHandle &key, @@ -560,20 +560,20 @@ public: static JSHandle CreateObjectFromProperties(const JSThread *thread, const JSHandle &properties); static void GetAllKeys(const JSThread *thread, const JSHandle &obj, int offset, - const JSHandle &keyArray); + const JSHandle &key_array); static void GetAllKeys(const JSThread *thread, const JSHandle &obj, - std::vector &keyVector); + std::vector &key_vector); static void GetAllElementKeys(JSThread *thread, const JSHandle &obj, int offset, - const JSHandle &keyArray); + const JSHandle &key_array); static void GetALLElementKeysIntoVector(const JSThread *thread, const JSHandle &obj, - std::vector &keyVector); + std::vector &key_vector); uint32_t GetNumberOfKeys(); uint32_t GetNumberOfElements(); static JSHandle GetEnumElementKeys(JSThread *thread, const JSHandle &obj, int offset, - uint32_t numOfElements, uint32_t *keys); + uint32_t num_of_elements, uint32_t *keys); static JSHandle GetAllEnumKeys(const JSThread *thread, const JSHandle &obj, int offset, - uint32_t numOfKeys, uint32_t *keys); + uint32_t num_of_keys, uint32_t *keys); static void AddAccessor(JSThread *thread, const JSHandle &obj, const JSHandle &key, const JSHandle &value, PropertyAttributes attr); @@ -621,13 +621,13 @@ private: PropertyAttributes attr = PropertyAttributes(PropertyAttributes::GetDefaultAttributes())); static JSTaggedValue GetProperty(JSThread *thread, ObjectOperator *op); - static bool SetProperty(ObjectOperator *op, const JSHandle &value, bool mayThrow); + static bool SetProperty(ObjectOperator *op, const JSHandle &value, bool may_throw); static void DeletePropertyInternal(JSThread *thread, const JSHandle &obj, const JSHandle &key, uint32_t index); int FindProperty(const JSHandle &key); - static uint32_t ComputeElementCapacity(uint32_t oldCapacity); - static uint32_t ComputePropertyCapacity(uint32_t oldCapacity); + static uint32_t ComputeElementCapacity(uint32_t old_capacity); + static uint32_t ComputePropertyCapacity(uint32_t old_capacity); }; } // namespace panda::ecmascript diff --git a/runtime/js_proxy.cpp b/runtime/js_proxy.cpp index 7d60ce1f9..f70d83b25 100644 --- a/runtime/js_proxy.cpp +++ b/runtime/js_proxy.cpp @@ -581,7 +581,7 @@ OperationResult JSProxy::GetProperty(JSThread *thread, const JSHandle & // ES6 9.5.9 [[Set]] ( P, V, Receiver) bool JSProxy::SetProperty(JSThread *thread, const JSHandle &proxy, const JSHandle &key, - const JSHandle &value, const JSHandle &receiver, bool mayThrow) + const JSHandle &value, const JSHandle &receiver, bool may_throw) { // step 1 ~ 10 are almost same as GetOwnProperty ASSERT(JSTaggedValue::IsPropertyKey(key)); @@ -597,7 +597,7 @@ bool JSProxy::SetProperty(JSThread *thread, const JSHandle &proxy, cons // 7. ReturnIfAbrupt(trap). RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, false); if (trap->IsUndefined()) { - return JSTaggedValue::SetProperty(thread, targetHandle, propKey, value, receiver, mayThrow); + return JSTaggedValue::SetProperty(thread, targetHandle, propKey, value, receiver, may_throw); } // 9. Let booleanTrapResult be ToBoolean(Call(trap, handler, «target, P, V, Receiver»)) @@ -835,7 +835,7 @@ JSHandle JSProxy::OwnPropertyKeys(JSThread *thread, const JSHandle< // ES6 9.5.13 [[Call]] (thisArgument, argumentsList) JSTaggedValue JSProxy::CallInternal(JSThread *thread, const JSHandle &proxy, - const JSHandle &thisArg, uint32_t argc, + const JSHandle &this_arg, uint32_t argc, const JSTaggedType argv[] // NOLINT(modernize-avoid-c-arrays) ) { @@ -856,7 +856,7 @@ JSTaggedValue JSProxy::CallInternal(JSThread *thread, const JSHandle &p // 7.If trap is undefined, then // a.Return Call(target, thisArgument, argumentsList). if (method->IsUndefined()) { - return JSFunction::Call(thread, target, thisArg, argc, argv); + return JSFunction::Call(thread, target, this_arg, argc, argv); } // 8.Let argArray be CreateArrayFromList(argumentsList). ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); @@ -869,14 +869,14 @@ JSTaggedValue JSProxy::CallInternal(JSThread *thread, const JSHandle &p // 9.Return Call(trap, handler, «target, thisArgument, argArray»). InternalCallParams *proxyArgv = thread->GetInternalCallParams(); - proxyArgv->MakeArgv(target, thisArg, arrHandle); + proxyArgv->MakeArgv(target, this_arg, arrHandle); return JSFunction::Call(thread, method, handler, 3, proxyArgv->GetArgv()); // 3: «target, thisArgument, argArray» } -// ES6 9.5.14 [[Construct]] ( argumentsList, newTarget) +// ES6 9.5.14 [[Construct]] ( argumentsList, new_target) JSTaggedValue JSProxy::ConstructInternal(JSThread *thread, const JSHandle &proxy, uint32_t argc, const JSTaggedType argv[], // NOLINT(modernize-avoid-c-arrays) - const JSHandle &newTarget) + const JSHandle &new_target) { // step 1 ~ 4 get ProxyHandler and ProxyTarget JSHandle handler(thread, proxy->GetHandler()); @@ -894,10 +894,10 @@ JSTaggedValue JSProxy::ConstructInternal(JSThread *thread, const JSHandleIsUndefined()) { ASSERT(target->IsConstructor()); - return JSFunction::Construct(thread, target, argc, argv, newTarget); + return JSFunction::Construct(thread, target, argc, argv, new_target); } // 8.Let argArray be CreateArrayFromList(argumentsList). @@ -909,11 +909,11 @@ JSTaggedValue JSProxy::ConstructInternal(JSThread *thread, const JSHandle arrHandle = JSArray::CreateArrayFromList(thread, taggedArray); - // step 8 ~ 9 Call(trap, handler, «target, argArray, newTarget »). + // step 8 ~ 9 Call(trap, handler, «target, argArray, new_target »). InternalCallParams *arguments = thread->GetInternalCallParams(); - arguments->MakeArgv(target, arrHandle, newTarget); + arguments->MakeArgv(target, arrHandle, new_target); JSTaggedValue newObj = - JSFunction::Call(thread, method, handler, 3, arguments->GetArgv()); // 3: «target, argArray, newTarget » + JSFunction::Call(thread, method, handler, 3, arguments->GetArgv()); // 3: «target, argArray, new_target » // 10.ReturnIfAbrupt(newObj). RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); // 11.If Type(newObj) is not Object, throw a TypeError exception. diff --git a/runtime/js_proxy.h b/runtime/js_proxy.h index a2fa88894..a9fe1b553 100644 --- a/runtime/js_proxy.h +++ b/runtime/js_proxy.h @@ -53,13 +53,13 @@ public: const JSHandle &key, const JSHandle &receiver); // ES6 9.5.9 [[Set]] ( P, V, Receiver) static inline bool SetProperty(JSThread *thread, const JSHandle &proxy, const JSHandle &key, - const JSHandle &value, bool mayThrow = false) + const JSHandle &value, bool may_throw = false) { - return SetProperty(thread, proxy, key, value, JSHandle::Cast(proxy), mayThrow); + return SetProperty(thread, proxy, key, value, JSHandle::Cast(proxy), may_throw); } static bool SetProperty(JSThread *thread, const JSHandle &proxy, const JSHandle &key, const JSHandle &value, const JSHandle &receiver, - bool mayThrow = false); + bool may_throw = false); // ES6 9.5.10 [[Delete]] (P) static bool DeleteProperty(JSThread *thread, const JSHandle &proxy, const JSHandle &key); @@ -80,13 +80,13 @@ public: // ES6 9.5.13 [[Call]] (thisArgument, argumentsList) static JSTaggedValue CallInternal(JSThread *thread, const JSHandle &proxy, - const JSHandle &thisArg, uint32_t argc, + const JSHandle &this_arg, uint32_t argc, const JSTaggedType argv[]); // NOLINT(modernize-avoid-c-arrays) // ES6 9.5.14 [[Construct]] ( argumentsList, newTarget) static JSTaggedValue ConstructInternal( // NOLINTNEXTLINE(modernize-avoid-c-arrays) JSThread *thread, const JSHandle &proxy, uint32_t argc, const JSTaggedType argv[], - const JSHandle &newTarget); + const JSHandle &new_target); static constexpr size_t METHOD_OFFSET = ECMAObject::SIZE; SET_GET_NATIVE_FIELD(Method, JSMethod, METHOD_OFFSET, TARGET_OFFSET) diff --git a/runtime/js_symbol.h b/runtime/js_symbol.h index de1fc4c78..c541d3483 100644 --- a/runtime/js_symbol.h +++ b/runtime/js_symbol.h @@ -42,8 +42,8 @@ public: static inline uint32_t ComputeHash() { - uint32_t hashSeed = LINEAR_SEED + std::time(nullptr); - uint32_t hash = hashSeed * LINEAR_X + LINEAR_Y; + uint32_t hash_seed = LINEAR_SEED + std::time(nullptr); + uint32_t hash = hash_seed * LINEAR_X + LINEAR_Y; return hash; } @@ -141,9 +141,9 @@ public: if (src.GetFlags() != dst.GetFlags()) { return false; } - EcmaString *srcString = EcmaString::Cast(src.GetDescription().GetTaggedObject()); - EcmaString *dstString = EcmaString::Cast(dst.GetDescription().GetTaggedObject()); - return EcmaString::StringsAreEqual(srcString, dstString); + EcmaString *src_string = EcmaString::Cast(src.GetDescription().GetTaggedObject()); + EcmaString *dst_string = EcmaString::Cast(dst.GetDescription().GetTaggedObject()); + return EcmaString::StringsAreEqual(src_string, dst_string); } public: diff --git a/runtime/js_tagged_number.h b/runtime/js_tagged_number.h index 9638311c8..9209bef1d 100644 --- a/runtime/js_tagged_number.h +++ b/runtime/js_tagged_number.h @@ -104,9 +104,9 @@ public: JSTaggedNumber operator*(JSTaggedNumber number) const { if (IsInt() && number.IsInt()) { - int64_t intA = GetInt(); - int64_t intB = number.GetInt(); - int64_t res = intA * intB; + int64_t int_a = GetInt(); + int64_t int_b = number.GetInt(); + int64_t res = int_a * int_b; if (res > INT32_MAX || res < INT32_MIN) { return JSTaggedNumber(static_cast(res)); } @@ -147,14 +147,14 @@ public: /* static */ inline static bool SameValue(JSTaggedNumber x, JSTaggedNumber y) { - double xValue = x.GetNumber(); - double yValue = y.GetNumber(); + double x_value = x.GetNumber(); + double y_value = y.GetNumber(); // SameNumberValue(NaN, NaN) is true. - if (xValue != yValue) { - return std::isnan(xValue) && std::isnan(yValue); + if (x_value != y_value) { + return std::isnan(x_value) && std::isnan(y_value); } // SameNumberValue(0.0, -0.0) is false. - return (std::signbit(xValue) == std::signbit(yValue)); + return (std::signbit(x_value) == std::signbit(y_value)); } inline static JSTaggedNumber FromIntOrDouble(JSThread *thread, JSTaggedValue tagged) diff --git a/runtime/js_tagged_value-inl.h b/runtime/js_tagged_value-inl.h index 093e8465a..f4b844d1d 100644 --- a/runtime/js_tagged_value-inl.h +++ b/runtime/js_tagged_value-inl.h @@ -105,28 +105,28 @@ inline JSTaggedNumber JSTaggedValue::ToNumber(JSThread *thread, const JSHandleIsString()) { Span str; - auto strObj = static_cast(tagged->GetTaggedObject()); - size_t strLen = strObj->GetLength(); - if (strLen == 0) { + auto str_obj = static_cast(tagged->GetTaggedObject()); + size_t str_len = str_obj->GetLength(); + if (str_len == 0) { return JSTaggedNumber(0); } [[maybe_unused]] PandaVector buf; // Span will use buf.data(), shouldn't define inside 'if' - if (UNLIKELY(strObj->IsUtf16())) { - size_t len = base::utf_helper::Utf16ToUtf8Size(strObj->GetDataUtf16(), strLen) - 1; + if (UNLIKELY(str_obj->IsUtf16())) { + size_t len = base::utf_helper::Utf16ToUtf8Size(str_obj->GetDataUtf16(), str_len) - 1; buf.reserve(len); - len = base::utf_helper::ConvertRegionUtf16ToUtf8(strObj->GetDataUtf16(), buf.data(), strLen, len, 0); + len = base::utf_helper::ConvertRegionUtf16ToUtf8(str_obj->GetDataUtf16(), buf.data(), str_len, len, 0); str = Span(buf.data(), len); } else { - str = Span(strObj->GetDataUtf8(), strLen); + str = Span(str_obj->GetDataUtf8(), str_len); } double d = base::NumberHelper::StringToDouble(str.begin(), str.end(), 0, base::ALLOW_BINARY + base::ALLOW_OCTAL + base::ALLOW_HEX); return JSTaggedNumber(d); } if (tagged->IsECMAObject()) { - JSHandle primValue(thread, ToPrimitive(thread, tagged, PREFER_NUMBER)); + JSHandle prim_value(thread, ToPrimitive(thread, tagged, PREFER_NUMBER)); RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, JSTaggedNumber::Exception()); - return ToNumber(thread, primValue); + return ToNumber(thread, prim_value); } if (tagged->IsSymbol()) { THROW_TYPE_ERROR_AND_RETURN(thread, "Cannot convert a Symbol value to a number", JSTaggedNumber::Exception()); @@ -273,9 +273,9 @@ inline bool JSTaggedValue::SameValue(const JSTaggedValue &x, const JSTaggedValue return false; } -inline bool JSTaggedValue::SameValue(const JSHandle &xHandle, const JSHandle &yHandle) +inline bool JSTaggedValue::SameValue(const JSHandle &x_handle, const JSHandle &y_handle) { - return SameValue(xHandle.GetTaggedValue(), yHandle.GetTaggedValue()); + return SameValue(x_handle.GetTaggedValue(), y_handle.GetTaggedValue()); } inline bool JSTaggedValue::SameValueZero(const JSTaggedValue &x, const JSTaggedValue &y) @@ -285,10 +285,10 @@ inline bool JSTaggedValue::SameValueZero(const JSTaggedValue &x, const JSTaggedV } if (x.IsNumber() && y.IsNumber()) { - double xValue = x.ExtractNumber(); - double yValue = y.ExtractNumber(); + double x_value = x.ExtractNumber(); + double y_value = y.ExtractNumber(); // Compare xValue with yValue to deal with -0.0 - return (xValue == yValue) || (std::isnan(xValue) && std::isnan(yValue)); + return (x_value == y_value) || (std::isnan(x_value) && std::isnan(y_value)); } if (x.IsString() && y.IsString()) { @@ -300,14 +300,14 @@ inline bool JSTaggedValue::SameValueZero(const JSTaggedValue &x, const JSTaggedV inline bool JSTaggedValue::SameValueNumberic(const JSTaggedValue &x, const JSTaggedValue &y) { - double xValue = x.ExtractNumber(); - double yValue = y.ExtractNumber(); + double x_value = x.ExtractNumber(); + double y_value = y.ExtractNumber(); // SameNumberValue(NaN, NaN) is true. - if (xValue != yValue) { - return std::isnan(xValue) && std::isnan(yValue); + if (x_value != y_value) { + return std::isnan(x_value) && std::isnan(y_value); } // SameNumberValue(0.0, -0.0) is false. - return (std::signbit(xValue) == std::signbit(yValue)); + return (std::signbit(x_value) == std::signbit(y_value)); } inline bool JSTaggedValue::Less(JSThread *thread, const JSHandle &x, const JSHandle &y) @@ -556,12 +556,12 @@ inline bool JSTaggedValue::IsArray(JSThread *thread) const if (!IsHeapObject()) { return false; } - JSHClass *jsHclass = GetTaggedObject()->GetClass(); - if (jsHclass->IsJSArray()) { + JSHClass *js_hclass = GetTaggedObject()->GetClass(); + if (js_hclass->IsJSArray()) { return true; } - if (jsHclass->IsJSProxy()) { + if (js_hclass->IsJSProxy()) { return JSProxy::Cast(GetTaggedObject())->IsArray(thread); } return false; @@ -909,21 +909,21 @@ inline double JSTaggedValue::ExtractNumber() const inline bool JSTaggedValue::ToArrayLength(JSThread *thread, const JSHandle &tagged, uint32_t *output) { // 3. Let newLen be ToUint32(Desc.[[Value]]). - uint32_t newLen = ToUint32(thread, tagged); + uint32_t new_len = ToUint32(thread, tagged); // 4. ReturnIfAbrupt(newLen). RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, false); // 5. Let numberLen be ToNumber(Desc.[[Value]]). - JSTaggedNumber numberLen = ToNumber(thread, tagged); + JSTaggedNumber number_len = ToNumber(thread, tagged); // 6. ReturnIfAbrupt(newLen). RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, false); // 7. If newLen != numberLen, throw a RangeError exception. - if (JSTaggedNumber(newLen) != numberLen) { + if (JSTaggedNumber(new_len) != number_len) { THROW_RANGE_ERROR_AND_RETURN(thread, "Not a valid array length", false); } - *output = newLen; + *output = new_len; return true; } @@ -965,16 +965,16 @@ inline bool JSTaggedValue::StringToElementIndex(JSTaggedValue key, uint32_t *out { ASSERT(key.IsString()); - auto strObj = static_cast(key.GetTaggedObject()); - uint32_t len = strObj->GetLength(); + auto str_obj = static_cast(key.GetTaggedObject()); + uint32_t len = str_obj->GetLength(); if (len == 0 || len > MAX_INDEX_LEN) { return false; } uint32_t c; - if (strObj->IsUtf16()) { - c = strObj->GetDataUtf16()[0]; // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic) + if (str_obj->IsUtf16()) { + c = str_obj->GetDataUtf16()[0]; // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic) } else { - c = strObj->GetDataUtf8()[0]; // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic) + c = str_obj->GetDataUtf8()[0]; // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic) } uint64_t n = 0; if (c >= '0' && c <= '9') { @@ -988,10 +988,10 @@ inline bool JSTaggedValue::StringToElementIndex(JSTaggedValue key, uint32_t *out n = c - '0'; for (uint32_t i = 1; i < len; i++) { - if (strObj->IsUtf16()) { - c = strObj->GetDataUtf16()[i]; // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic) + if (str_obj->IsUtf16()) { + c = str_obj->GetDataUtf16()[i]; // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic) } else { - c = strObj->GetDataUtf8()[i]; // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic) + c = str_obj->GetDataUtf8()[i]; // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic) } if (c < '0' || c > '9') { return false; diff --git a/runtime/js_tagged_value.cpp b/runtime/js_tagged_value.cpp index 568ccfd68..baf9b3931 100644 --- a/runtime/js_tagged_value.cpp +++ b/runtime/js_tagged_value.cpp @@ -469,7 +469,8 @@ OperationResult JSTaggedValue::GetProperty(JSThread *thread, const JSHandle &obj, - const JSHandle &key, const JSHandle &value, bool mayThrow) + const JSHandle &key, const JSHandle &value, + bool may_throw) { if (obj->IsUndefined() || obj->IsNull() || obj->IsHole()) { THROW_TYPE_ERROR_AND_RETURN(thread, "Obj is not a Valid object", false); @@ -480,11 +481,11 @@ bool JSTaggedValue::SetProperty(JSThread *thread, const JSHandle // 4. Let success be O.[[Set]](P, V, O). bool success = false; if (obj->IsJSProxy()) { - success = JSProxy::SetProperty(thread, JSHandle(obj), key, value, mayThrow); + success = JSProxy::SetProperty(thread, JSHandle(obj), key, value, may_throw); } else if (obj->IsTypedArray()) { - success = JSTypedArray::SetProperty(thread, obj, JSTypedArray::ToPropKey(thread, key), value, mayThrow); + success = JSTypedArray::SetProperty(thread, obj, JSTypedArray::ToPropKey(thread, key), value, may_throw); } else { - success = JSObject::SetProperty(thread, obj, key, value, mayThrow); + success = JSObject::SetProperty(thread, obj, key, value, may_throw); } // 5. ReturnIfAbrupt(success). RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, success); @@ -494,7 +495,7 @@ bool JSTaggedValue::SetProperty(JSThread *thread, const JSHandle } bool JSTaggedValue::SetProperty(JSThread *thread, const JSHandle &obj, uint32_t key, - const JSHandle &value, bool mayThrow) + const JSHandle &value, bool may_throw) { if (obj->IsUndefined() || obj->IsNull() || obj->IsHole()) { THROW_TYPE_ERROR_AND_RETURN(thread, "Obj is not a Valid object", false); @@ -504,13 +505,13 @@ bool JSTaggedValue::SetProperty(JSThread *thread, const JSHandle bool success = false; if (obj->IsJSProxy()) { JSHandle keyHandle(thread, JSTaggedValue(key)); - success = JSProxy::SetProperty(thread, JSHandle(obj), keyHandle, value, mayThrow); + success = JSProxy::SetProperty(thread, JSHandle(obj), keyHandle, value, may_throw); } else if (obj->IsTypedArray()) { JSHandle keyHandle(thread, JSTaggedValue(key)); success = JSTypedArray::SetProperty( - thread, obj, JSHandle(JSTaggedValue::ToString(thread, keyHandle)), value, mayThrow); + thread, obj, JSHandle(JSTaggedValue::ToString(thread, keyHandle)), value, may_throw); } else { - success = JSObject::SetProperty(thread, obj, key, value, mayThrow); + success = JSObject::SetProperty(thread, obj, key, value, may_throw); } // 5. ReturnIfAbrupt(success). RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, success); @@ -521,7 +522,7 @@ bool JSTaggedValue::SetProperty(JSThread *thread, const JSHandle bool JSTaggedValue::SetProperty(JSThread *thread, const JSHandle &obj, const JSHandle &key, const JSHandle &value, - const JSHandle &receiver, bool mayThrow) + const JSHandle &receiver, bool may_throw) { if (obj->IsUndefined() || obj->IsNull() || obj->IsHole()) { THROW_TYPE_ERROR_AND_RETURN(thread, "Obj is not a Valid object", false); @@ -532,12 +533,12 @@ bool JSTaggedValue::SetProperty(JSThread *thread, const JSHandle // 4. Let success be O.[[Set]](P, V, O). bool success = false; if (obj->IsJSProxy()) { - success = JSProxy::SetProperty(thread, JSHandle(obj), key, value, receiver, mayThrow); + success = JSProxy::SetProperty(thread, JSHandle(obj), key, value, receiver, may_throw); } else if (obj->IsTypedArray()) { success = - JSTypedArray::SetProperty(thread, obj, JSTypedArray::ToPropKey(thread, key), value, receiver, mayThrow); + JSTypedArray::SetProperty(thread, obj, JSTypedArray::ToPropKey(thread, key), value, receiver, may_throw); } else { - success = JSObject::SetProperty(thread, obj, key, value, receiver, mayThrow); + success = JSObject::SetProperty(thread, obj, key, value, receiver, may_throw); } // 5. ReturnIfAbrupt(success). RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, success); diff --git a/runtime/js_tagged_value.h b/runtime/js_tagged_value.h index 342c1ac03..ba83d8a4c 100644 --- a/runtime/js_tagged_value.h +++ b/runtime/js_tagged_value.h @@ -167,7 +167,7 @@ public: static bool IsPropertyKey(const JSHandle &key); static JSHandle RequireObjectCoercible(JSThread *thread, const JSHandle &tagged); static bool SameValue(const JSTaggedValue &x, const JSTaggedValue &y); - static bool SameValue(const JSHandle &xHandle, const JSHandle &yHandle); + static bool SameValue(const JSHandle &x_handle, const JSHandle &y_handle); static bool SameValueZero(const JSTaggedValue &x, const JSTaggedValue &y); static bool Less(JSThread *thread, const JSHandle &x, const JSHandle &y); static bool Equal(JSThread *thread, const JSHandle &x, const JSHandle &y); @@ -185,14 +185,14 @@ public: static OperationResult GetProperty(JSThread *thread, const JSHandle &obj, const JSHandle &key, const JSHandle &receiver); static bool SetProperty(JSThread *thread, const JSHandle &obj, uint32_t key, - const JSHandle &value, bool mayThrow = false); + const JSHandle &value, bool may_throw = false); static bool SetProperty(JSThread *thread, const JSHandle &obj, const JSHandle &key, - const JSHandle &value, bool mayThrow = false); + const JSHandle &value, bool may_throw = false); static bool SetProperty(JSThread *thread, const JSHandle &obj, const JSHandle &key, const JSHandle &value, const JSHandle &receiver, - bool mayThrow = false); + bool may_throw = false); static bool DeleteProperty(JSThread *thread, const JSHandle &obj, const JSHandle &key); static bool DeletePropertyOrThrow(JSThread *thread, const JSHandle &obj, @@ -339,7 +339,7 @@ public: void Dump(JSThread *thread, std::ostream &os) const DUMP_API_ATTR; void D() const DUMP_API_ATTR; void DumpForSnapshot(JSThread *thread, std::vector> &vec, - bool isVmMode = true) const; + bool is_vm_mode = true) const; static void DV(JSTaggedType val) DUMP_API_ATTR; private: diff --git a/runtime/js_thread.cpp b/runtime/js_thread.cpp index ef273661a..8e5ae7de9 100644 --- a/runtime/js_thread.cpp +++ b/runtime/js_thread.cpp @@ -38,29 +38,29 @@ JSThread::JSThread(Runtime *runtime, PandaVM *vm) panda_file::SourceLang::ECMASCRIPT) { SetLanguageContext(runtime->GetLanguageContext(panda_file::SourceLang::ECMASCRIPT)); - globalStorage_ = runtime->GetInternalAllocator()->New(); - internalCallParams_ = new InternalCallParams(); - propertiesCache_ = new PropertiesCache(); + global_storage_ = runtime->GetInternalAllocator()->New(); + internal_call_params_ = new InternalCallParams(); + properties_cache_ = new PropertiesCache(); } JSThread::~JSThread() { - for (auto n : handleStorageNodes_) { + for (auto n : handle_storage_nodes_) { delete n; } - handleStorageNodes_.clear(); - currentHandleStorageIndex_ = -1; - handleScopeCount_ = 0; - handleScopeStorageNext_ = handleScopeStorageEnd_ = nullptr; - Runtime::GetCurrent()->GetInternalAllocator()->Delete(globalStorage_); - - if (internalCallParams_ != nullptr) { - delete internalCallParams_; - internalCallParams_ = nullptr; + handle_storage_nodes_.clear(); + current_handle_storage_index_ = -1; + handle_scope_count_ = 0; + handle_scope_storage_next_ = handle_scope_storage_end_ = nullptr; + Runtime::GetCurrent()->GetInternalAllocator()->Delete(global_storage_); + + if (internal_call_params_ != nullptr) { + delete internal_call_params_; + internal_call_params_ = nullptr; } - if (propertiesCache_ != nullptr) { - delete propertiesCache_; - propertiesCache_ = nullptr; + if (properties_cache_ != nullptr) { + delete properties_cache_; + properties_cache_ = nullptr; } } @@ -103,18 +103,18 @@ void JSThread::Iterate(const RootVisitor &v0, const RootRangeVisitor &v1) IterateEcmascriptEnvironment(v0, v1); // visit internal call params; - internalCallParams_->Iterate(v1); + internal_call_params_->Iterate(v1); // visit tagged handle storage roots - if (currentHandleStorageIndex_ != -1) { - int32_t nid = currentHandleStorageIndex_; + if (current_handle_storage_index_ != -1) { + int32_t nid = current_handle_storage_index_; for (int32_t i = 0; i <= nid; ++i) { - auto node = handleStorageNodes_.at(i); + auto node = handle_storage_nodes_.at(i); auto start = node->data(); - auto end = (i != nid) ? &(node->data()[NODE_BLOCK_SIZE]) : handleScopeStorageNext_; + auto end = (i != nid) ? &(node->data()[NODE_BLOCK_SIZE]) : handle_scope_storage_next_; v1(ecmascript::Root::ROOT_HANDLE, ObjectSlot(ToUintPtr(start)), ObjectSlot(ToUintPtr(end))); } } - globalStorage_->IterateUsageGlobal([v0](EcmaGlobalStorage::Node *node) { + global_storage_->IterateUsageGlobal([v0](EcmaGlobalStorage::Node *node) { JSTaggedValue value(node->GetObject()); if (value.IsHeapObject()) { v0(ecmascript::Root::ROOT_HANDLE, ecmascript::ObjectSlot(node->GetObjectAddress())); @@ -126,7 +126,7 @@ void JSThread::Iterate(const RootVisitor &v0, const RootRangeVisitor &v1) void JSThread::IterateWeakEcmaGlobalStorage(const WeakRootVisitor &visitor) { - globalStorage_->IterateWeakUsageGlobal([visitor](EcmaGlobalStorage::Node *node) { + global_storage_->IterateWeakUsageGlobal([visitor](EcmaGlobalStorage::Node *node) { JSTaggedValue value(node->GetObject()); if (value.IsHeapObject()) { auto object = value.GetTaggedObject(); @@ -161,8 +161,8 @@ void JSThread::IterateEcmascriptEnvironment(const RootVisitor &v0, const RootRan env = env->GetPrevEnvironment(); } - if (propertiesCache_ != nullptr) { - propertiesCache_->Clear(); + if (properties_cache_ != nullptr) { + properties_cache_->Clear(); } if (!exception_.IsHole()) { @@ -170,47 +170,47 @@ void JSThread::IterateEcmascriptEnvironment(const RootVisitor &v0, const RootRan } // visit global Constant - globalConst_.VisitRangeSlot(v1); + global_const_.VisitRangeSlot(v1); } uintptr_t *JSThread::ExpandHandleStorage() { uintptr_t *result = nullptr; - int32_t lastIndex = handleStorageNodes_.size() - 1; - if (currentHandleStorageIndex_ == lastIndex) { + int32_t lastIndex = handle_storage_nodes_.size() - 1; + if (current_handle_storage_index_ == lastIndex) { auto n = new std::array(); - handleStorageNodes_.push_back(n); - currentHandleStorageIndex_++; + handle_storage_nodes_.push_back(n); + current_handle_storage_index_++; result = reinterpret_cast(&n->data()[0]); - handleScopeStorageEnd_ = &n->data()[NODE_BLOCK_SIZE]; + handle_scope_storage_end_ = &n->data()[NODE_BLOCK_SIZE]; } else { - currentHandleStorageIndex_++; - auto lastNode = handleStorageNodes_[currentHandleStorageIndex_]; + current_handle_storage_index_++; + auto lastNode = handle_storage_nodes_[current_handle_storage_index_]; result = reinterpret_cast(&lastNode->data()[0]); - handleScopeStorageEnd_ = &lastNode->data()[NODE_BLOCK_SIZE]; + handle_scope_storage_end_ = &lastNode->data()[NODE_BLOCK_SIZE]; } return result; } -void JSThread::ShrinkHandleStorage(int prevIndex) +void JSThread::ShrinkHandleStorage(int prev_index) { - currentHandleStorageIndex_ = prevIndex; - int32_t lastIndex = handleStorageNodes_.size() - 1; + current_handle_storage_index_ = prev_index; + int32_t lastIndex = handle_storage_nodes_.size() - 1; #if ECMASCRIPT_ENABLE_ZAP_MEM - uintptr_t size = ToUintPtr(handleScopeStorageEnd_) - ToUintPtr(handleScopeStorageNext_); - memset_s(handleScopeStorageNext_, size, 0, size); - for (int32_t i = currentHandleStorageIndex_ + 1; i < lastIndex; i++) { - memset_s(handleStorageNodes_[i], NODE_BLOCK_SIZE * sizeof(JSTaggedType), 0, + uintptr_t size = ToUintPtr(handle_scope_storage_end_) - ToUintPtr(handle_scope_storage_next_); + memset_s(handle_scope_storage_next_, size, 0, size); + for (int32_t i = current_handle_storage_index_ + 1; i < lastIndex; i++) { + memset_s(handle_storage_nodes_[i], NODE_BLOCK_SIZE * sizeof(JSTaggedType), 0, NODE_BLOCK_SIZE * sizeof(JSTaggedType)); } #endif - if (lastIndex > MIN_HANDLE_STORAGE_SIZE && currentHandleStorageIndex_ < MIN_HANDLE_STORAGE_SIZE) { + if (lastIndex > MIN_HANDLE_STORAGE_SIZE && current_handle_storage_index_ < MIN_HANDLE_STORAGE_SIZE) { for (int i = MIN_HANDLE_STORAGE_SIZE; i < lastIndex; i++) { - auto node = handleStorageNodes_.back(); + auto node = handle_storage_nodes_.back(); delete node; - handleStorageNodes_.pop_back(); + handle_storage_nodes_.pop_back(); } } } @@ -220,22 +220,22 @@ void JSThread::NotifyStableArrayElementsGuardians(JSHandle receiver) if (!receiver->GetJSHClass()->IsPrototype()) { return; } - if (!stableArrayElementsGuardians_) { + if (!stable_array_elements_guardians_) { return; } auto env = GetEcmaVM()->GetGlobalEnv(); if (receiver.GetTaggedValue() == env->GetObjectFunctionPrototype().GetTaggedValue() || receiver.GetTaggedValue() == env->GetArrayPrototype().GetTaggedValue()) { - stableArrayElementsGuardians_ = false; + stable_array_elements_guardians_ = false; } } void JSThread::ResetGuardians() { - stableArrayElementsGuardians_ = true; + stable_array_elements_guardians_ = true; } -void JSThread::LoadFastStubModule([[maybe_unused]] const char *moduleFile) +void JSThread::LoadFastStubModule([[maybe_unused]] const char *module_file) { UNREACHABLE(); } diff --git a/runtime/js_thread.h b/runtime/js_thread.h index cc42cf978..e5ad952db 100644 --- a/runtime/js_thread.h +++ b/runtime/js_thread.h @@ -79,22 +79,22 @@ public: int GetNestedLevel() const { - return nestedLevel_; + return nested_level_; } void SetNestedLevel(int level) { - nestedLevel_ = level; + nested_level_ = level; } const JSTaggedType *GetCurrentSPFrame() const { - return currentFrame_; + return current_frame_; } void SetCurrentSPFrame(JSTaggedType *sp) { - currentFrame_ = sp; + current_frame_ = sp; } bool DoStackOverflowCheck(const JSTaggedType *sp); @@ -102,41 +102,41 @@ public: void Iterate(const RootVisitor &v0, const RootRangeVisitor &v1); uintptr_t *ExpandHandleStorage(); - void ShrinkHandleStorage(int prevIndex); + void ShrinkHandleStorage(int prev_index); JSTaggedType *GetHandleScopeStorageNext() const { - return handleScopeStorageNext_; + return handle_scope_storage_next_; } void SetHandleScopeStorageNext(JSTaggedType *value) { - handleScopeStorageNext_ = value; + handle_scope_storage_next_ = value; } JSTaggedType *GetHandleScopeStorageEnd() const { - return handleScopeStorageEnd_; + return handle_scope_storage_end_; } void SetHandleScopeStorageEnd(JSTaggedType *value) { - handleScopeStorageEnd_ = value; + handle_scope_storage_end_ = value; } int GetCurrentHandleStorageIndex() { - return currentHandleStorageIndex_; + return current_handle_storage_index_; } void HandleScopeCountAdd() { - handleScopeCount_++; + handle_scope_count_++; } void HandleScopeCountDec() { - handleScopeCount_--; + handle_scope_count_--; } void SetException(JSTaggedValue exception); @@ -155,12 +155,12 @@ public: EcmaGlobalStorage *GetEcmaGlobalStorage() const { - return globalStorage_; + return global_storage_; } const GlobalEnvConstants *GlobalConstants() const { - return &globalConst_; + return &global_const_; } EcmascriptEnvironment *GetEcmascriptEnv() const @@ -175,29 +175,29 @@ public: JSTaggedValue GetFunctionalObject() const { - return functionalObject_; + return functional_object_; } - void SetFunctionalObject(JSTaggedValue functionalObject) + void SetFunctionalObject(JSTaggedValue functional_object) { - functionalObject_ = functionalObject; + functional_object_ = functional_object; } JSTaggedValue GetInvocationLexicalEnv() const { - return invocationLexicalEnv_; + return invocation_lexical_env_; } - void SetInvocationLexicalEnv(JSTaggedValue invocationLexicalEnv) + void SetInvocationLexicalEnv(JSTaggedValue invocation_lexical_env) { - invocationLexicalEnv_ = invocationLexicalEnv; + invocation_lexical_env_ = invocation_lexical_env; } void NotifyStableArrayElementsGuardians(JSHandle receiver); bool IsStableArrayElementsGuardiansInvalid() const { - return !stableArrayElementsGuardians_; + return !stable_array_elements_guardians_; } void ResetGuardians(); @@ -206,11 +206,11 @@ public: void InitializeFastRuntimeStubs(); - void LoadFastStubModule(const char *moduleFile); + void LoadFastStubModule(const char *module_file); InternalCallParams *GetInternalCallParams() const { - return internalCallParams_; + return internal_call_params_; } ThreadId GetThreadId() const @@ -227,54 +227,54 @@ public: PropertiesCache *GetPropertiesCache() const { - return propertiesCache_; + return properties_cache_; } static constexpr uint32_t GetPropertiesCacheOffset() { - return MEMBER_OFFSET(JSThread, propertiesCache_); + return MEMBER_OFFSET(JSThread, properties_cache_); } static constexpr uint32_t GetGlobalConstantsOffset() { - return MEMBER_OFFSET(JSThread, globalConst_); + return MEMBER_OFFSET(JSThread, global_const_); } static constexpr uint32_t GetGlobalStorageOffset() { - return MEMBER_OFFSET(JSThread, globalStorage_); + return MEMBER_OFFSET(JSThread, global_storage_); } static constexpr uint32_t GetGlobalObjectOffset() { - return MEMBER_OFFSET(JSThread, globalObj_); + return MEMBER_OFFSET(JSThread, global_obj_); } static constexpr uint32_t GetCurrentFrameOffset() { - return MEMBER_OFFSET(JSThread, currentFrame_); + return MEMBER_OFFSET(JSThread, current_frame_); } bool CheckSafepoint() const; - void SetGetStackSignal(bool isParseStack) + void SetGetStackSignal(bool is_parse_stack) { - getStackSignal_ = isParseStack; + get_stack_signal_ = is_parse_stack; } bool GetStackSignal() const { - return getStackSignal_; + return get_stack_signal_; } - void SetGcState(bool gcState) + void SetGcState(bool gc_state) { - gcState_ = gcState; + gc_state_ = gc_state; } bool GetGcState() const { - return gcState_; + return gc_state_; } static constexpr uint32_t GetExceptionOffset() { @@ -292,14 +292,14 @@ public: return reinterpret_cast(glue - GetExceptionOffset()); } - void SetGlobalObject(JSTaggedValue globalObj) + void SetGlobalObject(JSTaggedValue global_obj) { - globalObj_ = globalObj; + global_obj_ = global_obj; } JSTaggedValue GetGlobalObject() const { - return globalObj_; + return global_obj_; } private: @@ -321,35 +321,35 @@ private: static constexpr int32_t MIN_HANDLE_STORAGE_SIZE = 2; // MM: handles, global-handles, and aot-stubs. - int nestedLevel_ = 0; - JSTaggedType *handleScopeStorageNext_ {nullptr}; - JSTaggedType *handleScopeStorageEnd_ {nullptr}; - std::vector *> handleStorageNodes_ {}; - int32_t currentHandleStorageIndex_ {-1}; - int32_t handleScopeCount_ {0}; - JSSpanHandle *spanHandle_ {nullptr}; - JSTaggedValue stubCode_ {JSTaggedValue::Hole()}; + int nested_level_ = 0; + JSTaggedType *handle_scope_storage_next_ {nullptr}; + JSTaggedType *handle_scope_storage_end_ {nullptr}; + std::vector *> handle_storage_nodes_ {}; + int32_t current_handle_storage_index_ {-1}; + int32_t handle_scope_count_ {0}; + JSSpanHandle *span_handle_ {nullptr}; + JSTaggedValue stub_code_ {JSTaggedValue::Hole()}; // Run-time state - bool getStackSignal_ {false}; - bool gcState_ {false}; - volatile uint64_t threadStateBitField_ {0ULL}; - JSTaggedType *frameBase_ {nullptr}; - bool stableArrayElementsGuardians_ {true}; - InternalCallParams *internalCallParams_ {nullptr}; + bool get_stack_signal_ {false}; + bool gc_state_ {false}; + volatile uint64_t thread_state_bit_field_ {0ULL}; + JSTaggedType *frame_base_ {nullptr}; + bool stable_array_elements_guardians_ {true}; + InternalCallParams *internal_call_params_ {nullptr}; // GLUE members start, very careful to modify here JSTaggedValue exception_ {JSTaggedValue::Hole()}; - GlobalEnvConstants globalConst_; // Place-Holder - PropertiesCache *propertiesCache_ {nullptr}; - EcmaGlobalStorage *globalStorage_ {nullptr}; - JSTaggedType *currentFrame_ {nullptr}; + GlobalEnvConstants global_const_; // Place-Holder + PropertiesCache *properties_cache_ {nullptr}; + EcmaGlobalStorage *global_storage_ {nullptr}; + JSTaggedType *current_frame_ {nullptr}; - JSTaggedValue globalObj_ {JSTaggedValue::Hole()}; + JSTaggedValue global_obj_ {JSTaggedValue::Hole()}; // Uses to forward a0 argument (functional object) to InvokeHelper - JSTaggedValue functionalObject_; - JSTaggedValue invocationLexicalEnv_; + JSTaggedValue functional_object_; + JSTaggedValue invocation_lexical_env_; friend class EcmaHandleScope; friend class JSSpanHandle; diff --git a/runtime/js_typed_array.cpp b/runtime/js_typed_array.cpp index 762c7ef94..cc2893e37 100644 --- a/runtime/js_typed_array.cpp +++ b/runtime/js_typed_array.cpp @@ -228,7 +228,7 @@ OperationResult JSTypedArray::GetProperty(JSThread *thread, const JSHandle &typedarray, const JSHandle &key, const JSHandle &value, - const JSHandle &receiver, bool mayThrow) + const JSHandle &receiver, bool may_throw) { // 1. Assert : IsPropertyKey(P) is true. ASSERT(JSTaggedValue::IsPropertyKey(key)); @@ -246,7 +246,7 @@ bool JSTypedArray::SetProperty(JSThread *thread, const JSHandle & } // 3. Return the result of calling the default ordinary object [[Set]] internal method (9.1.8) on O passing // P, V, and Receiver as arguments. - return JSObject::SetProperty(thread, typedarray, key, value, receiver, mayThrow); + return JSObject::SetProperty(thread, typedarray, key, value, receiver, may_throw); } // 9.4.5.6 [[OwnPropertyKeys]] ( ) @@ -367,14 +367,14 @@ OperationResult JSTypedArray::IntegerIndexedElementGet(JSThread *thread, const J } // static -bool JSTypedArray::FastCopyElementToArray(JSThread *thread, const JSHandle &typedArray, +bool JSTypedArray::FastCopyElementToArray(JSThread *thread, const JSHandle &typed_array, JSHandle &array) { // 2. Assert: O is an Object that has [[ViewedArrayBuffer]], [[ArrayLength]], [[ByteOffset]], and // [[TypedArrayName]] internal slots. - ASSERT(typedArray->IsTypedArray()); + ASSERT(typed_array->IsTypedArray()); // 3. Let buffer be the value of O’s [[ViewedArrayBuffer]] internal slot. - JSHandle typedarrayObj(typedArray); + JSHandle typedarrayObj(typed_array); JSTaggedValue buffer = JSTypedArray::Cast(*typedarrayObj)->GetViewedArrayBuffer(); // 4. If IsDetachedBuffer(buffer) is true, throw a TypeError exception. if (BuiltinsArrayBuffer::IsDetachedBuffer(buffer)) { diff --git a/runtime/js_typed_array.h b/runtime/js_typed_array.h index 313ff331f..a9a4278e7 100644 --- a/runtime/js_typed_array.h +++ b/runtime/js_typed_array.h @@ -62,13 +62,13 @@ public: // 9.4.5.5 [[Set]] ( P, V, Receiver ) static inline bool SetProperty(JSThread *thread, const JSHandle &typedarray, const JSHandle &key, const JSHandle &value, - bool mayThrow = false) + bool may_throw = false) { - return SetProperty(thread, typedarray, key, value, typedarray, mayThrow); + return SetProperty(thread, typedarray, key, value, typedarray, may_throw); } static bool SetProperty(JSThread *thread, const JSHandle &typedarray, const JSHandle &key, const JSHandle &value, - const JSHandle &receiver, bool mayThrow = false); + const JSHandle &receiver, bool may_throw = false); // 9.4.5.6 [[OwnPropertyKeys]] ( ) static JSHandle OwnPropertyKeys(JSThread *thread, const JSHandle &typedarray); // 9.4.5.7 IntegerIndexedObjectCreate (prototype, internalSlotsList) @@ -76,7 +76,7 @@ public: static OperationResult IntegerIndexedElementGet(JSThread *thread, const JSHandle &typedarray, JSTaggedValue index); static OperationResult FastElementGet(JSThread *thread, const JSHandle &typedarray, uint32_t index); - static bool FastCopyElementToArray(JSThread *thread, const JSHandle &typedArray, + static bool FastCopyElementToArray(JSThread *thread, const JSHandle &typed_array, JSHandle &array); // 9.4.5.9 IntegerIndexedElementSet ( O, index, value ) static bool IntegerIndexedElementSet(JSThread *thread, const JSHandle &typedarray, diff --git a/runtime/layout_info-inl.h b/runtime/layout_info-inl.h index d37210754..b3f77fce0 100644 --- a/runtime/layout_info-inl.h +++ b/runtime/layout_info-inl.h @@ -57,9 +57,9 @@ inline void LayoutInfo::SetPropertyInit(const JSThread *thread, int32_t index, c inline void LayoutInfo::SetNormalAttr(const JSThread *thread, int32_t index, const PropertyAttributes &attr) { uint32_t fixed_idx = GetAttrIndex(index); - PropertyAttributes oldAttr(TaggedArray::Get(fixed_idx)); - oldAttr.SetNormalAttr(attr.GetNormalAttr()); - TaggedArray::Set(thread, fixed_idx, oldAttr.GetTaggedValue()); + PropertyAttributes old_attr(TaggedArray::Get(fixed_idx)); + old_attr.SetNormalAttr(attr.GetNormalAttr()); + TaggedArray::Set(thread, fixed_idx, old_attr.GetTaggedValue()); } inline JSTaggedValue LayoutInfo::GetKey(int32_t index) const @@ -85,23 +85,23 @@ inline uint32_t LayoutInfo::GetSortedIndex(int32_t index) const return GetAttr(index).GetSortedIndex(); } -inline void LayoutInfo::SetSortedIndex(const JSThread *thread, int32_t index, int32_t sortedIndex) +inline void LayoutInfo::SetSortedIndex(const JSThread *thread, int32_t index, int32_t sorted_index) { uint32_t fixed_idx = GetAttrIndex(index); PropertyAttributes attr(TaggedArray::Get(fixed_idx)); - attr.SetSortedIndex(sortedIndex); + attr.SetSortedIndex(sorted_index); TaggedArray::Set(thread, fixed_idx, attr.GetTaggedValue()); } inline int32_t LayoutInfo::FindElementWithCache(JSThread *thread, JSHClass *cls, JSTaggedValue key, - int32_t propertiesNumber) + int32_t properties_number) { - ASSERT(NumberOfElements() >= propertiesNumber); - const int32_t MAX_ELEMENTS_LINER_SEARCH = 9; // 9: Builtins Object properties number is nine; - if (propertiesNumber <= MAX_ELEMENTS_LINER_SEARCH) { - Span sp(GetProperties(), propertiesNumber); - for (int32_t i = 0; i < propertiesNumber; i++) { - if (sp[i].key_ == key) { + ASSERT(NumberOfElements() >= properties_number); + const int32_t max_elements_liner_search = 9; // 9: Builtins Object properties number is nine; + if (properties_number <= max_elements_liner_search) { + Span sp(GetProperties(), properties_number); + for (int32_t i = 0; i < properties_number; i++) { + if (sp[i].key == key) { return i; } } @@ -111,55 +111,55 @@ inline int32_t LayoutInfo::FindElementWithCache(JSThread *thread, JSHClass *cls, PropertiesCache *cache = thread->GetPropertiesCache(); int32_t index = cache->Get(cls, key); if (index == PropertiesCache::NOT_FOUND) { - index = BinarySearch(key, propertiesNumber); + index = BinarySearch(key, properties_number); cache->Set(cls, key, index); } return index; } -inline int32_t LayoutInfo::BinarySearch(JSTaggedValue key, int32_t propertiesNumber) +inline int32_t LayoutInfo::BinarySearch(JSTaggedValue key, int32_t properties_number) { - ASSERT(NumberOfElements() >= propertiesNumber); + ASSERT(NumberOfElements() >= properties_number); int32_t low = 0; int32_t elements = NumberOfElements(); int32_t high = elements - 1; - uint32_t keyHash = key.GetKeyHashCode(); + uint32_t key_hash = key.GetKeyHashCode(); ASSERT(low <= high); while (low <= high) { int32_t mid = low + (high - low) / 2; // 2: half - JSTaggedValue midKey = GetSortedKey(mid); - uint32_t midHash = midKey.GetKeyHashCode(); - if (midHash > keyHash) { + JSTaggedValue mid_key = GetSortedKey(mid); + uint32_t mid_hash = mid_key.GetKeyHashCode(); + if (mid_hash > key_hash) { high = mid - 1; - } else if (midHash < keyHash) { + } else if (mid_hash < key_hash) { low = mid + 1; } else { - int32_t sortIndex = GetSortedIndex(mid); - JSTaggedValue currentKey = GetKey(sortIndex); - if (currentKey == key) { - return sortIndex < propertiesNumber ? sortIndex : -1; + int32_t sort_index = GetSortedIndex(mid); + JSTaggedValue current_key = GetKey(sort_index); + if (current_key == key) { + return sort_index < properties_number ? sort_index : -1; } - int32_t midLeft = mid; - int32_t midRight = mid; - while (midLeft - 1 >= 0) { - sortIndex = GetSortedIndex(--midLeft); - currentKey = GetKey(sortIndex); - if (currentKey.GetKeyHashCode() == keyHash) { - if (currentKey == key) { - return sortIndex < propertiesNumber ? sortIndex : -1; + int32_t mid_left = mid; + int32_t mid_right = mid; + while (mid_left - 1 >= 0) { + sort_index = GetSortedIndex(--mid_left); + current_key = GetKey(sort_index); + if (current_key.GetKeyHashCode() == key_hash) { + if (current_key == key) { + return sort_index < properties_number ? sort_index : -1; } } else { break; } } - while (midRight + 1 < elements) { - sortIndex = GetSortedIndex(++midRight); - currentKey = GetKey(sortIndex); - if (currentKey.GetKeyHashCode() == keyHash) { - if (currentKey == key) { - return sortIndex < propertiesNumber ? sortIndex : -1; + while (mid_right + 1 < elements) { + sort_index = GetSortedIndex(++mid_right); + current_key = GetKey(sort_index); + if (current_key.GetKeyHashCode() == key_hash) { + if (current_key == key) { + return sort_index < properties_number ? sort_index : -1; } } else { break; diff --git a/runtime/layout_info.cpp b/runtime/layout_info.cpp index 5271d7a2f..4d28f0c64 100644 --- a/runtime/layout_info.cpp +++ b/runtime/layout_info.cpp @@ -40,74 +40,74 @@ void LayoutInfo::AddKey(const JSThread *thread, [[maybe_unused]] int index, cons SetSortedIndex(thread, insertIndex, number); } -void LayoutInfo::GetAllKeys(const JSThread *thread, int end, int offset, TaggedArray *keyArray) +void LayoutInfo::GetAllKeys(const JSThread *thread, int end, int offset, TaggedArray *key_array) { ASSERT(end <= NumberOfElements()); - ASSERT_PRINT(offset + end <= static_cast(keyArray->GetLength()), - "keyArray capacity is not enough for dictionary"); + ASSERT_PRINT(offset + end <= static_cast(key_array->GetLength()), + "key_array capacity is not enough for dictionary"); - int enumKeys = 0; + int enum_keys = 0; for (int i = 0; i < end; i++) { JSTaggedValue key = GetKey(i); if (key.IsString()) { - keyArray->Set(thread, enumKeys + offset, key); - enumKeys++; + key_array->Set(thread, enum_keys + offset, key); + enum_keys++; } } - if (enumKeys < end) { + if (enum_keys < end) { for (int i = 0; i < end; i++) { JSTaggedValue key = GetKey(i); if (key.IsSymbol()) { - keyArray->Set(thread, enumKeys + offset, key); - enumKeys++; + key_array->Set(thread, enum_keys + offset, key); + enum_keys++; } } } } -void LayoutInfo::GetAllKeys([[maybe_unused]] const JSThread *thread, int end, std::vector &keyVector) +void LayoutInfo::GetAllKeys([[maybe_unused]] const JSThread *thread, int end, std::vector &key_vector) { ASSERT(end <= NumberOfElements()); - int enumKeys = 0; + int enum_keys = 0; for (int i = 0; i < end; i++) { JSTaggedValue key = GetKey(i); if (key.IsString()) { - keyVector.emplace_back(key); - enumKeys++; + key_vector.emplace_back(key); + enum_keys++; } } } -void LayoutInfo::GetAllEnumKeys(const JSThread *thread, int end, int offset, TaggedArray *keyArray, uint32_t *keys) +void LayoutInfo::GetAllEnumKeys(const JSThread *thread, int end, int offset, TaggedArray *key_array, uint32_t *keys) { ASSERT(end <= NumberOfElements()); - ASSERT_PRINT(offset + end <= static_cast(keyArray->GetLength()), - "keyArray capacity is not enough for dictionary"); + ASSERT_PRINT(offset + end <= static_cast(key_array->GetLength()), + "key_array capacity is not enough for dictionary"); - int enumKeys = 0; + int enum_keys = 0; for (int i = 0; i < end; i++) { JSTaggedValue key = GetKey(i); if (key.IsString() && GetAttr(i).IsEnumerable()) { - keyArray->Set(thread, enumKeys + offset, key); - enumKeys++; + key_array->Set(thread, enum_keys + offset, key); + enum_keys++; } } - *keys += enumKeys; + *keys += enum_keys; } -void LayoutInfo::GetAllNames(const JSThread *thread, int end, const JSHandle &keyArray, uint32_t *length) +void LayoutInfo::GetAllNames(const JSThread *thread, int end, const JSHandle &key_array, uint32_t *length) { - int arrayIndex = 0; + int array_index = 0; for (int i = 0; i < end; i++) { JSTaggedValue key = GetKey(i); if (key.IsString()) { PropertyAttributes attr = GetAttr(i); if (attr.IsEnumerable()) { - keyArray->Set(thread, arrayIndex++, key); + key_array->Set(thread, array_index++, key); } } } - *length += arrayIndex; + *length += array_index; } } // namespace panda::ecmascript diff --git a/runtime/layout_info.h b/runtime/layout_info.h index 8ff6e34a7..024c82a94 100644 --- a/runtime/layout_info.h +++ b/runtime/layout_info.h @@ -22,17 +22,17 @@ namespace panda::ecmascript { struct Properties { - JSTaggedValue key_; - JSTaggedValue attr_; + JSTaggedValue key; + JSTaggedValue attr; static constexpr uint32_t GetKeyOffset() { - return MEMBER_OFFSET(Properties, key_); + return MEMBER_OFFSET(Properties, key); } static constexpr uint32_t GetAttrOffset() { - return MEMBER_OFFSET(Properties, attr_); + return MEMBER_OFFSET(Properties, attr); } }; @@ -62,7 +62,7 @@ public: PropertyAttributes GetAttr(int32_t index) const; JSTaggedValue GetSortedKey(int32_t index) const; uint32_t GetSortedIndex(int32_t index) const; - void SetSortedIndex(const JSThread *thread, int32_t index, int32_t sortedIndex); + void SetSortedIndex(const JSThread *thread, int32_t index, int32_t sorted_index); void AddKey(const JSThread *thread, int32_t index, const JSTaggedValue &key, const PropertyAttributes &attr); inline uint32_t GetLength() const @@ -91,13 +91,13 @@ public: return TaggedArray::DATA_OFFSET + ELEMENTS_START_INDEX * JSTaggedValue::TaggedTypeSize(); } - int32_t FindElementWithCache(JSThread *thread, JSHClass *cls, JSTaggedValue key, int32_t propertiesNumber); - int32_t FindElement(JSTaggedValue key, int32_t propertiesNumber); - int32_t BinarySearch(JSTaggedValue key, int32_t propertiesNumber); - void GetAllKeys(const JSThread *thread, int32_t end, int32_t offset, TaggedArray *keyArray); - void GetAllKeys(const JSThread *thread, int32_t end, std::vector &keyVector); - void GetAllEnumKeys(const JSThread *thread, int32_t end, int32_t offset, TaggedArray *keyArray, uint32_t *keys); - void GetAllNames(const JSThread *thread, int32_t end, const JSHandle &keyArray, uint32_t *length); + int32_t FindElementWithCache(JSThread *thread, JSHClass *cls, JSTaggedValue key, int32_t properties_number); + int32_t FindElement(JSTaggedValue key, int32_t properties_number); + int32_t BinarySearch(JSTaggedValue key, int32_t properties_number); + void GetAllKeys(const JSThread *thread, int32_t end, int32_t offset, TaggedArray *key_array); + void GetAllKeys(const JSThread *thread, int32_t end, std::vector &key_vector); + void GetAllEnumKeys(const JSThread *thread, int32_t end, int32_t offset, TaggedArray *key_array, uint32_t *keys); + void GetAllNames(const JSThread *thread, int32_t end, const JSHandle &key_array, uint32_t *length); DECL_DUMP() }; diff --git a/runtime/lexical_env.h b/runtime/lexical_env.h index dfb7cab12..7b532f72f 100644 --- a/runtime/lexical_env.h +++ b/runtime/lexical_env.h @@ -30,9 +30,9 @@ public: return static_cast(object); } - static size_t ComputeSize(uint32_t numSlots) + static size_t ComputeSize(uint32_t num_slots) { - return TaggedArray::ComputeSize(JSTaggedValue::TaggedTypeSize(), numSlots + RESERVED_ENV_LENGTH); + return TaggedArray::ComputeSize(JSTaggedValue::TaggedTypeSize(), num_slots + RESERVED_ENV_LENGTH); } void SetParentEnv(JSThread *thread, JSTaggedValue value) diff --git a/runtime/object_factory-inl.h b/runtime/object_factory-inl.h index 86e98c587..d6c058972 100644 --- a/runtime/object_factory-inl.h +++ b/runtime/object_factory-inl.h @@ -25,57 +25,57 @@ namespace panda::ecmascript { EcmaString *ObjectFactory::AllocNonMovableStringObject(size_t size) { NewObjectHook(); - return reinterpret_cast(heapHelper_.AllocateNonMovableOrHugeObject(stringClass_, size)); + return reinterpret_cast(heap_helper_.AllocateNonMovableOrHugeObject(string_class_, size)); } EcmaString *ObjectFactory::AllocStringObject(size_t size) { NewObjectHook(); - return reinterpret_cast(heapHelper_.AllocateYoungGenerationOrHugeObject(stringClass_, size)); + return reinterpret_cast(heap_helper_.AllocateYoungGenerationOrHugeObject(string_class_, size)); } -JSHandle ObjectFactory::NewJSNativePointer(void *externalPointer, const DeleteEntryPoint &callBack, - void *data, bool nonMovable) +JSHandle ObjectFactory::NewJSNativePointer(void *external_pointer, const DeleteEntryPoint &call_back, + void *data, bool non_movable) { NewObjectHook(); TaggedObject *header; - if (nonMovable) { - header = heapHelper_.AllocateNonMovableOrHugeObject(jsNativePointerClass_); + if (non_movable) { + header = heap_helper_.AllocateNonMovableOrHugeObject(js_native_pointer_class_); } else { - header = heapHelper_.AllocateYoungGenerationOrHugeObject(jsNativePointerClass_); + header = heap_helper_.AllocateYoungGenerationOrHugeObject(js_native_pointer_class_); } JSHandle obj(thread_, header); - obj->SetExternalPointer(externalPointer); - obj->SetDeleter(callBack); + obj->SetExternalPointer(external_pointer); + obj->SetDeleter(call_back); obj->SetData(data); return obj; } -LexicalEnv *ObjectFactory::InlineNewLexicalEnv(int numSlots) +LexicalEnv *ObjectFactory::InlineNewLexicalEnv(int num_slots) { NewObjectHook(); - size_t size = LexicalEnv::ComputeSize(numSlots); - auto header = heapHelper_.AllocateYoungGenerationOrHugeObject(envClass_, size); + size_t size = LexicalEnv::ComputeSize(num_slots); + auto header = heap_helper_.AllocateYoungGenerationOrHugeObject(env_class_, size); if (UNLIKELY(header == nullptr)) { return nullptr; } LexicalEnv *array = LexicalEnv::Cast(header); - array->InitializeWithSpecialValue(JSTaggedValue::Hole(), numSlots + LexicalEnv::RESERVED_ENV_LENGTH); + array->InitializeWithSpecialValue(JSTaggedValue::Hole(), num_slots + LexicalEnv::RESERVED_ENV_LENGTH); return array; } template void ObjectFactory::NewJSIntlIcuData(const JSHandle &obj, const S &icu, const DeleteEntryPoint &callback) { - S *icuPoint = Runtime::GetCurrent()->GetInternalAllocator()->New(icu); - ASSERT(icuPoint != nullptr); + S *icu_point = Runtime::GetCurrent()->GetInternalAllocator()->New(icu); + ASSERT(icu_point != nullptr); JSTaggedValue data = obj->GetIcuField(); if (data.IsHeapObject() && data.IsJSNativePointer()) { JSNativePointer *native = JSNativePointer::Cast(data.GetTaggedObject()); - native->ResetExternalPointer(icuPoint); + native->ResetExternalPointer(icu_point); return; } - JSHandle pointer(thread_, NewJSNativePointer(icuPoint, callback, vm_).GetTaggedValue()); + JSHandle pointer(thread_, NewJSNativePointer(icu_point, callback, vm_).GetTaggedValue()); obj->SetIcuField(thread_, pointer.GetTaggedValue()); // push uint8_t* to ecma array_data_list vm_->PushToArrayDataList(*pointer); diff --git a/runtime/object_factory.cpp b/runtime/object_factory.cpp index e3716c256..7ff26e8c5 100644 --- a/runtime/object_factory.cpp +++ b/runtime/object_factory.cpp @@ -95,7 +95,7 @@ static void PandaFreeBufferFunc([[maybe_unused]] void *buffer, [[maybe_unused]] } ObjectFactory::ObjectFactory(JSThread *thread) - : thread_(thread), heapHelper_(thread->GetEcmaVM()), vm_(thread->GetEcmaVM()) + : thread_(thread), heap_helper_(thread->GetEcmaVM()), vm_(thread->GetEcmaVM()) { } @@ -103,7 +103,7 @@ JSHandle ObjectFactory::NewEcmaDynClassClass(JSHClass *hclass, uint32_ { NewObjectHook(); uint32_t classSize = JSHClass::SIZE; - auto *newClass = static_cast(heapHelper_.AllocateDynClassClass(hclass, classSize)); + auto *newClass = static_cast(heap_helper_.AllocateDynClassClass(hclass, classSize)); newClass->Initialize(thread_, size, type, 0, HClass::HCLASS); return JSHandle(thread_, newClass); @@ -114,7 +114,7 @@ JSHandle ObjectFactory::NewEcmaDynClass(JSHClass *hclass, uint32_t siz { NewObjectHook(); uint32_t classSize = JSHClass::SIZE; - auto *newClass = static_cast(heapHelper_.AllocateNonMovableOrHugeObject(hclass, classSize)); + auto *newClass = static_cast(heap_helper_.AllocateNonMovableOrHugeObject(hclass, classSize)); newClass->Initialize(thread_, size, type, inlinedProps, flags); return JSHandle(thread_, newClass); @@ -122,56 +122,57 @@ JSHandle ObjectFactory::NewEcmaDynClass(JSHClass *hclass, uint32_t siz JSHandle ObjectFactory::NewEcmaDynClass(uint32_t size, JSType type, uint32_t inlinedProps) { - return NewEcmaDynClass(hclassClass_, size, type, 0, inlinedProps); + return NewEcmaDynClass(hclass_class_, size, type, 0, inlinedProps); } void ObjectFactory::ObtainRootClass([[maybe_unused]] const JSHandle &globalEnv) { const GlobalEnvConstants *globalConst = thread_->GlobalConstants(); - hclassClass_ = JSHClass::Cast(globalConst->GetHClassClass().GetTaggedObject()); - stringClass_ = JSHClass::Cast(globalConst->GetStringClass().GetTaggedObject()); - arrayClass_ = JSHClass::Cast(globalConst->GetArrayClass().GetTaggedObject()); - weakArrayClass_ = JSHClass::Cast(globalConst->GetWeakArrayClass().GetTaggedObject()); - dictionaryClass_ = JSHClass::Cast(globalConst->GetDictionaryClass().GetTaggedObject()); - jsNativePointerClass_ = JSHClass::Cast(globalConst->GetJSNativePointerClass().GetTaggedObject()); - freeObjectWithNoneFieldClass_ = JSHClass::Cast(globalConst->GetFreeObjectWithNoneFieldClass().GetTaggedObject()); - freeObjectWithOneFieldClass_ = JSHClass::Cast(globalConst->GetFreeObjectWithOneFieldClass().GetTaggedObject()); - freeObjectWithTwoFieldClass_ = JSHClass::Cast(globalConst->GetFreeObjectWithTwoFieldClass().GetTaggedObject()); - - completionRecordClass_ = JSHClass::Cast(globalConst->GetCompletionRecordClass().GetTaggedObject()); - generatorContextClass_ = JSHClass::Cast(globalConst->GetGeneratorContextClass().GetTaggedObject()); - programClass_ = JSHClass::Cast(globalConst->GetProgramClass().GetTaggedObject()); - ecmaModuleClass_ = JSHClass::Cast(globalConst->GetEcmaModuleClass().GetTaggedObject()); - envClass_ = JSHClass::Cast(globalConst->GetEnvClass().GetTaggedObject()); - symbolClass_ = JSHClass::Cast(globalConst->GetSymbolClass().GetTaggedObject()); - accessorDataClass_ = JSHClass::Cast(globalConst->GetAccessorDataClass().GetTaggedObject()); - internalAccessorClass_ = JSHClass::Cast(globalConst->GetInternalAccessorClass().GetTaggedObject()); - capabilityRecordClass_ = JSHClass::Cast(globalConst->GetCapabilityRecordClass().GetTaggedObject()); - reactionsRecordClass_ = JSHClass::Cast(globalConst->GetReactionsRecordClass().GetTaggedObject()); - promiseIteratorRecordClass_ = JSHClass::Cast(globalConst->GetPromiseIteratorRecordClass().GetTaggedObject()); - microJobQueueClass_ = JSHClass::Cast(globalConst->GetMicroJobQueueClass().GetTaggedObject()); - pendingJobClass_ = JSHClass::Cast(globalConst->GetPendingJobClass().GetTaggedObject()); - jsProxyOrdinaryClass_ = JSHClass::Cast(globalConst->GetJSProxyOrdinaryClass().GetTaggedObject()); - jsProxyCallableClass_ = JSHClass::Cast(globalConst->GetJSProxyCallableClass().GetTaggedObject()); - jsProxyConstructClass_ = JSHClass::Cast(globalConst->GetJSProxyConstructClass().GetTaggedObject()); - objectWrapperClass_ = JSHClass::Cast(globalConst->GetObjectWrapperClass().GetTaggedObject()); - PropertyBoxClass_ = JSHClass::Cast(globalConst->GetPropertyBoxClass().GetTaggedObject()); - protoChangeMarkerClass_ = JSHClass::Cast(globalConst->GetProtoChangeMarkerClass().GetTaggedObject()); - protoChangeDetailsClass_ = JSHClass::Cast(globalConst->GetProtoChangeDetailsClass().GetTaggedObject()); - promiseRecordClass_ = JSHClass::Cast(globalConst->GetPromiseRecordClass().GetTaggedObject()); - promiseResolvingFunctionsRecord_ = + hclass_class_ = JSHClass::Cast(globalConst->GetHClassClass().GetTaggedObject()); + string_class_ = JSHClass::Cast(globalConst->GetStringClass().GetTaggedObject()); + array_class_ = JSHClass::Cast(globalConst->GetArrayClass().GetTaggedObject()); + weak_array_class_ = JSHClass::Cast(globalConst->GetWeakArrayClass().GetTaggedObject()); + dictionary_class_ = JSHClass::Cast(globalConst->GetDictionaryClass().GetTaggedObject()); + js_native_pointer_class_ = JSHClass::Cast(globalConst->GetJSNativePointerClass().GetTaggedObject()); + free_object_with_one_field_class_ = + JSHClass::Cast(globalConst->GetFreeObjectWithNoneFieldClass().GetTaggedObject()); + free_object_with_two_field_class_ = JSHClass::Cast(globalConst->GetFreeObjectWithOneFieldClass().GetTaggedObject()); + free_object_with_two_field_class_ = JSHClass::Cast(globalConst->GetFreeObjectWithTwoFieldClass().GetTaggedObject()); + + completion_record_class_ = JSHClass::Cast(globalConst->GetCompletionRecordClass().GetTaggedObject()); + generator_context_class_ = JSHClass::Cast(globalConst->GetGeneratorContextClass().GetTaggedObject()); + program_class_ = JSHClass::Cast(globalConst->GetProgramClass().GetTaggedObject()); + ecma_module_class_ = JSHClass::Cast(globalConst->GetEcmaModuleClass().GetTaggedObject()); + env_class_ = JSHClass::Cast(globalConst->GetEnvClass().GetTaggedObject()); + symbol_class_ = JSHClass::Cast(globalConst->GetSymbolClass().GetTaggedObject()); + accessor_data_class_ = JSHClass::Cast(globalConst->GetAccessorDataClass().GetTaggedObject()); + internal_accessor_class_ = JSHClass::Cast(globalConst->GetInternalAccessorClass().GetTaggedObject()); + capability_record_class_ = JSHClass::Cast(globalConst->GetCapabilityRecordClass().GetTaggedObject()); + reactions_record_class_ = JSHClass::Cast(globalConst->GetReactionsRecordClass().GetTaggedObject()); + promise_iterator_record_class_ = JSHClass::Cast(globalConst->GetPromiseIteratorRecordClass().GetTaggedObject()); + micro_job_queue_class_ = JSHClass::Cast(globalConst->GetMicroJobQueueClass().GetTaggedObject()); + pending_job_class_ = JSHClass::Cast(globalConst->GetPendingJobClass().GetTaggedObject()); + js_proxy_ordinary_class_ = JSHClass::Cast(globalConst->GetJSProxyOrdinaryClass().GetTaggedObject()); + js_proxy_callable_class_ = JSHClass::Cast(globalConst->GetJSProxyCallableClass().GetTaggedObject()); + js_proxy_construct_class_ = JSHClass::Cast(globalConst->GetJSProxyConstructClass().GetTaggedObject()); + object_wrapper_class_ = JSHClass::Cast(globalConst->GetObjectWrapperClass().GetTaggedObject()); + property_box_class_ = JSHClass::Cast(globalConst->GetPropertyBoxClass().GetTaggedObject()); + proto_change_marker_class_ = JSHClass::Cast(globalConst->GetProtoChangeMarkerClass().GetTaggedObject()); + proto_change_details_class_ = JSHClass::Cast(globalConst->GetProtoChangeDetailsClass().GetTaggedObject()); + promise_record_class_ = JSHClass::Cast(globalConst->GetPromiseRecordClass().GetTaggedObject()); + promise_resolving_functions_record_ = JSHClass::Cast(globalConst->GetPromiseResolvingFunctionsRecordClass().GetTaggedObject()); - transitionHandlerClass_ = JSHClass::Cast(globalConst->GetTransitionHandlerClass().GetTaggedObject()); - prototypeHandlerClass_ = JSHClass::Cast(globalConst->GetPrototypeHandlerClass().GetTaggedObject()); - functionExtraInfo_ = JSHClass::Cast(globalConst->GetFunctionExtraInfoClass().GetTaggedObject()); - jsRealmClass_ = JSHClass::Cast(globalConst->GetJSRealmClass().GetTaggedObject()); - classInfoExtractorHClass_ = JSHClass::Cast(globalConst->GetClassInfoExtractorHClass().GetTaggedObject()); + transition_handler_class_ = JSHClass::Cast(globalConst->GetTransitionHandlerClass().GetTaggedObject()); + prototype_handler_class_ = JSHClass::Cast(globalConst->GetPrototypeHandlerClass().GetTaggedObject()); + function_extra_info_ = JSHClass::Cast(globalConst->GetFunctionExtraInfoClass().GetTaggedObject()); + js_realm_class_ = JSHClass::Cast(globalConst->GetJSRealmClass().GetTaggedObject()); + class_info_extractor_h_class_ = JSHClass::Cast(globalConst->GetClassInfoExtractorHClass().GetTaggedObject()); - linkedHashMapClass_ = JSHClass::Cast(globalConst->GetLinkedHashMapClass().GetTaggedObject()); - linkedHashSetClass_ = JSHClass::Cast(globalConst->GetLinkedHashSetClass().GetTaggedObject()); - weakRefClass_ = JSHClass::Cast(globalConst->GetWeakRefClass().GetTaggedObject()); - weakLinkedHashMapClass_ = JSHClass::Cast(globalConst->GetWeakLinkedHashMapClass().GetTaggedObject()); - weakLinkedHashSetClass_ = JSHClass::Cast(globalConst->GetWeakLinkedHashSetClass().GetTaggedObject()); + linked_hash_map_class_ = JSHClass::Cast(globalConst->GetLinkedHashMapClass().GetTaggedObject()); + linked_hash_set_class_ = JSHClass::Cast(globalConst->GetLinkedHashSetClass().GetTaggedObject()); + weak_ref_class_ = JSHClass::Cast(globalConst->GetWeakRefClass().GetTaggedObject()); + weak_linked_hash_map_class_ = JSHClass::Cast(globalConst->GetWeakLinkedHashMapClass().GetTaggedObject()); + weak_linked_hash_set_class_ = JSHClass::Cast(globalConst->GetWeakLinkedHashSetClass().GetTaggedObject()); } void ObjectFactory::InitObjectFields(TaggedObject *object) @@ -309,7 +310,7 @@ JSHandle ObjectFactory::NewEcmaDynClass(uint32_t size, JSType type, co uint32_t flags) { JSHandle newClass = - NewEcmaDynClass(hclassClass_, size, type, flags, JSHClass::DEFAULT_CAPACITY_OF_IN_OBJECTS); + NewEcmaDynClass(hclass_class_, size, type, flags, JSHClass::DEFAULT_CAPACITY_OF_IN_OBJECTS); newClass->SetPrototype(thread_, prototype.GetTaggedValue()); return newClass; } @@ -333,7 +334,7 @@ JSHandle ObjectFactory::CloneProperties(const JSHandle NewObjectHook(); auto klass = old->GetClass(); size_t size = TaggedArray::ComputeSize(JSTaggedValue::TaggedTypeSize(), newLength); - auto header = heapHelper_.AllocateYoungGenerationOrHugeObject(klass, size); + auto header = heap_helper_.AllocateYoungGenerationOrHugeObject(klass, size); JSHandle newArray(thread_, header); newArray->SetLength(newLength); @@ -398,7 +399,7 @@ JSHandle ObjectFactory::CloneProperties(const JSHandle NewObjectHook(); auto klass = old->GetClass(); size_t size = TaggedArray::ComputeSize(JSTaggedValue::TaggedTypeSize(), newLength); - auto header = heapHelper_.AllocateYoungGenerationOrHugeObject(klass, size); + auto header = heap_helper_.AllocateYoungGenerationOrHugeObject(klass, size); JSHandle newArray(thread_, header); newArray->SetLength(newLength); @@ -864,16 +865,16 @@ FreeObject *ObjectFactory::FillFreeObject(uintptr_t address, size_t size, [[mayb FreeObject *object = nullptr; if (size >= FreeObject::SIZE_OFFSET && size < FreeObject::SIZE) { object = reinterpret_cast(address); - object->SetClassWithoutBarrier(freeObjectWithOneFieldClass_); + object->SetClassWithoutBarrier(free_object_with_two_field_class_); object->SetNext(nullptr); } else if (size >= FreeObject::SIZE) { object = reinterpret_cast(address); - object->SetClassWithoutBarrier(freeObjectWithTwoFieldClass_); + object->SetClassWithoutBarrier(free_object_with_two_field_class_); object->SetAvailable(size); object->SetNext(nullptr); } else if (size == FreeObject::NEXT_OFFSET) { object = reinterpret_cast(address); - object->SetClassWithoutBarrier(freeObjectWithNoneFieldClass_); + object->SetClassWithoutBarrier(free_object_with_one_field_class_); } else { LOG_ECMA(DEBUG) << "Fill free object size is smaller"; } @@ -884,7 +885,7 @@ FreeObject *ObjectFactory::FillFreeObject(uintptr_t address, size_t size, [[mayb TaggedObject *ObjectFactory::NewDynObject(const JSHandle &dynclass) { NewObjectHook(); - TaggedObject *header = heapHelper_.AllocateYoungGenerationOrHugeObject(*dynclass); + TaggedObject *header = heap_helper_.AllocateYoungGenerationOrHugeObject(*dynclass); uint32_t inobjPropCount = dynclass->GetInlinedProperties(); if (inobjPropCount > 0) { InitializeExtraProperties(dynclass, header, inobjPropCount); @@ -895,7 +896,7 @@ TaggedObject *ObjectFactory::NewDynObject(const JSHandle &dynclass) TaggedObject *ObjectFactory::NewNonMovableDynObject(const JSHandle &dynclass, int inobjPropCount) { NewObjectHook(); - TaggedObject *header = heapHelper_.AllocateNonMovableOrHugeObject(*dynclass); + TaggedObject *header = heap_helper_.AllocateNonMovableOrHugeObject(*dynclass); if (inobjPropCount > 0) { InitializeExtraProperties(dynclass, header, inobjPropCount); } @@ -1232,7 +1233,7 @@ JSHandle ObjectFactory::NewJSAsyncFuncObject() JSHandle ObjectFactory::NewCompletionRecord(uint8_t type, const JSHandle &value) { NewObjectHook(); - TaggedObject *header = heapHelper_.AllocateYoungGenerationOrHugeObject(completionRecordClass_); + TaggedObject *header = heap_helper_.AllocateYoungGenerationOrHugeObject(completion_record_class_); JSHandle obj(thread_, header); obj->SetType(thread_, JSTaggedValue(static_cast(type))); obj->SetValue(thread_, value.GetTaggedValue()); @@ -1242,7 +1243,7 @@ JSHandle ObjectFactory::NewCompletionRecord(uint8_t type, cons JSHandle ObjectFactory::NewGeneratorContext() { NewObjectHook(); - TaggedObject *header = heapHelper_.AllocateYoungGenerationOrHugeObject(generatorContextClass_); + TaggedObject *header = heap_helper_.AllocateYoungGenerationOrHugeObject(generator_context_class_); JSHandle obj(thread_, header); obj->SetRegsArray(thread_, JSTaggedValue::Undefined()); obj->SetMethod(thread_, JSTaggedValue::Undefined()); @@ -1315,7 +1316,7 @@ JSHandle ObjectFactory::NewGlobalEnv(JSHClass *globalEnvClass) NewObjectHook(); // Note: Global env must be allocated in non-movable heap, since its getters will directly return // the offsets of the properties as the address of Handles. - TaggedObject *header = heapHelper_.AllocateNonMovableOrHugeObject(globalEnvClass); + TaggedObject *header = heap_helper_.AllocateNonMovableOrHugeObject(globalEnvClass); InitObjectFields(header); return JSHandle(thread_, GlobalEnv::Cast(header)); } @@ -1324,7 +1325,7 @@ JSHandle ObjectFactory::NewLexicalEnv(int numSlots) { NewObjectHook(); size_t size = LexicalEnv::ComputeSize(numSlots); - auto header = heapHelper_.AllocateYoungGenerationOrHugeObject(envClass_, size); + auto header = heap_helper_.AllocateYoungGenerationOrHugeObject(env_class_, size); JSHandle array(thread_, header); array->InitializeWithSpecialValue(JSTaggedValue::Undefined(), numSlots + LexicalEnv::RESERVED_ENV_LENGTH); return array; @@ -1333,7 +1334,7 @@ JSHandle ObjectFactory::NewLexicalEnv(int numSlots) JSHandle ObjectFactory::NewJSSymbol() { NewObjectHook(); - TaggedObject *header = heapHelper_.AllocateYoungGenerationOrHugeObject(symbolClass_); + TaggedObject *header = heap_helper_.AllocateYoungGenerationOrHugeObject(symbol_class_); JSHandle obj(thread_, JSSymbol::Cast(header)); obj->SetDescription(thread_, JSTaggedValue::Undefined()); obj->SetFlags(thread_, JSTaggedValue(0)); @@ -1352,7 +1353,7 @@ JSHandle ObjectFactory::NewPrivateSymbol() JSHandle ObjectFactory::NewPrivateNameSymbol(const JSHandle &name) { NewObjectHook(); - TaggedObject *header = heapHelper_.AllocateYoungGenerationOrHugeObject(symbolClass_); + TaggedObject *header = heap_helper_.AllocateYoungGenerationOrHugeObject(symbol_class_); JSHandle obj(thread_, JSSymbol::Cast(header)); obj->SetFlags(thread_, JSTaggedValue(0)); obj->SetPrivateNameSymbol(thread_); @@ -1365,7 +1366,7 @@ JSHandle ObjectFactory::NewPrivateNameSymbol(const JSHandle ObjectFactory::NewWellKnownSymbol(const JSHandle &name) { NewObjectHook(); - TaggedObject *header = heapHelper_.AllocateYoungGenerationOrHugeObject(symbolClass_); + TaggedObject *header = heap_helper_.AllocateYoungGenerationOrHugeObject(symbol_class_); JSHandle obj(thread_, JSSymbol::Cast(header)); obj->SetFlags(thread_, JSTaggedValue(0)); obj->SetWellKnownSymbol(thread_); @@ -1378,7 +1379,7 @@ JSHandle ObjectFactory::NewWellKnownSymbol(const JSHandle ObjectFactory::NewPublicSymbol(const JSHandle &name) { NewObjectHook(); - TaggedObject *header = heapHelper_.AllocateYoungGenerationOrHugeObject(symbolClass_); + TaggedObject *header = heap_helper_.AllocateYoungGenerationOrHugeObject(symbol_class_); JSHandle obj(thread_, JSSymbol::Cast(header)); obj->SetFlags(thread_, JSTaggedValue(0)); obj->SetDescription(thread_, name); @@ -1431,7 +1432,7 @@ JSHandle ObjectFactory::NewSymbolWithTableWithChar(const char *descrip JSHandle ObjectFactory::NewAccessorData() { NewObjectHook(); - TaggedObject *header = heapHelper_.AllocateYoungGenerationOrHugeObject(accessorDataClass_); + TaggedObject *header = heap_helper_.AllocateYoungGenerationOrHugeObject(accessor_data_class_); JSHandle acc(thread_, AccessorData::Cast(header)); acc->SetGetter(thread_, JSTaggedValue::Undefined()); acc->SetSetter(thread_, JSTaggedValue::Undefined()); @@ -1441,7 +1442,7 @@ JSHandle ObjectFactory::NewAccessorData() JSHandle ObjectFactory::NewInternalAccessor(void *setter, void *getter) { NewObjectHook(); - TaggedObject *header = heapHelper_.AllocateNonMovableOrHugeObject(internalAccessorClass_); + TaggedObject *header = heap_helper_.AllocateNonMovableOrHugeObject(internal_accessor_class_); JSHandle obj(thread_, AccessorData::Cast(header)); if (setter != nullptr) { JSHandle setFunc = NewJSNativePointer(setter, nullptr, nullptr, true); @@ -1459,7 +1460,7 @@ JSHandle ObjectFactory::NewInternalAccessor(void *setter, void *ge JSHandle ObjectFactory::NewPromiseCapability() { NewObjectHook(); - TaggedObject *header = heapHelper_.AllocateYoungGenerationOrHugeObject(capabilityRecordClass_); + TaggedObject *header = heap_helper_.AllocateYoungGenerationOrHugeObject(capability_record_class_); JSHandle obj(thread_, header); obj->SetPromise(thread_, JSTaggedValue::Undefined()); obj->SetResolve(thread_, JSTaggedValue::Undefined()); @@ -1470,7 +1471,7 @@ JSHandle ObjectFactory::NewPromiseCapability() JSHandle ObjectFactory::NewPromiseReaction() { NewObjectHook(); - TaggedObject *header = heapHelper_.AllocateYoungGenerationOrHugeObject(reactionsRecordClass_); + TaggedObject *header = heap_helper_.AllocateYoungGenerationOrHugeObject(reactions_record_class_); JSHandle obj(thread_, header); obj->SetPromiseCapability(thread_, JSTaggedValue::Undefined()); obj->SetHandler(thread_, JSTaggedValue::Undefined()); @@ -1482,7 +1483,7 @@ JSHandle ObjectFactory::NewPromiseIteratorRecord(const JS const JSHandle &done) { NewObjectHook(); - TaggedObject *header = heapHelper_.AllocateYoungGenerationOrHugeObject(promiseIteratorRecordClass_); + TaggedObject *header = heap_helper_.AllocateYoungGenerationOrHugeObject(promise_iterator_record_class_); JSHandle obj(thread_, header); obj->SetIterator(thread_, itor.GetTaggedValue()); obj->SetDone(thread_, done.GetTaggedValue()); @@ -1492,7 +1493,7 @@ JSHandle ObjectFactory::NewPromiseIteratorRecord(const JS JSHandle ObjectFactory::NewMicroJobQueue() { NewObjectHook(); - TaggedObject *header = heapHelper_.AllocateNonMovableOrHugeObject(microJobQueueClass_); + TaggedObject *header = heap_helper_.AllocateNonMovableOrHugeObject(micro_job_queue_class_); JSHandle obj(thread_, header); obj->SetPromiseJobQueue(thread_, GetEmptyTaggedQueue().GetTaggedValue()); obj->SetScriptJobQueue(thread_, GetEmptyTaggedQueue().GetTaggedValue()); @@ -1503,7 +1504,7 @@ JSHandle ObjectFactory::NewPendingJob(const JSHandle &argv) { NewObjectHook(); - TaggedObject *header = heapHelper_.AllocateYoungGenerationOrHugeObject(pendingJobClass_); + TaggedObject *header = heap_helper_.AllocateYoungGenerationOrHugeObject(pending_job_class_); JSHandle obj(thread_, header); obj->SetJob(thread_, func.GetTaggedValue()); obj->SetArguments(thread_, argv.GetTaggedValue()); @@ -1515,7 +1516,7 @@ JSHandle ObjectFactory::NewFunctionExtraInfo(const JSHandle const JSHandle &data) { NewObjectHook(); - TaggedObject *header = heapHelper_.AllocateYoungGenerationOrHugeObject(functionExtraInfo_); + TaggedObject *header = heap_helper_.AllocateYoungGenerationOrHugeObject(function_extra_info_); JSHandle obj(thread_, header); obj->SetCallback(thread_, callBack.GetTaggedValue()); obj->SetVm(thread_, vm.GetTaggedValue()); @@ -1529,10 +1530,10 @@ JSHandle ObjectFactory::NewJSProxy(const JSHandle &targe NewObjectHook(); TaggedObject *header = nullptr; if (target->IsCallable()) { - header = target->IsConstructor() ? heapHelper_.AllocateYoungGenerationOrHugeObject(jsProxyConstructClass_) - : heapHelper_.AllocateYoungGenerationOrHugeObject(jsProxyCallableClass_); + header = target->IsConstructor() ? heap_helper_.AllocateYoungGenerationOrHugeObject(js_proxy_construct_class_) + : heap_helper_.AllocateYoungGenerationOrHugeObject(js_proxy_callable_class_); } else { - header = heapHelper_.AllocateYoungGenerationOrHugeObject(jsProxyOrdinaryClass_); + header = heap_helper_.AllocateYoungGenerationOrHugeObject(js_proxy_ordinary_class_); } JSHandle proxy(thread_, header); @@ -1551,7 +1552,7 @@ JSHandle ObjectFactory::NewJSProxy(const JSHandle &targe JSHandle ObjectFactory::NewJSRealm() { JSHandle env = vm_->GetGlobalEnv(); - JSHandle realmEnvClass = NewEcmaDynClass(hclassClass_, GlobalEnv::SIZE, JSType::GLOBAL_ENV); + JSHandle realmEnvClass = NewEcmaDynClass(hclass_class_, GlobalEnv::SIZE, JSType::GLOBAL_ENV); JSHandle realmEnvHandle = NewGlobalEnv(*realmEnvClass); ObtainRootClass(env); @@ -1580,7 +1581,8 @@ JSHandle ObjectFactory::NewJSRealm() JSHandle ObjectFactory::NewEmptyArray(bool weak) { NewObjectHook(); - auto header = heapHelper_.AllocateNonMovableOrHugeObject(weak ? weakArrayClass_ : arrayClass_, TaggedArray::SIZE); + auto header = + heap_helper_.AllocateNonMovableOrHugeObject(weak ? weak_array_class_ : array_class_, TaggedArray::SIZE); JSHandle array(thread_, header); array->SetLength(0); return array; @@ -1596,9 +1598,9 @@ JSHandle ObjectFactory::NewTaggedArray(uint32_t length, JSTaggedVal size_t size = TaggedArray::ComputeSize(JSTaggedValue::TaggedTypeSize(), length); TaggedObject *header = nullptr; if (nonMovable) { - header = heapHelper_.AllocateNonMovableOrHugeObject(arrayClass_, size); + header = heap_helper_.AllocateNonMovableOrHugeObject(array_class_, size); } else { - header = heapHelper_.AllocateYoungGenerationOrHugeObject(arrayClass_, size); + header = heap_helper_.AllocateYoungGenerationOrHugeObject(array_class_, size); } JSHandle array(thread_, header); @@ -1627,7 +1629,7 @@ JSHandle ObjectFactory::NewTaggedArrayImpl(uint32_t length, JSTagge ASSERT(!initVal.IsHeapObject()); size_t size = TaggedArray::ComputeSize(JSTaggedValue::TaggedTypeSize(), length); - auto header = heapHelper_.AllocateYoungGenerationOrHugeObject(weak ? weakArrayClass_ : arrayClass_, size); + auto header = heap_helper_.AllocateYoungGenerationOrHugeObject(weak ? weak_array_class_ : array_class_, size); JSHandle array(thread_, header); // TODO(audovichenko): Remove this suppression when CSA gets recognize primitive TaggedValue (issue #I5QOJX) // SUPPRESS_CSA_NEXTLINE(alpha.core.WasteObjHeader) @@ -1641,27 +1643,27 @@ JSHandle ObjectFactory::NewDictionaryArray(uint32_t length) ASSERT(length > 0); size_t size = TaggedArray::ComputeSize(JSTaggedValue::TaggedTypeSize(), length); - auto header = heapHelper_.AllocateYoungGenerationOrHugeObject(dictionaryClass_, size); + auto header = heap_helper_.AllocateYoungGenerationOrHugeObject(dictionary_class_, size); JSHandle array(thread_, header); array->InitializeWithSpecialValue(JSTaggedValue::Undefined(), length); return array; } -JSHandle ObjectFactory::NewLinkedHashTable(array_size_t length, JSType tableType, bool isWeak) +JSHandle ObjectFactory::NewLinkedHashTable(ArraySizeT length, JSType tableType, bool isWeak) { NewObjectHook(); ASSERT(length > 0); size_t size = TaggedArray::ComputeSize(JSTaggedValue::TaggedTypeSize(), length); JSHClass *tableClass = nullptr; if (tableType == JSType::LINKED_HASH_MAP) { - tableClass = isWeak ? weakLinkedHashMapClass_ : linkedHashMapClass_; + tableClass = isWeak ? weak_linked_hash_map_class_ : linked_hash_map_class_; } else if (tableType == JSType::LINKED_HASH_SET) { - tableClass = isWeak ? weakLinkedHashSetClass_ : linkedHashSetClass_; + tableClass = isWeak ? weak_linked_hash_set_class_ : linked_hash_set_class_; } else { - tableClass = arrayClass_; + tableClass = array_class_; } - auto header = heapHelper_.AllocateYoungGenerationOrHugeObject(tableClass, size); + auto header = heap_helper_.AllocateYoungGenerationOrHugeObject(tableClass, size); JSHandle array(thread_, header); array->InitializeWithSpecialValue(JSTaggedValue::Hole(), length); return array; @@ -1674,7 +1676,7 @@ JSHandle ObjectFactory::ExtendArray(const JSHandle &ol ASSERT(length > old->GetLength()); NewObjectHook(); size_t size = TaggedArray::ComputeSize(JSTaggedValue::TaggedTypeSize(), length); - auto header = heapHelper_.AllocateYoungGenerationOrHugeObject(weak ? weakArrayClass_ : arrayClass_, size); + auto header = heap_helper_.AllocateYoungGenerationOrHugeObject(weak ? weak_array_class_ : array_class_, size); JSHandle newArray(thread_, header); newArray->SetLength(length); @@ -1704,7 +1706,7 @@ JSHandle ObjectFactory::CopyPartArray(const JSHandle & NewObjectHook(); size_t size = TaggedArray::ComputeSize(JSTaggedValue::TaggedTypeSize(), newLength); - auto header = heapHelper_.AllocateYoungGenerationOrHugeObject(weak ? weakArrayClass_ : arrayClass_, size); + auto header = heap_helper_.AllocateYoungGenerationOrHugeObject(weak ? weak_array_class_ : array_class_, size); JSHandle newArray(thread_, header); newArray->SetLength(newLength); @@ -1731,7 +1733,7 @@ JSHandle ObjectFactory::CopyArray(const JSHandle &old, NewObjectHook(); size_t size = TaggedArray::ComputeSize(JSTaggedValue::TaggedTypeSize(), newLength); - auto header = heapHelper_.AllocateYoungGenerationOrHugeObject(weak ? weakArrayClass_ : arrayClass_, size); + auto header = heap_helper_.AllocateYoungGenerationOrHugeObject(weak ? weak_array_class_ : array_class_, size); JSHandle newArray(thread_, header); newArray->SetLength(newLength); @@ -1772,7 +1774,7 @@ JSHandle ObjectFactory::CopyAndReSort(const JSHandle &ol Span sp(old->GetProperties(), end); int i = 0; for (; i < end; i++) { - newArr->AddKey(thread_, i, sp[i].key_, PropertyAttributes(sp[i].attr_)); + newArr->AddKey(thread_, i, sp[i].key, PropertyAttributes(sp[i].attr)); } return newArr; @@ -1785,7 +1787,7 @@ JSHandle ObjectFactory::NewConstantPool(uint32_t capacity) return JSHandle::Cast(EmptyArray()); } size_t size = TaggedArray::ComputeSize(JSTaggedValue::TaggedTypeSize(), capacity); - auto header = heapHelper_.AllocateNonMovableOrHugeObject(arrayClass_, size); + auto header = heap_helper_.AllocateNonMovableOrHugeObject(array_class_, size); JSHandle array(thread_, header); array->InitializeWithSpecialValue(JSTaggedValue::Undefined(), capacity); return array; @@ -1794,7 +1796,7 @@ JSHandle ObjectFactory::NewConstantPool(uint32_t capacity) JSHandle ObjectFactory::NewProgram() { NewObjectHook(); - TaggedObject *header = heapHelper_.AllocateNonMovableOrHugeObject(programClass_); + TaggedObject *header = heap_helper_.AllocateNonMovableOrHugeObject(program_class_); JSHandle p(thread_, header); p->SetLocation(thread_, JSTaggedValue::Undefined()); p->SetConstantPool(thread_, JSTaggedValue::Undefined()); @@ -1806,7 +1808,7 @@ JSHandle ObjectFactory::NewProgram() JSHandle ObjectFactory::NewEmptyEcmaModule() { NewObjectHook(); - TaggedObject *header = heapHelper_.AllocateYoungGenerationOrHugeObject(ecmaModuleClass_); + TaggedObject *header = heap_helper_.AllocateYoungGenerationOrHugeObject(ecma_module_class_); JSHandle module(thread_, header); module->SetNameDictionary(thread_, JSTaggedValue::Undefined()); return module; @@ -1832,7 +1834,7 @@ JSHandle ObjectFactory::EmptyWeakArray() const JSHandle ObjectFactory::NewObjectWrapper(const JSHandle &value) { NewObjectHook(); - TaggedObject *header = heapHelper_.AllocateYoungGenerationOrHugeObject(objectWrapperClass_); + TaggedObject *header = heap_helper_.AllocateYoungGenerationOrHugeObject(object_wrapper_class_); ObjectWrapper *obj = ObjectWrapper::Cast(header); obj->SetValue(thread_, value); return JSHandle(thread_, obj); @@ -1891,7 +1893,7 @@ EcmaString *ObjectFactory::GetRawStringFromStringTable(const uint8_t *mutf8Data, JSHandle ObjectFactory::NewPropertyBox(const JSHandle &value) { NewObjectHook(); - TaggedObject *header = heapHelper_.AllocateNonMovableOrHugeObject(PropertyBoxClass_); + TaggedObject *header = heap_helper_.AllocateNonMovableOrHugeObject(property_box_class_); JSHandle box(thread_, header); box->SetValue(thread_, value); return box; @@ -1900,7 +1902,7 @@ JSHandle ObjectFactory::NewPropertyBox(const JSHandle ObjectFactory::NewProtoChangeMarker() { NewObjectHook(); - TaggedObject *header = heapHelper_.AllocateYoungGenerationOrHugeObject(protoChangeMarkerClass_); + TaggedObject *header = heap_helper_.AllocateYoungGenerationOrHugeObject(proto_change_marker_class_); JSHandle marker(thread_, header); marker->SetHasChanged(false); return marker; @@ -1909,7 +1911,7 @@ JSHandle ObjectFactory::NewProtoChangeMarker() JSHandle ObjectFactory::NewProtoChangeDetails() { NewObjectHook(); - TaggedObject *header = heapHelper_.AllocateYoungGenerationOrHugeObject(protoChangeDetailsClass_); + TaggedObject *header = heap_helper_.AllocateYoungGenerationOrHugeObject(proto_change_details_class_); JSHandle protoInfo(thread_, header); protoInfo->SetChangeListener(thread_, JSTaggedValue(0)); protoInfo->SetRegisterIndex(thread_, JSTaggedValue(ProtoChangeDetails::UNREGISTERED)); @@ -1922,7 +1924,7 @@ JSHandle ObjectFactory::NewProfileTypeInfo(uint32_t length) ASSERT(length > 0); size_t size = TaggedArray::ComputeSize(JSTaggedValue::TaggedTypeSize(), length); - auto header = heapHelper_.AllocateNonMovableOrHugeObject(weakArrayClass_, size); + auto header = heap_helper_.AllocateNonMovableOrHugeObject(weak_array_class_, size); JSHandle array(thread_, header); array->InitializeWithSpecialValue(JSTaggedValue::Undefined(), length); @@ -1951,7 +1953,7 @@ JSHandle ObjectFactory::GetEmptyTaggedQueue() const JSHandle ObjectFactory::NewWeakRef(const JSHandle &referent) { - auto header = heapHelper_.AllocateYoungGenerationOrHugeObject(weakRefClass_); + auto header = heap_helper_.AllocateYoungGenerationOrHugeObject(weak_ref_class_); if (header == nullptr) { return JSHandle(); } @@ -2095,7 +2097,7 @@ JSHandle ObjectFactory::NewTransitionHandler() { NewObjectHook(); TransitionHandler *handler = - TransitionHandler::Cast(heapHelper_.AllocateYoungGenerationOrHugeObject(transitionHandlerClass_)); + TransitionHandler::Cast(heap_helper_.AllocateYoungGenerationOrHugeObject(transition_handler_class_)); return JSHandle(thread_, handler); } @@ -2103,7 +2105,7 @@ JSHandle ObjectFactory::NewPrototypeHandler() { NewObjectHook(); PrototypeHandler *header = - PrototypeHandler::Cast(heapHelper_.AllocateYoungGenerationOrHugeObject(prototypeHandlerClass_)); + PrototypeHandler::Cast(heap_helper_.AllocateYoungGenerationOrHugeObject(prototype_handler_class_)); JSHandle handler(thread_, header); handler->SetHandlerInfo(thread_, JSTaggedValue::Undefined()); handler->SetProtoCell(thread_, JSTaggedValue::Undefined()); @@ -2114,7 +2116,7 @@ JSHandle ObjectFactory::NewPrototypeHandler() JSHandle ObjectFactory::NewPromiseRecord() { NewObjectHook(); - TaggedObject *header = heapHelper_.AllocateYoungGenerationOrHugeObject(promiseRecordClass_); + TaggedObject *header = heap_helper_.AllocateYoungGenerationOrHugeObject(promise_record_class_); JSHandle obj(thread_, header); obj->SetValue(thread_, JSTaggedValue::Undefined()); return obj; @@ -2123,7 +2125,7 @@ JSHandle ObjectFactory::NewPromiseRecord() JSHandle ObjectFactory::NewResolvingFunctionsRecord() { NewObjectHook(); - TaggedObject *header = heapHelper_.AllocateYoungGenerationOrHugeObject(promiseResolvingFunctionsRecord_); + TaggedObject *header = heap_helper_.AllocateYoungGenerationOrHugeObject(promise_resolving_functions_record_); JSHandle obj(thread_, header); obj->SetResolveFunction(thread_, JSTaggedValue::Undefined()); obj->SetRejectFunction(thread_, JSTaggedValue::Undefined()); @@ -2192,7 +2194,7 @@ EcmaString *ObjectFactory::ResolveString(uint32_t stringId) JSHandle ObjectFactory::NewClassInfoExtractor(JSMethod *ctorMethod) { NewObjectHook(); - TaggedObject *header = heapHelper_.AllocateYoungGenerationOrHugeObject(classInfoExtractorHClass_); + TaggedObject *header = heap_helper_.AllocateYoungGenerationOrHugeObject(class_info_extractor_h_class_); JSHandle obj(thread_, header); obj->InitializeBitField(); obj->SetConstructorMethod(ctorMethod); diff --git a/runtime/object_factory.h b/runtime/object_factory.h index 0387b981e..c3e885987 100644 --- a/runtime/object_factory.h +++ b/runtime/object_factory.h @@ -118,9 +118,9 @@ public: JSHandle NewProgram(); JSHandle NewEmptyEcmaModule(); - JSHandle GetJSError(const ErrorType &errorType, const char *data = nullptr); + JSHandle GetJSError(const ErrorType &error_type, const char *data = nullptr); - JSHandle NewJSError(const ErrorType &errorType, const JSHandle &message); + JSHandle NewJSError(const ErrorType &error_type, const JSHandle &message); JSHandle NewTransitionHandler(); @@ -130,40 +130,40 @@ public: // use for others create, prototype is Function.prototype // use for native function - JSHandle NewJSFunction(const JSHandle &env, const void *nativeFunc = nullptr, + JSHandle NewJSFunction(const JSHandle &env, const void *native_func = nullptr, FunctionKind kind = FunctionKind::NORMAL_FUNCTION); // use for method JSHandle NewJSFunction(const JSHandle &env, JSMethod *method, FunctionKind kind = FunctionKind::NORMAL_FUNCTION); - JSHandle NewJSNativeErrorFunction(const JSHandle &env, const void *nativeFunc = nullptr); + JSHandle NewJSNativeErrorFunction(const JSHandle &env, const void *native_func = nullptr); JSHandle NewSpecificTypedArrayFunction(const JSHandle &env, - const void *nativeFunc = nullptr); + const void *native_func = nullptr); JSHandle OrdinaryNewJSObjectCreate(const JSHandle &proto); JSHandle NewJSBoundFunction(const JSHandle &target, - const JSHandle &boundThis, + const JSHandle &bound_this, const JSHandle &args); - JSHandle NewJSIntlBoundFunction(const void *nativeFunc = nullptr, int functionLength = 1); + JSHandle NewJSIntlBoundFunction(const void *native_func = nullptr, int function_length = 1); JSHandle NewJSProxyRevocFunction(const JSHandle &proxy, - const void *nativeFunc = nullptr); + const void *native_func = nullptr); - JSHandle NewJSAsyncAwaitStatusFunction(const void *nativeFunc); - JSHandle NewJSAsyncGeneratorResolveNextFunction(const void *nativeFunc); + JSHandle NewJSAsyncAwaitStatusFunction(const void *native_func); + JSHandle NewJSAsyncGeneratorResolveNextFunction(const void *native_func); JSHandle NewJSAsyncFromSyncIteratorValueUnwrapFunction( - const void *nativeFunc); + const void *native_func); JSHandle NewJSGeneratorFunction(JSMethod *method); JSHandle NewJSAsyncGeneratorFunction(JSMethod *method); JSHandle NewAsyncFunction(JSMethod *method); - JSHandle NewJSGeneratorObject(JSHandle generatorFunction); - JSHandle NewJSAsyncGeneratorObject(JSHandle generatorFunction); + JSHandle NewJSGeneratorObject(JSHandle generator_function); + JSHandle NewJSAsyncGeneratorObject(JSHandle generator_function); JSHandle NewJSAsyncFromSyncIteratorObject(); JSHandle NewJSAsyncFuncObject(); @@ -173,12 +173,12 @@ public: JSHandle NewJSPrimitiveRef(PrimitiveType type, const JSHandle &object); // get JSHClass for Ecma ClassLinker - JSHandle NewGlobalEnv(JSHClass *globalEnvClass); + JSHandle NewGlobalEnv(JSHClass *global_env_class); // get JSHClass for Ecma ClassLinker - JSHandle NewLexicalEnv(int numSlots); + JSHandle NewLexicalEnv(int num_slots); - inline LexicalEnv *InlineNewLexicalEnv(int numSlots); + inline LexicalEnv *InlineNewLexicalEnv(int num_slots); JSHandle NewJSSymbol(); @@ -218,7 +218,7 @@ public: JSHandle NewPendingJob(const JSHandle &func, const JSHandle &argv); - JSHandle NewFunctionExtraInfo(const JSHandle &callBack, + JSHandle NewFunctionExtraInfo(const JSHandle &call_back, const JSHandle &vm, const JSHandle &data); @@ -231,14 +231,14 @@ public: JSHandle NewJSString(const JSHandle &str); - JSHandle NewTaggedArray(uint32_t length, JSTaggedValue initVal = JSTaggedValue::Hole()); - JSHandle NewTaggedArray(uint32_t length, JSTaggedValue initVal, bool nonMovable); - JSHandle NewWeakTaggedArray(uint32_t length, JSTaggedValue initVal = JSTaggedValue::Hole()); + JSHandle NewTaggedArray(uint32_t length, JSTaggedValue init_val = JSTaggedValue::Hole()); + JSHandle NewTaggedArray(uint32_t length, JSTaggedValue init_val, bool non_movable); + JSHandle NewWeakTaggedArray(uint32_t length, JSTaggedValue init_val = JSTaggedValue::Hole()); JSHandle NewDictionaryArray(uint32_t length); JSHandle NewJSForinIterator(const JSHandle &obj); - JSHandle NewLinkedHashTable(array_size_t length, JSType tableType, bool isWeak); + JSHandle NewLinkedHashTable(ArraySizeT length, JSType table_type, bool is_weak); JSHandle NewPropertyBox(const JSHandle &value); JSHandle NewProtoChangeMarker(); @@ -247,18 +247,18 @@ public: // use for copy properties keys's array to another array JSHandle ExtendArray(const JSHandle &old, uint32_t length, - JSTaggedValue initVal = JSTaggedValue::Hole()); + JSTaggedValue init_val = JSTaggedValue::Hole()); JSHandle CopyPartArray(const JSHandle &old, uint32_t start, uint32_t end); - JSHandle CopyArray(const JSHandle &old, uint32_t oldLength, uint32_t newLength, - JSTaggedValue initVal = JSTaggedValue::Hole()); + JSHandle CopyArray(const JSHandle &old, uint32_t old_length, uint32_t new_length, + JSTaggedValue init_val = JSTaggedValue::Hole()); JSHandle CloneProperties(const JSHandle &old); JSHandle CloneProperties(const JSHandle &old, const JSHandle &env, const JSHandle &obj, const JSHandle &constpool); - JSHandle CreateLayoutInfo(int properties, JSTaggedValue initVal = JSTaggedValue::Hole()); + JSHandle CreateLayoutInfo(int properties, JSTaggedValue init_val = JSTaggedValue::Hole()); JSHandle ExtendLayoutInfo(const JSHandle &old, int properties, - JSTaggedValue initVal = JSTaggedValue::Hole()); + JSTaggedValue init_val = JSTaggedValue::Hole()); JSHandle CopyLayoutInfo(const JSHandle &old); @@ -271,13 +271,13 @@ public: JSHandle NewObjectWrapper(const JSHandle &value); - FreeObject *FillFreeObject(uintptr_t address, size_t size, RemoveSlots removeSlots = RemoveSlots::NO); + FreeObject *FillFreeObject(uintptr_t address, size_t size, RemoveSlots remove_slots = RemoveSlots::NO); TaggedObject *NewDynObject(const JSHandle &dynclass); - TaggedObject *NewNonMovableDynObject(const JSHandle &dynclass, int inobjPropCount = 0); + TaggedObject *NewNonMovableDynObject(const JSHandle &dynclass, int inobj_prop_count = 0); - void InitializeExtraProperties(const JSHandle &dynclass, TaggedObject *obj, int inobjPropCount); + void InitializeExtraProperties(const JSHandle &dynclass, TaggedObject *obj, int inobj_prop_count); JSHandle NewTaggedQueue(uint32_t length); @@ -298,22 +298,22 @@ public: JSHandle NewGeneratorContext(); - JSHandle CreateJSPromiseReactionsFunction(const void *nativeFunc); + JSHandle CreateJSPromiseReactionsFunction(const void *native_func); - JSHandle CreateJSPromiseExecutorFunction(const void *nativeFunc); + JSHandle CreateJSPromiseExecutorFunction(const void *native_func); JSHandle CreateBuiltinFunction(EcmaEntrypoint steps, uint8_t length, JSHandle name, JSHandle proto, JSHandle prefix); - JSHandle NewJSPromiseAllResolveElementFunction(const void *nativeFunc); + JSHandle NewJSPromiseAllResolveElementFunction(const void *native_func); JSHandle CloneObjectLiteral(JSHandle object, const JSHandle &env, - const JSHandle &constpool, bool canShareHClass = true); + const JSHandle &constpool, bool can_share_h_class = true); JSHandle CloneObjectLiteral(JSHandle object); JSHandle CloneArrayLiteral(JSHandle object); JSHandle CloneJSFuction(JSHandle obj, FunctionKind kind); JSHandle CloneClassCtor(JSHandle ctor, const JSHandle &lexenv, - bool canShareHClass); + bool can_share_h_class); void NewJSArrayBufferData(const JSHandle &array, int32_t length); @@ -331,29 +331,29 @@ public: EcmaString *InternString(const JSHandle &key); - inline JSHandle NewJSNativePointer(void *externalPointer, - const DeleteEntryPoint &callBack = nullptr, - void *data = nullptr, bool nonMovable = false); + inline JSHandle NewJSNativePointer(void *external_pointer, + const DeleteEntryPoint &call_back = nullptr, + void *data = nullptr, bool non_movable = false); JSHandle NewJSObjectByClass(const JSHandle &properties, size_t length); // only use for creating Function.prototype and Function JSHandle NewJSFunctionByDynClass(JSMethod *method, const JSHandle &clazz, FunctionKind kind = FunctionKind::NORMAL_FUNCTION); - EcmaString *ResolveString(uint32_t stringId); + EcmaString *ResolveString(uint32_t string_id); - void ObtainRootClass(const JSHandle &globalEnv); + void ObtainRootClass(const JSHandle &global_env); const MemManager &GetHeapManager() const { - return heapHelper_; + return heap_helper_; } // used for creating jsobject by constructor JSHandle NewJSObjectByConstructor(const JSHandle &constructor, - const JSHandle &newTarget); + const JSHandle &new_target); - JSHandle NewClassInfoExtractor(JSMethod *ctorMethod); + JSHandle NewClassInfoExtractor(JSMethod *ctor_method); ~ObjectFactory() = default; @@ -362,19 +362,20 @@ public: JSHandle NewFromCanBeCompressString(const PandaString &data); JSHandle NewFromStdString(const std::string &data); - JSHandle NewFromStdStringUnCheck(const std::string &data, bool canBeCompress); + JSHandle NewFromStdStringUnCheck(const std::string &data, bool can_be_compress); - JSHandle NewFromUtf8(const uint8_t *utf8Data, uint32_t utf8Len); - JSHandle NewFromUtf8UnCheck(const uint8_t *utf8Data, uint32_t utf8Len, bool canBeCompress); + JSHandle NewFromUtf8(const uint8_t *utf8_data, uint32_t utf8_len); + JSHandle NewFromUtf8UnCheck(const uint8_t *utf8_data, uint32_t utf8_len, bool can_be_compress); - JSHandle NewFromUtf16(const uint16_t *utf16Data, uint32_t utf16Len); - JSHandle NewFromUtf16UnCheck(const uint16_t *utf16Data, uint32_t utf16Len, bool canBeCompress); + JSHandle NewFromUtf16(const uint16_t *utf16_data, uint32_t utf16_len); + JSHandle NewFromUtf16UnCheck(const uint16_t *utf16_data, uint32_t utf16_len, bool can_be_compress); - JSHandle NewFromUtf8Literal(const uint8_t *utf8Data, uint32_t utf8Len); - JSHandle NewFromUtf8LiteralUnCheck(const uint8_t *utf8Data, uint32_t utf8Len, bool canBeCompress); + JSHandle NewFromUtf8Literal(const uint8_t *utf8_data, uint32_t utf8_len); + JSHandle NewFromUtf8LiteralUnCheck(const uint8_t *utf8_data, uint32_t utf8_len, bool can_be_compress); - JSHandle NewFromUtf16Literal(const uint16_t *utf16Data, uint32_t utf16Len); - JSHandle NewFromUtf16LiteralUnCheck(const uint16_t *utf16Data, uint32_t utf16Len, bool canBeCompress); + JSHandle NewFromUtf16Literal(const uint16_t *utf16_data, uint32_t utf16_len); + JSHandle NewFromUtf16LiteralUnCheck(const uint16_t *utf16_data, uint32_t utf16_len, + bool can_be_compress); JSHandle NewFromString(EcmaString *str); JSHandle ConcatFromString(const JSHandle &prefix, const JSHandle &suffix); @@ -384,7 +385,7 @@ public: // used for creating jshclass in GlobalEnv, EcmaVM JSHandle NewEcmaDynClass(JSHClass *hclass, uint32_t size, JSType type, uint32_t flags = 0, - uint32_t inlinedProps = JSHClass::DEFAULT_CAPACITY_OF_IN_OBJECTS); + uint32_t inlined_props = JSHClass::DEFAULT_CAPACITY_OF_IN_OBJECTS); // used for creating jshclass in Builtins, Function, Class_Linker JSHandle NewEcmaDynClass(uint32_t size, JSType type, const JSHandle &prototype, @@ -392,11 +393,11 @@ public: void SetTriggerGc(bool status) { - isTriggerGc_ = status; + is_trigger_gc_ = status; } private: - JSHandle NewTaggedArrayImpl(uint32_t length, JSTaggedValue initVal, bool weak); + JSHandle NewTaggedArrayImpl(uint32_t length, JSTaggedValue init_val, bool weak); friend class GlobalEnv; friend class GlobalEnvConstants; @@ -406,52 +407,52 @@ private: void InitObjectFields(TaggedObject *object); JSThread *thread_ {nullptr}; - bool isTriggerGc_ {false}; - bool triggerSemiGC_ {false}; - MemManager heapHelper_; - - JSHClass *hclassClass_ {nullptr}; - JSHClass *stringClass_ {nullptr}; - JSHClass *arrayClass_ {nullptr}; - JSHClass *weakArrayClass_ {nullptr}; - JSHClass *dictionaryClass_ {nullptr}; - JSHClass *freeObjectWithNoneFieldClass_ {nullptr}; - JSHClass *freeObjectWithOneFieldClass_ {nullptr}; - JSHClass *freeObjectWithTwoFieldClass_ {nullptr}; - - JSHClass *completionRecordClass_ {nullptr}; - JSHClass *generatorContextClass_ {nullptr}; - JSHClass *envClass_ {nullptr}; - JSHClass *symbolClass_ {nullptr}; - JSHClass *accessorDataClass_ {nullptr}; - JSHClass *internalAccessorClass_ {nullptr}; - JSHClass *capabilityRecordClass_ {nullptr}; - JSHClass *reactionsRecordClass_ {nullptr}; - JSHClass *promiseIteratorRecordClass_ {nullptr}; - JSHClass *microJobQueueClass_ {nullptr}; - JSHClass *pendingJobClass_ {nullptr}; - JSHClass *jsProxyOrdinaryClass_ {nullptr}; - JSHClass *jsProxyCallableClass_ {nullptr}; - JSHClass *jsProxyConstructClass_ {nullptr}; - JSHClass *objectWrapperClass_ {nullptr}; - JSHClass *PropertyBoxClass_ {nullptr}; - JSHClass *protoChangeDetailsClass_ {nullptr}; - JSHClass *protoChangeMarkerClass_ {nullptr}; - JSHClass *promiseRecordClass_ {nullptr}; - JSHClass *promiseResolvingFunctionsRecord_ {nullptr}; - JSHClass *jsNativePointerClass_ {nullptr}; - JSHClass *transitionHandlerClass_ {nullptr}; - JSHClass *prototypeHandlerClass_ {nullptr}; - JSHClass *functionExtraInfo_ {nullptr}; - JSHClass *jsRealmClass_ {nullptr}; - JSHClass *programClass_ {nullptr}; - JSHClass *ecmaModuleClass_ {nullptr}; - JSHClass *classInfoExtractorHClass_ {nullptr}; - JSHClass *linkedHashMapClass_ {nullptr}; - JSHClass *linkedHashSetClass_ {nullptr}; - JSHClass *weakRefClass_ {nullptr}; - JSHClass *weakLinkedHashMapClass_ {nullptr}; - JSHClass *weakLinkedHashSetClass_ {nullptr}; + bool is_trigger_gc_ {false}; + bool trigger_semi_gc_ {false}; + MemManager heap_helper_; + + JSHClass *hclass_class_ {nullptr}; + JSHClass *string_class_ {nullptr}; + JSHClass *array_class_ {nullptr}; + JSHClass *weak_array_class_ {nullptr}; + JSHClass *dictionary_class_ {nullptr}; + JSHClass *free_object_with_none_field_class_ {nullptr}; + JSHClass *free_object_with_one_field_class_ {nullptr}; + JSHClass *free_object_with_two_field_class_ {nullptr}; + + JSHClass *completion_record_class_ {nullptr}; + JSHClass *generator_context_class_ {nullptr}; + JSHClass *env_class_ {nullptr}; + JSHClass *symbol_class_ {nullptr}; + JSHClass *accessor_data_class_ {nullptr}; + JSHClass *internal_accessor_class_ {nullptr}; + JSHClass *capability_record_class_ {nullptr}; + JSHClass *reactions_record_class_ {nullptr}; + JSHClass *promise_iterator_record_class_ {nullptr}; + JSHClass *micro_job_queue_class_ {nullptr}; + JSHClass *pending_job_class_ {nullptr}; + JSHClass *js_proxy_ordinary_class_ {nullptr}; + JSHClass *js_proxy_callable_class_ {nullptr}; + JSHClass *js_proxy_construct_class_ {nullptr}; + JSHClass *object_wrapper_class_ {nullptr}; + JSHClass *property_box_class_ {nullptr}; + JSHClass *proto_change_details_class_ {nullptr}; + JSHClass *proto_change_marker_class_ {nullptr}; + JSHClass *promise_record_class_ {nullptr}; + JSHClass *promise_resolving_functions_record_ {nullptr}; + JSHClass *js_native_pointer_class_ {nullptr}; + JSHClass *transition_handler_class_ {nullptr}; + JSHClass *prototype_handler_class_ {nullptr}; + JSHClass *function_extra_info_ {nullptr}; + JSHClass *js_realm_class_ {nullptr}; + JSHClass *program_class_ {nullptr}; + JSHClass *ecma_module_class_ {nullptr}; + JSHClass *class_info_extractor_h_class_ {nullptr}; + JSHClass *linked_hash_map_class_ {nullptr}; + JSHClass *linked_hash_set_class_ {nullptr}; + JSHClass *weak_ref_class_ {nullptr}; + JSHClass *weak_linked_hash_map_class_ {nullptr}; + JSHClass *weak_linked_hash_set_class_ {nullptr}; EcmaVM *vm_ {nullptr}; @@ -462,7 +463,7 @@ private: // used for creating jshclass in Builtins, Function, Class_Linker JSHandle NewEcmaDynClass(uint32_t size, JSType type, - uint32_t inlinedProps = JSHClass::DEFAULT_CAPACITY_OF_IN_OBJECTS); + uint32_t inlined_props = JSHClass::DEFAULT_CAPACITY_OF_IN_OBJECTS); // used for creating jshclass in GlobalEnv, EcmaVM JSHandle NewEcmaDynClassClass(JSHClass *hclass, uint32_t size, JSType type); @@ -470,21 +471,23 @@ private: JSHandle NewNonMovableJSObject(const JSHandle &jshclass); // used for creating Function - JSHandle NewJSFunction(const JSHandle &env, const JSHandle &dynKlass); + JSHandle NewJSFunction(const JSHandle &env, const JSHandle &dyn_klass); JSHandle CreateObjectClass(const JSHandle &properties, size_t length); JSHandle CreateFunctionClass(FunctionKind kind, uint32_t size, JSType type, const JSHandle &prototype); // used for creating ref.prototype in buildins, such as Number.prototype - JSHandle NewJSPrimitiveRef(const JSHandle &dynKlass, + JSHandle NewJSPrimitiveRef(const JSHandle &dyn_klass, const JSHandle &object); - JSHandle GetStringFromStringTable(const uint8_t *utf8Data, uint32_t utf8Len, bool canBeCompress) const; + JSHandle GetStringFromStringTable(const uint8_t *utf8_data, uint32_t utf8_len, + bool can_be_compress) const; // For MUtf-8 string data - EcmaString *GetRawStringFromStringTable(const uint8_t *mutf8Data, uint32_t utf16Len, bool canBeCompressed) const; + EcmaString *GetRawStringFromStringTable(const uint8_t *mutf8_data, uint32_t utf16_len, + bool can_be_compressed) const; - JSHandle GetStringFromStringTable(const uint16_t *utf16Data, uint32_t utf16Len, - bool canBeCompress) const; + JSHandle GetStringFromStringTable(const uint16_t *utf16_data, uint32_t utf16_len, + bool can_be_compress) const; JSHandle GetStringFromStringTable(EcmaString *string) const; diff --git a/runtime/object_operator.cpp b/runtime/object_operator.cpp index fee652475..cc31bbf69 100644 --- a/runtime/object_operator.cpp +++ b/runtime/object_operator.cpp @@ -34,12 +34,12 @@ namespace panda::ecmascript { void ObjectOperator::HandleKey(const JSHandle &key) { if (key->IsInt()) { - int32_t keyInt = key->GetInt(); - if (keyInt >= 0) { - elementIndex_ = static_cast(keyInt); + int32_t key_int = key->GetInt(); + if (key_int >= 0) { + element_index_ = static_cast(key_int); return; } - key_ = JSHandle::Cast(base::NumberHelper::NumberToString(thread_, JSTaggedValue(keyInt))); + key_ = JSHandle::Cast(base::NumberHelper::NumberToString(thread_, JSTaggedValue(key_int))); return; } @@ -47,7 +47,7 @@ void ObjectOperator::HandleKey(const JSHandle &key) uint32_t index = 0; if (JSTaggedValue::ToElementIndex(key.GetTaggedValue(), &index)) { ASSERT(index < JSObject::MAX_ELEMENT_INDEX); - elementIndex_ = index; + element_index_ = index; return; } if (EcmaString::Cast(key->GetTaggedObject())->IsInternString()) { @@ -63,7 +63,7 @@ void ObjectOperator::HandleKey(const JSHandle &key) if (number >= 0 && number < JSObject::MAX_ELEMENT_INDEX) { auto integer = static_cast(number); if (integer == number) { - elementIndex_ = static_cast(number); + element_index_ = static_cast(number); return; } } @@ -89,7 +89,7 @@ void ObjectOperator::HandleKey(const JSHandle &key) void ObjectOperator::UpdateHolder() { if (holder_->IsString() && - (IsElement() && elementIndex_ < EcmaString::Cast(holder_->GetTaggedObject())->GetLength())) { + (IsElement() && element_index_ < EcmaString::Cast(holder_->GetTaggedObject())->GetLength())) { holder_.Update(JSPrimitiveRef::StringCreate(thread_, holder_).GetTaggedValue()); } else { holder_.Update(JSTaggedValue::ToPrototypeOrObj(thread_, holder_).GetTaggedValue()); @@ -148,7 +148,7 @@ ObjectOperator::ObjectOperator(JSThread *thread, const JSHandle & : thread_(thread), holder_(thread, holder.GetTaggedValue()), receiver_(thread, holder.GetTaggedValue()), - elementIndex_(index) + element_index_(index) { StartLookUp(type); } @@ -538,9 +538,9 @@ bool ObjectOperator::AddProperty(const JSHandle &receiver, const JSHan PropertyAttributes attr) { if (IsElement()) { - bool ret = JSObject::AddElementInternal(thread_, receiver, elementIndex_, value, attr); + bool ret = JSObject::AddElementInternal(thread_, receiver, element_index_, value, attr); bool isDict = receiver->GetJSHClass()->IsDictionaryElement(); - SetFound(elementIndex_, value.GetTaggedValue(), attr.GetValue(), !isDict); + SetFound(element_index_, value.GetTaggedValue(), attr.GetValue(), !isDict); return ret; } @@ -614,10 +614,10 @@ void ObjectOperator::LookupElementInlinedProps(const JSHandle &obj) // if is js string, do special. if (obj->IsJSPrimitiveRef() && JSPrimitiveRef::Cast(obj.GetTaggedValue().GetTaggedObject())->IsString()) { PropertyDescriptor desc(thread_); - bool status = JSPrimitiveRef::StringGetIndexProperty(thread_, obj, elementIndex_, &desc); + bool status = JSPrimitiveRef::StringGetIndexProperty(thread_, obj, element_index_, &desc); if (status) { PropertyAttributes attr(desc); - SetFound(elementIndex_, desc.GetValue().GetTaggedValue(), attr.GetValue(), true); + SetFound(element_index_, desc.GetValue().GetTaggedValue(), attr.GetValue(), true); return; } } @@ -628,18 +628,18 @@ void ObjectOperator::LookupElementInlinedProps(const JSHandle &obj) } if (!elements->IsDictionaryMode()) { - if (elements->GetLength() <= elementIndex_) { + if (elements->GetLength() <= element_index_) { return; } - JSTaggedValue value = elements->Get(elementIndex_); + JSTaggedValue value = elements->Get(element_index_); if (value.IsHole()) { return; } - SetFound(elementIndex_, value, PropertyAttributes::GetDefaultAttributes(), true); + SetFound(element_index_, value, PropertyAttributes::GetDefaultAttributes(), true); } else { NumberDictionary *dictionary = NumberDictionary::Cast(obj->GetElements().GetTaggedObject()); - JSTaggedValue key(static_cast(elementIndex_)); + JSTaggedValue key(static_cast(element_index_)); int entry = dictionary->FindEntry(key); if (entry == -1) { return; @@ -663,16 +663,16 @@ void ObjectOperator::AddPropertyInternal(const JSHandle &value) } // Add PropertyBox to global dictionary - JSHandle cellHandle = factory->NewPropertyBox(key_); - cellHandle->SetValue(thread_, value.GetTaggedValue()); - PropertyBoxType cellType = value->IsUndefined() ? PropertyBoxType::UNDEFINED : PropertyBoxType::CONSTANT; - attr.SetBoxType(cellType); + JSHandle cell_handle = factory->NewPropertyBox(key_); + cell_handle->SetValue(thread_, value.GetTaggedValue()); + PropertyBoxType cell_type = value->IsUndefined() ? PropertyBoxType::UNDEFINED : PropertyBoxType::CONSTANT; + attr.SetBoxType(cell_type); JSHandle properties = - GlobalDictionary::PutIfAbsent(thread_, dict, key_, JSHandle(cellHandle), attr); + GlobalDictionary::PutIfAbsent(thread_, dict, key_, JSHandle(cell_handle), attr); obj->SetProperties(thread_, properties); // index and fastMode is not essential for global obj; - SetFound(0, cellHandle.GetTaggedValue(), attr.GetValue(), true); + SetFound(0, cell_handle.GetTaggedValue(), attr.GetValue(), true); return; } diff --git a/runtime/object_operator.h b/runtime/object_operator.h index 10a850f3d..8bb3d3ec9 100644 --- a/runtime/object_operator.h +++ b/runtime/object_operator.h @@ -76,12 +76,12 @@ public: inline bool IsFastMode() const { - return IsFastModeField::Get(metaData_); + return IsFastModeField::Get(meta_data_); } inline void SetFastMode(bool flag) { - IsFastModeField::Set(flag, &metaData_); + IsFastModeField::Set(flag, &meta_data_); } inline bool IsElement() const @@ -91,32 +91,32 @@ public: inline bool IsOnPrototype() const { - return IsOnPrototypeField::Get(metaData_); + return IsOnPrototypeField::Get(meta_data_); } inline void SetIsOnPrototype(bool flag) { - IsOnPrototypeField::Set(flag, &metaData_); + IsOnPrototypeField::Set(flag, &meta_data_); } inline bool HasReceiver() const { - return HasReceiverField::Get(metaData_); + return HasReceiverField::Get(meta_data_); } inline void SetHasReceiver(bool flag) { - HasReceiverField::Set(flag, &metaData_); + HasReceiverField::Set(flag, &meta_data_); } inline bool IsTransition() const { - return IsTransitionField::Get(metaData_); + return IsTransitionField::Get(meta_data_); } inline void SetIsTransition(bool flag) { - IsTransitionField::Set(flag, &metaData_); + IsTransitionField::Set(flag, &meta_data_); } inline PropertyAttributes GetAttr() const @@ -216,7 +216,7 @@ public: inline uint32_t GetElementIndex() const { - return elementIndex_; + return element_index_; } inline JSThread *GetThread() const @@ -237,7 +237,7 @@ public: SetFound(NOT_FOUND_INDEX, JSTaggedValue::Undefined(), PropertyAttributes::GetDefaultAttributes(), false, false); } bool UpdateDataValue(const JSHandle &receiver, const JSHandle &value, - bool isInternalAccessor, bool mayThrow = false); + bool is_internal_accessor, bool may_throw = false); bool WriteDataPropertyInHolder(const PropertyDescriptor &desc) { JSHandle receiver(holder_); @@ -270,7 +270,7 @@ private: void StartLookUp(OperatorType type); void StartGlobalLookUp(OperatorType type); void HandleKey(const JSHandle &key); - uint32_t ComputeElementCapacity(uint32_t oldCapacity); + uint32_t ComputeElementCapacity(uint32_t old_capacity); void SetFound(uint32_t index, JSTaggedValue value, uint32_t attr, bool mode, bool transition = false); void UpdateFound(uint32_t index, uint32_t attr, bool mode, bool transition); void ResetState(); @@ -291,17 +291,17 @@ private: void WriteElement(const JSHandle &receiver, JSTaggedValue value) const; void DeleteElementInHolder() const; bool UpdateValueAndDetails(const JSHandle &receiver, const JSHandle &value, - PropertyAttributes attr, bool attrChanged); + PropertyAttributes attr, bool attr_changed); void TransitionForAttributeChanged(const JSHandle &receiver, PropertyAttributes attr); JSThread *thread_ {nullptr}; JSMutableHandle value_ {}; JSMutableHandle holder_ {}; JSMutableHandle receiver_ {}; JSHandle key_ {}; - uint32_t elementIndex_ {NOT_FOUND_INDEX}; + uint32_t element_index_ {NOT_FOUND_INDEX}; uint32_t index_ {NOT_FOUND_INDEX}; PropertyAttributes attributes_; - uint32_t metaData_ {0}; + uint32_t meta_data_ {0}; }; } // namespace panda::ecmascript #endif // ECMASCRIPT_OBJECT_OPERATOR_H diff --git a/runtime/property_attributes.h b/runtime/property_attributes.h index e410a0bd4..c107645af 100644 --- a/runtime/property_attributes.h +++ b/runtime/property_attributes.h @@ -94,10 +94,10 @@ public: return PropertyAttributes(GetDefaultAttributes()); } - static PropertyAttributes Default(bool w, bool e, bool c, bool isAccessor = false) + static PropertyAttributes Default(bool w, bool e, bool c, bool is_accessor = false) { uint32_t value = WritableField::Encode(w) | EnumerableField::Encode(e) | ConfigurableField::Encode(c) | - IsAccessorField::Encode(isAccessor); + IsAccessorField::Encode(is_accessor); return PropertyAttributes(value); } @@ -130,25 +130,25 @@ public: return Representation::OBJECT; } - static Representation UpdateRepresentation(Representation oldRep, JSTaggedValue value) + static Representation UpdateRepresentation(Representation old_rep, JSTaggedValue value) { - if (oldRep == Representation::MIXED) { - return oldRep; + if (old_rep == Representation::MIXED) { + return old_rep; } - Representation newRep = TaggedToRepresentation(value); - if (oldRep == Representation::NONE) { - return newRep; + Representation new_rep = TaggedToRepresentation(value); + if (old_rep == Representation::NONE) { + return new_rep; } - if (oldRep == newRep) { - return oldRep; + if (old_rep == new_rep) { + return old_rep; } - switch (oldRep) { + switch (old_rep) { case Representation::INT: case Representation::DOUBLE: case Representation::NUMBER: - if (newRep != Representation::OBJECT) { + if (new_rep != Representation::OBJECT) { return Representation::NUMBER; } return Representation::MIXED; @@ -256,18 +256,18 @@ public: return OffsetField::Get(value_); } - inline void SetSortedIndex(uint32_t sortedIndex) + inline void SetSortedIndex(uint32_t sorted_index) { - SortedIndexField::Set(sortedIndex, &value_); + SortedIndexField::Set(sorted_index, &value_); } inline uint32_t GetSortedIndex() const { return SortedIndexField::Get(value_); } - inline void SetNormalAttr(uint32_t normalAttr) + inline void SetNormalAttr(uint32_t normal_attr) { - NormalAttrField::Set(normalAttr, &value_); + NormalAttrField::Set(normal_attr, &value_); } inline uint32_t GetNormalAttr() const @@ -285,9 +285,9 @@ public: return value_; } - inline void SetBoxType(PropertyBoxType cellType) + inline void SetBoxType(PropertyBoxType cell_type) { - PropertyBoxTypeField::Set(cellType, &value_); + PropertyBoxTypeField::Set(cell_type, &value_); } inline PropertyBoxType GetBoxType() const diff --git a/runtime/tagged_array-inl.h b/runtime/tagged_array-inl.h index 78087d84f..0a124cec3 100644 --- a/runtime/tagged_array-inl.h +++ b/runtime/tagged_array-inl.h @@ -70,46 +70,46 @@ inline void TaggedArray::Set(const JSThread *thread, uint32_t idx, const JSTagge JSHandle TaggedArray::Append(const JSThread *thread, const JSHandle &first, const JSHandle &second) { - uint32_t firstLength = first->GetLength(); - uint32_t secondLength = second->GetLength(); - uint32_t length = firstLength + secondLength; + uint32_t first_length = first->GetLength(); + uint32_t second_length = second->GetLength(); + uint32_t length = first_length + second_length; ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); JSHandle argument = factory->NewTaggedArray(length); uint32_t index = 0; - for (; index < firstLength; ++index) { + for (; index < first_length; ++index) { argument->Set(thread, index, first->Get(index)); } for (; index < length; ++index) { - argument->Set(thread, index, second->Get(index - firstLength)); + argument->Set(thread, index, second->Get(index - first_length)); } return argument; } JSHandle TaggedArray::AppendSkipHole(const JSThread *thread, const JSHandle &first, - const JSHandle &second, uint32_t copyLength) + const JSHandle &second, uint32_t copy_length) { - uint32_t firstLength = first->GetLength(); - uint32_t secondLength = second->GetLength(); - ASSERT(firstLength + secondLength >= copyLength); + uint32_t first_length = first->GetLength(); + uint32_t second_length = second->GetLength(); + ASSERT(first_length + second_length >= copy_length); ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - JSHandle argument = factory->NewTaggedArray(copyLength); + JSHandle argument = factory->NewTaggedArray(copy_length); uint32_t index = 0; - for (; index < firstLength; ++index) { + for (; index < first_length; ++index) { JSTaggedValue val = first->Get(index); if (val.IsHole()) { break; } argument->Set(thread, index, val); - ASSERT(copyLength >= index); + ASSERT(copy_length >= index); } - for (uint32_t i = 0; i < secondLength; ++i) { + for (uint32_t i = 0; i < second_length; ++i) { JSTaggedValue val = second->Get(i); if (val.IsHole()) { break; } argument->Set(thread, index++, val); - ASSERT(copyLength >= index); + ASSERT(copy_length >= index); } return argument; } @@ -127,14 +127,14 @@ inline bool TaggedArray::HasDuplicateEntry() const return false; } -void TaggedArray::InitializeWithSpecialValue(JSTaggedValue initValue, uint32_t length) +void TaggedArray::InitializeWithSpecialValue(JSTaggedValue init_value, uint32_t length) { - ASSERT(initValue.IsSpecial()); + ASSERT(init_value.IsSpecial()); SetLength(length); for (uint32_t i = 0; i < length; i++) { size_t offset = JSTaggedValue::TaggedTypeSize() * i; // Without barrier because 'this' is just allocated object and it doesn't contains references. - ObjectAccessor::SetDynValueWithoutBarrier(this, DATA_OFFSET + offset, initValue.GetRawData()); + ObjectAccessor::SetDynValueWithoutBarrier(this, DATA_OFFSET + offset, init_value.GetRawData()); } } @@ -142,9 +142,9 @@ inline JSHandle TaggedArray::SetCapacity(const JSThread *thread, co uint32_t capa) { ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - uint32_t oldLength = array->GetLength(); - JSHandle newArray = factory->CopyArray(array, oldLength, capa); - return newArray; + uint32_t old_length = array->GetLength(); + JSHandle new_array = factory->CopyArray(array, old_length, capa); + return new_array; } inline bool TaggedArray::IsDictionaryMode() const @@ -152,15 +152,15 @@ inline bool TaggedArray::IsDictionaryMode() const return GetClass()->IsDictionary(); } -void TaggedArray::Trim(JSThread *thread, uint32_t newLength) +void TaggedArray::Trim(JSThread *thread, uint32_t new_length) { ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - uint32_t oldLength = GetLength(); - ASSERT(oldLength > newLength); - size_t trimBytes = (oldLength - newLength) * JSTaggedValue::TaggedTypeSize(); - size_t size = TaggedArray::ComputeSize(JSTaggedValue::TaggedTypeSize(), newLength); - factory->FillFreeObject(ToUintPtr(this) + size, trimBytes, RemoveSlots::YES); - SetLength(newLength); + uint32_t old_length = GetLength(); + ASSERT(old_length > new_length); + size_t trim_bytes = (old_length - new_length) * JSTaggedValue::TaggedTypeSize(); + size_t size = TaggedArray::ComputeSize(JSTaggedValue::TaggedTypeSize(), new_length); + factory->FillFreeObject(ToUintPtr(this) + size, trim_bytes, RemoveSlots::YES); + SetLength(new_length); } } // namespace panda::ecmascript #endif // ECMASCRIPT_TAGGED_ARRAY_INL_H diff --git a/runtime/tagged_array.h b/runtime/tagged_array.h index c8bac76aa..491d36029 100644 --- a/runtime/tagged_array.h +++ b/runtime/tagged_array.h @@ -48,15 +48,15 @@ public: static inline JSHandle Append(const JSThread *thread, const JSHandle &first, const JSHandle &second); static inline JSHandle AppendSkipHole(const JSThread *thread, const JSHandle &first, - const JSHandle &second, uint32_t copyLength); + const JSHandle &second, uint32_t copy_length); - static inline size_t ComputeSize(size_t elemSize, uint32_t length) + static inline size_t ComputeSize(size_t elem_size, uint32_t length) { - ASSERT(elemSize != 0); - size_t size = DATA_OFFSET + elemSize * length; + ASSERT(elem_size != 0); + size_t size = DATA_OFFSET + elem_size * length; #ifdef PANDA_TARGET_32 - size_t sizeLimit = (std::numeric_limits::max() - DATA_OFFSET) / elemSize; - if (UNLIKELY(sizeLimit < static_cast(length))) { + size_t size_limit = (std::numeric_limits::max() - DATA_OFFSET) / elem_size; + if (UNLIKELY(size_limit < static_cast(length))) { return 0; } #endif @@ -74,13 +74,13 @@ public: static JSHandle SetCapacity(const JSThread *thread, const JSHandle &array, uint32_t capa); - inline void InitializeWithSpecialValue(JSTaggedValue initValue, uint32_t length); + inline void InitializeWithSpecialValue(JSTaggedValue init_value, uint32_t length); - static inline bool ShouldTrim([[maybe_unused]] JSThread *thread, uint32_t oldLength, uint32_t newLength) + static inline bool ShouldTrim([[maybe_unused]] JSThread *thread, uint32_t old_length, uint32_t new_length) { - return (oldLength - newLength > MAX_END_UNUSED); + return (old_length - new_length > MAX_END_UNUSED); } - inline void Trim(JSThread *thread, uint32_t newLength); + inline void Trim(JSThread *thread, uint32_t new_length); inline size_t GetElementOffset(uint32_t idx) const { diff --git a/runtime/tagged_dictionary.h b/runtime/tagged_dictionary.h index fe5660bfd..84ddfe594 100644 --- a/runtime/tagged_dictionary.h +++ b/runtime/tagged_dictionary.h @@ -41,19 +41,19 @@ public: static int Hash(const JSTaggedValue &key); static bool IsMatch(const JSTaggedValue &key, const JSTaggedValue &other); static JSHandle Create(const JSThread *thread, - int numberOfElements = OrderHashTableT::DEFAULT_ELEMENTS_NUMBER); + int number_of_elements = OrderHashTableT::DEFAULT_ELEMENTS_NUMBER); // Returns the property metaData for the property at entry. PropertyAttributes GetAttributes(int entry) const; - void SetAttributes(const JSThread *thread, int entry, const PropertyAttributes &metaData); + void SetAttributes(const JSThread *thread, int entry, const PropertyAttributes &meta_data); void SetEntry(const JSThread *thread, int entry, const JSTaggedValue &key, const JSTaggedValue &value, - const PropertyAttributes &metaData); + const PropertyAttributes &meta_data); void UpdateValueAndAttributes(const JSThread *thread, int entry, const JSTaggedValue &value, - const PropertyAttributes &metaData); + const PropertyAttributes &meta_data); void UpdateValue(const JSThread *thread, int entry, const JSTaggedValue &value); - void UpdateAttributes(int entry, const PropertyAttributes &metaData); + void UpdateAttributes(int entry, const PropertyAttributes &meta_data); void ClearEntry(const JSThread *thread, int entry); - void GetAllKeys(const JSThread *thread, int offset, TaggedArray *keyArray) const; - void GetAllEnumKeys(const JSThread *thread, int offset, TaggedArray *keyArray, uint32_t *keys) const; + void GetAllKeys(const JSThread *thread, int offset, TaggedArray *key_array) const; + void GetAllEnumKeys(const JSThread *thread, int offset, TaggedArray *key_array, uint32_t *keys) const; static inline bool CompKey(const std::pair &a, const std::pair &b) { @@ -101,22 +101,22 @@ public: static int Hash(const JSTaggedValue &key); static bool IsMatch(const JSTaggedValue &key, const JSTaggedValue &other); static JSHandle Create(const JSThread *thread, - int numberOfElements = OrderHashTableT::DEFAULT_ELEMENTS_NUMBER); + int number_of_elements = OrderHashTableT::DEFAULT_ELEMENTS_NUMBER); // Returns the property metaData for the property at entry. PropertyAttributes GetAttributes(int entry) const; - void SetAttributes(const JSThread *thread, int entry, const PropertyAttributes &metaData); + void SetAttributes(const JSThread *thread, int entry, const PropertyAttributes &meta_data); void SetEntry([[maybe_unused]] const JSThread *thread, int entry, const JSTaggedValue &key, - const JSTaggedValue &value, const PropertyAttributes &metaData); + const JSTaggedValue &value, const PropertyAttributes &meta_data); void UpdateValueAndAttributes(const JSThread *thread, int entry, const JSTaggedValue &value, - const PropertyAttributes &metaData); + const PropertyAttributes &meta_data); void UpdateValue(const JSThread *thread, int entry, const JSTaggedValue &value); - void UpdateAttributes(int entry, const PropertyAttributes &metaData); + void UpdateAttributes(int entry, const PropertyAttributes &meta_data); void ClearEntry(const JSThread *thread, int entry); static void GetAllKeys(const JSThread *thread, const JSHandle &obj, int offset, - const JSHandle &keyArray); + const JSHandle &key_array); static void GetAllEnumKeys(const JSThread *thread, const JSHandle &obj, int offset, - const JSHandle &keyArray, uint32_t *keys); + const JSHandle &key_array, uint32_t *keys); static inline bool CompKey(const JSTaggedValue &a, const JSTaggedValue &b) { ASSERT(a.IsNumber() && b.IsNumber()); diff --git a/runtime/tagged_hash_table-inl.h b/runtime/tagged_hash_table-inl.h index 3ffaa50c3..5df3c7250 100644 --- a/runtime/tagged_hash_table-inl.h +++ b/runtime/tagged_hash_table-inl.h @@ -71,17 +71,17 @@ void TaggedHashTable::SetHashTableSize(const JSThread *thread, int size } template -void TaggedHashTable::GetAllKeys(const JSThread *thread, int offset, TaggedArray *keyArray) const +void TaggedHashTable::GetAllKeys(const JSThread *thread, int offset, TaggedArray *key_array) const { - ASSERT_PRINT(offset + EntriesCount() <= static_cast(keyArray->GetLength()), + ASSERT_PRINT(offset + EntriesCount() <= static_cast(key_array->GetLength()), "keyArray size is not enough for dictionary"); - int arrayIndex = 0; + int array_index = 0; int size = Size(); - for (int hashIndex = 0; hashIndex < size; hashIndex++) { - JSTaggedValue key = GetKey(hashIndex); + for (int hash_index = 0; hash_index < size; hash_index++) { + JSTaggedValue key = GetKey(hash_index); if (!key.IsUndefined() && !key.IsHole()) { - keyArray->Set(thread, arrayIndex + offset, key); - arrayIndex++; + key_array->Set(thread, array_index + offset, key); + array_index++; } } } @@ -92,18 +92,18 @@ int TaggedHashTable::FindEntry(const JSTaggedValue &key) { size_t size = Size(); int count = 1; - JSTaggedValue keyValue; + JSTaggedValue key_value; int hash = Derived::Hash(key); for (int entry = GetFirstPosition(hash, size);; entry = GetNextPosition(entry, count++, size)) { - keyValue = GetKey(entry); - if (keyValue.IsHole()) { + key_value = GetKey(entry); + if (key_value.IsHole()) { continue; } - if (keyValue.IsUndefined()) { + if (key_value.IsUndefined()) { return -1; } - if (Derived::IsMatch(key, keyValue)) { + if (Derived::IsMatch(key, key_value)) { return entry; } } @@ -112,56 +112,56 @@ int TaggedHashTable::FindEntry(const JSTaggedValue &key) // static template -int TaggedHashTable::RecalculateTableSize(int currentSize, int atLeastSize) +int TaggedHashTable::RecalculateTableSize(int current_size, int at_least_size) { - // When the filled entries is greater than a quart of currentSize + // When the filled entries is greater than a quart of current_size // it need not to shrink - if (atLeastSize > (currentSize / 4)) { // 4 : quarter - return currentSize; + if (at_least_size > (current_size / 4)) { // 4 : quarter + return current_size; } // Recalculate table size - int newSize = ComputeHashTableSize(atLeastSize); - ASSERT_PRINT(newSize > atLeastSize, "new size must greater than atLeastSize"); + int new_size = ComputeHashTableSize(at_least_size); + ASSERT_PRINT(new_size > at_least_size, "new size must greater than at_least_size"); // Don't go lower than room for MIN_SHRINK_SIZE elements. - if (newSize < MIN_SHRINK_SIZE) { - return currentSize; + if (new_size < MIN_SHRINK_SIZE) { + return current_size; } - return newSize; + return new_size; } // static template JSHandle TaggedHashTable::Shrink(const JSThread *thread, const JSHandle &table, - int additionalSize) + int additional_size) { - int newSize = RecalculateTableSize(table->Size(), table->EntriesCount() + additionalSize); - if (newSize == table->Size()) { + int new_size = RecalculateTableSize(table->Size(), table->EntriesCount() + additional_size); + if (new_size == table->Size()) { return table; } - JSHandle newTable = TaggedHashTable::Create(thread, newSize); - if (newTable.IsEmpty()) { + JSHandle new_table = TaggedHashTable::Create(thread, new_size); + if (new_table.IsEmpty()) { return table; } - table->Rehash(thread, *newTable); - return newTable; + table->Rehash(thread, *new_table); + return new_table; } template -bool TaggedHashTable::IsNeedGrowHashTable(int numOfAddEntries) +bool TaggedHashTable::IsNeedGrowHashTable(int num_of_add_entries) { - int entriesCount = EntriesCount(); - int numOfDelEntries = HoleEntriesCount(); - int currentSize = Size(); - int numberFilled = entriesCount + numOfAddEntries; + int entries_count = EntriesCount(); + int num_of_del_entries = HoleEntriesCount(); + int current_size = Size(); + int number_filled = entries_count + num_of_add_entries; // needn't to grow table: // 1. after adding number entries, table have half free entries. // 2. deleted entries are less than half of the free entries. - const int halfFree = 2; - if ((numberFilled < currentSize) && ((numOfDelEntries <= (currentSize - numberFilled) / halfFree))) { - int neededFree = numberFilled / halfFree; - if (numberFilled + neededFree <= currentSize) { + const int half_free = 2; + if ((number_filled < current_size) && ((num_of_del_entries <= (current_size - number_filled) / half_free))) { + int needed_free = number_filled / half_free; + if (number_filled + needed_free <= current_size) { return false; } } @@ -180,9 +180,9 @@ void TaggedHashTable::AddElement(const JSThread *thread, int entry, con template void TaggedHashTable::RemoveElement(const JSThread *thread, int entry) { - JSTaggedValue defaultValue(JSTaggedValue::Hole()); - this->SetKey(thread, entry, defaultValue); - this->SetValue(thread, entry, defaultValue); + JSTaggedValue default_value(JSTaggedValue::Hole()); + this->SetKey(thread, entry, default_value); + this->SetValue(thread, entry, default_value); this->IncreaseHoleEntriesCount(thread); } @@ -199,9 +199,9 @@ JSHandle TaggedHashTable::Insert(const JSThread *thread, JSHan return table; } - JSHandle newTable = GrowHashTable(thread, table); - newTable->AddElement(thread, newTable->FindInsertIndex(hash), key, value); - return newTable; + JSHandle new_table = GrowHashTable(thread, table); + new_table->AddElement(thread, new_table->FindInsertIndex(hash), key, value); + return new_table; } template @@ -218,65 +218,65 @@ JSHandle TaggedHashTable::Remove(const JSThread *thread, JSHan } template -void TaggedHashTable::Rehash(const JSThread *thread, Derived *newTable) +void TaggedHashTable::Rehash(const JSThread *thread, Derived *new_table) { - if ((newTable == nullptr) || (newTable->Size() < EntriesCount())) { + if ((new_table == nullptr) || (new_table->Size() < EntriesCount())) { return; } - int currentSize = this->Size(); + int current_size = this->Size(); // Rehash elements to new table - for (int i = 0; i < currentSize; i++) { - int fromIndex = Derived::GetKeyIndex(i); + for (int i = 0; i < current_size; i++) { + int from_index = Derived::GetKeyIndex(i); JSTaggedValue k = this->GetKey(i); if (!IsKey(k)) { continue; } int hash = Derived::Hash(k); - int insertionIndex = Derived::GetKeyIndex(newTable->FindInsertIndex(hash)); - JSTaggedValue tv = Get(fromIndex); - newTable->Set(thread, insertionIndex, tv); + int insertion_index = Derived::GetKeyIndex(new_table->FindInsertIndex(hash)); + JSTaggedValue tv = Get(from_index); + new_table->Set(thread, insertion_index, tv); for (int j = 1; j < Derived::GetEntrySize(); j++) { - tv = Get(fromIndex + j); - newTable->Set(thread, insertionIndex + j, tv); + tv = Get(from_index + j); + new_table->Set(thread, insertion_index + j, tv); } } - newTable->SetEntriesCount(thread, EntriesCount()); - newTable->SetHoleEntriesCount(thread, 0); + new_table->SetEntriesCount(thread, EntriesCount()); + new_table->SetHoleEntriesCount(thread, 0); } // static template -int TaggedHashTable::ComputeHashTableSize(uint32_t atLeastSize) +int TaggedHashTable::ComputeHashTableSize(uint32_t at_least_size) { // increase size for hash-collision - uint32_t rawSize = atLeastSize + (atLeastSize >> 1UL); - int newSize = static_cast(helpers::math::GetPowerOfTwoValue32(rawSize)); - return (newSize > MIN_SIZE) ? newSize : MIN_SIZE; + uint32_t raw_size = at_least_size + (at_least_size >> 1UL); + int new_size = static_cast(helpers::math::GetPowerOfTwoValue32(raw_size)); + return (new_size > MIN_SIZE) ? new_size : MIN_SIZE; } template JSHandle TaggedHashTable::GrowHashTable(const JSThread *thread, const JSHandle &table, - int numOfAddedElements) + int num_of_added_elements) { - if (!table->IsNeedGrowHashTable(numOfAddedElements)) { + if (!table->IsNeedGrowHashTable(num_of_added_elements)) { return table; } - int newSize = ComputeHashTableSize(table->Size() + numOfAddedElements); - int length = Derived::GetEntryIndex(newSize); - JSHandle newTable(thread->GetEcmaVM()->GetFactory()->NewDictionaryArray(length)); - newTable->SetHashTableSize(thread, newSize); - table->Rehash(thread, *newTable); - return newTable; + int new_size = ComputeHashTableSize(table->Size() + num_of_added_elements); + int length = Derived::GetEntryIndex(new_size); + JSHandle new_table(thread->GetEcmaVM()->GetFactory()->NewDictionaryArray(length)); + new_table->SetHashTableSize(thread, new_size); + table->Rehash(thread, *new_table); + return new_table; } template -JSHandle TaggedHashTable::Create(const JSThread *thread, int entriesCount) +JSHandle TaggedHashTable::Create(const JSThread *thread, int entries_count) { - ASSERT_PRINT((entriesCount > 0), "the size must be greater than zero"); - auto size = static_cast(entriesCount); - ASSERT_PRINT(helpers::math::IsPowerOfTwo(static_cast(entriesCount)), "the size must be power of two"); + ASSERT_PRINT((entries_count > 0), "the size must be greater than zero"); + auto size = static_cast(entries_count); + ASSERT_PRINT(helpers::math::IsPowerOfTwo(static_cast(entries_count)), "the size must be power of two"); - int length = Derived::GetEntryIndex(entriesCount); + int length = Derived::GetEntryIndex(entries_count); JSHandle table(thread->GetEcmaVM()->GetFactory()->NewDictionaryArray(length)); table->SetEntriesCount(thread, 0); @@ -339,9 +339,9 @@ int TaggedHashTable::FindInsertIndex(int hash) } template -JSHandle OrderTaggedHashTable::Create(const JSThread *thread, int numberOfElements) +JSHandle OrderTaggedHashTable::Create(const JSThread *thread, int number_of_elements) { - JSHandle dict = HashTableT::Create(thread, numberOfElements); + JSHandle dict = HashTableT::Create(thread, number_of_elements); dict->SetNextEnumerationIndex(thread, PropertyAttributes::INTIAL_PROPERTY_INDEX); return dict; } @@ -350,7 +350,7 @@ template JSHandle OrderTaggedHashTable::PutIfAbsent(const JSThread *thread, const JSHandle &table, const JSHandle &key, const JSHandle &value, - const PropertyAttributes &metaData) + const PropertyAttributes &meta_data) { int hash = Derived::Hash(key.GetTaggedValue()); @@ -359,46 +359,46 @@ JSHandle OrderTaggedHashTable::PutIfAbsent(const JSThread *thr if (entry != -1) { return table; } - int enumIndex = table->NextEnumerationIndex(thread); - PropertyAttributes attr(metaData); - attr.SetDictionaryOrder(enumIndex); + int enum_index = table->NextEnumerationIndex(thread); + PropertyAttributes attr(meta_data); + attr.SetDictionaryOrder(enum_index); // Check whether the table should be growed. - JSHandle newTable = HashTableT::GrowHashTable(thread, table); + JSHandle new_table = HashTableT::GrowHashTable(thread, table); // Compute the key object. - entry = newTable->FindInsertIndex(hash); - newTable->SetEntry(thread, entry, key.GetTaggedValue(), value.GetTaggedValue(), attr); + entry = new_table->FindInsertIndex(hash); + new_table->SetEntry(thread, entry, key.GetTaggedValue(), value.GetTaggedValue(), attr); - newTable->IncreaseEntries(thread); - newTable->SetNextEnumerationIndex(thread, enumIndex + 1); - return newTable; + new_table->IncreaseEntries(thread); + new_table->SetNextEnumerationIndex(thread, enum_index + 1); + return new_table; } template JSHandle OrderTaggedHashTable::Put(const JSThread *thread, const JSHandle &table, const JSHandle &key, const JSHandle &value, - const PropertyAttributes &metaData) + const PropertyAttributes &meta_data) { int hash = Derived::Hash(key.GetTaggedValue()); - int enumIndex = table->NextEnumerationIndex(thread); - PropertyAttributes attr(metaData); - attr.SetDictionaryOrder(enumIndex); + int enum_index = table->NextEnumerationIndex(thread); + PropertyAttributes attr(meta_data); + attr.SetDictionaryOrder(enum_index); int entry = table->FindEntry(key.GetTaggedValue()); if (entry != -1) { table->SetEntry(thread, entry, key.GetTaggedValue(), value.GetTaggedValue(), attr); return table; } // Check whether the table should be extended. - JSHandle newTable = HashTableT::GrowHashTable(thread, table); + JSHandle new_table = HashTableT::GrowHashTable(thread, table); // Compute the key object. - entry = newTable->FindInsertIndex(hash); - newTable->SetEntry(thread, entry, key.GetTaggedValue(), value.GetTaggedValue(), attr); + entry = new_table->FindInsertIndex(hash); + new_table->SetEntry(thread, entry, key.GetTaggedValue(), value.GetTaggedValue(), attr); - newTable->IncreaseEntries(thread); - newTable->SetNextEnumerationIndex(thread, enumIndex + 1); - return newTable; + new_table->IncreaseEntries(thread); + new_table->SetNextEnumerationIndex(thread, enum_index + 1); + return new_table; } template @@ -406,8 +406,8 @@ void TaggedHashTable::GetAllKeysIntoVector([[maybe_unused]] const JSThr std::vector &vector) const { int capacity = Size(); - for (int hashIndex = 0; hashIndex < capacity; hashIndex++) { - JSTaggedValue key = GetKey(hashIndex); + for (int hash_index = 0; hash_index < capacity; hash_index++) { + JSTaggedValue key = GetKey(hash_index); if (!key.IsUndefined() && !key.IsHole()) { vector.push_back(key); } @@ -433,14 +433,14 @@ int OrderTaggedHashTable::NextEnumerationIndex(const JSThread *thread) auto table = Derived::Cast(this); if (!PropertyAttributes::IsValidIndex(index)) { - std::vector indexOrder = GetEnumerationOrder(); - int length = indexOrder.size(); + std::vector index_order = GetEnumerationOrder(); + int length = index_order.size(); for (int i = 0; i < length; i++) { - int oldIndex = indexOrder[i]; - int enumIndex = PropertyAttributes::INTIAL_PROPERTY_INDEX + i; - PropertyAttributes attr = table->GetAttributes(oldIndex); - attr.SetDictionaryOrder(enumIndex); - table->SetAttributes(thread, oldIndex, attr); + int old_index = index_order[i]; + int enum_index = PropertyAttributes::INTIAL_PROPERTY_INDEX + i; + PropertyAttributes attr = table->GetAttributes(old_index); + attr.SetDictionaryOrder(enum_index); + table->SetAttributes(thread, old_index, attr); } index = PropertyAttributes::INTIAL_PROPERTY_INDEX + length; } @@ -459,9 +459,9 @@ std::vector OrderTaggedHashTable::GetEnumerationOrder() } } std::sort(result.begin(), result.end(), [table](int a, int b) { - PropertyAttributes attrA = table->GetAttributes(a); - PropertyAttributes attrB = table->GetAttributes(b); - return attrA.GetDictionaryOrder() < attrB.GetDictionaryOrder(); + PropertyAttributes attr_a = table->GetAttributes(a); + PropertyAttributes attr_b = table->GetAttributes(b); + return attr_a.GetDictionaryOrder() < attr_b.GetDictionaryOrder(); }); return result; } diff --git a/runtime/tagged_hash_table.h b/runtime/tagged_hash_table.h index 4de99f3b3..4b02a19b0 100644 --- a/runtime/tagged_hash_table.h +++ b/runtime/tagged_hash_table.h @@ -35,12 +35,12 @@ public: inline void IncreaseHoleEntriesCount(const JSThread *thread, int number = 1); - inline static int ComputeHashTableSize(uint32_t atLeastSize); + inline static int ComputeHashTableSize(uint32_t at_least_size); static JSHandle GrowHashTable(const JSThread *thread, const JSHandle &table, - int numOfAddedElements = 1); + int num_of_added_elements = 1); - static JSHandle Create(const JSThread *thread, int entriesCount); + static JSHandle Create(const JSThread *thread, int entries_count); static JSHandle Insert(const JSThread *thread, JSHandle &table, const JSHandle &key, const JSHandle &value); @@ -48,17 +48,17 @@ public: static JSHandle Remove(const JSThread *thread, JSHandle &table, const JSHandle &key); - inline static int RecalculateTableSize(int currentSize, int atLeastSize); + inline static int RecalculateTableSize(int current_size, int at_least_size); - inline static JSHandle Shrink(const JSThread *thread, const JSHandle &table, int additionalSize); + inline static JSHandle Shrink(const JSThread *thread, const JSHandle &table, int additional_size); - bool IsNeedGrowHashTable(int numOfAddEntries); + bool IsNeedGrowHashTable(int num_of_add_entries); JSTaggedValue GetKey(int entry) const; JSTaggedValue GetValue(int entry) const; - inline void GetAllKeys(const JSThread *thread, int offset, TaggedArray *keyArray) const; + inline void GetAllKeys(const JSThread *thread, int offset, TaggedArray *key_array) const; inline void GetAllKeysIntoVector(const JSThread *thread, std::vector &vector) const; @@ -114,7 +114,7 @@ protected: inline void RemoveElement(const JSThread *thread, int entry); // Rehash element to new_table - void Rehash(const JSThread *thread, Derived *newTable); + void Rehash(const JSThread *thread, Derived *new_table); }; template @@ -129,18 +129,18 @@ public: static JSHandle Shrink(const JSThread *thread, const JSHandle &table) { int index = table->GetNextEnumerationIndex(); - JSHandle newTable = HashTableT::Shrink(thread, table, 0); - newTable->SetNextEnumerationIndex(thread, index); - return newTable; + JSHandle new_table = HashTableT::Shrink(thread, table, 0); + new_table->SetNextEnumerationIndex(thread, index); + return new_table; } - static JSHandle Create(const JSThread *thread, int numberOfElements = DEFAULT_ELEMENTS_NUMBER); + static JSHandle Create(const JSThread *thread, int number_of_elements = DEFAULT_ELEMENTS_NUMBER); static JSHandle PutIfAbsent(const JSThread *thread, const JSHandle &table, const JSHandle &key, const JSHandle &value, - const PropertyAttributes &metaData); + const PropertyAttributes &meta_data); static JSHandle Put(const JSThread *thread, const JSHandle &table, const JSHandle &key, const JSHandle &value, - const PropertyAttributes &metaData); + const PropertyAttributes &meta_data); static JSHandle Remove(const JSThread *thread, const JSHandle &table, int entry); inline void SetNextEnumerationIndex(const JSThread *thread, int index) diff --git a/runtime/tagged_queue-inl.h b/runtime/tagged_queue-inl.h index 61f6013e1..b5200b22c 100644 --- a/runtime/tagged_queue-inl.h +++ b/runtime/tagged_queue-inl.h @@ -19,11 +19,11 @@ #include "plugins/ecmascript/runtime/tagged_queue.h" namespace panda::ecmascript { -inline TaggedQueue *TaggedQueue::Create(JSThread *thread, uint32_t capacity, JSTaggedValue initVal) +inline TaggedQueue *TaggedQueue::Create(JSThread *thread, uint32_t capacity, JSTaggedValue init_val) { uint32_t length = QueueToArrayIndex(capacity); - auto queue = TaggedQueue::Cast(*thread->GetEcmaVM()->GetFactory()->NewTaggedArray(length, initVal)); + auto queue = TaggedQueue::Cast(*thread->GetEcmaVM()->GetFactory()->NewTaggedArray(length, init_val)); queue->SetStart(thread, JSTaggedValue(0)); // equal to 0 when add 1. queue->SetEnd(thread, JSTaggedValue(0)); queue->SetCapacity(thread, JSTaggedValue(capacity)); diff --git a/runtime/tagged_queue.h b/runtime/tagged_queue.h index 091fb37b6..790b00962 100644 --- a/runtime/tagged_queue.h +++ b/runtime/tagged_queue.h @@ -37,12 +37,12 @@ public: if (capacity == 0) { // If there is no capacity, directly create a queue whose capacity is MIN_CAPACITY. Add elements. ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - JSHandle newQueue = factory->NewTaggedQueue(MIN_CAPACITY); - newQueue->Set(thread, 0, value.GetTaggedValue()); - newQueue->SetCapacity(thread, JSTaggedValue(MIN_CAPACITY)); - newQueue->SetStart(thread, JSTaggedValue(0)); - newQueue->SetEnd(thread, JSTaggedValue(1)); - return *newQueue; + JSHandle new_queue = factory->NewTaggedQueue(MIN_CAPACITY); + new_queue->Set(thread, 0, value.GetTaggedValue()); + new_queue->SetCapacity(thread, JSTaggedValue(MIN_CAPACITY)); + new_queue->SetStart(thread, JSTaggedValue(0)); + new_queue->SetEnd(thread, JSTaggedValue(1)); + return *new_queue; } uint32_t start = queue->GetStart().GetArrayLength(); @@ -56,20 +56,20 @@ public: } ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); // Grow Array for 1.5 times - uint32_t newCapacity = capacity + (capacity >> 1U); - newCapacity = newCapacity < capacity ? MAX_QUEUE_INDEX : newCapacity; - JSHandle newQueue = factory->NewTaggedQueue(newCapacity); - uint32_t newEnd = 0; - for (uint32_t i = start; newEnd < size; i = (i + 1) % capacity) { - newQueue->Set(thread, newEnd, queue->Get(i)); - newEnd++; + uint32_t new_capacity = capacity + (capacity >> 1U); + new_capacity = new_capacity < capacity ? MAX_QUEUE_INDEX : new_capacity; + JSHandle new_queue = factory->NewTaggedQueue(new_capacity); + uint32_t new_end = 0; + for (uint32_t i = start; new_end < size; i = (i + 1) % capacity) { + new_queue->Set(thread, new_end, queue->Get(i)); + new_end++; } - newQueue->SetCapacity(thread, JSTaggedValue(newCapacity)); - newQueue->SetStart(thread, JSTaggedValue(0)); - newQueue->Set(thread, newEnd++, value.GetTaggedValue()); - newQueue->SetEnd(thread, JSTaggedValue(newEnd)); - return *newQueue; + new_queue->SetCapacity(thread, JSTaggedValue(new_capacity)); + new_queue->SetStart(thread, JSTaggedValue(0)); + new_queue->Set(thread, new_end++, value.GetTaggedValue()); + new_queue->SetEnd(thread, JSTaggedValue(new_end)); + return *new_queue; } queue->Set(thread, end, value.GetTaggedValue()); queue->SetEnd(thread, JSTaggedValue((end + 1) % capacity)); @@ -175,7 +175,7 @@ private: return TaggedArray::Get(END_INDEX); } - static TaggedQueue *Create(JSThread *thread, uint32_t capacity, JSTaggedValue initVal = JSTaggedValue::Hole()); + static TaggedQueue *Create(JSThread *thread, uint32_t capacity, JSTaggedValue init_val = JSTaggedValue::Hole()); }; } // namespace panda::ecmascript #endif // ECMASCRIPT_TAGGED_QUEUE_H diff --git a/runtime/template_string.h b/runtime/template_string.h index a2e8c40c9..812689ae5 100644 --- a/runtime/template_string.h +++ b/runtime/template_string.h @@ -21,7 +21,7 @@ namespace panda::ecmascript { class TemplateString { public: - static JSHandle GetTemplateObject(JSThread *thread, JSHandle templateLiteral); + static JSHandle GetTemplateObject(JSThread *thread, JSHandle template_literal); }; } // namespace panda::ecmascript #endif // ECMASCRIPT_TEMPLATE_STRING_H diff --git a/runtime/tooling/pt_js_extractor.h b/runtime/tooling/pt_js_extractor.h index 9929d83ac..702cfcf71 100644 --- a/runtime/tooling/pt_js_extractor.h +++ b/runtime/tooling/pt_js_extractor.h @@ -47,14 +47,14 @@ public: } template - bool MatchWithOffset(const Callback &cb, File::EntityId methodId, uint32_t offset) + bool MatchWithOffset(const Callback &cb, File::EntityId method_id, uint32_t offset) { - auto lineTable = GetLineNumberTable(methodId); - auto columnTable = GetColumnNumberTable(methodId); + auto line_table = GetLineNumberTable(method_id); + auto column_table = GetColumnNumberTable(method_id); size_t line = 0; size_t column = 0; - for (const auto &pair : lineTable) { + for (const auto &pair : line_table) { if (offset < pair.offset) { break; } @@ -65,7 +65,7 @@ public: line = pair.line; } - for (const auto &pair : columnTable) { + for (const auto &pair : column_table) { if (offset < pair.offset) { break; } diff --git a/runtime/transitions_dictionary.h b/runtime/transitions_dictionary.h index e3fa3126a..d92afe288 100644 --- a/runtime/transitions_dictionary.h +++ b/runtime/transitions_dictionary.h @@ -26,7 +26,7 @@ class TransitionsDictionary : public TaggedHashTable { public: using HashTableT = TaggedHashTable; static inline bool IsMatch([[maybe_unused]] const JSTaggedValue &key, - [[maybe_unused]] const JSTaggedValue &otherKey) + [[maybe_unused]] const JSTaggedValue &other_key) { UNREACHABLE(); } @@ -35,13 +35,13 @@ public: UNREACHABLE(); } - static inline bool IsMatch(const JSTaggedValue &key, const JSTaggedValue &metaData, const JSTaggedValue &otherKey, - const JSTaggedValue &otherDetails) + static inline bool IsMatch(const JSTaggedValue &key, const JSTaggedValue &meta_data, const JSTaggedValue &other_key, + const JSTaggedValue &other_details) { - return key == otherKey && metaData == otherDetails; + return key == other_key && meta_data == other_details; } - static inline int Hash(const JSTaggedValue &key, const JSTaggedValue &metaData) + static inline int Hash(const JSTaggedValue &key, const JSTaggedValue &meta_data) { ASSERT(key.IsStringOrSymbol()); @@ -51,8 +51,8 @@ public: } else if (key.IsSymbol()) { hash = static_cast(JSSymbol::Cast(key.GetTaggedObject())->GetHashField()).GetInt(); } - int metaDataHash = metaData.IsInt() ? metaData.GetInt() : static_cast(metaData.GetRawData()); - return hash + metaDataHash; + int meta_data_hash = meta_data.IsInt() ? meta_data.GetInt() : static_cast(meta_data.GetRawData()); + return hash + meta_data_hash; } inline static int GetKeyIndex(int entry) @@ -79,9 +79,9 @@ public: static constexpr int DEFAULT_ELEMENTS_NUMBER = 16; static JSHandle Create(const JSThread *thread, - int numberOfElements = DEFAULT_ELEMENTS_NUMBER) + int number_of_elements = DEFAULT_ELEMENTS_NUMBER) { - return HashTableT::Create(thread, numberOfElements); + return HashTableT::Create(thread, number_of_elements); } // Attempt to shrink the dictionary after deletion of key. @@ -96,18 +96,18 @@ public: int index = GetEntryIndex(entry) + ENTRY_DETAILS_INDEX; return HashTableT::Get(index); } - inline void SetAttributes(const JSThread *thread, int entry, JSTaggedValue metaData) + inline void SetAttributes(const JSThread *thread, int entry, JSTaggedValue meta_data) { int index = GetEntryIndex(entry) + ENTRY_DETAILS_INDEX; - HashTableT::Set(thread, index, metaData); + HashTableT::Set(thread, index, meta_data); } inline void SetEntry(const JSThread *thread, int entry, const JSTaggedValue &key, const JSTaggedValue &value, - const JSTaggedValue &metaData) + const JSTaggedValue &meta_data) { SetKey(thread, entry, key); SetValue(thread, entry, value); - SetAttributes(thread, entry, metaData); + SetAttributes(thread, entry, meta_data); } inline void RemoveElement(const JSThread *thread, int entry) @@ -118,15 +118,15 @@ public: IncreaseHoleEntriesCount(thread); } - int FindEntry(const JSTaggedValue &key, const JSTaggedValue &metaData); + int FindEntry(const JSTaggedValue &key, const JSTaggedValue &meta_data); static JSHandle PutIfAbsent(const JSThread *thread, const JSHandle &dictionary, const JSHandle &key, const JSHandle &value, - const JSHandle &metaData); + const JSHandle &meta_data); static JSHandle Remove(const JSThread *thread, const JSHandle &table, - const JSHandle &key, const JSTaggedValue &metaData); - void Rehash(const JSThread *thread, TransitionsDictionary *newTable); + const JSHandle &key, const JSTaggedValue &meta_data); + void Rehash(const JSThread *thread, TransitionsDictionary *new_table); static constexpr int ENTRY_SIZE = 3; static constexpr int ENTRY_KEY_INDEX = 0; diff --git a/runtime/vmstat/caller_stat.cpp b/runtime/vmstat/caller_stat.cpp index d03570835..37a2f7512 100644 --- a/runtime/vmstat/caller_stat.cpp +++ b/runtime/vmstat/caller_stat.cpp @@ -19,7 +19,7 @@ namespace panda::ecmascript { void PandaRuntimeTimer::Start(PandaRuntimeCallerStat *callerStat, PandaRuntimeTimer *parent) { parent_ = parent; - callerStat_ = callerStat; + caller_stat_ = callerStat; uint64_t nowTime = Now(); if (parent != nullptr) { parent_->Pause(nowTime); diff --git a/runtime/vmstat/caller_stat.h b/runtime/vmstat/caller_stat.h index 9ccdc3da9..c6eb71420 100644 --- a/runtime/vmstat/caller_stat.h +++ b/runtime/vmstat/caller_stat.h @@ -38,9 +38,9 @@ public: void UpdateState(uint64_t elapsed) { - totalCount_++; - totalTime_ += elapsed; - maxTime_ = elapsed < maxTime_ ? maxTime_ : elapsed; + total_count_++; + total_time_ += elapsed; + max_time_ = elapsed < max_time_ ? max_time_ : elapsed; } const char *Name() const { @@ -48,39 +48,39 @@ public: } uint64_t TotalCount() const { - return totalCount_; + return total_count_; } uint64_t TotalTime() const { - return totalTime_; + return total_time_; } uint64_t MaxTime() const { - return maxTime_; + return max_time_; } void Reset() { - totalCount_ = 0; - totalTime_ = 0; - maxTime_ = 0; + total_count_ = 0; + total_time_ = 0; + max_time_ = 0; } private: PandaString name_ {}; - uint64_t totalCount_ {0}; - uint64_t totalTime_ {0}; - uint64_t maxTime_ {0}; + uint64_t total_count_ {0}; + uint64_t total_time_ {0}; + uint64_t max_time_ {0}; }; class PandaRuntimeTimer { public: - void Start(PandaRuntimeCallerStat *callerStat, PandaRuntimeTimer *parent); + void Start(PandaRuntimeCallerStat *caller_stat, PandaRuntimeTimer *parent); inline static uint64_t Now() { - struct timespec timeNow = {0, 0}; - clock_gettime(CLOCK_REALTIME, &timeNow); - return timeNow.tv_sec * NANOSECONDSINSECOND + timeNow.tv_nsec; + struct timespec time_now = {0, 0}; + clock_gettime(CLOCK_REALTIME, &time_now); + return time_now.tv_sec * NANOSECONDSINSECOND + time_now.tv_nsec; } uint64_t Elapsed() const @@ -102,7 +102,7 @@ public: inline void UpdateCallerState() { - callerStat_->UpdateState(elapsed_); + caller_stat_->UpdateState(elapsed_); } private: @@ -110,7 +110,7 @@ private: PandaRuntimeTimer *Stop(); void Pause(uint64_t now); void Resume(uint64_t now); - PandaRuntimeCallerStat *callerStat_ {nullptr}; + PandaRuntimeCallerStat *caller_stat_ {nullptr}; PandaRuntimeTimer *parent_ {nullptr}; uint64_t start_ {0}; uint64_t elapsed_ {0}; diff --git a/runtime/vmstat/runtime_stat.cpp b/runtime/vmstat/runtime_stat.cpp index a9cf7b09b..1df69bee9 100644 --- a/runtime/vmstat/runtime_stat.cpp +++ b/runtime/vmstat/runtime_stat.cpp @@ -26,44 +26,44 @@ EcmaRuntimeStat::EcmaRuntimeStat(const char *const runtimeCallerNames[], int cou { for (int i = 0; i < count; i++) { // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) - callerStat_.emplace_back(PandaRuntimeCallerStat(PandaString(runtimeCallerNames[i]))); + caller_stat_.emplace_back(PandaRuntimeCallerStat(PandaString(runtimeCallerNames[i]))); } } void EcmaRuntimeStat::StartCount(PandaRuntimeTimer *timer, int callerId) { - if (currentTimer_ != nullptr) { - timer->SetParent(currentTimer_); + if (current_timer_ != nullptr) { + timer->SetParent(current_timer_); } - PandaRuntimeTimer *parent = currentTimer_; - currentTimer_ = timer; - PandaRuntimeCallerStat *callerStat = &callerStat_[callerId]; + PandaRuntimeTimer *parent = current_timer_; + current_timer_ = timer; + PandaRuntimeCallerStat *callerStat = &caller_stat_[callerId]; timer->Start(callerStat, parent); } void EcmaRuntimeStat::StopCount(const PandaRuntimeTimer *nowTimer) { - if (nowTimer != currentTimer_) { + if (nowTimer != current_timer_) { return; } - PandaRuntimeTimer *parentTimer = currentTimer_->Stop(); - currentTimer_ = parentTimer; + PandaRuntimeTimer *parentTimer = current_timer_->Stop(); + current_timer_ = parentTimer; } void EcmaRuntimeStat::Print() const { - if (currentTimer_ != nullptr) { - currentTimer_->Snapshot(); + if (current_timer_ != nullptr) { + current_timer_->Snapshot(); } LOG_ECMA(ERROR) << GetAllStats(); } void EcmaRuntimeStat::ResetAllCount() { - while (currentTimer_ != nullptr) { - StopCount(currentTimer_); + while (current_timer_ != nullptr) { + StopCount(current_timer_); } - for (auto &runCallerStat : callerStat_) { + for (auto &runCallerStat : caller_stat_) { runCallerStat.Reset(); } } @@ -81,7 +81,7 @@ PandaString EcmaRuntimeStat::GetAllStats() const statistic << "===========================================================================================" << "=======================================" << std::endl; - for (auto &runCallerStat : callerStat_) { + for (auto &runCallerStat : caller_stat_) { if (runCallerStat.TotalCount() != 0) { statistic << std::right << std::setw(nameRightAdjustment) << runCallerStat.Name() << std::setw(numberRightAdjustment) << runCallerStat.TotalTime() diff --git a/runtime/vmstat/runtime_stat.h b/runtime/vmstat/runtime_stat.h index 8daa6a8e0..1d278c656 100644 --- a/runtime/vmstat/runtime_stat.h +++ b/runtime/vmstat/runtime_stat.h @@ -24,43 +24,43 @@ namespace panda::ecmascript { class EcmaRuntimeStat { public: // NOLINTNEXTLINE(modernize-avoid-c-arrays) - explicit EcmaRuntimeStat(const char *const runtimeCallerNames[], int count); + explicit EcmaRuntimeStat(const char *const runtime_caller_names[], int count); EcmaRuntimeStat() = default; virtual ~EcmaRuntimeStat() = default; DEFAULT_NOEXCEPT_MOVE_SEMANTIC(EcmaRuntimeStat); DEFAULT_COPY_SEMANTIC(EcmaRuntimeStat); - void StartCount(PandaRuntimeTimer *timer, int callerId); + void StartCount(PandaRuntimeTimer *timer, int caller_id); void StopCount(const PandaRuntimeTimer *timer); PandaString GetAllStats() const; void ResetAllCount(); void Print() const; private: - PandaRuntimeTimer *currentTimer_ = nullptr; - PandaVector callerStat_ {}; + PandaRuntimeTimer *current_timer_ = nullptr; + PandaVector caller_stat_ {}; }; class RuntimeTimerScope { public: - explicit RuntimeTimerScope(JSThread *thread, int callerId, EcmaRuntimeStat *stat) + explicit RuntimeTimerScope(JSThread *thread, int caller_id, EcmaRuntimeStat *stat) { - bool statEnabled = thread->GetEcmaVM()->IsRuntimeStatEnabled(); - if (!statEnabled || stat == nullptr) { + bool stat_enabled = thread->GetEcmaVM()->IsRuntimeStatEnabled(); + if (!stat_enabled || stat == nullptr) { return; } stats_ = stat; - stats_->StartCount(&timer_, callerId); + stats_->StartCount(&timer_, caller_id); } - RuntimeTimerScope(const EcmaVM *vm, int callerId, EcmaRuntimeStat *stat) + RuntimeTimerScope(const EcmaVM *vm, int caller_id, EcmaRuntimeStat *stat) { - bool statEnabled = vm->IsRuntimeStatEnabled(); - if (!statEnabled || stat == nullptr) { + bool stat_enabled = vm->IsRuntimeStatEnabled(); + if (!stat_enabled || stat == nullptr) { return; } stats_ = stat; - stats_->StartCount(&timer_, callerId); + stats_->StartCount(&timer_, caller_id); } ~RuntimeTimerScope() { diff --git a/runtime/weak_vector.h b/runtime/weak_vector.h index 2495a7c7f..645d4b88c 100644 --- a/runtime/weak_vector.h +++ b/runtime/weak_vector.h @@ -30,7 +30,7 @@ public: static constexpr uint32_t DEFALUT_CAPACITY = 4; static JSHandle Create(const JSThread *thread, uint32_t capacity = DEFALUT_CAPACITY); - static JSHandle Grow(const JSThread *thread, const JSHandle &old, uint32_t newCapacity); + static JSHandle Grow(const JSThread *thread, const JSHandle &old, uint32_t new_capacity); uint32_t PushBack(const JSThread *thread, JSTaggedValue value); // just set index value to Hole bool Delete(const JSThread *thread, uint32_t index); diff --git a/tests/runtime/builtins/builtins_date_test.cpp b/tests/runtime/builtins/builtins_date_test.cpp index d589fa3b5..96f8e1d50 100644 --- a/tests/runtime/builtins/builtins_date_test.cpp +++ b/tests/runtime/builtins/builtins_date_test.cpp @@ -70,7 +70,7 @@ JSHandle JSDateCreateTest(JSThread *thread) return dateObject; } -static std::unique_ptr CreateAndSetRuntimeCallInfo(JSThread *thread, array_size_t argvLength, +static std::unique_ptr CreateAndSetRuntimeCallInfo(JSThread *thread, ArraySizeT argvLength, JSTaggedValue this_value) { auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), argvLength); diff --git a/tests/runtime/common/ecma_string_test.cpp b/tests/runtime/common/ecma_string_test.cpp index 0dc91ffc5..9be81f79a 100644 --- a/tests/runtime/common/ecma_string_test.cpp +++ b/tests/runtime/common/ecma_string_test.cpp @@ -77,12 +77,12 @@ TEST_F(EcmaStringTest, CanBeCompressed) EXPECT_TRUE(EcmaString::CanBeCompressed(arrayU16Comp, sizeof(arrayU16Comp) / sizeof(arrayU16Comp[0]))); EXPECT_FALSE(EcmaString::CanBeCompressed(arrayU16NotComp, sizeof(arrayU16Comp) / sizeof(arrayU16Comp[0]))); - EcmaString::SetCompressedStringsEnabled(false); // Set compressedStringsEnabled false. + EcmaString::SetCompressedStringsEnabled(false); // Set compressed_strings_enabled_ false. EXPECT_FALSE(EcmaString::CanBeCompressed(arrayU16NotComp, sizeof(arrayU16Comp) / sizeof(arrayU16Comp[0]))); - /* Set compressedStringsEnabled default, because it is a static boolean that some other functions rely on.The foll- - * owing TEST_F will come to an unexpected result if we do not set it default in the end of this TEST_F. + /* Set compressed_strings_enabled_ default, because it is a static boolean that some other functions rely on.The + * foll- owing TEST_F will come to an unexpected result if we do not set it default in the end of this TEST_F. */ - EcmaString::SetCompressedStringsEnabled(true); // Set compressedStringsEnabled true(default). + EcmaString::SetCompressedStringsEnabled(true); // Set compressed_strings_enabled_ true(default). } /* @@ -101,11 +101,11 @@ TEST_F(EcmaStringTest, CreateEmptyString) EXPECT_TRUE(handleEcmaStrEmpty->IsUtf8()); EXPECT_FALSE(handleEcmaStrEmpty->IsUtf16()); - EcmaString::SetCompressedStringsEnabled(false); // Set compressedStringsEnabled false. + EcmaString::SetCompressedStringsEnabled(false); // Set compressed_strings_enabled_ false. JSHandle handleEcmaStrEmptyDisableComp(thread, EcmaString::CreateEmptyString(ecmaVMPtr)); EXPECT_EQ(handleEcmaStrEmptyDisableComp->GetLength(), 0); EXPECT_TRUE(handleEcmaStrEmptyDisableComp->IsUtf16()); - EcmaString::SetCompressedStringsEnabled(true); // Set compressedStringsEnabled true(default). + EcmaString::SetCompressedStringsEnabled(true); // Set compressed_strings_enabled_ true(default). } /* @@ -139,11 +139,11 @@ TEST_F(EcmaStringTest, AllocStringObject) EXPECT_EQ(handleEcmaStrAllocNotComp->GetLength(), sizeAllocNotComp); EXPECT_FALSE(handleEcmaStrAllocNotComp->IsUtf8()); EXPECT_TRUE(handleEcmaStrAllocNotComp->IsUtf16()); - EcmaString::SetCompressedStringsEnabled(false); // Set compressedStringsEnabled false. + EcmaString::SetCompressedStringsEnabled(false); // Set compressed_strings_enabled_ false. JSHandle handleEcmaStrAllocNotCompDisableComp( thread, EcmaString::AllocStringObject(sizeAllocNotComp, false, ecmaVMPtr)); EXPECT_TRUE(handleEcmaStrAllocNotCompDisableComp->IsUtf16()); - EcmaString::SetCompressedStringsEnabled(true); // Set compressedStringsEnabled true(default). + EcmaString::SetCompressedStringsEnabled(true); // Set compressed_strings_enabled_ true(default). } /* @@ -195,11 +195,11 @@ TEST_F(EcmaStringTest, CreateFromUtf16) EXPECT_EQ(handleEcmaStrU16NotComp->GetLength(), lengthEcmaStrU16NotComp); EXPECT_FALSE(handleEcmaStrU16NotComp->IsUtf8()); EXPECT_TRUE(handleEcmaStrU16NotComp->IsUtf16()); - EcmaString::SetCompressedStringsEnabled(false); // Set compressedStringsEnabled false. + EcmaString::SetCompressedStringsEnabled(false); // Set compressed_strings_enabled_ false. JSHandle handleEcmaStrU16NotCompDisableComp( thread, EcmaString::CreateFromUtf16(&arrayU16NotComp[0], lengthEcmaStrU16NotComp, ecmaVMPtr, false)); EXPECT_TRUE(handleEcmaStrU16NotCompDisableComp->IsUtf16()); - EcmaString::SetCompressedStringsEnabled(true); // Set compressedStringsEnabled true(default). + EcmaString::SetCompressedStringsEnabled(true); // Set compressed_strings_enabled_ true(default). } /* @@ -613,7 +613,7 @@ TEST_F(EcmaStringTest, Concat_004) /* Concat() after SetCompressedStringsEnabled(false). EcmaString made by CreateFromUtf16( , , , false) and * EcmaString made by CreateFromUtf16( , , , false). */ - EcmaString::SetCompressedStringsEnabled(false); // Set compressedStringsEnabled false. + EcmaString::SetCompressedStringsEnabled(false); // Set compressed_strings_enabled_ false. uint16_t arrayFrontU16NotComp[] = {128, 129, 256, 11100, 65535, 100}; uint16_t arrayBackU16NotComp[] = {88, 768, 1, 270, 345, 333}; uint32_t lengthEcmaStrFrontU16NotComp = sizeof(arrayFrontU16NotComp) / sizeof(arrayFrontU16NotComp[0]); @@ -634,7 +634,7 @@ TEST_F(EcmaStringTest, Concat_004) } EXPECT_EQ(handleEcmaStrConcatU16NotCompAfterSetFalse->GetLength(), lengthEcmaStrFrontU16NotComp + lengthEcmaStrBackU16NotComp); - EcmaString::SetCompressedStringsEnabled(true); // Set compressedStringsEnabled true(default). + EcmaString::SetCompressedStringsEnabled(true); // Set compressed_strings_enabled_ true(default). } /* @@ -1742,11 +1742,11 @@ TEST_F(EcmaStringTest, GetHashcode_003) } EXPECT_EQ(handleEcmaStrU16NotComp->GetHashcode(), static_cast(hashExpect)); - EcmaString::SetCompressedStringsEnabled(false); // Set compressedStringsEnabled false. + EcmaString::SetCompressedStringsEnabled(false); // Set compressed_strings_enabled_ false. JSHandle handleEcmaStrU16NotCompDisableComp( thread, EcmaString::CreateFromUtf16(&arrayU16NotComp[0], lengthEcmaStrU16NotComp, ecmaVMPtr, false)); EXPECT_EQ(handleEcmaStrU16NotCompDisableComp->GetHashcode(), static_cast(hashExpect)); - EcmaString::SetCompressedStringsEnabled(true); // Set compressedStringsEnabled true(default). + EcmaString::SetCompressedStringsEnabled(true); // Set compressed_strings_enabled_ true(default). } /* @@ -1764,10 +1764,10 @@ TEST_F(EcmaStringTest, GetHashcode_004) JSHandle handleEcmaStrEmpty(thread, EcmaString::CreateEmptyString(ecmaVMPtr)); EXPECT_EQ(handleEcmaStrEmpty->GetHashcode(), 0); - EcmaString::SetCompressedStringsEnabled(false); // Set compressedStringsEnabled false. + EcmaString::SetCompressedStringsEnabled(false); // Set compressed_strings_enabled_ false. JSHandle handleEcmaStrEmptyDisableComp(thread, EcmaString::CreateEmptyString(ecmaVMPtr)); EXPECT_EQ(handleEcmaStrEmptyDisableComp->GetHashcode(), 0); - EcmaString::SetCompressedStringsEnabled(true); // Set compressedStringsEnabled true(default). + EcmaString::SetCompressedStringsEnabled(true); // Set compressed_strings_enabled_ true(default). } /* @@ -1789,11 +1789,11 @@ TEST_F(EcmaStringTest, GetHashcode_005) EXPECT_EQ(handleEcmaStrAllocComp->GetHashcode(), 0); EXPECT_EQ(handleEcmaStrAllocNotComp->GetHashcode(), 0); - EcmaString::SetCompressedStringsEnabled(false); // Set compressedStringsEnabled false. + EcmaString::SetCompressedStringsEnabled(false); // Set compressed_strings_enabled_ false. JSHandle handleEcmaStrAllocNotCompDisableComp( thread, EcmaString::AllocStringObject(sizeAlloc, false, ecmaVMPtr)); EXPECT_EQ(handleEcmaStrAllocNotCompDisableComp->GetHashcode(), 0); - EcmaString::SetCompressedStringsEnabled(true); // Set compressedStringsEnabled true(default). + EcmaString::SetCompressedStringsEnabled(true); // Set compressed_strings_enabled_ true(default). } /* diff --git a/tests/runtime/common/test_helper.cpp b/tests/runtime/common/test_helper.cpp index e04bac096..ee0f2dcf4 100644 --- a/tests/runtime/common/test_helper.cpp +++ b/tests/runtime/common/test_helper.cpp @@ -25,7 +25,7 @@ thread_local bool TestHelper::isLeaf = true; ecmascript::JSHandle TestHelper::methodFunction_ {}; std::unique_ptr TestHelper::CreateEcmaRuntimeCallInfo(JSThread *thread, JSTaggedValue newTgt, - array_size_t argvLength) + ArraySizeT argvLength) { auto method = thread->GetEcmaVM()->GetMethodForNativeFunction(nullptr); if (isLeaf && thread->GetCurrentFrame() != nullptr) { diff --git a/tests/runtime/common/test_helper.h b/tests/runtime/common/test_helper.h index 8d865e140..5a24c1e2d 100644 --- a/tests/runtime/common/test_helper.h +++ b/tests/runtime/common/test_helper.h @@ -37,7 +37,7 @@ using panda::ecmascript::JSThread; class TestHelper { public: static std::unique_ptr CreateEcmaRuntimeCallInfo(JSThread *thread, JSTaggedValue newTgt, - array_size_t argvLength); + ArraySizeT argvLength); static Frame *SetupFrame(JSThread *thread, [[maybe_unused]] EcmaRuntimeCallInfo *info); static void TearDownFrame([[maybe_unused]] JSThread *thread, [[maybe_unused]] Frame *prev); -- Gitee From 5735fe516bd1b6e1b1bd8392ea9a74023f715d9a Mon Sep 17 00:00:00 2001 From: Nazarov Konstantin Date: Fri, 7 Oct 2022 16:26:00 +0300 Subject: [PATCH 2/2] additional fixes to runtime --- ecmastdlib/ecmastdlib.pa | 2 +- runtime/base/error_helper.cpp | 12 +- runtime/base/typed_array_helper.cpp | 34 +- runtime/base/typed_array_helper.h | 4 +- runtime/builtins.cpp | 8 +- runtime/builtins/builtins_array.cpp | 16 +- runtime/builtins/builtins_arraybuffer.cpp | 14 +- runtime/builtins/builtins_arraybuffer.h | 2 +- runtime/builtins/builtins_boolean.cpp | 6 +- runtime/builtins/builtins_collator.cpp | 12 +- runtime/builtins/builtins_dataview.cpp | 6 +- runtime/builtins/builtins_date.cpp | 6 +- .../builtins/builtins_date_time_format.cpp | 14 +- .../builtins_finalization_registry.cpp | 6 +- runtime/builtins/builtins_locale.cpp | 8 +- runtime/builtins/builtins_map.cpp | 6 +- runtime/builtins/builtins_number.cpp | 8 +- runtime/builtins/builtins_number_format.cpp | 16 +- runtime/builtins/builtins_object.cpp | 6 +- runtime/builtins/builtins_plural_rules.cpp | 8 +- runtime/builtins/builtins_promise.cpp | 6 +- runtime/builtins/builtins_proxy.cpp | 4 +- runtime/builtins/builtins_reflect.cpp | 16 +- runtime/builtins/builtins_regexp.cpp | 28 +- runtime/builtins/builtins_regexp.h | 4 +- .../builtins_relative_time_format.cpp | 10 +- runtime/builtins/builtins_set.cpp | 6 +- runtime/builtins/builtins_string.cpp | 62 +- runtime/builtins/builtins_symbol.cpp | 4 +- runtime/builtins/builtins_typedarray.cpp | 8 +- runtime/builtins/builtins_weak_map.cpp | 6 +- runtime/builtins/builtins_weak_ref.cpp | 6 +- runtime/builtins/builtins_weak_set.cpp | 6 +- runtime/class_info_extractor.cpp | 4 +- runtime/class_info_extractor.h | 2 +- runtime/containers/containers_arraylist.cpp | 6 +- runtime/dump.cpp | 10 +- runtime/ecma_global_storage-inl.h | 40 +- runtime/ecma_runtime.yaml | 4106 ++++++++--------- runtime/ecma_string.h | 2 +- runtime/ecma_string_table.cpp | 4 +- runtime/ecma_vm.cpp | 30 +- runtime/frames.h | 4 +- runtime/global_dictionary-inl.h | 4 +- runtime/ic/invoke_cache.h | 4 +- runtime/interpreter/ecma-interpreter-inl.h | 30 +- runtime/interpreter/slow_runtime_helper.cpp | 10 +- runtime/interpreter/slow_runtime_stub.cpp | 10 +- runtime/intrinsics-inl.h | 2 +- runtime/js_arraylist.cpp | 8 +- runtime/js_function.cpp | 4 +- runtime/js_function.h | 6 +- runtime/js_invoker.h | 4 +- runtime/js_method.h | 4 +- runtime/js_object.cpp | 20 +- runtime/js_promise.cpp | 8 +- runtime/js_proxy.h | 2 +- runtime/js_serializer.cpp | 12 +- runtime/js_stable_array.cpp | 28 +- runtime/js_tagged_value.cpp | 6 +- runtime/linked_hash_table-inl.h | 8 +- runtime/linked_hash_table.cpp | 22 +- runtime/linked_hash_table.h | 6 +- runtime/napi/include/jsnapi.h | 8 +- runtime/napi/jsnapi.cpp | 58 +- runtime/object_factory.cpp | 380 +- runtime/object_factory.h | 6 +- runtime/object_operator.cpp | 34 +- runtime/property_attributes.h | 2 +- runtime/symbol_table.h | 4 +- runtime/tagged_dictionary.cpp | 64 +- runtime/tagged_dictionary.h | 4 +- runtime/tagged_hash_table-inl.h | 2 +- runtime/template_map.h | 4 +- runtime/template_string.cpp | 6 +- runtime/vmstat/caller_stat.cpp | 4 +- runtime/vmstat/runtime_stat.cpp | 10 +- runtime/weak_vector.cpp | 10 +- .../runtime/builtins/builtins_array_test.cpp | 4 +- tests/runtime/builtins/builtins_date_test.cpp | 8 +- tests/runtime/builtins/builtins_json_test.cpp | 4 +- tests/runtime/builtins/builtins_map_test.cpp | 34 +- .../runtime/builtins/builtins_object_test.cpp | 12 +- .../runtime/builtins/builtins_proxy_test.cpp | 8 +- .../builtins/builtins_reflect_test.cpp | 2 +- .../runtime/builtins/builtins_regexp_test.cpp | 6 +- tests/runtime/builtins/builtins_set_test.cpp | 34 +- .../runtime/builtins/builtins_string_test.cpp | 4 +- .../builtins/builtins_weak_map_test.cpp | 16 +- .../builtins/builtins_weak_set_test.cpp | 16 +- tests/runtime/common/huge_object_test.cpp | 4 +- tests/runtime/common/js_arguments_test.cpp | 4 +- tests/runtime/common/js_function_test.cpp | 4 +- tests/runtime/common/js_proxy_test.cpp | 2 +- tests/runtime/common/js_serializer_test.cpp | 10 +- .../runtime/common/linked_hash_table_test.cpp | 72 +- tests/runtime/common/name_dictionary_test.cpp | 34 +- tests/runtime/common/symbol_table_test.cpp | 16 +- tests/runtime/common/test_helper.h | 4 +- tests/runtime/ic/ic_invoke_test.cpp | 22 +- .../api_tests/js/js_set_variable_test.h | 4 +- 101 files changed, 2844 insertions(+), 2842 deletions(-) diff --git a/ecmastdlib/ecmastdlib.pa b/ecmastdlib/ecmastdlib.pa index 502be2d99..e2111886d 100644 --- a/ecmastdlib/ecmastdlib.pa +++ b/ecmastdlib/ecmastdlib.pa @@ -82,7 +82,7 @@ .function void Ecmascript.Intrinsics.StLexVarDyn(u16 a0, u16 a1, any a2) .function any Ecmascript.Intrinsics.LdLexVarDyn(u16 a0, u16 a1) .function any Ecmascript.Intrinsics.ldlexenvDyn() -.function void Ecmascript.Intrinsics.PopLexenvDyn() +.function void Ecmascript.Intrinsics.popLexenvDyn() .function any Ecmascript.Intrinsics.getUnmappedArgs() .function any Ecmascript.Intrinsics.getUnmappedArgsInterp() .function any Ecmascript.Intrinsics.toboolean(any a0) diff --git a/runtime/base/error_helper.cpp b/runtime/base/error_helper.cpp index 2b97adb5e..a6821c5b1 100644 --- a/runtime/base/error_helper.cpp +++ b/runtime/base/error_helper.cpp @@ -119,18 +119,18 @@ JSTaggedValue ErrorHelper::ErrorCommonConstructor(EcmaRuntimeCallInfo *argv, JSThread *thread = argv->GetThread(); [[maybe_unused]] EcmaHandleScope handleScope(thread); - // 1. If NewTarget is undefined, let newTarget be the active function object, else let newTarget be NewTarget. + // 1. If NewTarget is undefined, let new_target be the active function object, else let new_target be NewTarget. auto ecmaVm = thread->GetEcmaVM(); ObjectFactory *factory = ecmaVm->GetFactory(); JSHandle ctor = BuiltinsBase::GetConstructor(argv); - JSMutableHandle newTarget(BuiltinsBase::GetNewTarget(argv)); - if (newTarget->IsUndefined()) { - newTarget.Update(ctor.GetTaggedValue()); + JSMutableHandle new_target(BuiltinsBase::GetNewTarget(argv)); + if (new_target->IsUndefined()) { + new_target.Update(ctor.GetTaggedValue()); } JSHandle message = BuiltinsBase::GetCallArg(argv, 0); - // 2. Let O be OrdinaryCreateFromConstructor(newTarget, "%ErrorPrototype%", «[[ErrorData]]»). - JSHandle nativeInstanceObj = factory->NewJSObjectByConstructor(JSHandle(ctor), newTarget); + // 2. Let O be OrdinaryCreateFromConstructor(new_target, "%ErrorPrototype%", «[[ErrorData]]»). + JSHandle nativeInstanceObj = factory->NewJSObjectByConstructor(JSHandle(ctor), new_target); // 3. ReturnIfAbrupt(O). RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); diff --git a/runtime/base/typed_array_helper.cpp b/runtime/base/typed_array_helper.cpp index 9c1475003..13cf8934e 100644 --- a/runtime/base/typed_array_helper.cpp +++ b/runtime/base/typed_array_helper.cpp @@ -43,9 +43,9 @@ JSTaggedValue TypedArrayHelper::TypedArrayConstructor(EcmaRuntimeCallInfo *argv, JSThread *thread = argv->GetThread(); [[maybe_unused]] EcmaHandleScope handleScope(thread); EcmaVM *ecmaVm = thread->GetEcmaVM(); - JSHandle newTarget = BuiltinsBase::GetNewTarget(argv); + JSHandle new_target = BuiltinsBase::GetNewTarget(argv); // 2. If NewTarget is undefined, throw a TypeError exception. - if (newTarget->IsUndefined()) { + if (new_target->IsUndefined()) { THROW_TYPE_ERROR_AND_RETURN(thread, "The NewTarget is undefined.", JSTaggedValue::Exception()); } // 3. Let constructorName be the String value of the Constructor Name value specified in Table 61 for this @@ -63,11 +63,11 @@ JSTaggedValue TypedArrayHelper::TypedArrayConstructor(EcmaRuntimeCallInfo *argv, elementLength = index.GetNumber(); } JSHandle obj = - TypedArrayHelper::AllocateTypedArray(factory, ecmaVm, constructorName, newTarget, elementLength); + TypedArrayHelper::AllocateTypedArray(factory, ecmaVm, constructorName, new_target, elementLength); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); return obj.GetTaggedValue(); } - JSHandle obj = TypedArrayHelper::AllocateTypedArray(factory, ecmaVm, constructorName, newTarget); + JSHandle obj = TypedArrayHelper::AllocateTypedArray(factory, ecmaVm, constructorName, new_target); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); if (firstArg->IsTypedArray()) { return TypedArrayHelper::CreateFromTypedArray(argv, obj, constructorName); @@ -277,13 +277,13 @@ JSTaggedValue TypedArrayHelper::CreateFromArrayBuffer(EcmaRuntimeCallInfo *argv, JSTaggedValue::Exception()); } // 8. If length is not undefined, then - // a. Let newLength be ? ToIndex(length). + // a. Let new_length be ? ToIndex(length). JSHandle length = BuiltinsBase::GetCallArg(argv, BuiltinsBase::ArgsPosition::THIRD); - int32_t newLength = 0; + int32_t new_length = 0; if (!length->IsUndefined()) { index = JSTaggedValue::ToIndex(thread, length); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); - newLength = static_cast(index.GetNumber()); + new_length = static_cast(index.GetNumber()); } // 9. If IsDetachedBuffer(buffer) is true, throw a TypeError exception. JSHandle buffer = BuiltinsBase::GetCallArg(argv, 0); @@ -310,9 +310,9 @@ JSTaggedValue TypedArrayHelper::CreateFromArrayBuffer(EcmaRuntimeCallInfo *argv, } } else { // 12. Else, - // a. Let newByteLength be newLength × elementSize. + // a. Let newByteLength be new_length × elementSize. // b. If offset + newByteLength > bufferByteLength, throw a RangeError exception. - newByteLength = newLength * elementSize; + newByteLength = new_length * elementSize; if (offset + newByteLength > bufferByteLength) { THROW_RANGE_ERROR_AND_RETURN(thread, "The newByteLength is out of range.", JSTaggedValue::Exception()); } @@ -329,17 +329,17 @@ JSTaggedValue TypedArrayHelper::CreateFromArrayBuffer(EcmaRuntimeCallInfo *argv, return obj.GetTaggedValue(); } -// es11 22.2.4.2.1 Runtime Semantics: AllocateTypedArray ( constructorName, newTarget, defaultProto ) +// es11 22.2.4.2.1 Runtime Semantics: AllocateTypedArray ( constructorName, new_target, defaultProto ) JSHandle TypedArrayHelper::AllocateTypedArray(ObjectFactory *factory, EcmaVM *ecmaVm, const JSHandle &constructorName, - const JSHandle &newTarget) + const JSHandle &new_target) { JSThread *thread = ecmaVm->GetJSThread(); - // 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). + // 1. Let proto be ? GetPrototypeFromConstructor(new_target, defaultProto). // 2. Let obj be ! IntegerIndexedObjectCreate(proto). RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, JSHandle(thread, JSTaggedValue::Exception())); JSHandle typedArrayFunc = TypedArrayHelper::GetConstructorFromName(thread, constructorName); - JSHandle obj = factory->NewJSObjectByConstructor(typedArrayFunc, newTarget); + JSHandle obj = factory->NewJSObjectByConstructor(typedArrayFunc, new_target); RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, JSHandle(thread, JSTaggedValue::Exception())); // 3. Assert: obj.[[ViewedArrayBuffer]] is undefined. // 4. Set obj.[[TypedArrayName]] to constructorName. @@ -355,17 +355,17 @@ JSHandle TypedArrayHelper::AllocateTypedArray(ObjectFactory *factory, return obj; } // namespace panda::ecmascript::base -// es11 22.2.4.2.1 Runtime Semantics: AllocateTypedArray ( constructorName, newTarget, defaultProto, length ) +// es11 22.2.4.2.1 Runtime Semantics: AllocateTypedArray ( constructorName, new_target, defaultProto, length ) JSHandle TypedArrayHelper::AllocateTypedArray(ObjectFactory *factory, EcmaVM *ecmaVm, const JSHandle &constructorName, - const JSHandle &newTarget, double length) + const JSHandle &new_target, double length) { JSThread *thread = ecmaVm->GetJSThread(); - // 1. Let proto be ? GetPrototypeFromConstructor(newTarget, defaultProto). + // 1. Let proto be ? GetPrototypeFromConstructor(new_target, defaultProto). // 2. Let obj be ! IntegerIndexedObjectCreate(proto). RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, JSHandle(thread, JSTaggedValue::Exception())); JSHandle typedArrayFunc = TypedArrayHelper::GetConstructorFromName(thread, constructorName); - JSHandle obj = factory->NewJSObjectByConstructor(typedArrayFunc, newTarget); + JSHandle obj = factory->NewJSObjectByConstructor(typedArrayFunc, new_target); RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, JSHandle(thread, JSTaggedValue::Exception())); // 3. Assert: obj.[[ViewedArrayBuffer]] is undefined. // 4. Set obj.[[TypedArrayName]] to constructorName. diff --git a/runtime/base/typed_array_helper.h b/runtime/base/typed_array_helper.h index accbb6e37..5cfb1b072 100644 --- a/runtime/base/typed_array_helper.h +++ b/runtime/base/typed_array_helper.h @@ -30,10 +30,10 @@ public: const JSHandle &constructorName); static JSHandle AllocateTypedArray(ObjectFactory *factory, EcmaVM *ecmaVm, const JSHandle &constructorName, - const JSHandle &newTarget); + const JSHandle &new_target); static JSHandle AllocateTypedArray(ObjectFactory *factory, EcmaVM *ecmaVm, const JSHandle &constructorName, - const JSHandle &newTarget, double length); + const JSHandle &new_target, double length); static JSHandle TypedArraySpeciesCreate(JSThread *thread, const JSHandle &obj, uint32_t argc, const JSTaggedType argv[] // NOLINT(modernize-avoid-c-arrays) ); diff --git a/runtime/builtins.cpp b/runtime/builtins.cpp index 270d73065..8c984e21f 100644 --- a/runtime/builtins.cpp +++ b/runtime/builtins.cpp @@ -2565,14 +2565,14 @@ void Builtins::InitializeGeneratorFunction(const JSHandle &env, generatorFuncInstanceDynclass->SetExtensible(true); generatorFuncInstanceDynclass->GetHClass()->MarkFieldAsNative(JSFunction::METHOD_OFFSET); // GeneratorFunction = new GeneratorFunction() - JSHandle generatorFunction = + JSHandle generator_function = NewBuiltinConstructor(env, generatorFuncPrototype, GeneratorObject::GeneratorFunctionConstructor, "GeneratorFunction", FunctionLength::ONE); JSHandle constructorKey = globalConst->GetHandledConstructorString(); - PropertyDescriptor generatorDesc(thread_, JSHandle::Cast(generatorFunction), false, false, true); + PropertyDescriptor generatorDesc(thread_, JSHandle::Cast(generator_function), false, false, true); JSObject::DefineOwnProperty(thread_, generatorFuncPrototype, constructorKey, generatorDesc); - generatorFunction->SetProtoOrDynClass(thread_, generatorFuncInstanceDynclass.GetTaggedValue()); - env->SetGeneratorFunctionFunction(thread_, generatorFunction); + generator_function->SetProtoOrDynClass(thread_, generatorFuncInstanceDynclass.GetTaggedValue()); + env->SetGeneratorFunctionFunction(thread_, generator_function); // 26.3.3.2 GeneratorFunction.prototype.prototype -> Generator prototype object. PropertyDescriptor descriptor(thread_, env->GetGeneratorPrototype(), false, false, true); diff --git a/runtime/builtins/builtins_array.cpp b/runtime/builtins/builtins_array.cpp index dfdb06991..807142316 100644 --- a/runtime/builtins/builtins_array.cpp +++ b/runtime/builtins/builtins_array.cpp @@ -51,28 +51,28 @@ JSTaggedValue BuiltinsArray::ArrayConstructor(EcmaRuntimeCallInfo *argv) // 1. Let numberOfArgs be the number of arguments passed to this function call. uint32_t argc = argv->GetArgsNumber(); - // 3. If NewTarget is undefined, let newTarget be the active function object, else let newTarget be NewTarget. + // 3. If NewTarget is undefined, let new_target be the active function object, else let new_target be NewTarget. JSHandle constructor = GetConstructor(argv); - JSHandle newTarget = GetNewTarget(argv); - if (newTarget->IsUndefined()) { - newTarget = constructor; + JSHandle new_target = GetNewTarget(argv); + if (new_target->IsUndefined()) { + new_target = constructor; } - // 4. Let proto be GetPrototypeFromConstructor(newTarget, "%ArrayPrototype%"). + // 4. Let proto be GetPrototypeFromConstructor(new_target, "%ArrayPrototype%"). // In NewJSObjectByConstructor(), will get prototype. // 5. ReturnIfAbrupt(proto). // 22.1.1.1 Array ( ) if (argc == 0) { // 6. Return ArrayCreate(0, proto). - return JSTaggedValue(JSArray::ArrayCreate(thread, JSTaggedNumber(0), newTarget).GetObject()); + return JSTaggedValue(JSArray::ArrayCreate(thread, JSTaggedNumber(0), new_target).GetObject()); } // 22.1.1.2 Array(len) if (argc == 1) { // 6. Let array be ArrayCreate(0, proto). uint32_t newLen = 0; - JSHandle newArrayHandle(JSArray::ArrayCreate(thread, JSTaggedNumber(newLen), newTarget)); + JSHandle newArrayHandle(JSArray::ArrayCreate(thread, JSTaggedNumber(newLen), new_target)); JSHandle len = GetCallArg(argv, 0); // 7. If Type(len) is not Number, then // a. Let defineStatus be CreateDataProperty(array, "0", len). @@ -101,7 +101,7 @@ JSTaggedValue BuiltinsArray::ArrayConstructor(EcmaRuntimeCallInfo *argv) } // 22.1.1.3 Array(...items ) - JSTaggedValue newArray = JSArray::ArrayCreate(thread, JSTaggedNumber(argc), newTarget).GetTaggedValue(); + JSTaggedValue newArray = JSArray::ArrayCreate(thread, JSTaggedNumber(argc), new_target).GetTaggedValue(); JSHandle newArrayHandle(thread, newArray); if (!newArray.IsArray(thread)) { THROW_TYPE_ERROR_AND_RETURN(thread, "Failed to create array.", JSTaggedValue::Exception()); diff --git a/runtime/builtins/builtins_arraybuffer.cpp b/runtime/builtins/builtins_arraybuffer.cpp index 3450c3f8c..428e32d09 100644 --- a/runtime/builtins/builtins_arraybuffer.cpp +++ b/runtime/builtins/builtins_arraybuffer.cpp @@ -39,16 +39,16 @@ JSTaggedValue BuiltinsArrayBuffer::ArrayBufferConstructor(EcmaRuntimeCallInfo *a BUILTINS_API_TRACE(argv->GetThread(), ArrayBuffer, Constructor); JSThread *thread = argv->GetThread(); [[maybe_unused]] EcmaHandleScope handleScope(thread); - JSHandle newTarget = GetNewTarget(argv); + JSHandle new_target = GetNewTarget(argv); // 1. If NewTarget is undefined, throw a TypeError exception. - if (newTarget->IsUndefined()) { + if (new_target->IsUndefined()) { THROW_TYPE_ERROR_AND_RETURN(thread, "newtarget is undefined", JSTaggedValue::Exception()); } JSHandle lengthHandle = GetCallArg(argv, 0); JSTaggedNumber lenNum = JSTaggedValue::ToIndex(thread, lengthHandle); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); double length = lenNum.GetNumber(); - return AllocateArrayBuffer(thread, newTarget, length); + return AllocateArrayBuffer(thread, new_target, length); } // 24.1.3.1 ArrayBuffer.isView(arg) @@ -215,7 +215,7 @@ JSTaggedValue BuiltinsArrayBuffer::Slice(EcmaRuntimeCallInfo *argv) } // 24.1.1.1 AllocateArrayBuffer(constructor, byteLength) -JSTaggedValue BuiltinsArrayBuffer::AllocateArrayBuffer(JSThread *thread, const JSHandle &newTarget, +JSTaggedValue BuiltinsArrayBuffer::AllocateArrayBuffer(JSThread *thread, const JSHandle &new_target, double byteLength) { BUILTINS_API_TRACE(thread, ArrayBuffer, AllocateArrayBuffer); @@ -227,13 +227,13 @@ JSTaggedValue BuiltinsArrayBuffer::AllocateArrayBuffer(JSThread *thread, const J JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); JSHandle arrBufFunc = env->GetArrayBufferFunction(); JSHandle obj; - if (!newTarget->IsBoundFunction()) { - obj = factory->NewJSObjectByConstructor(JSHandle(arrBufFunc), newTarget); + if (!new_target->IsBoundFunction()) { + obj = factory->NewJSObjectByConstructor(JSHandle(arrBufFunc), new_target); // 2. ReturnIfAbrupt RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); } else { JSHandle prototypeKey = thread->GlobalConstants()->GetHandledPrototypeString(); - JSHandle constructTag(newTarget); + JSHandle constructTag(new_target); JSHandle constructProto = JSTaggedValue::GetProperty(thread, constructTag, prototypeKey).GetValue(); obj = JSObject::ObjectCreate(thread, JSHandle(constructProto)); diff --git a/runtime/builtins/builtins_arraybuffer.h b/runtime/builtins/builtins_arraybuffer.h index a9f29b440..523ab0505 100644 --- a/runtime/builtins/builtins_arraybuffer.h +++ b/runtime/builtins/builtins_arraybuffer.h @@ -53,7 +53,7 @@ public: static JSTaggedValue CloneArrayBuffer(JSThread *thread, const JSHandle &srcBuffer, int32_t srcByteOffset, JSHandle constructor); // 24.1.1.1 AllocateArrayBuffer(constructor, byteLength) - static JSTaggedValue AllocateArrayBuffer(JSThread *thread, const JSHandle &newTarget, + static JSTaggedValue AllocateArrayBuffer(JSThread *thread, const JSHandle &new_target, double byteLength); private: diff --git a/runtime/builtins/builtins_boolean.cpp b/runtime/builtins/builtins_boolean.cpp index 6b82b1fd8..406ebdd23 100644 --- a/runtime/builtins/builtins_boolean.cpp +++ b/runtime/builtins/builtins_boolean.cpp @@ -31,15 +31,15 @@ JSTaggedValue BuiltinsBoolean::BooleanConstructor(EcmaRuntimeCallInfo *argv) // 1. Let b be ToBoolean(value). bool boolValue = GetCallArg(argv, 0)->ToBoolean(); // 2. If NewTarget is undefined, return b. - JSHandle newTarget = GetNewTarget(argv); - if (newTarget->IsUndefined()) { + JSHandle new_target = GetNewTarget(argv); + if (new_target->IsUndefined()) { return GetTaggedBoolean(boolValue); } // 3. Let O be OrdinaryCreateFromConstructor(NewTarget, "%BooleanPrototype%", [[BooleanData]] ). // 5. Set the value of O's [[BooleanData]] internal slot to b. ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); JSHandle ctor = JSHandle(GetConstructor(argv)); - JSHandle result = factory->NewJSObjectByConstructor(ctor, newTarget); + JSHandle result = factory->NewJSObjectByConstructor(ctor, new_target); JSTaggedValue objValue = boolValue ? JSTaggedValue::True() : JSTaggedValue::False(); JSPrimitiveRef::Cast(*result)->SetValue(thread, objValue); // 4. ReturnIfAbrupt(O). diff --git a/runtime/builtins/builtins_collator.cpp b/runtime/builtins/builtins_collator.cpp index d4650ebf4..dc8fc1330 100644 --- a/runtime/builtins/builtins_collator.cpp +++ b/runtime/builtins/builtins_collator.cpp @@ -31,11 +31,11 @@ JSTaggedValue BuiltinsCollator::CollatorConstructor(EcmaRuntimeCallInfo *argv) EcmaVM *ecmaVm = thread->GetEcmaVM(); ObjectFactory *factory = ecmaVm->GetFactory(); - // 1. If NewTarget is undefined, let newTarget be the active function object, else let newTarget be NewTarget. + // 1. If NewTarget is undefined, let new_target be the active function object, else let new_target be NewTarget. JSHandle constructor = GetConstructor(argv); - JSHandle newTarget = GetNewTarget(argv); - if (newTarget->IsUndefined()) { - newTarget = constructor; + JSHandle new_target = GetNewTarget(argv); + if (new_target->IsUndefined()) { + new_target = constructor; } // 2. Let internalSlotsList be « [[InitializedCollator]], [[Locale]], [[Usage]], [[Sensitivity]], // [[IgnorePunctuation]], [[Collation]], [[BoundCompare]] ». @@ -44,9 +44,9 @@ JSTaggedValue BuiltinsCollator::CollatorConstructor(EcmaRuntimeCallInfo *argv) // 4. If %Collator%.[[RelevantExtensionKeys]] contains "kf", then // a. Append [[CaseFirst]] as the last element of internalSlotsList. - // 5. Let collator be ? OrdinaryCreateFromConstructor(newTarget, "%CollatorPrototype%", internalSlotsList). + // 5. Let collator be ? OrdinaryCreateFromConstructor(new_target, "%CollatorPrototype%", internalSlotsList). JSHandle collator = - JSHandle::Cast(factory->NewJSObjectByConstructor(JSHandle(constructor), newTarget)); + JSHandle::Cast(factory->NewJSObjectByConstructor(JSHandle(constructor), new_target)); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); // 6. Return ? InitializeCollator(collator, locales, options). diff --git a/runtime/builtins/builtins_dataview.cpp b/runtime/builtins/builtins_dataview.cpp index 9bcb574d5..b11865241 100644 --- a/runtime/builtins/builtins_dataview.cpp +++ b/runtime/builtins/builtins_dataview.cpp @@ -32,9 +32,9 @@ JSTaggedValue BuiltinsDataView::DataViewConstructor(EcmaRuntimeCallInfo *argv) JSThread *thread = argv->GetThread(); [[maybe_unused]] EcmaHandleScope handleScope(thread); JSHandle ctor = GetConstructor(argv); - JSHandle newTarget = GetNewTarget(argv); + JSHandle new_target = GetNewTarget(argv); // 1. If NewTarget is undefined, throw a TypeError exception. - if (newTarget->IsUndefined()) { + if (new_target->IsUndefined()) { THROW_TYPE_ERROR_AND_RETURN(thread, "newtarget is undefined", JSTaggedValue::Exception()); } JSHandle bufferHandle = GetCallArg(argv, 0); @@ -87,7 +87,7 @@ JSTaggedValue BuiltinsDataView::DataViewConstructor(EcmaRuntimeCallInfo *argv) // 13. Let O be OrdinaryCreateFromConstructor OrdinaryCreateFromConstructor(NewTarget, "%DataViewPrototype%", // «[[DataView]],[[ViewedArrayBuffer]], [[ByteLength]], [[ByteOffset]]» ). ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - JSHandle obj = factory->NewJSObjectByConstructor(JSHandle(ctor), newTarget); + JSHandle obj = factory->NewJSObjectByConstructor(JSHandle(ctor), new_target); // 14. ReturnIfAbrupt(O). RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); JSHandle dataView(obj); diff --git a/runtime/builtins/builtins_date.cpp b/runtime/builtins/builtins_date.cpp index 391bb5a99..53f34fc64 100644 --- a/runtime/builtins/builtins_date.cpp +++ b/runtime/builtins/builtins_date.cpp @@ -32,8 +32,8 @@ JSTaggedValue BuiltinsDate::DateConstructor(EcmaRuntimeCallInfo *argv) BUILTINS_API_TRACE(argv->GetThread(), Date, Constructor); JSThread *thread = argv->GetThread(); [[maybe_unused]] EcmaHandleScope handleScope(thread); - JSHandle newTarget = GetNewTarget(argv); - if (newTarget->IsUndefined()) { + JSHandle new_target = GetNewTarget(argv); + if (new_target->IsUndefined()) { double now = JSDate::Now().GetDouble(); PandaString str = JSDate::ToDateString(now); return GetTaggedString(thread, str.c_str()); @@ -87,7 +87,7 @@ JSTaggedValue BuiltinsDate::DateConstructor(EcmaRuntimeCallInfo *argv) ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); JSHandle constructor = GetConstructor(argv); JSHandle dateObject = - JSHandle::Cast(factory->NewJSObjectByConstructor(JSHandle(constructor), newTarget)); + JSHandle::Cast(factory->NewJSObjectByConstructor(JSHandle(constructor), new_target)); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); dateObject->SetTimeValue(thread, timeValue); return JSTaggedValue(JSObject::Cast(static_cast(*dateObject))); diff --git a/runtime/builtins/builtins_date_time_format.cpp b/runtime/builtins/builtins_date_time_format.cpp index fcd77baaf..cb05d07bc 100644 --- a/runtime/builtins/builtins_date_time_format.cpp +++ b/runtime/builtins/builtins_date_time_format.cpp @@ -30,19 +30,19 @@ JSTaggedValue BuiltinsDateTimeFormat::DateTimeFormatConstructor(EcmaRuntimeCallI JSHandle env = ecmaVm->GetGlobalEnv(); ObjectFactory *factory = ecmaVm->GetFactory(); - // 1. If NewTarget is undefined, let newTarget be the active function object, else let newTarget be NewTarget. + // 1. If NewTarget is undefined, let new_target be the active function object, else let new_target be NewTarget. JSHandle constructor = GetConstructor(argv); - JSHandle newTarget = GetNewTarget(argv); - if (newTarget->IsUndefined()) { - newTarget = constructor; + JSHandle new_target = GetNewTarget(argv); + if (new_target->IsUndefined()) { + new_target = constructor; } - // 2. Let dateTimeFormat be ? OrdinaryCreateFromConstructor(newTarget, "%DateTimeFormatPrototype%", « + // 2. Let dateTimeFormat be ? OrdinaryCreateFromConstructor(new_target, "%DateTimeFormatPrototype%", « // [[InitializedDateTimeFormat]], [[Locale]], [[Calendar]], [[NumberingSystem]], [[TimeZone]], [[Weekday]], // [[Era]], [[Year]], [[Month]], [[Day]], [[Hour]], [[Minute]], [[Second]], [[TimeZoneName]], [[HourCycle]], // [[Pattern]], [[BoundFormat]] »). JSHandle dateTimeFormat = JSHandle::Cast( - factory->NewJSObjectByConstructor(JSHandle(constructor), newTarget)); + factory->NewJSObjectByConstructor(JSHandle(constructor), new_target)); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); // 3. Perform ? InitializeDateTimeFormat(dateTimeFormat, locales, options). @@ -62,7 +62,7 @@ JSTaggedValue BuiltinsDateTimeFormat::DateTimeFormatConstructor(EcmaRuntimeCallI // b. Return this. bool isInstanceOf = JSObject::InstanceOf(thread, thisValue, env->GetDateTimeFormatFunction()); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); - if (newTarget->IsUndefined() && thisValue->IsJSObject() && isInstanceOf) { + if (new_target->IsUndefined() && thisValue->IsJSObject() && isInstanceOf) { PropertyDescriptor descriptor(thread, JSHandle::Cast(dtf), false, false, false); JSHandle key(thread, JSHandle::Cast(env->GetIntlFunction())->GetFallbackSymbol()); JSTaggedValue::DefinePropertyOrThrow(thread, thisValue, key, descriptor); diff --git a/runtime/builtins/builtins_finalization_registry.cpp b/runtime/builtins/builtins_finalization_registry.cpp index a82cba231..be3790c4a 100644 --- a/runtime/builtins/builtins_finalization_registry.cpp +++ b/runtime/builtins/builtins_finalization_registry.cpp @@ -29,8 +29,8 @@ JSTaggedValue BuiltinsFinalizationRegistry::Constructor(EcmaRuntimeCallInfo *arg [[maybe_unused]] EcmaHandleScope handleScope(thread); ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); // 1.If NewTarget is undefined, throw a TypeError exception - JSHandle newTarget = GetNewTarget(argv); - if (newTarget->IsUndefined()) { + JSHandle new_target = GetNewTarget(argv); + if (new_target->IsUndefined()) { // throw type error THROW_TYPE_ERROR_AND_RETURN(thread, "new target can't be undefined", JSTaggedValue::Exception()); } @@ -41,7 +41,7 @@ JSTaggedValue BuiltinsFinalizationRegistry::Constructor(EcmaRuntimeCallInfo *arg // 3.Let FinalizationRegistry be OrdinaryCreateFromConstructor( // NewTarget, "%FinalizationRegistry.prototype%", «[[Realm]], [[CleanupCallback]], [[Cells]]») JSHandle constructor = GetConstructor(argv); - JSHandle obj = factory->NewJSObjectByConstructor(JSHandle(constructor), newTarget); + JSHandle obj = factory->NewJSObjectByConstructor(JSHandle(constructor), new_target); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); JSHandle registry = JSHandle::Cast(obj); // 4. Let fn be the active function object. diff --git a/runtime/builtins/builtins_locale.cpp b/runtime/builtins/builtins_locale.cpp index a86d4ae81..fedb69ec6 100644 --- a/runtime/builtins/builtins_locale.cpp +++ b/runtime/builtins/builtins_locale.cpp @@ -30,15 +30,15 @@ JSTaggedValue BuiltinsLocale::LocaleConstructor(EcmaRuntimeCallInfo *argv) ObjectFactory *factory = ecmaVm->GetFactory(); // 1. If NewTarget is undefined, throw a TypeError exception. - JSHandle newTarget = GetNewTarget(argv); - if (newTarget->IsUndefined()) { - THROW_TYPE_ERROR_AND_RETURN(thread, "newTarget is undefined", JSTaggedValue::Exception()); + JSHandle new_target = GetNewTarget(argv); + if (new_target->IsUndefined()) { + THROW_TYPE_ERROR_AND_RETURN(thread, "new_target is undefined", JSTaggedValue::Exception()); } // 6. Let locale be ? OrdinaryCreateFromConstructor(NewTarget, %LocalePrototype%, internalSlotsList). JSHandle constructor = GetConstructor(argv); JSHandle locale = - JSHandle::Cast(factory->NewJSObjectByConstructor(JSHandle(constructor), newTarget)); + JSHandle::Cast(factory->NewJSObjectByConstructor(JSHandle(constructor), new_target)); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); // 7. If Type(tag) is not String or Object, throw a TypeError exception. diff --git a/runtime/builtins/builtins_map.cpp b/runtime/builtins/builtins_map.cpp index a94739bd1..f0cef100f 100644 --- a/runtime/builtins/builtins_map.cpp +++ b/runtime/builtins/builtins_map.cpp @@ -32,14 +32,14 @@ JSTaggedValue BuiltinsMap::MapConstructor(EcmaRuntimeCallInfo *argv) [[maybe_unused]] EcmaHandleScope handleScope(thread); ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); // 1.If NewTarget is undefined, throw a TypeError exception - JSHandle newTarget = GetNewTarget(argv); - if (newTarget->IsUndefined()) { + JSHandle new_target = GetNewTarget(argv); + if (new_target->IsUndefined()) { // throw type error THROW_TYPE_ERROR_AND_RETURN(thread, "new target can't be undefined", JSTaggedValue::Exception()); } // 2.Let Map be OrdinaryCreateFromConstructor(NewTarget, "%MapPrototype%", «‍[[MapData]]» ). JSHandle constructor = GetConstructor(argv); - JSHandle obj = factory->NewJSObjectByConstructor(JSHandle(constructor), newTarget); + JSHandle obj = factory->NewJSObjectByConstructor(JSHandle(constructor), new_target); // 3.returnIfAbrupt() RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); JSHandle map = JSHandle::Cast(obj); diff --git a/runtime/builtins/builtins_number.cpp b/runtime/builtins/builtins_number.cpp index 2c9c0a66f..723b72fdd 100644 --- a/runtime/builtins/builtins_number.cpp +++ b/runtime/builtins/builtins_number.cpp @@ -36,7 +36,7 @@ JSTaggedValue BuiltinsNumber::NumberConstructor(EcmaRuntimeCallInfo *argv) BUILTINS_API_TRACE(argv->GetThread(), Number, Constructor); JSThread *thread = argv->GetThread(); [[maybe_unused]] EcmaHandleScope handleScope(thread); - JSHandle newTarget = GetNewTarget(argv); + JSHandle new_target = GetNewTarget(argv); // 1. If no arguments were passed to this function invocation, let n be +0. JSTaggedNumber numberValue(0); if (argv->GetArgsNumber() > 0) { @@ -46,13 +46,13 @@ JSTaggedValue BuiltinsNumber::NumberConstructor(EcmaRuntimeCallInfo *argv) RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); } // 4. If NewTarget is undefined, return n. - if (newTarget->IsUndefined()) { + if (new_target->IsUndefined()) { return numberValue; } // 5. Let O be OrdinaryCreateFromConstructor(NewTarget, "%NumberPrototype%", «[[NumberData]]» ). JSHandle constructor = GetConstructor(argv); - JSHandle result = - thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle::Cast(constructor), newTarget); + JSHandle result = thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor( + JSHandle::Cast(constructor), new_target); // 6. ReturnIfAbrupt(O). RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); // 7. Set the value of O’s [[NumberData]] internal slot to n. diff --git a/runtime/builtins/builtins_number_format.cpp b/runtime/builtins/builtins_number_format.cpp index e5889473c..ef8cc47ed 100644 --- a/runtime/builtins/builtins_number_format.cpp +++ b/runtime/builtins/builtins_number_format.cpp @@ -33,20 +33,20 @@ JSTaggedValue BuiltinsNumberFormat::NumberFormatConstructor(EcmaRuntimeCallInfo JSHandle env = ecmaVm->GetGlobalEnv(); ObjectFactory *factory = ecmaVm->GetFactory(); - // 1. If NewTarget is undefined, let newTarget be the active function object, else let newTarget be NewTarget. + // 1. If NewTarget is undefined, let new_target be the active function object, else let new_target be NewTarget. JSHandle constructor = GetConstructor(argv); - JSHandle newTarget = GetNewTarget(argv); - if (newTarget->IsUndefined()) { - newTarget = constructor; + JSHandle new_target = GetNewTarget(argv); + if (new_target->IsUndefined()) { + new_target = constructor; } - // Let numberFormat be ? OrdinaryCreateFromConstructor(newTarget, "%NumberFormatPrototype%", + // Let numberFormat be ? OrdinaryCreateFromConstructor(new_target, "%NumberFormatPrototype%", // « [[InitializedNumberFormat]], [[Locale]], [[DataLocale]], [[NumberingSystem]], [[Style]], [[Unit]], // [[UnitDisplay]], [[Currency]], [[CurrencyDisplay]], [[CurrencySign]], [[MinimumIntegerDigits]], // [[MinimumFractionDigits]], [[MaximumFractionDigits]], [[MinimumSignificantDigits]], [[MaximumSignificantDigits]], // [[RoundingType]], [[Notation]], [[CompactDisplay]], [[UseGrouping]], [[SignDisplay]], [[BoundFormat]] »). - JSHandle numberFormat = - JSHandle::Cast(factory->NewJSObjectByConstructor(JSHandle(constructor), newTarget)); + JSHandle numberFormat = JSHandle::Cast( + factory->NewJSObjectByConstructor(JSHandle(constructor), new_target)); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); // 3. Perform ? InitializeNumberFormat(numberFormat, locales, options). @@ -65,7 +65,7 @@ JSTaggedValue BuiltinsNumberFormat::NumberFormatConstructor(EcmaRuntimeCallInfo // b. Return this. bool isInstanceOf = JSObject::InstanceOf(thread, thisValue, env->GetNumberFormatFunction()); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); - if (newTarget->IsUndefined() && thisValue->IsJSObject() && isInstanceOf) { + if (new_target->IsUndefined() && thisValue->IsJSObject() && isInstanceOf) { PropertyDescriptor descriptor(thread, JSHandle::Cast(numberFormat), false, false, false); JSHandle key(thread, JSHandle::Cast(env->GetIntlFunction())->GetFallbackSymbol()); JSTaggedValue::DefinePropertyOrThrow(thread, thisValue, key, descriptor); diff --git a/runtime/builtins/builtins_object.cpp b/runtime/builtins/builtins_object.cpp index 3475bb38b..d8cf2836c 100644 --- a/runtime/builtins/builtins_object.cpp +++ b/runtime/builtins/builtins_object.cpp @@ -41,10 +41,10 @@ JSTaggedValue BuiltinsObject::ObjectConstructor(EcmaRuntimeCallInfo *argv) // 1.If NewTarget is neither undefined nor the active function, then // a.Return OrdinaryCreateFromConstructor(NewTarget, "%ObjectPrototype%"). JSHandle constructor = GetConstructor(argv); - JSHandle newTarget = GetNewTarget(argv); - if (!newTarget->IsUndefined() && !(newTarget.GetTaggedValue() == constructor.GetTaggedValue())) { + JSHandle new_target = GetNewTarget(argv); + if (!new_target->IsUndefined() && !(new_target.GetTaggedValue() == constructor.GetTaggedValue())) { JSHandle obj = - ecmaVm->GetFactory()->NewJSObjectByConstructor(JSHandle(constructor), newTarget); + ecmaVm->GetFactory()->NewJSObjectByConstructor(JSHandle(constructor), new_target); return obj.GetTaggedValue(); } diff --git a/runtime/builtins/builtins_plural_rules.cpp b/runtime/builtins/builtins_plural_rules.cpp index e50da817b..cdcb0c45f 100644 --- a/runtime/builtins/builtins_plural_rules.cpp +++ b/runtime/builtins/builtins_plural_rules.cpp @@ -31,16 +31,16 @@ JSTaggedValue BuiltinsPluralRules::PluralRulesConstructor(EcmaRuntimeCallInfo *a // 1. If NewTarget is undefined, throw a TypeError exception. JSHandle constructor = GetConstructor(argv); - JSHandle newTarget = GetNewTarget(argv); - if (newTarget->IsUndefined()) { - THROW_TYPE_ERROR_AND_RETURN(thread, "newTarget is undefined", JSTaggedValue::Exception()); + JSHandle new_target = GetNewTarget(argv); + if (new_target->IsUndefined()) { + THROW_TYPE_ERROR_AND_RETURN(thread, "new_target is undefined", JSTaggedValue::Exception()); } // 2. Let pluralRules be ? OrdinaryCreateFromConstructor(NewTarget, "%PluralRulesPrototype%", // « [[InitializedPluralRules]], [[Locale]], [[Type]], [[MinimumIntegerDigits]], [[MinimumFractionDigits]], // [[MaximumFractionDigits]], [[MinimumSignificantDigits]], [[MaximumSignificantDigits]], [[RoundingType]] »). JSHandle pluralRules = - JSHandle::Cast(factory->NewJSObjectByConstructor(JSHandle(constructor), newTarget)); + JSHandle::Cast(factory->NewJSObjectByConstructor(JSHandle(constructor), new_target)); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); // 3. Return ? InitializePluralRules(pluralRules, locales, options). diff --git a/runtime/builtins/builtins_promise.cpp b/runtime/builtins/builtins_promise.cpp index f996908c8..88a881db0 100644 --- a/runtime/builtins/builtins_promise.cpp +++ b/runtime/builtins/builtins_promise.cpp @@ -44,8 +44,8 @@ JSTaggedValue BuiltinsPromise::PromiseConstructor([[maybe_unused]] EcmaRuntimeCa ObjectFactory *factory = ecmaVm->GetFactory(); const GlobalEnvConstants *globalConst = thread->GlobalConstants(); // 1. If NewTarget is undefined, throw a TypeError exception. - JSHandle newTarget = GetNewTarget(argv); - if (newTarget->IsUndefined()) { + JSHandle new_target = GetNewTarget(argv); + if (new_target->IsUndefined()) { THROW_TYPE_ERROR_AND_RETURN(thread, "PromiseConstructor: NewTarget is undefined", JSTaggedValue::Exception()); } // 2. If IsCallable(executor) is false, throw a TypeError exception. @@ -59,7 +59,7 @@ JSTaggedValue BuiltinsPromise::PromiseConstructor([[maybe_unused]] EcmaRuntimeCa // 4. ReturnIfAbrupt(promise). JSHandle constructor = GetConstructor(argv); JSHandle instancePromise = - JSHandle::Cast(factory->NewJSObjectByConstructor(JSHandle(constructor), newTarget)); + JSHandle::Cast(factory->NewJSObjectByConstructor(JSHandle(constructor), new_target)); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); // 5. Set promise's [[PromiseState]] internal slot to "pending". diff --git a/runtime/builtins/builtins_proxy.cpp b/runtime/builtins/builtins_proxy.cpp index e19864896..5a0a74f23 100644 --- a/runtime/builtins/builtins_proxy.cpp +++ b/runtime/builtins/builtins_proxy.cpp @@ -29,8 +29,8 @@ JSTaggedValue BuiltinsProxy::ProxyConstructor(EcmaRuntimeCallInfo *argv) [[maybe_unused]] EcmaHandleScope handleScope(argv->GetThread()); // 1.If NewTarget is undefined, throw a TypeError exception. - JSHandle newTarget = GetNewTarget(argv); - if (newTarget->IsUndefined()) { + JSHandle new_target = GetNewTarget(argv); + if (new_target->IsUndefined()) { THROW_TYPE_ERROR_AND_RETURN(argv->GetThread(), "ProxyConstructor: NewTarget is undefined", JSTaggedValue::Exception()); } diff --git a/runtime/builtins/builtins_reflect.cpp b/runtime/builtins/builtins_reflect.cpp index 79782a9e8..a19edcdaa 100644 --- a/runtime/builtins/builtins_reflect.cpp +++ b/runtime/builtins/builtins_reflect.cpp @@ -44,7 +44,7 @@ JSTaggedValue BuiltinsReflect::ReflectApply(EcmaRuntimeCallInfo *argv) return JSFunction::Call(thread, target, thisArgument, args->GetLength(), arguments->GetArgv()); } -// ecma 26.1.2 Reflect.construct (target, argumentsList [ , newTarget]) +// ecma 26.1.2 Reflect.construct (target, argumentsList [ , new_target]) JSTaggedValue BuiltinsReflect::ReflectConstruct(EcmaRuntimeCallInfo *argv) { ASSERT(argv); @@ -56,12 +56,12 @@ JSTaggedValue BuiltinsReflect::ReflectConstruct(EcmaRuntimeCallInfo *argv) if (!target->IsConstructor()) { THROW_TYPE_ERROR_AND_RETURN(thread, "Reflect.construct target is not constructor", JSTaggedValue::Exception()); } - // 2. If newTarget is not present, set newTarget to target. - JSHandle newTarget = + // 2. If new_target is not present, set new_target to target. + JSHandle new_target = argv->GetArgsNumber() > 2 ? GetCallArg(argv, BuiltinsBase::ArgsPosition::THIRD) : target; // 2: num args - // 3. Else if IsConstructor(newTarget) is false, throw a TypeError exception. - if (!newTarget->IsConstructor()) { - THROW_TYPE_ERROR_AND_RETURN(thread, "Reflect.construct newTarget is present, but not constructor", + // 3. Else if IsConstructor(new_target) is false, throw a TypeError exception. + if (!new_target->IsConstructor()) { + THROW_TYPE_ERROR_AND_RETURN(thread, "Reflect.construct new_target is present, but not constructor", JSTaggedValue::Exception()); } // 4. Let args be ? CreateListFromArrayLike(argumentsList). @@ -69,10 +69,10 @@ JSTaggedValue BuiltinsReflect::ReflectConstruct(EcmaRuntimeCallInfo *argv) JSHandle argOrAbrupt = JSObject::CreateListFromArrayLike(thread, argumentsList); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); JSHandle args = JSHandle::Cast(argOrAbrupt); - // 5. Return ? Construct(target, args, newTarget). + // 5. Return ? Construct(target, args, new_target). InternalCallParams *arguments = thread->GetInternalCallParams(); arguments->MakeArgList(*args); - return JSFunction::Construct(thread, target, args->GetLength(), arguments->GetArgv(), newTarget); + return JSFunction::Construct(thread, target, args->GetLength(), arguments->GetArgv(), new_target); } // ecma 26.1.3 Reflect.defineProperty (target, propertyKey, attributes) diff --git a/runtime/builtins/builtins_regexp.cpp b/runtime/builtins/builtins_regexp.cpp index 26f925b62..ac08e5a95 100644 --- a/runtime/builtins/builtins_regexp.cpp +++ b/runtime/builtins/builtins_regexp.cpp @@ -47,18 +47,18 @@ JSTaggedValue BuiltinsRegExp::RegExpConstructor(EcmaRuntimeCallInfo *argv) bool patternIsRegExp = JSObject::IsRegExp(thread, pattern); // 2. ReturnIfAbrupt(patternIsRegExp). RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); - // 3. If NewTarget is not undefined, let newTarget be NewTarget. - JSHandle newTarget; + // 3. If NewTarget is not undefined, let new_target be NewTarget. + JSHandle new_target; const GlobalEnvConstants *globalConst = thread->GlobalConstants(); if (!newTargetTemp->IsUndefined()) { - newTarget = newTargetTemp; + new_target = newTargetTemp; } else { auto ecmaVm = thread->GetEcmaVM(); JSHandle env = ecmaVm->GetGlobalEnv(); // disable gc [[maybe_unused]] DisallowGarbageCollection no_gc; - // 4.a Let newTarget be the active function object. - newTarget = env->GetRegExpFunction(); + // 4.a Let new_target be the active function object. + new_target = env->GetRegExpFunction(); JSHandle constructorString = globalConst->GetHandledConstructorString(); // 4.b If patternIsRegExp is true and flags is undefined if (patternIsRegExp && flags->IsUndefined()) { @@ -67,8 +67,8 @@ JSTaggedValue BuiltinsRegExp::RegExpConstructor(EcmaRuntimeCallInfo *argv) thread, pattern.GetTaggedValue(), constructorString.GetTaggedValue()); // 4.b.ii ReturnIfAbrupt(patternConstructor). RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); - // 4.b.iii If SameValue(newTarget, patternConstructor) is true, return pattern. - if (JSTaggedValue::SameValue(newTarget.GetTaggedValue(), patternConstructor)) { + // 4.b.iii If SameValue(new_target, patternConstructor) is true, return pattern. + if (JSTaggedValue::SameValue(new_target.GetTaggedValue(), patternConstructor)) { return pattern.GetTaggedValue(); } } @@ -122,8 +122,8 @@ JSTaggedValue BuiltinsRegExp::RegExpConstructor(EcmaRuntimeCallInfo *argv) flagsTemp = JSHandle(thread, *JSTaggedValue::ToString(thread, flags)); } } - // 8. Let O be RegExpAlloc(newTarget). - JSHandle object(thread, RegExpAlloc(thread, newTarget)); + // 8. Let O be RegExpAlloc(new_target). + JSHandle object(thread, RegExpAlloc(thread, new_target)); // 9. ReturnIfAbrupt(O). RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); // 10. Return RegExpInitialize(O, P, F). @@ -1592,16 +1592,16 @@ JSTaggedValue BuiltinsRegExp::RegExpExec(JSThread *thread, const JSHandle &newTarget) +JSTaggedValue BuiltinsRegExp::RegExpAlloc(JSThread *thread, const JSHandle &new_target) { /** - * 1. Let obj be OrdinaryCreateFromConstructor(newTarget, "%RegExpPrototype%", + * 1. Let obj be OrdinaryCreateFromConstructor(new_target, "%RegExpPrototype%", * «[[RegExpMatcher]],[[OriginalSource]], [[OriginalFlags]]»). * */ ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); JSHandle func = env->GetRegExpFunction(); - JSHandle obj(factory->NewJSObjectByConstructor(JSHandle(func), newTarget)); + JSHandle obj(factory->NewJSObjectByConstructor(JSHandle(func), new_target)); // 2. ReturnIfAbrupt(obj). RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); // 5. Return obj. @@ -1780,9 +1780,9 @@ JSTaggedValue BuiltinsRegExp::RegExpCreate(JSThread *thread, const JSHandleGetEcmaVM(); JSHandle env = ecmaVm->GetGlobalEnv(); - JSHandle newTarget = env->GetRegExpFunction(); + JSHandle new_target = env->GetRegExpFunction(); // 1. Let obj be RegExpAlloc(%RegExp%). - JSHandle object(thread, RegExpAlloc(thread, newTarget)); + JSHandle object(thread, RegExpAlloc(thread, new_target)); // 2. ReturnIfAbrupt(obj). RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); // 3. Return RegExpInitialize(obj, P, F). diff --git a/runtime/builtins/builtins_regexp.h b/runtime/builtins/builtins_regexp.h index 4d4f8569e..5d7f28602 100644 --- a/runtime/builtins/builtins_regexp.h +++ b/runtime/builtins/builtins_regexp.h @@ -85,8 +85,8 @@ private: static JSTaggedValue RegExpBuiltinExec(JSThread *thread, const JSHandle ®exp, const JSHandle &inputStr, bool useCache); - // 21.2.3.2.1 Runtime Semantics: RegExpAlloc ( newTarget ) - static JSTaggedValue RegExpAlloc(JSThread *thread, const JSHandle &newTarget); + // 21.2.3.2.1 Runtime Semantics: RegExpAlloc ( new_target ) + static JSTaggedValue RegExpAlloc(JSThread *thread, const JSHandle &new_target); static uint32_t UpdateExpressionFlags(JSThread *thread, const PandaString &checkStr); diff --git a/runtime/builtins/builtins_relative_time_format.cpp b/runtime/builtins/builtins_relative_time_format.cpp index 99e7fd216..d5202b1e2 100644 --- a/runtime/builtins/builtins_relative_time_format.cpp +++ b/runtime/builtins/builtins_relative_time_format.cpp @@ -25,9 +25,9 @@ JSTaggedValue BuiltinsRelativeTimeFormat::RelativeTimeFormatConstructor(EcmaRunt ObjectFactory *factory = ecmaVm->GetFactory(); // 1. If NewTarget is undefined, throw a TypeError exception. - JSHandle newTarget = GetNewTarget(argv); - if (newTarget->IsUndefined()) { - THROW_TYPE_ERROR_AND_RETURN(thread, "newTarget is undefined", JSTaggedValue::Exception()); + JSHandle new_target = GetNewTarget(argv); + if (new_target->IsUndefined()) { + THROW_TYPE_ERROR_AND_RETURN(thread, "new_target is undefined", JSTaggedValue::Exception()); } // 2. Let relativeTimeFormat be ? OrdinaryCreateFromConstructor @@ -35,7 +35,7 @@ JSTaggedValue BuiltinsRelativeTimeFormat::RelativeTimeFormatConstructor(EcmaRunt // [[Locale]], [[DataLocale]], [[Style]], [[Numeric]], [[NumberFormat]], [[NumberingSystem]], [[PluralRules]] »). JSHandle constructor = GetConstructor(argv); JSHandle relativeTimeFormat = JSHandle::Cast( - factory->NewJSObjectByConstructor(JSHandle(constructor), newTarget)); + factory->NewJSObjectByConstructor(JSHandle(constructor), new_target)); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); // 3. Perform ? InitializeRelativeTimeFormat(relativeTimeFormat, locales, options). @@ -49,7 +49,7 @@ JSTaggedValue BuiltinsRelativeTimeFormat::RelativeTimeFormatConstructor(EcmaRunt JSHandle thisValue = GetThis(argv); bool isInstanceOf = JSObject::InstanceOf(thread, thisValue, env->GetRelativeTimeFormatFunction()); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); - if (newTarget->IsUndefined() && thisValue->IsJSObject() && isInstanceOf) { + if (new_target->IsUndefined() && thisValue->IsJSObject() && isInstanceOf) { PropertyDescriptor descriptor(thread, JSHandle::Cast(relativeTimeFormat), false, false, true); JSHandle key(thread, JSHandle::Cast(env->GetIntlFunction())->GetFallbackSymbol()); JSTaggedValue::DefinePropertyOrThrow(thread, thisValue, key, descriptor); diff --git a/runtime/builtins/builtins_set.cpp b/runtime/builtins/builtins_set.cpp index 5faaa2a11..f57501ad5 100644 --- a/runtime/builtins/builtins_set.cpp +++ b/runtime/builtins/builtins_set.cpp @@ -33,14 +33,14 @@ JSTaggedValue BuiltinsSet::SetConstructor(EcmaRuntimeCallInfo *argv) [[maybe_unused]] EcmaHandleScope handleScope(thread); ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); // 1.If NewTarget is undefined, throw a TypeError exception - JSHandle newTarget = GetNewTarget(argv); - if (newTarget->IsUndefined()) { + JSHandle new_target = GetNewTarget(argv); + if (new_target->IsUndefined()) { // throw type error THROW_TYPE_ERROR_AND_RETURN(thread, "new target can't be undefined", JSTaggedValue::Exception()); } // 2.Let set be OrdinaryCreateFromConstructor(NewTarget, "%SetPrototype%", «‍[[SetData]]» ). JSHandle constructor = GetConstructor(argv); - JSHandle obj = factory->NewJSObjectByConstructor(JSHandle(constructor), newTarget); + JSHandle obj = factory->NewJSObjectByConstructor(JSHandle(constructor), new_target); // 3.returnIfAbrupt() RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); JSHandle set = JSHandle::Cast(obj); diff --git a/runtime/builtins/builtins_string.cpp b/runtime/builtins/builtins_string.cpp index 4f81de1da..fa9cc9fb2 100644 --- a/runtime/builtins/builtins_string.cpp +++ b/runtime/builtins/builtins_string.cpp @@ -56,15 +56,15 @@ JSTaggedValue BuiltinsString::StringConstructor(EcmaRuntimeCallInfo *argv) JSThread *thread = argv->GetThread(); [[maybe_unused]] EcmaHandleScope handleScope(thread); ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - JSHandle newTarget = GetNewTarget(argv); + JSHandle new_target = GetNewTarget(argv); if (argv->GetArgsNumber() > 0) { JSHandle valTagNew = GetCallArg(argv, 0); - if (newTarget->IsUndefined() && valTagNew->IsSymbol()) { + if (new_target->IsUndefined() && valTagNew->IsSymbol()) { return BuiltinsSymbol::SymbolDescriptiveString(thread, valTagNew.GetTaggedValue()); } JSHandle str = JSTaggedValue::ToString(thread, valTagNew); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); - if (newTarget->IsUndefined()) { + if (new_target->IsUndefined()) { return str.GetTaggedValue(); } JSHandle strTag(str); @@ -72,7 +72,7 @@ JSTaggedValue BuiltinsString::StringConstructor(EcmaRuntimeCallInfo *argv) } JSHandle val = factory->GetEmptyString(); JSHandle valTag(val); - if (newTarget->IsUndefined()) { + if (new_target->IsUndefined()) { return factory->GetEmptyString().GetTaggedValue(); } return JSPrimitiveRef::StringCreate(thread, valTag).GetTaggedValue(); @@ -197,7 +197,7 @@ JSTaggedValue BuiltinsString::Raw(EcmaRuntimeCallInfo *argv) std::u16string u16str; int argc = static_cast(argv->GetArgsNumber()) - 1; - bool canBeCompress = true; + bool can_be_compress = true; for (int i = 0, argsI = 1; i < length; ++i, ++argsI) { // Let nextSeg be ToString(Get(raw, nextKey)). JSHandle elementString = @@ -207,7 +207,7 @@ JSTaggedValue BuiltinsString::Raw(EcmaRuntimeCallInfo *argv) RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); if (nextSeg->IsUtf16()) { u16str += ecmascript::base::StringHelper::Utf16ToU16String(nextSeg->GetDataUtf16(), nextSeg->GetLength()); - canBeCompress = false; + can_be_compress = false; } else { u16str += ecmascript::base::StringHelper::Utf8ToU16String(nextSeg->GetDataUtf8(), nextSeg->GetLength()); } @@ -220,7 +220,7 @@ JSTaggedValue BuiltinsString::Raw(EcmaRuntimeCallInfo *argv) if (nextSub->IsUtf16()) { u16str += ecmascript::base::StringHelper::Utf16ToU16String(nextSub->GetDataUtf16(), nextSub->GetLength()); - canBeCompress = false; + can_be_compress = false; } else { u16str += ecmascript::base::StringHelper::Utf8ToU16String(nextSub->GetDataUtf8(), nextSub->GetLength()); } @@ -228,7 +228,7 @@ JSTaggedValue BuiltinsString::Raw(EcmaRuntimeCallInfo *argv) } // return the result string auto *uint16tData = reinterpret_cast(const_cast(u16str.data())); - return factory->NewFromUtf16LiteralUnCheck(uint16tData, u16str.size(), canBeCompress).GetTaggedValue(); + return factory->NewFromUtf16LiteralUnCheck(uint16tData, u16str.size(), can_be_compress).GetTaggedValue(); } // 21.1.3.1 @@ -337,10 +337,10 @@ JSTaggedValue BuiltinsString::Concat(EcmaRuntimeCallInfo *argv) } std::u16string u16strThis; std::u16string u16strNext; - bool canBeCompress = true; + bool can_be_compress = true; if (thisHandle->IsUtf16()) { u16strThis = ecmascript::base::StringHelper::Utf16ToU16String(thisHandle->GetDataUtf16(), thisLen); - canBeCompress = false; + can_be_compress = false; } else { u16strThis = ecmascript::base::StringHelper::Utf8ToU16String(thisHandle->GetDataUtf8(), thisLen); } @@ -350,7 +350,7 @@ JSTaggedValue BuiltinsString::Concat(EcmaRuntimeCallInfo *argv) int32_t nextLen = nextHandle->GetLength(); if (nextHandle->IsUtf16()) { u16strNext = ecmascript::base::StringHelper::Utf16ToU16String(nextHandle->GetDataUtf16(), nextLen); - canBeCompress = false; + can_be_compress = false; } else { u16strNext = ecmascript::base::StringHelper::Utf8ToU16String(nextHandle->GetDataUtf8(), nextLen); } @@ -360,7 +360,7 @@ JSTaggedValue BuiltinsString::Concat(EcmaRuntimeCallInfo *argv) auto *char16tData = const_cast(constChar16tData); auto *uint16tData = reinterpret_cast(char16tData); int32_t u16strSize = u16strThis.size(); - return factory->NewFromUtf16LiteralUnCheck(uint16tData, u16strSize, canBeCompress).GetTaggedValue(); + return factory->NewFromUtf16LiteralUnCheck(uint16tData, u16strSize, can_be_compress).GetTaggedValue(); } // 21.1.3.5 String.prototype.constructor @@ -785,10 +785,10 @@ JSTaggedValue BuiltinsString::Repeat(EcmaRuntimeCallInfo *argv) } int32_t count = ecmascript::base::NumberHelper::DoubleInRangeInt32(d); std::u16string u16strThis; - bool canBeCompress = true; + bool can_be_compress = true; if (thisHandle->IsUtf16()) { u16strThis = ecmascript::base::StringHelper::Utf16ToU16String(thisHandle->GetDataUtf16(), thisLen); - canBeCompress = false; + can_be_compress = false; } else { const uint8_t *uint8This = thisHandle->GetDataUtf8(); u16strThis = ecmascript::base::StringHelper::Utf8ToU16String(uint8This, thisLen); @@ -797,7 +797,7 @@ JSTaggedValue BuiltinsString::Repeat(EcmaRuntimeCallInfo *argv) return thisHandle.GetTaggedValue(); } - EcmaString *res = ecmascript::base::StringHelper::Repeat(thread, u16strThis, count, canBeCompress); + EcmaString *res = ecmascript::base::StringHelper::Repeat(thread, u16strThis, count, can_be_compress); return JSTaggedValue(res); } @@ -987,7 +987,7 @@ JSTaggedValue BuiltinsString::ReplaceAll(EcmaRuntimeCallInfo *argv) // 10. Let position be ! StringIndexOf(string, searchString, 0). int32_t pos = thisString->IndexOf(*searchString); int32_t endOfLastMatch = 0; - bool canBeCompress = true; + bool can_be_compress = true; JSHandle undefined = globalConst->GetHandledUndefined(); JSMutableHandle replHandle(thread, factory->GetEmptyString().GetTaggedValue()); while (pos != -1) { @@ -1020,7 +1020,7 @@ JSTaggedValue BuiltinsString::ReplaceAll(EcmaRuntimeCallInfo *argv) if (prefixString->IsUtf16()) { const uint16_t *data = prefixString->GetDataUtf16(); stringPrefixString = base::StringHelper::Utf16ToU16String(data, prefixString->GetLength()); - canBeCompress = false; + can_be_compress = false; } else { const uint8_t *data = prefixString->GetDataUtf8(); stringPrefixString = base::StringHelper::Utf8ToU16String(data, prefixString->GetLength()); @@ -1028,7 +1028,7 @@ JSTaggedValue BuiltinsString::ReplaceAll(EcmaRuntimeCallInfo *argv) if (realReplaceStr->IsUtf16()) { const uint16_t *data = realReplaceStr->GetDataUtf16(); stringRealReplaceStr = base::StringHelper::Utf16ToU16String(data, realReplaceStr->GetLength()); - canBeCompress = false; + can_be_compress = false; } else { const uint8_t *data = realReplaceStr->GetDataUtf8(); stringRealReplaceStr = base::StringHelper::Utf8ToU16String(data, realReplaceStr->GetLength()); @@ -1046,7 +1046,7 @@ JSTaggedValue BuiltinsString::ReplaceAll(EcmaRuntimeCallInfo *argv) if (suffixString->IsUtf16()) { const uint16_t *data = suffixString->GetDataUtf16(); stringSuffixString = base::StringHelper::Utf16ToU16String(data, suffixString->GetLength()); - canBeCompress = false; + can_be_compress = false; } else { const uint8_t *data = suffixString->GetDataUtf8(); stringSuffixString = base::StringHelper::Utf8ToU16String(data, suffixString->GetLength()); @@ -1056,7 +1056,7 @@ JSTaggedValue BuiltinsString::ReplaceAll(EcmaRuntimeCallInfo *argv) auto *char16tData = const_cast(stringBuilder.c_str()); auto *uint16tData = reinterpret_cast(char16tData); - return factory->NewFromUtf16LiteralUnCheck(uint16tData, stringBuilder.length(), canBeCompress).GetTaggedValue(); + return factory->NewFromUtf16LiteralUnCheck(uint16tData, stringBuilder.length(), can_be_compress).GetTaggedValue(); } // NOLINTNEXTLINE(readability-function-size) @@ -1078,12 +1078,12 @@ JSTaggedValue BuiltinsString::GetSubstitution(JSThread *thread, const JSHandle 0) { if (replacement->IsUtf16()) { const uint16_t *data = replacement->GetDataUtf16(); stringBuilder += base::StringHelper::Utf16ToU16String(data, nextDollarIndex); - canBeCompress = false; + can_be_compress = false; } else { const uint8_t *data = replacement->GetDataUtf8(); stringBuilder += base::StringHelper::Utf8ToU16String(data, nextDollarIndex); @@ -1096,7 +1096,7 @@ JSTaggedValue BuiltinsString::GetSubstitution(JSThread *thread, const JSHandle(stringBuilder.c_str()); auto *uint16tData = reinterpret_cast(char16tData); - return factory->NewFromUtf16LiteralUnCheck(uint16tData, stringBuilder.length(), canBeCompress) + return factory->NewFromUtf16LiteralUnCheck(uint16tData, stringBuilder.length(), can_be_compress) .GetTaggedValue(); } int continueFromIndex = -1; @@ -1110,7 +1110,7 @@ JSTaggedValue BuiltinsString::GetSubstitution(JSThread *thread, const JSHandleIsUtf16()) { const uint16_t *data = matched->GetDataUtf16(); stringBuilder += ecmascript::base::StringHelper::Utf16ToU16String(data, matched->GetLength()); - canBeCompress = false; + can_be_compress = false; } else { const uint8_t *data = matched->GetDataUtf8(); stringBuilder += ecmascript::base::StringHelper::Utf8ToU16String(data, matched->GetLength()); @@ -1123,7 +1123,7 @@ JSTaggedValue BuiltinsString::GetSubstitution(JSThread *thread, const JSHandleIsUtf16()) { const uint16_t *data = prefix->GetDataUtf16(); stringBuilder += ecmascript::base::StringHelper::Utf16ToU16String(data, prefix->GetLength()); - canBeCompress = false; + can_be_compress = false; } else { const uint8_t *data = prefix->GetDataUtf8(); stringBuilder += ecmascript::base::StringHelper::Utf8ToU16String(data, prefix->GetLength()); @@ -1139,7 +1139,7 @@ JSTaggedValue BuiltinsString::GetSubstitution(JSThread *thread, const JSHandleIsUtf16()) { const uint16_t *data = sufffix->GetDataUtf16(); stringBuilder += ecmascript::base::StringHelper::Utf16ToU16String(data, sufffix->GetLength()); - canBeCompress = false; + can_be_compress = false; } else { const uint8_t *data = sufffix->GetDataUtf8(); stringBuilder += ecmascript::base::StringHelper::Utf8ToU16String(data, sufffix->GetLength()); @@ -1187,7 +1187,7 @@ JSTaggedValue BuiltinsString::GetSubstitution(JSThread *thread, const JSHandleGetDataUtf16(); stringBuilder += ecmascript::base::StringHelper::Utf16ToU16String(data, captureString->GetLength()); - canBeCompress = false; + can_be_compress = false; } else { const uint8_t *data = captureString->GetDataUtf8(); stringBuilder += @@ -1222,7 +1222,7 @@ JSTaggedValue BuiltinsString::GetSubstitution(JSThread *thread, const JSHandleIsUtf16()) { const uint16_t *data = captureName->GetDataUtf16(); stringBuilder += base::StringHelper::Utf16ToU16String(data, captureName->GetLength()); - canBeCompress = false; + can_be_compress = false; } else { const uint8_t *data = captureName->GetDataUtf8(); stringBuilder += base::StringHelper::Utf8ToU16String(data, captureName->GetLength()); @@ -1244,7 +1244,7 @@ JSTaggedValue BuiltinsString::GetSubstitution(JSThread *thread, const JSHandleIsUtf16()) { const uint16_t *data = nextAppend->GetDataUtf16(); stringBuilder += ecmascript::base::StringHelper::Utf16ToU16String(data, nextAppend->GetLength()); - canBeCompress = false; + can_be_compress = false; } else { const uint8_t *data = nextAppend->GetDataUtf8(); stringBuilder += ecmascript::base::StringHelper::Utf8ToU16String(data, nextAppend->GetLength()); @@ -1252,7 +1252,7 @@ JSTaggedValue BuiltinsString::GetSubstitution(JSThread *thread, const JSHandle(stringBuilder.c_str()); auto *uint16tData = reinterpret_cast(char16tData); - return factory->NewFromUtf16LiteralUnCheck(uint16tData, stringBuilder.length(), canBeCompress) + return factory->NewFromUtf16LiteralUnCheck(uint16tData, stringBuilder.length(), can_be_compress) .GetTaggedValue(); } // Append substring between the previous and the next $ character. @@ -1262,7 +1262,7 @@ JSTaggedValue BuiltinsString::GetSubstitution(JSThread *thread, const JSHandleIsUtf16()) { const uint16_t *data = nextAppend->GetDataUtf16(); stringBuilder += ecmascript::base::StringHelper::Utf16ToU16String(data, nextAppend->GetLength()); - canBeCompress = false; + can_be_compress = false; } else { const uint8_t *data = nextAppend->GetDataUtf8(); stringBuilder += ecmascript::base::StringHelper::Utf8ToU16String(data, nextAppend->GetLength()); diff --git a/runtime/builtins/builtins_symbol.cpp b/runtime/builtins/builtins_symbol.cpp index 2de586040..aca8767f4 100644 --- a/runtime/builtins/builtins_symbol.cpp +++ b/runtime/builtins/builtins_symbol.cpp @@ -36,8 +36,8 @@ JSTaggedValue BuiltinsSymbol::SymbolConstructor(EcmaRuntimeCallInfo *argv) [[maybe_unused]] EcmaHandleScope handleScope(thread); // 1.If NewTarget is not undefined, throw a TypeError exception. JSHandle key = GetCallArg(argv, 0); - JSHandle newTarget = GetNewTarget(argv); - if (!newTarget->IsUndefined()) { + JSHandle new_target = GetNewTarget(argv); + if (!new_target->IsUndefined()) { THROW_TYPE_ERROR_AND_RETURN(thread, "SymbolConstructor: NewTarget is not undefined", JSTaggedValue::Exception()); } diff --git a/runtime/builtins/builtins_typedarray.cpp b/runtime/builtins/builtins_typedarray.cpp index 7a6cfc9a3..20f39a675 100644 --- a/runtime/builtins/builtins_typedarray.cpp +++ b/runtime/builtins/builtins_typedarray.cpp @@ -1352,8 +1352,8 @@ JSTaggedValue BuiltinsTypedArray::Subarray(EcmaRuntimeCallInfo *argv) } else { endIndex = relativeEnd < srcLength ? relativeEnd : srcLength; } - // 13. Let newLength be max(endIndex – beginIndex, 0). - double newLength = (endIndex - beginIndex) > 0 ? (endIndex - beginIndex) : 0; + // 13. Let new_length be max(endIndex – beginIndex, 0). + double new_length = (endIndex - beginIndex) > 0 ? (endIndex - beginIndex) : 0; // 14. Let constructorName be the String value of O’s [[TypedArrayName]] internal slot. // 15. Let elementSize be the Number value of the Element Size value specified in Table 49 for constructorName. // 16. Let srcByteOffset be the value of O’s [[ByteOffset]] internal slot. @@ -1362,12 +1362,12 @@ JSTaggedValue BuiltinsTypedArray::Subarray(EcmaRuntimeCallInfo *argv) int32_t elementSize = TypedArrayHelper::GetSizeFromName(thread, constructorName); int32_t srcByteOffset = TypedArrayHelper::GetByteOffset(thread, thisObj); int32_t beginByteOffset = srcByteOffset + beginIndex * elementSize; - // 21. Let argumentsList be «buffer, beginByteOffset, newLength». + // 21. Let argumentsList be «buffer, beginByteOffset, new_length». // 5. Let buffer be the value of O’s [[ViewedArrayBuffer]] internal slot. JSTaggedValue buffer = JSTypedArray::Cast(*thisObj)->GetViewedArrayBuffer(); // 22. Return Construct(constructor, argumentsList). InternalCallParams *arguments = thread->GetInternalCallParams(); - arguments->MakeArgv(buffer, JSTaggedValue(beginByteOffset), JSTaggedValue(newLength)); + arguments->MakeArgv(buffer, JSTaggedValue(beginByteOffset), JSTaggedValue(new_length)); JSHandle newArr = TypedArrayHelper::TypedArraySpeciesCreate(thread, thisObj, 3, arguments->GetArgv()); // 3: three args RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); diff --git a/runtime/builtins/builtins_weak_map.cpp b/runtime/builtins/builtins_weak_map.cpp index 47c30daa8..d47501ec3 100644 --- a/runtime/builtins/builtins_weak_map.cpp +++ b/runtime/builtins/builtins_weak_map.cpp @@ -32,14 +32,14 @@ JSTaggedValue BuiltinsWeakMap::WeakMapConstructor(EcmaRuntimeCallInfo *argv) [[maybe_unused]] EcmaHandleScope handleScope(thread); ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); // 1.If NewTarget is undefined, throw a TypeError exception - JSHandle newTarget = GetNewTarget(argv); - if (newTarget->IsUndefined()) { + JSHandle new_target = GetNewTarget(argv); + if (new_target->IsUndefined()) { // throw type error THROW_TYPE_ERROR_AND_RETURN(thread, "new target can't be undefined", JSTaggedValue::Exception()); } // 2.Let WeakMap be OrdinaryCreateFromConstructor(NewTarget, "%WeakMapPrototype%", «‍[[WeakMapData]]» ). JSHandle constructor = GetConstructor(argv); - JSHandle obj = factory->NewJSObjectByConstructor(JSHandle(constructor), newTarget); + JSHandle obj = factory->NewJSObjectByConstructor(JSHandle(constructor), new_target); // 3.returnIfAbrupt() RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); JSHandle weakMap = JSHandle::Cast(obj); diff --git a/runtime/builtins/builtins_weak_ref.cpp b/runtime/builtins/builtins_weak_ref.cpp index ba91b9e95..4dd00cde6 100644 --- a/runtime/builtins/builtins_weak_ref.cpp +++ b/runtime/builtins/builtins_weak_ref.cpp @@ -29,8 +29,8 @@ JSTaggedValue BuiltinsWeakRef::Constructor(EcmaRuntimeCallInfo *argv) [[maybe_unused]] EcmaHandleScope handleScope(thread); ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); // 1.If NewTarget is undefined, throw a TypeError exception - JSHandle newTarget = GetNewTarget(argv); - if (newTarget->IsUndefined()) { + JSHandle new_target = GetNewTarget(argv); + if (new_target->IsUndefined()) { THROW_TYPE_ERROR_AND_RETURN(thread, "new target must not be undefined", JSTaggedValue::Exception()); } // 2. If Type(target) is not Object, throw a TypeError exception. @@ -40,7 +40,7 @@ JSTaggedValue BuiltinsWeakRef::Constructor(EcmaRuntimeCallInfo *argv) } // 3. Let WeakRef be OrdinaryCreateFromConstructor(NewTarget, "%WeakRefPrototype%", «[[WeakRefTarget]]» ). JSHandle constructor = GetConstructor(argv); - JSHandle obj = factory->NewJSObjectByConstructor(JSHandle(constructor), newTarget); + JSHandle obj = factory->NewJSObjectByConstructor(JSHandle(constructor), new_target); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); JSHandle weakRef = JSHandle::Cast(obj); diff --git a/runtime/builtins/builtins_weak_set.cpp b/runtime/builtins/builtins_weak_set.cpp index f41aee103..5f954ae69 100644 --- a/runtime/builtins/builtins_weak_set.cpp +++ b/runtime/builtins/builtins_weak_set.cpp @@ -32,14 +32,14 @@ JSTaggedValue BuiltinsWeakSet::WeakSetConstructor(EcmaRuntimeCallInfo *argv) [[maybe_unused]] EcmaHandleScope handleScope(thread); ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); // 1.If NewTarget is undefined, throw a TypeError exception - JSHandle newTarget = GetNewTarget(argv); - if (newTarget->IsUndefined()) { + JSHandle new_target = GetNewTarget(argv); + if (new_target->IsUndefined()) { // throw type error THROW_TYPE_ERROR_AND_RETURN(thread, "new target can't be undefined", JSTaggedValue::Exception()); } // 2.Let weakset be OrdinaryCreateFromConstructor(NewTarget, "%WeakSetPrototype%", «‍[[WeakSetData]]» ). JSHandle constructor = GetConstructor(argv); - JSHandle obj = factory->NewJSObjectByConstructor(JSHandle(constructor), newTarget); + JSHandle obj = factory->NewJSObjectByConstructor(JSHandle(constructor), new_target); // 3.returnIfAbrupt() RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); JSHandle weakSet = JSHandle::Cast(obj); diff --git a/runtime/class_info_extractor.cpp b/runtime/class_info_extractor.cpp index ed075cd46..b360fde9b 100644 --- a/runtime/class_info_extractor.cpp +++ b/runtime/class_info_extractor.cpp @@ -106,7 +106,7 @@ bool ClassInfoExtractor::ExtractAndReturnWhetherWithElements(JSThread *thread, c uint32_t pos = detail.fillStartLoc; bool withElemenstFlag = false; - bool isStaticFlag = detail.ctorMethod != nullptr; + bool isStaticFlag = detail.ctor_method != nullptr; bool keysHasNameFlag = false; JSHandle nameString = globalConst->GetHandledNameString(); @@ -146,7 +146,7 @@ bool ClassInfoExtractor::ExtractAndReturnWhetherWithElements(JSThread *thread, c if (LIKELY(!keysHasNameFlag)) { [[maybe_unused]] EcmaHandleScope handleScope(thread); ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - PandaString clsName = detail.ctorMethod->ParseFunctionName(); + PandaString clsName = detail.ctor_method->ParseFunctionName(); JSHandle clsNameHandle = factory->NewFromString(clsName); properties->Set(thread, NAME_INDEX, clsNameHandle); } else { diff --git a/runtime/class_info_extractor.h b/runtime/class_info_extractor.h index 2420f4a0f..e120419b1 100644 --- a/runtime/class_info_extractor.h +++ b/runtime/class_info_extractor.h @@ -37,7 +37,7 @@ public: uint32_t extractBegin; uint32_t extractEnd; uint8_t fillStartLoc; - JSMethod *ctorMethod; + JSMethod *ctor_method; }; CAST_CHECK(ClassInfoExtractor, IsClassInfoExtractor); diff --git a/runtime/containers/containers_arraylist.cpp b/runtime/containers/containers_arraylist.cpp index a43e155d3..90a74f165 100644 --- a/runtime/containers/containers_arraylist.cpp +++ b/runtime/containers/containers_arraylist.cpp @@ -27,12 +27,12 @@ JSTaggedValue ContainersArrayList::ArrayListConstructor(EcmaRuntimeCallInfo *arg JSThread *thread = argv->GetThread(); [[maybe_unused]] EcmaHandleScope handleScope(thread); ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - JSHandle newTarget = GetNewTarget(argv); - if (newTarget->IsUndefined()) { + JSHandle new_target = GetNewTarget(argv); + if (new_target->IsUndefined()) { THROW_TYPE_ERROR_AND_RETURN(thread, "new target can't be undefined", JSTaggedValue::Exception()); } JSHandle constructor = GetConstructor(argv); - JSHandle obj = factory->NewJSObjectByConstructor(JSHandle(constructor), newTarget); + JSHandle obj = factory->NewJSObjectByConstructor(JSHandle(constructor), new_target); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); diff --git a/runtime/dump.cpp b/runtime/dump.cpp index 2f5c10280..5bbca0498 100644 --- a/runtime/dump.cpp +++ b/runtime/dump.cpp @@ -664,9 +664,9 @@ void JSTaggedValue::DumpSpecialValue([[maybe_unused]] JSThread *thread, std::ost void JSTaggedValue::DumpHeapObjectType([[maybe_unused]] JSThread *thread, std::ostream &os) const { ASSERT(IsWeak() || IsHeapObject()); - bool isWeak = IsWeak(); - TaggedObject *obj = isWeak ? GetTaggedWeakRef() : GetTaggedObject(); - if (isWeak) { + bool is_weak = IsWeak(); + TaggedObject *obj = is_weak ? GetTaggedWeakRef() : GetTaggedObject(); + if (is_weak) { os << "----------Dump Weak Referent----------" << "\n"; } @@ -2275,8 +2275,8 @@ static void DumpObject(JSThread *thread, TaggedObject *obj, std::vectorGetLength() == 0) { - PandaString emptyStr = "EmptyString"; - res.append(emptyStr); + PandaString empty_str = "EmptyString"; + res.append(empty_str); } PandaString string = ConvertToPandaString(str); diff --git a/runtime/ecma_global_storage-inl.h b/runtime/ecma_global_storage-inl.h index a1b475955..07ece9706 100644 --- a/runtime/ecma_global_storage-inl.h +++ b/runtime/ecma_global_storage-inl.h @@ -106,14 +106,14 @@ void EcmaGlobalStorage::NodeList::RemoveList() } } -uintptr_t EcmaGlobalStorage::NewGlobalHandleImplement(NodeList **storage, NodeList **freeList, bool isWeak, +uintptr_t EcmaGlobalStorage::NewGlobalHandleImplement(NodeList **storage, NodeList **free_list, bool is_weak, JSTaggedType value) { auto allocator = Runtime::GetCurrent()->GetInternalAllocator(); - if (*freeList == nullptr) { + if (*free_list == nullptr) { if ((*storage)->IsFull()) { // alloc new block - auto block = allocator->New(isWeak); + auto block = allocator->New(is_weak); block->LinkTo(*storage); *storage = block; } @@ -129,16 +129,16 @@ uintptr_t EcmaGlobalStorage::NewGlobalHandleImplement(NodeList **storage, NodeLi } // use free_list node - node = (*freeList)->GetFreeNode(value); + node = (*free_list)->GetFreeNode(value); ASSERT(node != nullptr); - if (!(*freeList)->HasFreeNode()) { - auto next = (*freeList)->GetFreeNext(); - (*freeList)->SetFreeNext(nullptr); - (*freeList)->SetFreePrev(nullptr); + if (!(*free_list)->HasFreeNode()) { + auto next = (*free_list)->GetFreeNext(); + (*free_list)->SetFreeNext(nullptr); + (*free_list)->SetFreePrev(nullptr); if (next != nullptr) { next->SetFreePrev(nullptr); } - *freeList = next; + *free_list = next; } return node->GetObjectAddress(); } @@ -159,22 +159,22 @@ inline void EcmaGlobalStorage::DisposeGlobalHandle(uintptr_t nodeAddr) list->FreeNode(node); // If NodeList has no usage node, then delete NodeList - NodeList **freeList = nullptr; + NodeList **free_list = nullptr; NodeList **top = nullptr; NodeList **last = nullptr; if (list->IsWeak()) { - freeList = &weak_free_list_nodes_; + free_list = &weak_free_list_nodes_; top = &top_weak_global_nodes_; last = &last_weak_global_nodes_; } else { - freeList = &free_list_nodes_; + free_list = &free_list_nodes_; top = &top_global_nodes_; last = &last_global_nodes_; } if (!list->HasUsagedNode() && (*top != *last)) { list->RemoveList(); - if (*freeList == list) { - *freeList = list->GetNext(); + if (*free_list == list) { + *free_list = list->GetNext(); } if (*top == list) { *top = list->GetNext(); @@ -184,13 +184,13 @@ inline void EcmaGlobalStorage::DisposeGlobalHandle(uintptr_t nodeAddr) } allocator->Delete(list); } else { - // Add to freeList - if (list != *freeList && list->GetFreeNext() == nullptr && list->GetFreePrev() == nullptr) { - list->SetFreeNext(*freeList); - if (*freeList != nullptr) { - (*freeList)->SetFreePrev(list); + // Add to free_list + if (list != *free_list && list->GetFreeNext() == nullptr && list->GetFreePrev() == nullptr) { + list->SetFreeNext(*free_list); + if (*free_list != nullptr) { + (*free_list)->SetFreePrev(list); } - *freeList = list; + *free_list = list; } } } diff --git a/runtime/ecma_runtime.yaml b/runtime/ecma_runtime.yaml index 96fd8f8aa..5ed3c0bad 100644 --- a/runtime/ecma_runtime.yaml +++ b/runtime/ecma_runtime.yaml @@ -14,2056 +14,2056 @@ intrinsics_namespace: panda::ecmascript::intrinsics intrinsics: - - name: Ldnan - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: ldnan - static: true - signature: - ret: any - args: [] - impl: panda::ecmascript::intrinsics::Ldnan - clear_flags: [no_dce] - use_thread: false - - - name: Ldinfinity - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: ldinfinity - static: true - signature: - ret: any - args: [] - impl: panda::ecmascript::intrinsics::Ldinfinity - clear_flags: [no_dce] - use_thread: false - - - name: Ldglobalthis - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: ldglobalthis - static: true - signature: - ret: any - args: [] - impl: panda::ecmascript::intrinsics::Ldglobalthis - clear_flags: [no_dce] - - - name: Ldundefined - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: ldundefined - static: true - signature: - ret: any - args: [] - impl: panda::ecmascript::intrinsics::Ldundefined - clear_flags: [no_dce] - use_thread: false - - - name: Ldboolean - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: ldboolean - static: true - signature: - ret: any - args: [any] - impl: panda::ecmascript::intrinsics::Ldboolean - - - name: Ldnumber - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: ldnumber - static: true - signature: - ret: any - args: [any] - impl: panda::ecmascript::intrinsics::Ldnumber - - - name: Ldstring - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: ldstring - static: true - signature: - ret: any - args: [any] - impl: panda::ecmascript::intrinsics::Ldstring - - - name: Ldbigint - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: ldbigint - static: true - signature: - ret: any - args: [any] - impl: panda::ecmascript::intrinsics::Ldbigint - - - name: Ldnull - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: ldnull - static: true - signature: - ret: any - args: [] - impl: panda::ecmascript::intrinsics::Ldnull - clear_flags: [no_dce] - use_thread: false - - - name: Ldsymbol - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: ldsymbol - static: true - signature: - ret: any - args: [] - impl: panda::ecmascript::intrinsics::Ldsymbol - clear_flags: [no_dce] - - - name: Ldobject - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: ldobject - static: true - signature: - ret: any - args: [any, any] - impl: panda::ecmascript::intrinsics::Ldobject - - - name: Ldfunction - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: ldfunction - static: true - signature: - ret: any - args: [any, any] - impl: panda::ecmascript::intrinsics::Ldfunction - - - name: Ldglobal - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: ldglobal - static: true - signature: - ret: any - args: [] - impl: panda::ecmascript::intrinsics::Ldglobal - clear_flags: [no_dce] - - - name: Ldtrue - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: ldtrue - static: true - signature: - ret: any - args: [] - impl: panda::ecmascript::intrinsics::Ldtrue - clear_flags: [no_dce] - use_thread: false - - - name: Ldfalse - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: ldfalse - static: true - signature: - ret: any - args: [] - impl: panda::ecmascript::intrinsics::Ldfalse - clear_flags: [no_dce] - use_thread: false - - - name: Add2Dyn - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: add2Dyn - static: true - exception: true - signature: - ret: any - args: [any, acc] - impl: panda::ecmascript::intrinsics::Add2Dyn - set_flags: [heap_inv] - fast_path: FastPathEcmaAdd - - - name: Sub2Dyn - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: sub2Dyn - static: true - exception: true - signature: - ret: any - args: [any, acc] - impl: panda::ecmascript::intrinsics::Sub2Dyn - set_flags: [heap_inv] - fast_path: FastPathEcmaSub - - - name: Mul2Dyn - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: mul2Dyn - static: true - exception: true - signature: - ret: any - args: [any, acc] - impl: panda::ecmascript::intrinsics::Mul2Dyn - set_flags: [heap_inv] - fast_path: FastPathEcmaMul - - - name: Div2Dyn - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: div2Dyn - static: true - exception: true - signature: - ret: any - args: [any, acc] - impl: panda::ecmascript::intrinsics::Div2Dyn - set_flags: [heap_inv] - fast_path: FastPathEcmaDiv - - - name: Mod2Dyn - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: mod2Dyn - static: true - exception: true - signature: - ret: any - args: [any, acc] - impl: panda::ecmascript::intrinsics::Mod2Dyn - set_flags: [heap_inv] - - - name: EqDyn - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: eqDyn - static: true - exception: true - signature: - ret: any - args: [any, acc] - impl: panda::ecmascript::intrinsics::EqDyn - set_flags: [heap_inv] - - - name: NotEqDyn - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: noteqDyn - static: true - exception: true - signature: - ret: any - args: [any, acc] - impl: panda::ecmascript::intrinsics::NotEqDyn - set_flags: [heap_inv] - - - name: LessDyn - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: lessDyn - static: true - exception: true - signature: - ret: any - args: [any, acc] - impl: panda::ecmascript::intrinsics::LessDyn - set_flags: [heap_inv] - - - name: LessEqDyn - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: lesseqDyn - static: true - exception: true - signature: - ret: any - args: [any, acc] - impl: panda::ecmascript::intrinsics::LessEqDyn - set_flags: [heap_inv] - - - name: GreaterDyn - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: greaterDyn - static: true - exception: true - signature: - ret: any - args: [any, acc] - impl: panda::ecmascript::intrinsics::GreaterDyn - set_flags: [heap_inv] - - - name: GreaterEqDyn - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: greatereqDyn - static: true - exception: true - signature: - ret: any - args: [any, acc] - impl: panda::ecmascript::intrinsics::GreaterEqDyn - set_flags: [heap_inv] - - - name: LdObjByValue - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: ldObjByValue - static: true - exception: true - signature: - ret: any - args: [any, any, u16] - impl: panda::ecmascript::intrinsics::LdObjByValue - fast_path: FastPathLdObjByValue - set_flags: [heap_inv] - - - name: TryLdGlobalByValue - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: tryLdGlobalByValue - static: true - exception: true - signature: - ret: any - args: [u16, any] - impl: panda::ecmascript::intrinsics::TryLdGlobalByValue - set_flags: [heap_inv] - - - name: StObjByValue - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: stObjByValue - static: true - exception: true - signature: - ret: any - args: [any, any, acc, u16] - impl: panda::ecmascript::intrinsics::StObjByValue - fast_path: FastPathStObjByValue - set_flags: [heap_inv] - - - name: Shl2Dyn - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: shl2Dyn - static: true - exception: true - signature: - ret: any - args: [any, acc] - impl: panda::ecmascript::intrinsics::Shl2Dyn - set_flags: [heap_inv] - fast_path: FastPathEcmaShl - - - name: Shr2Dyn - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: shr2Dyn - static: true - exception: true - signature: - ret: any - args: [any, acc] - impl: panda::ecmascript::intrinsics::Shr2Dyn - set_flags: [heap_inv] - fast_path: FastPathEcmaShr - - - name: Ashr2Dyn - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: ashr2Dyn - static: true - exception: true - signature: - ret: any - args: [any, acc] - impl: panda::ecmascript::intrinsics::Ashr2Dyn - set_flags: [heap_inv] - - - name: And2Dyn - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: and2Dyn - static: true - exception: true - signature: - ret: any - args: [any, acc] - impl: panda::ecmascript::intrinsics::And2Dyn - set_flags: [heap_inv] - fast_path: FastPathEcmaAnd - - - name: Or2Dyn - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: or2Dyn - static: true - exception: true - signature: - ret: any - args: [any, acc] - impl: panda::ecmascript::intrinsics::Or2Dyn - set_flags: [heap_inv] - fast_path: FastPathEcmaOr - - - name: Xor2Dyn - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: xor2Dyn - static: true - exception: true - signature: - ret: any - args: [any, acc] - impl: panda::ecmascript::intrinsics::Xor2Dyn - set_flags: [heap_inv] - fast_path: FastPathEcmaXor - - - name: Tonumber - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: tonumber - static: true - exception: true - signature: - ret: any - args: [any] - impl: panda::ecmascript::intrinsics::Tonumber - set_flags: [heap_inv] - - - name: NegDyn - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: negDyn - static: true - exception: true - signature: - ret: any - args: [any] - impl: panda::ecmascript::intrinsics::NegDyn - set_flags: [heap_inv] - fast_path: FastPathEcmaNeg - - - name: NotDyn - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: notDyn - static: true - exception: true - signature: - ret: any - args: [any] - impl: panda::ecmascript::intrinsics::NotDyn - set_flags: [heap_inv] - fast_path: FastPathEcmaNot - - - name: IncDyn - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: incDyn - static: true - exception: true - signature: - ret: any - args: [any] - impl: panda::ecmascript::intrinsics::IncDyn - set_flags: [heap_inv] - fast_path: FastPathEcmaInc - - - name: DecDyn - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: decDyn - static: true - exception: true - signature: - ret: any - args: [any] - impl: panda::ecmascript::intrinsics::DecDyn - set_flags: [heap_inv] - fast_path: FastPathEcmaDec - - - name: RethrowDyn - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: rethrowDyn - static: true - exception: true - signature: - ret: any - args: [acc] - impl: panda::ecmascript::intrinsics::RethrowDyn - set_flags: [heap_inv] - - - name: ThrowDyn - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: throwDyn - static: true - exception: true - signature: - ret: void - args: [acc] - impl: panda::ecmascript::intrinsics::ThrowDyn - - - name: Delobjprop - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: delobjprop - static: true - exception: true - signature: - ret: any - args: [any, any] - impl: panda::ecmascript::intrinsics::Delobjprop - set_flags: [heap_inv] - - - name: Defineglobalvar - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: defineglobalvar - static: true - signature: - ret: any - args: [any, any] - impl: panda::ecmascript::intrinsics::Defineglobalvar - - - name: Definelocalvar - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: definelocalvar - static: true - signature: - ret: any - args: [any, any] - impl: panda::ecmascript::intrinsics::Definelocalvar - - - name: Definefuncexpr - class_name: Ecmascript.Intrinsics - space: ecmascript - method_name: definefuncexpr - static: true - signature: - ret: any - args: [any, any] - impl: panda::ecmascript::intrinsics::Definefuncexpr - - - name: DefinefuncDyn - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: definefuncDyn - static: true - exception: true - signature: - ret: any - args: [method_id, any] - impl: panda::ecmascript::intrinsics::DefinefuncDyn - - - name: DefineNCFuncDyn - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: defineNCFuncDyn - static: true - exception: true - signature: - ret: any - args: [method_id, any, acc] - impl: panda::ecmascript::intrinsics::DefineNCFuncDyn - - - name: NewobjDynrange - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: newobjDynrange - static: true - exception: true - signature: - ret: any - args: [u16, any, any] - stackrange: true - impl: panda::ecmascript::intrinsics::NewobjDynrange - set_flags: [heap_inv] - - - name: NewobjDynrangeInterp - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: newobjDynrangeInterp - static: true - exception: true - signature: - ret: any - args: [u16, any] - impl: panda::ecmascript::intrinsics::NewobjDynrangeInterp - set_flags: [heap_inv] - - - name: RefeqDyn - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: refeqDyn - static: true - signature: - ret: any - args: [any, any] - impl: panda::ecmascript::intrinsics::RefeqDyn - - - name: ExpDyn - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: expDyn - static: true - exception: true - signature: - ret: any - args: [any, acc] - impl: panda::ecmascript::intrinsics::ExpDyn - set_flags: [heap_inv] - - - name: TypeofDyn - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: typeofDyn - static: true - signature: - ret: any - args: [acc] - impl: panda::ecmascript::intrinsics::TypeofDyn - clear_flags: [no_dce] - - - name: Callruntimerange - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: callruntimerange - static: true - signature: - ret: any - args: [any, any] - impl: panda::ecmascript::intrinsics::Callruntimerange - - - name: IsinDyn - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: isinDyn - static: true - exception: true - signature: - ret: any - args: [any, acc] - impl: panda::ecmascript::intrinsics::IsinDyn - set_flags: [heap_inv] - - - name: InstanceofDyn - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: instanceofDyn - static: true - exception: true - signature: - ret: any - args: [any, acc] - impl: panda::ecmascript::intrinsics::InstanceofDyn - set_flags: [heap_inv] - - - name: StrictNotEqDyn - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: strictNotEqDyn - static: true - signature: - ret: any - args: [any, acc] - impl: panda::ecmascript::intrinsics::StrictNotEqDyn - set_flags: [heap_inv] - clear_flags: [no_dce] - use_thread: false - - - name: StrictEqDyn - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: strictEqDyn - static: true - signature: - ret: any - args: [any, acc] - impl: panda::ecmascript::intrinsics::StrictEqDyn - set_flags: [heap_inv] - use_thread: false - - - name: NewobjspreadDyn - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: newobjspreadDyn - static: true - exception: true - signature: - ret: any - args: [any, any, acc] - impl: panda::ecmascript::intrinsics::NewobjspreadDyn - set_flags: [heap_inv] - - - name: CallspreadDyn - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: callspreadDyn - static: true - exception: true - signature: - ret: any - args: [any, any, any] - impl: panda::ecmascript::intrinsics::CallspreadDyn - set_flags: [heap_inv] - - - name: JfalseDyn - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: jfalseDyn - static: true - signature: - ret: void - args: [u16, acc] - impl: panda::ecmascript::intrinsics::JfalseDyn - - - name: JtrueDyn - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: jtrueDyn - static: true - signature: - ret: void - args: [u16, acc] - impl: panda::ecmascript::intrinsics::JtrueDyn - - - name: ReturnDyn - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: returnDyn - static: true - signature: - ret: any - args: [any] - impl: panda::ecmascript::intrinsics::ReturnDyn - - - name: NewlexenvDyn - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: newlexenvDyn - static: true - exception: true - signature: - ret: any - args: [u16] - impl: panda::ecmascript::intrinsics::NewlexenvDyn - - - name: CopylexenvDyn - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: copylexenvDyn - static: true - signature: - ret: any - args: [] - impl: panda::ecmascript::intrinsics::CopylexenvDyn - - - name: StLexVarDyn - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: StLexVarDyn - static: true - exception: true - signature: - ret: void - args: [u16, u16, acc] - impl: panda::ecmascript::intrinsics::StLexVarDyn - - - name: LdLexVarDyn - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: LdLexVarDyn - static: true - exception: true - signature: - ret: any - args: [u16, u16] - impl: panda::ecmascript::intrinsics::LdLexVarDyn - set_flags: [require_tmp] - clear_flags: [no_dce] - codegen_func: LdLexVarDyn - - - name: LdlexenvDyn - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: ldlexenvDyn - static: true - exception: true - signature: - ret: any - args: [] - impl: panda::ecmascript::intrinsics::LdlexenvDyn - clear_flags: [no_dce] - codegen_func: LdlexenvDyn - - - name: PopLexenvDyn - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: PopLexenvDyn - static: true - signature: - ret: void - args: [] - impl: panda::ecmascript::intrinsics::PopLexenvDyn - - - name: GetUnmappedArgs - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: getUnmappedArgs - static: true - exception: true - signature: - ret: any - args: [] - impl: panda::ecmascript::intrinsics::GetUnmappedArgs - - - name: GetUnmappedArgsInterp - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: getUnmappedArgsInterp - static: true - exception: true - signature: - ret: any - args: [] - impl: panda::ecmascript::intrinsics::GetUnmappedArgsInterp - - - name: Toboolean - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: toboolean - static: true - signature: - ret: any - args: [acc] - impl: panda::ecmascript::intrinsics::Toboolean - set_flags: [heap_inv] - clear_flags: [no_dce] - use_thread: false - - - name: Negate - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: negate - static: true - exception: true - signature: - ret: any - args: [acc] - impl: panda::ecmascript::intrinsics::Negate - clear_flags: [no_dce] - use_thread: false - - - name: IsUndefined - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: isUndefined - static: true - exception: true - signature: - ret: any - args: [acc] - impl: panda::ecmascript::intrinsics::IsUndefined - clear_flags: [no_dce] - use_thread: false - - - name: IsTrue - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: isTrue - static: true - exception: true - signature: - ret: any - args: [acc] - impl: panda::ecmascript::intrinsics::IsTrue - clear_flags: [no_dce] - use_thread: false - - - name: IsFalse - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: isFalse - static: true - exception: true - signature: - ret: any - args: [acc] - impl: panda::ecmascript::intrinsics::IsFalse - clear_flags: [no_dce] - use_thread: false - - - name: IsCoercible - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: isCoercible - static: true - exception: true - signature: - ret: any - args: [acc] - impl: panda::ecmascript::intrinsics::IsCoercible - clear_flags: [no_dce] - use_thread: false - - - name: GetPropIterator - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: getPropIterator - static: true - exception: true - signature: - ret: any - args: [acc] - impl: panda::ecmascript::intrinsics::GetPropIterator - - - name: DefineGeneratorFunc - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: defineGeneratorFunc - static: true - exception: true - signature: - ret: any - args: [method_id, any] - impl: panda::ecmascript::intrinsics::DefineGeneratorFunc - - - name: CreateIterResultObj - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: createIterResultObj - static: true - exception: true - signature: - ret: any - args: [acc, u8] - impl: panda::ecmascript::intrinsics::CreateIterResultObj - - - name: suspendGenerator - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: suspendGenerator - static: true - exception: true - signature: - ret: any - args: [any, acc] - impl: panda::ecmascript::intrinsics::SuspendGenerator - - - name: suspendGeneratorInterp - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: suspendGeneratorInterp - static: true - exception: true - signature: - ret: any - args: [any, acc, any] - impl: panda::ecmascript::intrinsics::SuspendGeneratorInterp - - - name: SuspendAsyncGenerator - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: suspendAsyncGenerator - static: true - exception: true - signature: - ret: any - args: [any, acc] - impl: panda::ecmascript::intrinsics::SuspendAsyncGenerator - - - name: SuspendAsyncGeneratorInterp - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: suspendAsyncGeneratorInterp - static: true - exception: true - signature: - ret: any - args: [any, acc, any] - impl: panda::ecmascript::intrinsics::SuspendAsyncGeneratorInterp - - - name: ResumeGenerator - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: resumeGenerator - static: true - exception: true - signature: - ret: any - args: [any] - impl: panda::ecmascript::intrinsics::ResumeGenerator - clear_flags: [no_dce] - use_thread: false - - - name: GetResumeMode - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: getResumeMode - static: true - exception: true - signature: - ret: any - args: [any] - impl: panda::ecmascript::intrinsics::GetResumeMode - clear_flags: [no_dce] - use_thread: false - - - name: CreateGeneratorObj - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: createGeneratorObj - static: true - exception: true - signature: - ret: any - args: [any] - impl: panda::ecmascript::intrinsics::CreateGeneratorObj - - - name: SetGeneratorState - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: setGeneratorState - static: true - exception: true - signature: - ret: any - args: [any, u8] - impl: panda::ecmascript::intrinsics::SetGeneratorState - - - name: CreateAsyncGeneratorObj - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: createAsyncGeneratorObj - static: true - exception: true - signature: - ret: any - args: [any] - impl: panda::ecmascript::intrinsics::CreateAsyncGeneratorObj - - - name: DefineAsyncGeneratorFunc - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: defineAsyncGeneratorFunc - static: true - exception: true - signature: - ret: any - args: [method_id, any] - impl: panda::ecmascript::intrinsics::DefineAsyncGeneratorFunc - - - name: DefineAsyncFunc - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: defineAsyncFunc - static: true - exception: true - signature: - ret: any - args: [method_id, any] - impl: panda::ecmascript::intrinsics::DefineAsyncFunc - - - name: AsyncFunctionEnter - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: asyncFunctionEnter - static: true - exception: true - signature: - ret: any - args: [] - impl: panda::ecmascript::intrinsics::AsyncFunctionEnter - - - name: AsyncFunctionAwait - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: asyncFunctionAwait - static: true - exception: true - signature: - ret: any - args: [any, acc] - set_flags: [heap_inv] - impl: panda::ecmascript::intrinsics::AsyncFunctionAwait - - - name: AsyncFunctionResolve - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: asyncFunctionResolve - static: true - exception: true - signature: - ret: any - args: [any, acc] - set_flags: [heap_inv] - impl: panda::ecmascript::intrinsics::AsyncFunctionResolve - - - name: AsyncFunctionReject - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: asyncFunctionReject - exception: true - static: true - signature: - ret: any - args: [any, acc] - set_flags: [heap_inv] - impl: panda::ecmascript::intrinsics::AsyncFunctionReject - - - name: AsyncGeneratorResolve - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: asyncGeneratorResolve - static: true - exception: true - signature: - ret: any - args: [any, acc] - set_flags: [heap_inv] - impl: panda::ecmascript::intrinsics::AsyncGeneratorResolve - - - name: AsyncGeneratorReject - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: asyncGeneratorReject - exception: true - static: true - signature: - ret: any - args: [any, acc] - set_flags: [heap_inv] - impl: panda::ecmascript::intrinsics::AsyncGeneratorReject - - - name: ThrowUndefined - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: throwUndefined - static: true - exception: true - signature: - ret: void - args: [any] - impl: panda::ecmascript::intrinsics::ThrowUndefined - - - name: ThrowConstAssignment - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: throwConstAssignment - static: true - exception: true - signature: - ret: void - args: [string_id] - impl: panda::ecmascript::intrinsics::ThrowConstAssignment - - - name: ThrowUndefinedIfHole - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: throwUndefinedIfHole - static: true - exception: true - signature: - ret: any - args: [string_id, acc] - impl: panda::ecmascript::intrinsics::ThrowUndefinedIfHole - - - name: Copyrestargs - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: copyrestargs - static: true - exception: true - signature: - ret: any - args: [u16] - impl: panda::ecmascript::intrinsics::Copyrestargs - - - name: CopyrestargsInterp - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: copyrestargsInterp - static: true - exception: true - signature: - ret: any - args: [u16] - impl: panda::ecmascript::intrinsics::CopyrestargsInterp - - - name: Ldhole - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: ldHole - static: true - signature: - ret: any - args: [] - clear_flags: [no_dce] - impl: panda::ecmascript::intrinsics::Ldhole - use_thread: false - - - name: TryStGlobalByValue - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: tryStGlobalByValue - exception: true - static: true - signature: - ret: void - args: [u16, any, acc] - impl: panda::ecmascript::intrinsics::TryStGlobalByValue - set_flags: [heap_inv] - - - name: GetMethod - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: getMethod - static: true - exception: true - signature: - ret: any - args: [string_id, any] - impl: panda::ecmascript::intrinsics::GetMethod - set_flags: [heap_inv] - - - name: GetTemplateObject - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: getTemplateObject - static: true - exception: true - signature: - ret: any - args: [any] - impl: panda::ecmascript::intrinsics::GetTemplateObject - set_flags: [heap_inv] - - - name: TryLdGlobalByName - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: TryLdGlobalByName - static: true - exception: true - signature: - ret: any - args: [string_id, u16] - impl: panda::ecmascript::intrinsics::TryLdGlobalByName - set_flags: [heap_inv] - - - name: TryStGlobalByName - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: TryStGlobalByName - static: true - exception: true - signature: - ret: any - args: [string_id, acc, u16] - impl: panda::ecmascript::intrinsics::TryStGlobalByName - set_flags: [heap_inv] - - - name: LdGlobalVar - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: LdGlobalVar - static: true - exception: true - signature: - ret: any - args: [string_id, u16] - impl: panda::ecmascript::intrinsics::LdGlobalVar - fast_path: FastPathLdGlobalVar - set_flags: [heap_inv] - - - name: StGlobalVar - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: StGlobalVar - static: true - exception: true - signature: - ret: any - args: [string_id, acc, u16] - impl: panda::ecmascript::intrinsics::StGlobalVar - fast_path: FastPathStGlobalVar - set_flags: [heap_inv] - - - name: StGlobalLet - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: StGlobalLet - static: true - exception: true - signature: - ret: any - args: [string_id, acc] - impl: panda::ecmascript::intrinsics::StGlobalLet - set_flags: [heap_inv] - - - name: LdObjByName - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: LdObjByName - static: true - exception: true - signature: - ret: any - args: [string_id, any, u16] - impl: panda::ecmascript::intrinsics::LdObjByName - fast_path: FastPathLdObjByName - set_flags: [heap_inv] - - - name: StObjByName - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: StObjByName - static: true - exception: true - signature: - ret: any - args: [string_id, any, acc, u16] - impl: panda::ecmascript::intrinsics::StObjByName - fast_path: FastPathStObjByName - set_flags: [heap_inv] - - - name: LdObjByIndex - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: LdObjByIndex - static: true - exception: true - signature: - ret: any - args: [u32, any] - impl: panda::ecmascript::intrinsics::LdObjByIndex - set_flags: [heap_inv] - - - name: StObjByIndex - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: StObjByIndex - static: true - exception: true - signature: - ret: any - args: [u32, any, acc] - impl: panda::ecmascript::intrinsics::StObjByIndex - set_flags: [heap_inv] - - - name: GetNextPropName - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: getnextpropname - static: true - exception: true - signature: - ret: any - args: [any] - impl: panda::ecmascript::intrinsics::GetNextPropName - set_flags: [heap_inv] - - - name: ReturnUndefined - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: ReturnUndefined - static: true - signature: - ret: void - args: [] - impl: panda::ecmascript::intrinsics::ReturnUndefined - - - name: Call0Dyn - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: Call0Dyn - static: true - exception: true - signature: - ret: any - args: [any] - impl: panda::ecmascript::intrinsics::Call0Dyn - set_flags: [heap_inv] - - - name: Call1Dyn - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: Call1Dyn - static: true - exception: true - signature: - ret: any - args: [any, any] - impl: panda::ecmascript::intrinsics::Call1Dyn - set_flags: [heap_inv] - - - name: Call2Dyn - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: Call2Dyn - static: true - exception: true - signature: - ret: any - args: [any, any, any] - impl: panda::ecmascript::intrinsics::Call2Dyn - set_flags: [heap_inv] - - - name: Call3Dyn - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: Call3Dyn - static: true - exception: true - signature: - ret: any - args: [any, any, any, any] - impl: panda::ecmascript::intrinsics::Call3Dyn - set_flags: [heap_inv] - - - name: CalliRangeDyn - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: CalliRangeDyn - static: true - exception: true - signature: - ret: any - args: [u16, any] - impl: panda::ecmascript::intrinsics::CalliRangeDyn - set_flags: [heap_inv] - - - name: CalliRangeDynInterp - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: CalliRangeDynInterp - static: true - exception: true - signature: - ret: any - args: [u16, any] - impl: panda::ecmascript::intrinsics::CalliRangeDynInterp - set_flags: [heap_inv] - - - name: CalliThisRangeDyn - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: CalliThisRangeDyn - static: true - exception: true - signature: - ret: any - args: [u16, any] - impl: panda::ecmascript::intrinsics::CalliThisRangeDyn - set_flags: [heap_inv] - - - name: CreateEmptyObject - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: createemptyobject - static: true - exception: true - signature: - ret: any - args: [] - impl: panda::ecmascript::intrinsics::CreateEmptyObject - clear_flags: [no_dce] - - - name: CreateObjectWithBuffer - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: createobjectwithbuffer - static: true - exception: true - signature: - ret: any - args: [u16] - impl: panda::ecmascript::intrinsics::CreateObjectWithBuffer - - - name: CopyDataProperties - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: copydataproperties - static: true - exception: true - signature: - ret: any - args: [any, any] - impl: panda::ecmascript::intrinsics::CopyDataProperties - set_flags: [heap_inv] - - - name: DefineGetterSetterByValue - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: definegettersetterbyvalue - static: true - exception: true - signature: - ret: any - args: [any, any, any, any, acc] - impl: panda::ecmascript::intrinsics::DefineGetterSetterByValue - set_flags: [heap_inv] - - - name: CreateEmptyArray - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: createemptyarray - static: true - exception: true - signature: - ret: any - args: [] - impl: panda::ecmascript::intrinsics::CreateEmptyArray - clear_flags: [no_dce] - - - name: CreateArrayWithBuffer - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: createarraywithbuffer - static: true - exception: true - signature: - ret: any - args: [u16] - impl: panda::ecmascript::intrinsics::CreateArrayWithBuffer - - - name: StOwnByName - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: StOwnByName - static: true - exception: true - signature: - ret: any - args: [string_id, any, acc] - impl: panda::ecmascript::intrinsics::StOwnByName - set_flags: [heap_inv] - - - name: StOwnByIndex - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: StOwnByIndex - static: true - exception: true - signature: - ret: any - args: [u32, any, acc] - impl: panda::ecmascript::intrinsics::StOwnByIndex - set_flags: [heap_inv] - - - name: StOwnByValue - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: StOwnByValue - static: true - exception: true - signature: - ret: any - args: [any, any, acc] - impl: panda::ecmascript::intrinsics::StOwnByValue - set_flags: [heap_inv] - - - name: StArraySpread - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: starrayspread - static: true - exception: true - signature: - ret: any - args: [any, any, acc] - impl: panda::ecmascript::intrinsics::StArraySpread - set_flags: [heap_inv] - - - name: GetIterator - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: GetIterator - static: true - exception: true - signature: - ret: any - args: [acc] - impl: panda::ecmascript::intrinsics::GetIterator - set_flags: [heap_inv] - - - name: GetAsyncIterator - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: GetAsyncIterator - static: true - exception: true - signature: - ret: any - args: [acc] - impl: panda::ecmascript::intrinsics::GetAsyncIterator - set_flags: [heap_inv] - - - name: ThrowIfNotObject - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: ThrowIfNotObject - static: true - exception: true - signature: - ret: any - args: [acc] - impl: panda::ecmascript::intrinsics::ThrowIfNotObject - - - name: ThrowThrowNotExists - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: ThrowThrowNotExists - static: true - exception: true - signature: - ret: void - args: [] - impl: panda::ecmascript::intrinsics::ThrowThrowNotExists - - - name: CreateObjectWithExcludedKeys - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: CreateObjectWithExcludedKeys - static: true - exception: true - range: true - signature: - ret: any - args: [u16, any, any] - impl: panda::ecmascript::intrinsics::CreateObjectWithExcludedKeys - - - name: ThrowPatternNonCoercible - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: ThrowPatternNonCoercible - static: true - exception: true - signature: - ret: void - args: [] - impl: panda::ecmascript::intrinsics::ThrowPatternNonCoercible - - - name: CloseIterator - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: CloseIterator - static: true - exception: true - signature: - ret: any - args: [any, acc] - impl: panda::ecmascript::intrinsics::CloseIterator - set_flags: [heap_inv] - - - name: ImportModule - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: ImportModule - static: true - exception: true - signature: - ret: any - args: [string_id] - impl: panda::ecmascript::intrinsics::ImportModule - clear_flags: [no_dce] - - - name: StModuleVar - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: StModuleVar - static: true - exception: true - signature: - ret: void - args: [string_id, acc] - impl: panda::ecmascript::intrinsics::StModuleVar - - - name: CopyModule - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: CopyModule - static: true - exception: true - signature: - ret: void - args: [any] - impl: panda::ecmascript::intrinsics::CopyModule - - - name: LdModvarByName - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: LdModvarByName - static: true - exception: true - signature: - ret: any - args: [string_id, any] - impl: panda::ecmascript::intrinsics::LdModvarByName - clear_flags: [no_dce] - set_flags: [heap_inv] - - - name: DefineClassWithBuffer - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: DefineClassWithBuffer - static: true - exception: true - signature: - ret: any - args: [method_id, u16, any, any] - impl: panda::ecmascript::intrinsics::DefineClassWithBuffer - - - name: SuperCall - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: SuperCall - static: true - exception: true - signature: - ret: any - args: [u16, any, any, acc] - impl: panda::ecmascript::intrinsics::SuperCall - set_flags: [heap_inv] - - - name: SuperCallSpread - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: SuperCallSpread - static: true - exception: true - signature: - ret: any - args: [any, any, acc] - impl: panda::ecmascript::intrinsics::SuperCallSpread - set_flags: [heap_inv] - - - name: DefineMethod - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: defineMethod - static: true - exception: true - signature: - ret: any - args: [method_id, any, acc] - impl: panda::ecmascript::intrinsics::DefineMethod - - - name: LdSuperByName - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: LdSuperByName - static: true - exception: true - signature: - ret: any - args: [string_id, any] - impl: panda::ecmascript::intrinsics::LdSuperByName - set_flags: [heap_inv] - - - name: StSuperByName - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: StSuperByName - static: true - exception: true - signature: - ret: any - args: [string_id, any, any] - impl: panda::ecmascript::intrinsics::StSuperByName - set_flags: [heap_inv] - - - name: StSuperByValue - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: StSuperByValue - static: true - exception: true - signature: - ret: any - args: [any, any, acc] - impl: panda::ecmascript::intrinsics::StSuperByValue - set_flags: [heap_inv] - - - name: LdSuperByValue - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: LdSuperByValue - static: true - exception: true - signature: - ret: any - args: [any, any] - impl: panda::ecmascript::intrinsics::LdSuperByValue - set_flags: [heap_inv] - - - name: CreateObjectHavingMethod - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: createobjecthavingmethod - static: true - exception: true - signature: - ret: any - args: [u16, acc] - impl: panda::ecmascript::intrinsics::CreateObjectHavingMethod - - - name: ThrowIfSuperNotCorrectCall - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: ThrowIfSuperNotCorrectCall - static: true - exception: true - signature: - ret: any - args: [u16, acc] - impl: panda::ecmascript::intrinsics::ThrowIfSuperNotCorrectCall - - - name: LdHomeObject - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: LdHomeObject - static: true - signature: - ret: any - args: [] - impl: panda::ecmascript::intrinsics::LdHomeObject - clear_flags: [no_dce] - - - name: SetObjectWithProto - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: setobjectwithproto - static: true - exception: true - signature: - ret: any - args: [any, any] - impl: panda::ecmascript::intrinsics::SetObjectWithProto - - - name: ThrowDeleteSuperProperty - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: ThrowDeleteSuperProperty - static: true - exception: true - signature: - ret: void - args: [] - impl: panda::ecmascript::intrinsics::ThrowDeleteSuperProperty - - - name: Debugger - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: debugger - static: true - signature: - ret: void - args: [] - impl: panda::ecmascript::intrinsics::Debugger - use_thread: false - - - name: NativeMethodWrapper - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: NativeMethodWrapper - static: true - exception: true - signature: - ret: void - args: [any] - impl: panda::ecmascript::intrinsics::NativeMethodWrapper - use_thread: false - - - name: GetObjectClassType - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: GetObjectClassType - static: true - codegen_func: GetObjectClassTypeIntrinsic - signature: - ret: u8 - args: [any] - impl: panda::ecmascript::intrinsics::GetObjectClassType - use_thread: false - clear_flags: [no_dce, barrier, require_state, runtime_call] - - - name: IsNan - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: IsNan - static: true - signature: - ret: any - args: [f64] - impl: panda::ecmascript::intrinsics::IsNan - use_thread: false - - - name: GetEcmaConstantPool - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: GetEcmaConstantPool - static: true - codegen_func: GetEcmaConstantPool - signature: - ret: any - args: [] - impl: panda::ecmascript::intrinsics::GetEcmaConstantPool - clear_flags: [no_dce, barrier, require_state, runtime_call] - - - name: GetEcmaThisFunc - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: GetEcmaThisFunc - static: true - codegen_func: GetEcmaThisFunc - signature: - ret: any - args: [] - impl: panda::ecmascript::intrinsics::GetEcmaThisFunc - clear_flags: [no_dce, barrier, require_state, runtime_call] - - - name: GetWeakReferent - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: GetWeakReferent - static: true - codegen_func: GetWeakReferent - signature: - ret: any - args: [any] - impl: panda::ecmascript::intrinsics::GetWeakReferent - use_thread: false - clear_flags: [no_dce, barrier, require_state, runtime_call] - - - name: DynClassIsDictionaryElement - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: DynClassIsDictionaryElement - static: true - signature: - ret: u1 - args: [any] - impl: panda::ecmascript::intrinsics::DynClassIsDictionaryElement - codegen_func: CreateDynClassIsDictionaryElement - use_thread: false - clear_flags: [no_dce, barrier, require_state, runtime_call] - - - name: DynClassIsExtensible - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: DynClassIsExtensible - static: true - signature: - ret: u1 - args: [any] - impl: panda::ecmascript::intrinsics::DynClassIsExtensible - codegen_func: CreateDynClassIsExtensible - use_thread: false - clear_flags: [no_dce, barrier, require_state, runtime_call] - - - name: DynObjectGetClass - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: DynObjectGetClass - static: true - signature: - ret: any - args: [any] - impl: panda::ecmascript::intrinsics::DynObjectGetClass - codegen_func: CreateDynObjectGetClass - use_thread: false - clear_flags: [no_dce, barrier, require_state, runtime_call] - - - name: DynObjectSetClass - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: DynObjectSetClass - static: true - signature: - ret: void - args: [any, any] - impl: panda::ecmascript::intrinsics::DynObjectSetClass - codegen_func: CreateDynObjectSetClass - use_thread: false - clear_flags: [require_state, runtime_call] - - - name: DynCallCheck - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: CreateDynCallCheck - static: true - signature: - ret: void - args: [any] - codegen_func: CreateDynCallCheck - use_thread: false - clear_flags: [] - - - name: DynClassNumberOfProps - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: DynClassNumberOfProps - static: true - signature: - ret: u32 - args: [any] - impl: panda::ecmascript::intrinsics::DynClassNumberOfProps - codegen_func: CreateDynClassNumberOfProps - use_thread: false - clear_flags: [no_dce, barrier, require_state, runtime_call] - - - name: DynClassGetHash - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: DynClassGetHash - static: true - signature: - ret: u32 - args: [any] - impl: panda::ecmascript::intrinsics::DynClassGetHash - codegen_func: CreateDynClassGetHash - use_thread: false - clear_flags: [no_dce, barrier, require_state, runtime_call] - - - name: LdObjDynByName - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: LdObjDynByName - static: true - signature: - ret: any - args: [any, any, u16] - impl: panda::ecmascript::intrinsics::LdObjDynByName - codegen_func: CreateLdObjDynByName - use_thread: false - is_fastpath: true - clear_flags: [barrier, require_state] - - - name: StObjDynByName - space: ecmascript - class_name: Ecmascript.Intrinsics - method_name: StObjDynByName - static: true - signature: - ret: any - args: [any, any, any, u16] - impl: panda::ecmascript::intrinsics::StObjDynByName - codegen_func: CreateStObjDynByName - use_thread: false - is_fastpath: true - clear_flags: [barrier, require_state] +- name: Ldnan + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: ldnan + static: true + signature: + ret: any + args: [] + impl: panda::ecmascript::intrinsics::Ldnan + clear_flags: [no_dce] + use_thread: false + +- name: Ldinfinity + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: ldinfinity + static: true + signature: + ret: any + args: [] + impl: panda::ecmascript::intrinsics::Ldinfinity + clear_flags: [no_dce] + use_thread: false + +- name: Ldglobalthis + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: ldglobalthis + static: true + signature: + ret: any + args: [] + impl: panda::ecmascript::intrinsics::Ldglobalthis + clear_flags: [no_dce] + +- name: Ldundefined + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: ldundefined + static: true + signature: + ret: any + args: [] + impl: panda::ecmascript::intrinsics::Ldundefined + clear_flags: [no_dce] + use_thread: false + +- name: Ldboolean + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: ldboolean + static: true + signature: + ret: any + args: [any] + impl: panda::ecmascript::intrinsics::Ldboolean + +- name: Ldnumber + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: ldnumber + static: true + signature: + ret: any + args: [any] + impl: panda::ecmascript::intrinsics::Ldnumber + +- name: Ldstring + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: ldstring + static: true + signature: + ret: any + args: [any] + impl: panda::ecmascript::intrinsics::Ldstring + +- name: Ldbigint + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: ldbigint + static: true + signature: + ret: any + args: [any] + impl: panda::ecmascript::intrinsics::Ldbigint + +- name: Ldnull + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: ldnull + static: true + signature: + ret: any + args: [] + impl: panda::ecmascript::intrinsics::Ldnull + clear_flags: [no_dce] + use_thread: false + +- name: Ldsymbol + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: ldsymbol + static: true + signature: + ret: any + args: [] + impl: panda::ecmascript::intrinsics::Ldsymbol + clear_flags: [no_dce] + +- name: Ldobject + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: ldobject + static: true + signature: + ret: any + args: [any, any] + impl: panda::ecmascript::intrinsics::Ldobject + +- name: Ldfunction + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: ldfunction + static: true + signature: + ret: any + args: [any, any] + impl: panda::ecmascript::intrinsics::Ldfunction + +- name: Ldglobal + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: ldglobal + static: true + signature: + ret: any + args: [] + impl: panda::ecmascript::intrinsics::Ldglobal + clear_flags: [no_dce] + +- name: Ldtrue + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: ldtrue + static: true + signature: + ret: any + args: [] + impl: panda::ecmascript::intrinsics::Ldtrue + clear_flags: [no_dce] + use_thread: false + +- name: Ldfalse + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: ldfalse + static: true + signature: + ret: any + args: [] + impl: panda::ecmascript::intrinsics::Ldfalse + clear_flags: [no_dce] + use_thread: false + +- name: Add2Dyn + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: add2Dyn + static: true + exception: true + signature: + ret: any + args: [any, acc] + impl: panda::ecmascript::intrinsics::Add2Dyn + set_flags: [heap_inv] + fast_path: FastPathEcmaAdd + +- name: Sub2Dyn + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: sub2Dyn + static: true + exception: true + signature: + ret: any + args: [any, acc] + impl: panda::ecmascript::intrinsics::Sub2Dyn + set_flags: [heap_inv] + fast_path: FastPathEcmaSub + +- name: Mul2Dyn + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: mul2Dyn + static: true + exception: true + signature: + ret: any + args: [any, acc] + impl: panda::ecmascript::intrinsics::Mul2Dyn + set_flags: [heap_inv] + fast_path: FastPathEcmaMul + +- name: Div2Dyn + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: div2Dyn + static: true + exception: true + signature: + ret: any + args: [any, acc] + impl: panda::ecmascript::intrinsics::Div2Dyn + set_flags: [heap_inv] + fast_path: FastPathEcmaDiv + +- name: Mod2Dyn + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: mod2Dyn + static: true + exception: true + signature: + ret: any + args: [any, acc] + impl: panda::ecmascript::intrinsics::Mod2Dyn + set_flags: [heap_inv] + +- name: EqDyn + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: eqDyn + static: true + exception: true + signature: + ret: any + args: [any, acc] + impl: panda::ecmascript::intrinsics::EqDyn + set_flags: [heap_inv] + +- name: NotEqDyn + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: noteqDyn + static: true + exception: true + signature: + ret: any + args: [any, acc] + impl: panda::ecmascript::intrinsics::NotEqDyn + set_flags: [heap_inv] + +- name: LessDyn + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: lessDyn + static: true + exception: true + signature: + ret: any + args: [any, acc] + impl: panda::ecmascript::intrinsics::LessDyn + set_flags: [heap_inv] + +- name: LessEqDyn + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: lesseqDyn + static: true + exception: true + signature: + ret: any + args: [any, acc] + impl: panda::ecmascript::intrinsics::LessEqDyn + set_flags: [heap_inv] + +- name: GreaterDyn + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: greaterDyn + static: true + exception: true + signature: + ret: any + args: [any, acc] + impl: panda::ecmascript::intrinsics::GreaterDyn + set_flags: [heap_inv] + +- name: GreaterEqDyn + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: greatereqDyn + static: true + exception: true + signature: + ret: any + args: [any, acc] + impl: panda::ecmascript::intrinsics::GreaterEqDyn + set_flags: [heap_inv] + +- name: LdObjByValue + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: ldObjByValue + static: true + exception: true + signature: + ret: any + args: [any, any, u16] + impl: panda::ecmascript::intrinsics::LdObjByValue + fast_path: FastPathLdObjByValue + set_flags: [heap_inv] + +- name: TryLdGlobalByValue + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: tryLdGlobalByValue + static: true + exception: true + signature: + ret: any + args: [u16, any] + impl: panda::ecmascript::intrinsics::TryLdGlobalByValue + set_flags: [heap_inv] + +- name: StObjByValue + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: stObjByValue + static: true + exception: true + signature: + ret: any + args: [any, any, acc, u16] + impl: panda::ecmascript::intrinsics::StObjByValue + fast_path: FastPathStObjByValue + set_flags: [heap_inv] + +- name: Shl2Dyn + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: shl2Dyn + static: true + exception: true + signature: + ret: any + args: [any, acc] + impl: panda::ecmascript::intrinsics::Shl2Dyn + set_flags: [heap_inv] + fast_path: FastPathEcmaShl + +- name: Shr2Dyn + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: shr2Dyn + static: true + exception: true + signature: + ret: any + args: [any, acc] + impl: panda::ecmascript::intrinsics::Shr2Dyn + set_flags: [heap_inv] + fast_path: FastPathEcmaShr + +- name: Ashr2Dyn + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: ashr2Dyn + static: true + exception: true + signature: + ret: any + args: [any, acc] + impl: panda::ecmascript::intrinsics::Ashr2Dyn + set_flags: [heap_inv] + +- name: And2Dyn + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: and2Dyn + static: true + exception: true + signature: + ret: any + args: [any, acc] + impl: panda::ecmascript::intrinsics::And2Dyn + set_flags: [heap_inv] + fast_path: FastPathEcmaAnd + +- name: Or2Dyn + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: or2Dyn + static: true + exception: true + signature: + ret: any + args: [any, acc] + impl: panda::ecmascript::intrinsics::Or2Dyn + set_flags: [heap_inv] + fast_path: FastPathEcmaOr + +- name: Xor2Dyn + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: xor2Dyn + static: true + exception: true + signature: + ret: any + args: [any, acc] + impl: panda::ecmascript::intrinsics::Xor2Dyn + set_flags: [heap_inv] + fast_path: FastPathEcmaXor + +- name: Tonumber + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: tonumber + static: true + exception: true + signature: + ret: any + args: [any] + impl: panda::ecmascript::intrinsics::Tonumber + set_flags: [heap_inv] + +- name: NegDyn + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: negDyn + static: true + exception: true + signature: + ret: any + args: [any] + impl: panda::ecmascript::intrinsics::NegDyn + set_flags: [heap_inv] + fast_path: FastPathEcmaNeg + +- name: NotDyn + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: notDyn + static: true + exception: true + signature: + ret: any + args: [any] + impl: panda::ecmascript::intrinsics::NotDyn + set_flags: [heap_inv] + fast_path: FastPathEcmaNot + +- name: IncDyn + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: incDyn + static: true + exception: true + signature: + ret: any + args: [any] + impl: panda::ecmascript::intrinsics::IncDyn + set_flags: [heap_inv] + fast_path: FastPathEcmaInc + +- name: DecDyn + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: decDyn + static: true + exception: true + signature: + ret: any + args: [any] + impl: panda::ecmascript::intrinsics::DecDyn + set_flags: [heap_inv] + fast_path: FastPathEcmaDec + +- name: RethrowDyn + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: rethrowDyn + static: true + exception: true + signature: + ret: any + args: [acc] + impl: panda::ecmascript::intrinsics::RethrowDyn + set_flags: [heap_inv] + +- name: ThrowDyn + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: throwDyn + static: true + exception: true + signature: + ret: void + args: [acc] + impl: panda::ecmascript::intrinsics::ThrowDyn + +- name: Delobjprop + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: delobjprop + static: true + exception: true + signature: + ret: any + args: [any, any] + impl: panda::ecmascript::intrinsics::Delobjprop + set_flags: [heap_inv] + +- name: Defineglobalvar + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: defineglobalvar + static: true + signature: + ret: any + args: [any, any] + impl: panda::ecmascript::intrinsics::Defineglobalvar + +- name: Definelocalvar + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: definelocalvar + static: true + signature: + ret: any + args: [any, any] + impl: panda::ecmascript::intrinsics::Definelocalvar + +- name: Definefuncexpr + class_name: Ecmascript.Intrinsics + space: ecmascript + method_name: definefuncexpr + static: true + signature: + ret: any + args: [any, any] + impl: panda::ecmascript::intrinsics::Definefuncexpr + +- name: DefinefuncDyn + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: definefuncDyn + static: true + exception: true + signature: + ret: any + args: [method_id, any] + impl: panda::ecmascript::intrinsics::DefinefuncDyn + +- name: DefineNCFuncDyn + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: defineNCFuncDyn + static: true + exception: true + signature: + ret: any + args: [method_id, any, acc] + impl: panda::ecmascript::intrinsics::DefineNCFuncDyn + +- name: NewobjDynrange + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: newobjDynrange + static: true + exception: true + signature: + ret: any + args: [u16, any, any] + stackrange: true + impl: panda::ecmascript::intrinsics::NewobjDynrange + set_flags: [heap_inv] + +- name: NewobjDynrangeInterp + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: newobjDynrangeInterp + static: true + exception: true + signature: + ret: any + args: [u16, any] + impl: panda::ecmascript::intrinsics::NewobjDynrangeInterp + set_flags: [heap_inv] + +- name: RefeqDyn + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: refeqDyn + static: true + signature: + ret: any + args: [any, any] + impl: panda::ecmascript::intrinsics::RefeqDyn + +- name: ExpDyn + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: expDyn + static: true + exception: true + signature: + ret: any + args: [any, acc] + impl: panda::ecmascript::intrinsics::ExpDyn + set_flags: [heap_inv] + +- name: TypeofDyn + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: typeofDyn + static: true + signature: + ret: any + args: [acc] + impl: panda::ecmascript::intrinsics::TypeofDyn + clear_flags: [no_dce] + +- name: Callruntimerange + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: callruntimerange + static: true + signature: + ret: any + args: [any, any] + impl: panda::ecmascript::intrinsics::Callruntimerange + +- name: IsinDyn + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: isinDyn + static: true + exception: true + signature: + ret: any + args: [any, acc] + impl: panda::ecmascript::intrinsics::IsinDyn + set_flags: [heap_inv] + +- name: InstanceofDyn + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: instanceofDyn + static: true + exception: true + signature: + ret: any + args: [any, acc] + impl: panda::ecmascript::intrinsics::InstanceofDyn + set_flags: [heap_inv] + +- name: StrictNotEqDyn + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: strictNotEqDyn + static: true + signature: + ret: any + args: [any, acc] + impl: panda::ecmascript::intrinsics::StrictNotEqDyn + set_flags: [heap_inv] + clear_flags: [no_dce] + use_thread: false + +- name: StrictEqDyn + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: strictEqDyn + static: true + signature: + ret: any + args: [any, acc] + impl: panda::ecmascript::intrinsics::StrictEqDyn + set_flags: [heap_inv] + use_thread: false + +- name: NewobjspreadDyn + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: newobjspreadDyn + static: true + exception: true + signature: + ret: any + args: [any, any, acc] + impl: panda::ecmascript::intrinsics::NewobjspreadDyn + set_flags: [heap_inv] + +- name: CallspreadDyn + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: callspreadDyn + static: true + exception: true + signature: + ret: any + args: [any, any, any] + impl: panda::ecmascript::intrinsics::CallspreadDyn + set_flags: [heap_inv] + +- name: JfalseDyn + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: jfalseDyn + static: true + signature: + ret: void + args: [u16, acc] + impl: panda::ecmascript::intrinsics::JfalseDyn + +- name: JtrueDyn + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: jtrueDyn + static: true + signature: + ret: void + args: [u16, acc] + impl: panda::ecmascript::intrinsics::JtrueDyn + +- name: ReturnDyn + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: returnDyn + static: true + signature: + ret: any + args: [any] + impl: panda::ecmascript::intrinsics::ReturnDyn + +- name: NewlexenvDyn + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: newlexenvDyn + static: true + exception: true + signature: + ret: any + args: [u16] + impl: panda::ecmascript::intrinsics::NewlexenvDyn + +- name: CopylexenvDyn + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: copylexenvDyn + static: true + signature: + ret: any + args: [] + impl: panda::ecmascript::intrinsics::CopylexenvDyn + +- name: StLexVarDyn + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: StLexVarDyn + static: true + exception: true + signature: + ret: void + args: [u16, u16, acc] + impl: panda::ecmascript::intrinsics::StLexVarDyn + +- name: LdLexVarDyn + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: LdLexVarDyn + static: true + exception: true + signature: + ret: any + args: [u16, u16] + impl: panda::ecmascript::intrinsics::LdLexVarDyn + set_flags: [require_tmp] + clear_flags: [no_dce] + codegen_func: LdLexVarDyn + +- name: LdlexenvDyn + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: ldlexenvDyn + static: true + exception: true + signature: + ret: any + args: [] + impl: panda::ecmascript::intrinsics::LdlexenvDyn + clear_flags: [no_dce] + codegen_func: LdlexenvDyn + +- name: PopLexenvDyn + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: popLexenvDyn + static: true + signature: + ret: void + args: [] + impl: panda::ecmascript::intrinsics::PopLexenvDyn + +- name: GetUnmappedArgs + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: getUnmappedArgs + static: true + exception: true + signature: + ret: any + args: [] + impl: panda::ecmascript::intrinsics::GetUnmappedArgs + +- name: GetUnmappedArgsInterp + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: getUnmappedArgsInterp + static: true + exception: true + signature: + ret: any + args: [] + impl: panda::ecmascript::intrinsics::GetUnmappedArgsInterp + +- name: Toboolean + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: toboolean + static: true + signature: + ret: any + args: [acc] + impl: panda::ecmascript::intrinsics::Toboolean + set_flags: [heap_inv] + clear_flags: [no_dce] + use_thread: false + +- name: Negate + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: negate + static: true + exception: true + signature: + ret: any + args: [acc] + impl: panda::ecmascript::intrinsics::Negate + clear_flags: [no_dce] + use_thread: false + +- name: IsUndefined + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: isUndefined + static: true + exception: true + signature: + ret: any + args: [acc] + impl: panda::ecmascript::intrinsics::IsUndefined + clear_flags: [no_dce] + use_thread: false + +- name: IsTrue + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: isTrue + static: true + exception: true + signature: + ret: any + args: [acc] + impl: panda::ecmascript::intrinsics::IsTrue + clear_flags: [no_dce] + use_thread: false + +- name: IsFalse + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: isFalse + static: true + exception: true + signature: + ret: any + args: [acc] + impl: panda::ecmascript::intrinsics::IsFalse + clear_flags: [no_dce] + use_thread: false + +- name: IsCoercible + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: isCoercible + static: true + exception: true + signature: + ret: any + args: [acc] + impl: panda::ecmascript::intrinsics::IsCoercible + clear_flags: [no_dce] + use_thread: false + +- name: GetPropIterator + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: getPropIterator + static: true + exception: true + signature: + ret: any + args: [acc] + impl: panda::ecmascript::intrinsics::GetPropIterator + +- name: DefineGeneratorFunc + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: defineGeneratorFunc + static: true + exception: true + signature: + ret: any + args: [method_id, any] + impl: panda::ecmascript::intrinsics::DefineGeneratorFunc + +- name: CreateIterResultObj + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: createIterResultObj + static: true + exception: true + signature: + ret: any + args: [acc, u8] + impl: panda::ecmascript::intrinsics::CreateIterResultObj + +- name: suspendGenerator + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: suspendGenerator + static: true + exception: true + signature: + ret: any + args: [any, acc] + impl: panda::ecmascript::intrinsics::SuspendGenerator + +- name: suspendGeneratorInterp + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: suspendGeneratorInterp + static: true + exception: true + signature: + ret: any + args: [any, acc, any] + impl: panda::ecmascript::intrinsics::SuspendGeneratorInterp + +- name: SuspendAsyncGenerator + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: suspendAsyncGenerator + static: true + exception: true + signature: + ret: any + args: [any, acc] + impl: panda::ecmascript::intrinsics::SuspendAsyncGenerator + +- name: SuspendAsyncGeneratorInterp + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: suspendAsyncGeneratorInterp + static: true + exception: true + signature: + ret: any + args: [any, acc, any] + impl: panda::ecmascript::intrinsics::SuspendAsyncGeneratorInterp + +- name: ResumeGenerator + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: resumeGenerator + static: true + exception: true + signature: + ret: any + args: [any] + impl: panda::ecmascript::intrinsics::ResumeGenerator + clear_flags: [no_dce] + use_thread: false + +- name: GetResumeMode + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: getResumeMode + static: true + exception: true + signature: + ret: any + args: [any] + impl: panda::ecmascript::intrinsics::GetResumeMode + clear_flags: [no_dce] + use_thread: false + +- name: CreateGeneratorObj + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: createGeneratorObj + static: true + exception: true + signature: + ret: any + args: [any] + impl: panda::ecmascript::intrinsics::CreateGeneratorObj + +- name: SetGeneratorState + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: setGeneratorState + static: true + exception: true + signature: + ret: any + args: [any, u8] + impl: panda::ecmascript::intrinsics::SetGeneratorState + +- name: CreateAsyncGeneratorObj + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: createAsyncGeneratorObj + static: true + exception: true + signature: + ret: any + args: [any] + impl: panda::ecmascript::intrinsics::CreateAsyncGeneratorObj + +- name: DefineAsyncGeneratorFunc + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: defineAsyncGeneratorFunc + static: true + exception: true + signature: + ret: any + args: [method_id, any] + impl: panda::ecmascript::intrinsics::DefineAsyncGeneratorFunc + +- name: DefineAsyncFunc + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: defineAsyncFunc + static: true + exception: true + signature: + ret: any + args: [method_id, any] + impl: panda::ecmascript::intrinsics::DefineAsyncFunc + +- name: AsyncFunctionEnter + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: asyncFunctionEnter + static: true + exception: true + signature: + ret: any + args: [] + impl: panda::ecmascript::intrinsics::AsyncFunctionEnter + +- name: AsyncFunctionAwait + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: asyncFunctionAwait + static: true + exception: true + signature: + ret: any + args: [any, acc] + set_flags: [heap_inv] + impl: panda::ecmascript::intrinsics::AsyncFunctionAwait + +- name: AsyncFunctionResolve + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: asyncFunctionResolve + static: true + exception: true + signature: + ret: any + args: [any, acc] + set_flags: [heap_inv] + impl: panda::ecmascript::intrinsics::AsyncFunctionResolve + +- name: AsyncFunctionReject + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: asyncFunctionReject + exception: true + static: true + signature: + ret: any + args: [any, acc] + set_flags: [heap_inv] + impl: panda::ecmascript::intrinsics::AsyncFunctionReject + +- name: AsyncGeneratorResolve + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: asyncGeneratorResolve + static: true + exception: true + signature: + ret: any + args: [any, acc] + set_flags: [heap_inv] + impl: panda::ecmascript::intrinsics::AsyncGeneratorResolve + +- name: AsyncGeneratorReject + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: asyncGeneratorReject + exception: true + static: true + signature: + ret: any + args: [any, acc] + set_flags: [heap_inv] + impl: panda::ecmascript::intrinsics::AsyncGeneratorReject + +- name: ThrowUndefined + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: throwUndefined + static: true + exception: true + signature: + ret: void + args: [any] + impl: panda::ecmascript::intrinsics::ThrowUndefined + +- name: ThrowConstAssignment + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: throwConstAssignment + static: true + exception: true + signature: + ret: void + args: [string_id] + impl: panda::ecmascript::intrinsics::ThrowConstAssignment + +- name: ThrowUndefinedIfHole + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: throwUndefinedIfHole + static: true + exception: true + signature: + ret: any + args: [string_id, acc] + impl: panda::ecmascript::intrinsics::ThrowUndefinedIfHole + +- name: Copyrestargs + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: copyrestargs + static: true + exception: true + signature: + ret: any + args: [u16] + impl: panda::ecmascript::intrinsics::Copyrestargs + +- name: CopyrestargsInterp + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: copyrestargsInterp + static: true + exception: true + signature: + ret: any + args: [u16] + impl: panda::ecmascript::intrinsics::CopyrestargsInterp + +- name: Ldhole + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: ldHole + static: true + signature: + ret: any + args: [] + clear_flags: [no_dce] + impl: panda::ecmascript::intrinsics::Ldhole + use_thread: false + +- name: TryStGlobalByValue + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: tryStGlobalByValue + exception: true + static: true + signature: + ret: void + args: [u16, any, acc] + impl: panda::ecmascript::intrinsics::TryStGlobalByValue + set_flags: [heap_inv] + +- name: GetMethod + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: getMethod + static: true + exception: true + signature: + ret: any + args: [string_id, any] + impl: panda::ecmascript::intrinsics::GetMethod + set_flags: [heap_inv] + +- name: GetTemplateObject + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: getTemplateObject + static: true + exception: true + signature: + ret: any + args: [any] + impl: panda::ecmascript::intrinsics::GetTemplateObject + set_flags: [heap_inv] + +- name: TryLdGlobalByName + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: TryLdGlobalByName + static: true + exception: true + signature: + ret: any + args: [string_id, u16] + impl: panda::ecmascript::intrinsics::TryLdGlobalByName + set_flags: [heap_inv] + +- name: TryStGlobalByName + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: TryStGlobalByName + static: true + exception: true + signature: + ret: any + args: [string_id, acc, u16] + impl: panda::ecmascript::intrinsics::TryStGlobalByName + set_flags: [heap_inv] + +- name: LdGlobalVar + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: LdGlobalVar + static: true + exception: true + signature: + ret: any + args: [string_id, u16] + impl: panda::ecmascript::intrinsics::LdGlobalVar + fast_path: FastPathLdGlobalVar + set_flags: [heap_inv] + +- name: StGlobalVar + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: StGlobalVar + static: true + exception: true + signature: + ret: any + args: [string_id, acc, u16] + impl: panda::ecmascript::intrinsics::StGlobalVar + fast_path: FastPathStGlobalVar + set_flags: [heap_inv] + +- name: StGlobalLet + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: StGlobalLet + static: true + exception: true + signature: + ret: any + args: [string_id, acc] + impl: panda::ecmascript::intrinsics::StGlobalLet + set_flags: [heap_inv] + +- name: LdObjByName + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: LdObjByName + static: true + exception: true + signature: + ret: any + args: [string_id, any, u16] + impl: panda::ecmascript::intrinsics::LdObjByName + fast_path: FastPathLdObjByName + set_flags: [heap_inv] + +- name: StObjByName + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: StObjByName + static: true + exception: true + signature: + ret: any + args: [string_id, any, acc, u16] + impl: panda::ecmascript::intrinsics::StObjByName + fast_path: FastPathStObjByName + set_flags: [heap_inv] + +- name: LdObjByIndex + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: LdObjByIndex + static: true + exception: true + signature: + ret: any + args: [u32, any] + impl: panda::ecmascript::intrinsics::LdObjByIndex + set_flags: [heap_inv] + +- name: StObjByIndex + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: StObjByIndex + static: true + exception: true + signature: + ret: any + args: [u32, any, acc] + impl: panda::ecmascript::intrinsics::StObjByIndex + set_flags: [heap_inv] + +- name: GetNextPropName + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: getnextpropname + static: true + exception: true + signature: + ret: any + args: [any] + impl: panda::ecmascript::intrinsics::GetNextPropName + set_flags: [heap_inv] + +- name: ReturnUndefined + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: ReturnUndefined + static: true + signature: + ret: void + args: [] + impl: panda::ecmascript::intrinsics::ReturnUndefined + +- name: Call0Dyn + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: Call0Dyn + static: true + exception: true + signature: + ret: any + args: [any] + impl: panda::ecmascript::intrinsics::Call0Dyn + set_flags: [heap_inv] + +- name: Call1Dyn + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: Call1Dyn + static: true + exception: true + signature: + ret: any + args: [any, any] + impl: panda::ecmascript::intrinsics::Call1Dyn + set_flags: [heap_inv] + +- name: Call2Dyn + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: Call2Dyn + static: true + exception: true + signature: + ret: any + args: [any, any, any] + impl: panda::ecmascript::intrinsics::Call2Dyn + set_flags: [heap_inv] + +- name: Call3Dyn + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: Call3Dyn + static: true + exception: true + signature: + ret: any + args: [any, any, any, any] + impl: panda::ecmascript::intrinsics::Call3Dyn + set_flags: [heap_inv] + +- name: CalliRangeDyn + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: CalliRangeDyn + static: true + exception: true + signature: + ret: any + args: [u16, any] + impl: panda::ecmascript::intrinsics::CalliRangeDyn + set_flags: [heap_inv] + +- name: CalliRangeDynInterp + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: CalliRangeDynInterp + static: true + exception: true + signature: + ret: any + args: [u16, any] + impl: panda::ecmascript::intrinsics::CalliRangeDynInterp + set_flags: [heap_inv] + +- name: CalliThisRangeDyn + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: CalliThisRangeDyn + static: true + exception: true + signature: + ret: any + args: [u16, any] + impl: panda::ecmascript::intrinsics::CalliThisRangeDyn + set_flags: [heap_inv] + +- name: CreateEmptyObject + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: createemptyobject + static: true + exception: true + signature: + ret: any + args: [] + impl: panda::ecmascript::intrinsics::CreateEmptyObject + clear_flags: [no_dce] + +- name: CreateObjectWithBuffer + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: createobjectwithbuffer + static: true + exception: true + signature: + ret: any + args: [u16] + impl: panda::ecmascript::intrinsics::CreateObjectWithBuffer + +- name: CopyDataProperties + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: copydataproperties + static: true + exception: true + signature: + ret: any + args: [any, any] + impl: panda::ecmascript::intrinsics::CopyDataProperties + set_flags: [heap_inv] + +- name: DefineGetterSetterByValue + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: definegettersetterbyvalue + static: true + exception: true + signature: + ret: any + args: [any, any, any, any, acc] + impl: panda::ecmascript::intrinsics::DefineGetterSetterByValue + set_flags: [heap_inv] + +- name: CreateEmptyArray + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: createemptyarray + static: true + exception: true + signature: + ret: any + args: [] + impl: panda::ecmascript::intrinsics::CreateEmptyArray + clear_flags: [no_dce] + +- name: CreateArrayWithBuffer + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: createarraywithbuffer + static: true + exception: true + signature: + ret: any + args: [u16] + impl: panda::ecmascript::intrinsics::CreateArrayWithBuffer + +- name: StOwnByName + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: StOwnByName + static: true + exception: true + signature: + ret: any + args: [string_id, any, acc] + impl: panda::ecmascript::intrinsics::StOwnByName + set_flags: [heap_inv] + +- name: StOwnByIndex + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: StOwnByIndex + static: true + exception: true + signature: + ret: any + args: [u32, any, acc] + impl: panda::ecmascript::intrinsics::StOwnByIndex + set_flags: [heap_inv] + +- name: StOwnByValue + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: StOwnByValue + static: true + exception: true + signature: + ret: any + args: [any, any, acc] + impl: panda::ecmascript::intrinsics::StOwnByValue + set_flags: [heap_inv] + +- name: StArraySpread + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: starrayspread + static: true + exception: true + signature: + ret: any + args: [any, any, acc] + impl: panda::ecmascript::intrinsics::StArraySpread + set_flags: [heap_inv] + +- name: GetIterator + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: GetIterator + static: true + exception: true + signature: + ret: any + args: [acc] + impl: panda::ecmascript::intrinsics::GetIterator + set_flags: [heap_inv] + +- name: GetAsyncIterator + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: GetAsyncIterator + static: true + exception: true + signature: + ret: any + args: [acc] + impl: panda::ecmascript::intrinsics::GetAsyncIterator + set_flags: [heap_inv] + +- name: ThrowIfNotObject + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: ThrowIfNotObject + static: true + exception: true + signature: + ret: any + args: [acc] + impl: panda::ecmascript::intrinsics::ThrowIfNotObject + +- name: ThrowThrowNotExists + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: ThrowThrowNotExists + static: true + exception: true + signature: + ret: void + args: [] + impl: panda::ecmascript::intrinsics::ThrowThrowNotExists + +- name: CreateObjectWithExcludedKeys + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: CreateObjectWithExcludedKeys + static: true + exception: true + range: true + signature: + ret: any + args: [u16, any, any] + impl: panda::ecmascript::intrinsics::CreateObjectWithExcludedKeys + +- name: ThrowPatternNonCoercible + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: ThrowPatternNonCoercible + static: true + exception: true + signature: + ret: void + args: [] + impl: panda::ecmascript::intrinsics::ThrowPatternNonCoercible + +- name: CloseIterator + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: CloseIterator + static: true + exception: true + signature: + ret: any + args: [any, acc] + impl: panda::ecmascript::intrinsics::CloseIterator + set_flags: [heap_inv] + +- name: ImportModule + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: ImportModule + static: true + exception: true + signature: + ret: any + args: [string_id] + impl: panda::ecmascript::intrinsics::ImportModule + clear_flags: [no_dce] + +- name: StModuleVar + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: StModuleVar + static: true + exception: true + signature: + ret: void + args: [string_id, acc] + impl: panda::ecmascript::intrinsics::StModuleVar + +- name: CopyModule + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: CopyModule + static: true + exception: true + signature: + ret: void + args: [any] + impl: panda::ecmascript::intrinsics::CopyModule + +- name: LdModvarByName + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: LdModvarByName + static: true + exception: true + signature: + ret: any + args: [string_id, any] + impl: panda::ecmascript::intrinsics::LdModvarByName + clear_flags: [no_dce] + set_flags: [heap_inv] + +- name: DefineClassWithBuffer + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: DefineClassWithBuffer + static: true + exception: true + signature: + ret: any + args: [method_id, u16, any, any] + impl: panda::ecmascript::intrinsics::DefineClassWithBuffer + +- name: SuperCall + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: SuperCall + static: true + exception: true + signature: + ret: any + args: [u16, any, any, acc] + impl: panda::ecmascript::intrinsics::SuperCall + set_flags: [heap_inv] + +- name: SuperCallSpread + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: SuperCallSpread + static: true + exception: true + signature: + ret: any + args: [any, any, acc] + impl: panda::ecmascript::intrinsics::SuperCallSpread + set_flags: [heap_inv] + +- name: DefineMethod + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: defineMethod + static: true + exception: true + signature: + ret: any + args: [method_id, any, acc] + impl: panda::ecmascript::intrinsics::DefineMethod + +- name: LdSuperByName + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: LdSuperByName + static: true + exception: true + signature: + ret: any + args: [string_id, any] + impl: panda::ecmascript::intrinsics::LdSuperByName + set_flags: [heap_inv] + +- name: StSuperByName + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: StSuperByName + static: true + exception: true + signature: + ret: any + args: [string_id, any, any] + impl: panda::ecmascript::intrinsics::StSuperByName + set_flags: [heap_inv] + +- name: StSuperByValue + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: StSuperByValue + static: true + exception: true + signature: + ret: any + args: [any, any, acc] + impl: panda::ecmascript::intrinsics::StSuperByValue + set_flags: [heap_inv] + +- name: LdSuperByValue + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: LdSuperByValue + static: true + exception: true + signature: + ret: any + args: [any, any] + impl: panda::ecmascript::intrinsics::LdSuperByValue + set_flags: [heap_inv] + +- name: CreateObjectHavingMethod + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: createobjecthavingmethod + static: true + exception: true + signature: + ret: any + args: [u16, acc] + impl: panda::ecmascript::intrinsics::CreateObjectHavingMethod + +- name: ThrowIfSuperNotCorrectCall + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: ThrowIfSuperNotCorrectCall + static: true + exception: true + signature: + ret: any + args: [u16, acc] + impl: panda::ecmascript::intrinsics::ThrowIfSuperNotCorrectCall + +- name: LdHomeObject + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: LdHomeObject + static: true + signature: + ret: any + args: [] + impl: panda::ecmascript::intrinsics::LdHomeObject + clear_flags: [no_dce] + +- name: SetObjectWithProto + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: setobjectwithproto + static: true + exception: true + signature: + ret: any + args: [any, any] + impl: panda::ecmascript::intrinsics::SetObjectWithProto + +- name: ThrowDeleteSuperProperty + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: ThrowDeleteSuperProperty + static: true + exception: true + signature: + ret: void + args: [] + impl: panda::ecmascript::intrinsics::ThrowDeleteSuperProperty + +- name: Debugger + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: debugger + static: true + signature: + ret: void + args: [] + impl: panda::ecmascript::intrinsics::Debugger + use_thread: false + +- name: NativeMethodWrapper + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: NativeMethodWrapper + static: true + exception: true + signature: + ret: void + args: [any] + impl: panda::ecmascript::intrinsics::NativeMethodWrapper + use_thread: false + +- name: GetObjectClassType + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: GetObjectClassType + static: true + codegen_func: GetObjectClassTypeIntrinsic + signature: + ret: u8 + args: [any] + impl: panda::ecmascript::intrinsics::GetObjectClassType + use_thread: false + clear_flags: [no_dce, barrier, require_state, runtime_call] + +- name: IsNan + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: IsNan + static: true + signature: + ret: any + args: [f64] + impl: panda::ecmascript::intrinsics::IsNan + use_thread: false + +- name: GetEcmaConstantPool + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: GetEcmaConstantPool + static: true + codegen_func: GetEcmaConstantPool + signature: + ret: any + args: [] + impl: panda::ecmascript::intrinsics::GetEcmaConstantPool + clear_flags: [no_dce, barrier, require_state, runtime_call] + +- name: GetEcmaThisFunc + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: GetEcmaThisFunc + static: true + codegen_func: GetEcmaThisFunc + signature: + ret: any + args: [] + impl: panda::ecmascript::intrinsics::GetEcmaThisFunc + clear_flags: [no_dce, barrier, require_state, runtime_call] + +- name: GetWeakReferent + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: GetWeakReferent + static: true + codegen_func: GetWeakReferent + signature: + ret: any + args: [any] + impl: panda::ecmascript::intrinsics::GetWeakReferent + use_thread: false + clear_flags: [no_dce, barrier, require_state, runtime_call] + +- name: DynClassIsDictionaryElement + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: DynClassIsDictionaryElement + static: true + signature: + ret: u1 + args: [any] + impl: panda::ecmascript::intrinsics::DynClassIsDictionaryElement + codegen_func: CreateDynClassIsDictionaryElement + use_thread: false + clear_flags: [no_dce, barrier, require_state, runtime_call] + +- name: DynClassIsExtensible + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: DynClassIsExtensible + static: true + signature: + ret: u1 + args: [any] + impl: panda::ecmascript::intrinsics::DynClassIsExtensible + codegen_func: CreateDynClassIsExtensible + use_thread: false + clear_flags: [no_dce, barrier, require_state, runtime_call] + +- name: DynObjectGetClass + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: DynObjectGetClass + static: true + signature: + ret: any + args: [any] + impl: panda::ecmascript::intrinsics::DynObjectGetClass + codegen_func: CreateDynObjectGetClass + use_thread: false + clear_flags: [no_dce, barrier, require_state, runtime_call] + +- name: DynObjectSetClass + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: DynObjectSetClass + static: true + signature: + ret: void + args: [any, any] + impl: panda::ecmascript::intrinsics::DynObjectSetClass + codegen_func: CreateDynObjectSetClass + use_thread: false + clear_flags: [require_state, runtime_call] + +- name: DynCallCheck + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: CreateDynCallCheck + static: true + signature: + ret: void + args: [any] + codegen_func: CreateDynCallCheck + use_thread: false + clear_flags: [] + +- name: DynClassNumberOfProps + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: DynClassNumberOfProps + static: true + signature: + ret: u32 + args: [any] + impl: panda::ecmascript::intrinsics::DynClassNumberOfProps + codegen_func: CreateDynClassNumberOfProps + use_thread: false + clear_flags: [no_dce, barrier, require_state, runtime_call] + +- name: DynClassGetHash + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: DynClassGetHash + static: true + signature: + ret: u32 + args: [any] + impl: panda::ecmascript::intrinsics::DynClassGetHash + codegen_func: CreateDynClassGetHash + use_thread: false + clear_flags: [no_dce, barrier, require_state, runtime_call] + +- name: LdObjDynByName + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: LdObjDynByName + static: true + signature: + ret: any + args: [any, any, u16] + impl: panda::ecmascript::intrinsics::LdObjDynByName + codegen_func: CreateLdObjDynByName + use_thread: false + is_fastpath: true + clear_flags: [barrier, require_state] + +- name: StObjDynByName + space: ecmascript + class_name: Ecmascript.Intrinsics + method_name: StObjDynByName + static: true + signature: + ret: any + args: [any, any, any, u16] + impl: panda::ecmascript::intrinsics::StObjDynByName + codegen_func: CreateStObjDynByName + use_thread: false + is_fastpath: true + clear_flags: [barrier, require_state] diff --git a/runtime/ecma_string.h b/runtime/ecma_string.h index 431a118d3..ffc722be1 100644 --- a/runtime/ecma_string.h +++ b/runtime/ecma_string.h @@ -318,7 +318,7 @@ private: /** * str1 should have the same length as utf16_data. - * Converts utf8Data to utf16 and compare it with given utf16_data. + * Converts utf8_data to utf16 and compare it with given utf16_data. */ static bool IsUtf8EqualsUtf16(const uint8_t *utf8_data, size_t utf8_len, const uint16_t *utf16_data, uint32_t utf16_len); diff --git a/runtime/ecma_string_table.cpp b/runtime/ecma_string_table.cpp index 790cdf08d..f2e133eb0 100644 --- a/runtime/ecma_string_table.cpp +++ b/runtime/ecma_string_table.cpp @@ -85,9 +85,9 @@ void EcmaStringTable::InternString(EcmaString *string) string->SetIsInternString(); } -void EcmaStringTable::InternEmptyString(EcmaString *emptyStr) +void EcmaStringTable::InternEmptyString(EcmaString *empty_str) { - InternString(emptyStr); + InternString(empty_str); } EcmaString *EcmaStringTable::GetOrInternString(const uint8_t *utf8_data, uint32_t utf8_len, bool can_be_compress) diff --git a/runtime/ecma_vm.cpp b/runtime/ecma_vm.cpp index a99af3799..2bae8e6ff 100644 --- a/runtime/ecma_vm.cpp +++ b/runtime/ecma_vm.cpp @@ -234,10 +234,10 @@ bool EcmaVM::Initialize() JSHandle dynClassClassHandle = factory_->NewEcmaDynClassClass(nullptr, JSHClass::SIZE, JSType::HCLASS); JSHClass *dynclass = reinterpret_cast(dynClassClassHandle.GetTaggedValue().GetTaggedObject()); dynclass->SetClass(dynclass); - JSHandle globalEnvClass = + JSHandle global_env_class = factory_->NewEcmaDynClass(*dynClassClassHandle, GlobalEnv::SIZE, JSType::GLOBAL_ENV); - JSHandle globalEnvHandle = factory_->NewGlobalEnv(*globalEnvClass); + JSHandle globalEnvHandle = factory_->NewGlobalEnv(*global_env_class); global_env_ = globalEnvHandle.GetTaggedValue(); // init global env @@ -249,8 +249,8 @@ bool EcmaVM::Initialize() globalEnvHandle->SetEmptyLayoutInfo(thread_, factory_->CreateLayoutInfo(0)); globalEnvHandle->SetRegisterSymbols(thread_, SymbolTable::Create(thread_)); globalEnvHandle->SetGlobalRecord(thread_, GlobalDictionary::Create(thread_)); - JSTaggedValue emptyStr = thread_->GlobalConstants()->GetEmptyString(); - string_table_->InternEmptyString(EcmaString::Cast(emptyStr.GetTaggedObject())); + JSTaggedValue empty_str = thread_->GlobalConstants()->GetEmptyString(); + string_table_->InternEmptyString(EcmaString::Cast(empty_str.GetTaggedObject())); globalEnvHandle->SetEmptyTaggedQueue(thread_, factory_->NewTaggedQueue(0)); globalEnvHandle->SetTemplateMap(thread_, TemplateMap::Create(thread_)); globalEnvHandle->SetRegisterSymbols(GetJSThread(), SymbolTable::Create(GetJSThread())); @@ -279,7 +279,7 @@ bool EcmaVM::Initialize() void EcmaVM::InitializeEcmaScriptRunStat() { // NOLINTNEXTLINE(modernize-avoid-c-arrays) - static const char *runtimeCallerNames[] = { + static const char *runtime_caller_names[] = { // NOLINTNEXTLINE(cppcoreguidelines-macro-usage) #define INTERPRETER_CALLER_NAME(name) "InterPreter::" #name, INTERPRETER_CALLER_LIST(INTERPRETER_CALLER_NAME) // NOLINTNEXTLINE(bugprone-suspicious-missing-comma) @@ -293,10 +293,10 @@ void EcmaVM::InitializeEcmaScriptRunStat() ABSTRACT_OPERATION_LIST(ABSTRACT_OPERATION_NAME) #undef ABSTRACT_OPERATION_NAME }; - static_assert(sizeof(runtimeCallerNames) == sizeof(const char *) * ecmascript::RUNTIME_CALLER_NUMBER, + static_assert(sizeof(runtime_caller_names) == sizeof(const char *) * ecmascript::RUNTIME_CALLER_NUMBER, "Invalid runtime caller number"); auto allocator = Runtime::GetCurrent()->GetInternalAllocator(); - runtime_stat_ = allocator->New(runtimeCallerNames, ecmascript::RUNTIME_CALLER_NUMBER); + runtime_stat_ = allocator->New(runtime_caller_names, ecmascript::RUNTIME_CALLER_NUMBER); if (UNLIKELY(runtime_stat_ == nullptr)) { LOG_ECMA(FATAL) << "alloc runtime_stat_ failed"; UNREACHABLE(); @@ -605,7 +605,7 @@ Expected EcmaVM::InvokeEcmaEntrypoint(const panda_file::Fil JSHandle func = JSHandle(thread_, program->GetMainFunction()); JSHandle global = GlobalEnv::Cast(global_env_.GetTaggedObject())->GetJSGlobalObject(); - JSHandle newTarget(thread_, JSTaggedValue::Undefined()); + JSHandle new_target(thread_, JSTaggedValue::Undefined()); JSHandle jsargs = factory_->NewTaggedArray(args.size()); uint32_t i = 0; for (const std::string &str : args) { @@ -616,7 +616,7 @@ Expected EcmaVM::InvokeEcmaEntrypoint(const panda_file::Fil InternalCallParams *params = thread_->GetInternalCallParams(); params->MakeArgList(*jsargs); JSRuntimeOptions options = this->GetJSOptions(); - panda::ecmascript::InvokeJsFunction(thread_, func, global, newTarget, params); + panda::ecmascript::InvokeJsFunction(thread_, func, global, new_target, params); if (!thread_->HasPendingException()) { job::MicroJobQueue::ExecutePendingJob(thread_, GetMicroJobQueue()); } @@ -874,23 +874,23 @@ const panda_file::File *EcmaVM::GetLastLoadedPandaFile() return std::get<1>(currentFileTuple); } -JSHandle EcmaVM::GetModuleByName(JSHandle moduleName) +JSHandle EcmaVM::GetModuleByName(JSHandle module_name) { const std::string ¤tPathFile = GetLastLoadedPandaFile()->GetFilename(); - PandaString relativeFile = ConvertToPandaString(EcmaString::Cast(moduleName->GetTaggedObject())); + PandaString relativeFile = ConvertToPandaString(EcmaString::Cast(module_name->GetTaggedObject())); // generate full path PandaString abcPath = module_manager_->GenerateModuleFullPath(currentPathFile, relativeFile); // Uniform module name - JSHandle abcModuleName = factory_->NewFromString(abcPath); + JSHandle abcmodule_name = factory_->NewFromString(abcPath); - JSHandle module = module_manager_->GetModule(thread_, JSHandle::Cast(abcModuleName)); + JSHandle module = module_manager_->GetModule(thread_, JSHandle::Cast(abcmodule_name)); if (module->IsUndefined()) { - PandaString file = ConvertToPandaString(abcModuleName.GetObject()); + PandaString file = ConvertToPandaString(abcmodule_name.GetObject()); std::vector argv; ExecuteModule(file, ENTRY_POINTER, argv); - module = module_manager_->GetModule(thread_, JSHandle::Cast(abcModuleName)); + module = module_manager_->GetModule(thread_, JSHandle::Cast(abcmodule_name)); } return module; } diff --git a/runtime/frames.h b/runtime/frames.h index b56668d24..9ec736d29 100644 --- a/runtime/frames.h +++ b/runtime/frames.h @@ -27,7 +27,7 @@ // |----------------------------------| | // | thisArg [maybe not exist] | | // |----------------------------------| | -// | newTarget [maybe not exist] | | +// | new_target [maybe not exist] | | // |----------------------------------| | // | callTarget [deleted] | | // |----------------------------------| | @@ -78,7 +78,7 @@ // |----------------------------------| | // | thisArg [maybe not exist] | | // |----------------------------------| | -// | newTarget [maybe not exist] | | +// | new_target [maybe not exist] | | // |----------------------------------| | // | ...... | | // |----------------------------------| | diff --git a/runtime/global_dictionary-inl.h b/runtime/global_dictionary-inl.h index 2a32125b4..ca6f553ee 100644 --- a/runtime/global_dictionary-inl.h +++ b/runtime/global_dictionary-inl.h @@ -105,7 +105,7 @@ void GlobalDictionary::UpdateValue(const JSThread *thread, int entry, const JSTa void GlobalDictionary::GetAllKeys(const JSThread *thread, int offset, TaggedArray *key_array) const { ASSERT_PRINT(offset + EntriesCount() <= static_cast(key_array->GetLength()), - "keyArray capacity is not enough for dictionary"); + "key_array capacity is not enough for dictionary"); int array_index = 0; int size = Size(); @@ -129,7 +129,7 @@ void GlobalDictionary::GetAllKeys(const JSThread *thread, int offset, TaggedArra void GlobalDictionary::GetEnumAllKeys(const JSThread *thread, int offset, TaggedArray *key_array, uint32_t *keys) const { ASSERT_PRINT(offset + EntriesCount() <= static_cast(key_array->GetLength()), - "keyArray capacity is not enough for dictionary"); + "key_array capacity is not enough for dictionary"); int array_index = 0; int size = Size(); diff --git a/runtime/ic/invoke_cache.h b/runtime/ic/invoke_cache.h index 2733f7f47..5fb1747dd 100644 --- a/runtime/ic/invoke_cache.h +++ b/runtime/ic/invoke_cache.h @@ -26,7 +26,7 @@ public: static constexpr size_t POLY_CASE_NUM = 4; static bool SetMonoConstuctCacheSlot(JSThread *thread, ProfileTypeInfo *profileTypeInfo, uint32_t slotId, - JSTaggedValue newTarget, JSTaggedValue initialHClass); + JSTaggedValue new_target, JSTaggedValue initialHClass); static bool SetPolyConstuctCacheSlot(JSThread *thread, ProfileTypeInfo *profileTypeInfo, uint32_t slotId, uint8_t length, JSTaggedValue newTargetArray, @@ -35,7 +35,7 @@ public: static JSTaggedValue CheckPolyInvokeCache(JSTaggedValue cachedArray, JSTaggedValue func); static JSTaggedValue Construct(JSThread *thread, JSTaggedValue firstValue, JSTaggedValue secondValue, - JSTaggedValue ctor, JSTaggedValue newTarget, uint16_t firstArgIdx, uint16_t length); + JSTaggedValue ctor, JSTaggedValue new_target, uint16_t firstArgIdx, uint16_t length); static bool SetMonoInlineCallCacheSlot(JSThread *thread, ProfileTypeInfo *profileTypeInfo, uint32_t slotId, JSTaggedValue callee); diff --git a/runtime/interpreter/ecma-interpreter-inl.h b/runtime/interpreter/ecma-interpreter-inl.h index b083fd5d0..a3566204f 100644 --- a/runtime/interpreter/ecma-interpreter-inl.h +++ b/runtime/interpreter/ecma-interpreter-inl.h @@ -788,7 +788,7 @@ public: auto string_id = this->GetInst().template GetId(); auto prop = GetConstantPool(this->GetJSThread())->GetObjectFromCache(string_id.AsIndex()); LOG_INST() << "throwconstassignment " - << "stringId:" << ConvertToPandaString(EcmaString::Cast(prop.GetHeapObject())); + << "string_id:" << ConvertToPandaString(EcmaString::Cast(prop.GetHeapObject())); auto thread = JSThread::Cast(this->GetThread()); SlowRuntimeStub::ThrowConstAssignment(thread, prop); @@ -1509,7 +1509,7 @@ public: auto string_id = this->GetInst().template GetId(); auto prop = GetConstantPool(this->GetJSThread())->GetObjectFromCache(string_id.AsIndex()); LOG_INST() << "intrinsic::throwundefinedifhole " - << "stringId:" << ConvertToPandaString(EcmaString::Cast(prop.GetHeapObject())); + << "string_id:" << ConvertToPandaString(EcmaString::Cast(prop.GetHeapObject())); if (!GetAccAsTaggedValue().IsHole()) { this->template MoveToNextInst(); @@ -1528,7 +1528,7 @@ public: auto id = this->GetInst().template GetId(); LOG_INST() << "stownbyname " - << "v" << v0 << " stringId:" << id.AsIndex(); + << "v" << v0 << " string_id:" << id.AsIndex(); uint64_t obj = GetRegAsTaggedValue(v0).GetRawData(); uint64_t value = GetAccAsTaggedValue().GetRawData(); @@ -1584,7 +1584,7 @@ public: { auto string_id = this->GetInst().template GetId(); LOG_INST() << "importmodule " - << "stringId:" << std::hex << string_id.AsIndex(); + << "string_id:" << std::hex << string_id.AsIndex(); INTRINSIC_CALL_SETACC(intrinsics::ImportModule(this->GetJSThread(), string_id.AsIndex())); this->template MoveToNextInst(); @@ -1595,7 +1595,7 @@ public: { auto string_id = this->GetInst().template GetId(); LOG_INST() << "stmodulevar " - << "stringId:" << string_id; + << "string_id:" << string_id; uint64_t value = GetAccAsTaggedValue().GetRawData(); @@ -1640,7 +1640,7 @@ public: auto v0 = this->GetInst().template GetVReg(); auto string_id = this->GetInst().template GetId(); - LOG_INST() << "getmethod v" << v0 << " stringId:" << string_id; + LOG_INST() << "getmethod v" << v0 << " string_id:" << string_id; uint64_t obj = GetRegAsTaggedValue(v0).GetRawData(); INTRINSIC_CALL_CHECK_SETACC(intrinsics::GetMethod(this->GetJSThread(), string_id.AsIndex(), obj)); @@ -1799,7 +1799,7 @@ public: auto *state = this->GetFrame(); uint32_t num_vregs = state->GetMethod()->GetNumVregs(); - // Exclude func, newTarget and "this" + // Exclude func, new_target and "this" int32_t actual_num_args = state->GetNumActualArgs() - NUM_MANDATORY_JSFUNC_ARGS; int32_t tmp = actual_num_args - rest_idx; uint32_t rest_num_args = (tmp > 0) ? tmp : 0; @@ -1947,7 +1947,7 @@ public: { auto string_id = this->GetInst().template GetId(); LOG_INST() << "trystglobalbyname" - << " stringId:" << string_id; + << " string_id:" << string_id; uint64_t value = GetAccAsTaggedValue().GetRawData(); @@ -1964,7 +1964,7 @@ public: auto string_id = this->GetInst().template GetId(); LOG_INST() << "ldglobalvar " - << " stringId:" << string_id; + << " string_id:" << string_id; INTRINSIC_CALL_CHECK_SETACC( intrinsics::LdGlobalVar(this->GetJSThread(), string_id.AsIndex(), this->GetBytecodeOffset())); @@ -1977,7 +1977,7 @@ public: auto v0 = this->GetInst().template GetVReg(); auto string_id = this->GetInst().template GetId(); - LOG_INST() << "ldobjbyname v" << v0 << " stringId:" << string_id; + LOG_INST() << "ldobjbyname v" << v0 << " string_id:" << string_id; uint64_t obj = GetRegAsTaggedValue(v0).GetRawData(); INTRINSIC_CALL_CHECK_SETACC( @@ -1992,7 +1992,7 @@ public: auto string_id = this->GetInst().template GetId(); LOG_INST() << "stobjbyname " - << "v" << v0 << " stringId:" << string_id.AsIndex(); + << "v" << v0 << " string_id:" << string_id.AsIndex(); uint64_t obj = GetRegAsTaggedValue(v0).GetRawData(); uint64_t value = GetAccAsTaggedValue().GetRawData(); @@ -2011,7 +2011,7 @@ public: auto string_id = this->GetInst().template GetId(); LOG_INST() << "ldsuperbyname" - << "v" << v0 << " stringId:" << string_id.AsIndex(); + << "v" << v0 << " string_id:" << string_id.AsIndex(); uint64_t obj = GetRegAsTaggedValue(v0).GetRawData(); @@ -2026,7 +2026,7 @@ public: auto v0 = this->GetInst().template GetVReg(); LOG_INST() << "stsuperbyname" - << "v" << v0 << " stringId:" << string_id.AsIndex(); + << "v" << v0 << " string_id:" << string_id.AsIndex(); uint64_t obj = GetRegAsTaggedValue(v0).GetRawData(); uint64_t value = GetAccAsTaggedValue().GetRawData(); @@ -2043,7 +2043,7 @@ public: auto string_id = this->GetInst().template GetId(); LOG_INST() << "stglobalvar " - << "stringId:" << string_id.AsIndex() << ", "; + << "string_id:" << string_id.AsIndex() << ", "; uint64_t value = GetAccAsTaggedValue().GetRawData(); @@ -2060,7 +2060,7 @@ public: auto string_id = this->GetInst().template GetId(); LOG_INST() << "stgloballet " - << "stringId:" << string_id.AsIndex(); + << "string_id:" << string_id.AsIndex(); uint64_t value = GetAccAsTaggedValue().GetRawData(); diff --git a/runtime/interpreter/slow_runtime_helper.cpp b/runtime/interpreter/slow_runtime_helper.cpp index aab07b22e..948b39865 100644 --- a/runtime/interpreter/slow_runtime_helper.cpp +++ b/runtime/interpreter/slow_runtime_helper.cpp @@ -137,7 +137,7 @@ JSTaggedValue ConstructGeneric(JSThread *thread, JSHandle ctor, JSHa // add default arg func values.emplace_back(ctor.GetTaggedType()); - // add default arg newTarget, this + // add default arg new_target, this values.emplace_back(new_tgt.GetTaggedType()); values.emplace_back(obj.GetTaggedType()); @@ -161,7 +161,7 @@ JSTaggedValue ConstructGeneric(JSThread *thread, JSHandle ctor, JSHa JSTaggedValue result_value = EcmaInterpreter::Execute(thread, JSHandle::Cast(ctor), values.size(), values.data()); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); - // 9.3.2 [[Construct]] (argumentsList, newTarget) + // 9.3.2 [[Construct]] (argumentsList, new_target) if (ctor->IsBuiltinsConstructor() || result_value.IsECMAObject()) { return result_value; } @@ -215,7 +215,7 @@ JSTaggedValue ConstructProxy(JSThread *thread, JSHandle ctor, JSHandle< RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); // 7.If trap is undefined, then // a.Assert: target has a [[Construct]] internal method. - // b.Return Construct(target, argumentsList, newTarget). + // b.Return Construct(target, argumentsList, new_target). if (method->IsUndefined()) { ASSERT(target->IsConstructor()); return SlowRuntimeHelper::Construct(thread, target, new_tgt, pre_args, args_count, stkargs); @@ -237,11 +237,11 @@ JSTaggedValue ConstructProxy(JSThread *thread, JSHandle ctor, JSHandle< args->Set(thread, i + pre_args_size, JSTaggedValue(stkargs[i])); } - // step 8 ~ 9 Call(trap, handler, «target, argArray, newTarget »). + // step 8 ~ 9 Call(trap, handler, «target, argArray, new_target »). InternalCallParams *arguments = thread->GetInternalCallParams(); arguments->MakeArgv(target, JSHandle(args), new_tgt); JSTaggedValue new_obj_value = - JSFunction::Call(thread, method, handler, 3, arguments->GetArgv()); // 3: «target, argArray, newTarget » + JSFunction::Call(thread, method, handler, 3, arguments->GetArgv()); // 3: «target, argArray, new_target » // 10.ReturnIfAbrupt(newObj). RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); // 11.If Type(newObj) is not Object, throw a TypeError exception. diff --git a/runtime/interpreter/slow_runtime_stub.cpp b/runtime/interpreter/slow_runtime_stub.cpp index 97d1cc7bc..f8a2f0e67 100644 --- a/runtime/interpreter/slow_runtime_stub.cpp +++ b/runtime/interpreter/slow_runtime_stub.cpp @@ -1967,15 +1967,15 @@ JSTaggedValue SlowRuntimeStub::CloneClassFromTemplate(JSThread *thread, JSTagged JSHandle cls_prototype(thread, cls->GetFunctionPrototype()); - bool can_share_h_class = false; + bool can_share_hclass = false; if (cls->GetClass()->GetProto() == base_handle.GetTaggedValue()) { - can_share_h_class = true; + can_share_hclass = true; } - JSHandle clone_class = factory->CloneClassCtor(cls, lexenv_handle, can_share_h_class); + JSHandle clone_class = factory->CloneClassCtor(cls, lexenv_handle, can_share_hclass); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); JSHandle clone_class_prototype = factory->CloneObjectLiteral( - JSHandle(cls_prototype), lexenv_handle, constpool_handle, can_share_h_class); + JSHandle(cls_prototype), lexenv_handle, constpool_handle, can_share_hclass); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); // After clone both, reset "constructor" and "prototype" properties. @@ -1989,7 +1989,7 @@ JSTaggedValue SlowRuntimeStub::CloneClassFromTemplate(JSThread *thread, JSTagged clone_class->SetHomeObject(thread, clone_class_prototype); - if (!can_share_h_class) { + if (!can_share_hclass) { SetClassInheritanceRelationship(thread, clone_class.GetTaggedValue(), base_handle.GetTaggedValue()); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); } diff --git a/runtime/intrinsics-inl.h b/runtime/intrinsics-inl.h index 863830052..2c45c23f7 100644 --- a/runtime/intrinsics-inl.h +++ b/runtime/intrinsics-inl.h @@ -1355,7 +1355,7 @@ INLINE_ECMA_INTRINSICS uint64_t CopylexenvDyn(JSThread *thread) JSHandle old_env(thread, GetLexicalEnv(thread)); JSHandle parent_env(thread, old_env->GetParentEnv()); SetLexicalEnv(thread, parent_env.GetTaggedValue()); - array_size_t numOfSlots = old_env->GetLength(); + ArraySizeT num_of_slots = old_env->GetLength(); JSTaggedValue res = FastRuntimeStub::NewLexicalEnvDyn(thread, factory, num_of_slots); if (res.IsHole()) { diff --git a/runtime/js_arraylist.cpp b/runtime/js_arraylist.cpp index 126155e3a..12206a980 100644 --- a/runtime/js_arraylist.cpp +++ b/runtime/js_arraylist.cpp @@ -34,13 +34,13 @@ JSHandle JSArrayList::GrowCapacity(const JSThread *thread, const JS uint32_t capacity) { JSHandle oldElements(thread, obj->GetElements()); - uint32_t oldLength = oldElements->GetLength(); - if (capacity < oldLength) { + uint32_t old_length = oldElements->GetLength(); + if (capacity < old_length) { return oldElements; } - uint32_t newCapacity = ComputeCapacity(capacity); + uint32_t new_capacity = ComputeCapacity(capacity); JSHandle newElements = - thread->GetEcmaVM()->GetFactory()->CopyArray(oldElements, oldLength, newCapacity); + thread->GetEcmaVM()->GetFactory()->CopyArray(oldElements, old_length, new_capacity); obj->SetElements(thread, newElements); return newElements; diff --git a/runtime/js_function.cpp b/runtime/js_function.cpp index c33b4792a..8ddcca846 100644 --- a/runtime/js_function.cpp +++ b/runtime/js_function.cpp @@ -470,11 +470,11 @@ bool JSFunction::SetFunctionLength(JSThread *thread, const JSHandle JSTaggedValue JSBoundFunction::CallInternal(JSThread *thread, const JSHandle &func) { JSHandle target(thread, func->GetBoundTarget()); - JSHandle boundThis(thread, func->GetBoundThis()); + JSHandle bound_this(thread, func->GetBoundThis()); InternalCallParams *params = thread->GetInternalCallParams(); params->MakeBoundArgv(thread, func); - return JSFunction::Call(thread, target, boundThis, params->GetLength(), params->GetArgv()); + return JSFunction::Call(thread, target, bound_this, params->GetLength(), params->GetArgv()); } // 9.4.1.2[[Construct]](argumentsList, new_target) diff --git a/runtime/js_function.h b/runtime/js_function.h index 1e541974c..82527c7f0 100644 --- a/runtime/js_function.h +++ b/runtime/js_function.h @@ -93,8 +93,8 @@ public: const JSHandle &this_arg, uint32_t argc, const JSTaggedType argv[] // NOLINT(modernize-avoid-c-arrays) ); - // 9.2.2[[Construct]](argumentsList, newTarget) - // 9.3.2[[Construct]](argumentsList, newTarget) + // 9.2.2[[Construct]](argumentsList, new_target) + // 9.3.2[[Construct]](argumentsList, new_target) static JSTaggedValue ConstructInternal(JSThread *thread, const JSHandle &func, uint32_t argc, const JSTaggedType argv[], // NOLINT(modernize-avoid-c-arrays) const JSHandle &new_target); @@ -343,7 +343,7 @@ public: // 9.4.1.1[[Call]](thisArgument, argumentsList) static JSTaggedValue CallInternal(JSThread *thread, const JSHandle &func); - // 9.4.1.2[[Construct]](argumentsList, newTarget) + // 9.4.1.2[[Construct]](argumentsList, new_target) static JSTaggedValue ConstructInternal(JSThread *thread, const JSHandle &func, const JSHandle &new_target); diff --git a/runtime/js_invoker.h b/runtime/js_invoker.h index a852121e9..1af88acf0 100644 --- a/runtime/js_invoker.h +++ b/runtime/js_invoker.h @@ -29,10 +29,10 @@ public: { } - JsInvoker(const JSThread *thread, JSTaggedValue func, JSTaggedValue obj, JSTaggedValue newTarget) + JsInvoker(const JSThread *thread, JSTaggedValue func, JSTaggedValue obj, JSTaggedValue new_target) { AddArgument(JSHandle(thread, func)); - AddArgument(JSHandle(thread, newTarget)); + AddArgument(JSHandle(thread, new_target)); AddArgument(JSHandle(thread, obj)); } diff --git a/runtime/js_method.h b/runtime/js_method.h index 19811c1f1..f13f65fd9 100644 --- a/runtime/js_method.h +++ b/runtime/js_method.h @@ -25,9 +25,9 @@ namespace panda { class Class; } // namespace panda -static constexpr uint32_t NORMAL_CALL_TYPE = 0; // 0: normal (without this, newTarget, extra, func) +static constexpr uint32_t NORMAL_CALL_TYPE = 0; // 0: normal (without this, new_target, extra, func) static constexpr uint32_t HAVE_THIS_BIT = 1; // 1: the last bit means this -static constexpr uint32_t HAVE_NEWTARGET_BIT = 2; // 2: the 2nd to last bit means newTarget +static constexpr uint32_t HAVE_NEWTARGET_BIT = 2; // 2: the 2nd to last bit means new_target static constexpr uint32_t HAVE_EXTRA_BIT = 4; // 4: the 3rd to last bit means extra static constexpr uint32_t HAVE_FUNC_BIT = 8; // 8: the 4th to last bit means func (for old version, UINT32_MAX) diff --git a/runtime/js_object.cpp b/runtime/js_object.cpp index d85b55297..4e6c3a0b9 100644 --- a/runtime/js_object.cpp +++ b/runtime/js_object.cpp @@ -68,11 +68,11 @@ JSMethod *ECMAObject::GetCallTarget() const JSHandle JSObject::GrowElementsCapacity(const JSThread *thread, const JSHandle &obj, uint32_t capacity) { - uint32_t newCapacity = ComputeElementCapacity(capacity); + uint32_t new_capacity = ComputeElementCapacity(capacity); ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); JSHandle oldElements(thread, obj->GetElements()); - uint32_t oldLength = oldElements->GetLength(); - JSHandle newElements = factory->CopyArray(oldElements, oldLength, newCapacity); + uint32_t old_length = oldElements->GetLength(); + JSHandle newElements = factory->CopyArray(oldElements, old_length, new_capacity); obj->SetElements(thread, newElements); return newElements; @@ -185,8 +185,8 @@ bool JSObject::AddElementInternal(JSThread *thread, const JSHandle &re bool isDictionary = receiver->GetJSHClass()->IsDictionaryElement(); if (receiver->IsJSArray()) { JSHandle arr(receiver); - uint32_t oldLength = arr->GetArrayLength(); - if (index >= oldLength) { + uint32_t old_length = arr->GetArrayLength(); + if (index >= old_length) { if (!IsArrayLengthWritable(thread, receiver)) { return false; } @@ -513,13 +513,13 @@ bool JSObject::SetProperty(ObjectOperator *op, const JSHandle &va op->SetAsDefaultAttr(); } - bool isInternalAccessor = false; + bool is_internal_accessor = false; if (op->IsAccessorDescriptor()) { - isInternalAccessor = AccessorData::Cast(op->GetValue().GetTaggedObject())->IsInternal(); + is_internal_accessor = AccessorData::Cast(op->GetValue().GetTaggedObject())->IsInternal(); } // 5. If IsDataDescriptor(ownDesc) is true, then - if (!op->IsAccessorDescriptor() || isInternalAccessor) { + if (!op->IsAccessorDescriptor() || is_internal_accessor) { bool isSuccess = true; if (!op->IsWritable()) { if (may_throw) { @@ -576,7 +576,7 @@ bool JSObject::SetProperty(ObjectOperator *op, const JSHandle &va if (op->IsFound() && !op->IsOnPrototype()) { // i. If IsAccessorDescriptor(existingDescriptor) is true, return false. - if (op->IsAccessorDescriptor() && !isInternalAccessor) { + if (op->IsAccessorDescriptor() && !is_internal_accessor) { return false; } @@ -587,7 +587,7 @@ bool JSObject::SetProperty(ObjectOperator *op, const JSHandle &va } return false; } - isSuccess = op->UpdateDataValue(JSHandle(receiver), value, isInternalAccessor, may_throw); + isSuccess = op->UpdateDataValue(JSHandle(receiver), value, is_internal_accessor, may_throw); RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, isSuccess); } else { // 5f. Else if Receiver does not currently have a property P, Return CreateDataProperty(Receiver, P, V). diff --git a/runtime/js_promise.cpp b/runtime/js_promise.cpp index ae7587aaa..dd7ea6827 100644 --- a/runtime/js_promise.cpp +++ b/runtime/js_promise.cpp @@ -102,10 +102,10 @@ JSHandle JSPromise::NewPromiseCapability(JSThread *thread, co executor->SetCapability(thread, promiseCapability.GetTaggedValue()); // 6. Let promise be Construct(C, «executor»). // 7. ReturnIfAbrupt(promise). - JSHandle newTarget(thread, JSTaggedValue::Undefined()); + JSHandle new_target(thread, JSTaggedValue::Undefined()); InternalCallParams *arguments = thread->GetInternalCallParams(); arguments->MakeArgv(executor); - JSTaggedValue result = JSFunction::Construct(thread, obj, 1, arguments->GetArgv(), newTarget); + JSTaggedValue result = JSFunction::Construct(thread, obj, 1, arguments->GetArgv(), new_target); JSHandle promise(thread, result); RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, factory->NewPromiseCapability()); // 8. If IsCallable(promiseCapability.[[Resolve]]) is false, throw a TypeError exception. @@ -212,10 +212,10 @@ JSTaggedValue JSPromise::TriggerPromiseReactions(JSThread *thread, const JSHandl // 1. Repeat for each reaction in reactions, in original insertion order // a. Perform EnqueueJob("PromiseJobs", PromiseReactionJob, «reaction, argument»). JSHandle job = thread->GetEcmaVM()->GetMicroJobQueue(); - JSHandle globalEnv = thread->GetEcmaVM()->GetGlobalEnv(); + JSHandle global_env = thread->GetEcmaVM()->GetGlobalEnv(); const GlobalEnvConstants *globalConst = thread->GlobalConstants(); ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - JSHandle promiseReactionsJob(globalEnv->GetPromiseReactionJob()); + JSHandle promiseReactionsJob(global_env->GetPromiseReactionJob()); JSMutableHandle reaction(thread, JSTaggedValue::Undefined()); while (!reactions->Empty()) { reaction.Update(reactions->Pop(thread)); diff --git a/runtime/js_proxy.h b/runtime/js_proxy.h index a9fe1b553..cb5fb73c7 100644 --- a/runtime/js_proxy.h +++ b/runtime/js_proxy.h @@ -82,7 +82,7 @@ public: static JSTaggedValue CallInternal(JSThread *thread, const JSHandle &proxy, const JSHandle &this_arg, uint32_t argc, const JSTaggedType argv[]); // NOLINT(modernize-avoid-c-arrays) - // ES6 9.5.14 [[Construct]] ( argumentsList, newTarget) + // ES6 9.5.14 [[Construct]] ( argumentsList, new_target) static JSTaggedValue ConstructInternal( // NOLINTNEXTLINE(modernize-avoid-c-arrays) JSThread *thread, const JSHandle &proxy, uint32_t argc, const JSTaggedType argv[], diff --git a/runtime/js_serializer.cpp b/runtime/js_serializer.cpp index 7685ba83f..e836d5964 100644 --- a/runtime/js_serializer.cpp +++ b/runtime/js_serializer.cpp @@ -197,18 +197,18 @@ bool JSSerializer::AllocateBuffer(size_t bytes) bool JSSerializer::ExpandBuffer([[maybe_unused]] size_t requestedSize) { - size_t newCapacity = bufferCapacity_ * CAPACITY_INCREASE_RATE; - newCapacity = std::max(newCapacity, requestedSize); - if (newCapacity > sizeLimit_) { + size_t new_capacity = bufferCapacity_ * CAPACITY_INCREASE_RATE; + new_capacity = std::max(new_capacity, requestedSize); + if (new_capacity > sizeLimit_) { return false; } // NOLINTNEXTLINE(cppcoreguidelines-no-malloc) - auto *newBuffer = reinterpret_cast(malloc(newCapacity)); + auto *newBuffer = reinterpret_cast(malloc(new_capacity)); if (newBuffer == nullptr) { return false; } errno_t rc; - rc = memcpy_s(newBuffer, newCapacity, buffer_, bufferSize_); + rc = memcpy_s(newBuffer, new_capacity, buffer_, bufferSize_); if (rc != EOK) { LOG(ERROR, RUNTIME) << "Failed to memcpy_s Data"; // NOLINTNEXTLINE(cppcoreguidelines-no-malloc) @@ -218,7 +218,7 @@ bool JSSerializer::ExpandBuffer([[maybe_unused]] size_t requestedSize) // NOLINTNEXTLINE(cppcoreguidelines-no-malloc) free(buffer_); buffer_ = newBuffer; - bufferCapacity_ = newCapacity; + bufferCapacity_ = new_capacity; return true; } diff --git a/runtime/js_stable_array.cpp b/runtime/js_stable_array.cpp index 88aae1333..28c43605c 100644 --- a/runtime/js_stable_array.cpp +++ b/runtime/js_stable_array.cpp @@ -29,21 +29,21 @@ JSTaggedValue JSStableArray::Push(JSHandle receiver, EcmaRuntimeCallInf { JSThread *thread = argv->GetThread(); uint32_t argc = argv->GetArgsNumber(); - uint32_t oldLength = receiver->GetArrayLength(); - uint32_t newLength = argc + oldLength; + uint32_t old_length = receiver->GetArrayLength(); + uint32_t new_length = argc + old_length; TaggedArray *elements = TaggedArray::Cast(receiver->GetElements().GetTaggedObject()); - if (newLength > elements->GetLength()) { - elements = *JSObject::GrowElementsCapacity(thread, JSHandle::Cast(receiver), newLength); + if (new_length > elements->GetLength()) { + elements = *JSObject::GrowElementsCapacity(thread, JSHandle::Cast(receiver), new_length); } for (uint32_t k = 0; k < argc; k++) { JSHandle value = argv->GetCallArg(k); - elements->Set(thread, oldLength + k, value.GetTaggedValue()); + elements->Set(thread, old_length + k, value.GetTaggedValue()); } - receiver->SetArrayLength(thread, newLength); + receiver->SetArrayLength(thread, new_length); - return JSTaggedValue(newLength); + return JSTaggedValue(new_length); } JSTaggedValue JSStableArray::Pop(JSHandle receiver, EcmaRuntimeCallInfo *argv) @@ -121,7 +121,7 @@ JSTaggedValue JSStableArray::Splice(JSHandle receiver, EcmaRuntimeCallI } uint32_t oldCapacity = srcElementsHandle->GetLength(); - uint32_t newCapacity = len - actualDeleteCount + insertCount; + uint32_t new_capacity = len - actualDeleteCount + insertCount; if (insertCount < actualDeleteCount) { for (uint32_t idx = start; idx < len - actualDeleteCount; idx++) { auto element = srcElementsHandle->Get(idx + actualDeleteCount); @@ -129,16 +129,16 @@ JSTaggedValue JSStableArray::Splice(JSHandle receiver, EcmaRuntimeCallI srcElementsHandle->Set(thread, idx + insertCount, element); } - if (TaggedArray::ShouldTrim(thread, oldCapacity, newCapacity)) { - srcElementsHandle->Trim(thread, newCapacity); + if (TaggedArray::ShouldTrim(thread, oldCapacity, new_capacity)) { + srcElementsHandle->Trim(thread, new_capacity); } else { - for (uint32_t idx = newCapacity; idx < len; idx++) { + for (uint32_t idx = new_capacity; idx < len; idx++) { srcElementsHandle->Set(thread, idx, JSTaggedValue::Hole()); } } } else { - if (newCapacity > oldCapacity) { - srcElementsHandle = JSObject::GrowElementsCapacity(thread, thisObjHandle, newCapacity); + if (new_capacity > oldCapacity) { + srcElementsHandle = JSObject::GrowElementsCapacity(thread, thisObjHandle, new_capacity); } for (uint32_t idx = len - actualDeleteCount; idx > start; idx--) { auto element = srcElementsHandle->Get(idx + actualDeleteCount - 1); @@ -151,7 +151,7 @@ JSTaggedValue JSStableArray::Splice(JSHandle receiver, EcmaRuntimeCallI srcElementsHandle->Set(thread, idx, argv->GetCallArg(i)); } - JSHandle newLenHandle(thread, JSTaggedValue(newCapacity)); + JSHandle newLenHandle(thread, JSTaggedValue(new_capacity)); JSTaggedValue::SetProperty(thread, thisObjVal, lengthKey, newLenHandle, true); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); return newArrayHandle.GetTaggedValue(); diff --git a/runtime/js_tagged_value.cpp b/runtime/js_tagged_value.cpp index baf9b3931..71c011cd4 100644 --- a/runtime/js_tagged_value.cpp +++ b/runtime/js_tagged_value.cpp @@ -342,14 +342,14 @@ JSHandle JSTaggedValue::ToString(JSThread *thread, const JSHandleGetHandledEmptyString(); + auto empty_str = globalConst->GetHandledEmptyString(); if (tagged->IsECMAObject()) { JSHandle primValue(thread, ToPrimitive(thread, tagged, PREFER_STRING)); - RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, JSHandle(emptyStr)); + RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, JSHandle(empty_str)); return ToString(thread, primValue); } // Already Include Symbol - THROW_TYPE_ERROR_AND_RETURN(thread, "Cannot convert a illegal value to a String", JSHandle(emptyStr)); + THROW_TYPE_ERROR_AND_RETURN(thread, "Cannot convert a illegal value to a String", JSHandle(empty_str)); } JSTaggedValue JSTaggedValue::CanonicalNumericIndexString(JSThread *thread, const JSHandle &tagged) diff --git a/runtime/linked_hash_table-inl.h b/runtime/linked_hash_table-inl.h index c432682ff..1eea90039 100644 --- a/runtime/linked_hash_table-inl.h +++ b/runtime/linked_hash_table-inl.h @@ -251,13 +251,13 @@ int LinkedHashTable::ComputeCapacityWithShrink(int currentC return currentCapacity; } // Recalculate the smaller capacity actually needed. - int newCapacity = ComputeCapacity(atLeastSpaceFor); - ASSERT_PRINT(newCapacity > atLeastSpaceFor, "new capacity must greater than atLeastSpaceFor"); + int new_capacity = ComputeCapacity(atLeastSpaceFor); + ASSERT_PRINT(new_capacity > atLeastSpaceFor, "new capacity must greater than atLeastSpaceFor"); // Don't go lower than room for MIN_SHRINK_CAPACITY elements. - if (newCapacity < Derived::MIN_SHRINK_CAPACITY) { + if (new_capacity < Derived::MIN_SHRINK_CAPACITY) { return currentCapacity; } - return newCapacity; + return new_capacity; } bool LinkedHashMapObject::IsMatch(JSTaggedValue key, JSTaggedValue other) diff --git a/runtime/linked_hash_table.cpp b/runtime/linked_hash_table.cpp index 36237a103..66f8dd20f 100644 --- a/runtime/linked_hash_table.cpp +++ b/runtime/linked_hash_table.cpp @@ -21,7 +21,7 @@ namespace panda::ecmascript { template -JSHandle LinkedHashTable::Create(const JSThread *thread, JSType tableType, bool isWeak, +JSHandle LinkedHashTable::Create(const JSThread *thread, JSType table_type, bool is_weak, int numberOfElements) { ASSERT_PRINT(numberOfElements > 0, "size must be a non-negative integer"); @@ -30,7 +30,7 @@ JSHandle LinkedHashTable::Create(const JSThread *t ASSERT_PRINT(helpers::math::IsPowerOfTwo(capacity), "capacity must be pow of '2'"); int length = ELEMENTS_START_INDEX + numberOfElements + numberOfElements * (HashObject::ENTRY_SIZE + 1); - auto table = JSHandle(factory->NewLinkedHashTable(length, tableType, isWeak)); + auto table = JSHandle(factory->NewLinkedHashTable(length, table_type, is_weak)); table->SetNumberOfElements(thread, 0); table->SetNumberOfDeletedElements(thread, 0); table->SetCapacity(thread, capacity); @@ -109,10 +109,10 @@ JSHandle LinkedHashTable::GrowCapacity(const JSThr if (table->HasSufficientCapacity(numberOfAddedElements)) { return table; } - int newCapacity = ComputeCapacity(table->NumberOfElements() + numberOfAddedElements); + int new_capacity = ComputeCapacity(table->NumberOfElements() + numberOfAddedElements); auto tableClass = table->GetClass(); JSHandle newTable = - Create(thread, tableClass->GetObjectType(), tableClass->IsWeakContainer(), newCapacity); + Create(thread, tableClass->GetObjectType(), tableClass->IsWeakContainer(), new_capacity); table->Rehash(thread, newTable); return newTable; } @@ -136,14 +136,14 @@ template JSHandle LinkedHashTable::Shrink(const JSThread *thread, const JSHandle &table, int additionalCapacity) { - int newCapacity = ComputeCapacityWithShrink(table->Capacity(), table->NumberOfElements() + additionalCapacity); - if (newCapacity == table->Capacity()) { + int new_capacity = ComputeCapacityWithShrink(table->Capacity(), table->NumberOfElements() + additionalCapacity); + if (new_capacity == table->Capacity()) { return table; } auto tableClass = table->GetClass(); JSHandle newTable = - Create(thread, tableClass->GetObjectType(), tableClass->IsWeakContainer(), newCapacity); + Create(thread, tableClass->GetObjectType(), tableClass->IsWeakContainer(), new_capacity); if (newTable.IsEmpty()) { // No enough memory. Use the origin table. return table; @@ -154,9 +154,9 @@ JSHandle LinkedHashTable::Shrink(const JSThread *t } // LinkedHashMap -JSHandle LinkedHashMap::Create(const JSThread *thread, bool isWeak, int numberOfElements) +JSHandle LinkedHashMap::Create(const JSThread *thread, bool is_weak, int numberOfElements) { - return LinkedHashTable::Create(thread, JSType::LINKED_HASH_MAP, isWeak, + return LinkedHashTable::Create(thread, JSType::LINKED_HASH_MAP, is_weak, numberOfElements); } @@ -207,9 +207,9 @@ JSHandle LinkedHashMap::Shrink(const JSThread *thread, const JSHa } // LinkedHashSet -JSHandle LinkedHashSet::Create(const JSThread *thread, bool isWeak, int numberOfElements) +JSHandle LinkedHashSet::Create(const JSThread *thread, bool is_weak, int numberOfElements) { - return LinkedHashTable::Create(thread, JSType::LINKED_HASH_SET, isWeak, + return LinkedHashTable::Create(thread, JSType::LINKED_HASH_SET, is_weak, numberOfElements); } diff --git a/runtime/linked_hash_table.h b/runtime/linked_hash_table.h index 96b3480bd..b940b2720 100644 --- a/runtime/linked_hash_table.h +++ b/runtime/linked_hash_table.h @@ -42,7 +42,7 @@ public: // Don't shrink a HashTable below this capacity. static const int MIN_SHRINK_CAPACITY = 16; - static JSHandle Create(const JSThread *thread, JSType tableType, bool isWeak, int numberOfElements); + static JSHandle Create(const JSThread *thread, JSType table_type, bool is_weak, int numberOfElements); static JSHandle Insert(const JSThread *thread, const JSHandle &table, const JSHandle &key, const JSHandle &value); @@ -146,7 +146,7 @@ public: { return static_cast(obj); } - static JSHandle Create(const JSThread *thread, bool isWeak = false, + static JSHandle Create(const JSThread *thread, bool is_weak = false, int numberOfElements = MIN_CAPACITY); static JSHandle Delete(const JSThread *thread, const JSHandle &obj, @@ -189,7 +189,7 @@ public: { return static_cast(obj); } - static JSHandle Create(const JSThread *thread, bool isWeak = false, + static JSHandle Create(const JSThread *thread, bool is_weak = false, int numberOfElements = MIN_CAPACITY); static JSHandle Delete(const JSThread *thread, const JSHandle &obj, diff --git a/runtime/napi/include/jsnapi.h b/runtime/napi/include/jsnapi.h index 165025eee..9bd4dbd63 100644 --- a/runtime/napi/include/jsnapi.h +++ b/runtime/napi/include/jsnapi.h @@ -552,10 +552,10 @@ using FunctionCallbackWithNewTarget = int32_t, void *); class PUBLIC_API FunctionRef : public ObjectRef { public: - static Local New(EcmaVM *vm, FunctionCallback nativeFunc, void *data); - static Local New(EcmaVM *vm, FunctionCallback nativeFunc, Deleter deleter, void *data); - static Local NewWithProperty(EcmaVM *vm, FunctionCallback nativeFunc, void *data); - static Local NewClassFunction(EcmaVM *vm, FunctionCallbackWithNewTarget nativeFunc, Deleter deleter, + static Local New(EcmaVM *vm, FunctionCallback native_func, void *data); + static Local New(EcmaVM *vm, FunctionCallback native_func, Deleter deleter, void *data); + static Local NewWithProperty(EcmaVM *vm, FunctionCallback native_func, void *data); + static Local NewClassFunction(EcmaVM *vm, FunctionCallbackWithNewTarget native_func, Deleter deleter, void *data); Local Call(const EcmaVM *vm, Local thisObj, const Local argv[], // NOLINT(modernize-avoid-c-arrays) diff --git a/runtime/napi/jsnapi.cpp b/runtime/napi/jsnapi.cpp index 203a8bf04..eb0d4e9bb 100644 --- a/runtime/napi/jsnapi.cpp +++ b/runtime/napi/jsnapi.cpp @@ -298,8 +298,8 @@ void JSNApi::EnableUserUncaughtErrorHandler(EcmaVM *vm) Local JSNApi::GetGlobalObject(const EcmaVM *vm) { - JSHandle globalEnv = vm->GetGlobalEnv(); - JSHandle global(vm->GetJSThread(), globalEnv->GetGlobalObject()); + JSHandle global_env = vm->GetGlobalEnv(); + JSHandle global(vm->GetJSThread(), global_env->GetGlobalObject()); return JSNApiHelper::ToLocal(global); } @@ -632,8 +632,8 @@ Local ObjectRef::New(const EcmaVM *vm) { ScopedManagedCodeThread s(vm->GetAssociatedThread()); ObjectFactory *factory = vm->GetFactory(); - JSHandle globalEnv = vm->GetGlobalEnv(); - JSHandle constructor = globalEnv->GetObjectFunction(); + JSHandle global_env = vm->GetGlobalEnv(); + JSHandle constructor = global_env->GetObjectFunction(); JSHandle object(factory->NewJSObjectByConstructor(JSHandle(constructor), constructor)); RETURN_VALUE_IF_ABRUPT(vm->GetJSThread(), Local(JSValueRef::Exception(vm))); return JSNApiHelper::ToLocal(object); @@ -836,14 +836,14 @@ void ObjectRef::SetNativePointerField(int32_t index, void *nativePointer, Native } // ----------------------------------- FunctionRef -------------------------------------- -Local FunctionRef::New(EcmaVM *vm, FunctionCallback nativeFunc, void *data) +Local FunctionRef::New(EcmaVM *vm, FunctionCallback native_func, void *data) { JSThread *thread = vm->GetJSThread(); ScopedManagedCodeThread s(thread); ObjectFactory *factory = vm->GetFactory(); JSHandle env = vm->GetGlobalEnv(); JSHandle current(factory->NewJSFunction(env, reinterpret_cast(Callback::RegisterCallback))); - JSHandle funcCallback = factory->NewJSNativePointer(reinterpret_cast(nativeFunc)); + JSHandle funcCallback = factory->NewJSNativePointer(reinterpret_cast(native_func)); JSHandle vmCaddress = factory->NewJSNativePointer(vm); JSHandle dataCaddress = factory->NewJSNativePointer(data); JSHandle extraInfo(factory->NewFunctionExtraInfo(funcCallback, vmCaddress, dataCaddress)); @@ -851,14 +851,14 @@ Local FunctionRef::New(EcmaVM *vm, FunctionCallback nativeFunc, voi return JSNApiHelper::ToLocal(JSHandle(current)); } -Local FunctionRef::New(EcmaVM *vm, FunctionCallback nativeFunc, Deleter deleter, void *data) +Local FunctionRef::New(EcmaVM *vm, FunctionCallback native_func, Deleter deleter, void *data) { JSThread *thread = vm->GetJSThread(); ScopedManagedCodeThread s(thread); ObjectFactory *factory = vm->GetFactory(); JSHandle env = vm->GetGlobalEnv(); JSHandle current(factory->NewJSFunction(env, reinterpret_cast(Callback::RegisterCallback))); - JSHandle funcCallback = factory->NewJSNativePointer(reinterpret_cast(nativeFunc)); + JSHandle funcCallback = factory->NewJSNativePointer(reinterpret_cast(native_func)); JSHandle vmCaddress = factory->NewJSNativePointer(vm); JSHandle dataCaddress = factory->NewJSNativePointer(data, deleter, nullptr); vm->PushToArrayDataList(*dataCaddress); @@ -867,7 +867,7 @@ Local FunctionRef::New(EcmaVM *vm, FunctionCallback nativeFunc, Del return JSNApiHelper::ToLocal(JSHandle(current)); } -Local FunctionRef::NewWithProperty(EcmaVM *vm, FunctionCallback nativeFunc, void *data) +Local FunctionRef::NewWithProperty(EcmaVM *vm, FunctionCallback native_func, void *data) { JSThread *thread = vm->GetJSThread(); ScopedManagedCodeThread s(thread); @@ -875,7 +875,7 @@ Local FunctionRef::NewWithProperty(EcmaVM *vm, FunctionCallback nat JSHandle env = vm->GetGlobalEnv(); JSHandle current = factory->NewJSFunction(env, reinterpret_cast(Callback::RegisterCallbackWithProperty)); - JSHandle funcCallback = factory->NewJSNativePointer(reinterpret_cast(nativeFunc)); + JSHandle funcCallback = factory->NewJSNativePointer(reinterpret_cast(native_func)); JSHandle vmCaddress = factory->NewJSNativePointer(vm); JSHandle dataCaddress = factory->NewJSNativePointer(data); JSHandle extraInfo(factory->NewFunctionExtraInfo(funcCallback, vmCaddress, dataCaddress)); @@ -883,7 +883,7 @@ Local FunctionRef::NewWithProperty(EcmaVM *vm, FunctionCallback nat return JSNApiHelper::ToLocal(JSHandle(current)); } -Local FunctionRef::NewClassFunction(EcmaVM *vm, FunctionCallbackWithNewTarget nativeFunc, Deleter deleter, +Local FunctionRef::NewClassFunction(EcmaVM *vm, FunctionCallbackWithNewTarget native_func, Deleter deleter, void *data) { JSThread *thread = vm->GetJSThread(); @@ -901,7 +901,7 @@ Local FunctionRef::NewClassFunction(EcmaVM *vm, FunctionCallbackWit current->SetPropertyInlinedProps(thread, JSFunction::CLASS_PROTOTYPE_INLINE_PROPERTY_INDEX, accessor.GetTaggedValue()); - JSHandle funcCallback = factory->NewJSNativePointer(reinterpret_cast(nativeFunc)); + JSHandle funcCallback = factory->NewJSNativePointer(reinterpret_cast(native_func)); JSHandle vmCaddress = factory->NewJSNativePointer(vm); JSHandle dataCaddress(thread, JSTaggedValue::Undefined()); if (deleter == nullptr) { @@ -967,7 +967,7 @@ Local FunctionRef::Constructor(const EcmaVM *vm, } ScopedManagedCodeThread s(thread); JSHandle func = JSNApiHelper::ToJSHandle(this); - JSHandle newTarget = func; + JSHandle new_target = func; ObjectFactory *factory = vm->GetFactory(); JSHandle arguments = factory->NewTaggedArray(length); Span> sp(argv, length); @@ -976,7 +976,7 @@ Local FunctionRef::Constructor(const EcmaVM *vm, } ecmascript::InternalCallParams *params = thread->GetInternalCallParams(); params->MakeArgList(*arguments); - JSTaggedValue result = JSFunction::Construct(thread, func, length, params->GetArgv(), newTarget); + JSTaggedValue result = JSFunction::Construct(thread, func, length, params->GetArgv(), new_target); RETURN_VALUE_IF_ABRUPT(thread, JSValueRef::Exception(vm)); JSHandle resultValue(vm->GetJSThread(), result); return JSNApiHelper::ToLocal(resultValue); @@ -1071,8 +1071,8 @@ Local PromiseCapabilityRef::New(const EcmaVM *vm) { JSThread *thread = vm->GetJSThread(); ScopedManagedCodeThread s(thread); - JSHandle globalEnv = vm->GetGlobalEnv(); - JSHandle constructor(globalEnv->GetPromiseFunction()); + JSHandle global_env = vm->GetGlobalEnv(); + JSHandle constructor(global_env->GetPromiseFunction()); JSHandle capability(JSPromise::NewPromiseCapability(thread, constructor)); return JSNApiHelper::ToLocal(capability); } @@ -1399,8 +1399,8 @@ Local DateRef::New(const EcmaVM *vm, double time) { JSThread *thread = vm->GetJSThread(); ObjectFactory *factory = vm->GetFactory(); - JSHandle globalEnv = vm->GetGlobalEnv(); - JSHandle dateFunction = globalEnv->GetDateFunction(); + JSHandle global_env = vm->GetGlobalEnv(); + JSHandle dateFunction = global_env->GetDateFunction(); JSHandle dateObject = JSHandle::Cast(factory->NewJSObjectByConstructor(JSHandle(dateFunction), dateFunction)); dateObject->SetTimeValue(thread, JSTaggedValue(time)); @@ -1477,7 +1477,7 @@ JSTaggedValue Callback::RegisterCallback(ecmascript::EcmaRuntimeCallInfo *info) return JSTaggedValue::False(); } JSHandle callBackObj(callBack); - FunctionCallback nativeFunc = (reinterpret_cast(callBackObj->GetExternalPointer())); + FunctionCallback native_func = (reinterpret_cast(callBackObj->GetExternalPointer())); // this JSHandle thisValue(BuiltinsBase::GetThis(info)); @@ -1490,8 +1490,8 @@ JSTaggedValue Callback::RegisterCallback(ecmascript::EcmaRuntimeCallInfo *info) } ScopedNativeCodeThread s(thread); - Local result = nativeFunc(vm, JSNApiHelper::ToLocal(thisValue), arguments.data(), - arguments.size(), dataObj->GetExternalPointer()); + Local result = native_func(vm, JSNApiHelper::ToLocal(thisValue), arguments.data(), + arguments.size(), dataObj->GetExternalPointer()); return JSNApiHelper::ToJSHandle(result).GetTaggedValue(); } @@ -1522,7 +1522,7 @@ JSTaggedValue Callback::RegisterCallbackWithProperty(ecmascript::EcmaRuntimeCall return JSTaggedValue::False(); } JSHandle callBackObj(callBack); - FunctionCallback nativeFunc = (reinterpret_cast(callBackObj->GetExternalPointer())); + FunctionCallback native_func = (reinterpret_cast(callBackObj->GetExternalPointer())); // constructor JSHandle thisValue(BuiltinsBase::GetConstructor(info)); @@ -1535,8 +1535,8 @@ JSTaggedValue Callback::RegisterCallbackWithProperty(ecmascript::EcmaRuntimeCall } ScopedNativeCodeThread s(thread); - Local result = nativeFunc(vm, JSNApiHelper::ToLocal(thisValue), arguments.data(), - arguments.size(), dataObj->GetExternalPointer()); + Local result = native_func(vm, JSNApiHelper::ToLocal(thisValue), arguments.data(), + arguments.size(), dataObj->GetExternalPointer()); return JSNApiHelper::ToJSHandle(result).GetTaggedValue(); } @@ -1567,11 +1567,11 @@ JSTaggedValue Callback::RegisterCallbackWithNewTarget(ecmascript::EcmaRuntimeCal return JSTaggedValue::False(); } JSHandle callBackObj(callBack); - FunctionCallbackWithNewTarget nativeFunc = + FunctionCallbackWithNewTarget native_func = (reinterpret_cast(callBackObj->GetExternalPointer())); - // newTarget - JSHandle newTarget(BuiltinsBase::GetNewTarget(info)); + // new_target + JSHandle new_target(BuiltinsBase::GetNewTarget(info)); // this JSHandle thisValue(BuiltinsBase::GetThis(info)); @@ -1585,8 +1585,8 @@ JSTaggedValue Callback::RegisterCallbackWithNewTarget(ecmascript::EcmaRuntimeCal ScopedNativeCodeThread s(thread); Local result = - nativeFunc(vm, JSNApiHelper::ToLocal(thisValue), JSNApiHelper::ToLocal(newTarget), - arguments.data(), arguments.size(), dataObj->GetExternalPointer()); + native_func(vm, JSNApiHelper::ToLocal(thisValue), JSNApiHelper::ToLocal(new_target), + arguments.data(), arguments.size(), dataObj->GetExternalPointer()); return JSNApiHelper::ToJSHandle(result).GetTaggedValue(); } diff --git a/runtime/object_factory.cpp b/runtime/object_factory.cpp index 7ff26e8c5..b11d246df 100644 --- a/runtime/object_factory.cpp +++ b/runtime/object_factory.cpp @@ -110,22 +110,22 @@ JSHandle ObjectFactory::NewEcmaDynClassClass(JSHClass *hclass, uint32_ } JSHandle ObjectFactory::NewEcmaDynClass(JSHClass *hclass, uint32_t size, JSType type, uint32_t flags, - uint32_t inlinedProps) + uint32_t inlined_props) { NewObjectHook(); uint32_t classSize = JSHClass::SIZE; auto *newClass = static_cast(heap_helper_.AllocateNonMovableOrHugeObject(hclass, classSize)); - newClass->Initialize(thread_, size, type, inlinedProps, flags); + newClass->Initialize(thread_, size, type, inlined_props, flags); return JSHandle(thread_, newClass); } -JSHandle ObjectFactory::NewEcmaDynClass(uint32_t size, JSType type, uint32_t inlinedProps) +JSHandle ObjectFactory::NewEcmaDynClass(uint32_t size, JSType type, uint32_t inlined_props) { - return NewEcmaDynClass(hclass_class_, size, type, 0, inlinedProps); + return NewEcmaDynClass(hclass_class_, size, type, 0, inlined_props); } -void ObjectFactory::ObtainRootClass([[maybe_unused]] const JSHandle &globalEnv) +void ObjectFactory::ObtainRootClass([[maybe_unused]] const JSHandle &global_env) { const GlobalEnvConstants *globalConst = thread_->GlobalConstants(); hclass_class_ = JSHClass::Cast(globalConst->GetHClassClass().GetTaggedObject()); @@ -134,9 +134,9 @@ void ObjectFactory::ObtainRootClass([[maybe_unused]] const JSHandle & weak_array_class_ = JSHClass::Cast(globalConst->GetWeakArrayClass().GetTaggedObject()); dictionary_class_ = JSHClass::Cast(globalConst->GetDictionaryClass().GetTaggedObject()); js_native_pointer_class_ = JSHClass::Cast(globalConst->GetJSNativePointerClass().GetTaggedObject()); - free_object_with_one_field_class_ = + free_object_with_none_field_class_ = JSHClass::Cast(globalConst->GetFreeObjectWithNoneFieldClass().GetTaggedObject()); - free_object_with_two_field_class_ = JSHClass::Cast(globalConst->GetFreeObjectWithOneFieldClass().GetTaggedObject()); + free_object_with_one_field_class_ = JSHClass::Cast(globalConst->GetFreeObjectWithOneFieldClass().GetTaggedObject()); free_object_with_two_field_class_ = JSHClass::Cast(globalConst->GetFreeObjectWithTwoFieldClass().GetTaggedObject()); completion_record_class_ = JSHClass::Cast(globalConst->GetCompletionRecordClass().GetTaggedObject()); @@ -222,8 +222,8 @@ JSHandle ObjectFactory::NewJSArrayBuffer(int32_t length) JSHandle env = vm_->GetGlobalEnv(); JSHandle constructor(env->GetArrayBufferFunction()); - JSHandle newTarget(constructor); - JSHandle arrayBuffer(NewJSObjectByConstructor(constructor, newTarget)); + JSHandle new_target(constructor); + JSHandle arrayBuffer(NewJSObjectByConstructor(constructor, new_target)); arrayBuffer->SetArrayBufferByteLength(thread_, JSTaggedValue(length)); if (length > 0) { auto newData = Runtime::GetCurrent()->GetInternalAllocator()->Alloc(length); @@ -245,8 +245,8 @@ JSHandle ObjectFactory::NewJSArrayBuffer(void *buffer, int32_t le JSHandle env = vm_->GetGlobalEnv(); JSHandle constructor(env->GetArrayBufferFunction()); - JSHandle newTarget(constructor); - JSHandle arrayBuffer(NewJSObjectByConstructor(constructor, newTarget)); + JSHandle new_target(constructor); + JSHandle arrayBuffer(NewJSObjectByConstructor(constructor, new_target)); length = buffer == nullptr ? 0 : length; arrayBuffer->SetArrayBufferByteLength(thread_, JSTaggedValue(length)); if (length > 0) { @@ -272,8 +272,8 @@ JSHandle ObjectFactory::NewJSDataView(JSHandle buffer JSHandle env = vm_->GetGlobalEnv(); JSHandle constructor(env->GetDataViewFunction()); - JSHandle newTarget(constructor); - JSHandle arrayBuffer(NewJSObjectByConstructor(constructor, newTarget)); + JSHandle new_target(constructor); + JSHandle arrayBuffer(NewJSObjectByConstructor(constructor, new_target)); arrayBuffer->SetDataView(thread_, JSTaggedValue::True()); arrayBuffer->SetViewedArrayBuffer(thread_, buffer.GetTaggedValue()); arrayBuffer->SetByteLength(thread_, JSTaggedValue(length)); @@ -327,18 +327,18 @@ JSHandle ObjectFactory::NewJSObject(const JSHandle &jshclass JSHandle ObjectFactory::CloneProperties(const JSHandle &old) { - uint32_t newLength = old->GetLength(); - if (newLength == 0) { + uint32_t new_length = old->GetLength(); + if (new_length == 0) { return EmptyArray(); } NewObjectHook(); auto klass = old->GetClass(); - size_t size = TaggedArray::ComputeSize(JSTaggedValue::TaggedTypeSize(), newLength); + size_t size = TaggedArray::ComputeSize(JSTaggedValue::TaggedTypeSize(), new_length); auto header = heap_helper_.AllocateYoungGenerationOrHugeObject(klass, size); JSHandle newArray(thread_, header); - newArray->SetLength(newLength); + newArray->SetLength(new_length); - for (uint32_t i = 0; i < newLength; i++) { + for (uint32_t i = 0; i < new_length; i++) { JSTaggedValue value = old->Get(i); newArray->Set(thread_, i, value); } @@ -392,18 +392,18 @@ JSHandle ObjectFactory::CloneProperties(const JSHandle const JSHandle &env, const JSHandle &obj, const JSHandle &constpool) { - uint32_t newLength = old->GetLength(); - if (newLength == 0) { + uint32_t new_length = old->GetLength(); + if (new_length == 0) { return EmptyArray(); } NewObjectHook(); auto klass = old->GetClass(); - size_t size = TaggedArray::ComputeSize(JSTaggedValue::TaggedTypeSize(), newLength); + size_t size = TaggedArray::ComputeSize(JSTaggedValue::TaggedTypeSize(), new_length); auto header = heap_helper_.AllocateYoungGenerationOrHugeObject(klass, size); JSHandle newArray(thread_, header); - newArray->SetLength(newLength); + newArray->SetLength(new_length); - for (uint32_t i = 0; i < newLength; i++) { + for (uint32_t i = 0; i < new_length; i++) { JSTaggedValue value = old->Get(i); if (!value.IsJSFunction()) { newArray->Set(thread_, i, value); @@ -420,12 +420,12 @@ JSHandle ObjectFactory::CloneProperties(const JSHandle } JSHandle ObjectFactory::CloneObjectLiteral(JSHandle object, const JSHandle &env, - const JSHandle &constpool, bool canShareHClass) + const JSHandle &constpool, bool can_share_hclass) { NewObjectHook(); auto klass = JSHandle(thread_, object->GetClass()); - if (!canShareHClass) { + if (!can_share_hclass) { klass = JSHClass::Clone(thread_, klass); } @@ -480,13 +480,13 @@ JSHandle ObjectFactory::CloneJSFuction(JSHandle obj, Fun } JSHandle ObjectFactory::CloneClassCtor(JSHandle ctor, const JSHandle &lexenv, - bool canShareHClass) + bool can_share_hclass) { NewObjectHook(); JSHandle constpool(thread_, ctor->GetConstantPool()); JSHandle hclass(thread_, ctor->GetClass()); - if (!canShareHClass) { + if (!can_share_hclass) { hclass = JSHClass::Clone(thread_, hclass); } @@ -530,10 +530,10 @@ JSHandle ObjectFactory::NewNonMovableJSObject(const JSHandle return obj; } -JSHandle ObjectFactory::NewJSPrimitiveRef(const JSHandle &dynKlass, +JSHandle ObjectFactory::NewJSPrimitiveRef(const JSHandle &dyn_klass, const JSHandle &object) { - JSHandle obj = JSHandle::Cast(NewJSObject(dynKlass)); + JSHandle obj = JSHandle::Cast(NewJSObject(dyn_klass)); obj->SetValue(thread_, object); return obj; } @@ -665,27 +665,27 @@ JSHandle ObjectFactory::NewJSArguments() return obj; } -JSHandle ObjectFactory::GetJSError(const ErrorType &errorType, const char *data) +JSHandle ObjectFactory::GetJSError(const ErrorType &error_type, const char *data) { - ASSERT_PRINT(errorType == ErrorType::ERROR || errorType == ErrorType::EVAL_ERROR || - errorType == ErrorType::RANGE_ERROR || errorType == ErrorType::REFERENCE_ERROR || - errorType == ErrorType::SYNTAX_ERROR || errorType == ErrorType::TYPE_ERROR || - errorType == ErrorType::URI_ERROR, + ASSERT_PRINT(error_type == ErrorType::ERROR || error_type == ErrorType::EVAL_ERROR || + error_type == ErrorType::RANGE_ERROR || error_type == ErrorType::REFERENCE_ERROR || + error_type == ErrorType::SYNTAX_ERROR || error_type == ErrorType::TYPE_ERROR || + error_type == ErrorType::URI_ERROR, "The error type is not in the valid range."); if (data != nullptr) { JSHandle handleMsg = NewFromString(data); - return NewJSError(errorType, handleMsg); + return NewJSError(error_type, handleMsg); } JSHandle emptyString(thread_->GlobalConstants()->GetHandledEmptyString()); - return NewJSError(errorType, emptyString); + return NewJSError(error_type, emptyString); } -JSHandle ObjectFactory::NewJSError(const ErrorType &errorType, const JSHandle &message) +JSHandle ObjectFactory::NewJSError(const ErrorType &error_type, const JSHandle &message) { JSHandle env = vm_->GetGlobalEnv(); const GlobalEnvConstants *globalConst = thread_->GlobalConstants(); JSHandle nativeConstructor; - switch (errorType) { + switch (error_type) { case ErrorType::RANGE_ERROR: nativeConstructor = env->GetRangeErrorFunction(); break; @@ -708,8 +708,8 @@ JSHandle ObjectFactory::NewJSError(const ErrorType &errorType, const J nativeConstructor = env->GetErrorFunction(); break; } - JSHandle nativeFunc = JSHandle::Cast(nativeConstructor); - JSHandle nativePrototype(thread_, nativeFunc->GetFunctionPrototype()); + JSHandle native_func = JSHandle::Cast(nativeConstructor); + JSHandle nativePrototype(thread_, native_func->GetFunctionPrototype()); JSHandle ctorKey = globalConst->GetHandledConstructorString(); InternalCallParams *arguments = thread_->GetInternalCallParams(); @@ -720,15 +720,15 @@ JSHandle ObjectFactory::NewJSError(const ErrorType &errorType, const J } JSHandle ObjectFactory::NewJSObjectByConstructor(const JSHandle &constructor, - const JSHandle &newTarget) + const JSHandle &new_target) { JSHandle jshclass; if (!constructor->HasFunctionPrototype() || (constructor->GetProtoOrDynClass().IsHeapObject() && constructor->GetFunctionPrototype().IsECMAObject())) { - jshclass = JSFunction::GetInstanceJSHClass(thread_, constructor, newTarget); + jshclass = JSFunction::GetInstanceJSHClass(thread_, constructor, new_target); } else { JSHandle env = vm_->GetGlobalEnv(); - jshclass = JSFunction::GetInstanceJSHClass(thread_, JSHandle(env->GetObjectFunction()), newTarget); + jshclass = JSFunction::GetInstanceJSHClass(thread_, JSHandle(env->GetObjectFunction()), new_target); } // Check this exception elsewhere RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSObject, thread_); @@ -860,12 +860,12 @@ JSHandle ObjectFactory::NewJSObjectByConstructor(const JSHandle= FreeObject::SIZE_OFFSET && size < FreeObject::SIZE) { object = reinterpret_cast(address); - object->SetClassWithoutBarrier(free_object_with_two_field_class_); + object->SetClassWithoutBarrier(free_object_with_one_field_class_); object->SetNext(nullptr); } else if (size >= FreeObject::SIZE) { object = reinterpret_cast(address); @@ -874,7 +874,7 @@ FreeObject *ObjectFactory::FillFreeObject(uintptr_t address, size_t size, [[mayb object->SetNext(nullptr); } else if (size == FreeObject::NEXT_OFFSET) { object = reinterpret_cast(address); - object->SetClassWithoutBarrier(free_object_with_one_field_class_); + object->SetClassWithoutBarrier(free_object_with_none_field_class_); } else { LOG_ECMA(DEBUG) << "Fill free object size is smaller"; } @@ -886,32 +886,33 @@ TaggedObject *ObjectFactory::NewDynObject(const JSHandle &dynclass) { NewObjectHook(); TaggedObject *header = heap_helper_.AllocateYoungGenerationOrHugeObject(*dynclass); - uint32_t inobjPropCount = dynclass->GetInlinedProperties(); - if (inobjPropCount > 0) { - InitializeExtraProperties(dynclass, header, inobjPropCount); + uint32_t inobj_prop_count = dynclass->GetInlinedProperties(); + if (inobj_prop_count > 0) { + InitializeExtraProperties(dynclass, header, inobj_prop_count); } return header; } -TaggedObject *ObjectFactory::NewNonMovableDynObject(const JSHandle &dynclass, int inobjPropCount) +TaggedObject *ObjectFactory::NewNonMovableDynObject(const JSHandle &dynclass, int inobj_prop_count) { NewObjectHook(); TaggedObject *header = heap_helper_.AllocateNonMovableOrHugeObject(*dynclass); - if (inobjPropCount > 0) { - InitializeExtraProperties(dynclass, header, inobjPropCount); + if (inobj_prop_count > 0) { + InitializeExtraProperties(dynclass, header, inobj_prop_count); } return header; } -void ObjectFactory::InitializeExtraProperties(const JSHandle &dynclass, TaggedObject *obj, int inobjPropCount) +void ObjectFactory::InitializeExtraProperties(const JSHandle &dynclass, TaggedObject *obj, + int inobj_prop_count) { - ASSERT(inobjPropCount * JSTaggedValue::TaggedTypeSize() < dynclass->GetObjectSize()); + ASSERT(inobj_prop_count * JSTaggedValue::TaggedTypeSize() < dynclass->GetObjectSize()); auto offset = dynclass->GetObjectSize(); - JSTaggedType initVal = JSTaggedValue::Undefined().GetRawData(); - for (int i = 0; i < inobjPropCount; ++i) { + JSTaggedType init_val = JSTaggedValue::Undefined().GetRawData(); + for (int i = 0; i < inobj_prop_count; ++i) { offset -= JSTaggedValue::TaggedTypeSize(); // Without barrier because 'object' is a just allocated object and it doesn't contain references. - ObjectAccessor::SetDynValueWithoutBarrier(obj, offset, initVal); + ObjectAccessor::SetDynValueWithoutBarrier(obj, offset, init_val); } } @@ -924,10 +925,10 @@ JSHandle ObjectFactory::OrdinaryNewJSObjectCreate(const JSHandle ObjectFactory::NewJSFunction(const JSHandle &env, const void *nativeFunc, +JSHandle ObjectFactory::NewJSFunction(const JSHandle &env, const void *native_func, FunctionKind kind) { - JSMethod *target = vm_->GetMethodForNativeFunction(nativeFunc); + JSMethod *target = vm_->GetMethodForNativeFunction(native_func); return NewJSFunction(env, target, kind); } @@ -1020,23 +1021,23 @@ JSHandle ObjectFactory::NewJSFunctionByDynClass(JSMethod *method, co return function; } -JSHandle ObjectFactory::NewJSNativeErrorFunction(const JSHandle &env, const void *nativeFunc) +JSHandle ObjectFactory::NewJSNativeErrorFunction(const JSHandle &env, const void *native_func) { - JSMethod *target = vm_->GetMethodForNativeFunction(nativeFunc); + JSMethod *target = vm_->GetMethodForNativeFunction(native_func); JSHandle dynclass = JSHandle::Cast(env->GetNativeErrorFunctionClass()); return NewJSFunctionByDynClass(target, dynclass, FunctionKind::BUILTIN_CONSTRUCTOR); } JSHandle ObjectFactory::NewSpecificTypedArrayFunction(const JSHandle &env, - const void *nativeFunc) + const void *native_func) { - JSMethod *target = vm_->GetMethodForNativeFunction(nativeFunc); + JSMethod *target = vm_->GetMethodForNativeFunction(native_func); JSHandle dynclass = JSHandle::Cast(env->GetSpecificTypedArrayFunctionClass()); return NewJSFunctionByDynClass(target, dynclass, FunctionKind::BUILTIN_CONSTRUCTOR); } JSHandle ObjectFactory::NewJSBoundFunction(const JSHandle &target, - const JSHandle &boundThis, + const JSHandle &bound_this, const JSHandle &args) { JSHandle env = vm_->GetGlobalEnv(); @@ -1046,7 +1047,7 @@ JSHandle ObjectFactory::NewJSBoundFunction(const JSHandle bundleFunction = JSHandle::Cast(NewJSObject(dynclass)); bundleFunction->SetBoundTarget(thread_, target); - bundleFunction->SetBoundThis(thread_, boundThis); + bundleFunction->SetBoundThis(thread_, bound_this); bundleFunction->SetBoundArguments(thread_, args); dynclass->GetHClass()->MarkFieldAsNative(JSFunctionBase::METHOD_OFFSET); if (target.GetTaggedValue().IsConstructor()) { @@ -1058,17 +1059,17 @@ JSHandle ObjectFactory::NewJSBoundFunction(const JSHandle ObjectFactory::NewJSIntlBoundFunction(const void *nativeFunc, int functionLength) +JSHandle ObjectFactory::NewJSIntlBoundFunction(const void *native_func, int function_length) { JSHandle env = vm_->GetGlobalEnv(); JSHandle dynclass = JSHandle::Cast(env->GetJSIntlBoundFunctionClass()); JSHandle intlBoundFunc = JSHandle::Cast(NewJSObject(dynclass)); - JSMethod *method = vm_->GetMethodForNativeFunction(nativeFunc); + JSMethod *method = vm_->GetMethodForNativeFunction(native_func); intlBoundFunc->SetCallTarget(thread_, method); JSHandle function = JSHandle::Cast(intlBoundFunc); JSFunction::InitializeJSFunction(thread_, function, FunctionKind::NORMAL_FUNCTION); - JSFunction::SetFunctionLength(thread_, function, JSTaggedValue(functionLength)); + JSFunction::SetFunctionLength(thread_, function, JSTaggedValue(function_length)); const GlobalEnvConstants *globalConst = thread_->GlobalConstants(); JSHandle emptyString = globalConst->GetHandledEmptyString(); JSHandle nameKey = globalConst->GetHandledNameString(); @@ -1078,7 +1079,7 @@ JSHandle ObjectFactory::NewJSIntlBoundFunction(const void * } JSHandle ObjectFactory::NewJSProxyRevocFunction(const JSHandle &proxy, - const void *nativeFunc) + const void *native_func) { JSHandle env = vm_->GetGlobalEnv(); const GlobalEnvConstants *globalConst = thread_->GlobalConstants(); @@ -1087,7 +1088,7 @@ JSHandle ObjectFactory::NewJSProxyRevocFunction(const JSHa JSHandle revocFunction = JSHandle::Cast(NewJSObject(dynclass)); revocFunction->SetRevocableProxy(thread_, proxy); - JSMethod *target = vm_->GetMethodForNativeFunction(nativeFunc); + JSMethod *target = vm_->GetMethodForNativeFunction(native_func); revocFunction->SetCallTarget(thread_, target); JSHandle function = JSHandle::Cast(revocFunction); JSFunction::InitializeJSFunction(thread_, function, FunctionKind::NORMAL_FUNCTION); @@ -1099,7 +1100,7 @@ JSHandle ObjectFactory::NewJSProxyRevocFunction(const JSHa return revocFunction; } -JSHandle ObjectFactory::NewJSAsyncAwaitStatusFunction(const void *nativeFunc) +JSHandle ObjectFactory::NewJSAsyncAwaitStatusFunction(const void *native_func) { JSHandle env = vm_->GetGlobalEnv(); JSHandle dynclass = JSHandle::Cast(env->GetAsyncAwaitStatusFunctionClass()); @@ -1108,13 +1109,13 @@ JSHandle ObjectFactory::NewJSAsyncAwaitStatusFunctio JSHandle::Cast(NewJSObject(dynclass)); JSFunction::InitializeJSFunction(thread_, JSHandle::Cast(awaitFunction)); - JSMethod *target = vm_->GetMethodForNativeFunction(nativeFunc); + JSMethod *target = vm_->GetMethodForNativeFunction(native_func); awaitFunction->SetCallTarget(thread_, target); return awaitFunction; } JSHandle ObjectFactory::NewJSAsyncGeneratorResolveNextFunction( - const void *nativeFunc) + const void *native_func) { NewObjectHook(); JSHandle env = vm_->GetGlobalEnv(); @@ -1124,13 +1125,13 @@ JSHandle ObjectFactory::NewJSAsyncGenerator JSHandle::Cast(NewJSObject(dynclass)); JSFunction::InitializeJSFunction(thread_, env, JSHandle::Cast(resolveNextFunction)); - JSMethod *target = vm_->GetMethodForNativeFunction(nativeFunc); + JSMethod *target = vm_->GetMethodForNativeFunction(native_func); resolveNextFunction->SetCallTarget(thread_, target); return resolveNextFunction; } JSHandle ObjectFactory::NewJSAsyncFromSyncIteratorValueUnwrapFunction( - const void *nativeFunc) + const void *native_func) { NewObjectHook(); JSHandle env = vm_->GetGlobalEnv(); @@ -1140,7 +1141,7 @@ JSHandle ObjectFactory::NewJSAsyncFr JSHandle::Cast(NewJSObject(dynclass)); JSFunction::InitializeJSFunction(thread_, env, JSHandle::Cast(asyncFromSyncIteratorUnwrapFunction)); - JSMethod *target = vm_->GetMethodForNativeFunction(nativeFunc); + JSMethod *target = vm_->GetMethodForNativeFunction(native_func); asyncFromSyncIteratorUnwrapFunction->SetCallTarget(thread_, target); return asyncFromSyncIteratorUnwrapFunction; } @@ -1157,11 +1158,11 @@ JSHandle ObjectFactory::NewJSGeneratorFunction(JSMethod *method) return generatorFunc; } -JSHandle ObjectFactory::NewJSGeneratorObject(JSHandle generatorFunction) +JSHandle ObjectFactory::NewJSGeneratorObject(JSHandle generator_function) { - JSHandle proto(thread_, JSHandle::Cast(generatorFunction)->GetProtoOrDynClass()); + JSHandle proto(thread_, JSHandle::Cast(generator_function)->GetProtoOrDynClass()); if (!proto->IsECMAObject()) { - JSHandle realmHandle = JSObject::GetFunctionRealm(thread_, generatorFunction); + JSHandle realmHandle = JSObject::GetFunctionRealm(thread_, generator_function); proto = realmHandle->GetGeneratorPrototype(); } JSHandle dynclass = NewEcmaDynClass(JSGeneratorObject::SIZE, JSType::JS_GENERATOR_OBJECT, proto); @@ -1182,12 +1183,12 @@ JSHandle ObjectFactory::NewJSAsyncGeneratorFunction(JSMethod *method } JSHandle ObjectFactory::NewJSAsyncGeneratorObject( - JSHandle asyncGeneratorFunction) + JSHandle async_generator_function) { NewObjectHook(); - JSHandle proto(thread_, JSHandle::Cast(asyncGeneratorFunction)->GetProtoOrDynClass()); + JSHandle proto(thread_, JSHandle::Cast(async_generator_function)->GetProtoOrDynClass()); if (!proto->IsECMAObject()) { - JSHandle realmHandle = JSObject::GetFunctionRealm(thread_, asyncGeneratorFunction); + JSHandle realmHandle = JSObject::GetFunctionRealm(thread_, async_generator_function); proto = realmHandle->GetAsyncGeneratorPrototype(); } JSHandle dynclass = @@ -1311,23 +1312,23 @@ JSHandle ObjectFactory::NewJSString(const JSHandle ObjectFactory::NewGlobalEnv(JSHClass *globalEnvClass) +JSHandle ObjectFactory::NewGlobalEnv(JSHClass *global_env_class) { NewObjectHook(); // Note: Global env must be allocated in non-movable heap, since its getters will directly return // the offsets of the properties as the address of Handles. - TaggedObject *header = heap_helper_.AllocateNonMovableOrHugeObject(globalEnvClass); + TaggedObject *header = heap_helper_.AllocateNonMovableOrHugeObject(global_env_class); InitObjectFields(header); return JSHandle(thread_, GlobalEnv::Cast(header)); } -JSHandle ObjectFactory::NewLexicalEnv(int numSlots) +JSHandle ObjectFactory::NewLexicalEnv(int num_slots) { NewObjectHook(); - size_t size = LexicalEnv::ComputeSize(numSlots); + size_t size = LexicalEnv::ComputeSize(num_slots); auto header = heap_helper_.AllocateYoungGenerationOrHugeObject(env_class_, size); JSHandle array(thread_, header); - array->InitializeWithSpecialValue(JSTaggedValue::Undefined(), numSlots + LexicalEnv::RESERVED_ENV_LENGTH); + array->InitializeWithSpecialValue(JSTaggedValue::Undefined(), num_slots + LexicalEnv::RESERVED_ENV_LENGTH); return array; } @@ -1511,14 +1512,14 @@ JSHandle ObjectFactory::NewPendingJob(const JSHandle ObjectFactory::NewFunctionExtraInfo(const JSHandle &callBack, +JSHandle ObjectFactory::NewFunctionExtraInfo(const JSHandle &call_back, const JSHandle &vm, const JSHandle &data) { NewObjectHook(); TaggedObject *header = heap_helper_.AllocateYoungGenerationOrHugeObject(function_extra_info_); JSHandle obj(thread_, header); - obj->SetCallback(thread_, callBack.GetTaggedValue()); + obj->SetCallback(thread_, call_back.GetTaggedValue()); obj->SetVm(thread_, vm.GetTaggedValue()); obj->SetData(thread_, data.GetTaggedValue()); return obj; @@ -1588,7 +1589,7 @@ JSHandle ObjectFactory::NewEmptyArray(bool weak) return array; } -JSHandle ObjectFactory::NewTaggedArray(uint32_t length, JSTaggedValue initVal, bool nonMovable) +JSHandle ObjectFactory::NewTaggedArray(uint32_t length, JSTaggedValue init_val, bool non_movable) { NewObjectHook(); if (length == 0) { @@ -1597,7 +1598,7 @@ JSHandle ObjectFactory::NewTaggedArray(uint32_t length, JSTaggedVal size_t size = TaggedArray::ComputeSize(JSTaggedValue::TaggedTypeSize(), length); TaggedObject *header = nullptr; - if (nonMovable) { + if (non_movable) { header = heap_helper_.AllocateNonMovableOrHugeObject(array_class_, size); } else { header = heap_helper_.AllocateYoungGenerationOrHugeObject(array_class_, size); @@ -1606,34 +1607,34 @@ JSHandle ObjectFactory::NewTaggedArray(uint32_t length, JSTaggedVal JSHandle array(thread_, header); // TODO(audovichenko): Remove this suppression when CSA gets recognize primitive TaggedValue (issue #I5QOJX) // SUPPRESS_CSA_NEXTLINE(alpha.core.WasteObjHeader) - array->InitializeWithSpecialValue(initVal, length); + array->InitializeWithSpecialValue(init_val, length); return array; } -JSHandle ObjectFactory::NewTaggedArray(uint32_t length, JSTaggedValue initVal) +JSHandle ObjectFactory::NewTaggedArray(uint32_t length, JSTaggedValue init_val) { - return NewTaggedArrayImpl(length, initVal, false); + return NewTaggedArrayImpl(length, init_val, false); } -JSHandle ObjectFactory::NewWeakTaggedArray(uint32_t length, JSTaggedValue initVal) +JSHandle ObjectFactory::NewWeakTaggedArray(uint32_t length, JSTaggedValue init_val) { - return NewTaggedArrayImpl(length, initVal, true); + return NewTaggedArrayImpl(length, init_val, true); } -JSHandle ObjectFactory::NewTaggedArrayImpl(uint32_t length, JSTaggedValue initVal, bool weak) +JSHandle ObjectFactory::NewTaggedArrayImpl(uint32_t length, JSTaggedValue init_val, bool weak) { NewObjectHook(); if (length == 0) { return weak ? EmptyWeakArray() : EmptyArray(); } - ASSERT(!initVal.IsHeapObject()); + ASSERT(!init_val.IsHeapObject()); size_t size = TaggedArray::ComputeSize(JSTaggedValue::TaggedTypeSize(), length); auto header = heap_helper_.AllocateYoungGenerationOrHugeObject(weak ? weak_array_class_ : array_class_, size); JSHandle array(thread_, header); // TODO(audovichenko): Remove this suppression when CSA gets recognize primitive TaggedValue (issue #I5QOJX) // SUPPRESS_CSA_NEXTLINE(alpha.core.WasteObjHeader) - array->InitializeWithSpecialValue(initVal, length); + array->InitializeWithSpecialValue(init_val, length); return array; } @@ -1650,16 +1651,16 @@ JSHandle ObjectFactory::NewDictionaryArray(uint32_t length) return array; } -JSHandle ObjectFactory::NewLinkedHashTable(ArraySizeT length, JSType tableType, bool isWeak) +JSHandle ObjectFactory::NewLinkedHashTable(ArraySizeT length, JSType table_type, bool is_weak) { NewObjectHook(); ASSERT(length > 0); size_t size = TaggedArray::ComputeSize(JSTaggedValue::TaggedTypeSize(), length); JSHClass *tableClass = nullptr; - if (tableType == JSType::LINKED_HASH_MAP) { - tableClass = isWeak ? weak_linked_hash_map_class_ : linked_hash_map_class_; - } else if (tableType == JSType::LINKED_HASH_SET) { - tableClass = isWeak ? weak_linked_hash_set_class_ : linked_hash_set_class_; + if (table_type == JSType::LINKED_HASH_MAP) { + tableClass = is_weak ? weak_linked_hash_map_class_ : linked_hash_map_class_; + } else if (table_type == JSType::LINKED_HASH_SET) { + tableClass = is_weak ? weak_linked_hash_set_class_ : linked_hash_set_class_; } else { tableClass = array_class_; } @@ -1670,7 +1671,7 @@ JSHandle ObjectFactory::NewLinkedHashTable(ArraySizeT length, JSTyp } JSHandle ObjectFactory::ExtendArray(const JSHandle &old, uint32_t length, - JSTaggedValue initVal) + JSTaggedValue init_val) { bool weak = old->GetClass()->IsWeakContainer(); ASSERT(length > old->GetLength()); @@ -1680,14 +1681,14 @@ JSHandle ObjectFactory::ExtendArray(const JSHandle &ol JSHandle newArray(thread_, header); newArray->SetLength(length); - uint32_t oldLength = old->GetLength(); - for (uint32_t i = 0; i < oldLength; i++) { + uint32_t old_length = old->GetLength(); + for (uint32_t i = 0; i < old_length; i++) { JSTaggedValue value = old->Get(i); newArray->Set(thread_, i, value); } - for (uint32_t i = oldLength; i < length; i++) { - newArray->Set(thread_, i, initVal); + for (uint32_t i = old_length; i < length; i++) { + newArray->Set(thread_, i, init_val); } return newArray; @@ -1699,18 +1700,18 @@ JSHandle ObjectFactory::CopyPartArray(const JSHandle & ASSERT(end <= old->GetLength()); bool weak = old->GetClass()->IsWeakContainer(); - uint32_t newLength = end - start; - if (newLength == 0) { + uint32_t new_length = end - start; + if (new_length == 0) { return weak ? EmptyWeakArray() : EmptyArray(); } NewObjectHook(); - size_t size = TaggedArray::ComputeSize(JSTaggedValue::TaggedTypeSize(), newLength); + size_t size = TaggedArray::ComputeSize(JSTaggedValue::TaggedTypeSize(), new_length); auto header = heap_helper_.AllocateYoungGenerationOrHugeObject(weak ? weak_array_class_ : array_class_, size); JSHandle newArray(thread_, header); - newArray->SetLength(newLength); + newArray->SetLength(new_length); - for (uint32_t i = 0; i < newLength; i++) { + for (uint32_t i = 0; i < new_length; i++) { JSTaggedValue value = old->Get(i + start); if (value.IsHole()) { break; @@ -1720,24 +1721,24 @@ JSHandle ObjectFactory::CopyPartArray(const JSHandle & return newArray; } -JSHandle ObjectFactory::CopyArray(const JSHandle &old, [[maybe_unused]] uint32_t oldLength, - uint32_t newLength, JSTaggedValue initVal) +JSHandle ObjectFactory::CopyArray(const JSHandle &old, [[maybe_unused]] uint32_t old_length, + uint32_t new_length, JSTaggedValue init_val) { bool weak = old->GetClass()->IsWeakContainer(); - if (newLength == 0) { + if (new_length == 0) { return weak ? EmptyWeakArray() : EmptyArray(); } - if (newLength > oldLength) { - return ExtendArray(old, newLength, initVal); + if (new_length > old_length) { + return ExtendArray(old, new_length, init_val); } NewObjectHook(); - size_t size = TaggedArray::ComputeSize(JSTaggedValue::TaggedTypeSize(), newLength); + size_t size = TaggedArray::ComputeSize(JSTaggedValue::TaggedTypeSize(), new_length); auto header = heap_helper_.AllocateYoungGenerationOrHugeObject(weak ? weak_array_class_ : array_class_, size); JSHandle newArray(thread_, header); - newArray->SetLength(newLength); + newArray->SetLength(new_length); - for (uint32_t i = 0; i < newLength; i++) { + for (uint32_t i = 0; i < new_length; i++) { JSTaggedValue value = old->Get(i); newArray->Set(thread_, i, value); } @@ -1745,26 +1746,26 @@ JSHandle ObjectFactory::CopyArray(const JSHandle &old, return newArray; } -JSHandle ObjectFactory::CreateLayoutInfo(int properties, JSTaggedValue initVal) +JSHandle ObjectFactory::CreateLayoutInfo(int properties, JSTaggedValue init_val) { int arrayLength = LayoutInfo::ComputeArrayLength(LayoutInfo::ComputeGrowCapacity(properties)); - JSHandle layoutInfoHandle = JSHandle::Cast(NewTaggedArray(arrayLength, initVal)); + JSHandle layoutInfoHandle = JSHandle::Cast(NewTaggedArray(arrayLength, init_val)); layoutInfoHandle->SetNumberOfElements(thread_, 0); return layoutInfoHandle; } JSHandle ObjectFactory::ExtendLayoutInfo(const JSHandle &old, int properties, - JSTaggedValue initVal) + JSTaggedValue init_val) { ASSERT(properties > old->NumberOfElements()); int arrayLength = LayoutInfo::ComputeArrayLength(LayoutInfo::ComputeGrowCapacity(properties)); - return JSHandle(ExtendArray(JSHandle(old), arrayLength, initVal)); + return JSHandle(ExtendArray(JSHandle(old), arrayLength, init_val)); } JSHandle ObjectFactory::CopyLayoutInfo(const JSHandle &old) { - int newLength = old->GetLength(); - return JSHandle(CopyArray(JSHandle::Cast(old), newLength, newLength)); + int new_length = old->GetLength(); + return JSHandle(CopyArray(JSHandle::Cast(old), new_length, new_length)); } JSHandle ObjectFactory::CopyAndReSort(const JSHandle &old, int end, int capacity) @@ -1840,26 +1841,26 @@ JSHandle ObjectFactory::NewObjectWrapper(const JSHandle(thread_, obj); } -JSHandle ObjectFactory::GetStringFromStringTable(const uint8_t *utf8Data, uint32_t utf8Len, - bool canBeCompress) const +JSHandle ObjectFactory::GetStringFromStringTable(const uint8_t *utf8_data, uint32_t utf8_len, + bool can_be_compress) const { NewObjectHook(); - if (utf8Len == 0) { + if (utf8_len == 0) { return GetEmptyString(); } auto stringTable = vm_->GetEcmaStringTable(); - return JSHandle(thread_, stringTable->GetOrInternString(utf8Data, utf8Len, canBeCompress)); + return JSHandle(thread_, stringTable->GetOrInternString(utf8_data, utf8_len, can_be_compress)); } -JSHandle ObjectFactory::GetStringFromStringTable(const uint16_t *utf16Data, uint32_t utf16Len, - bool canBeCompress) const +JSHandle ObjectFactory::GetStringFromStringTable(const uint16_t *utf16_data, uint32_t utf16_len, + bool can_be_compress) const { NewObjectHook(); - if (utf16Len == 0) { + if (utf16_len == 0) { return GetEmptyString(); } auto stringTable = vm_->GetEcmaStringTable(); - return JSHandle(thread_, stringTable->GetOrInternString(utf16Data, utf16Len, canBeCompress)); + return JSHandle(thread_, stringTable->GetOrInternString(utf16_data, utf16_len, can_be_compress)); } JSHandle ObjectFactory::GetStringFromStringTable(EcmaString *string) const @@ -1873,21 +1874,21 @@ JSHandle ObjectFactory::GetStringFromStringTable(EcmaString *string) } // NB! don't do special case for C0 80, it means '\u0000', so don't convert to UTF-8 -EcmaString *ObjectFactory::GetRawStringFromStringTable(const uint8_t *mutf8Data, uint32_t utf16Len, - bool canBeCompressed) const +EcmaString *ObjectFactory::GetRawStringFromStringTable(const uint8_t *mutf8_data, uint32_t utf16_len, + bool can_be_compressed) const { NewObjectHook(); - if (UNLIKELY(utf16Len == 0)) { + if (UNLIKELY(utf16_len == 0)) { return *GetEmptyString(); } - if (canBeCompressed) { - return EcmaString::Cast(vm_->GetEcmaStringTable()->GetOrInternString(mutf8Data, utf16Len, true)); + if (can_be_compressed) { + return EcmaString::Cast(vm_->GetEcmaStringTable()->GetOrInternString(mutf8_data, utf16_len, true)); } - PandaVector utf16Data(utf16Len); - auto len = utf::ConvertRegionMUtf8ToUtf16(mutf8Data, utf16Data.data(), utf::Mutf8Size(mutf8Data), utf16Len, 0); - return EcmaString::Cast(vm_->GetEcmaStringTable()->GetOrInternString(utf16Data.data(), len, false)); + PandaVector utf16_data(utf16_len); + auto len = utf::ConvertRegionMUtf8ToUtf16(mutf8_data, utf16_data.data(), utf::Mutf8Size(mutf8_data), utf16_len, 0); + return EcmaString::Cast(vm_->GetEcmaStringTable()->GetOrInternString(utf16_data.data(), len, false)); } JSHandle ObjectFactory::NewPropertyBox(const JSHandle &value) @@ -2021,7 +2022,7 @@ JSHandle ObjectFactory::NewJSArrayIterator(const JSHandle ObjectFactory::CreateJSPromiseReactionsFunction(const void *nativeFunc) +JSHandle ObjectFactory::CreateJSPromiseReactionsFunction(const void *native_func) { JSHandle env = vm_->GetGlobalEnv(); JSHandle dynclass = JSHandle::Cast(env->GetPromiseReactionFunctionClass()); @@ -2030,7 +2031,7 @@ JSHandle ObjectFactory::CreateJSPromiseReactionsFunc JSHandle::Cast(NewJSObject(dynclass)); reactionsFunction->SetPromise(thread_, JSTaggedValue::Hole()); reactionsFunction->SetAlreadyResolved(thread_, JSTaggedValue::Hole()); - JSMethod *method = vm_->GetMethodForNativeFunction(nativeFunc); + JSMethod *method = vm_->GetMethodForNativeFunction(native_func); reactionsFunction->SetCallTarget(thread_, method); JSHandle function = JSHandle::Cast(reactionsFunction); JSFunction::InitializeJSFunction(thread_, function); @@ -2038,14 +2039,14 @@ JSHandle ObjectFactory::CreateJSPromiseReactionsFunc return reactionsFunction; } -JSHandle ObjectFactory::CreateJSPromiseExecutorFunction(const void *nativeFunc) +JSHandle ObjectFactory::CreateJSPromiseExecutorFunction(const void *native_func) { JSHandle env = vm_->GetGlobalEnv(); JSHandle dynclass = JSHandle::Cast(env->GetPromiseExecutorFunctionClass()); JSHandle executorFunction = JSHandle::Cast(NewJSObject(dynclass)); executorFunction->SetCapability(thread_, JSTaggedValue::Hole()); - JSMethod *method = vm_->GetMethodForNativeFunction(nativeFunc); + JSMethod *method = vm_->GetMethodForNativeFunction(native_func); executorFunction->SetCallTarget(thread_, method); executorFunction->SetCapability(thread_, JSTaggedValue::Undefined()); JSHandle function = JSHandle::Cast(executorFunction); @@ -2069,14 +2070,14 @@ JSHandle ObjectFactory::CreateBuiltinFunction(EcmaEntrypoint steps, } JSHandle ObjectFactory::NewJSPromiseAllResolveElementFunction( - const void *nativeFunc) + const void *native_func) { JSHandle env = vm_->GetGlobalEnv(); JSHandle dynclass = JSHandle::Cast(env->GetPromiseAllResolveElementFunctionClass()); JSHandle function = JSHandle::Cast(NewJSObject(dynclass)); JSFunction::InitializeJSFunction(thread_, JSHandle::Cast(function)); - JSMethod *method = vm_->GetMethodForNativeFunction(nativeFunc); + JSMethod *method = vm_->GetMethodForNativeFunction(native_func); function->SetCallTarget(thread_, method); JSFunction::SetFunctionLength(thread_, JSHandle::Cast(function), JSTaggedValue(1)); return function; @@ -2181,23 +2182,23 @@ JSHandle ObjectFactory::NewEmptyJSObject() return NewJSObjectByConstructor(JSHandle(builtinObj), builtinObj); } -EcmaString *ObjectFactory::ResolveString(uint32_t stringId) +EcmaString *ObjectFactory::ResolveString(uint32_t string_id) { auto *caller = panda::StackWalker::Create(thread_).GetMethod(); auto *pf = caller->GetPandaFile(); - auto id = panda_file::File::EntityId(stringId); + auto id = panda_file::File::EntityId(string_id); auto foundStr = pf->GetStringData(id); return GetRawStringFromStringTable(foundStr.data, foundStr.utf16_length, foundStr.is_ascii); } -JSHandle ObjectFactory::NewClassInfoExtractor(JSMethod *ctorMethod) +JSHandle ObjectFactory::NewClassInfoExtractor(JSMethod *ctor_method) { NewObjectHook(); TaggedObject *header = heap_helper_.AllocateYoungGenerationOrHugeObject(class_info_extractor_h_class_); JSHandle obj(thread_, header); obj->InitializeBitField(); - obj->SetConstructorMethod(ctorMethod); + obj->SetConstructorMethod(ctor_method); JSHandle emptyArray = EmptyArray(); obj->SetPrototypeHClass(thread_, JSTaggedValue::Undefined()); obj->SetNonStaticKeys(thread_, emptyArray, SKIP_BARRIER); @@ -2213,80 +2214,81 @@ JSHandle ObjectFactory::NewClassInfoExtractor(JSMethod *ctor // ----------------------------------- new string ---------------------------------------- JSHandle ObjectFactory::NewFromString(const PandaString &data) { - auto utf8Data = reinterpret_cast(data.c_str()); - bool canBeCompress = EcmaString::CanBeCompressed(utf8Data, data.length()); - return GetStringFromStringTable(utf8Data, data.length(), canBeCompress); + auto utf8_data = reinterpret_cast(data.c_str()); + bool can_be_compress = EcmaString::CanBeCompressed(utf8_data, data.length()); + return GetStringFromStringTable(utf8_data, data.length(), can_be_compress); } JSHandle ObjectFactory::NewFromCanBeCompressString(const PandaString &data) { - auto utf8Data = reinterpret_cast(data.c_str()); - ASSERT(EcmaString::CanBeCompressed(utf8Data, data.length())); - return GetStringFromStringTable(utf8Data, data.length(), true); + auto utf8_data = reinterpret_cast(data.c_str()); + ASSERT(EcmaString::CanBeCompressed(utf8_data, data.length())); + return GetStringFromStringTable(utf8_data, data.length(), true); } JSHandle ObjectFactory::NewFromStdString(const std::string &data) { - auto utf8Data = reinterpret_cast(data.c_str()); - bool canBeCompress = EcmaString::CanBeCompressed(utf8Data, data.length()); - return GetStringFromStringTable(utf8Data, data.size(), canBeCompress); + auto utf8_data = reinterpret_cast(data.c_str()); + bool can_be_compress = EcmaString::CanBeCompressed(utf8_data, data.length()); + return GetStringFromStringTable(utf8_data, data.size(), can_be_compress); } -JSHandle ObjectFactory::NewFromStdStringUnCheck(const std::string &data, bool canBeCompress) +JSHandle ObjectFactory::NewFromStdStringUnCheck(const std::string &data, bool can_be_compress) { - auto utf8Data = reinterpret_cast(data.c_str()); - return GetStringFromStringTable(utf8Data, data.size(), canBeCompress); + auto utf8_data = reinterpret_cast(data.c_str()); + return GetStringFromStringTable(utf8_data, data.size(), can_be_compress); } -JSHandle ObjectFactory::NewFromUtf8(const uint8_t *utf8Data, uint32_t utf8Len) +JSHandle ObjectFactory::NewFromUtf8(const uint8_t *utf8_data, uint32_t utf8_len) { - bool canBeCompress = EcmaString::CanBeCompressed(utf8Data, utf8Len); - return GetStringFromStringTable(utf8Data, utf8Len, canBeCompress); + bool can_be_compress = EcmaString::CanBeCompressed(utf8_data, utf8_len); + return GetStringFromStringTable(utf8_data, utf8_len, can_be_compress); } -JSHandle ObjectFactory::NewFromUtf8UnCheck(const uint8_t *utf8Data, uint32_t utf8Len, bool canBeCompress) +JSHandle ObjectFactory::NewFromUtf8UnCheck(const uint8_t *utf8_data, uint32_t utf8_len, + bool can_be_compress) { - return GetStringFromStringTable(utf8Data, utf8Len, canBeCompress); + return GetStringFromStringTable(utf8_data, utf8_len, can_be_compress); } -JSHandle ObjectFactory::NewFromUtf16(const uint16_t *utf16Data, uint32_t utf16Len) +JSHandle ObjectFactory::NewFromUtf16(const uint16_t *utf16_data, uint32_t utf16_len) { - bool canBeCompress = EcmaString::CanBeCompressed(utf16Data, utf16Len); - return GetStringFromStringTable(utf16Data, utf16Len, canBeCompress); + bool can_be_compress = EcmaString::CanBeCompressed(utf16_data, utf16_len); + return GetStringFromStringTable(utf16_data, utf16_len, can_be_compress); } -JSHandle ObjectFactory::NewFromUtf16UnCheck(const uint16_t *utf16Data, uint32_t utf16Len, - bool canBeCompress) +JSHandle ObjectFactory::NewFromUtf16UnCheck(const uint16_t *utf16_data, uint32_t utf16_len, + bool can_be_compress) { - return GetStringFromStringTable(utf16Data, utf16Len, canBeCompress); + return GetStringFromStringTable(utf16_data, utf16_len, can_be_compress); } -JSHandle ObjectFactory::NewFromUtf8Literal(const uint8_t *utf8Data, uint32_t utf8Len) +JSHandle ObjectFactory::NewFromUtf8Literal(const uint8_t *utf8_data, uint32_t utf8_len) { NewObjectHook(); - bool canBeCompress = EcmaString::CanBeCompressed(utf8Data, utf8Len); - return JSHandle(thread_, EcmaString::CreateFromUtf8(utf8Data, utf8Len, vm_, canBeCompress)); + bool can_be_compress = EcmaString::CanBeCompressed(utf8_data, utf8_len); + return JSHandle(thread_, EcmaString::CreateFromUtf8(utf8_data, utf8_len, vm_, can_be_compress)); } -JSHandle ObjectFactory::NewFromUtf8LiteralUnCheck(const uint8_t *utf8Data, uint32_t utf8Len, - bool canBeCompress) +JSHandle ObjectFactory::NewFromUtf8LiteralUnCheck(const uint8_t *utf8_data, uint32_t utf8_len, + bool can_be_compress) { NewObjectHook(); - return JSHandle(thread_, EcmaString::CreateFromUtf8(utf8Data, utf8Len, vm_, canBeCompress)); + return JSHandle(thread_, EcmaString::CreateFromUtf8(utf8_data, utf8_len, vm_, can_be_compress)); } -JSHandle ObjectFactory::NewFromUtf16Literal(const uint16_t *utf16Data, uint32_t utf16Len) +JSHandle ObjectFactory::NewFromUtf16Literal(const uint16_t *utf16_data, uint32_t utf16_len) { NewObjectHook(); - bool canBeCompress = EcmaString::CanBeCompressed(utf16Data, utf16Len); - return JSHandle(thread_, EcmaString::CreateFromUtf16(utf16Data, utf16Len, vm_, canBeCompress)); + bool can_be_compress = EcmaString::CanBeCompressed(utf16_data, utf16_len); + return JSHandle(thread_, EcmaString::CreateFromUtf16(utf16_data, utf16_len, vm_, can_be_compress)); } -JSHandle ObjectFactory::NewFromUtf16LiteralUnCheck(const uint16_t *utf16Data, uint32_t utf16Len, - bool canBeCompress) +JSHandle ObjectFactory::NewFromUtf16LiteralUnCheck(const uint16_t *utf16_data, uint32_t utf16_len, + bool can_be_compress) { NewObjectHook(); - return JSHandle(thread_, EcmaString::CreateFromUtf16(utf16Data, utf16Len, vm_, canBeCompress)); + return JSHandle(thread_, EcmaString::CreateFromUtf16(utf16_data, utf16_len, vm_, can_be_compress)); } JSHandle ObjectFactory::NewFromString(EcmaString *str) diff --git a/runtime/object_factory.h b/runtime/object_factory.h index c3e885987..4267fdc6d 100644 --- a/runtime/object_factory.h +++ b/runtime/object_factory.h @@ -163,7 +163,7 @@ public: JSHandle NewAsyncFunction(JSMethod *method); JSHandle NewJSGeneratorObject(JSHandle generator_function); - JSHandle NewJSAsyncGeneratorObject(JSHandle generator_function); + JSHandle NewJSAsyncGeneratorObject(JSHandle async_generator_function); JSHandle NewJSAsyncFromSyncIteratorObject(); JSHandle NewJSAsyncFuncObject(); @@ -308,12 +308,12 @@ public: JSHandle NewJSPromiseAllResolveElementFunction(const void *native_func); JSHandle CloneObjectLiteral(JSHandle object, const JSHandle &env, - const JSHandle &constpool, bool can_share_h_class = true); + const JSHandle &constpool, bool can_share_hclass = true); JSHandle CloneObjectLiteral(JSHandle object); JSHandle CloneArrayLiteral(JSHandle object); JSHandle CloneJSFuction(JSHandle obj, FunctionKind kind); JSHandle CloneClassCtor(JSHandle ctor, const JSHandle &lexenv, - bool can_share_h_class); + bool can_share_hclass); void NewJSArrayBufferData(const JSHandle &array, int32_t length); diff --git a/runtime/object_operator.cpp b/runtime/object_operator.cpp index cc31bbf69..0c82fc2ee 100644 --- a/runtime/object_operator.cpp +++ b/runtime/object_operator.cpp @@ -389,17 +389,17 @@ void ObjectOperator::TransitionForAttributeChanged(const JSHandle &rec } bool ObjectOperator::UpdateValueAndDetails(const JSHandle &receiver, const JSHandle &value, - PropertyAttributes attr, bool attrChanged) + PropertyAttributes attr, bool attr_changed) { - bool isInternalAccessor = IsAccessorDescriptor() && AccessorData::Cast(GetValue().GetHeapObject())->IsInternal(); - if (attrChanged) { + bool is_internal_accessor = IsAccessorDescriptor() && AccessorData::Cast(GetValue().GetHeapObject())->IsInternal(); + if (attr_changed) { TransitionForAttributeChanged(receiver, attr); } - return UpdateDataValue(receiver, value, isInternalAccessor); + return UpdateDataValue(receiver, value, is_internal_accessor); } bool ObjectOperator::UpdateDataValue(const JSHandle &receiver, const JSHandle &value, - bool isInternalAccessor, bool mayThrow) + bool is_internal_accessor, bool may_throw) { if (IsElement()) { TaggedArray *elements = TaggedArray::Cast(receiver->GetElements().GetTaggedObject()); @@ -421,10 +421,10 @@ bool ObjectOperator::UpdateDataValue(const JSHandle &receiver, const J return true; } - if (isInternalAccessor) { + if (is_internal_accessor) { auto accessor = AccessorData::Cast(GetValue().GetHeapObject()); if (accessor->HasSetter()) { - return accessor->CallInternalSet(thread_, JSHandle(receiver), value, mayThrow); + return accessor->CallInternalSet(thread_, JSHandle(receiver), value, may_throw); } } @@ -445,25 +445,25 @@ bool ObjectOperator::UpdateDataValue(const JSHandle &receiver, const J bool ObjectOperator::WriteDataProperty(const JSHandle &receiver, const PropertyDescriptor &desc) { PropertyAttributes attr = GetAttr(); - bool attrChanged = false; + bool attr_changed = false; // composed new attribute from desc if (desc.HasConfigurable() && attr.IsConfigurable() != desc.IsConfigurable()) { attr.SetConfigurable(desc.IsConfigurable()); - attrChanged = true; + attr_changed = true; } if (desc.HasEnumerable() && attr.IsEnumerable() != desc.IsEnumerable()) { attr.SetEnumerable(desc.IsEnumerable()); - attrChanged = true; + attr_changed = true; } if (!desc.IsAccessorDescriptor()) { if (desc.HasWritable() && attr.IsWritable() != desc.IsWritable()) { attr.SetWritable(desc.IsWritable()); - attrChanged = true; + attr_changed = true; } if (!desc.HasValue()) { - if (attrChanged) { + if (attr_changed) { TransitionForAttributeChanged(receiver, attr); } return true; @@ -473,17 +473,17 @@ bool ObjectOperator::WriteDataProperty(const JSHandle &receiver, const auto accessor = AccessorData::Cast(GetValue().GetHeapObject()); if (!accessor->IsInternal() || !accessor->HasSetter()) { attr.SetIsAccessor(false); - attrChanged = true; + attr_changed = true; } } - return UpdateValueAndDetails(receiver, desc.GetValue(), attr, attrChanged); + return UpdateValueAndDetails(receiver, desc.GetValue(), attr, attr_changed); } if (IsAccessorDescriptor() && !IsElement()) { TaggedArray *properties = TaggedArray::Cast(receiver->GetProperties().GetTaggedObject()); if (!properties->IsDictionaryMode()) { - // as some accessorData is in globalEnv, we need to new accessorData. + // as some accessorData is in global_env, we need to new accessorData. JSHandle accessor = thread_->GetEcmaVM()->GetFactory()->NewAccessorData(); if (desc.HasGetter()) { @@ -518,11 +518,11 @@ bool ObjectOperator::WriteDataProperty(const JSHandle &receiver, const if (!IsAccessorDescriptor()) { attr.SetIsAccessor(true); - attrChanged = true; + attr_changed = true; } JSHandle value = JSHandle::Cast(accessor); - return UpdateValueAndDetails(receiver, value, attr, attrChanged); + return UpdateValueAndDetails(receiver, value, attr, attr_changed); } void ObjectOperator::DeletePropertyInHolder() diff --git a/runtime/property_attributes.h b/runtime/property_attributes.h index c107645af..190aa0fb5 100644 --- a/runtime/property_attributes.h +++ b/runtime/property_attributes.h @@ -60,7 +60,7 @@ public: static constexpr uint32_t OFFSET_BITFIELD_NUM = 10; static constexpr uint32_t MAX_CAPACITY_OF_PROPERTIES = (1U << OFFSET_BITFIELD_NUM) - 1; - using PropertyMetaDataField = BitField; // 4: property metaData field occupies 4 bits + using PropertyMetaDataField = BitField; // 4: property meta_data field occupies 4 bits using AttributesField = BitField; // 4: attributes field occupies 4 bits using DefaultAttributesField = BitField; // 3: default attributes field occupies 3 bits using WritableField = BitField; // 1: writable field occupies 1 bits diff --git a/runtime/symbol_table.h b/runtime/symbol_table.h index 0b36377ee..0db0b5d61 100644 --- a/runtime/symbol_table.h +++ b/runtime/symbol_table.h @@ -48,9 +48,9 @@ public: static inline uint32_t Hash(const JSTaggedValue &obj); static const int DEFAULT_ELEMENTS_NUMBER = 64; - static JSHandle Create(JSThread *thread, int numberOfElements = DEFAULT_ELEMENTS_NUMBER) + static JSHandle Create(JSThread *thread, int number_of_elements = DEFAULT_ELEMENTS_NUMBER) { - return HashTable::Create(thread, numberOfElements); + return HashTable::Create(thread, number_of_elements); } inline bool ContainsKey(JSThread *thread, const JSTaggedValue &key); diff --git a/runtime/tagged_dictionary.cpp b/runtime/tagged_dictionary.cpp index b64b1c1f3..058b16c45 100644 --- a/runtime/tagged_dictionary.cpp +++ b/runtime/tagged_dictionary.cpp @@ -39,7 +39,7 @@ bool NameDictionary::IsMatch(const JSTaggedValue &key, const JSTaggedValue &othe return key == other; } -void NameDictionary::GetAllKeys(const JSThread *thread, int offset, TaggedArray *keyArray) const +void NameDictionary::GetAllKeys(const JSThread *thread, int offset, TaggedArray *key_array) const { int arrayIndex = 0; int size = Size(); @@ -54,12 +54,12 @@ void NameDictionary::GetAllKeys(const JSThread *thread, int offset, TaggedArray } std::sort(sortArr.begin(), sortArr.end(), CompKey); for (const auto &entry : sortArr) { - keyArray->Set(thread, arrayIndex + offset, entry.first); + key_array->Set(thread, arrayIndex + offset, entry.first); arrayIndex++; } } -void NameDictionary::GetAllEnumKeys(const JSThread *thread, int offset, TaggedArray *keyArray, uint32_t *keys) const +void NameDictionary::GetAllEnumKeys(const JSThread *thread, int offset, TaggedArray *key_array, uint32_t *keys) const { uint32_t arrayIndex = 0; int size = Size(); @@ -76,15 +76,15 @@ void NameDictionary::GetAllEnumKeys(const JSThread *thread, int offset, TaggedAr } std::sort(sortArr.begin(), sortArr.end(), CompKey); for (auto entry : sortArr) { - keyArray->Set(thread, arrayIndex + offset, entry.first); + key_array->Set(thread, arrayIndex + offset, entry.first); arrayIndex++; } *keys += arrayIndex; } -JSHandle NameDictionary::Create(const JSThread *thread, int numberOfElements) +JSHandle NameDictionary::Create(const JSThread *thread, int number_of_elements) { - return OrderHashTableT::Create(thread, numberOfElements); + return OrderHashTableT::Create(thread, number_of_elements); } PropertyAttributes NameDictionary::GetAttributes(int entry) const @@ -93,25 +93,25 @@ PropertyAttributes NameDictionary::GetAttributes(int entry) const return PropertyAttributes(Get(index).GetInt()); } -void NameDictionary::SetAttributes(const JSThread *thread, int entry, const PropertyAttributes &metaData) +void NameDictionary::SetAttributes(const JSThread *thread, int entry, const PropertyAttributes &meta_data) { int index = GetEntryIndex(entry) + ENTRY_DETAILS_INDEX; - Set(thread, index, metaData.GetTaggedValue()); + Set(thread, index, meta_data.GetTaggedValue()); } void NameDictionary::SetEntry(const JSThread *thread, int entry, const JSTaggedValue &key, const JSTaggedValue &value, - const PropertyAttributes &metaData) + const PropertyAttributes &meta_data) { SetKey(thread, entry, key); SetValue(thread, entry, value); - SetAttributes(thread, entry, metaData); + SetAttributes(thread, entry, meta_data); } void NameDictionary::UpdateValueAndAttributes(const JSThread *thread, int entry, const JSTaggedValue &value, - const PropertyAttributes &metaData) + const PropertyAttributes &meta_data) { SetValue(thread, entry, value); - SetAttributes(thread, entry, metaData); + SetAttributes(thread, entry, meta_data); } void NameDictionary::UpdateValue(const JSThread *thread, int entry, const JSTaggedValue &value) @@ -122,8 +122,8 @@ void NameDictionary::UpdateValue(const JSThread *thread, int entry, const JSTagg void NameDictionary::ClearEntry(const JSThread *thread, int entry) { JSTaggedValue hole = JSTaggedValue::Hole(); - PropertyAttributes metaData; - SetEntry(thread, entry, hole, hole, metaData); + PropertyAttributes meta_data; + SetEntry(thread, entry, hole, hole, meta_data); } int NumberDictionary::Hash(const JSTaggedValue &key) @@ -153,10 +153,10 @@ bool NumberDictionary::IsMatch(const JSTaggedValue &key, const JSTaggedValue &ot } void NumberDictionary::GetAllKeys(const JSThread *thread, const JSHandle &obj, int offset, - const JSHandle &keyArray) + const JSHandle &key_array) { - ASSERT_PRINT(offset + obj->EntriesCount() <= static_cast(keyArray->GetLength()), - "keyArray capacity is not enough for dictionary"); + ASSERT_PRINT(offset + obj->EntriesCount() <= static_cast(key_array->GetLength()), + "key_array capacity is not enough for dictionary"); int arrayIndex = 0; int size = obj->Size(); PandaVector sortArr; @@ -171,16 +171,16 @@ void NumberDictionary::GetAllKeys(const JSThread *thread, const JSHandle keyHandle(thread, entry); JSHandle str = JSTaggedValue::ToString(const_cast(thread), keyHandle); ASSERT_NO_ABRUPT_COMPLETION(thread); - keyArray->Set(thread, arrayIndex + offset, str.GetTaggedValue()); + key_array->Set(thread, arrayIndex + offset, str.GetTaggedValue()); arrayIndex++; } } void NumberDictionary::GetAllEnumKeys(const JSThread *thread, const JSHandle &obj, int offset, - const JSHandle &keyArray, uint32_t *keys) + const JSHandle &key_array, uint32_t *keys) { - ASSERT_PRINT(offset + obj->EntriesCount() <= static_cast(keyArray->GetLength()), - "keyArray capacity is not enough for dictionary"); + ASSERT_PRINT(offset + obj->EntriesCount() <= static_cast(key_array->GetLength()), + "key_array capacity is not enough for dictionary"); uint32_t arrayIndex = 0; int size = obj->Size(); PandaVector sortArr; @@ -198,15 +198,15 @@ void NumberDictionary::GetAllEnumKeys(const JSThread *thread, const JSHandle key_handle(thread, entry); JSHandle str = JSTaggedValue::ToString(const_cast(thread), key_handle); ASSERT_NO_ABRUPT_COMPLETION(thread); - keyArray->Set(thread, arrayIndex + offset, str.GetTaggedValue()); + key_array->Set(thread, arrayIndex + offset, str.GetTaggedValue()); arrayIndex++; } *keys += arrayIndex; } -JSHandle NumberDictionary::Create(const JSThread *thread, int numberOfElements) +JSHandle NumberDictionary::Create(const JSThread *thread, int number_of_elements) { - return OrderHashTableT::Create(thread, numberOfElements); + return OrderHashTableT::Create(thread, number_of_elements); } PropertyAttributes NumberDictionary::GetAttributes(int entry) const @@ -215,25 +215,25 @@ PropertyAttributes NumberDictionary::GetAttributes(int entry) const return PropertyAttributes(Get(index).GetInt()); } -void NumberDictionary::SetAttributes(const JSThread *thread, int entry, const PropertyAttributes &metaData) +void NumberDictionary::SetAttributes(const JSThread *thread, int entry, const PropertyAttributes &meta_data) { int index = GetEntryIndex(entry) + ENTRY_DETAILS_INDEX; - Set(thread, index, metaData.GetTaggedValue()); + Set(thread, index, meta_data.GetTaggedValue()); } void NumberDictionary::SetEntry(const JSThread *thread, int entry, const JSTaggedValue &key, const JSTaggedValue &value, - const PropertyAttributes &metaData) + const PropertyAttributes &meta_data) { SetKey(thread, entry, key); SetValue(thread, entry, value); - SetAttributes(thread, entry, metaData); + SetAttributes(thread, entry, meta_data); } void NumberDictionary::UpdateValueAndAttributes(const JSThread *thread, int entry, const JSTaggedValue &value, - const PropertyAttributes &metaData) + const PropertyAttributes &meta_data) { SetValue(thread, entry, value); - SetAttributes(thread, entry, metaData); + SetAttributes(thread, entry, meta_data); } void NumberDictionary::UpdateValue(const JSThread *thread, int entry, const JSTaggedValue &value) @@ -244,7 +244,7 @@ void NumberDictionary::UpdateValue(const JSThread *thread, int entry, const JSTa void NumberDictionary::ClearEntry(const JSThread *thread, int entry) { JSTaggedValue hole = JSTaggedValue::Hole(); - PropertyAttributes metaData; - SetEntry(thread, entry, hole, hole, metaData); + PropertyAttributes meta_data; + SetEntry(thread, entry, hole, hole, meta_data); } } // namespace panda::ecmascript diff --git a/runtime/tagged_dictionary.h b/runtime/tagged_dictionary.h index 84ddfe594..5721d0014 100644 --- a/runtime/tagged_dictionary.h +++ b/runtime/tagged_dictionary.h @@ -42,7 +42,7 @@ public: static bool IsMatch(const JSTaggedValue &key, const JSTaggedValue &other); static JSHandle Create(const JSThread *thread, int number_of_elements = OrderHashTableT::DEFAULT_ELEMENTS_NUMBER); - // Returns the property metaData for the property at entry. + // Returns the property meta_data for the property at entry. PropertyAttributes GetAttributes(int entry) const; void SetAttributes(const JSThread *thread, int entry, const PropertyAttributes &meta_data); void SetEntry(const JSThread *thread, int entry, const JSTaggedValue &key, const JSTaggedValue &value, @@ -102,7 +102,7 @@ public: static bool IsMatch(const JSTaggedValue &key, const JSTaggedValue &other); static JSHandle Create(const JSThread *thread, int number_of_elements = OrderHashTableT::DEFAULT_ELEMENTS_NUMBER); - // Returns the property metaData for the property at entry. + // Returns the property meta_data for the property at entry. PropertyAttributes GetAttributes(int entry) const; void SetAttributes(const JSThread *thread, int entry, const PropertyAttributes &meta_data); void SetEntry([[maybe_unused]] const JSThread *thread, int entry, const JSTaggedValue &key, diff --git a/runtime/tagged_hash_table-inl.h b/runtime/tagged_hash_table-inl.h index 5df3c7250..9c25878a6 100644 --- a/runtime/tagged_hash_table-inl.h +++ b/runtime/tagged_hash_table-inl.h @@ -74,7 +74,7 @@ template void TaggedHashTable::GetAllKeys(const JSThread *thread, int offset, TaggedArray *key_array) const { ASSERT_PRINT(offset + EntriesCount() <= static_cast(key_array->GetLength()), - "keyArray size is not enough for dictionary"); + "key_array size is not enough for dictionary"); int array_index = 0; int size = Size(); for (int hash_index = 0; hash_index < size; hash_index++) { diff --git a/runtime/template_map.h b/runtime/template_map.h index 6a09ac57f..8beba701f 100644 --- a/runtime/template_map.h +++ b/runtime/template_map.h @@ -55,9 +55,9 @@ public: return reinterpret_cast(object); } static const int DEFAULT_ELEMENTS_NUMBER = 16; - static JSHandle Create(JSThread *thread, int numberOfElements = DEFAULT_ELEMENTS_NUMBER) + static JSHandle Create(JSThread *thread, int number_of_elements = DEFAULT_ELEMENTS_NUMBER) { - return HashTable::Create(thread, numberOfElements); + return HashTable::Create(thread, number_of_elements); } static const int ENTRY_SIZE = 2; static const int ENTRY_KEY_INDEX = 0; diff --git a/runtime/template_string.cpp b/runtime/template_string.cpp index 2e201e53b..679706905 100644 --- a/runtime/template_string.cpp +++ b/runtime/template_string.cpp @@ -23,17 +23,17 @@ #include "plugins/ecmascript/runtime/template_map.h" namespace panda::ecmascript { -JSHandle TemplateString::GetTemplateObject(JSThread *thread, JSHandle templateLiteral) +JSHandle TemplateString::GetTemplateObject(JSThread *thread, JSHandle template_literal) { JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); - JSHandle rawStringsTag = JSObject::GetProperty(thread, templateLiteral, 0).GetValue(); + JSHandle rawStringsTag = JSObject::GetProperty(thread, template_literal, 0).GetValue(); JSHandle templateMapTag = env->GetTemplateMap(); JSHandle templateMap(templateMapTag); int32_t element = templateMap->FindEntry(rawStringsTag.GetTaggedValue()); if (element != -1) { return JSHandle(thread, templateMap->GetValue(element)); } - JSHandle cookedStringsTag = JSObject::GetProperty(thread, templateLiteral, 1).GetValue(); + JSHandle cookedStringsTag = JSObject::GetProperty(thread, template_literal, 1).GetValue(); JSHandle cookedStrings(cookedStringsTag); int32_t count = cookedStrings->GetArrayLength(); auto countNum = JSTaggedNumber(count); diff --git a/runtime/vmstat/caller_stat.cpp b/runtime/vmstat/caller_stat.cpp index 37a2f7512..352298228 100644 --- a/runtime/vmstat/caller_stat.cpp +++ b/runtime/vmstat/caller_stat.cpp @@ -16,10 +16,10 @@ #include "caller_stat.h" namespace panda::ecmascript { -void PandaRuntimeTimer::Start(PandaRuntimeCallerStat *callerStat, PandaRuntimeTimer *parent) +void PandaRuntimeTimer::Start(PandaRuntimeCallerStat *caller_stat, PandaRuntimeTimer *parent) { parent_ = parent; - caller_stat_ = callerStat; + caller_stat_ = caller_stat; uint64_t nowTime = Now(); if (parent != nullptr) { parent_->Pause(nowTime); diff --git a/runtime/vmstat/runtime_stat.cpp b/runtime/vmstat/runtime_stat.cpp index 1df69bee9..4f4a782d4 100644 --- a/runtime/vmstat/runtime_stat.cpp +++ b/runtime/vmstat/runtime_stat.cpp @@ -22,23 +22,23 @@ namespace panda::ecmascript { // NOLINTNEXTLINE(modernize-avoid-c-arrays) -EcmaRuntimeStat::EcmaRuntimeStat(const char *const runtimeCallerNames[], int count) +EcmaRuntimeStat::EcmaRuntimeStat(const char *const runtime_caller_names[], int count) { for (int i = 0; i < count; i++) { // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) - caller_stat_.emplace_back(PandaRuntimeCallerStat(PandaString(runtimeCallerNames[i]))); + caller_stat_.emplace_back(PandaRuntimeCallerStat(PandaString(runtime_caller_names[i]))); } } -void EcmaRuntimeStat::StartCount(PandaRuntimeTimer *timer, int callerId) +void EcmaRuntimeStat::StartCount(PandaRuntimeTimer *timer, int caller_id) { if (current_timer_ != nullptr) { timer->SetParent(current_timer_); } PandaRuntimeTimer *parent = current_timer_; current_timer_ = timer; - PandaRuntimeCallerStat *callerStat = &caller_stat_[callerId]; - timer->Start(callerStat, parent); + PandaRuntimeCallerStat *caller_stat = &caller_stat_[caller_id]; + timer->Start(caller_stat, parent); } void EcmaRuntimeStat::StopCount(const PandaRuntimeTimer *nowTimer) diff --git a/runtime/weak_vector.cpp b/runtime/weak_vector.cpp index dea11549f..1faba2d28 100644 --- a/runtime/weak_vector.cpp +++ b/runtime/weak_vector.cpp @@ -39,21 +39,21 @@ bool WeakVector::Delete(const JSThread *thread, uint32_t index) return false; } -JSHandle WeakVector::Grow(const JSThread *thread, const JSHandle &old, uint32_t newCapacity) +JSHandle WeakVector::Grow(const JSThread *thread, const JSHandle &old, uint32_t new_capacity) { uint32_t oldCapacity = old->GetCapacity(); - ASSERT(newCapacity > oldCapacity); + ASSERT(new_capacity > oldCapacity); if (oldCapacity == MAX_VECTOR_INDEX) { return old; } - if (newCapacity > MAX_VECTOR_INDEX) { - newCapacity = MAX_VECTOR_INDEX; + if (new_capacity > MAX_VECTOR_INDEX) { + new_capacity = MAX_VECTOR_INDEX; } ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); JSHandle newVec = factory->CopyArray(JSHandle(old), VectorToArrayIndex(oldCapacity), - VectorToArrayIndex(newCapacity)); + VectorToArrayIndex(new_capacity)); return JSHandle(newVec); } diff --git a/tests/runtime/builtins/builtins_array_test.cpp b/tests/runtime/builtins/builtins_array_test.cpp index a2997dbd4..e9e5367c3 100644 --- a/tests/runtime/builtins/builtins_array_test.cpp +++ b/tests/runtime/builtins/builtins_array_test.cpp @@ -170,9 +170,9 @@ public: JSTaggedValue CreateBuiltinsJSObject(JSThread *thread, const PandaString keyCStr) { EcmaVM *ecmaVM = thread->GetEcmaVM(); - JSHandle globalEnv = ecmaVM->GetGlobalEnv(); + JSHandle global_env = ecmaVM->GetGlobalEnv(); - JSHandle dynclass = globalEnv->GetObjectFunction(); + JSHandle dynclass = global_env->GetObjectFunction(); ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); JSHandle obj(factory->NewJSObjectByConstructor(JSHandle(dynclass), dynclass)); diff --git a/tests/runtime/builtins/builtins_date_test.cpp b/tests/runtime/builtins/builtins_date_test.cpp index 96f8e1d50..b5591be6d 100644 --- a/tests/runtime/builtins/builtins_date_test.cpp +++ b/tests/runtime/builtins/builtins_date_test.cpp @@ -63,8 +63,8 @@ JSHandle JSDateCreateTest(JSThread *thread) { EcmaVM *ecmaVM = thread->GetEcmaVM(); ObjectFactory *factory = ecmaVM->GetFactory(); - JSHandle globalEnv = ecmaVM->GetGlobalEnv(); - JSHandle dateFunction = globalEnv->GetDateFunction(); + JSHandle global_env = ecmaVM->GetGlobalEnv(); + JSHandle dateFunction = global_env->GetDateFunction(); JSHandle dateObject = JSHandle::Cast(factory->NewJSObjectByConstructor(JSHandle(dateFunction), dateFunction)); return dateObject; @@ -905,8 +905,8 @@ TEST_F(BuiltinsDateTest, DateConstructor) { // case1: test new target is undefined. JSHandle jsDate = JSDateCreateTest(thread); - JSHandle globalEnv = thread->GetEcmaVM()->GetGlobalEnv(); - JSHandle date_func(globalEnv->GetDateFunction()); + JSHandle global_env = thread->GetEcmaVM()->GetGlobalEnv(); + JSHandle date_func(global_env->GetDateFunction()); auto ecmaRuntimeCallInfo1 = CreateAndSetRuntimeCallInfo(thread, 4, JSTaggedValue::Undefined()); [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); diff --git a/tests/runtime/builtins/builtins_json_test.cpp b/tests/runtime/builtins/builtins_json_test.cpp index be612c9e5..77a969f31 100644 --- a/tests/runtime/builtins/builtins_json_test.cpp +++ b/tests/runtime/builtins/builtins_json_test.cpp @@ -116,9 +116,9 @@ public: JSTaggedValue CreateBuiltinJSObject1(JSThread *thread, const PandaString keyCStr) { EcmaVM *ecmaVM = thread->GetEcmaVM(); - JSHandle globalEnv = ecmaVM->GetGlobalEnv(); + JSHandle global_env = ecmaVM->GetGlobalEnv(); ObjectFactory *factory = ecmaVM->GetFactory(); - JSHandle objectFunc(globalEnv->GetObjectFunction()); + JSHandle objectFunc(global_env->GetObjectFunction()); JSHandle jsobject(factory->NewJSObjectByConstructor(JSHandle(objectFunc), objectFunc)); EXPECT_TRUE(*jsobject != nullptr); diff --git a/tests/runtime/builtins/builtins_map_test.cpp b/tests/runtime/builtins/builtins_map_test.cpp index 28f0aa85a..281465bd8 100644 --- a/tests/runtime/builtins/builtins_map_test.cpp +++ b/tests/runtime/builtins/builtins_map_test.cpp @@ -81,10 +81,10 @@ public: JSMap *CreateBuiltinsMap(JSThread *thread) { JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); - JSHandle newTarget(env->GetBuiltinsMapFunction()); + JSHandle new_target(env->GetBuiltinsMapFunction()); // 4 : test case - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue(*newTarget), 4); - ecmaRuntimeCallInfo->SetFunction(newTarget.GetTaggedValue()); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue(*new_target), 4); + ecmaRuntimeCallInfo->SetFunction(new_target.GetTaggedValue()); ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); @@ -99,7 +99,7 @@ TEST_F(BuiltinsMapTest, CreateAndGetSize) { ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); - JSHandle newTarget(env->GetBuiltinsMapFunction()); + JSHandle new_target(env->GetBuiltinsMapFunction()); JSHandle map(thread, CreateBuiltinsMap(thread)); auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); @@ -123,10 +123,10 @@ TEST_F(BuiltinsMapTest, CreateAndGetSize) } JSHandle values = JSArray::CreateArrayFromList(thread, array); auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); - ecmaRuntimeCallInfo1->SetFunction(newTarget.GetTaggedValue()); + ecmaRuntimeCallInfo1->SetFunction(new_target.GetTaggedValue()); ecmaRuntimeCallInfo1->SetThis(map.GetTaggedValue()); ecmaRuntimeCallInfo1->SetCallArg(0, values.GetTaggedValue()); - ecmaRuntimeCallInfo1->SetNewTarget(newTarget.GetTaggedValue()); + ecmaRuntimeCallInfo1->SetNewTarget(new_target.GetTaggedValue()); { [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); JSTaggedValue result1 = BuiltinsMap::MapConstructor(ecmaRuntimeCallInfo1.get()); @@ -183,10 +183,10 @@ TEST_F(BuiltinsMapTest, ForEach) ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); JSHandle map(thread, CreateBuiltinsMap(thread)); - char keyArray[] = "key0"; + char key_array[] = "key0"; for (int i = 0; i < 5; i++) { - keyArray[3] = '1' + i; - JSHandle key(factory->NewFromCanBeCompressString(keyArray)); + key_array[3] = '1' + i; + JSHandle key(factory->NewFromCanBeCompressString(key_array)); auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(map.GetTaggedValue()); @@ -223,10 +223,10 @@ TEST_F(BuiltinsMapTest, DeleteAndRemove) JSHandle map(thread, CreateBuiltinsMap(thread)); // add 40 keys - char keyArray[] = "key0"; + char key_array[] = "key0"; for (int i = 0; i < 40; i++) { - keyArray[3] = '1' + i; - JSHandle key(thread, factory->NewFromCanBeCompressString(keyArray).GetTaggedValue()); + key_array[3] = '1' + i; + JSHandle key(thread, factory->NewFromCanBeCompressString(key_array).GetTaggedValue()); auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(map.GetTaggedValue()); @@ -241,8 +241,8 @@ TEST_F(BuiltinsMapTest, DeleteAndRemove) EXPECT_EQ(jsMap->GetSize(), i + 1); } // whether jsMap has delete key - keyArray[3] = '1' + 8; - JSHandle deleteKey(factory->NewFromCanBeCompressString(keyArray)); + key_array[3] = '1' + 8; + JSHandle deleteKey(factory->NewFromCanBeCompressString(key_array)); auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo1->SetFunction(JSTaggedValue::Undefined()); @@ -283,12 +283,12 @@ TEST_F(BuiltinsMapTest, Species) JSHandle speciesSymbol = env->GetSpeciesSymbol(); EXPECT_TRUE(!speciesSymbol.GetTaggedValue().IsUndefined()); - JSHandle newTarget(env->GetBuiltinsMapFunction()); + JSHandle new_target(env->GetBuiltinsMapFunction()); JSTaggedValue value = - JSObject::GetProperty(thread, JSHandle(newTarget), speciesSymbol).GetValue().GetTaggedValue(); + JSObject::GetProperty(thread, JSHandle(new_target), speciesSymbol).GetValue().GetTaggedValue(); JSHandle valueHandle(thread, value); - EXPECT_EQ(value, newTarget.GetTaggedValue()); + EXPECT_EQ(value, new_target.GetTaggedValue()); // to string tag JSHandle toStringTagSymbol = env->GetToStringTagSymbol(); diff --git a/tests/runtime/builtins/builtins_object_test.cpp b/tests/runtime/builtins/builtins_object_test.cpp index fbe6c908d..0fd1c1d3d 100644 --- a/tests/runtime/builtins/builtins_object_test.cpp +++ b/tests/runtime/builtins/builtins_object_test.cpp @@ -63,8 +63,8 @@ public: JSTaggedValue CreateBuiltinJSObject(JSThread *thread, const PandaString keyCStr) { EcmaVM *ecmaVM = thread->GetEcmaVM(); - JSHandle globalEnv = ecmaVM->GetGlobalEnv(); - JSHandle objFun = globalEnv->GetObjectFunction(); + JSHandle global_env = ecmaVM->GetGlobalEnv(); + JSHandle objFun = global_env->GetObjectFunction(); ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); JSHandle obj(factory->NewJSObjectByConstructor(JSHandle(objFun), objFun)); @@ -77,8 +77,8 @@ JSTaggedValue CreateBuiltinJSObject(JSThread *thread, const PandaString keyCStr) JSFunction *BuiltinsObjectTestCreate(JSThread *thread) { EcmaVM *ecmaVM = thread->GetEcmaVM(); - JSHandle globalEnv = ecmaVM->GetGlobalEnv(); - return globalEnv->GetObjectFunction().GetObject(); + JSHandle global_env = ecmaVM->GetGlobalEnv(); + return global_env->GetObjectFunction().GetObject(); } JSObject *TestNewJSObject(JSThread *thread, const JSHandle &dynClass) @@ -95,8 +95,8 @@ TEST_F(BuiltinsObjectTest, ObjectConstructor) { JSHandle function(thread, BuiltinsObjectTestCreate(thread)); JSHandle objectFunc(thread, BuiltinsObjectTestCreate(thread)); - JSHandle globalEnv = thread->GetEcmaVM()->GetGlobalEnv(); - JSHandle objFun(globalEnv->GetObjectFunction()); + JSHandle global_env = thread->GetEcmaVM()->GetGlobalEnv(); + JSHandle objFun(global_env->GetObjectFunction()); auto objCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); objCallInfo->SetFunction(JSTaggedValue::Undefined()); diff --git a/tests/runtime/builtins/builtins_proxy_test.cpp b/tests/runtime/builtins/builtins_proxy_test.cpp index b721cec31..8c03f45d7 100644 --- a/tests/runtime/builtins/builtins_proxy_test.cpp +++ b/tests/runtime/builtins/builtins_proxy_test.cpp @@ -61,8 +61,8 @@ public: JSHandle BuiltinsTestProxyCreate(JSThread *thread) { EcmaVM *ecmaVM = thread->GetEcmaVM(); - JSHandle globalEnv = ecmaVM->GetGlobalEnv(); - JSHandle objFun(globalEnv->GetObjectFunction()); + JSHandle global_env = ecmaVM->GetGlobalEnv(); + JSHandle objFun(global_env->GetObjectFunction()); ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); JSHandle obj = factory->NewJSObjectByConstructor(JSHandle(objFun), objFun); @@ -94,8 +94,8 @@ TEST_F(BuiltinsProxyTest, Revocable) JSHandle target = BuiltinsTestProxyCreate(thread); JSHandle handler = BuiltinsTestProxyCreate(thread); - JSHandle globalEnv = thread->GetEcmaVM()->GetGlobalEnv(); - JSHandle proxyFun(globalEnv->GetProxyFunction()); + JSHandle global_env = thread->GetEcmaVM()->GetGlobalEnv(); + JSHandle proxyFun(global_env->GetProxyFunction()); JSHandle key(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("prop")); PropertyDescriptor desc(thread); desc.SetWritable(false); diff --git a/tests/runtime/builtins/builtins_reflect_test.cpp b/tests/runtime/builtins/builtins_reflect_test.cpp index e46255cae..2fa72e65c 100644 --- a/tests/runtime/builtins/builtins_reflect_test.cpp +++ b/tests/runtime/builtins/builtins_reflect_test.cpp @@ -137,7 +137,7 @@ TEST_F(BuiltinsReflectTest, ReflectApply) JSHandle(factory->NewFromCanBeCompressString("test_reflect_apply_b"))); } -// Reflect.construct (target, argumentsList [ , newTarget]) +// Reflect.construct (target, argumentsList [ , new_target]) TEST_F(BuiltinsReflectTest, ReflectConstruct) { JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); diff --git a/tests/runtime/builtins/builtins_regexp_test.cpp b/tests/runtime/builtins/builtins_regexp_test.cpp index 96407f39d..bd59a2e44 100644 --- a/tests/runtime/builtins/builtins_regexp_test.cpp +++ b/tests/runtime/builtins/builtins_regexp_test.cpp @@ -558,11 +558,11 @@ TEST_F(BuiltinsRegExpTest, GetSpecies) JSHandle speciesSymbol = env->GetSpeciesSymbol(); EXPECT_TRUE(!speciesSymbol.GetTaggedValue().IsUndefined()); - JSHandle newTarget(env->GetRegExpFunction()); + JSHandle new_target(env->GetRegExpFunction()); JSTaggedValue value = - JSObject::GetProperty(thread, JSHandle(newTarget), speciesSymbol).GetValue().GetTaggedValue(); - EXPECT_EQ(value, newTarget.GetTaggedValue()); + JSObject::GetProperty(thread, JSHandle(new_target), speciesSymbol).GetValue().GetTaggedValue(); + EXPECT_EQ(value, new_target.GetTaggedValue()); } TEST_F(BuiltinsRegExpTest, Replace1) diff --git a/tests/runtime/builtins/builtins_set_test.cpp b/tests/runtime/builtins/builtins_set_test.cpp index 9be2b958f..cceb876ed 100644 --- a/tests/runtime/builtins/builtins_set_test.cpp +++ b/tests/runtime/builtins/builtins_set_test.cpp @@ -82,10 +82,10 @@ public: JSSet *CreateBuiltinsSet(JSThread *thread) { JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); - JSHandle newTarget(env->GetBuiltinsSetFunction()); + JSHandle new_target(env->GetBuiltinsSetFunction()); // 4 : test case - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue(*newTarget), 4); - ecmaRuntimeCallInfo->SetFunction(newTarget.GetTaggedValue()); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue(*new_target), 4); + ecmaRuntimeCallInfo->SetFunction(new_target.GetTaggedValue()); ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); @@ -99,7 +99,7 @@ TEST_F(BuiltinsSetTest, CreateAndGetSize) { ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); - JSHandle newTarget(env->GetBuiltinsSetFunction()); + JSHandle new_target(env->GetBuiltinsSetFunction()); JSHandle set(thread, CreateBuiltinsSet(thread)); auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); @@ -120,10 +120,10 @@ TEST_F(BuiltinsSetTest, CreateAndGetSize) JSHandle values = JSArray::CreateArrayFromList(thread, array); auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); - ecmaRuntimeCallInfo1->SetFunction(newTarget.GetTaggedValue()); + ecmaRuntimeCallInfo1->SetFunction(new_target.GetTaggedValue()); ecmaRuntimeCallInfo1->SetThis(set.GetTaggedValue()); ecmaRuntimeCallInfo1->SetCallArg(0, values.GetTaggedValue()); - ecmaRuntimeCallInfo1->SetNewTarget(newTarget.GetTaggedValue()); + ecmaRuntimeCallInfo1->SetNewTarget(new_target.GetTaggedValue()); { [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); JSTaggedValue result1 = BuiltinsSet::SetConstructor(ecmaRuntimeCallInfo1.get()); @@ -196,10 +196,10 @@ TEST_F(BuiltinsSetTest, ForEach) // generate a set has 5 entry{key1,key2,key3,key4,key5} ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); JSHandle set(thread, CreateBuiltinsSet(thread)); - char keyArray[] = "key0"; + char key_array[] = "key0"; for (int i = 0; i < 5; i++) { - keyArray[3] = '1' + i; - JSHandle key(factory->NewFromCanBeCompressString(keyArray)); + key_array[3] = '1' + i; + JSHandle key(factory->NewFromCanBeCompressString(key_array)); auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(set.GetTaggedValue()); @@ -237,10 +237,10 @@ TEST_F(BuiltinsSetTest, DeleteAndRemove) JSHandle set(thread, CreateBuiltinsSet(thread)); // add 40 keys - char keyArray[] = "key0"; + char key_array[] = "key0"; for (int i = 0; i < 40; i++) { - keyArray[3] = '1' + i; - JSHandle key(factory->NewFromCanBeCompressString(keyArray)); + key_array[3] = '1' + i; + JSHandle key(factory->NewFromCanBeCompressString(key_array)); auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); @@ -255,8 +255,8 @@ TEST_F(BuiltinsSetTest, DeleteAndRemove) EXPECT_EQ(jsSet->GetSize(), i + 1); } // whether jsSet has delete key - keyArray[3] = '1' + 8; - JSHandle deleteKey(factory->NewFromCanBeCompressString(keyArray)); + key_array[3] = '1' + 8; + JSHandle deleteKey(factory->NewFromCanBeCompressString(key_array)); auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo1->SetFunction(JSTaggedValue::Undefined()); @@ -296,12 +296,12 @@ TEST_F(BuiltinsSetTest, Species) JSHandle speciesSymbol = env->GetSpeciesSymbol(); EXPECT_TRUE(!speciesSymbol->IsUndefined()); - JSHandle newTarget(env->GetBuiltinsSetFunction()); + JSHandle new_target(env->GetBuiltinsSetFunction()); JSTaggedValue value = - JSObject::GetProperty(thread, JSHandle(newTarget), speciesSymbol).GetValue().GetTaggedValue(); + JSObject::GetProperty(thread, JSHandle(new_target), speciesSymbol).GetValue().GetTaggedValue(); JSHandle valueHandle(thread, value); - EXPECT_EQ(value, newTarget.GetTaggedValue()); + EXPECT_EQ(value, new_target.GetTaggedValue()); // to string tag JSHandle toStringTagSymbol = env->GetToStringTagSymbol(); diff --git a/tests/runtime/builtins/builtins_string_test.cpp b/tests/runtime/builtins/builtins_string_test.cpp index 1ab23e738..53102f817 100644 --- a/tests/runtime/builtins/builtins_string_test.cpp +++ b/tests/runtime/builtins/builtins_string_test.cpp @@ -1056,8 +1056,8 @@ TEST_F(BuiltinsStringTest, ValueOf) static inline JSFunction *BuiltinsStringTestCreate(JSThread *thread) { EcmaVM *ecmaVM = thread->GetEcmaVM(); - JSHandle globalEnv = ecmaVM->GetGlobalEnv(); - return globalEnv->GetObjectFunction().GetObject(); + JSHandle global_env = ecmaVM->GetGlobalEnv(); + return global_env->GetObjectFunction().GetObject(); } TEST_F(BuiltinsStringTest, Raw) diff --git a/tests/runtime/builtins/builtins_weak_map_test.cpp b/tests/runtime/builtins/builtins_weak_map_test.cpp index 2af7d22bd..0e4aaa5a5 100644 --- a/tests/runtime/builtins/builtins_weak_map_test.cpp +++ b/tests/runtime/builtins/builtins_weak_map_test.cpp @@ -71,18 +71,18 @@ static JSObject *JSObjectTestCreate(JSThread *thread) EcmaVM *ecmaVM = thread->GetEcmaVM(); ObjectFactory *factory = ecmaVM->GetFactory(); [[maybe_unused]] EcmaHandleScope scope(thread); - JSHandle globalEnv = ecmaVM->GetGlobalEnv(); - JSHandle jsFunc = globalEnv->GetObjectFunction(); + JSHandle global_env = ecmaVM->GetGlobalEnv(); + JSHandle jsFunc = global_env->GetObjectFunction(); return *factory->NewJSObjectByConstructor(JSHandle(jsFunc), jsFunc); } JSWeakMap *CreateBuiltinsWeakMap(JSThread *thread) { JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); - JSHandle newTarget(env->GetBuiltinsWeakMapFunction()); + JSHandle new_target(env->GetBuiltinsWeakMapFunction()); // 4 : test case - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, newTarget.GetTaggedValue(), 4); - ecmaRuntimeCallInfo->SetFunction(newTarget.GetTaggedValue()); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, new_target.GetTaggedValue(), 4); + ecmaRuntimeCallInfo->SetFunction(new_target.GetTaggedValue()); ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); @@ -97,7 +97,7 @@ TEST_F(BuiltinsWeakMapTest, CreateAndGetSize) { ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); - JSHandle newTarget(env->GetBuiltinsWeakMapFunction()); + JSHandle new_target(env->GetBuiltinsWeakMapFunction()); JSHandle map(thread, CreateBuiltinsWeakMap(thread)); JSHandle array(factory->NewTaggedArray(1)); @@ -111,10 +111,10 @@ TEST_F(BuiltinsWeakMapTest, CreateAndGetSize) JSHandle values = JSArray::CreateArrayFromList(thread, array); auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); - ecmaRuntimeCallInfo->SetFunction(newTarget.GetTaggedValue()); + ecmaRuntimeCallInfo->SetFunction(new_target.GetTaggedValue()); ecmaRuntimeCallInfo->SetThis(map.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, values.GetTaggedValue()); - ecmaRuntimeCallInfo->SetNewTarget(newTarget.GetTaggedValue()); + ecmaRuntimeCallInfo->SetNewTarget(new_target.GetTaggedValue()); [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); diff --git a/tests/runtime/builtins/builtins_weak_set_test.cpp b/tests/runtime/builtins/builtins_weak_set_test.cpp index c8ae14bab..89ee90c8f 100644 --- a/tests/runtime/builtins/builtins_weak_set_test.cpp +++ b/tests/runtime/builtins/builtins_weak_set_test.cpp @@ -68,8 +68,8 @@ static JSObject *JSObjectTestCreate(JSThread *thread) { [[maybe_unused]] EcmaHandleScope scope(thread); EcmaVM *ecmaVM = thread->GetEcmaVM(); - JSHandle globalEnv = ecmaVM->GetGlobalEnv(); - JSHandle jsFunc = globalEnv->GetObjectFunction(); + JSHandle global_env = ecmaVM->GetGlobalEnv(); + JSHandle jsFunc = global_env->GetObjectFunction(); JSHandle newObj = thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(jsFunc), jsFunc); return *newObj; @@ -78,11 +78,11 @@ static JSObject *JSObjectTestCreate(JSThread *thread) JSWeakSet *CreateBuiltinsWeakSet(JSThread *thread) { JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); - JSHandle newTarget(env->GetBuiltinsWeakSetFunction()); + JSHandle new_target(env->GetBuiltinsWeakSetFunction()); // 4 : test case - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue(*newTarget), 4); - ecmaRuntimeCallInfo->SetFunction(newTarget.GetTaggedValue()); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue(*new_target), 4); + ecmaRuntimeCallInfo->SetFunction(new_target.GetTaggedValue()); ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsWeakSet::WeakSetConstructor(ecmaRuntimeCallInfo.get()); @@ -96,7 +96,7 @@ TEST_F(BuiltinsWeakSetTest, CreateAndGetSize) { ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); - JSHandle newTarget(env->GetBuiltinsWeakSetFunction()); + JSHandle new_target(env->GetBuiltinsWeakSetFunction()); JSHandle weakSet(thread, CreateBuiltinsWeakSet(thread)); JSHandle array(factory->NewTaggedArray(5)); @@ -107,10 +107,10 @@ TEST_F(BuiltinsWeakSetTest, CreateAndGetSize) JSHandle values = JSArray::CreateArrayFromList(thread, array); auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); - ecmaRuntimeCallInfo->SetFunction(newTarget.GetTaggedValue()); + ecmaRuntimeCallInfo->SetFunction(new_target.GetTaggedValue()); ecmaRuntimeCallInfo->SetThis(weakSet.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, values.GetTaggedValue()); - ecmaRuntimeCallInfo->SetNewTarget(newTarget.GetTaggedValue()); + ecmaRuntimeCallInfo->SetNewTarget(new_target.GetTaggedValue()); [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); diff --git a/tests/runtime/common/huge_object_test.cpp b/tests/runtime/common/huge_object_test.cpp index e414aa8a9..6b7bb531f 100644 --- a/tests/runtime/common/huge_object_test.cpp +++ b/tests/runtime/common/huge_object_test.cpp @@ -56,8 +56,8 @@ static JSObject *JSObjectTestCreate(JSThread *thread) { [[maybe_unused]] ecmascript::EcmaHandleScope scope(thread); EcmaVM *ecmaVM = thread->GetEcmaVM(); - auto globalEnv = ecmaVM->GetGlobalEnv(); - JSHandle jsFunc = globalEnv->GetObjectFunction(); + auto global_env = ecmaVM->GetGlobalEnv(); + JSHandle jsFunc = global_env->GetObjectFunction(); JSHandle newObj = ecmaVM->GetFactory()->NewJSObjectByConstructor(JSHandle(jsFunc), jsFunc); return *newObj; } diff --git a/tests/runtime/common/js_arguments_test.cpp b/tests/runtime/common/js_arguments_test.cpp index c0ed517f7..a24c35175 100644 --- a/tests/runtime/common/js_arguments_test.cpp +++ b/tests/runtime/common/js_arguments_test.cpp @@ -52,8 +52,8 @@ public: static JSFunction *JSObjectTestCreate(JSThread *thread) { EcmaVM *ecmaVM = thread->GetEcmaVM(); - JSHandle globalEnv = ecmaVM->GetGlobalEnv(); - return globalEnv->GetObjectFunction().GetObject(); + JSHandle global_env = ecmaVM->GetGlobalEnv(); + return global_env->GetObjectFunction().GetObject(); } TEST_F(JsArgumentsTest, SetProperty) diff --git a/tests/runtime/common/js_function_test.cpp b/tests/runtime/common/js_function_test.cpp index 94c2cadca..a9115e0ec 100644 --- a/tests/runtime/common/js_function_test.cpp +++ b/tests/runtime/common/js_function_test.cpp @@ -130,8 +130,8 @@ TEST_F(JSFunctionTest, Invoke) thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle::Cast(dynclass), dynclass)); EXPECT_TRUE(*callee != nullptr); - char keyArray[] = "invoked"; - JSHandle calleeKey(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(&keyArray[0])); + char key_array[] = "invoked"; + JSHandle calleeKey(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(&key_array[0])); JSHandle calleeFunc = thread->GetEcmaVM()->GetFactory()->NewJSFunction(env, reinterpret_cast(TestInvokeInternal)); JSHandle calleeValue(calleeFunc); diff --git a/tests/runtime/common/js_proxy_test.cpp b/tests/runtime/common/js_proxy_test.cpp index 3b1dfd2e8..53e832ebb 100644 --- a/tests/runtime/common/js_proxy_test.cpp +++ b/tests/runtime/common/js_proxy_test.cpp @@ -599,7 +599,7 @@ JSTaggedValue HandlerConFunc([[maybe_unused]] EcmaRuntimeCallInfo *argv) return JSTaggedValue(obj.GetTaggedValue()); } -// ES6 9.5.14 [[Construct]] ( argumentsList, newTarget) +// ES6 9.5.14 [[Construct]] ( argumentsList, new_target) TEST_F(JSProxyTest, Construct) { ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); diff --git a/tests/runtime/common/js_serializer_test.cpp b/tests/runtime/common/js_serializer_test.cpp index 26a526bfa..84c9fc623 100644 --- a/tests/runtime/common/js_serializer_test.cpp +++ b/tests/runtime/common/js_serializer_test.cpp @@ -198,12 +198,12 @@ public: JSHandle retArray = JSHandle::Cast(arrayValue); - JSHandle keyArray = JSObject::GetOwnPropertyKeys(thread, JSHandle(retArray)); - int propertyLength = keyArray->GetLength(); + JSHandle key_array = JSObject::GetOwnPropertyKeys(thread, JSHandle(retArray)); + int propertyLength = key_array->GetLength(); EXPECT_EQ(propertyLength, 23); // 23 : test case int sum = 0; for (int i = 0; i < propertyLength; i++) { - JSHandle key(thread, keyArray->Get(i)); + JSHandle key(thread, key_array->Get(i)); double a = JSObject::GetProperty(thread, JSHandle(retArray), key).GetValue()->GetNumber(); sum += a; } @@ -752,8 +752,8 @@ TEST_F(JSSerializerTest, SerializeDouble) JSDate *JSDateCreate(EcmaVM *ecmaVM) { ObjectFactory *factory = ecmaVM->GetFactory(); - JSHandle globalEnv = ecmaVM->GetGlobalEnv(); - JSHandle dateFunction = globalEnv->GetDateFunction(); + JSHandle global_env = ecmaVM->GetGlobalEnv(); + JSHandle dateFunction = global_env->GetDateFunction(); JSHandle dateObject = JSHandle::Cast(factory->NewJSObjectByConstructor(JSHandle(dateFunction), dateFunction)); return *dateObject; diff --git a/tests/runtime/common/linked_hash_table_test.cpp b/tests/runtime/common/linked_hash_table_test.cpp index 5ca6f2dd9..edac816b1 100644 --- a/tests/runtime/common/linked_hash_table_test.cpp +++ b/tests/runtime/common/linked_hash_table_test.cpp @@ -85,8 +85,8 @@ TEST_F(LinkedHashTableTest, addKeyAndValue) EXPECT_TRUE(*dictHandle != nullptr); JSHandle objFun = GetGlobalEnv()->GetObjectFunction(); - char keyArray[] = "hello"; - JSHandle stringKey1 = factory->NewFromCanBeCompressString(keyArray); + char key_array[] = "hello"; + JSHandle stringKey1 = factory->NewFromCanBeCompressString(key_array); JSHandle key1(stringKey1); JSHandle value1(factory->NewJSObjectByConstructor(JSHandle(objFun), objFun)); @@ -128,8 +128,8 @@ TEST_F(LinkedHashTableTest, SetaddKeyAndValue) EXPECT_TRUE(*setHandle != nullptr); JSHandle objFun = GetGlobalEnv()->GetObjectFunction(); - char keyArray[] = "hello"; - JSHandle stringKey1 = factory->NewFromCanBeCompressString(keyArray); + char key_array[] = "hello"; + JSHandle stringKey1 = factory->NewFromCanBeCompressString(key_array); JSHandle key1(stringKey1); JSHandle value1(factory->NewJSObjectByConstructor(JSHandle(objFun), objFun)); @@ -166,11 +166,11 @@ TEST_F(LinkedHashTableTest, GrowCapacity) JSHandle dictHandle = LinkedHashMap::Create(thread, numOfElement); EXPECT_TRUE(*dictHandle != nullptr); JSHandle objFun(GetGlobalEnv()->GetObjectFunction()); - char keyArray[7] = "hello"; + char key_array[7] = "hello"; for (int i = 0; i < 33; i++) { - keyArray[5] = '1' + i; - keyArray[6] = 0; - JSHandle key(factory->NewFromCanBeCompressString(keyArray)); + key_array[5] = '1' + i; + key_array[6] = 0; + JSHandle key(factory->NewFromCanBeCompressString(key_array)); JSHandle value(thread, JSTaggedValue(i)); // test insert() @@ -181,9 +181,9 @@ TEST_F(LinkedHashTableTest, GrowCapacity) // test order for (int i = 0; i < 33; i++) { - keyArray[5] = '1' + i; - keyArray[6] = 0; - JSHandle stringKey = factory->NewFromCanBeCompressString(keyArray); + key_array[5] = '1' + i; + key_array[6] = 0; + JSHandle stringKey = factory->NewFromCanBeCompressString(key_array); // test insert() int hash = LinkedHash::Hash(stringKey.GetTaggedValue()); EXPECT_EQ(i, dictHandle->FindElement(stringKey.GetTaggedValue(), hash)); @@ -200,11 +200,11 @@ TEST_F(LinkedHashTableTest, SetGrowCapacity) EXPECT_TRUE(*setHandle != nullptr); JSHandle objFun(GetGlobalEnv()->GetObjectFunction()); // create key and values - char keyArray[7] = "hello"; + char key_array[7] = "hello"; for (int i = 0; i < 33; i++) { - keyArray[5] = '1' + i; - keyArray[6] = 0; - JSHandle stringKey = factory->NewFromCanBeCompressString(keyArray); + key_array[5] = '1' + i; + key_array[6] = 0; + JSHandle stringKey = factory->NewFromCanBeCompressString(key_array); JSHandle key(stringKey); // test insert() @@ -215,9 +215,9 @@ TEST_F(LinkedHashTableTest, SetGrowCapacity) // test order for (int i = 0; i < 33; i++) { - keyArray[5] = '1' + i; - keyArray[6] = 0; - JSHandle stringKey = factory->NewFromCanBeCompressString(keyArray); + key_array[5] = '1' + i; + key_array[6] = 0; + JSHandle stringKey = factory->NewFromCanBeCompressString(key_array); // test insert() int hash = LinkedHash::Hash(stringKey.GetTaggedValue()); EXPECT_EQ(i, setHandle->FindElement(stringKey.GetTaggedValue(), hash)); @@ -233,24 +233,24 @@ TEST_F(LinkedHashTableTest, ShrinkCapacity) JSHandle dictHandle = LinkedHashMap::Create(thread, numOfElement); EXPECT_TRUE(*dictHandle != nullptr); JSHandle objFun(GetGlobalEnv()->GetObjectFunction()); - char keyArray[7] = "hello"; + char key_array[7] = "hello"; for (int i = 0; i < 10; i++) { - keyArray[5] = '1' + i; - keyArray[6] = 0; - JSHandle key(factory->NewFromCanBeCompressString(keyArray)); + key_array[5] = '1' + i; + key_array[6] = 0; + JSHandle key(factory->NewFromCanBeCompressString(key_array)); JSHandle value(thread, JSTaggedValue(i)); // test insert() dictHandle = LinkedHashMap::Set(thread, dictHandle, key, value); } - keyArray[5] = '1' + 9; - JSHandle key(factory->NewFromCanBeCompressString(keyArray)); + key_array[5] = '1' + 9; + JSHandle key(factory->NewFromCanBeCompressString(key_array)); dictHandle = LinkedHashMap::Delete(thread, dictHandle, key); // test order for (int i = 0; i < 9; i++) { - keyArray[5] = '1' + i; - keyArray[6] = 0; - JSHandle stringKey = factory->NewFromCanBeCompressString(keyArray); + key_array[5] = '1' + i; + key_array[6] = 0; + JSHandle stringKey = factory->NewFromCanBeCompressString(key_array); // test insert() int hash = LinkedHash::Hash(stringKey.GetTaggedValue()); EXPECT_EQ(i, dictHandle->FindElement(stringKey.GetTaggedValue(), hash)); @@ -267,23 +267,23 @@ TEST_F(LinkedHashTableTest, SetShrinkCapacity) EXPECT_TRUE(*setHandle != nullptr); JSHandle objFun(GetGlobalEnv()->GetObjectFunction()); // create key and values - char keyArray[7] = "hello"; + char key_array[7] = "hello"; for (int i = 0; i < 10; i++) { - keyArray[5] = '1' + i; - keyArray[6] = 0; - JSHandle key(factory->NewFromCanBeCompressString(keyArray)); + key_array[5] = '1' + i; + key_array[6] = 0; + JSHandle key(factory->NewFromCanBeCompressString(key_array)); // test insert() setHandle = LinkedHashSet::Add(thread, setHandle, key); } - keyArray[5] = '1' + 9; - JSHandle keyHandle(factory->NewFromCanBeCompressString(keyArray)); + key_array[5] = '1' + 9; + JSHandle keyHandle(factory->NewFromCanBeCompressString(key_array)); setHandle = LinkedHashSet::Delete(thread, setHandle, keyHandle); // test order for (int i = 0; i < 9; i++) { - keyArray[5] = '1' + i; - keyArray[6] = 0; - JSHandle stringKey = factory->NewFromCanBeCompressString(keyArray); + key_array[5] = '1' + i; + key_array[6] = 0; + JSHandle stringKey = factory->NewFromCanBeCompressString(key_array); // test insert() int hash = LinkedHash::Hash(stringKey.GetTaggedValue()); EXPECT_EQ(i, setHandle->FindElement(stringKey.GetTaggedValue(), hash)); diff --git a/tests/runtime/common/name_dictionary_test.cpp b/tests/runtime/common/name_dictionary_test.cpp index 9a9de1470..c8423c956 100644 --- a/tests/runtime/common/name_dictionary_test.cpp +++ b/tests/runtime/common/name_dictionary_test.cpp @@ -86,8 +86,8 @@ TEST_F(NameDictionaryTest, addKeyAndValue) thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(objFun), objFun); EXPECT_TRUE(*jsObject != nullptr); - char keyArray[] = "hello"; - JSHandle stringKey1 = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(keyArray); + char key_array[] = "hello"; + JSHandle stringKey1 = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(key_array); JSHandle key1(stringKey1); JSHandle taggedkey1(stringKey1); JSHandle value1( @@ -130,21 +130,21 @@ TEST_F(NameDictionaryTest, GrowCapacity) JSHandle jsObject = thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(objFun), objFun); EXPECT_TRUE(*jsObject != nullptr); - char keyArray[7] = "hello"; + char key_array[7] = "hello"; for (int i = 0; i < 9; i++) { JSHandle tempHandle = dictHandle; - keyArray[5] = '1' + i; - keyArray[6] = 0; + key_array[5] = '1' + i; + key_array[6] = 0; - JSHandle stringKey = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(keyArray); + JSHandle stringKey = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(key_array); ecmascript::JSHandle key(stringKey); JSHandle keyHandle(key); ecmascript::JSHandle value(thread, JSTaggedValue(i)); JSHandle valueHandle(value); - PropertyAttributes metaData; + PropertyAttributes meta_data; // test insert() - dictHandle = NameDictionary::PutIfAbsent(thread, tempHandle, keyHandle, valueHandle, metaData); + dictHandle = NameDictionary::PutIfAbsent(thread, tempHandle, keyHandle, valueHandle, meta_data); } EXPECT_EQ(dictHandle->EntriesCount(), 9); EXPECT_EQ(dictHandle->Size(), 16); @@ -160,26 +160,26 @@ TEST_F(NameDictionaryTest, ShrinkCapacity) JSHandle jsObject = thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(objFun), objFun); EXPECT_TRUE(*jsObject != nullptr); - uint8_t keyArray[7] = "hello"; + uint8_t key_array[7] = "hello"; auto stringTable = thread->GetEcmaVM()->GetEcmaStringTable(); for (int i = 0; i < 10; i++) { - keyArray[5] = '0' + i; - keyArray[6] = 0; + key_array[5] = '0' + i; + key_array[6] = 0; - JSHandle key(thread, stringTable->GetOrInternString(keyArray, utf::Mutf8Size(keyArray), true)); + JSHandle key(thread, stringTable->GetOrInternString(key_array, utf::Mutf8Size(key_array), true)); JSHandle value(thread, JSTaggedValue(i)); - PropertyAttributes metaData; + PropertyAttributes meta_data; // test insert() - JSHandle newDict = NameDictionary::PutIfAbsent(thread, dictHandle, key, value, metaData); + JSHandle newDict = NameDictionary::PutIfAbsent(thread, dictHandle, key, value, meta_data); dictHandle.Update(newDict.GetTaggedValue()); } - keyArray[5] = '2'; - keyArray[6] = 0; + key_array[5] = '2'; + key_array[6] = 0; JSHandle arrayHandle(thread, - stringTable->GetOrInternString(keyArray, utf::Mutf8Size(keyArray), true)); + stringTable->GetOrInternString(key_array, utf::Mutf8Size(key_array), true)); int entry = dictHandle->FindEntry(arrayHandle.GetTaggedValue()); EXPECT_NE(entry, -1); diff --git a/tests/runtime/common/symbol_table_test.cpp b/tests/runtime/common/symbol_table_test.cpp index a5505ad5a..578927032 100644 --- a/tests/runtime/common/symbol_table_test.cpp +++ b/tests/runtime/common/symbol_table_test.cpp @@ -161,12 +161,12 @@ TEST_F(SymbolTableTest, Hash_Utf16) */ TEST_F(SymbolTableTest, Create) { - int numberOfElements = SymbolTable::DEFAULT_ELEMENTS_NUMBER; + int number_of_elements = SymbolTable::DEFAULT_ELEMENTS_NUMBER; // the CompressedStringsEnabled must be true bool flag = EcmaString::GetCompressedStringsEnabled(); EXPECT_EQ(flag, true); - JSHandle symbolTable = SymbolTable::Create(thread, numberOfElements); + JSHandle symbolTable = SymbolTable::Create(thread, number_of_elements); EXPECT_TRUE(*symbolTable != nullptr); } @@ -185,8 +185,8 @@ TEST_F(SymbolTableTest, ContainsKey) JSHandle symbolTableStringKey2 = factory->NewFromCanBeCompressString("key1"); JSHandle symbolTableStringKey3 = factory->NewFromCanBeCompressString("value"); - int numberOfElements = 2; - JSHandle symbolTable = SymbolTable::Create(thread, numberOfElements); + int number_of_elements = 2; + JSHandle symbolTable = SymbolTable::Create(thread, number_of_elements); EXPECT_EQ(symbolTable->ContainsKey(thread, symbolTableStringKey1.GetTaggedValue()), false); symbolTable->SetKey(thread, 1, JSTaggedValue::Hole()); @@ -217,10 +217,10 @@ TEST_F(SymbolTableTest, ContainsKey) TEST_F(SymbolTableTest, GetSymbol) { ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - int numberOfElements = 2; + int number_of_elements = 2; JSHandle symbolTableStringKey = factory->NewFromCanBeCompressString("key"); - JSHandle symbolTable = SymbolTable::Create(thread, numberOfElements); + JSHandle symbolTable = SymbolTable::Create(thread, number_of_elements); symbolTable->SetKey(thread, 1, symbolTableStringKey.GetTaggedValue()); EXPECT_EQ(symbolTable->GetSymbol(symbolTableStringKey.GetTaggedValue()), JSTaggedValue::Undefined()); @@ -248,9 +248,9 @@ TEST_F(SymbolTableTest, FindSymbol) JSHandle symbolTableStringKey1(factory->NewFromCanBeCompressString("key")); JSHandle symbolTableStringKey2(factory->NewFromCanBeCompressString("key1")); - int numberOfElements = 2; + int number_of_elements = 2; JSHandle handleSymbol = factory->NewJSSymbol(); - JSHandle symbolTable = SymbolTable::Create(thread, numberOfElements); + JSHandle symbolTable = SymbolTable::Create(thread, number_of_elements); JSTaggedValue resultValue1 = symbolTable->FindSymbol(thread, handleSymbol.GetTaggedValue()); EXPECT_EQ(JSTaggedValue::SameValue(resultValue1, JSTaggedValue::Undefined()), true); diff --git a/tests/runtime/common/test_helper.h b/tests/runtime/common/test_helper.h index 5a24c1e2d..d2a0662a2 100644 --- a/tests/runtime/common/test_helper.h +++ b/tests/runtime/common/test_helper.h @@ -58,10 +58,10 @@ public: thread = EcmaVM::Cast(instance)->GetAssociatedJSThread(); scope = new EcmaHandleScope(thread); EcmaVM *ecmaVm = thread->GetEcmaVM(); - auto globalEnv = ecmaVm->GetGlobalEnv(); + auto global_env = ecmaVm->GetGlobalEnv(); { ScopedManagedCodeThread s(thread); - methodFunction_ = ecmaVm->GetFactory()->NewJSFunction(globalEnv); + methodFunction_ = ecmaVm->GetFactory()->NewJSFunction(global_env); } if (enter_managed_code) { thread->ManagedCodeBegin(); diff --git a/tests/runtime/ic/ic_invoke_test.cpp b/tests/runtime/ic/ic_invoke_test.cpp index 2fd40d355..45071841d 100644 --- a/tests/runtime/ic/ic_invoke_test.cpp +++ b/tests/runtime/ic/ic_invoke_test.cpp @@ -54,9 +54,9 @@ public: TEST_F(ICInvokeTest, SetMonoConstuctCacheSlot) { - auto globalEnv = ecmaVm->GetGlobalEnv(); + auto global_env = ecmaVm->GetGlobalEnv(); auto factory = ecmaVm->GetFactory(); - JSHandle func = factory->NewJSFunction(globalEnv); + JSHandle func = factory->NewJSFunction(global_env); func.GetTaggedValue().GetTaggedObject()->GetClass()->SetClassConstructor(true); JSHandle array = factory->NewTaggedArray(10); @@ -70,20 +70,20 @@ TEST_F(ICInvokeTest, SetMonoConstuctCacheSlot) TEST_F(ICInvokeTest, SetPolyConstuctCacheSlot) { - auto globalEnv = ecmaVm->GetGlobalEnv(); + auto global_env = ecmaVm->GetGlobalEnv(); auto factory = ecmaVm->GetFactory(); JSHandle array1 = factory->NewTaggedArray(3); JSHandle array2 = factory->NewTaggedArray(3); - JSHandle func0 = factory->NewJSFunction(globalEnv); + JSHandle func0 = factory->NewJSFunction(global_env); func0.GetTaggedValue().GetTaggedObject()->GetClass()->SetClassConstructor(true); array1->Set(thread, 0, func0.GetTaggedValue()); array2->Set(thread, 0, JSTaggedValue(123)); - JSHandle func1 = factory->NewJSFunction(globalEnv); + JSHandle func1 = factory->NewJSFunction(global_env); func1.GetTaggedValue().GetTaggedObject()->GetClass()->SetClassConstructor(true); array1->Set(thread, 1, func1.GetTaggedValue()); array2->Set(thread, 1, JSTaggedValue(456)); - JSHandle func2 = factory->NewJSFunction(globalEnv); + JSHandle func2 = factory->NewJSFunction(global_env); func2.GetTaggedValue().GetTaggedObject()->GetClass()->SetClassConstructor(true); array1->Set(thread, 2, func2.GetTaggedValue()); array2->Set(thread, 2, JSTaggedValue(789)); @@ -107,14 +107,14 @@ TEST_F(ICInvokeTest, SetPolyConstuctCacheSlot) TEST_F(ICInvokeTest, CheckPolyInvokeCache) { - auto globalEnv = ecmaVm->GetGlobalEnv(); + auto global_env = ecmaVm->GetGlobalEnv(); auto factory = ecmaVm->GetFactory(); JSHandle array = factory->NewTaggedArray(6); - JSHandle func0 = factory->NewJSFunction(globalEnv); - JSHandle func1 = factory->NewJSFunction(globalEnv); - JSHandle func2 = factory->NewJSFunction(globalEnv); - JSHandle func3 = factory->NewJSFunction(globalEnv); + JSHandle func0 = factory->NewJSFunction(global_env); + JSHandle func1 = factory->NewJSFunction(global_env); + JSHandle func2 = factory->NewJSFunction(global_env); + JSHandle func3 = factory->NewJSFunction(global_env); array->Set(thread, 0, func0.GetTaggedValue()); array->Set(thread, 1, JSTaggedValue(123)); array->Set(thread, 2, func1.GetTaggedValue()); diff --git a/tests/runtime/tooling/api_tests/js/js_set_variable_test.h b/tests/runtime/tooling/api_tests/js/js_set_variable_test.h index 9e92062ad..9b6a051cb 100644 --- a/tests/runtime/tooling/api_tests/js/js_set_variable_test.h +++ b/tests/runtime/tooling/api_tests/js/js_set_variable_test.h @@ -93,8 +93,8 @@ private: { JSThread *jsThread = JSThread::Cast(JSThread::GetCurrent()); auto ecmaVm = jsThread->GetEcmaVM(); - panda::ecmascript::JSHandle globalEnv = ecmaVm->GetGlobalEnv(); - auto globalObject = globalEnv->GetGlobalObject(); + panda::ecmascript::JSHandle global_env = ecmaVm->GetGlobalEnv(); + auto globalObject = global_env->GetGlobalObject(); panda::ecmascript::ObjectFactory *factory = ecmaVm->GetFactory(); panda::ecmascript::JSHandle execHandle( -- Gitee