diff --git a/patch1-all-ecma.txt b/patch1-all-ecma.txt new file mode 100755 index 0000000000000000000000000000000000000000..ec5e272e7eed5a9998339c7d478543cc2388ffd7 --- /dev/null +++ b/patch1-all-ecma.txt @@ -0,0 +1,40596 @@ +diff --git a/runtime/base/json_parser.h b/runtime/base/json_parser.h +index 82f650e..74fe473 100644 +--- a/runtime/base/json_parser.h ++++ b/runtime/base/json_parser.h +@@ -77,7 +77,7 @@ public: + JSHandle ParseUtf8(EcmaString *str) + { + ASSERT(str != nullptr); +- isAsciiString_ = true; ++ is_ascii_string_ = true; + uint32_t len = str->GetUtf8Length(); + CVector buf(len); + str->CopyDataUtf8(buf.data(), len); +@@ -164,7 +164,7 @@ private: + bool ReadJsonStringRange(bool &isFastString, bool &isAscii) + { + current_++; +- if (isAsciiString_) { ++ if (is_ascii_string_) { + return ReadAsciiStringRange(isFastString); + } + return ReadStringRange(isFastString, isAscii); +@@ -173,7 +173,7 @@ private: + bool IsFastParseJsonString(bool &isFastString, bool &isAscii) + { + current_++; +- if (isAsciiString_) { ++ if (is_ascii_string_) { + return IsFastParseString(isFastString, isAscii); + } + return IsFastParseAsciiString(isFastString); +@@ -752,7 +752,7 @@ private: + return true; + } + +- bool isAsciiString_ {false}; ++ bool is_ascii_string_ {false}; + Text end_ {nullptr}; + Text current_ {nullptr}; + Text range_ {nullptr}; +diff --git a/runtime/base/json_stringifier.cpp b/runtime/base/json_stringifier.cpp +index b860b2f..4bb379d 100644 +--- a/runtime/base/json_stringifier.cpp ++++ b/runtime/base/json_stringifier.cpp +@@ -141,8 +141,8 @@ JSHandle JsonStringifier::Stringify(const JSHandle + const JSHandle &gap) + { + factory_ = thread_->GetEcmaVM()->GetFactory(); +- handleValue_.Update(JSTaggedValue::Undefined()); +- handleKey_.Update(JSTaggedValue::Undefined()); ++ handle_value_.Update(JSTaggedValue::Undefined()); ++ handle_key_.Update(JSTaggedValue::Undefined()); + // Let isArray be IsArray(replacer). + bool isArray = replacer->IsArray(thread_); + // ReturnIfAbrupt(isArray). +@@ -236,8 +236,8 @@ JSHandle JsonStringifier::Stringify(const JSHandle + + JSTaggedValue serializeValue = GetSerializeValue(JSHandle::Cast(wrapper), key, value, replacer); + RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSTaggedValue, thread_); +- handleValue_.Update(serializeValue); +- JSTaggedValue result = SerializeJSONProperty(handleValue_, replacer); ++ handle_value_.Update(serializeValue); ++ JSTaggedValue result = SerializeJSONProperty(handle_value_, replacer); + RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSTaggedValue, thread_); + if (!result.IsUndefined()) { + return JSHandle( +@@ -248,16 +248,16 @@ JSHandle JsonStringifier::Stringify(const JSHandle + + void JsonStringifier::AddDeduplicateProp(const JSHandle &property) + { +- uint32_t propLen = propList_.size(); ++ uint32_t propLen = prop_list_.size(); + for (uint32_t i = 0; i < propLen; i++) { +- if (JSTaggedValue::SameValue(propList_[i], property)) { ++ if (JSTaggedValue::SameValue(prop_list_[i], property)) { + return; + } + } + JSHandle primString = JSTaggedValue::ToString(thread_, property); + RETURN_IF_ABRUPT_COMPLETION(thread_); + JSHandle addVal(thread_, *primString); +- propList_.emplace_back(addVal); ++ prop_list_.emplace_back(addVal); + } + + bool JsonStringifier::CalculateNumberGap(JSTaggedValue gap) +@@ -314,10 +314,10 @@ JSTaggedValue JsonStringifier::GetSerializeValue(const JSHandle & + } + + if (UNLIKELY(replacer->IsCallable())) { +- handleValue_.Update(tagValue); ++ handle_value_.Update(tagValue); + // a. Let value be Call(ReplacerFunction, holder, «key, value»). + InternalCallParams *arguments = thread_->GetInternalCallParams(); +- arguments->MakeArgv(key, handleValue_); ++ arguments->MakeArgv(key, handle_value_); + tagValue = JSFunction::Call(thread_, replacer, object, 2, arguments->GetArgv()); // 2: two args + // b. ReturnIfAbrupt(value). + RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread_); +@@ -469,20 +469,20 @@ bool JsonStringifier::SerializeJSONObject(const JSHandle &value, + RETURN_VALUE_IF_ABRUPT_COMPLETION(thread_, false); + } + } else { +- uint32_t propLen = propList_.size(); ++ uint32_t propLen = prop_list_.size(); + for (uint32_t i = 0; i < propLen; i++) { + JSTaggedValue tagVal = +- FastRuntimeStub::FastGetPropertyByValue(thread_, obj.GetTaggedValue(), propList_[i].GetTaggedValue()); +- handleValue_.Update(tagVal); +- JSTaggedValue serializeValue = GetSerializeValue(value, propList_[i], handleValue_, replacer); ++ FastRuntimeStub::FastGetPropertyByValue(thread_, obj.GetTaggedValue(), prop_list_[i].GetTaggedValue()); ++ handle_value_.Update(tagVal); ++ JSTaggedValue serializeValue = GetSerializeValue(value, prop_list_[i], handle_value_, replacer); + RETURN_VALUE_IF_ABRUPT_COMPLETION(thread_, false); + if (UNLIKELY(serializeValue.IsUndefined() || serializeValue.IsSymbol() || + (serializeValue.IsECMAObject() && serializeValue.IsCallable()))) { + continue; + } +- handleValue_.Update(serializeValue); +- SerializeObjectKey(propList_[i], hasContent); +- JSTaggedValue res = SerializeJSONProperty(handleValue_, replacer); ++ handle_value_.Update(serializeValue); ++ SerializeObjectKey(prop_list_[i], hasContent); ++ JSTaggedValue res = SerializeJSONProperty(handle_value_, replacer); + RETURN_VALUE_IF_ABRUPT_COMPLETION(thread_, false); + if (!res.IsUndefined()) { + hasContent = true; +@@ -523,17 +523,17 @@ bool JsonStringifier::SerializeJSProxy(const JSHandle &object, co + RETURN_VALUE_IF_ABRUPT_COMPLETION(thread_, false); + uint32_t length = lenNumber.ToUint32(); + for (uint32_t i = 0; i < length; i++) { +- handleKey_.Update(JSTaggedValue(i)); +- JSHandle valHandle = JSProxy::GetProperty(thread_, proxy, handleKey_).GetValue(); ++ handle_key_.Update(JSTaggedValue(i)); ++ JSHandle valHandle = JSProxy::GetProperty(thread_, proxy, handle_key_).GetValue(); + RETURN_VALUE_IF_ABRUPT_COMPLETION(thread_, false); + if (i > 0) { + result_ += ","; + } + result_ += stepBegin; +- JSTaggedValue serializeValue = GetSerializeValue(object, handleKey_, valHandle, replacer); ++ JSTaggedValue serializeValue = GetSerializeValue(object, handle_key_, valHandle, replacer); + RETURN_VALUE_IF_ABRUPT_COMPLETION(thread_, false); +- handleValue_.Update(serializeValue); +- JSTaggedValue res = SerializeJSONProperty(handleValue_, replacer); ++ handle_value_.Update(serializeValue); ++ JSTaggedValue res = SerializeJSONProperty(handle_value_, replacer); + RETURN_VALUE_IF_ABRUPT_COMPLETION(thread_, false); + if (res.IsUndefined()) { + result_ += "null"; +@@ -575,17 +575,17 @@ bool JsonStringifier::SerializeJSArray(const JSHandle &value, con + if (UNLIKELY(tagVal.IsAccessor())) { + tagVal = JSObject::CallGetter(thread_, AccessorData::Cast(tagVal.GetTaggedObject()), value); + } +- handleValue_.Update(tagVal); +- handleKey_.Update(JSTaggedNumber(i).ToString(thread_).GetTaggedValue()); ++ handle_value_.Update(tagVal); ++ handle_key_.Update(JSTaggedNumber(i).ToString(thread_).GetTaggedValue()); + + if (i > 0) { + result_ += ","; + } + result_ += stepBegin; +- JSTaggedValue serializeValue = GetSerializeValue(value, handleKey_, handleValue_, replacer); ++ JSTaggedValue serializeValue = GetSerializeValue(value, handle_key_, handle_value_, replacer); + RETURN_VALUE_IF_ABRUPT_COMPLETION(thread_, false); +- handleValue_.Update(serializeValue); +- JSTaggedValue res = SerializeJSONProperty(handleValue_, replacer); ++ handle_value_.Update(serializeValue); ++ JSTaggedValue res = SerializeJSONProperty(handle_value_, replacer); + RETURN_VALUE_IF_ABRUPT_COMPLETION(thread_, false); + if (res.IsUndefined()) { + result_ += "null"; +@@ -634,8 +634,8 @@ bool JsonStringifier::SerializeElements(const JSHandle &obj, const JSH + uint32_t elementsLen = elementsArr->GetLength(); + for (uint32_t i = 0; i < elementsLen; ++i) { + if (!elementsArr->Get(i).IsHole()) { +- handleKey_.Update(JSTaggedValue(i)); +- handleValue_.Update(elementsArr->Get(i)); ++ handle_key_.Update(JSTaggedValue(i)); ++ handle_value_.Update(elementsArr->Get(i)); + hasContent = JsonStringifier::AppendJsonString(obj, replacer, hasContent); + RETURN_VALUE_IF_ABRUPT_COMPLETION(thread_, false); + } +@@ -657,10 +657,10 @@ bool JsonStringifier::SerializeElements(const JSHandle &obj, const JSH + std::sort(sortArr.begin(), sortArr.end(), CompareNumber); + for (const auto &entry : sortArr) { + JSTaggedValue entryKey = entry.GetTaggedValue(); +- handleKey_.Update(entryKey); ++ handle_key_.Update(entryKey); + int index = numberDic->FindEntry(entryKey); + JSTaggedValue value = numberDic->GetValue(index); +- handleValue_.Update(value); ++ handle_value_.Update(value); + hasContent = JsonStringifier::AppendJsonString(obj, replacer, hasContent); + RETURN_VALUE_IF_ABRUPT_COMPLETION(thread_, false); + } +@@ -679,7 +679,7 @@ bool JsonStringifier::SerializeKeys(const JSHandle &obj, const JSHandl + if (!key.IsString()) { + continue; + } +- handleKey_.Update(key); ++ handle_key_.Update(key); + TaggedArray *properties = TaggedArray::Cast(obj->GetProperties().GetHeapObject()); + PropertyAttributes attr; + uint32_t indexOrEntry = 0; +@@ -696,7 +696,7 @@ bool JsonStringifier::SerializeKeys(const JSHandle &obj, const JSHandl + } else { + value = JSTaggedValue::Undefined(); + } +- handleValue_.Update(value); ++ handle_value_.Update(value); + hasContent = JsonStringifier::AppendJsonString(obj, replacer, hasContent); + RETURN_VALUE_IF_ABRUPT_COMPLETION(thread_, false); + } +@@ -706,15 +706,16 @@ bool JsonStringifier::SerializeKeys(const JSHandle &obj, const JSHandl + bool JsonStringifier::AppendJsonString(const JSHandle &obj, const JSHandle &replacer, + bool hasContent) + { +- JSTaggedValue serializeValue = GetSerializeValue(JSHandle(obj), handleKey_, handleValue_, replacer); ++ JSTaggedValue serializeValue = ++ GetSerializeValue(JSHandle(obj), handle_key_, handle_value_, replacer); + RETURN_VALUE_IF_ABRUPT_COMPLETION(thread_, false); + if (UNLIKELY(serializeValue.IsUndefined() || serializeValue.IsSymbol() || + (serializeValue.IsECMAObject() && serializeValue.IsCallable()))) { + return hasContent; + } +- handleValue_.Update(serializeValue); +- SerializeObjectKey(handleKey_, hasContent); +- JSTaggedValue res = SerializeJSONProperty(handleValue_, replacer); ++ handle_value_.Update(serializeValue); ++ SerializeObjectKey(handle_key_, hasContent); ++ JSTaggedValue res = SerializeJSONProperty(handle_value_, replacer); + RETURN_VALUE_IF_ABRUPT_COMPLETION(thread_, false); + if (!res.IsUndefined()) { + return true; +diff --git a/runtime/base/json_stringifier.h b/runtime/base/json_stringifier.h +index bdc0b78..ce6ce23 100644 +--- a/runtime/base/json_stringifier.h ++++ b/runtime/base/json_stringifier.h +@@ -27,8 +27,8 @@ class JsonStringifier { + public: + explicit JsonStringifier(JSThread *thread) + : thread_(thread), +- handleKey_(thread, JSTaggedValue::Undefined()), +- handleValue_(thread, JSTaggedValue::Undefined()) ++ handle_key_(thread, JSTaggedValue::Undefined()), ++ handle_value_(thread, JSTaggedValue::Undefined()) + { + } + +@@ -86,9 +86,9 @@ private: + JSThread *thread_ {nullptr}; + ObjectFactory *factory_ {nullptr}; + CVector> stack_; +- CVector> propList_; +- JSMutableHandle handleKey_; +- JSMutableHandle handleValue_; ++ CVector> prop_list_; ++ JSMutableHandle handle_key_; ++ JSMutableHandle handle_value_; + }; + } // namespace panda::ecmascript::base + #endif // ECMASCRIPT_BASE_JSON_STRINGIFY_INL_H +diff --git a/runtime/base/utf_helper.cpp b/runtime/base/utf_helper.cpp +index bf5a8f6..6262b94 100644 +--- a/runtime/base/utf_helper.cpp ++++ b/runtime/base/utf_helper.cpp +@@ -167,13 +167,13 @@ size_t ConvertRegionUtf16ToUtf8(const uint16_t *utf16In, uint8_t *utf8Out, size_ + } + // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) + Utf8Char ch = ConvertUtf16ToUtf8(utf16In[i], next16Code, modify); +- if (utf8Pos + ch.n > utf8Len) { ++ if (utf8Pos + ch.n_ > utf8Len) { + break; + } +- for (size_t c = 0; c < ch.n; ++c) { +- utf8Out[utf8Pos++] = ch.ch[c]; // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic) ++ for (size_t c = 0; c < ch.n_; ++c) { ++ utf8Out[utf8Pos++] = ch.ch_[c]; // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic) + } +- if (ch.n == UtfLength::FOUR) { // Two UTF-16 chars are used ++ if (ch.n_ == UtfLength::FOUR) { // Two UTF-16 chars are used + ++i; + } + } +diff --git a/runtime/base/utf_helper.h b/runtime/base/utf_helper.h +index 48728f7..93b37b9 100644 +--- a/runtime/base/utf_helper.h ++++ b/runtime/base/utf_helper.h +@@ -52,8 +52,8 @@ enum UtfOffset : uint8_t { SIX = 6, TEN = 10, TWELVE = 12, EIGHTEEN = 18 }; + + static constexpr size_t MAX_BYTES = 4; + struct Utf8Char { +- size_t n; +- std::array ch; ++ size_t n_; ++ std::array ch_; + }; + + uint32_t UTF16Decode(uint16_t lead, uint16_t trail); +diff --git a/runtime/builtins.cpp b/runtime/builtins.cpp +index 160b0c8..a233d30 100644 +--- a/runtime/builtins.cpp ++++ b/runtime/builtins.cpp +@@ -1031,10 +1031,10 @@ void Builtins::SetErrorWithRealm(const JSHandle &realm, const JSType + void Builtins::GeneralUpdateError(ErrorParameter *error, EcmaEntrypoint constructor, EcmaEntrypoint method, + const char *name, JSType type) const + { +- error->nativeConstructor = constructor; +- error->nativeMethod = method; +- error->nativePropertyName = name; +- error->nativeJstype = type; ++ error->native_constructor_ = constructor; ++ error->native_method_ = method; ++ error->native_property_name_ = name; ++ error->native_jstype_ = type; + } + + void Builtins::InitializeError(const JSHandle &env, const JSHandle &objFuncDynclass, +@@ -1077,22 +1077,22 @@ void Builtins::InitializeError(const JSHandle &env, const JSHandle nativeErrorFuncInstanceDynclass = +- factory_->NewEcmaDynClass(JSObject::SIZE, errorParameter.nativeJstype, nativeErrorFuncPrototypeValue); ++ factory_->NewEcmaDynClass(JSObject::SIZE, errorParameter.native_jstype_, nativeErrorFuncPrototypeValue); + + // NativeError() = new Error() + JSHandle nativeErrorFunction = +- factory_->NewJSNativeErrorFunction(env, reinterpret_cast(errorParameter.nativeConstructor)); +- InitializeCtor(env, nativeErrorFuncPrototype, nativeErrorFunction, errorParameter.nativePropertyName, ++ factory_->NewJSNativeErrorFunction(env, reinterpret_cast(errorParameter.native_constructor_)); ++ InitializeCtor(env, nativeErrorFuncPrototype, nativeErrorFunction, errorParameter.native_property_name_, + FunctionLength::ONE); + + nativeErrorFunction->SetFunctionPrototype(thread_, nativeErrorFuncInstanceDynclass.GetTaggedValue()); + + // NativeError.prototype method + SetFunction(env, nativeErrorFuncPrototype, thread_->GlobalConstants()->GetHandledToStringString(), +- errorParameter.nativeMethod, FunctionLength::ZERO); ++ errorParameter.native_method_, FunctionLength::ZERO); + + // Error.prototype Attribute +- SetAttribute(nativeErrorFuncPrototype, "name", errorParameter.nativePropertyName); ++ SetAttribute(nativeErrorFuncPrototype, "name", errorParameter.native_property_name_); + SetAttribute(nativeErrorFuncPrototype, "message", ""); + + if (errorTag == JSType::JS_RANGE_ERROR) { +@@ -3043,20 +3043,22 @@ JSHandle Builtins::InitializeArkPrivate(const JSHandle &env + { + JSHandle arkPrivate = factory_->NewEmptyJSObject(); + SetFrozenFunction(env, arkPrivate, "Load", ContainersPrivate::Load, FunctionLength::ZERO); +- SetConstant(arkPrivate, "ArrayList", JSTaggedValue(static_cast(containers::ContainerTag::ArrayList))); +- SetConstant(arkPrivate, "Queue", JSTaggedValue(static_cast(containers::ContainerTag::Queue))); +- SetConstant(arkPrivate, "Deque", JSTaggedValue(static_cast(containers::ContainerTag::Deque))); +- SetConstant(arkPrivate, "Stack", JSTaggedValue(static_cast(containers::ContainerTag::Stack))); +- SetConstant(arkPrivate, "Vector", JSTaggedValue(static_cast(containers::ContainerTag::Vector))); +- SetConstant(arkPrivate, "List", JSTaggedValue(static_cast(containers::ContainerTag::List))); +- SetConstant(arkPrivate, "LinkedList", JSTaggedValue(static_cast(containers::ContainerTag::LinkedList))); +- SetConstant(arkPrivate, "TreeMap", JSTaggedValue(static_cast(containers::ContainerTag::TreeMap))); +- SetConstant(arkPrivate, "TreeSet", JSTaggedValue(static_cast(containers::ContainerTag::TreeSet))); +- SetConstant(arkPrivate, "HashMap", JSTaggedValue(static_cast(containers::ContainerTag::HashMap))); +- SetConstant(arkPrivate, "HashSet", JSTaggedValue(static_cast(containers::ContainerTag::HashSet))); +- SetConstant(arkPrivate, "LightWightMap", JSTaggedValue(static_cast(containers::ContainerTag::LightWightMap))); +- SetConstant(arkPrivate, "LightWightSet", JSTaggedValue(static_cast(containers::ContainerTag::LightWightSet))); +- SetConstant(arkPrivate, "PlainArray", JSTaggedValue(static_cast(containers::ContainerTag::PlainArray))); ++ SetConstant(arkPrivate, "ArrayList", JSTaggedValue(static_cast(containers::ContainerTag::ARRAY_LIST))); ++ SetConstant(arkPrivate, "Queue", JSTaggedValue(static_cast(containers::ContainerTag::QUEUE))); ++ SetConstant(arkPrivate, "Deque", JSTaggedValue(static_cast(containers::ContainerTag::DEQUE))); ++ SetConstant(arkPrivate, "Stack", JSTaggedValue(static_cast(containers::ContainerTag::STACK))); ++ SetConstant(arkPrivate, "Vector", JSTaggedValue(static_cast(containers::ContainerTag::VECTOR))); ++ SetConstant(arkPrivate, "List", JSTaggedValue(static_cast(containers::ContainerTag::LIST))); ++ SetConstant(arkPrivate, "LinkedList", JSTaggedValue(static_cast(containers::ContainerTag::LINKED_LIST))); ++ SetConstant(arkPrivate, "TreeMap", JSTaggedValue(static_cast(containers::ContainerTag::TREE_MAP))); ++ SetConstant(arkPrivate, "TreeSet", JSTaggedValue(static_cast(containers::ContainerTag::TREE_SET))); ++ SetConstant(arkPrivate, "HashMap", JSTaggedValue(static_cast(containers::ContainerTag::HASH_MAP))); ++ SetConstant(arkPrivate, "HashSet", JSTaggedValue(static_cast(containers::ContainerTag::HASH_SET))); ++ SetConstant(arkPrivate, "LightWightMap", ++ JSTaggedValue(static_cast(containers::ContainerTag::LIGHT_WIGHT_MAP))); ++ SetConstant(arkPrivate, "LightWightSet", ++ JSTaggedValue(static_cast(containers::ContainerTag::LIGHT_WIGHT_SET))); ++ SetConstant(arkPrivate, "PlainArray", JSTaggedValue(static_cast(containers::ContainerTag::PLAIN_ARRAY))); + return arkPrivate; + } + +diff --git a/runtime/builtins.h b/runtime/builtins.h +index 399ada6..8e02fc4 100644 +--- a/runtime/builtins.h ++++ b/runtime/builtins.h +@@ -26,10 +26,10 @@ + + namespace panda::ecmascript { + struct ErrorParameter { +- EcmaEntrypoint nativeConstructor {nullptr}; +- EcmaEntrypoint nativeMethod {nullptr}; +- const char *nativePropertyName {nullptr}; +- JSType nativeJstype {JSType::INVALID}; ++ EcmaEntrypoint native_constructor_ {nullptr}; ++ EcmaEntrypoint native_method_ {nullptr}; ++ const char *native_property_name_ {nullptr}; ++ JSType native_jstype_ {JSType::INVALID}; + }; + + enum FunctionLength : uint8_t { ZERO = 0, ONE, TWO, THREE, FOUR }; +diff --git a/runtime/builtins/builtins_regexp.cpp b/runtime/builtins/builtins_regexp.cpp +index eedeba4..0995b76 100644 +--- a/runtime/builtins/builtins_regexp.cpp ++++ b/runtime/builtins/builtins_regexp.cpp +@@ -608,7 +608,7 @@ JSTaggedValue BuiltinsRegExp::RegExpReplaceFast(JSThread *thread, JSHandle lastIndexValue(thread, JSTaggedValue(0)); + FastRuntimeStub::FastSetPropertyByValue(thread, regexp.GetTaggedValue(), lastIndexHandle.GetTaggedValue(), +@@ -1339,7 +1339,7 @@ JSTaggedValue BuiltinsRegExp::RegExpBuiltinExec(JSThread *thread, const JSHandle + } + return JSTaggedValue::Null(); + } +- uint32_t endIndex = matchResult.endIndex_; ++ uint32_t endIndex = matchResult.end_index_; + if (global || sticky) { + // a. Let setStatus be Set(R, "lastIndex", e, true). + FastRuntimeStub::FastSetPropertyByValue(thread, regexp.GetTaggedValue(), lastIndexHandle.GetTaggedValue(), +diff --git a/runtime/builtins/builtins_string.cpp b/runtime/builtins/builtins_string.cpp +index 6398410..b13fe7c 100644 +--- a/runtime/builtins/builtins_string.cpp ++++ b/runtime/builtins/builtins_string.cpp +@@ -1582,7 +1582,7 @@ JSTaggedValue BuiltinsString::ToLocaleLowerCase(EcmaRuntimeCallInfo *argv) + RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); + + // Let locale be BestAvailableLocale(availableLocales, noExtensionsLocale). +- std::string locale = JSLocale::BestAvailableLocale(thread, availableLocales, noExtensionsLocale.base); ++ std::string locale = JSLocale::BestAvailableLocale(thread, availableLocales, noExtensionsLocale.base_); + RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); + + // If locale is undefined, let locale be "und". +@@ -1651,7 +1651,7 @@ JSTaggedValue BuiltinsString::ToLocaleUpperCase(EcmaRuntimeCallInfo *argv) + RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); + + // Let locale be BestAvailableLocale(availableLocales, noExtensionsLocale). +- std::string locale = JSLocale::BestAvailableLocale(thread, availableLocales, noExtensionsLocale.base); ++ std::string locale = JSLocale::BestAvailableLocale(thread, availableLocales, noExtensionsLocale.base_); + RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); + + // If locale is undefined, let locale be "und". +diff --git a/runtime/class_info_extractor.cpp b/runtime/class_info_extractor.cpp +index 2c9c84d..ec94d52 100644 +--- a/runtime/class_info_extractor.cpp ++++ b/runtime/class_info_extractor.cpp +@@ -104,15 +104,15 @@ bool ClassInfoExtractor::ExtractAndReturnWhetherWithElements(JSThread *thread, c + + ASSERT(keys->GetLength() == properties->GetLength() && elements->GetLength() == 0); + +- uint32_t pos = detail.fillStartLoc; ++ uint32_t pos = detail.fill_start_loc_; + bool withElemenstFlag = false; +- bool isStaticFlag = detail.ctorMethod != nullptr; ++ bool isStaticFlag = detail.ctor_method_ != nullptr; + bool keysHasNameFlag = false; + + JSHandle nameString = globalConst->GetHandledNameString(); + JSMutableHandle firstValue(thread, JSTaggedValue::Undefined()); + JSMutableHandle secondValue(thread, JSTaggedValue::Undefined()); +- for (uint32_t index = detail.extractBegin; index < detail.extractEnd; index += 2) { // 2: key-value pair ++ for (uint32_t index = detail.extract_begin_; index < detail.extract_end_; index += 2) { // 2: key-value pair + firstValue.Update(literal->Get(index)); + secondValue.Update(literal->Get(index + 1)); + ASSERT_PRINT(JSTaggedValue::IsPropertyKey(firstValue), "Key is not a property key"); +@@ -146,7 +146,7 @@ bool ClassInfoExtractor::ExtractAndReturnWhetherWithElements(JSThread *thread, c + if (LIKELY(!keysHasNameFlag)) { + [[maybe_unused]] EcmaHandleScope handleScope(thread); + ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); +- CString clsName = detail.ctorMethod->ParseFunctionName(); ++ CString clsName = detail.ctor_method_->ParseFunctionName(); + JSHandle clsNameHandle = factory->NewFromString(clsName); + properties->Set(thread, NAME_INDEX, clsNameHandle); + } else { +@@ -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_info_extractor.h b/runtime/class_info_extractor.h +index 2420f4a..19fdefa 100644 +--- a/runtime/class_info_extractor.h ++++ b/runtime/class_info_extractor.h +@@ -34,10 +34,10 @@ public: + static constexpr uint8_t PROTOTYPE_INDEX = 2; + + struct ExtractContentsDetail { +- uint32_t extractBegin; +- uint32_t extractEnd; +- uint8_t fillStartLoc; +- JSMethod *ctorMethod; ++ uint32_t extract_begin_; ++ uint32_t extract_end_; ++ uint8_t fill_start_loc_; ++ JSMethod *ctor_method_; + }; + + CAST_CHECK(ClassInfoExtractor, IsClassInfoExtractor); +diff --git a/runtime/class_linker/panda_file_translator.cpp b/runtime/class_linker/panda_file_translator.cpp +index f1a5d99..dc2d21d 100644 +--- a/runtime/class_linker/panda_file_translator.cpp ++++ b/runtime/class_linker/panda_file_translator.cpp +@@ -41,7 +41,7 @@ + + namespace panda::ecmascript { + PandaFileTranslator::PandaFileTranslator(EcmaVM *vm) +- : ecmaVm_(vm), factory_(vm->GetFactory()), thread_(vm->GetJSThread()) ++ : ecma_vm_(vm), factory_(vm->GetFactory()), thread_(vm->GetJSThread()) + { + } + +@@ -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()); +@@ -162,30 +162,30 @@ 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); + auto foundStr = pf.GetStringData(id); + auto string = +- factory_->GetRawStringFromStringTable(foundStr.data, foundStr.utf16_length, foundStr.is_ascii); ++ factory_->GetRawStringFromStringTable(foundStr.data_, foundStr.utf16_length_, foundStr.is_ascii_); + if (string == nullptr) { + LOG(FATAL, ECMASCRIPT) << "Not enough memory"; + } + 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); +@@ -195,7 +195,7 @@ Program *PandaFileTranslator::GenerateProgram(const panda_file::File &pf) + constpool->Set(thread_, value.GetConstpoolIndex(), jsFunc.GetTaggedValue()); + jsFunc->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); +@@ -205,7 +205,7 @@ Program *PandaFileTranslator::GenerateProgram(const panda_file::File &pf) + constpool->Set(thread_, value.GetConstpoolIndex(), jsFunc.GetTaggedValue()); + jsFunc->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); +@@ -224,7 +224,7 @@ Program *PandaFileTranslator::GenerateProgram(const panda_file::File &pf) + constpool->Set(thread_, value.GetConstpoolIndex(), jsFunc.GetTaggedValue()); + jsFunc->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); +@@ -234,7 +234,7 @@ Program *PandaFileTranslator::GenerateProgram(const panda_file::File &pf) + constpool->Set(thread_, value.GetConstpoolIndex(), jsFunc.GetTaggedValue()); + jsFunc->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); +@@ -244,14 +244,14 @@ Program *PandaFileTranslator::GenerateProgram(const panda_file::File &pf) + constpool->Set(thread_, value.GetConstpoolIndex(), jsFunc.GetTaggedValue()); + jsFunc->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); +@@ -296,7 +296,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); +@@ -304,7 +304,7 @@ 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); +@@ -502,15 +502,15 @@ void PandaFileTranslator::UpdateICOffset(JSMethod *method, uint32_t insSz, const + + 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; + } + +diff --git a/runtime/class_linker/panda_file_translator.h b/runtime/class_linker/panda_file_translator.h +index 4803cbc..0b83030 100644 +--- a/runtime/class_linker/panda_file_translator.h ++++ b/runtime/class_linker/panda_file_translator.h +@@ -100,14 +100,14 @@ private: + void UpdateICOffset(JSMethod *method, uint32_t insSz, 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/containers/containers_private.cpp b/runtime/containers/containers_private.cpp +index 4cc3e7b..1086d77 100644 +--- a/runtime/containers/containers_private.cpp ++++ b/runtime/containers/containers_private.cpp +@@ -38,7 +38,7 @@ JSTaggedValue ContainersPrivate::Load(EcmaRuntimeCallInfo *msg) + ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + JSTaggedValue res = JSTaggedValue::Undefined(); + switch (tag) { +- case ContainerTag::ArrayList: { ++ case ContainerTag::ARRAY_LIST: { + JSHandle key(factory->NewFromCanBeCompressString("ArrayListConstructor")); + JSTaggedValue value = + FastRuntimeStub::GetPropertyByName(thread, thisValue.GetTaggedValue(), key.GetTaggedValue()); +@@ -51,7 +51,7 @@ JSTaggedValue ContainersPrivate::Load(EcmaRuntimeCallInfo *msg) + } + break; + } +- case ContainerTag::Queue: ++ case ContainerTag::QUEUE: + case ContainerTag::END: + break; + default: +diff --git a/runtime/containers/containers_private.h b/runtime/containers/containers_private.h +index 705dc53..3cdeaf6 100644 +--- a/runtime/containers/containers_private.h ++++ b/runtime/containers/containers_private.h +@@ -21,20 +21,20 @@ + namespace panda::ecmascript::containers { + enum FuncLength : uint8_t { ZERO = 0, ONE, TWO, THREE, FOUR }; + enum ContainerTag : uint8_t { +- ArrayList = 0, +- Queue, +- Deque, +- Stack, +- Vector, +- List, +- LinkedList, +- TreeMap, +- TreeSet, +- HashMap, +- HashSet, +- LightWightMap, +- LightWightSet, +- PlainArray, ++ ARRAY_LIST = 0, ++ QUEUE, ++ DEQUE, ++ STACK, ++ VECTOR, ++ LIST, ++ LINKED_LIST, ++ TREE_MAP, ++ TREE_SET, ++ HASH_MAP, ++ HASH_SET, ++ LIGHT_WIGHT_MAP, ++ LIGHT_WIGHT_SET, ++ PLAIN_ARRAY, + END + }; + // Using Lazy-loading container, including ArrayList, Queue, Stack, Vector, List, LinkedList, Deque, +diff --git a/runtime/ecma_global_storage-inl.h b/runtime/ecma_global_storage-inl.h +index 258aa3b..6a481c2 100644 +--- a/runtime/ecma_global_storage-inl.h ++++ b/runtime/ecma_global_storage-inl.h +@@ -30,16 +30,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; + } + +@@ -51,35 +51,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; + } +@@ -99,11 +99,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) +@@ -162,13 +162,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(); +@@ -198,7 +198,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 46c9354..d7c7b65 100644 +--- a/runtime/ecma_global_storage.h ++++ b/runtime/ecma_global_storage.h +@@ -29,13 +29,13 @@ public: + explicit EcmaGlobalStorage(Chunk *chunk) : chunk_(chunk) + { + ASSERT(chunk != nullptr); +- topGlobalNodes_ = lastGlobalNodes_ = chunk_->New(false); +- topWeakGlobalNodes_ = lastWeakGlobalNodes_ = chunk_->New(true); ++ top_global_nodes_ = last_global_nodes_ = chunk_->New(false); ++ top_weak_global_nodes_ = last_weak_global_nodes_ = chunk_->New(true); + } + + ~EcmaGlobalStorage() + { +- NodeList *next = topGlobalNodes_; ++ NodeList *next = top_global_nodes_; + NodeList *current = nullptr; + while (next != nullptr) { + current = next; +@@ -43,7 +43,7 @@ public: + chunk_->Delete(current); + } + +- next = topWeakGlobalNodes_; ++ next = top_weak_global_nodes_; + while (next != nullptr) { + current = next; + next = current->GetNext(); +@@ -95,12 +95,12 @@ public: + + void SetFree(bool free) + { +- isFree_ = free; ++ is_free_ = free; + } + + bool IsFree() const + { +- return isFree_; ++ return is_free_; + } + + uintptr_t GetObjectAddress() const +@@ -113,15 +113,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 isWeak) : is_weak_(isWeak) + { + for (int i = 0; i < GLOBAL_BLOCK_SIZE; i++) { +- nodeList_[i].SetIndex(i); ++ node_list_[i].SetIndex(i); + } + } + ~NodeList() = default; +@@ -142,17 +142,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) +@@ -175,26 +175,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; +@@ -208,15 +208,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); +@@ -227,7 +227,7 @@ public: + template + void IterateUsageGlobal(Callback callback) + { +- NodeList *next = topGlobalNodes_; ++ NodeList *next = top_global_nodes_; + NodeList *current = nullptr; + while (next != nullptr) { + current = next; +@@ -240,7 +240,7 @@ public: + template + void IterateWeakUsageGlobal(Callback callback) + { +- NodeList *next = topWeakGlobalNodes_; ++ NodeList *next = top_weak_global_nodes_; + NodeList *current = nullptr; + while (next != nullptr) { + current = next; +@@ -257,13 +257,13 @@ private: + inline uintptr_t NewGlobalHandleImplement(NodeList **storage, NodeList **freeList, bool isWeak, JSTaggedType value); + + Chunk *chunk_ {nullptr}; +- 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 d183a49..557b5ff 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 1709fc7..c79b806 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_macros.h b/runtime/ecma_macros.h +index a92a7b3..6931d6c 100644 +--- a/runtime/ecma_macros.h ++++ b/runtime/ecma_macros.h +@@ -30,18 +30,18 @@ template + static inline T UnalignedLoad(T const *p) + { + struct Wrapper { +- T x; ++ T x_; + } __attribute__((packed, aligned(1))); +- return reinterpret_cast(p)->x; ++ return reinterpret_cast(p)->x_; + } + + template + static inline void UnalignedStore(T *p, T v) + { + struct Wrapper { +- T x; ++ T x_; + } __attribute__((packed, aligned(1))); +- reinterpret_cast(p)->x = v; ++ reinterpret_cast(p)->x_ = v; + } + + // NOLINTNEXTLINE(cppcoreguidelines-macro-usage) +diff --git a/runtime/ecma_module.cpp b/runtime/ecma_module.cpp +index 9679010..4bbb917 100644 +--- a/runtime/ecma_module.cpp ++++ b/runtime/ecma_module.cpp +@@ -106,7 +106,7 @@ void EcmaModule::DebugPrint(const JSThread *thread, const CString &caller) + + ModuleManager::ModuleManager(EcmaVM *vm) : vm_(vm) + { +- ecmaModules_ = NameDictionary::Create(vm_->GetJSThread(), DEAULT_DICTIONART_CAPACITY).GetTaggedValue(); ++ ecma_modules_ = NameDictionary::Create(vm_->GetJSThread(), DEAULT_DICTIONART_CAPACITY).GetTaggedValue(); + } + + // class ModuleManager +@@ -114,8 +114,8 @@ void ModuleManager::AddModule(JSHandle moduleName, JSHandleGetJSThread(); + [[maybe_unused]] EcmaHandleScope scope(thread); +- JSHandle dict(thread, ecmaModules_); +- ecmaModules_ = ++ JSHandle dict(thread, ecma_modules_); ++ ecma_modules_ = + NameDictionary::Put(thread, dict, moduleName, module, PropertyAttributes::Default()).GetTaggedValue(); + } + +@@ -123,19 +123,19 @@ void ModuleManager::RemoveModule(JSHandle moduleName) + { + JSThread *thread = vm_->GetJSThread(); + [[maybe_unused]] EcmaHandleScope scope(thread); +- JSHandle moduleItems(thread, ecmaModules_); ++ JSHandle moduleItems(thread, ecma_modules_); + int entry = moduleItems->FindEntry(moduleName.GetTaggedValue()); + if (entry != -1) { +- ecmaModules_ = NameDictionary::Remove(thread, moduleItems, entry).GetTaggedValue(); ++ ecma_modules_ = NameDictionary::Remove(thread, moduleItems, entry).GetTaggedValue(); + } + } + + JSHandle ModuleManager::GetModule(const JSThread *thread, + [[maybe_unused]] JSHandle moduleName) + { +- int entry = NameDictionary::Cast(ecmaModules_.GetTaggedObject())->FindEntry(moduleName.GetTaggedValue()); ++ int entry = NameDictionary::Cast(ecma_modules_.GetTaggedObject())->FindEntry(moduleName.GetTaggedValue()); + if (entry != -1) { +- return JSHandle(thread, NameDictionary::Cast(ecmaModules_.GetTaggedObject())->GetValue(entry)); ++ return JSHandle(thread, NameDictionary::Cast(ecma_modules_.GetTaggedObject())->GetValue(entry)); + } + return thread->GlobalConstants()->GetHandledUndefined(); + } +@@ -166,19 +166,19 @@ CString ModuleManager::GenerateModuleFullPath(const std::string ¤tPathFile + + const CString &ModuleManager::GetCurrentExportModuleName() + { +- return moduleNames_.back(); ++ return module_names_.back(); + } + + void ModuleManager::SetCurrentExportModuleName(const std::string_view &moduleFile) + { +- moduleNames_.emplace_back(CString(moduleFile)); // xx/xx/x.abc ++ module_names_.emplace_back(CString(moduleFile)); // xx/xx/x.abc + } + + void ModuleManager::RestoreCurrentExportModuleName() + { +- auto s = moduleNames_.size(); ++ auto s = module_names_.size(); + if (s > 0) { +- moduleNames_.resize(s - 1); ++ module_names_.resize(s - 1); + return; + } + UNREACHABLE(); +@@ -187,9 +187,9 @@ void ModuleManager::RestoreCurrentExportModuleName() + const CString &ModuleManager::GetPrevExportModuleName() + { + static const int MINIMUM_COUNT = 2; +- auto count = moduleNames_.size(); ++ auto count = module_names_.size(); + ASSERT(count >= MINIMUM_COUNT); +- return moduleNames_[count - MINIMUM_COUNT]; ++ return module_names_[count - MINIMUM_COUNT]; + } + + void ModuleManager::AddModuleItem(const JSThread *thread, JSHandle itemName, +@@ -241,7 +241,7 @@ void ModuleManager::CopyModule(const JSThread *thread, JSHandle s + void ModuleManager::DebugPrint([[maybe_unused]] const JSThread *thread, [[maybe_unused]] const CString &caller) + { + std::cout << "ModuleStack:"; +- for_each(moduleNames_.cbegin(), moduleNames_.cend(), [](const CString &s) -> void { std::cout << s << " "; }); ++ for_each(module_names_.cbegin(), module_names_.cend(), [](const CString &s) -> void { std::cout << s << " "; }); + std::cout << "\n"; + } + } // namespace panda::ecmascript +diff --git a/runtime/ecma_module.h b/runtime/ecma_module.h +index 440181e..a11d2f7 100644 +--- a/runtime/ecma_module.h ++++ b/runtime/ecma_module.h +@@ -92,8 +92,8 @@ private: + NO_MOVE_SEMANTIC(ModuleManager); + + EcmaVM *vm_ {nullptr}; +- JSTaggedValue ecmaModules_ {JSTaggedValue::Hole()}; +- std::vector moduleNames_ {DEAULT_DICTIONART_CAPACITY}; ++ JSTaggedValue ecma_modules_ {JSTaggedValue::Hole()}; ++ std::vector module_names_ {DEAULT_DICTIONART_CAPACITY}; + + friend class EcmaVM; + }; +diff --git a/runtime/ecma_runtime_call_info.h b/runtime/ecma_runtime_call_info.h +index d3504ca..fef062c 100644 +--- a/runtime/ecma_runtime_call_info.h ++++ b/runtime/ecma_runtime_call_info.h +@@ -32,20 +32,20 @@ public: + // For builtins interpreter call + EcmaRuntimeCallInfo(JSThread *thread, uint32_t numArgs, interpreter::VRegister *args) + : thread_(thread), +- numArgs_(numArgs), +- gprArgs_(reinterpret_cast(args), numArgs), +- stackArgs_(nullptr, static_cast(0)) ++ num_args_(numArgs), ++ gpr_args_(reinterpret_cast(args), numArgs), ++ stack_args_(nullptr, static_cast(0)) + { +- ASSERT(numArgs_ >= NUM_MANDATORY_JSFUNC_ARGS); ++ ASSERT(num_args_ >= NUM_MANDATORY_JSFUNC_ARGS); + } + + EcmaRuntimeCallInfo(JSThread *thread, uint32_t numArgs, JSTaggedValue *gprArgs, JSTaggedValue *stackArgs) + : thread_(thread), +- numArgs_(numArgs), +- gprArgs_(gprArgs, GetGprArgsCount(numArgs)), +- stackArgs_(stackArgs, GetStackArgsCount(numArgs)) ++ num_args_(numArgs), ++ gpr_args_(gprArgs, GetGprArgsCount(numArgs)), ++ stack_args_(stackArgs, GetStackArgsCount(numArgs)) + { +- ASSERT(numArgs_ >= NUM_MANDATORY_JSFUNC_ARGS); ++ ASSERT(num_args_ >= NUM_MANDATORY_JSFUNC_ARGS); + } + + ~EcmaRuntimeCallInfo() = default; +@@ -107,15 +107,15 @@ 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 + { +- if (idx < gprArgs_.size()) { +- return reinterpret_cast(&gprArgs_[idx]); ++ if (idx < gpr_args_.size()) { ++ return reinterpret_cast(&gpr_args_[idx]); + } +- return reinterpret_cast(&stackArgs_[idx - gprArgs_.size()]); ++ return reinterpret_cast(&stack_args_[idx - gpr_args_.size()]); + } + + private: +@@ -145,9 +145,9 @@ private: + + private: + JSThread *thread_; +- uint32_t numArgs_; +- Span gprArgs_; +- Span stackArgs_; ++ uint32_t num_args_; ++ Span gpr_args_; ++ Span stack_args_; + }; + } // namespace panda::ecmascript + +diff --git a/runtime/ecma_string.cpp b/runtime/ecma_string.cpp +index 0f46277..fdaf9a9 100644 +--- a/runtime/ecma_string.cpp ++++ b/runtime/ecma_string.cpp +@@ -19,7 +19,7 @@ + #include "plugins/ecmascript/runtime/mem/c_containers.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, +@@ -243,7 +243,7 @@ int32_t EcmaString::IndexOf(const EcmaString *rhs, int32_t pos) const + // static + bool EcmaString::CanBeCompressed(const uint8_t *utf8Data, uint32_t utf8Len) + { +- if (!compressedStringsEnabled) { ++ if (!compressed_strings_enabled_) { + return false; + } + bool isCompressed = true; +@@ -263,7 +263,7 @@ bool EcmaString::CanBeCompressed(const uint8_t *utf8Data, uint32_t utf8Len) + /* static */ + bool EcmaString::CanBeCompressed(const uint16_t *utf16Data, uint32_t utf16Len) + { +- if (!compressedStringsEnabled) { ++ if (!compressed_strings_enabled_) { + return false; + } + bool isCompressed = true; +@@ -392,7 +392,7 @@ static int32_t ComputeHashForUtf8(const uint8_t *utf8Data) + uint32_t EcmaString::ComputeHashcode() const + { + uint32_t hash; +- if (compressedStringsEnabled) { ++ if (compressed_strings_enabled_) { + if (!IsUtf16()) { + hash = ComputeHashForData(GetDataUtf8(), GetLength()); + } else { +diff --git a/runtime/ecma_string.h b/runtime/ecma_string.h +index b49a488..749aea6 100644 +--- a/runtime/ecma_string.h ++++ b/runtime/ecma_string.h +@@ -75,12 +75,12 @@ public: + + 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) +@@ -263,12 +263,12 @@ public: + + 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); +@@ -307,7 +307,7 @@ private: + uint32_t ComputeHashcode() const; + static void CopyUtf16AsUtf8(const uint16_t *utf16From, uint8_t *utf8To, uint32_t utf16Len); + +- static bool compressedStringsEnabled; ++ static bool compressed_strings_enabled_; + + static bool IsASCIICharacter(uint16_t data) + { +diff --git a/runtime/ecma_string_table.cpp b/runtime/ecma_string_table.cpp +index 27d948f..c369955 100644 +--- a/runtime/ecma_string_table.cpp ++++ b/runtime/ecma_string_table.cpp +@@ -68,11 +68,11 @@ ObjectHeader *EcmaStringTable::ResolveString(const panda_file::File &pf, panda_f + auto foundStr = pf.GetStringData(id); + const auto factory = vm_->GetFactory(); + +- if (UNLIKELY(foundStr.utf16_length == 0)) { ++ if (UNLIKELY(foundStr.utf16_length_ == 0)) { + return *(factory->GetEmptyString()); + } + +- return EcmaString::Cast(this->GetOrInternString(foundStr.data, foundStr.utf16_length, foundStr.is_ascii)); ++ return EcmaString::Cast(this->GetOrInternString(foundStr.data_, foundStr.utf16_length_, foundStr.is_ascii_)); + } + + void EcmaStringTable::InternString(EcmaString *string) +diff --git a/runtime/ecma_vm.cpp b/runtime/ecma_vm.cpp +index dd7d1e4..e08a9ca 100644 +--- a/runtime/ecma_vm.cpp ++++ b/runtime/ecma_vm.cpp +@@ -183,25 +183,25 @@ Expected EcmaVM::Create(Runtime *runtime, const JSRuntimeOpti + } + + EcmaVM::EcmaVM(JSRuntimeOptions options) +- : stringTable_(new EcmaStringTable(this)), +- regionFactory_(std::make_unique()), +- chunk_(regionFactory_.get()), +- nativeMethods_(&chunk_) ++ : string_table_(new EcmaStringTable(this)), ++ region_factory_(std::make_unique()), ++ chunk_(region_factory_.get()), ++ native_methods_(&chunk_) + { + options_ = std::move(options); +- icEnable_ = options_.IsIcEnable(); +- optionalLogEnabled_ = options_.IsEnableOptionalLog(); ++ ic_enable_ = options_.IsIcEnable(); ++ optional_log_enabled_ = options_.IsEnableOptionalLog(); + rendezvous_ = chunk_.New(this); +- snapshotSerializeEnable_ = options_.IsSnapshotSerializeEnabled(); +- if (!snapshotSerializeEnable_) { +- snapshotDeserializeEnable_ = options_.IsSnapshotDeserializeEnabled(); ++ snapshot_serialize_enable_ = options_.IsSnapshotSerializeEnabled(); ++ if (!snapshot_serialize_enable_) { ++ snapshot_deserialize_enable_ = options_.IsSnapshotDeserializeEnabled(); + } +- snapshotFileName_ = options_.GetSnapshotFile(); +- frameworkAbcFileName_ = options_.GetFrameworkAbcFile(); ++ snapshot_file_name_ = options_.GetSnapshotFile(); ++ framework_abc_file_name_ = options_.GetFrameworkAbcFile(); + + auto runtime = Runtime::GetCurrent(); +- notificationManager_ = chunk_.New(runtime->GetInternalAllocator()); +- notificationManager_->SetRendezvous(rendezvous_); ++ notification_manager_ = chunk_.New(runtime->GetInternalAllocator()); ++ notification_manager_->SetRendezvous(rendezvous_); + + LanguageContext ctx = Runtime::GetCurrent()->GetLanguageContext(panda_file::SourceLang::ECMASCRIPT); + mm_ = CreateMM(ctx, Runtime::GetCurrent()->GetInternalAllocator(), options_); +@@ -245,10 +245,10 @@ bool EcmaVM::Initialize() + Platform::GetCurrentPlatform()->Initialize(); + + auto globalConst = const_cast(thread_->GlobalConstants()); +- regExpParserCache_ = new RegExpParserCache(); ++ reg_exp_parser_cache_ = new RegExpParserCache(); + heap_ = new Heap(this); + heap_->Initialize(); +- gcStats_ = chunk_.New(heap_); ++ gc_stats_ = chunk_.New(heap_); + factory_ = chunk_.New(thread_, heap_); + if (UNLIKELY(factory_ == nullptr)) { + LOG_ECMA(FATAL) << "alloc factory_ failed"; +@@ -266,7 +266,7 @@ bool EcmaVM::Initialize() + } + + [[maybe_unused]] EcmaHandleScope scope(thread_); +- if (!snapshotDeserializeEnable_ || !VerifyFilePath(snapshotFileName_)) { ++ if (!snapshot_deserialize_enable_ || !VerifyFilePath(snapshot_file_name_)) { + LOG_ECMA(DEBUG) << "EcmaVM::Initialize run builtins"; + + JSHandle dynClassClassHandle = +@@ -277,7 +277,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); +@@ -289,7 +289,7 @@ 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())); +@@ -298,7 +298,7 @@ bool EcmaVM::Initialize() + thread_->LoadFastStubModule(moduleFile.c_str()); + #endif + SetupRegExpResultCache(); +- microJobQueue_ = factory_->NewMicroJobQueue().GetTaggedValue(); ++ micro_job_queue_ = factory_->NewMicroJobQueue().GetTaggedValue(); + + { + Builtins builtins; +@@ -309,21 +309,21 @@ bool EcmaVM::Initialize() + } else { + LOG_ECMA(DEBUG) << "EcmaVM::Initialize run snapshot"; + SnapShot snapShot(this); +- std::unique_ptr pf = snapShot.DeserializeGlobalEnvAndProgram(snapshotFileName_); +- frameworkPandaFile_ = pf.get(); ++ std::unique_ptr pf = snapShot.DeserializeGlobalEnvAndProgram(snapshot_file_name_); ++ framework_panda_file_ = pf.get(); + AddPandaFile(pf.release(), false); +- SetProgram(Program::Cast(frameworkProgram_.GetTaggedObject()), frameworkPandaFile_); +- notificationManager_->LoadModuleEvent(pf->GetFilename()); ++ SetProgram(Program::Cast(framework_program_.GetTaggedObject()), framework_panda_file_); ++ notification_manager_->LoadModuleEvent(pf->GetFilename()); + globalConst->InitGlobalUndefined(); + + factory_->ObtainRootClass(GetGlobalEnv()); + } + +- moduleManager_ = new ModuleManager(this); ++ module_manager_ = new ModuleManager(this); + + InitializeFinish(); +- notificationManager_->VmStartEvent(); +- notificationManager_->VmInitializationEvent(thread_->GetThreadId()); ++ notification_manager_->VmStartEvent(); ++ notification_manager_->VmInitializationEvent(thread_->GetThreadId()); + Platform::GetCurrentPlatform()->PostTask(std::make_unique(heap_)); + return true; + } +@@ -364,8 +364,8 @@ void EcmaVM::InitializeEcmaScriptRunStat() + }; + static_assert(sizeof(runtimeCallerNames) == sizeof(const char *) * ecmascript::RUNTIME_CALLER_NUMBER, + "Invalid runtime caller number"); +- runtimeStat_ = chunk_.New(runtimeCallerNames, ecmascript::RUNTIME_CALLER_NUMBER); +- if (UNLIKELY(runtimeStat_ == nullptr)) { ++ runtime_stat_ = chunk_.New(runtimeCallerNames, ecmascript::RUNTIME_CALLER_NUMBER); ++ if (UNLIKELY(runtime_stat_ == nullptr)) { + LOG_ECMA(FATAL) << "alloc runtimeStat_ failed"; + UNREACHABLE(); + } +@@ -374,21 +374,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; + } + +@@ -400,7 +400,7 @@ void EcmaVM::UninitializeThreads() + + EcmaVM::~EcmaVM() + { +- vmInitialized_ = false; ++ vm_initialized_ = false; + Platform::GetCurrentPlatform()->Destroy(); + ClearNativeMethodsData(); + +@@ -410,19 +410,19 @@ 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(); + +- if (gcStats_ != nullptr) { ++ if (gc_stats_ != nullptr) { + if (options_.IsEnableGCStatsPrint()) { +- gcStats_->PrintStatisticResult(true); ++ gc_stats_->PrintStatisticResult(true); + } +- chunk_.Delete(gcStats_); +- gcStats_ = nullptr; ++ chunk_.Delete(gc_stats_); ++ gc_stats_ = nullptr; + } + + if (heap_ != nullptr) { +@@ -431,12 +431,12 @@ EcmaVM::~EcmaVM() + heap_ = nullptr; + } + +- delete regExpParserCache_; +- regExpParserCache_ = nullptr; ++ delete reg_exp_parser_cache_; ++ reg_exp_parser_cache_ = nullptr; + +- if (notificationManager_ != nullptr) { +- chunk_.Delete(notificationManager_); +- notificationManager_ = nullptr; ++ if (notification_manager_ != nullptr) { ++ chunk_.Delete(notification_manager_); ++ notification_manager_ = nullptr; + } + + if (factory_ != nullptr) { +@@ -444,19 +444,19 @@ EcmaVM::~EcmaVM() + factory_ = nullptr; + } + +- if (stringTable_ != nullptr) { +- delete stringTable_; +- stringTable_ = nullptr; ++ if (string_table_ != nullptr) { ++ delete string_table_; ++ string_table_ = nullptr; + } + +- if (runtimeStat_ != nullptr) { +- chunk_.Delete(runtimeStat_); +- runtimeStat_ = nullptr; ++ if (runtime_stat_ != nullptr) { ++ chunk_.Delete(runtime_stat_); ++ runtime_stat_ = nullptr; + } + +- if (moduleManager_ != nullptr) { +- delete moduleManager_; +- moduleManager_ = nullptr; ++ if (module_manager_ != nullptr) { ++ delete module_manager_; ++ module_manager_ = nullptr; + } + + if (thread_ != nullptr) { +@@ -465,8 +465,8 @@ EcmaVM::~EcmaVM() + thread_ = nullptr; + } + +- extractorCache_.clear(); +- frameworkProgramMethods_.clear(); ++ extractor_cache_.clear(); ++ framework_program_methods_.clear(); + + mem::InternalAllocatorPtr allocator = mm_->GetHeapManager()->GetInternalAllocator(); + allocator->Delete(runtime_iface_); +@@ -480,15 +480,15 @@ bool EcmaVM::ExecuteFromPf(std::string_view filename, std::string_view entryPoin + bool isModule) + { + 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()); ++ notification_manager_->LoadModuleEvent(pf->GetFilename()); + } else { +- pf.reset(frameworkPandaFile_); ++ pf.reset(framework_panda_file_); + } + + return Execute(std::move(pf), entryPoint, args, isModule); +@@ -502,7 +502,7 @@ 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); + } +@@ -510,11 +510,11 @@ bool EcmaVM::ExecuteFromBuffer(const void *buffer, size_t size, std::string_view + 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(); + } +@@ -571,18 +571,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 = +@@ -599,8 +599,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) +@@ -611,13 +611,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); + } + } +@@ -633,7 +633,7 @@ Expected EcmaVM::InvokeEntrypointImpl(Method *entrypoint, c + const panda_file::File *file = entrypoint->GetPandaFile(); + AddPandaFile(file, false); + ScopedManagedCodeThread managed_scope(thread_); +- return InvokeEcmaEntrypoint(*file, utf::Mutf8AsCString(entrypoint->GetName().data), args); ++ return InvokeEcmaEntrypoint(*file, utf::Mutf8AsCString(entrypoint->GetName().data_), args); + } + + Expected EcmaVM::InvokeEcmaEntrypoint(const panda_file::File &pf, const CString &methodName, +@@ -641,22 +641,22 @@ Expected EcmaVM::InvokeEcmaEntrypoint(const panda_file::Fil + { + [[maybe_unused]] EcmaHandleScope scope(thread_); + JSHandle program; +- if (snapshotSerializeEnable_) { ++ if (snapshot_serialize_enable_) { + program = PandaFileTranslator::TranslatePandaFile(this, pf, methodName); + auto string = EcmaString::Cast(program->GetLocation().GetTaggedObject()); + +- auto index = ConvertToString(string).find(frameworkAbcFileName_); ++ auto index = ConvertToString(string).find(framework_abc_file_name_); + if (index != CString::npos) { + LOG_ECMA(DEBUG) << "snapShot MakeSnapShotProgramObject abc " << ConvertToString(string); + SnapShot snapShot(this); +- snapShot.MakeSnapShotProgramObject(*program, &pf, snapshotFileName_); ++ snapShot.MakeSnapShotProgramObject(*program, &pf, snapshot_file_name_); + } + } else { +- if (&pf != frameworkPandaFile_) { ++ if (&pf != framework_panda_file_) { + program = PandaFileTranslator::TranslatePandaFile(this, pf, methodName); + } else { + JSHandle string = factory_->NewFromStdStringUnCheck(pf.GetFilename(), true); +- program = JSHandle(thread_, frameworkProgram_); ++ program = JSHandle(thread_, framework_program_); + program->SetLocation(thread_, string); + RedirectMethod(pf); + } +@@ -669,7 +669,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; +@@ -692,23 +692,23 @@ Expected EcmaVM::InvokeEcmaEntrypoint(const panda_file::Fil + void EcmaVM::AddPandaFile(const panda_file::File *pf, bool isModule) + { + 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, isModule)); + } + + 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 +@@ -729,12 +729,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_); +@@ -776,17 +776,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; +@@ -798,29 +798,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 +@@ -849,17 +849,18 @@ 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); + } + } + +@@ -884,17 +885,17 @@ bool EcmaVM::VerifyFilePath(const CString &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 +@@ -923,28 +924,28 @@ void EcmaVM::StopHeapTracking() + + 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_->ecma_modules_))); ++ 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); + } + +@@ -954,17 +955,17 @@ JSHandle EcmaVM::GetModuleByName(JSHandle moduleNa + CString relativeFile = ConvertToString(EcmaString::Cast(moduleName->GetTaggedObject())); + + // generate full path +- CString abcPath = moduleManager_->GenerateModuleFullPath(currentPathFile, relativeFile); ++ CString 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()) { + CString file = ConvertToString(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; + } +@@ -972,24 +973,24 @@ JSHandle EcmaVM::GetModuleByName(JSHandle moduleNa + void EcmaVM::ExecuteModule(std::string_view moduleFile, std::string_view entryPoint, + const std::vector &args) + { +- moduleManager_->SetCurrentExportModuleName(moduleFile); ++ module_manager_->SetCurrentExportModuleName(moduleFile); + // Update Current Module + EcmaVM::ExecuteFromPf(moduleFile, entryPoint, args, true); + // Restore Current Module +- moduleManager_->RestoreCurrentExportModuleName(); ++ module_manager_->RestoreCurrentExportModuleName(); + } + + void EcmaVM::ClearNativeMethodsData() + { +- for (auto iter : nativeMethods_) { ++ for (auto iter : native_methods_) { + chunk_.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) +@@ -1014,8 +1015,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; + } +@@ -1087,8 +1088,8 @@ void EcmaVM::UpdateVmRefs() + // 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 0f46dfc..a2b682e 100644 +--- a/runtime/ecma_vm.h ++++ b/runtime/ecma_vm.h +@@ -120,7 +120,7 @@ public: + + bool IsInitialized() const + { +- return vmInitialized_; ++ return vm_initialized_; + } + + void HandleLdaStr(Frame *frame, BytecodeId string_id) override; +@@ -195,7 +195,7 @@ public: + + GCStats *GetEcmaGCStats() const + { +- return gcStats_; ++ return gc_stats_; + } + + panda::mem::GlobalObjectStorage *GetGlobalObjectStorage() const override +@@ -205,8 +205,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); + } + +@@ -296,16 +296,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 +@@ -315,7 +315,7 @@ public: + + bool ICEnable() const + { +- return icEnable_; ++ return ic_enable_; + } + + void HandleReferences([[maybe_unused]] const GCTask &task, const mem::GC::ReferenceClearPredicateT &pred) override +@@ -334,8 +334,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; + } +@@ -345,8 +345,8 @@ public: + template + void EnumerateProgram(Callback cb, const std::string &pandaFile) 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 (pandaFile == std::get<1>(iter)->GetFilename()) { + cb(std::get<0>(iter)); + break; +@@ -356,19 +356,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); +@@ -386,7 +386,7 @@ public: + + RegionFactory *GetRegionFactory() const + { +- return regionFactory_.get(); ++ return region_factory_.get(); + } + + Chunk *GetChunk() const +@@ -403,24 +403,24 @@ public: + + 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) + { +- regexpCache_ = newCache; ++ regexp_cache_ = newCache; + } + + RuntimeNotificationManager *GetNotificationManager() const + { +- return notificationManager_; ++ return notification_manager_; + } + + std::unique_ptr OpenPandaFile(std::string_view location) override; +@@ -429,7 +429,7 @@ public: + + const ChunkVector &GetNativeMethods() const + { +- return nativeMethods_; ++ return native_methods_; + } + + void SetEnableForceGC(bool enable) +@@ -444,24 +444,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_); + } + } + +@@ -532,62 +532,62 @@ private: + PandaUniquePtr ecma_reference_processor_; + + EcmaRendezvous *rendezvous_ {nullptr}; +- bool isTestMode_ {false}; ++ bool is_test_mode_ {false}; + + // VM startup states. + static JSRuntimeOptions options_; +- bool icEnable_ {true}; +- bool vmInitialized_ {false}; +- GCStats *gcStats_ {nullptr}; +- bool snapshotSerializeEnable_ {false}; +- bool snapshotDeserializeEnable_ {false}; +- bool isUncaughtExceptionRegistered_ {false}; ++ bool ic_enable_ {true}; ++ bool vm_initialized_ {false}; ++ GCStats *gc_stats_ {nullptr}; ++ bool snapshot_serialize_enable_ {false}; ++ bool snapshot_deserialize_enable_ {false}; ++ bool is_uncaught_exception_registered_ {false}; + + // VM memory management. +- EcmaStringTable *stringTable_ {nullptr}; +- std::unique_ptr regionFactory_; ++ EcmaStringTable *string_table_ {nullptr}; ++ std::unique_ptr region_factory_; + Chunk chunk_; + Heap *heap_ {nullptr}; + ObjectFactory *factory_ {nullptr}; +- CVector arrayBufferDataList_; ++ CVector 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()}; +- CString frameworkAbcFileName_; +- const panda_file::File *frameworkPandaFile_ {nullptr}; +- CVector frameworkProgramMethods_; ++ JSTaggedValue framework_program_ {JSTaggedValue::Hole()}; ++ CString framework_abc_file_name_; ++ const panda_file::File *framework_panda_file_ {nullptr}; ++ CVector framework_program_methods_; + + // VM resources. +- CString snapshotFileName_; +- ChunkVector nativeMethods_; +- ModuleManager *moduleManager_ {nullptr}; +- bool optionalLogEnabled_ {false}; ++ CString snapshot_file_name_; ++ ChunkVector native_methods_; ++ ModuleManager *module_manager_ {nullptr}; ++ bool optional_log_enabled_ {false}; + // weak reference need Redirect address +- CVector> pandaFileWithProgram_ +- GUARDED_BY(pandaFileWithProgramLock_); +- mutable os::memory::Mutex pandaFileWithProgramLock_; ++ CVector> 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}; +- CUnorderedMap> extractorCache_; ++ RuntimeNotificationManager *notification_manager_ {nullptr}; ++ CUnorderedMap> 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 465de0e..a66f8ac 100644 +--- a/runtime/frames.h ++++ b/runtime/frames.h +@@ -174,13 +174,13 @@ public: + OptimizedFrameBase() = default; + ~OptimizedFrameBase() = default; + // NOLINTNEXTLINE(misc-non-private-member-variables-in-classes) +- FrameType type; ++ FrameType type_; + // NOLINTNEXTLINE(misc-non-private-member-variables-in-classes) +- JSTaggedType *prev; // for llvm :c-fp ; for interrupt: thread-fp for gc ++ JSTaggedType *prev_; // for llvm :c-fp ; for interrupt: thread-fp for gc + static OptimizedFrameBase *GetFrameFromSp(JSTaggedType *sp) + { + return reinterpret_cast(reinterpret_cast(sp) - +- MEMBER_OFFSET(OptimizedFrameBase, prev)); ++ MEMBER_OFFSET(OptimizedFrameBase, prev_)); + } + DEFAULT_MOVE_SEMANTIC(OptimizedFrameBase); + DEFAULT_COPY_SEMANTIC(OptimizedFrameBase); +@@ -191,13 +191,13 @@ public: + OptimizedEntryFrame() = default; + ~OptimizedEntryFrame() = default; + // NOLINTNEXTLINE(misc-non-private-member-variables-in-classes) +- JSTaggedType *prevInterpretedFrameFp; ++ JSTaggedType *prev_interpreted_frame_fp_; + // NOLINTNEXTLINE(misc-non-private-member-variables-in-classes) +- OptimizedFrameBase base; ++ OptimizedFrameBase base_; + static OptimizedEntryFrame *GetFrameFromSp(JSTaggedType *sp) + { + return reinterpret_cast(reinterpret_cast(sp) - +- MEMBER_OFFSET(OptimizedEntryFrame, base.prev)); ++ MEMBER_OFFSET(OptimizedEntryFrame, base_.prev_)); + } + DEFAULT_MOVE_SEMANTIC(OptimizedEntryFrame); + DEFAULT_COPY_SEMANTIC(OptimizedEntryFrame); +@@ -208,10 +208,10 @@ public: + InterpretedFrameBase() = default; + ~InterpretedFrameBase() = default; + // NOLINTNEXTLINE(misc-non-private-member-variables-in-classes) +- JSTaggedType *prev; // for llvm :c-fp ; for interrupt: thread-fp for gc ++ JSTaggedType *prev_; // for llvm :c-fp ; for interrupt: thread-fp for gc + + // NOLINTNEXTLINE(misc-non-private-member-variables-in-classes) +- FrameType type; ++ FrameType type_; + DEFAULT_MOVE_SEMANTIC(InterpretedFrameBase); + DEFAULT_COPY_SEMANTIC(InterpretedFrameBase); + }; +@@ -219,48 +219,48 @@ public: + // align with 8 + // NOLINTNEXTLINE(cppcoreguidelines-pro-type-member-init) + struct InterpretedFrame { +- const uint8_t *pc; +- JSTaggedType *sp; ++ const uint8_t *pc_; ++ JSTaggedType *sp_; + // aligned with 8 bits +- alignas(sizeof(uint64_t)) JSTaggedValue constpool; +- JSTaggedValue function; +- JSTaggedValue profileTypeInfo; +- JSTaggedValue acc; +- JSTaggedValue env; +- InterpretedFrameBase base; ++ alignas(sizeof(uint64_t)) JSTaggedValue constpool_; ++ JSTaggedValue function_; ++ JSTaggedValue profile_type_info_; ++ JSTaggedValue acc_; ++ JSTaggedValue env_; ++ InterpretedFrameBase base_; + static InterpretedFrame *GetFrameFromSp(JSTaggedType *sp) + { + // 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 +- uintptr_t sp; +- uintptr_t fp; +- uint64_t patchId; ++ FrameType type_; ++ JSTaggedType *prev_fp_; // set cursp here ++ uintptr_t sp_; ++ uintptr_t fp_; ++ 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/hprof/heap_profiler.cpp b/runtime/hprof/heap_profiler.cpp +index 0f3178b..cfcf723 100644 +--- a/runtime/hprof/heap_profiler.cpp ++++ b/runtime/hprof/heap_profiler.cpp +@@ -30,8 +30,8 @@ namespace panda::ecmascript { + HeapProfiler::~HeapProfiler() + { + ClearSnapShot(); +- const_cast(heap_->GetRegionFactory())->Delete(jsonSerializer_); +- jsonSerializer_ = nullptr; ++ const_cast(heap_->GetRegionFactory())->Delete(json_serializer_); ++ json_serializer_ = nullptr; + } + + bool HeapProfiler::DumpHeapSnapShot(JSThread *thread, DumpFormat dumpFormat, const std::string &filePath, bool isVmMode) +@@ -44,12 +44,12 @@ bool HeapProfiler::DumpHeapSnapShot(JSThread *thread, DumpFormat dumpFormat, con + ASSERT(snapShot != nullptr); + std::pair realPath = FilePathValid(filePath); + if (realPath.first) { +- return jsonSerializer_->Serialize(snapShot, realPath.second); ++ return json_serializer_->Serialize(snapShot, realPath.second); + } + + std::pair realGenPath = FilePathValid(GenDumpFileName(dumpFormat)); + if (realGenPath.first) { +- return jsonSerializer_->Serialize(snapShot, realGenPath.second); ++ return json_serializer_->Serialize(snapShot, realGenPath.second); + } + UNREACHABLE(); + } +@@ -61,19 +61,19 @@ bool HeapProfiler::StartHeapTracking(JSThread *thread, double timeInterval, bool + if (snapShot == nullptr) { + return false; + } +- heapTracker_ = std::make_unique(snapShot, timeInterval); +- thread->GetEcmaVM()->StartHeapTracking(heapTracker_.get()); +- heapTracker_->StartTracing(); ++ heap_tracker_ = std::make_unique(snapShot, timeInterval); ++ thread->GetEcmaVM()->StartHeapTracking(heap_tracker_.get()); ++ heap_tracker_->StartTracing(); + return true; + } + + bool HeapProfiler::StopHeapTracking(JSThread *thread, [[maybe_unused]] DumpFormat dumpFormat, const std::string &path) + { +- if (heapTracker_ == nullptr) { ++ if (heap_tracker_ == nullptr) { + return false; + } + thread->GetEcmaVM()->StopHeapTracking(); +- heapTracker_->StopTracing(); ++ heap_tracker_->StopTracing(); + + // check path + if (path.empty()) { +@@ -89,7 +89,7 @@ bool HeapProfiler::StopHeapTracking(JSThread *thread, [[maybe_unused]] DumpForma + return false; + } + snapShot->FinishSnapShot(); +- return jsonSerializer_->Serialize(snapShot, realPath.second); ++ return json_serializer_->Serialize(snapShot, realPath.second); + } + + std::pair HeapProfiler::FilePathValid(const std::string &filePath) +@@ -192,7 +192,7 @@ HeapSnapShot *HeapProfiler::MakeHeapSnapShot(JSThread *thread, SampleType sample + + void HeapProfiler::AddSnapShot(HeapSnapShot *snapshot) + { +- if (hprofs_.size() >= MAX_NUM_HPROF) { ++ if (hprofs_.size() >= max_num_hprof_) { + ClearSnapShot(); + } + ASSERT(snapshot != nullptr); +diff --git a/runtime/hprof/heap_profiler.h b/runtime/hprof/heap_profiler.h +index 4395cb5..dde84c3 100644 +--- a/runtime/hprof/heap_profiler.h ++++ b/runtime/hprof/heap_profiler.h +@@ -32,8 +32,8 @@ public: + NO_COPY_SEMANTIC(HeapProfiler); + explicit HeapProfiler(const Heap *heap) : heap_(heap) + { +- jsonSerializer_ = const_cast(heap->GetRegionFactory())->New(); +- if (UNLIKELY(jsonSerializer_ == nullptr)) { ++ json_serializer_ = const_cast(heap->GetRegionFactory())->New(); ++ if (UNLIKELY(json_serializer_ == nullptr)) { + LOG_ECMA(FATAL) << "alloc snapshot json serializer failed"; + UNREACHABLE(); + } +@@ -66,10 +66,10 @@ private: + CString GetTimeStamp(); + void ClearSnapShot(); + +- const size_t MAX_NUM_HPROF = 5; // ~10MB ++ const size_t max_num_hprof_ = 5; // ~10MB + CVector hprofs_; +- HeapSnapShotJSONSerializer *jsonSerializer_ {nullptr}; +- std::unique_ptr heapTracker_; ++ HeapSnapShotJSONSerializer *json_serializer_ {nullptr}; ++ std::unique_ptr heap_tracker_; + const Heap *heap_; + }; + } // namespace panda::ecmascript +diff --git a/runtime/hprof/heap_profiler_interface.cpp b/runtime/hprof/heap_profiler_interface.cpp +index 9cb907f..f7d4e31 100644 +--- a/runtime/hprof/heap_profiler_interface.cpp ++++ b/runtime/hprof/heap_profiler_interface.cpp +@@ -18,13 +18,13 @@ + #include "plugins/ecmascript/runtime/mem/heap.h" + + namespace panda::ecmascript { +-HeapProfilerInterface *HeapProfilerInterface::heapProfile_ = nullptr; ++HeapProfilerInterface *HeapProfilerInterface::heap_profile_ = nullptr; + HeapProfilerInterface *HeapProfilerInterface::GetInstance(JSThread *thread) + { +- if (HeapProfilerInterface::heapProfile_ == nullptr) { +- heapProfile_ = HeapProfilerInterface::CreateHeapProfiler(thread); ++ if (HeapProfilerInterface::heap_profile_ == nullptr) { ++ heap_profile_ = HeapProfilerInterface::CreateHeapProfiler(thread); + } +- return HeapProfilerInterface::heapProfile_; ++ return HeapProfilerInterface::heap_profile_; + } + + void HeapProfilerInterface::DumpHeapSnapShot(JSThread *thread, DumpFormat dumpFormat, const std::string &filePath, +diff --git a/runtime/hprof/heap_profiler_interface.h b/runtime/hprof/heap_profiler_interface.h +index a338c65..f40fccf 100644 +--- a/runtime/hprof/heap_profiler_interface.h ++++ b/runtime/hprof/heap_profiler_interface.h +@@ -42,7 +42,7 @@ public: + NO_COPY_SEMANTIC(HeapProfilerInterface); + + private: +- static HeapProfilerInterface *heapProfile_; ++ static HeapProfilerInterface *heap_profile_; + }; + } // namespace panda::ecmascript + #endif // ECMASCRIPT_HPROF_HEAP_PROFILER_INTERFACE_H +diff --git a/runtime/hprof/heap_snapshot.cpp b/runtime/hprof/heap_snapshot.cpp +index 74bf6b0..f22cb02 100644 +--- a/runtime/hprof/heap_snapshot.cpp ++++ b/runtime/hprof/heap_snapshot.cpp +@@ -37,7 +37,7 @@ + namespace panda::ecmascript { + CString *HeapSnapShot::GetString(const CString &as) + { +- return stringTable_.GetString(as); ++ return string_table_.GetString(as); + } + + Node *Node::NewNode(const Heap *heap, size_t id, size_t index, CString *name, NodeType type, size_t size, +@@ -85,8 +85,8 @@ bool HeapSnapShot::BuildUp(JSThread *thread) + + bool HeapSnapShot::Verify() + { +- GetString(CString("HeapVerify:").append(ToCString(totalNodesSize_))); +- return (edgeCount_ > nodeCount_) && (totalNodesSize_ > 0); ++ GetString(CString("HeapVerify:").append(ToCString(total_nodes_size_))); ++ return (edge_count_ > node_count_) && (total_nodes_size_ > 0); + } + + void HeapSnapShot::PrepareSnapShot() +@@ -120,7 +120,7 @@ bool HeapSnapShot::FinishSnapShot() + + void HeapSnapShot::RecordSampleTime() + { +- timeStamps_.emplace_back(sequenceId_); ++ time_stamps_.emplace_back(sequence_id_); + } + + void HeapSnapShot::AddNode(uintptr_t address) +@@ -131,7 +131,7 @@ void HeapSnapShot::AddNode(uintptr_t address) + void HeapSnapShot::MoveNode(uintptr_t address, uintptr_t forward_address) + { + int sequenceId = -1; +- Node *node = entryMap_.FindAndEraseNode(address); ++ Node *node = entry_map_.FindAndEraseNode(address); + if (node != nullptr) { + sequenceId = node->GetId(); + EraseNodeUnique(node); +@@ -388,7 +388,7 @@ Node *HeapSnapShot::GenerateNode(JSThread *thread, JSTaggedValue entry, int sequ + { + Node *node = nullptr; + if (sequenceId == -1) { +- sequenceId = sequenceId_ + SEQ_STEP; ++ sequenceId = sequence_id_ + SEQ_STEP; + } + if (entry.IsHeapObject()) { + if (entry.IsWeak()) { +@@ -404,19 +404,19 @@ Node *HeapSnapShot::GenerateNode(JSThread *thread, JSTaggedValue entry, int sequ + auto *baseClass = obj->GetClass(); + if (baseClass != nullptr) { + auto name = GenerateNodeName(thread, obj); +- node = Node::NewNode(heap_, sequenceId, nodeCount_, name, GenerateNodeType(obj.GetObject()), ++ node = Node::NewNode(heap_, sequenceId, node_count_, name, GenerateNodeType(obj.GetObject()), + obj->GetClass()->SizeFromJSHClass(obj.GetObject()), + obj.GetObject()); +- Node *existNode = entryMap_.FindOrInsertNode(node); // Fast Index ++ Node *existNode = entry_map_.FindOrInsertNode(node); // Fast Index + if (existNode == node) { +- if (sequenceId == sequenceId_ + SEQ_STEP) { +- sequenceId_ = sequenceId; // Odd Digit ++ if (sequenceId == sequence_id_ + SEQ_STEP) { ++ sequence_id_ = sequenceId; // Odd Digit + } + InsertNodeUnique(node); +- ASSERT(entryMap_.FindEntry(node->GetAddress())->GetAddress() == node->GetAddress()); ++ ASSERT(entry_map_.FindEntry(node->GetAddress())->GetAddress() == node->GetAddress()); + } else { + existNode->SetLive(true); +- ASSERT(entryMap_.FindEntry(node->GetAddress())->GetAddress() == node->GetAddress()); ++ ASSERT(entry_map_.FindEntry(node->GetAddress())->GetAddress() == node->GetAddress()); + const_cast(heap_->GetRegionFactory())->Delete(node); + return nullptr; + } +@@ -446,10 +446,10 @@ Node *HeapSnapShot::GenerateNode(JSThread *thread, JSTaggedValue entry, int sequ + } + + node = +- Node::NewNode(heap_, sequenceId, nodeCount_, GetString(primitiveName), NodeType::JS_PRIMITIVE_REF, 0, obj); +- entryMap_.InsertEntry(node); // Fast Index +- if (sequenceId == sequenceId_ + SEQ_STEP) { +- sequenceId_ = sequenceId; // Odd Digit ++ Node::NewNode(heap_, sequenceId, node_count_, GetString(primitiveName), NodeType::JS_PRIMITIVE_REF, 0, obj); ++ entry_map_.InsertEntry(node); // Fast Index ++ if (sequenceId == sequence_id_ + SEQ_STEP) { ++ sequence_id_ = sequenceId; // Odd Digit + } + InsertNodeUnique(node); + } +@@ -463,18 +463,18 @@ Node *HeapSnapShot::GenerateStringNode(JSTaggedValue entry, int sequenceId) + size_t selfsize = originStr->ObjectSize(); + CString strContent; + strContent.append(EntryVisitor::ConvertKey(entry)); +- node = Node::NewNode(heap_, sequenceId, nodeCount_, GetString(strContent), NodeType::PRIM_STRING, selfsize, ++ node = Node::NewNode(heap_, sequenceId, node_count_, GetString(strContent), NodeType::PRIM_STRING, selfsize, + entry.GetTaggedObject()); +- Node *existNode = entryMap_.FindOrInsertNode(node); // Fast Index ++ Node *existNode = entry_map_.FindOrInsertNode(node); // Fast Index + if (existNode == node) { +- if (sequenceId == sequenceId_ + SEQ_STEP) { +- sequenceId_ = sequenceId; // Odd Digit ++ if (sequenceId == sequence_id_ + SEQ_STEP) { ++ sequence_id_ = sequenceId; // Odd Digit + } + InsertNodeUnique(node); + } else { + existNode->SetLive(true); + } +- ASSERT(entryMap_.FindEntry(node->GetAddress())->GetAddress() == node->GetAddress()); ++ ASSERT(entry_map_.FindEntry(node->GetAddress())->GetAddress() == node->GetAddress()); + if (existNode != node) { + const_cast(heap_->GetRegionFactory())->Delete(node); + return nullptr; +@@ -491,22 +491,22 @@ void HeapSnapShot::FillEdges(JSThread *thread) + ASSERT(*iter != nullptr); + auto *objFrom = reinterpret_cast((*iter)->GetAddress()); + std::vector> nameResources; +- JSTaggedValue(objFrom).DumpForSnapshot(thread, nameResources, isVmMode_); ++ JSTaggedValue(objFrom).DumpForSnapshot(thread, nameResources, is_vm_mode_); + JSTaggedValue objValue(objFrom); + for (auto const &it : nameResources) { + JSTaggedValue toValue = it.second; + Node *entryTo = nullptr; + if (toValue.IsHeapObject()) { + auto *to = reinterpret_cast(toValue.GetHeapObject()); +- entryTo = entryMap_.FindEntry(Node::NewAddress(to)); ++ entryTo = entry_map_.FindEntry(Node::NewAddress(to)); + } + if (entryTo == nullptr) { + entryTo = GenerateNode(thread, toValue); + } + if (entryTo != nullptr) { +- Edge *edge = Edge::NewEdge(heap_, edgeCount_, EdgeType::DEFAULT, *iter, entryTo, GetString(it.first)); ++ Edge *edge = Edge::NewEdge(heap_, edge_count_, EdgeType::DEFAULT, *iter, entryTo, GetString(it.first)); + InsertEdgeUnique(edge); +- (*iter)->IncEdgeCount(); // Update Node's edgeCount_ here ++ (*iter)->IncEdgeCount(); // Update Node's edge_count_ here + } + } + iter++; +@@ -525,9 +525,9 @@ void HeapSnapShot::FillEdges(JSThread *thread) + } else { + valueName.append("NaN"); + } +- Edge *edge = Edge::NewEdge(heap_, edgeCount_, EdgeType::DEFAULT, (*iter), (*iter), GetString(valueName)); ++ Edge *edge = Edge::NewEdge(heap_, edge_count_, EdgeType::DEFAULT, (*iter), (*iter), GetString(valueName)); + InsertEdgeUnique(edge); +- (*iter)->IncEdgeCount(); // Update Node's edgeCount_ here ++ (*iter)->IncEdgeCount(); // Update Node's edge_count_ here + } + iter++; + } +@@ -557,7 +557,7 @@ Node *HeapSnapShot::InsertNodeUnique(Node *node) + { + AccumulateNodeSize(node->GetSelfSize()); + nodes_.emplace_back(node); +- nodeCount_++; ++ node_count_++; + return node; + } + +@@ -567,37 +567,37 @@ void HeapSnapShot::EraseNodeUnique(Node *node) + if (iter != nodes_.end()) { + DecreaseNodeSize(node->GetSelfSize()); + nodes_.erase(iter); +- nodeCount_--; ++ node_count_--; + } + } + + Edge *HeapSnapShot::InsertEdgeUnique(Edge *edge) + { + edges_.emplace_back(edge); +- edgeCount_++; ++ edge_count_++; + return edge; + } + + void HeapSnapShot::AddSyntheticRoot(JSThread *thread) + { + Node *syntheticRoot = +- Node::NewNode(heap_, 1, nodeCount_, GetString("SyntheticRoot"), NodeType::SYNTHETIC, 0, nullptr); ++ Node::NewNode(heap_, 1, node_count_, GetString("SyntheticRoot"), NodeType::SYNTHETIC, 0, nullptr); + InsertNodeAt(0, syntheticRoot); + + int edgeOffset = 0; + // NOLINTNEXTLINE(cppcoreguidelines-macro-usage) +-#define ROOT_EDGE_BUILDER_CORE(type, slot) \ +- JSTaggedValue value(slot.GetTaggedType()); \ +- if (value.IsHeapObject()) { \ +- TaggedObject *root = value.GetTaggedObject(); \ +- Node *rootNode = entryMap_.FindEntry(Node::NewAddress(root)); \ +- if (rootNode != nullptr) { \ +- Edge *edge = \ +- Edge::NewEdge(heap_, edgeCount_, EdgeType::SHORTCUT, syntheticRoot, rootNode, GetString("-subroot-")); \ +- InsertEdgeAt(edgeOffset, edge); \ +- edgeOffset++; \ +- syntheticRoot->IncEdgeCount(); \ +- } \ ++#define ROOT_EDGE_BUILDER_CORE(type, slot) \ ++ JSTaggedValue value(slot.GetTaggedType()); \ ++ if (value.IsHeapObject()) { \ ++ TaggedObject *root = value.GetTaggedObject(); \ ++ Node *rootNode = entry_map_.FindEntry(Node::NewAddress(root)); \ ++ if (rootNode != nullptr) { \ ++ Edge *edge = Edge::NewEdge(heap_, edge_count_, EdgeType::SHORTCUT, syntheticRoot, rootNode, \ ++ GetString("-subroot-")); \ ++ InsertEdgeAt(edgeOffset, edge); \ ++ edgeOffset++; \ ++ syntheticRoot->IncEdgeCount(); \ ++ } \ + } + + RootVisitor rootEdgeBuilder = [this, syntheticRoot, &edgeOffset]([[maybe_unused]] Root type, ObjectSlot slot) { +@@ -611,7 +611,7 @@ void HeapSnapShot::AddSyntheticRoot(JSThread *thread) + } + }; + #undef ROOT_EDGE_BUILDER_CORE +- rootVisitor_.VisitHeapRoots(thread, rootEdgeBuilder, rootRangeEdgeBuilder); ++ root_visitor_.VisitHeapRoots(thread, rootEdgeBuilder, rootRangeEdgeBuilder); + + int reindex = 0; + for (Node *node : nodes_) { +@@ -626,7 +626,7 @@ Node *HeapSnapShot::InsertNodeAt(size_t pos, Node *node) + auto iter = nodes_.begin(); + std::advance(iter, pos); + nodes_.insert(iter, node); +- nodeCount_++; ++ node_count_++; + return node; + } + +@@ -634,7 +634,7 @@ Edge *HeapSnapShot::InsertEdgeAt(size_t pos, Edge *edge) + { + ASSERT(edge != nullptr); + edges_.insert(edges_.begin() + pos, edge); +- edgeCount_++; ++ edge_count_++; + return edge; + } + +@@ -667,8 +667,8 @@ CString EntryVisitor::ConvertKey(JSTaggedValue key) + Node *HeapEntryMap::FindOrInsertNode(Node *node) + { + ASSERT(node != nullptr); +- auto it = nodesMap_.find(node->GetAddress()); +- if (it != nodesMap_.end()) { ++ auto it = nodes_map_.find(node->GetAddress()); ++ if (it != nodes_map_.end()) { + return it->second; + } + InsertEntry(node); +@@ -677,11 +677,11 @@ Node *HeapEntryMap::FindOrInsertNode(Node *node) + + Node *HeapEntryMap::FindAndEraseNode(Address addr) + { +- auto it = nodesMap_.find(addr); +- if (it != nodesMap_.end()) { ++ auto it = nodes_map_.find(addr); ++ if (it != nodes_map_.end()) { + Node *node = it->second; +- nodesMap_.erase(it); +- nodeEntryCount_--; ++ nodes_map_.erase(it); ++ node_entry_count_--; + return node; + } + return nullptr; +@@ -689,14 +689,14 @@ Node *HeapEntryMap::FindAndEraseNode(Address addr) + + Node *HeapEntryMap::FindEntry(Address addr) + { +- auto it = nodesMap_.find(addr); +- return it != nodesMap_.end() ? it->second : nullptr; ++ auto it = nodes_map_.find(addr); ++ return it != nodes_map_.end() ? it->second : nullptr; + } + + void HeapEntryMap::InsertEntry(Node *node) + { +- nodeEntryCount_++; +- nodesMap_.insert(std::make_pair(node->GetAddress(), node)); ++ node_entry_count_++; ++ nodes_map_.insert(std::make_pair(node->GetAddress(), node)); + } + + FrontType NodeTypeConverter::Convert(NodeType type) +diff --git a/runtime/hprof/heap_snapshot.h b/runtime/hprof/heap_snapshot.h +index f399294..89f1132 100644 +--- a/runtime/hprof/heap_snapshot.h ++++ b/runtime/hprof/heap_snapshot.h +@@ -52,9 +52,9 @@ public: + name_(name), + type_(type), + size_(size), +- traceId_(traceId), ++ trace_id_(traceId), + address_(address), +- isLive_(isLive) ++ is_live_(isLive) + { + } + uint64_t GetId() const +@@ -84,15 +84,15 @@ public: + } + size_t GetEdgeCount() const + { +- return edgeCount_; ++ return edge_count_; + } + void IncEdgeCount() + { +- edgeCount_++; ++ edge_count_++; + } + uint64_t GetStackTraceId() const + { +- return traceId_; ++ return trace_id_; + } + Address GetAddress() const + { +@@ -100,11 +100,11 @@ public: + } + bool IsLive() const + { +- return isLive_; ++ return is_live_; + } + void SetLive(bool isLive) + { +- isLive_ = isLive; ++ is_live_ = isLive; + } + static Node *NewNode(const Heap *heap, size_t id, size_t index, CString *name, NodeType type, size_t size, + TaggedObject *entry, bool isLive = true); +@@ -125,16 +125,16 @@ private: + CString *name_ {nullptr}; + NodeType type_ {NodeType::INVALID}; + size_t size_ {0}; +- size_t edgeCount_ {0}; +- uint64_t traceId_ {0}; ++ size_t edge_count_ {0}; ++ uint64_t trace_id_ {0}; + Address address_ {0x0}; +- bool isLive_ {true}; ++ bool is_live_ {true}; + }; + + class Edge { + public: + explicit Edge(uint64_t id, EdgeType type, Node *from, Node *to, CString *name) +- : id_(id), edgeType_(type), from_(from), to_(to), name_(name) ++ : id_(id), edge_type_(type), from_(from), to_(to), name_(name) + { + } + uint64_t GetId() const +@@ -143,7 +143,7 @@ public: + } + EdgeType GetType() const + { +- return edgeType_; ++ return edge_type_; + } + const Node *GetFrom() const + { +@@ -178,7 +178,7 @@ public: + + private: + uint64_t id_ {-1ULL}; +- EdgeType edgeType_ {EdgeType::DEFAULT}; ++ EdgeType edge_type_ {EdgeType::DEFAULT}; + Node *from_ {nullptr}; + Node *to_ {nullptr}; + CString *name_ {nullptr}; +@@ -186,7 +186,7 @@ private: + + class TimeStamp { + public: +- explicit TimeStamp(int sequenceId) : lastSequenceId_(sequenceId), timeStampUs_(TimeStamp::Now()) {} ++ explicit TimeStamp(int sequenceId) : last_sequence_id_(sequenceId), time_stamp_us_(TimeStamp::Now()) {} + ~TimeStamp() = default; + + DEFAULT_MOVE_SEMANTIC(TimeStamp); +@@ -194,12 +194,12 @@ public: + + int GetLastSequenceId() const + { +- return lastSequenceId_; ++ return last_sequence_id_; + } + + int64_t GetTimeStamp() const + { +- return timeStampUs_; ++ return time_stamp_us_; + } + + private: +@@ -211,8 +211,8 @@ private: + return tv.tv_usec + tv.tv_sec * THOUSAND * THOUSAND; + } + +- int lastSequenceId_ {0}; +- int64_t timeStampUs_ {0}; ++ int last_sequence_id_ {0}; ++ int64_t time_stamp_us_ {0}; + }; + + class HeapEntryMap { +@@ -226,17 +226,17 @@ public: + Node *FindEntry(Address addr); + size_t GetCapcity() const + { +- return nodesMap_.size(); ++ return nodes_map_.size(); + } + size_t GetEntryCount() const + { +- return nodeEntryCount_; ++ return node_entry_count_; + } + void InsertEntry(Node *node); + + private: +- size_t nodeEntryCount_ {0}; +- CUnorderedMap nodesMap_ {}; ++ size_t node_entry_count_ {0}; ++ CUnorderedMap nodes_map_ {}; + }; + + class HeapSnapShot { +@@ -245,7 +245,7 @@ public: + NO_MOVE_SEMANTIC(HeapSnapShot); + NO_COPY_SEMANTIC(HeapSnapShot); + explicit HeapSnapShot(JSThread *thread, const Heap *heap, const bool isVmMode) +- : stringTable_(heap), thread_(thread), heap_(heap), isVmMode_(isVmMode) ++ : string_table_(heap), thread_(thread), heap_(heap), is_vm_mode_(isVmMode) + { + } + ~HeapSnapShot(); +@@ -261,28 +261,28 @@ public: + + const CVector &GetTimeStamps() const + { +- return timeStamps_; ++ return time_stamps_; + } + + size_t GetNodeCount() const + { +- return nodeCount_; ++ return node_count_; + } + size_t GetEdgeCount() const + { +- return edgeCount_; ++ return edge_count_; + } + size_t GetTotalNodeSize() const + { +- return totalNodesSize_; ++ return total_nodes_size_; + } + void AccumulateNodeSize(size_t size) + { +- totalNodesSize_ += size; ++ total_nodes_size_ += size; + } + void DecreaseNodeSize(size_t size) + { +- totalNodesSize_ -= size; ++ total_nodes_size_ -= size; + } + CString *GenerateNodeName(JSThread *thread, const JSHandle &entry); + NodeType GenerateNodeType(TaggedObject *entry); +@@ -296,14 +296,14 @@ public: + } + const StringHashMap *GetEcmaStringTable() const + { +- return &stringTable_; ++ return &string_table_; + } + + CString *GetString(const CString &as); + + bool IsInVmMode() const + { +- return isVmMode_; ++ return is_vm_mode_; + } + + private: +@@ -321,19 +321,19 @@ private: + Node *InsertNodeAt(size_t pos, Node *node); + Edge *InsertEdgeAt(size_t pos, Edge *edge); + +- StringHashMap stringTable_; ++ StringHashMap string_table_; + CList nodes_ {}; + CVector edges_ {}; +- CVector timeStamps_ {}; +- std::atomic_int sequenceId_ {1}; // 1 Reversed for SyntheticRoot +- int nodeCount_ {0}; +- int edgeCount_ {0}; +- int totalNodesSize_ {0}; +- HeapEntryMap entryMap_; +- panda::ecmascript::HeapRootVisitor rootVisitor_; ++ CVector time_stamps_ {}; ++ std::atomic_int sequence_id_ {1}; // 1 Reversed for SyntheticRoot ++ int node_count_ {0}; ++ int edge_count_ {0}; ++ int total_nodes_size_ {0}; ++ HeapEntryMap entry_map_; ++ panda::ecmascript::HeapRootVisitor root_visitor_; + JSThread *thread_; + const Heap *heap_; +- bool isVmMode_ {true}; ++ bool is_vm_mode_ {true}; + }; + + class EntryVisitor { +diff --git a/runtime/hprof/heap_snapshot_json_serializer.cpp b/runtime/hprof/heap_snapshot_json_serializer.cpp +index a811dd6..af9a8a5 100644 +--- a/runtime/hprof/heap_snapshot_json_serializer.cpp ++++ b/runtime/hprof/heap_snapshot_json_serializer.cpp +@@ -23,10 +23,10 @@ bool HeapSnapShotJSONSerializer::Serialize(HeapSnapShot *snapShot, const CString + { + // Serialize Node/Edge/String-Table + LOG(ERROR, RUNTIME) << "HeapSnapShotJSONSerializer::Serialize begin"; +- snapShot_ = snapShot; +- ASSERT(snapShot_->GetNodes() != nullptr && snapShot_->GetEdges() != nullptr && +- snapShot_->GetEcmaStringTable() != nullptr); +- stringBuffer_.str(""); // Clear Buffer ++ snap_shot_ = snapShot; ++ ASSERT(snap_shot_->GetNodes() != nullptr && snap_shot_->GetEdges() != nullptr && ++ snap_shot_->GetEcmaStringTable() != nullptr); ++ string_buffer_.str(""); // Clear Buffer + + SerializeSnapShotHeader(); // 1. + SerializeNodes(); // 2. +@@ -45,62 +45,62 @@ bool HeapSnapShotJSONSerializer::Serialize(HeapSnapShot *snapShot, const CString + + void HeapSnapShotJSONSerializer::SerializeSnapShotHeader() + { +- stringBuffer_ << "{\"snapshot\":\n"; // 1. +- stringBuffer_ << "{\"meta\":\n"; // 2. ++ string_buffer_ << "{\"snapshot\":\n"; // 1. ++ string_buffer_ << "{\"meta\":\n"; // 2. + // NOLINTNEXTLINE(modernize-raw-string-literal) +- stringBuffer_ << "{\"node_fields\":[\"type\",\"name\",\"id\",\"self_size\",\"edge_count\",\"trace_node_id\","; +- stringBuffer_ << "\"detachedness\"],\n"; // 3. ++ string_buffer_ << "{\"node_fields\":[\"type\",\"name\",\"id\",\"self_size\",\"edge_count\",\"trace_node_id\","; ++ string_buffer_ << "\"detachedness\"],\n"; // 3. + // NOLINTNEXTLINE(modernize-raw-string-literal) +- stringBuffer_ << "\"node_types\":[[\"hidden\",\"array\",\"string\",\"object\",\"code\",\"closure\",\"regexp\","; ++ string_buffer_ << "\"node_types\":[[\"hidden\",\"array\",\"string\",\"object\",\"code\",\"closure\",\"regexp\","; + // NOLINTNEXTLINE(modernize-raw-string-literal) +- stringBuffer_ << "\"number\",\"native\",\"synthetic\",\"concatenated string\",\"slicedstring\",\"symbol\","; ++ string_buffer_ << "\"number\",\"native\",\"synthetic\",\"concatenated string\",\"slicedstring\",\"symbol\","; + // NOLINTNEXTLINE(modernize-raw-string-literal) +- stringBuffer_ << "\"bigint\"],\"string\",\"number\",\"number\",\"number\",\"number\",\"number\"],\n"; // 4. ++ string_buffer_ << "\"bigint\"],\"string\",\"number\",\"number\",\"number\",\"number\",\"number\"],\n"; // 4. + // NOLINTNEXTLINE(modernize-raw-string-literal) +- stringBuffer_ << "\"edge_fields\":[\"type\",\"name_or_index\",\"to_node\"],\n"; // 5. ++ string_buffer_ << "\"edge_fields\":[\"type\",\"name_or_index\",\"to_node\"],\n"; // 5. + // NOLINTNEXTLINE(modernize-raw-string-literal) +- stringBuffer_ << "\"edge_types\":[[\"context\",\"element\",\"property\",\"internal\",\"hidden\",\"shortcut\","; ++ string_buffer_ << "\"edge_types\":[[\"context\",\"element\",\"property\",\"internal\",\"hidden\",\"shortcut\","; + // NOLINTNEXTLINE(modernize-raw-string-literal) +- stringBuffer_ << "\"weak\"],\"string_or_number\",\"node\"],\n"; // 6. ++ string_buffer_ << "\"weak\"],\"string_or_number\",\"node\"],\n"; // 6. + // NOLINTNEXTLINE(modernize-raw-string-literal) +- stringBuffer_ << "\"trace_function_info_fields\":[\"function_id\",\"name\",\"script_name\",\"script_id\","; ++ string_buffer_ << "\"trace_function_info_fields\":[\"function_id\",\"name\",\"script_name\",\"script_id\","; + // NOLINTNEXTLINE(modernize-raw-string-literal) +- stringBuffer_ << "\"line\",\"column\"],\n"; // 7. ++ string_buffer_ << "\"line\",\"column\"],\n"; // 7. + // NOLINTNEXTLINE(modernize-raw-string-literal) +- stringBuffer_ << "\"trace_node_fields\":[\"id\",\"function_info_index\",\"count\",\"size\",\"children\"],\n"; ++ string_buffer_ << "\"trace_node_fields\":[\"id\",\"function_info_index\",\"count\",\"size\",\"children\"],\n"; + // NOLINTNEXTLINE(modernize-raw-string-literal) +- stringBuffer_ << "\"sample_fields\":[\"timestamp_us\",\"last_assigned_id\"],\n"; // 9. ++ string_buffer_ << "\"sample_fields\":[\"timestamp_us\",\"last_assigned_id\"],\n"; // 9. + // NOLINTNEXTLINE(modernize-raw-string-literal) +- stringBuffer_ << "\"location_fields\":[\"object_index\",\"script_id\",\"line\",\"column\"]},\n"; // 10. +- stringBuffer_ << "\"node_count\":" << snapShot_->GetNodeCount() << ",\n"; // 11. +- stringBuffer_ << "\"edge_count\":" << snapShot_->GetEdgeCount() << ",\n"; // 12. +- stringBuffer_ << "\"trace_function_count\":" +- << "0\n"; // 13. +- stringBuffer_ << "},\n"; // 14. ++ string_buffer_ << "\"location_fields\":[\"object_index\",\"script_id\",\"line\",\"column\"]},\n"; // 10. ++ string_buffer_ << "\"node_count\":" << snap_shot_->GetNodeCount() << ",\n"; // 11. ++ string_buffer_ << "\"edge_count\":" << snap_shot_->GetEdgeCount() << ",\n"; // 12. ++ string_buffer_ << "\"trace_function_count\":" ++ << "0\n"; // 13. ++ string_buffer_ << "},\n"; // 14. + } + + void HeapSnapShotJSONSerializer::SerializeNodes() + { +- const CList *nodes = snapShot_->GetNodes(); +- const StringHashMap *stringTable = snapShot_->GetEcmaStringTable(); ++ const CList *nodes = snap_shot_->GetNodes(); ++ const StringHashMap *stringTable = snap_shot_->GetEcmaStringTable(); + ASSERT(nodes != nullptr); +- stringBuffer_ << "\"nodes\":["; // Section Header ++ string_buffer_ << "\"nodes\":["; // Section Header + size_t i = 0; + for (auto *node : *nodes) { + if (i > 0) { +- stringBuffer_ << ","; // add comma except first line ++ string_buffer_ << ","; // add comma except first line + } +- stringBuffer_ << static_cast(NodeTypeConverter::Convert(node->GetType())) << ","; // 1. +- stringBuffer_ << stringTable->GetStringId(node->GetName()) << ","; // 2. +- stringBuffer_ << node->GetId() << ","; // 3. +- stringBuffer_ << node->GetSelfSize() << ","; // 4. +- stringBuffer_ << node->GetEdgeCount() << ","; // 5. +- stringBuffer_ << node->GetStackTraceId() << ","; // 6. ++ string_buffer_ << static_cast(NodeTypeConverter::Convert(node->GetType())) << ","; // 1. ++ string_buffer_ << stringTable->GetStringId(node->GetName()) << ","; // 2. ++ string_buffer_ << node->GetId() << ","; // 3. ++ string_buffer_ << node->GetSelfSize() << ","; // 4. ++ string_buffer_ << node->GetEdgeCount() << ","; // 5. ++ string_buffer_ << node->GetStackTraceId() << ","; // 6. + if (i == nodes->size() - 1) { // add comma at last the line +- stringBuffer_ << "0" +- << "],\n"; // 7. detachedness default ++ string_buffer_ << "0" ++ << "],\n"; // 7. detachedness default + } else { +- stringBuffer_ << "0\n"; // 7. ++ string_buffer_ << "0\n"; // 7. + } + i++; + } +@@ -108,22 +108,22 @@ void HeapSnapShotJSONSerializer::SerializeNodes() + + void HeapSnapShotJSONSerializer::SerializeEdges() + { +- const CVector *edges = snapShot_->GetEdges(); +- const StringHashMap *stringTable = snapShot_->GetEcmaStringTable(); ++ const CVector *edges = snap_shot_->GetEdges(); ++ const StringHashMap *stringTable = snap_shot_->GetEcmaStringTable(); + ASSERT(edges != nullptr); +- stringBuffer_ << "\"edges\":["; ++ string_buffer_ << "\"edges\":["; + size_t i = 0; + for (auto *edge : *edges) { + if (i > 0) { // add comma except the first line +- stringBuffer_ << ","; ++ string_buffer_ << ","; + } +- stringBuffer_ << static_cast(edge->GetType()) << ","; // 1. +- stringBuffer_ << stringTable->GetStringId(edge->GetName()) << ","; // 2. Use StringId ++ string_buffer_ << static_cast(edge->GetType()) << ","; // 1. ++ string_buffer_ << stringTable->GetStringId(edge->GetName()) << ","; // 2. Use StringId + + if (i == edges->size() - 1) { // add comma at last the line +- stringBuffer_ << edge->GetTo()->GetIndex() * Node::NODE_FIELD_COUNT << "],\n"; // 3. ++ string_buffer_ << edge->GetTo()->GetIndex() * Node::NODE_FIELD_COUNT << "],\n"; // 3. + } else { +- stringBuffer_ << edge->GetTo()->GetIndex() * Node::NODE_FIELD_COUNT << "\n"; // 3. ++ string_buffer_ << edge->GetTo()->GetIndex() * Node::NODE_FIELD_COUNT << "\n"; // 3. + } + i++; + } +@@ -131,76 +131,76 @@ void HeapSnapShotJSONSerializer::SerializeEdges() + + void HeapSnapShotJSONSerializer::SerializeTraceFunctionInfo() + { +- stringBuffer_ << "\"trace_function_infos\":[],\n"; // Empty ++ string_buffer_ << "\"trace_function_infos\":[],\n"; // Empty + } + + void HeapSnapShotJSONSerializer::SerializeTraceTree() + { +- stringBuffer_ << "\"trace_tree\":[],\n"; // Empty ++ string_buffer_ << "\"trace_tree\":[],\n"; // Empty + } + + void HeapSnapShotJSONSerializer::SerializeSamples() + { +- stringBuffer_ << "\"samples\":["; +- const CVector &timeStamps = snapShot_->GetTimeStamps(); ++ string_buffer_ << "\"samples\":["; ++ const CVector &timeStamps = snap_shot_->GetTimeStamps(); + if (!timeStamps.empty()) { + auto firstTimeStamp = timeStamps[0]; + bool isFirst = true; + for (auto timeStamp : timeStamps) { + if (!isFirst) { +- stringBuffer_ << "\n, "; ++ string_buffer_ << "\n, "; + } else { + isFirst = false; + } +- stringBuffer_ << timeStamp.GetTimeStamp() - firstTimeStamp.GetTimeStamp() << ", "; +- stringBuffer_ << timeStamp.GetLastSequenceId(); ++ string_buffer_ << timeStamp.GetTimeStamp() - firstTimeStamp.GetTimeStamp() << ", "; ++ string_buffer_ << timeStamp.GetLastSequenceId(); + } + } +- stringBuffer_ << "],\n"; ++ string_buffer_ << "],\n"; + } + + void HeapSnapShotJSONSerializer::SerializeLocations() + { +- stringBuffer_ << "\"locations\":[],\n"; ++ string_buffer_ << "\"locations\":[],\n"; + } + + void HeapSnapShotJSONSerializer::SerializeStringTable() + { +- const StringHashMap *stringTable = snapShot_->GetEcmaStringTable(); ++ const StringHashMap *stringTable = snap_shot_->GetEcmaStringTable(); + ASSERT(stringTable != nullptr); +- stringBuffer_ << "\"strings\":[\"\",\n"; +- stringBuffer_ << "\"\",\n"; +- stringBuffer_ << "\"GC roots\",\n"; ++ string_buffer_ << "\"strings\":[\"\",\n"; ++ string_buffer_ << "\"\",\n"; ++ string_buffer_ << "\"GC roots\",\n"; + // StringId Range from 3 + size_t capcity = stringTable->GetCapcity(); + size_t i = 0; + for (auto key : stringTable->GetOrderedKeyStorage()) { + if (i == capcity - 1) { +- stringBuffer_ << "\"" << *(stringTable->GetStringByKey(key)) << "\"\n"; // No Comma for the last line ++ string_buffer_ << "\"" << *(stringTable->GetStringByKey(key)) << "\"\n"; // No Comma for the last line + } else { +- stringBuffer_ << "\"" << *(stringTable->GetStringByKey(key)) << "\",\n"; ++ string_buffer_ << "\"" << *(stringTable->GetStringByKey(key)) << "\",\n"; + } + i++; + } +- stringBuffer_ << "]\n"; ++ string_buffer_ << "]\n"; + } + + void HeapSnapShotJSONSerializer::SerializerSnapShotClosure() + { +- stringBuffer_ << "}\n"; ++ string_buffer_ << "}\n"; + } + + void HeapSnapShotJSONSerializer::WriteJSON(const CString &fileName) + { + std::string fName(fileName); + LOG(ERROR, RUNTIME) << "HeapSnapShotJSONSerializer::WriteJSON" << fName; +- outputStream_.open(fName, std::ios::out); +- if (!outputStream_.good()) { ++ output_stream_.open(fName, std::ios::out); ++ if (!output_stream_.good()) { + LOG_ECMA(ERROR) << "open file failed"; + return; + } +- outputStream_ << stringBuffer_.str(); +- outputStream_.close(); +- outputStream_.clear(); // Make sure the next open operation success ++ output_stream_ << string_buffer_.str(); ++ output_stream_.close(); ++ output_stream_.clear(); // Make sure the next open operation success + } + } // namespace panda::ecmascript +diff --git a/runtime/hprof/heap_snapshot_json_serializer.h b/runtime/hprof/heap_snapshot_json_serializer.h +index 84ebf89..06ecb3e 100644 +--- a/runtime/hprof/heap_snapshot_json_serializer.h ++++ b/runtime/hprof/heap_snapshot_json_serializer.h +@@ -48,9 +48,9 @@ private: + void SerializerSnapShotClosure(); + + void WriteJSON(const CString &fileName); +- fstream outputStream_; +- HeapSnapShot *snapShot_ {nullptr}; +- stringstream stringBuffer_; ++ fstream output_stream_; ++ HeapSnapShot *snap_shot_ {nullptr}; ++ stringstream string_buffer_; + }; + } // namespace panda::ecmascript + #endif // ECMASCRIPT_HPROF_HEAP_SNAPSHOT_SERIALIZER_H +diff --git a/runtime/hprof/heap_tracker.cpp b/runtime/hprof/heap_tracker.cpp +index c15fd68..cd88dbf 100644 +--- a/runtime/hprof/heap_tracker.cpp ++++ b/runtime/hprof/heap_tracker.cpp +@@ -22,23 +22,23 @@ static constexpr int32_t MILLI_TO_MICRO = 1000; + + void HeapTrackerSample::Run() + { +- while (!isInterrupt_) { +- snapShot_->RecordSampleTime(); +- usleep(timeInterval_ * MILLI_TO_MICRO); ++ while (!is_interrupt_) { ++ snap_shot_->RecordSampleTime(); ++ usleep(time_interval_ * MILLI_TO_MICRO); + } + } + + void HeapTracker::AllocationEvent(uintptr_t address) + { +- if (snapShot_ != nullptr) { +- snapShot_->AddNode(address); ++ if (snap_shot_ != nullptr) { ++ snap_shot_->AddNode(address); + } + } + + void HeapTracker::MoveEvent(uintptr_t address, uintptr_t forward_address) + { +- if (snapShot_ != nullptr) { +- snapShot_->MoveNode(address, forward_address); ++ if (snap_shot_ != nullptr) { ++ snap_shot_->MoveNode(address, forward_address); + } + } + } // namespace panda::ecmascript +diff --git a/runtime/hprof/heap_tracker.h b/runtime/hprof/heap_tracker.h +index f0d98e1..5617db3 100644 +--- a/runtime/hprof/heap_tracker.h ++++ b/runtime/hprof/heap_tracker.h +@@ -28,24 +28,24 @@ class HeapSnapShot; + class HeapTrackerSample { + public: + explicit HeapTrackerSample(HeapSnapShot *snapShot, double timeInterval) +- : timeInterval_(timeInterval), snapShot_(snapShot) ++ : time_interval_(timeInterval), snap_shot_(snapShot) + { + } + + ~HeapTrackerSample() + { +- isInterrupt_ = true; ++ is_interrupt_ = true; + } + + void Start() + { +- isInterrupt_ = false; ++ is_interrupt_ = false; + thread_ = std::thread(&HeapTrackerSample::Run, this); + } + + void Stop() + { +- isInterrupt_ = true; ++ is_interrupt_ = true; + if (thread_.joinable()) { + thread_.join(); + } +@@ -58,14 +58,14 @@ public: + + private: + std::thread thread_; +- std::atomic_bool isInterrupt_ = true; +- double timeInterval_ = 0; +- HeapSnapShot *snapShot_; ++ std::atomic_bool is_interrupt_ = true; ++ double time_interval_ = 0; ++ HeapSnapShot *snap_shot_; + }; + + class HeapTracker { + public: +- HeapTracker(HeapSnapShot *snapShot, double timeInterval) : snapShot_(snapShot), sample_(snapShot, timeInterval) {} ++ HeapTracker(HeapSnapShot *snapShot, double timeInterval) : snap_shot_(snapShot), sample_(snapShot, timeInterval) {} + ~HeapTracker() = default; + + void StartTracing() +@@ -85,7 +85,7 @@ public: + NO_MOVE_SEMANTIC(HeapTracker); + + private: +- HeapSnapShot *snapShot_; ++ HeapSnapShot *snap_shot_; + HeapTrackerSample sample_; + }; + } // namespace panda::ecmascript +diff --git a/runtime/hprof/string_hashmap.cpp b/runtime/hprof/string_hashmap.cpp +index 43c0218..82e7c01 100644 +--- a/runtime/hprof/string_hashmap.cpp ++++ b/runtime/hprof/string_hashmap.cpp +@@ -25,15 +25,15 @@ CString *StringHashMap::FindOrInsertString(CString *string) + } + index_++; + hashmap_.insert(std::make_pair(key, string)); +- orderedKey_.emplace_back(key); +- indexMap_.insert(std::make_pair(key, index_)); ++ ordered_key_.emplace_back(key); ++ index_map_.insert(std::make_pair(key, index_)); + return string; + } + + StringId StringHashMap::GetStringId(const CString *string) const + { +- auto it = indexMap_.find(GenerateStringKey(string)); +- return it != indexMap_.end() ? it->second : 1; // "" ++ auto it = index_map_.find(GenerateStringKey(string)); ++ return it != index_map_.end() ? it->second : 1; // "" + } + + CString *StringHashMap::GetStringByKey(StringKey key) const +diff --git a/runtime/hprof/string_hashmap.h b/runtime/hprof/string_hashmap.h +index 776a750..b55402a 100644 +--- a/runtime/hprof/string_hashmap.h ++++ b/runtime/hprof/string_hashmap.h +@@ -49,7 +49,7 @@ public: + */ + const CVector &GetOrderedKeyStorage() const + { +- return orderedKey_; ++ return ordered_key_; + } + /* + * Get string by its hash key +@@ -57,8 +57,8 @@ public: + CString *GetStringByKey(StringKey key) const; + size_t GetCapcity() const + { +- ASSERT(orderedKey_.size() == hashmap_.size()); +- return orderedKey_.size(); ++ ASSERT(ordered_key_.size() == hashmap_.size()); ++ return ordered_key_.size(); + } + /* + * For external call to use this StringTable +@@ -74,9 +74,9 @@ private: + */ + void Clear(); + const Heap *heap_; +- CVector orderedKey_; // Used for Serialize Order +- size_t index_ {2}; // 2: Offset the String-Table Header +- CUnorderedMap indexMap_; ++ CVector ordered_key_; // Used for Serialize Order ++ size_t index_ {2}; // 2: Offset the String-Table Header ++ CUnorderedMap index_map_; + CUnorderedMap hashmap_; + }; + } // namespace panda::ecmascript +diff --git a/runtime/ic/ic_runtime.cpp b/runtime/ic/ic_runtime.cpp +index 3c72fc2..b93798a 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, 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 67a0972..1f8e780 100644 +--- a/runtime/ic/ic_runtime.h ++++ b/runtime/ic/ic_runtime.h +@@ -30,7 +30,7 @@ class ObjectOperator; + class ICRuntime { + public: + ICRuntime(JSThread *thread, JSHandle profileTypeInfo, uint32_t slotId, ICKind kind) +- : thread_(thread), icAccessor_(thread, profileTypeInfo, slotId, kind) ++ : thread_(thread), ic_accessor_(thread, profileTypeInfo, slotId, kind) + { + } + +@@ -46,12 +46,12 @@ public: + + void UpdateReceiverHClass(JSHandle receiverHClass) + { +- receiverHClass_ = receiverHClass; ++ receiver_h_class_ = receiverHClass; + } + + ICKind GetICKind() const + { +- return icAccessor_.GetKind(); ++ return ic_accessor_.GetKind(); + } + + void TraceIC(JSHandle receiver, JSHandle key) const; +@@ -60,9 +60,9 @@ 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 { +diff --git a/runtime/ic/profile_type_info.cpp b/runtime/ic/profile_type_info.cpp +index 306d1ae..bf33155 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, GetWeakRef(dynclass.GetTaggedValue())); +- profileTypeInfo_->Set(thread_, index + 1, handler.GetTaggedValue()); ++ profile_type_info_->Set(thread_, index, GetWeakRef(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 a8584fb..0ab0ac7 100644 +--- a/runtime/ic/profile_type_info.h ++++ b/runtime/ic/profile_type_info.h +@@ -109,7 +109,7 @@ public: + }; + + ProfileTypeAccessor(JSThread *thread, JSHandle profileTypeInfo, uint32_t slotId, ICKind kind) +- : thread_(thread), profileTypeInfo_(profileTypeInfo), slotId_(slotId), kind_(kind) ++ : thread_(thread), profile_type_info_(profileTypeInfo), slot_id_(slotId), kind_(kind) + { + } + ~ProfileTypeAccessor() = default; +@@ -144,8 +144,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/intrinsics-inl.h b/runtime/intrinsics-inl.h +index 247692b..3f14241 100644 +--- a/runtime/intrinsics-inl.h ++++ b/runtime/intrinsics-inl.h +@@ -90,7 +90,7 @@ static inline JSTaggedValue HandlerCall(JSThread *thread, JSTaggedValue fn_objec + return JSTaggedValue::Exception(); + } + +- LOG(DEBUG, INTERPRETER) << "Method name: " << method->GetName().data; ++ LOG(DEBUG, INTERPRETER) << "Method name: " << method->GetName().data_; + JSTaggedValue ret_value = EcmaInterpreter::ExecuteInvoke(thread, fn_object, num_args, args); + + if (UNLIKELY(thread->HasPendingException())) { +diff --git a/runtime/js_collator.cpp b/runtime/js_collator.cpp +index 571c66a..2e83f8d 100644 +--- a/runtime/js_collator.cpp ++++ b/runtime/js_collator.cpp +@@ -24,10 +24,10 @@ namespace panda::ecmascript { + // NOLINTNEXTLINE (readability-identifier-naming, fuchsia-statically-constructed-objects) + const CString JSCollator::uIcuDataColl = U_ICUDATA_NAME U_TREE_SEPARATOR_STRING "coll"; + // NOLINTNEXTLINE(fuchsia-statically-constructed-objects) +-const std::map JSCollator::caseFirstMap = { ++const std::map JSCollator::CASE_FIRST_MAP = { + {"upper", CaseFirstOption::UPPER}, {"lower", CaseFirstOption::LOWER}, {"false", CaseFirstOption::FALSE_OPTION}}; + // NOLINTNEXTLINE(fuchsia-statically-constructed-objects) +-const std::map JSCollator::uColAttributeValueMap = { ++const std::map JSCollator::U_COL_ATTRIBUTE_VALUE_MAP = { + {CaseFirstOption::UPPER, UCOL_UPPER_FIRST}, + {CaseFirstOption::LOWER, UCOL_LOWER_FIRST}, + {CaseFirstOption::FALSE_OPTION, UCOL_OFF}, +@@ -147,7 +147,7 @@ JSHandle JSCollator::InitializeCollator(JSThread *thread, const JSHa + } + ResolvedLocale r = + JSLocale::ResolveLocale(thread, availableLocales, requestedLocales, matcher, relevantExtensionKeys); +- icu::Locale icuLocale = r.localeData; ++ icu::Locale icuLocale = r.locale_data_; + JSHandle localeStr = JSLocale::ToLanguageTag(thread, icuLocale); + collator->SetLocale(thread, localeStr.GetTaggedValue()); + ASSERT_PRINT(!icuLocale.isBogus(), "icuLocale is bogus"); +@@ -156,8 +156,8 @@ JSHandle JSCollator::InitializeCollator(JSThread *thread, const JSHa + // if found, set ICU collator UnicodeKeyword to iterator->second + UErrorCode status = U_ZERO_ERROR; + if (!collation->IsUndefined()) { +- auto extensionIter = r.extensions.find("co"); +- if (extensionIter != r.extensions.end() && extensionIter->second != collationStr) { ++ auto extensionIter = r.extensions_.find("co"); ++ if (extensionIter != r.extensions_.end() && extensionIter->second != collationStr) { + icuLocale.setUnicodeKeywordValue("co", nullptr, status); + ASSERT_PRINT(U_SUCCESS(status), "icuLocale set co failed"); + } +@@ -199,8 +199,8 @@ JSHandle JSCollator::InitializeCollator(JSThread *thread, const JSHa + icuCollator->setAttribute(UCOL_NUMERIC_COLLATION, numeric ? UCOL_ON : UCOL_OFF, status); + ASSERT(U_SUCCESS(status)); + } else { +- auto extensionIter = r.extensions.find("kn"); +- if (extensionIter != r.extensions.end()) { ++ auto extensionIter = r.extensions_.find("kn"); ++ if (extensionIter != r.extensions_.end()) { + ASSERT(icuCollator.get() != nullptr); + bool found = (extensionIter->second == "true"); + JSHandle isNumeric(thread, JSTaggedValue(found)); +@@ -219,11 +219,11 @@ JSHandle JSCollator::InitializeCollator(JSThread *thread, const JSHa + icuCollator->setAttribute(UCOL_CASE_FIRST, OptionToUColAttribute(caseFirst), status); + ASSERT(U_SUCCESS(status)); + } else { +- auto extensionIter = r.extensions.find("kf"); +- if (extensionIter != r.extensions.end()) { ++ auto extensionIter = r.extensions_.find("kf"); ++ if (extensionIter != r.extensions_.end()) { + ASSERT(icuCollator.get() != nullptr); +- auto mapIter = caseFirstMap.find(extensionIter->second); +- if (mapIter != caseFirstMap.end()) { ++ auto mapIter = CASE_FIRST_MAP.find(extensionIter->second); ++ if (mapIter != CASE_FIRST_MAP.end()) { + icuCollator->setAttribute(UCOL_CASE_FIRST, OptionToUColAttribute(mapIter->second), status); + JSHandle value(thread, JSTaggedValue(static_cast(mapIter->second))); + collator->SetCaseFirst(thread, value); +@@ -294,8 +294,8 @@ JSHandle JSCollator::InitializeCollator(JSThread *thread, const JSHa + + UColAttributeValue JSCollator::OptionToUColAttribute(CaseFirstOption caseFirstOption) + { +- auto iter = uColAttributeValueMap.find(caseFirstOption); +- if (iter != uColAttributeValueMap.end()) { ++ auto iter = U_COL_ATTRIBUTE_VALUE_MAP.find(caseFirstOption); ++ if (iter != U_COL_ATTRIBUTE_VALUE_MAP.end()) { + return iter->second; + } + UNREACHABLE(); +diff --git a/runtime/js_collator.h b/runtime/js_collator.h +index f307bbf..da9c321 100644 +--- a/runtime/js_collator.h ++++ b/runtime/js_collator.h +@@ -30,9 +30,9 @@ public: + // NOLINTNEXTLINE (readability-identifier-naming, fuchsia-statically-constructed-objects) + static const CString uIcuDataColl; + +- static const std::map caseFirstMap; ++ static const std::map CASE_FIRST_MAP; + +- static const std::map uColAttributeValueMap; ++ static const std::map U_COL_ATTRIBUTE_VALUE_MAP; + + CAST_CHECK(JSCollator, IsJSCollator); + +diff --git a/runtime/js_date_time_format.cpp b/runtime/js_date_time_format.cpp +index fcfd459..5b70dbe 100644 +--- a/runtime/js_date_time_format.cpp ++++ b/runtime/js_date_time_format.cpp +@@ -26,15 +26,19 @@ + + namespace panda::ecmascript { + struct CommonDateFormatPart { +- int32_t fField = 0; // NOLINT(misc-non-private-member-variables-in-classes) +- int32_t fBeginIndex = 0; // NOLINT(misc-non-private-member-variables-in-classes) +- int32_t fEndIndex = 0; // NOLINT(misc-non-private-member-variables-in-classes) +- int32_t index = 0; // NOLINT(misc-non-private-member-variables-in-classes) +- bool isPreExist = false; // NOLINT(misc-non-private-member-variables-in-classes) ++ int32_t f_field_ = 0; // NOLINT(misc-non-private-member-variables-in-classes) ++ int32_t f_begin_index_ = 0; // NOLINT(misc-non-private-member-variables-in-classes) ++ int32_t f_end_index_ = 0; // NOLINT(misc-non-private-member-variables-in-classes) ++ int32_t index_ = 0; // NOLINT(misc-non-private-member-variables-in-classes) ++ bool is_pre_exist_ = false; // NOLINT(misc-non-private-member-variables-in-classes) + + CommonDateFormatPart() = default; + CommonDateFormatPart(int32_t fField, int32_t fBeginIndex, int32_t fEndIndex, int32_t index, bool isPreExist) +- : fField(fField), fBeginIndex(fBeginIndex), fEndIndex(fEndIndex), index(index), isPreExist(isPreExist) ++ : f_field_(fField), ++ f_begin_index_(fBeginIndex), ++ f_end_index_(fEndIndex), ++ index_(index), ++ is_pre_exist_(isPreExist) + { + } + +@@ -287,7 +291,7 @@ JSHandle JSDateTimeFormat::InitializeDateTimeFormat(JSThread * + JSLocale::ResolveLocale(thread, availableLocales, requestedLocales, matcher, RELEVANT_EXTENSION_KEYS); + + // 18. Set icuLocale to r.[[locale]]. +- icu::Locale icuLocale = resolvedLocale.localeData; ++ icu::Locale icuLocale = resolvedLocale.locale_data_; + ASSERT_PRINT(!icuLocale.isBogus(), "icuLocale is bogus"); + UErrorCode status = U_ZERO_ERROR; + +@@ -333,7 +337,7 @@ JSHandle JSDateTimeFormat::InitializeDateTimeFormat(JSThread * + HourCycleOption hcDefault = OptionToHourCycle(generator->getDefaultHourCycle(status)); + // b. Let hc be dateTimeFormat.[[HourCycle]]. + HourCycleOption hc = HourCycleOption::UNDEFINED; +- hc = (hourCycle == HourCycleOption::UNDEFINED) ? OptionToHourCycle(resolvedLocale.extensions.find("hc")->second) ++ hc = (hourCycle == HourCycleOption::UNDEFINED) ? OptionToHourCycle(resolvedLocale.extensions_.find("hc")->second) + : hourCycle; + // c. If hc is null, then + // i. Set hc to hcDefault. +@@ -379,19 +383,19 @@ JSHandle JSDateTimeFormat::InitializeDateTimeFormat(JSThread * + std::vector data = GetIcuPatternDesc(hc); + for (const IcuPatternDesc &item : data) { + // prop be [[TimeZoneName]] +- if (item.property == "timeZoneName") { ++ if (item.property_ == "timeZoneName") { + int secondDigitsString = JSLocale::GetNumberOption( + thread, dateTimeOptions, globalConst->GetHandledFractionalSecondDigitsString(), 1, 3, 0); + skeleton.append(secondDigitsString, 'S'); + } +- JSHandle property(thread, factory->NewFromStdString(item.property).GetTaggedValue()); ++ JSHandle property(thread, factory->NewFromStdString(item.property_).GetTaggedValue()); + std::string value; +- bool isFind = JSLocale::GetOptionOfString(thread, dateTimeOptions, property, item.allowedValues, &value); ++ bool isFind = JSLocale::GetOptionOfString(thread, dateTimeOptions, property, item.allowed_values_, &value); + RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSDateTimeFormat, thread); + if (isFind) { +- skeleton += item.map.find(value)->second; ++ skeleton += item.map_.find(value)->second; + // [[Hour]] is defined. +- isHourDefined = (item.property == "hour") ? true : isHourDefined; ++ isHourDefined = (item.property_ == "hour") ? true : isHourDefined; + } + } + +@@ -461,8 +465,8 @@ JSHandle JSDateTimeFormat::InitializeDateTimeFormat(JSThread * + + // Set dateTimeFormat.[[locale]]. + if (!hour12->IsUndefined() || hourCycle != HourCycleOption::UNDEFINED) { +- if ((resolvedLocale.extensions.find("hc") != resolvedLocale.extensions.end()) && +- (dtfHourCycle != OptionToHourCycle((resolvedLocale.extensions.find("hc")->second)))) { ++ if ((resolvedLocale.extensions_.find("hc") != resolvedLocale.extensions_.end()) && ++ (dtfHourCycle != OptionToHourCycle((resolvedLocale.extensions_.find("hc")->second)))) { + resolvedIcuLocaleCopy.setUnicodeKeywordValue("hc", nullptr, status); + ASSERT_PRINT(U_SUCCESS(status), "resolvedIcuLocaleCopy set hc failed"); + } +@@ -673,17 +677,17 @@ JSHandle JSDateTimeFormat::FormatDateTimeToParts(JSThread *thread, + // 4. For each part in parts, do + for (auto part : parts) { + substring.Update( +- JSLocale::IcuToString(thread, formattedParts, part.fBeginIndex, part.fEndIndex).GetTaggedValue()); ++ JSLocale::IcuToString(thread, formattedParts, part.f_begin_index_, part.f_end_index_).GetTaggedValue()); + RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSArray, thread); + // Let O be ObjectCreate(%ObjectPrototype%). + // Perform ! CreateDataPropertyOrThrow(O, "type", part.[[Type]]). + // Perform ! CreateDataPropertyOrThrow(O, "value", part.[[Value]]). + // Perform ! CreateDataProperty(result, ! ToString(n), O). +- if (part.isPreExist) { +- JSLocale::PutElement(thread, part.index, result, ConvertFieldIdToDateType(thread, -1), ++ if (part.is_pre_exist_) { ++ JSLocale::PutElement(thread, part.index_, result, ConvertFieldIdToDateType(thread, -1), + JSHandle::Cast(substring)); + } else { +- JSLocale::PutElement(thread, part.index, result, ConvertFieldIdToDateType(thread, part.fField), ++ JSLocale::PutElement(thread, part.index_, result, ConvertFieldIdToDateType(thread, part.f_field_), + JSHandle::Cast(substring)); + } + } +@@ -867,7 +871,7 @@ void JSDateTimeFormat::ResolvedOptions(JSThread *thread, const JSHandleGetTimeStyle() == JSTaggedValue(static_cast(DateTimeStyleOption::UNDEFINED))) { + for (const auto &item : BuildIcuPatternDescs()) { + // fractionalSecondsDigits need to be added before timeZoneName. +- if (item.property == "timeZoneName") { ++ if (item.property_ == "timeZoneName") { + int tmpResult = count(pattern.begin(), pattern.end(), 'S'); + int fsd = (tmpResult >= STRING_LENGTH_3) ? STRING_LENGTH_3 : tmpResult; + if (fsd > 0) { +@@ -876,8 +880,8 @@ void JSDateTimeFormat::ResolvedOptions(JSThread *thread, const JSHandle::Cast(factory->NewFromStdString(item.property)); +- for (const auto &pair : item.pairs) { ++ property = JSHandle::Cast(factory->NewFromStdString(item.property_)); ++ for (const auto &pair : item.pairs_) { + if (pattern.find(pair.first) != std::string::npos) { + hcValue = JSHandle::Cast(factory->NewFromStdString(pair.second)); + JSObject::CreateDataPropertyOrThrow(thread, options, property, hcValue); +@@ -1056,18 +1060,18 @@ JSHandle JSDateTimeFormat::ConstructFDateIntervalToJSArray(JSThread *th + } + for (auto part : parts) { + substring.Update( +- JSLocale::IcuToString(thread, formattedValue, part.fBeginIndex, part.fEndIndex).GetTaggedValue()); ++ JSLocale::IcuToString(thread, formattedValue, part.f_begin_index_, part.f_end_index_).GetTaggedValue()); + RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSArray, thread); + JSHandle element; +- if (part.isPreExist) { +- element = JSLocale::PutElement(thread, part.index, array, ConvertFieldIdToDateType(thread, -1), ++ if (part.is_pre_exist_) { ++ element = JSLocale::PutElement(thread, part.index_, array, ConvertFieldIdToDateType(thread, -1), + JSHandle::Cast(substring)); + } else { +- element = JSLocale::PutElement(thread, part.index, array, ConvertFieldIdToDateType(thread, part.fField), ++ element = JSLocale::PutElement(thread, part.index_, array, ConvertFieldIdToDateType(thread, part.f_field_), + JSHandle::Cast(substring)); + } + JSHandle value = JSHandle::Cast( +- ToValueString(thread, TrackValue(part.fBeginIndex, part.fEndIndex, begin, end))); ++ ToValueString(thread, TrackValue(part.f_begin_index_, part.f_end_index_, begin, end))); + JSObject::SetProperty(thread, element, thread->GlobalConstants()->GetHandledSourceString(), value, true); + } + return array; +@@ -1106,8 +1110,8 @@ std::vector InitializePattern(const IcuPatternDesc &hourData) + std::vector items = BuildIcuPatternDescs(); + auto item = items.begin(); + while (static_cast(item != items.end()) != 0) { +- if (item->property != "hour") { +- result.emplace_back(IcuPatternDesc(item->property, item->pairs, item->allowedValues)); ++ if (item->property_ != "hour") { ++ result.emplace_back(IcuPatternDesc(item->property_, item->pairs_, item->allowed_values_)); + } else { + result.emplace_back(hourData); + } +diff --git a/runtime/js_date_time_format.h b/runtime/js_date_time_format.h +index 556ea85..56fa976 100644 +--- a/runtime/js_date_time_format.h ++++ b/runtime/js_date_time_format.h +@@ -49,19 +49,21 @@ class IcuPatternDesc { + public: + IcuPatternDesc(std::string propertyParam, std::vector pairsParam, + std::vector allowedValuesParam) +- : property(std::move(propertyParam)), pairs(std::move(pairsParam)), allowedValues(std::move(allowedValuesParam)) ++ : property_(std::move(propertyParam)), ++ pairs_(std::move(pairsParam)), ++ allowed_values_(std::move(allowedValuesParam)) + { +- for (const auto &pair : pairs) { +- map.insert(std::make_pair(pair.second, pair.first)); ++ for (const auto &pair : pairs_) { ++ map_.insert(std::make_pair(pair.second, pair.first)); + } + } + + virtual ~IcuPatternDesc() = default; + +- std::string property; // NOLINT(misc-non-private-member-variables-in-classes) +- std::vector pairs; // NOLINT(misc-non-private-member-variables-in-classes) +- std::map map; // NOLINT(misc-non-private-member-variables-in-classes) +- std::vector allowedValues; // NOLINT(misc-non-private-member-variables-in-classes) ++ std::string property_; // NOLINT(misc-non-private-member-variables-in-classes) ++ std::vector pairs_; // NOLINT(misc-non-private-member-variables-in-classes) ++ std::map map_; // NOLINT(misc-non-private-member-variables-in-classes) ++ std::vector allowed_values_; // NOLINT(misc-non-private-member-variables-in-classes) + + DEFAULT_COPY_SEMANTIC(IcuPatternDesc); + // NOLINT(performance-noexcept-move-constructor, hicpp-noexcept-move) +@@ -71,18 +73,18 @@ public: + class Pattern { + public: + Pattern(const std::string &data1, const std::string &data2) +- : data(InitializePattern( ++ : data_(InitializePattern( + IcuPatternDesc("hour", {{data1, "2-digit"}, {data2, "numeric"}}, {"2-digit", "numeric"}))) + { + } + virtual ~Pattern() = default; + std::vector Get() const + { +- return data; ++ return data_; + } + + private: +- std::vector data {}; ++ std::vector data_ {}; + NO_COPY_SEMANTIC(Pattern); + NO_MOVE_SEMANTIC(Pattern); + }; +diff --git a/runtime/js_hclass.cpp b/runtime/js_hclass.cpp +index 62d4121..15268a8 100644 +--- a/runtime/js_hclass.cpp ++++ b/runtime/js_hclass.cpp +@@ -165,8 +165,8 @@ JSHandle JSHClass::Clone(const JSThread *thread, const JSHandleGetInlinedProperties(); + 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()); +diff --git a/runtime/js_locale.cpp b/runtime/js_locale.cpp +index 6f985b0..f111c9b 100644 +--- a/runtime/js_locale.cpp ++++ b/runtime/js_locale.cpp +@@ -147,19 +147,19 @@ JSLocale::ParsedLocale JSLocale::HandleLocale(const JSHandle &locale + // defined by private agreement. + // b. Extensions cannot be used in tags that are entirely private use. + if (IsPrivateSubTag(result, len)) { +- parsedResult.base = result; ++ parsedResult.base_ = result; + return parsedResult; + } + // If cannot find "-u-", return the whole string as base. + size_t foundExtension = result.find("-u-"); + if (foundExtension == std::string::npos) { +- parsedResult.base = result; ++ parsedResult.base_ = result; + return parsedResult; + } + // Let privateIndex be Call(%StringProto_indexOf%, foundLocale, « "-x-" »). + size_t praviteIndex = result.find("-x-"); + if (praviteIndex != std::string::npos && praviteIndex < foundExtension) { +- parsedResult.base = result; ++ parsedResult.base_ = result; + return parsedResult; + } + const std::string basis = result.substr(INTL_INDEX_ZERO, foundExtension); +@@ -168,8 +168,8 @@ JSLocale::ParsedLocale JSLocale::HandleLocale(const JSHandle &locale + size_t start = foundExtension + INTL_INDEX_ONE; + HandleLocaleExtension(start, extensionEnd, result, len); + const std::string end = result.substr(extensionEnd); +- parsedResult.base = basis + end; +- parsedResult.extension = result.substr(foundExtension, extensionEnd - foundExtension); ++ parsedResult.base_ = basis + end; ++ parsedResult.extension_ = result.substr(foundExtension, extensionEnd - foundExtension); + return parsedResult; + } + +@@ -337,20 +337,20 @@ JSHandle JSLocale::LookupMatcher(JSThread *thread, const JSHandleNewFromStdString(res); + } +@@ -360,8 +360,8 @@ JSHandle JSLocale::LookupMatcher(JSThread *thread, const JSHandleNewFromStdString(result.locale); ++ result.locale_ = defLocale; ++ return factory->NewFromStdString(result.locale_); + } + + icu::LocaleMatcher BuildLocaleMatcher(JSThread *thread, uint32_t *availableLength, UErrorCode *status, +@@ -433,7 +433,7 @@ JSHandle JSLocale::LookupSupportedLocales(JSThread *thread, const J + for (uint32_t i = 0; i < length; ++i) { + item.Update(requestedLocales->Get(thread, i)); + ParsedLocale foundationResult = HandleLocale(item); +- std::string availableLocale = BestAvailableLocale(thread, availableLocales, foundationResult.base); ++ std::string availableLocale = BestAvailableLocale(thread, availableLocales, foundationResult.base_); + if (!availableLocale.empty()) { + subset->Set(thread, index++, item.GetTaggedValue()); + } +@@ -784,9 +784,9 @@ ResolvedLocale JSLocale::ResolveLocale(JSThread *thread, const JSHandle tag = ToLanguageTag(thread, foundLocaleData); +- result.locale = ConvertToStdString(tag); ++ result.locale_ = ConvertToStdString(tag); + std::string supportedExtension = "-u"; + icu::LocaleBuilder localeBuilder; + localeBuilder.setLocale(foundLocaleData).clearExtensions(); +@@ -868,7 +868,7 @@ ResolvedLocale JSLocale::ResolveLocale(JSThread *thread, const JSHandle(key, value)); ++ result.extensions_.insert(std::pair(key, value)); + supportedExtension += supportedExtensionAddition; + } + size_t found = foundLocale.find("-u-"); +@@ -892,18 +892,18 @@ ResolvedLocale JSLocale::ResolveLocale(JSThread *thread, const JSHandle &t + return false; + } + +- tagElements.language = GetOption(thread, options, globalConst->GetHandledLanguageString(), OptionType::STRING, +- globalConst->GetHandledUndefined(), globalConst->GetHandledUndefined()); ++ tagElements.language_ = GetOption(thread, options, globalConst->GetHandledLanguageString(), OptionType::STRING, ++ globalConst->GetHandledUndefined(), globalConst->GetHandledUndefined()); + RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, false); + + // 4. If language is not undefined, then + // a. If language does not match the unicode_language_subtag production, throw a RangeError exception. +- if (!tagElements.language->IsUndefined()) { +- std::string languageStr = ConvertToStdString(JSHandle::Cast(tagElements.language)); ++ if (!tagElements.language_->IsUndefined()) { ++ std::string languageStr = ConvertToStdString(JSHandle::Cast(tagElements.language_)); + if (languageStr[INTL_INDEX_ZERO] == '\0' || IsAlpha(languageStr, INTL_INDEX_FOUR, INTL_INDEX_FOUR)) { + return false; + } + } + + // 5. Let script be ? GetOption(options, "script", "string", undefined, undefined). +- tagElements.script = GetOption(thread, options, globalConst->GetHandledScriptString(), OptionType::STRING, +- globalConst->GetHandledUndefined(), globalConst->GetHandledUndefined()); ++ tagElements.script_ = GetOption(thread, options, globalConst->GetHandledScriptString(), OptionType::STRING, ++ globalConst->GetHandledUndefined(), globalConst->GetHandledUndefined()); + RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, false); + + // 6. If script is not undefined, then + // a. If script does not match the unicode_script_subtag production, throw a RangeError exception. +- if (!tagElements.script->IsUndefined()) { +- std::string scriptStr = JSLocale::ConvertToStdString((JSHandle::Cast(tagElements.script))); ++ if (!tagElements.script_->IsUndefined()) { ++ std::string scriptStr = JSLocale::ConvertToStdString((JSHandle::Cast(tagElements.script_))); + if (scriptStr[INTL_INDEX_ZERO] == '\0') { + return false; + } +@@ -1102,12 +1102,12 @@ bool JSLocale::ApplyOptionsToTag(JSThread *thread, const JSHandle &t + // 7. Let region be ? GetOption(options, "region", "string", undefined, undefined). + // 8. If region is not undefined, then + // a. If region does not match the unicode_region_subtag production, throw a RangeError exception. +- tagElements.region = GetOption(thread, options, globalConst->GetHandledRegionString(), OptionType::STRING, +- globalConst->GetHandledUndefined(), globalConst->GetHandledUndefined()); ++ tagElements.region_ = GetOption(thread, options, globalConst->GetHandledRegionString(), OptionType::STRING, ++ globalConst->GetHandledUndefined(), globalConst->GetHandledUndefined()); + RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, false); + +- if (!tagElements.region->IsUndefined()) { +- std::string regionStr = ConvertToStdString(JSHandle::Cast(tagElements.region)); ++ if (!tagElements.region_->IsUndefined()) { ++ std::string regionStr = ConvertToStdString(JSHandle::Cast(tagElements.region_)); + if (regionStr[INTL_INDEX_ZERO] == '\0') { + return false; + } +@@ -1239,7 +1239,8 @@ JSHandle JSLocale::InitializeLocale(JSThread *thread, const JSHandle(curIdx_ < length_); ++ return static_cast(cur_idx_ < length_); + } + + const icu::Locale &next() override + { +- ASSERT(curIdx_ < length_); ++ ASSERT(cur_idx_ < length_); + UErrorCode status = U_ZERO_ERROR; +- locale_ = icu::Locale::forLanguageTag(data_[curIdx_].c_str(), status); ++ locale_ = icu::Locale::forLanguageTag(data_[cur_idx_].c_str(), status); + ASSERT(U_SUCCESS(status)); +- curIdx_++; ++ cur_idx_++; + return locale_; + } + +@@ -113,39 +113,39 @@ public: + private: + std::vector data_ {}; + uint32_t length_ {0}; +- uint32_t curIdx_ {0}; ++ uint32_t cur_idx_ {0}; + icu::Locale locale_ {}; + }; + + struct ResolvedLocale { +- std::string locale {}; +- icu::Locale localeData {}; +- std::map extensions {}; ++ std::string locale_ {}; ++ icu::Locale locale_data_ {}; ++ std::map extensions_ {}; + }; + + struct MatcherResult { +- std::string locale; +- std::string extension; ++ std::string locale_; ++ std::string extension_; + }; + + struct OptionData { +- std::string name; +- std::string key; +- std::vector possibleValues; +- bool isBoolValue = false; ++ std::string name_; ++ std::string key_; ++ std::vector possible_values_; ++ bool is_bool_value_ = false; + }; + + struct TagElements { +- JSHandle language; +- JSHandle script; +- JSHandle region; ++ JSHandle language_; ++ JSHandle script_; ++ JSHandle region_; + }; + + class JSLocale : public JSObject { + public: + struct ParsedLocale { +- std::string base; +- std::string extension; ++ std::string base_; ++ std::string extension_; + }; + + static JSLocale *Cast(ObjectHeader *object) +diff --git a/runtime/js_method.cpp b/runtime/js_method.cpp +index c180ec2..1c57090 100644 +--- a/runtime/js_method.cpp ++++ b/runtime/js_method.cpp +@@ -20,15 +20,15 @@ + namespace panda::ecmascript { + JSMethod::~JSMethod() + { +- mem::InternalAllocator<>::GetInternalAllocatorFromRuntime()->Free(icOffsetMapping_); ++ mem::InternalAllocator<>::GetInternalAllocatorFromRuntime()->Free(ic_offset_mapping_); + } + + // It's not allowed '#' token appear in ECMA function(method) name, which discriminates same names in panda methods. + CString JSMethod::ParseFunctionName() const + { +- auto *name = GetStringDataAnnotation(Method::AnnotationField::FUNCTION_NAME).data; ++ auto *name = GetStringDataAnnotation(Method::AnnotationField::FUNCTION_NAME).data_; + if (name == nullptr) { +- name = GetName().data; ++ name = GetName().data_; + } + return utf::Mutf8AsCString(name); + } +@@ -40,14 +40,14 @@ void JSMethod::SetCallTypeFromAnnotation() + panda_file::MethodDataAccessor mda(*pandaFile, fieldId); + mda.EnumerateAnnotations([&](panda_file::File::EntityId annotation_id) { + panda_file::AnnotationDataAccessor ada(*pandaFile, annotation_id); +- auto *annotation_name = reinterpret_cast(pandaFile->GetStringData(ada.GetClassId()).data); ++ auto *annotation_name = reinterpret_cast(pandaFile->GetStringData(ada.GetClassId()).data_); + if (::strcmp("L_ESCallTypeAnnotation;", annotation_name) == 0) { + uint32_t elem_count = ada.GetCount(); + for (uint32_t i = 0; i < elem_count; i++) { + panda_file::AnnotationDataAccessor::Elem adae = ada.GetElement(i); +- auto *elem_name = reinterpret_cast(pandaFile->GetStringData(adae.GetNameId()).data); ++ 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 85471dd..58fa5fe 100644 +--- a/runtime/js_method.h ++++ b/runtime/js_method.h +@@ -44,14 +44,14 @@ public: + panda_file::File::EntityId codeId, uint32_t accessFlags, uint32_t numArgs, const uint16_t *shorty) + : Method(klass, pf, fileId, codeId, accessFlags, numArgs, 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; +@@ -63,57 +63,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; + } + + uint8_t *GetICOffsetMapping() + { +- return icOffsetMapping_; ++ return ic_offset_mapping_; + } + + const uint8_t *GetICOffsetMapping() const + { +- return icOffsetMapping_; ++ return ic_offset_mapping_; + } + + void SetICOffsetMapping(uint8_t *mapping) + { +- icOffsetMapping_ = mapping; ++ ic_offset_mapping_ = mapping; + } + + static constexpr size_t GetICOffsetMappingOffset() + { +- return MEMBER_OFFSET(JSMethod, icOffsetMapping_); ++ return MEMBER_OFFSET(JSMethod, ic_offset_mapping_); + } + + uint32_t GetCallType() const + { +- return callType_; ++ return call_type_; + } + + CString ParseFunctionName() const; +@@ -123,11 +123,11 @@ public: + JSTaggedValue GetLength() const; + + private: +- const uint8_t *bytecodeArray_ {nullptr}; +- uint32_t bytecodeArraySize_ {0}; +- uint32_t slotSize_ {0}; +- uint8_t *icOffsetMapping_ {nullptr}; +- uint32_t callType_ {UINT32_MAX}; // UINT32_MAX means not found ++ const uint8_t *bytecode_array_ {nullptr}; ++ uint32_t bytecode_array_size_ {0}; ++ uint32_t slot_size_ {0}; ++ uint8_t *ic_offset_mapping_ {nullptr}; ++ uint32_t call_type_ {UINT32_MAX}; // UINT32_MAX means not found + }; + } // namespace panda::ecmascript + +diff --git a/runtime/js_number_format.cpp b/runtime/js_number_format.cpp +index 7da773c..aeebb4c 100644 +--- a/runtime/js_number_format.cpp ++++ b/runtime/js_number_format.cpp +@@ -404,8 +404,8 @@ FractionDigitsOption SetNumberFormatUnitOptions(JSThread *thread, const JSHandle + // c. Let mxfdDefault be cDigits. + if (style == StyleOption::CURRENCY) { + int32_t cDigits = JSNumberFormat::CurrencyDigits(currencyUStr); +- fractionDigitsOption.mnfdDefault = cDigits; +- fractionDigitsOption.mxfdDefault = cDigits; ++ fractionDigitsOption.mnfd_default_ = cDigits; ++ fractionDigitsOption.mxfd_default_ = cDigits; + } else { + // 18. Else, + // a. Let mnfdDefault be 0. +@@ -413,11 +413,11 @@ FractionDigitsOption SetNumberFormatUnitOptions(JSThread *thread, const JSHandle + // i. Let mxfdDefault be 0. + // c. else, + // i. Let mxfdDefault be 3. +- fractionDigitsOption.mnfdDefault = 0; ++ fractionDigitsOption.mnfd_default_ = 0; + if (style == StyleOption::PERCENT) { +- fractionDigitsOption.mxfdDefault = 0; ++ fractionDigitsOption.mxfd_default_ = 0; + } else { +- fractionDigitsOption.mxfdDefault = 3; // Max decimal precision is 3 ++ fractionDigitsOption.mxfd_default_ = 3; // Max decimal precision is 3 + } + } + return fractionDigitsOption; +@@ -491,7 +491,7 @@ void JSNumberFormat::InitializeNumberFormat(JSThread *thread, const JSHandle localeStr = JSLocale::ToLanguageTag(thread, icuLocale); + numberFormat->SetLocale(thread, localeStr.GetTaggedValue()); + +@@ -515,8 +515,8 @@ void JSNumberFormat::InitializeNumberFormat(JSThread *thread, const JSHandleGetUnitDisplay(); + auto unitDisplay = static_cast(unitDisplayValue.GetInt()); + +diff --git a/runtime/js_number_format.h b/runtime/js_number_format.h +index ae58956..18debd4 100644 +--- a/runtime/js_number_format.h ++++ b/runtime/js_number_format.h +@@ -37,8 +37,8 @@ enum class CurrencySignOption : uint8_t { STANDARD = 0x01, ACCOUNTING, EXCEPTION + enum class UnitDisplayOption : uint8_t { SHORT = 0x01, NARROW, LONG, EXCEPTION }; + + struct FractionDigitsOption { +- int32_t mnfdDefault = 0; +- int32_t mxfdDefault = 0; ++ int32_t mnfd_default_ = 0; ++ int32_t mxfd_default_ = 0; + }; + + // NOLINTNEXTLINE(fuchsia-statically-constructed-objects) +diff --git a/runtime/js_object.h b/runtime/js_object.h +index d23dd17..5be4e8c 100644 +--- a/runtime/js_object.h ++++ b/runtime/js_object.h +@@ -68,9 +68,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) + { + } +@@ -101,7 +101,7 @@ public: + inline void SetWritable(bool flag) + { + writable_ = flag; +- hasWritable_ = true; ++ has_writable_ = true; + } + + inline bool IsEnumerable() const +@@ -112,7 +112,7 @@ public: + inline void SetEnumerable(bool flag) + { + enumerable_ = flag; +- hasEnumerable_ = true; ++ has_enumerable_ = true; + } + + inline bool IsConfigurable() const +@@ -123,7 +123,7 @@ public: + inline void SetConfigurable(bool flag) + { + configurable_ = flag; +- hasConfigurable_ = true; ++ has_configurable_ = true; + } + + inline bool HasValue() const +@@ -133,17 +133,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 +@@ -192,7 +192,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 +@@ -203,7 +203,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); +@@ -214,9 +214,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_ {}; +@@ -232,7 +232,7 @@ public: + using RepresentationField = IsInlinedPropsField::NextField; + using OffsetField = RepresentationField::NextField; + +- explicit PropertyMetaData(uint32_t metaData) : metaData_(metaData) {} ++ explicit PropertyMetaData(uint32_t metaData) : meta_data_(metaData) {} + + ~PropertyMetaData() = default; + DEFAULT_NOEXCEPT_MOVE_SEMANTIC(PropertyMetaData); +@@ -245,52 +245,52 @@ public: + + 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) ++ : meta_data_(metaData) + { + thread_ = thread; + value_ = JSHandle(thread_, value); +@@ -316,13 +316,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 { +diff --git a/runtime/js_plural_rules.cpp b/runtime/js_plural_rules.cpp +index a31b17c..e92a9ce 100644 +--- a/runtime/js_plural_rules.cpp ++++ b/runtime/js_plural_rules.cpp +@@ -202,7 +202,7 @@ JSHandle JSPluralRules::InitializePluralRules(JSThread *thread, + ResolvedLocale r = + JSLocale::ResolveLocale(thread, availableLocales, requestedLocales, matcher, relevantExtensionKeys); + RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSPluralRules, thread); +- icu::Locale icuLocale = r.localeData; ++ icu::Locale icuLocale = r.locale_data_; + + // Get ICU numberFormatter with given locale + icu::number::LocalizedNumberFormatter icuNumberFormatter = +diff --git a/runtime/js_relative_time_format.cpp b/runtime/js_relative_time_format.cpp +index 65a52d3..0931f60 100644 +--- a/runtime/js_relative_time_format.cpp ++++ b/runtime/js_relative_time_format.cpp +@@ -87,7 +87,7 @@ JSHandle JSRelativeTimeFormat::InitializeRelativeTimeForma + ResolvedLocale r = + JSLocale::ResolveLocale(thread, availableLocales, requestedLocales, matcher, relevantExtensionKeys); + RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSRelativeTimeFormat, thread); +- icu::Locale icuLocale = r.localeData; ++ icu::Locale icuLocale = r.locale_data_; + + // 12. Let locale be r.[[Locale]]. + JSHandle localeStr = JSLocale::ToLanguageTag(thread, icuLocale); +diff --git a/runtime/js_serializer.cpp b/runtime/js_serializer.cpp +index 7685ba8..23c9a2d 100644 +--- a/runtime/js_serializer.cpp ++++ b/runtime/js_serializer.cpp +@@ -85,12 +85,12 @@ bool JSSerializer::WritePrimitiveValue(const JSHandle &value) + + bool JSSerializer::WriteInt(int32_t value) + { +- size_t oldSize = bufferSize_; ++ size_t oldSize = buffer_size_; + if (!WriteType(SerializationUID::INT32)) { + return false; + } + if (!WriteRawData(&value, sizeof(value))) { +- bufferSize_ = oldSize; ++ buffer_size_ = oldSize; + return false; + } + return true; +@@ -98,12 +98,12 @@ bool JSSerializer::WriteInt(int32_t value) + + bool JSSerializer::WriteInt(uint32_t value) + { +- size_t oldSize = bufferSize_; ++ size_t oldSize = buffer_size_; + if (!WriteType(SerializationUID::UINT32)) { + return false; + } + if (!WriteRawData(&value, sizeof(value))) { +- bufferSize_ = oldSize; ++ buffer_size_ = oldSize; + return false; + } + return true; +@@ -111,12 +111,12 @@ bool JSSerializer::WriteInt(uint32_t value) + + bool JSSerializer::WriteDouble(double value) + { +- size_t oldSize = bufferSize_; ++ size_t oldSize = buffer_size_; + if (!WriteType(SerializationUID::DOUBLE)) { + return false; + } + if (!WriteRawData(&value, sizeof(value))) { +- bufferSize_ = oldSize; ++ buffer_size_ = oldSize; + return false; + } + return true; +@@ -141,40 +141,40 @@ bool JSSerializer::WriteRawData(const void *data, size_t length) + if (length <= 0) { + return false; + } +- if ((bufferSize_ + length) > bufferCapacity_) { ++ if ((buffer_size_ + length) > buffer_capacity_) { + if (!AllocateBuffer(length)) { + return false; + } + } + errno_t rc; + // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) +- rc = memcpy_s(buffer_ + bufferSize_, bufferCapacity_ - bufferSize_, data, length); ++ rc = memcpy_s(buffer_ + buffer_size_, buffer_capacity_ - buffer_size_, data, length); + if (rc != EOK) { + LOG(ERROR, RUNTIME) << "Failed to memcpy_s Data"; + return false; + } +- bufferSize_ += length; ++ buffer_size_ += length; + return true; + } + + bool JSSerializer::AllocateBuffer(size_t bytes) + { + // Get internal heap size +- if (sizeLimit_ == 0) { ++ if (size_limit_ == 0) { + uint64_t heapSize = thread_->GetEcmaVM()->GetJSOptions().GetInternalMemorySizeLimit(); +- sizeLimit_ = heapSize; ++ size_limit_ = heapSize; + } +- size_t oldSize = bufferSize_; ++ size_t oldSize = buffer_size_; + size_t newSize = oldSize + bytes; +- if (newSize > sizeLimit_) { ++ if (newSize > size_limit_) { + return false; + } +- if (bufferCapacity_ == 0) { ++ if (buffer_capacity_ == 0) { + if (bytes < INITIAL_CAPACITY) { + // NOLINTNEXTLINE(cppcoreguidelines-no-malloc) + buffer_ = reinterpret_cast(malloc(INITIAL_CAPACITY)); + if (buffer_ != nullptr) { +- bufferCapacity_ = INITIAL_CAPACITY; ++ buffer_capacity_ = INITIAL_CAPACITY; + return true; + } + return false; +@@ -182,12 +182,12 @@ bool JSSerializer::AllocateBuffer(size_t bytes) + // NOLINTNEXTLINE(cppcoreguidelines-no-malloc) + buffer_ = reinterpret_cast(malloc(bytes)); + if (buffer_ != nullptr) { +- bufferCapacity_ = bytes; ++ buffer_capacity_ = bytes; + return true; + } + return false; + } +- if (newSize > bufferCapacity_) { ++ if (newSize > buffer_capacity_) { + if (!ExpandBuffer(newSize)) { + return false; + } +@@ -197,9 +197,9 @@ bool JSSerializer::AllocateBuffer(size_t bytes) + + bool JSSerializer::ExpandBuffer([[maybe_unused]] size_t requestedSize) + { +- size_t newCapacity = bufferCapacity_ * CAPACITY_INCREASE_RATE; ++ size_t newCapacity = buffer_capacity_ * CAPACITY_INCREASE_RATE; + newCapacity = std::max(newCapacity, requestedSize); +- if (newCapacity > sizeLimit_) { ++ if (newCapacity > size_limit_) { + return false; + } + // NOLINTNEXTLINE(cppcoreguidelines-no-malloc) +@@ -208,7 +208,7 @@ bool JSSerializer::ExpandBuffer([[maybe_unused]] size_t requestedSize) + return false; + } + errno_t rc; +- rc = memcpy_s(newBuffer, newCapacity, buffer_, bufferSize_); ++ rc = memcpy_s(newBuffer, newCapacity, buffer_, buffer_size_); + if (rc != EOK) { + LOG(ERROR, RUNTIME) << "Failed to memcpy_s Data"; + // NOLINTNEXTLINE(cppcoreguidelines-no-malloc) +@@ -218,31 +218,31 @@ bool JSSerializer::ExpandBuffer([[maybe_unused]] size_t requestedSize) + // NOLINTNEXTLINE(cppcoreguidelines-no-malloc) + free(buffer_); + buffer_ = newBuffer; +- bufferCapacity_ = newCapacity; ++ buffer_capacity_ = newCapacity; + return true; + } + + // Transfer ownership of buffer, should not use this Serializer after release + std::pair JSSerializer::ReleaseBuffer() + { +- auto res = std::make_pair(buffer_, bufferSize_); ++ auto res = std::make_pair(buffer_, buffer_size_); + buffer_ = nullptr; +- bufferSize_ = 0; +- bufferCapacity_ = 0; +- objectId_ = 0; ++ buffer_size_ = 0; ++ buffer_capacity_ = 0; ++ object_id_ = 0; + return res; + } + + bool JSSerializer::IsSerialized(uintptr_t addr) const + { +- return referenceMap_.find(addr) != referenceMap_.end(); ++ return reference_map_.find(addr) != reference_map_.end(); + } + + bool JSSerializer::WriteIfSerialized(uintptr_t addr) + { +- size_t oldSize = bufferSize_; +- auto iter = referenceMap_.find(addr); +- if (iter == referenceMap_.end()) { ++ size_t oldSize = buffer_size_; ++ auto iter = reference_map_.find(addr); ++ if (iter == reference_map_.end()) { + return false; + } + uint64_t id = iter->second; +@@ -250,7 +250,7 @@ bool JSSerializer::WriteIfSerialized(uintptr_t addr) + return false; + } + if (!WriteRawData(&id, sizeof(uint64_t))) { +- bufferSize_ = oldSize; ++ buffer_size_ = oldSize; + return false; + } + return true; +@@ -264,8 +264,8 @@ bool JSSerializer::WriteTaggedObject(const JSHandle &value) + if (serialized) { + return WriteIfSerialized(addr); + } +- referenceMap_.insert(std::pair(addr, objectId_)); +- objectId_++; ++ reference_map_.insert(std::pair(addr, object_id_)); ++ object_id_++; + + TaggedObject *taggedObject = value->GetTaggedObject(); + JSType type = taggedObject->GetClass()->GetObjectType(); +@@ -320,7 +320,7 @@ bool JSSerializer::WriteTaggedObject(const JSHandle &value) + + bool JSSerializer::WriteJSError(const JSHandle &value) + { +- size_t oldSize = bufferSize_; ++ size_t oldSize = buffer_size_; + TaggedObject *taggedObject = value->GetTaggedObject(); + JSType errorType = taggedObject->GetClass()->GetObjectType(); + if (!WriteJSErrorHeader(errorType)) { +@@ -331,7 +331,7 @@ bool JSSerializer::WriteJSError(const JSHandle &value) + JSHandle msg = JSObject::GetProperty(thread_, value, handleMsg).GetValue(); + // Write error message + if (!SerializeJSTaggedValue(msg)) { +- bufferSize_ = oldSize; ++ buffer_size_ = oldSize; + return false; + } + return true; +@@ -363,22 +363,22 @@ bool JSSerializer::WriteJSErrorHeader(JSType type) + bool JSSerializer::WriteJSDate(const JSHandle &value) + { + JSHandle date = JSHandle::Cast(value); +- size_t oldSize = bufferSize_; ++ size_t oldSize = buffer_size_; + if (!WriteType(SerializationUID::JS_DATE)) { + return false; + } + if (!WritePlainObject(value)) { +- bufferSize_ = oldSize; ++ buffer_size_ = oldSize; + return false; + } + double timeValue = date->GetTimeValue().GetDouble(); + if (!WriteDouble(timeValue)) { +- bufferSize_ = oldSize; ++ buffer_size_ = oldSize; + return false; + } + double localOffset = date->GetLocalOffset().GetDouble(); + if (!WriteDouble(localOffset)) { +- bufferSize_ = oldSize; ++ buffer_size_ = oldSize; + return false; + } + return true; +@@ -387,17 +387,17 @@ bool JSSerializer::WriteJSDate(const JSHandle &value) + bool JSSerializer::WriteJSArray(const JSHandle &value) + { + JSHandle array = JSHandle::Cast(value); +- size_t oldSize = bufferSize_; ++ size_t oldSize = buffer_size_; + if (!WriteType(SerializationUID::JS_ARRAY)) { + return false; + } + if (!WritePlainObject(value)) { +- bufferSize_ = oldSize; ++ buffer_size_ = oldSize; + return false; + } + uint32_t arrayLength = static_cast(array->GetLength().GetInt()); + if (!WriteInt(arrayLength)) { +- bufferSize_ = oldSize; ++ buffer_size_ = oldSize; + return false; + } + return true; +@@ -406,19 +406,19 @@ bool JSSerializer::WriteJSArray(const JSHandle &value) + bool JSSerializer::WriteEcmaString(const JSHandle &value) + { + JSHandle string = JSHandle::Cast(value); +- size_t oldSize = bufferSize_; ++ size_t oldSize = buffer_size_; + if (!WriteType(SerializationUID::ECMASTRING)) { + return false; + } + size_t length = string->GetLength(); + if (!WriteLength(static_cast(length))) { +- bufferSize_ = oldSize; ++ buffer_size_ = oldSize; + return false; + } + const uint8_t *data = string->GetDataUtf8(); + const uint8_t strEnd = '\0'; + if (!WriteRawData(data, length) || !WriteRawData(&strEnd, sizeof(uint8_t))) { +- bufferSize_ = oldSize; ++ buffer_size_ = oldSize; + return false; + } + return true; +@@ -427,28 +427,28 @@ bool JSSerializer::WriteEcmaString(const JSHandle &value) + bool JSSerializer::WriteJSMap(const JSHandle &value) + { + JSHandle map = JSHandle::Cast(value); +- size_t oldSize = bufferSize_; ++ size_t oldSize = buffer_size_; + if (!WriteType(SerializationUID::JS_MAP)) { + return false; + } + if (!WritePlainObject(value)) { +- bufferSize_ = oldSize; ++ buffer_size_ = oldSize; + return false; + } + int size = map->GetSize(); + if (!WriteLength(static_cast(size))) { +- bufferSize_ = oldSize; ++ buffer_size_ = oldSize; + return false; + } + for (int i = 0; i < size; i++) { + JSHandle key(thread_, map->GetKey(i)); + if (!SerializeJSTaggedValue(key)) { +- bufferSize_ = oldSize; ++ buffer_size_ = oldSize; + return false; + } + JSHandle val(thread_, map->GetValue(i)); + if (!SerializeJSTaggedValue(val)) { +- bufferSize_ = oldSize; ++ buffer_size_ = oldSize; + return false; + } + } +@@ -458,23 +458,23 @@ bool JSSerializer::WriteJSMap(const JSHandle &value) + bool JSSerializer::WriteJSSet(const JSHandle &value) + { + JSHandle set = JSHandle::Cast(value); +- size_t oldSize = bufferSize_; ++ size_t oldSize = buffer_size_; + if (!WriteType(SerializationUID::JS_SET)) { + return false; + } + if (!WritePlainObject(value)) { +- bufferSize_ = oldSize; ++ buffer_size_ = oldSize; + return false; + } + int size = set->GetSize(); + if (!WriteLength(static_cast(size))) { +- bufferSize_ = oldSize; ++ buffer_size_ = oldSize; + return false; + } + for (int i = 0; i < size; i++) { + JSHandle val(thread_, set->GetValue(i)); + if (!SerializeJSTaggedValue(val)) { +- bufferSize_ = oldSize; ++ buffer_size_ = oldSize; + return false; + } + } +@@ -484,17 +484,17 @@ bool JSSerializer::WriteJSSet(const JSHandle &value) + bool JSSerializer::WriteJSRegExp(const JSHandle &value) + { + JSHandle regExp = JSHandle::Cast(value); +- size_t oldSize = bufferSize_; ++ size_t oldSize = buffer_size_; + if (!WriteType(SerializationUID::JS_REG_EXP)) { + return false; + } + if (!WritePlainObject(value)) { +- bufferSize_ = oldSize; ++ buffer_size_ = oldSize; + return false; + } + uint32_t bufferSize = static_cast(regExp->GetLength().GetInt()); + if (!WriteLength(bufferSize)) { +- bufferSize_ = oldSize; ++ buffer_size_ = oldSize; + return false; + } + // Write Accessor(ByteCodeBuffer) which is a pointer to a Dynbuffer +@@ -502,19 +502,19 @@ bool JSSerializer::WriteJSRegExp(const JSHandle &value) + JSHandle np = JSHandle::Cast(bufferValue); + void *dynBuffer = np->GetExternalPointer(); + if (!WriteRawData(dynBuffer, bufferSize)) { +- bufferSize_ = oldSize; ++ buffer_size_ = oldSize; + return false; + } + // Write Accessor(OriginalSource) + JSHandle originalSource(thread_, regExp->GetOriginalSource()); + if (!SerializeJSTaggedValue(originalSource)) { +- bufferSize_ = oldSize; ++ buffer_size_ = oldSize; + return false; + } + // Write Accessor(OriginalFlags) + JSHandle originalFlags(thread_, regExp->GetOriginalFlags()); + if (!SerializeJSTaggedValue(originalFlags)) { +- bufferSize_ = oldSize; ++ buffer_size_ = oldSize; + return false; + } + return true; +@@ -523,42 +523,42 @@ bool JSSerializer::WriteJSRegExp(const JSHandle &value) + bool JSSerializer::WriteJSTypedArray(const JSHandle &value, SerializationUID uId) + { + JSHandle typedArray = JSHandle::Cast(value); +- size_t oldSize = bufferSize_; ++ size_t oldSize = buffer_size_; + if (!WriteType(uId)) { + return false; + } + if (!WritePlainObject(value)) { +- bufferSize_ = oldSize; ++ buffer_size_ = oldSize; + return false; + } + // Write ACCESSORS(ViewedArrayBuffer) which is a pointer to an ArrayBuffer + JSHandle viewedArrayBuffer(thread_, typedArray->GetViewedArrayBuffer()); + if (!WriteJSArrayBuffer(viewedArrayBuffer)) { +- bufferSize_ = oldSize; ++ buffer_size_ = oldSize; + return false; + } + // Write ACCESSORS(TypedArrayName) + JSHandle typedArrayName(thread_, typedArray->GetTypedArrayName()); + if (!SerializeJSTaggedValue(typedArrayName)) { +- bufferSize_ = oldSize; ++ buffer_size_ = oldSize; + return false; + } + // Write ACCESSORS(ByteLength) + JSTaggedValue byteLength = typedArray->GetByteLength(); + if (!WriteRawData(&byteLength, sizeof(JSTaggedValue))) { +- bufferSize_ = oldSize; ++ buffer_size_ = oldSize; + return false; + } + // Write ACCESSORS(ByteOffset) + JSTaggedValue byteOffset = typedArray->GetByteOffset(); + if (!WriteRawData(&byteOffset, sizeof(JSTaggedValue))) { +- bufferSize_ = oldSize; ++ buffer_size_ = oldSize; + return false; + } + // Write ACCESSORS(ArrayLength) + JSTaggedValue arrayLength = typedArray->GetArrayLength(); + if (!WriteRawData(&arrayLength, sizeof(JSTaggedValue))) { +- bufferSize_ = oldSize; ++ buffer_size_ = oldSize; + return false; + } + return true; +@@ -566,13 +566,13 @@ bool JSSerializer::WriteJSTypedArray(const JSHandle &value, Seria + + bool JSSerializer::WriteNativeFunctionPointer(const JSHandle &value) + { +- size_t oldSize = bufferSize_; ++ size_t oldSize = buffer_size_; + if (!WriteType(SerializationUID::NATIVE_FUNCTION_POINTER)) { + return false; + } + JSTaggedValue pointer = value.GetTaggedValue(); + if (!WriteRawData(&pointer, sizeof(JSTaggedValue))) { +- bufferSize_ = oldSize; ++ buffer_size_ = oldSize; + return false; + } + return true; +@@ -580,7 +580,7 @@ bool JSSerializer::WriteNativeFunctionPointer(const JSHandle &val + + bool JSSerializer::WriteJSArrayBuffer(const JSHandle &value) + { +- size_t oldSize = bufferSize_; ++ size_t oldSize = buffer_size_; + JSHandle arrayBuffer = JSHandle::Cast(value); + + if (arrayBuffer->IsDetach()) { +@@ -594,14 +594,14 @@ bool JSSerializer::WriteJSArrayBuffer(const JSHandle &value) + // Write Accessors(ArrayBufferByteLength) + JSTaggedValue taggedLength = arrayBuffer->GetArrayBufferByteLength(); + if (!WriteRawData(&taggedLength, sizeof(JSTaggedValue))) { +- bufferSize_ = oldSize; ++ buffer_size_ = oldSize; + return false; + } + + // write Accessor shared which indicate the C memeory is shared + bool shared = arrayBuffer->GetShared().ToBoolean(); + if (!WriteBoolean(shared)) { +- bufferSize_ = oldSize; ++ buffer_size_ = oldSize; + return false; + } + +@@ -610,7 +610,7 @@ bool JSSerializer::WriteJSArrayBuffer(const JSHandle &value) + void *buffer = np->GetExternalPointer(); + auto bufferAddr = reinterpret_cast(buffer); + if (!WriteRawData(&bufferAddr, sizeof(uint64_t))) { +- bufferSize_ = oldSize; ++ buffer_size_ = oldSize; + return false; + } + } else { +@@ -619,14 +619,14 @@ bool JSSerializer::WriteJSArrayBuffer(const JSHandle &value) + JSHandle np(thread_, arrayBuffer->GetArrayBufferData()); + void *buffer = np->GetExternalPointer(); + if (!WriteRawData(buffer, byteLength)) { +- bufferSize_ = oldSize; ++ buffer_size_ = oldSize; + return false; + } + } + + // write obj properties + if (!WritePlainObject(value)) { +- bufferSize_ = oldSize; ++ buffer_size_ = oldSize; + return false; + } + +@@ -636,38 +636,38 @@ bool JSSerializer::WriteJSArrayBuffer(const JSHandle &value) + bool JSSerializer::WritePlainObject(const JSHandle &objValue) + { + JSHandle obj = JSHandle::Cast(objValue); +- size_t oldSize = bufferSize_; ++ size_t oldSize = buffer_size_; + if (!WriteType(SerializationUID::JS_PLAIN_OBJECT)) { + return false; + } + // Get the number of elements stored in obj + uint32_t elementsLength = obj->GetNumberOfElements(); + if (!WriteLength(elementsLength)) { +- bufferSize_ = oldSize; ++ buffer_size_ = oldSize; + return false; + } + std::vector keyVector; + JSObject::GetALLElementKeysIntoVector(thread_, obj, keyVector); + // Write elements' description attributes and value + if (keyVector.size() != elementsLength) { +- bufferSize_ = oldSize; ++ buffer_size_ = oldSize; + return false; + } + for (uint32_t i = 0; i < elementsLength; i++) { + JSHandle key(thread_, keyVector[i]); + if (!SerializeJSTaggedValue(key)) { +- bufferSize_ = oldSize; ++ buffer_size_ = oldSize; + return false; + } + PropertyDescriptor desc(thread_); + JSObject::OrdinaryGetOwnProperty(thread_, obj, key, desc); + if (!WriteDesc(desc)) { +- bufferSize_ = oldSize; ++ buffer_size_ = oldSize; + return false; + } + JSHandle value = desc.GetValue(); + if (!SerializeJSTaggedValue(value)) { +- bufferSize_ = oldSize; ++ buffer_size_ = oldSize; + return false; + } + } +@@ -675,34 +675,34 @@ bool JSSerializer::WritePlainObject(const JSHandle &objValue) + keyVector.clear(); + uint32_t propertiesLength = obj->GetNumberOfKeys(); + if (!WriteLength(propertiesLength)) { +- bufferSize_ = oldSize; ++ buffer_size_ = oldSize; + return false; + } + JSObject::GetAllKeys(thread_, obj, keyVector); + if (keyVector.size() != propertiesLength) { +- bufferSize_ = oldSize; ++ buffer_size_ = oldSize; + return false; + } + // Write keys' description attributes and related values + for (uint32_t i = 0; i < propertiesLength; i++) { + if (keyVector.empty()) { +- bufferSize_ = oldSize; ++ buffer_size_ = oldSize; + return false; + } + JSHandle key(thread_, keyVector[i]); + if (!SerializeJSTaggedValue(key)) { +- bufferSize_ = oldSize; ++ buffer_size_ = oldSize; + return false; + } + PropertyDescriptor desc(thread_); + JSObject::OrdinaryGetOwnProperty(thread_, obj, key, desc); + if (!WriteDesc(desc)) { +- bufferSize_ = oldSize; ++ buffer_size_ = oldSize; + return false; + } + JSHandle value = desc.GetValue(); + if (!SerializeJSTaggedValue(value)) { +- bufferSize_ = oldSize; ++ buffer_size_ = oldSize; + return false; + } + } +@@ -711,35 +711,35 @@ bool JSSerializer::WritePlainObject(const JSHandle &objValue) + + bool JSSerializer::WriteDesc(const PropertyDescriptor &desc) + { +- size_t oldSize = bufferSize_; ++ size_t oldSize = buffer_size_; + bool isWritable = desc.IsWritable(); + if (!WriteBoolean(isWritable)) { +- bufferSize_ = oldSize; ++ buffer_size_ = oldSize; + return false; + } + bool isEnumerable = desc.IsEnumerable(); + if (!WriteBoolean(isEnumerable)) { +- bufferSize_ = oldSize; ++ buffer_size_ = oldSize; + return false; + } + bool isConfigurable = desc.IsConfigurable(); + if (!WriteBoolean(isConfigurable)) { +- bufferSize_ = oldSize; ++ buffer_size_ = oldSize; + return false; + } + bool hasWritable = desc.HasWritable(); + if (!WriteBoolean(hasWritable)) { +- bufferSize_ = oldSize; ++ buffer_size_ = oldSize; + return false; + } + bool hasEnumerable = desc.HasEnumerable(); + if (!WriteBoolean(hasEnumerable)) { +- bufferSize_ = oldSize; ++ buffer_size_ = oldSize; + return false; + } + bool hasConfigurable = desc.HasConfigurable(); + if (!WriteBoolean(hasConfigurable)) { +- bufferSize_ = oldSize; ++ buffer_size_ = oldSize; + return false; + } + return true; +@@ -943,7 +943,7 @@ JSHandle JSDeserializer::ReadJSError(SerializationUID uid) + JSHandle msg = DeserializeJSTaggedValue(); + JSHandle handleMsg(msg); + JSHandle errorTag = JSHandle::Cast(factory->NewJSError(errorType, handleMsg)); +- referenceMap_.insert(std::pair(objectId_++, errorTag)); ++ reference_map_.insert(std::pair(object_id_++, errorTag)); + return errorTag; + } + +@@ -955,7 +955,7 @@ JSHandle JSDeserializer::ReadJSDate() + JSHandle date = + JSHandle::Cast(factory->NewJSObjectByConstructor(JSHandle(dateFunction), dateFunction)); + JSHandle dateTag = JSHandle::Cast(date); +- referenceMap_.insert(std::pair(objectId_++, dateTag)); ++ reference_map_.insert(std::pair(object_id_++, dateTag)); + if (!JudgeType(SerializationUID::JS_PLAIN_OBJECT) || !DefinePropertiesAndElements(dateTag)) { + return JSHandle(); + } +@@ -976,7 +976,7 @@ JSHandle JSDeserializer::ReadJSArray() + { + JSHandle jsArray = thread_->GetEcmaVM()->GetFactory()->NewJSArray(); + JSHandle arrayTag = JSHandle::Cast(jsArray); +- referenceMap_.insert(std::pair(objectId_++, arrayTag)); ++ reference_map_.insert(std::pair(object_id_++, arrayTag)); + if (!JudgeType(SerializationUID::JS_PLAIN_OBJECT) || !DefinePropertiesAndElements(arrayTag)) { + return JSHandle(); + } +@@ -1002,7 +1002,7 @@ JSHandle JSDeserializer::ReadEcmaString() + + JSHandle ecmaString = factory->NewFromUtf8(string, stringLength); + auto stringTag = JSHandle(ecmaString); +- referenceMap_.insert(std::pair(objectId_++, stringTag)); ++ reference_map_.insert(std::pair(object_id_++, stringTag)); + return stringTag; + } + +@@ -1013,7 +1013,7 @@ JSHandle JSDeserializer::ReadPlainObject() + JSHandle jsObject = + thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(objFunc), objFunc); + JSHandle objTag = JSHandle::Cast(jsObject); +- referenceMap_.insert(std::pair(objectId_++, objTag)); ++ reference_map_.insert(std::pair(object_id_++, objTag)); + if (!DefinePropertiesAndElements(objTag)) { + return JSHandle(); + } +@@ -1028,7 +1028,7 @@ JSHandle JSDeserializer::ReadJSMap() + JSHandle jsMap = + JSHandle::Cast(factory->NewJSObjectByConstructor(JSHandle(mapFunction), mapFunction)); + JSHandle mapTag = JSHandle::Cast(jsMap); +- referenceMap_.insert(std::pair(objectId_++, mapTag)); ++ reference_map_.insert(std::pair(object_id_++, mapTag)); + if (!JudgeType(SerializationUID::JS_PLAIN_OBJECT) || !DefinePropertiesAndElements(mapTag)) { + return JSHandle(); + } +@@ -1060,7 +1060,7 @@ JSHandle JSDeserializer::ReadJSSet() + JSHandle jsSet = + JSHandle::Cast(factory->NewJSObjectByConstructor(JSHandle(setFunction), setFunction)); + JSHandle setTag = JSHandle::Cast(jsSet); +- referenceMap_.insert(std::pair(objectId_++, setTag)); ++ reference_map_.insert(std::pair(object_id_++, setTag)); + if (!JudgeType(SerializationUID::JS_PLAIN_OBJECT) || !DefinePropertiesAndElements(setTag)) { + return JSHandle(); + } +@@ -1088,7 +1088,7 @@ JSHandle JSDeserializer::ReadJSRegExp() + JSHandle obj = factory->NewJSObjectByConstructor(JSHandle(regexpFunction), regexpFunction); + JSHandle regExp = JSHandle::Cast(obj); + JSHandle regexpTag = JSHandle::Cast(regExp); +- referenceMap_.insert(std::pair(objectId_++, regexpTag)); ++ reference_map_.insert(std::pair(object_id_++, regexpTag)); + if (!JudgeType(SerializationUID::JS_PLAIN_OBJECT) || !DefinePropertiesAndElements(regexpTag)) { + return JSHandle(); + } +@@ -1159,7 +1159,7 @@ JSHandle JSDeserializer::ReadJSTypedArray(SerializationUID uid) + JSHandle::Cast(factory->NewJSObjectByConstructor(JSHandle(target), target)); + obj = JSHandle::Cast(typedArray); + objTag = JSHandle::Cast(obj); +- referenceMap_.insert(std::pair(objectId_++, objTag)); ++ reference_map_.insert(std::pair(object_id_++, objTag)); + if (!JudgeType(SerializationUID::JS_PLAIN_OBJECT) || !DefinePropertiesAndElements(objTag)) { + return JSHandle(); + } +@@ -1226,7 +1226,7 @@ JSHandle JSDeserializer::ReadJSArrayBuffer() + void *bufferData = ToVoidPtr(*bufferAddr); + JSHandle arrayBuffer = factory->NewJSArrayBuffer(bufferData, byteLength, nullptr, nullptr); + arrayBufferTag = JSHandle::Cast(arrayBuffer); +- referenceMap_.insert(std::pair(objectId_++, arrayBufferTag)); ++ reference_map_.insert(std::pair(object_id_++, arrayBufferTag)); + } else { + void *fromBuffer = GetBuffer(byteLength); + if (fromBuffer == nullptr) { +@@ -1234,7 +1234,7 @@ JSHandle JSDeserializer::ReadJSArrayBuffer() + } + JSHandle arrayBuffer = factory->NewJSArrayBuffer(byteLength); + arrayBufferTag = JSHandle::Cast(arrayBuffer); +- referenceMap_.insert(std::pair(objectId_++, arrayBufferTag)); ++ reference_map_.insert(std::pair(object_id_++, arrayBufferTag)); + JSHandle np(thread_, arrayBuffer->GetArrayBufferData()); + void *toBuffer = np->GetExternalPointer(); + if (memcpy_s(toBuffer, byteLength, fromBuffer, byteLength) != EOK) { +@@ -1282,8 +1282,8 @@ JSHandle JSDeserializer::ReadReference() + if (!ReadObjectId(&objId)) { + return JSHandle(); + } +- auto objIter = referenceMap_.find(objId); +- if (objIter == referenceMap_.end()) { ++ auto objIter = reference_map_.find(objId); ++ if (objIter == reference_map_.end()) { + return JSHandle(); + } + return objIter->second; +@@ -1407,15 +1407,15 @@ bool Serializer::WriteValue(JSThread *thread, const JSHandle &val + if (!PrepareTransfer(thread, transfer)) { + return false; + } +- if (!valueSerializer_.SerializeJSTaggedValue(value)) { ++ if (!value_serializer_.SerializeJSTaggedValue(value)) { + return false; + } + if (!FinalizeTransfer(thread, transfer)) { + return false; + } +- std::pair pair = valueSerializer_.ReleaseBuffer(); ++ std::pair pair = value_serializer_.ReleaseBuffer(); + data_->value_.reset(pair.first); +- data_->dataSize_ = pair.second; ++ data_->data_size_ = pair.second; + return true; + } + +@@ -1441,7 +1441,7 @@ bool Serializer::PrepareTransfer(JSThread *thread, const JSHandle + if (!element->IsArrayBuffer()) { + return false; + } +- arrayBufferIdxs_.emplace_back(k); ++ array_buffer_idxs_.emplace_back(k); + } + k++; + } +@@ -1450,7 +1450,7 @@ bool Serializer::PrepareTransfer(JSThread *thread, const JSHandle + + bool Serializer::FinalizeTransfer(JSThread *thread, const JSHandle &transfer) + { +- for (int idx : arrayBufferIdxs_) { ++ for (int idx : array_buffer_idxs_) { + JSHandle element = JSArray::FastGetPropertyByValue(thread, transfer, idx); + JSArrayBuffer::Cast(element->GetHeapObject())->Detach(thread); + } +@@ -1459,6 +1459,6 @@ bool Serializer::FinalizeTransfer(JSThread *thread, const JSHandle Deserializer::ReadValue() + { +- return valueDeserializer_.DeserializeJSTaggedValue(); ++ return value_deserializer_.DeserializeJSTaggedValue(); + } + } // namespace panda::ecmascript +diff --git a/runtime/js_serializer.h b/runtime/js_serializer.h +index 99a12bf..92cf432 100644 +--- a/runtime/js_serializer.h ++++ b/runtime/js_serializer.h +@@ -124,13 +124,13 @@ private: + + JSThread *thread_; + uint8_t *buffer_ = nullptr; +- uint64_t sizeLimit_ = 0; +- size_t bufferSize_ = 0; +- size_t bufferCapacity_ = 0; ++ uint64_t size_limit_ = 0; ++ size_t buffer_size_ = 0; ++ size_t buffer_capacity_ = 0; + // The Reference map is used for check whether a tagged object has been serialized + // Reference map works only if no gc happens during serialization +- std::map referenceMap_; +- uint64_t objectId_ = 0; ++ std::map reference_map_; ++ uint64_t object_id_ = 0; + }; + + class JSDeserializer { +@@ -177,8 +177,8 @@ private: + uint8_t *begin_ = nullptr; + const uint8_t *position_ = nullptr; + const uint8_t *const end_ = nullptr; +- uint64_t objectId_ = 0; +- std::map> referenceMap_; ++ uint64_t object_id_ = 0; ++ std::map> reference_map_; + }; + + class SerializationData { +@@ -192,7 +192,7 @@ public: + } + size_t GetSize() const + { +- return dataSize_; ++ return data_size_; + } + + NO_MOVE_SEMANTIC(SerializationData); +@@ -206,7 +206,7 @@ private: + free(ptr); + } + }; +- size_t dataSize_ {0}; ++ size_t data_size_ {0}; + std::unique_ptr value_; + + private: +@@ -215,7 +215,7 @@ private: + + class Serializer { + public: +- explicit Serializer(JSThread *thread) : valueSerializer_(thread) {} ++ explicit Serializer(JSThread *thread) : value_serializer_(thread) {} + ~Serializer() = default; + + bool WriteValue(JSThread *thread, const JSHandle &value, const JSHandle &transfer); +@@ -228,15 +228,15 @@ private: + bool PrepareTransfer(JSThread *thread, const JSHandle &transfer); + bool FinalizeTransfer(JSThread *thread, const JSHandle &transfer); + +- ecmascript::JSSerializer valueSerializer_; ++ ecmascript::JSSerializer value_serializer_; + std::unique_ptr data_; +- CVector arrayBufferIdxs_; ++ CVector array_buffer_idxs_; + }; + + class Deserializer { + public: + explicit Deserializer(JSThread *thread, SerializationData *data) +- : valueDeserializer_(thread, data->GetData(), data->GetSize()) ++ : value_deserializer_(thread, data->GetData(), data->GetSize()) + { + } + ~Deserializer() = default; +@@ -247,7 +247,7 @@ public: + NO_COPY_SEMANTIC(Deserializer); + + private: +- ecmascript::JSDeserializer valueDeserializer_; ++ ecmascript::JSDeserializer value_deserializer_; + }; + } // namespace panda::ecmascript + +diff --git a/runtime/js_thread.cpp b/runtime/js_thread.cpp +index e7c5e6a..18a5c2b 100644 +--- a/runtime/js_thread.cpp ++++ b/runtime/js_thread.cpp +@@ -28,7 +28,7 @@ namespace panda::ecmascript { + JSThread *JSThread::Create(Runtime *runtime, PandaVM *vm) + { + auto jsThread = new JSThread(runtime, vm); +- jsThread->regionFactory_ = EcmaVM::Cast(vm)->GetRegionFactory(); ++ jsThread->region_factory_ = EcmaVM::Cast(vm)->GetRegionFactory(); + jsThread->InitBuffers(); + JSThread::SetCurrent(jsThread); + jsThread->NativeCodeBegin(); +@@ -41,30 +41,30 @@ JSThread::JSThread(Runtime *runtime, PandaVM *vm) + { + SetLanguageContext(runtime->GetLanguageContext(panda_file::SourceLang::ECMASCRIPT)); + auto chunk = EcmaVM::Cast(vm)->GetChunk(); +- globalStorage_ = chunk->New(chunk); +- internalCallParams_ = new InternalCallParams(); +- propertiesCache_ = new PropertiesCache(); ++ global_storage_ = chunk->New(chunk); ++ 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; +- EcmaVM::Cast(GetVM())->GetChunk()->Delete(globalStorage_); +- +- regionFactory_ = nullptr; +- 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; ++ EcmaVM::Cast(GetVM())->GetChunk()->Delete(global_storage_); ++ ++ region_factory_ = nullptr; ++ 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; + } + } + +@@ -107,18 +107,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())); +@@ -128,7 +128,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(); +@@ -163,8 +163,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()) { +@@ -172,24 +172,24 @@ 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; +@@ -197,8 +197,8 @@ uintptr_t *JSThread::ExpandHandleStorage() + + void JSThread::ShrinkHandleStorage(int prevIndex) + { +- currentHandleStorageIndex_ = prevIndex; +- int32_t lastIndex = handleStorageNodes_.size() - 1; ++ current_handle_storage_index_ = prevIndex; ++ 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); +@@ -208,11 +208,11 @@ void JSThread::ShrinkHandleStorage(int prevIndex) + } + #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(); + } + } + } +@@ -222,19 +222,19 @@ 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) +diff --git a/runtime/js_thread.h b/runtime/js_thread.h +index 25901d3..d17cba4 100644 +--- a/runtime/js_thread.h ++++ b/runtime/js_thread.h +@@ -82,29 +82,29 @@ 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); + + RegionFactory *GetRegionFactory() const + { +- return regionFactory_; ++ return region_factory_; + } + + void Iterate(const RootVisitor &v0, const RootRangeVisitor &v1); +@@ -114,37 +114,37 @@ public: + + 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); +@@ -163,12 +163,12 @@ public: + + EcmaGlobalStorage *GetEcmaGlobalStorage() const + { +- return globalStorage_; ++ return global_storage_; + } + + const GlobalEnvConstants *GlobalConstants() const + { +- return &globalConst_; ++ return &global_const_; + } + + EcmascriptEnvironment *GetEcmascriptEnv() const +@@ -183,29 +183,29 @@ public: + + JSTaggedValue GetFunctionalObject() const + { +- return functionalObject_; ++ return functional_object_; + } + + void SetFunctionalObject(JSTaggedValue functionalObject) + { +- functionalObject_ = functionalObject; ++ functional_object_ = functionalObject; + } + + JSTaggedValue GetInvocationLexicalEnv() const + { +- return invocationLexicalEnv_; ++ return invocation_lexical_env_; + } + + void SetInvocationLexicalEnv(JSTaggedValue invocationLexicalEnv) + { +- invocationLexicalEnv_ = invocationLexicalEnv; ++ invocation_lexical_env_ = invocationLexicalEnv; + } + + void NotifyStableArrayElementsGuardians(JSHandle receiver); + + bool IsStableArrayElementsGuardiansInvalid() const + { +- return !stableArrayElementsGuardians_; ++ return !stable_array_elements_guardians_; + } + + void ResetGuardians(); +@@ -218,7 +218,7 @@ public: + + InternalCallParams *GetInternalCallParams() const + { +- return internalCallParams_; ++ return internal_call_params_; + } + + ThreadId GetThreadId() const +@@ -235,50 +235,50 @@ 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 GetCurrentFrameOffset() + { +- return MEMBER_OFFSET(JSThread, currentFrame_); ++ return MEMBER_OFFSET(JSThread, current_frame_); + } + + void SetMarkStatus(MarkStatus status) + { +- uint64_t newVal = MarkStatusBits::Update(threadStateBitField_, status); +- threadStateBitField_ = newVal; ++ uint64_t newVal = MarkStatusBits::Update(thread_state_bit_field_, status); ++ thread_state_bit_field_ = newVal; + } + + bool IsReadyToMark() const + { +- auto status = MarkStatusBits::Decode(threadStateBitField_); ++ auto status = MarkStatusBits::Decode(thread_state_bit_field_); + return status == MarkStatus::READY_TO_MARK; + } + + bool IsMarking() const + { +- auto status = MarkStatusBits::Decode(threadStateBitField_); ++ auto status = MarkStatusBits::Decode(thread_state_bit_field_); + return status == MarkStatus::MARKING; + } + + bool IsMarkFinished() const + { +- auto status = MarkStatusBits::Decode(threadStateBitField_); ++ auto status = MarkStatusBits::Decode(thread_state_bit_field_); + return status == MarkStatus::MARK_FINISHED; + } + +@@ -286,22 +286,22 @@ public: + + void SetGetStackSignal(bool isParseStack) + { +- getStackSignal_ = isParseStack; ++ get_stack_signal_ = isParseStack; + } + + bool GetStackSignal() const + { +- return getStackSignal_; ++ return get_stack_signal_; + } + + void SetGcState(bool gcState) + { +- gcState_ = gcState; ++ gc_state_ = gcState; + } + + bool GetGcState() const + { +- return gcState_; ++ return gc_state_; + } + static constexpr uint32_t GetExceptionOffset() + { +@@ -321,12 +321,12 @@ public: + + void SetGlobalObject(JSTaggedValue globalObj) + { +- globalObj_ = globalObj; ++ global_obj_ = globalObj; + } + + JSTaggedValue GetGlobalObject() const + { +- return globalObj_; ++ return global_obj_; + } + + private: +@@ -348,35 +348,35 @@ private: + static constexpr int32_t MIN_HANDLE_STORAGE_SIZE = 2; + + // MM: handles, global-handles, and aot-stubs. +- int nestedLevel_ = 0; +- RegionFactory *regionFactory_ {nullptr}; +- JSTaggedType *handleScopeStorageNext_ {nullptr}; +- JSTaggedType *handleScopeStorageEnd_ {nullptr}; +- std::vector *> handleStorageNodes_ {}; +- int32_t currentHandleStorageIndex_ {-1}; +- int32_t handleScopeCount_ {0}; +- JSTaggedValue stubCode_ {JSTaggedValue::Hole()}; ++ int nested_level_ = 0; ++ RegionFactory *region_factory_ {nullptr}; ++ 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}; ++ 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 GlobalHandleCollection; +diff --git a/runtime/literal_data_extractor.cpp b/runtime/literal_data_extractor.cpp +index 9314e71..97edc8d 100644 +--- a/runtime/literal_data_extractor.cpp ++++ b/runtime/literal_data_extractor.cpp +@@ -62,7 +62,7 @@ void LiteralDataExtractor::ExtractObjectDatas(JSThread *thread, const panda_file + } + case LiteralTag::STRING: { + StringData sd = pf->GetStringData(panda_file::File::EntityId(std::get(value))); +- EcmaString *str = factory->GetRawStringFromStringTable(sd.data, sd.utf16_length, sd.is_ascii); ++ EcmaString *str = factory->GetRawStringFromStringTable(sd.data_, sd.utf16_length_, sd.is_ascii_); + jt = JSTaggedValue(str); + uint32_t idx = 0; + if (JSTaggedValue::ToElementIndex(jt, &idx) && ppos % pairSize == 0) { +@@ -144,7 +144,7 @@ JSHandle LiteralDataExtractor::GetDatasIgnoreType(JSThread *thread, + } + case LiteralTag::STRING: { + StringData sd = pf->GetStringData(panda_file::File::EntityId(std::get(value))); +- EcmaString *str = factory->GetRawStringFromStringTable(sd.data, sd.utf16_length, sd.is_ascii); ++ EcmaString *str = factory->GetRawStringFromStringTable(sd.data_, sd.utf16_length_, sd.is_ascii_); + jt = JSTaggedValue(str); + break; + } +diff --git a/runtime/mem/allocator-inl.h b/runtime/mem/allocator-inl.h +index 413cb1b..68f2330 100644 +--- a/runtime/mem/allocator-inl.h ++++ b/runtime/mem/allocator-inl.h +@@ -70,10 +70,10 @@ uintptr_t BumpPointerAllocator::Allocate(size_t size) + + FreeListAllocator::FreeListAllocator(const Space *space) : heap_(space->GetHeap()), type_(space->GetSpaceType()) + { +- freeList_ = std::make_unique(); +- bpAllocator_.Reset(space); +- FreeObject::Cast(bpAllocator_.GetTop())->SetAvailable(bpAllocator_.Available()); +- FreeObject::Cast(bpAllocator_.GetTop())->SetNext(nullptr); ++ free_list_ = std::make_unique(); ++ bp_allocator_.Reset(space); ++ FreeObject::Cast(bp_allocator_.GetTop())->SetAvailable(bp_allocator_.Available()); ++ FreeObject::Cast(bp_allocator_.GetTop())->SetNext(nullptr); + } + + void FreeListAllocator::Reset(const Space *space) +@@ -81,17 +81,17 @@ void FreeListAllocator::Reset(const Space *space) + heap_ = space->GetHeap(); + type_ = space->GetSpaceType(); + sweeping_ = false; +- freeList_ = std::make_unique(); +- bpAllocator_.Reset(space); +- FreeObject::FillFreeObject(heap_->GetEcmaVM(), bpAllocator_.GetTop(), bpAllocator_.Available()); ++ free_list_ = std::make_unique(); ++ bp_allocator_.Reset(space); ++ FreeObject::FillFreeObject(heap_->GetEcmaVM(), bp_allocator_.GetTop(), bp_allocator_.Available()); + } + + void FreeListAllocator::Reset(Heap *heap) + { + heap_ = heap; +- freeList_ = std::make_unique(); ++ free_list_ = std::make_unique(); + sweeping_ = false; +- bpAllocator_.Reset(); ++ bp_allocator_.Reset(); + } + + void FreeListAllocator::AddFree(Region *region) +@@ -106,13 +106,13 @@ uintptr_t FreeListAllocator::Allocate(size_t size) + if (UNLIKELY(size < static_cast(TaggedObject::TaggedObjectSize()))) { + return 0; + } +- auto ret = bpAllocator_.Allocate(size); ++ auto ret = bp_allocator_.Allocate(size); + if (LIKELY(ret != 0)) { +- FreeObject::FillFreeObject(heap_->GetEcmaVM(), bpAllocator_.GetTop(), bpAllocator_.Available()); +- allocationSizeAccumulator_ += size; ++ FreeObject::FillFreeObject(heap_->GetEcmaVM(), bp_allocator_.GetTop(), bp_allocator_.Available()); ++ allocation_size_accumulator_ += size; + return ret; + } +- FreeObject *object = freeList_->Allocator(size); ++ FreeObject *object = free_list_->Allocator(size); + if (LIKELY(object != nullptr && !object->IsEmpty())) { + return Allocate(object, size); + } +@@ -120,14 +120,14 @@ uintptr_t FreeListAllocator::Allocate(size_t size) + if (sweeping_) { + // Concurrent sweep maybe sweep same region + heap_->GetSweeper()->FillSweptRegion(type_); +- object = freeList_->Allocator(size); ++ object = free_list_->Allocator(size); + if (LIKELY(object != nullptr && !object->IsEmpty())) { + return Allocate(object, size); + } + + // Parallel + heap_->GetSweeper()->WaitingTaskFinish(type_); +- object = freeList_->Allocator(size); ++ object = free_list_->Allocator(size); + if (LIKELY(object != nullptr && !object->IsEmpty())) { + return Allocate(object, size); + } +@@ -139,21 +139,21 @@ uintptr_t FreeListAllocator::Allocate(size_t size) + uintptr_t FreeListAllocator::Allocate(FreeObject *object, size_t size) + { + FreeBumpPoint(); +- bpAllocator_.Reset(object->GetBegin(), object->GetEnd()); +- auto ret = bpAllocator_.Allocate(size); +- if (ret != 0 && bpAllocator_.Available() > 0) { +- FreeObject::FillFreeObject(heap_->GetEcmaVM(), bpAllocator_.GetTop(), bpAllocator_.Available()); +- allocationSizeAccumulator_ += size; ++ bp_allocator_.Reset(object->GetBegin(), object->GetEnd()); ++ auto ret = bp_allocator_.Allocate(size); ++ if (ret != 0 && bp_allocator_.Available() > 0) { ++ FreeObject::FillFreeObject(heap_->GetEcmaVM(), bp_allocator_.GetTop(), bp_allocator_.Available()); ++ allocation_size_accumulator_ += size; + } + return ret; + } + + void FreeListAllocator::FreeBumpPoint() + { +- auto begin = bpAllocator_.GetTop(); +- auto end = bpAllocator_.GetEnd(); ++ auto begin = bp_allocator_.GetTop(); ++ auto end = bp_allocator_.GetEnd(); + Free(begin, end); +- bpAllocator_.Reset(); ++ bp_allocator_.Reset(); + } + + void FreeListAllocator::Free(uintptr_t begin, uintptr_t end, bool isAdd) +@@ -167,25 +167,25 @@ void FreeListAllocator::Free(uintptr_t begin, uintptr_t end, bool isAdd) + return; + } + +- freeList_->Free(begin, size, isAdd); ++ free_list_->Free(begin, size, isAdd); + } + + void FreeListAllocator::RebuildFreeList() + { +- bpAllocator_.Reset(); +- freeList_->Rebuild(); ++ bp_allocator_.Reset(); ++ free_list_->Rebuild(); + } + + void FreeListAllocator::Merge(FreeListAllocator *other) + { + ASSERT(type_ == other->type_); + other->FreeBumpPoint(); +- freeList_->Merge(other->freeList_.get()); ++ free_list_->Merge(other->free_list_.get()); + } + + void FreeListAllocator::FillFreeList(FreeObjectKind *kind) + { +- freeList_->AddKind(kind); ++ free_list_->AddKind(kind); + } + + size_t FreeListAllocator::GetAvailableSize() const +@@ -193,7 +193,7 @@ size_t FreeListAllocator::GetAvailableSize() const + if (sweeping_) { + heap_->GetSweeper()->WaitingTaskFinish(type_); + } +- return freeList_->GetFreeObjectSize(); ++ return free_list_->GetFreeObjectSize(); + } + } // namespace panda::ecmascript + #endif // ECMASCRIPT_MEM_ALLOCATOR_INL_H +diff --git a/runtime/mem/allocator.h b/runtime/mem/allocator.h +index 8c9d76e..0d70412 100644 +--- a/runtime/mem/allocator.h ++++ b/runtime/mem/allocator.h +@@ -100,8 +100,8 @@ public: + inline void Swap(FreeListAllocator &other) + { + heap_ = other.heap_; +- bpAllocator_.Swap(other.bpAllocator_); +- freeList_.swap(other.freeList_); ++ bp_allocator_.Swap(other.bp_allocator_); ++ free_list_.swap(other.free_list_); + type_ = other.type_; + sweeping_ = other.sweeping_; + } +@@ -122,18 +122,18 @@ public: + + size_t GetAllocatedSize() const + { +- return allocationSizeAccumulator_; ++ return allocation_size_accumulator_; + } + + private: + inline uintptr_t Allocate(FreeObject *object, size_t size); + +- BumpPointerAllocator bpAllocator_; +- std::unique_ptr freeList_; ++ BumpPointerAllocator bp_allocator_; ++ std::unique_ptr free_list_; + Heap *heap_ {nullptr}; + MemSpaceType type_ = OLD_SPACE; + bool sweeping_ = false; +- size_t allocationSizeAccumulator_ = 0; ++ size_t allocation_size_accumulator_ = 0; + }; + } // namespace panda::ecmascript + +diff --git a/runtime/mem/assert_scope-inl.h b/runtime/mem/assert_scope-inl.h +index d2bde54..c705fb8 100644 +--- a/runtime/mem/assert_scope-inl.h ++++ b/runtime/mem/assert_scope-inl.h +@@ -24,14 +24,14 @@ namespace panda::ecmascript { + static thread_local size_t currentAssertData(~0); + + template +-AssertScopeT::AssertScopeT() : oldData_(currentAssertData) ++AssertScopeT::AssertScopeT() : old_data_(currentAssertData) + { + switch (type) { + case AssertType::GARBAGE_COLLECTION_ASSERT: +- currentAssertData = AssertGarbageCollectBit::Update(oldData_.value(), isAllow); ++ currentAssertData = AssertGarbageCollectBit::Update(old_data_.value(), isAllow); + break; + case AssertType::HEAP_ALLOC_ASSERT: +- currentAssertData = AssertHeapAllocBit::Update(oldData_.value(), isAllow); ++ currentAssertData = AssertHeapAllocBit::Update(old_data_.value(), isAllow); + break; + default: + break; +@@ -41,12 +41,12 @@ AssertScopeT::AssertScopeT() : oldData_(currentAssertData) + template + AssertScopeT::~AssertScopeT() + { +- if (!oldData_.has_value()) { ++ if (!old_data_.has_value()) { + return; + } + +- currentAssertData = oldData_.value(); +- oldData_.reset(); ++ currentAssertData = old_data_.value(); ++ old_data_.reset(); + } + + // static +diff --git a/runtime/mem/assert_scope.h b/runtime/mem/assert_scope.h +index a999f5c..8f9943d 100644 +--- a/runtime/mem/assert_scope.h ++++ b/runtime/mem/assert_scope.h +@@ -55,7 +55,7 @@ public: + DEFAULT_NOEXCEPT_MOVE_SEMANTIC(AssertScopeT); + + private: +- std::optional oldData_; ++ std::optional old_data_; + }; + + using DisallowGarbageCollection = AssertScopeT; +diff --git a/runtime/mem/chunk.cpp b/runtime/mem/chunk.cpp +index 9455380..e911cd6 100644 +--- a/runtime/mem/chunk.cpp ++++ b/runtime/mem/chunk.cpp +@@ -27,8 +27,8 @@ Area *Chunk::NewArea(size_t size) + LOG_ECMA_MEM(FATAL) << "OOM Chunk::NewArea area is nullptr"; + UNREACHABLE(); + } +- areaList_.AddNode(area); +- currentArea_ = area; ++ area_list_.AddNode(area); ++ current_area_ = area; + return area; + } + +@@ -36,7 +36,7 @@ uintptr_t Chunk::Expand(size_t size) + { + ASSERT(end_ - ptr_ < size); + +- Area *head = currentArea_; ++ Area *head = current_area_; + size_t newSize; + if (head != nullptr) { + // NOLINTNEXTLINE(hicpp-signed-bitwise) +@@ -70,8 +70,8 @@ uintptr_t Chunk::Expand(size_t size) + + void Chunk::ReleaseMemory() + { +- while (!areaList_.IsEmpty()) { +- Area *node = areaList_.PopBack(); ++ while (!area_list_.IsEmpty()) { ++ Area *node = area_list_.PopBack(); + factory_->FreeArea(node); + } + ptr_ = 0; +diff --git a/runtime/mem/chunk.h b/runtime/mem/chunk.h +index 434451c..955a05d 100644 +--- a/runtime/mem/chunk.h ++++ b/runtime/mem/chunk.h +@@ -90,8 +90,8 @@ private: + uintptr_t ptr_ {0}; + uintptr_t end_ {0}; + +- Area *currentArea_ {nullptr}; +- EcmaList areaList_ {}; ++ Area *current_area_ {nullptr}; ++ EcmaList area_list_ {}; + RegionFactory *factory_ {nullptr}; + }; + } // namespace panda::ecmascript +diff --git a/runtime/mem/compress_collector.cpp b/runtime/mem/compress_collector.cpp +index 1c3c899..0bc689e 100644 +--- a/runtime/mem/compress_collector.cpp ++++ b/runtime/mem/compress_collector.cpp +@@ -28,7 +28,7 @@ + #include "plugins/ecmascript/runtime/vmstat/runtime_stat.h" + + namespace panda::ecmascript { +-CompressCollector::CompressCollector(Heap *heap) : heap_(heap), workList_(heap->GetWorkList()) {} ++CompressCollector::CompressCollector(Heap *heap) : heap_(heap), work_list_(heap->GetWorkList()) {} + + void CompressCollector::RunPhases() + { +@@ -46,9 +46,9 @@ void CompressCollector::RunPhases() + MarkingPhase(); + SweepPhases(); + FinishPhase(); +- heap_->GetEcmaVM()->GetEcmaGCStats()->StatisticCompressCollector(clockScope.GetPauseTime(), youngAndOldAliveSize_, +- youngSpaceCommitSize_, oldSpaceCommitSize_, +- nonMoveSpaceFreeSize_, nonMoveSpaceCommitSize_); ++ heap_->GetEcmaVM()->GetEcmaGCStats()->StatisticCompressCollector( ++ clockScope.GetPauseTime(), young_and_old_alive_size_, young_space_commit_size_, old_space_commit_size_, ++ non_move_space_free_size_, non_move_space_commit_size_); + ECMA_GC_LOG() << "CompressCollector::RunPhases " << clockScope.TotalSpentTime(); + } + +@@ -70,15 +70,15 @@ void CompressCollector::InitializePhase() + } + }; + heap_->EnumerateNonMovableRegions(callback); +- workList_->Initialize(TriggerGCType::COMPRESS_FULL_GC, ParallelGCTaskPhase::COMPRESS_HANDLE_GLOBAL_POOL_TASK); ++ work_list_->Initialize(TriggerGCType::COMPRESS_FULL_GC, ParallelGCTaskPhase::COMPRESS_HANDLE_GLOBAL_POOL_TASK); + heap_->GetCompressGcMarker()->Initialized(); + heap_->GetEvacuationAllocator()->Initialize(TriggerGCType::COMPRESS_FULL_GC); + +- youngAndOldAliveSize_ = 0; +- nonMoveSpaceFreeSize_ = 0; +- youngSpaceCommitSize_ = heap_->GetFromSpace()->GetCommittedSize(); +- oldSpaceCommitSize_ = heap_->GetCompressSpace()->GetCommittedSize(); +- nonMoveSpaceCommitSize_ = heap_->GetNonMovableSpace()->GetCommittedSize(); ++ young_and_old_alive_size_ = 0; ++ non_move_space_free_size_ = 0; ++ young_space_commit_size_ = heap_->GetFromSpace()->GetCommittedSize(); ++ old_space_commit_size_ = heap_->GetCompressSpace()->GetCommittedSize(); ++ non_move_space_commit_size_ = heap_->GetNonMovableSpace()->GetCommittedSize(); + } + + void CompressCollector::MarkingPhase() +@@ -95,7 +95,7 @@ void CompressCollector::SweepPhases() + // process weak reference + auto totalThreadCount = Platform::GetCurrentPlatform()->GetTotalThreadNum() + 1; // gc thread and main thread + for (uint32_t i = 0; i < totalThreadCount; i++) { +- ProcessQueue *queue = workList_->GetWeakReferenceQueue(i); ++ ProcessQueue *queue = work_list_->GetWeakReferenceQueue(i); + + while (true) { + auto obj = queue->PopBack(); +@@ -153,7 +153,7 @@ void CompressCollector::SweepPhases() + void CompressCollector::FinishPhase() + { + ECMA_BYTRACE_NAME(BYTRACE_TAG_ARK, "CompressCollector::FinishPhase"); +- workList_->Finish(youngAndOldAliveSize_); ++ work_list_->Finish(young_and_old_alive_size_); + heap_->GetEvacuationAllocator()->Finalize(TriggerGCType::COMPRESS_FULL_GC); + } + } // namespace panda::ecmascript +diff --git a/runtime/mem/compress_collector.h b/runtime/mem/compress_collector.h +index fa44094..f30e264 100644 +--- a/runtime/mem/compress_collector.h ++++ b/runtime/mem/compress_collector.h +@@ -40,14 +40,14 @@ private: + void FinishPhase(); + + Heap *heap_; +- size_t youngAndOldAliveSize_ = 0; +- size_t nonMoveSpaceFreeSize_ = 0; +- size_t youngSpaceCommitSize_ = 0; +- size_t oldSpaceCommitSize_ = 0; +- size_t nonMoveSpaceCommitSize_ = 0; ++ size_t young_and_old_alive_size_ = 0; ++ size_t non_move_space_free_size_ = 0; ++ size_t young_space_commit_size_ = 0; ++ size_t old_space_commit_size_ = 0; ++ size_t non_move_space_commit_size_ = 0; + + // obtain from heap +- WorkerHelper *workList_ {nullptr}; ++ WorkerHelper *work_list_ {nullptr}; + + friend class WorkerHelper; + friend class Heap; +diff --git a/runtime/mem/concurrent_marker.cpp b/runtime/mem/concurrent_marker.cpp +index 9518c28..8d1e1be 100644 +--- a/runtime/mem/concurrent_marker.cpp ++++ b/runtime/mem/concurrent_marker.cpp +@@ -28,7 +28,7 @@ + + namespace panda::ecmascript { + ConcurrentMarker::ConcurrentMarker(Heap *heap) +- : heap_(heap), vm_(heap->GetEcmaVM()), thread_(vm_->GetJSThread()), workList_(heap->GetWorkList()) ++ : heap_(heap), vm_(heap->GetEcmaVM()), thread_(vm_->GetJSThread()), work_list_(heap->GetWorkList()) + { + } + +@@ -40,12 +40,12 @@ void ConcurrentMarker::ConcurrentMarking() + ECMA_BYTRACE_NAME(BYTRACE_TAG_ARK, "ConcurrentMarker::ConcurrentMarking"); + thread_->SetMarkStatus(MarkStatus::MARKING); + if (!heap_->IsSemiMarkNeeded()) { +- heapObjectSize_ = heap_->GetHeapObjectSize(); ++ heap_object_size_ = heap_->GetHeapObjectSize(); + if (heap_->GetSweeper()->CanSelectCset()) { + const_cast(heap_->GetOldSpace())->SelectCSet(); + } + } else { +- heapObjectSize_ = heap_->GetNewSpace()->GetHeapObjectSize(); ++ heap_object_size_ = heap_->GetNewSpace()->GetHeapObjectSize(); + } + + InitializeMarking(); +@@ -58,7 +58,7 @@ void ConcurrentMarker::ConcurrentMarking() + void ConcurrentMarker::FinishPhase() + { + size_t aliveSize = 0; +- workList_->Finish(aliveSize); ++ work_list_->Finish(aliveSize); + } + + void ConcurrentMarker::ReMarking() +@@ -76,18 +76,18 @@ void ConcurrentMarker::ReMarking() + + void ConcurrentMarker::HandleMarkFinished() // js-thread wait for sweep + { +- os::memory::LockHolder lock(waitMarkingFinishedMutex_); +- if (notifyMarkingFinished_) { ++ os::memory::LockHolder lock(wait_marking_finished_mutex_); ++ if (notify_marking_finished_) { + heap_->CollectGarbage(TriggerGCType::OLD_GC); + } + } + + void ConcurrentMarker::WaitConcurrentMarkingFinished() // call in EcmaVm thread, wait for mark finished + { +- os::memory::LockHolder lock(waitMarkingFinishedMutex_); +- if (!notifyMarkingFinished_) { +- vmThreadWaitMarkingFinished_ = true; +- waitMarkingFinishedCV_.Wait(&waitMarkingFinishedMutex_); ++ os::memory::LockHolder lock(wait_marking_finished_mutex_); ++ if (!notify_marking_finished_) { ++ vm_thread_wait_marking_finished_ = true; ++ wait_marking_finished_cv_.Wait(&wait_marking_finished_mutex_); + } + } + +@@ -95,7 +95,7 @@ void ConcurrentMarker::Reset(bool isClearCSet) + { + FinishPhase(); + thread_->SetMarkStatus(MarkStatus::READY_TO_MARK); +- notifyMarkingFinished_ = false; ++ notify_marking_finished_ = false; + duration_ = 0.0; + if (isClearCSet) { + // Mix space gc clear cset when evacuation allocator finalize +@@ -129,7 +129,7 @@ void ConcurrentMarker::InitializeMarking() + } else { + heap_->EnumerateRegions([](Region *current) { current->ResetAliveObject(); }); + } +- workList_->Initialize(TriggerGCType::OLD_GC, ParallelGCTaskPhase::CONCURRENT_HANDLE_GLOBAL_POOL_TASK); ++ work_list_->Initialize(TriggerGCType::OLD_GC, ParallelGCTaskPhase::CONCURRENT_HANDLE_GLOBAL_POOL_TASK); + heap_->GetNonMovableMarker()->MarkRoots(0); + } + +@@ -145,12 +145,12 @@ bool ConcurrentMarker::MarkerTask::Run(uint32_t threadId) + + void ConcurrentMarker::MarkingFinished() + { +- os::memory::LockHolder lock(waitMarkingFinishedMutex_); ++ os::memory::LockHolder lock(wait_marking_finished_mutex_); + thread_->SetMarkStatus(MarkStatus::MARK_FINISHED); +- if (vmThreadWaitMarkingFinished_) { +- vmThreadWaitMarkingFinished_ = false; +- waitMarkingFinishedCV_.Signal(); ++ if (vm_thread_wait_marking_finished_) { ++ vm_thread_wait_marking_finished_ = false; ++ wait_marking_finished_cv_.Signal(); + } +- notifyMarkingFinished_ = true; ++ notify_marking_finished_ = true; + } + } // namespace panda::ecmascript +diff --git a/runtime/mem/concurrent_marker.h b/runtime/mem/concurrent_marker.h +index cc5283a..94b7ea0 100644 +--- a/runtime/mem/concurrent_marker.h ++++ b/runtime/mem/concurrent_marker.h +@@ -49,7 +49,7 @@ public: + + double GetHeapObjectSize() const + { +- return heapObjectSize_; ++ return heap_object_size_; + } + + private: +@@ -82,14 +82,14 @@ private: + JSThread *thread_ {nullptr}; + + // obtain from heap +- WorkerHelper *workList_ {nullptr}; +- size_t heapObjectSize_ {0}; ++ WorkerHelper *work_list_ {nullptr}; ++ size_t heap_object_size_ {0}; + double duration_ {0.0}; + +- bool notifyMarkingFinished_ {false}; // notify js-thread that marking is finished and need sweep +- bool vmThreadWaitMarkingFinished_ {false}; // jsMainThread waiting for concurrentGC FINISHED +- os::memory::Mutex waitMarkingFinishedMutex_; +- os::memory::ConditionVariable waitMarkingFinishedCV_; ++ bool notify_marking_finished_ {false}; // notify js-thread that marking is finished and need sweep ++ bool vm_thread_wait_marking_finished_ {false}; // jsMainThread waiting for concurrentGC FINISHED ++ os::memory::Mutex wait_marking_finished_mutex_; ++ os::memory::ConditionVariable wait_marking_finished_cv_; + }; + } // namespace panda::ecmascript + #endif // ECMASCRIPT_MEM_CONCURRENT_MARKER_H +diff --git a/runtime/mem/concurrent_sweeper.cpp b/runtime/mem/concurrent_sweeper.cpp +index 33ad87c..75ebc8b 100644 +--- a/runtime/mem/concurrent_sweeper.cpp ++++ b/runtime/mem/concurrent_sweeper.cpp +@@ -24,13 +24,13 @@ + #include "plugins/ecmascript/runtime/platform/platform.h" + + namespace panda::ecmascript { +-ConcurrentSweeper::ConcurrentSweeper(Heap *heap, bool concurrentSweep) : heap_(heap), concurrentSweep_(concurrentSweep) ++ConcurrentSweeper::ConcurrentSweeper(Heap *heap, bool concurrentSweep) : heap_(heap), concurrent_sweep_(concurrentSweep) + { + } + + void ConcurrentSweeper::SweepPhases(bool compressGC) + { +- if (concurrentSweep_) { ++ if (concurrent_sweep_) { + // Add all region to region list. Ensure all task finish + if (!compressGC) { + heap_->GetOldSpace()->EnumerateNonCollectRegionSet( +@@ -41,21 +41,21 @@ void ConcurrentSweeper::SweepPhases(bool compressGC) + [this](Region *current) { AddRegion(MACHINE_CODE_SPACE, current); }); + + // Prepare +- isSweeping_ = true; +- startSpaceType_ = compressGC ? NON_MOVABLE : OLD_SPACE; +- for (int type = startSpaceType_; type < FREE_LIST_NUM; type++) { ++ is_sweeping_ = true; ++ start_space_type_ = compressGC ? NON_MOVABLE : OLD_SPACE; ++ for (int type = start_space_type_; type < FREE_LIST_NUM; type++) { + auto spaceType = static_cast(type); + FreeListAllocator &allocator = heap_->GetHeapManager()->GetFreeListAllocator(spaceType); +- remainderTaskNum_[type] = FREE_LIST_NUM - startSpaceType_; ++ remainder_task_num_[type] = FREE_LIST_NUM - start_space_type_; + allocator.SetSweeping(true); + allocator.RebuildFreeList(); + } + + if (!compressGC) { + Platform::GetCurrentPlatform()->PostTask(std::make_unique(this, OLD_SPACE)); +- canSelectCset_ = true; ++ can_select_cset_ = true; + } else { +- canSelectCset_ = false; ++ can_select_cset_ = false; + } + Platform::GetCurrentPlatform()->PostTask(std::make_unique(this, NON_MOVABLE)); + Platform::GetCurrentPlatform()->PostTask(std::make_unique(this, MACHINE_CODE_SPACE)); +@@ -63,9 +63,9 @@ void ConcurrentSweeper::SweepPhases(bool compressGC) + if (!compressGC) { + SweepSpace(OLD_SPACE, const_cast(heap_->GetOldSpace()), + heap_->GetHeapManager()->GetOldSpaceAllocator()); +- canSelectCset_ = true; ++ can_select_cset_ = true; + } else { +- canSelectCset_ = false; ++ can_select_cset_ = false; + } + SweepSpace(NON_MOVABLE, const_cast(heap_->GetNonMovableSpace()), + heap_->GetHeapManager()->GetNonMovableSpaceAllocator()); +@@ -90,7 +90,7 @@ void ConcurrentSweeper::SweepSpace(MemSpaceType type, bool isMain) + + if (!isMain) { + os::memory::LockHolder holder(mutexs_[type]); +- if (--remainderTaskNum_[type] == 0) { ++ if (--remainder_task_num_[type] == 0) { + cvs_[type].SignalAll(); + } + } +@@ -149,7 +149,7 @@ void ConcurrentSweeper::FreeRegion(Region *current, FreeListAllocator &allocator + + void ConcurrentSweeper::FillSweptRegion(MemSpaceType type) + { +- if (sweptList_[type].empty()) { ++ if (swept_list_[type].empty()) { + return; + } + FreeListAllocator &allocator = heap_->GetHeapManager()->GetFreeListAllocator(type); +@@ -173,16 +173,16 @@ void ConcurrentSweeper::FreeLiveRange(FreeListAllocator &allocator, Region *curr + + void ConcurrentSweeper::AddRegion(MemSpaceType type, Region *region) + { +- sweepingList_[type].emplace_back(region); ++ sweeping_list_[type].emplace_back(region); + } + + Region *ConcurrentSweeper::GetRegionSafe(MemSpaceType type) + { + os::memory::LockHolder holder(mutexs_[type]); + Region *region = nullptr; +- if (!sweepingList_[type].empty()) { +- region = sweepingList_[type].back(); +- sweepingList_[type].pop_back(); ++ if (!sweeping_list_[type].empty()) { ++ region = sweeping_list_[type].back(); ++ sweeping_list_[type].pop_back(); + } + return region; + } +@@ -190,38 +190,38 @@ Region *ConcurrentSweeper::GetRegionSafe(MemSpaceType type) + void ConcurrentSweeper::AddSweptRegionSafe(MemSpaceType type, Region *region) + { + os::memory::LockHolder holder(mutexs_[type]); +- sweptList_[type].emplace_back(region); ++ swept_list_[type].emplace_back(region); + } + + Region *ConcurrentSweeper::GetSweptRegionSafe(MemSpaceType type) + { + os::memory::LockHolder holder(mutexs_[type]); + Region *region = nullptr; +- if (!sweptList_[type].empty()) { +- region = sweptList_[type].back(); +- sweptList_[type].pop_back(); ++ if (!swept_list_[type].empty()) { ++ region = swept_list_[type].back(); ++ swept_list_[type].pop_back(); + } + return region; + } + + void ConcurrentSweeper::EnsureAllTaskFinished() + { +- if (!isSweeping_) { ++ if (!is_sweeping_) { + return; + } +- for (int i = startSpaceType_; i < FREE_LIST_NUM; i++) { ++ for (int i = start_space_type_; i < FREE_LIST_NUM; i++) { + WaitingTaskFinish(static_cast(i)); + } +- isSweeping_ = false; ++ is_sweeping_ = false; + } + + void ConcurrentSweeper::WaitingTaskFinish(MemSpaceType type) + { +- if (remainderTaskNum_[type] > 0) { ++ if (remainder_task_num_[type] > 0) { + SweepSpace(type); + { + os::memory::LockHolder holder(mutexs_[type]); +- while (remainderTaskNum_[type] > 0) { ++ while (remainder_task_num_[type] > 0) { + cvs_[type].Wait(&mutexs_[type]); + } + } +@@ -241,9 +241,9 @@ void ConcurrentSweeper::FinishSweeping(MemSpaceType type) + + bool ConcurrentSweeper::SweeperTask::Run([[maybe_unused]] uint32_t threadIndex) + { +- int sweepTypeNum = FREE_LIST_NUM - sweeper_->startSpaceType_; +- for (size_t i = sweeper_->startSpaceType_; i < FREE_LIST_NUM; i++) { +- auto type = static_cast(((i + type_) % sweepTypeNum) + sweeper_->startSpaceType_); ++ int sweepTypeNum = FREE_LIST_NUM - sweeper_->start_space_type_; ++ for (size_t i = sweeper_->start_space_type_; i < FREE_LIST_NUM; i++) { ++ auto type = static_cast(((i + type_) % sweepTypeNum) + sweeper_->start_space_type_); + sweeper_->SweepSpace(type, false); + } + return true; +diff --git a/runtime/mem/concurrent_sweeper.h b/runtime/mem/concurrent_sweeper.h +index bbaca44..62370c1 100644 +--- a/runtime/mem/concurrent_sweeper.h ++++ b/runtime/mem/concurrent_sweeper.h +@@ -44,12 +44,12 @@ public: + + bool IsConcurrentSweepEnabled() + { +- return concurrentSweep_; ++ return concurrent_sweep_; + } + + bool CanSelectCset() const + { +- return canSelectCset_; ++ return can_select_cset_; + } + + private: +@@ -84,16 +84,16 @@ private: + + std::array mutexs_; + std::array cvs_; +- std::array remainderTaskNum_ = {0, 0, 0}; ++ std::array remainder_task_num_ = {0, 0, 0}; + +- std::array, FREE_LIST_NUM> sweepingList_; +- std::array, FREE_LIST_NUM> sweptList_; ++ std::array, FREE_LIST_NUM> sweeping_list_; ++ std::array, FREE_LIST_NUM> swept_list_; + + Heap *heap_; +- bool concurrentSweep_ {false}; +- bool isSweeping_ {false}; +- bool canSelectCset_ {false}; +- MemSpaceType startSpaceType_ = MemSpaceType::OLD_SPACE; ++ bool concurrent_sweep_ {false}; ++ bool is_sweeping_ {false}; ++ bool can_select_cset_ {false}; ++ MemSpaceType start_space_type_ = MemSpaceType::OLD_SPACE; + }; + } // namespace panda::ecmascript + #endif // ECMASCRIPT_MEM_CONCURRENT_SWEEPER_H +diff --git a/runtime/mem/evacuation_allocator-inl.h b/runtime/mem/evacuation_allocator-inl.h +index 915a7ca..34d8705 100644 +--- a/runtime/mem/evacuation_allocator-inl.h ++++ b/runtime/mem/evacuation_allocator-inl.h +@@ -23,24 +23,24 @@ + namespace panda::ecmascript { + Region *EvacuationAllocator::ExpandOldSpace() + { +- os::memory::LockHolder lock(oldAllocatorLock_); ++ os::memory::LockHolder lock(old_allocator_lock_); + return heap_->ExpandCompressSpace(); + } + + void EvacuationAllocator::FreeSafe(uintptr_t begin, uintptr_t end) + { +- os::memory::LockHolder lock(oldAllocatorLock_); +- oldSpaceAllocator_.Free(begin, end); ++ os::memory::LockHolder lock(old_allocator_lock_); ++ old_space_allocator_.Free(begin, end); + } + + void EvacuationAllocator::Free(uintptr_t begin, uintptr_t end, bool isAdd) + { +- oldSpaceAllocator_.Free(begin, end, isAdd); ++ old_space_allocator_.Free(begin, end, isAdd); + } + + void EvacuationAllocator::FillFreeList(FreeObjectKind *kind) + { +- oldSpaceAllocator_.FillFreeList(kind); ++ old_space_allocator_.FillFreeList(kind); + } + } // namespace panda::ecmascript + #endif // ECMASCRIPT_MEM_EVACUATION_ALLOCATOR_INL_H +diff --git a/runtime/mem/evacuation_allocator.cpp b/runtime/mem/evacuation_allocator.cpp +index 5eaebb6..d3fe07c 100644 +--- a/runtime/mem/evacuation_allocator.cpp ++++ b/runtime/mem/evacuation_allocator.cpp +@@ -30,19 +30,19 @@ void EvacuationAllocator::Initialize(TriggerGCType type) + heap_->GetNewSpace()->GetCurrentRegion()->SetHighWaterMark(heapManager->GetNewSpaceAllocator().GetTop()); + heap_->InitializeFromSpace(); + auto fromSpace = heap_->GetFromSpace(); +- newSpaceAllocator_.Reset(fromSpace); ++ new_space_allocator_.Reset(fromSpace); + heap_->FlipNewSpace(); + // Reset old space allocator + if (type == TriggerGCType::OLD_GC) { +- oldSpaceAllocator_.Reset(heap_); ++ old_space_allocator_.Reset(heap_); + } else if (type == TriggerGCType::COMPRESS_FULL_GC) { + heap_->InitializeCompressSpace(); + auto compressSpace = const_cast(heap_->GetCompressSpace()); + auto currentRegion = compressSpace->GetCurrentRegion(); + currentRegion->SetAliveObject(currentRegion->GetSize()); +- oldSpaceAllocator_.Reset(compressSpace); ++ old_space_allocator_.Reset(compressSpace); + } else { +- oldSpaceAllocator_.Swap(heapManager->GetOldSpaceAllocator()); ++ old_space_allocator_.Swap(heapManager->GetOldSpaceAllocator()); + } + } + +@@ -54,72 +54,72 @@ void EvacuationAllocator::Finalize(TriggerGCType type) + auto oldSpace = const_cast(heap_->GetOldSpace()); + oldSpace->RemoveCSetFromList(); + oldSpace->Merge(const_cast(heap_->GetCompressSpace())); +- heapManager->GetOldSpaceAllocator().Merge(&oldSpaceAllocator_); ++ heapManager->GetOldSpaceAllocator().Merge(&old_space_allocator_); + } else { + if (type == TriggerGCType::COMPRESS_FULL_GC) { + heap_->FlipCompressSpace(); + } +- heapManager->GetOldSpaceAllocator().Swap(oldSpaceAllocator_); ++ heapManager->GetOldSpaceAllocator().Swap(old_space_allocator_); + } +- heapManager->GetNewSpaceAllocator().Swap(newSpaceAllocator_); ++ heapManager->GetNewSpaceAllocator().Swap(new_space_allocator_); + + // Reclaim Region + if (heap_->IsParallelGCEnabled()) { +- isFreeTaskFinish_ = false; ++ is_free_task_finish_ = false; + Platform::GetCurrentPlatform()->PostTask(std::make_unique(this, type)); + } else { + ReclaimRegions(type); + } + +- heap_->SetNewSpaceAgeMark(newSpaceAllocator_.GetTop()); ++ heap_->SetNewSpaceAgeMark(new_space_allocator_.GetTop()); + } + + bool EvacuationAllocator::AddRegionToOld(Region *region) + { + if (!region->InYoungGeneration()) { +- os::memory::LockHolder lock(oldAllocatorLock_); ++ os::memory::LockHolder lock(old_allocator_lock_); + const_cast(heap_->GetOldSpace())->RemoveRegionFromCSetAndList(region); + return heap_->AddRegionToCompressSpace(region); + } + { +- os::memory::LockHolder lock(youngAllocatorLock_); ++ os::memory::LockHolder lock(young_allocator_lock_); + const_cast(heap_->GetFromSpace())->RemoveRegion(region); + } +- os::memory::LockHolder lock(oldAllocatorLock_); ++ os::memory::LockHolder lock(old_allocator_lock_); + return heap_->AddRegionToCompressSpace(region); + } + + bool EvacuationAllocator::AddRegionToYoung(Region *region) + { + ASSERT(region->InYoungGeneration()); +- os::memory::LockHolder lock(youngAllocatorLock_); ++ os::memory::LockHolder lock(young_allocator_lock_); + const_cast(heap_->GetFromSpace())->RemoveRegion(region); + return heap_->AddRegionToToSpace(region); + } + + uintptr_t EvacuationAllocator::AllocateOld(size_t size) + { +- os::memory::LockHolder lock(oldAllocatorLock_); +- uintptr_t result = oldSpaceAllocator_.Allocate(size); ++ os::memory::LockHolder lock(old_allocator_lock_); ++ uintptr_t result = old_space_allocator_.Allocate(size); + if (UNLIKELY(result == 0)) { + // Compress bugfix +- if (!heap_->FillOldSpaceAndTryGC(&oldSpaceAllocator_, false)) { ++ if (!heap_->FillOldSpaceAndTryGC(&old_space_allocator_, false)) { + return 0; + } +- result = oldSpaceAllocator_.Allocate(size); ++ result = old_space_allocator_.Allocate(size); + } + return result; + } + + uintptr_t EvacuationAllocator::AllocateYoung(size_t size) + { +- os::memory::LockHolder lock(youngAllocatorLock_); +- uintptr_t result = newSpaceAllocator_.Allocate(size); ++ os::memory::LockHolder lock(young_allocator_lock_); ++ uintptr_t result = new_space_allocator_.Allocate(size); + if (UNLIKELY(result == 0)) { +- if (!heap_->FillNewSpaceAndTryGC(&newSpaceAllocator_, false)) { ++ if (!heap_->FillNewSpaceAndTryGC(&new_space_allocator_, false)) { + return 0; + } +- result = newSpaceAllocator_.Allocate(size); ++ result = new_space_allocator_.Allocate(size); + } + return result; + } +@@ -132,18 +132,18 @@ void EvacuationAllocator::ReclaimRegions(TriggerGCType gcType) + const_cast(heap_->GetOldSpace())->ReclaimRegionCSet(); + } + const_cast(heap_->GetFromSpace())->ReclaimRegions(); +- if (!isFreeTaskFinish_) { ++ if (!is_free_task_finish_) { + os::memory::LockHolder holder(mutex_); +- isFreeTaskFinish_ = true; ++ is_free_task_finish_ = true; + condition_.SignalAll(); + } + } + + void EvacuationAllocator::WaitFreeTaskFinish() + { +- if (!isFreeTaskFinish_) { ++ if (!is_free_task_finish_) { + os::memory::LockHolder holder(mutex_); +- while (!isFreeTaskFinish_) { ++ while (!is_free_task_finish_) { + condition_.Wait(&mutex_); + } + } +@@ -151,7 +151,7 @@ void EvacuationAllocator::WaitFreeTaskFinish() + + bool EvacuationAllocator::AsyncFreeRegionTask::Run([[maybe_unused]] uint32_t threadIndex) + { +- allocator_->ReclaimRegions(gcType_); ++ allocator_->ReclaimRegions(gc_type_); + return true; + } + } // namespace panda::ecmascript +diff --git a/runtime/mem/evacuation_allocator.h b/runtime/mem/evacuation_allocator.h +index 309c0cd..fb98851 100644 +--- a/runtime/mem/evacuation_allocator.h ++++ b/runtime/mem/evacuation_allocator.h +@@ -37,7 +37,7 @@ public: + + inline uintptr_t GetNewSpaceTop() + { +- return newSpaceAllocator_.GetTop(); ++ return new_space_allocator_.GetTop(); + } + + bool AddRegionToOld(Region *region); +@@ -58,7 +58,7 @@ public: + private: + class AsyncFreeRegionTask : public Task { + public: +- AsyncFreeRegionTask(EvacuationAllocator *allocator, TriggerGCType type) : allocator_(allocator), gcType_(type) ++ AsyncFreeRegionTask(EvacuationAllocator *allocator, TriggerGCType type) : allocator_(allocator), gc_type_(type) + { + } + ~AsyncFreeRegionTask() override = default; +@@ -69,15 +69,15 @@ private: + + private: + EvacuationAllocator *allocator_; +- TriggerGCType gcType_; ++ TriggerGCType gc_type_; + }; + + Heap *heap_; +- bool isFreeTaskFinish_ = true; +- BumpPointerAllocator newSpaceAllocator_; +- FreeListAllocator oldSpaceAllocator_; +- os::memory::Mutex youngAllocatorLock_; +- os::memory::Mutex oldAllocatorLock_; ++ bool is_free_task_finish_ = true; ++ BumpPointerAllocator new_space_allocator_; ++ FreeListAllocator old_space_allocator_; ++ os::memory::Mutex young_allocator_lock_; ++ os::memory::Mutex old_allocator_lock_; + // Async free region task + os::memory::Mutex mutex_; + os::memory::ConditionVariable condition_; +diff --git a/runtime/mem/free_object_kind.cpp b/runtime/mem/free_object_kind.cpp +index fee3869..043726e 100644 +--- a/runtime/mem/free_object_kind.cpp ++++ b/runtime/mem/free_object_kind.cpp +@@ -22,16 +22,16 @@ namespace panda::ecmascript { + void FreeObjectKind::Free(uintptr_t begin, size_t size) + { + auto freeObject = FreeObject::Cast(begin); +- freeObject->SetNext(freeObject_); +- freeObject_ = freeObject; ++ freeObject->SetNext(free_object_); ++ free_object_ = freeObject; + available_ += size; + } + + void FreeObjectKind::Rebuild() + { +- freeObject_ = nullptr; ++ free_object_ = nullptr; + available_ = 0; +- isAdded_ = false; ++ is_added_ = false; + next_ = nullptr; + prev_ = nullptr; + } +@@ -39,9 +39,9 @@ void FreeObjectKind::Rebuild() + FreeObject *FreeObjectKind::SearchSmallFreeObject(size_t size) + { + FreeObject *curFreeObject = nullptr; +- if (freeObject_ != nullptr && freeObject_->Available() >= size) { +- curFreeObject = freeObject_; +- freeObject_ = freeObject_->GetNext(); ++ if (free_object_ != nullptr && free_object_->Available() >= size) { ++ curFreeObject = free_object_; ++ free_object_ = free_object_->GetNext(); + curFreeObject->SetNext(nullptr); + available_ -= curFreeObject->Available(); + } +@@ -50,12 +50,12 @@ FreeObject *FreeObjectKind::SearchSmallFreeObject(size_t size) + + FreeObject *FreeObjectKind::SearchLargeFreeObject(size_t size) + { +- FreeObject *prevFreeObject = freeObject_; +- FreeObject *curFreeObject = freeObject_; ++ FreeObject *prevFreeObject = free_object_; ++ FreeObject *curFreeObject = free_object_; + while (curFreeObject != nullptr) { + if (curFreeObject->Available() >= size) { +- if (curFreeObject == freeObject_) { +- freeObject_ = curFreeObject->GetNext(); ++ if (curFreeObject == free_object_) { ++ free_object_ = curFreeObject->GetNext(); + } else { + prevFreeObject->SetNext(curFreeObject->GetNext()); + } +diff --git a/runtime/mem/free_object_kind.h b/runtime/mem/free_object_kind.h +index 046a16d..8333da6 100644 +--- a/runtime/mem/free_object_kind.h ++++ b/runtime/mem/free_object_kind.h +@@ -27,7 +27,7 @@ class FreeObject; + + class FreeObjectKind { + public: +- explicit FreeObjectKind(KindType type) : kindType_(type) ++ explicit FreeObjectKind(KindType type) : kind_type_(type) + { + Rebuild(); + } +@@ -58,10 +58,10 @@ public: + private: + FreeObjectKind *next_ = nullptr; + FreeObjectKind *prev_ = nullptr; +- KindType kindType_ = INVALID_KIND_TYPE; ++ KindType kind_type_ = INVALID_KIND_TYPE; + size_t available_ = 0; +- bool isAdded_ = false; +- FreeObject *freeObject_ = nullptr; ++ bool is_added_ = false; ++ FreeObject *free_object_ = nullptr; + + friend class FreeObjectList; + }; +diff --git a/runtime/mem/free_object_list-inl.h b/runtime/mem/free_object_list-inl.h +index 908c41f..b6f195a 100644 +--- a/runtime/mem/free_object_list-inl.h ++++ b/runtime/mem/free_object_list-inl.h +@@ -27,7 +27,7 @@ KindType FreeObjectList::SelectKindType(size_t size) const + if (UNLIKELY(size < MIN_SIZE)) { + return FreeObjectKind::INVALID_KIND_TYPE; + } +- return (size >> INTERVAL_OFFSET) - smallKindOffsetIndex; ++ return (size >> INTERVAL_OFFSET) - small_kind_offset_index_; + } + if (size < LARGE_KIND_MAX_SIZE) { + return MAX_BIT_OF_SIZET - __builtin_clzl(size) + LOG2_OFFSET; +@@ -41,17 +41,17 @@ KindType FreeObjectList::SelectKindType(size_t size) const + + void FreeObjectList::SetNoneEmptyBit(KindType type) + { +- noneEmptyKindBitMap_ |= 1ULL << static_cast(type); ++ none_empty_kind_bit_map_ |= 1ULL << static_cast(type); + } + + void FreeObjectList::ClearNoneEmptyBit(KindType type) + { +- noneEmptyKindBitMap_ &= ~(1ULL << static_cast(type)); ++ none_empty_kind_bit_map_ &= ~(1ULL << static_cast(type)); + } + + inline size_t FreeObjectList::CalcNextNoneEmptyIndex(KindType start) + { +- return __builtin_ffsll(noneEmptyKindBitMap_ >> static_cast(start)) + start - 1; ++ return __builtin_ffsll(none_empty_kind_bit_map_ >> static_cast(start)) + start - 1; + } + } // namespace panda::ecmascript + #endif // ECMASCRIPT_MEM_FREE_OBJECT_LIST_INL_H +diff --git a/runtime/mem/free_object_list.cpp b/runtime/mem/free_object_list.cpp +index 4a1480b..6038706 100644 +--- a/runtime/mem/free_object_list.cpp ++++ b/runtime/mem/free_object_list.cpp +@@ -23,25 +23,25 @@ + namespace panda::ecmascript { + FreeObjectList::FreeObjectList() + : kinds_(new FreeObjectKind *[NUMBER_OF_KINDS](), NUMBER_OF_KINDS), +- lastKinds_(new FreeObjectKind *[NUMBER_OF_KINDS](), NUMBER_OF_KINDS) ++ last_kinds_(new FreeObjectKind *[NUMBER_OF_KINDS](), NUMBER_OF_KINDS) + { + for (int i = 0; i < NUMBER_OF_KINDS; i++) { + kinds_[i] = nullptr; +- lastKinds_[i] = nullptr; ++ last_kinds_[i] = nullptr; + } +- noneEmptyKindBitMap_ = 0; ++ none_empty_kind_bit_map_ = 0; + } + + FreeObjectList::~FreeObjectList() + { + delete[] kinds_.data(); +- delete[] lastKinds_.data(); +- noneEmptyKindBitMap_ = 0; ++ delete[] last_kinds_.data(); ++ none_empty_kind_bit_map_ = 0; + } + + FreeObject *FreeObjectList::Allocator(size_t size) + { +- if (noneEmptyKindBitMap_ == 0) { ++ if (none_empty_kind_bit_map_ == 0) { + return nullptr; + } + size = AlignUp(size, static_cast(MemAlignment::MEM_ALIGN_OBJECT)); +@@ -105,7 +105,7 @@ void FreeObjectList::Free(uintptr_t start, size_t size, bool isAdd) + kind->Free(start, size); + + if (isAdd) { +- if (kind->isAdded_) { ++ if (kind->is_added_) { + available_ += size; + } else { + AddKind(kind); +@@ -118,10 +118,10 @@ void FreeObjectList::Rebuild() + EnumerateKinds([](FreeObjectKind *kind) { kind->Rebuild(); }); + for (int i = 0; i < NUMBER_OF_KINDS; i++) { + kinds_[i] = nullptr; +- lastKinds_[i] = nullptr; ++ last_kinds_[i] = nullptr; + } + available_ = 0; +- noneEmptyKindBitMap_ = 0; ++ none_empty_kind_bit_map_ = 0; + } + + size_t FreeObjectList::GetFreeObjectSize() const +@@ -131,10 +131,10 @@ size_t FreeObjectList::GetFreeObjectSize() const + + bool FreeObjectList::AddKind(FreeObjectKind *kind) + { +- if (kind == nullptr || kind->Empty() || kind->isAdded_) { ++ if (kind == nullptr || kind->Empty() || kind->is_added_) { + return false; + } +- KindType type = kind->kindType_; ++ KindType type = kind->kind_type_; + FreeObjectKind *top = kinds_[type]; + if (kind == top) { + return false; +@@ -142,10 +142,10 @@ bool FreeObjectList::AddKind(FreeObjectKind *kind) + if (top != nullptr) { + top->prev_ = kind; + } +- kind->isAdded_ = true; ++ kind->is_added_ = true; + kind->next_ = top; +- if (lastKinds_[type] == nullptr) { +- lastKinds_[type] = kind; ++ if (last_kinds_[type] == nullptr) { ++ last_kinds_[type] = kind; + } + kinds_[type] = kind; + SetNoneEmptyBit(type); +@@ -158,14 +158,14 @@ void FreeObjectList::RemoveKind(FreeObjectKind *kind) + if (kind == nullptr) { + return; + } +- KindType type = kind->kindType_; ++ KindType type = kind->kind_type_; + FreeObjectKind *top = kinds_[type]; +- FreeObjectKind *end = lastKinds_[type]; ++ FreeObjectKind *end = last_kinds_[type]; + if (top == kind) { + kinds_[type] = top->next_; + } + if (end == kind) { +- lastKinds_[type] = end->prev_; ++ last_kinds_[type] = end->prev_; + } + if (kind->prev_ != nullptr) { + kind->prev_->next_ = kind->next_; +@@ -186,15 +186,15 @@ void FreeObjectList::Merge(FreeObjectList *list) + if (kind == nullptr || kind->Empty()) { + return; + } +- KindType type = kind->kindType_; ++ KindType type = kind->kind_type_; + FreeObjectKind *top = kinds_[type]; + if (top == nullptr) { + top = kind; + } else { +- lastKinds_[type]->next_ = kind; +- kind->prev_ = lastKinds_[type]; ++ last_kinds_[type]->next_ = kind; ++ kind->prev_ = last_kinds_[type]; + } +- lastKinds_[type] = end; ++ last_kinds_[type] = end; + SetNoneEmptyBit(type); + }); + available_ += list->available_; +@@ -225,7 +225,7 @@ template + void FreeObjectList::EnumerateTopAndLastKinds(const Callback &cb) const + { + for (KindType i = 0; i < NUMBER_OF_KINDS; i++) { +- cb(kinds_[i], lastKinds_[i]); ++ cb(kinds_[i], last_kinds_[i]); + } + } + } // namespace panda::ecmascript +diff --git a/runtime/mem/free_object_list.h b/runtime/mem/free_object_list.h +index 84227ef..d9d26c9 100644 +--- a/runtime/mem/free_object_list.h ++++ b/runtime/mem/free_object_list.h +@@ -70,7 +70,7 @@ private: + static constexpr size_t INTERVAL_OFFSET = 3; + static constexpr size_t LOG2_OFFSET = 21; + static constexpr size_t MAX_BIT_OF_SIZET = sizeof(size_t) << INTERVAL_OFFSET; +- const int smallKindOffsetIndex = 2; ++ const int small_kind_offset_index_ = 2; + + inline KindType SelectKindType(size_t size) const; + +@@ -79,9 +79,9 @@ private: + inline size_t CalcNextNoneEmptyIndex(KindType start); + + size_t available_ = 0; +- uint64_t noneEmptyKindBitMap_; ++ uint64_t none_empty_kind_bit_map_; + Span kinds_ {}; +- Span lastKinds_ {}; ++ Span last_kinds_ {}; + }; + } // namespace panda::ecmascript + #endif // ECMASCRIPT_MEM_FREE_OBJECT_LIST_H +diff --git a/runtime/mem/gc_stats.cpp b/runtime/mem/gc_stats.cpp +index 57e78ed..5416104 100644 +--- a/runtime/mem/gc_stats.cpp ++++ b/runtime/mem/gc_stats.cpp +@@ -22,66 +22,70 @@ namespace panda::ecmascript { + void GCStats::PrintStatisticResult(bool isForce) + { + LOG(ERROR, RUNTIME) << "GCStats statistic: "; +- if ((isForce && semiGCCount_ != 0) || (!isForce && semiGCCount_ != lastSemiGCCount_)) { +- lastSemiGCCount_ = semiGCCount_; +- LOG(ERROR, RUNTIME) << " SemiCollector statistic: total semi gc count " << semiGCCount_; +- LOG(ERROR, RUNTIME) << " MIN pause time: " << PrintTimeMilliseconds(semiGCMinPause_) << "ms" +- << " MAX pause time: " << PrintTimeMilliseconds(semiGCMAXPause_) << "ms" +- << " total pause time: " << PrintTimeMilliseconds(semiGCTotalPause_) << "ms" +- << " average pause time: " << PrintTimeMilliseconds(semiGCTotalPause_ / semiGCCount_) ++ if ((isForce && semi_gc_count_ != 0) || (!isForce && semi_gc_count_ != last_semi_gc_count_)) { ++ last_semi_gc_count_ = semi_gc_count_; ++ LOG(ERROR, RUNTIME) << " SemiCollector statistic: total semi gc count " << semi_gc_count_; ++ LOG(ERROR, RUNTIME) << " MIN pause time: " << PrintTimeMilliseconds(semi_gc_min_pause_) << "ms" ++ << " MAX pause time: " << PrintTimeMilliseconds(semi_gcmax_pause_) << "ms" ++ << " total pause time: " << PrintTimeMilliseconds(semi_gc_total_pause_) << "ms" ++ << " average pause time: " << PrintTimeMilliseconds(semi_gc_total_pause_ / semi_gc_count_) + << "ms" +- << " tatal alive size: " << sizeToMB(semiTotalAliveSize_) << "MB" +- << " average alive size: " << sizeToMB(semiTotalAliveSize_ / semiGCCount_) << "MB" +- << " tatal commit size: " << sizeToMB(semiTotalCommitSize_) << "MB" +- << " average commit size: " << sizeToMB(semiTotalCommitSize_ / semiGCCount_) << "MB" +- << " semi aliveRate: " << double(semiTotalAliveSize_) / semiTotalCommitSize_ +- << " total promote size: " << sizeToMB(semiTotalPromoteSize_) << "MB" +- << " average promote size: " << sizeToMB(semiTotalPromoteSize_ / semiGCCount_) << "MB"; ++ << " tatal alive size: " << sizeToMB(semi_total_alive_size_) << "MB" ++ << " average alive size: " << sizeToMB(semi_total_alive_size_ / semi_gc_count_) << "MB" ++ << " tatal commit size: " << sizeToMB(semi_total_commit_size_) << "MB" ++ << " average commit size: " << sizeToMB(semi_total_commit_size_ / semi_gc_count_) << "MB" ++ << " semi aliveRate: " << double(semi_total_alive_size_) / semi_total_commit_size_ ++ << " total promote size: " << sizeToMB(semi_total_promote_size_) << "MB" ++ << " average promote size: " << sizeToMB(semi_total_promote_size_ / semi_gc_count_) << "MB"; + } + +- if ((isForce && oldGCCount_ != 0) || (!isForce && lastOldGCCount_ != oldGCCount_)) { +- lastOldGCCount_ = oldGCCount_; +- LOG(ERROR, RUNTIME) << " MixCollector statistic: total old gc count " << oldGCCount_; +- LOG(ERROR, RUNTIME) << " MIN pause time: " << PrintTimeMilliseconds(oldGCMinPause_) << "ms" +- << " MAX pause time: " << PrintTimeMilliseconds(oldGCMAXPause_) << "ms" +- << " total pause time: " << PrintTimeMilliseconds(oldGCTotalPause_) << "ms" +- << " average pause time: " << PrintTimeMilliseconds(oldGCTotalPause_ / oldGCCount_) << "ms" +- << " total free size: " << sizeToMB(oldTotalFreeSize_) << "MB" +- << " average free size: " << sizeToMB(oldTotalFreeSize_ / oldGCCount_) << "MB" +- << " old space total commit size: " << sizeToMB(oldSpaceTotalCommitSize_) << "MB" +- << " old space average commit size: " << sizeToMB(oldSpaceTotalCommitSize_ / oldGCCount_) ++ if ((isForce && old_gc_count_ != 0) || (!isForce && last_old_gc_count_ != old_gc_count_)) { ++ last_old_gc_count_ = old_gc_count_; ++ LOG(ERROR, RUNTIME) << " MixCollector statistic: total old gc count " << old_gc_count_; ++ LOG(ERROR, RUNTIME) << " MIN pause time: " << PrintTimeMilliseconds(old_gc_min_pause_) << "ms" ++ << " MAX pause time: " << PrintTimeMilliseconds(old_gcmax_pause_) << "ms" ++ << " total pause time: " << PrintTimeMilliseconds(old_gc_total_pause_) << "ms" ++ << " average pause time: " << PrintTimeMilliseconds(old_gc_total_pause_ / old_gc_count_) ++ << "ms" ++ << " total free size: " << sizeToMB(old_total_free_size_) << "MB" ++ << " average free size: " << sizeToMB(old_total_free_size_ / old_gc_count_) << "MB" ++ << " old space total commit size: " << sizeToMB(old_space_total_commit_size_) << "MB" ++ << " old space average commit size: " ++ << sizeToMB(old_space_total_commit_size_ / old_gc_count_) << "MB" ++ << " non move space total commit size: " << sizeToMB(old_non_move_total_commit_size_) + << "MB" +- << " non move space total commit size: " << sizeToMB(oldNonMoveTotalCommitSize_) << "MB" + << " non move space average commit size: " +- << sizeToMB(oldNonMoveTotalCommitSize_ / oldGCCount_) << "MB" ++ << sizeToMB(old_non_move_total_commit_size_ / old_gc_count_) << "MB" + << " old free rate: " +- << static_cast(oldTotalFreeSize_) / +- static_cast(oldSpaceTotalCommitSize_ + oldNonMoveTotalCommitSize_); ++ << static_cast(old_total_free_size_) / ++ static_cast(old_space_total_commit_size_ + old_non_move_total_commit_size_); + } + +- if ((isForce && compressGCCount_ != 0) || (!isForce && compressGCCount_ != lastCompressGCCount_)) { +- lastCompressGCCount_ = compressGCCount_; +- LOG(ERROR, RUNTIME) << " compressCollector statistic: total compress gc count " << compressGCCount_; +- LOG(ERROR, RUNTIME) << " MIN pause time: " << PrintTimeMilliseconds(compressGCMinPause_) << "ms" +- << " MAX pause time: " << PrintTimeMilliseconds(compressGCMaxPause_) << "ms" +- << " total pause time: " << PrintTimeMilliseconds(compressGCTotalPause_) << "ms" ++ if ((isForce && compress_gc_count_ != 0) || (!isForce && compress_gc_count_ != last_compress_gc_count_)) { ++ last_compress_gc_count_ = compress_gc_count_; ++ LOG(ERROR, RUNTIME) << " compressCollector statistic: total compress gc count " << compress_gc_count_; ++ LOG(ERROR, RUNTIME) << " MIN pause time: " << PrintTimeMilliseconds(compress_gc_min_pause_) << "ms" ++ << " MAX pause time: " << PrintTimeMilliseconds(compress_gc_max_pause_) << "ms" ++ << " total pause time: " << PrintTimeMilliseconds(compress_gc_total_pause_) << "ms" + << " average pause time: " +- << PrintTimeMilliseconds(compressGCTotalPause_ / compressGCCount_) << "ms" +- << " young and old total alive size: " << sizeToMB(compressYoungAndOldAliveSize_) << "MB" ++ << PrintTimeMilliseconds(compress_gc_total_pause_ / compress_gc_count_) << "ms" ++ << " young and old total alive size: " << sizeToMB(compress_young_and_old_alive_size_) ++ << "MB" + << " young and old average alive size: " +- << sizeToMB(compressYoungAndOldAliveSize_ / compressGCCount_) << "MB" +- << " young total commit size: " << sizeToMB(compressYoungCommitSize_) << "MB" +- << " old total commit size: " << sizeToMB(compressOldCommitSize_) << "MB" ++ << sizeToMB(compress_young_and_old_alive_size_ / compress_gc_count_) << "MB" ++ << " young total commit size: " << sizeToMB(compress_young_commit_size_) << "MB" ++ << " old total commit size: " << sizeToMB(compress_old_commit_size_) << "MB" + << " young and old average commit size: " +- << sizeToMB((compressYoungCommitSize_ + compressOldCommitSize_) / compressGCCount_) << "MB" ++ << sizeToMB((compress_young_commit_size_ + compress_old_commit_size_) / compress_gc_count_) ++ << "MB" + << " young and old free rate: " +- << 1 - static_cast(compressYoungAndOldAliveSize_) / +- static_cast(compressYoungCommitSize_ + compressOldCommitSize_) +- << " non move total free size: " << sizeToMB(compressNonMoveTotalFreeSize_) << "MB" +- << " non move total commit size: " << sizeToMB(compressNonMoveTotalCommitSize_) << "MB" ++ << 1 - static_cast(compress_young_and_old_alive_size_) / ++ static_cast(compress_young_commit_size_ + compress_old_commit_size_) ++ << " non move total free size: " << sizeToMB(compress_non_move_total_free_size_) << "MB" ++ << " non move total commit size: " << sizeToMB(compress_non_move_total_commit_size_) << "MB" + << " non move free rate: " +- << static_cast(compressNonMoveTotalFreeSize_) / +- static_cast(compressNonMoveTotalCommitSize_); ++ << static_cast(compress_non_move_total_free_size_) / ++ static_cast(compress_non_move_total_commit_size_); + } + + if (isForce && heap_ != nullptr) { +@@ -97,36 +101,36 @@ void GCStats::PrintStatisticResult(bool isForce) + void GCStats::StatisticSemiCollector(Duration time, size_t aliveSize, size_t promoteSize, size_t commitSize) + { + auto timeToMillion = TimeToMicroseconds(time); +- if (semiGCCount_ == 0) { +- semiGCMinPause_ = timeToMillion; +- semiGCMAXPause_ = timeToMillion; ++ if (semi_gc_count_ == 0) { ++ semi_gc_min_pause_ = timeToMillion; ++ semi_gcmax_pause_ = timeToMillion; + } else { +- semiGCMinPause_ = std::min(semiGCMinPause_, timeToMillion); +- semiGCMAXPause_ = std::max(semiGCMAXPause_, timeToMillion); ++ semi_gc_min_pause_ = std::min(semi_gc_min_pause_, timeToMillion); ++ semi_gcmax_pause_ = std::max(semi_gcmax_pause_, timeToMillion); + } +- semiGCTotalPause_ += timeToMillion; +- semiTotalAliveSize_ += aliveSize; +- semiTotalCommitSize_ += commitSize; +- semiTotalPromoteSize_ += promoteSize; +- semiGCCount_++; ++ semi_gc_total_pause_ += timeToMillion; ++ semi_total_alive_size_ += aliveSize; ++ semi_total_commit_size_ += commitSize; ++ semi_total_promote_size_ += promoteSize; ++ semi_gc_count_++; + } + + void GCStats::StatisticOldCollector(Duration time, size_t freeSize, size_t oldSpaceCommitSize, + size_t nonMoveSpaceCommitSize) + { + auto timeToMillion = TimeToMicroseconds(time); +- if (oldGCCount_ == 0) { +- oldGCMinPause_ = timeToMillion; +- oldGCMAXPause_ = timeToMillion; ++ if (old_gc_count_ == 0) { ++ old_gc_min_pause_ = timeToMillion; ++ old_gcmax_pause_ = timeToMillion; + } else { +- oldGCMinPause_ = std::min(oldGCMinPause_, timeToMillion); +- oldGCMAXPause_ = std::max(oldGCMAXPause_, timeToMillion); ++ old_gc_min_pause_ = std::min(old_gc_min_pause_, timeToMillion); ++ old_gcmax_pause_ = std::max(old_gcmax_pause_, timeToMillion); + } +- oldGCTotalPause_ += timeToMillion; +- oldTotalFreeSize_ += freeSize; +- oldSpaceTotalCommitSize_ += oldSpaceCommitSize; +- oldNonMoveTotalCommitSize_ += nonMoveSpaceCommitSize; +- oldGCCount_++; ++ old_gc_total_pause_ += timeToMillion; ++ old_total_free_size_ += freeSize; ++ old_space_total_commit_size_ += oldSpaceCommitSize; ++ old_non_move_total_commit_size_ += nonMoveSpaceCommitSize; ++ old_gc_count_++; + } + + void GCStats::StatisticCompressCollector(Duration time, size_t youngAndOldAliveSize, size_t youngCommitSize, +@@ -134,19 +138,19 @@ void GCStats::StatisticCompressCollector(Duration time, size_t youngAndOldAliveS + size_t nonMoveSpaceCommitSize) + { + auto timeToMillion = TimeToMicroseconds(time); +- if (compressGCCount_ == 0) { +- compressGCMinPause_ = timeToMillion; +- compressGCMaxPause_ = timeToMillion; ++ if (compress_gc_count_ == 0) { ++ compress_gc_min_pause_ = timeToMillion; ++ compress_gc_max_pause_ = timeToMillion; + } else { +- compressGCMinPause_ = std::min(compressGCMinPause_, timeToMillion); +- compressGCMaxPause_ = std::max(compressGCMaxPause_, timeToMillion); ++ compress_gc_min_pause_ = std::min(compress_gc_min_pause_, timeToMillion); ++ compress_gc_max_pause_ = std::max(compress_gc_max_pause_, timeToMillion); + } +- compressGCTotalPause_ += timeToMillion; +- compressYoungAndOldAliveSize_ += youngAndOldAliveSize; +- compressYoungCommitSize_ += youngCommitSize; +- compressOldCommitSize_ += oldCommitSize; +- compressNonMoveTotalFreeSize_ += nonMoveSpaceFreeSize; +- compressNonMoveTotalCommitSize_ += nonMoveSpaceCommitSize; +- compressGCCount_++; ++ compress_gc_total_pause_ += timeToMillion; ++ compress_young_and_old_alive_size_ += youngAndOldAliveSize; ++ compress_young_commit_size_ += youngCommitSize; ++ compress_old_commit_size_ += oldCommitSize; ++ compress_non_move_total_free_size_ += nonMoveSpaceFreeSize; ++ compress_non_move_total_commit_size_ += nonMoveSpaceCommitSize; ++ compress_gc_count_++; + } + } // namespace panda::ecmascript +diff --git a/runtime/mem/gc_stats.h b/runtime/mem/gc_stats.h +index 8009130..4ca20f8 100644 +--- a/runtime/mem/gc_stats.h ++++ b/runtime/mem/gc_stats.h +@@ -53,34 +53,34 @@ private: + return static_cast(size) / MB; + } + +- size_t lastSemiGCCount_ = 0; +- size_t semiGCCount_ = 0; +- size_t semiGCMinPause_ = 0; +- size_t semiGCMAXPause_ = 0; +- size_t semiGCTotalPause_ = 0; +- size_t semiTotalAliveSize_ = 0; +- size_t semiTotalCommitSize_ = 0; +- size_t semiTotalPromoteSize_ = 0; +- +- size_t lastOldGCCount_ = 0; +- size_t oldGCCount_ = 0; +- size_t oldGCMinPause_ = 0; +- size_t oldGCMAXPause_ = 0; +- size_t oldGCTotalPause_ = 0; +- size_t oldTotalFreeSize_ = 0; +- size_t oldSpaceTotalCommitSize_ = 0; +- size_t oldNonMoveTotalCommitSize_ = 0; +- +- size_t lastCompressGCCount_ = 0; +- size_t compressGCCount_ = 0; +- size_t compressGCMinPause_ = 0; +- size_t compressGCMaxPause_ = 0; +- size_t compressGCTotalPause_ = 0; +- size_t compressYoungAndOldAliveSize_ = 0; +- size_t compressYoungCommitSize_ = 0; +- size_t compressOldCommitSize_ = 0; +- size_t compressNonMoveTotalFreeSize_ = 0; +- size_t compressNonMoveTotalCommitSize_ = 0; ++ size_t last_semi_gc_count_ = 0; ++ size_t semi_gc_count_ = 0; ++ size_t semi_gc_min_pause_ = 0; ++ size_t semi_gcmax_pause_ = 0; ++ size_t semi_gc_total_pause_ = 0; ++ size_t semi_total_alive_size_ = 0; ++ size_t semi_total_commit_size_ = 0; ++ size_t semi_total_promote_size_ = 0; ++ ++ size_t last_old_gc_count_ = 0; ++ size_t old_gc_count_ = 0; ++ size_t old_gc_min_pause_ = 0; ++ size_t old_gcmax_pause_ = 0; ++ size_t old_gc_total_pause_ = 0; ++ size_t old_total_free_size_ = 0; ++ size_t old_space_total_commit_size_ = 0; ++ size_t old_non_move_total_commit_size_ = 0; ++ ++ size_t last_compress_gc_count_ = 0; ++ size_t compress_gc_count_ = 0; ++ size_t compress_gc_min_pause_ = 0; ++ size_t compress_gc_max_pause_ = 0; ++ size_t compress_gc_total_pause_ = 0; ++ size_t compress_young_and_old_alive_size_ = 0; ++ size_t compress_young_commit_size_ = 0; ++ size_t compress_old_commit_size_ = 0; ++ size_t compress_non_move_total_free_size_ = 0; ++ size_t compress_non_move_total_commit_size_ = 0; + + const Heap *heap_; + +diff --git a/runtime/mem/heap-inl.h b/runtime/mem/heap-inl.h +index 84c3d49..91d764c 100644 +--- a/runtime/mem/heap-inl.h ++++ b/runtime/mem/heap-inl.h +@@ -29,67 +29,67 @@ namespace panda::ecmascript { + template + void Heap::EnumerateOldSpaceRegions(const Callback &cb, Region *region) const + { +- oldSpace_->EnumerateRegions(cb, region); +- nonMovableSpace_->EnumerateRegions(cb); +- hugeObjectSpace_->EnumerateRegions(cb); +- machineCodeSpace_->EnumerateRegions(cb); ++ old_space_->EnumerateRegions(cb, region); ++ non_movable_space_->EnumerateRegions(cb); ++ huge_object_space_->EnumerateRegions(cb); ++ machine_code_space_->EnumerateRegions(cb); + } + + template + void Heap::EnumerateSnapShotSpaceRegions(const Callback &cb) const + { +- snapshotSpace_->EnumerateRegions(cb); ++ snapshot_space_->EnumerateRegions(cb); + } + + template + void Heap::EnumerateNewSpaceRegions(const Callback &cb) const + { +- toSpace_->EnumerateRegions(cb); ++ to_space_->EnumerateRegions(cb); + } + + template + void Heap::EnumerateNonMovableRegions(const Callback &cb) const + { +- snapshotSpace_->EnumerateRegions(cb); +- nonMovableSpace_->EnumerateRegions(cb); +- hugeObjectSpace_->EnumerateRegions(cb); +- machineCodeSpace_->EnumerateRegions(cb); ++ snapshot_space_->EnumerateRegions(cb); ++ non_movable_space_->EnumerateRegions(cb); ++ huge_object_space_->EnumerateRegions(cb); ++ machine_code_space_->EnumerateRegions(cb); + } + + template + void Heap::EnumerateRegions(const Callback &cb) const + { +- toSpace_->EnumerateRegions(cb); +- oldSpace_->EnumerateRegions(cb); +- snapshotSpace_->EnumerateRegions(cb); +- nonMovableSpace_->EnumerateRegions(cb); +- hugeObjectSpace_->EnumerateRegions(cb); +- machineCodeSpace_->EnumerateRegions(cb); ++ to_space_->EnumerateRegions(cb); ++ old_space_->EnumerateRegions(cb); ++ snapshot_space_->EnumerateRegions(cb); ++ non_movable_space_->EnumerateRegions(cb); ++ huge_object_space_->EnumerateRegions(cb); ++ machine_code_space_->EnumerateRegions(cb); + } + + template + void Heap::IteratorOverObjects(const Callback &cb) const + { +- toSpace_->IterateOverObjects(cb); +- oldSpace_->IterateOverObjects(cb); +- nonMovableSpace_->IterateOverObjects(cb); +- hugeObjectSpace_->IterateOverObjects(cb); ++ to_space_->IterateOverObjects(cb); ++ old_space_->IterateOverObjects(cb); ++ non_movable_space_->IterateOverObjects(cb); ++ huge_object_space_->IterateOverObjects(cb); + } + + bool Heap::FillNewSpaceAndTryGC(BumpPointerAllocator *spaceAllocator, bool allowGc) + { +- if (toSpace_->Expand(spaceAllocator->GetTop())) { +- spaceAllocator->Reset(toSpace_); ++ if (to_space_->Expand(spaceAllocator->GetTop())) { ++ spaceAllocator->Reset(to_space_); + TryTriggerConcurrentMarking(allowGc); + return true; + } + +- if (toSpace_->GetCommittedSize() == SEMI_SPACE_SIZE_CAPACITY && ++ if (to_space_->GetCommittedSize() == SEMI_SPACE_SIZE_CAPACITY && + !GetEcmaVM()->GetAssociatedJSThread()->IsReadyToMark()) { +- toSpace_->SetMaximumCapacity( ++ to_space_->SetMaximumCapacity( + std::min(SEMI_SPACE_SIZE_CAPACITY + SEMI_SPACE_OVERSHOOT_SIZE, MAX_SEMI_SPACE_SIZE_STARTUP)); +- if (toSpace_->Expand(spaceAllocator->GetTop())) { +- spaceAllocator->Reset(toSpace_); ++ if (to_space_->Expand(spaceAllocator->GetTop())) { ++ spaceAllocator->Reset(to_space_); + return true; + } + } +@@ -103,12 +103,12 @@ bool Heap::FillNewSpaceAndTryGC(BumpPointerAllocator *spaceAllocator, bool allow + + bool Heap::FillOldSpaceAndTryGC(FreeListAllocator *spaceAllocator, bool allowGc) + { +- if (oldSpace_->Expand()) { ++ if (old_space_->Expand()) { + if (!allowGc) { + auto currentRegion = GetCompressSpace()->GetCurrentRegion(); + currentRegion->SetAliveObject(currentRegion->GetSize()); + } +- spaceAllocator->AddFree(oldSpace_->GetCurrentRegion()); ++ spaceAllocator->AddFree(old_space_->GetCurrentRegion()); + return true; + } + if (allowGc) { +@@ -120,8 +120,8 @@ bool Heap::FillOldSpaceAndTryGC(FreeListAllocator *spaceAllocator, bool allowGc) + + bool Heap::FillNonMovableSpaceAndTryGC(FreeListAllocator *spaceAllocator, bool allowGc) + { +- if (nonMovableSpace_->Expand()) { +- spaceAllocator->AddFree(nonMovableSpace_->GetCurrentRegion()); ++ if (non_movable_space_->Expand()) { ++ spaceAllocator->AddFree(non_movable_space_->GetCurrentRegion()); + return true; + } + if (allowGc) { +@@ -133,17 +133,17 @@ bool Heap::FillNonMovableSpaceAndTryGC(FreeListAllocator *spaceAllocator, bool a + + bool Heap::FillSnapShotSpace(BumpPointerAllocator *spaceAllocator) + { +- bool result = snapshotSpace_->Expand(spaceAllocator->GetTop()); ++ bool result = snapshot_space_->Expand(spaceAllocator->GetTop()); + if (result) { +- spaceAllocator->Reset(snapshotSpace_); ++ spaceAllocator->Reset(snapshot_space_); + } + return result; + } + + bool Heap::FillMachineCodeSpaceAndTryGC(FreeListAllocator *spaceAllocator, bool allowGc) + { +- if (machineCodeSpace_->Expand()) { +- spaceAllocator->AddFree(machineCodeSpace_->GetCurrentRegion()); ++ if (machine_code_space_->Expand()) { ++ spaceAllocator->AddFree(machine_code_space_->GetCurrentRegion()); + return true; + } + if (allowGc) { +@@ -155,20 +155,20 @@ bool Heap::FillMachineCodeSpaceAndTryGC(FreeListAllocator *spaceAllocator, bool + + Region *Heap::ExpandCompressSpace() + { +- if (compressSpace_->Expand()) { +- return compressSpace_->GetCurrentRegion(); ++ if (compress_space_->Expand()) { ++ return compress_space_->GetCurrentRegion(); + } + return nullptr; + } + + bool Heap::AddRegionToCompressSpace(Region *region) + { +- return compressSpace_->AddRegionToList(region); ++ return compress_space_->AddRegionToList(region); + } + + bool Heap::AddRegionToToSpace(Region *region) + { +- return toSpace_->AddRegionToList(region); ++ return to_space_->AddRegionToList(region); + } + + void Heap::OnAllocateEvent(uintptr_t address) +@@ -187,53 +187,53 @@ void Heap::OnMoveEvent(uintptr_t address, uintptr_t forwardAddress) + + void Heap::SetNewSpaceAgeMark(uintptr_t mark) + { +- ASSERT(toSpace_ != nullptr); +- toSpace_->SetAgeMark(mark); ++ ASSERT(to_space_ != nullptr); ++ to_space_->SetAgeMark(mark); + } + + void Heap::SetNewSpaceMaximumCapacity(size_t maximumCapacity) + { +- ASSERT(toSpace_ != nullptr); +- SetMaximumCapacity(toSpace_, maximumCapacity); ++ ASSERT(to_space_ != nullptr); ++ SetMaximumCapacity(to_space_, maximumCapacity); + } + + void Heap::InitializeFromSpace() + { +- if (fromSpace_->GetCommittedSize() == 0) { +- fromSpace_->Initialize(); ++ if (from_space_->GetCommittedSize() == 0) { ++ from_space_->Initialize(); + } + } + + void Heap::InitializeCompressSpace() + { +- if (compressSpace_->GetCommittedSize() == 0) { +- compressSpace_->Initialize(); ++ if (compress_space_->GetCommittedSize() == 0) { ++ compress_space_->Initialize(); + } + } + + void Heap::SwapSpace() + { +- ASSERT(toSpace_ != nullptr); +- ASSERT(fromSpace_ != nullptr); +- toSpace_->Swap(fromSpace_); ++ ASSERT(to_space_ != nullptr); ++ ASSERT(from_space_ != nullptr); ++ to_space_->Swap(from_space_); + } + + void Heap::ReclaimFromSpaceRegions() + { +- ASSERT(fromSpace_ != nullptr); +- fromSpace_->ReclaimRegions(); ++ ASSERT(from_space_ != nullptr); ++ from_space_->ReclaimRegions(); + } + + void Heap::SetFromSpaceMaximumCapacity(size_t maximumCapacity) + { +- ASSERT(fromSpace_ != nullptr); +- SetMaximumCapacity(fromSpace_, maximumCapacity); ++ ASSERT(from_space_ != nullptr); ++ SetMaximumCapacity(from_space_, maximumCapacity); + } + + void Heap::ResetDelayGCMode() + { +- ASSERT(memController_ != nullptr); +- memController_->ResetDelayGCMode(); ++ ASSERT(mem_controller_ != nullptr); ++ mem_controller_->ResetDelayGCMode(); + } + + void Heap::SetMaximumCapacity(SemiSpace *space, size_t maximumCapacity) +@@ -255,17 +255,17 @@ void Heap::ClearSlotsRange(Region *current, uintptr_t freeStart, uintptr_t freeE + + size_t Heap::GetCommittedSize() const + { +- size_t result = toSpace_->GetCommittedSize() + oldSpace_->GetCommittedSize() + +- hugeObjectSpace_->GetCommittedSize() + nonMovableSpace_->GetCommittedSize() + +- machineCodeSpace_->GetCommittedSize(); ++ size_t result = to_space_->GetCommittedSize() + old_space_->GetCommittedSize() + ++ huge_object_space_->GetCommittedSize() + non_movable_space_->GetCommittedSize() + ++ machine_code_space_->GetCommittedSize(); + return result; + } + + size_t Heap::GetHeapObjectSize() const + { +- size_t result = toSpace_->GetHeapObjectSize() + oldSpace_->GetHeapObjectSize() + +- hugeObjectSpace_->GetHeapObjectSize() + nonMovableSpace_->GetHeapObjectSize() + +- machineCodeSpace_->GetCommittedSize(); ++ size_t result = to_space_->GetHeapObjectSize() + old_space_->GetHeapObjectSize() + ++ huge_object_space_->GetHeapObjectSize() + non_movable_space_->GetHeapObjectSize() + ++ machine_code_space_->GetCommittedSize(); + return result; + } + } // namespace panda::ecmascript +diff --git a/runtime/mem/heap.cpp b/runtime/mem/heap.cpp +index 8af3576..b567732 100644 +--- a/runtime/mem/heap.cpp ++++ b/runtime/mem/heap.cpp +@@ -36,33 +36,33 @@ + static constexpr int MAX_PARALLEL_THREAD_NUM = 3; + + namespace panda::ecmascript { +-Heap::Heap(EcmaVM *ecmaVm) : ecmaVm_(ecmaVm), regionFactory_(ecmaVm->GetRegionFactory()) {} ++Heap::Heap(EcmaVM *ecmaVm) : ecma_vm_(ecmaVm), region_factory_(ecmaVm->GetRegionFactory()) {} + + void Heap::Initialize() + { +- memController_ = CreateMemController(this, "no-gc-for-start-up"); ++ mem_controller_ = CreateMemController(this, "no-gc-for-start-up"); + +- if (memController_->IsDelayGCMode()) { +- toSpace_ = new SemiSpace(this, DEFAULT_SEMI_SPACE_SIZE, MAX_SEMI_SPACE_SIZE_STARTUP); +- fromSpace_ = new SemiSpace(this, DEFAULT_SEMI_SPACE_SIZE, MAX_SEMI_SPACE_SIZE_STARTUP); ++ if (mem_controller_->IsDelayGCMode()) { ++ to_space_ = new SemiSpace(this, DEFAULT_SEMI_SPACE_SIZE, MAX_SEMI_SPACE_SIZE_STARTUP); ++ from_space_ = new SemiSpace(this, DEFAULT_SEMI_SPACE_SIZE, MAX_SEMI_SPACE_SIZE_STARTUP); + } else { +- toSpace_ = new SemiSpace(this); +- fromSpace_ = new SemiSpace(this); ++ to_space_ = new SemiSpace(this); ++ from_space_ = new SemiSpace(this); + } + +- toSpace_->Initialize(); ++ to_space_->Initialize(); + // not set up from space +- oldSpace_ = new OldSpace(this); +- compressSpace_ = new OldSpace(this); +- oldSpace_->Initialize(); +- nonMovableSpace_ = new NonMovableSpace(this); +- nonMovableSpace_->Initialize(); +- snapshotSpace_ = new SnapShotSpace(this); +- machineCodeSpace_ = new MachineCodeSpace(this); +- machineCodeSpace_->Initialize(); +- hugeObjectSpace_ = new HugeObjectSpace(this); +- paralledGc_ = ecmaVm_->GetJSOptions().IsEnableParallelGC(); +- concurrentMarkingEnabled_ = ecmaVm_->GetJSOptions().IsEnableConcurrentMark(); ++ old_space_ = new OldSpace(this); ++ compress_space_ = new OldSpace(this); ++ old_space_->Initialize(); ++ non_movable_space_ = new NonMovableSpace(this); ++ non_movable_space_->Initialize(); ++ snapshot_space_ = new SnapShotSpace(this); ++ machine_code_space_ = new MachineCodeSpace(this); ++ machine_code_space_->Initialize(); ++ huge_object_space_ = new HugeObjectSpace(this); ++ paralled_gc_ = ecma_vm_->GetJSOptions().IsEnableParallelGC(); ++ concurrent_marking_enabled_ = ecma_vm_->GetJSOptions().IsEnableConcurrentMark(); + #if ECMASCRIPT_DISABLE_PARALLEL_GC + paralledGc_ = false; + #endif +@@ -70,113 +70,113 @@ void Heap::Initialize() + paralledGc_ = false; + concurrentMarkingEnabled_ = false; + #endif +- workList_ = new WorkerHelper(this, Platform::GetCurrentPlatform()->GetTotalThreadNum() + 1); +- semiSpaceCollector_ = new SemiSpaceCollector(this, paralledGc_); +- compressCollector_ = new CompressCollector(this); +- +- derivedPointers_ = new ChunkMap(ecmaVm_->GetChunk()); +- mixSpaceCollector_ = new MixSpaceCollector(this); +- sweeper_ = new ConcurrentSweeper(this, ecmaVm_->GetJSOptions().IsEnableConcurrentSweep()); +- concurrentMarker_ = new ConcurrentMarker(this); +- nonMovableMarker_ = new NonMovableMarker(this); +- semiGcMarker_ = new SemiGcMarker(this); +- compressGcMarker_ = new CompressGcMarker(this); +- evacuationAllocator_ = new EvacuationAllocator(this); ++ work_list_ = new WorkerHelper(this, Platform::GetCurrentPlatform()->GetTotalThreadNum() + 1); ++ semi_space_collector_ = new SemiSpaceCollector(this, paralled_gc_); ++ compress_collector_ = new CompressCollector(this); ++ ++ derived_pointers_ = new ChunkMap(ecma_vm_->GetChunk()); ++ mix_space_collector_ = new MixSpaceCollector(this); ++ sweeper_ = new ConcurrentSweeper(this, ecma_vm_->GetJSOptions().IsEnableConcurrentSweep()); ++ concurrent_marker_ = new ConcurrentMarker(this); ++ non_movable_marker_ = new NonMovableMarker(this); ++ semi_gc_marker_ = new SemiGcMarker(this); ++ compress_gc_marker_ = new CompressGcMarker(this); ++ evacuation_allocator_ = new EvacuationAllocator(this); + evacuation_ = new ParallelEvacuation(this); + } + + void Heap::FlipNewSpace() + { +- SemiSpace *newSpace = fromSpace_; +- fromSpace_ = toSpace_; +- toSpace_ = newSpace; ++ SemiSpace *newSpace = from_space_; ++ from_space_ = to_space_; ++ to_space_ = newSpace; + } + + void Heap::FlipCompressSpace() + { +- OldSpace *oldSpace = compressSpace_; +- compressSpace_ = oldSpace_; +- oldSpace_ = oldSpace; ++ OldSpace *oldSpace = compress_space_; ++ compress_space_ = old_space_; ++ old_space_ = oldSpace; + } + + void Heap::Destroy() + { + Prepare(); +- if (toSpace_ != nullptr) { +- toSpace_->Destroy(); +- delete toSpace_; +- toSpace_ = nullptr; +- } +- if (fromSpace_ != nullptr) { +- fromSpace_->Destroy(); +- delete fromSpace_; +- fromSpace_ = nullptr; +- } +- if (oldSpace_ != nullptr) { +- oldSpace_->Destroy(); +- delete oldSpace_; +- oldSpace_ = nullptr; +- } +- if (compressSpace_ != nullptr) { +- compressSpace_->Destroy(); +- delete compressSpace_; +- compressSpace_ = nullptr; +- } +- if (nonMovableSpace_ != nullptr) { +- nonMovableSpace_->Destroy(); +- delete nonMovableSpace_; +- nonMovableSpace_ = nullptr; +- } +- if (snapshotSpace_ != nullptr) { +- snapshotSpace_->Destroy(); +- delete snapshotSpace_; +- snapshotSpace_ = nullptr; +- } +- if (machineCodeSpace_ != nullptr) { +- machineCodeSpace_->Destroy(); +- delete machineCodeSpace_; +- machineCodeSpace_ = nullptr; +- } +- if (hugeObjectSpace_ != nullptr) { +- hugeObjectSpace_->Destroy(); +- delete hugeObjectSpace_; +- hugeObjectSpace_ = nullptr; +- } +- +- delete workList_; +- workList_ = nullptr; +- delete semiSpaceCollector_; +- semiSpaceCollector_ = nullptr; +- delete mixSpaceCollector_; +- mixSpaceCollector_ = nullptr; +- delete compressCollector_; +- compressCollector_ = nullptr; +- regionFactory_ = nullptr; +- delete memController_; +- memController_ = nullptr; ++ if (to_space_ != nullptr) { ++ to_space_->Destroy(); ++ delete to_space_; ++ to_space_ = nullptr; ++ } ++ if (from_space_ != nullptr) { ++ from_space_->Destroy(); ++ delete from_space_; ++ from_space_ = nullptr; ++ } ++ if (old_space_ != nullptr) { ++ old_space_->Destroy(); ++ delete old_space_; ++ old_space_ = nullptr; ++ } ++ if (compress_space_ != nullptr) { ++ compress_space_->Destroy(); ++ delete compress_space_; ++ compress_space_ = nullptr; ++ } ++ if (non_movable_space_ != nullptr) { ++ non_movable_space_->Destroy(); ++ delete non_movable_space_; ++ non_movable_space_ = nullptr; ++ } ++ if (snapshot_space_ != nullptr) { ++ snapshot_space_->Destroy(); ++ delete snapshot_space_; ++ snapshot_space_ = nullptr; ++ } ++ if (machine_code_space_ != nullptr) { ++ machine_code_space_->Destroy(); ++ delete machine_code_space_; ++ machine_code_space_ = nullptr; ++ } ++ if (huge_object_space_ != nullptr) { ++ huge_object_space_->Destroy(); ++ delete huge_object_space_; ++ huge_object_space_ = nullptr; ++ } ++ ++ delete work_list_; ++ work_list_ = nullptr; ++ delete semi_space_collector_; ++ semi_space_collector_ = nullptr; ++ delete mix_space_collector_; ++ mix_space_collector_ = nullptr; ++ delete compress_collector_; ++ compress_collector_ = nullptr; ++ region_factory_ = nullptr; ++ delete mem_controller_; ++ mem_controller_ = nullptr; + delete sweeper_; + sweeper_ = nullptr; +- delete derivedPointers_; +- derivedPointers_ = nullptr; +- delete concurrentMarker_; +- concurrentMarker_ = nullptr; +- delete nonMovableMarker_; +- nonMovableMarker_ = nullptr; +- delete semiGcMarker_; +- semiGcMarker_ = nullptr; +- delete compressGcMarker_; +- compressGcMarker_ = nullptr; ++ delete derived_pointers_; ++ derived_pointers_ = nullptr; ++ delete concurrent_marker_; ++ concurrent_marker_ = nullptr; ++ delete non_movable_marker_; ++ non_movable_marker_ = nullptr; ++ delete semi_gc_marker_; ++ semi_gc_marker_ = nullptr; ++ delete compress_gc_marker_; ++ compress_gc_marker_ = nullptr; + delete evacuation_; + evacuation_ = nullptr; +- delete evacuationAllocator_; +- evacuationAllocator_ = nullptr; ++ delete evacuation_allocator_; ++ evacuation_allocator_ = nullptr; + } + + void Heap::Prepare() + { + WaitRunningTaskFinished(); + sweeper_->EnsureAllTaskFinished(); +- evacuationAllocator_->WaitFreeTaskFinish(); ++ evacuation_allocator_->WaitFreeTaskFinish(); + } + + void Heap::CollectGarbage(TriggerGCType gcType) +@@ -200,45 +200,45 @@ void Heap::CollectGarbage(TriggerGCType gcType) + #if ECMASCRIPT_SWITCH_GC_MODE_TO_COMPRESS_GC + gcType = TriggerGCType::COMPRESS_FULL_GC; + #endif +- bool isDelayGCMode = memController_->IsDelayGCMode(); +- if (isCompressGCRequested_ && GetEcmaVM()->GetAssociatedJSThread()->IsReadyToMark() && ++ bool isDelayGCMode = mem_controller_->IsDelayGCMode(); ++ if (is_compress_gc_requested_ && GetEcmaVM()->GetAssociatedJSThread()->IsReadyToMark() && + gcType != TriggerGCType::COMPRESS_FULL_GC && !isDelayGCMode) { + gcType = TriggerGCType::COMPRESS_FULL_GC; + } +- memController_->StartCalculationBeforeGC(); ++ mem_controller_->StartCalculationBeforeGC(); + +- OPTIONAL_LOG(ecmaVm_, ERROR, ECMASCRIPT) << "Heap::CollectGarbage, gcType = " << gcType << " global CommittedSize" +- << GetCommittedSize() << " global limit" << globalSpaceAllocLimit_; ++ OPTIONAL_LOG(ecma_vm_, ERROR, ECMASCRIPT) << "Heap::CollectGarbage, gcType = " << gcType << " global CommittedSize" ++ << GetCommittedSize() << " global limit" << global_space_alloc_limit_; + switch (gcType) { + case TriggerGCType::SEMI_GC: + if (isDelayGCMode) { + SetFromSpaceMaximumCapacity(SEMI_SPACE_SIZE_CAPACITY); + SetNewSpaceMaximumCapacity(SEMI_SPACE_SIZE_CAPACITY); +- compressCollector_->RunPhases(); ++ compress_collector_->RunPhases(); + ResetDelayGCMode(); + } else { + bool isOldGCTriggered = false; +- if (!concurrentMarkingEnabled_) { ++ if (!concurrent_marking_enabled_) { + isOldGCTriggered = + GetCommittedSize() > HALF_MAX_HEAP_SIZE ? CheckAndTriggerOldGC() : CheckAndTriggerCompressGC(); + } + if (!isOldGCTriggered) { +- mixSpaceCollector_->RunPhases(); ++ mix_space_collector_->RunPhases(); + } + } + break; + case TriggerGCType::OLD_GC: +- mixSpaceCollector_->RunPhases(); ++ mix_space_collector_->RunPhases(); + break; + case TriggerGCType::NON_MOVE_GC: + case TriggerGCType::HUGE_GC: + case TriggerGCType::MACHINE_CODE_GC: +- mixSpaceCollector_->RunPhases(); ++ mix_space_collector_->RunPhases(); + break; + case TriggerGCType::COMPRESS_FULL_GC: +- compressCollector_->RunPhases(); +- if (isCompressGCRequested_) { +- isCompressGCRequested_ = false; ++ compress_collector_->RunPhases(); ++ if (is_compress_gc_requested_) { ++ is_compress_gc_requested_ = false; + } + break; + default: +@@ -247,24 +247,24 @@ void Heap::CollectGarbage(TriggerGCType gcType) + } + + if (gcType == TriggerGCType::COMPRESS_FULL_GC || +- (gcType != TriggerGCType::SEMI_GC && !isOnlySemi_ && !sweeper_->IsConcurrentSweepEnabled())) { ++ (gcType != TriggerGCType::SEMI_GC && !is_only_semi_ && !sweeper_->IsConcurrentSweepEnabled())) { + // Only when the gc type is not semiGC and after the old space sweeping has been finished, + // the limits of old space and global space can be recomputed. + RecomputeLimits(); + } +- memController_->StopCalculationAfterGC(gcType); ++ mem_controller_->StopCalculationAfterGC(gcType); + +- if (toSpace_->GetMaximumCapacity() != SEMI_SPACE_SIZE_CAPACITY || +- toSpace_->GetCommittedSize() > SEMI_SPACE_SIZE_CAPACITY * SEMI_SPACE_RETENTION_RATIO) { +- auto capacity = AlignUp(static_cast(toSpace_->GetCommittedSize() / SEMI_SPACE_RETENTION_RATIO), ++ if (to_space_->GetMaximumCapacity() != SEMI_SPACE_SIZE_CAPACITY || ++ to_space_->GetCommittedSize() > SEMI_SPACE_SIZE_CAPACITY * SEMI_SPACE_RETENTION_RATIO) { ++ auto capacity = AlignUp(static_cast(to_space_->GetCommittedSize() / SEMI_SPACE_RETENTION_RATIO), + PANDA_POOL_ALIGNMENT_IN_BYTES); + capacity = std::max(capacity, SEMI_SPACE_SIZE_CAPACITY); + capacity = std::min(capacity, MAX_SEMI_SPACE_SIZE_STARTUP); +- toSpace_->SetMaximumCapacity(capacity); ++ to_space_->SetMaximumCapacity(capacity); + } + +- OPTIONAL_LOG(ecmaVm_, ERROR, ECMASCRIPT) << " GC after: isOnlySemi_" << isOnlySemi_ << " global CommittedSize" +- << GetCommittedSize() << " global limit" << globalSpaceAllocLimit_; ++ OPTIONAL_LOG(ecma_vm_, ERROR, ECMASCRIPT) << " GC after: isOnlySemi_" << is_only_semi_ << " global CommittedSize" ++ << GetCommittedSize() << " global limit" << global_space_alloc_limit_; + + #if ECMASCRIPT_ENABLE_GC_LOG + ecmaVm_->GetEcmaGCStats()->PrintStatisticResult(); +@@ -293,40 +293,40 @@ size_t Heap::VerifyHeapObjects() const + size_t failCount = 0; + { + VerifyObjectVisitor verifier(this, &failCount); +- toSpace_->IterateOverObjects(verifier); ++ to_space_->IterateOverObjects(verifier); + } + + { + VerifyObjectVisitor verifier(this, &failCount); +- oldSpace_->IterateOverObjects(verifier); ++ old_space_->IterateOverObjects(verifier); + } + + { + VerifyObjectVisitor verifier(this, &failCount); +- nonMovableSpace_->IterateOverObjects(verifier); ++ non_movable_space_->IterateOverObjects(verifier); + } + + { + VerifyObjectVisitor verifier(this, &failCount); +- hugeObjectSpace_->IterateOverObjects(verifier); ++ huge_object_space_->IterateOverObjects(verifier); + } + return failCount; + } + + void Heap::RecomputeLimits() + { +- double gcSpeed = memController_->CalculateMarkCompactSpeedPerMS(); +- double mutatorSpeed = memController_->GetCurrentOldSpaceAllocationThroughtputPerMS(); +- size_t oldSpaceSize = oldSpace_->GetCommittedSize() + hugeObjectSpace_->GetCommittedSize(); +- size_t newSpaceCapacity = toSpace_->GetCommittedSize(); +- +- double growingFactor = memController_->CalculateGrowingFactor(gcSpeed, mutatorSpeed); +- auto newOldSpaceLimit = memController_->CalculateAllocLimit(oldSpaceSize, DEFAULT_OLD_SPACE_SIZE, +- MAX_OLD_SPACE_SIZE, newSpaceCapacity, growingFactor); +- auto newGlobalSpaceLimit = memController_->CalculateAllocLimit(GetCommittedSize(), DEFAULT_HEAP_SIZE, MAX_HEAP_SIZE, +- newSpaceCapacity, growingFactor); +- globalSpaceAllocLimit_ = newGlobalSpaceLimit; +- oldSpaceAllocLimit_ = newOldSpaceLimit; ++ double gcSpeed = mem_controller_->CalculateMarkCompactSpeedPerMS(); ++ double mutatorSpeed = mem_controller_->GetCurrentOldSpaceAllocationThroughtputPerMS(); ++ size_t oldSpaceSize = old_space_->GetCommittedSize() + huge_object_space_->GetCommittedSize(); ++ size_t newSpaceCapacity = to_space_->GetCommittedSize(); ++ ++ double growingFactor = mem_controller_->CalculateGrowingFactor(gcSpeed, mutatorSpeed); ++ auto newOldSpaceLimit = mem_controller_->CalculateAllocLimit(oldSpaceSize, DEFAULT_OLD_SPACE_SIZE, ++ MAX_OLD_SPACE_SIZE, newSpaceCapacity, growingFactor); ++ auto newGlobalSpaceLimit = mem_controller_->CalculateAllocLimit(GetCommittedSize(), DEFAULT_HEAP_SIZE, ++ MAX_HEAP_SIZE, newSpaceCapacity, growingFactor); ++ global_space_alloc_limit_ = newGlobalSpaceLimit; ++ old_space_alloc_limit_ = newOldSpaceLimit; + } + + bool Heap::CheckConcurrentMark(JSThread *thread) +@@ -338,7 +338,7 @@ bool Heap::CheckConcurrentMark(JSThread *thread) + WaitConcurrentMarkingFinished(); + ECMA_GC_LOG() << "wait concurrent marking finish pause time " << clockScope.TotalSpentTime(); + } +- memController_->RecordAfterConcurrentMark(isOnlySemi_, concurrentMarker_); ++ mem_controller_->RecordAfterConcurrentMark(is_only_semi_, concurrent_marker_); + return true; + } + return false; +@@ -353,7 +353,7 @@ void Heap::TryTriggerConcurrentMarking(bool allowGc) + // can exactly allow the new space to allocate to the capacity, semi mark can be triggered. But when it will spend + // a lot of time in full mark, the compress full GC will be requested after the spaces reach to limits. And If the + // global space is larger than the half max heap size, we will turn to use full mark and trigger mix GC. +- if (!concurrentMarkingEnabled_ || !allowGc || !GetEcmaVM()->GetAssociatedJSThread()->IsReadyToMark() || ++ if (!concurrent_marking_enabled_ || !allowGc || !GetEcmaVM()->GetAssociatedJSThread()->IsReadyToMark() || + GetMemController()->IsDelayGCMode()) { + return; + } +@@ -363,22 +363,22 @@ void Heap::TryTriggerConcurrentMarking(bool allowGc) + double newSpaceRemainSize = 0; + double newSpaceAllocToLimitDuration = 0; + double oldSpaceAllocToLimitDuration = 0; +- double oldSpaceAllocSpeed = memController_->GetOldSpaceAllocationThroughtPerMS(); +- double oldSpaceConcurrentMarkSpeed = memController_->GetFullSpaceConcurrentMarkSpeedPerMS(); +- size_t oldSpaceCommittedSize = oldSpace_->GetCommittedSize() + hugeObjectSpace_->GetCommittedSize(); ++ double oldSpaceAllocSpeed = mem_controller_->GetOldSpaceAllocationThroughtPerMS(); ++ double oldSpaceConcurrentMarkSpeed = mem_controller_->GetFullSpaceConcurrentMarkSpeedPerMS(); ++ size_t oldSpaceCommittedSize = old_space_->GetCommittedSize() + huge_object_space_->GetCommittedSize(); + size_t globalSpaceCommittedSize = GetCommittedSize(); + if (oldSpaceConcurrentMarkSpeed == 0 || oldSpaceAllocSpeed == 0) { + if (oldSpaceCommittedSize >= OLD_SPACE_LIMIT_BEGIN) { +- isOnlySemi_ = false; ++ is_only_semi_ = false; + ECMA_GC_LOG() << "Trigger the first full mark"; + TriggerConcurrentMarking(); + } + } else { +- if (oldSpaceCommittedSize >= oldSpaceAllocLimit_ || globalSpaceCommittedSize >= globalSpaceAllocLimit_) { ++ if (oldSpaceCommittedSize >= old_space_alloc_limit_ || globalSpaceCommittedSize >= global_space_alloc_limit_) { + isFullMarkNeeded = true; + } + oldSpaceAllocToLimitDuration = +- static_cast(oldSpaceAllocLimit_ - oldSpaceCommittedSize) / oldSpaceAllocSpeed; ++ static_cast(old_space_alloc_limit_ - oldSpaceCommittedSize) / oldSpaceAllocSpeed; + oldSpaceMarkDuration = GetHeapObjectSize() / oldSpaceConcurrentMarkSpeed; + // oldSpaceRemainSize means the predicted size which can be allocated after the full concurrent mark. + double oldSpaceRemainSize = (oldSpaceAllocToLimitDuration - oldSpaceMarkDuration) * oldSpaceAllocSpeed; +@@ -387,39 +387,39 @@ void Heap::TryTriggerConcurrentMarking(bool allowGc) + } + } + +- double newSpaceAllocSpeed = memController_->GetNewSpaceAllocationThroughtPerMS(); +- double newSpaceConcurrentMarkSpeed = memController_->GetNewSpaceConcurrentMarkSpeedPerMS(); ++ double newSpaceAllocSpeed = mem_controller_->GetNewSpaceAllocationThroughtPerMS(); ++ double newSpaceConcurrentMarkSpeed = mem_controller_->GetNewSpaceConcurrentMarkSpeedPerMS(); + + if (newSpaceConcurrentMarkSpeed == 0 || newSpaceAllocSpeed == 0) { +- if (toSpace_->GetCommittedSize() >= SEMI_SPACE_TRIGGER_CONCURRENT_MARK) { +- isOnlySemi_ = true; ++ if (to_space_->GetCommittedSize() >= SEMI_SPACE_TRIGGER_CONCURRENT_MARK) { ++ is_only_semi_ = true; + TriggerConcurrentMarking(); + ECMA_GC_LOG() << "Trigger the first semi mark"; + } + return; + } + newSpaceAllocToLimitDuration = +- static_cast(toSpace_->GetMaximumCapacity() - toSpace_->GetCommittedSize()) / newSpaceAllocSpeed; +- newSpaceMarkDuration = toSpace_->GetHeapObjectSize() / newSpaceConcurrentMarkSpeed; ++ static_cast(to_space_->GetMaximumCapacity() - to_space_->GetCommittedSize()) / newSpaceAllocSpeed; ++ newSpaceMarkDuration = to_space_->GetHeapObjectSize() / newSpaceConcurrentMarkSpeed; + // newSpaceRemainSize means the predicted size which can be allocated after the semi concurrent mark. + newSpaceRemainSize = (newSpaceAllocToLimitDuration - newSpaceMarkDuration) * newSpaceAllocSpeed; + + if (isFullMarkNeeded) { + if (oldSpaceMarkDuration < newSpaceAllocToLimitDuration && + oldSpaceMarkDuration < oldSpaceAllocToLimitDuration) { +- isOnlySemi_ = false; ++ is_only_semi_ = false; + TriggerConcurrentMarking(); + ECMA_GC_LOG() << "Trigger full mark"; + return; + } + +- if (oldSpaceCommittedSize >= oldSpaceAllocLimit_ || globalSpaceCommittedSize >= globalSpaceAllocLimit_) { ++ if (oldSpaceCommittedSize >= old_space_alloc_limit_ || globalSpaceCommittedSize >= global_space_alloc_limit_) { + if (oldSpaceCommittedSize > HALF_MAX_HEAP_SIZE) { +- isOnlySemi_ = false; ++ is_only_semi_ = false; + TriggerConcurrentMarking(); + ECMA_GC_LOG() << "HEAP is larger than half of the max size. Trigger full mark"; + } else { +- isCompressGCRequested_ = true; ++ is_compress_gc_requested_ = true; + ECMA_GC_LOG() << "Request compress GC"; + } + } +@@ -427,7 +427,7 @@ void Heap::TryTriggerConcurrentMarking(bool allowGc) + } + + if (newSpaceRemainSize < DEFAULT_REGION_SIZE) { +- isOnlySemi_ = true; ++ is_only_semi_ = true; + TriggerConcurrentMarking(); + ECMA_GC_LOG() << "Trigger semi mark"; + } +@@ -435,21 +435,21 @@ void Heap::TryTriggerConcurrentMarking(bool allowGc) + + void Heap::TriggerConcurrentMarking() + { +- if (concurrentMarkingEnabled_ && !isCompressGCRequested_) { +- concurrentMarker_->ConcurrentMarking(); ++ if (concurrent_marking_enabled_ && !is_compress_gc_requested_) { ++ concurrent_marker_->ConcurrentMarking(); + } + } + + void Heap::CheckNeedFullMark() + { +- if ((oldSpace_->GetCommittedSize() + hugeObjectSpace_->GetCommittedSize()) > oldSpaceAllocLimit_) { ++ if ((old_space_->GetCommittedSize() + huge_object_space_->GetCommittedSize()) > old_space_alloc_limit_) { + SetOnlyMarkSemi(false); + } + } + + bool Heap::CheckAndTriggerOldGC() + { +- if ((oldSpace_->GetCommittedSize() + hugeObjectSpace_->GetCommittedSize()) <= oldSpaceAllocLimit_) { ++ if ((old_space_->GetCommittedSize() + huge_object_space_->GetCommittedSize()) <= old_space_alloc_limit_) { + return false; + } + CollectGarbage(TriggerGCType::OLD_GC); +@@ -458,7 +458,7 @@ bool Heap::CheckAndTriggerOldGC() + + bool Heap::CheckAndTriggerCompressGC() + { +- if (GetCommittedSize() <= globalSpaceAllocLimit_) { ++ if (GetCommittedSize() <= global_space_alloc_limit_) { + return false; + } + CollectGarbage(TriggerGCType::COMPRESS_FULL_GC); +@@ -467,7 +467,7 @@ bool Heap::CheckAndTriggerCompressGC() + + bool Heap::CheckAndTriggerNonMovableGC() + { +- if (nonMovableSpace_->GetCommittedSize() <= DEFAULT_NON_MOVABLE_SPACE_LIMIT) { ++ if (non_movable_space_->GetCommittedSize() <= DEFAULT_NON_MOVABLE_SPACE_LIMIT) { + return false; + } + CollectGarbage(TriggerGCType::NON_MOVE_GC); +@@ -476,7 +476,7 @@ bool Heap::CheckAndTriggerNonMovableGC() + + bool Heap::CheckAndTriggerMachineCodeGC() + { +- if (machineCodeSpace_->GetCommittedSize() <= DEFAULT_MACHINE_CODE_SPACE_LIMIT) { ++ if (machine_code_space_->GetCommittedSize() <= DEFAULT_MACHINE_CODE_SPACE_LIMIT) { + return false; + } + CollectGarbage(TriggerGCType::MACHINE_CODE_GC); +@@ -485,10 +485,10 @@ bool Heap::CheckAndTriggerMachineCodeGC() + + void Heap::UpdateDerivedObjectInStack() + { +- if (derivedPointers_->empty()) { ++ if (derived_pointers_->empty()) { + return; + } +- for (auto derived : *derivedPointers_) { ++ for (auto derived : *derived_pointers_) { + auto baseAddr = reinterpret_cast(derived.first.first); + JSTaggedValue base = *baseAddr; + if (base.IsHeapObject()) { +@@ -506,30 +506,30 @@ void Heap::UpdateDerivedObjectInStack() + #endif + } + } +- derivedPointers_->clear(); ++ derived_pointers_->clear(); + } + + void Heap::WaitRunningTaskFinished() + { +- os::memory::LockHolder holder(waitTaskFinishedMutex_); +- while (runningTastCount_ > 0) { +- waitTaskFinishedCV_.Wait(&waitTaskFinishedMutex_); ++ os::memory::LockHolder holder(wait_task_finished_mutex_); ++ while (running_tast_count_ > 0) { ++ wait_task_finished_cv_.Wait(&wait_task_finished_mutex_); + } + } + + void Heap::WaitConcurrentMarkingFinished() + { +- concurrentMarker_->WaitConcurrentMarkingFinished(); ++ concurrent_marker_->WaitConcurrentMarkingFinished(); + } + + void Heap::SetConcurrentMarkingEnable(bool flag) + { +- concurrentMarkingEnabled_ = flag; ++ concurrent_marking_enabled_ = flag; + } + + bool Heap::ConcurrentMarkingEnable() const + { +- return concurrentMarkingEnabled_; ++ return concurrent_marking_enabled_; + } + + void Heap::PostParallelGCTask(ParallelGCTaskPhase gcTask) +@@ -540,29 +540,29 @@ void Heap::PostParallelGCTask(ParallelGCTaskPhase gcTask) + + void Heap::IncreaseTaskCount() + { +- os::memory::LockHolder holder(waitTaskFinishedMutex_); +- runningTastCount_++; ++ os::memory::LockHolder holder(wait_task_finished_mutex_); ++ running_tast_count_++; + } + + bool Heap::CheckCanDistributeTask() + { +- os::memory::LockHolder holder(waitTaskFinishedMutex_); +- return (runningTastCount_ < Platform::GetCurrentPlatform()->GetTotalThreadNum() - 1) && +- (runningTastCount_ <= MAX_PARALLEL_THREAD_NUM); ++ os::memory::LockHolder holder(wait_task_finished_mutex_); ++ return (running_tast_count_ < Platform::GetCurrentPlatform()->GetTotalThreadNum() - 1) && ++ (running_tast_count_ <= MAX_PARALLEL_THREAD_NUM); + } + + void Heap::ReduceTaskCount() + { +- os::memory::LockHolder holder(waitTaskFinishedMutex_); +- runningTastCount_--; +- if (runningTastCount_ == 0) { +- waitTaskFinishedCV_.SignalAll(); ++ os::memory::LockHolder holder(wait_task_finished_mutex_); ++ running_tast_count_--; ++ if (running_tast_count_ == 0) { ++ wait_task_finished_cv_.SignalAll(); + } + } + + bool Heap::ParallelGCTask::Run(uint32_t threadIndex) + { +- switch (taskPhase_) { ++ switch (task_phase_) { + case ParallelGCTaskPhase::SEMI_HANDLE_THREAD_ROOTS_TASK: + heap_->GetSemiGcMarker()->MarkRoots(threadIndex); + heap_->GetSemiGcMarker()->ProcessMarkStack(threadIndex); +diff --git a/runtime/mem/heap.h b/runtime/mem/heap.h +index 2196e9e..6c07468 100644 +--- a/runtime/mem/heap.h ++++ b/runtime/mem/heap.h +@@ -55,7 +55,7 @@ public: + + const SemiSpace *GetNewSpace() const + { +- return toSpace_; ++ return to_space_; + } + + inline void SetNewSpaceAgeMark(uintptr_t mark); +@@ -64,12 +64,12 @@ public: + + const SemiSpace *GetFromSpace() const + { +- return fromSpace_; ++ return from_space_; + } + + const OldSpace *GetCompressSpace() const + { +- return compressSpace_; ++ return compress_space_; + } + + inline void InitializeFromSpace(); +@@ -83,37 +83,37 @@ public: + + const OldSpace *GetOldSpace() const + { +- return oldSpace_; ++ return old_space_; + } + + const NonMovableSpace *GetNonMovableSpace() const + { +- return nonMovableSpace_; ++ return non_movable_space_; + } + + const HugeObjectSpace *GetHugeObjectSpace() const + { +- return hugeObjectSpace_; ++ return huge_object_space_; + } + + const MachineCodeSpace *GetMachineCodeSpace() const + { +- return machineCodeSpace_; ++ return machine_code_space_; + } + + SemiSpaceCollector *GetSemiSpaceCollector() const + { +- return semiSpaceCollector_; ++ return semi_space_collector_; + } + + MixSpaceCollector *GetMixSpaceCollector() const + { +- return mixSpaceCollector_; ++ return mix_space_collector_; + } + + CompressCollector *GetCompressCollector() const + { +- return compressCollector_; ++ return compress_collector_; + } + + ConcurrentSweeper *GetSweeper() const +@@ -128,22 +128,22 @@ public: + + EvacuationAllocator *GetEvacuationAllocator() const + { +- return evacuationAllocator_; ++ return evacuation_allocator_; + } + + ConcurrentMarker *GetConcurrentMarker() const + { +- return concurrentMarker_; ++ return concurrent_marker_; + } + + EcmaVM *GetEcmaVM() const + { +- return ecmaVm_; ++ return ecma_vm_; + } + + WorkerHelper *GetWorkList() const + { +- return workList_; ++ return work_list_; + } + + void FlipNewSpace(); +@@ -183,12 +183,12 @@ public: + + void SetHeapManager(MemManager *heapManager) + { +- heapManager_ = heapManager; ++ heap_manager_ = heapManager; + } + + MemManager *GetHeapManager() const + { +- return heapManager_; ++ return heap_manager_; + } + + void StartHeapTracking(HeapTracker *tracker) +@@ -222,12 +222,12 @@ public: + + const RegionFactory *GetRegionFactory() const + { +- return regionFactory_; ++ return region_factory_; + } + + SnapShotSpace *GetSnapShotSpace() const + { +- return snapshotSpace_; ++ return snapshot_space_; + } + + bool IsLive(TaggedObject *object) const +@@ -237,19 +237,19 @@ public: + } + + // semi space +- if (toSpace_->IsLive(object)) { ++ if (to_space_->IsLive(object)) { + return true; + } + // old space +- if (oldSpace_->IsLive(object)) { ++ if (old_space_->IsLive(object)) { + return true; + } + // non movable space +- if (nonMovableSpace_->IsLive(object)) { ++ if (non_movable_space_->IsLive(object)) { + return true; + } + // huge object space +- if (hugeObjectSpace_->IsLive(object)) { ++ if (huge_object_space_->IsLive(object)) { + return true; + } + return false; +@@ -258,19 +258,19 @@ public: + bool ContainObject(TaggedObject *object) const + { + // semi space +- if (toSpace_->ContainObject(object)) { ++ if (to_space_->ContainObject(object)) { + return true; + } + // old space +- if (oldSpace_->ContainObject(object)) { ++ if (old_space_->ContainObject(object)) { + return true; + } + // non movable space +- if (nonMovableSpace_->ContainObject(object)) { ++ if (non_movable_space_->ContainObject(object)) { + return true; + } + // huge object space +- if (hugeObjectSpace_->ContainObject(object)) { ++ if (huge_object_space_->ContainObject(object)) { + return true; + } + return false; +@@ -280,17 +280,17 @@ public: + + MemController *GetMemController() const + { +- return memController_; ++ return mem_controller_; + } + + size_t GetOldSpaceAllocLimit() + { +- return oldSpaceAllocLimit_; ++ return old_space_alloc_limit_; + } + + void SetGlobalSpaceAllocLimit(size_t limit) + { +- globalSpaceAllocLimit_ = limit; ++ global_space_alloc_limit_ = limit; + } + + inline void ResetDelayGCMode(); +@@ -301,7 +301,7 @@ public: + + ChunkMap *GetDerivedPointers() const + { +- return derivedPointers_; ++ return derived_pointers_; + } + #if ECMASCRIPT_ENABLE_HEAP_VERIFY + bool GetIsVerifying() const +@@ -321,7 +321,7 @@ public: + + bool IsParallelGCEnabled() const + { +- return paralledGc_; ++ return paralled_gc_; + } + + void WaitConcurrentMarkingFinished(); +@@ -332,27 +332,27 @@ public: + + inline bool IsSemiMarkNeeded() const + { +- return isOnlySemi_; ++ return is_only_semi_; + } + + void SetOnlyMarkSemi(bool onlySemi) + { +- isOnlySemi_ = onlySemi; ++ is_only_semi_ = onlySemi; + } + + Marker *GetNonMovableMarker() const + { +- return nonMovableMarker_; ++ return non_movable_marker_; + } + + Marker *GetSemiGcMarker() const + { +- return semiGcMarker_; ++ return semi_gc_marker_; + } + + Marker *GetCompressGcMarker() const + { +- return compressGcMarker_; ++ return compress_gc_marker_; + } + + size_t GetArrayBufferSize() const; +@@ -368,7 +368,7 @@ private: + + class ParallelGCTask : public Task { + public: +- ParallelGCTask(Heap *heap, ParallelGCTaskPhase taskPhase) : heap_(heap), taskPhase_(taskPhase) {}; ++ ParallelGCTask(Heap *heap, ParallelGCTaskPhase taskPhase) : heap_(heap), task_phase_(taskPhase) {}; + ~ParallelGCTask() override = default; + bool Run(uint32_t threadIndex) override; + +@@ -377,48 +377,48 @@ private: + + private: + Heap *heap_ {nullptr}; +- ParallelGCTaskPhase taskPhase_; ++ ParallelGCTaskPhase task_phase_; + }; + +- EcmaVM *ecmaVm_ {nullptr}; +- SemiSpace *fromSpace_ {nullptr}; +- SemiSpace *toSpace_ {nullptr}; +- OldSpace *oldSpace_ {nullptr}; +- OldSpace *compressSpace_ {nullptr}; +- HugeObjectSpace *hugeObjectSpace_ {nullptr}; +- SnapShotSpace *snapshotSpace_ {nullptr}; +- NonMovableSpace *nonMovableSpace_ {nullptr}; +- MachineCodeSpace *machineCodeSpace_ {nullptr}; +- SemiSpaceCollector *semiSpaceCollector_ {nullptr}; +- MixSpaceCollector *mixSpaceCollector_ {nullptr}; +- CompressCollector *compressCollector_ {nullptr}; ++ EcmaVM *ecma_vm_ {nullptr}; ++ SemiSpace *from_space_ {nullptr}; ++ SemiSpace *to_space_ {nullptr}; ++ OldSpace *old_space_ {nullptr}; ++ OldSpace *compress_space_ {nullptr}; ++ HugeObjectSpace *huge_object_space_ {nullptr}; ++ SnapShotSpace *snapshot_space_ {nullptr}; ++ NonMovableSpace *non_movable_space_ {nullptr}; ++ MachineCodeSpace *machine_code_space_ {nullptr}; ++ SemiSpaceCollector *semi_space_collector_ {nullptr}; ++ MixSpaceCollector *mix_space_collector_ {nullptr}; ++ CompressCollector *compress_collector_ {nullptr}; + ConcurrentSweeper *sweeper_ {nullptr}; +- Marker *nonMovableMarker_ {nullptr}; +- Marker *semiGcMarker_ {nullptr}; +- Marker *compressGcMarker_ {nullptr}; ++ Marker *non_movable_marker_ {nullptr}; ++ Marker *semi_gc_marker_ {nullptr}; ++ Marker *compress_gc_marker_ {nullptr}; + ParallelEvacuation *evacuation_ {nullptr}; +- EvacuationAllocator *evacuationAllocator_ {nullptr}; +- MemManager *heapManager_ {nullptr}; +- RegionFactory *regionFactory_ {nullptr}; ++ EvacuationAllocator *evacuation_allocator_ {nullptr}; ++ MemManager *heap_manager_ {nullptr}; ++ RegionFactory *region_factory_ {nullptr}; + HeapTracker *tracker_ {nullptr}; +- MemController *memController_ {nullptr}; +- size_t oldSpaceAllocLimit_ {OLD_SPACE_LIMIT_BEGIN}; +- size_t globalSpaceAllocLimit_ {GLOBAL_SPACE_LIMIT_BEGIN}; +- ChunkMap *derivedPointers_ {nullptr}; ++ MemController *mem_controller_ {nullptr}; ++ size_t old_space_alloc_limit_ {OLD_SPACE_LIMIT_BEGIN}; ++ size_t global_space_alloc_limit_ {GLOBAL_SPACE_LIMIT_BEGIN}; ++ ChunkMap *derived_pointers_ {nullptr}; + #if ECMASCRIPT_ENABLE_HEAP_VERIFY + bool isVerifying_ {false}; + #endif + +- ConcurrentMarker *concurrentMarker_ {nullptr}; +- uint32_t runningTastCount_ {0}; +- os::memory::Mutex waitTaskFinishedMutex_; +- os::memory::ConditionVariable waitTaskFinishedCV_; +- bool paralledGc_ {true}; +- WorkerHelper *workList_ {nullptr}; ++ ConcurrentMarker *concurrent_marker_ {nullptr}; ++ uint32_t running_tast_count_ {0}; ++ os::memory::Mutex wait_task_finished_mutex_; ++ os::memory::ConditionVariable wait_task_finished_cv_; ++ bool paralled_gc_ {true}; ++ WorkerHelper *work_list_ {nullptr}; + +- bool concurrentMarkingEnabled_ {true}; +- bool isOnlySemi_ {true}; +- bool isCompressGCRequested_ {false}; ++ bool concurrent_marking_enabled_ {true}; ++ bool is_only_semi_ {true}; ++ bool is_compress_gc_requested_ {false}; + inline void SetMaximumCapacity(SemiSpace *space, size_t maximumCapacity); + }; + } // namespace panda::ecmascript +diff --git a/runtime/mem/mark_stack-inl.h b/runtime/mem/mark_stack-inl.h +index a83e645..8f1f3cc 100644 +--- a/runtime/mem/mark_stack-inl.h ++++ b/runtime/mem/mark_stack-inl.h +@@ -24,20 +24,20 @@ template + void ContinuousStack::BeginMarking(Heap *heap, ContinuousStack *other) + { + heap_ = heap; +- currentArea_ = other->currentArea_; +- if (currentArea_ == nullptr) { +- currentArea_ = RegionFactory::AllocateSpace(DEFAULT_MARK_STACK_SIZE); ++ current_area_ = other->current_area_; ++ if (current_area_ == nullptr) { ++ current_area_ = RegionFactory::AllocateSpace(DEFAULT_MARK_STACK_SIZE); + } +- ResetBegin(currentArea_->GetBegin(), currentArea_->GetEnd()); ++ ResetBegin(current_area_->GetBegin(), current_area_->GetEnd()); + } + + template + void ContinuousStack::FinishMarking(ContinuousStack *other) + { +- other->currentArea_ = currentArea_; ++ other->current_area_ = current_area_; + +- while (!unusedList_.IsEmpty()) { +- Area *node = unusedList_.PopBack(); ++ while (!unused_list_.IsEmpty()) { ++ Area *node = unused_list_.PopBack(); + RegionFactory::FreeSpace(node); + } + } +@@ -46,17 +46,17 @@ template + void ContinuousStack::Extend() + { + auto area = RegionFactory::AllocateSpace(DEFAULT_MARK_STACK_SIZE); +- areaList_.AddNode(currentArea_); +- currentArea_ = area; +- ResetBegin(currentArea_->GetBegin(), currentArea_->GetEnd()); ++ area_list_.AddNode(current_area_); ++ current_area_ = area; ++ ResetBegin(current_area_->GetBegin(), current_area_->GetEnd()); + } + + template + void ContinuousStack::Destroy() + { +- if (currentArea_ != nullptr) { +- RegionFactory::FreeSpace(currentArea_); +- currentArea_ = nullptr; ++ if (current_area_ != nullptr) { ++ RegionFactory::FreeSpace(current_area_); ++ current_area_ = nullptr; + } + } + } // namespace panda::ecmascript +diff --git a/runtime/mem/mark_stack.h b/runtime/mem/mark_stack.h +index 2bbdd43..25542ab 100644 +--- a/runtime/mem/mark_stack.h ++++ b/runtime/mem/mark_stack.h +@@ -107,11 +107,11 @@ public: + T *PopBack() + { + if (UNLIKELY(top_ <= reinterpret_cast(begin_))) { +- if (!areaList_.IsEmpty()) { +- unusedList_.AddNode(currentArea_); +- Area *last = areaList_.PopBack(); +- currentArea_ = last; +- ResetTop(currentArea_->GetBegin(), currentArea_->GetEnd()); ++ if (!area_list_.IsEmpty()) { ++ unused_list_.AddNode(current_area_); ++ Area *last = area_list_.PopBack(); ++ current_area_ = last; ++ ResetTop(current_area_->GetBegin(), current_area_->GetEnd()); + } else { + return nullptr; + } +@@ -133,9 +133,9 @@ private: + inline void Extend(); + + Heap *heap_ {nullptr}; +- Area *currentArea_ {nullptr}; +- EcmaList areaList_ {}; +- EcmaList unusedList_ {}; ++ Area *current_area_ {nullptr}; ++ EcmaList area_list_ {}; ++ EcmaList unused_list_ {}; + }; + + using MarkStack = ContinuousStack; +diff --git a/runtime/mem/mem_controller.cpp b/runtime/mem/mem_controller.cpp +index 8dcdae6..45b5269 100644 +--- a/runtime/mem/mem_controller.cpp ++++ b/runtime/mem/mem_controller.cpp +@@ -21,7 +21,7 @@ + #include "plugins/ecmascript/runtime/mem/parallel_evacuation.h" + + namespace panda::ecmascript { +-MemController::MemController(Heap *heap, bool isDelayGCMode) : heap_(heap), isDelayGCMode_(isDelayGCMode) {} ++MemController::MemController(Heap *heap, bool isDelayGCMode) : heap_(heap), is_delay_gc_mode_(isDelayGCMode) {} + + double MemController::CalculateAllocLimit(size_t currentSize, size_t minSize, size_t maxSize, + [[maybe_unused]] size_t newSpaceCapacity, double factor) const +@@ -58,70 +58,74 @@ double MemController::CalculateGrowingFactor(double gcSpeed, double mutatorSpeed + + void MemController::StartCalculationBeforeGC() + { +- startCounter_++; +- if (startCounter_ != 1) { ++ start_counter_++; ++ if (start_counter_ != 1) { + return; + } + + auto heapManager = heap_->GetHeapManager(); + // It's unnecessary to calculate newSpaceAllocAccumulatorSize. newSpaceAllocBytesSinceGC can be calculated directly. + size_t newSpaceAllocBytesSinceGC = heap_->GetNewSpace()->GetAllocatedSizeSinceGC(); +- size_t hugeObjectAllocSizeSinceGC = heap_->GetHugeObjectSpace()->GetHeapObjectSize() - hugeObjectAllocSizeSinceGC_; ++ size_t hugeObjectAllocSizeSinceGC = ++ heap_->GetHugeObjectSpace()->GetHeapObjectSize() - huge_object_alloc_size_since_gc_; + size_t oldSpaceAllocAccumulatorSize = + heapManager->GetOldSpaceAllocator().GetAllocatedSize() + heap_->GetEvacuation()->GetPromotedAccumulatorSize(); + size_t nonMovableSpaceAllocAccumulatorSize = heapManager->GetNonMovableSpaceAllocator().GetAllocatedSize(); + size_t codeSpaceAllocAccumulatorSize = heapManager->GetMachineCodeSpaceAllocator().GetAllocatedSize(); +- if (allocTimeMs_ == 0) { +- allocTimeMs_ = GetSystemTimeInMs(); +- oldSpaceAllocAccumulatorSize_ = oldSpaceAllocAccumulatorSize; +- nonMovableSpaceAllocAccumulatorSize_ = nonMovableSpaceAllocAccumulatorSize; +- codeSpaceAllocAccumulatorSize_ = codeSpaceAllocAccumulatorSize; ++ if (alloc_time_ms_ == 0) { ++ alloc_time_ms_ = GetSystemTimeInMs(); ++ old_space_alloc_accumulator_size_ = oldSpaceAllocAccumulatorSize; ++ non_movable_space_alloc_accumulator_size_ = nonMovableSpaceAllocAccumulatorSize; ++ code_space_alloc_accumulator_size_ = codeSpaceAllocAccumulatorSize; + return; + } + double currentTimeInMs = GetSystemTimeInMs(); +- gcStartTime_ = currentTimeInMs; +- size_t oldSpaceAllocSize = oldSpaceAllocAccumulatorSize - oldSpaceAllocAccumulatorSize_; +- size_t nonMovableSpaceAllocSize = nonMovableSpaceAllocAccumulatorSize - nonMovableSpaceAllocAccumulatorSize_; +- size_t codeSpaceAllocSize = codeSpaceAllocAccumulatorSize - codeSpaceAllocAccumulatorSize_; +- +- double duration = currentTimeInMs - allocTimeMs_; +- allocTimeMs_ = currentTimeInMs; +- oldSpaceAllocAccumulatorSize_ = oldSpaceAllocAccumulatorSize; +- nonMovableSpaceAllocAccumulatorSize_ = nonMovableSpaceAllocAccumulatorSize; +- codeSpaceAllocAccumulatorSize_ = codeSpaceAllocAccumulatorSize; +- allocDurationSinceGc_ += duration; +- newSpaceAllocSizeSinceGC_ += newSpaceAllocBytesSinceGC; +- oldSpaceAllocSizeSinceGC_ += oldSpaceAllocSize; +- oldSpaceAllocSizeSinceGC_ += hugeObjectAllocSizeSinceGC; +- nonMovableSpaceAllocSizeSinceGC_ += nonMovableSpaceAllocSize; +- codeSpaceAllocSizeSinceGC_ += codeSpaceAllocSize; ++ gc_start_time_ = currentTimeInMs; ++ size_t oldSpaceAllocSize = oldSpaceAllocAccumulatorSize - old_space_alloc_accumulator_size_; ++ size_t nonMovableSpaceAllocSize = nonMovableSpaceAllocAccumulatorSize - non_movable_space_alloc_accumulator_size_; ++ size_t codeSpaceAllocSize = codeSpaceAllocAccumulatorSize - code_space_alloc_accumulator_size_; ++ ++ double duration = currentTimeInMs - alloc_time_ms_; ++ alloc_time_ms_ = currentTimeInMs; ++ old_space_alloc_accumulator_size_ = oldSpaceAllocAccumulatorSize; ++ non_movable_space_alloc_accumulator_size_ = nonMovableSpaceAllocAccumulatorSize; ++ code_space_alloc_accumulator_size_ = codeSpaceAllocAccumulatorSize; ++ alloc_duration_since_gc_ += duration; ++ new_space_alloc_size_since_gc_ += newSpaceAllocBytesSinceGC; ++ old_space_alloc_size_since_gc_ += oldSpaceAllocSize; ++ old_space_alloc_size_since_gc_ += hugeObjectAllocSizeSinceGC; ++ non_movable_space_alloc_size_since_gc_ += nonMovableSpaceAllocSize; ++ code_space_alloc_size_since_gc_ += codeSpaceAllocSize; + } + + void MemController::StopCalculationAfterGC(TriggerGCType gcType) + { +- startCounter_--; +- if (startCounter_ != 0) { ++ start_counter_--; ++ if (start_counter_ != 0) { + return; + } + +- gcEndTime_ = GetSystemTimeInMs(); +- allocTimeMs_ = gcEndTime_; +- if (allocDurationSinceGc_ > 0) { +- recordedNewSpaceAllocations_.Push(MakeBytesAndDuration(newSpaceAllocSizeSinceGC_, allocDurationSinceGc_)); +- recordedOldSpaceAllocations_.Push(MakeBytesAndDuration(oldSpaceAllocSizeSinceGC_, allocDurationSinceGc_)); +- recordedNonmovableSpaceAllocations_.Push( +- MakeBytesAndDuration(nonMovableSpaceAllocSizeSinceGC_, allocDurationSinceGc_)); +- recordedCodeSpaceAllocations_.Push(MakeBytesAndDuration(codeSpaceAllocSizeSinceGC_, allocDurationSinceGc_)); ++ gc_end_time_ = GetSystemTimeInMs(); ++ alloc_time_ms_ = gc_end_time_; ++ if (alloc_duration_since_gc_ > 0) { ++ recorded_new_space_allocations_.Push( ++ MakeBytesAndDuration(new_space_alloc_size_since_gc_, alloc_duration_since_gc_)); ++ recorded_old_space_allocations_.Push( ++ MakeBytesAndDuration(old_space_alloc_size_since_gc_, alloc_duration_since_gc_)); ++ recorded_nonmovable_space_allocations_.Push( ++ MakeBytesAndDuration(non_movable_space_alloc_size_since_gc_, alloc_duration_since_gc_)); ++ recorded_code_space_allocations_.Push( ++ MakeBytesAndDuration(code_space_alloc_size_since_gc_, alloc_duration_since_gc_)); + } +- allocDurationSinceGc_ = 0.0; +- newSpaceAllocSizeSinceGC_ = 0; +- oldSpaceAllocSizeSinceGC_ = 0; +- nonMovableSpaceAllocSizeSinceGC_ = 0; +- codeSpaceAllocSizeSinceGC_ = 0; ++ alloc_duration_since_gc_ = 0.0; ++ new_space_alloc_size_since_gc_ = 0; ++ old_space_alloc_size_since_gc_ = 0; ++ non_movable_space_alloc_size_since_gc_ = 0; ++ code_space_alloc_size_since_gc_ = 0; + +- hugeObjectAllocSizeSinceGC_ = heap_->GetHugeObjectSpace()->GetHeapObjectSize(); ++ huge_object_alloc_size_since_gc_ = heap_->GetHugeObjectSpace()->GetHeapObjectSize(); + +- double duration = gcEndTime_ - gcStartTime_; ++ double duration = gc_end_time_ - gc_start_time_; + + switch (gcType) { + case TriggerGCType::SEMI_GC: +@@ -132,7 +136,7 @@ void MemController::StopCalculationAfterGC(TriggerGCType gcType) + case TriggerGCType::OLD_GC: + case TriggerGCType::COMPRESS_FULL_GC: { + size_t heapObjectSize = heap_->GetHeapObjectSize(); +- recordedMarkCompacts_.Push(MakeBytesAndDuration(heapObjectSize, duration)); ++ recorded_mark_compacts_.Push(MakeBytesAndDuration(heapObjectSize, duration)); + break; + } + default: +@@ -145,20 +149,20 @@ void MemController::RecordAfterConcurrentMark(const bool isSemi, const Concurren + { + double duration = marker->GetDuration(); + if (isSemi) { +- recordedSemiConcurrentMarks_.Push(MakeBytesAndDuration(marker->GetHeapObjectSize(), duration)); ++ recorded_semi_concurrent_marks_.Push(MakeBytesAndDuration(marker->GetHeapObjectSize(), duration)); + } else { +- recordedConcurrentMarks_.Push(MakeBytesAndDuration(marker->GetHeapObjectSize(), duration)); ++ recorded_concurrent_marks_.Push(MakeBytesAndDuration(marker->GetHeapObjectSize(), duration)); + } + } + + double MemController::CalculateMarkCompactSpeedPerMS() + { +- if (markCompactSpeedCache_ > 0) { +- return markCompactSpeedCache_; ++ if (mark_compact_speed_cache_ > 0) { ++ return mark_compact_speed_cache_; + } +- markCompactSpeedCache_ = CalculateAverageSpeed(recordedMarkCompacts_); +- if (markCompactSpeedCache_ > 0) { +- return markCompactSpeedCache_; ++ mark_compact_speed_cache_ = CalculateAverageSpeed(recorded_mark_compacts_); ++ if (mark_compact_speed_cache_ > 0) { ++ return mark_compact_speed_cache_; + } + return 0; + } +@@ -198,29 +202,30 @@ double MemController::CalculateAverageSpeed(const base::GCRingBuffer recordedMarkCompacts_; +- base::GCRingBuffer recordedNewSpaceAllocations_; +- base::GCRingBuffer recordedOldSpaceAllocations_; +- base::GCRingBuffer recordedNonmovableSpaceAllocations_; +- base::GCRingBuffer recordedCodeSpaceAllocations_; +- +- base::GCRingBuffer recordedConcurrentMarks_; +- base::GCRingBuffer recordedSemiConcurrentMarks_; +- bool isDelayGCMode_ {false}; ++ double alloc_duration_since_gc_ {0.0}; ++ size_t new_space_alloc_size_since_gc_ {0}; ++ size_t old_space_alloc_size_since_gc_ {0}; ++ size_t non_movable_space_alloc_size_since_gc_ {0}; ++ size_t code_space_alloc_size_since_gc_ {0}; ++ size_t huge_object_alloc_size_since_gc_ {0}; ++ ++ int start_counter_ {0}; ++ double mark_compact_speed_cache_ {0.0}; ++ ++ base::GCRingBuffer recorded_mark_compacts_; ++ base::GCRingBuffer recorded_new_space_allocations_; ++ base::GCRingBuffer recorded_old_space_allocations_; ++ base::GCRingBuffer recorded_nonmovable_space_allocations_; ++ base::GCRingBuffer recorded_code_space_allocations_; ++ ++ base::GCRingBuffer recorded_concurrent_marks_; ++ base::GCRingBuffer recorded_semi_concurrent_marks_; ++ bool is_delay_gc_mode_ {false}; + + static constexpr double THROUGHPUT_TIME_FRAME_MS = 5000; + static constexpr int MILLISECOND_PER_SECOND = 1000; +diff --git a/runtime/mem/mem_manager-inl.h b/runtime/mem/mem_manager-inl.h +index 90912ec..29b34c0 100644 +--- a/runtime/mem/mem_manager-inl.h ++++ b/runtime/mem/mem_manager-inl.h +@@ -34,7 +34,7 @@ TaggedObject *MemManager::AllocateYoungGenerationOrHugeObject(JSHClass *hclass) + + TaggedObject *MemManager::AllocateYoungGenerationOrHugeObject(JSHClass *hclass, size_t size) + { +- auto object = heapManager_->AllocateObject(hclass->GetHClass(), size, DEFAULT_ALIGNMENT, thread_); ++ auto object = heap_manager_->AllocateObject(hclass->GetHClass(), size, DEFAULT_ALIGNMENT, thread_); + // OnAllocateEvent checks object for nullptr + // SUPPRESS_CSA_NEXTLINE(alpha.core.CheckObjHeaderTypeRef) + heap_->OnAllocateEvent(reinterpret_cast(object)); +@@ -54,9 +54,9 @@ TaggedObject *MemManager::AllocateNonMovableOrHugeObject(JSHClass *hclass, size_ + { + ObjectHeader *object = nullptr; + if (hclass == nullptr) { +- object = heapManager_->AllocateNonMovableObject(nullptr, size, DEFAULT_ALIGNMENT, thread_); ++ object = heap_manager_->AllocateNonMovableObject(nullptr, size, DEFAULT_ALIGNMENT, thread_); + } else { +- object = heapManager_->AllocateNonMovableObject(hclass->GetHClass(), size, DEFAULT_ALIGNMENT, thread_); ++ object = heap_manager_->AllocateNonMovableObject(hclass->GetHClass(), size, DEFAULT_ALIGNMENT, thread_); + } + // OnAllocateEvent checks object for nullptr + // SUPPRESS_CSA_NEXTLINE(alpha.core.CheckObjHeaderTypeRef) +@@ -70,13 +70,13 @@ TaggedObject *MemManager::AllocateNonMovableOrHugeObject(JSHClass *hclass, size_ + + uintptr_t MemManager::AllocateSnapShotSpace(size_t size) + { +- uintptr_t object = snapshotSpaceAllocator_.Allocate(size); ++ uintptr_t object = snapshot_space_allocator_.Allocate(size); + if (UNLIKELY(object == 0)) { +- if (!heap_->FillSnapShotSpace(&snapshotSpaceAllocator_)) { ++ if (!heap_->FillSnapShotSpace(&snapshot_space_allocator_)) { + LOG_ECMA_MEM(FATAL) << "alloc failed"; + UNREACHABLE(); + } +- object = snapshotSpaceAllocator_.Allocate(size); ++ object = snapshot_space_allocator_.Allocate(size); + if (UNLIKELY(object == 0)) { + LOG_ECMA_MEM(FATAL) << "alloc failed"; + UNREACHABLE(); +@@ -98,7 +98,7 @@ TaggedObject *MemManager::AllocateNonMovableOrHugeObject(JSHClass *hclass) + + TaggedObject *MemManager::AllocateOldGenerationOrHugeObject(JSHClass *hclass, size_t size) + { +- auto object = heapManager_->AllocateObject(hclass->GetHClass(), size, DEFAULT_ALIGNMENT, thread_); ++ auto object = heap_manager_->AllocateObject(hclass->GetHClass(), size, DEFAULT_ALIGNMENT, thread_); + // OnAllocateEvent checks object for nullptr + // SUPPRESS_CSA_NEXTLINE(alpha.core.CheckObjHeaderTypeRef) + heap_->OnAllocateEvent(reinterpret_cast(object)); +@@ -111,7 +111,7 @@ TaggedObject *MemManager::AllocateOldGenerationOrHugeObject(JSHClass *hclass, si + + TaggedObject *MemManager::AllocateHugeObject(JSHClass *hclass, size_t size) + { +- auto object = heapManager_->AllocateObject(hclass->GetHClass(), size, DEFAULT_ALIGNMENT, thread_); ++ auto object = heap_manager_->AllocateObject(hclass->GetHClass(), size, DEFAULT_ALIGNMENT, thread_); + // OnAllocateEvent checks object for nullptr + // SUPPRESS_CSA_NEXTLINE(alpha.core.CheckObjHeaderTypeRef) + heap_->OnAllocateEvent(reinterpret_cast(object)); +diff --git a/runtime/mem/mem_manager.cpp b/runtime/mem/mem_manager.cpp +index 15614ed..16ae926 100644 +--- a/runtime/mem/mem_manager.cpp ++++ b/runtime/mem/mem_manager.cpp +@@ -19,13 +19,13 @@ + namespace panda::ecmascript { + MemManager::MemManager(Heap *heap) + : heap_(heap), +- newSpaceAllocator_(heap->GetNewSpace()), +- freeListAllocator_ {FreeListAllocator(heap->GetOldSpace()), FreeListAllocator(heap_->GetNonMovableSpace()), +- FreeListAllocator(heap->GetMachineCodeSpace())} ++ new_space_allocator_(heap->GetNewSpace()), ++ free_list_allocator_ {FreeListAllocator(heap->GetOldSpace()), FreeListAllocator(heap_->GetNonMovableSpace()), ++ FreeListAllocator(heap->GetMachineCodeSpace())} + { + ASSERT(heap != nullptr); + heap->SetHeapManager(this); +- heapManager_ = heap->GetEcmaVM()->GetHeapManager(); ++ heap_manager_ = heap->GetEcmaVM()->GetHeapManager(); + thread_ = heap->GetEcmaVM()->GetAssociatedJSThread(); + } + } // namespace panda::ecmascript +diff --git a/runtime/mem/mem_manager.h b/runtime/mem/mem_manager.h +index bfa1bfc..2a75627 100644 +--- a/runtime/mem/mem_manager.h ++++ b/runtime/mem/mem_manager.h +@@ -49,41 +49,41 @@ public: + + FreeListAllocator &GetFreeListAllocator(MemSpaceType type) + { +- return freeListAllocator_[type]; ++ return free_list_allocator_[type]; + } + + inline FreeListAllocator &GetOldSpaceAllocator() + { +- return freeListAllocator_[OLD_SPACE]; ++ return free_list_allocator_[OLD_SPACE]; + } + + BumpPointerAllocator &GetNewSpaceAllocator() + { +- return newSpaceAllocator_; ++ return new_space_allocator_; + } + + inline FreeListAllocator &GetNonMovableSpaceAllocator() + { +- return freeListAllocator_[NON_MOVABLE]; ++ return free_list_allocator_[NON_MOVABLE]; + } + + const BumpPointerAllocator &GetSnapShotSpaceAllocator() const + { +- return snapshotSpaceAllocator_; ++ return snapshot_space_allocator_; + } + + inline FreeListAllocator &GetMachineCodeSpaceAllocator() + { +- return freeListAllocator_[MACHINE_CODE_SPACE]; ++ return free_list_allocator_[MACHINE_CODE_SPACE]; + } + + private: + Heap *heap_ {nullptr}; +- mem::HeapManager *heapManager_; ++ mem::HeapManager *heap_manager_; + ManagedThread *thread_; +- BumpPointerAllocator newSpaceAllocator_; +- std::array freeListAllocator_; +- BumpPointerAllocator snapshotSpaceAllocator_; ++ BumpPointerAllocator new_space_allocator_; ++ std::array free_list_allocator_; ++ BumpPointerAllocator snapshot_space_allocator_; + }; + } // namespace panda::ecmascript + +diff --git a/runtime/mem/mix_space_collector.cpp b/runtime/mem/mix_space_collector.cpp +index e16095a..860ba0d 100644 +--- a/runtime/mem/mix_space_collector.cpp ++++ b/runtime/mem/mix_space_collector.cpp +@@ -31,7 +31,7 @@ + #include "plugins/ecmascript/runtime/vmstat/runtime_stat.h" + + namespace panda::ecmascript { +-MixSpaceCollector::MixSpaceCollector(Heap *heap) : heap_(heap), workList_(heap->GetWorkList()) {} ++MixSpaceCollector::MixSpaceCollector(Heap *heap) : heap_(heap), work_list_(heap->GetWorkList()) {} + + void MixSpaceCollector::RunPhases() + { +@@ -40,23 +40,23 @@ void MixSpaceCollector::RunPhases() + ClockScope clockScope; + + ECMA_BYTRACE_NAME(BYTRACE_TAG_ARK, "MixSpaceCollector::RunPhases"); +- concurrentMark_ = heap_->CheckConcurrentMark(thread); +- ECMA_GC_LOG() << "concurrentMark_" << concurrentMark_; ++ concurrent_mark_ = heap_->CheckConcurrentMark(thread); ++ ECMA_GC_LOG() << "concurrentMark_" << concurrent_mark_; + InitializePhase(); + MarkingPhase(); + EvacuaPhases(); + SweepPhases(); + heap_->GetEvacuation()->Finalize(); + FinishPhase(); +- heap_->GetEcmaVM()->GetEcmaGCStats()->StatisticOldCollector(clockScope.GetPauseTime(), freeSize_, +- oldSpaceCommitSize_, nonMoveSpaceCommitSize_); ++ heap_->GetEcmaVM()->GetEcmaGCStats()->StatisticOldCollector(clockScope.GetPauseTime(), free_size_, ++ old_space_commit_size_, non_move_space_commit_size_); + ECMA_GC_LOG() << "MixSpaceCollector::RunPhases " << clockScope.TotalSpentTime(); + } + + void MixSpaceCollector::InitializePhase() + { + ECMA_BYTRACE_NAME(BYTRACE_TAG_ARK, "MixSpaceCollector::InitializePhase"); +- if (!concurrentMark_) { ++ if (!concurrent_mark_) { + heap_->Prepare(); + if (!heap_->IsSemiMarkNeeded() && heap_->GetSweeper()->CanSelectCset()) { + const_cast(heap_->GetOldSpace())->SelectCSet(); +@@ -80,24 +80,24 @@ void MixSpaceCollector::InitializePhase() + } else { + heap_->EnumerateRegions([](Region *current) { current->ResetAliveObject(); }); + } +- workList_->Initialize(TriggerGCType::OLD_GC, ParallelGCTaskPhase::OLD_HANDLE_GLOBAL_POOL_TASK); ++ work_list_->Initialize(TriggerGCType::OLD_GC, ParallelGCTaskPhase::OLD_HANDLE_GLOBAL_POOL_TASK); + +- freeSize_ = 0; +- hugeSpaceFreeSize_ = 0; +- oldSpaceCommitSize_ = heap_->GetOldSpace()->GetCommittedSize(); +- nonMoveSpaceCommitSize_ = heap_->GetNonMovableSpace()->GetCommittedSize(); ++ free_size_ = 0; ++ huge_space_free_size_ = 0; ++ old_space_commit_size_ = heap_->GetOldSpace()->GetCommittedSize(); ++ non_move_space_commit_size_ = heap_->GetNonMovableSpace()->GetCommittedSize(); + } + } + + void MixSpaceCollector::FinishPhase() + { + ECMA_BYTRACE_NAME(BYTRACE_TAG_ARK, "MixSpaceCollector::FinishPhase"); +- if (concurrentMark_) { ++ if (concurrent_mark_) { + auto marker = heap_->GetConcurrentMarker(); + marker->Reset(false); + } else { + size_t aliveSize = 0; +- workList_->Finish(aliveSize); ++ work_list_->Finish(aliveSize); + heap_->EnumerateRegions([](Region *current) { current->ClearFlag(RegionFlags::IS_IN_PROMOTE_SET); }); + } + } +@@ -105,7 +105,7 @@ void MixSpaceCollector::FinishPhase() + void MixSpaceCollector::MarkingPhase() + { + ECMA_BYTRACE_NAME(BYTRACE_TAG_ARK, "MixSpaceCollector::MarkingPhase"); +- if (concurrentMark_) { ++ if (concurrent_mark_) { + [[maybe_unused]] ClockScope scope; + heap_->GetConcurrentMarker()->ReMarking(); + return; +diff --git a/runtime/mem/mix_space_collector.h b/runtime/mem/mix_space_collector.h +index 59031fe..a8bed14 100644 +--- a/runtime/mem/mix_space_collector.h ++++ b/runtime/mem/mix_space_collector.h +@@ -52,13 +52,13 @@ private: + void FinishPhase(); + + Heap *heap_; +- size_t freeSize_ {0}; +- size_t hugeSpaceFreeSize_ = 0; +- size_t oldSpaceCommitSize_ = 0; +- size_t nonMoveSpaceCommitSize_ = 0; +- bool concurrentMark_ {false}; ++ size_t free_size_ {0}; ++ size_t huge_space_free_size_ = 0; ++ size_t old_space_commit_size_ = 0; ++ size_t non_move_space_commit_size_ = 0; ++ bool concurrent_mark_ {false}; + // obtain from heap +- WorkerHelper *workList_ {nullptr}; ++ WorkerHelper *work_list_ {nullptr}; + + friend class WorkerHelper; + friend class Heap; +diff --git a/runtime/mem/object_xray-inl.h b/runtime/mem/object_xray-inl.h +index 004be24..ba12971 100644 +--- a/runtime/mem/object_xray-inl.h ++++ b/runtime/mem/object_xray-inl.h +@@ -66,8 +66,8 @@ + namespace panda::ecmascript { + void ObjectXRay::VisitVMRoots(const RootVisitor &visitor, const RootRangeVisitor &range_visitor) const + { +- ecmaVm_->Iterate(visitor); +- ecmaVm_->GetJSThread()->Iterate(visitor, range_visitor); ++ ecma_vm_->Iterate(visitor); ++ ecma_vm_->GetJSThread()->Iterate(visitor, range_visitor); + } + + template +diff --git a/runtime/mem/object_xray.h b/runtime/mem/object_xray.h +index 9fe7bc3..e4da2a6 100644 +--- a/runtime/mem/object_xray.h ++++ b/runtime/mem/object_xray.h +@@ -44,7 +44,7 @@ using WeakRootVisitor = std::function; + + class ObjectXRay { + public: +- explicit ObjectXRay(EcmaVM *ecmaVm) : ecmaVm_(ecmaVm) {} ++ explicit ObjectXRay(EcmaVM *ecmaVm) : ecma_vm_(ecmaVm) {} + ~ObjectXRay() = default; + + inline void VisitVMRoots(const RootVisitor &visitor, const RootRangeVisitor &range_visitor) const; +@@ -55,7 +55,7 @@ public: + DEFAULT_COPY_SEMANTIC(ObjectXRay); + + private: +- EcmaVM *ecmaVm_ {nullptr}; ++ EcmaVM *ecma_vm_ {nullptr}; + }; + } // namespace panda::ecmascript + +diff --git a/runtime/mem/parallel_evacuation-inl.h b/runtime/mem/parallel_evacuation-inl.h +index 5219e79..3268b4e 100644 +--- a/runtime/mem/parallel_evacuation-inl.h ++++ b/runtime/mem/parallel_evacuation-inl.h +@@ -93,19 +93,19 @@ void ParallelEvacuation::AddFragment(std::unique_ptr region) + void ParallelEvacuation::AddSweptRegionSafe(Region *region) + { + os::memory::LockHolder holder(mutex_); +- sweptList_.emplace_back(region); ++ swept_list_.emplace_back(region); + } + + void ParallelEvacuation::FillSweptRegion() + { +- while (!sweptList_.empty()) { +- Region *region = sweptList_.back(); +- sweptList_.pop_back(); ++ while (!swept_list_.empty()) { ++ Region *region = swept_list_.back(); ++ swept_list_.pop_back(); + region->EnumerateKinds([this](FreeObjectKind *kind) { + if (kind == nullptr || kind->Empty()) { + return; + } +- evacuationAllocator_->FillFreeList(kind); ++ evacuation_allocator_->FillFreeList(kind); + }); + } + } +diff --git a/runtime/mem/parallel_evacuation.cpp b/runtime/mem/parallel_evacuation.cpp +index 81e1da5..488730f 100644 +--- a/runtime/mem/parallel_evacuation.cpp ++++ b/runtime/mem/parallel_evacuation.cpp +@@ -28,15 +28,15 @@ + namespace panda::ecmascript { + void ParallelEvacuation::Initialize() + { +- evacuationAllocator_->Initialize(TriggerGCType::OLD_GC); ++ evacuation_allocator_->Initialize(TriggerGCType::OLD_GC); + allocator_ = new TlabAllocator(heap_, TriggerGCType::COMPRESS_FULL_GC); +- ageMark_ = heap_->GetFromSpace()->GetAgeMark(); ++ age_mark_ = heap_->GetFromSpace()->GetAgeMark(); + } + + void ParallelEvacuation::Finalize() + { + delete allocator_; +- evacuationAllocator_->Finalize(TriggerGCType::OLD_GC); ++ evacuation_allocator_->Finalize(TriggerGCType::OLD_GC); + } + + void ParallelEvacuation::Evacuate() +@@ -91,16 +91,16 @@ void ParallelEvacuation::EvacuateRegion(TlabAllocator *allocator, Region *region + bool ret = false; + if (isPromoted) { + if (region->InYoungGeneration()) { +- promotedAccumulatorSize_.fetch_add(region->AliveObject()); ++ promoted_accumulator_size_.fetch_add(region->AliveObject()); + } +- ret = evacuationAllocator_->AddRegionToOld(region); ++ ret = evacuation_allocator_->AddRegionToOld(region); + } else { +- ret = evacuationAllocator_->AddRegionToYoung(region); ++ ret = evacuation_allocator_->AddRegionToYoung(region); + if (!ret) { + if (region->InYoungGeneration()) { +- promotedAccumulatorSize_.fetch_add(region->AliveObject()); ++ promoted_accumulator_size_.fetch_add(region->AliveObject()); + } +- ret = evacuationAllocator_->AddRegionToOld(region); ++ ret = evacuation_allocator_->AddRegionToOld(region); + } + } + if (!ret) { +@@ -116,14 +116,14 @@ void ParallelEvacuation::EvacuateRegion(TlabAllocator *allocator, Region *region + auto size = klass->SizeFromJSHClass(header); + + uintptr_t address = 0; +- if (isPromoted || (region->HasAgeMark() && ToUintPtr(mem) < ageMark_)) { ++ if (isPromoted || (region->HasAgeMark() && ToUintPtr(mem) < age_mark_)) { + address = allocator->Allocate(size, SpaceAlloc::OLD_SPACE); +- promotedAccumulatorSize_.fetch_add(size); ++ promoted_accumulator_size_.fetch_add(size); + } else { + address = allocator->Allocate(size, SpaceAlloc::YOUNG_SPACE); + if (address == 0) { + address = allocator->Allocate(size, SpaceAlloc::OLD_SPACE); +- promotedAccumulatorSize_.fetch_add(size); ++ promoted_accumulator_size_.fetch_add(size); + } + } + LOG_IF(address == 0, FATAL, RUNTIME) << "Evacuate object failed:" << size; +@@ -145,7 +145,7 @@ void ParallelEvacuation::EvacuateRegion(TlabAllocator *allocator, Region *region + void ParallelEvacuation::VerifyHeapObject(TaggedObject *object) + { + auto klass = object->GetClass(); +- objXRay_.VisitObjectBody( ++ obj_x_ray_.VisitObjectBody( + object, klass, [&]([[maybe_unused]] TaggedObject *root, ObjectSlot start, ObjectSlot end) { + for (ObjectSlot slot = start; slot < end; slot++) { + JSTaggedValue value(slot.GetTaggedType()); +@@ -228,7 +228,7 @@ void ParallelEvacuation::UpdateRoot() + } + }; + +- objXRay_.VisitVMRoots(gcUpdateYoung, gcUpdateRangeYoung); ++ obj_x_ray_.VisitVMRoots(gcUpdateYoung, gcUpdateRangeYoung); + } + + void ParallelEvacuation::UpdateWeakReference() +@@ -319,7 +319,7 @@ void ParallelEvacuation::UpdateNewRegionReference(Region *region) + auto curPtr = region->GetBegin(); + uintptr_t endPtr; + if (region == current) { +- auto top = evacuationAllocator_->GetNewSpaceTop(); ++ auto top = evacuation_allocator_->GetNewSpaceTop(); + endPtr = curPtr + region->GetAllocatedBytes(top); + } else { + endPtr = curPtr + region->GetAllocatedBytes(); +@@ -395,7 +395,7 @@ void ParallelEvacuation::UpdateAndSweepCompressRegionReference(Region *region, b + + uintptr_t freeEnd = ToUintPtr(mem); + if (freeStart != freeEnd) { +- evacuationAllocator_->Free(freeStart, freeEnd, isMain); ++ evacuation_allocator_->Free(freeStart, freeEnd, isMain); + } + freeStart = freeEnd + klass->SizeFromJSHClass(header); + }); +@@ -403,7 +403,7 @@ void ParallelEvacuation::UpdateAndSweepCompressRegionReference(Region *region, b + uintptr_t freeEnd = region->GetEnd(); + CHECK_REGION_END(freeStart, freeEnd); + if (freeStart < freeEnd) { +- evacuationAllocator_->Free(freeStart, freeEnd, isMain); ++ evacuation_allocator_->Free(freeStart, freeEnd, isMain); + } + if (!isMain) { + AddSweptRegionSafe(region); +@@ -412,7 +412,7 @@ void ParallelEvacuation::UpdateAndSweepCompressRegionReference(Region *region, b + + void ParallelEvacuation::UpdateNewObjectField(TaggedObject *object, JSHClass *cls) + { +- objXRay_.VisitObjectBody( ++ obj_x_ray_.VisitObjectBody( + object, cls, [this]([[maybe_unused]] TaggedObject *root, ObjectSlot start, ObjectSlot end) { + for (ObjectSlot slot = start; slot < end; slot++) { + UpdateObjectSlot(slot); +@@ -422,7 +422,7 @@ void ParallelEvacuation::UpdateNewObjectField(TaggedObject *object, JSHClass *cl + + void ParallelEvacuation::UpdateCompressObjectField(Region *region, TaggedObject *object, JSHClass *cls) + { +- objXRay_.VisitObjectBody( ++ obj_x_ray_.VisitObjectBody( + object, cls, [this, region]([[maybe_unused]] TaggedObject *root, ObjectSlot start, ObjectSlot end) { + for (ObjectSlot slot = start; slot < end; slot++) { + if (UpdateObjectSlot(slot)) { +diff --git a/runtime/mem/parallel_evacuation.h b/runtime/mem/parallel_evacuation.h +index 7ac8170..e17f8a0 100644 +--- a/runtime/mem/parallel_evacuation.h ++++ b/runtime/mem/parallel_evacuation.h +@@ -35,7 +35,7 @@ class TlabAllocator; + class ParallelEvacuation { + public: + explicit ParallelEvacuation(Heap *heap) +- : heap_(heap), objXRay_(heap->GetEcmaVM()), evacuationAllocator_(heap_->GetEvacuationAllocator()) ++ : heap_(heap), obj_x_ray_(heap->GetEcmaVM()), evacuation_allocator_(heap_->GetEvacuationAllocator()) + { + } + ~ParallelEvacuation() = default; +@@ -45,7 +45,7 @@ public: + + size_t GetPromotedAccumulatorSize() const + { +- return promotedAccumulatorSize_; ++ return promoted_accumulator_size_; + } + + NO_COPY_SEMANTIC(ParallelEvacuation); +@@ -181,14 +181,14 @@ private: + + Heap *heap_; + TlabAllocator *allocator_ {nullptr}; +- ObjectXRay objXRay_; +- EvacuationAllocator *evacuationAllocator_; ++ ObjectXRay obj_x_ray_; ++ EvacuationAllocator *evacuation_allocator_; + +- uintptr_t ageMark_ {0}; ++ uintptr_t age_mark_ {0}; + std::vector> fragments_; +- std::vector sweptList_; ++ std::vector swept_list_; + std::atomic_int parallel_ = 0; +- std::atomic promotedAccumulatorSize_ = 0; ++ std::atomic promoted_accumulator_size_ = 0; + os::memory::Mutex mutex_; + os::memory::ConditionVariable condition_; + }; +diff --git a/runtime/mem/parallel_marker-inl.h b/runtime/mem/parallel_marker-inl.h +index 8ce6b1e..7501777 100644 +--- a/runtime/mem/parallel_marker-inl.h ++++ b/runtime/mem/parallel_marker-inl.h +@@ -271,7 +271,7 @@ inline SlotStatus SemiGcMarker::EvacuateObject(uint32_t threadId, TaggedObject * + inline bool SemiGcMarker::ShouldBePromoted(TaggedObject *object) + { + Region *region = Region::ObjectAddressToRange(object); +- return (region->BelowAgeMark() || (region->HasAgeMark() && ToUintPtr(object) < ageMark_)); ++ return (region->BelowAgeMark() || (region->HasAgeMark() && ToUintPtr(object) < age_mark_)); + } + + inline void SemiGcMarker::RecordWeakReference(uint32_t threadId, JSTaggedType *ref) +diff --git a/runtime/mem/parallel_marker.cpp b/runtime/mem/parallel_marker.cpp +index 928ed0a..43d8097 100644 +--- a/runtime/mem/parallel_marker.cpp ++++ b/runtime/mem/parallel_marker.cpp +@@ -20,13 +20,14 @@ + #ifndef __clang_analyzer__ + + namespace panda::ecmascript { +-Marker::Marker(Heap *heap) : heap_(heap), objXRay_(heap_->GetEcmaVM()) {} ++Marker::Marker(Heap *heap) : heap_(heap), obj_x_ray_(heap_->GetEcmaVM()) {} + + void Marker::MarkRoots(uint32_t threadId) + { +- objXRay_.VisitVMRoots(std::bind(&Marker::HandleRoots, this, threadId, std::placeholders::_1, std::placeholders::_2), +- std::bind(&Marker::HandleRangeRoots, this, threadId, std::placeholders::_1, +- std::placeholders::_2, std::placeholders::_3)); ++ obj_x_ray_.VisitVMRoots( ++ std::bind(&Marker::HandleRoots, this, threadId, std::placeholders::_1, std::placeholders::_2), ++ std::bind(&Marker::HandleRangeRoots, this, threadId, std::placeholders::_1, std::placeholders::_2, ++ std::placeholders::_3)); + heap_->GetWorkList()->PushWorkNodeToGlobal(threadId, false); + } + +@@ -65,16 +66,16 @@ void NonMovableMarker::ProcessMarkStack(uint32_t threadId) + + Region *objectRegion = Region::ObjectAddressToRange(obj); + bool needBarrier = !isOnlySemi && !objectRegion->InYoungAndCSetGeneration(); +- objXRay_.VisitObjectBody(obj, jsHclass, +- std::bind(&Marker::HandleObjectVisitor, this, threadId, objectRegion, +- needBarrier, std::placeholders::_1, std::placeholders::_2, +- std::placeholders::_3)); ++ obj_x_ray_.VisitObjectBody(obj, jsHclass, ++ std::bind(&Marker::HandleObjectVisitor, this, threadId, objectRegion, ++ needBarrier, std::placeholders::_1, std::placeholders::_2, ++ std::placeholders::_3)); + } + } + + void SemiGcMarker::Initialized() + { +- ageMark_ = heap_->GetNewSpace()->GetAgeMark(); ++ age_mark_ = heap_->GetNewSpace()->GetAgeMark(); + } + + void SemiGcMarker::ProcessMarkStack(uint32_t threadId) +@@ -90,10 +91,10 @@ void SemiGcMarker::ProcessMarkStack(uint32_t threadId) + auto jsHclass = obj->GetClass(); + Region *objectRegion = Region::ObjectAddressToRange(obj); + bool promoted = !objectRegion->InYoungGeneration(); +- objXRay_.VisitObjectBody(obj, jsHclass, +- std::bind(&Marker::HandleMoveObjectVisitor, this, threadId, promoted, +- std::placeholders::_1, std::placeholders::_2, +- std::placeholders::_3)); ++ obj_x_ray_.VisitObjectBody(obj, jsHclass, ++ std::bind(&Marker::HandleMoveObjectVisitor, this, threadId, ++ promoted, std::placeholders::_1, std::placeholders::_2, ++ std::placeholders::_3)); + } + } + +@@ -111,10 +112,10 @@ void CompressGcMarker::ProcessMarkStack(uint32_t threadId) + ObjectSlot objectSlot(ToUintPtr(obj)); + MarkObject(threadId, jsHclass, objectSlot); + +- objXRay_.VisitObjectBody(obj, jsHclass, +- std::bind(&Marker::HandleMoveObjectVisitor, this, threadId, false, +- std::placeholders::_1, std::placeholders::_2, +- std::placeholders::_3)); ++ obj_x_ray_.VisitObjectBody(obj, jsHclass, ++ std::bind(&Marker::HandleMoveObjectVisitor, this, threadId, false, ++ std::placeholders::_1, std::placeholders::_2, ++ std::placeholders::_3)); + } + } + } // namespace panda::ecmascript +diff --git a/runtime/mem/parallel_marker.h b/runtime/mem/parallel_marker.h +index f01b973..919e6b7 100644 +--- a/runtime/mem/parallel_marker.h ++++ b/runtime/mem/parallel_marker.h +@@ -77,8 +77,8 @@ protected: + LOG(FATAL, ECMASCRIPT) << "can not call this method"; + } + +- Heap *heap_; // NOLINT(misc-non-private-member-variables-in-classes) +- ObjectXRay objXRay_; // NOLINT(misc-non-private-member-variables-in-classes) ++ Heap *heap_; // NOLINT(misc-non-private-member-variables-in-classes) ++ ObjectXRay obj_x_ray_; // NOLINT(misc-non-private-member-variables-in-classes) + }; + + class NonMovableMarker : public Marker { +@@ -131,7 +131,7 @@ protected: + private: + inline bool ShouldBePromoted(TaggedObject *object); + +- uintptr_t ageMark_ {0}; ++ uintptr_t age_mark_ {0}; + }; + + class CompressGcMarker : public MovableMarker { +diff --git a/runtime/mem/parallel_work_helper.cpp b/runtime/mem/parallel_work_helper.cpp +index 7628f58..d75917b 100644 +--- a/runtime/mem/parallel_work_helper.cpp ++++ b/runtime/mem/parallel_work_helper.cpp +@@ -27,27 +27,27 @@ + + namespace panda::ecmascript { + WorkerHelper::WorkerHelper(Heap *heap, uint32_t threadNum) +- : heap_(heap), threadNum_(threadNum), markSpace_(0), spaceTop_(0), markSpaceEnd_(0) ++ : heap_(heap), thread_num_(threadNum), mark_space_(0), space_top_(0), mark_space_end_(0) + { +- for (uint32_t i = 0; i < threadNum_; i++) { +- continuousQueue_[i] = new ProcessQueue(heap); ++ for (uint32_t i = 0; i < thread_num_; i++) { ++ continuous_queue_[i] = new ProcessQueue(heap); + } +- markSpace_ = ToUintPtr(const_cast(heap_->GetRegionFactory())->AllocateBuffer(SPACE_SIZE)); ++ mark_space_ = ToUintPtr(const_cast(heap_->GetRegionFactory())->AllocateBuffer(SPACE_SIZE)); + } + + WorkerHelper::~WorkerHelper() + { +- for (uint32_t i = 0; i < threadNum_; i++) { +- continuousQueue_[i]->Destroy(); +- delete continuousQueue_[i]; +- continuousQueue_[i] = nullptr; ++ for (uint32_t i = 0; i < thread_num_; i++) { ++ continuous_queue_[i]->Destroy(); ++ delete continuous_queue_[i]; ++ continuous_queue_[i] = nullptr; + } +- const_cast(heap_->GetRegionFactory())->FreeBuffer(reinterpret_cast(markSpace_)); ++ const_cast(heap_->GetRegionFactory())->FreeBuffer(reinterpret_cast(mark_space_)); + } + + bool WorkerHelper::Push(uint32_t threadId, TaggedObject *object) + { +- WorkNode *&pushNode = workList_[threadId].pushNode_; ++ WorkNode *&pushNode = work_list_[threadId].push_node_; + if (!pushNode->Push(ToUintPtr(object))) { + PushWorkNodeToGlobal(threadId); + return pushNode->Push(ToUintPtr(object)); +@@ -68,20 +68,20 @@ bool WorkerHelper::Push(uint32_t threadId, TaggedObject *object, Region *region) + + void WorkerHelper::PushWorkNodeToGlobal(uint32_t threadId, bool postTask) + { +- WorkNode *&pushNode = workList_[threadId].pushNode_; ++ WorkNode *&pushNode = work_list_[threadId].push_node_; + if (!pushNode->IsEmpty()) { +- globalWork_.Push(pushNode); ++ global_work_.Push(pushNode); + pushNode = AllocalWorkNode(); + if (postTask && heap_->IsParallelGCEnabled() && heap_->CheckCanDistributeTask()) { +- heap_->PostParallelGCTask(parallelTask_); ++ heap_->PostParallelGCTask(parallel_task_); + } + } + } + + bool WorkerHelper::Pop(uint32_t threadId, TaggedObject **object) + { +- WorkNode *&popNode = workList_[threadId].popNode_; +- WorkNode *&pushNode = workList_[threadId].pushNode_; ++ WorkNode *&popNode = work_list_[threadId].pop_node_; ++ WorkNode *&pushNode = work_list_[threadId].push_node_; + if (!popNode->Pop(reinterpret_cast(object))) { + if (!pushNode->IsEmpty()) { + WorkNode *tmp = popNode; +@@ -97,51 +97,51 @@ bool WorkerHelper::Pop(uint32_t threadId, TaggedObject **object) + + bool WorkerHelper::PopWorkNodeFromGlobal(uint32_t threadId) + { +- return globalWork_.Pop(&workList_[threadId].popNode_); ++ return global_work_.Pop(&work_list_[threadId].pop_node_); + } + + void WorkerHelper::Finish(size_t &aliveSize) + { +- for (uint32_t i = 0; i < threadNum_; i++) { +- WorkNodeHolder &holder = workList_[i]; +- holder.weakQueue_->FinishMarking(continuousQueue_[i]); +- delete holder.weakQueue_; +- holder.weakQueue_ = nullptr; ++ for (uint32_t i = 0; i < thread_num_; i++) { ++ WorkNodeHolder &holder = work_list_[i]; ++ holder.weak_queue_->FinishMarking(continuous_queue_[i]); ++ delete holder.weak_queue_; ++ holder.weak_queue_ = nullptr; + delete holder.allocator_; + holder.allocator_ = nullptr; +- holder.waitUpdate_.clear(); +- aliveSize += holder.aliveSize_; ++ holder.wait_update_.clear(); ++ aliveSize += holder.alive_size_; + } + +- while (!unuseSpace_.empty()) { ++ while (!unuse_space_.empty()) { + const_cast(heap_->GetRegionFactory()) +- ->FreeBuffer(reinterpret_cast(unuseSpace_.back())); +- unuseSpace_.pop_back(); ++ ->FreeBuffer(reinterpret_cast(unuse_space_.back())); ++ unuse_space_.pop_back(); + } + } + + void WorkerHelper::Finish(size_t &aliveSize, size_t &promoteSize) + { + Finish(aliveSize); +- for (uint32_t i = 0; i < threadNum_; i++) { +- WorkNodeHolder &holder = workList_[i]; +- promoteSize += holder.aliveSize_; ++ for (uint32_t i = 0; i < thread_num_; i++) { ++ WorkNodeHolder &holder = work_list_[i]; ++ promoteSize += holder.alive_size_; + } + } + + void WorkerHelper::Initialize(TriggerGCType gcType, ParallelGCTaskPhase parallelTask) + { +- parallelTask_ = parallelTask; +- spaceTop_ = markSpace_; +- markSpaceEnd_ = markSpace_ + SPACE_SIZE; +- for (uint32_t i = 0; i < threadNum_; i++) { +- WorkNodeHolder &holder = workList_[i]; +- holder.pushNode_ = AllocalWorkNode(); +- holder.popNode_ = AllocalWorkNode(); +- holder.weakQueue_ = new ProcessQueue(); +- holder.weakQueue_->BeginMarking(heap_, continuousQueue_[i]); +- holder.aliveSize_ = 0; +- holder.promoteSize_ = 0; ++ parallel_task_ = parallelTask; ++ space_top_ = mark_space_; ++ mark_space_end_ = mark_space_ + SPACE_SIZE; ++ for (uint32_t i = 0; i < thread_num_; i++) { ++ WorkNodeHolder &holder = work_list_[i]; ++ holder.push_node_ = AllocalWorkNode(); ++ holder.pop_node_ = AllocalWorkNode(); ++ holder.weak_queue_ = new ProcessQueue(); ++ holder.weak_queue_->BeginMarking(heap_, continuous_queue_[i]); ++ holder.alive_size_ = 0; ++ holder.promote_size_ = 0; + if (gcType == TriggerGCType::SEMI_GC) { + holder.allocator_ = new TlabAllocator(heap_, TriggerGCType::SEMI_GC); + } else if (gcType == TriggerGCType::COMPRESS_FULL_GC) { +@@ -154,21 +154,21 @@ WorkNode *WorkerHelper::AllocalWorkNode() + { + size_t totalSize = sizeof(WorkNode) + sizeof(Stack) + STACK_AREA_SIZE; + // CAS +- volatile auto atomicField = reinterpret_cast *>(&spaceTop_); ++ volatile auto atomicField = reinterpret_cast *>(&space_top_); + bool result = false; + uintptr_t begin = 0; + do { + begin = atomicField->load(std::memory_order_acquire); +- if (begin + totalSize >= markSpaceEnd_) { ++ if (begin + totalSize >= mark_space_end_) { + os::memory::LockHolder lock(mtx_); + begin = atomicField->load(std::memory_order_acquire); +- if (begin + totalSize >= markSpaceEnd_) { +- unuseSpace_.emplace_back(markSpace_); +- markSpace_ = ++ if (begin + totalSize >= mark_space_end_) { ++ unuse_space_.emplace_back(mark_space_); ++ mark_space_ = + ToUintPtr(const_cast(heap_->GetRegionFactory())->AllocateBuffer(SPACE_SIZE)); +- spaceTop_ = markSpace_; +- markSpaceEnd_ = markSpace_ + SPACE_SIZE; +- begin = spaceTop_; ++ space_top_ = mark_space_; ++ mark_space_end_ = mark_space_ + SPACE_SIZE; ++ begin = space_top_; + } + } + result = std::atomic_compare_exchange_strong_explicit(atomicField, &begin, begin + totalSize, +diff --git a/runtime/mem/parallel_work_helper.h b/runtime/mem/parallel_work_helper.h +index f685421..e8c431f 100644 +--- a/runtime/mem/parallel_work_helper.h ++++ b/runtime/mem/parallel_work_helper.h +@@ -129,13 +129,13 @@ private: + }; + + struct WorkNodeHolder { +- WorkNode *pushNode_ {nullptr}; +- WorkNode *popNode_ {nullptr}; +- ProcessQueue *weakQueue_ {nullptr}; +- std::vector waitUpdate_; ++ WorkNode *push_node_ {nullptr}; ++ WorkNode *pop_node_ {nullptr}; ++ ProcessQueue *weak_queue_ {nullptr}; ++ std::vector wait_update_; + TlabAllocator *allocator_ {nullptr}; +- size_t aliveSize_ = 0; +- size_t promoteSize_ = 0; ++ size_t alive_size_ = 0; ++ size_t promote_size_ = 0; + }; + + class WorkerHelper final { +@@ -157,37 +157,37 @@ public: + + inline void PushWeakReference(uint32_t threadId, JSTaggedType *weak) + { +- workList_[threadId].weakQueue_->PushBack(weak); ++ work_list_[threadId].weak_queue_->PushBack(weak); + } + + inline void AddAliveSize(uint32_t threadId, size_t size) + { +- workList_[threadId].aliveSize_ += size; ++ work_list_[threadId].alive_size_ += size; + } + + inline void AddPromoteSize(uint32_t threadId, size_t size) + { +- workList_[threadId].promoteSize_ += size; ++ work_list_[threadId].promote_size_ += size; + } + + inline ProcessQueue *GetWeakReferenceQueue(uint32_t threadId) const + { +- return workList_[threadId].weakQueue_; ++ return work_list_[threadId].weak_queue_; + } + + inline TlabAllocator *GetTlabAllocator(uint32_t threadId) const + { +- return workList_[threadId].allocator_; ++ return work_list_[threadId].allocator_; + } + + inline void PushWaitUpdateSlot(uint32_t threadId, SlotNeedUpdate slot) + { +- workList_[threadId].waitUpdate_.emplace_back(slot); ++ work_list_[threadId].wait_update_.emplace_back(slot); + } + + inline bool GetSlotNeedUpdate(uint32_t threadId, SlotNeedUpdate *slot) + { +- std::vector &waitUpdate = workList_[threadId].waitUpdate_; ++ std::vector &waitUpdate = work_list_[threadId].wait_update_; + if (waitUpdate.empty()) { + return false; + } +@@ -203,16 +203,16 @@ private: + WorkNode *AllocalWorkNode(); + + Heap *heap_; +- uint32_t threadNum_; +- std::array workList_; +- std::array *, MAX_PLATFORM_THREAD_NUM + 1> continuousQueue_ {}; +- GlobalWorkList globalWork_; +- uintptr_t markSpace_; +- uintptr_t spaceTop_; +- uintptr_t markSpaceEnd_; +- std::vector unuseSpace_; ++ uint32_t thread_num_; ++ std::array work_list_; ++ std::array *, MAX_PLATFORM_THREAD_NUM + 1> continuous_queue_ {}; ++ GlobalWorkList global_work_; ++ uintptr_t mark_space_; ++ uintptr_t space_top_; ++ uintptr_t mark_space_end_; ++ std::vector unuse_space_; + os::memory::Mutex mtx_; +- ParallelGCTaskPhase parallelTask_ {}; ++ ParallelGCTaskPhase parallel_task_ {}; + }; + } // namespace panda::ecmascript + #endif // ECMASCRIPT_MEM_PARALLEL_WORK_HELPER_H +diff --git a/runtime/mem/region-inl.h b/runtime/mem/region-inl.h +index cdcbca4..3773577 100644 +--- a/runtime/mem/region-inl.h ++++ b/runtime/mem/region-inl.h +@@ -32,13 +32,13 @@ inline void Region::SetSpace(Space *space) + + inline RangeBitmap *Region::GetOrCreateMarkBitmap() + { +- if (UNLIKELY(markBitmap_ == nullptr)) { ++ if (UNLIKELY(mark_bitmap_ == nullptr)) { + os::memory::LockHolder lock(lock_); +- if (markBitmap_ == nullptr) { +- markBitmap_ = CreateMarkBitmap(); ++ if (mark_bitmap_ == nullptr) { ++ mark_bitmap_ = CreateMarkBitmap(); + } + } +- return markBitmap_; ++ return mark_bitmap_; + } + + RangeBitmap *Region::CreateMarkBitmap() +@@ -66,24 +66,24 @@ RememberedSet *Region::CreateRememberedSet() + + RememberedSet *Region::GetOrCreateCrossRegionRememberedSet() + { +- if (UNLIKELY(crossRegionSet_ == nullptr)) { ++ if (UNLIKELY(cross_region_set_ == nullptr)) { + os::memory::LockHolder lock(lock_); +- if (crossRegionSet_ == nullptr) { +- crossRegionSet_ = CreateRememberedSet(); ++ if (cross_region_set_ == nullptr) { ++ cross_region_set_ = CreateRememberedSet(); + } + } +- return crossRegionSet_; ++ return cross_region_set_; + } + + RememberedSet *Region::GetOrCreateOldToNewRememberedSet() + { +- if (UNLIKELY(oldToNewSet_ == nullptr)) { ++ if (UNLIKELY(old_to_new_set_ == nullptr)) { + os::memory::LockHolder lock(lock_); +- if (oldToNewSet_ == nullptr) { +- oldToNewSet_ = CreateRememberedSet(); ++ if (old_to_new_set_ == nullptr) { ++ old_to_new_set_ = CreateRememberedSet(); + } + } +- return oldToNewSet_; ++ return old_to_new_set_; + } + + void Region::InsertCrossRegionRememberedSet(uintptr_t addr) +@@ -117,31 +117,31 @@ void Region::AtomicInsertOldToNewRememberedSet(uintptr_t addr) + + void Region::ClearMarkBitmap() + { +- if (markBitmap_ != nullptr) { ++ if (mark_bitmap_ != nullptr) { + auto size = RangeBitmap::GetBitMapSizeInByte(GetCapacity()); +- const_cast(heap_->GetRegionFactory())->Free(markBitmap_->GetBitMap().Data(), size); +- delete markBitmap_; +- markBitmap_ = nullptr; ++ const_cast(heap_->GetRegionFactory())->Free(mark_bitmap_->GetBitMap().Data(), size); ++ delete mark_bitmap_; ++ mark_bitmap_ = nullptr; + } + } + + void Region::ClearCrossRegionRememberedSet() + { +- if (crossRegionSet_ != nullptr) { ++ if (cross_region_set_ != nullptr) { + auto size = RememberedSet::GetSizeInByte(GetCapacity()); +- const_cast(heap_->GetRegionFactory())->Free(crossRegionSet_->GetBitMap().Data(), size); +- delete crossRegionSet_; +- crossRegionSet_ = nullptr; ++ const_cast(heap_->GetRegionFactory())->Free(cross_region_set_->GetBitMap().Data(), size); ++ delete cross_region_set_; ++ cross_region_set_ = nullptr; + } + } + + void Region::ClearOldToNewRememberedSet() + { +- if (oldToNewSet_ != nullptr) { ++ if (old_to_new_set_ != nullptr) { + auto size = RememberedSet::GetSizeInByte(GetCapacity()); +- const_cast(heap_->GetRegionFactory())->Free(oldToNewSet_->GetBitMap().Data(), size); +- delete oldToNewSet_; +- oldToNewSet_ = nullptr; ++ const_cast(heap_->GetRegionFactory())->Free(old_to_new_set_->GetBitMap().Data(), size); ++ delete old_to_new_set_; ++ old_to_new_set_ = nullptr; + } + } + } // namespace panda::ecmascript +diff --git a/runtime/mem/region.h b/runtime/mem/region.h +index fe956ee..4a0ba7f 100644 +--- a/runtime/mem/region.h ++++ b/runtime/mem/region.h +@@ -50,12 +50,12 @@ public: + Region(Space *space, Heap *heap, uintptr_t allocateBase, uintptr_t begin, uintptr_t end) + : space_(space), + heap_(heap), +- allocateBase_(allocateBase), ++ allocate_base_(allocateBase), + // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) + begin_(begin), + end_(end), +- highWaterMark_(end), +- aliveObject_(0) ++ high_water_mark_(end), ++ alive_object_(0) + { + } + ~Region() = default; +@@ -65,7 +65,7 @@ public: + void Reset() + { + flags_ = 0; +- highWaterMark_ = end_; ++ high_water_mark_ = end_; + memset_s(reinterpret_cast(begin_), GetSize(), 0, GetSize()); + } + +@@ -139,17 +139,17 @@ public: + + RangeBitmap *GetMarkBitmap() + { +- return markBitmap_; ++ return mark_bitmap_; + } + + RememberedSet *GetCrossRegionRememberedSet() + { +- return crossRegionSet_; ++ return cross_region_set_; + } + + RememberedSet *GetOldToNewRememberedSet() + { +- return oldToNewSet_; ++ return old_to_new_set_; + } + + static Region *ObjectAddressToRange(TaggedObject *obj) +@@ -222,25 +222,25 @@ public: + + uintptr_t GetAllocateBase() const + { +- return allocateBase_; ++ return allocate_base_; + } + + size_t GetAllocatedBytes(uintptr_t top = 0) + { + ASSERT(top == 0 || InRange(top)); +- return (top == 0) ? (highWaterMark_ - begin_) : (top - begin_); ++ return (top == 0) ? (high_water_mark_ - begin_) : (top - begin_); + } + + void SetHighWaterMark(uintptr_t mark) + { + ASSERT(InRange(mark)); +- highWaterMark_ = mark; ++ high_water_mark_ = mark; + } + + int SetCodeExecutableAndReadable() + { + // NOLINTNEXTLINE(hicpp-signed-bitwise) +- int res = mprotect(reinterpret_cast(allocateBase_), GetCapacity(), PROT_EXEC | PROT_READ | PROT_WRITE); ++ int res = mprotect(reinterpret_cast(allocate_base_), GetCapacity(), PROT_EXEC | PROT_READ | PROT_WRITE); + return res; + } + +@@ -298,32 +298,32 @@ public: + + void IncrementAliveObject(size_t size) + { +- aliveObject_ += size; ++ alive_object_ += size; + } + + void DecreaseAliveObject(size_t size) + { +- aliveObject_ -= size; ++ alive_object_ -= size; + } + + void SetAliveObject(size_t size) + { +- aliveObject_ = size; ++ alive_object_ = size; + } + + void ResetAliveObject() + { +- aliveObject_ = 0; ++ alive_object_ = 0; + } + + size_t AliveObject() const + { +- return aliveObject_; ++ return alive_object_; + } + + bool MostObjectAlive() const + { +- return aliveObject_ > MOST_OBJECT_ALIVE_THRESHOLD_PERCENT * GetSize(); ++ return alive_object_ > MOST_OBJECT_ALIVE_THRESHOLD_PERCENT * GetSize(); + } + + private: +@@ -331,17 +331,17 @@ private: + Space *space_; + Heap *heap_; + uintptr_t flags_ {0}; // Memory alignment, only low 32bits are used now +- uintptr_t allocateBase_; ++ uintptr_t allocate_base_; + uintptr_t begin_; + uintptr_t end_; +- uintptr_t highWaterMark_; ++ uintptr_t high_water_mark_; + bool marking_ {false}; +- std::atomic_size_t aliveObject_ {0}; ++ std::atomic_size_t alive_object_ {0}; + Region *next_ {nullptr}; + Region *prev_ {nullptr}; +- RangeBitmap *markBitmap_ {nullptr}; +- RememberedSet *crossRegionSet_ {nullptr}; +- RememberedSet *oldToNewSet_ {nullptr}; ++ RangeBitmap *mark_bitmap_ {nullptr}; ++ RememberedSet *cross_region_set_ {nullptr}; ++ RememberedSet *old_to_new_set_ {nullptr}; + Span kinds_; + os::memory::Mutex lock_; + friend class SnapShot; +diff --git a/runtime/mem/region_factory.cpp b/runtime/mem/region_factory.cpp +index d5ceff4..4eb9071 100644 +--- a/runtime/mem/region_factory.cpp ++++ b/runtime/mem/region_factory.cpp +@@ -41,7 +41,7 @@ Region *RegionFactory::AllocateAlignedRegion(Space *space, size_t capacity) + memset_s(mapMem, commitSize, 0, commitSize); + #endif + if (mapMem == nullptr) { +- LOG_ECMA_MEM(FATAL) << "pool is empty " << annoMemoryUsage_.load(std::memory_order_relaxed); ++ LOG_ECMA_MEM(FATAL) << "pool is empty " << anno_memory_usage_.load(std::memory_order_relaxed); + UNREACHABLE(); + } + IncreaseAnnoMemoryUsage(capacity); +@@ -74,9 +74,9 @@ Area *RegionFactory::AllocateArea(size_t capacity) + LOG_ECMA_MEM(FATAL) << "capacity must have a size not less than sizeof Area."; + UNREACHABLE(); + } +- if (cachedArea_ != nullptr && capacity <= cachedArea_->GetSize()) { +- auto result = cachedArea_; +- cachedArea_ = nullptr; ++ if (cached_area_ != nullptr && capacity <= cached_area_->GetSize()) { ++ auto result = cached_area_; ++ cached_area_ = nullptr; + return result; + } + // NOLINTNEXTLINE(cppcoreguidelines-no-malloc) +@@ -100,8 +100,8 @@ void RegionFactory::FreeArea(Area *area) + if (area == nullptr) { + return; + } +- if (cachedArea_ == nullptr && area->GetSize() <= MAX_CACHED_CHUNK_AREA_SIZE) { +- cachedArea_ = area; ++ if (cached_area_ == nullptr && area->GetSize() <= MAX_CACHED_CHUNK_AREA_SIZE) { ++ cached_area_ = area; + return; + } + auto size = area->GetSize() + sizeof(Area); +diff --git a/runtime/mem/region_factory.h b/runtime/mem/region_factory.h +index 2718197..f8c02b6 100644 +--- a/runtime/mem/region_factory.h ++++ b/runtime/mem/region_factory.h +@@ -32,9 +32,9 @@ public: + RegionFactory() = default; + virtual ~RegionFactory() + { +- if (cachedArea_ != nullptr) { +- FreeArea(cachedArea_); +- cachedArea_ = nullptr; ++ if (cached_area_ != nullptr) { ++ FreeArea(cached_area_); ++ cached_area_ = nullptr; + } + } + +@@ -75,48 +75,50 @@ public: + + void IncreaseAnnoMemoryUsage(size_t bytes) + { +- size_t current = annoMemoryUsage_.fetch_add(bytes, std::memory_order_relaxed) + bytes; +- size_t max = maxAnnoMemoryUsage_.load(std::memory_order_relaxed); +- while (current > max && !maxAnnoMemoryUsage_.compare_exchange_weak(max, current, std::memory_order_relaxed)) { ++ size_t current = anno_memory_usage_.fetch_add(bytes, std::memory_order_relaxed) + bytes; ++ size_t max = max_anno_memory_usage_.load(std::memory_order_relaxed); ++ while (current > max && ++ !max_anno_memory_usage_.compare_exchange_weak(max, current, std::memory_order_relaxed)) { + } + } + + void DecreaseAnnoMemoryUsage(size_t bytes) + { +- annoMemoryUsage_.fetch_sub(bytes, std::memory_order_relaxed); ++ anno_memory_usage_.fetch_sub(bytes, std::memory_order_relaxed); + } + + size_t GetAnnoMemoryUsage() const + { +- return annoMemoryUsage_.load(std::memory_order_relaxed); ++ return anno_memory_usage_.load(std::memory_order_relaxed); + } + + size_t GetMaxAnnoMemoryUsage() const + { +- return maxAnnoMemoryUsage_.load(std::memory_order_relaxed); ++ return max_anno_memory_usage_.load(std::memory_order_relaxed); + } + + void IncreaseNativeMemoryUsage(size_t bytes) + { +- size_t current = nativeMemoryUsage_.fetch_add(bytes, std::memory_order_relaxed) + bytes; +- size_t max = maxNativeMemoryUsage_.load(std::memory_order_relaxed); +- while (current > max && !maxNativeMemoryUsage_.compare_exchange_weak(max, current, std::memory_order_relaxed)) { ++ size_t current = native_memory_usage_.fetch_add(bytes, std::memory_order_relaxed) + bytes; ++ size_t max = max_native_memory_usage_.load(std::memory_order_relaxed); ++ while (current > max && ++ !max_native_memory_usage_.compare_exchange_weak(max, current, std::memory_order_relaxed)) { + } + } + + void DecreaseNativeMemoryUsage(size_t bytes) + { +- nativeMemoryUsage_.fetch_sub(bytes, std::memory_order_relaxed); ++ native_memory_usage_.fetch_sub(bytes, std::memory_order_relaxed); + } + + size_t GetNativeMemoryUsage() const + { +- return nativeMemoryUsage_.load(std::memory_order_relaxed); ++ return native_memory_usage_.load(std::memory_order_relaxed); + } + + size_t GetMaxNativeMemoryUsage() const + { +- return maxNativeMemoryUsage_.load(std::memory_order_relaxed); ++ return max_native_memory_usage_.load(std::memory_order_relaxed); + } + + void *Allocate(size_t size) +@@ -170,11 +172,11 @@ private: + #if ECMASCRIPT_ENABLE_ZAP_MEM + static constexpr int INVALID_VALUE = 0x7; + #endif +- Area *cachedArea_ {nullptr}; +- std::atomic annoMemoryUsage_ {0}; +- std::atomic maxAnnoMemoryUsage_ {0}; +- std::atomic nativeMemoryUsage_ {0}; +- std::atomic maxNativeMemoryUsage_ {0}; ++ Area *cached_area_ {nullptr}; ++ std::atomic anno_memory_usage_ {0}; ++ std::atomic max_anno_memory_usage_ {0}; ++ std::atomic native_memory_usage_ {0}; ++ std::atomic max_native_memory_usage_ {0}; + }; + } // namespace panda::ecmascript + +diff --git a/runtime/mem/semi_space_collector.cpp b/runtime/mem/semi_space_collector.cpp +index acc7d29..c6d987d 100644 +--- a/runtime/mem/semi_space_collector.cpp ++++ b/runtime/mem/semi_space_collector.cpp +@@ -31,7 +31,7 @@ + + namespace panda::ecmascript { + SemiSpaceCollector::SemiSpaceCollector(Heap *heap, bool paralledGc) +- : heap_(heap), paralledGc_(paralledGc), workList_(heap->GetWorkList()) ++ : heap_(heap), paralled_gc_(paralledGc), work_list_(heap->GetWorkList()) + { + } + +@@ -51,8 +51,8 @@ void SemiSpaceCollector::RunPhases() + ParallelMarkingPhase(); + SweepPhases(); + FinishPhase(); +- heap_->GetEcmaVM()->GetEcmaGCStats()->StatisticSemiCollector(clockScope.GetPauseTime(), semiCopiedSize_, +- promotedSize_, commitSize_); ++ heap_->GetEcmaVM()->GetEcmaGCStats()->StatisticSemiCollector(clockScope.GetPauseTime(), semi_copied_size_, ++ promoted_size_, commit_size_); + ECMA_GC_LOG() << "SemiSpaceCollector::RunPhases " << clockScope.TotalSpentTime(); + } + +@@ -60,12 +60,12 @@ void SemiSpaceCollector::InitializePhase() + { + ECMA_BYTRACE_NAME(BYTRACE_TAG_ARK, "SemiSpaceCollector::InitializePhase"); + heap_->Prepare(); +- workList_->Initialize(TriggerGCType::SEMI_GC, ParallelGCTaskPhase::SEMI_HANDLE_GLOBAL_POOL_TASK); ++ work_list_->Initialize(TriggerGCType::SEMI_GC, ParallelGCTaskPhase::SEMI_HANDLE_GLOBAL_POOL_TASK); + heap_->GetSemiGcMarker()->Initialized(); + heap_->GetEvacuationAllocator()->Initialize(TriggerGCType::SEMI_GC); +- promotedSize_ = 0; +- semiCopiedSize_ = 0; +- commitSize_ = heap_->GetFromSpace()->GetCommittedSize(); ++ promoted_size_ = 0; ++ semi_copied_size_ = 0; ++ commit_size_ = heap_->GetFromSpace()->GetCommittedSize(); + } + + void SemiSpaceCollector::ParallelMarkingPhase() +@@ -73,7 +73,7 @@ void SemiSpaceCollector::ParallelMarkingPhase() + ECMA_BYTRACE_NAME(BYTRACE_TAG_ARK, "SemiSpaceCollector::ParallelMarkingPhase"); + auto region = heap_->GetOldSpace()->GetCurrentRegion(); + +- if (paralledGc_) { ++ if (paralled_gc_) { + heap_->PostParallelGCTask(ParallelGCTaskPhase::SEMI_HANDLE_THREAD_ROOTS_TASK); + heap_->PostParallelGCTask(ParallelGCTaskPhase::SEMI_HANDLE_SNAPSHOT_TASK); + heap_->GetSemiGcMarker()->ProcessOldToNew(0, region); +@@ -88,7 +88,7 @@ void SemiSpaceCollector::ParallelMarkingPhase() + auto totalThreadCount = Platform::GetCurrentPlatform()->GetTotalThreadNum() + 1; // gc thread and main thread + for (uint32_t i = 0; i < totalThreadCount; i++) { + SlotNeedUpdate needUpdate(nullptr, ObjectSlot(0)); +- while (workList_->GetSlotNeedUpdate(i, &needUpdate)) { ++ while (work_list_->GetSlotNeedUpdate(i, &needUpdate)) { + UpdatePromotedSlot(needUpdate.first, needUpdate.second); + } + } +@@ -99,7 +99,7 @@ void SemiSpaceCollector::SweepPhases() + ECMA_BYTRACE_NAME(BYTRACE_TAG_ARK, "SemiSpaceCollector::SweepPhases"); + auto totalThreadCount = Platform::GetCurrentPlatform()->GetTotalThreadNum() + 1; // gc thread and main thread + for (uint32_t i = 0; i < totalThreadCount; i++) { +- ProcessQueue *queue = workList_->GetWeakReferenceQueue(i); ++ ProcessQueue *queue = work_list_->GetWeakReferenceQueue(i); + while (true) { + auto obj = queue->PopBack(); + if (UNLIKELY(obj == nullptr)) { +@@ -142,7 +142,7 @@ void SemiSpaceCollector::SweepPhases() + void SemiSpaceCollector::FinishPhase() + { + ECMA_BYTRACE_NAME(BYTRACE_TAG_ARK, "SemiSpaceCollector::FinishPhase"); +- workList_->Finish(semiCopiedSize_, promotedSize_); ++ work_list_->Finish(semi_copied_size_, promoted_size_); + heap_->GetEvacuationAllocator()->Finalize(TriggerGCType::SEMI_GC); + } + } // namespace panda::ecmascript +diff --git a/runtime/mem/semi_space_collector.h b/runtime/mem/semi_space_collector.h +index 1c127ff..4494d57 100644 +--- a/runtime/mem/semi_space_collector.h ++++ b/runtime/mem/semi_space_collector.h +@@ -61,13 +61,13 @@ private: + inline void UpdatePromotedSlot(TaggedObject *object, ObjectSlot slot); + + Heap *heap_; +- size_t promotedSize_ {0}; +- size_t semiCopiedSize_ {0}; +- size_t commitSize_ = 0; ++ size_t promoted_size_ {0}; ++ size_t semi_copied_size_ {0}; ++ size_t commit_size_ = 0; + + // obtain from heap +- bool paralledGc_ {false}; +- WorkerHelper *workList_ {nullptr}; ++ bool paralled_gc_ {false}; ++ WorkerHelper *work_list_ {nullptr}; + + friend class TlabAllocator; + friend class WorkerHelper; +diff --git a/runtime/mem/slots.h b/runtime/mem/slots.h +index a2d3c37..9e705b9 100644 +--- a/runtime/mem/slots.h ++++ b/runtime/mem/slots.h +@@ -22,7 +22,7 @@ + namespace panda::ecmascript { + class ObjectSlot { + public: +- explicit ObjectSlot(uintptr_t slotAddr) : slotAddress_(slotAddr) {} ++ explicit ObjectSlot(uintptr_t slotAddr) : slot_address_(slotAddr) {} + ~ObjectSlot() = default; + + DEFAULT_COPY_SEMANTIC(ObjectSlot); +@@ -36,7 +36,7 @@ public: + void Update(JSTaggedType value) + { + // NOLINTNEXTLINE(clang-analyzer-core.NullDereference) +- *reinterpret_cast(slotAddress_) = value; ++ *reinterpret_cast(slot_address_) = value; + } + + TaggedObject *GetTaggedObjectHeader() const +@@ -47,12 +47,12 @@ public: + JSTaggedType GetTaggedType() const + { + // NOLINTNEXTLINE(clang-analyzer-core.NullDereference) +- return *reinterpret_cast(slotAddress_); ++ return *reinterpret_cast(slot_address_); + } + + ObjectSlot &operator++() + { +- slotAddress_ += sizeof(JSTaggedType); ++ slot_address_ += sizeof(JSTaggedType); + return *this; + } + +@@ -60,42 +60,42 @@ public: + ObjectSlot operator++(int) + { + ObjectSlot ret = *this; +- slotAddress_ += sizeof(JSTaggedType); ++ slot_address_ += sizeof(JSTaggedType); + return ret; + } + + uintptr_t SlotAddress() const + { +- return slotAddress_; ++ return slot_address_; + } + + bool operator<(const ObjectSlot &other) const + { +- return slotAddress_ < other.slotAddress_; ++ return slot_address_ < other.slot_address_; + } + bool operator<=(const ObjectSlot &other) const + { +- return slotAddress_ <= other.slotAddress_; ++ return slot_address_ <= other.slot_address_; + } + bool operator>(const ObjectSlot &other) const + { +- return slotAddress_ > other.slotAddress_; ++ return slot_address_ > other.slot_address_; + } + bool operator>=(const ObjectSlot &other) const + { +- return slotAddress_ >= other.slotAddress_; ++ return slot_address_ >= other.slot_address_; + } + bool operator==(const ObjectSlot &other) const + { +- return slotAddress_ == other.slotAddress_; ++ return slot_address_ == other.slot_address_; + } + bool operator!=(const ObjectSlot &other) const + { +- return slotAddress_ != other.slotAddress_; ++ return slot_address_ != other.slot_address_; + } + + private: +- uintptr_t slotAddress_; ++ uintptr_t slot_address_; + }; + } // namespace panda::ecmascript + +diff --git a/runtime/mem/space-inl.h b/runtime/mem/space-inl.h +index 0686444..3f68255 100644 +--- a/runtime/mem/space-inl.h ++++ b/runtime/mem/space-inl.h +@@ -22,9 +22,9 @@ namespace panda::ecmascript { + template + void Space::EnumerateRegions(const Callback &cb, Region *end) const + { +- Region *current = regionList_.GetFirst(); ++ Region *current = region_list_.GetFirst(); + if (end == nullptr) { +- end = regionList_.GetLast(); ++ end = region_list_.GetLast(); + } + while (current != end) { + auto next = current->GetNext(); +@@ -40,7 +40,7 @@ void Space::EnumerateRegions(const Callback &cb, Region *end) const + template + void OldSpace::EnumerateCollectRegionSet(const Callback &cb) const + { +- for (Region *current : collectRegionSet_) { ++ for (Region *current : collect_region_set_) { + if (current != nullptr) { + ASSERT(current->InCollectSet()); + cb(current); +diff --git a/runtime/mem/space.cpp b/runtime/mem/space.cpp +index 5dd04f6..9e284cd 100644 +--- a/runtime/mem/space.cpp ++++ b/runtime/mem/space.cpp +@@ -28,57 +28,57 @@ Space::Space(Heap *heap, MemSpaceType spaceType, size_t initialCapacity, size_t + : heap_(heap), + vm_(heap_->GetEcmaVM()), + thread_(vm_->GetJSThread()), +- regionFactory_(vm_->GetRegionFactory()), +- spaceType_(spaceType), +- initialCapacity_(initialCapacity), +- maximumCapacity_(maximumCapacity) ++ region_factory_(vm_->GetRegionFactory()), ++ space_type_(spaceType), ++ initial_capacity_(initialCapacity), ++ maximum_capacity_(maximumCapacity) + { + } + + void Space::AddRegion(Region *region) + { +- LOG_ECMA_MEM(DEBUG) << "Add region:" << region << " to " << ToSpaceTypeName(spaceType_); +- regionList_.AddNode(region); ++ LOG_ECMA_MEM(DEBUG) << "Add region:" << region << " to " << ToSpaceTypeName(space_type_); ++ region_list_.AddNode(region); + IncrementCommitted(region->GetCapacity()); + } + + void Space::AddRegionToFirst(Region *region) + { +- LOG_ECMA_MEM(DEBUG) << "Add region to first:" << region << " to " << ToSpaceTypeName(spaceType_); +- regionList_.AddNodeToFirst(region); ++ LOG_ECMA_MEM(DEBUG) << "Add region to first:" << region << " to " << ToSpaceTypeName(space_type_); ++ region_list_.AddNodeToFirst(region); + IncrementCommitted(region->GetCapacity()); + } + + void Space::RemoveRegion(Region *region) + { +- LOG_ECMA_MEM(DEBUG) << "Remove region:" << region << " to " << ToSpaceTypeName(spaceType_); +- if (regionList_.HasNode(region)) { +- if (spaceType_ == MemSpaceType::OLD_SPACE || spaceType_ == MemSpaceType::NON_MOVABLE || +- spaceType_ == MemSpaceType::MACHINE_CODE_SPACE) { ++ LOG_ECMA_MEM(DEBUG) << "Remove region:" << region << " to " << ToSpaceTypeName(space_type_); ++ if (region_list_.HasNode(region)) { ++ if (space_type_ == MemSpaceType::OLD_SPACE || space_type_ == MemSpaceType::NON_MOVABLE || ++ space_type_ == MemSpaceType::MACHINE_CODE_SPACE) { + region->RebuildKind(); + } +- regionList_.RemoveNode(region); ++ region_list_.RemoveNode(region); + DecrementCommitted(region->GetCapacity()); + } + } + + void Space::Initialize() + { +- Region *region = regionFactory_->AllocateAlignedRegion(this, DEFAULT_REGION_SIZE); +- if (spaceType_ == MemSpaceType::SEMI_SPACE) { ++ Region *region = region_factory_->AllocateAlignedRegion(this, DEFAULT_REGION_SIZE); ++ if (space_type_ == MemSpaceType::SEMI_SPACE) { + region->SetFlag(RegionFlags::IS_IN_YOUNG_GENERATION); +- } else if (spaceType_ == MemSpaceType::SNAPSHOT_SPACE) { ++ } else if (space_type_ == MemSpaceType::SNAPSHOT_SPACE) { + region->SetFlag(RegionFlags::IS_IN_SNAPSHOT_GENERATION); +- } else if (spaceType_ == MemSpaceType::OLD_SPACE) { ++ } else if (space_type_ == MemSpaceType::OLD_SPACE) { + region->InitializeKind(); + region->SetFlag(RegionFlags::IS_IN_OLD_GENERATION); +- } else if (spaceType_ == MemSpaceType::MACHINE_CODE_SPACE) { ++ } else if (space_type_ == MemSpaceType::MACHINE_CODE_SPACE) { + region->InitializeKind(); + region->SetFlag(RegionFlags::IS_IN_NON_MOVABLE_GENERATION); + // NOLINTNEXTLINE(clang-analyzer-deadcode.DeadStores) + [[maybe_unused]] int res = region->SetCodeExecutableAndReadable(); + LOG_ECMA_MEM(DEBUG) << "Initialize SetCodeExecutableAndReadable" << res; +- } else if (spaceType_ == MemSpaceType::NON_MOVABLE) { ++ } else if (space_type_ == MemSpaceType::NON_MOVABLE) { + region->InitializeKind(); + region->SetFlag(RegionFlags::IS_IN_NON_MOVABLE_GENERATION); + } +@@ -89,22 +89,22 @@ void Space::Initialize() + void Space::ReclaimRegions() + { + EnumerateRegions([this](Region *current) { ClearAndFreeRegion(current); }); +- regionList_.Clear(); +- committedSize_ = 0; ++ region_list_.Clear(); ++ committed_size_ = 0; + } + + void Space::ClearAndFreeRegion(Region *region) + { +- LOG_ECMA_MEM(DEBUG) << "Clear region from:" << region << " to " << ToSpaceTypeName(spaceType_); ++ LOG_ECMA_MEM(DEBUG) << "Clear region from:" << region << " to " << ToSpaceTypeName(space_type_); + region->ClearMarkBitmap(); + region->ClearCrossRegionRememberedSet(); + region->ClearOldToNewRememberedSet(); + DecrementCommitted(region->GetCapacity()); +- if (spaceType_ == MemSpaceType::OLD_SPACE || spaceType_ == MemSpaceType::NON_MOVABLE || +- spaceType_ == MemSpaceType::MACHINE_CODE_SPACE) { ++ if (space_type_ == MemSpaceType::OLD_SPACE || space_type_ == MemSpaceType::NON_MOVABLE || ++ space_type_ == MemSpaceType::MACHINE_CODE_SPACE) { + region->DestroyKind(); + } +- regionFactory_->FreeRegion(region); ++ region_factory_->FreeRegion(region); + } + + size_t Space::GetHeapObjectSize() const +@@ -129,11 +129,11 @@ SemiSpace::SemiSpace(Heap *heap, size_t initialCapacity, size_t maximumCapacity) + + bool SemiSpace::Expand(uintptr_t top) + { +- if (committedSize_ >= maximumCapacity_) { ++ if (committed_size_ >= maximum_capacity_) { + return false; + } + GetCurrentRegion()->SetHighWaterMark(top); +- Region *region = regionFactory_->AllocateAlignedRegion(this, DEFAULT_REGION_SIZE); ++ Region *region = region_factory_->AllocateAlignedRegion(this, DEFAULT_REGION_SIZE); + region->SetFlag(RegionFlags::IS_IN_YOUNG_GENERATION); + if (!thread_->IsReadyToMark()) { + region->SetMarking(true); +@@ -161,7 +161,7 @@ void SemiSpace::Swap([[maybe_unused]] SemiSpace *other) {} + + void SemiSpace::SetAgeMark(uintptr_t mark) + { +- ageMark_ = mark; ++ age_mark_ = mark; + Region *last = GetCurrentRegion(); + last->SetFlag(RegionFlags::HAS_AGE_MARK); + +@@ -239,7 +239,7 @@ size_t SemiSpace::GetAllocatedSizeSinceGC() const + auto top = GetHeap()->GetHeapManager()->GetNewSpaceAllocator().GetTop(); + size_t result = 0; + if (last->HasAgeMark()) { +- result = last->GetAllocatedBytes(top) - last->GetAllocatedBytes(ageMark_); ++ result = last->GetAllocatedBytes(top) - last->GetAllocatedBytes(age_mark_); + return result; + } + result = last->GetAllocatedBytes(top); +@@ -263,11 +263,11 @@ OldSpace::OldSpace(Heap *heap, size_t initialCapacity, size_t maximumCapacity) + + bool OldSpace::Expand() + { +- if (committedSize_ >= maximumCapacity_) { +- LOG_ECMA_MEM(FATAL) << "Committed size " << committedSize_ << " of old space is too big. "; ++ if (committed_size_ >= maximum_capacity_) { ++ LOG_ECMA_MEM(FATAL) << "Committed size " << committed_size_ << " of old space is too big. "; + return false; + } +- Region *region = regionFactory_->AllocateAlignedRegion(this, DEFAULT_REGION_SIZE); ++ Region *region = region_factory_->AllocateAlignedRegion(this, DEFAULT_REGION_SIZE); + region->SetFlag(RegionFlags::IS_IN_OLD_GENERATION); + if (!thread_->IsReadyToMark()) { + region->SetMarking(true); +@@ -354,7 +354,7 @@ size_t OldSpace::GetHeapObjectSize() const + { + size_t result; + size_t availableSize = heap_->GetHeapManager()->GetOldSpaceAllocator().GetAvailableSize(); +- result = committedSize_ - availableSize; ++ result = committed_size_ - availableSize; + return result; + } + +@@ -371,21 +371,21 @@ void OldSpace::Merge(Space *fromSpace) + void OldSpace::AddRegionToCSet(Region *region) + { + region->SetFlag(RegionFlags::IS_IN_COLLECT_SET); +- collectRegionSet_.emplace_back(region); ++ collect_region_set_.emplace_back(region); + } + + void OldSpace::ClearRegionFromCSet() + { + EnumerateCollectRegionSet([](Region *region) { region->ClearFlag(RegionFlags::IS_IN_COLLECT_SET); }); +- collectRegionSet_.clear(); ++ collect_region_set_.clear(); + } + + void OldSpace::RemoveRegionFromCSetAndList(Region *region) + { +- for (auto current = collectRegionSet_.begin(); current != collectRegionSet_.end(); current++) { ++ for (auto current = collect_region_set_.begin(); current != collect_region_set_.end(); current++) { + if (*current == region) { + region->ClearFlag(RegionFlags::IS_IN_COLLECT_SET); +- current = collectRegionSet_.erase(current); ++ current = collect_region_set_.erase(current); + break; + } + } +@@ -400,29 +400,29 @@ void OldSpace::RemoveCSetFromList() + void OldSpace::ReclaimRegionCSet() + { + EnumerateCollectRegionSet([this](Region *current) { ClearAndFreeRegion(current); }); +- collectRegionSet_.clear(); ++ collect_region_set_.clear(); + } + + void OldSpace::SelectCSet() + { + EnumerateRegions([this](Region *region) { + if (!region->MostObjectAlive()) { +- collectRegionSet_.emplace_back(region); ++ collect_region_set_.emplace_back(region); + } + }); +- if (collectRegionSet_.size() < PARTIAL_GC_MIN_COLLECT_REGION_SIZE) { ++ if (collect_region_set_.size() < PARTIAL_GC_MIN_COLLECT_REGION_SIZE) { + heap_->SetOnlyMarkSemi(true); +- collectRegionSet_.clear(); ++ collect_region_set_.clear(); + return; + } + // sort +- std::sort(collectRegionSet_.begin(), collectRegionSet_.end(), ++ std::sort(collect_region_set_.begin(), collect_region_set_.end(), + [](Region *first, Region *second) { return first->AliveObject() < second->AliveObject(); }); + uint64_t selectedRegionNumber = GetSelectedRegionNumber(); +- if (collectRegionSet_.size() > selectedRegionNumber) { +- collectRegionSet_.resize(selectedRegionNumber); ++ if (collect_region_set_.size() > selectedRegionNumber) { ++ collect_region_set_.resize(selectedRegionNumber); + } +- for (Region *region : collectRegionSet_) { ++ for (Region *region : collect_region_set_) { + region->SetFlag(RegionFlags::IS_IN_COLLECT_SET); + } + } +@@ -434,11 +434,11 @@ NonMovableSpace::NonMovableSpace(Heap *heap, size_t initialCapacity, size_t maxi + + bool NonMovableSpace::Expand() + { +- if (committedSize_ >= maximumCapacity_) { +- LOG_ECMA_MEM(FATAL) << "Committed size " << committedSize_ << " of non movable space is too big. "; ++ if (committed_size_ >= maximum_capacity_) { ++ LOG_ECMA_MEM(FATAL) << "Committed size " << committed_size_ << " of non movable space is too big. "; + return false; + } +- Region *region = regionFactory_->AllocateAlignedRegion(this, DEFAULT_REGION_SIZE); ++ Region *region = region_factory_->AllocateAlignedRegion(this, DEFAULT_REGION_SIZE); + region->SetFlag(IS_IN_NON_MOVABLE_GENERATION); + if (!thread_->IsReadyToMark()) { + region->SetMarking(true); +@@ -463,14 +463,14 @@ SnapShotSpace::SnapShotSpace(Heap *heap, size_t initialCapacity, size_t maximumC + + bool SnapShotSpace::Expand(uintptr_t top) + { +- if (committedSize_ >= maximumCapacity_) { ++ if (committed_size_ >= maximum_capacity_) { + return false; + } + Region *current = GetCurrentRegion(); + if (current != nullptr) { + current->SetHighWaterMark(top); + } +- Region *region = regionFactory_->AllocateAlignedRegion(this, DEFAULT_SNAPSHOT_SPACE_SIZE); ++ Region *region = region_factory_->AllocateAlignedRegion(this, DEFAULT_SNAPSHOT_SPACE_SIZE); + region->SetFlag(RegionFlags::IS_IN_SNAPSHOT_GENERATION); + if (!thread_->IsReadyToMark()) { + region->SetMarking(true); +@@ -540,8 +540,8 @@ HugeObjectSpace::HugeObjectSpace(Heap *heap, size_t initialCapacity, size_t maxi + + uintptr_t HugeObjectSpace::Allocate(size_t objectSize) + { +- if (committedSize_ >= maximumCapacity_) { +- LOG_ECMA_MEM(FATAL) << "Committed size " << committedSize_ << " of huge object space is too big. " ++ if (committed_size_ >= maximum_capacity_) { ++ LOG_ECMA_MEM(FATAL) << "Committed size " << committed_size_ << " of huge object space is too big. " + << " old space committed: " << heap_->GetOldSpace()->GetCommittedSize() + << " old space limit: " << heap_->GetOldSpaceAllocLimit() + << " length: " << GetRegionList().GetLength(); +@@ -552,7 +552,7 @@ uintptr_t HugeObjectSpace::Allocate(size_t objectSize) + LOG_ECMA_MEM(FATAL) << "The size is too big for this allocator. Return nullptr."; + return 0; + } +- Region *region = regionFactory_->AllocateAlignedRegion(this, alignedSize); ++ Region *region = region_factory_->AllocateAlignedRegion(this, alignedSize); + region->SetFlag(RegionFlags::IS_HUGE_OBJECT); + if (!thread_->IsReadyToMark()) { + region->SetMarking(true); +@@ -586,7 +586,7 @@ bool HugeObjectSpace::IsLive(TaggedObject *object) const + + size_t HugeObjectSpace::GetHeapObjectSize() const + { +- return committedSize_; ++ return committed_size_; + } + + void HugeObjectSpace::IterateOverObjects(const std::function &objectVisitor) const +@@ -604,11 +604,11 @@ MachineCodeSpace::MachineCodeSpace(Heap *heap, size_t initialCapacity, size_t ma + + bool MachineCodeSpace::Expand() + { +- if (committedSize_ >= maximumCapacity_) { +- LOG_ECMA_MEM(FATAL) << "Committed size " << committedSize_ << " of machine Code space is too big. "; ++ if (committed_size_ >= maximum_capacity_) { ++ LOG_ECMA_MEM(FATAL) << "Committed size " << committed_size_ << " of machine Code space is too big. "; + return false; + } +- Region *region = regionFactory_->AllocateAlignedRegion(this, DEFAULT_REGION_SIZE); ++ Region *region = region_factory_->AllocateAlignedRegion(this, DEFAULT_REGION_SIZE); + region->SetFlag(IS_IN_NON_MOVABLE_GENERATION); + region->InitializeKind(); + AddRegion(region); +@@ -625,7 +625,7 @@ size_t MachineCodeSpace::GetHeapObjectSize() const + { + size_t result = 0; + size_t availableSize = GetHeap()->GetHeapManager()->GetMachineCodeSpaceAllocator().GetAvailableSize(); +- result = committedSize_ - availableSize; ++ result = committed_size_ - availableSize; + return result; + } + } // namespace panda::ecmascript +diff --git a/runtime/mem/space.h b/runtime/mem/space.h +index 69b7877..9aa1b9e 100644 +--- a/runtime/mem/space.h ++++ b/runtime/mem/space.h +@@ -90,67 +90,67 @@ public: + + size_t GetMaximumCapacity() const + { +- return maximumCapacity_; ++ return maximum_capacity_; + } + + void SetMaximumCapacity(size_t maximumCapacity) + { +- maximumCapacity_ = maximumCapacity; ++ maximum_capacity_ = maximumCapacity; + } + + size_t GetInitialCapacity() const + { +- return initialCapacity_; ++ return initial_capacity_; + } + + size_t GetCommittedSize() const + { +- return committedSize_; ++ return committed_size_; + } + + void IncrementCommitted(size_t bytes) + { +- committedSize_ += bytes; ++ committed_size_ += bytes; + } + + void DecrementCommitted(size_t bytes) + { +- committedSize_ -= bytes; ++ committed_size_ -= bytes; + } + + MemSpaceType GetSpaceType() const + { +- return spaceType_; ++ return space_type_; + } + + uintptr_t GetAllocateAreaBegin() const + { +- return regionList_.GetLast()->GetBegin(); ++ return region_list_.GetLast()->GetBegin(); + } + + uintptr_t GetAllocateAreaEnd() const + { +- return regionList_.GetLast()->GetEnd(); ++ return region_list_.GetLast()->GetEnd(); + } + + Region *GetCurrentRegion() const + { +- return regionList_.GetLast(); ++ return region_list_.GetLast(); + } + + uint32_t GetRegionCount() + { +- return regionList_.GetLength(); ++ return region_list_.GetLength(); + } + + EcmaList &GetRegionList() + { +- return regionList_; ++ return region_list_; + } + + const EcmaList &GetRegionList() const + { +- return regionList_; ++ return region_list_; + } + + size_t GetHeapObjectSize() const; +@@ -177,17 +177,17 @@ protected: + // NOLINTNEXTLINE(misc-non-private-member-variables-in-classes) + JSThread *thread_ {nullptr}; + // NOLINTNEXTLINE(misc-non-private-member-variables-in-classes) +- RegionFactory *regionFactory_ {nullptr}; ++ RegionFactory *region_factory_ {nullptr}; + // NOLINTNEXTLINE(misc-non-private-member-variables-in-classes) +- EcmaList regionList_ {}; ++ EcmaList region_list_ {}; + // NOLINTNEXTLINE(misc-non-private-member-variables-in-classes) +- MemSpaceType spaceType_ {}; ++ MemSpaceType space_type_ {}; + // NOLINTNEXTLINE(misc-non-private-member-variables-in-classes) +- size_t initialCapacity_ {0}; ++ size_t initial_capacity_ {0}; + // NOLINTNEXTLINE(misc-non-private-member-variables-in-classes) +- size_t maximumCapacity_ {0}; ++ size_t maximum_capacity_ {0}; + // NOLINTNEXTLINE(misc-non-private-member-variables-in-classes) +- size_t committedSize_ {0}; ++ size_t committed_size_ {0}; + // NOLINTNEXTLINE(misc-non-private-member-variables-in-classes) + }; + +@@ -203,7 +203,7 @@ public: + + uintptr_t GetAgeMark() const + { +- return ageMark_; ++ return age_mark_; + } + + bool Expand(uintptr_t top); +@@ -218,7 +218,7 @@ public: + size_t GetAllocatedSizeSinceGC() const; + + private: +- uintptr_t ageMark_ {0}; ++ uintptr_t age_mark_ {0}; + }; + + class OldSpace : public Space { +@@ -247,14 +247,14 @@ public: + void SelectCSet(); + size_t GetSelectedRegionNumber() const + { +- return std::max(committedSize_ / PARTIAL_GC_MAX_COLLECT_REGION_RATE, PARTIAL_GC_INITIAL_COLLECT_REGION_SIZE); ++ return std::max(committed_size_ / PARTIAL_GC_MAX_COLLECT_REGION_RATE, PARTIAL_GC_INITIAL_COLLECT_REGION_SIZE); + } + + private: + static constexpr size_t PARTIAL_GC_MAX_COLLECT_REGION_RATE = 1024 * 1024 * 2; + static constexpr size_t PARTIAL_GC_INITIAL_COLLECT_REGION_SIZE = 16; + static constexpr size_t PARTIAL_GC_MIN_COLLECT_REGION_SIZE = 5; +- CVector collectRegionSet_; ++ CVector collect_region_set_; + }; + + class NonMovableSpace : public Space { +diff --git a/runtime/mem/tlab_allocator-inl.h b/runtime/mem/tlab_allocator-inl.h +index 23e8867..81cff08 100644 +--- a/runtime/mem/tlab_allocator-inl.h ++++ b/runtime/mem/tlab_allocator-inl.h +@@ -29,7 +29,7 @@ static constexpr size_t YOUNG_BUFFER_SIZE = 31 * 1024; + static constexpr size_t OLD_BUFFER_SIZE = 255 * 1024; + + TlabAllocator::TlabAllocator(Heap *heap, TriggerGCType gcType) +- : heap_(heap), gcType_(gcType), youngEnable_(true), allocator_(heap_->GetEvacuationAllocator()) ++ : heap_(heap), gc_type_(gcType), young_enable_(true), allocator_(heap_->GetEvacuationAllocator()) + { + } + +@@ -40,15 +40,15 @@ TlabAllocator::~TlabAllocator() + + inline void TlabAllocator::Finalize() + { +- if (youngerAllocator_.Available() != 0) { +- FreeObject::FillFreeObject(heap_->GetEcmaVM(), youngerAllocator_.GetTop(), youngerAllocator_.Available()); +- youngerAllocator_.Reset(); ++ if (younger_allocator_.Available() != 0) { ++ FreeObject::FillFreeObject(heap_->GetEcmaVM(), younger_allocator_.GetTop(), younger_allocator_.Available()); ++ younger_allocator_.Reset(); + } +- if (oldBumpPointerAllocator_.Available() != 0) { +- allocator_->FreeSafe(oldBumpPointerAllocator_.GetTop(), oldBumpPointerAllocator_.GetEnd()); +- Region *current = Region::ObjectAddressToRange(oldBumpPointerAllocator_.GetTop()); +- current->DecreaseAliveObject(oldBumpPointerAllocator_.Available()); +- oldBumpPointerAllocator_.Reset(); ++ if (old_bump_pointer_allocator_.Available() != 0) { ++ allocator_->FreeSafe(old_bump_pointer_allocator_.GetTop(), old_bump_pointer_allocator_.GetEnd()); ++ Region *current = Region::ObjectAddressToRange(old_bump_pointer_allocator_.GetTop()); ++ current->DecreaseAliveObject(old_bump_pointer_allocator_.Available()); ++ old_bump_pointer_allocator_.Reset(); + } + } + +@@ -76,41 +76,41 @@ uintptr_t TlabAllocator::TlabAllocatorYoungSpace(size_t size) + LOG(DEBUG, RUNTIME) << "AllocatorYoungSpace:" << address; + return address; + } +- uintptr_t result = youngerAllocator_.Allocate(size); ++ uintptr_t result = younger_allocator_.Allocate(size); + if (result != 0) { + return result; + } +- if (youngerAllocator_.Available() != 0) { +- FreeObject::FillFreeObject(heap_->GetEcmaVM(), youngerAllocator_.GetTop(), youngerAllocator_.Available()); ++ if (younger_allocator_.Available() != 0) { ++ FreeObject::FillFreeObject(heap_->GetEcmaVM(), younger_allocator_.GetTop(), younger_allocator_.Available()); + } +- if (!youngEnable_ || !ExpandYoung()) { +- youngEnable_ = false; ++ if (!young_enable_ || !ExpandYoung()) { ++ young_enable_ = false; + return 0; + } +- return youngerAllocator_.Allocate(size); ++ return younger_allocator_.Allocate(size); + } + + uintptr_t TlabAllocator::TlabAllocatorOldSpace(size_t size) + { + size = AlignUp(size, static_cast(MemAlignment::MEM_ALIGN_OBJECT)); +- uintptr_t result = oldBumpPointerAllocator_.Allocate(size); ++ uintptr_t result = old_bump_pointer_allocator_.Allocate(size); + if (result != 0) { +- FreeObject::FillFreeObject(heap_->GetEcmaVM(), oldBumpPointerAllocator_.GetTop(), +- oldBumpPointerAllocator_.Available()); ++ FreeObject::FillFreeObject(heap_->GetEcmaVM(), old_bump_pointer_allocator_.GetTop(), ++ old_bump_pointer_allocator_.Available()); + return result; + } +- Region *current = Region::ObjectAddressToRange(oldBumpPointerAllocator_.GetTop()); ++ Region *current = Region::ObjectAddressToRange(old_bump_pointer_allocator_.GetTop()); + if (current != nullptr) { +- current->DecreaseAliveObject(oldBumpPointerAllocator_.Available()); ++ current->DecreaseAliveObject(old_bump_pointer_allocator_.Available()); + } +- allocator_->FreeSafe(oldBumpPointerAllocator_.GetTop(), oldBumpPointerAllocator_.GetEnd()); ++ allocator_->FreeSafe(old_bump_pointer_allocator_.GetTop(), old_bump_pointer_allocator_.GetEnd()); + if (!ExpandOld()) { + return 0; + } +- result = oldBumpPointerAllocator_.Allocate(size); ++ result = old_bump_pointer_allocator_.Allocate(size); + if (result != 0) { +- FreeObject::FillFreeObject(heap_->GetEcmaVM(), oldBumpPointerAllocator_.GetTop(), +- oldBumpPointerAllocator_.Available()); ++ FreeObject::FillFreeObject(heap_->GetEcmaVM(), old_bump_pointer_allocator_.GetTop(), ++ old_bump_pointer_allocator_.Available()); + } + return result; + } +@@ -123,30 +123,30 @@ bool TlabAllocator::ExpandYoung() + if (buffer == 0) { + return false; + } +- youngerAllocator_.Reset(buffer, buffer + YOUNG_BUFFER_SIZE); ++ younger_allocator_.Reset(buffer, buffer + YOUNG_BUFFER_SIZE); + return true; + } + + bool TlabAllocator::ExpandOld() + { + uintptr_t buffer = 0; +- if (gcType_ == TriggerGCType::SEMI_GC) { ++ if (gc_type_ == TriggerGCType::SEMI_GC) { + buffer = allocator_->AllocateOld(YOUNG_BUFFER_SIZE); + if (buffer == 0) { + return false; + } +- oldBumpPointerAllocator_.Reset(buffer, buffer + YOUNG_BUFFER_SIZE); +- FreeObject::FillFreeObject(heap_->GetEcmaVM(), oldBumpPointerAllocator_.GetTop(), +- oldBumpPointerAllocator_.Available()); +- } else if (gcType_ == TriggerGCType::COMPRESS_FULL_GC) { ++ old_bump_pointer_allocator_.Reset(buffer, buffer + YOUNG_BUFFER_SIZE); ++ FreeObject::FillFreeObject(heap_->GetEcmaVM(), old_bump_pointer_allocator_.GetTop(), ++ old_bump_pointer_allocator_.Available()); ++ } else if (gc_type_ == TriggerGCType::COMPRESS_FULL_GC) { + Region *region = allocator_->ExpandOldSpace(); + if (region == nullptr) { + return false; + } + region->SetAliveObject(region->GetSize()); +- oldBumpPointerAllocator_.Reset(region->GetBegin(), region->GetEnd()); +- FreeObject::FillFreeObject(heap_->GetEcmaVM(), oldBumpPointerAllocator_.GetTop(), +- oldBumpPointerAllocator_.Available()); ++ old_bump_pointer_allocator_.Reset(region->GetBegin(), region->GetEnd()); ++ FreeObject::FillFreeObject(heap_->GetEcmaVM(), old_bump_pointer_allocator_.GetTop(), ++ old_bump_pointer_allocator_.Available()); + } else { + UNREACHABLE(); + } +diff --git a/runtime/mem/tlab_allocator.h b/runtime/mem/tlab_allocator.h +index 70f5579..41e7e3d 100644 +--- a/runtime/mem/tlab_allocator.h ++++ b/runtime/mem/tlab_allocator.h +@@ -48,11 +48,11 @@ private: + inline bool ExpandOld(); + + Heap *heap_; +- TriggerGCType gcType_; +- bool youngEnable_; ++ TriggerGCType gc_type_; ++ bool young_enable_; + +- BumpPointerAllocator youngerAllocator_; +- BumpPointerAllocator oldBumpPointerAllocator_; ++ BumpPointerAllocator younger_allocator_; ++ BumpPointerAllocator old_bump_pointer_allocator_; + EvacuationAllocator *allocator_; + }; + } // namespace panda::ecmascript +diff --git a/runtime/mem/verification.cpp b/runtime/mem/verification.cpp +index 990abbc..d1050af 100644 +--- a/runtime/mem/verification.cpp ++++ b/runtime/mem/verification.cpp +@@ -24,7 +24,7 @@ namespace panda::ecmascript { + void VerifyObjectVisitor::VisitAllObjects(TaggedObject *obj) + { + auto jsHclass = obj->GetClass(); +- objXRay_.VisitObjectBody( ++ obj_x_ray_.VisitObjectBody( + obj, jsHclass, [this]([[maybe_unused]] TaggedObject *root, ObjectSlot start, ObjectSlot end) { + for (ObjectSlot slot = start; slot < end; slot++) { + JSTaggedValue value(slot.GetTaggedType()); +@@ -32,13 +32,13 @@ void VerifyObjectVisitor::VisitAllObjects(TaggedObject *obj) + if (!heap_->IsLive(value.GetTaggedWeakRef())) { + LOG(ERROR, RUNTIME) << "Heap verify detected a dead object at " << value.GetTaggedObject() + << "at object:" << slot.SlotAddress(); +- ++(*failCount_); ++ ++(*fail_count_); + } + } else if (value.IsHeapObject()) { + if (!heap_->IsLive(value.GetTaggedObject())) { + LOG(ERROR, RUNTIME) << "Heap verify detected a dead object at " << value.GetTaggedObject() + << "at object:" << slot.SlotAddress(); +- ++(*failCount_); ++ ++(*fail_count_); + } + } + } +@@ -66,7 +66,7 @@ size_t Verification::VerifyRoot() const + } + } + }; +- objXRay_.VisitVMRoots(visit1, visit2); ++ obj_x_ray_.VisitVMRoots(visit1, visit2); + if (failCount > 0) { + LOG(ERROR, RUNTIME) << "VerifyRoot detects deadObject count is " << failCount; + } +diff --git a/runtime/mem/verification.h b/runtime/mem/verification.h +index 5a6c65b..7f6ac4f 100644 +--- a/runtime/mem/verification.h ++++ b/runtime/mem/verification.h +@@ -29,7 +29,7 @@ namespace panda::ecmascript { + class VerifyObjectVisitor { + public: + VerifyObjectVisitor(const Heap *heap, size_t *failCount) +- : heap_(heap), failCount_(failCount), objXRay_(heap->GetEcmaVM()) ++ : heap_(heap), fail_count_(failCount), obj_x_ray_(heap->GetEcmaVM()) + { + } + ~VerifyObjectVisitor() = default; +@@ -41,20 +41,20 @@ public: + + size_t GetFailedCount() const + { +- return *failCount_; ++ return *fail_count_; + } + + private: + void VisitAllObjects(TaggedObject *obj); + + const Heap *const heap_ {nullptr}; +- size_t *const failCount_ {nullptr}; +- ObjectXRay objXRay_; ++ size_t *const fail_count_ {nullptr}; ++ ObjectXRay obj_x_ray_; + }; + + class Verification { + public: +- explicit Verification(const Heap *heap) : heap_(heap), objXRay_(heap->GetEcmaVM()) {} ++ explicit Verification(const Heap *heap) : heap_(heap), obj_x_ray_(heap->GetEcmaVM()) {} + ~Verification() = default; + + size_t VerifyAll() const +@@ -73,7 +73,7 @@ private: + NO_MOVE_SEMANTIC(Verification); + + const Heap *heap_ {nullptr}; +- ObjectXRay objXRay_; ++ ObjectXRay obj_x_ray_; + }; + } // namespace panda::ecmascript + +diff --git a/runtime/napi/include/jsnapi.h b/runtime/napi/include/jsnapi.h +index 1da1a79..b3d1c83 100644 +--- a/runtime/napi/include/jsnapi.h ++++ b/runtime/napi/include/jsnapi.h +@@ -214,9 +214,9 @@ protected: + inline LocalScope(const EcmaVM *vm, JSTaggedType value); + + private: +- void *prevNext_ = nullptr; +- void *prevEnd_ = nullptr; +- int prevHandleStorageIndex_ {-1}; ++ void *prev_next_ = nullptr; ++ void *prev_end_ = nullptr; ++ int prev_handle_storage_index_ {-1}; + void *thread_ = nullptr; + }; + +@@ -231,15 +231,15 @@ public: + template + inline Local Escape(Local current) + { +- ASSERT(!alreadyEscape_); +- alreadyEscape_ = true; +- *(reinterpret_cast(escapeHandle_)) = **current; +- return Local(escapeHandle_); ++ ASSERT(!already_escape_); ++ already_escape_ = true; ++ *(reinterpret_cast(escape_handle_)) = **current; ++ return Local(escape_handle_); + } + + private: +- bool alreadyEscape_ = false; +- uintptr_t escapeHandle_ = 0U; ++ bool already_escape_ = false; ++ uintptr_t escape_handle_ = 0U; + }; + + class PUBLIC_API JSExecutionScope { +@@ -404,9 +404,9 @@ public: + writable_(w), + enumerable_(e), + configurable_(c), +- hasWritable_(true), +- hasEnumerable_(true), +- hasConfigurable_(true) ++ has_writable_(true), ++ has_enumerable_(true), ++ has_configurable_(true) + { + } + ~PropertyAttribute() = default; +@@ -418,7 +418,7 @@ public: + void SetWritable(bool flag) + { + writable_ = flag; +- hasWritable_ = true; ++ has_writable_ = true; + } + bool IsEnumerable() const + { +@@ -427,7 +427,7 @@ public: + void SetEnumerable(bool flag) + { + enumerable_ = flag; +- hasEnumerable_ = true; ++ has_enumerable_ = true; + } + bool IsConfigurable() const + { +@@ -436,19 +436,19 @@ public: + void SetConfigurable(bool flag) + { + configurable_ = flag; +- hasConfigurable_ = true; ++ has_configurable_ = true; + } + bool HasWritable() const + { +- return hasWritable_; ++ return has_writable_; + } + bool HasConfigurable() const + { +- return hasConfigurable_; ++ return has_configurable_; + } + bool HasEnumerable() const + { +- return hasEnumerable_; ++ return has_enumerable_; + } + Local GetValue(const EcmaVM *vm) const + { +@@ -503,9 +503,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; + }; + + class PUBLIC_API ObjectRef : public JSValueRef { +@@ -714,8 +714,8 @@ using LOG_PRINT = int (*)(int id, int level, const char *tag, const char *fmt, c + + class PUBLIC_API RuntimeOption { + public: +- enum class PUBLIC_API GC_TYPE : uint8_t { EPSILON, GEN_GC, STW, G1_GC }; +- enum class PUBLIC_API LOG_LEVEL : uint8_t { ++ enum class PUBLIC_API GcType : uint8_t { EPSILON, GEN_GC, STW, G1_GC }; ++ enum class PUBLIC_API LogLevel : uint8_t { + DEBUG = 3, + INFO = 4, + WARN = 5, +@@ -723,56 +723,56 @@ public: + FATAL = 7, + }; + +- void SetGcType(GC_TYPE type) ++ void SetGcType(GcType type) + { +- gcType_ = type; ++ gc_type_ = type; + } + + void SetGcPoolSize(uint32_t size) + { +- gcPoolSize_ = size; ++ gc_pool_size_ = size; + } + +- void SetLogLevel(LOG_LEVEL logLevel) ++ void SetLogLevel(LogLevel logLevel) + { +- logLevel_ = logLevel; ++ log_level_ = logLevel; + } + + void SetLogBufPrint(LOG_PRINT out) + { +- logBufPrint_ = out; ++ log_buf_print_ = out; + } + + void SetDebuggerLibraryPath(const std::string &path) + { +- debuggerLibraryPath_ = path; ++ debugger_library_path_ = path; + } + + void SetEnableArkTools(bool value) + { +- enableArkTools_ = value; ++ enable_ark_tools_ = value; + } + + void SetArkProperties(int prop) + { +- arkProperties_ = prop; ++ ark_properties_ = prop; + } + + private: + std::string GetGcType() const + { + std::string gcType; +- switch (gcType_) { +- case GC_TYPE::GEN_GC: ++ switch (gc_type_) { ++ case GcType::GEN_GC: + gcType = "gen-gc"; + break; +- case GC_TYPE::STW: ++ case GcType::STW: + gcType = "stw"; + break; +- case GC_TYPE::EPSILON: ++ case GcType::EPSILON: + gcType = "epsilon"; + break; +- case GC_TYPE::G1_GC: ++ case GcType::G1_GC: + gcType = "g1-gc"; + break; + default: +@@ -784,18 +784,18 @@ private: + std::string GetLogLevel() const + { + std::string logLevel; +- switch (logLevel_) { +- case LOG_LEVEL::INFO: +- case LOG_LEVEL::WARN: ++ switch (log_level_) { ++ case LogLevel::INFO: ++ case LogLevel::WARN: + logLevel = "info"; + break; +- case LOG_LEVEL::ERROR: ++ case LogLevel::ERROR: + logLevel = "error"; + break; +- case LOG_LEVEL::FATAL: ++ case LogLevel::FATAL: + logLevel = "fatal"; + break; +- case LOG_LEVEL::DEBUG: ++ case LogLevel::DEBUG: + default: + logLevel = "debug"; + break; +@@ -806,48 +806,48 @@ private: + + uint32_t GetGcPoolSize() const + { +- return gcPoolSize_; ++ return gc_pool_size_; + } + + LOG_PRINT GetLogBufPrint() const + { +- return logBufPrint_; ++ return log_buf_print_; + } + + std::string GetDebuggerLibraryPath() const + { +- return debuggerLibraryPath_; ++ return debugger_library_path_; + } + + bool GetEnableArkTools() const + { +- return enableArkTools_; ++ return enable_ark_tools_; + } + + int GetArkProperties() const + { +- return arkProperties_; ++ return ark_properties_; + } + +- GC_TYPE gcType_ = GC_TYPE::EPSILON; +- LOG_LEVEL logLevel_ = LOG_LEVEL::DEBUG; +- uint32_t gcPoolSize_ = DEFAULT_GC_POOL_SIZE; +- LOG_PRINT logBufPrint_ {nullptr}; +- std::string debuggerLibraryPath_ {}; +- bool enableArkTools_ {false}; +- int arkProperties_ {-1}; ++ GcType gc_type_ = GcType::EPSILON; ++ LogLevel log_level_ = LogLevel::DEBUG; ++ uint32_t gc_pool_size_ = DEFAULT_GC_POOL_SIZE; ++ LOG_PRINT log_buf_print_ {nullptr}; ++ std::string debugger_library_path_ {}; ++ bool enable_ark_tools_ {false}; ++ int ark_properties_ {-1}; + friend JSNApi; + }; + + class PUBLIC_API PromiseRejectInfo { + public: +- enum class PUBLIC_API PROMISE_REJECTION_EVENT : uint32_t { REJECT = 0, HANDLE }; ++ enum class PUBLIC_API PromiseRejectionEvent : uint32_t { REJECT = 0, HANDLE }; + PromiseRejectInfo(Local promise, Local reason, +- PromiseRejectInfo::PROMISE_REJECTION_EVENT operation, void *data); ++ PromiseRejectInfo::PromiseRejectionEvent operation, void *data); + ~PromiseRejectInfo() = default; + Local GetPromise() const; + Local GetReason() const; +- PromiseRejectInfo::PROMISE_REJECTION_EVENT GetOperation() const; ++ PromiseRejectInfo::PromiseRejectionEvent GetOperation() const; + void *GetData() const; + + DEFAULT_MOVE_SEMANTIC(PromiseRejectInfo); +@@ -856,14 +856,14 @@ public: + private: + Local promise_ {}; + Local reason_ {}; +- PROMISE_REJECTION_EVENT operation_ = PROMISE_REJECTION_EVENT::REJECT; ++ PromiseRejectionEvent operation_ = PromiseRejectionEvent::REJECT; + void *data_ {nullptr}; + }; + + class PUBLIC_API JSNApi { + public: + // JSVM +- enum class PUBLIC_API TRIGGER_GC_TYPE : uint8_t { SEMI_GC, OLD_GC, COMPRESS_FULL_GC }; ++ enum class PUBLIC_API TriggerGcType : uint8_t { SEMI_GC, OLD_GC, COMPRESS_FULL_GC }; + static EcmaVM *CreateJSVM(const RuntimeOption &option); + static void DestroyJSVM(EcmaVM *ecmaVm); + +@@ -878,7 +878,7 @@ public: + static void ExecutePendingJob(const EcmaVM *vm); + + // Memory +- static void TriggerGC(const EcmaVM *vm, TRIGGER_GC_TYPE gcType = TRIGGER_GC_TYPE::SEMI_GC); ++ static void TriggerGC(const EcmaVM *vm, TriggerGcType gcType = TriggerGcType::SEMI_GC); + // Exception + static void ThrowException(const EcmaVM *vm, Local error); + static Local GetUncaughtException(const EcmaVM *vm); +diff --git a/runtime/napi/jsnapi.cpp b/runtime/napi/jsnapi.cpp +index 454a4ed..d65fcf1 100644 +--- a/runtime/napi/jsnapi.cpp ++++ b/runtime/napi/jsnapi.cpp +@@ -112,7 +112,7 @@ constexpr std::string_view ENTRY_POINTER = "_GLOBAL::func_main_0"; + class JSNDebuggerAgent : public LibraryAgent, public LibraryAgentLoader { + public: + JSNDebuggerAgent(os::memory::Mutex &mutex, const char *libraryPath, EcmaVM *vm, bool isDebugMode) +- : LibraryAgent(mutex, libraryPath, "StartDebug", "StopDebug"), vm_(vm), isDebugMode_(isDebugMode) ++ : LibraryAgent(mutex, libraryPath, "StartDebug", "StopDebug"), vm_(vm), is_debug_mode_(isDebugMode) + { + } + +@@ -122,7 +122,7 @@ private: + ASSERT(resolvedFunction); + + using StartDebugger = bool (*)(const std::string &, EcmaVM *, bool); +- if (!reinterpret_cast(resolvedFunction)("PandaDebugger", vm_, isDebugMode_)) { ++ if (!reinterpret_cast(resolvedFunction)("PandaDebugger", vm_, is_debug_mode_)) { + LOG_ECMA(ERROR) << "'StartDebug' has failed"; + return false; + } +@@ -141,7 +141,7 @@ private: + } + + EcmaVM *vm_; +- bool isDebugMode_; ++ bool is_debug_mode_; + }; + + LoadableAgentHandle s_debugger_agent; // NOLINT(fuchsia-statically-constructed-objects) +@@ -230,18 +230,18 @@ void JSNApi::DestroyJSVM(EcmaVM *ecmaVm) + } + } + +-void JSNApi::TriggerGC(const EcmaVM *vm, TRIGGER_GC_TYPE gcType) ++void JSNApi::TriggerGC(const EcmaVM *vm, TriggerGcType gcType) + { + if (vm->GetJSThread() != nullptr && vm->IsInitialized()) { + ScopedManagedCodeThread s(vm->GetAssociatedThread()); + switch (gcType) { +- case TRIGGER_GC_TYPE::SEMI_GC: ++ case TriggerGcType::SEMI_GC: + vm->CollectGarbage(ecmascript::TriggerGCType::SEMI_GC); + break; +- case TRIGGER_GC_TYPE::OLD_GC: ++ case TriggerGcType::OLD_GC: + vm->CollectGarbage(ecmascript::TriggerGCType::OLD_GC); + break; +- case TRIGGER_GC_TYPE::COMPRESS_FULL_GC: ++ case TriggerGcType::COMPRESS_FULL_GC: + vm->CollectGarbage(ecmascript::TriggerGCType::COMPRESS_FULL_GC); + break; + default: +@@ -399,7 +399,7 @@ void HostPromiseRejectionTracker(const EcmaVM *vm, const JSHandle pro + if (promiseRejectCallback != nullptr) { + Local promiseVal = JSNApiHelper::ToLocal(JSHandle::Cast(promise)); + PromiseRejectInfo promiseRejectInfo(promiseVal, JSNApiHelper::ToLocal(reason), +- static_cast(operation), data); ++ static_cast(operation), data); + promiseRejectCallback(reinterpret_cast(&promiseRejectInfo)); + } + } +@@ -420,7 +420,7 @@ void JSNApi::SetHostEnqueueJob(const EcmaVM *vm, Local cb) + } + + PromiseRejectInfo::PromiseRejectInfo(Local promise, Local reason, +- PromiseRejectInfo::PROMISE_REJECTION_EVENT operation, void *data) ++ PromiseRejectInfo::PromiseRejectionEvent operation, void *data) + : promise_(promise), reason_(reason), operation_(operation), data_(data) + { + } +@@ -435,7 +435,7 @@ Local PromiseRejectInfo::GetReason() const + return reason_; + } + +-PromiseRejectInfo::PROMISE_REJECTION_EVENT PromiseRejectInfo::GetOperation() const ++PromiseRejectInfo::PromiseRejectionEvent PromiseRejectInfo::GetOperation() const + { + return operation_; + } +@@ -478,9 +478,9 @@ Local JSNApi::GetExportObject(EcmaVM *vm, const std::string &file, co + LocalScope::LocalScope(const EcmaVM *vm) : thread_(vm->GetJSThread()) + { + auto thread = reinterpret_cast(thread_); +- prevNext_ = thread->GetHandleScopeStorageNext(); +- prevEnd_ = thread->GetHandleScopeStorageEnd(); +- prevHandleStorageIndex_ = thread->GetCurrentHandleStorageIndex(); ++ prev_next_ = thread->GetHandleScopeStorageNext(); ++ prev_end_ = thread->GetHandleScopeStorageEnd(); ++ prev_handle_storage_index_ = thread->GetCurrentHandleStorageIndex(); + thread->HandleScopeCountAdd(); + } + +@@ -488,9 +488,9 @@ LocalScope::LocalScope(const EcmaVM *vm, JSTaggedType value) : thread_(vm->GetJS + { + auto thread = reinterpret_cast(thread_); + ecmascript::EcmaHandleScope::NewHandle(thread, value); +- prevNext_ = thread->GetHandleScopeStorageNext(); +- prevEnd_ = thread->GetHandleScopeStorageEnd(); +- prevHandleStorageIndex_ = thread->GetCurrentHandleStorageIndex(); ++ prev_next_ = thread->GetHandleScopeStorageNext(); ++ prev_end_ = thread->GetHandleScopeStorageEnd(); ++ prev_handle_storage_index_ = thread->GetCurrentHandleStorageIndex(); + thread->HandleScopeCountAdd(); + } + +@@ -498,10 +498,10 @@ LocalScope::~LocalScope() + { + auto thread = reinterpret_cast(thread_); + thread->HandleScopeCountDec(); +- thread->SetHandleScopeStorageNext(static_cast(prevNext_)); +- if (thread->GetHandleScopeStorageEnd() != prevEnd_) { +- thread->SetHandleScopeStorageEnd(static_cast(prevEnd_)); +- thread->ShrinkHandleStorage(prevHandleStorageIndex_); ++ thread->SetHandleScopeStorageNext(static_cast(prev_next_)); ++ if (thread->GetHandleScopeStorageEnd() != prev_end_) { ++ thread->SetHandleScopeStorageEnd(static_cast(prev_end_)); ++ thread->ShrinkHandleStorage(prev_handle_storage_index_); + } + } + +@@ -510,7 +510,7 @@ EscapeLocalScope::EscapeLocalScope(const EcmaVM *vm) : LocalScope(vm, 0U) + { + auto thread = vm->GetJSThread(); + // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) +- escapeHandle_ = ToUintPtr(thread->GetHandleScopeStorageNext() - 1); ++ escape_handle_ = ToUintPtr(thread->GetHandleScopeStorageNext() - 1); + } + + // ----------------------------------- NumberRef --------------------------------------- +diff --git a/runtime/object_factory-inl.h b/runtime/object_factory-inl.h +index d32e1cf..d2598f1 100644 +--- a/runtime/object_factory-inl.h ++++ b/runtime/object_factory-inl.h +@@ -25,13 +25,13 @@ 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, +@@ -40,9 +40,9 @@ JSHandle ObjectFactory::NewJSNativePointer(void *externalPointe + NewObjectHook(); + TaggedObject *header; + if (nonMovable) { +- header = heapHelper_.AllocateNonMovableOrHugeObject(jsNativePointerClass_); ++ 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); +@@ -55,7 +55,7 @@ LexicalEnv *ObjectFactory::InlineNewLexicalEnv(int numSlots) + { + NewObjectHook(); + size_t size = LexicalEnv::ComputeSize(numSlots); +- auto header = heapHelper_.AllocateYoungGenerationOrHugeObject(envClass_, size); ++ auto header = heap_helper_.AllocateYoungGenerationOrHugeObject(env_class_, size); + if (UNLIKELY(header == nullptr)) { + return nullptr; + } +diff --git a/runtime/object_factory.cpp b/runtime/object_factory.cpp +index 2095e36..20fd273 100644 +--- a/runtime/object_factory.cpp ++++ b/runtime/object_factory.cpp +@@ -92,7 +92,7 @@ using ErrorType = base::ErrorType; + using ErrorHelper = base::ErrorHelper; + + ObjectFactory::ObjectFactory(JSThread *thread, Heap *heap) +- : thread_(thread), heapHelper_(heap), vm_(thread->GetEcmaVM()), heap_(heap) ++ : thread_(thread), heap_helper_(heap), vm_(thread->GetEcmaVM()), heap_(heap) + { + } + +@@ -100,7 +100,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); +@@ -111,7 +111,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); +@@ -119,57 +119,58 @@ 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_none_field_class_ = ++ JSHClass::Cast(globalConst->GetFreeObjectWithNoneFieldClass().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()); ++ 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()); +- machineCodeClass_ = JSHClass::Cast(globalConst->GetMachineCodeClass().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()); ++ machine_code_class_ = JSHClass::Cast(globalConst->GetMachineCodeClass().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) +@@ -310,7 +311,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; + } +@@ -334,7 +335,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); + +@@ -399,7 +400,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); + +@@ -863,16 +864,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_one_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_none_field_class_); + } else { + LOG_ECMA(DEBUG) << "Fill free object size is smaller"; + } +@@ -883,7 +884,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); +@@ -894,7 +895,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); + } +@@ -1231,7 +1232,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()); +@@ -1241,7 +1242,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()); +@@ -1314,7 +1315,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)); + } +@@ -1323,7 +1324,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; +@@ -1332,7 +1333,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)); +@@ -1351,7 +1352,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_); +@@ -1364,7 +1365,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_); +@@ -1377,7 +1378,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); +@@ -1430,7 +1431,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()); +@@ -1440,7 +1441,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); +@@ -1458,7 +1459,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()); +@@ -1469,7 +1470,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()); +@@ -1481,7 +1482,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()); +@@ -1491,7 +1492,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()); +@@ -1502,7 +1503,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()); +@@ -1514,7 +1515,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()); +@@ -1528,10 +1529,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); +@@ -1550,7 +1551,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); +@@ -1579,7 +1580,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; +@@ -1604,13 +1606,13 @@ JSHandle ObjectFactory::NewTaggedArray(uint32_t length, JSTaggedVal + TaggedObject *header = nullptr; + switch (spaceType) { + case MemSpaceType::SEMI_SPACE: +- header = heapHelper_.AllocateYoungGenerationOrHugeObject(arrayClass_, size); ++ header = heap_helper_.AllocateYoungGenerationOrHugeObject(array_class_, size); + break; + case MemSpaceType::OLD_SPACE: +- header = heapHelper_.AllocateOldGenerationOrHugeObject(arrayClass_, size); ++ header = heap_helper_.AllocateOldGenerationOrHugeObject(array_class_, size); + break; + case MemSpaceType::NON_MOVABLE: +- header = heapHelper_.AllocateNonMovableOrHugeObject(arrayClass_, size); ++ header = heap_helper_.AllocateNonMovableOrHugeObject(array_class_, size); + break; + default: + UNREACHABLE(); +@@ -1640,7 +1642,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); + array->InitializeWithSpecialValue(initVal, length); + return array; +@@ -1652,7 +1654,7 @@ 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); + +@@ -1666,13 +1668,13 @@ JSHandle ObjectFactory::NewLinkedHashTable(array_size_t length, JST + 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; +@@ -1685,7 +1687,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); + +@@ -1715,7 +1717,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); + +@@ -1742,7 +1744,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); + +@@ -1796,7 +1798,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; +@@ -1805,7 +1807,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()); +@@ -1817,7 +1819,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; +@@ -1843,7 +1845,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); +@@ -1902,7 +1904,7 @@ EcmaString *ObjectFactory::GetRawStringFromStringTable(const uint8_t *mutf8Data, + JSHandle ObjectFactory::NewPropertyBox(const JSHandle &value) + { + NewObjectHook(); +- TaggedObject *header = heapHelper_.AllocateYoungGenerationOrHugeObject(PropertyBoxClass_); ++ TaggedObject *header = heap_helper_.AllocateYoungGenerationOrHugeObject(property_box_class_); + JSHandle box(thread_, header); + box->SetValue(thread_, value); + return box; +@@ -1911,7 +1913,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; +@@ -1920,7 +1922,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)); +@@ -1933,7 +1935,7 @@ JSHandle ObjectFactory::NewProfileTypeInfo(uint32_t length) + ASSERT(length > 0); + + size_t size = TaggedArray::ComputeSize(JSTaggedValue::TaggedTypeSize(), length); +- auto header = heapHelper_.AllocateNonMovableOrHugeObject(arrayClass_, size); ++ auto header = heap_helper_.AllocateNonMovableOrHugeObject(array_class_, size); + JSHandle array(thread_, header); + array->InitializeWithSpecialValue(JSTaggedValue::Undefined(), length); + +@@ -1962,7 +1964,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(); + } +@@ -2086,7 +2088,7 @@ JSHandle ObjectFactory::NewTransitionHandler() + { + NewObjectHook(); + TransitionHandler *handler = +- TransitionHandler::Cast(heapHelper_.AllocateYoungGenerationOrHugeObject(transitionHandlerClass_)); ++ TransitionHandler::Cast(heap_helper_.AllocateYoungGenerationOrHugeObject(transition_handler_class_)); + return JSHandle(thread_, handler); + } + +@@ -2094,7 +2096,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()); +@@ -2105,7 +2107,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; +@@ -2114,7 +2116,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()); +@@ -2177,19 +2179,19 @@ EcmaString *ObjectFactory::ResolveString(uint32_t stringId) + auto id = panda_file::File::EntityId(stringId); + auto foundStr = pf->GetStringData(id); + +- return GetRawStringFromStringTable(foundStr.data, foundStr.utf16_length, foundStr.is_ascii); ++ return GetRawStringFromStringTable(foundStr.data_, foundStr.utf16_length_, foundStr.is_ascii_); + } + + uintptr_t ObjectFactory::NewSpaceBySnapShotAllocator(size_t size) + { + NewObjectHook(); +- return heapHelper_.AllocateSnapShotSpace(size); ++ return heap_helper_.AllocateSnapShotSpace(size); + } + + JSHandle ObjectFactory::NewMachineCodeObject(size_t length, const uint8_t *data) + { + NewObjectHook(); +- TaggedObject *obj = heapHelper_.AllocateMachineCodeSpaceObject(machineCodeClass_, length + MachineCode::SIZE); ++ TaggedObject *obj = heap_helper_.AllocateMachineCodeSpaceObject(machine_code_class_, length + MachineCode::SIZE); + MachineCode *code = MachineCode::Cast(obj); + code->SetInstructionSizeInBytes(thread_, JSTaggedValue(static_cast(length))); + if (data != nullptr) { +@@ -2202,7 +2204,7 @@ JSHandle ObjectFactory::NewMachineCodeObject(size_t length, const u + 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 ae3cbe1..717a5eb 100644 +--- a/runtime/object_factory.h ++++ b/runtime/object_factory.h +@@ -346,7 +346,7 @@ public: + + const MemManager &GetHeapManager() const + { +- return heapHelper_; ++ return heap_helper_; + } + + // used for creating jsobject by constructor +@@ -394,7 +394,7 @@ public: + + void SetTriggerGc(bool status) + { +- isTriggerGc_ = status; ++ is_trigger_gc_ = status; + } + + private: +@@ -408,53 +408,53 @@ 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 *machineCodeClass_ {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 *machine_code_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}; + Heap *heap_ {nullptr}; +diff --git a/runtime/object_operator.cpp b/runtime/object_operator.cpp +index d8fc375..fa90e9b 100644 +--- a/runtime/object_operator.cpp ++++ b/runtime/object_operator.cpp +@@ -36,7 +36,7 @@ void ObjectOperator::HandleKey(const JSHandle &key) + if (key->IsInt()) { + int32_t keyInt = key->GetInt(); + if (keyInt >= 0) { +- elementIndex_ = static_cast(keyInt); ++ element_index_ = static_cast(keyInt); + return; + } + key_ = JSHandle::Cast(base::NumberHelper::NumberToString(thread_, JSTaggedValue(keyInt))); +@@ -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); + } +@@ -539,7 +539,7 @@ bool ObjectOperator::AddProperty(const JSHandle &receiver, const JSHan + PropertyAttributes attr) + { + if (IsElement()) { +- return JSObject::AddElementInternal(thread_, receiver, elementIndex_, value, attr); ++ return JSObject::AddElementInternal(thread_, receiver, element_index_, value, attr); + } + + ResetState(); +@@ -612,10 +612,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; + } + } +@@ -627,18 +627,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; +diff --git a/runtime/object_operator.h b/runtime/object_operator.h +index 10a850f..c8b1046 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 +@@ -298,10 +298,10 @@ private: + 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/platform/platform.cpp b/runtime/platform/platform.cpp +index e226a1f..112d0be 100644 +--- a/runtime/platform/platform.cpp ++++ b/runtime/platform/platform.cpp +@@ -21,7 +21,7 @@ namespace panda::ecmascript { + void Platform::Initialize(int threadNum) + { + os::memory::LockHolder lock(mutex_); +- if (isInitialized_++ <= 0) { ++ if (is_initialized_++ <= 0) { + runner_ = std::make_unique(TheMostSuitableThreadNum(threadNum)); + } + } +@@ -29,11 +29,11 @@ void Platform::Initialize(int threadNum) + void Platform::Destroy() + { + os::memory::LockHolder lock(mutex_); +- if (isInitialized_ <= 0) { ++ if (is_initialized_ <= 0) { + return; + } +- isInitialized_--; +- if (isInitialized_ == 0) { ++ is_initialized_--; ++ if (is_initialized_ == 0) { + runner_->TerminateThread(); + } else { + runner_->TerminateTask(); +diff --git a/runtime/platform/platform.h b/runtime/platform/platform.h +index 2a4f2b5..077d9f9 100644 +--- a/runtime/platform/platform.h ++++ b/runtime/platform/platform.h +@@ -35,7 +35,7 @@ public: + { + os::memory::LockHolder lock(mutex_); + runner_->TerminateThread(); +- isInitialized_ = 0; ++ is_initialized_ = 0; + } + + NO_COPY_SEMANTIC(Platform); +@@ -46,7 +46,7 @@ public: + + void PostTask(std::unique_ptr task) const + { +- ASSERT(isInitialized_ > 0); ++ ASSERT(is_initialized_ > 0); + runner_->PostTask(std::move(task)); + } + +@@ -64,7 +64,7 @@ private: + uint32_t TheMostSuitableThreadNum(uint32_t threadNum) const; + + std::unique_ptr runner_; +- int isInitialized_ = 0; ++ int is_initialized_ = 0; + os::memory::Mutex mutex_; + }; + } // namespace panda::ecmascript +diff --git a/runtime/platform/runner.cpp b/runtime/platform/runner.cpp +index a70f59a..e0bfb0f 100644 +--- a/runtime/platform/runner.cpp ++++ b/runtime/platform/runner.cpp +@@ -18,23 +18,23 @@ + #include "os/thread.h" + + namespace panda::ecmascript { +-Runner::Runner(uint32_t threadNum) : totalThreadNum_(threadNum) ++Runner::Runner(uint32_t threadNum) : total_thread_num_(threadNum) + { + for (uint32_t i = 0; i < threadNum; i++) { + // main thread is 0; + std::unique_ptr thread = std::make_unique(&Runner::Run, this, i + 1); + os::thread::SetThreadName(thread->native_handle(), "GC_WorkerThread"); +- threadPool_.emplace_back(std::move(thread)); ++ thread_pool_.emplace_back(std::move(thread)); + } + +- for (auto ¤t : runningTask_) { ++ for (auto ¤t : running_task_) { + current = nullptr; + } + } + + void Runner::TerminateTask() + { +- for (auto ¤t : runningTask_) { ++ for (auto ¤t : running_task_) { + auto val = current.load(); + if (val != nullptr) { + val->Terminated(); +@@ -44,22 +44,22 @@ void Runner::TerminateTask() + + void Runner::TerminateThread() + { +- taskQueue_.Terminate(); ++ task_queue_.Terminate(); + TerminateTask(); + +- int threadNum = threadPool_.size(); ++ int threadNum = thread_pool_.size(); + for (int i = 0; i < threadNum; i++) { +- threadPool_.at(i)->join(); ++ thread_pool_.at(i)->join(); + } +- threadPool_.clear(); ++ thread_pool_.clear(); + } + + void Runner::Run(uint32_t threadId) + { +- while (std::unique_ptr task = taskQueue_.PopTask()) { +- runningTask_[threadId].store(task.get()); ++ while (std::unique_ptr task = task_queue_.PopTask()) { ++ running_task_[threadId].store(task.get()); + task->Run(threadId); +- runningTask_[threadId].store(nullptr); ++ running_task_[threadId].store(nullptr); + } + } + } // namespace panda::ecmascript +diff --git a/runtime/platform/runner.h b/runtime/platform/runner.h +index f5d5cca..122ef1e 100644 +--- a/runtime/platform/runner.h ++++ b/runtime/platform/runner.h +@@ -37,7 +37,7 @@ public: + + void PostTask(std::unique_ptr task) + { +- taskQueue_.PostTask(std::move(task)); ++ task_queue_.PostTask(std::move(task)); + } + + void TerminateThread(); +@@ -45,12 +45,12 @@ public: + + uint32_t GetTotalThreadNum() const + { +- return totalThreadNum_; ++ return total_thread_num_; + } + + bool IsInThreadPool(std::thread::id id) const + { +- for (auto &thread : threadPool_) { ++ for (auto &thread : thread_pool_) { + if (thread->get_id() == id) { + return true; + } +@@ -61,11 +61,11 @@ public: + private: + void Run(uint32_t threadId); + +- std::vector> threadPool_ {}; +- TaskQueue taskQueue_ {}; +- std::array, MAX_PLATFORM_THREAD_NUM + 1> runningTask_ {}; +- uint32_t totalThreadNum_ {0}; +- std::vector threadIdToIndexList_; ++ std::vector> thread_pool_ {}; ++ TaskQueue task_queue_ {}; ++ std::array, MAX_PLATFORM_THREAD_NUM + 1> running_task_ {}; ++ uint32_t total_thread_num_ {0}; ++ std::vector thread_id_to_index_list_; + }; + } // namespace panda::ecmascript + +diff --git a/runtime/regexp/dyn_chunk.cpp b/runtime/regexp/dyn_chunk.cpp +index 3b415b9..d895571 100644 +--- a/runtime/regexp/dyn_chunk.cpp ++++ b/runtime/regexp/dyn_chunk.cpp +@@ -19,12 +19,12 @@ + namespace panda::ecmascript { + int DynChunk::Expand(size_t newSize) + { +- if (newSize > allocatedSize_) { ++ if (newSize > allocated_size_) { + if (error_) { + return FAILURE; + } +- ASSERT(allocatedSize_ <= std::numeric_limits::max() / ALLOCATE_MULTIPLIER); +- size_t size = allocatedSize_ * ALLOCATE_MULTIPLIER; ++ ASSERT(allocated_size_ <= std::numeric_limits::max() / ALLOCATE_MULTIPLIER); ++ size_t size = allocated_size_ * ALLOCATE_MULTIPLIER; + if (size > newSize) { + newSize = size; + } +@@ -45,7 +45,7 @@ int DynChunk::Expand(size_t newSize) + } + } + buf_ = newBuf; +- allocatedSize_ = newSize; ++ allocated_size_ = newSize; + } + return SUCCESS; + } +@@ -69,7 +69,7 @@ int DynChunk::Insert(uint32_t position, size_t len) + + int DynChunk::Emit(const uint8_t *data, size_t length) + { +- if (UNLIKELY((size_ + length) > allocatedSize_)) { ++ if (UNLIKELY((size_ + length) > allocated_size_)) { + if (Expand(size_ + length) != 0) { + return FAILURE; + } +@@ -90,7 +90,7 @@ int DynChunk::EmitChar(uint8_t c) + + int DynChunk::EmitSelf(size_t offset, size_t length) + { +- if (UNLIKELY((size_ + length) > allocatedSize_)) { ++ if (UNLIKELY((size_ + length) > allocated_size_)) { + if (Expand(size_ + length) != 0) { + return FAILURE; + } +diff --git a/runtime/regexp/dyn_chunk.h b/runtime/regexp/dyn_chunk.h +index 61646de..0d03bdb 100644 +--- a/runtime/regexp/dyn_chunk.h ++++ b/runtime/regexp/dyn_chunk.h +@@ -77,7 +77,7 @@ public: + + inline size_t GetAllocatedSize() const + { +- return allocatedSize_; ++ return allocated_size_; + } + + inline bool GetError() const +@@ -142,7 +142,7 @@ private: + + uint8_t *buf_ {nullptr}; + size_t size_ {0}; +- size_t allocatedSize_ {0}; ++ size_t allocated_size_ {0}; + bool error_ {false}; + Chunk *chunk_ {nullptr}; + }; +diff --git a/runtime/regexp/regexp_executor.cpp b/runtime/regexp/regexp_executor.cpp +index 292c019..e9bb8a5 100644 +--- a/runtime/regexp/regexp_executor.cpp ++++ b/runtime/regexp/regexp_executor.cpp +@@ -28,27 +28,27 @@ bool RegExpExecutor::Execute(const uint8_t *input, uint32_t lastIndex, uint32_t + DynChunk buffer(buf, chunk_); + input_ = const_cast(input); + // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) +- inputEnd_ = const_cast(input + length * (isWideChar ? WIDE_CHAR_SIZE : CHAR_SIZE)); ++ input_end_ = const_cast(input + length * (isWideChar ? WIDE_CHAR_SIZE : CHAR_SIZE)); + uint32_t size = buffer.GetU32(0); +- nCapture_ = buffer.GetU32(RegExpParser::NUM_CAPTURE__OFFSET); +- nStack_ = buffer.GetU32(RegExpParser::NUM_STACK_OFFSET); ++ n_capture_ = buffer.GetU32(RegExpParser::NUM_CAPTURE__OFFSET); ++ n_stack_ = buffer.GetU32(RegExpParser::NUM_STACK_OFFSET); + flags_ = buffer.GetU32(RegExpParser::FLAGS_OFFSET); +- isWideChar_ = isWideChar; ++ is_wide_char_ = isWideChar; + +- uint32_t captureResultSize = sizeof(CaptureState) * nCapture_; +- uint32_t stackSize = sizeof(uintptr_t) * nStack_; +- stateSize_ = sizeof(RegExpState) + captureResultSize + stackSize; +- stateStackLen_ = 0; ++ uint32_t captureResultSize = sizeof(CaptureState) * n_capture_; ++ uint32_t stackSize = sizeof(uintptr_t) * n_stack_; ++ state_size_ = sizeof(RegExpState) + captureResultSize + stackSize; ++ state_stack_len_ = 0; + + if (captureResultSize != 0) { +- captureResultList_ = chunk_->NewArray(nCapture_); +- if (memset_s(captureResultList_, captureResultSize, 0, captureResultSize) != EOK) { ++ capture_result_list_ = chunk_->NewArray(n_capture_); ++ if (memset_s(capture_result_list_, captureResultSize, 0, captureResultSize) != EOK) { + LOG_ECMA(FATAL) << "memset_s failed"; + UNREACHABLE(); + } + } + if (stackSize != 0) { +- stack_ = chunk_->NewArray(nStack_); ++ stack_ = chunk_->NewArray(n_stack_); + if (memset_s(stack_, stackSize, 0, stackSize) != EOK) { + LOG_ECMA(FATAL) << "memset_s failed"; + UNREACHABLE(); +@@ -68,7 +68,7 @@ bool RegExpExecutor::Execute(const uint8_t *input, uint32_t lastIndex, uint32_t + bool RegExpExecutor::MatchFailed(bool isMatched) + { + while (true) { +- if (stateStackLen_ == 0) { ++ if (state_stack_len_ == 0) { + return true; + } + RegExpState *state = PeekRegExpState(); +@@ -99,7 +99,7 @@ bool RegExpExecutor::MatchFailed(bool isMatched) + + bool RegExpExecutor::HandleFirstSplit() + { +- if (GetCurrentPC() == RegExpParser::OP_START_OFFSET && stateStackLen_ == 0 && ++ if (GetCurrentPC() == RegExpParser::OP_START_OFFSET && state_stack_len_ == 0 && + (flags_ & RegExpParser::FLAG_STICKY) == 0) { + if (IsEOF()) { + if (MatchFailed()) { +@@ -166,9 +166,9 @@ bool RegExpExecutor::HandleOpWordBoundary(uint8_t opCode) + bool preIsWord = false; + if (GetCurrentPtr() != input_) { + // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) +- preIsWord = IsWordChar(PeekPrevChar(currentPtr_, input_)); ++ preIsWord = IsWordChar(PeekPrevChar(current_ptr_, input_)); + } +- bool currentIsWord = IsWordChar(PeekChar(currentPtr_, inputEnd_)); ++ bool currentIsWord = IsWordChar(PeekChar(current_ptr_, input_end_)); + if (((opCode == RegExpOpCode::OP_WORD_BOUNDARY) && + ((!preIsWord && currentIsWord) || (preIsWord && !currentIsWord))) || + ((opCode == RegExpOpCode::OP_NOT_WORD_BOUNDARY) && +@@ -189,7 +189,7 @@ bool RegExpExecutor::HandleOpLineStart(uint8_t opCode) + } + if ((GetCurrentPtr() == input_) || + // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) +- ((flags_ & RegExpParser::FLAG_MULTILINE) != 0 && PeekPrevChar(currentPtr_, input_) == '\n')) { ++ ((flags_ & RegExpParser::FLAG_MULTILINE) != 0 && PeekPrevChar(current_ptr_, input_) == '\n')) { + Advance(opCode); + } else { + if (MatchFailed()) { +@@ -203,7 +203,7 @@ bool RegExpExecutor::HandleOpLineEnd(uint8_t opCode) + { + if (IsEOF() || + // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) +- ((flags_ & RegExpParser::FLAG_MULTILINE) != 0 && PeekChar(currentPtr_, inputEnd_) == '\n')) { ++ ((flags_ & RegExpParser::FLAG_MULTILINE) != 0 && PeekChar(current_ptr_, input_end_) == '\n')) { + Advance(opCode); + } else { + if (MatchFailed()) { +@@ -216,20 +216,20 @@ bool RegExpExecutor::HandleOpLineEnd(uint8_t opCode) + void RegExpExecutor::HandleOpSaveStart(const DynChunk &byteCode, uint8_t opCode) + { + uint32_t captureIndex = byteCode.GetU8(GetCurrentPC() + 1); +- ASSERT(captureIndex < nCapture_); ++ ASSERT(captureIndex < n_capture_); + // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) +- CaptureState *captureState = &captureResultList_[captureIndex]; +- captureState->captureStart = GetCurrentPtr(); ++ CaptureState *captureState = &capture_result_list_[captureIndex]; ++ captureState->capture_start_ = GetCurrentPtr(); + Advance(opCode); + } + + void RegExpExecutor::HandleOpSaveEnd(const DynChunk &byteCode, uint8_t opCode) + { + uint32_t captureIndex = byteCode.GetU8(GetCurrentPC() + 1); +- ASSERT(captureIndex < nCapture_); ++ ASSERT(captureIndex < n_capture_); + // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) +- CaptureState *captureState = &captureResultList_[captureIndex]; +- captureState->captureEnd = GetCurrentPtr(); ++ CaptureState *captureState = &capture_result_list_[captureIndex]; ++ captureState->capture_end_ = GetCurrentPtr(); + Advance(opCode); + } + +@@ -238,9 +238,10 @@ void RegExpExecutor::HandleOpSaveReset(const DynChunk &byteCode, uint8_t opCode) + uint32_t catpureStartIndex = byteCode.GetU8(GetCurrentPC() + SAVE_RESET_START); + uint32_t catpureEndIndex = byteCode.GetU8(GetCurrentPC() + SAVE_RESET_END); + for (uint32_t i = catpureStartIndex; i <= catpureEndIndex; i++) { +- CaptureState *captureState = &captureResultList_[i]; // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic) +- captureState->captureStart = nullptr; +- captureState->captureEnd = nullptr; ++ CaptureState *captureState = ++ &capture_result_list_[i]; // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic) ++ captureState->capture_start_ = nullptr; ++ captureState->capture_end_ = nullptr; + } + Advance(opCode); + } +@@ -270,7 +271,7 @@ bool RegExpExecutor::HandleOpPrev(uint8_t opCode) + return false; + } + } else { +- PrevPtr(¤tPtr_, input_); ++ PrevPtr(¤t_ptr_, input_); + Advance(opCode); + } + return true; +@@ -392,13 +393,13 @@ bool RegExpExecutor::HandleOpRange(const DynChunk &byteCode) + bool RegExpExecutor::HandleOpBackReference(const DynChunk &byteCode, uint8_t opCode) + { + uint32_t captureIndex = byteCode.GetU8(GetCurrentPC() + 1); +- if (captureIndex >= nCapture_) { ++ if (captureIndex >= n_capture_) { + return !MatchFailed(); + } + // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) +- const uint8_t *captureStart = captureResultList_[captureIndex].captureStart; ++ const uint8_t *captureStart = capture_result_list_[captureIndex].capture_start_; + // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) +- const uint8_t *captureEnd = captureResultList_[captureIndex].captureEnd; ++ const uint8_t *captureEnd = capture_result_list_[captureIndex].capture_end_; + if (captureStart == nullptr || captureEnd == nullptr) { + Advance(opCode); + return true; +@@ -414,7 +415,7 @@ bool RegExpExecutor::HandleOpBackReference(const DynChunk &byteCode, uint8_t opC + // NOLINTNEXTLINE(readability-identifier-naming) + uint32_t c1 = GetChar(&refCptr, captureEnd); + // NOLINTNEXTLINE(readability-identifier-naming) +- uint32_t c2 = GetChar(¤tPtr_, inputEnd_); ++ uint32_t c2 = GetChar(¤t_ptr_, input_end_); + if (IsIgnoreCase()) { + c1 = RegExpParser::Canonicalize(c1, IsUtf16()); + c2 = RegExpParser::Canonicalize(c2, IsUtf16()); +@@ -441,7 +442,7 @@ bool RegExpExecutor::HandleOpBackReference(const DynChunk &byteCode, uint8_t opC + // NOLINTNEXTLINE(readability-identifier-naming) + uint32_t c1 = GetPrevChar(&refCptr, captureStart); + // NOLINTNEXTLINE(readability-identifier-naming) +- uint32_t c2 = GetPrevChar(¤tPtr_, input_); ++ uint32_t c2 = GetPrevChar(¤t_ptr_, input_); + if (IsIgnoreCase()) { + c1 = RegExpParser::Canonicalize(c1, IsUtf16()); + c2 = RegExpParser::Canonicalize(c2, IsUtf16()); +@@ -586,12 +587,13 @@ bool RegExpExecutor::ExecuteInternal(const DynChunk &byteCode, uint32_t pcEnd) + void RegExpExecutor::DumpResult(std::ostream &out) const + { + out << "captures:" << std::endl; +- for (uint32_t i = 0; i < nCapture_; i++) { ++ for (uint32_t i = 0; i < n_capture_; i++) { + // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) +- CaptureState *captureState = &captureResultList_[i]; +- int32_t len = captureState->captureEnd - captureState->captureStart; +- if ((captureState->captureStart != nullptr && captureState->captureEnd != nullptr) && (len >= 0)) { +- out << i << ":\t" << CString(reinterpret_cast(captureState->captureStart), len) << std::endl; ++ CaptureState *captureState = &capture_result_list_[i]; ++ int32_t len = captureState->capture_end_ - captureState->capture_start_; ++ if ((captureState->capture_start_ != nullptr && captureState->capture_end_ != nullptr) && (len >= 0)) { ++ out << i << ":\t" << CString(reinterpret_cast(captureState->capture_start_), len) ++ << std::endl; + } else { + out << i << ":\t" + << "undefined" << std::endl; +@@ -604,30 +606,30 @@ MatchResult RegExpExecutor::GetResult(const JSThread *thread, bool isSuccess) co + ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + MatchResult result; + std::vector>> captures; +- result.isSuccess_ = isSuccess; ++ result.is_success_ = isSuccess; + if (isSuccess) { +- for (uint32_t i = 0; i < nCapture_; i++) { ++ for (uint32_t i = 0; i < n_capture_; i++) { + // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) +- CaptureState *captureState = &captureResultList_[i]; ++ CaptureState *captureState = &capture_result_list_[i]; + if (i == 0) { +- result.index_ = captureState->captureStart - input_; +- if (isWideChar_) { ++ result.index_ = captureState->capture_start_ - input_; ++ if (is_wide_char_) { + result.index_ /= WIDE_CHAR_SIZE; + } + } +- int32_t len = captureState->captureEnd - captureState->captureStart; ++ int32_t len = captureState->capture_end_ - captureState->capture_start_; + std::pair> pair; +- if ((captureState->captureStart != nullptr && captureState->captureEnd != nullptr) && (len >= 0)) { ++ if ((captureState->capture_start_ != nullptr && captureState->capture_end_ != nullptr) && (len >= 0)) { + pair.first = false; +- if (isWideChar_) { ++ if (is_wide_char_) { + // create utf-16 string + pair.second = factory->NewFromUtf16UnCheck( +- reinterpret_cast(captureState->captureStart), len / 2, false); ++ reinterpret_cast(captureState->capture_start_), len / 2, false); + } else { + // create utf-8 string + CVector buffer(len + 1); + uint8_t *dest = buffer.data(); +- if (memcpy_s(dest, len + 1, reinterpret_cast(captureState->captureStart), len) != ++ if (memcpy_s(dest, len + 1, reinterpret_cast(captureState->capture_start_), len) != + EOK) { + LOG_ECMA(FATAL) << "memcpy_s failed"; + UNREACHABLE(); +@@ -643,9 +645,9 @@ MatchResult RegExpExecutor::GetResult(const JSThread *thread, bool isSuccess) co + captures.emplace_back(pair); + } + result.captures_ = captures; +- result.endIndex_ = currentPtr_ - input_; +- if (isWideChar_) { +- result.endIndex_ /= WIDE_CHAR_SIZE; ++ result.end_index_ = current_ptr_ - input_; ++ if (is_wide_char_) { ++ result.end_index_ /= WIDE_CHAR_SIZE; + } + } + return result; +@@ -653,56 +655,56 @@ MatchResult RegExpExecutor::GetResult(const JSThread *thread, bool isSuccess) co + + void RegExpExecutor::PushRegExpState(StateType type, uint32_t pc) + { +- ReAllocStack(stateStackLen_ + 1); ++ ReAllocStack(state_stack_len_ + 1); + auto state = +- reinterpret_cast(stateStack_ + // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic) +- stateStackLen_ * stateSize_); ++ reinterpret_cast(state_stack_ + // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic) ++ state_stack_len_ * state_size_); + state->type_ = type; +- state->currentPc_ = pc; +- state->currentStack_ = currentStack_; +- state->currentPtr_ = GetCurrentPtr(); +- size_t listSize = sizeof(CaptureState) * nCapture_; +- if (memcpy_s(state->captureResultList_, listSize, GetCaptureResultList(), listSize) != EOK) { ++ state->current_pc_ = pc; ++ state->current_stack_ = current_stack_; ++ state->current_ptr_ = GetCurrentPtr(); ++ size_t listSize = sizeof(CaptureState) * n_capture_; ++ if (memcpy_s(state->capture_result_list_, listSize, GetCaptureResultList(), listSize) != EOK) { + LOG_ECMA(FATAL) << "memcpy_s failed"; + UNREACHABLE(); + } + uint8_t *stackStart = + // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) +- reinterpret_cast(state->captureResultList_) + sizeof(CaptureState) * nCapture_; ++ reinterpret_cast(state->capture_result_list_) + sizeof(CaptureState) * n_capture_; + if (stack_ != nullptr) { +- size_t stackSize = sizeof(uintptr_t) * nStack_; ++ size_t stackSize = sizeof(uintptr_t) * n_stack_; + if (memcpy_s(stackStart, stackSize, stack_, stackSize) != EOK) { + LOG_ECMA(FATAL) << "memcpy_s failed"; + UNREACHABLE(); + } + } +- stateStackLen_++; ++ state_stack_len_++; + } + + RegExpState *RegExpExecutor::PopRegExpState(bool copyCaptrue) + { +- if (stateStackLen_ != 0) { ++ if (state_stack_len_ != 0) { + auto state = PeekRegExpState(); +- size_t listSize = sizeof(CaptureState) * nCapture_; ++ size_t listSize = sizeof(CaptureState) * n_capture_; + if (copyCaptrue) { +- if (memcpy_s(GetCaptureResultList(), listSize, state->captureResultList_, listSize) != EOK) { ++ if (memcpy_s(GetCaptureResultList(), listSize, state->capture_result_list_, listSize) != EOK) { + LOG_ECMA(FATAL) << "memcpy_s failed"; + UNREACHABLE(); + } + } +- SetCurrentPtr(state->currentPtr_); +- SetCurrentPC(state->currentPc_); +- currentStack_ = state->currentStack_; ++ SetCurrentPtr(state->current_ptr_); ++ SetCurrentPC(state->current_pc_); ++ current_stack_ = state->current_stack_; + // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) +- uint8_t *stackStart = reinterpret_cast(state->captureResultList_) + listSize; ++ uint8_t *stackStart = reinterpret_cast(state->capture_result_list_) + listSize; + if (stack_ != nullptr) { +- size_t stackSize = sizeof(uintptr_t) * nStack_; ++ size_t stackSize = sizeof(uintptr_t) * n_stack_; + if (memcpy_s(stack_, stackSize, stackStart, stackSize) != EOK) { + LOG_ECMA(FATAL) << "memcpy_s failed"; + UNREACHABLE(); + } + } +- stateStackLen_--; ++ state_stack_len_--; + return state; + } + return nullptr; +@@ -710,22 +712,22 @@ RegExpState *RegExpExecutor::PopRegExpState(bool copyCaptrue) + + void RegExpExecutor::ReAllocStack(uint32_t stackLen) + { +- if (stackLen > stateStackSize_) { +- uint32_t newStackSize = std::max(stateStackSize_ * 2, MIN_STACK_SIZE); // 2: double the size +- uint32_t stackByteSize = newStackSize * stateSize_; ++ if (stackLen > state_stack_size_) { ++ uint32_t newStackSize = std::max(state_stack_size_ * 2, MIN_STACK_SIZE); // 2: double the size ++ uint32_t stackByteSize = newStackSize * state_size_; + auto newStack = chunk_->NewArray(stackByteSize); + if (memset_s(newStack, stackByteSize, 0, stackByteSize) != EOK) { + LOG_ECMA(FATAL) << "memset_s failed"; + UNREACHABLE(); + } +- if (stateStack_ != nullptr) { +- size_t stackSize = stateStackSize_ * stateSize_; +- if (memcpy_s(newStack, stackSize, stateStack_, stackSize) != EOK) { ++ if (state_stack_ != nullptr) { ++ size_t stackSize = state_stack_size_ * state_size_; ++ if (memcpy_s(newStack, stackSize, state_stack_, stackSize) != EOK) { + return; + } + } +- stateStack_ = newStack; +- stateStackSize_ = newStackSize; ++ state_stack_ = newStack; ++ state_stack_size_ = newStackSize; + } + } + } // namespace panda::ecmascript +diff --git a/runtime/regexp/regexp_executor.h b/runtime/regexp/regexp_executor.h +index bc59233..d0f14c2 100644 +--- a/runtime/regexp/regexp_executor.h ++++ b/runtime/regexp/regexp_executor.h +@@ -23,8 +23,8 @@ namespace panda::ecmascript { + class RegExpExecutor { + public: + struct CaptureState { +- const uint8_t *captureStart; +- const uint8_t *captureEnd; ++ const uint8_t *capture_start_; ++ const uint8_t *capture_end_; + }; + + enum StateType : uint8_t { +@@ -35,18 +35,18 @@ public: + + struct RegExpState { + StateType type_ = STATE_SPLIT; +- uint32_t currentPc_ = 0; +- uint32_t currentStack_ = 0; +- const uint8_t *currentPtr_ = nullptr; +- __extension__ CaptureState *captureResultList_[0]; // NOLINT(modernize-avoid-c-arrays) ++ uint32_t current_pc_ = 0; ++ uint32_t current_stack_ = 0; ++ const uint8_t *current_ptr_ = nullptr; ++ __extension__ CaptureState *capture_result_list_[0]; // NOLINT(modernize-avoid-c-arrays) + }; + + struct MatchResult { +- uint32_t endIndex_ = 0; ++ uint32_t end_index_ = 0; + uint32_t index_ = 0; + // first value is true if result is undefined + std::vector>> captures_; +- bool isSuccess_ = false; ++ bool is_success_ = false; + }; + + explicit RegExpExecutor(Chunk *chunk) : chunk_(chunk) +@@ -81,30 +81,30 @@ public: + + inline void Advance(uint8_t opCode, uint32_t offset = 0) + { +- currentPc_ += offset + RegExpOpCode::GetRegExpOpCode(opCode)->GetSize(); ++ current_pc_ += offset + RegExpOpCode::GetRegExpOpCode(opCode)->GetSize(); + } + + inline void AdvanceOffset(uint32_t offset) + { + // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) +- currentPc_ += offset; ++ current_pc_ += offset; + } + + inline uint32_t GetCurrentChar() + { +- return GetChar(¤tPtr_, inputEnd_); ++ return GetChar(¤t_ptr_, input_end_); + } + + inline void AdvanceCurrentPtr() + { +- AdvancePtr(¤tPtr_, inputEnd_); ++ AdvancePtr(¤t_ptr_, input_end_); + } + + uint32_t GetChar(const uint8_t **pp, const uint8_t *end) const + { + uint32_t c; + const uint8_t *cptr = *pp; +- if (!isWideChar_) { ++ if (!is_wide_char_) { + c = *cptr; + *pp += 1; // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic) + } else { +@@ -127,7 +127,7 @@ public: + { + uint32_t c; + const uint8_t *cptr = p; +- if (!isWideChar_) { ++ if (!is_wide_char_) { + c = *cptr; + } else { + uint16_t c1 = *(uint16_t *)cptr; // NOLINT(cppcoreguidelines-pro-type-cstyle-cast) +@@ -146,7 +146,7 @@ public: + void AdvancePtr(const uint8_t **pp, const uint8_t *end) const + { + const uint8_t *cptr = *pp; +- if (!isWideChar_) { ++ if (!is_wide_char_) { + *pp += 1; // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic) + } else { + uint16_t c1 = *(uint16_t *)cptr; // NOLINT(cppcoreguidelines-pro-type-cstyle-cast) +@@ -165,7 +165,7 @@ public: + { + uint32_t c; + const uint8_t *cptr = p; +- if (!isWideChar_) { ++ if (!is_wide_char_) { + c = *(cptr - 1); // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic) + } else { + cptr -= WIDE_CHAR_SIZE; // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic) +@@ -186,7 +186,7 @@ public: + { + uint32_t c; + const uint8_t *cptr = *pp; +- if (!isWideChar_) { ++ if (!is_wide_char_) { + c = *(cptr - 1); // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic) + cptr -= 1; // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic) + *pp = cptr; +@@ -211,7 +211,7 @@ public: + void PrevPtr(const uint8_t **pp, const uint8_t *start) const + { + const uint8_t *cptr = *pp; +- if (!isWideChar_) { ++ if (!is_wide_char_) { + cptr -= 1; // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic) + *pp = cptr; + } else { +@@ -233,60 +233,60 @@ public: + + void SetCurrentPC(uint32_t pc) + { +- currentPc_ = pc; ++ current_pc_ = pc; + } + + void SetCurrentPtr(const uint8_t *ptr) + { +- currentPtr_ = ptr; ++ current_ptr_ = ptr; + } + + bool IsEOF() const + { +- return currentPtr_ >= inputEnd_; ++ return current_ptr_ >= input_end_; + } + + uint32_t GetCurrentPC() const + { +- return currentPc_; ++ return current_pc_; + } + + void PushStack(uintptr_t val) + { +- ASSERT(currentStack_ < nStack_); ++ ASSERT(current_stack_ < n_stack_); + // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) +- stack_[currentStack_++] = val; ++ stack_[current_stack_++] = val; + } + + void SetStackValue(uintptr_t val) const + { +- ASSERT(currentStack_ >= 1); ++ ASSERT(current_stack_ >= 1); + // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) +- stack_[currentStack_ - 1] = val; ++ stack_[current_stack_ - 1] = val; + } + + uintptr_t PopStack() + { +- ASSERT(currentStack_ >= 1); ++ ASSERT(current_stack_ >= 1); + // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) +- return stack_[--currentStack_]; ++ return stack_[--current_stack_]; + } + + uintptr_t PeekStack() const + { +- ASSERT(currentStack_ >= 1); ++ ASSERT(current_stack_ >= 1); + // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) +- return stack_[currentStack_ - 1]; ++ return stack_[current_stack_ - 1]; + } + + const uint8_t *GetCurrentPtr() const + { +- return currentPtr_; ++ return current_ptr_; + } + + CaptureState *GetCaptureResultList() const + { +- return captureResultList_; ++ return capture_result_list_; + } + + void DumpResult(std::ostream &out) const; +@@ -299,14 +299,15 @@ public: + + void DropRegExpState() + { +- stateStackLen_--; ++ state_stack_len_--; + } + + RegExpState *PeekRegExpState() const + { +- ASSERT(stateStackLen_ >= 1); +- return reinterpret_cast(stateStack_ + // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic) +- (stateStackLen_ - 1) * stateSize_); ++ ASSERT(state_stack_len_ >= 1); ++ return reinterpret_cast( ++ state_stack_ + // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic) ++ (state_stack_len_ - 1) * state_size_); + } + + void ReAllocStack(uint32_t stackLen); +@@ -348,23 +349,23 @@ private: + static constexpr uint32_t STACK_MULTIPLIER = 2; + static constexpr uint32_t MIN_STACK_SIZE = 8; + uint8_t *input_ = nullptr; +- uint8_t *inputEnd_ = nullptr; +- bool isWideChar_ = false; ++ uint8_t *input_end_ = nullptr; ++ bool is_wide_char_ = false; + +- uint32_t currentPc_ = 0; +- const uint8_t *currentPtr_ = nullptr; +- CaptureState *captureResultList_ = nullptr; ++ uint32_t current_pc_ = 0; ++ const uint8_t *current_ptr_ = nullptr; ++ CaptureState *capture_result_list_ = nullptr; + uintptr_t *stack_ = nullptr; +- uint32_t currentStack_ = 0; ++ uint32_t current_stack_ = 0; + +- uint32_t nCapture_ = 0; +- uint32_t nStack_ = 0; ++ uint32_t n_capture_ = 0; ++ uint32_t n_stack_ = 0; + + uint32_t flags_ = 0; +- uint32_t stateStackLen_ = 0; +- uint32_t stateStackSize_ = 0; +- uint32_t stateSize_ = 0; +- uint8_t *stateStack_ = nullptr; ++ uint32_t state_stack_len_ = 0; ++ uint32_t state_stack_size_ = 0; ++ uint32_t state_size_ = 0; ++ uint8_t *state_stack_ = nullptr; + Chunk *chunk_ = nullptr; + }; + } // namespace panda::ecmascript +diff --git a/runtime/regexp/regexp_opcode.cpp b/runtime/regexp/regexp_opcode.cpp +index a25a6db..4b3a693 100644 +--- a/runtime/regexp/regexp_opcode.cpp ++++ b/runtime/regexp/regexp_opcode.cpp +@@ -111,7 +111,7 @@ static std::vector g_intrinsicSet = { + &g_range32Opcode, + }; + +-RegExpOpCode::RegExpOpCode(uint8_t opCode, int size) : opCode_(opCode), size_(size) {} ++RegExpOpCode::RegExpOpCode(uint8_t opCode, int size) : op_code_(opCode), size_(size) {} + + /* static */ + RegExpOpCode *RegExpOpCode::GetRegExpOpCode(const DynChunk &buf, int pc) +@@ -487,9 +487,9 @@ uint32_t RangeOpCode::DumpOpCode(std::ostream &out, const DynChunk &buf, uint32_ + uint32_t RangeOpCode::InsertOpCode(DynChunk *buf, const RangeSet &rangeSet) const + { + buf->EmitChar(GetOpCode()); +- size_t size = rangeSet.rangeSet_.size(); ++ size_t size = rangeSet.range_set_.size(); + buf->EmitU16(size); +- for (auto range : rangeSet.rangeSet_) { ++ for (auto range : rangeSet.range_set_) { + buf->EmitU16(range.first); + buf->EmitU16(range.second); + } +@@ -514,9 +514,9 @@ uint32_t Range32OpCode::DumpOpCode(std::ostream &out, const DynChunk &buf, uint3 + uint32_t Range32OpCode::InsertOpCode(DynChunk *buf, const RangeSet &rangeSet) const + { + buf->EmitChar(GetOpCode()); +- size_t size = rangeSet.rangeSet_.size(); ++ size_t size = rangeSet.range_set_.size(); + buf->EmitU16(size); +- for (auto range : rangeSet.rangeSet_) { ++ for (auto range : rangeSet.range_set_) { + buf->EmitU32(range.first); + buf->EmitU32(range.second); + } +@@ -595,10 +595,10 @@ void RangeSet::Insert(uint32_t start, uint32_t end) + return; + } + std::pair pairElement = std::make_pair(start, end); +- if (rangeSet_.empty()) { +- rangeSet_.emplace_back(pairElement); ++ if (range_set_.empty()) { ++ range_set_.emplace_back(pairElement); + } else { +- for (auto iter = rangeSet_.begin(); iter != rangeSet_.end(); iter++) { ++ for (auto iter = range_set_.begin(); iter != range_set_.end(); iter++) { + if (IsIntersect(start, end, iter->first, iter->second) || + IsAdjacent(start, end, iter->first, iter->second)) { + iter->first = std::min(iter->first, start); +@@ -606,23 +606,23 @@ void RangeSet::Insert(uint32_t start, uint32_t end) + return; + } + if (iter->first > end) { +- rangeSet_.insert(iter, pairElement); ++ range_set_.insert(iter, pairElement); + return; + } + } +- rangeSet_.emplace_back(pairElement); ++ range_set_.emplace_back(pairElement); + } + } + + void RangeSet::Insert(const RangeSet &s1) + { +- if (s1.rangeSet_.empty()) { ++ if (s1.range_set_.empty()) { + return; + } +- if (rangeSet_.empty()) { +- rangeSet_ = s1.rangeSet_; ++ if (range_set_.empty()) { ++ range_set_ = s1.range_set_; + } else { +- for (auto range : s1.rangeSet_) { ++ for (auto range : s1.range_set_) { + Insert(range.first, range.second); + } + Compress(); +@@ -632,28 +632,28 @@ void RangeSet::Insert(const RangeSet &s1) + void RangeSet::Invert(bool isUtf16) + { + uint32_t maxValue = isUtf16 ? UINT32_MAX : UINT16_MAX; +- if (rangeSet_.empty()) { +- rangeSet_.emplace_back(std::make_pair(0, maxValue)); ++ if (range_set_.empty()) { ++ range_set_.emplace_back(std::make_pair(0, maxValue)); + return; + } + +- auto iter = rangeSet_.begin(); +- auto iter2 = rangeSet_.begin(); ++ auto iter = range_set_.begin(); ++ auto iter2 = range_set_.begin(); + if (iter->first == 0 && iter->second == maxValue) { +- rangeSet_.clear(); ++ range_set_.clear(); + return; + } + iter2++; + + uint32_t first = iter->first; + +- for (iter = rangeSet_.begin(); iter != rangeSet_.end(); iter++) { ++ for (iter = range_set_.begin(); iter != range_set_.end(); iter++) { + if (iter->second == maxValue) { +- rangeSet_.erase(iter); ++ range_set_.erase(iter); + break; + } + iter->first = iter->second + 1; +- if (iter2 != rangeSet_.end()) { ++ if (iter2 != range_set_.end()) { + iter->second = iter2->first - 1; + iter2++; + } else { +@@ -662,22 +662,22 @@ void RangeSet::Invert(bool isUtf16) + } + if (first > 0) { + std::pair pair1 = std::make_pair(0, first - 1); +- rangeSet_.push_front(pair1); ++ range_set_.push_front(pair1); + } + Compress(); + } + + void RangeSet::Compress() + { +- auto iter = rangeSet_.begin(); +- auto iter2 = rangeSet_.begin(); ++ auto iter = range_set_.begin(); ++ auto iter2 = range_set_.begin(); + iter2++; +- while (iter2 != rangeSet_.end()) { ++ while (iter2 != range_set_.end()) { + if (IsIntersect(iter->first, iter->second, iter2->first, iter2->second) || + IsAdjacent(iter->first, iter->second, iter2->first, iter2->second)) { + iter->first = std::min(iter->first, iter2->first); + iter->second = std::max(iter->second, iter2->second); +- iter2 = rangeSet_.erase(iter2); ++ iter2 = range_set_.erase(iter2); + } else { + iter++; + iter2++; +diff --git a/runtime/regexp/regexp_opcode.h b/runtime/regexp/regexp_opcode.h +index 6cf830d..aefbac1 100644 +--- a/runtime/regexp/regexp_opcode.h ++++ b/runtime/regexp/regexp_opcode.h +@@ -79,7 +79,7 @@ public: + } + inline uint8_t GetOpCode() const + { +- return opCode_; ++ return op_code_; + } + inline int GetDynChunkfSize(const DynChunk &buf) const + { +@@ -88,7 +88,7 @@ public: + virtual uint32_t DumpOpCode(std::ostream &out, const DynChunk &buf, uint32_t offset) const = 0; + + private: +- uint8_t opCode_ {0}; ++ uint8_t op_code_ {0}; + uint8_t size_ {0}; + }; + +@@ -316,7 +316,7 @@ public: + } + explicit RangeSet(const std::list> &rangeSet) + { +- rangeSet_ = rangeSet; ++ range_set_ = rangeSet; + } + ~RangeSet() = default; + +@@ -331,12 +331,12 @@ public: + + inline bool operator==(const RangeSet &other) const + { +- return rangeSet_ == other.rangeSet_; ++ return range_set_ == other.range_set_; + } + + inline bool IsContain(uint32_t value) const + { +- for (auto range : rangeSet_) { ++ for (auto range : range_set_) { + if (value >= range.first && value <= range.second) { + return true; + } +@@ -346,8 +346,8 @@ public: + + inline uint32_t HighestValue() const + { +- if (!rangeSet_.empty()) { +- return rangeSet_.back().second; ++ if (!range_set_.empty()) { ++ return range_set_.back().second; + } + return 0; + } +@@ -365,7 +365,7 @@ public: + private: + friend class RangeOpCode; + friend class Range32OpCode; +- std::list> rangeSet_ {}; ++ std::list> range_set_ {}; + }; + + class RangeOpCode : public RegExpOpCode { +diff --git a/runtime/regexp/regexp_parser.cpp b/runtime/regexp/regexp_parser.cpp +index e972e9b..895b314 100644 +--- a/runtime/regexp/regexp_parser.cpp ++++ b/runtime/regexp/regexp_parser.cpp +@@ -81,7 +81,7 @@ void RegExpParser::Parse() + // NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg) + Advance(); + SaveStartOpCode saveStartOp; +- int captureIndex = captureCount_++; ++ int captureIndex = capture_count_++; + saveStartOp.EmitOpCode(&buffer_, captureIndex); + ParseDisjunction(false); + if (c0_ != KEY_EOF) { +@@ -94,8 +94,8 @@ void RegExpParser::Parse() + matchEndOp.EmitOpCode(&buffer_, 0); + // dynbuffer head assignments + buffer_.PutU32(0, buffer_.size_); +- buffer_.PutU32(NUM_CAPTURE__OFFSET, captureCount_); +- buffer_.PutU32(NUM_STACK_OFFSET, stackCount_); ++ buffer_.PutU32(NUM_CAPTURE__OFFSET, capture_count_); ++ buffer_.PutU32(NUM_STACK_OFFSET, stack_count_); + buffer_.PutU32(FLAGS_OFFSET, flags_); + #ifndef _NO_DEBUG_ + RegExpOpCode::DumpRegExpOpCode(std::cout, buffer_); +@@ -108,7 +108,7 @@ void RegExpParser::ParseDisjunction(bool isBackward) + PrintF("Parse Disjunction------\n"); + size_t start = buffer_.size_; + ParseAlternative(isBackward); +- if (isError_) { ++ if (is_error_) { + return; + } + do { +@@ -228,7 +228,7 @@ void RegExpParser::ParseAlternative(bool isBackward) + { + size_t start = buffer_.size_; + while (c0_ != '|' && c0_ != KEY_EOF && c0_ != ')') { +- if (isError_) { ++ if (is_error_) { + return; + } + size_t atomBcStart = buffer_.GetSize(); +@@ -424,8 +424,8 @@ void RegExpParser::ParseAlternative(bool isBackward) + Advance(); + break; + } +- if (isAtom && !isError_) { +- ParseQuantifier(atomBcStart, captureIndex, captureCount_ - 1); ++ if (isAtom && !is_error_) { ++ ParseQuantifier(atomBcStart, captureIndex, capture_count_ - 1); + } + if (isBackward) { + size_t end = buffer_.GetSize(); +@@ -453,9 +453,9 @@ int RegExpParser::FindGroupName(const CString &name) + { + size_t len = 0; + size_t nameLen = name.size(); +- const char *p = reinterpret_cast(groupNames_.buf_); ++ const char *p = reinterpret_cast(group_names_.buf_); + // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) +- const char *bufEnd = reinterpret_cast(groupNames_.buf_) + groupNames_.size_; ++ const char *bufEnd = reinterpret_cast(group_names_.buf_) + group_names_.size_; + int captureIndex = 1; + while (p < bufEnd) { + len = strlen(p); +@@ -539,7 +539,7 @@ bool RegExpParser::ParseAssertionCapture(int *captureIndex, bool isBackward) + ParseError("Duplicate GroupName error."); + return false; + } +- groupNames_.EmitStr(name.c_str()); ++ group_names_.EmitStr(name.c_str()); + // NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg) + PrintF("group name %s", name.c_str()); + Advance(); +@@ -560,10 +560,10 @@ bool RegExpParser::ParseAssertionCapture(int *captureIndex, bool isBackward) + return false; + } + } else { +- groupNames_.EmitChar(0); ++ group_names_.EmitChar(0); + parseCapture: + isAtom = true; +- *captureIndex = captureCount_++; ++ *captureIndex = capture_count_++; + SaveEndOpCode saveEndOp; + SaveStartOpCode saveStartOp; + if (isBackward) { +@@ -713,7 +713,7 @@ void RegExpParser::ParseQuantifier(size_t atomBcStart, int captureStart, int cap + return; + } + if (min != -1 && max != -1) { +- stackCount_++; ++ stack_count_++; + PushOpCode pushOp; + pushOp.InsertOpCode(&buffer_, atomBcStart); + atomBcStart += pushOp.GetSize(); +@@ -725,7 +725,7 @@ void RegExpParser::ParseQuantifier(size_t atomBcStart, int captureStart, int cap + + // zero advance check + if (max == INT32_MAX) { +- stackCount_++; ++ stack_count_++; + PushCharOpCode pushCharOp; + pushCharOp.InsertOpCode(&buffer_, atomBcStart); + CheckCharOpCode checkCharOp; +@@ -855,7 +855,7 @@ int RegExpParser::ParseAtomEscape(bool isBackward) + // NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg) + PrintF("NonZeroDigit %c\n", c0_); + int capture = ParseDecimalDigits(); +- if (capture > captureCount_ - 1 && capture > ParseCaptureCount(nullptr) - 1) { ++ if (capture > capture_count_ - 1 && capture > ParseCaptureCount(nullptr) - 1) { + ParseError("invalid backreference count"); + break; + } +@@ -1287,7 +1287,7 @@ void RegExpParser::ParseError(const char *errorMessage) + PrintF("\n"); + SetIsError(); + size_t length = strlen(errorMessage) + 1; +- if (memcpy_s(errorMsg_, length, errorMessage, length) != EOK) { ++ if (memcpy_s(error_msg_, length, errorMessage, length) != EOK) { + LOG_ECMA(FATAL) << "memcpy_s failed"; + UNREACHABLE(); + } +diff --git a/runtime/regexp/regexp_parser.h b/runtime/regexp/regexp_parser.h +index 6dc705b..06daff4 100644 +--- a/runtime/regexp/regexp_parser.h ++++ b/runtime/regexp/regexp_parser.h +@@ -51,7 +51,7 @@ public: + static constexpr uint32_t UNICODE_HEX_ADVANCE = 2; + static constexpr uint32_t CAPTURE_CONUT_ADVANCE = 3; + +- explicit RegExpParser(Chunk *chunk) : c0_(KEY_EOF), buffer_(chunk), groupNames_(chunk) {} ++ explicit RegExpParser(Chunk *chunk) : c0_(KEY_EOF), buffer_(chunk), group_names_(chunk) {} + + ~RegExpParser() + { +@@ -95,7 +95,7 @@ public: + + inline bool IsError() const + { +- return isError_; ++ return is_error_; + } + + inline uint8_t *GetOriginBuffer() const +@@ -110,8 +110,8 @@ public: + + inline CString GetErrorMsg() const + { +- if (isError_) { +- return CString(errorMsg_); ++ if (is_error_) { ++ return CString(error_msg_); + } + return CString(""); + } +@@ -169,7 +169,7 @@ private: + pc_ = nullptr; + end_ = nullptr; + c0_ = KEY_EOF; +- isError_ = false; ++ is_error_ = false; + } + + void Advance() +@@ -201,7 +201,7 @@ private: + + void SetIsError() + { +- isError_ = true; ++ is_error_ = true; + } + + void PrintF(const char *fmt, ...); +@@ -210,12 +210,12 @@ private: + uint8_t *end_ {nullptr}; + uint32_t flags_ {0}; + int c0_; +- int captureCount_ {0}; +- int stackCount_ {0}; +- bool isError_ {false}; +- char errorMsg_[TMP_BUF_SIZE] = {0}; // NOLINT(modernize-avoid-c-arrays) ++ int capture_count_ {0}; ++ int stack_count_ {0}; ++ bool is_error_ {false}; ++ char error_msg_[TMP_BUF_SIZE] = {0}; // NOLINT(modernize-avoid-c-arrays) + DynChunk buffer_; +- DynChunk groupNames_; ++ DynChunk group_names_; + }; + } // namespace panda::ecmascript + #endif // ECMASCRIPT_REGEXP_PARSER_H +diff --git a/runtime/regexp/regexp_parser_cache.cpp b/runtime/regexp/regexp_parser_cache.cpp +index 3ee4d2e..8db95a1 100644 +--- a/runtime/regexp/regexp_parser_cache.cpp ++++ b/runtime/regexp/regexp_parser_cache.cpp +@@ -31,8 +31,8 @@ void RegExpParserCache::Clear() + for (ParserKey &info : info_) { + info.pattern_ = nullptr; + info.flags_ = UINT32_MAX; // flags cannot be UINT32_MAX, so it means invalid. +- info.codeBuffer_ = JSTaggedValue::Hole(); +- info.bufferSize_ = 0; ++ info.code_buffer_ = JSTaggedValue::Hole(); ++ info.buffer_size_ = 0; + } + } + +@@ -48,7 +48,7 @@ std::pair RegExpParserCache::GetCache(EcmaString *pattern + if (info.flags_ != flags || !EcmaString::StringsAreEqual(info.pattern_, pattern)) { + return std::pair(JSTaggedValue::Hole(), 0); + } +- return std::pair(info.codeBuffer_, info.bufferSize_); ++ return std::pair(info.code_buffer_, info.buffer_size_); + } + + void RegExpParserCache::SetCache(EcmaString *pattern, const uint32_t flags, const JSTaggedValue codeBuffer, +@@ -58,7 +58,7 @@ void RegExpParserCache::SetCache(EcmaString *pattern, const uint32_t flags, cons + ParserKey &info = info_[hash]; + info.pattern_ = pattern; + info.flags_ = flags; +- info.codeBuffer_ = codeBuffer; +- info.bufferSize_ = bufferSize; ++ info.code_buffer_ = codeBuffer; ++ info.buffer_size_ = bufferSize; + } + } // namespace panda::ecmascript +diff --git a/runtime/regexp/regexp_parser_cache.h b/runtime/regexp/regexp_parser_cache.h +index 874f727..65dfb9b 100644 +--- a/runtime/regexp/regexp_parser_cache.h ++++ b/runtime/regexp/regexp_parser_cache.h +@@ -42,8 +42,8 @@ private: + struct ParserKey { + EcmaString *pattern_ {nullptr}; + uint32_t flags_ {UINT32_MAX}; +- JSTaggedValue codeBuffer_ {JSTaggedValue::Hole()}; +- size_t bufferSize_ {0}; ++ JSTaggedValue code_buffer_ {JSTaggedValue::Hole()}; ++ size_t buffer_size_ {0}; + }; + + std::array info_ {}; +diff --git a/runtime/snapshot/mem/snapshot.cpp b/runtime/snapshot/mem/snapshot.cpp +index 90bfd23..28bfbb8 100644 +--- a/runtime/snapshot/mem/snapshot.cpp ++++ b/runtime/snapshot/mem/snapshot.cpp +@@ -113,7 +113,7 @@ void SnapShot::MakeSnapShotProgramObject(Program *program, const panda_file::Fil + ASSERT(static_cast(write.tellp()) == snapshot_size + sizeof(Header)); + + write.seekp(panda_file_begin); +- write.write(reinterpret_cast(pf->GetBase()), pf->GetHeader()->file_size); ++ write.write(reinterpret_cast(pf->GetBase()), pf->GetHeader()->file_size_); + write.close(); + } + +@@ -137,21 +137,21 @@ std::unique_ptr SnapShot::DeserializeGlobalEnvAndProgram + size_t file_size = lseek(fd, 0, SEEK_END); + auto readFile = ToUintPtr(mmap(nullptr, file_size, PROT_READ, MAP_PRIVATE, fd, 0)); + auto hdr = *ToNativePtr(readFile); +- if (hdr.snapshot_size % DEFAULT_SNAPSHOT_SPACE_SIZE != 0) { ++ if (hdr.snapshot_size_ % DEFAULT_SNAPSHOT_SPACE_SIZE != 0) { + LOG_ECMA(FATAL) << "Invalid snapshot file"; + UNREACHABLE(); + } + SnapShotSpace *space = vm_->GetHeap()->GetSnapShotSpace(); + + uintptr_t snapshot_begin = readFile + sizeof(Header); +- for (size_t i = 0; i < hdr.snapshot_size / DEFAULT_SNAPSHOT_SPACE_SIZE; i++) { ++ for (size_t i = 0; i < hdr.snapshot_size_ / DEFAULT_SNAPSHOT_SPACE_SIZE; i++) { + Region *region = const_cast(vm_->GetHeap()->GetRegionFactory()) + ->AllocateAlignedRegion(space, DEFAULT_SNAPSHOT_SPACE_SIZE); + auto fileRegion = ToNativePtr(snapshot_begin + i * DEFAULT_SNAPSHOT_SPACE_SIZE); + +- uint64_t base = region->allocateBase_; ++ uint64_t base = region->allocate_base_; + uint64_t begin = (fileRegion->begin_) % DEFAULT_SNAPSHOT_SPACE_SIZE; +- uint64_t waterMark = (fileRegion->highWaterMark_) % DEFAULT_SNAPSHOT_SPACE_SIZE; ++ uint64_t waterMark = (fileRegion->high_water_mark_) % DEFAULT_SNAPSHOT_SPACE_SIZE; + + if (memcpy_s(region, DEFAULT_SNAPSHOT_SPACE_SIZE, fileRegion, DEFAULT_SNAPSHOT_SPACE_SIZE) != EOK) { + LOG_ECMA(FATAL) << "memcpy_s failed"; +@@ -161,31 +161,31 @@ std::unique_ptr SnapShot::DeserializeGlobalEnvAndProgram + // space + region->space_ = space; + // allocate_base_ +- region->allocateBase_ = base; ++ region->allocate_base_ = base; + // begin_ + region->begin_ = ToUintPtr(region) + begin; + // end_ + region->end_ = ToUintPtr(region) + DEFAULT_SNAPSHOT_SPACE_SIZE; + // high_water_mark_ +- region->highWaterMark_ = ToUintPtr(region) + waterMark; ++ region->high_water_mark_ = ToUintPtr(region) + waterMark; + // prev_ + region->prev_ = nullptr; + // next_ + region->next_ = nullptr; + // mark_bitmap_ +- region->markBitmap_ = nullptr; ++ region->mark_bitmap_ = nullptr; + // cross_region_set_ +- region->crossRegionSet_ = nullptr; ++ region->cross_region_set_ = nullptr; + // old_to_new_set_ +- region->oldToNewSet_ = nullptr; ++ region->old_to_new_set_ = nullptr; + + space->AddRegion(region); + } +- munmap(ToNativePtr(readFile), hdr.panda_file_begin); +- uintptr_t panda_file_mem = readFile + hdr.panda_file_begin; ++ munmap(ToNativePtr(readFile), hdr.panda_file_begin_); ++ uintptr_t panda_file_mem = readFile + hdr.panda_file_begin_; + auto pf = + panda_file::File::OpenFromMemory(os::mem::ConstBytePtr(ToNativePtr(panda_file_mem), +- file_size - hdr.panda_file_begin, os::mem::MmapDeleter), ++ file_size - hdr.panda_file_begin_, os::mem::MmapDeleter), + fileName); + close(fd); + // redirect object field +diff --git a/runtime/snapshot/mem/snapshot.h b/runtime/snapshot/mem/snapshot.h +index 920a2ae..fa10e6d 100644 +--- a/runtime/snapshot/mem/snapshot.h ++++ b/runtime/snapshot/mem/snapshot.h +@@ -37,8 +37,8 @@ public: + + private: + struct Header { +- uint32_t snapshot_size; +- uint32_t panda_file_begin; ++ uint32_t snapshot_size_; ++ uint32_t panda_file_begin_; + }; + + private: +diff --git a/runtime/snapshot/mem/snapshot_serialize.cpp b/runtime/snapshot/mem/snapshot_serialize.cpp +index 4f07d05..195809c 100644 +--- a/runtime/snapshot/mem/snapshot_serialize.cpp ++++ b/runtime/snapshot/mem/snapshot_serialize.cpp +@@ -579,20 +579,20 @@ static uintptr_t g_nativeTable[] = { + + SnapShotSerialize::SnapShotSerialize(EcmaVM *vm, bool serialize) : vm_(vm), serialize_(serialize) + { +- objectArraySize_ = OBJECT_SIZE_EXTEND_PAGE; ++ object_array_size_ = OBJECT_SIZE_EXTEND_PAGE; + if (serialize_) { +- addressSlot_ = ToUintPtr(vm_->GetRegionFactory()->Allocate(sizeof(uintptr_t) * OBJECT_SIZE_EXTEND_PAGE)); ++ address_slot_ = ToUintPtr(vm_->GetRegionFactory()->Allocate(sizeof(uintptr_t) * OBJECT_SIZE_EXTEND_PAGE)); + } else { +- addressSlot_ = ToUintPtr(vm_->GetRegionFactory()->Allocate(sizeof(uintptr_t) * objectArraySize_)); ++ address_slot_ = ToUintPtr(vm_->GetRegionFactory()->Allocate(sizeof(uintptr_t) * object_array_size_)); + } + } + + SnapShotSerialize::~SnapShotSerialize() + { + if (serialize_) { +- vm_->GetRegionFactory()->Free(ToVoidPtr(addressSlot_), sizeof(uintptr_t) * OBJECT_SIZE_EXTEND_PAGE); ++ vm_->GetRegionFactory()->Free(ToVoidPtr(address_slot_), sizeof(uintptr_t) * OBJECT_SIZE_EXTEND_PAGE); + } else { +- vm_->GetRegionFactory()->Free(ToVoidPtr(addressSlot_), sizeof(uintptr_t) * objectArraySize_); ++ vm_->GetRegionFactory()->Free(ToVoidPtr(address_slot_), sizeof(uintptr_t) * object_array_size_); + } + } + +@@ -681,18 +681,18 @@ void SnapShotSerialize::Serialize(TaggedObject *objectHeader, CQueueGetRegionFactory()->Allocate(sizeof(uintptr_t) * objectArraySize_); ++ auto addr = vm_->GetRegionFactory()->Allocate(sizeof(uintptr_t) * object_array_size_); + int size = countNow * ADDRESS_SIZE; +- if (memcpy_s(addr, size, ToVoidPtr(addressSlot_), size) != EOK) { ++ if (memcpy_s(addr, size, ToVoidPtr(address_slot_), size) != EOK) { + LOG_ECMA(FATAL) << "memcpy_s failed"; + UNREACHABLE(); + } + +- vm_->GetRegionFactory()->Free(ToVoidPtr(addressSlot_), sizeof(uintptr_t) * objectArraySize_); +- addressSlot_ = ToUintPtr(addr); ++ vm_->GetRegionFactory()->Free(ToVoidPtr(address_slot_), sizeof(uintptr_t) * object_array_size_); ++ address_slot_ = ToUintPtr(addr); + } + + void SnapShotSerialize::RedirectSlot(const panda_file::File *pf) +@@ -708,11 +708,11 @@ void SnapShotSerialize::RedirectSlot(const panda_file::File *pf) + while (begin < end) { + if (others != 0) { + for (size_t i = 0; i < others; i++) { +- pandaMethod_.emplace_back(begin); ++ panda_method_.emplace_back(begin); + auto method = reinterpret_cast(begin); + method->SetPandaFile(pf); + method->SetBytecodeArray(method->GetInstructions()); +- vm_->frameworkProgramMethods_.emplace_back(method); ++ vm_->framework_program_methods_.emplace_back(method); + begin += METHOD_SIZE; + if (begin >= end) { + others = others - i - 1; +@@ -721,18 +721,18 @@ void SnapShotSerialize::RedirectSlot(const panda_file::File *pf) + break; + } + +- if (count_ == objectArraySize_) { ++ if (count_ == object_array_size_) { + ExtendObjectArray(); + } + SlotBit slot(*reinterpret_cast(begin)); + if (slot.GetObjectType() == MASK_METHOD_SPACE_BEGIN) { + begin += sizeof(uint64_t); + for (size_t i = 0; i < slot.GetObjectSize(); i++) { +- pandaMethod_.emplace_back(begin); ++ panda_method_.emplace_back(begin); + auto method = reinterpret_cast(begin); + method->SetPandaFile(pf); + method->SetBytecodeArray(method->GetInstructions()); +- vm_->frameworkProgramMethods_.emplace_back(method); ++ vm_->framework_program_methods_.emplace_back(method); + begin += METHOD_SIZE; + if (begin >= end) { + others = slot.GetObjectSize() - i - 1; +@@ -785,7 +785,7 @@ void SnapShotSerialize::RedirectSlot(const panda_file::File *pf) + break; + case JSType::PROGRAM: + DynProgramDeserialize(GetAddress(i), objectSize); +- vm_->frameworkProgram_ = JSTaggedValue(GetAddress(i)); ++ vm_->framework_program_ = JSTaggedValue(GetAddress(i)); + break; + case JSType::JS_FUNCTION_BASE: + case JSType::JS_FUNCTION: +@@ -973,10 +973,10 @@ SlotBit SnapShotSerialize::NativePointerToSlotBit(void *nativePointer) + if (nativePointer != nullptr) { // nativePointer + uint32_t index = MAX_UINT_32; + +- if (programSerialize_) { +- pandaMethod_.emplace_back(ToUintPtr(nativePointer)); ++ if (program_serialize_) { ++ panda_method_.emplace_back(ToUintPtr(nativePointer)); + // NOLINTNEXTLINE(bugprone-narrowing-conversions, cppcoreguidelines-narrowing-conversions) +- index = pandaMethod_.size() + PROGRAM_NATIVE_METHOD_BEGIN + NATIVE_METHOD_SIZE - 1; ++ index = panda_method_.size() + PROGRAM_NATIVE_METHOD_BEGIN + NATIVE_METHOD_SIZE - 1; + } else { + for (size_t i = 0; i < PROGRAM_NATIVE_METHOD_BEGIN; i++) { + if (nativePointer == reinterpret_cast(g_nativeTable[i + NATIVE_METHOD_SIZE])) { +@@ -1010,11 +1010,11 @@ void *SnapShotSerialize::NativePointerSlotBitToAddr(SlotBit native) + void *addr = nullptr; + + if (index < NATIVE_METHOD_SIZE) { +- addr = reinterpret_cast(vm_->nativeMethods_.at(index)); ++ addr = reinterpret_cast(vm_->native_methods_.at(index)); + } else if (index < NATIVE_METHOD_SIZE + PROGRAM_NATIVE_METHOD_BEGIN) { + addr = reinterpret_cast(g_nativeTable[index]); + } else { +- addr = ToVoidPtr(pandaMethod_.at(index - PROGRAM_NATIVE_METHOD_BEGIN - NATIVE_METHOD_SIZE)); ++ addr = ToVoidPtr(panda_method_.at(index - PROGRAM_NATIVE_METHOD_BEGIN - NATIVE_METHOD_SIZE)); + } + return addr; + } +@@ -1221,7 +1221,7 @@ void SnapShotSerialize::SerializePandaFileMethod() + { + SlotBit slot(0); + slot.SetObjectType(MASK_METHOD_SPACE_BEGIN); +- slot.SetObjectSize(pandaMethod_.size()); ++ slot.SetObjectSize(panda_method_.size()); + + ObjectFactory *factory = vm_->GetFactory(); + // panda method space begin +@@ -1233,7 +1233,7 @@ void SnapShotSerialize::SerializePandaFileMethod() + SetObjectSlotField(snapshotObj, 0, slot.GetValue()); // methods + + // panda methods +- for (auto &it : pandaMethod_) { ++ for (auto &it : panda_method_) { + // write method + size_t methodObjSize = METHOD_SIZE; + uintptr_t methodObj = factory->NewSpaceBySnapShotAllocator(methodObjSize); +diff --git a/runtime/snapshot/mem/snapshot_serialize.h b/runtime/snapshot/mem/snapshot_serialize.h +index f14c128..fc9e948 100644 +--- a/runtime/snapshot/mem/snapshot_serialize.h ++++ b/runtime/snapshot/mem/snapshot_serialize.h +@@ -39,7 +39,7 @@ public: + + void SetProgramSerializeStart() + { +- programSerialize_ = true; ++ program_serialize_ = true; + } + + void RegisterNativeMethod(); +@@ -84,7 +84,7 @@ private: + + void SetAddressToSlot(size_t index, uintptr_t value) + { +- auto addr = reinterpret_cast(addressSlot_ + index * ADDRESS_SIZE); ++ auto addr = reinterpret_cast(address_slot_ + index * ADDRESS_SIZE); + // NOLINTNEXTLINE(clang-analyzer-core.CallAndMessage) + *addr = value; + } +@@ -92,7 +92,7 @@ private: + template + T GetAddress(size_t index) + { +- return *reinterpret_cast(addressSlot_ + index * ADDRESS_SIZE); ++ return *reinterpret_cast(address_slot_ + index * ADDRESS_SIZE); + } + + SlotBit NativePointerToSlotBit(void *nativePointer); +@@ -101,11 +101,11 @@ private: + + EcmaVM *vm_ {nullptr}; + bool serialize_ {false}; +- bool programSerialize_ {false}; ++ bool program_serialize_ {false}; + int count_ {0}; +- int objectArraySize_ {0}; +- uintptr_t addressSlot_; +- CVector pandaMethod_; ++ int object_array_size_ {0}; ++ uintptr_t address_slot_; ++ CVector panda_method_; + + NO_COPY_SEMANTIC(SnapShotSerialize); + NO_MOVE_SEMANTIC(SnapShotSerialize); +diff --git a/runtime/tooling/pt_js_extractor.h b/runtime/tooling/pt_js_extractor.h +index c65b73c..1f52a7c 100644 +--- a/runtime/tooling/pt_js_extractor.h ++++ b/runtime/tooling/pt_js_extractor.h +@@ -39,8 +39,8 @@ public: + for (const auto &method : methods) { + auto table = GetLineNumberTable(method); + for (const auto &pair : table) { +- if (static_cast(pair.line) == line) { +- return cb(method, pair.offset); ++ if (static_cast(pair.line_) == line) { ++ return cb(method, pair.offset_); + } + } + } +@@ -56,25 +56,25 @@ public: + size_t column = 0; + + for (const auto &pair : lineTable) { +- if (offset < pair.offset) { ++ if (offset < pair.offset_) { + break; + } +- if (offset == pair.offset) { +- line = pair.line; ++ if (offset == pair.offset_) { ++ line = pair.line_; + break; + } +- line = pair.line; ++ line = pair.line_; + } + + for (const auto &pair : columnTable) { +- if (offset < pair.offset) { ++ if (offset < pair.offset_) { + break; + } +- if (offset == pair.offset) { +- column = pair.column; ++ if (offset == pair.offset_) { ++ column = pair.column_; + break; + } +- column = pair.column; ++ column = pair.column_; + } + return cb(line, column); + } +diff --git a/runtime/vmstat/caller_stat.cpp b/runtime/vmstat/caller_stat.cpp +index d035708..37a2f75 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 a8cd573..ce0ebb3 100644 +--- a/runtime/vmstat/caller_stat.h ++++ b/runtime/vmstat/caller_stat.h +@@ -37,9 +37,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 + { +@@ -47,29 +47,29 @@ 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: + CString 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 { +@@ -101,7 +101,7 @@ public: + + inline void UpdateCallerState() + { +- callerStat_->UpdateState(elapsed_); ++ caller_stat_->UpdateState(elapsed_); + } + + private: +@@ -109,7 +109,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 093bc71..7011bc8 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(CString(runtimeCallerNames[i]))); ++ caller_stat_.emplace_back(PandaRuntimeCallerStat(CString(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 @@ CString 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 5c66d07..40fb339 100644 +--- a/runtime/vmstat/runtime_stat.h ++++ b/runtime/vmstat/runtime_stat.h +@@ -39,8 +39,8 @@ public: + void Print() const; + + private: +- PandaRuntimeTimer *currentTimer_ = nullptr; +- CVector callerStat_ {}; ++ PandaRuntimeTimer *current_timer_ = nullptr; ++ CVector caller_stat_ {}; + }; + + class RuntimeTimerScope { +diff --git a/tests/assembler/emitter_test_ecmascript.cpp b/tests/assembler/emitter_test_ecmascript.cpp +index 514613e..afe8368 100644 +--- a/tests/assembler/emitter_test_ecmascript.cpp ++++ b/tests/assembler/emitter_test_ecmascript.cpp +@@ -59,7 +59,7 @@ TEST(emittertests, get_GLOBAL_lang_for_JS_func) + )"; + + auto res = p.Parse(source); +- ASSERT_EQ(p.ShowError().err, Error::ErrorType::ERR_NONE); ++ ASSERT_EQ(p.ShowError().err_, Error::ErrorType::ERR_NONE); + + auto pf = AsmEmitter::Emit(res.Value()); + ASSERT_NE(pf, nullptr); +@@ -88,7 +88,7 @@ TEST(emittertests, ecmascript_debuginfo) + + std::string source_filename = "source.pa"; + auto res = p.Parse(source, source_filename); +- ASSERT_EQ(p.ShowError().err, Error::ErrorType::ERR_NONE); ++ ASSERT_EQ(p.ShowError().err_, Error::ErrorType::ERR_NONE); + + auto pf = AsmEmitter::Emit(res.Value()); + ASSERT_NE(pf, nullptr); +diff --git a/tests/assembler/parser_test_ecmascript.cpp b/tests/assembler/parser_test_ecmascript.cpp +index d42dd2f..ad37347 100644 +--- a/tests/assembler/parser_test_ecmascript.cpp ++++ b/tests/assembler/parser_test_ecmascript.cpp +@@ -38,6 +38,6 @@ TEST(parsertests, calli_dyn_3args) + + Error e = p.ShowError(); + +- ASSERT_EQ(e.err, Error::ErrorType::ERR_NONE); ++ ASSERT_EQ(e.err_, Error::ErrorType::ERR_NONE); + } + } +\ No newline at end of file +diff --git a/tests/compiler/unit_ecma_test.cpp b/tests/compiler/unit_ecma_test.cpp +index bcfff00..9b12332 100644 +--- a/tests/compiler/unit_ecma_test.cpp ++++ b/tests/compiler/unit_ecma_test.cpp +@@ -96,9 +96,9 @@ std::unique_ptr AsmTest::ParseToFile(const char *source, + { + panda::pandasm::Parser parser; + auto res = parser.Parse(source, file_name); +- if (parser.ShowError().err != pandasm::Error::ErrorType::ERR_NONE) { +- std::cerr << "Parse failed: " << parser.ShowError().message << std::endl +- << parser.ShowError().whole_line << std::endl; ++ if (parser.ShowError().err_ != pandasm::Error::ErrorType::ERR_NONE) { ++ std::cerr << "Parse failed: " << parser.ShowError().message_ << std::endl ++ << parser.ShowError().whole_line_ << std::endl; + ADD_FAILURE(); + return nullptr; + } +diff --git a/tests/runtime/builtins/builtins_array_test.cpp b/tests/runtime/builtins/builtins_array_test.cpp +index ba19fbf..daa1c5a 100644 +--- a/tests/runtime/builtins/builtins_array_test.cpp ++++ b/tests/runtime/builtins/builtins_array_test.cpp +@@ -53,17 +53,17 @@ public: + + void SetUp() override + { +- TestHelper::CreateEcmaVMWithScope(instance, thread, scope); ++ TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); + } + + void TearDown() override + { +- TestHelper::DestroyEcmaVMWithScope(instance, scope); ++ TestHelper::DestroyEcmaVMWithScope(instance_, scope_); + } + +- PandaVM *instance {nullptr}; +- EcmaHandleScope *scope {nullptr}; +- JSThread *thread {nullptr}; ++ PandaVM *instance_ {nullptr}; ++ EcmaHandleScope *scope_ {nullptr}; ++ JSThread *thread_ {nullptr}; + + class TestClass : public base::BuiltinsBase { + public: +@@ -184,611 +184,613 @@ JSTaggedValue CreateBuiltinsJSObject(JSThread *thread, const CString keyCStr) + + TEST_F(BuiltinsArrayTest, ArrayConstructor) + { +- auto ecmaVM = thread->GetEcmaVM(); ++ auto ecmaVM = thread_->GetEcmaVM(); + JSHandle env = ecmaVM->GetGlobalEnv(); + JSHandle array(env->GetArrayFunction()); +- JSHandle globalObject(thread, env->GetGlobalObject()); ++ JSHandle globalObject(thread_, env->GetGlobalObject()); + +- auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 10); ++ auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 10); + ecmaRuntimeCallInfo1->SetFunction(array.GetTaggedValue()); + ecmaRuntimeCallInfo1->SetThis(globalObject.GetTaggedValue()); + ecmaRuntimeCallInfo1->SetCallArg(0, JSTaggedValue(static_cast(1))); + ecmaRuntimeCallInfo1->SetCallArg(1, JSTaggedValue(static_cast(3))); + ecmaRuntimeCallInfo1->SetCallArg(2, JSTaggedValue(static_cast(5))); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); + JSTaggedValue result = Array::ArrayConstructor(ecmaRuntimeCallInfo1.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + JSTaggedValue value(static_cast(result.GetRawData())); + ASSERT_TRUE(value.IsECMAObject()); +- PropertyDescriptor descRes(thread); +- JSHandle valueHandle(thread, value); +- JSHandle key0(thread, JSTaggedValue(0)); +- JSHandle key1(thread, JSTaggedValue(1)); +- JSHandle key2(thread, JSTaggedValue(2)); +- JSObject::GetOwnProperty(thread, valueHandle, key0, descRes); ++ PropertyDescriptor descRes(thread_); ++ JSHandle valueHandle(thread_, value); ++ JSHandle key0(thread_, JSTaggedValue(0)); ++ JSHandle key1(thread_, JSTaggedValue(1)); ++ JSHandle key2(thread_, JSTaggedValue(2)); ++ JSObject::GetOwnProperty(thread_, valueHandle, key0, descRes); + ASSERT_EQ(descRes.GetValue().GetTaggedValue(), JSTaggedValue(1)); +- JSObject::GetOwnProperty(thread, valueHandle, key1, descRes); ++ JSObject::GetOwnProperty(thread_, valueHandle, key1, descRes); + ASSERT_EQ(descRes.GetValue().GetTaggedValue(), JSTaggedValue(3)); +- JSObject::GetOwnProperty(thread, valueHandle, key2, descRes); ++ JSObject::GetOwnProperty(thread_, valueHandle, key2, descRes); + ASSERT_EQ(descRes.GetValue().GetTaggedValue(), JSTaggedValue(5)); + } + + // 22.1.2.1 Array.from ( items [ , mapfn [ , thisArg ] ] ) + TEST_F(BuiltinsArrayTest, From) + { +- JSHandle lengthKeyHandle = thread->GlobalConstants()->GetHandledLengthString(); +- JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread, JSTaggedNumber(0))->GetTaggedObject()); ++ JSHandle lengthKeyHandle = thread_->GlobalConstants()->GetHandledLengthString(); ++ JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread_, JSTaggedNumber(0))->GetTaggedObject()); + EXPECT_TRUE(arr != nullptr); +- JSHandle obj(thread, arr); +- EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 0); +- +- JSHandle key0(thread, JSTaggedValue(0)); +- PropertyDescriptor desc0(thread, JSHandle(thread, JSTaggedValue(1)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key0, desc0); +- JSHandle key1(thread, JSTaggedValue(1)); +- PropertyDescriptor desc1(thread, JSHandle(thread, JSTaggedValue(2)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key1, desc1); +- JSHandle key2(thread, JSTaggedValue(2)); +- PropertyDescriptor desc2(thread, JSHandle(thread, JSTaggedValue(3)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key2, desc2); +- JSHandle key3(thread, JSTaggedValue(3)); +- PropertyDescriptor desc3(thread, JSHandle(thread, JSTaggedValue(4)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key3, desc3); +- JSHandle key4(thread, JSTaggedValue(4)); +- PropertyDescriptor desc4(thread, JSHandle(thread, JSTaggedValue(5)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key4, desc4); +- +- auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ JSHandle obj(thread_, arr); ++ EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 0); ++ ++ JSHandle key0(thread_, JSTaggedValue(0)); ++ PropertyDescriptor desc0(thread_, JSHandle(thread_, JSTaggedValue(1)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key0, desc0); ++ JSHandle key1(thread_, JSTaggedValue(1)); ++ PropertyDescriptor desc1(thread_, JSHandle(thread_, JSTaggedValue(2)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key1, desc1); ++ JSHandle key2(thread_, JSTaggedValue(2)); ++ PropertyDescriptor desc2(thread_, JSHandle(thread_, JSTaggedValue(3)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key2, desc2); ++ JSHandle key3(thread_, JSTaggedValue(3)); ++ PropertyDescriptor desc3(thread_, JSHandle(thread_, JSTaggedValue(4)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key3, desc3); ++ JSHandle key4(thread_, JSTaggedValue(4)); ++ PropertyDescriptor desc4(thread_, JSHandle(thread_, JSTaggedValue(5)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key4, desc4); ++ ++ auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo1->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo1->SetThis(obj.GetTaggedValue()); + ecmaRuntimeCallInfo1->SetCallArg(0, obj.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); + JSTaggedValue result = Array::From(ecmaRuntimeCallInfo1.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + JSTaggedValue value(static_cast(result.GetRawData())); + ASSERT_TRUE(value.IsECMAObject()); +- PropertyDescriptor descRes(thread); +- JSHandle valueHandle(thread, value); +- JSObject::GetOwnProperty(thread, valueHandle, key0, descRes); ++ PropertyDescriptor descRes(thread_); ++ JSHandle valueHandle(thread_, value); ++ JSObject::GetOwnProperty(thread_, valueHandle, key0, descRes); + ASSERT_EQ(descRes.GetValue().GetTaggedValue(), JSTaggedValue(1)); +- JSObject::GetOwnProperty(thread, valueHandle, key1, descRes); ++ JSObject::GetOwnProperty(thread_, valueHandle, key1, descRes); + ASSERT_EQ(descRes.GetValue().GetTaggedValue(), JSTaggedValue(2)); +- JSObject::GetOwnProperty(thread, valueHandle, key2, descRes); ++ JSObject::GetOwnProperty(thread_, valueHandle, key2, descRes); + ASSERT_EQ(descRes.GetValue().GetTaggedValue(), JSTaggedValue(3)); +- JSObject::GetOwnProperty(thread, valueHandle, key3, descRes); ++ JSObject::GetOwnProperty(thread_, valueHandle, key3, descRes); + ASSERT_EQ(descRes.GetValue().GetTaggedValue(), JSTaggedValue(4)); +- JSObject::GetOwnProperty(thread, valueHandle, key4, descRes); ++ JSObject::GetOwnProperty(thread_, valueHandle, key4, descRes); + ASSERT_EQ(descRes.GetValue().GetTaggedValue(), JSTaggedValue(5)); + } + + // 22.1.2.2 Array.isArray(arg) + TEST_F(BuiltinsArrayTest, IsArray) + { +- JSHandle lengthKeyHandle = thread->GlobalConstants()->GetHandledLengthString(); +- JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); ++ JSHandle lengthKeyHandle = thread_->GlobalConstants()->GetHandledLengthString(); ++ JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread_, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); + EXPECT_TRUE(arr != nullptr); +- JSHandle obj(thread, arr); +- EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 0); ++ JSHandle obj(thread_, arr); ++ EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 0); + +- auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo1->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo1->SetThis(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo1->SetCallArg(0, obj.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); + JSTaggedValue result = Array::IsArray(ecmaRuntimeCallInfo1.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + ASSERT_EQ(result.GetRawData(), JSTaggedValue::True().GetRawData()); + +- auto ecmaRuntimeCallInfo2 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto ecmaRuntimeCallInfo2 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo2->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo2->SetThis(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo2->SetCallArg(0, JSTaggedValue(static_cast(1))); + +- prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo2.get()); ++ prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo2.get()); + result = Array::IsArray(ecmaRuntimeCallInfo2.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + ASSERT_EQ(result.GetRawData(), JSTaggedValue::False().GetRawData()); + } + + TEST_F(BuiltinsArrayTest, Of) + { +- auto ecmaVM = thread->GetEcmaVM(); ++ auto ecmaVM = thread_->GetEcmaVM(); + JSHandle env = ecmaVM->GetGlobalEnv(); + JSHandle array(env->GetArrayFunction()); +- JSHandle globalObject(thread, env->GetGlobalObject()); ++ JSHandle globalObject(thread_, env->GetGlobalObject()); + +- auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 10); ++ auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 10); + ecmaRuntimeCallInfo1->SetFunction(array.GetTaggedValue()); + ecmaRuntimeCallInfo1->SetThis(globalObject.GetTaggedValue()); + ecmaRuntimeCallInfo1->SetCallArg(0, JSTaggedValue(static_cast(1))); + ecmaRuntimeCallInfo1->SetCallArg(1, JSTaggedValue(static_cast(3))); + ecmaRuntimeCallInfo1->SetCallArg(2, JSTaggedValue(static_cast(5))); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); + JSTaggedValue result = Array::Of(ecmaRuntimeCallInfo1.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + JSTaggedValue value(static_cast(result.GetRawData())); + ASSERT_TRUE(value.IsECMAObject()); +- PropertyDescriptor descRes(thread); +- JSHandle valueHandle(thread, value); +- JSHandle key0(thread, JSTaggedValue(0)); +- JSHandle key1(thread, JSTaggedValue(1)); +- JSHandle key2(thread, JSTaggedValue(2)); ++ PropertyDescriptor descRes(thread_); ++ JSHandle valueHandle(thread_, value); ++ JSHandle key0(thread_, JSTaggedValue(0)); ++ JSHandle key1(thread_, JSTaggedValue(1)); ++ JSHandle key2(thread_, JSTaggedValue(2)); + +- JSObject::GetOwnProperty(thread, valueHandle, key0, descRes); ++ JSObject::GetOwnProperty(thread_, valueHandle, key0, descRes); + ASSERT_EQ(descRes.GetValue().GetTaggedValue(), JSTaggedValue(1)); +- JSObject::GetOwnProperty(thread, valueHandle, key1, descRes); ++ JSObject::GetOwnProperty(thread_, valueHandle, key1, descRes); + ASSERT_EQ(descRes.GetValue().GetTaggedValue(), JSTaggedValue(3)); +- JSObject::GetOwnProperty(thread, valueHandle, key2, descRes); ++ JSObject::GetOwnProperty(thread_, valueHandle, key2, descRes); + ASSERT_EQ(descRes.GetValue().GetTaggedValue(), JSTaggedValue(5)); + } + + TEST_F(BuiltinsArrayTest, Species) + { +- auto ecmaVM = thread->GetEcmaVM(); ++ auto ecmaVM = thread_->GetEcmaVM(); + JSHandle env = ecmaVM->GetGlobalEnv(); + JSHandle array(env->GetArrayFunction()); +- JSHandle globalObject(thread, env->GetGlobalObject()); ++ JSHandle globalObject(thread_, env->GetGlobalObject()); + +- auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); ++ auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); + ecmaRuntimeCallInfo1->SetFunction(array.GetTaggedValue()); + ecmaRuntimeCallInfo1->SetThis(globalObject.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); + JSTaggedValue result = Array::Species(ecmaRuntimeCallInfo1.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + ASSERT_TRUE(result.IsECMAObject()); + } + + TEST_F(BuiltinsArrayTest, Concat) + { +- JSHandle lengthKeyHandle = thread->GlobalConstants()->GetHandledLengthString(); +- JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); ++ JSHandle lengthKeyHandle = thread_->GlobalConstants()->GetHandledLengthString(); ++ JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread_, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); + EXPECT_TRUE(arr != nullptr); +- JSHandle obj(thread, arr); +- JSHandle key0(thread, JSTaggedValue(0)); +- PropertyDescriptor desc0(thread, JSHandle(thread, JSTaggedValue(1)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key0, desc0); +- JSHandle key1(thread, JSTaggedValue(1)); +- PropertyDescriptor desc1(thread, JSHandle(thread, JSTaggedValue(2)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key1, desc1); +- JSHandle key2(thread, JSTaggedValue(2)); +- PropertyDescriptor desc2(thread, JSHandle(thread, JSTaggedValue(3)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key2, desc2); +- +- JSArray *arr1 = JSArray::ArrayCreate(thread, JSTaggedNumber(0)).GetObject(); ++ JSHandle obj(thread_, arr); ++ JSHandle key0(thread_, JSTaggedValue(0)); ++ PropertyDescriptor desc0(thread_, JSHandle(thread_, JSTaggedValue(1)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key0, desc0); ++ JSHandle key1(thread_, JSTaggedValue(1)); ++ PropertyDescriptor desc1(thread_, JSHandle(thread_, JSTaggedValue(2)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key1, desc1); ++ JSHandle key2(thread_, JSTaggedValue(2)); ++ PropertyDescriptor desc2(thread_, JSHandle(thread_, JSTaggedValue(3)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key2, desc2); ++ ++ JSArray *arr1 = JSArray::ArrayCreate(thread_, JSTaggedNumber(0)).GetObject(); + EXPECT_TRUE(arr1 != nullptr); +- JSHandle obj1(thread, arr1); +- JSHandle key4(thread, JSTaggedValue(0)); +- PropertyDescriptor desc4(thread, JSHandle(thread, JSTaggedValue(4)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj1, key4, desc4); +- JSHandle key5(thread, JSTaggedValue(1)); +- PropertyDescriptor desc5(thread, JSHandle(thread, JSTaggedValue(5)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj1, key5, desc5); +- JSHandle key6(thread, JSTaggedValue(2)); +- PropertyDescriptor desc6(thread, JSHandle(thread, JSTaggedValue(6)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj1, key6, desc6); +- +- auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ JSHandle obj1(thread_, arr1); ++ JSHandle key4(thread_, JSTaggedValue(0)); ++ PropertyDescriptor desc4(thread_, JSHandle(thread_, JSTaggedValue(4)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj1, key4, desc4); ++ JSHandle key5(thread_, JSTaggedValue(1)); ++ PropertyDescriptor desc5(thread_, JSHandle(thread_, JSTaggedValue(5)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj1, key5, desc5); ++ JSHandle key6(thread_, JSTaggedValue(2)); ++ PropertyDescriptor desc6(thread_, JSHandle(thread_, JSTaggedValue(6)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj1, key6, desc6); ++ ++ auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo1->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo1->SetThis(obj.GetTaggedValue()); + ecmaRuntimeCallInfo1->SetCallArg(0, obj1.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); + JSTaggedValue result = Array::Concat(ecmaRuntimeCallInfo1.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + JSTaggedValue value(static_cast(result.GetRawData())); + ASSERT_TRUE(value.IsECMAObject()); + +- PropertyDescriptor descRes(thread); +- JSHandle valueHandle(thread, value); +- JSHandle key7(thread, JSTaggedValue(5)); +- EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(valueHandle), lengthKeyHandle).GetValue()->GetInt(), ++ PropertyDescriptor descRes(thread_); ++ JSHandle valueHandle(thread_, value); ++ JSHandle key7(thread_, JSTaggedValue(5)); ++ EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(valueHandle), lengthKeyHandle).GetValue()->GetInt(), + 6); +- JSObject::GetOwnProperty(thread, valueHandle, key7, descRes); ++ JSObject::GetOwnProperty(thread_, valueHandle, key7, descRes); + ASSERT_EQ(descRes.GetValue().GetTaggedValue(), JSTaggedValue(6)); + } + + // 22.1.3.3 new Array(1,2,3,4,5).CopyWithin(0,3,5) + TEST_F(BuiltinsArrayTest, CopyWithin) + { +- JSHandle lengthKeyHandle = thread->GlobalConstants()->GetHandledLengthString(); +- JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); ++ JSHandle lengthKeyHandle = thread_->GlobalConstants()->GetHandledLengthString(); ++ JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread_, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); + EXPECT_TRUE(arr != nullptr); +- JSHandle obj(thread, arr); +- EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 0); +- +- JSHandle key0(thread, JSTaggedValue(0)); +- PropertyDescriptor desc0(thread, JSHandle(thread, JSTaggedValue(1)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key0, desc0); +- JSHandle key1(thread, JSTaggedValue(1)); +- PropertyDescriptor desc1(thread, JSHandle(thread, JSTaggedValue(2)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key1, desc1); +- JSHandle key2(thread, JSTaggedValue(2)); +- PropertyDescriptor desc2(thread, JSHandle(thread, JSTaggedValue(3)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key2, desc2); +- JSHandle key3(thread, JSTaggedValue(3)); +- PropertyDescriptor desc3(thread, JSHandle(thread, JSTaggedValue(4)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key3, desc3); +- JSHandle key4(thread, JSTaggedValue(4)); +- PropertyDescriptor desc4(thread, JSHandle(thread, JSTaggedValue(5)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key4, desc4); +- +- auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 10); ++ JSHandle obj(thread_, arr); ++ EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 0); ++ ++ JSHandle key0(thread_, JSTaggedValue(0)); ++ PropertyDescriptor desc0(thread_, JSHandle(thread_, JSTaggedValue(1)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key0, desc0); ++ JSHandle key1(thread_, JSTaggedValue(1)); ++ PropertyDescriptor desc1(thread_, JSHandle(thread_, JSTaggedValue(2)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key1, desc1); ++ JSHandle key2(thread_, JSTaggedValue(2)); ++ PropertyDescriptor desc2(thread_, JSHandle(thread_, JSTaggedValue(3)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key2, desc2); ++ JSHandle key3(thread_, JSTaggedValue(3)); ++ PropertyDescriptor desc3(thread_, JSHandle(thread_, JSTaggedValue(4)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key3, desc3); ++ JSHandle key4(thread_, JSTaggedValue(4)); ++ PropertyDescriptor desc4(thread_, JSHandle(thread_, JSTaggedValue(5)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key4, desc4); ++ ++ auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 10); + ecmaRuntimeCallInfo1->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo1->SetThis(obj.GetTaggedValue()); + ecmaRuntimeCallInfo1->SetCallArg(0, JSTaggedValue(static_cast(0))); + ecmaRuntimeCallInfo1->SetCallArg(1, JSTaggedValue(static_cast(3))); + ecmaRuntimeCallInfo1->SetCallArg(2, JSTaggedValue(static_cast(5))); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); + JSTaggedValue result = Array::CopyWithin(ecmaRuntimeCallInfo1.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + JSTaggedValue value(static_cast(result.GetRawData())); + ASSERT_TRUE(value.IsECMAObject()); +- PropertyDescriptor descRes(thread); +- JSHandle valueHandle(thread, value); +- JSObject::GetOwnProperty(thread, valueHandle, key0, descRes); ++ PropertyDescriptor descRes(thread_); ++ JSHandle valueHandle(thread_, value); ++ JSObject::GetOwnProperty(thread_, valueHandle, key0, descRes); + ASSERT_EQ(descRes.GetValue().GetTaggedValue(), JSTaggedValue(4)); +- JSObject::GetOwnProperty(thread, valueHandle, key1, descRes); ++ JSObject::GetOwnProperty(thread_, valueHandle, key1, descRes); + ASSERT_EQ(descRes.GetValue().GetTaggedValue(), JSTaggedValue(5)); +- JSObject::GetOwnProperty(thread, valueHandle, key2, descRes); ++ JSObject::GetOwnProperty(thread_, valueHandle, key2, descRes); + ASSERT_EQ(descRes.GetValue().GetTaggedValue(), JSTaggedValue(3)); +- JSObject::GetOwnProperty(thread, valueHandle, key3, descRes); ++ JSObject::GetOwnProperty(thread_, valueHandle, key3, descRes); + ASSERT_EQ(descRes.GetValue().GetTaggedValue(), JSTaggedValue(4)); +- JSObject::GetOwnProperty(thread, valueHandle, key4, descRes); ++ JSObject::GetOwnProperty(thread_, valueHandle, key4, descRes); + ASSERT_EQ(descRes.GetValue().GetTaggedValue(), JSTaggedValue(5)); + } + + TEST_F(BuiltinsArrayTest, Every) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); +- auto ecmaVM = thread->GetEcmaVM(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); ++ auto ecmaVM = thread_->GetEcmaVM(); + JSHandle env = ecmaVM->GetGlobalEnv(); + +- JSHandle lengthKeyHandle = thread->GlobalConstants()->GetHandledLengthString(); +- JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); ++ JSHandle lengthKeyHandle = thread_->GlobalConstants()->GetHandledLengthString(); ++ JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread_, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); + EXPECT_TRUE(arr != nullptr); +- JSHandle obj(thread, arr); +- EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 0); ++ JSHandle obj(thread_, arr); ++ EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 0); + +- JSHandle key0(thread, JSTaggedValue(0)); +- PropertyDescriptor desc0(thread, JSHandle(thread, JSTaggedValue(100)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key0, desc0); ++ JSHandle key0(thread_, JSTaggedValue(0)); ++ PropertyDescriptor desc0(thread_, JSHandle(thread_, JSTaggedValue(100)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key0, desc0); + +- JSHandle key1(thread, JSTaggedValue(1)); +- PropertyDescriptor desc1(thread, JSHandle(thread, JSTaggedValue(200)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key1, desc1); +- JSHandle key2(thread, JSTaggedValue(2)); +- PropertyDescriptor desc2(thread, JSHandle(thread, JSTaggedValue(300)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key2, desc2); ++ JSHandle key1(thread_, JSTaggedValue(1)); ++ PropertyDescriptor desc1(thread_, JSHandle(thread_, JSTaggedValue(200)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key1, desc1); ++ JSHandle key2(thread_, JSTaggedValue(2)); ++ PropertyDescriptor desc2(thread_, JSHandle(thread_, JSTaggedValue(300)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key2, desc2); + + JSHandle jsArray = factory->NewJSArray(); + JSHandle func = factory->NewJSFunction(env, reinterpret_cast(TestClass::TestEveryFunc)); + +- auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + ecmaRuntimeCallInfo1->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo1->SetThis(obj.GetTaggedValue()); + ecmaRuntimeCallInfo1->SetCallArg(0, func.GetTaggedValue()); + ecmaRuntimeCallInfo1->SetCallArg(1, jsArray.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); + JSTaggedValue result2 = Array::Every(ecmaRuntimeCallInfo1.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + + ASSERT_EQ(result2.GetRawData(), JSTaggedValue::True().GetRawData()); + } + + TEST_F(BuiltinsArrayTest, Map) + { +- auto ecmaVM = thread->GetEcmaVM(); ++ auto ecmaVM = thread_->GetEcmaVM(); + JSHandle env = ecmaVM->GetGlobalEnv(); + ObjectFactory *factory = ecmaVM->GetFactory(); + +- JSHandle lengthKeyHandle = thread->GlobalConstants()->GetHandledLengthString(); +- JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); ++ JSHandle lengthKeyHandle = thread_->GlobalConstants()->GetHandledLengthString(); ++ JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread_, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); + EXPECT_TRUE(arr != nullptr); +- JSHandle obj(thread, arr); +- EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 0); +- JSHandle key0(thread, JSTaggedValue(0)); +- PropertyDescriptor desc0(thread, JSHandle(thread, JSTaggedValue(50)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key0, desc0); +- JSHandle key1(thread, JSTaggedValue(1)); +- PropertyDescriptor desc1(thread, JSHandle(thread, JSTaggedValue(200)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key1, desc1); +- JSHandle key2(thread, JSTaggedValue(2)); +- PropertyDescriptor desc2(thread, JSHandle(thread, JSTaggedValue(3)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key2, desc2); +- JSHandle jsArray(JSArray::ArrayCreate(thread, JSTaggedNumber(0))); ++ JSHandle obj(thread_, arr); ++ EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 0); ++ JSHandle key0(thread_, JSTaggedValue(0)); ++ PropertyDescriptor desc0(thread_, JSHandle(thread_, JSTaggedValue(50)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key0, desc0); ++ JSHandle key1(thread_, JSTaggedValue(1)); ++ PropertyDescriptor desc1(thread_, JSHandle(thread_, JSTaggedValue(200)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key1, desc1); ++ JSHandle key2(thread_, JSTaggedValue(2)); ++ PropertyDescriptor desc2(thread_, JSHandle(thread_, JSTaggedValue(3)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key2, desc2); ++ JSHandle jsArray(JSArray::ArrayCreate(thread_, JSTaggedNumber(0))); + JSHandle func = factory->NewJSFunction(env, reinterpret_cast(TestClass::TestMapFunc)); + +- auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + ecmaRuntimeCallInfo1->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo1->SetThis(obj.GetTaggedValue()); + ecmaRuntimeCallInfo1->SetCallArg(0, func.GetTaggedValue()); + ecmaRuntimeCallInfo1->SetCallArg(1, jsArray.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); + JSTaggedValue result = Array::Map(ecmaRuntimeCallInfo1.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + JSTaggedValue value(static_cast(result.GetRawData())); + ASSERT_TRUE(value.IsECMAObject()); + +- PropertyDescriptor descRes(thread); +- JSHandle valueHandle(thread, value); +- EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(valueHandle), lengthKeyHandle).GetValue()->GetInt(), ++ PropertyDescriptor descRes(thread_); ++ JSHandle valueHandle(thread_, value); ++ EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(valueHandle), lengthKeyHandle).GetValue()->GetInt(), + 3); +- JSObject::GetOwnProperty(thread, valueHandle, key0, descRes); ++ JSObject::GetOwnProperty(thread_, valueHandle, key0, descRes); + + ASSERT_EQ(descRes.GetValue()->GetInt(), 100); +- JSObject::GetOwnProperty(thread, valueHandle, key1, descRes); ++ JSObject::GetOwnProperty(thread_, valueHandle, key1, descRes); + ASSERT_EQ(descRes.GetValue()->GetInt(), 400); +- JSObject::GetOwnProperty(thread, valueHandle, key2, descRes); ++ JSObject::GetOwnProperty(thread_, valueHandle, key2, descRes); + ASSERT_EQ(descRes.GetValue()->GetInt(), 6); + } + + TEST_F(BuiltinsArrayTest, Reverse) + { +- JSHandle lengthKeyHandle = thread->GlobalConstants()->GetHandledLengthString(); +- JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); ++ JSHandle lengthKeyHandle = thread_->GlobalConstants()->GetHandledLengthString(); ++ JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread_, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); + EXPECT_TRUE(arr != nullptr); +- JSHandle obj(thread, arr); +- EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 0); +- JSHandle key0(thread, JSTaggedValue(0)); +- PropertyDescriptor desc0(thread, JSHandle(thread, JSTaggedValue(50)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key0, desc0); +- JSHandle key1(thread, JSTaggedValue(1)); +- PropertyDescriptor desc1(thread, JSHandle(thread, JSTaggedValue(200)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key1, desc1); +- JSHandle key2(thread, JSTaggedValue(2)); +- PropertyDescriptor desc2(thread, JSHandle(thread, JSTaggedValue(3)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key2, desc2); +- +- auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); ++ JSHandle obj(thread_, arr); ++ EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 0); ++ JSHandle key0(thread_, JSTaggedValue(0)); ++ PropertyDescriptor desc0(thread_, JSHandle(thread_, JSTaggedValue(50)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key0, desc0); ++ JSHandle key1(thread_, JSTaggedValue(1)); ++ PropertyDescriptor desc1(thread_, JSHandle(thread_, JSTaggedValue(200)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key1, desc1); ++ JSHandle key2(thread_, JSTaggedValue(2)); ++ PropertyDescriptor desc2(thread_, JSHandle(thread_, JSTaggedValue(3)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key2, desc2); ++ ++ auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); + ecmaRuntimeCallInfo1->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo1->SetThis(obj.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); + JSTaggedValue result = Array::Reverse(ecmaRuntimeCallInfo1.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + JSTaggedValue value(static_cast(result.GetRawData())); + ASSERT_TRUE(value.IsECMAObject()); + +- PropertyDescriptor descRes(thread); +- JSHandle valueHandle(thread, value); +- EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(valueHandle), lengthKeyHandle).GetValue()->GetInt(), ++ PropertyDescriptor descRes(thread_); ++ JSHandle valueHandle(thread_, value); ++ EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(valueHandle), lengthKeyHandle).GetValue()->GetInt(), + 3); +- JSObject::GetOwnProperty(thread, valueHandle, key0, descRes); ++ JSObject::GetOwnProperty(thread_, valueHandle, key0, descRes); + ASSERT_EQ(descRes.GetValue().GetTaggedValue(), JSTaggedValue(3)); +- JSObject::GetOwnProperty(thread, valueHandle, key1, descRes); ++ JSObject::GetOwnProperty(thread_, valueHandle, key1, descRes); + ASSERT_EQ(descRes.GetValue().GetTaggedValue(), JSTaggedValue(200)); +- JSObject::GetOwnProperty(thread, valueHandle, key2, descRes); ++ JSObject::GetOwnProperty(thread_, valueHandle, key2, descRes); + ASSERT_EQ(descRes.GetValue().GetTaggedValue(), JSTaggedValue(50)); +- EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 3); +- JSObject::GetOwnProperty(thread, obj, key0, descRes); ++ EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 3); ++ JSObject::GetOwnProperty(thread_, obj, key0, descRes); + ASSERT_EQ(descRes.GetValue().GetTaggedValue(), JSTaggedValue(3)); +- JSObject::GetOwnProperty(thread, obj, key1, descRes); ++ JSObject::GetOwnProperty(thread_, obj, key1, descRes); + ASSERT_EQ(descRes.GetValue().GetTaggedValue(), JSTaggedValue(200)); +- JSObject::GetOwnProperty(thread, obj, key2, descRes); ++ JSObject::GetOwnProperty(thread_, obj, key2, descRes); + ASSERT_EQ(descRes.GetValue().GetTaggedValue(), JSTaggedValue(50)); + } + + TEST_F(BuiltinsArrayTest, Slice) + { +- JSHandle lengthKeyHandle = thread->GlobalConstants()->GetHandledLengthString(); +- JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); ++ JSHandle lengthKeyHandle = thread_->GlobalConstants()->GetHandledLengthString(); ++ JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread_, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); + EXPECT_TRUE(arr != nullptr); +- JSHandle obj(thread, arr); +- EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 0); +- JSHandle key0(thread, JSTaggedValue(0)); +- PropertyDescriptor desc0(thread, JSHandle(thread, JSTaggedValue(1)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key0, desc0); +- JSHandle key1(thread, JSTaggedValue(1)); +- PropertyDescriptor desc1(thread, JSHandle(thread, JSTaggedValue(2)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key1, desc1); +- JSHandle key2(thread, JSTaggedValue(2)); +- PropertyDescriptor desc2(thread, JSHandle(thread, JSTaggedValue(3)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key2, desc2); +- JSHandle key3(thread, JSTaggedValue(3)); +- PropertyDescriptor desc3(thread, JSHandle(thread, JSTaggedValue(4)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key3, desc3); +- JSHandle key4(thread, JSTaggedValue(4)); +- PropertyDescriptor desc4(thread, JSHandle(thread, JSTaggedValue(3)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key4, desc4); +- +- auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ JSHandle obj(thread_, arr); ++ EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 0); ++ JSHandle key0(thread_, JSTaggedValue(0)); ++ PropertyDescriptor desc0(thread_, JSHandle(thread_, JSTaggedValue(1)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key0, desc0); ++ JSHandle key1(thread_, JSTaggedValue(1)); ++ PropertyDescriptor desc1(thread_, JSHandle(thread_, JSTaggedValue(2)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key1, desc1); ++ JSHandle key2(thread_, JSTaggedValue(2)); ++ PropertyDescriptor desc2(thread_, JSHandle(thread_, JSTaggedValue(3)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key2, desc2); ++ JSHandle key3(thread_, JSTaggedValue(3)); ++ PropertyDescriptor desc3(thread_, JSHandle(thread_, JSTaggedValue(4)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key3, desc3); ++ JSHandle key4(thread_, JSTaggedValue(4)); ++ PropertyDescriptor desc4(thread_, JSHandle(thread_, JSTaggedValue(3)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key4, desc4); ++ ++ auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + ecmaRuntimeCallInfo1->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo1->SetThis(obj.GetTaggedValue()); + ecmaRuntimeCallInfo1->SetCallArg(0, JSTaggedValue(static_cast(1))); + ecmaRuntimeCallInfo1->SetCallArg(1, JSTaggedValue(static_cast(4))); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); + JSTaggedValue result = Array::Slice(ecmaRuntimeCallInfo1.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + JSTaggedValue value(static_cast(result.GetRawData())); + ASSERT_TRUE(value.IsECMAObject()); + +- PropertyDescriptor descRes(thread); +- JSHandle valueHandle(thread, value); +- EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(valueHandle), lengthKeyHandle).GetValue()->GetInt(), ++ PropertyDescriptor descRes(thread_); ++ JSHandle valueHandle(thread_, value); ++ EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(valueHandle), lengthKeyHandle).GetValue()->GetInt(), + 3); +- JSObject::GetOwnProperty(thread, valueHandle, key0, descRes); ++ JSObject::GetOwnProperty(thread_, valueHandle, key0, descRes); + ASSERT_EQ(descRes.GetValue().GetTaggedValue(), JSTaggedValue(2)); +- JSObject::GetOwnProperty(thread, valueHandle, key1, descRes); ++ JSObject::GetOwnProperty(thread_, valueHandle, key1, descRes); + ASSERT_EQ(descRes.GetValue().GetTaggedValue(), JSTaggedValue(3)); +- JSObject::GetOwnProperty(thread, valueHandle, key2, descRes); ++ JSObject::GetOwnProperty(thread_, valueHandle, key2, descRes); + ASSERT_EQ(descRes.GetValue().GetTaggedValue(), JSTaggedValue(4)); + } + + TEST_F(BuiltinsArrayTest, Splice) + { +- JSHandle lengthKeyHandle = thread->GlobalConstants()->GetHandledLengthString(); +- JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); ++ JSHandle lengthKeyHandle = thread_->GlobalConstants()->GetHandledLengthString(); ++ JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread_, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); + EXPECT_TRUE(arr != nullptr); +- JSHandle obj(thread, arr); +- EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 0); +- JSHandle key0(thread, JSTaggedValue(0)); +- PropertyDescriptor desc0(thread, JSHandle(thread, JSTaggedValue(1)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key0, desc0); +- JSHandle key1(thread, JSTaggedValue(1)); +- PropertyDescriptor desc1(thread, JSHandle(thread, JSTaggedValue(2)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key1, desc1); +- JSHandle key2(thread, JSTaggedValue(2)); +- PropertyDescriptor desc2(thread, JSHandle(thread, JSTaggedValue(3)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key2, desc2); +- JSHandle key3(thread, JSTaggedValue(3)); +- PropertyDescriptor desc3(thread, JSHandle(thread, JSTaggedValue(4)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key3, desc3); +- JSHandle key4(thread, JSTaggedValue(4)); +- PropertyDescriptor desc4(thread, JSHandle(thread, JSTaggedValue(5)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key4, desc4); +- +- auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 10); ++ JSHandle obj(thread_, arr); ++ EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 0); ++ JSHandle key0(thread_, JSTaggedValue(0)); ++ PropertyDescriptor desc0(thread_, JSHandle(thread_, JSTaggedValue(1)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key0, desc0); ++ JSHandle key1(thread_, JSTaggedValue(1)); ++ PropertyDescriptor desc1(thread_, JSHandle(thread_, JSTaggedValue(2)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key1, desc1); ++ JSHandle key2(thread_, JSTaggedValue(2)); ++ PropertyDescriptor desc2(thread_, JSHandle(thread_, JSTaggedValue(3)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key2, desc2); ++ JSHandle key3(thread_, JSTaggedValue(3)); ++ PropertyDescriptor desc3(thread_, JSHandle(thread_, JSTaggedValue(4)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key3, desc3); ++ JSHandle key4(thread_, JSTaggedValue(4)); ++ PropertyDescriptor desc4(thread_, JSHandle(thread_, JSTaggedValue(5)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key4, desc4); ++ ++ auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 10); + ecmaRuntimeCallInfo1->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo1->SetThis(obj.GetTaggedValue()); + ecmaRuntimeCallInfo1->SetCallArg(0, JSTaggedValue(static_cast(1))); + ecmaRuntimeCallInfo1->SetCallArg(1, JSTaggedValue(static_cast(2))); + ecmaRuntimeCallInfo1->SetCallArg(2, JSTaggedValue(static_cast(100))); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); + JSTaggedValue result = Array::Splice(ecmaRuntimeCallInfo1.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + JSTaggedValue value(static_cast(result.GetRawData())); + ASSERT_TRUE(value.IsECMAObject()); +- EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 4); ++ EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 4); + +- PropertyDescriptor descRes(thread); +- JSHandle valueHandle(thread, value); +- EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(valueHandle), lengthKeyHandle).GetValue()->GetInt(), ++ PropertyDescriptor descRes(thread_); ++ JSHandle valueHandle(thread_, value); ++ EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(valueHandle), lengthKeyHandle).GetValue()->GetInt(), + 2); +- JSObject::GetOwnProperty(thread, valueHandle, key0, descRes); ++ JSObject::GetOwnProperty(thread_, valueHandle, key0, descRes); + ASSERT_EQ(descRes.GetValue().GetTaggedValue(), JSTaggedValue(2)); + } + + // ES2019 22.1.3.10 Builtin Array.flat() + TEST_F(BuiltinsArrayTest, Flat) + { +- ASSERT_NE(thread, nullptr); +- JSHandle length_key_handle = thread->GlobalConstants()->GetHandledLengthString(); ++ ASSERT_NE(thread_, nullptr); ++ JSHandle length_key_handle = thread_->GlobalConstants()->GetHandledLengthString(); + +- JSArray *arr1 = JSArray::ArrayCreate(thread, JSTaggedNumber(0)).GetObject(); +- JSArray *arr2 = JSArray::ArrayCreate(thread, JSTaggedNumber(0)).GetObject(); +- JSArray *arr3 = JSArray::ArrayCreate(thread, JSTaggedNumber(0)).GetObject(); ++ JSArray *arr1 = JSArray::ArrayCreate(thread_, JSTaggedNumber(0)).GetObject(); ++ JSArray *arr2 = JSArray::ArrayCreate(thread_, JSTaggedNumber(0)).GetObject(); ++ JSArray *arr3 = JSArray::ArrayCreate(thread_, JSTaggedNumber(0)).GetObject(); + + EXPECT_TRUE(arr1 != nullptr); + EXPECT_TRUE(arr2 != nullptr); + EXPECT_TRUE(arr3 != nullptr); + +- JSHandle obj1(thread, arr1); +- JSHandle obj2(thread, arr2); +- JSHandle obj3(thread, arr3); ++ JSHandle obj1(thread_, arr1); ++ JSHandle obj2(thread_, arr2); ++ JSHandle obj3(thread_, arr3); + +- EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(obj1), length_key_handle).GetValue()->GetInt(), 0); +- EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(obj2), length_key_handle).GetValue()->GetInt(), 0); +- EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(obj3), length_key_handle).GetValue()->GetInt(), 0); ++ EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(obj1), length_key_handle).GetValue()->GetInt(), 0); ++ EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(obj2), length_key_handle).GetValue()->GetInt(), 0); ++ EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(obj3), length_key_handle).GetValue()->GetInt(), 0); + +- JSHandle key0(thread, JSTaggedValue(0)); +- JSHandle key1(thread, JSTaggedValue(1)); +- JSHandle key2(thread, JSTaggedValue(2)); ++ JSHandle key0(thread_, JSTaggedValue(0)); ++ JSHandle key1(thread_, JSTaggedValue(1)); ++ JSHandle key2(thread_, JSTaggedValue(2)); + + // arr1 = [0, 1, arr2] +- PropertyDescriptor desc0(thread, JSHandle(thread, JSTaggedValue(0)), true, true, true); +- PropertyDescriptor desc1(thread, JSHandle(thread, JSTaggedValue(1)), true, true, true); +- PropertyDescriptor desc_nested1(thread, JSHandle(thread, obj2.GetTaggedValue()), true, true, true); +- JSArray::DefineOwnProperty(thread, obj1, key0, desc0); +- JSArray::DefineOwnProperty(thread, obj1, key1, desc1); +- JSArray::DefineOwnProperty(thread, obj1, key2, desc_nested1); ++ PropertyDescriptor desc0(thread_, JSHandle(thread_, JSTaggedValue(0)), true, true, true); ++ PropertyDescriptor desc1(thread_, JSHandle(thread_, JSTaggedValue(1)), true, true, true); ++ PropertyDescriptor desc_nested1(thread_, JSHandle(thread_, obj2.GetTaggedValue()), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj1, key0, desc0); ++ JSArray::DefineOwnProperty(thread_, obj1, key1, desc1); ++ JSArray::DefineOwnProperty(thread_, obj1, key2, desc_nested1); + + // arr2 = [2, 3, arr3] +- PropertyDescriptor desc2(thread, JSHandle(thread, JSTaggedValue(2)), true, true, true); +- PropertyDescriptor desc3(thread, JSHandle(thread, JSTaggedValue(3)), true, true, true); +- PropertyDescriptor desc_nested2(thread, JSHandle(thread, obj3.GetTaggedValue()), true, true, true); +- JSArray::DefineOwnProperty(thread, obj2, key0, desc2); +- JSArray::DefineOwnProperty(thread, obj2, key1, desc3); +- JSArray::DefineOwnProperty(thread, obj2, key2, desc_nested2); ++ PropertyDescriptor desc2(thread_, JSHandle(thread_, JSTaggedValue(2)), true, true, true); ++ PropertyDescriptor desc3(thread_, JSHandle(thread_, JSTaggedValue(3)), true, true, true); ++ PropertyDescriptor desc_nested2(thread_, JSHandle(thread_, obj3.GetTaggedValue()), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj2, key0, desc2); ++ JSArray::DefineOwnProperty(thread_, obj2, key1, desc3); ++ JSArray::DefineOwnProperty(thread_, obj2, key2, desc_nested2); + + // arr3 = [4, 5] +- PropertyDescriptor desc4(thread, JSHandle(thread, JSTaggedValue(4)), true, true, true); +- PropertyDescriptor desc5(thread, JSHandle(thread, JSTaggedValue(5)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj3, key0, desc4); +- JSArray::DefineOwnProperty(thread, obj3, key1, desc5); ++ PropertyDescriptor desc4(thread_, JSHandle(thread_, JSTaggedValue(4)), true, true, true); ++ PropertyDescriptor desc5(thread_, JSHandle(thread_, JSTaggedValue(5)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj3, key0, desc4); ++ JSArray::DefineOwnProperty(thread_, obj3, key1, desc5); + + // [0, 1, [2, 3, [4, 5]]].flat(2) = [0, 1, 2, 3, 4, 5] +- auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo1->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo1->SetThis(obj1.GetTaggedValue()); + ecmaRuntimeCallInfo1->SetCallArg(0, JSTaggedValue(static_cast(2))); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); + JSTaggedValue result = Array::Flat(ecmaRuntimeCallInfo1.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + +- PropertyDescriptor desc_res(thread); ++ PropertyDescriptor desc_res(thread_); + + JSTaggedValue value(static_cast(result.GetRawData())); +- JSHandle value_handle(thread, value); ++ JSHandle value_handle(thread_, value); + + EXPECT_EQ( +- JSArray::GetProperty(thread, JSHandle(value_handle), length_key_handle).GetValue()->GetInt(), 6); ++ JSArray::GetProperty(thread_, JSHandle(value_handle), length_key_handle).GetValue()->GetInt(), ++ 6); + +- JSHandle key3(thread, JSTaggedValue(3)); +- JSHandle key4(thread, JSTaggedValue(4)); +- JSHandle key5(thread, JSTaggedValue(5)); ++ JSHandle key3(thread_, JSTaggedValue(3)); ++ JSHandle key4(thread_, JSTaggedValue(4)); ++ JSHandle key5(thread_, JSTaggedValue(5)); + +- JSObject::GetOwnProperty(thread, value_handle, key0, desc_res); ++ JSObject::GetOwnProperty(thread_, value_handle, key0, desc_res); + ASSERT_EQ(desc_res.GetValue().GetTaggedValue(), JSTaggedValue(0)); +- JSObject::GetOwnProperty(thread, value_handle, key1, desc_res); ++ JSObject::GetOwnProperty(thread_, value_handle, key1, desc_res); + ASSERT_EQ(desc_res.GetValue().GetTaggedValue(), JSTaggedValue(1)); +- JSObject::GetOwnProperty(thread, value_handle, key2, desc_res); ++ JSObject::GetOwnProperty(thread_, value_handle, key2, desc_res); + ASSERT_EQ(desc_res.GetValue().GetTaggedValue(), JSTaggedValue(2)); +- JSObject::GetOwnProperty(thread, value_handle, key3, desc_res); ++ JSObject::GetOwnProperty(thread_, value_handle, key3, desc_res); + ASSERT_EQ(desc_res.GetValue().GetTaggedValue(), JSTaggedValue(3)); +- JSObject::GetOwnProperty(thread, value_handle, key4, desc_res); ++ JSObject::GetOwnProperty(thread_, value_handle, key4, desc_res); + ASSERT_EQ(desc_res.GetValue().GetTaggedValue(), JSTaggedValue(4)); +- JSObject::GetOwnProperty(thread, value_handle, key5, desc_res); ++ JSObject::GetOwnProperty(thread_, value_handle, key5, desc_res); + ASSERT_EQ(desc_res.GetValue().GetTaggedValue(), JSTaggedValue(5)); + + // [0, 1, [2, 3, [4, 5]]].flat() = [0, 1, 2, 3, [4, 5]] +- auto ecmaRuntimeCallInfo2 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); ++ auto ecmaRuntimeCallInfo2 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); + ecmaRuntimeCallInfo2->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo2->SetThis(obj1.GetTaggedValue()); + +- prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo2.get()); ++ prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo2.get()); + result = Array::Flat(ecmaRuntimeCallInfo2.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + + JSTaggedValue value2(static_cast(result.GetRawData())); +- JSHandle value_handle2(thread, value2); ++ JSHandle value_handle2(thread_, value2); + + EXPECT_EQ( +- JSArray::GetProperty(thread, JSHandle(value_handle2), length_key_handle).GetValue()->GetInt(), ++ JSArray::GetProperty(thread_, JSHandle(value_handle2), length_key_handle).GetValue()->GetInt(), + 5); + +- JSObject::GetOwnProperty(thread, value_handle2, key0, desc_res); ++ JSObject::GetOwnProperty(thread_, value_handle2, key0, desc_res); + ASSERT_EQ(desc_res.GetValue().GetTaggedValue(), JSTaggedValue(0)); +- JSObject::GetOwnProperty(thread, value_handle2, key1, desc_res); ++ JSObject::GetOwnProperty(thread_, value_handle2, key1, desc_res); + ASSERT_EQ(desc_res.GetValue().GetTaggedValue(), JSTaggedValue(1)); +- JSObject::GetOwnProperty(thread, value_handle2, key2, desc_res); ++ JSObject::GetOwnProperty(thread_, value_handle2, key2, desc_res); + ASSERT_EQ(desc_res.GetValue().GetTaggedValue(), JSTaggedValue(2)); +- JSObject::GetOwnProperty(thread, value_handle2, key3, desc_res); ++ JSObject::GetOwnProperty(thread_, value_handle2, key3, desc_res); + ASSERT_EQ(desc_res.GetValue().GetTaggedValue(), JSTaggedValue(3)); + +- JSObject::GetOwnProperty(thread, value_handle2, key4, desc_res); ++ JSObject::GetOwnProperty(thread_, value_handle2, key4, desc_res); + ASSERT_TRUE(desc_res.GetValue().GetTaggedValue().IsECMAObject()); + + JSTaggedValue inner_arr_value(desc_res.GetValue().GetTaggedValue()); +- JSHandle inner_arr_handle(thread, inner_arr_value); ++ JSHandle inner_arr_handle(thread_, inner_arr_value); + +- EXPECT_EQ( +- JSArray::GetProperty(thread, JSHandle(inner_arr_handle), length_key_handle).GetValue()->GetInt(), +- 2); ++ EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(inner_arr_handle), length_key_handle) ++ .GetValue() ++ ->GetInt(), ++ 2); + +- JSObject::GetOwnProperty(thread, inner_arr_handle, key0, desc_res); ++ JSObject::GetOwnProperty(thread_, inner_arr_handle, key0, desc_res); + ASSERT_EQ(desc_res.GetValue().GetTaggedValue(), JSTaggedValue(4)); +- JSObject::GetOwnProperty(thread, inner_arr_handle, key1, desc_res); ++ JSObject::GetOwnProperty(thread_, inner_arr_handle, key1, desc_res); + ASSERT_EQ(desc_res.GetValue().GetTaggedValue(), JSTaggedValue(5)); + } + +@@ -796,242 +798,243 @@ TEST_F(BuiltinsArrayTest, Flat) + TEST_F(BuiltinsArrayTest, FlatMap) + { + // [[1], [2], [4]].flatMap(x => [x*2]) = [2, 4, 8] +- ASSERT_NE(thread, nullptr); +- auto ecma_vm = thread->GetEcmaVM(); ++ ASSERT_NE(thread_, nullptr); ++ auto ecma_vm = thread_->GetEcmaVM(); + JSHandle env = ecma_vm->GetGlobalEnv(); + ObjectFactory *factory_ = ecma_vm->GetFactory(); + +- JSHandle length_key_handle = thread->GlobalConstants()->GetHandledLengthString(); +- JSArray *arr = JSArray::ArrayCreate(thread, JSTaggedNumber(0)).GetObject(); +- JSArray *arr1 = JSArray::ArrayCreate(thread, JSTaggedNumber(0)).GetObject(); +- JSArray *arr2 = JSArray::ArrayCreate(thread, JSTaggedNumber(0)).GetObject(); +- JSArray *arr3 = JSArray::ArrayCreate(thread, JSTaggedNumber(0)).GetObject(); ++ JSHandle length_key_handle = thread_->GlobalConstants()->GetHandledLengthString(); ++ JSArray *arr = JSArray::ArrayCreate(thread_, JSTaggedNumber(0)).GetObject(); ++ JSArray *arr1 = JSArray::ArrayCreate(thread_, JSTaggedNumber(0)).GetObject(); ++ JSArray *arr2 = JSArray::ArrayCreate(thread_, JSTaggedNumber(0)).GetObject(); ++ JSArray *arr3 = JSArray::ArrayCreate(thread_, JSTaggedNumber(0)).GetObject(); + + EXPECT_TRUE(arr != nullptr); + EXPECT_TRUE(arr1 != nullptr); + EXPECT_TRUE(arr2 != nullptr); + EXPECT_TRUE(arr3 != nullptr); + +- JSHandle obj(thread, arr); +- JSHandle obj1(thread, arr1); +- JSHandle obj2(thread, arr2); +- JSHandle obj3(thread, arr3); ++ JSHandle obj(thread_, arr); ++ JSHandle obj1(thread_, arr1); ++ JSHandle obj2(thread_, arr2); ++ JSHandle obj3(thread_, arr3); + +- EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(obj), length_key_handle).GetValue()->GetInt(), 0); +- EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(obj1), length_key_handle).GetValue()->GetInt(), 0); +- EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(obj2), length_key_handle).GetValue()->GetInt(), 0); +- EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(obj3), length_key_handle).GetValue()->GetInt(), 0); ++ EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(obj), length_key_handle).GetValue()->GetInt(), 0); ++ EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(obj1), length_key_handle).GetValue()->GetInt(), 0); ++ EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(obj2), length_key_handle).GetValue()->GetInt(), 0); ++ EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(obj3), length_key_handle).GetValue()->GetInt(), 0); + + // create [1], [2], [4] elements +- JSHandle key0(thread, JSTaggedNumber(0)); +- JSHandle key1(thread, JSTaggedNumber(1)); +- JSHandle key2(thread, JSTaggedNumber(2)); +- PropertyDescriptor desc1(thread, JSHandle(thread, JSTaggedValue(1)), true, true, true); +- PropertyDescriptor desc2(thread, JSHandle(thread, JSTaggedValue(2)), true, true, true); +- PropertyDescriptor desc4(thread, JSHandle(thread, JSTaggedValue(4)), true, true, true); +- JSObject::DefineOwnProperty(thread, obj1, key0, desc1); +- JSObject::DefineOwnProperty(thread, obj2, key0, desc2); +- JSObject::DefineOwnProperty(thread, obj3, key0, desc4); ++ JSHandle key0(thread_, JSTaggedNumber(0)); ++ JSHandle key1(thread_, JSTaggedNumber(1)); ++ JSHandle key2(thread_, JSTaggedNumber(2)); ++ PropertyDescriptor desc1(thread_, JSHandle(thread_, JSTaggedValue(1)), true, true, true); ++ PropertyDescriptor desc2(thread_, JSHandle(thread_, JSTaggedValue(2)), true, true, true); ++ PropertyDescriptor desc4(thread_, JSHandle(thread_, JSTaggedValue(4)), true, true, true); ++ JSObject::DefineOwnProperty(thread_, obj1, key0, desc1); ++ JSObject::DefineOwnProperty(thread_, obj2, key0, desc2); ++ JSObject::DefineOwnProperty(thread_, obj3, key0, desc4); + + // arr = [[1], [2], [4]] +- PropertyDescriptor obj_desc1(thread, JSHandle(thread, obj1.GetTaggedValue()), true, true, true); +- PropertyDescriptor obj_desc2(thread, JSHandle(thread, obj2.GetTaggedValue()), true, true, true); +- PropertyDescriptor obj_desc4(thread, JSHandle(thread, obj3.GetTaggedValue()), true, true, true); +- JSObject::DefineOwnProperty(thread, obj, key0, obj_desc1); +- JSObject::DefineOwnProperty(thread, obj, key1, obj_desc2); +- JSObject::DefineOwnProperty(thread, obj, key2, obj_desc4); +- +- EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(obj1), length_key_handle).GetValue()->GetInt(), 1); +- EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(obj2), length_key_handle).GetValue()->GetInt(), 1); +- EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(obj3), length_key_handle).GetValue()->GetInt(), 1); +- EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(obj), length_key_handle).GetValue()->GetInt(), 3); ++ PropertyDescriptor obj_desc1(thread_, JSHandle(thread_, obj1.GetTaggedValue()), true, true, true); ++ PropertyDescriptor obj_desc2(thread_, JSHandle(thread_, obj2.GetTaggedValue()), true, true, true); ++ PropertyDescriptor obj_desc4(thread_, JSHandle(thread_, obj3.GetTaggedValue()), true, true, true); ++ JSObject::DefineOwnProperty(thread_, obj, key0, obj_desc1); ++ JSObject::DefineOwnProperty(thread_, obj, key1, obj_desc2); ++ JSObject::DefineOwnProperty(thread_, obj, key2, obj_desc4); ++ ++ EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(obj1), length_key_handle).GetValue()->GetInt(), 1); ++ EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(obj2), length_key_handle).GetValue()->GetInt(), 1); ++ EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(obj3), length_key_handle).GetValue()->GetInt(), 1); ++ EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(obj), length_key_handle).GetValue()->GetInt(), 3); + + JSHandle cb = factory_->NewJSFunction(env, reinterpret_cast(TestClass::TestFlatMapFunc)); +- auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo1->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo1->SetThis(obj.GetTaggedValue()); + ecmaRuntimeCallInfo1->SetCallArg(0, cb.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); + JSTaggedValue result = Array::FlatMap(ecmaRuntimeCallInfo1.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + +- PropertyDescriptor res_desc(thread); ++ PropertyDescriptor res_desc(thread_); + + JSTaggedValue value(static_cast(result.GetRawData())); +- JSHandle value_handle(thread, value); ++ JSHandle value_handle(thread_, value); + + EXPECT_EQ( +- JSArray::GetProperty(thread, JSHandle(value_handle), length_key_handle).GetValue()->GetInt(), 3); ++ JSArray::GetProperty(thread_, JSHandle(value_handle), length_key_handle).GetValue()->GetInt(), ++ 3); + +- JSObject::GetOwnProperty(thread, value_handle, key0, res_desc); ++ JSObject::GetOwnProperty(thread_, value_handle, key0, res_desc); + ASSERT_EQ(res_desc.GetValue().GetTaggedValue(), JSTaggedValue(2)); +- JSObject::GetOwnProperty(thread, value_handle, key1, res_desc); ++ JSObject::GetOwnProperty(thread_, value_handle, key1, res_desc); + ASSERT_EQ(res_desc.GetValue().GetTaggedValue(), JSTaggedValue(4)); +- JSObject::GetOwnProperty(thread, value_handle, key2, res_desc); ++ JSObject::GetOwnProperty(thread_, value_handle, key2, res_desc); + ASSERT_EQ(res_desc.GetValue().GetTaggedValue(), JSTaggedValue(8)); + } + + // 22.1.3.6 new Array(1,2,3,4,5).Fill(0,1,3) + TEST_F(BuiltinsArrayTest, Fill) + { +- JSHandle lengthKeyHandle = thread->GlobalConstants()->GetHandledLengthString(); +- JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); ++ JSHandle lengthKeyHandle = thread_->GlobalConstants()->GetHandledLengthString(); ++ JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread_, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); + EXPECT_TRUE(arr != nullptr); +- JSHandle obj(thread, arr); +- EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 0); +- +- JSHandle key0(thread, JSTaggedValue(0)); +- PropertyDescriptor desc0(thread, JSHandle(thread, JSTaggedValue(1)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key0, desc0); +- JSHandle key1(thread, JSTaggedValue(1)); +- PropertyDescriptor desc1(thread, JSHandle(thread, JSTaggedValue(2)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key1, desc1); +- JSHandle key2(thread, JSTaggedValue(2)); +- PropertyDescriptor desc2(thread, JSHandle(thread, JSTaggedValue(3)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key2, desc2); +- JSHandle key3(thread, JSTaggedValue(3)); +- PropertyDescriptor desc3(thread, JSHandle(thread, JSTaggedValue(4)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key3, desc3); +- JSHandle key4(thread, JSTaggedValue(4)); +- PropertyDescriptor desc4(thread, JSHandle(thread, JSTaggedValue(5)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key4, desc4); +- +- auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 10); ++ JSHandle obj(thread_, arr); ++ EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 0); ++ ++ JSHandle key0(thread_, JSTaggedValue(0)); ++ PropertyDescriptor desc0(thread_, JSHandle(thread_, JSTaggedValue(1)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key0, desc0); ++ JSHandle key1(thread_, JSTaggedValue(1)); ++ PropertyDescriptor desc1(thread_, JSHandle(thread_, JSTaggedValue(2)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key1, desc1); ++ JSHandle key2(thread_, JSTaggedValue(2)); ++ PropertyDescriptor desc2(thread_, JSHandle(thread_, JSTaggedValue(3)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key2, desc2); ++ JSHandle key3(thread_, JSTaggedValue(3)); ++ PropertyDescriptor desc3(thread_, JSHandle(thread_, JSTaggedValue(4)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key3, desc3); ++ JSHandle key4(thread_, JSTaggedValue(4)); ++ PropertyDescriptor desc4(thread_, JSHandle(thread_, JSTaggedValue(5)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key4, desc4); ++ ++ auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 10); + ecmaRuntimeCallInfo1->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo1->SetThis(obj.GetTaggedValue()); + ecmaRuntimeCallInfo1->SetCallArg(0, JSTaggedValue(static_cast(0))); + ecmaRuntimeCallInfo1->SetCallArg(1, JSTaggedValue(static_cast(1))); + ecmaRuntimeCallInfo1->SetCallArg(2, JSTaggedValue(static_cast(3))); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); + JSTaggedValue result = Array::Fill(ecmaRuntimeCallInfo1.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + JSTaggedValue value(static_cast(result.GetRawData())); + ASSERT_TRUE(value.IsECMAObject()); +- PropertyDescriptor descRes(thread); +- JSHandle valueHandle(thread, value); +- JSObject::GetOwnProperty(thread, valueHandle, key0, descRes); ++ PropertyDescriptor descRes(thread_); ++ JSHandle valueHandle(thread_, value); ++ JSObject::GetOwnProperty(thread_, valueHandle, key0, descRes); + ASSERT_EQ(descRes.GetValue().GetTaggedValue(), JSTaggedValue(1)); +- JSObject::GetOwnProperty(thread, valueHandle, key1, descRes); ++ JSObject::GetOwnProperty(thread_, valueHandle, key1, descRes); + ASSERT_EQ(descRes.GetValue().GetTaggedValue(), JSTaggedValue(0)); +- JSObject::GetOwnProperty(thread, valueHandle, key2, descRes); ++ JSObject::GetOwnProperty(thread_, valueHandle, key2, descRes); + ASSERT_EQ(descRes.GetValue().GetTaggedValue(), JSTaggedValue(0)); +- JSObject::GetOwnProperty(thread, valueHandle, key3, descRes); ++ JSObject::GetOwnProperty(thread_, valueHandle, key3, descRes); + ASSERT_EQ(descRes.GetValue().GetTaggedValue(), JSTaggedValue(4)); +- JSObject::GetOwnProperty(thread, valueHandle, key4, descRes); ++ JSObject::GetOwnProperty(thread_, valueHandle, key4, descRes); + ASSERT_EQ(descRes.GetValue().GetTaggedValue(), JSTaggedValue(5)); + } + + TEST_F(BuiltinsArrayTest, Find) + { +- auto ecmaVM = thread->GetEcmaVM(); ++ auto ecmaVM = thread_->GetEcmaVM(); + JSHandle env = ecmaVM->GetGlobalEnv(); + ObjectFactory *factory = ecmaVM->GetFactory(); + +- JSHandle lengthKeyHandle = thread->GlobalConstants()->GetHandledLengthString(); +- JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); ++ JSHandle lengthKeyHandle = thread_->GlobalConstants()->GetHandledLengthString(); ++ JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread_, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); + EXPECT_TRUE(arr != nullptr); +- JSHandle obj(thread, arr); +- EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 0); +- JSHandle key0(thread, JSTaggedValue(0)); +- PropertyDescriptor desc0(thread, JSHandle(thread, JSTaggedValue(1)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key0, desc0); +- JSHandle key1(thread, JSTaggedValue(1)); +- PropertyDescriptor desc1(thread, JSHandle(thread, JSTaggedValue(102)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key1, desc1); +- JSHandle key2(thread, JSTaggedValue(2)); +- PropertyDescriptor desc2(thread, JSHandle(thread, JSTaggedValue(3)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key2, desc2); +- JSHandle jsArray(JSArray::ArrayCreate(thread, JSTaggedNumber(0))); ++ JSHandle obj(thread_, arr); ++ EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 0); ++ JSHandle key0(thread_, JSTaggedValue(0)); ++ PropertyDescriptor desc0(thread_, JSHandle(thread_, JSTaggedValue(1)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key0, desc0); ++ JSHandle key1(thread_, JSTaggedValue(1)); ++ PropertyDescriptor desc1(thread_, JSHandle(thread_, JSTaggedValue(102)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key1, desc1); ++ JSHandle key2(thread_, JSTaggedValue(2)); ++ PropertyDescriptor desc2(thread_, JSHandle(thread_, JSTaggedValue(3)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key2, desc2); ++ JSHandle jsArray(JSArray::ArrayCreate(thread_, JSTaggedNumber(0))); + JSHandle func = factory->NewJSFunction(env, reinterpret_cast(TestClass::TestFindFunc)); + +- auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + ecmaRuntimeCallInfo1->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo1->SetThis(obj.GetTaggedValue()); + ecmaRuntimeCallInfo1->SetCallArg(0, func.GetTaggedValue()); + ecmaRuntimeCallInfo1->SetCallArg(1, jsArray.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); + JSTaggedValue result2 = Array::Find(ecmaRuntimeCallInfo1.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + + EXPECT_EQ(result2.GetRawData(), JSTaggedValue(102).GetRawData()); + } + + TEST_F(BuiltinsArrayTest, FindIndex) + { +- auto ecmaVM = thread->GetEcmaVM(); ++ auto ecmaVM = thread_->GetEcmaVM(); + JSHandle env = ecmaVM->GetGlobalEnv(); + ObjectFactory *factory = ecmaVM->GetFactory(); + +- JSHandle lengthKeyHandle = thread->GlobalConstants()->GetHandledLengthString(); +- JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); ++ JSHandle lengthKeyHandle = thread_->GlobalConstants()->GetHandledLengthString(); ++ JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread_, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); + EXPECT_TRUE(arr != nullptr); +- JSHandle obj(thread, arr); +- EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 0); ++ JSHandle obj(thread_, arr); ++ EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 0); + +- JSHandle key0(thread, JSTaggedValue(0)); +- PropertyDescriptor desc0(thread, JSHandle(thread, JSTaggedValue(1)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key0, desc0); ++ JSHandle key0(thread_, JSTaggedValue(0)); ++ PropertyDescriptor desc0(thread_, JSHandle(thread_, JSTaggedValue(1)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key0, desc0); + +- JSHandle key1(thread, JSTaggedValue(1)); +- PropertyDescriptor desc1(thread, JSHandle(thread, JSTaggedValue(2)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key1, desc1); +- JSHandle key2(thread, JSTaggedValue(2)); +- PropertyDescriptor desc2(thread, JSHandle(thread, JSTaggedValue(30)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key2, desc2); ++ JSHandle key1(thread_, JSTaggedValue(1)); ++ PropertyDescriptor desc1(thread_, JSHandle(thread_, JSTaggedValue(2)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key1, desc1); ++ JSHandle key2(thread_, JSTaggedValue(2)); ++ PropertyDescriptor desc2(thread_, JSHandle(thread_, JSTaggedValue(30)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key2, desc2); + +- JSHandle jsArray(JSArray::ArrayCreate(thread, JSTaggedNumber(0))); ++ JSHandle jsArray(JSArray::ArrayCreate(thread_, JSTaggedNumber(0))); + JSHandle func = factory->NewJSFunction(env, reinterpret_cast(TestClass::TestFindIndexFunc)); + +- auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + ecmaRuntimeCallInfo1->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo1->SetThis(obj.GetTaggedValue()); + ecmaRuntimeCallInfo1->SetCallArg(0, func.GetTaggedValue()); + ecmaRuntimeCallInfo1->SetCallArg(1, jsArray.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); + JSTaggedValue result2 = Array::FindIndex(ecmaRuntimeCallInfo1.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + + EXPECT_EQ(result2.GetRawData(), JSTaggedValue(static_cast(2)).GetRawData()); + } + + TEST_F(BuiltinsArrayTest, ForEach) + { +- auto ecmaVM = thread->GetEcmaVM(); ++ auto ecmaVM = thread_->GetEcmaVM(); + JSHandle env = ecmaVM->GetGlobalEnv(); + ObjectFactory *factory = ecmaVM->GetFactory(); + +- JSHandle lengthKeyHandle = thread->GlobalConstants()->GetHandledLengthString(); +- JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); ++ JSHandle lengthKeyHandle = thread_->GlobalConstants()->GetHandledLengthString(); ++ JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread_, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); + EXPECT_TRUE(arr != nullptr); +- JSHandle obj(thread, arr); +- EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 0); +- +- JSHandle key0(thread, JSTaggedValue(0)); +- PropertyDescriptor desc0(thread, JSHandle(thread, JSTaggedValue(1)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key0, desc0); +- JSHandle key1(thread, JSTaggedValue(1)); +- PropertyDescriptor desc1(thread, JSHandle(thread, JSTaggedValue(2)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key1, desc1); +- JSHandle key2(thread, JSTaggedValue(2)); +- PropertyDescriptor desc2(thread, JSHandle(thread, JSTaggedValue(3)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key2, desc2); +- +- JSHandle jsArray(JSArray::ArrayCreate(thread, JSTaggedNumber(0))); ++ JSHandle obj(thread_, arr); ++ EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 0); ++ ++ JSHandle key0(thread_, JSTaggedValue(0)); ++ PropertyDescriptor desc0(thread_, JSHandle(thread_, JSTaggedValue(1)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key0, desc0); ++ JSHandle key1(thread_, JSTaggedValue(1)); ++ PropertyDescriptor desc1(thread_, JSHandle(thread_, JSTaggedValue(2)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key1, desc1); ++ JSHandle key2(thread_, JSTaggedValue(2)); ++ PropertyDescriptor desc2(thread_, JSHandle(thread_, JSTaggedValue(3)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key2, desc2); ++ ++ JSHandle jsArray(JSArray::ArrayCreate(thread_, JSTaggedNumber(0))); + JSHandle func = factory->NewJSFunction(env, reinterpret_cast(TestClass::TestForEachFunc)); + +- auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + ecmaRuntimeCallInfo1->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo1->SetThis(obj.GetTaggedValue()); + ecmaRuntimeCallInfo1->SetCallArg(0, func.GetTaggedValue()); + ecmaRuntimeCallInfo1->SetCallArg(1, jsArray.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); + JSTaggedValue result2 = Array::ForEach(ecmaRuntimeCallInfo1.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + EXPECT_EQ(result2.GetRawData(), JSTaggedValue::VALUE_UNDEFINED); + EXPECT_EQ(jsArray->GetArrayLength(), 3); + } +@@ -1039,652 +1042,652 @@ TEST_F(BuiltinsArrayTest, ForEach) + // ES2021 23.1.3.13 new Array(1,2,3,4,3).includes(searchElement [ , fromIndex ]) + TEST_F(BuiltinsArrayTest, Includes1) + { +- ASSERT_NE(thread, nullptr); ++ ASSERT_NE(thread_, nullptr); + +- JSHandle length_key_handle = thread->GlobalConstants()->GetHandledLengthString(); +- JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread, JSTaggedNumber(0)).GetTaggedValue().GetHeapObject()); ++ JSHandle length_key_handle = thread_->GlobalConstants()->GetHandledLengthString(); ++ JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread_, JSTaggedNumber(0)).GetTaggedValue().GetHeapObject()); + EXPECT_TRUE(arr != nullptr); +- JSHandle obj(thread, arr); +- EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(obj), length_key_handle).GetValue()->GetInt(), 0); +- +- JSHandle key0(thread, JSTaggedValue(0)); +- PropertyDescriptor desc0(thread, JSHandle(thread, JSTaggedValue(1)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key0, desc0); +- JSHandle key1(thread, JSTaggedValue(1)); +- PropertyDescriptor desc1(thread, JSHandle(thread, JSTaggedValue(2)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key1, desc1); +- JSHandle key2(thread, JSTaggedValue(2)); +- PropertyDescriptor desc2(thread, JSHandle(thread, JSTaggedValue(3)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key2, desc2); +- JSHandle key3(thread, JSTaggedValue(3)); +- PropertyDescriptor desc3(thread, JSHandle(thread, JSTaggedValue(4)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key3, desc3); +- JSHandle key4(thread, JSTaggedValue(4)); +- PropertyDescriptor desc4(thread, JSHandle(thread, JSTaggedValue(3)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key4, desc4); ++ JSHandle obj(thread_, arr); ++ EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(obj), length_key_handle).GetValue()->GetInt(), 0); ++ ++ JSHandle key0(thread_, JSTaggedValue(0)); ++ PropertyDescriptor desc0(thread_, JSHandle(thread_, JSTaggedValue(1)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key0, desc0); ++ JSHandle key1(thread_, JSTaggedValue(1)); ++ PropertyDescriptor desc1(thread_, JSHandle(thread_, JSTaggedValue(2)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key1, desc1); ++ JSHandle key2(thread_, JSTaggedValue(2)); ++ PropertyDescriptor desc2(thread_, JSHandle(thread_, JSTaggedValue(3)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key2, desc2); ++ JSHandle key3(thread_, JSTaggedValue(3)); ++ PropertyDescriptor desc3(thread_, JSHandle(thread_, JSTaggedValue(4)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key3, desc3); ++ JSHandle key4(thread_, JSTaggedValue(4)); ++ PropertyDescriptor desc4(thread_, JSHandle(thread_, JSTaggedValue(3)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key4, desc4); + + // new Array(1,2,3,4,3).includes(1,0) +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(obj.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast(1))); + ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(static_cast(0))); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = Array::Includes(ecmaRuntimeCallInfo.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + ASSERT_EQ(result.GetRawData(), JSTaggedValue(true).GetRawData()); + } + + // ES2021 23.1.3.13 new Array(1,2,3,4,3).includes(searchElement [ , fromIndex ]) + TEST_F(BuiltinsArrayTest, Includes2) + { +- ASSERT_NE(thread, nullptr); ++ ASSERT_NE(thread_, nullptr); + +- JSHandle length_key_handle = thread->GlobalConstants()->GetHandledLengthString(); +- JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread, JSTaggedNumber(0)).GetTaggedValue().GetHeapObject()); ++ JSHandle length_key_handle = thread_->GlobalConstants()->GetHandledLengthString(); ++ JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread_, JSTaggedNumber(0)).GetTaggedValue().GetHeapObject()); + EXPECT_TRUE(arr != nullptr); +- JSHandle obj(thread, arr); +- EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(obj), length_key_handle).GetValue()->GetInt(), 0); +- +- JSHandle key0(thread, JSTaggedValue(0)); +- PropertyDescriptor desc0(thread, JSHandle(thread, JSTaggedValue(1)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key0, desc0); +- JSHandle key1(thread, JSTaggedValue(1)); +- PropertyDescriptor desc1(thread, JSHandle(thread, JSTaggedValue(2)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key1, desc1); +- JSHandle key2(thread, JSTaggedValue(2)); +- PropertyDescriptor desc2(thread, JSHandle(thread, JSTaggedValue(3)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key2, desc2); +- JSHandle key3(thread, JSTaggedValue(3)); +- PropertyDescriptor desc3(thread, JSHandle(thread, JSTaggedValue(4)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key3, desc3); +- JSHandle key4(thread, JSTaggedValue(4)); +- PropertyDescriptor desc4(thread, JSHandle(thread, JSTaggedValue(3)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key4, desc4); ++ JSHandle obj(thread_, arr); ++ EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(obj), length_key_handle).GetValue()->GetInt(), 0); ++ ++ JSHandle key0(thread_, JSTaggedValue(0)); ++ PropertyDescriptor desc0(thread_, JSHandle(thread_, JSTaggedValue(1)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key0, desc0); ++ JSHandle key1(thread_, JSTaggedValue(1)); ++ PropertyDescriptor desc1(thread_, JSHandle(thread_, JSTaggedValue(2)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key1, desc1); ++ JSHandle key2(thread_, JSTaggedValue(2)); ++ PropertyDescriptor desc2(thread_, JSHandle(thread_, JSTaggedValue(3)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key2, desc2); ++ JSHandle key3(thread_, JSTaggedValue(3)); ++ PropertyDescriptor desc3(thread_, JSHandle(thread_, JSTaggedValue(4)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key3, desc3); ++ JSHandle key4(thread_, JSTaggedValue(4)); ++ PropertyDescriptor desc4(thread_, JSHandle(thread_, JSTaggedValue(3)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key4, desc4); + + // new Array(1,2,3,4,3).includes(1,3) +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(obj.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast(1))); + ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(static_cast(3))); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = Array::Includes(ecmaRuntimeCallInfo.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + ASSERT_EQ(result.GetRawData(), JSTaggedValue(false).GetRawData()); + } + + // ES2021 23.1.3.13 new Array(1,2,3,4,3).includes(searchElement [ , fromIndex ]) + TEST_F(BuiltinsArrayTest, Includes3) + { +- ASSERT_NE(thread, nullptr); ++ ASSERT_NE(thread_, nullptr); + +- JSHandle length_key_handle = thread->GlobalConstants()->GetHandledLengthString(); +- JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread, JSTaggedNumber(0)).GetTaggedValue().GetHeapObject()); ++ JSHandle length_key_handle = thread_->GlobalConstants()->GetHandledLengthString(); ++ JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread_, JSTaggedNumber(0)).GetTaggedValue().GetHeapObject()); + EXPECT_TRUE(arr != nullptr); +- JSHandle obj(thread, arr); +- EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(obj), length_key_handle).GetValue()->GetInt(), 0); +- +- JSHandle key0(thread, JSTaggedValue(0)); +- PropertyDescriptor desc0(thread, JSHandle(thread, JSTaggedValue(1)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key0, desc0); +- JSHandle key1(thread, JSTaggedValue(1)); +- PropertyDescriptor desc1(thread, JSHandle(thread, JSTaggedValue(2)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key1, desc1); +- JSHandle key2(thread, JSTaggedValue(2)); +- PropertyDescriptor desc2(thread, JSHandle(thread, JSTaggedValue(3)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key2, desc2); +- JSHandle key3(thread, JSTaggedValue(3)); +- PropertyDescriptor desc3(thread, JSHandle(thread, JSTaggedValue(4)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key3, desc3); +- JSHandle key4(thread, JSTaggedValue(4)); +- PropertyDescriptor desc4(thread, JSHandle(thread, JSTaggedValue(3)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key4, desc4); ++ JSHandle obj(thread_, arr); ++ EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(obj), length_key_handle).GetValue()->GetInt(), 0); ++ ++ JSHandle key0(thread_, JSTaggedValue(0)); ++ PropertyDescriptor desc0(thread_, JSHandle(thread_, JSTaggedValue(1)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key0, desc0); ++ JSHandle key1(thread_, JSTaggedValue(1)); ++ PropertyDescriptor desc1(thread_, JSHandle(thread_, JSTaggedValue(2)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key1, desc1); ++ JSHandle key2(thread_, JSTaggedValue(2)); ++ PropertyDescriptor desc2(thread_, JSHandle(thread_, JSTaggedValue(3)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key2, desc2); ++ JSHandle key3(thread_, JSTaggedValue(3)); ++ PropertyDescriptor desc3(thread_, JSHandle(thread_, JSTaggedValue(4)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key3, desc3); ++ JSHandle key4(thread_, JSTaggedValue(4)); ++ PropertyDescriptor desc4(thread_, JSHandle(thread_, JSTaggedValue(3)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key4, desc4); + + // new Array(1,2,3,4,3).includes(5,0) +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(obj.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast(5))); + ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(static_cast(0))); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = Array::Includes(ecmaRuntimeCallInfo.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + ASSERT_EQ(result.GetRawData(), JSTaggedValue(false).GetRawData()); + } + + // ES2021 23.1.3.13 new Array(1,2,3,4,3).includes(searchElement [ , fromIndex ]) + TEST_F(BuiltinsArrayTest, Includes4) + { +- ASSERT_NE(thread, nullptr); ++ ASSERT_NE(thread_, nullptr); + +- JSHandle length_key_handle = thread->GlobalConstants()->GetHandledLengthString(); +- JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread, JSTaggedNumber(0)).GetTaggedValue().GetHeapObject()); ++ JSHandle length_key_handle = thread_->GlobalConstants()->GetHandledLengthString(); ++ JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread_, JSTaggedNumber(0)).GetTaggedValue().GetHeapObject()); + EXPECT_TRUE(arr != nullptr); +- JSHandle obj(thread, arr); +- EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(obj), length_key_handle).GetValue()->GetInt(), 0); +- +- JSHandle key0(thread, JSTaggedValue(0)); +- PropertyDescriptor desc0(thread, JSHandle(thread, JSTaggedValue(1)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key0, desc0); +- JSHandle key1(thread, JSTaggedValue(1)); +- PropertyDescriptor desc1(thread, JSHandle(thread, JSTaggedValue(2)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key1, desc1); +- JSHandle key2(thread, JSTaggedValue(2)); +- PropertyDescriptor desc2(thread, JSHandle(thread, JSTaggedValue(3)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key2, desc2); +- JSHandle key3(thread, JSTaggedValue(3)); +- PropertyDescriptor desc3(thread, JSHandle(thread, JSTaggedValue(4)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key3, desc3); +- JSHandle key4(thread, JSTaggedValue(4)); +- PropertyDescriptor desc4(thread, JSHandle(thread, JSTaggedValue(3)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key4, desc4); ++ JSHandle obj(thread_, arr); ++ EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(obj), length_key_handle).GetValue()->GetInt(), 0); ++ ++ JSHandle key0(thread_, JSTaggedValue(0)); ++ PropertyDescriptor desc0(thread_, JSHandle(thread_, JSTaggedValue(1)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key0, desc0); ++ JSHandle key1(thread_, JSTaggedValue(1)); ++ PropertyDescriptor desc1(thread_, JSHandle(thread_, JSTaggedValue(2)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key1, desc1); ++ JSHandle key2(thread_, JSTaggedValue(2)); ++ PropertyDescriptor desc2(thread_, JSHandle(thread_, JSTaggedValue(3)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key2, desc2); ++ JSHandle key3(thread_, JSTaggedValue(3)); ++ PropertyDescriptor desc3(thread_, JSHandle(thread_, JSTaggedValue(4)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key3, desc3); ++ JSHandle key4(thread_, JSTaggedValue(4)); ++ PropertyDescriptor desc4(thread_, JSHandle(thread_, JSTaggedValue(3)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key4, desc4); + + // new Array(1,2,3,4,3).includes(1) +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(obj.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast(1))); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = Array::Includes(ecmaRuntimeCallInfo.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + ASSERT_EQ(result.GetRawData(), JSTaggedValue(true).GetRawData()); + } + + // ES2021 23.1.3.13 new Array(1,2,3,4,3).includes(searchElement [ , fromIndex ]) + TEST_F(BuiltinsArrayTest, Includes5) + { +- ASSERT_NE(thread, nullptr); ++ ASSERT_NE(thread_, nullptr); + +- JSHandle length_key_handle = thread->GlobalConstants()->GetHandledLengthString(); +- JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread, JSTaggedNumber(0)).GetTaggedValue().GetHeapObject()); ++ JSHandle length_key_handle = thread_->GlobalConstants()->GetHandledLengthString(); ++ JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread_, JSTaggedNumber(0)).GetTaggedValue().GetHeapObject()); + EXPECT_TRUE(arr != nullptr); +- JSHandle obj(thread, arr); +- EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(obj), length_key_handle).GetValue()->GetInt(), 0); +- +- JSHandle key0(thread, JSTaggedValue(0)); +- PropertyDescriptor desc0(thread, JSHandle(thread, JSTaggedValue(1)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key0, desc0); +- JSHandle key1(thread, JSTaggedValue(1)); +- PropertyDescriptor desc1(thread, JSHandle(thread, JSTaggedValue(2)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key1, desc1); +- JSHandle key2(thread, JSTaggedValue(2)); +- PropertyDescriptor desc2(thread, JSHandle(thread, JSTaggedValue(3)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key2, desc2); +- JSHandle key3(thread, JSTaggedValue(3)); +- PropertyDescriptor desc3(thread, JSHandle(thread, JSTaggedValue(4)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key3, desc3); +- JSHandle key4(thread, JSTaggedValue(4)); +- PropertyDescriptor desc4(thread, JSHandle(thread, JSTaggedValue(3)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key4, desc4); ++ JSHandle obj(thread_, arr); ++ EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(obj), length_key_handle).GetValue()->GetInt(), 0); ++ ++ JSHandle key0(thread_, JSTaggedValue(0)); ++ PropertyDescriptor desc0(thread_, JSHandle(thread_, JSTaggedValue(1)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key0, desc0); ++ JSHandle key1(thread_, JSTaggedValue(1)); ++ PropertyDescriptor desc1(thread_, JSHandle(thread_, JSTaggedValue(2)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key1, desc1); ++ JSHandle key2(thread_, JSTaggedValue(2)); ++ PropertyDescriptor desc2(thread_, JSHandle(thread_, JSTaggedValue(3)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key2, desc2); ++ JSHandle key3(thread_, JSTaggedValue(3)); ++ PropertyDescriptor desc3(thread_, JSHandle(thread_, JSTaggedValue(4)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key3, desc3); ++ JSHandle key4(thread_, JSTaggedValue(4)); ++ PropertyDescriptor desc4(thread_, JSHandle(thread_, JSTaggedValue(3)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key4, desc4); + + // new Array(1,2,3,4,3).includes(5) +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(obj.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast(5))); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = Array::Includes(ecmaRuntimeCallInfo.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + ASSERT_EQ(result.GetRawData(), JSTaggedValue(false).GetRawData()); + } + + // 22.1.3.11 new Array(1,2,3,4,3).IndexOf(searchElement [ , fromIndex ]) + TEST_F(BuiltinsArrayTest, IndexOf) + { +- JSHandle lengthKeyHandle = thread->GlobalConstants()->GetHandledLengthString(); +- JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); ++ JSHandle lengthKeyHandle = thread_->GlobalConstants()->GetHandledLengthString(); ++ JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread_, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); + EXPECT_TRUE(arr != nullptr); +- JSHandle obj(thread, arr); +- EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 0); +- +- JSHandle key0(thread, JSTaggedValue(0)); +- PropertyDescriptor desc0(thread, JSHandle(thread, JSTaggedValue(1)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key0, desc0); +- JSHandle key1(thread, JSTaggedValue(1)); +- PropertyDescriptor desc1(thread, JSHandle(thread, JSTaggedValue(2)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key1, desc1); +- JSHandle key2(thread, JSTaggedValue(2)); +- PropertyDescriptor desc2(thread, JSHandle(thread, JSTaggedValue(3)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key2, desc2); +- JSHandle key3(thread, JSTaggedValue(3)); +- PropertyDescriptor desc3(thread, JSHandle(thread, JSTaggedValue(4)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key3, desc3); +- JSHandle key4(thread, JSTaggedValue(4)); +- PropertyDescriptor desc4(thread, JSHandle(thread, JSTaggedValue(3)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key4, desc4); +- +- auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ JSHandle obj(thread_, arr); ++ EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 0); ++ ++ JSHandle key0(thread_, JSTaggedValue(0)); ++ PropertyDescriptor desc0(thread_, JSHandle(thread_, JSTaggedValue(1)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key0, desc0); ++ JSHandle key1(thread_, JSTaggedValue(1)); ++ PropertyDescriptor desc1(thread_, JSHandle(thread_, JSTaggedValue(2)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key1, desc1); ++ JSHandle key2(thread_, JSTaggedValue(2)); ++ PropertyDescriptor desc2(thread_, JSHandle(thread_, JSTaggedValue(3)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key2, desc2); ++ JSHandle key3(thread_, JSTaggedValue(3)); ++ PropertyDescriptor desc3(thread_, JSHandle(thread_, JSTaggedValue(4)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key3, desc3); ++ JSHandle key4(thread_, JSTaggedValue(4)); ++ PropertyDescriptor desc4(thread_, JSHandle(thread_, JSTaggedValue(3)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key4, desc4); ++ ++ auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + ecmaRuntimeCallInfo1->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo1->SetThis(obj.GetTaggedValue()); + ecmaRuntimeCallInfo1->SetCallArg(0, JSTaggedValue(static_cast(3))); + ecmaRuntimeCallInfo1->SetCallArg(1, JSTaggedValue(static_cast(0))); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); + JSTaggedValue result = Array::IndexOf(ecmaRuntimeCallInfo1.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + ASSERT_EQ(result.GetRawData(), JSTaggedValue(static_cast(2)).GetRawData()); + +- auto ecmaRuntimeCallInfo2 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ auto ecmaRuntimeCallInfo2 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + ecmaRuntimeCallInfo2->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo2->SetThis(obj.GetTaggedValue()); + ecmaRuntimeCallInfo2->SetCallArg(0, JSTaggedValue(static_cast(3))); + ecmaRuntimeCallInfo2->SetCallArg(1, JSTaggedValue(static_cast(3))); + +- prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo2.get()); ++ prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo2.get()); + result = Array::IndexOf(ecmaRuntimeCallInfo2.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + ASSERT_EQ(result.GetRawData(), JSTaggedValue(static_cast(4)).GetRawData()); + +- auto ecmaRuntimeCallInfo3 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ auto ecmaRuntimeCallInfo3 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + ecmaRuntimeCallInfo3->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo3->SetThis(obj.GetTaggedValue()); + ecmaRuntimeCallInfo3->SetCallArg(0, JSTaggedValue(static_cast(5))); + ecmaRuntimeCallInfo3->SetCallArg(1, JSTaggedValue(static_cast(0))); + +- prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo3.get()); ++ prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo3.get()); + result = Array::IndexOf(ecmaRuntimeCallInfo3.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + ASSERT_EQ(result.GetRawData(), JSTaggedValue(-1).GetRawData()); + +- auto ecmaRuntimeCallInfo4 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto ecmaRuntimeCallInfo4 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo4->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo4->SetThis(obj.GetTaggedValue()); + ecmaRuntimeCallInfo4->SetCallArg(0, JSTaggedValue(static_cast(3))); + +- prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo4.get()); ++ prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo4.get()); + result = Array::IndexOf(ecmaRuntimeCallInfo4.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + ASSERT_EQ(result.GetRawData(), JSTaggedValue(static_cast(2)).GetRawData()); + } + + // 22.1.3.14 new Array(1,2,3,4,3).LastIndexOf(searchElement [ , fromIndex ]) + TEST_F(BuiltinsArrayTest, LastIndexOf) + { +- JSHandle lengthKeyHandle = thread->GlobalConstants()->GetHandledLengthString(); +- JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); ++ JSHandle lengthKeyHandle = thread_->GlobalConstants()->GetHandledLengthString(); ++ JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread_, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); + EXPECT_TRUE(arr != nullptr); +- JSHandle obj(thread, arr); +- EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 0); +- +- JSHandle key0(thread, JSTaggedValue(0)); +- PropertyDescriptor desc0(thread, JSHandle(thread, JSTaggedValue(1)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key0, desc0); +- JSHandle key1(thread, JSTaggedValue(1)); +- PropertyDescriptor desc1(thread, JSHandle(thread, JSTaggedValue(2)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key1, desc1); +- JSHandle key2(thread, JSTaggedValue(2)); +- PropertyDescriptor desc2(thread, JSHandle(thread, JSTaggedValue(3)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key2, desc2); +- JSHandle key3(thread, JSTaggedValue(3)); +- PropertyDescriptor desc3(thread, JSHandle(thread, JSTaggedValue(4)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key3, desc3); +- JSHandle key4(thread, JSTaggedValue(4)); +- PropertyDescriptor desc4(thread, JSHandle(thread, JSTaggedValue(3)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key4, desc4); ++ JSHandle obj(thread_, arr); ++ EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 0); ++ ++ JSHandle key0(thread_, JSTaggedValue(0)); ++ PropertyDescriptor desc0(thread_, JSHandle(thread_, JSTaggedValue(1)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key0, desc0); ++ JSHandle key1(thread_, JSTaggedValue(1)); ++ PropertyDescriptor desc1(thread_, JSHandle(thread_, JSTaggedValue(2)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key1, desc1); ++ JSHandle key2(thread_, JSTaggedValue(2)); ++ PropertyDescriptor desc2(thread_, JSHandle(thread_, JSTaggedValue(3)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key2, desc2); ++ JSHandle key3(thread_, JSTaggedValue(3)); ++ PropertyDescriptor desc3(thread_, JSHandle(thread_, JSTaggedValue(4)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key3, desc3); ++ JSHandle key4(thread_, JSTaggedValue(4)); ++ PropertyDescriptor desc4(thread_, JSHandle(thread_, JSTaggedValue(3)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key4, desc4); + + // new Array(1,2,3,4,3).LastIndexOf(3,4) +- auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + ecmaRuntimeCallInfo1->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo1->SetThis(obj.GetTaggedValue()); + ecmaRuntimeCallInfo1->SetCallArg(0, JSTaggedValue(static_cast(3))); + ecmaRuntimeCallInfo1->SetCallArg(1, JSTaggedValue(static_cast(4))); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); + JSTaggedValue result = Array::LastIndexOf(ecmaRuntimeCallInfo1.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + ASSERT_EQ(result.GetRawData(), JSTaggedValue(static_cast(4)).GetRawData()); + + // new Array(1,2,3,4,3).LastIndexOf(3,3) +- auto ecmaRuntimeCallInfo2 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ auto ecmaRuntimeCallInfo2 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + ecmaRuntimeCallInfo2->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo2->SetThis(obj.GetTaggedValue()); + ecmaRuntimeCallInfo2->SetCallArg(0, JSTaggedValue(static_cast(3))); + ecmaRuntimeCallInfo2->SetCallArg(1, JSTaggedValue(static_cast(3))); + +- prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo2.get()); ++ prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo2.get()); + result = Array::LastIndexOf(ecmaRuntimeCallInfo2.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + ASSERT_EQ(result.GetRawData(), JSTaggedValue(static_cast(2)).GetRawData()); + + // new Array(1,2,3,4,3).LastIndexOf(5,4) +- auto ecmaRuntimeCallInfo3 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ auto ecmaRuntimeCallInfo3 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + ecmaRuntimeCallInfo3->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo3->SetThis(obj.GetTaggedValue()); + ecmaRuntimeCallInfo3->SetCallArg(0, JSTaggedValue(static_cast(5))); + ecmaRuntimeCallInfo3->SetCallArg(1, JSTaggedValue(static_cast(4))); + +- prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo3.get()); ++ prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo3.get()); + result = Array::LastIndexOf(ecmaRuntimeCallInfo3.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + ASSERT_EQ(result.GetRawData(), JSTaggedValue(-1).GetRawData()); + + // new Array(1,2,3,4,3).LastIndexOf(3) +- auto ecmaRuntimeCallInfo4 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto ecmaRuntimeCallInfo4 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo4->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo4->SetThis(obj.GetTaggedValue()); + ecmaRuntimeCallInfo4->SetCallArg(0, JSTaggedValue(static_cast(3))); + +- prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo4.get()); ++ prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo4.get()); + result = Array::LastIndexOf(ecmaRuntimeCallInfo4.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + ASSERT_EQ(result.GetRawData(), JSTaggedValue(static_cast(4)).GetRawData()); + } + + // 22.1.3.11 new Array().Pop() + TEST_F(BuiltinsArrayTest, Pop) + { +- JSHandle lengthKeyHandle = thread->GlobalConstants()->GetHandledLengthString(); +- JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); ++ JSHandle lengthKeyHandle = thread_->GlobalConstants()->GetHandledLengthString(); ++ JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread_, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); + EXPECT_TRUE(arr != nullptr); +- JSHandle obj(thread, arr); +- EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 0); ++ JSHandle obj(thread_, arr); ++ EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 0); + +- auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); ++ auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); + ecmaRuntimeCallInfo1->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo1->SetThis(obj.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); + JSTaggedValue result = Array::Pop(ecmaRuntimeCallInfo1.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + ASSERT_EQ(result.GetRawData(), JSTaggedValue::VALUE_UNDEFINED); + ASSERT_EQ(result.GetRawData(), JSTaggedValue::VALUE_UNDEFINED); + +- JSHandle key0(thread, JSTaggedValue(0)); +- PropertyDescriptor desc0(thread, JSHandle(thread, JSTaggedValue(1)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key0, desc0); +- JSHandle key1(thread, JSTaggedValue(1)); +- PropertyDescriptor desc1(thread, JSHandle(thread, JSTaggedValue(2)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key1, desc1); +- JSHandle key2(thread, JSTaggedValue(2)); +- PropertyDescriptor desc2(thread, JSHandle(thread, JSTaggedValue(3)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key2, desc2); +- +- auto ecmaRuntimeCallInfo2 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); ++ JSHandle key0(thread_, JSTaggedValue(0)); ++ PropertyDescriptor desc0(thread_, JSHandle(thread_, JSTaggedValue(1)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key0, desc0); ++ JSHandle key1(thread_, JSTaggedValue(1)); ++ PropertyDescriptor desc1(thread_, JSHandle(thread_, JSTaggedValue(2)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key1, desc1); ++ JSHandle key2(thread_, JSTaggedValue(2)); ++ PropertyDescriptor desc2(thread_, JSHandle(thread_, JSTaggedValue(3)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key2, desc2); ++ ++ auto ecmaRuntimeCallInfo2 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); + ecmaRuntimeCallInfo2->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo2->SetThis(obj.GetTaggedValue()); + +- prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo2.get()); ++ prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo2.get()); + result = Array::Pop(ecmaRuntimeCallInfo2.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + ASSERT_EQ(result.GetRawData(), JSTaggedValue(3).GetRawData()); + } + + // 22.1.3.11 new Array(1,2,3).Push(...items) + TEST_F(BuiltinsArrayTest, Push) + { +- JSHandle lengthKeyHandle = thread->GlobalConstants()->GetHandledLengthString(); +- JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); ++ JSHandle lengthKeyHandle = thread_->GlobalConstants()->GetHandledLengthString(); ++ JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread_, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); + EXPECT_TRUE(arr != nullptr); +- JSHandle obj(thread, arr); +- EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 0); +- +- JSHandle key0(thread, JSTaggedValue(0)); +- PropertyDescriptor desc0(thread, JSHandle(thread, JSTaggedValue(1)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key0, desc0); +- JSHandle key1(thread, JSTaggedValue(1)); +- PropertyDescriptor desc1(thread, JSHandle(thread, JSTaggedValue(2)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key1, desc1); +- JSHandle key2(thread, JSTaggedValue(2)); +- PropertyDescriptor desc2(thread, JSHandle(thread, JSTaggedValue(3)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key2, desc2); +- +- auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ JSHandle obj(thread_, arr); ++ EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 0); ++ ++ JSHandle key0(thread_, JSTaggedValue(0)); ++ PropertyDescriptor desc0(thread_, JSHandle(thread_, JSTaggedValue(1)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key0, desc0); ++ JSHandle key1(thread_, JSTaggedValue(1)); ++ PropertyDescriptor desc1(thread_, JSHandle(thread_, JSTaggedValue(2)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key1, desc1); ++ JSHandle key2(thread_, JSTaggedValue(2)); ++ PropertyDescriptor desc2(thread_, JSHandle(thread_, JSTaggedValue(3)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key2, desc2); ++ ++ auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + ecmaRuntimeCallInfo1->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo1->SetThis(obj.GetTaggedValue()); + ecmaRuntimeCallInfo1->SetCallArg(0, JSTaggedValue(static_cast(4))); + ecmaRuntimeCallInfo1->SetCallArg(1, JSTaggedValue(static_cast(5))); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); + JSTaggedValue result = Array::Push(ecmaRuntimeCallInfo1.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + ASSERT_EQ(result.GetNumber(), 5); + +- EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 5); +- JSHandle key3(thread, JSTaggedValue(3)); +- EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(obj), key3).GetValue()->GetInt(), 4); +- JSHandle key4(thread, JSTaggedValue(4)); +- EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(obj), key4).GetValue()->GetInt(), 5); ++ EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 5); ++ JSHandle key3(thread_, JSTaggedValue(3)); ++ EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(obj), key3).GetValue()->GetInt(), 4); ++ JSHandle key4(thread_, JSTaggedValue(4)); ++ EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(obj), key4).GetValue()->GetInt(), 5); + } + + TEST_F(BuiltinsArrayTest, Reduce) + { +- auto ecmaVM = thread->GetEcmaVM(); ++ auto ecmaVM = thread_->GetEcmaVM(); + JSHandle env = ecmaVM->GetGlobalEnv(); + ObjectFactory *factory = ecmaVM->GetFactory(); + +- JSHandle lengthKeyHandle = thread->GlobalConstants()->GetHandledLengthString(); +- JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); ++ JSHandle lengthKeyHandle = thread_->GlobalConstants()->GetHandledLengthString(); ++ JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread_, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); + EXPECT_TRUE(arr != nullptr); +- JSHandle obj(thread, arr); +- EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 0); +- JSHandle key0(thread, JSTaggedValue(0)); +- PropertyDescriptor desc0(thread, JSHandle(thread, JSTaggedValue(1)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key0, desc0); +- JSHandle key1(thread, JSTaggedValue(1)); +- PropertyDescriptor desc1(thread, JSHandle(thread, JSTaggedValue(2)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key1, desc1); +- JSHandle key2(thread, JSTaggedValue(2)); +- PropertyDescriptor desc2(thread, JSHandle(thread, JSTaggedValue(3)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key2, desc2); ++ JSHandle obj(thread_, arr); ++ EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 0); ++ JSHandle key0(thread_, JSTaggedValue(0)); ++ PropertyDescriptor desc0(thread_, JSHandle(thread_, JSTaggedValue(1)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key0, desc0); ++ JSHandle key1(thread_, JSTaggedValue(1)); ++ PropertyDescriptor desc1(thread_, JSHandle(thread_, JSTaggedValue(2)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key1, desc1); ++ JSHandle key2(thread_, JSTaggedValue(2)); ++ PropertyDescriptor desc2(thread_, JSHandle(thread_, JSTaggedValue(3)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key2, desc2); + + JSHandle func = factory->NewJSFunction(env, reinterpret_cast(TestClass::TestReduceFunc)); + +- auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + ecmaRuntimeCallInfo1->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo1->SetThis(obj.GetTaggedValue()); + ecmaRuntimeCallInfo1->SetCallArg(0, func.GetTaggedValue()); + ecmaRuntimeCallInfo1->SetCallArg(1, JSTaggedValue(static_cast(10))); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); + JSTaggedValue result = Array::Reduce(ecmaRuntimeCallInfo1.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + ASSERT_EQ(result.GetRawData(), JSTaggedValue(16).GetRawData()); + } + + TEST_F(BuiltinsArrayTest, ReduceRight) + { +- auto ecmaVM = thread->GetEcmaVM(); ++ auto ecmaVM = thread_->GetEcmaVM(); + JSHandle env = ecmaVM->GetGlobalEnv(); + ObjectFactory *factory = ecmaVM->GetFactory(); + +- JSHandle lengthKeyHandle = thread->GlobalConstants()->GetHandledLengthString(); +- JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); ++ JSHandle lengthKeyHandle = thread_->GlobalConstants()->GetHandledLengthString(); ++ JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread_, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); + EXPECT_TRUE(arr != nullptr); +- JSHandle obj(thread, arr); +- EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 0); +- JSHandle key0(thread, JSTaggedValue(0)); +- PropertyDescriptor desc0(thread, JSHandle(thread, JSTaggedValue(1)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key0, desc0); +- JSHandle key1(thread, JSTaggedValue(1)); +- PropertyDescriptor desc1(thread, JSHandle(thread, JSTaggedValue(2)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key1, desc1); +- JSHandle key2(thread, JSTaggedValue(2)); +- PropertyDescriptor desc2(thread, JSHandle(thread, JSTaggedValue(3)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key2, desc2); ++ JSHandle obj(thread_, arr); ++ EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 0); ++ JSHandle key0(thread_, JSTaggedValue(0)); ++ PropertyDescriptor desc0(thread_, JSHandle(thread_, JSTaggedValue(1)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key0, desc0); ++ JSHandle key1(thread_, JSTaggedValue(1)); ++ PropertyDescriptor desc1(thread_, JSHandle(thread_, JSTaggedValue(2)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key1, desc1); ++ JSHandle key2(thread_, JSTaggedValue(2)); ++ PropertyDescriptor desc2(thread_, JSHandle(thread_, JSTaggedValue(3)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key2, desc2); + + JSHandle func = factory->NewJSFunction(env, reinterpret_cast(TestClass::TestReduceRightFunc)); + +- auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + ecmaRuntimeCallInfo1->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo1->SetThis(obj.GetTaggedValue()); + ecmaRuntimeCallInfo1->SetCallArg(0, func.GetTaggedValue()); + ecmaRuntimeCallInfo1->SetCallArg(1, JSTaggedValue(static_cast(10))); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); + JSTaggedValue result = Array::ReduceRight(ecmaRuntimeCallInfo1.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + ASSERT_EQ(result.GetRawData(), JSTaggedValue(16).GetRawData()); + } + + TEST_F(BuiltinsArrayTest, Shift) + { +- JSHandle lengthKeyHandle = thread->GlobalConstants()->GetHandledLengthString(); +- JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); ++ JSHandle lengthKeyHandle = thread_->GlobalConstants()->GetHandledLengthString(); ++ JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread_, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); + EXPECT_TRUE(arr != nullptr); +- JSHandle obj(thread, arr); +- EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 0); +- +- JSHandle key0(thread, JSTaggedValue(0)); +- PropertyDescriptor desc0(thread, JSHandle(thread, JSTaggedValue(1)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key0, desc0); +- JSHandle key1(thread, JSTaggedValue(1)); +- PropertyDescriptor desc1(thread, JSHandle(thread, JSTaggedValue(2)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key1, desc1); +- JSHandle key2(thread, JSTaggedValue(2)); +- PropertyDescriptor desc2(thread, JSHandle(thread, JSTaggedValue(3)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key2, desc2); +- +- auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); ++ JSHandle obj(thread_, arr); ++ EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 0); ++ ++ JSHandle key0(thread_, JSTaggedValue(0)); ++ PropertyDescriptor desc0(thread_, JSHandle(thread_, JSTaggedValue(1)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key0, desc0); ++ JSHandle key1(thread_, JSTaggedValue(1)); ++ PropertyDescriptor desc1(thread_, JSHandle(thread_, JSTaggedValue(2)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key1, desc1); ++ JSHandle key2(thread_, JSTaggedValue(2)); ++ PropertyDescriptor desc2(thread_, JSHandle(thread_, JSTaggedValue(3)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key2, desc2); ++ ++ auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); + ecmaRuntimeCallInfo1->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo1->SetThis(obj.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); + JSTaggedValue result = Array::Shift(ecmaRuntimeCallInfo1.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + ASSERT_EQ(result.GetRawData(), JSTaggedValue(1).GetRawData()); + } + + TEST_F(BuiltinsArrayTest, Some) + { +- auto ecmaVM = thread->GetEcmaVM(); ++ auto ecmaVM = thread_->GetEcmaVM(); + JSHandle env = ecmaVM->GetGlobalEnv(); + ObjectFactory *factory = ecmaVM->GetFactory(); + +- JSHandle lengthKeyHandle = thread->GlobalConstants()->GetHandledLengthString(); +- JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); ++ JSHandle lengthKeyHandle = thread_->GlobalConstants()->GetHandledLengthString(); ++ JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread_, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); + EXPECT_TRUE(arr != nullptr); +- JSHandle obj(thread, arr); +- EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 0); +- +- JSHandle key0(thread, JSTaggedValue(0)); +- PropertyDescriptor desc0(thread, JSHandle(thread, JSTaggedValue(1)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key0, desc0); +- JSHandle key1(thread, JSTaggedValue(1)); +- PropertyDescriptor desc1(thread, JSHandle(thread, JSTaggedValue(20)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key1, desc1); +- JSHandle key2(thread, JSTaggedValue(2)); +- PropertyDescriptor desc2(thread, JSHandle(thread, JSTaggedValue(3)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key2, desc2); +- +- JSHandle jsArray(JSArray::ArrayCreate(thread, JSTaggedNumber(0))); ++ JSHandle obj(thread_, arr); ++ EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 0); ++ ++ JSHandle key0(thread_, JSTaggedValue(0)); ++ PropertyDescriptor desc0(thread_, JSHandle(thread_, JSTaggedValue(1)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key0, desc0); ++ JSHandle key1(thread_, JSTaggedValue(1)); ++ PropertyDescriptor desc1(thread_, JSHandle(thread_, JSTaggedValue(20)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key1, desc1); ++ JSHandle key2(thread_, JSTaggedValue(2)); ++ PropertyDescriptor desc2(thread_, JSHandle(thread_, JSTaggedValue(3)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key2, desc2); ++ ++ JSHandle jsArray(JSArray::ArrayCreate(thread_, JSTaggedNumber(0))); + JSHandle func = factory->NewJSFunction(env, reinterpret_cast(TestClass::TestSomeFunc)); + +- auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + ecmaRuntimeCallInfo1->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo1->SetThis(obj.GetTaggedValue()); + ecmaRuntimeCallInfo1->SetCallArg(0, func.GetTaggedValue()); + ecmaRuntimeCallInfo1->SetCallArg(1, jsArray.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); + JSTaggedValue result2 = Array::Some(ecmaRuntimeCallInfo1.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + ASSERT_EQ(result2.GetRawData(), JSTaggedValue::True().GetRawData()); + } + + TEST_F(BuiltinsArrayTest, Sort) + { +- JSHandle lengthKeyHandle = thread->GlobalConstants()->GetHandledLengthString(); +- JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); ++ JSHandle lengthKeyHandle = thread_->GlobalConstants()->GetHandledLengthString(); ++ JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread_, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); + EXPECT_TRUE(arr != nullptr); +- JSHandle obj(thread, arr); +- EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 0); +- +- JSHandle key0(thread, JSTaggedValue(0)); +- PropertyDescriptor desc0(thread, JSHandle(thread, JSTaggedValue(3)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key0, desc0); +- JSHandle key1(thread, JSTaggedValue(1)); +- PropertyDescriptor desc1(thread, JSHandle(thread, JSTaggedValue(2)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key1, desc1); +- JSHandle key2(thread, JSTaggedValue(2)); +- PropertyDescriptor desc2(thread, JSHandle(thread, JSTaggedValue(1)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key2, desc2); +- +- auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); ++ JSHandle obj(thread_, arr); ++ EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 0); ++ ++ JSHandle key0(thread_, JSTaggedValue(0)); ++ PropertyDescriptor desc0(thread_, JSHandle(thread_, JSTaggedValue(3)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key0, desc0); ++ JSHandle key1(thread_, JSTaggedValue(1)); ++ PropertyDescriptor desc1(thread_, JSHandle(thread_, JSTaggedValue(2)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key1, desc1); ++ JSHandle key2(thread_, JSTaggedValue(2)); ++ PropertyDescriptor desc2(thread_, JSHandle(thread_, JSTaggedValue(1)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key2, desc2); ++ ++ auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); + ecmaRuntimeCallInfo1->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo1->SetThis(obj.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); + JSTaggedValue result2 = Array::Sort(ecmaRuntimeCallInfo1.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + + EXPECT_TRUE(result2.IsECMAObject()); + JSHandle resultArr = +- JSHandle(thread, JSTaggedValue(static_cast(result2.GetRawData()))); +- EXPECT_EQ(JSArray::GetProperty(thread, resultArr, key0).GetValue()->GetInt(), 1); +- EXPECT_EQ(JSArray::GetProperty(thread, resultArr, key1).GetValue()->GetInt(), 2); +- EXPECT_EQ(JSArray::GetProperty(thread, resultArr, key2).GetValue()->GetInt(), 3); ++ JSHandle(thread_, JSTaggedValue(static_cast(result2.GetRawData()))); ++ EXPECT_EQ(JSArray::GetProperty(thread_, resultArr, key0).GetValue()->GetInt(), 1); ++ EXPECT_EQ(JSArray::GetProperty(thread_, resultArr, key1).GetValue()->GetInt(), 2); ++ EXPECT_EQ(JSArray::GetProperty(thread_, resultArr, key2).GetValue()->GetInt(), 3); + } + + TEST_F(BuiltinsArrayTest, Unshift) + { +- JSHandle lengthKeyHandle = thread->GlobalConstants()->GetHandledLengthString(); +- JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); ++ JSHandle lengthKeyHandle = thread_->GlobalConstants()->GetHandledLengthString(); ++ JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread_, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); + EXPECT_TRUE(arr != nullptr); +- JSHandle obj(thread, arr); +- EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 0); +- +- JSHandle key0(thread, JSTaggedValue(0)); +- PropertyDescriptor desc0(thread, JSHandle(thread, JSTaggedValue(1)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key0, desc0); +- JSHandle key1(thread, JSTaggedValue(1)); +- PropertyDescriptor desc1(thread, JSHandle(thread, JSTaggedValue(2)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key1, desc1); +- JSHandle key2(thread, JSTaggedValue(2)); +- PropertyDescriptor desc2(thread, JSHandle(thread, JSTaggedValue(3)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key2, desc2); +- +- auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ JSHandle obj(thread_, arr); ++ EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 0); ++ ++ JSHandle key0(thread_, JSTaggedValue(0)); ++ PropertyDescriptor desc0(thread_, JSHandle(thread_, JSTaggedValue(1)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key0, desc0); ++ JSHandle key1(thread_, JSTaggedValue(1)); ++ PropertyDescriptor desc1(thread_, JSHandle(thread_, JSTaggedValue(2)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key1, desc1); ++ JSHandle key2(thread_, JSTaggedValue(2)); ++ PropertyDescriptor desc2(thread_, JSHandle(thread_, JSTaggedValue(3)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key2, desc2); ++ ++ auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + ecmaRuntimeCallInfo1->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo1->SetThis(obj.GetTaggedValue()); + ecmaRuntimeCallInfo1->SetCallArg(0, JSTaggedValue(static_cast(4))); + ecmaRuntimeCallInfo1->SetCallArg(1, JSTaggedValue(static_cast(5))); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); + JSTaggedValue result = Array::Unshift(ecmaRuntimeCallInfo1.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + + ASSERT_EQ(result.GetRawData(), JSTaggedValue(static_cast(5)).GetRawData()); + +- EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 5); +- JSHandle key3(thread, JSTaggedValue(0)); +- EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(obj), key3).GetValue()->GetInt(), 4); +- JSHandle key4(thread, JSTaggedValue(1)); +- EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(obj), key4).GetValue()->GetInt(), 5); ++ EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 5); ++ JSHandle key3(thread_, JSTaggedValue(0)); ++ EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(obj), key3).GetValue()->GetInt(), 4); ++ JSHandle key4(thread_, JSTaggedValue(1)); ++ EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(obj), key4).GetValue()->GetInt(), 5); + } + + TEST_F(BuiltinsArrayTest, Join) + { +- JSHandle lengthKeyHandle = thread->GlobalConstants()->GetHandledLengthString(); +- JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); ++ JSHandle lengthKeyHandle = thread_->GlobalConstants()->GetHandledLengthString(); ++ JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread_, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); + EXPECT_TRUE(arr != nullptr); +- JSHandle obj(thread, arr); +- EXPECT_EQ(JSArray::GetProperty(thread, obj, lengthKeyHandle).GetValue()->GetInt(), 0); +- +- JSHandle key0(thread, JSTaggedValue(0)); +- PropertyDescriptor desc0(thread, JSHandle(thread, JSTaggedValue(2))); +- JSArray::DefineOwnProperty(thread, JSHandle(obj), key0, desc0); +- JSHandle key1(thread, JSTaggedValue(1)); +- PropertyDescriptor desc1(thread, JSHandle(thread, JSTaggedValue(3))); +- JSArray::DefineOwnProperty(thread, JSHandle(obj), key1, desc1); +- JSHandle key2(thread, JSTaggedValue(2)); +- PropertyDescriptor desc2(thread, JSHandle(thread, JSTaggedValue(4))); +- JSArray::DefineOwnProperty(thread, JSHandle(obj), key2, desc2); +- +- JSHandle str = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("2,3,4"); +- auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); ++ JSHandle obj(thread_, arr); ++ EXPECT_EQ(JSArray::GetProperty(thread_, obj, lengthKeyHandle).GetValue()->GetInt(), 0); ++ ++ JSHandle key0(thread_, JSTaggedValue(0)); ++ PropertyDescriptor desc0(thread_, JSHandle(thread_, JSTaggedValue(2))); ++ JSArray::DefineOwnProperty(thread_, JSHandle(obj), key0, desc0); ++ JSHandle key1(thread_, JSTaggedValue(1)); ++ PropertyDescriptor desc1(thread_, JSHandle(thread_, JSTaggedValue(3))); ++ JSArray::DefineOwnProperty(thread_, JSHandle(obj), key1, desc1); ++ JSHandle key2(thread_, JSTaggedValue(2)); ++ PropertyDescriptor desc2(thread_, JSHandle(thread_, JSTaggedValue(4))); ++ JSArray::DefineOwnProperty(thread_, JSHandle(obj), key2, desc2); ++ ++ JSHandle str = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("2,3,4"); ++ auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); + ecmaRuntimeCallInfo1->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo1->SetThis(obj.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); + JSTaggedValue result = Array::Join(ecmaRuntimeCallInfo1.get()); +- TestHelper::TearDownFrame(thread, prev); +- JSHandle resultHandle(thread, reinterpret_cast(result.GetRawData())); ++ TestHelper::TearDownFrame(thread_, prev); ++ JSHandle resultHandle(thread_, reinterpret_cast(result.GetRawData())); + [[maybe_unused]] auto *res = EcmaString::Cast(resultHandle.GetTaggedValue().GetTaggedObject()); + + ASSERT_EQ(res->Compare(*str), 0); +@@ -1692,31 +1695,31 @@ TEST_F(BuiltinsArrayTest, Join) + + TEST_F(BuiltinsArrayTest, ToString) + { +- JSHandle lengthKeyHandle = thread->GlobalConstants()->GetHandledLengthString(); +- JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); ++ JSHandle lengthKeyHandle = thread_->GlobalConstants()->GetHandledLengthString(); ++ JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread_, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); + EXPECT_TRUE(arr != nullptr); +- JSHandle obj(thread, arr); +- EXPECT_EQ(JSArray::GetProperty(thread, obj, lengthKeyHandle).GetValue()->GetInt(), 0); +- +- JSHandle key0(thread, JSTaggedValue(0)); +- PropertyDescriptor desc0(thread, JSHandle(thread, JSTaggedValue(2))); +- JSArray::DefineOwnProperty(thread, JSHandle(obj), key0, desc0); +- JSHandle key1(thread, JSTaggedValue(1)); +- PropertyDescriptor desc1(thread, JSHandle(thread, JSTaggedValue(3))); +- JSArray::DefineOwnProperty(thread, JSHandle(obj), key1, desc1); +- JSHandle key2(thread, JSTaggedValue(2)); +- PropertyDescriptor desc2(thread, JSHandle(thread, JSTaggedValue(4))); +- JSArray::DefineOwnProperty(thread, JSHandle(obj), key2, desc2); +- +- JSHandle str = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("2,3,4"); +- auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); ++ JSHandle obj(thread_, arr); ++ EXPECT_EQ(JSArray::GetProperty(thread_, obj, lengthKeyHandle).GetValue()->GetInt(), 0); ++ ++ JSHandle key0(thread_, JSTaggedValue(0)); ++ PropertyDescriptor desc0(thread_, JSHandle(thread_, JSTaggedValue(2))); ++ JSArray::DefineOwnProperty(thread_, JSHandle(obj), key0, desc0); ++ JSHandle key1(thread_, JSTaggedValue(1)); ++ PropertyDescriptor desc1(thread_, JSHandle(thread_, JSTaggedValue(3))); ++ JSArray::DefineOwnProperty(thread_, JSHandle(obj), key1, desc1); ++ JSHandle key2(thread_, JSTaggedValue(2)); ++ PropertyDescriptor desc2(thread_, JSHandle(thread_, JSTaggedValue(4))); ++ JSArray::DefineOwnProperty(thread_, JSHandle(obj), key2, desc2); ++ ++ JSHandle str = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("2,3,4"); ++ auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); + ecmaRuntimeCallInfo1->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo1->SetThis(obj.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); + JSTaggedValue result = Array::Join(ecmaRuntimeCallInfo1.get()); +- TestHelper::TearDownFrame(thread, prev); +- JSHandle resultHandle(thread, reinterpret_cast(result.GetRawData())); ++ TestHelper::TearDownFrame(thread_, prev); ++ JSHandle resultHandle(thread_, reinterpret_cast(result.GetRawData())); + [[maybe_unused]] auto *res = EcmaString::Cast(resultHandle.GetTaggedValue().GetTaggedObject()); + + ASSERT_EQ(res->Compare(*str), 0); +diff --git a/tests/runtime/builtins/builtins_arraybuffer_test.cpp b/tests/runtime/builtins/builtins_arraybuffer_test.cpp +index d293abe..3426be0 100644 +--- a/tests/runtime/builtins/builtins_arraybuffer_test.cpp ++++ b/tests/runtime/builtins/builtins_arraybuffer_test.cpp +@@ -41,17 +41,17 @@ public: + + void SetUp() override + { +- TestHelper::CreateEcmaVMWithScope(instance, thread, scope); ++ TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); + } + + void TearDown() override + { +- TestHelper::DestroyEcmaVMWithScope(instance, scope); ++ TestHelper::DestroyEcmaVMWithScope(instance_, scope_); + } + +- PandaVM *instance {nullptr}; +- EcmaHandleScope *scope {nullptr}; +- JSThread *thread {nullptr}; ++ PandaVM *instance_ {nullptr}; ++ EcmaHandleScope *scope_ {nullptr}; ++ JSThread *thread_ {nullptr}; + }; + + JSTaggedValue CreateBuiltinsArrayBuffer(JSThread *thread, int32_t length) +@@ -73,15 +73,15 @@ JSTaggedValue CreateBuiltinsArrayBuffer(JSThread *thread, int32_t length) + // new ArrayBuffer(8) + TEST_F(BuiltinsArrayBufferTest, Constructor1) + { +- JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); +- JSHandle arrayBuffer(thread, env->GetArrayBufferFunction().GetTaggedValue()); +- JSHandle globalObject(thread, env->GetGlobalObject()); +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, arrayBuffer.GetTaggedValue(), 6); ++ JSHandle env = thread_->GetEcmaVM()->GetGlobalEnv(); ++ JSHandle arrayBuffer(thread_, env->GetArrayBufferFunction().GetTaggedValue()); ++ JSHandle globalObject(thread_, env->GetGlobalObject()); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, arrayBuffer.GetTaggedValue(), 6); + ecmaRuntimeCallInfo->SetFunction(arrayBuffer.GetTaggedValue()); + ecmaRuntimeCallInfo->SetThis(globalObject.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast(8))); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsArrayBuffer::ArrayBufferConstructor(ecmaRuntimeCallInfo.get()); + ASSERT_TRUE(result.IsECMAObject()); + } +@@ -89,13 +89,13 @@ TEST_F(BuiltinsArrayBufferTest, Constructor1) + // (new ArrayBuffer(5)).byteLength + TEST_F(BuiltinsArrayBufferTest, byteLength1) + { +- JSTaggedValue tagged = CreateBuiltinsArrayBuffer(thread, 5); +- JSHandle arrBuf(thread, JSArrayBuffer::Cast(reinterpret_cast(tagged.GetRawData()))); +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); ++ JSTaggedValue tagged = CreateBuiltinsArrayBuffer(thread_, 5); ++ JSHandle arrBuf(thread_, JSArrayBuffer::Cast(reinterpret_cast(tagged.GetRawData()))); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(arrBuf.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsArrayBuffer::GetByteLength(ecmaRuntimeCallInfo.get()); + ASSERT_EQ(result.GetRawData(), JSTaggedValue(5).GetRawData()); + } +@@ -103,23 +103,23 @@ TEST_F(BuiltinsArrayBufferTest, byteLength1) + // (new ArrayBuffer(10)).slice(1, 5).bytelength + TEST_F(BuiltinsArrayBufferTest, slice1) + { +- JSTaggedValue tagged = CreateBuiltinsArrayBuffer(thread, 10); +- JSHandle arrBuf(thread, JSArrayBuffer::Cast(reinterpret_cast(tagged.GetRawData()))); +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ JSTaggedValue tagged = CreateBuiltinsArrayBuffer(thread_, 10); ++ JSHandle arrBuf(thread_, JSArrayBuffer::Cast(reinterpret_cast(tagged.GetRawData()))); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(arrBuf.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast(1))); + ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(static_cast(5))); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result1 = BuiltinsArrayBuffer::Slice(ecmaRuntimeCallInfo.get()); +- TestHelper::TearDownFrame(thread, prev); +- JSHandle arrBuf1(thread, ++ TestHelper::TearDownFrame(thread_, prev); ++ JSHandle arrBuf1(thread_, + JSArrayBuffer::Cast(reinterpret_cast(result1.GetRawData()))); +- auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); ++ auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); + ecmaRuntimeCallInfo1->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo1->SetThis(arrBuf1.GetTaggedValue()); +- prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); ++ prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); + JSTaggedValue result2 = BuiltinsArrayBuffer::GetByteLength(ecmaRuntimeCallInfo1.get()); + + ASSERT_EQ(result2.GetRawData(), JSTaggedValue(4).GetRawData()); +diff --git a/tests/runtime/builtins/builtins_boolean_test.cpp b/tests/runtime/builtins/builtins_boolean_test.cpp +index a8f70f1..fdddf6f 100644 +--- a/tests/runtime/builtins/builtins_boolean_test.cpp ++++ b/tests/runtime/builtins/builtins_boolean_test.cpp +@@ -43,33 +43,33 @@ public: + + void SetUp() override + { +- TestHelper::CreateEcmaVMWithScope(instance, thread, scope); ++ TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); + } + + void TearDown() override + { +- TestHelper::DestroyEcmaVMWithScope(instance, scope); ++ TestHelper::DestroyEcmaVMWithScope(instance_, scope_); + } + +- PandaVM *instance {nullptr}; +- EcmaHandleScope *scope {nullptr}; +- JSThread *thread {nullptr}; ++ PandaVM *instance_ {nullptr}; ++ EcmaHandleScope *scope_ {nullptr}; ++ JSThread *thread_ {nullptr}; + }; + + // new Boolean(123) + TEST_F(BuiltinsBooleanTest, BooleanConstructor) + { +- JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); ++ JSHandle env = thread_->GetEcmaVM()->GetGlobalEnv(); + + JSHandle boolean(env->GetBooleanFunction()); +- JSHandle globalObject(thread, env->GetGlobalObject()); ++ JSHandle globalObject(thread_, env->GetGlobalObject()); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue(*boolean), 6); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue(*boolean), 6); + ecmaRuntimeCallInfo->SetFunction(boolean.GetTaggedValue()); + ecmaRuntimeCallInfo->SetThis(globalObject.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast(123))); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsBoolean::BooleanConstructor(ecmaRuntimeCallInfo.get()); + + ASSERT_TRUE(result.IsECMAObject()); +@@ -79,17 +79,17 @@ TEST_F(BuiltinsBooleanTest, BooleanConstructor) + // new Boolean(undefined) + TEST_F(BuiltinsBooleanTest, BooleanConstructor1) + { +- JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); ++ JSHandle env = thread_->GetEcmaVM()->GetGlobalEnv(); + + JSHandle boolean(env->GetBooleanFunction()); +- JSHandle globalObject(thread, env->GetGlobalObject()); ++ JSHandle globalObject(thread_, env->GetGlobalObject()); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue(*boolean), 6); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue(*boolean), 6); + ecmaRuntimeCallInfo->SetFunction(boolean.GetTaggedValue()); + ecmaRuntimeCallInfo->SetThis(globalObject.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue::Undefined()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsBoolean::BooleanConstructor(ecmaRuntimeCallInfo.get()); + + ASSERT_TRUE(result.IsECMAObject()); +@@ -99,18 +99,18 @@ TEST_F(BuiltinsBooleanTest, BooleanConstructor1) + // Boolean("helloworld") + TEST_F(BuiltinsBooleanTest, BooleanConstructor2) + { +- JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); ++ JSHandle env = thread_->GetEcmaVM()->GetGlobalEnv(); + + JSHandle boolean(env->GetBooleanFunction()); +- JSHandle globalObject(thread, env->GetGlobalObject()); +- JSHandle str = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("helloworld"); ++ JSHandle globalObject(thread_, env->GetGlobalObject()); ++ JSHandle str = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("helloworld"); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo->SetFunction(boolean.GetTaggedValue()); + ecmaRuntimeCallInfo->SetThis(globalObject.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, str.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsBoolean::BooleanConstructor(ecmaRuntimeCallInfo.get()); + + JSTaggedValue ruler = BuiltinsBase::GetTaggedBoolean(true); +@@ -120,48 +120,48 @@ TEST_F(BuiltinsBooleanTest, BooleanConstructor2) + // false.toString() + TEST_F(BuiltinsBooleanTest, BooleanPrototypeToString) + { +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(JSTaggedValue::False()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsBoolean::BooleanPrototypeToString(ecmaRuntimeCallInfo.get()); + ASSERT_TRUE(result.IsString()); +- JSHandle res(thread, reinterpret_cast(result.GetRawData())); +- auto ruler = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("false"); ++ JSHandle res(thread_, reinterpret_cast(result.GetRawData())); ++ auto ruler = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("false"); + ASSERT_EQ(res->Compare(*ruler), 0); + } + + // (new Boolean(true)).toString() + TEST_F(BuiltinsBooleanTest, BooleanPrototypeToString1) + { +- auto ecmaVM = thread->GetEcmaVM(); ++ auto ecmaVM = thread_->GetEcmaVM(); + JSHandle env = ecmaVM->GetGlobalEnv(); + + JSHandle booleanObject(env->GetBooleanFunction()); +- JSHandle value(thread, JSTaggedValue::True()); +- JSHandle boolean = thread->GetEcmaVM()->GetFactory()->NewJSPrimitiveRef(booleanObject, value); ++ JSHandle value(thread_, JSTaggedValue::True()); ++ JSHandle boolean = thread_->GetEcmaVM()->GetFactory()->NewJSPrimitiveRef(booleanObject, value); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(boolean.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsBoolean::BooleanPrototypeToString(ecmaRuntimeCallInfo.get()); + ASSERT_TRUE(result.IsString()); +- JSHandle res(thread, reinterpret_cast(result.GetRawData())); +- auto ruler = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("true"); ++ JSHandle res(thread_, reinterpret_cast(result.GetRawData())); ++ auto ruler = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("true"); + ASSERT_EQ(res->Compare(*ruler), 0); + } + + // true.valueOf() + TEST_F(BuiltinsBooleanTest, BooleanPrototypeValueOf) + { +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(JSTaggedValue::True()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsBoolean::BooleanPrototypeValueOf(ecmaRuntimeCallInfo.get()); + + JSTaggedValue ruler = BuiltinsBase::GetTaggedBoolean(true); +@@ -171,18 +171,18 @@ TEST_F(BuiltinsBooleanTest, BooleanPrototypeValueOf) + // (new Boolean(false)).valueOf() + TEST_F(BuiltinsBooleanTest, BooleanPrototypeValueOf1) + { +- auto ecmaVM = thread->GetEcmaVM(); ++ auto ecmaVM = thread_->GetEcmaVM(); + JSHandle env = ecmaVM->GetGlobalEnv(); + + JSHandle booleanObject(env->GetBooleanFunction()); +- JSHandle value(thread, JSTaggedValue::False()); +- JSHandle boolean = thread->GetEcmaVM()->GetFactory()->NewJSPrimitiveRef(booleanObject, value); ++ JSHandle value(thread_, JSTaggedValue::False()); ++ JSHandle boolean = thread_->GetEcmaVM()->GetFactory()->NewJSPrimitiveRef(booleanObject, value); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(boolean.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsBoolean::BooleanPrototypeValueOf(ecmaRuntimeCallInfo.get()); + + JSTaggedValue ruler = BuiltinsBase::GetTaggedBoolean(false); +diff --git a/tests/runtime/builtins/builtins_dataview_test.cpp b/tests/runtime/builtins/builtins_dataview_test.cpp +index 0f036cc..5d528e6 100644 +--- a/tests/runtime/builtins/builtins_dataview_test.cpp ++++ b/tests/runtime/builtins/builtins_dataview_test.cpp +@@ -43,17 +43,17 @@ public: + + void SetUp() override + { +- TestHelper::CreateEcmaVMWithScope(instance, thread, scope); ++ TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); + } + + void TearDown() override + { +- TestHelper::DestroyEcmaVMWithScope(instance, scope); ++ TestHelper::DestroyEcmaVMWithScope(instance_, scope_); + } + +- PandaVM *instance {nullptr}; +- EcmaHandleScope *scope {nullptr}; +- JSThread *thread {nullptr}; ++ PandaVM *instance_ {nullptr}; ++ EcmaHandleScope *scope_ {nullptr}; ++ JSThread *thread_ {nullptr}; + }; + + JSTaggedValue CreateBuiltinsArrayBuffer(JSThread *thread, int32_t length) +@@ -106,18 +106,18 @@ void SetUint8(JSThread *thread, const JSHandle &view, int32_t offset + // new DataView(new ArrayBuffer(10), 1) + TEST_F(BuiltinsDataViewTest, Constructor) + { +- JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); +- JSHandle dataView(thread, env->GetDataViewFunction().GetTaggedValue()); +- JSHandle globalObject(thread, env->GetGlobalObject()); +- JSTaggedValue tagged = CreateBuiltinsArrayBuffer(thread, 10); +- JSHandle arrBuf(thread, JSArrayBuffer::Cast(reinterpret_cast(tagged.GetRawData()))); +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue(*dataView), 8); ++ JSHandle env = thread_->GetEcmaVM()->GetGlobalEnv(); ++ JSHandle dataView(thread_, env->GetDataViewFunction().GetTaggedValue()); ++ JSHandle globalObject(thread_, env->GetGlobalObject()); ++ JSTaggedValue tagged = CreateBuiltinsArrayBuffer(thread_, 10); ++ JSHandle arrBuf(thread_, JSArrayBuffer::Cast(reinterpret_cast(tagged.GetRawData()))); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue(*dataView), 8); + ecmaRuntimeCallInfo->SetFunction(dataView.GetTaggedValue()); + ecmaRuntimeCallInfo->SetThis(globalObject.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, arrBuf.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(1)); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsDataView::DataViewConstructor(ecmaRuntimeCallInfo.get()); + ASSERT_TRUE(result.IsECMAObject()); + } +@@ -125,13 +125,13 @@ TEST_F(BuiltinsDataViewTest, Constructor) + // new DataView(new ArrayBuffer(10), 1).byteOffset + TEST_F(BuiltinsDataViewTest, byteOffset) + { +- JSTaggedValue tagged = CreateBuiltinsDataView(thread, 10, 1); +- JSHandle view(thread, JSDataView::Cast(reinterpret_cast(tagged.GetRawData()))); +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); ++ JSTaggedValue tagged = CreateBuiltinsDataView(thread_, 10, 1); ++ JSHandle view(thread_, JSDataView::Cast(reinterpret_cast(tagged.GetRawData()))); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(view.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsDataView::GetOffset(ecmaRuntimeCallInfo.get()); + ASSERT_EQ(result.GetRawData(), JSTaggedValue(1).GetRawData()); + } +@@ -139,13 +139,13 @@ TEST_F(BuiltinsDataViewTest, byteOffset) + // new DataView(new ArrayBuffer(10), 2).byteLength + TEST_F(BuiltinsDataViewTest, byteLength) + { +- JSTaggedValue tagged = CreateBuiltinsDataView(thread, 10, 2); +- JSHandle view(thread, JSDataView::Cast(reinterpret_cast(tagged.GetRawData()))); +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); ++ JSTaggedValue tagged = CreateBuiltinsDataView(thread_, 10, 2); ++ JSHandle view(thread_, JSDataView::Cast(reinterpret_cast(tagged.GetRawData()))); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(view.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsDataView::GetByteLength(ecmaRuntimeCallInfo.get()); + ASSERT_EQ(result.GetRawData(), JSTaggedValue(8).GetRawData()); + } +@@ -153,13 +153,13 @@ TEST_F(BuiltinsDataViewTest, byteLength) + // new DataView(new ArrayBuffer(10), 1).buffer + TEST_F(BuiltinsDataViewTest, buffer) + { +- JSTaggedValue tagged = CreateBuiltinsDataView(thread, 10, 1); +- JSHandle view(thread, JSDataView::Cast(reinterpret_cast(tagged.GetRawData()))); +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); ++ JSTaggedValue tagged = CreateBuiltinsDataView(thread_, 10, 1); ++ JSHandle view(thread_, JSDataView::Cast(reinterpret_cast(tagged.GetRawData()))); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(view.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsDataView::GetBuffer(ecmaRuntimeCallInfo.get()); + ASSERT_EQ(result.IsArrayBuffer(), true); + } +@@ -167,20 +167,20 @@ TEST_F(BuiltinsDataViewTest, buffer) + // new DataView(new ArrayBuffer(8), 0).SetUint16/GetUint16 + TEST_F(BuiltinsDataViewTest, getUint16) + { +- JSTaggedValue tagged = CreateBuiltinsDataView(thread, 8, 0); +- JSHandle view(thread, JSDataView::Cast(reinterpret_cast(tagged.GetRawData()))); +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 10); ++ JSTaggedValue tagged = CreateBuiltinsDataView(thread_, 8, 0); ++ JSHandle view(thread_, JSDataView::Cast(reinterpret_cast(tagged.GetRawData()))); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 10); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(view.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(0)); + ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(-1870724872)); + ecmaRuntimeCallInfo->SetCallArg(2, JSTaggedValue::False()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsDataView::SetUint16(ecmaRuntimeCallInfo.get()); + ASSERT_EQ(result.GetRawData(), JSTaggedValue::VALUE_UNDEFINED); + +- auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + ecmaRuntimeCallInfo1->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo1->SetThis(view.GetTaggedValue()); + ecmaRuntimeCallInfo1->SetCallArg(0, JSTaggedValue(0)); +@@ -193,20 +193,20 @@ TEST_F(BuiltinsDataViewTest, getUint16) + // new DataView(new ArrayBuffer(8), 0).SetInt16/GetInt16 + TEST_F(BuiltinsDataViewTest, getInt16) + { +- JSTaggedValue tagged = CreateBuiltinsDataView(thread, 8, 0); +- JSHandle view(thread, JSDataView::Cast(reinterpret_cast(tagged.GetRawData()))); +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 10); ++ JSTaggedValue tagged = CreateBuiltinsDataView(thread_, 8, 0); ++ JSHandle view(thread_, JSDataView::Cast(reinterpret_cast(tagged.GetRawData()))); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 10); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(view.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(0)); + ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(-1870724872)); + ecmaRuntimeCallInfo->SetCallArg(2, JSTaggedValue::False()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsDataView::SetInt16(ecmaRuntimeCallInfo.get()); + ASSERT_EQ(result.GetRawData(), JSTaggedValue::VALUE_UNDEFINED); + +- auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + ecmaRuntimeCallInfo1->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo1->SetThis(view.GetTaggedValue()); + ecmaRuntimeCallInfo1->SetCallArg(0, JSTaggedValue(0)); +@@ -219,20 +219,20 @@ TEST_F(BuiltinsDataViewTest, getInt16) + // new DataView(new ArrayBuffer(8), 0).SetUint8/GetUint32 + TEST_F(BuiltinsDataViewTest, GetUint32) + { +- JSTaggedValue tagged = CreateBuiltinsDataView(thread, 8, 0); +- JSHandle view(thread, JSDataView::Cast(reinterpret_cast(tagged.GetRawData()))); +- SetUint8(thread, view, 0, JSTaggedValue(127)); +- SetUint8(thread, view, 1, JSTaggedValue(255)); +- SetUint8(thread, view, 2, JSTaggedValue(255)); +- SetUint8(thread, view, 3, JSTaggedValue(255)); +- +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ JSTaggedValue tagged = CreateBuiltinsDataView(thread_, 8, 0); ++ JSHandle view(thread_, JSDataView::Cast(reinterpret_cast(tagged.GetRawData()))); ++ SetUint8(thread_, view, 0, JSTaggedValue(127)); ++ SetUint8(thread_, view, 1, JSTaggedValue(255)); ++ SetUint8(thread_, view, 2, JSTaggedValue(255)); ++ SetUint8(thread_, view, 3, JSTaggedValue(255)); ++ ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(view.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(0)); + ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue::False()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsDataView::GetUint32(ecmaRuntimeCallInfo.get()); + ASSERT_EQ(result.GetRawData(), JSTaggedValue(2147483647).GetRawData()); + } +@@ -240,20 +240,20 @@ TEST_F(BuiltinsDataViewTest, GetUint32) + // new DataView(new ArrayBuffer(8), 0).SetUint8/GetInt32 + TEST_F(BuiltinsDataViewTest, GetInt32) + { +- JSTaggedValue tagged = CreateBuiltinsDataView(thread, 8, 0); +- JSHandle view(thread, JSDataView::Cast(reinterpret_cast(tagged.GetRawData()))); +- SetUint8(thread, view, 0, JSTaggedValue(127)); +- SetUint8(thread, view, 1, JSTaggedValue(255)); +- SetUint8(thread, view, 2, JSTaggedValue(255)); +- SetUint8(thread, view, 3, JSTaggedValue(255)); +- +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ JSTaggedValue tagged = CreateBuiltinsDataView(thread_, 8, 0); ++ JSHandle view(thread_, JSDataView::Cast(reinterpret_cast(tagged.GetRawData()))); ++ SetUint8(thread_, view, 0, JSTaggedValue(127)); ++ SetUint8(thread_, view, 1, JSTaggedValue(255)); ++ SetUint8(thread_, view, 2, JSTaggedValue(255)); ++ SetUint8(thread_, view, 3, JSTaggedValue(255)); ++ ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(view.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(0)); + ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue::False()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsDataView::GetInt32(ecmaRuntimeCallInfo.get()); + ASSERT_EQ(result.GetRawData(), JSTaggedValue(2147483647).GetRawData()); + } +@@ -261,16 +261,16 @@ TEST_F(BuiltinsDataViewTest, GetInt32) + // new DataView(new ArrayBuffer(8), 0).SetUint8/GetInt8 + TEST_F(BuiltinsDataViewTest, GetInt8) + { +- JSTaggedValue tagged = CreateBuiltinsDataView(thread, 8, 0); +- JSHandle view(thread, JSDataView::Cast(reinterpret_cast(tagged.GetRawData()))); +- SetUint8(thread, view, 0, JSTaggedValue(255)); ++ JSTaggedValue tagged = CreateBuiltinsDataView(thread_, 8, 0); ++ JSHandle view(thread_, JSDataView::Cast(reinterpret_cast(tagged.GetRawData()))); ++ SetUint8(thread_, view, 0, JSTaggedValue(255)); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(view.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(0)); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsDataView::GetInt8(ecmaRuntimeCallInfo.get()); + ASSERT_EQ(result.GetRawData(), JSTaggedValue(-1).GetRawData()); + } +@@ -278,16 +278,16 @@ TEST_F(BuiltinsDataViewTest, GetInt8) + // new DataView(new ArrayBuffer(8), 0).SetUint8/GetUint8 + TEST_F(BuiltinsDataViewTest, GetUint8) + { +- JSTaggedValue tagged = CreateBuiltinsDataView(thread, 8, 0); +- JSHandle view(thread, JSDataView::Cast(reinterpret_cast(tagged.GetRawData()))); +- SetUint8(thread, view, 0, JSTaggedValue(127)); ++ JSTaggedValue tagged = CreateBuiltinsDataView(thread_, 8, 0); ++ JSHandle view(thread_, JSDataView::Cast(reinterpret_cast(tagged.GetRawData()))); ++ SetUint8(thread_, view, 0, JSTaggedValue(127)); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(view.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(0)); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsDataView::GetUint8(ecmaRuntimeCallInfo.get()); + ASSERT_EQ(result.GetRawData(), JSTaggedValue(127).GetRawData()); + } +@@ -295,20 +295,20 @@ TEST_F(BuiltinsDataViewTest, GetUint8) + // new DataView(new ArrayBuffer(8), 4).SetUint8/GetFloat32 + TEST_F(BuiltinsDataViewTest, GetFloat32) + { +- JSTaggedValue tagged = CreateBuiltinsDataView(thread, 8, 0); +- JSHandle view(thread, JSDataView::Cast(reinterpret_cast(tagged.GetRawData()))); +- SetUint8(thread, view, 4, JSTaggedValue(75)); +- SetUint8(thread, view, 5, JSTaggedValue(75)); +- SetUint8(thread, view, 6, JSTaggedValue(75)); +- SetUint8(thread, view, 7, JSTaggedValue(75)); +- +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ JSTaggedValue tagged = CreateBuiltinsDataView(thread_, 8, 0); ++ JSHandle view(thread_, JSDataView::Cast(reinterpret_cast(tagged.GetRawData()))); ++ SetUint8(thread_, view, 4, JSTaggedValue(75)); ++ SetUint8(thread_, view, 5, JSTaggedValue(75)); ++ SetUint8(thread_, view, 6, JSTaggedValue(75)); ++ SetUint8(thread_, view, 7, JSTaggedValue(75)); ++ ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(view.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(4)); + ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue::False()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsDataView::GetFloat32(ecmaRuntimeCallInfo.get()); + ASSERT_EQ(result.GetRawData(), JSTaggedValue(static_cast(13323083)).GetRawData()); + } +@@ -316,24 +316,24 @@ TEST_F(BuiltinsDataViewTest, GetFloat32) + // new DataView(new ArrayBuffer(12), 4).SetUint8/GetFloat64 + TEST_F(BuiltinsDataViewTest, GetFloat64) + { +- JSTaggedValue tagged = CreateBuiltinsDataView(thread, 12, 0); +- JSHandle view(thread, JSDataView::Cast(reinterpret_cast(tagged.GetRawData()))); +- SetUint8(thread, view, 4, JSTaggedValue(67)); +- SetUint8(thread, view, 5, JSTaggedValue(67)); +- SetUint8(thread, view, 6, JSTaggedValue(68)); +- SetUint8(thread, view, 7, JSTaggedValue(68)); +- SetUint8(thread, view, 8, JSTaggedValue(67)); +- SetUint8(thread, view, 9, JSTaggedValue(67)); +- SetUint8(thread, view, 10, JSTaggedValue(68)); +- SetUint8(thread, view, 11, JSTaggedValue(68)); +- +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ JSTaggedValue tagged = CreateBuiltinsDataView(thread_, 12, 0); ++ JSHandle view(thread_, JSDataView::Cast(reinterpret_cast(tagged.GetRawData()))); ++ SetUint8(thread_, view, 4, JSTaggedValue(67)); ++ SetUint8(thread_, view, 5, JSTaggedValue(67)); ++ SetUint8(thread_, view, 6, JSTaggedValue(68)); ++ SetUint8(thread_, view, 7, JSTaggedValue(68)); ++ SetUint8(thread_, view, 8, JSTaggedValue(67)); ++ SetUint8(thread_, view, 9, JSTaggedValue(67)); ++ SetUint8(thread_, view, 10, JSTaggedValue(68)); ++ SetUint8(thread_, view, 11, JSTaggedValue(68)); ++ ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(view.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(4)); + ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue::False()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsDataView::GetFloat64(ecmaRuntimeCallInfo.get()); + ASSERT_EQ(result.GetRawData(), JSTaggedValue(static_cast(10846169068898440)).GetRawData()); + } +@@ -341,20 +341,20 @@ TEST_F(BuiltinsDataViewTest, GetFloat64) + // new DataView(new ArrayBuffer(8), 0).SetUint32/GetUint32 + TEST_F(BuiltinsDataViewTest, SetUint32) + { +- JSTaggedValue tagged = CreateBuiltinsDataView(thread, 8, 0); +- JSHandle view(thread, JSDataView::Cast(reinterpret_cast(tagged.GetRawData()))); +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 10); ++ JSTaggedValue tagged = CreateBuiltinsDataView(thread_, 8, 0); ++ JSHandle view(thread_, JSDataView::Cast(reinterpret_cast(tagged.GetRawData()))); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 10); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(view.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(0)); + ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(0x907f00f8)); + ecmaRuntimeCallInfo->SetCallArg(2, JSTaggedValue::True()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsDataView::SetUint32(ecmaRuntimeCallInfo.get()); + ASSERT_EQ(result.GetRawData(), JSTaggedValue::VALUE_UNDEFINED); + +- auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + ecmaRuntimeCallInfo1->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo1->SetThis(view.GetTaggedValue()); + ecmaRuntimeCallInfo1->SetCallArg(0, JSTaggedValue(0)); +@@ -367,20 +367,20 @@ TEST_F(BuiltinsDataViewTest, SetUint32) + // new DataView(new ArrayBuffer(8), 0).SetInt32/GetInt32 + TEST_F(BuiltinsDataViewTest, SetInt32) + { +- JSTaggedValue tagged = CreateBuiltinsDataView(thread, 8, 0); +- JSHandle view(thread, JSDataView::Cast(reinterpret_cast(tagged.GetRawData()))); +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 10); ++ JSTaggedValue tagged = CreateBuiltinsDataView(thread_, 8, 0); ++ JSHandle view(thread_, JSDataView::Cast(reinterpret_cast(tagged.GetRawData()))); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 10); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(view.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(0)); + ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(-1870724872)); + ecmaRuntimeCallInfo->SetCallArg(2, JSTaggedValue::True()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsDataView::SetInt32(ecmaRuntimeCallInfo.get()); + ASSERT_EQ(result.GetRawData(), JSTaggedValue::VALUE_UNDEFINED); + +- auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + ecmaRuntimeCallInfo1->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo1->SetThis(view.GetTaggedValue()); + ecmaRuntimeCallInfo1->SetCallArg(0, JSTaggedValue(0)); +@@ -393,18 +393,18 @@ TEST_F(BuiltinsDataViewTest, SetInt32) + // new DataView(new ArrayBuffer(8), 0).SetInt8/GetUint8 + TEST_F(BuiltinsDataViewTest, SetInt8) + { +- JSTaggedValue tagged = CreateBuiltinsDataView(thread, 8, 0); +- JSHandle view(thread, JSDataView::Cast(reinterpret_cast(tagged.GetRawData()))); +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ JSTaggedValue tagged = CreateBuiltinsDataView(thread_, 8, 0); ++ JSHandle view(thread_, JSDataView::Cast(reinterpret_cast(tagged.GetRawData()))); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(view.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(0)); + ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(-1)); +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsDataView::SetInt8(ecmaRuntimeCallInfo.get()); + ASSERT_EQ(result.GetRawData(), JSTaggedValue::VALUE_UNDEFINED); + +- auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo1->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo1->SetThis(view.GetTaggedValue()); + ecmaRuntimeCallInfo1->SetCallArg(0, JSTaggedValue(0)); +@@ -415,20 +415,20 @@ TEST_F(BuiltinsDataViewTest, SetInt8) + // new DataView(new ArrayBuffer(4), 0).SetFloat32/GetFloat32 + TEST_F(BuiltinsDataViewTest, SetFloat32) + { +- JSTaggedValue tagged = CreateBuiltinsDataView(thread, 4, 0); +- JSHandle view(thread, JSDataView::Cast(reinterpret_cast(tagged.GetRawData()))); +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 10); ++ JSTaggedValue tagged = CreateBuiltinsDataView(thread_, 4, 0); ++ JSHandle view(thread_, JSDataView::Cast(reinterpret_cast(tagged.GetRawData()))); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 10); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(view.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(0)); + ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(42)); + ecmaRuntimeCallInfo->SetCallArg(2, JSTaggedValue::True()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsDataView::SetFloat32(ecmaRuntimeCallInfo.get()); + ASSERT_EQ(result.GetRawData(), JSTaggedValue::VALUE_UNDEFINED); + +- auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + ecmaRuntimeCallInfo1->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo1->SetThis(view.GetTaggedValue()); + ecmaRuntimeCallInfo1->SetCallArg(0, JSTaggedValue(0)); +@@ -441,20 +441,20 @@ TEST_F(BuiltinsDataViewTest, SetFloat32) + // new DataView(new ArrayBuffer(8), 0).SetFloat64/GetFloat64 + TEST_F(BuiltinsDataViewTest, SetFloat64) + { +- JSTaggedValue tagged = CreateBuiltinsDataView(thread, 8, 0); +- JSHandle view(thread, JSDataView::Cast(reinterpret_cast(tagged.GetRawData()))); +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 10); ++ JSTaggedValue tagged = CreateBuiltinsDataView(thread_, 8, 0); ++ JSHandle view(thread_, JSDataView::Cast(reinterpret_cast(tagged.GetRawData()))); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 10); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(view.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(0)); + ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(42)); + ecmaRuntimeCallInfo->SetCallArg(2, JSTaggedValue::True()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsDataView::SetFloat64(ecmaRuntimeCallInfo.get()); + ASSERT_EQ(result.GetRawData(), JSTaggedValue::VALUE_UNDEFINED); + +- auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + ecmaRuntimeCallInfo1->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo1->SetThis(view.GetTaggedValue()); + ecmaRuntimeCallInfo1->SetCallArg(0, JSTaggedValue(0)); +diff --git a/tests/runtime/builtins/builtins_date_test.cpp b/tests/runtime/builtins/builtins_date_test.cpp +index aef2959..49dc38f 100644 +--- a/tests/runtime/builtins/builtins_date_test.cpp ++++ b/tests/runtime/builtins/builtins_date_test.cpp +@@ -46,17 +46,17 @@ public: + + void SetUp() override + { +- TestHelper::CreateEcmaVMWithScope(instance, thread, scope); ++ TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); + } + + void TearDown() override + { +- TestHelper::DestroyEcmaVMWithScope(instance, scope); ++ TestHelper::DestroyEcmaVMWithScope(instance_, scope_); + } + +- PandaVM *instance {nullptr}; +- EcmaHandleScope *scope {nullptr}; +- JSThread *thread {nullptr}; ++ PandaVM *instance_ {nullptr}; ++ EcmaHandleScope *scope_ {nullptr}; ++ JSThread *thread_ {nullptr}; + }; + + JSHandle JSDateCreateTest(JSThread *thread) +@@ -81,12 +81,12 @@ static std::unique_ptr CreateAndSetRuntimeCallInfo(JSThread + + TEST_F(BuiltinsDateTest, SetGetDate) + { +- JSHandle jsDate = JSDateCreateTest(thread); ++ JSHandle jsDate = JSDateCreateTest(thread_); + +- auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread, 6, jsDate.GetTaggedValue()); ++ auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread_, 6, jsDate.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast(2))); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] JSTaggedValue result1 = BuiltinsDate::SetDate(ecmaRuntimeCallInfo.get()); + JSTaggedValue result2 = BuiltinsDate::GetDate(ecmaRuntimeCallInfo.get()); + ASSERT_EQ(result2.GetRawData(), JSTaggedValue(static_cast(2)).GetRawData()); +@@ -94,12 +94,12 @@ TEST_F(BuiltinsDateTest, SetGetDate) + + TEST_F(BuiltinsDateTest, SetGetUTCDate) + { +- JSHandle jsDate = JSDateCreateTest(thread); ++ JSHandle jsDate = JSDateCreateTest(thread_); + +- auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread, 6, jsDate.GetTaggedValue()); ++ auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread_, 6, jsDate.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast(2))); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] JSTaggedValue result3 = BuiltinsDate::SetUTCDate(ecmaRuntimeCallInfo.get()); + JSTaggedValue result4 = BuiltinsDate::GetUTCDate(ecmaRuntimeCallInfo.get()); + ASSERT_EQ(result4.GetRawData(), JSTaggedValue(static_cast(2)).GetRawData()); +@@ -107,12 +107,12 @@ TEST_F(BuiltinsDateTest, SetGetUTCDate) + + TEST_F(BuiltinsDateTest, SetGetMinusUTCDate) + { +- JSHandle jsDate = JSDateCreateTest(thread); ++ JSHandle jsDate = JSDateCreateTest(thread_); + +- auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread, 6, jsDate.GetTaggedValue()); ++ auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread_, 6, jsDate.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast(-2))); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] JSTaggedValue result3 = BuiltinsDate::SetUTCDate(ecmaRuntimeCallInfo.get()); + JSTaggedValue result4 = BuiltinsDate::GetUTCDate(ecmaRuntimeCallInfo.get()); + ASSERT_EQ(result4.GetRawData(), JSTaggedValue(static_cast(29)).GetRawData()); +@@ -120,9 +120,9 @@ TEST_F(BuiltinsDateTest, SetGetMinusUTCDate) + + TEST_F(BuiltinsDateTest, SetGetFullYear) + { +- JSHandle jsDate = JSDateCreateTest(thread); ++ JSHandle jsDate = JSDateCreateTest(thread_); + +- auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread, 10, jsDate.GetTaggedValue()); ++ auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread_, 10, jsDate.GetTaggedValue()); + // 2018 : test case + ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast(2018))); + // 10 : test case +@@ -130,7 +130,7 @@ TEST_F(BuiltinsDateTest, SetGetFullYear) + // 2, 6 : test case + ecmaRuntimeCallInfo->SetCallArg(2, JSTaggedValue(static_cast(6))); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + BuiltinsDate::SetFullYear(ecmaRuntimeCallInfo.get()); + JSTaggedValue result1 = BuiltinsDate::GetFullYear(ecmaRuntimeCallInfo.get()); + // 2018 : test case +@@ -147,9 +147,9 @@ TEST_F(BuiltinsDateTest, SetGetFullYear) + + TEST_F(BuiltinsDateTest, SetGetUTCFullYear) + { +- JSHandle jsDate = JSDateCreateTest(thread); ++ JSHandle jsDate = JSDateCreateTest(thread_); + +- auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread, 10, jsDate.GetTaggedValue()); ++ auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread_, 10, jsDate.GetTaggedValue()); + // 2018 : test case + ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast(2018))); + // 10 : test case +@@ -157,7 +157,7 @@ TEST_F(BuiltinsDateTest, SetGetUTCFullYear) + // 2, 6 : test case + ecmaRuntimeCallInfo->SetCallArg(2, JSTaggedValue(static_cast(6))); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + BuiltinsDate::SetUTCFullYear(ecmaRuntimeCallInfo.get()); + JSTaggedValue result4 = BuiltinsDate::GetUTCFullYear(ecmaRuntimeCallInfo.get()); + // 2018 : test case +@@ -174,13 +174,13 @@ TEST_F(BuiltinsDateTest, SetGetUTCFullYear) + + TEST_F(BuiltinsDateTest, SetGetMinusFullYear) + { +- JSHandle jsDate = JSDateCreateTest(thread); +- auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread, 10, jsDate.GetTaggedValue()); ++ JSHandle jsDate = JSDateCreateTest(thread_); ++ auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread_, 10, jsDate.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast(-2018))); + ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(static_cast(-10))); + ecmaRuntimeCallInfo->SetCallArg(2, JSTaggedValue(static_cast(-6))); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + BuiltinsDate::SetFullYear(ecmaRuntimeCallInfo.get()); + JSTaggedValue result1 = BuiltinsDate::GetFullYear(ecmaRuntimeCallInfo.get()); + ASSERT_EQ(result1.GetRawData(), JSTaggedValue(static_cast(-2019)).GetRawData()); +@@ -194,14 +194,14 @@ TEST_F(BuiltinsDateTest, SetGetMinusFullYear) + + TEST_F(BuiltinsDateTest, SetGetMinusUTCFullYear) + { +- JSHandle jsDate = JSDateCreateTest(thread); ++ JSHandle jsDate = JSDateCreateTest(thread_); + +- auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread, 10, jsDate.GetTaggedValue()); ++ auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread_, 10, jsDate.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast(-2018))); + ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(static_cast(-10))); + ecmaRuntimeCallInfo->SetCallArg(2, JSTaggedValue(static_cast(-6))); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + BuiltinsDate::SetUTCFullYear(ecmaRuntimeCallInfo.get()); + JSTaggedValue result4 = BuiltinsDate::GetUTCFullYear(ecmaRuntimeCallInfo.get()); + ASSERT_EQ(result4.GetRawData(), JSTaggedValue(static_cast(-2019)).GetRawData()); +@@ -215,15 +215,15 @@ TEST_F(BuiltinsDateTest, SetGetMinusUTCFullYear) + + TEST_F(BuiltinsDateTest, SetGetHours) + { +- JSHandle jsDate = JSDateCreateTest(thread); ++ JSHandle jsDate = JSDateCreateTest(thread_); + +- auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread, 12, jsDate.GetTaggedValue()); ++ auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread_, 12, jsDate.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast(18))); + ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(static_cast(10))); + ecmaRuntimeCallInfo->SetCallArg(2, JSTaggedValue(static_cast(6))); + ecmaRuntimeCallInfo->SetCallArg(3, JSTaggedValue(static_cast(111))); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + BuiltinsDate::SetHours(ecmaRuntimeCallInfo.get()); + JSTaggedValue result1 = BuiltinsDate::GetHours(ecmaRuntimeCallInfo.get()); + ASSERT_EQ(result1.GetRawData(), JSTaggedValue(static_cast(18)).GetRawData()); +@@ -240,15 +240,15 @@ TEST_F(BuiltinsDateTest, SetGetHours) + + TEST_F(BuiltinsDateTest, SetGetUTCHours) + { +- JSHandle jsDate = JSDateCreateTest(thread); ++ JSHandle jsDate = JSDateCreateTest(thread_); + +- auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread, 12, jsDate.GetTaggedValue()); ++ auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread_, 12, jsDate.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast(18))); + ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(static_cast(10))); + ecmaRuntimeCallInfo->SetCallArg(2, JSTaggedValue(static_cast(6))); + ecmaRuntimeCallInfo->SetCallArg(3, JSTaggedValue(static_cast(111))); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + BuiltinsDate::SetUTCHours(ecmaRuntimeCallInfo.get()); + JSTaggedValue result5 = BuiltinsDate::GetUTCHours(ecmaRuntimeCallInfo.get()); + ASSERT_EQ(result5.GetRawData(), JSTaggedValue(static_cast(18)).GetRawData()); +@@ -265,15 +265,15 @@ TEST_F(BuiltinsDateTest, SetGetUTCHours) + + TEST_F(BuiltinsDateTest, SetGetMinusHours) + { +- JSHandle jsDate = JSDateCreateTest(thread); ++ JSHandle jsDate = JSDateCreateTest(thread_); + +- auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread, 12, jsDate.GetTaggedValue()); ++ auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread_, 12, jsDate.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast(-18))); + ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(static_cast(-10))); + ecmaRuntimeCallInfo->SetCallArg(2, JSTaggedValue(static_cast(-6))); + ecmaRuntimeCallInfo->SetCallArg(3, JSTaggedValue(static_cast(-111))); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + BuiltinsDate::SetHours(ecmaRuntimeCallInfo.get()); + JSTaggedValue result1 = BuiltinsDate::GetHours(ecmaRuntimeCallInfo.get()); + ASSERT_EQ(result1.GetRawData(), JSTaggedValue(static_cast(5)).GetRawData()); +@@ -290,15 +290,15 @@ TEST_F(BuiltinsDateTest, SetGetMinusHours) + + TEST_F(BuiltinsDateTest, SetGetMinusUTCHours) + { +- JSHandle jsDate = JSDateCreateTest(thread); ++ JSHandle jsDate = JSDateCreateTest(thread_); + +- auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread, 12, jsDate.GetTaggedValue()); ++ auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread_, 12, jsDate.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast(-18))); + ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(static_cast(-10))); + ecmaRuntimeCallInfo->SetCallArg(2, JSTaggedValue(static_cast(-6))); + ecmaRuntimeCallInfo->SetCallArg(3, JSTaggedValue(static_cast(-111))); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + BuiltinsDate::SetUTCHours(ecmaRuntimeCallInfo.get()); + JSTaggedValue result5 = BuiltinsDate::GetUTCHours(ecmaRuntimeCallInfo.get()); + ASSERT_EQ(result5.GetRawData(), JSTaggedValue(static_cast(5)).GetRawData()); +@@ -315,12 +315,12 @@ TEST_F(BuiltinsDateTest, SetGetMinusUTCHours) + + TEST_F(BuiltinsDateTest, SetGetMilliseconds) + { +- JSHandle jsDate = JSDateCreateTest(thread); ++ JSHandle jsDate = JSDateCreateTest(thread_); + +- auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread, 6, jsDate.GetTaggedValue()); ++ auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread_, 6, jsDate.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast(100))); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result1 = BuiltinsDate::SetMilliseconds(ecmaRuntimeCallInfo.get()); + ASSERT_EQ(result1.GetRawData(), JSTaggedValue(static_cast(100)).GetRawData()); + +@@ -330,12 +330,12 @@ TEST_F(BuiltinsDateTest, SetGetMilliseconds) + + TEST_F(BuiltinsDateTest, SetGetUTCMilliseconds) + { +- JSHandle jsDate = JSDateCreateTest(thread); ++ JSHandle jsDate = JSDateCreateTest(thread_); + +- auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread, 6, jsDate.GetTaggedValue()); ++ auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread_, 6, jsDate.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast(100))); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result3 = BuiltinsDate::SetUTCMilliseconds(ecmaRuntimeCallInfo.get()); + ASSERT_EQ(result3.GetRawData(), JSTaggedValue(static_cast(100)).GetRawData()); + +@@ -345,14 +345,14 @@ TEST_F(BuiltinsDateTest, SetGetUTCMilliseconds) + + TEST_F(BuiltinsDateTest, SetGetMinutes) + { +- JSHandle jsDate = JSDateCreateTest(thread); ++ JSHandle jsDate = JSDateCreateTest(thread_); + +- auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread, 10, jsDate.GetTaggedValue()); ++ auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread_, 10, jsDate.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast(10))); + ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(static_cast(6))); + ecmaRuntimeCallInfo->SetCallArg(2, JSTaggedValue(static_cast(111))); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + BuiltinsDate::SetMinutes(ecmaRuntimeCallInfo.get()); + JSTaggedValue result1 = BuiltinsDate::GetMinutes(ecmaRuntimeCallInfo.get()); + ASSERT_EQ(result1.GetRawData(), JSTaggedValue(static_cast(10)).GetRawData()); +@@ -366,14 +366,14 @@ TEST_F(BuiltinsDateTest, SetGetMinutes) + + TEST_F(BuiltinsDateTest, SetGetUTCMinutes) + { +- JSHandle jsDate = JSDateCreateTest(thread); ++ JSHandle jsDate = JSDateCreateTest(thread_); + +- auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread, 10, jsDate.GetTaggedValue()); ++ auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread_, 10, jsDate.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast(10))); + ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(static_cast(6))); + ecmaRuntimeCallInfo->SetCallArg(2, JSTaggedValue(static_cast(111))); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + BuiltinsDate::SetUTCMinutes(ecmaRuntimeCallInfo.get()); + JSTaggedValue result4 = BuiltinsDate::GetUTCMinutes(ecmaRuntimeCallInfo.get()); + ASSERT_EQ(result4.GetRawData(), JSTaggedValue(static_cast(10)).GetRawData()); +@@ -387,13 +387,13 @@ TEST_F(BuiltinsDateTest, SetGetUTCMinutes) + + TEST_F(BuiltinsDateTest, SetGetMonth) + { +- JSHandle jsDate = JSDateCreateTest(thread); ++ JSHandle jsDate = JSDateCreateTest(thread_); + +- auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread, 8, jsDate.GetTaggedValue()); ++ auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread_, 8, jsDate.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast(8))); + ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(static_cast(3))); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + BuiltinsDate::SetMonth(ecmaRuntimeCallInfo.get()); + JSTaggedValue result1 = BuiltinsDate::GetMonth(ecmaRuntimeCallInfo.get()); + ASSERT_EQ(result1.GetRawData(), JSTaggedValue(static_cast(8)).GetRawData()); +@@ -404,13 +404,13 @@ TEST_F(BuiltinsDateTest, SetGetMonth) + + TEST_F(BuiltinsDateTest, SetGetUTCMonth) + { +- JSHandle jsDate = JSDateCreateTest(thread); ++ JSHandle jsDate = JSDateCreateTest(thread_); + +- auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread, 8, jsDate.GetTaggedValue()); ++ auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread_, 8, jsDate.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast(8))); + ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(static_cast(3))); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + BuiltinsDate::SetUTCMonth(ecmaRuntimeCallInfo.get()); + JSTaggedValue result3 = BuiltinsDate::GetUTCMonth(ecmaRuntimeCallInfo.get()); + ASSERT_EQ(result3.GetRawData(), JSTaggedValue(static_cast(8)).GetRawData()); +@@ -421,13 +421,13 @@ TEST_F(BuiltinsDateTest, SetGetUTCMonth) + + TEST_F(BuiltinsDateTest, SetGetSeconds) + { +- JSHandle jsDate = JSDateCreateTest(thread); ++ JSHandle jsDate = JSDateCreateTest(thread_); + +- auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread, 8, jsDate.GetTaggedValue()); ++ auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread_, 8, jsDate.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast(59))); + ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(static_cast(123))); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + BuiltinsDate::SetSeconds(ecmaRuntimeCallInfo.get()); + JSTaggedValue result1 = BuiltinsDate::GetSeconds(ecmaRuntimeCallInfo.get()); + ASSERT_EQ(result1.GetRawData(), JSTaggedValue(static_cast(59)).GetRawData()); +@@ -438,13 +438,13 @@ TEST_F(BuiltinsDateTest, SetGetSeconds) + + TEST_F(BuiltinsDateTest, SetGetUTCSeconds) + { +- JSHandle jsDate = JSDateCreateTest(thread); ++ JSHandle jsDate = JSDateCreateTest(thread_); + +- auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread, 8, jsDate.GetTaggedValue()); ++ auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread_, 8, jsDate.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast(59))); + ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(static_cast(123))); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + BuiltinsDate::SetUTCSeconds(ecmaRuntimeCallInfo.get()); + JSTaggedValue result3 = BuiltinsDate::GetUTCSeconds(ecmaRuntimeCallInfo.get()); + ASSERT_EQ(result3.GetRawData(), JSTaggedValue(static_cast(59)).GetRawData()); +@@ -455,12 +455,12 @@ TEST_F(BuiltinsDateTest, SetGetUTCSeconds) + + TEST_F(BuiltinsDateTest, SetGetTime) + { +- JSHandle jsDate = JSDateCreateTest(thread); ++ JSHandle jsDate = JSDateCreateTest(thread_); + +- auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread, 6, jsDate.GetTaggedValue()); ++ auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread_, 6, jsDate.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast(2))); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result1 = BuiltinsDate::SetTime(ecmaRuntimeCallInfo.get()); + ASSERT_EQ(result1.GetRawData(), JSTaggedValue(static_cast(2)).GetRawData()); + +@@ -470,18 +470,18 @@ TEST_F(BuiltinsDateTest, SetGetTime) + + TEST_F(BuiltinsDateTest, UTC) + { +- auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread, 12, JSTaggedValue::Undefined()); ++ auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread_, 12, JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(2020.982)); + ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(10.23)); + ecmaRuntimeCallInfo->SetCallArg(2, JSTaggedValue(4.32)); + ecmaRuntimeCallInfo->SetCallArg(3, JSTaggedValue(11.32)); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result1 = BuiltinsDate::UTC(ecmaRuntimeCallInfo.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + ASSERT_EQ(result1.GetRawData(), JSTaggedValue(static_cast(1604487600000)).GetRawData()); + +- auto ecmaRuntimeCallInfo1 = CreateAndSetRuntimeCallInfo(thread, 18, JSTaggedValue::Undefined()); ++ auto ecmaRuntimeCallInfo1 = CreateAndSetRuntimeCallInfo(thread_, 18, JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo1->SetCallArg(0, JSTaggedValue(2020.982)); + ecmaRuntimeCallInfo1->SetCallArg(1, JSTaggedValue(10.23)); + ecmaRuntimeCallInfo1->SetCallArg(2, JSTaggedValue(4.32)); +@@ -490,35 +490,35 @@ TEST_F(BuiltinsDateTest, UTC) + ecmaRuntimeCallInfo1->SetCallArg(5, JSTaggedValue(34.321)); + ecmaRuntimeCallInfo1->SetCallArg(6, JSTaggedValue(static_cast(231))); + +- prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); ++ prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); + result1 = BuiltinsDate::UTC(ecmaRuntimeCallInfo1.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + ASSERT_EQ(result1.GetRawData(), JSTaggedValue(static_cast(1604490334231)).GetRawData()); + +- auto ecmaRuntimeCallInfo2 = CreateAndSetRuntimeCallInfo(thread, 10, JSTaggedValue::Undefined()); ++ auto ecmaRuntimeCallInfo2 = CreateAndSetRuntimeCallInfo(thread_, 10, JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo2->SetCallArg(0, JSTaggedValue(10.23)); + ecmaRuntimeCallInfo2->SetCallArg(1, JSTaggedValue(4.32)); + ecmaRuntimeCallInfo2->SetCallArg(2, JSTaggedValue(11.32)); + +- prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo2.get()); ++ prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo2.get()); + result1 = BuiltinsDate::UTC(ecmaRuntimeCallInfo2.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + ASSERT_EQ(result1.GetRawData(), JSTaggedValue(static_cast(-1882224000000)).GetRawData()); + +- auto ecmaRuntimeCallInfo3 = CreateAndSetRuntimeCallInfo(thread, 6, JSTaggedValue::Undefined()); ++ auto ecmaRuntimeCallInfo3 = CreateAndSetRuntimeCallInfo(thread_, 6, JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo3->SetCallArg(0, JSTaggedValue(1994.982)); + +- prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo3.get()); ++ prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo3.get()); + result1 = BuiltinsDate::UTC(ecmaRuntimeCallInfo3.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + ASSERT_EQ(result1.GetRawData(), JSTaggedValue(static_cast(757382400000)).GetRawData()); + +- auto ecmaRuntimeCallInfo4 = CreateAndSetRuntimeCallInfo(thread, 6, JSTaggedValue::Undefined()); ++ auto ecmaRuntimeCallInfo4 = CreateAndSetRuntimeCallInfo(thread_, 6, JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo4->SetCallArg(0, JSTaggedValue(19999944.982)); + +- prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo4.get()); ++ prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo4.get()); + result1 = BuiltinsDate::UTC(ecmaRuntimeCallInfo4.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + ASSERT_EQ(result1.GetRawData(), JSTaggedValue(static_cast(base::NAN_VALUE)).GetRawData()); + } + +@@ -606,74 +606,74 @@ void SetAll2(JSThread *thread, const JSHandle &jsDate) + TEST_F(BuiltinsDateTest, parse) + { + JSHandle str = +- thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("2020-11-19T12:18:18.132Z"); +- auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread, 6, JSTaggedValue::Undefined()); ++ thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("2020-11-19T12:18:18.132Z"); ++ auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread_, 6, JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetCallArg(0, str.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result1 = BuiltinsDate::Parse(ecmaRuntimeCallInfo.get()); + ASSERT_EQ(result1.GetRawData(), JSTaggedValue(static_cast(1605788298132)).GetRawData()); + +- JSHandle str1 = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("2020-11-19Z"); +- auto ecmaRuntimeCallInfo1 = CreateAndSetRuntimeCallInfo(thread, 6, JSTaggedValue::Undefined()); ++ JSHandle str1 = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("2020-11-19Z"); ++ auto ecmaRuntimeCallInfo1 = CreateAndSetRuntimeCallInfo(thread_, 6, JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo1->SetCallArg(0, str1.GetTaggedValue()); + +- prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); ++ prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); + result1 = BuiltinsDate::Parse(ecmaRuntimeCallInfo1.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + ASSERT_EQ(result1.GetRawData(), JSTaggedValue(static_cast(1605744000000)).GetRawData()); + + JSHandle str2 = +- thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("2020-11T12:18:17.231+08:00"); +- auto ecmaRuntimeCallInfo2 = CreateAndSetRuntimeCallInfo(thread, 6, JSTaggedValue::Undefined()); ++ thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("2020-11T12:18:17.231+08:00"); ++ auto ecmaRuntimeCallInfo2 = CreateAndSetRuntimeCallInfo(thread_, 6, JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo2->SetCallArg(0, str2.GetTaggedValue()); + +- prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo2.get()); ++ prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo2.get()); + result1 = BuiltinsDate::Parse(ecmaRuntimeCallInfo2.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + ASSERT_EQ(result1.GetRawData(), JSTaggedValue(static_cast(1604204297231)).GetRawData()); + + JSHandle str3 = +- thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("Thu Nov 19 2020 20:18:18 GMT+0800"); +- auto ecmaRuntimeCallInfo3 = CreateAndSetRuntimeCallInfo(thread, 6, JSTaggedValue::Undefined()); ++ thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("Thu Nov 19 2020 20:18:18 GMT+0800"); ++ auto ecmaRuntimeCallInfo3 = CreateAndSetRuntimeCallInfo(thread_, 6, JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo3->SetCallArg(0, str3.GetTaggedValue()); + +- prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo3.get()); ++ prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo3.get()); + result1 = BuiltinsDate::Parse(ecmaRuntimeCallInfo3.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + ASSERT_EQ(result1.GetRawData(), JSTaggedValue(static_cast(1605788298000)).GetRawData()); + + JSHandle str4 = +- thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("Thu 03 Jun 2093 04:18 GMT"); +- auto ecmaRuntimeCallInfo4 = CreateAndSetRuntimeCallInfo(thread, 6, JSTaggedValue::Undefined()); ++ thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("Thu 03 Jun 2093 04:18 GMT"); ++ auto ecmaRuntimeCallInfo4 = CreateAndSetRuntimeCallInfo(thread_, 6, JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo4->SetCallArg(0, str4.GetTaggedValue()); + +- prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo4.get()); ++ prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo4.get()); + result1 = BuiltinsDate::Parse(ecmaRuntimeCallInfo4.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + ASSERT_EQ(result1.GetRawData(), JSTaggedValue(static_cast(3894841080000)).GetRawData()); + +- auto ecmaRuntimeCallInfo5 = CreateAndSetRuntimeCallInfo(thread, 6, JSTaggedValue::Undefined()); ++ auto ecmaRuntimeCallInfo5 = CreateAndSetRuntimeCallInfo(thread_, 6, JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo5->SetCallArg(0, JSTaggedValue::Null()); + +- prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo5.get()); ++ prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo5.get()); + result1 = BuiltinsDate::Parse(ecmaRuntimeCallInfo5.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + ASSERT_EQ(result1.GetRawData(), JSTaggedValue(static_cast(base::NAN_VALUE)).GetRawData()); + } + + TEST_F(BuiltinsDateTest, ToDateString) + { + JSHandle expect_value = +- thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("Tue Nov 06 2018"); +- JSHandle jsDate = JSDateCreateTest(thread); +- SetAllYearAndHours(thread, jsDate); ++ thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("Tue Nov 06 2018"); ++ JSHandle jsDate = JSDateCreateTest(thread_); ++ SetAllYearAndHours(thread_, jsDate); + +- auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread, 4, jsDate.GetTaggedValue()); ++ auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread_, 4, jsDate.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsDate::ToDateString(ecmaRuntimeCallInfo.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + + ASSERT_TRUE(result.IsString()); + ASSERT_TRUE(EcmaString::StringsAreEqual(reinterpret_cast(result.GetRawData()), *expect_value)); +@@ -682,14 +682,14 @@ TEST_F(BuiltinsDateTest, ToDateString) + TEST_F(BuiltinsDateTest, ToISOString) + { + JSHandle expect_value = +- thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("2020-11-19T12:18:18.132Z"); +- JSHandle jsDate = JSDateCreateTest(thread); +- JSDate::Cast(jsDate.GetTaggedValue().GetTaggedObject())->SetTimeValue(thread, JSTaggedValue(1605788298132.0)); +- auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread, 4, jsDate.GetTaggedValue()); ++ thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("2020-11-19T12:18:18.132Z"); ++ JSHandle jsDate = JSDateCreateTest(thread_); ++ JSDate::Cast(jsDate.GetTaggedValue().GetTaggedObject())->SetTimeValue(thread_, JSTaggedValue(1605788298132.0)); ++ auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread_, 4, jsDate.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result1 = BuiltinsDate::ToISOString(ecmaRuntimeCallInfo.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + ASSERT_TRUE(result1.IsString()); + ASSERT_TRUE(EcmaString::StringsAreEqual(reinterpret_cast(result1.GetRawData()), *expect_value)); + } +@@ -697,15 +697,15 @@ TEST_F(BuiltinsDateTest, ToISOString) + TEST_F(BuiltinsDateTest, ToISOStringMinus) + { + JSHandle expect_value = +- thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("1831-12-02T21:47:18.382Z"); +- JSHandle jsDate = JSDateCreateTest(thread); +- JSDate::Cast(jsDate.GetTaggedValue().GetTaggedObject())->SetTimeValue(thread, JSTaggedValue(-4357419161618.0)); ++ thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("1831-12-02T21:47:18.382Z"); ++ JSHandle jsDate = JSDateCreateTest(thread_); ++ JSDate::Cast(jsDate.GetTaggedValue().GetTaggedObject())->SetTimeValue(thread_, JSTaggedValue(-4357419161618.0)); + +- auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread, 4, jsDate.GetTaggedValue()); ++ auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread_, 4, jsDate.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result1 = BuiltinsDate::ToISOString(ecmaRuntimeCallInfo.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + ASSERT_TRUE(result1.IsString()); + ASSERT_TRUE(EcmaString::StringsAreEqual(reinterpret_cast(result1.GetRawData()), *expect_value)); + } +@@ -714,14 +714,14 @@ TEST_F(BuiltinsDateTest, ToISOStringMinus) + TEST_F(BuiltinsDateTest, ToJSON) + { + JSHandle expect_value = +- thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("2020-11-19T12:18:18.132Z"); +- JSHandle jsDate = JSDateCreateTest(thread); +- jsDate->SetTimeValue(thread, JSTaggedValue(1605788298132.0)); +- auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread, 4, jsDate.GetTaggedValue()); ++ thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("2020-11-19T12:18:18.132Z"); ++ JSHandle jsDate = JSDateCreateTest(thread_); ++ jsDate->SetTimeValue(thread_, JSTaggedValue(1605788298132.0)); ++ auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread_, 4, jsDate.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result1 = BuiltinsDate::ToJSON(ecmaRuntimeCallInfo.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + ASSERT_TRUE(result1.IsString()); + ASSERT_TRUE(EcmaString::StringsAreEqual(reinterpret_cast(result1.GetRawData()), *expect_value)); + } +@@ -729,12 +729,12 @@ TEST_F(BuiltinsDateTest, ToJSON) + TEST_F(BuiltinsDateTest, ToJSONMinus) + { + JSHandle expect_value = +- thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("1831-12-02T21:47:18.382Z"); +- JSHandle jsDate = JSDateCreateTest(thread); +- jsDate->SetTimeValue(thread, JSTaggedValue(-4357419161618.0)); +- auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread, 4, jsDate.GetTaggedValue()); ++ thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("1831-12-02T21:47:18.382Z"); ++ JSHandle jsDate = JSDateCreateTest(thread_); ++ jsDate->SetTimeValue(thread_, JSTaggedValue(-4357419161618.0)); ++ auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread_, 4, jsDate.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result1 = BuiltinsDate::ToJSON(ecmaRuntimeCallInfo.get()); + ASSERT_TRUE(result1.IsString()); + ASSERT_TRUE(EcmaString::StringsAreEqual(reinterpret_cast(result1.GetRawData()), *expect_value)); +@@ -764,47 +764,47 @@ TEST_F(BuiltinsDateTest, ToString) + int localMin = 0; + CString localTime; + +- JSHandle jsDate = JSDateCreateTest(thread); +- auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread, 4, jsDate.GetTaggedValue()); ++ JSHandle jsDate = JSDateCreateTest(thread_); ++ auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread_, 4, jsDate.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + +- SetAllYearAndHours(thread, jsDate); ++ SetAllYearAndHours(thread_, jsDate); + localTime = GetLocalTime(jsDate, localMin); + JSTaggedValue result1 = BuiltinsDate::ToString(ecmaRuntimeCallInfo.get()); + ASSERT_TRUE(result1.IsString()); +- TestHelper::TearDownFrame(thread, prev); +- JSHandle result1_val(thread, reinterpret_cast(result1.GetRawData())); ++ TestHelper::TearDownFrame(thread_, prev); ++ JSHandle result1_val(thread_, reinterpret_cast(result1.GetRawData())); + CString str = "Tue Nov 06 2018 18:10:06 GMT" + localTime; +- JSHandle str_handle = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(str); ++ JSHandle str_handle = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(str); + ASSERT_TRUE(EcmaString::StringsAreEqual(*result1_val, *str_handle)); + +- JSHandle js_date1 = JSDateCreateTest(thread); +- auto ecmaRuntimeCallInfo1 = CreateAndSetRuntimeCallInfo(thread, 4, js_date1.GetTaggedValue()); +- prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); ++ JSHandle js_date1 = JSDateCreateTest(thread_); ++ auto ecmaRuntimeCallInfo1 = CreateAndSetRuntimeCallInfo(thread_, 4, js_date1.GetTaggedValue()); ++ prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); + +- SetAll1(thread, js_date1); ++ SetAll1(thread_, js_date1); + localTime = GetLocalTime(js_date1, localMin); + JSTaggedValue result2 = BuiltinsDate::ToString(ecmaRuntimeCallInfo1.get()); + ASSERT_TRUE(result2.IsString()); +- TestHelper::TearDownFrame(thread, prev); +- JSHandle result2_val(thread, reinterpret_cast(result2.GetRawData())); ++ TestHelper::TearDownFrame(thread_, prev); ++ JSHandle result2_val(thread_, reinterpret_cast(result2.GetRawData())); + str = "Mon Dec 31 1900 23:54:16 GMT" + localTime; +- str_handle = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(str); ++ str_handle = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(str); + ASSERT_TRUE(EcmaString::StringsAreEqual(*result2_val, *str_handle)); + +- JSHandle js_date2 = JSDateCreateTest(thread); +- auto ecmaRuntimeCallInfo2 = CreateAndSetRuntimeCallInfo(thread, 4, js_date2.GetTaggedValue()); +- prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo2.get()); ++ JSHandle js_date2 = JSDateCreateTest(thread_); ++ auto ecmaRuntimeCallInfo2 = CreateAndSetRuntimeCallInfo(thread_, 4, js_date2.GetTaggedValue()); ++ prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo2.get()); + +- SetAll2(thread, js_date2); ++ SetAll2(thread_, js_date2); + localTime = GetLocalTime(jsDate, localMin); + JSTaggedValue result3 = BuiltinsDate::ToString(ecmaRuntimeCallInfo2.get()); + ASSERT_TRUE(result3.IsString()); +- TestHelper::TearDownFrame(thread, prev); +- JSHandle result3_val(thread, reinterpret_cast(result3.GetRawData())); ++ TestHelper::TearDownFrame(thread_, prev); ++ JSHandle result3_val(thread_, reinterpret_cast(result3.GetRawData())); + str = "Tue Jan 01 1901 00:03:21 GMT" + localTime; +- str_handle = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(str); ++ str_handle = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(str); + ASSERT_TRUE(EcmaString::StringsAreEqual(*result3_val, *str_handle)); + } + +@@ -813,53 +813,53 @@ TEST_F(BuiltinsDateTest, ToTimeString) + int localMin = 0; + CString localTime; + +- JSHandle jsDate = JSDateCreateTest(thread); +- auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread, 4, jsDate.GetTaggedValue()); ++ JSHandle jsDate = JSDateCreateTest(thread_); ++ auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread_, 4, jsDate.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + +- SetAllYearAndHours(thread, jsDate); ++ SetAllYearAndHours(thread_, jsDate); + localTime = GetLocalTime(jsDate, localMin); + JSTaggedValue result1 = BuiltinsDate::ToTimeString(ecmaRuntimeCallInfo.get()); + ASSERT_TRUE(result1.IsString()); +- JSHandle result1_val(thread, reinterpret_cast(result1.GetRawData())); ++ JSHandle result1_val(thread_, reinterpret_cast(result1.GetRawData())); + CString str = "18:10:06 GMT" + localTime; +- JSHandle str_handle = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(str); ++ JSHandle str_handle = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(str); + ASSERT_TRUE(EcmaString::StringsAreEqual(*result1_val, *str_handle)); + +- JSHandle js_date1 = JSDateCreateTest(thread); +- auto ecmaRuntimeCallInfo1 = CreateAndSetRuntimeCallInfo(thread, 4, js_date1.GetTaggedValue()); +- prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); +- SetAll1(thread, js_date1); ++ JSHandle js_date1 = JSDateCreateTest(thread_); ++ auto ecmaRuntimeCallInfo1 = CreateAndSetRuntimeCallInfo(thread_, 4, js_date1.GetTaggedValue()); ++ prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); ++ SetAll1(thread_, js_date1); + localTime = GetLocalTime(js_date1, localMin); + JSTaggedValue result2 = BuiltinsDate::ToTimeString(ecmaRuntimeCallInfo1.get()); + ASSERT_TRUE(result2.IsString()); +- JSHandle result2_val(thread, reinterpret_cast(result2.GetRawData())); ++ JSHandle result2_val(thread_, reinterpret_cast(result2.GetRawData())); + str = "23:54:16 GMT" + localTime; +- str_handle = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(str); ++ str_handle = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(str); + ASSERT_TRUE(EcmaString::StringsAreEqual(*result2_val, *str_handle)); +- JSHandle js_date2 = JSDateCreateTest(thread); +- auto ecmaRuntimeCallInfo2 = CreateAndSetRuntimeCallInfo(thread, 4, js_date2.GetTaggedValue()); +- prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo2.get()); +- SetAll2(thread, js_date2); ++ JSHandle js_date2 = JSDateCreateTest(thread_); ++ auto ecmaRuntimeCallInfo2 = CreateAndSetRuntimeCallInfo(thread_, 4, js_date2.GetTaggedValue()); ++ prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo2.get()); ++ SetAll2(thread_, js_date2); + localTime = GetLocalTime(jsDate, localMin); + JSTaggedValue result3 = BuiltinsDate::ToTimeString(ecmaRuntimeCallInfo2.get()); + ASSERT_TRUE(result3.IsString()); +- JSHandle result3_val(thread, reinterpret_cast(result3.GetRawData())); ++ JSHandle result3_val(thread_, reinterpret_cast(result3.GetRawData())); + str = "00:03:21 GMT" + localTime; +- str_handle = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(str); ++ str_handle = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(str); + ASSERT_TRUE(EcmaString::StringsAreEqual(*result3_val, *str_handle)); + } + + TEST_F(BuiltinsDateTest, ToUTCString) + { + JSHandle expect_value = +- thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("Thu, 19 Nov 2020 12:18:18 GMT"); +- JSHandle jsDate = JSDateCreateTest(thread); +- JSDate::Cast(jsDate.GetTaggedValue().GetTaggedObject())->SetTimeValue(thread, JSTaggedValue(1605788298132.0)); +- auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread, 4, jsDate.GetTaggedValue()); ++ thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("Thu, 19 Nov 2020 12:18:18 GMT"); ++ JSHandle jsDate = JSDateCreateTest(thread_); ++ JSDate::Cast(jsDate.GetTaggedValue().GetTaggedObject())->SetTimeValue(thread_, JSTaggedValue(1605788298132.0)); ++ auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread_, 4, jsDate.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result1 = BuiltinsDate::ToUTCString(ecmaRuntimeCallInfo.get()); + ASSERT_TRUE(result1.IsString()); + ASSERT_TRUE(EcmaString::StringsAreEqual(reinterpret_cast(result1.GetRawData()), *expect_value)); +@@ -868,12 +868,12 @@ TEST_F(BuiltinsDateTest, ToUTCString) + TEST_F(BuiltinsDateTest, ToUTCStringMinus) + { + JSHandle expect_value = +- thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("Fri, 02 Dec 1831 21:47:18 GMT"); +- JSHandle jsDate = JSDateCreateTest(thread); +- JSDate::Cast(jsDate.GetTaggedValue().GetTaggedObject())->SetTimeValue(thread, JSTaggedValue(-4357419161618.0)); +- auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread, 4, jsDate.GetTaggedValue()); ++ thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("Fri, 02 Dec 1831 21:47:18 GMT"); ++ JSHandle jsDate = JSDateCreateTest(thread_); ++ JSDate::Cast(jsDate.GetTaggedValue().GetTaggedObject())->SetTimeValue(thread_, JSTaggedValue(-4357419161618.0)); ++ auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread_, 4, jsDate.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result1 = BuiltinsDate::ToUTCString(ecmaRuntimeCallInfo.get()); + ASSERT_TRUE(result1.IsString()); + ASSERT_TRUE(EcmaString::StringsAreEqual(reinterpret_cast(result1.GetRawData()), *expect_value)); +@@ -881,22 +881,22 @@ TEST_F(BuiltinsDateTest, ToUTCStringMinus) + + TEST_F(BuiltinsDateTest, ValueOf) + { +- JSHandle jsDate = JSDateCreateTest(thread); +- JSDate::Cast(jsDate.GetTaggedValue().GetTaggedObject())->SetTimeValue(thread, JSTaggedValue(1605788298132.0)); +- auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread, 4, jsDate.GetTaggedValue()); ++ JSHandle jsDate = JSDateCreateTest(thread_); ++ JSDate::Cast(jsDate.GetTaggedValue().GetTaggedObject())->SetTimeValue(thread_, JSTaggedValue(1605788298132.0)); ++ auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread_, 4, jsDate.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result1 = BuiltinsDate::ValueOf(ecmaRuntimeCallInfo.get()); + ASSERT_EQ(result1.GetRawData(), JSTaggedValue(static_cast(1605788298132)).GetRawData()); + } + + TEST_F(BuiltinsDateTest, ValueOfMinus) + { +- JSHandle jsDate = JSDateCreateTest(thread); +- JSDate::Cast(jsDate.GetTaggedValue().GetTaggedObject())->SetTimeValue(thread, JSTaggedValue(-4357419161618.0)); +- auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread, 4, jsDate.GetTaggedValue()); ++ JSHandle jsDate = JSDateCreateTest(thread_); ++ JSDate::Cast(jsDate.GetTaggedValue().GetTaggedObject())->SetTimeValue(thread_, JSTaggedValue(-4357419161618.0)); ++ auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread_, 4, jsDate.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result1 = BuiltinsDate::ValueOf(ecmaRuntimeCallInfo.get()); + ASSERT_EQ(result1.GetRawData(), JSTaggedValue(static_cast(-4357419161618)).GetRawData()); + } +@@ -904,35 +904,35 @@ TEST_F(BuiltinsDateTest, ValueOfMinus) + TEST_F(BuiltinsDateTest, DateConstructor) + { + // case1: test new target is undefined. +- JSHandle jsDate = JSDateCreateTest(thread); +- JSHandle globalEnv = thread->GetEcmaVM()->GetGlobalEnv(); ++ JSHandle jsDate = JSDateCreateTest(thread_); ++ JSHandle globalEnv = thread_->GetEcmaVM()->GetGlobalEnv(); + JSHandle date_func(globalEnv->GetDateFunction()); +- auto ecmaRuntimeCallInfo1 = CreateAndSetRuntimeCallInfo(thread, 4, JSTaggedValue::Undefined()); ++ auto ecmaRuntimeCallInfo1 = CreateAndSetRuntimeCallInfo(thread_, 4, JSTaggedValue::Undefined()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); + JSTaggedValue result1 = BuiltinsDate::DateConstructor(ecmaRuntimeCallInfo1.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + ASSERT_TRUE(result1.IsString()); + + // case2: length == 0 +- auto ecmaRuntimeCallInfo2 = TestHelper::CreateEcmaRuntimeCallInfo(thread, jsDate.GetTaggedValue(), 4); ++ auto ecmaRuntimeCallInfo2 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, jsDate.GetTaggedValue(), 4); + ecmaRuntimeCallInfo2->SetFunction(date_func.GetTaggedValue()); + ecmaRuntimeCallInfo2->SetThis(jsDate.GetTaggedValue()); + +- prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo2.get()); ++ prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo2.get()); + JSTaggedValue result2 = BuiltinsDate::DateConstructor(ecmaRuntimeCallInfo2.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + ASSERT_TRUE(result2.IsObject()); + + // case3: length == 1 +- auto ecmaRuntimeCallInfo3 = TestHelper::CreateEcmaRuntimeCallInfo(thread, jsDate.GetTaggedValue(), 6); ++ auto ecmaRuntimeCallInfo3 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, jsDate.GetTaggedValue(), 6); + ecmaRuntimeCallInfo3->SetFunction(date_func.GetTaggedValue()); + ecmaRuntimeCallInfo3->SetThis(jsDate.GetTaggedValue()); + ecmaRuntimeCallInfo3->SetCallArg(0, JSTaggedValue(static_cast(2018))); + +- prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo3.get()); ++ prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo3.get()); + JSTaggedValue result3 = BuiltinsDate::DateConstructor(ecmaRuntimeCallInfo3.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + ASSERT_TRUE(result3.IsObject()); + + BuiltinsDate::SetFullYear(ecmaRuntimeCallInfo3.get()); +@@ -940,17 +940,17 @@ TEST_F(BuiltinsDateTest, DateConstructor) + ASSERT_EQ(result4.GetRawData(), JSTaggedValue(static_cast(2018)).GetRawData()); + + // case3: length > 1 +- auto ecmaRuntimeCallInfo4 = TestHelper::CreateEcmaRuntimeCallInfo(thread, jsDate.GetTaggedValue(), 8); ++ auto ecmaRuntimeCallInfo4 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, jsDate.GetTaggedValue(), 8); + ecmaRuntimeCallInfo4->SetFunction(date_func.GetTaggedValue()); + ecmaRuntimeCallInfo4->SetThis(jsDate.GetTaggedValue()); + ecmaRuntimeCallInfo4->SetCallArg(0, JSTaggedValue(static_cast(2018))); + ecmaRuntimeCallInfo4->SetCallArg(1, JSTaggedValue(static_cast(10))); + +- prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo4.get()); ++ prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo4.get()); + JSTaggedValue result5 = BuiltinsDate::DateConstructor(ecmaRuntimeCallInfo4.get()); + ASSERT_TRUE(result5.IsObject()); + +- SetAllYearAndHours(thread, jsDate); ++ SetAllYearAndHours(thread_, jsDate); + BuiltinsDate::SetFullYear(ecmaRuntimeCallInfo4.get()); + JSTaggedValue result6 = BuiltinsDate::GetFullYear(ecmaRuntimeCallInfo4.get()); + ASSERT_EQ(result6.GetRawData(), JSTaggedValue(static_cast(2018)).GetRawData()); +diff --git a/tests/runtime/builtins/builtins_errors_test.cpp b/tests/runtime/builtins/builtins_errors_test.cpp +index 6630318..e6ea900 100644 +--- a/tests/runtime/builtins/builtins_errors_test.cpp ++++ b/tests/runtime/builtins/builtins_errors_test.cpp +@@ -57,17 +57,17 @@ public: + + void SetUp() override + { +- TestHelper::CreateEcmaVMWithScope(instance, thread, scope); ++ TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); + } + + void TearDown() override + { +- TestHelper::DestroyEcmaVMWithScope(instance, scope); ++ TestHelper::DestroyEcmaVMWithScope(instance_, scope_); + } + +- PandaVM *instance {nullptr}; +- EcmaHandleScope *scope {nullptr}; +- JSThread *thread {nullptr}; ++ PandaVM *instance_ {nullptr}; ++ EcmaHandleScope *scope_ {nullptr}; ++ JSThread *thread_ {nullptr}; + }; + + /* +@@ -80,23 +80,23 @@ TEST_F(BuiltinsErrorsTest, GetJSErrorObject) + /** + * @tc.steps: step1. Create JSError object + */ +- ObjectFactory *factory = EcmaVM::Cast(instance)->GetFactory(); ++ ObjectFactory *factory = EcmaVM::Cast(instance_)->GetFactory(); + + JSHandle handleObj = factory->GetJSError(ErrorType::TYPE_ERROR); + JSHandle msgKey(factory->NewFromCanBeCompressString("message")); +- JSHandle nameKey = thread->GlobalConstants()->GetHandledNameString(); ++ JSHandle nameKey = thread_->GlobalConstants()->GetHandledNameString(); + + /** + * @tc.steps: step2. obtain JSError object prototype chain name property and message property + */ + JSHandle msgValue( +- JSObject::GetProperty(thread, JSHandle(handleObj), msgKey).GetValue()); ++ JSObject::GetProperty(thread_, JSHandle(handleObj), msgKey).GetValue()); + EXPECT_EQ(reinterpret_cast(msgValue->GetRawData()) + ->Compare(reinterpret_cast( + ecmascript::JSTaggedValue(*factory->NewFromCanBeCompressString("")).GetRawData())), + 0); + JSHandle nameValue( +- JSObject::GetProperty(thread, JSHandle(handleObj), nameKey).GetValue()); ++ JSObject::GetProperty(thread_, JSHandle(handleObj), nameKey).GetValue()); + ASSERT_EQ(reinterpret_cast( + ecmascript::JSTaggedValue(*factory->NewFromCanBeCompressString("TypeError")).GetRawData()) + ->Compare(reinterpret_cast(nameValue->GetRawData())), +@@ -110,19 +110,19 @@ TEST_F(BuiltinsErrorsTest, GetJSErrorObject) + */ + TEST_F(BuiltinsErrorsTest, GetJSErrorWithMessage) + { +- ObjectFactory *factory = EcmaVM::Cast(instance)->GetFactory(); ++ ObjectFactory *factory = EcmaVM::Cast(instance_)->GetFactory(); + + JSHandle handleObj = factory->GetJSError(ErrorType::TYPE_ERROR, "I am type error"); + JSHandle msgKey(factory->NewFromCanBeCompressString("message")); +- JSHandle nameKey = thread->GlobalConstants()->GetHandledNameString(); ++ JSHandle nameKey = thread_->GlobalConstants()->GetHandledNameString(); + JSHandle msgValue( +- JSObject::GetProperty(thread, JSHandle(handleObj), msgKey).GetValue()); ++ JSObject::GetProperty(thread_, JSHandle(handleObj), msgKey).GetValue()); + ASSERT_EQ(reinterpret_cast( + ecmascript::JSTaggedValue(*factory->NewFromCanBeCompressString("I am type error")).GetRawData()) + ->Compare(reinterpret_cast(msgValue->GetRawData())), + 0); + JSHandle nameValue( +- JSObject::GetProperty(thread, JSHandle(handleObj), nameKey).GetValue()); ++ JSObject::GetProperty(thread_, JSHandle(handleObj), nameKey).GetValue()); + ASSERT_EQ(reinterpret_cast( + ecmascript::JSTaggedValue(*factory->NewFromCanBeCompressString("TypeError")).GetRawData()) + ->Compare(reinterpret_cast(nameValue->GetRawData())), +@@ -136,31 +136,31 @@ TEST_F(BuiltinsErrorsTest, GetJSErrorWithMessage) + */ + TEST_F(BuiltinsErrorsTest, ErrorNoParameterConstructor) + { +- ObjectFactory *factory = EcmaVM::Cast(instance)->GetFactory(); +- JSHandle env = EcmaVM::Cast(instance)->GetGlobalEnv(); ++ ObjectFactory *factory = EcmaVM::Cast(instance_)->GetFactory(); ++ JSHandle env = EcmaVM::Cast(instance_)->GetGlobalEnv(); + + JSHandle error(env->GetErrorFunction()); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue(*error), 4); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue(*error), 4); + ecmaRuntimeCallInfo->SetFunction(error.GetTaggedValue()); + ecmaRuntimeCallInfo->SetThis(JSTaggedValue(*error)); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = Error::ErrorConstructor(ecmaRuntimeCallInfo.get()); + + EXPECT_TRUE(result.IsECMAObject()); + +- JSHandle errorObject(thread, reinterpret_cast(result.GetRawData())); ++ JSHandle errorObject(thread_, reinterpret_cast(result.GetRawData())); + JSHandle msgKey(factory->NewFromCanBeCompressString("message")); +- JSHandle nameKey = thread->GlobalConstants()->GetHandledNameString(); ++ JSHandle nameKey = thread_->GlobalConstants()->GetHandledNameString(); + +- JSHandle msgValue(JSObject::GetProperty(thread, errorObject, msgKey).GetValue()); ++ JSHandle msgValue(JSObject::GetProperty(thread_, errorObject, msgKey).GetValue()); + ASSERT_EQ( + reinterpret_cast(ecmascript::JSTaggedValue(*factory->NewFromCanBeCompressString("")).GetRawData()) + ->Compare(reinterpret_cast(msgValue->GetRawData())), + 0); + +- JSHandle nameValue(JSObject::GetProperty(thread, errorObject, nameKey).GetValue()); ++ JSHandle nameValue(JSObject::GetProperty(thread_, errorObject, nameKey).GetValue()); + ASSERT_EQ(reinterpret_cast( + ecmascript::JSTaggedValue(*factory->NewFromCanBeCompressString("Error")).GetRawData()) + ->Compare(reinterpret_cast(nameValue->GetRawData())), +@@ -174,33 +174,33 @@ TEST_F(BuiltinsErrorsTest, ErrorNoParameterConstructor) + */ + TEST_F(BuiltinsErrorsTest, ErrorParameterConstructor) + { +- ObjectFactory *factory = EcmaVM::Cast(instance)->GetFactory(); +- JSHandle env = EcmaVM::Cast(instance)->GetGlobalEnv(); ++ ObjectFactory *factory = EcmaVM::Cast(instance_)->GetFactory(); ++ JSHandle env = EcmaVM::Cast(instance_)->GetGlobalEnv(); + + JSHandle error(env->GetErrorFunction()); + JSHandle paramMsg(factory->NewFromCanBeCompressString("Hello Error!")); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue(*error), 6); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue(*error), 6); + ecmaRuntimeCallInfo->SetFunction(error.GetTaggedValue()); + ecmaRuntimeCallInfo->SetThis(JSTaggedValue(*error)); + ecmaRuntimeCallInfo->SetCallArg(0, paramMsg.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = Error::ErrorConstructor(ecmaRuntimeCallInfo.get()); + + EXPECT_TRUE(result.IsECMAObject()); + +- JSHandle errorObject(thread, reinterpret_cast(result.GetRawData())); ++ JSHandle errorObject(thread_, reinterpret_cast(result.GetRawData())); + JSHandle msgKey(factory->NewFromCanBeCompressString("message")); +- JSHandle nameKey = thread->GlobalConstants()->GetHandledNameString(); +- JSHandle msgValue(JSObject::GetProperty(thread, errorObject, msgKey).GetValue()); ++ JSHandle nameKey = thread_->GlobalConstants()->GetHandledNameString(); ++ JSHandle msgValue(JSObject::GetProperty(thread_, errorObject, msgKey).GetValue()); + + ASSERT_EQ(reinterpret_cast( + ecmascript::JSTaggedValue(*factory->NewFromCanBeCompressString("Hello Error!")).GetRawData()) + ->Compare(reinterpret_cast(msgValue->GetRawData())), + 0); + +- JSHandle nameValue(JSObject::GetProperty(thread, errorObject, nameKey).GetValue()); ++ JSHandle nameValue(JSObject::GetProperty(thread_, errorObject, nameKey).GetValue()); + ASSERT_EQ(reinterpret_cast( + ecmascript::JSTaggedValue(*factory->NewFromCanBeCompressString("Error")).GetRawData()) + ->Compare(reinterpret_cast(nameValue->GetRawData())), +@@ -214,20 +214,20 @@ TEST_F(BuiltinsErrorsTest, ErrorParameterConstructor) + */ + TEST_F(BuiltinsErrorsTest, ErrorNoParameterToString) + { +- ObjectFactory *factory = EcmaVM::Cast(instance)->GetFactory(); +- JSHandle env = EcmaVM::Cast(instance)->GetGlobalEnv(); ++ ObjectFactory *factory = EcmaVM::Cast(instance_)->GetFactory(); ++ JSHandle env = EcmaVM::Cast(instance_)->GetGlobalEnv(); + + JSHandle errorObject = env->GetErrorFunction(); + JSHandle error = factory->NewJSObjectByConstructor(JSHandle(errorObject), errorObject); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(JSTaggedValue(*error)); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = Error::ToString(ecmaRuntimeCallInfo.get()); + +- JSHandle resultHandle(thread, reinterpret_cast(result.GetRawData())); ++ JSHandle resultHandle(thread_, reinterpret_cast(result.GetRawData())); + EXPECT_TRUE(result.IsString()); + EXPECT_EQ(reinterpret_cast( + ecmascript::JSTaggedValue(*factory->NewFromCanBeCompressString("Error")).GetRawData()) +@@ -242,25 +242,25 @@ TEST_F(BuiltinsErrorsTest, ErrorNoParameterToString) + */ + TEST_F(BuiltinsErrorsTest, ErrorToString) + { +- ObjectFactory *factory = EcmaVM::Cast(instance)->GetFactory(); +- JSHandle env = EcmaVM::Cast(instance)->GetGlobalEnv(); ++ ObjectFactory *factory = EcmaVM::Cast(instance_)->GetFactory(); ++ JSHandle env = EcmaVM::Cast(instance_)->GetGlobalEnv(); + + JSHandle errorObject = env->GetErrorFunction(); + JSHandle error = factory->NewJSObjectByConstructor(JSHandle(errorObject), errorObject); + + JSHandle handleMsgKey(factory->NewFromCanBeCompressString("message")); + JSObject::SetProperty( +- thread, JSHandle(error), handleMsgKey, +- JSHandle(thread, factory->NewFromCanBeCompressString("This is Error!").GetTaggedValue())); ++ thread_, JSHandle(error), handleMsgKey, ++ JSHandle(thread_, factory->NewFromCanBeCompressString("This is Error!").GetTaggedValue())); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(JSTaggedValue(*error)); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = Error::ToString(ecmaRuntimeCallInfo.get()); + +- JSHandle resultHandle(thread, reinterpret_cast(result.GetRawData())); ++ JSHandle resultHandle(thread_, reinterpret_cast(result.GetRawData())); + EXPECT_TRUE(result.IsString()); + EXPECT_EQ(reinterpret_cast( + ecmascript::JSTaggedValue(*factory->NewFromCanBeCompressString("Error: This is Error!")).GetRawData()) +@@ -275,30 +275,30 @@ TEST_F(BuiltinsErrorsTest, ErrorToString) + */ + TEST_F(BuiltinsErrorsTest, RangeErrorNoParameterConstructor) + { +- ObjectFactory *factory = EcmaVM::Cast(instance)->GetFactory(); +- JSHandle env = EcmaVM::Cast(instance)->GetGlobalEnv(); ++ ObjectFactory *factory = EcmaVM::Cast(instance_)->GetFactory(); ++ JSHandle env = EcmaVM::Cast(instance_)->GetGlobalEnv(); + + JSHandle error(env->GetRangeErrorFunction()); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); + ecmaRuntimeCallInfo->SetFunction(error.GetTaggedValue()); + ecmaRuntimeCallInfo->SetThis(JSTaggedValue(*error)); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = RangeError::RangeErrorConstructor(ecmaRuntimeCallInfo.get()); + + EXPECT_TRUE(result.IsECMAObject()); + +- JSHandle errorObject(thread, reinterpret_cast(result.GetRawData())); ++ JSHandle errorObject(thread_, reinterpret_cast(result.GetRawData())); + JSHandle msgKey(factory->NewFromCanBeCompressString("message")); +- JSHandle nameKey = thread->GlobalConstants()->GetHandledNameString(); ++ JSHandle nameKey = thread_->GlobalConstants()->GetHandledNameString(); + +- JSHandle msgValue(JSObject::GetProperty(thread, errorObject, msgKey).GetValue()); ++ JSHandle msgValue(JSObject::GetProperty(thread_, errorObject, msgKey).GetValue()); + ASSERT_EQ( + reinterpret_cast(ecmascript::JSTaggedValue(*factory->NewFromCanBeCompressString("")).GetRawData()) + ->Compare(reinterpret_cast(JSTaggedValue(msgValue.GetTaggedValue()).GetRawData())), + 0); +- JSHandle nameValue(JSObject::GetProperty(thread, errorObject, nameKey).GetValue()); ++ JSHandle nameValue(JSObject::GetProperty(thread_, errorObject, nameKey).GetValue()); + ASSERT_EQ(reinterpret_cast( + ecmascript::JSTaggedValue(*factory->NewFromCanBeCompressString("RangeError")).GetRawData()) + ->Compare(reinterpret_cast(JSTaggedValue(nameValue.GetTaggedValue()).GetRawData())), +@@ -312,33 +312,33 @@ TEST_F(BuiltinsErrorsTest, RangeErrorNoParameterConstructor) + */ + TEST_F(BuiltinsErrorsTest, RangeErrorParameterConstructor) + { +- ObjectFactory *factory = EcmaVM::Cast(instance)->GetFactory(); +- JSHandle env = EcmaVM::Cast(instance)->GetGlobalEnv(); ++ ObjectFactory *factory = EcmaVM::Cast(instance_)->GetFactory(); ++ JSHandle env = EcmaVM::Cast(instance_)->GetGlobalEnv(); + + JSHandle error(env->GetRangeErrorFunction()); + JSHandle paramMsg(factory->NewFromCanBeCompressString("Hello RangeError!")); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue(*error), 6); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue(*error), 6); + ecmaRuntimeCallInfo->SetFunction(error.GetTaggedValue()); + ecmaRuntimeCallInfo->SetThis(JSTaggedValue(*error)); + ecmaRuntimeCallInfo->SetCallArg(0, paramMsg.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = RangeError::RangeErrorConstructor(ecmaRuntimeCallInfo.get()); + + EXPECT_TRUE(result.IsECMAObject()); + +- JSHandle errorObject(thread, reinterpret_cast(result.GetRawData())); ++ JSHandle errorObject(thread_, reinterpret_cast(result.GetRawData())); + JSHandle msgKey(factory->NewFromCanBeCompressString("message")); +- JSHandle nameKey = thread->GlobalConstants()->GetHandledNameString(); ++ JSHandle nameKey = thread_->GlobalConstants()->GetHandledNameString(); + +- JSHandle msgValue(JSObject::GetProperty(thread, errorObject, msgKey).GetValue()); ++ JSHandle msgValue(JSObject::GetProperty(thread_, errorObject, msgKey).GetValue()); + ASSERT_EQ(reinterpret_cast( + ecmascript::JSTaggedValue(*factory->NewFromCanBeCompressString("Hello RangeError!")).GetRawData()) + ->Compare(reinterpret_cast(msgValue->GetRawData())), + 0); + +- JSHandle nameValue(JSObject::GetProperty(thread, errorObject, nameKey).GetValue()); ++ JSHandle nameValue(JSObject::GetProperty(thread_, errorObject, nameKey).GetValue()); + ASSERT_EQ(reinterpret_cast( + ecmascript::JSTaggedValue(*factory->NewFromCanBeCompressString("RangeError")).GetRawData()) + ->Compare(reinterpret_cast(nameValue->GetRawData())), +@@ -352,19 +352,19 @@ TEST_F(BuiltinsErrorsTest, RangeErrorParameterConstructor) + */ + TEST_F(BuiltinsErrorsTest, RangeErrorNoParameterToString) + { +- ObjectFactory *factory = EcmaVM::Cast(instance)->GetFactory(); +- JSHandle env = EcmaVM::Cast(instance)->GetGlobalEnv(); ++ ObjectFactory *factory = EcmaVM::Cast(instance_)->GetFactory(); ++ JSHandle env = EcmaVM::Cast(instance_)->GetGlobalEnv(); + + JSHandle errorObject = env->GetRangeErrorFunction(); + JSHandle error = factory->NewJSObjectByConstructor(JSHandle(errorObject), errorObject); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(JSTaggedValue(*error)); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = RangeError::ToString(ecmaRuntimeCallInfo.get()); +- JSHandle resultHandle(thread, result); ++ JSHandle resultHandle(thread_, result); + + EXPECT_TRUE(result.IsString()); + +@@ -381,24 +381,24 @@ TEST_F(BuiltinsErrorsTest, RangeErrorNoParameterToString) + */ + TEST_F(BuiltinsErrorsTest, RangeErrorToString) + { +- ObjectFactory *factory = EcmaVM::Cast(instance)->GetFactory(); +- JSHandle env = EcmaVM::Cast(instance)->GetGlobalEnv(); ++ ObjectFactory *factory = EcmaVM::Cast(instance_)->GetFactory(); ++ JSHandle env = EcmaVM::Cast(instance_)->GetGlobalEnv(); + + JSHandle errorObject = env->GetRangeErrorFunction(); + JSHandle error = factory->NewJSObjectByConstructor(JSHandle(errorObject), errorObject); + + JSHandle handleMsgKey(factory->NewFromCanBeCompressString("message")); +- JSObject::SetProperty(thread, JSHandle(error), handleMsgKey, ++ JSObject::SetProperty(thread_, JSHandle(error), handleMsgKey, + JSHandle(factory->NewFromCanBeCompressString("This is RangeError!"))); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(JSTaggedValue(*error)); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = RangeError::ToString(ecmaRuntimeCallInfo.get()); + +- JSHandle resultHandle(thread, reinterpret_cast(result.GetRawData())); ++ JSHandle resultHandle(thread_, reinterpret_cast(result.GetRawData())); + EXPECT_TRUE(result.IsString()); + EXPECT_EQ(factory->NewFromCanBeCompressString("RangeError: This is RangeError!")->Compare(*resultHandle), 0); + } +@@ -411,30 +411,30 @@ TEST_F(BuiltinsErrorsTest, RangeErrorToString) + */ + TEST_F(BuiltinsErrorsTest, ReferenceErrorNoParameterConstructor) + { +- ObjectFactory *factory = EcmaVM::Cast(instance)->GetFactory(); +- JSHandle env = EcmaVM::Cast(instance)->GetGlobalEnv(); ++ ObjectFactory *factory = EcmaVM::Cast(instance_)->GetFactory(); ++ JSHandle env = EcmaVM::Cast(instance_)->GetGlobalEnv(); + + JSHandle error(env->GetReferenceErrorFunction()); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue(*error), 4); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue(*error), 4); + ecmaRuntimeCallInfo->SetFunction(error.GetTaggedValue()); + ecmaRuntimeCallInfo->SetThis(JSTaggedValue(*error)); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = ReferenceError::ReferenceErrorConstructor(ecmaRuntimeCallInfo.get()); + EXPECT_TRUE(result.IsECMAObject()); + +- JSHandle errorObject(thread, reinterpret_cast(result.GetRawData())); ++ JSHandle errorObject(thread_, reinterpret_cast(result.GetRawData())); + JSHandle msgKey(factory->NewFromCanBeCompressString("message")); +- JSHandle nameKey = thread->GlobalConstants()->GetHandledNameString(); ++ JSHandle nameKey = thread_->GlobalConstants()->GetHandledNameString(); + +- JSHandle msgValue(JSObject::GetProperty(thread, errorObject, msgKey).GetValue()); ++ JSHandle msgValue(JSObject::GetProperty(thread_, errorObject, msgKey).GetValue()); + ASSERT_EQ( + reinterpret_cast(ecmascript::JSTaggedValue(*factory->NewFromCanBeCompressString("")).GetRawData()) + ->Compare(reinterpret_cast(msgValue->GetRawData())), + 0); + +- JSHandle nameValue(JSObject::GetProperty(thread, errorObject, nameKey).GetValue()); ++ JSHandle nameValue(JSObject::GetProperty(thread_, errorObject, nameKey).GetValue()); + ASSERT_EQ(reinterpret_cast( + ecmascript::JSTaggedValue(*factory->NewFromCanBeCompressString("ReferenceError")).GetRawData()) + ->Compare(reinterpret_cast(nameValue->GetRawData())), +@@ -448,31 +448,31 @@ TEST_F(BuiltinsErrorsTest, ReferenceErrorNoParameterConstructor) + */ + TEST_F(BuiltinsErrorsTest, ReferenceErrorParameterConstructor) + { +- ObjectFactory *factory = EcmaVM::Cast(instance)->GetFactory(); +- JSHandle env = EcmaVM::Cast(instance)->GetGlobalEnv(); ++ ObjectFactory *factory = EcmaVM::Cast(instance_)->GetFactory(); ++ JSHandle env = EcmaVM::Cast(instance_)->GetGlobalEnv(); + + JSHandle error(env->GetReferenceErrorFunction()); + JSHandle paramMsg(factory->NewFromCanBeCompressString("Hello ReferenceError!")); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue(*error), 6); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue(*error), 6); + ecmaRuntimeCallInfo->SetFunction(error.GetTaggedValue()); + ecmaRuntimeCallInfo->SetThis(JSTaggedValue(*error)); + ecmaRuntimeCallInfo->SetCallArg(0, paramMsg.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = ReferenceError::ReferenceErrorConstructor(ecmaRuntimeCallInfo.get()); + EXPECT_TRUE(result.IsECMAObject()); + +- JSHandle errorObject(thread, reinterpret_cast(result.GetRawData())); ++ JSHandle errorObject(thread_, reinterpret_cast(result.GetRawData())); + JSHandle msgKey(factory->NewFromCanBeCompressString("message")); +- JSHandle nameKey = thread->GlobalConstants()->GetHandledNameString(); +- JSHandle msgValue(JSObject::GetProperty(thread, errorObject, msgKey).GetValue()); ++ JSHandle nameKey = thread_->GlobalConstants()->GetHandledNameString(); ++ JSHandle msgValue(JSObject::GetProperty(thread_, errorObject, msgKey).GetValue()); + ASSERT_EQ(reinterpret_cast( + ecmascript::JSTaggedValue(*factory->NewFromCanBeCompressString("Hello ReferenceError!")).GetRawData()) + ->Compare(reinterpret_cast(msgValue->GetRawData())), + 0); + +- JSHandle nameValue(JSObject::GetProperty(thread, errorObject, nameKey).GetValue()); ++ JSHandle nameValue(JSObject::GetProperty(thread_, errorObject, nameKey).GetValue()); + ASSERT_EQ(reinterpret_cast( + ecmascript::JSTaggedValue(*factory->NewFromCanBeCompressString("ReferenceError")).GetRawData()) + ->Compare(reinterpret_cast(nameValue->GetRawData())), +@@ -486,19 +486,19 @@ TEST_F(BuiltinsErrorsTest, ReferenceErrorParameterConstructor) + */ + TEST_F(BuiltinsErrorsTest, ReferenceErrorNoParameterToString) + { +- ObjectFactory *factory = EcmaVM::Cast(instance)->GetFactory(); +- JSHandle env = EcmaVM::Cast(instance)->GetGlobalEnv(); ++ ObjectFactory *factory = EcmaVM::Cast(instance_)->GetFactory(); ++ JSHandle env = EcmaVM::Cast(instance_)->GetGlobalEnv(); + + JSHandle errorObject = env->GetReferenceErrorFunction(); + JSHandle error = factory->NewJSObjectByConstructor(JSHandle(errorObject), errorObject); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(JSTaggedValue(*error)); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = ReferenceError::ToString(ecmaRuntimeCallInfo.get()); +- JSHandle resultHandle(thread, reinterpret_cast(result.GetRawData())); ++ JSHandle resultHandle(thread_, reinterpret_cast(result.GetRawData())); + EXPECT_TRUE(result.IsString()); + EXPECT_EQ(reinterpret_cast( + ecmascript::JSTaggedValue(*factory->NewFromCanBeCompressString("ReferenceError")).GetRawData()) +@@ -513,23 +513,23 @@ TEST_F(BuiltinsErrorsTest, ReferenceErrorNoParameterToString) + */ + TEST_F(BuiltinsErrorsTest, ReferenceErrorToString) + { +- ObjectFactory *factory = EcmaVM::Cast(instance)->GetFactory(); +- JSHandle env = EcmaVM::Cast(instance)->GetGlobalEnv(); ++ ObjectFactory *factory = EcmaVM::Cast(instance_)->GetFactory(); ++ JSHandle env = EcmaVM::Cast(instance_)->GetGlobalEnv(); + + JSHandle errorObject = env->GetReferenceErrorFunction(); + JSHandle error = factory->NewJSObjectByConstructor(JSHandle(errorObject), errorObject); + + JSHandle handleMsgKey(factory->NewFromCanBeCompressString("message")); +- JSObject::SetProperty(thread, JSHandle(error), handleMsgKey, ++ JSObject::SetProperty(thread_, JSHandle(error), handleMsgKey, + JSHandle(factory->NewFromCanBeCompressString("This is ReferenceError!"))); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(JSTaggedValue(*error)); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = ReferenceError::ToString(ecmaRuntimeCallInfo.get()); +- JSHandle resultHandle(thread, reinterpret_cast(result.GetRawData())); ++ JSHandle resultHandle(thread_, reinterpret_cast(result.GetRawData())); + EXPECT_TRUE(result.IsString()); + EXPECT_EQ(factory->NewFromCanBeCompressString("ReferenceError: This is ReferenceError!")->Compare(*resultHandle), + 0); +@@ -542,30 +542,30 @@ TEST_F(BuiltinsErrorsTest, ReferenceErrorToString) + */ + TEST_F(BuiltinsErrorsTest, TypeErrorNoParameterConstructor) + { +- ObjectFactory *factory = EcmaVM::Cast(instance)->GetFactory(); +- JSHandle env = EcmaVM::Cast(instance)->GetGlobalEnv(); ++ ObjectFactory *factory = EcmaVM::Cast(instance_)->GetFactory(); ++ JSHandle env = EcmaVM::Cast(instance_)->GetGlobalEnv(); + + JSHandle error(env->GetTypeErrorFunction()); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue(*error), 4); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue(*error), 4); + ecmaRuntimeCallInfo->SetFunction(error.GetTaggedValue()); + ecmaRuntimeCallInfo->SetThis(JSTaggedValue(*error)); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = TypeError::TypeErrorConstructor(ecmaRuntimeCallInfo.get()); + EXPECT_TRUE(result.IsECMAObject()); + +- JSHandle errorObject(thread, reinterpret_cast(result.GetRawData())); ++ JSHandle errorObject(thread_, reinterpret_cast(result.GetRawData())); + JSHandle msgKey(factory->NewFromCanBeCompressString("message")); +- JSHandle nameKey = thread->GlobalConstants()->GetHandledNameString(); ++ JSHandle nameKey = thread_->GlobalConstants()->GetHandledNameString(); + +- JSHandle msgValue(JSObject::GetProperty(thread, errorObject, msgKey).GetValue()); ++ JSHandle msgValue(JSObject::GetProperty(thread_, errorObject, msgKey).GetValue()); + ASSERT_EQ( + reinterpret_cast(ecmascript::JSTaggedValue(*factory->NewFromCanBeCompressString("")).GetRawData()) + ->Compare(reinterpret_cast(msgValue->GetRawData())), + 0); + +- JSHandle nameValue(JSObject::GetProperty(thread, errorObject, nameKey).GetValue()); ++ JSHandle nameValue(JSObject::GetProperty(thread_, errorObject, nameKey).GetValue()); + EXPECT_EQ(reinterpret_cast(JSTaggedValue(nameValue.GetTaggedValue()).GetRawData()) + ->Compare(reinterpret_cast(JSTaggedValue(nameValue.GetTaggedValue()).GetRawData())), + 0); +@@ -578,32 +578,32 @@ TEST_F(BuiltinsErrorsTest, TypeErrorNoParameterConstructor) + */ + TEST_F(BuiltinsErrorsTest, TypeErrorParameterConstructor) + { +- ObjectFactory *factory = EcmaVM::Cast(instance)->GetFactory(); +- JSHandle env = EcmaVM::Cast(instance)->GetGlobalEnv(); ++ ObjectFactory *factory = EcmaVM::Cast(instance_)->GetFactory(); ++ JSHandle env = EcmaVM::Cast(instance_)->GetGlobalEnv(); + + JSHandle error(env->GetTypeErrorFunction()); + JSHandle paramMsg(factory->NewFromCanBeCompressString("Hello TypeError!")); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue(*error), 6); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue(*error), 6); + ecmaRuntimeCallInfo->SetFunction(error.GetTaggedValue()); + ecmaRuntimeCallInfo->SetThis(JSTaggedValue(*error)); + ecmaRuntimeCallInfo->SetCallArg(0, paramMsg.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = TypeError::TypeErrorConstructor(ecmaRuntimeCallInfo.get()); + EXPECT_TRUE(result.IsECMAObject()); + +- JSHandle errorObject(thread, reinterpret_cast(result.GetRawData())); ++ JSHandle errorObject(thread_, reinterpret_cast(result.GetRawData())); + JSHandle msgKey(factory->NewFromCanBeCompressString("message")); +- JSHandle nameKey = thread->GlobalConstants()->GetHandledNameString(); ++ JSHandle nameKey = thread_->GlobalConstants()->GetHandledNameString(); + +- JSHandle msgValue(JSObject::GetProperty(thread, errorObject, msgKey).GetValue()); ++ JSHandle msgValue(JSObject::GetProperty(thread_, errorObject, msgKey).GetValue()); + ASSERT_EQ(reinterpret_cast( + ecmascript::JSTaggedValue(*factory->NewFromCanBeCompressString("Hello TypeError!")).GetRawData()) + ->Compare(reinterpret_cast(msgValue->GetRawData())), + 0); + +- JSHandle nameValue(JSObject::GetProperty(thread, errorObject, nameKey).GetValue()); ++ JSHandle nameValue(JSObject::GetProperty(thread_, errorObject, nameKey).GetValue()); + ASSERT_EQ(reinterpret_cast( + ecmascript::JSTaggedValue(*factory->NewFromCanBeCompressString("TypeError")).GetRawData()) + ->Compare(reinterpret_cast(nameValue->GetRawData())), +@@ -617,19 +617,19 @@ TEST_F(BuiltinsErrorsTest, TypeErrorParameterConstructor) + */ + TEST_F(BuiltinsErrorsTest, TypeErrorNoParameterToString) + { +- ObjectFactory *factory = EcmaVM::Cast(instance)->GetFactory(); +- JSHandle env = EcmaVM::Cast(instance)->GetGlobalEnv(); ++ ObjectFactory *factory = EcmaVM::Cast(instance_)->GetFactory(); ++ JSHandle env = EcmaVM::Cast(instance_)->GetGlobalEnv(); + + JSHandle errorObject = env->GetTypeErrorFunction(); + JSHandle error = factory->NewJSObjectByConstructor(JSHandle(errorObject), errorObject); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(JSTaggedValue(*error)); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = TypeError::ToString(ecmaRuntimeCallInfo.get()); +- JSHandle resultHandle(thread, reinterpret_cast(result.GetRawData())); ++ JSHandle resultHandle(thread_, reinterpret_cast(result.GetRawData())); + EXPECT_TRUE(result.IsString()); + EXPECT_EQ(reinterpret_cast( + ecmascript::JSTaggedValue(*factory->NewFromCanBeCompressString("TypeError")).GetRawData()) +@@ -644,23 +644,23 @@ TEST_F(BuiltinsErrorsTest, TypeErrorNoParameterToString) + */ + TEST_F(BuiltinsErrorsTest, TypeErrorToString) + { +- ObjectFactory *factory = EcmaVM::Cast(instance)->GetFactory(); +- JSHandle env = EcmaVM::Cast(instance)->GetGlobalEnv(); ++ ObjectFactory *factory = EcmaVM::Cast(instance_)->GetFactory(); ++ JSHandle env = EcmaVM::Cast(instance_)->GetGlobalEnv(); + + JSHandle errorObject = env->GetTypeErrorFunction(); + JSHandle error = factory->NewJSObjectByConstructor(JSHandle(errorObject), errorObject); + + JSHandle value(factory->NewFromCanBeCompressString("This is TypeError!")); + JSHandle handleMsgKey(factory->NewFromCanBeCompressString("message")); +- JSObject::SetProperty(thread, JSHandle(error), handleMsgKey, value); ++ JSObject::SetProperty(thread_, JSHandle(error), handleMsgKey, value); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(JSTaggedValue(*error)); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = TypeError::ToString(ecmaRuntimeCallInfo.get()); +- JSHandle resultHandle(thread, reinterpret_cast(result.GetRawData())); ++ JSHandle resultHandle(thread_, reinterpret_cast(result.GetRawData())); + EXPECT_TRUE(result.IsString()); + EXPECT_EQ(factory->NewFromCanBeCompressString("TypeError: This is TypeError!")->Compare(*resultHandle), 0); + } +@@ -672,30 +672,30 @@ TEST_F(BuiltinsErrorsTest, TypeErrorToString) + */ + TEST_F(BuiltinsErrorsTest, URIErrorNoParameterConstructor) + { +- ObjectFactory *factory = EcmaVM::Cast(instance)->GetFactory(); +- JSHandle env = EcmaVM::Cast(instance)->GetGlobalEnv(); ++ ObjectFactory *factory = EcmaVM::Cast(instance_)->GetFactory(); ++ JSHandle env = EcmaVM::Cast(instance_)->GetGlobalEnv(); + + JSHandle error(env->GetURIErrorFunction()); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue(*error), 4); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue(*error), 4); + ecmaRuntimeCallInfo->SetFunction(error.GetTaggedValue()); + ecmaRuntimeCallInfo->SetThis(JSTaggedValue(*error)); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = URIError::URIErrorConstructor(ecmaRuntimeCallInfo.get()); + EXPECT_TRUE(result.IsECMAObject()); + +- JSHandle errorObject(thread, reinterpret_cast(result.GetRawData())); ++ JSHandle errorObject(thread_, reinterpret_cast(result.GetRawData())); + JSHandle msgKey(factory->NewFromCanBeCompressString("message")); +- JSHandle nameKey = thread->GlobalConstants()->GetHandledNameString(); ++ JSHandle nameKey = thread_->GlobalConstants()->GetHandledNameString(); + +- JSHandle msgValue(JSObject::GetProperty(thread, errorObject, msgKey).GetValue()); ++ JSHandle msgValue(JSObject::GetProperty(thread_, errorObject, msgKey).GetValue()); + ASSERT_EQ( + reinterpret_cast(ecmascript::JSTaggedValue(*factory->NewFromCanBeCompressString("")).GetRawData()) + ->Compare(reinterpret_cast(msgValue->GetRawData())), + 0); + +- JSHandle nameValue(JSObject::GetProperty(thread, errorObject, nameKey).GetValue()); ++ JSHandle nameValue(JSObject::GetProperty(thread_, errorObject, nameKey).GetValue()); + ASSERT_EQ(reinterpret_cast( + ecmascript::JSTaggedValue(*factory->NewFromCanBeCompressString("URIError")).GetRawData()) + ->Compare(reinterpret_cast(nameValue->GetRawData())), +@@ -709,32 +709,32 @@ TEST_F(BuiltinsErrorsTest, URIErrorNoParameterConstructor) + */ + TEST_F(BuiltinsErrorsTest, URIErrorParameterConstructor) + { +- ObjectFactory *factory = EcmaVM::Cast(instance)->GetFactory(); +- JSHandle env = EcmaVM::Cast(instance)->GetGlobalEnv(); ++ ObjectFactory *factory = EcmaVM::Cast(instance_)->GetFactory(); ++ JSHandle env = EcmaVM::Cast(instance_)->GetGlobalEnv(); + + JSHandle error(env->GetURIErrorFunction()); + JSHandle paramMsg(factory->NewFromCanBeCompressString("Hello URIError!")); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue(*error), 6); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue(*error), 6); + ecmaRuntimeCallInfo->SetFunction(error.GetTaggedValue()); + ecmaRuntimeCallInfo->SetThis(JSTaggedValue(*error)); + ecmaRuntimeCallInfo->SetCallArg(0, paramMsg.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = URIError::URIErrorConstructor(ecmaRuntimeCallInfo.get()); + EXPECT_TRUE(result.IsECMAObject()); + +- JSHandle errorObject(thread, reinterpret_cast(result.GetRawData())); ++ JSHandle errorObject(thread_, reinterpret_cast(result.GetRawData())); + JSHandle msgKey(factory->NewFromCanBeCompressString("message")); +- JSHandle nameKey = thread->GlobalConstants()->GetHandledNameString(); ++ JSHandle nameKey = thread_->GlobalConstants()->GetHandledNameString(); + +- JSHandle msgValue(JSObject::GetProperty(thread, errorObject, msgKey).GetValue()); ++ JSHandle msgValue(JSObject::GetProperty(thread_, errorObject, msgKey).GetValue()); + ASSERT_EQ(reinterpret_cast( + ecmascript::JSTaggedValue(*factory->NewFromCanBeCompressString("Hello URIError!")).GetRawData()) + ->Compare(reinterpret_cast(msgValue->GetRawData())), + 0); + +- JSHandle nameValue(JSObject::GetProperty(thread, errorObject, nameKey).GetValue()); ++ JSHandle nameValue(JSObject::GetProperty(thread_, errorObject, nameKey).GetValue()); + ASSERT_EQ(reinterpret_cast( + ecmascript::JSTaggedValue(*factory->NewFromCanBeCompressString("URIError")).GetRawData()) + ->Compare(reinterpret_cast(nameValue->GetRawData())), +@@ -748,19 +748,19 @@ TEST_F(BuiltinsErrorsTest, URIErrorParameterConstructor) + */ + TEST_F(BuiltinsErrorsTest, URIErrorNoParameterToString) + { +- ObjectFactory *factory = EcmaVM::Cast(instance)->GetFactory(); +- JSHandle env = EcmaVM::Cast(instance)->GetGlobalEnv(); ++ ObjectFactory *factory = EcmaVM::Cast(instance_)->GetFactory(); ++ JSHandle env = EcmaVM::Cast(instance_)->GetGlobalEnv(); + + JSHandle errorObject = env->GetURIErrorFunction(); + JSHandle error = factory->NewJSObjectByConstructor(JSHandle(errorObject), errorObject); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(JSTaggedValue(*error)); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = URIError::ToString(ecmaRuntimeCallInfo.get()); +- JSHandle resultHandle(thread, reinterpret_cast(result.GetRawData())); ++ JSHandle resultHandle(thread_, reinterpret_cast(result.GetRawData())); + EXPECT_TRUE(result.IsString()); + + EXPECT_EQ(reinterpret_cast( +@@ -776,24 +776,24 @@ TEST_F(BuiltinsErrorsTest, URIErrorNoParameterToString) + */ + TEST_F(BuiltinsErrorsTest, URIErrorToString) + { +- ObjectFactory *factory = EcmaVM::Cast(instance)->GetFactory(); +- JSHandle env = EcmaVM::Cast(instance)->GetGlobalEnv(); ++ ObjectFactory *factory = EcmaVM::Cast(instance_)->GetFactory(); ++ JSHandle env = EcmaVM::Cast(instance_)->GetGlobalEnv(); + + JSHandle errorObject = env->GetURIErrorFunction(); + JSHandle error = factory->NewJSObjectByConstructor(JSHandle(errorObject), errorObject); + + JSHandle handleMsgKey(factory->NewFromCanBeCompressString("message")); + JSObject::SetProperty( +- thread, JSHandle(error), handleMsgKey, +- JSHandle(thread, factory->NewFromCanBeCompressString("This is URIError!").GetTaggedValue())); ++ thread_, JSHandle(error), handleMsgKey, ++ JSHandle(thread_, factory->NewFromCanBeCompressString("This is URIError!").GetTaggedValue())); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(JSTaggedValue(*error)); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = URIError::ToString(ecmaRuntimeCallInfo.get()); +- JSHandle resultHandle(thread, reinterpret_cast(result.GetRawData())); ++ JSHandle resultHandle(thread_, reinterpret_cast(result.GetRawData())); + EXPECT_TRUE(result.IsString()); + + EXPECT_EQ( +@@ -810,30 +810,30 @@ TEST_F(BuiltinsErrorsTest, URIErrorToString) + */ + TEST_F(BuiltinsErrorsTest, SyntaxErrorNoParameterConstructor) + { +- ObjectFactory *factory = EcmaVM::Cast(instance)->GetFactory(); +- JSHandle env = EcmaVM::Cast(instance)->GetGlobalEnv(); ++ ObjectFactory *factory = EcmaVM::Cast(instance_)->GetFactory(); ++ JSHandle env = EcmaVM::Cast(instance_)->GetGlobalEnv(); + + JSHandle error(env->GetSyntaxErrorFunction()); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue(*error), 4); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue(*error), 4); + ecmaRuntimeCallInfo->SetFunction(error.GetTaggedValue()); + ecmaRuntimeCallInfo->SetThis(JSTaggedValue(*error)); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = SyntaxError::SyntaxErrorConstructor(ecmaRuntimeCallInfo.get()); + EXPECT_TRUE(result.IsECMAObject()); + +- JSHandle errorObject(thread, reinterpret_cast(result.GetRawData())); ++ JSHandle errorObject(thread_, reinterpret_cast(result.GetRawData())); + JSHandle msgKey(factory->NewFromCanBeCompressString("message")); +- JSHandle nameKey = thread->GlobalConstants()->GetHandledNameString(); ++ JSHandle nameKey = thread_->GlobalConstants()->GetHandledNameString(); + +- JSHandle msgValue(JSObject::GetProperty(thread, errorObject, msgKey).GetValue()); ++ JSHandle msgValue(JSObject::GetProperty(thread_, errorObject, msgKey).GetValue()); + ASSERT_EQ( + reinterpret_cast(ecmascript::JSTaggedValue(*factory->NewFromCanBeCompressString("")).GetRawData()) + ->Compare(reinterpret_cast(msgValue->GetRawData())), + 0); + +- JSHandle nameValue(JSObject::GetProperty(thread, errorObject, nameKey).GetValue()); ++ JSHandle nameValue(JSObject::GetProperty(thread_, errorObject, nameKey).GetValue()); + ASSERT_EQ(reinterpret_cast( + ecmascript::JSTaggedValue(*factory->NewFromCanBeCompressString("SyntaxError")).GetRawData()) + ->Compare(reinterpret_cast(nameValue->GetRawData())), +@@ -847,32 +847,32 @@ TEST_F(BuiltinsErrorsTest, SyntaxErrorNoParameterConstructor) + */ + TEST_F(BuiltinsErrorsTest, SyntaxErrorParameterConstructor) + { +- ObjectFactory *factory = EcmaVM::Cast(instance)->GetFactory(); +- JSHandle env = EcmaVM::Cast(instance)->GetGlobalEnv(); ++ ObjectFactory *factory = EcmaVM::Cast(instance_)->GetFactory(); ++ JSHandle env = EcmaVM::Cast(instance_)->GetGlobalEnv(); + + JSHandle error(env->GetSyntaxErrorFunction()); + JSHandle paramMsg(factory->NewFromCanBeCompressString("Hello SyntaxError!")); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue(*error), 6); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue(*error), 6); + ecmaRuntimeCallInfo->SetFunction(error.GetTaggedValue()); + ecmaRuntimeCallInfo->SetThis(JSTaggedValue(*error)); + ecmaRuntimeCallInfo->SetCallArg(0, paramMsg.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = SyntaxError::SyntaxErrorConstructor(ecmaRuntimeCallInfo.get()); + EXPECT_TRUE(result.IsECMAObject()); + +- JSHandle errorObject(thread, reinterpret_cast(result.GetRawData())); ++ JSHandle errorObject(thread_, reinterpret_cast(result.GetRawData())); + JSHandle msgKey(factory->NewFromCanBeCompressString("message")); +- JSHandle nameKey = thread->GlobalConstants()->GetHandledNameString(); ++ JSHandle nameKey = thread_->GlobalConstants()->GetHandledNameString(); + +- JSHandle msgValue(JSObject::GetProperty(thread, errorObject, msgKey).GetValue()); ++ JSHandle msgValue(JSObject::GetProperty(thread_, errorObject, msgKey).GetValue()); + ASSERT_EQ(reinterpret_cast( + ecmascript::JSTaggedValue(*factory->NewFromCanBeCompressString("Hello SyntaxError!")).GetRawData()) + ->Compare(reinterpret_cast(msgValue->GetRawData())), + 0); + +- JSHandle nameValue(JSObject::GetProperty(thread, errorObject, nameKey).GetValue()); ++ JSHandle nameValue(JSObject::GetProperty(thread_, errorObject, nameKey).GetValue()); + ASSERT_EQ(reinterpret_cast( + ecmascript::JSTaggedValue(*factory->NewFromCanBeCompressString("SyntaxError")).GetRawData()) + ->Compare(reinterpret_cast(nameValue->GetRawData())), +@@ -886,19 +886,19 @@ TEST_F(BuiltinsErrorsTest, SyntaxErrorParameterConstructor) + */ + TEST_F(BuiltinsErrorsTest, SyntaxErrorNoParameterToString) + { +- ObjectFactory *factory = EcmaVM::Cast(instance)->GetFactory(); +- JSHandle env = EcmaVM::Cast(instance)->GetGlobalEnv(); ++ ObjectFactory *factory = EcmaVM::Cast(instance_)->GetFactory(); ++ JSHandle env = EcmaVM::Cast(instance_)->GetGlobalEnv(); + + JSHandle errorObject = env->GetSyntaxErrorFunction(); + JSHandle error = factory->NewJSObjectByConstructor(JSHandle(errorObject), errorObject); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(JSTaggedValue(*error)); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = SyntaxError::ToString(ecmaRuntimeCallInfo.get()); +- JSHandle resultHandle(thread, reinterpret_cast(result.GetRawData())); ++ JSHandle resultHandle(thread_, reinterpret_cast(result.GetRawData())); + EXPECT_TRUE(result.IsString()); + + EXPECT_EQ(reinterpret_cast( +@@ -914,23 +914,23 @@ TEST_F(BuiltinsErrorsTest, SyntaxErrorNoParameterToString) + */ + TEST_F(BuiltinsErrorsTest, SyntaxErrorToString) + { +- ObjectFactory *factory = EcmaVM::Cast(instance)->GetFactory(); +- JSHandle env = EcmaVM::Cast(instance)->GetGlobalEnv(); ++ ObjectFactory *factory = EcmaVM::Cast(instance_)->GetFactory(); ++ JSHandle env = EcmaVM::Cast(instance_)->GetGlobalEnv(); + + JSHandle errorObject = env->GetSyntaxErrorFunction(); + JSHandle error = factory->NewJSObjectByConstructor(JSHandle(errorObject), errorObject); + + JSHandle handleMsgKey(factory->NewFromCanBeCompressString("message")); +- JSObject::SetProperty(thread, JSHandle(error), handleMsgKey, ++ JSObject::SetProperty(thread_, JSHandle(error), handleMsgKey, + JSHandle(factory->NewFromCanBeCompressString("This is SyntaxError!"))); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(JSTaggedValue(*error)); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = SyntaxError::ToString(ecmaRuntimeCallInfo.get()); +- JSHandle resultHandle(thread, reinterpret_cast(result.GetRawData())); ++ JSHandle resultHandle(thread_, reinterpret_cast(result.GetRawData())); + EXPECT_TRUE(result.IsString()); + + EXPECT_EQ(factory->NewFromCanBeCompressString("SyntaxError: This is SyntaxError!")->Compare(*resultHandle), 0); +@@ -943,30 +943,30 @@ TEST_F(BuiltinsErrorsTest, SyntaxErrorToString) + */ + TEST_F(BuiltinsErrorsTest, EvalErrorNoParameterConstructor) + { +- ObjectFactory *factory = EcmaVM::Cast(instance)->GetFactory(); +- JSHandle env = EcmaVM::Cast(instance)->GetGlobalEnv(); ++ ObjectFactory *factory = EcmaVM::Cast(instance_)->GetFactory(); ++ JSHandle env = EcmaVM::Cast(instance_)->GetGlobalEnv(); + + JSHandle error(env->GetEvalErrorFunction()); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue(*error), 4); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue(*error), 4); + ecmaRuntimeCallInfo->SetFunction(error.GetTaggedValue()); + ecmaRuntimeCallInfo->SetThis(JSTaggedValue(*error)); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = EvalError::EvalErrorConstructor(ecmaRuntimeCallInfo.get()); + EXPECT_TRUE(result.IsECMAObject()); + +- JSHandle errorObject(thread, reinterpret_cast(result.GetRawData())); ++ JSHandle errorObject(thread_, reinterpret_cast(result.GetRawData())); + JSHandle msgKey(factory->NewFromCanBeCompressString("message")); +- JSHandle nameKey = thread->GlobalConstants()->GetHandledNameString(); ++ JSHandle nameKey = thread_->GlobalConstants()->GetHandledNameString(); + +- JSHandle msgValue(JSObject::GetProperty(thread, errorObject, msgKey).GetValue()); ++ JSHandle msgValue(JSObject::GetProperty(thread_, errorObject, msgKey).GetValue()); + ASSERT_EQ( + reinterpret_cast(ecmascript::JSTaggedValue(*factory->NewFromCanBeCompressString("")).GetRawData()) + ->Compare(reinterpret_cast(msgValue->GetRawData())), + 0); + +- JSHandle nameValue(JSObject::GetProperty(thread, errorObject, nameKey).GetValue()); ++ JSHandle nameValue(JSObject::GetProperty(thread_, errorObject, nameKey).GetValue()); + ASSERT_EQ(reinterpret_cast( + ecmascript::JSTaggedValue(*factory->NewFromCanBeCompressString("EvalError")).GetRawData()) + ->Compare(reinterpret_cast(nameValue->GetRawData())), +@@ -980,32 +980,32 @@ TEST_F(BuiltinsErrorsTest, EvalErrorNoParameterConstructor) + */ + TEST_F(BuiltinsErrorsTest, EvalErrorParameterConstructor) + { +- ObjectFactory *factory = EcmaVM::Cast(instance)->GetFactory(); +- JSHandle env = EcmaVM::Cast(instance)->GetGlobalEnv(); ++ ObjectFactory *factory = EcmaVM::Cast(instance_)->GetFactory(); ++ JSHandle env = EcmaVM::Cast(instance_)->GetGlobalEnv(); + + JSHandle error(env->GetEvalErrorFunction()); + JSHandle paramMsg(factory->NewFromCanBeCompressString("Hello EvalError!")); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue(*error), 6); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue(*error), 6); + ecmaRuntimeCallInfo->SetFunction(error.GetTaggedValue()); + ecmaRuntimeCallInfo->SetThis(JSTaggedValue(*error)); + ecmaRuntimeCallInfo->SetCallArg(0, paramMsg.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = EvalError::EvalErrorConstructor(ecmaRuntimeCallInfo.get()); + EXPECT_TRUE(result.IsECMAObject()); + +- JSHandle errorObject(thread, reinterpret_cast(result.GetRawData())); ++ JSHandle errorObject(thread_, reinterpret_cast(result.GetRawData())); + JSHandle msgKey(factory->NewFromCanBeCompressString("message")); +- JSHandle nameKey = thread->GlobalConstants()->GetHandledNameString(); ++ JSHandle nameKey = thread_->GlobalConstants()->GetHandledNameString(); + +- JSHandle msgValue(JSObject::GetProperty(thread, errorObject, msgKey).GetValue()); ++ JSHandle msgValue(JSObject::GetProperty(thread_, errorObject, msgKey).GetValue()); + ASSERT_EQ(reinterpret_cast( + ecmascript::JSTaggedValue(*factory->NewFromCanBeCompressString("Hello EvalError!")).GetRawData()) + ->Compare(reinterpret_cast(msgValue->GetRawData())), + 0); + +- JSHandle nameValue(JSObject::GetProperty(thread, errorObject, nameKey).GetValue()); ++ JSHandle nameValue(JSObject::GetProperty(thread_, errorObject, nameKey).GetValue()); + ASSERT_EQ(reinterpret_cast( + ecmascript::JSTaggedValue(*factory->NewFromCanBeCompressString("EvalError")).GetRawData()) + ->Compare(reinterpret_cast(nameValue->GetRawData())), +@@ -1019,18 +1019,18 @@ TEST_F(BuiltinsErrorsTest, EvalErrorParameterConstructor) + */ + TEST_F(BuiltinsErrorsTest, EvalErrorNoParameterToString) + { +- ObjectFactory *factory = EcmaVM::Cast(instance)->GetFactory(); +- JSHandle env = EcmaVM::Cast(instance)->GetGlobalEnv(); ++ ObjectFactory *factory = EcmaVM::Cast(instance_)->GetFactory(); ++ JSHandle env = EcmaVM::Cast(instance_)->GetGlobalEnv(); + JSHandle errorObject = env->GetEvalErrorFunction(); + JSHandle error = factory->NewJSObjectByConstructor(JSHandle(errorObject), errorObject); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(JSTaggedValue(*error)); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = EvalError::ToString(ecmaRuntimeCallInfo.get()); +- JSHandle resultHandle(thread, reinterpret_cast(result.GetRawData())); ++ JSHandle resultHandle(thread_, reinterpret_cast(result.GetRawData())); + EXPECT_TRUE(result.IsString()); + EXPECT_EQ(reinterpret_cast( + ecmascript::JSTaggedValue(*factory->NewFromCanBeCompressString("EvalError")).GetRawData()) +@@ -1045,24 +1045,24 @@ TEST_F(BuiltinsErrorsTest, EvalErrorNoParameterToString) + */ + TEST_F(BuiltinsErrorsTest, EvalErrorToString) + { +- ObjectFactory *factory = EcmaVM::Cast(instance)->GetFactory(); +- JSHandle env = EcmaVM::Cast(instance)->GetGlobalEnv(); ++ ObjectFactory *factory = EcmaVM::Cast(instance_)->GetFactory(); ++ JSHandle env = EcmaVM::Cast(instance_)->GetGlobalEnv(); + + JSHandle errorObject = env->GetEvalErrorFunction(); + JSHandle error = factory->NewJSObjectByConstructor(JSHandle(errorObject), errorObject); + + JSHandle handleMsgKey(factory->NewFromCanBeCompressString("message")); + JSObject::SetProperty( +- thread, JSHandle(error), handleMsgKey, +- JSHandle(thread, factory->NewFromCanBeCompressString("This is EvalError!").GetTaggedValue())); ++ thread_, JSHandle(error), handleMsgKey, ++ JSHandle(thread_, factory->NewFromCanBeCompressString("This is EvalError!").GetTaggedValue())); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(JSTaggedValue(*error)); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = EvalError::ToString(ecmaRuntimeCallInfo.get()); +- JSHandle resultHandle(thread, reinterpret_cast(result.GetRawData())); ++ JSHandle resultHandle(thread_, reinterpret_cast(result.GetRawData())); + EXPECT_TRUE(result.IsString()); + EXPECT_EQ(factory->NewFromCanBeCompressString("EvalError: This is EvalError!")->Compare(*resultHandle), 0); + } +diff --git a/tests/runtime/builtins/builtins_function_test.cpp b/tests/runtime/builtins/builtins_function_test.cpp +index 14a9bfc..a7c8cab 100644 +--- a/tests/runtime/builtins/builtins_function_test.cpp ++++ b/tests/runtime/builtins/builtins_function_test.cpp +@@ -48,17 +48,17 @@ public: + + void SetUp() override + { +- TestHelper::CreateEcmaVMWithScope(instance, thread, scope); ++ TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); + } + + void TearDown() override + { +- TestHelper::DestroyEcmaVMWithScope(instance, scope); ++ TestHelper::DestroyEcmaVMWithScope(instance_, scope_); + } + +- PandaVM *instance {nullptr}; +- EcmaHandleScope *scope {nullptr}; +- JSThread *thread {nullptr}; ++ PandaVM *instance_ {nullptr}; ++ EcmaHandleScope *scope_ {nullptr}; ++ JSThread *thread_ {nullptr}; + }; + + // native function for test apply and call +@@ -91,162 +91,162 @@ JSTaggedValue TestFunctionApplyAndCall(EcmaRuntimeCallInfo *argv) + // func.apply(thisArg) + TEST_F(BuiltinsFunctionTest, FunctionPrototypeApply) + { +- JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); ++ JSHandle env = thread_->GetEcmaVM()->GetGlobalEnv(); + +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + // ecma 19.2.3.1: func + JSHandle func = factory->NewJSFunction(env, reinterpret_cast(TestFunctionApplyAndCall)); + + // ecma 19.2.3.1: thisArg +- JSHandle thisArg(thread, env->GetGlobalObject()); +- JSObject::SetProperty(thread, JSHandle(thisArg), ++ JSHandle thisArg(thread_, env->GetGlobalObject()); ++ JSObject::SetProperty(thread_, JSHandle(thisArg), + JSHandle(factory->NewFromCanBeCompressString("test_builtins_function_a")), +- JSHandle(thread, JSTaggedValue(1))); +- JSObject::SetProperty(thread, JSHandle(thisArg), ++ JSHandle(thread_, JSTaggedValue(1))); ++ JSObject::SetProperty(thread_, JSHandle(thisArg), + JSHandle(factory->NewFromCanBeCompressString("test_builtins_function_b")), +- JSHandle(thread, JSTaggedValue(2))); ++ JSHandle(thread_, JSTaggedValue(2))); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(func.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, (thisArg.GetTaggedValue())); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsFunction::FunctionPrototypeApply(ecmaRuntimeCallInfo.get()); + + ASSERT_EQ(result.GetRawData(), JSTaggedValue(3).GetRawData()); + +- JSObject::DeleteProperty(thread, (thisArg), ++ JSObject::DeleteProperty(thread_, (thisArg), + JSHandle(factory->NewFromCanBeCompressString("test_builtins_function_a"))); +- JSObject::DeleteProperty(thread, (thisArg), ++ JSObject::DeleteProperty(thread_, (thisArg), + JSHandle(factory->NewFromCanBeCompressString("test_builtins_function_b"))); + } + + // func.apply(thisArg, argArray) + TEST_F(BuiltinsFunctionTest, FunctionPrototypeApply1) + { +- JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); ++ JSHandle env = thread_->GetEcmaVM()->GetGlobalEnv(); + +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + + // ecma 19.2.3.1: func + JSHandle func = factory->NewJSFunction(env, reinterpret_cast(TestFunctionApplyAndCall)); + + // ecma 19.2.3.1: thisArg +- JSHandle thisArg(thread, env->GetGlobalObject()); +- JSObject::SetProperty(thread, JSHandle(thisArg), ++ JSHandle thisArg(thread_, env->GetGlobalObject()); ++ JSObject::SetProperty(thread_, JSHandle(thisArg), + JSHandle(factory->NewFromCanBeCompressString("test_builtins_function_a")), +- JSHandle(thread, JSTaggedValue(10))); +- JSObject::SetProperty(thread, JSHandle(thisArg), ++ JSHandle(thread_, JSTaggedValue(10))); ++ JSObject::SetProperty(thread_, JSHandle(thisArg), + JSHandle(factory->NewFromCanBeCompressString("test_builtins_function_b")), +- JSHandle(thread, JSTaggedValue(20))); ++ JSHandle(thread_, JSTaggedValue(20))); + + // ecma 19.2.3.1: argArray +- JSHandle array(JSArray::ArrayCreate(thread, JSTaggedNumber(2))); +- PropertyDescriptor desc(thread, JSHandle(thread, JSTaggedValue(30))); +- JSArray::DefineOwnProperty(thread, array, JSHandle(thread, JSTaggedValue(0)), desc); ++ JSHandle array(JSArray::ArrayCreate(thread_, JSTaggedNumber(2))); ++ PropertyDescriptor desc(thread_, JSHandle(thread_, JSTaggedValue(30))); ++ JSArray::DefineOwnProperty(thread_, array, JSHandle(thread_, JSTaggedValue(0)), desc); + +- PropertyDescriptor desc1(thread, JSHandle(thread, JSTaggedValue(40))); +- JSArray::DefineOwnProperty(thread, array, JSHandle(thread, JSTaggedValue(1)), desc1); ++ PropertyDescriptor desc1(thread_, JSHandle(thread_, JSTaggedValue(40))); ++ JSArray::DefineOwnProperty(thread_, array, JSHandle(thread_, JSTaggedValue(1)), desc1); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(func.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, (thisArg.GetTaggedValue())); + ecmaRuntimeCallInfo->SetCallArg(1, array.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsFunction::FunctionPrototypeApply(ecmaRuntimeCallInfo.get()); + + ASSERT_EQ(result.GetRawData(), JSTaggedValue(100).GetRawData()); + +- JSObject::DeleteProperty(thread, (thisArg), ++ JSObject::DeleteProperty(thread_, (thisArg), + JSHandle(factory->NewFromCanBeCompressString("test_builtins_function_a"))); +- JSObject::DeleteProperty(thread, (thisArg), ++ JSObject::DeleteProperty(thread_, (thisArg), + JSHandle(factory->NewFromCanBeCompressString("test_builtins_function_b"))); + } + + // target.bind(thisArg) + TEST_F(BuiltinsFunctionTest, FunctionPrototypeBind) + { +- JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); ++ JSHandle env = thread_->GetEcmaVM()->GetGlobalEnv(); + +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + + JSHandle target = factory->NewJSFunction(env); +- JSFunction::SetFunctionName(thread, JSHandle(target), ++ JSFunction::SetFunctionName(thread_, JSHandle(target), + JSHandle(factory->NewFromCanBeCompressString("target")), +- JSHandle(thread, JSTaggedValue::Undefined())); +- JSFunction::SetFunctionLength(thread, target, JSTaggedValue(2)); ++ JSHandle(thread_, JSTaggedValue::Undefined())); ++ JSFunction::SetFunctionLength(thread_, target, JSTaggedValue(2)); + +- JSHandle thisArg(thread, env->GetGlobalObject()); ++ JSHandle thisArg(thread_, env->GetGlobalObject()); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(target.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, (thisArg.GetTaggedValue())); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsFunction::FunctionPrototypeBind(ecmaRuntimeCallInfo.get()); + + ASSERT_TRUE(result.IsECMAObject()); + +- JSHandle resultFunc(thread, reinterpret_cast(result.GetRawData())); ++ JSHandle resultFunc(thread_, reinterpret_cast(result.GetRawData())); + // test BoundTarget + ASSERT_EQ(resultFunc->GetBoundTarget(), target.GetTaggedValue()); + // test BoundThis + ASSERT_EQ(resultFunc->GetBoundThis(), thisArg.GetTaggedValue()); + // test BoundArguments +- JSHandle array(thread, resultFunc->GetBoundArguments()); ++ JSHandle array(thread_, resultFunc->GetBoundArguments()); + ASSERT_EQ(array->GetLength(), 0); + // test name property +- auto globalConst = thread->GlobalConstants(); ++ auto globalConst = thread_->GlobalConstants(); + JSHandle nameKey = globalConst->GetHandledNameString(); +- JSHandle resultFuncHandle(thread, *resultFunc); +- JSHandle resultName(JSObject::GetProperty(thread, resultFuncHandle, nameKey).GetValue()); ++ JSHandle resultFuncHandle(thread_, *resultFunc); ++ JSHandle resultName(JSObject::GetProperty(thread_, resultFuncHandle, nameKey).GetValue()); + JSHandle boundTarget = factory->NewFromCanBeCompressString("bound target"); + ASSERT_EQ(resultName->Compare(*boundTarget), 0); + // test length property + JSHandle lengthKey = globalConst->GetHandledLengthString(); +- JSHandle resultLength(JSObject::GetProperty(thread, resultFuncHandle, lengthKey).GetValue()); +- ASSERT_EQ(JSTaggedValue::ToNumber(thread, resultLength).GetNumber(), 2.0); ++ JSHandle resultLength(JSObject::GetProperty(thread_, resultFuncHandle, lengthKey).GetValue()); ++ ASSERT_EQ(JSTaggedValue::ToNumber(thread_, resultLength).GetNumber(), 2.0); + } + + // target.bind(thisArg, 123, "helloworld") + TEST_F(BuiltinsFunctionTest, FunctionPrototypeBind1) + { +- JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); ++ JSHandle env = thread_->GetEcmaVM()->GetGlobalEnv(); + +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + + JSHandle target = factory->NewJSFunction(env); +- JSFunction::SetFunctionName(thread, JSHandle(target), ++ JSFunction::SetFunctionName(thread_, JSHandle(target), + JSHandle(factory->NewFromCanBeCompressString("target1")), +- JSHandle(thread, JSTaggedValue::Undefined())); +- JSFunction::SetFunctionLength(thread, target, JSTaggedValue(5)); ++ JSHandle(thread_, JSTaggedValue::Undefined())); ++ JSFunction::SetFunctionLength(thread_, target, JSTaggedValue(5)); + +- JSHandle thisArg(thread, env->GetGlobalObject()); ++ JSHandle thisArg(thread_, env->GetGlobalObject()); + JSHandle str = factory->NewFromCanBeCompressString("helloworld"); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 10); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 10); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(target.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, thisArg.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(static_cast(123))); + ecmaRuntimeCallInfo->SetCallArg(2, str.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsFunction::FunctionPrototypeBind(ecmaRuntimeCallInfo.get()); + + ASSERT_TRUE(result.IsECMAObject()); + +- JSHandle resultFunc(thread, reinterpret_cast(result.GetRawData())); ++ JSHandle resultFunc(thread_, reinterpret_cast(result.GetRawData())); + // test BoundTarget + ASSERT_EQ(resultFunc->GetBoundTarget(), target.GetTaggedValue()); + // test BoundThis + ASSERT_EQ(resultFunc->GetBoundThis(), thisArg.GetTaggedValue()); + // test BoundArguments +- JSHandle array(thread, resultFunc->GetBoundArguments()); ++ JSHandle array(thread_, resultFunc->GetBoundArguments()); + ASSERT_EQ(array->GetLength(), 2); + JSTaggedValue elem = array->Get(0); + JSTaggedValue elem1 = array->Get(1); +@@ -255,54 +255,54 @@ TEST_F(BuiltinsFunctionTest, FunctionPrototypeBind1) + ASSERT_EQ(elem1.GetRawData(), str.GetTaggedType()); + ASSERT_TRUE(elem1.IsString()); + // test name property +- auto globalConst = thread->GlobalConstants(); ++ auto globalConst = thread_->GlobalConstants(); + JSHandle nameKey = globalConst->GetHandledNameString(); +- JSHandle resultFuncHandle(thread, *resultFunc); +- JSHandle resultName(JSObject::GetProperty(thread, resultFuncHandle, nameKey).GetValue()); ++ JSHandle resultFuncHandle(thread_, *resultFunc); ++ JSHandle resultName(JSObject::GetProperty(thread_, resultFuncHandle, nameKey).GetValue()); + JSHandle rulerName = factory->NewFromCanBeCompressString("bound target1"); + ASSERT_EQ(resultName->Compare(*rulerName), 0); + // test length property + JSHandle lengthKey = globalConst->GetHandledLengthString(); +- JSHandle resultLength(JSObject::GetProperty(thread, resultFuncHandle, lengthKey).GetValue()); ++ JSHandle resultLength(JSObject::GetProperty(thread_, resultFuncHandle, lengthKey).GetValue()); + // target.length is 5, (...args) length is 2 +- ASSERT_EQ(JSTaggedValue::ToNumber(thread, resultLength).GetNumber(), 3.0); ++ ASSERT_EQ(JSTaggedValue::ToNumber(thread_, resultLength).GetNumber(), 3.0); + } + + // target.bind(thisArg, 123, "helloworld") set target_name = EmptyString() + TEST_F(BuiltinsFunctionTest, FunctionPrototypeBind2) + { +- JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); ++ JSHandle env = thread_->GetEcmaVM()->GetGlobalEnv(); + +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + + JSHandle target = factory->NewJSFunction(env); +- PropertyDescriptor nameDesc(thread, JSHandle(thread, JSTaggedValue(123)), false, false, true); +- JSTaggedValue::DefinePropertyOrThrow(thread, JSHandle(target), +- thread->GlobalConstants()->GetHandledNameString(), nameDesc); +- JSFunction::SetFunctionLength(thread, target, JSTaggedValue(5)); ++ PropertyDescriptor nameDesc(thread_, JSHandle(thread_, JSTaggedValue(123)), false, false, true); ++ JSTaggedValue::DefinePropertyOrThrow(thread_, JSHandle(target), ++ thread_->GlobalConstants()->GetHandledNameString(), nameDesc); ++ JSFunction::SetFunctionLength(thread_, target, JSTaggedValue(5)); + +- JSHandle thisArg(thread, env->GetGlobalObject()); ++ JSHandle thisArg(thread_, env->GetGlobalObject()); + JSHandle str = factory->NewFromCanBeCompressString("helloworld"); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 10); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 10); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(target.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, (thisArg.GetTaggedValue())); + ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(static_cast(123))); + ecmaRuntimeCallInfo->SetCallArg(2, str.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsFunction::FunctionPrototypeBind(ecmaRuntimeCallInfo.get()); + + ASSERT_TRUE(result.IsECMAObject()); + +- JSHandle resultFunc(thread, reinterpret_cast(result.GetRawData())); ++ JSHandle resultFunc(thread_, reinterpret_cast(result.GetRawData())); + // test BoundTarget + ASSERT_EQ(resultFunc->GetBoundTarget(), target.GetTaggedValue()); + // test BoundThis + ASSERT_EQ(resultFunc->GetBoundThis(), thisArg.GetTaggedValue()); + // test BoundArguments +- JSHandle array(thread, resultFunc->GetBoundArguments()); ++ JSHandle array(thread_, resultFunc->GetBoundArguments()); + ASSERT_EQ(array->GetLength(), 2); + JSTaggedValue elem = array->Get(0); + JSTaggedValue elem1 = array->Get(1); +@@ -311,75 +311,75 @@ TEST_F(BuiltinsFunctionTest, FunctionPrototypeBind2) + ASSERT_EQ(elem1.GetRawData(), str.GetTaggedType()); + ASSERT_TRUE(elem1.IsString()); + // test name property +- auto globalConst = thread->GlobalConstants(); ++ auto globalConst = thread_->GlobalConstants(); + JSHandle nameKey = globalConst->GetHandledNameString(); + JSHandle resultFuncHandle(resultFunc); +- JSHandle resultName(JSObject::GetProperty(thread, resultFuncHandle, nameKey).GetValue()); ++ JSHandle resultName(JSObject::GetProperty(thread_, resultFuncHandle, nameKey).GetValue()); + JSHandle rulerName = factory->NewFromCanBeCompressString("bound "); + ASSERT_EQ(resultName->Compare(*rulerName), 0); + // test length property + JSHandle lengthKey = globalConst->GetHandledLengthString(); +- JSHandle resultLength(JSObject::GetProperty(thread, resultFuncHandle, lengthKey).GetValue()); ++ JSHandle resultLength(JSObject::GetProperty(thread_, resultFuncHandle, lengthKey).GetValue()); + // target.length is 5, (...args) length is 2 +- ASSERT_EQ(JSTaggedValue::ToNumber(thread, resultLength).GetNumber(), 3.0); ++ ASSERT_EQ(JSTaggedValue::ToNumber(thread_, resultLength).GetNumber(), 3.0); + } + + // func.call(thisArg) + TEST_F(BuiltinsFunctionTest, FunctionPrototypeCall) + { +- JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); ++ JSHandle env = thread_->GetEcmaVM()->GetGlobalEnv(); + +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + + // ecma 19.2.3.3: func + JSHandle func = factory->NewJSFunction(env, reinterpret_cast(TestFunctionApplyAndCall)); + + // ecma 19.2.3.3: thisArg +- JSHandle thisArg(thread, env->GetGlobalObject()); +- JSObject::SetProperty(thread, JSHandle(thisArg), ++ JSHandle thisArg(thread_, env->GetGlobalObject()); ++ JSObject::SetProperty(thread_, JSHandle(thisArg), + JSHandle(factory->NewFromCanBeCompressString("test_builtins_function_a")), +- JSHandle(thread, JSTaggedValue(1))); +- JSObject::SetProperty(thread, JSHandle(thisArg), ++ JSHandle(thread_, JSTaggedValue(1))); ++ JSObject::SetProperty(thread_, JSHandle(thisArg), + JSHandle(factory->NewFromCanBeCompressString("test_builtins_function_b")), +- JSHandle(thread, JSTaggedValue(2))); ++ JSHandle(thread_, JSTaggedValue(2))); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(func.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, (thisArg.GetTaggedValue())); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsFunction::FunctionPrototypeCall(ecmaRuntimeCallInfo.get()); + + ASSERT_EQ(result.GetRawData(), JSTaggedValue(3).GetRawData()); + +- JSObject::DeleteProperty(thread, (thisArg), ++ JSObject::DeleteProperty(thread_, (thisArg), + JSHandle(factory->NewFromCanBeCompressString("test_builtins_function_a"))); +- JSObject::DeleteProperty(thread, (thisArg), ++ JSObject::DeleteProperty(thread_, (thisArg), + JSHandle(factory->NewFromCanBeCompressString("test_builtins_function_b"))); + } + + // func.call(thisArg, 123, 456, 789) + TEST_F(BuiltinsFunctionTest, FunctionPrototypeCall1) + { +- JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); ++ JSHandle env = thread_->GetEcmaVM()->GetGlobalEnv(); + +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + + // ecma 19.2.3.3: func + JSHandle func = factory->NewJSFunction(env, reinterpret_cast(TestFunctionApplyAndCall)); + + // ecma 19.2.3.3: thisArg +- JSHandle thisArg(thread, env->GetGlobalObject()); +- JSObject::SetProperty(thread, JSHandle(thisArg), ++ JSHandle thisArg(thread_, env->GetGlobalObject()); ++ JSObject::SetProperty(thread_, JSHandle(thisArg), + JSHandle(factory->NewFromCanBeCompressString("test_builtins_function_a")), +- JSHandle(thread, JSTaggedValue(1))); +- JSObject::SetProperty(thread, JSHandle(thisArg), ++ JSHandle(thread_, JSTaggedValue(1))); ++ JSObject::SetProperty(thread_, JSHandle(thisArg), + JSHandle(factory->NewFromCanBeCompressString("test_builtins_function_b")), +- JSHandle(thread, JSTaggedValue(2))); ++ JSHandle(thread_, JSTaggedValue(2))); + + // func thisArg ...args +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 12); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 12); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(func.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, (thisArg.GetTaggedValue())); +@@ -387,41 +387,41 @@ TEST_F(BuiltinsFunctionTest, FunctionPrototypeCall1) + ecmaRuntimeCallInfo->SetCallArg(2, JSTaggedValue(static_cast(456))); + ecmaRuntimeCallInfo->SetCallArg(3, JSTaggedValue(static_cast(789))); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsFunction::FunctionPrototypeCall(ecmaRuntimeCallInfo.get()); + + ASSERT_EQ(result.GetRawData(), JSTaggedValue(1371).GetRawData()); + +- JSObject::DeleteProperty(thread, (thisArg), ++ JSObject::DeleteProperty(thread_, (thisArg), + JSHandle(factory->NewFromCanBeCompressString("test_builtins_function_a"))); +- JSObject::DeleteProperty(thread, (thisArg), ++ JSObject::DeleteProperty(thread_, (thisArg), + JSHandle(factory->NewFromCanBeCompressString("test_builtins_function_b"))); + } + + TEST_F(BuiltinsFunctionTest, FunctionPrototypeHasInstance) + { +- JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); ++ JSHandle env = thread_->GetEcmaVM()->GetGlobalEnv(); + + JSHandle booleanCtor(env->GetBooleanFunction()); + +- auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue(*booleanCtor), 6); ++ auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue(*booleanCtor), 6); + ecmaRuntimeCallInfo1->SetFunction(booleanCtor.GetTaggedValue()); + ecmaRuntimeCallInfo1->SetThis(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo1->SetCallArg(0, JSTaggedValue(static_cast(123))); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); + JSTaggedValue result = BuiltinsBoolean::BooleanConstructor(ecmaRuntimeCallInfo1.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + +- JSHandle booleanInstance(thread, result); ++ JSHandle booleanInstance(thread_, result); + +- auto ecmaRuntimeCallInfo2 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto ecmaRuntimeCallInfo2 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo2->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo2->SetThis(booleanCtor.GetTaggedValue()); + ecmaRuntimeCallInfo2->SetCallArg(0, booleanInstance.GetTaggedValue()); + +- prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo2.get()); ++ prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo2.get()); + EXPECT_TRUE(BuiltinsFunction::FunctionPrototypeHasInstance(ecmaRuntimeCallInfo2.get()).GetRawData()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + } + } // namespace panda::test +diff --git a/tests/runtime/builtins/builtins_iterator_test.cpp b/tests/runtime/builtins/builtins_iterator_test.cpp +index 3c9340b..15ee9e6 100644 +--- a/tests/runtime/builtins/builtins_iterator_test.cpp ++++ b/tests/runtime/builtins/builtins_iterator_test.cpp +@@ -41,16 +41,16 @@ public: + + void SetUp() override + { +- TestHelper::CreateEcmaVMWithScope(instance, thread, scope); ++ TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); + } + + void TearDown() override + { +- TestHelper::DestroyEcmaVMWithScope(instance, scope); ++ TestHelper::DestroyEcmaVMWithScope(instance_, scope_); + } + +- PandaVM *instance {nullptr}; +- EcmaHandleScope *scope {nullptr}; +- JSThread *thread {nullptr}; ++ PandaVM *instance_ {nullptr}; ++ EcmaHandleScope *scope_ {nullptr}; ++ JSThread *thread_ {nullptr}; + }; + } // namespace panda::test +diff --git a/tests/runtime/builtins/builtins_json_test.cpp b/tests/runtime/builtins/builtins_json_test.cpp +index 97502ca..c8dedc8 100644 +--- a/tests/runtime/builtins/builtins_json_test.cpp ++++ b/tests/runtime/builtins/builtins_json_test.cpp +@@ -54,17 +54,17 @@ public: + + void SetUp() override + { +- TestHelper::CreateEcmaVMWithScope(instance, thread, scope); ++ TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); + } + + void TearDown() override + { +- TestHelper::DestroyEcmaVMWithScope(instance, scope); ++ TestHelper::DestroyEcmaVMWithScope(instance_, scope_); + } + +- PandaVM *instance {nullptr}; +- EcmaHandleScope *scope {nullptr}; +- JSThread *thread {nullptr}; ++ PandaVM *instance_ {nullptr}; ++ EcmaHandleScope *scope_ {nullptr}; ++ JSThread *thread_ {nullptr}; + + class TestClass : public base::BuiltinsBase { + public: +@@ -143,261 +143,261 @@ JSTaggedValue CreateBuiltinJSObject1(JSThread *thread, const CString keyCStr) + + TEST_F(BuiltinsJsonTest, Parse10) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + + JSHandle msg(factory->NewFromCanBeCompressString( + "\t\r \n{\t\r \n \"property\"\t\r \n:\t\r \n{\t\r \n}\t\r \n,\t\r \n \"prop2\"\t\r \n:\t\r \n [\t\r \ntrue\t\r " + "\n,\t\r \nnull\t\r \n,123.456\t\r \n] \t\r \n}\t\r \n")); +- JSHandle str(JSTaggedValue::ToString(thread, msg)); ++ JSHandle str(JSTaggedValue::ToString(thread_, msg)); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetCallArg(0, str.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsJson::Parse(ecmaRuntimeCallInfo.get()); + ASSERT_TRUE(result.IsECMAObject()); + } + + TEST_F(BuiltinsJsonTest, Parse21) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); +- JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); ++ JSHandle env = thread_->GetEcmaVM()->GetGlobalEnv(); + + JSHandle msg(factory->NewFromCanBeCompressString("[100,2.5,\"abc\"]")); + + JSHandle handleFunc = factory->NewJSFunction(env, reinterpret_cast(TestClass::TestForParse)); +- JSHandle str(JSTaggedValue::ToString(thread, msg)); ++ JSHandle str(JSTaggedValue::ToString(thread_, msg)); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetCallArg(0, str.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(1, handleFunc.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsJson::Parse(ecmaRuntimeCallInfo.get()); + ASSERT_TRUE(result.IsECMAObject()); + } + + TEST_F(BuiltinsJsonTest, Parse) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); +- JSHandle lengthKeyHandle = thread->GlobalConstants()->GetHandledLengthString(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); ++ JSHandle lengthKeyHandle = thread_->GlobalConstants()->GetHandledLengthString(); + + JSHandle msg(factory->NewFromCanBeCompressString("[100,2.5,\"abc\"]")); +- JSHandle str(JSTaggedValue::ToString(thread, msg)); ++ JSHandle str(JSTaggedValue::ToString(thread_, msg)); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetCallArg(0, str.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsJson::Parse(ecmaRuntimeCallInfo.get()); + JSTaggedValue value(static_cast(result.GetRawData())); + ASSERT_TRUE(value.IsECMAObject()); +- JSHandle valueHandle(thread, value); ++ JSHandle valueHandle(thread_, value); + JSHandle lenResult = +- JSObject::GetProperty(thread, JSHandle(valueHandle), lengthKeyHandle).GetValue(); +- uint32_t length = JSTaggedValue::ToLength(thread, lenResult).ToUint32(); ++ JSObject::GetProperty(thread_, JSHandle(valueHandle), lengthKeyHandle).GetValue(); ++ uint32_t length = JSTaggedValue::ToLength(thread_, lenResult).ToUint32(); + EXPECT_EQ(length, 3); + } + + TEST_F(BuiltinsJsonTest, Parse2) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle msg(factory->NewFromCanBeCompressString("{\"epf\":100,\"key1\":200}")); +- JSHandle str(JSTaggedValue::ToString(thread, msg)); ++ JSHandle str(JSTaggedValue::ToString(thread_, msg)); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetCallArg(0, str.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsJson::Parse(ecmaRuntimeCallInfo.get()); + JSTaggedValue value(static_cast(result.GetRawData())); + ASSERT_TRUE(value.IsECMAObject()); +- JSHandle valueHandle(thread, value); ++ JSHandle valueHandle(thread_, value); + +- JSHandle nameList(JSObject::EnumerableOwnNames(thread, valueHandle)); +- JSHandle nameResult = JSArray::CreateArrayFromList(thread, nameList); ++ JSHandle nameList(JSObject::EnumerableOwnNames(thread_, valueHandle)); ++ JSHandle nameResult = JSArray::CreateArrayFromList(thread_, nameList); + + JSHandle handleKey(nameResult); + JSHandle lengthKey(factory->NewFromCanBeCompressString("length")); +- JSHandle lenResult = JSObject::GetProperty(thread, handleKey, lengthKey).GetValue(); +- uint32_t length = JSTaggedValue::ToLength(thread, lenResult).ToUint32(); ++ JSHandle lenResult = JSObject::GetProperty(thread_, handleKey, lengthKey).GetValue(); ++ uint32_t length = JSTaggedValue::ToLength(thread_, lenResult).ToUint32(); + ASSERT_EQ(length, 2); + } + + TEST_F(BuiltinsJsonTest, Stringify11) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); +- JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); +- JSHandle obj = JSHandle(thread, CreateBuiltinJSObject1(thread, "x")); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); ++ JSHandle env = thread_->GetEcmaVM()->GetGlobalEnv(); ++ JSHandle obj = JSHandle(thread_, CreateBuiltinJSObject1(thread_, "x")); + JSHandle handleFunc = factory->NewJSFunction(env, reinterpret_cast(TestClass::TestForStringfy)); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetCallArg(0, obj.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(1, handleFunc.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsJson::Stringify(ecmaRuntimeCallInfo.get()); + ASSERT_TRUE(result.IsString()); + } + + TEST_F(BuiltinsJsonTest, Stringify12) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); +- JSHandle obj = JSHandle(thread, CreateBuiltinJSObject1(thread, "x")); +- JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); ++ JSHandle obj = JSHandle(thread_, CreateBuiltinJSObject1(thread_, "x")); ++ JSHandle env = thread_->GetEcmaVM()->GetGlobalEnv(); + JSHandle handleFunc = factory->NewJSFunction(env, reinterpret_cast(TestClass::TestForStringfy)); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 10); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 10); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetCallArg(0, obj.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(1, handleFunc.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(2, JSTaggedValue(static_cast(10))); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsJson::Stringify(ecmaRuntimeCallInfo.get()); + ASSERT_TRUE(result.IsString()); + } + + TEST_F(BuiltinsJsonTest, Stringify13) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); +- JSHandle obj = JSHandle(thread, CreateBuiltinJSObject1(thread, "x")); +- JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); ++ JSHandle obj = JSHandle(thread_, CreateBuiltinJSObject1(thread_, "x")); ++ JSHandle env = thread_->GetEcmaVM()->GetGlobalEnv(); + JSHandle handleFunc = factory->NewJSFunction(env, reinterpret_cast(TestClass::TestForStringfy)); + JSHandle msg(factory->NewFromCanBeCompressString("tttt")); +- JSHandle str(JSTaggedValue::ToString(thread, msg)); ++ JSHandle str(JSTaggedValue::ToString(thread_, msg)); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 10); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 10); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetCallArg(0, obj.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(1, handleFunc.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(2, str.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsJson::Stringify(ecmaRuntimeCallInfo.get()); + ASSERT_TRUE(result.IsString()); + } + + TEST_F(BuiltinsJsonTest, Stringify14) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); +- JSHandle obj = JSHandle(thread, CreateBuiltinJSObject1(thread, "x")); +- JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); ++ JSHandle obj = JSHandle(thread_, CreateBuiltinJSObject1(thread_, "x")); ++ JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread_, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); + +- JSHandle obj1(thread, arr); +- JSHandle key0(thread, JSTaggedValue(0)); ++ JSHandle obj1(thread_, arr); ++ JSHandle key0(thread_, JSTaggedValue(0)); + JSHandle value0(factory->NewFromCanBeCompressString("x")); +- JSObject::SetProperty(thread, JSHandle(obj), key0, value0); +- JSHandle key1(thread, JSTaggedValue(1)); ++ JSObject::SetProperty(thread_, JSHandle(obj), key0, value0); ++ JSHandle key1(thread_, JSTaggedValue(1)); + JSHandle value1(factory->NewFromCanBeCompressString("z")); +- JSObject::SetProperty(thread, JSHandle(obj), key1, value1); ++ JSObject::SetProperty(thread_, JSHandle(obj), key1, value1); + + JSHandle msg(factory->NewFromCanBeCompressString("tttt")); +- JSHandle str(JSTaggedValue::ToString(thread, msg)); ++ JSHandle str(JSTaggedValue::ToString(thread_, msg)); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 10); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 10); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetCallArg(0, obj.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(1, obj1.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(2, str.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsJson::Stringify(ecmaRuntimeCallInfo.get()); + ASSERT_TRUE(result.IsString()); + } + + TEST_F(BuiltinsJsonTest, Stringify) + { +- JSHandle obj = JSHandle(thread, CreateBuiltinJSObject1(thread, "x")); +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ JSHandle obj = JSHandle(thread_, CreateBuiltinJSObject1(thread_, "x")); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetCallArg(0, obj.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsJson::Stringify(ecmaRuntimeCallInfo.get()); + ASSERT_TRUE(result.IsString()); + } + + TEST_F(BuiltinsJsonTest, Stringify1) + { +- auto ecmaVM = thread->GetEcmaVM(); ++ auto ecmaVM = thread_->GetEcmaVM(); + ObjectFactory *factory = ecmaVM->GetFactory(); + JSHandle env = ecmaVM->GetGlobalEnv(); + +- JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); ++ JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread_, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); + + EXPECT_TRUE(arr != nullptr); +- JSHandle obj(thread, arr); +- JSHandle key0(thread, JSTaggedValue(0)); ++ JSHandle obj(thread_, arr); ++ JSHandle key0(thread_, JSTaggedValue(0)); + + JSHandle value(factory->NewFromCanBeCompressString("def")); +- JSObject::SetProperty(thread, JSHandle(obj), key0, value); ++ JSObject::SetProperty(thread_, JSHandle(obj), key0, value); + +- JSHandle key1(thread, JSTaggedValue(1)); +- PropertyDescriptor desc1(thread, JSHandle(thread, JSTaggedValue(200)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key1, desc1); ++ JSHandle key1(thread_, JSTaggedValue(1)); ++ PropertyDescriptor desc1(thread_, JSHandle(thread_, JSTaggedValue(200)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key1, desc1); + +- JSHandle key2(thread, JSTaggedValue(2)); ++ JSHandle key2(thread_, JSTaggedValue(2)); + JSHandle value2(factory->NewFromCanBeCompressString("abc")); +- JSObject::SetProperty(thread, JSHandle(obj), key2, value2); ++ JSObject::SetProperty(thread_, JSHandle(obj), key2, value2); + + JSHandle handleFunc = factory->NewJSFunction(env, reinterpret_cast(TestClass::TestForStringfy)); + JSHandle msg(factory->NewFromCanBeCompressString("tttt")); +- JSHandle str(JSTaggedValue::ToString(thread, msg)); ++ JSHandle str(JSTaggedValue::ToString(thread_, msg)); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 10); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 10); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetCallArg(0, obj.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(1, handleFunc.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(2, str.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsJson::Stringify(ecmaRuntimeCallInfo.get()); + ASSERT_TRUE(result.IsString()); + } + + TEST_F(BuiltinsJsonTest, Stringify2) + { +- auto ecmaVM = thread->GetEcmaVM(); ++ auto ecmaVM = thread_->GetEcmaVM(); + ObjectFactory *factory = ecmaVM->GetFactory(); + +- JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); ++ JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread_, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); + EXPECT_TRUE(arr != nullptr); +- JSHandle obj(thread, arr); ++ JSHandle obj(thread_, arr); + +- JSHandle key0(thread, JSTaggedValue(0)); +- PropertyDescriptor desc0(thread, JSHandle(thread, JSTaggedValue(1)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key0, desc0); +- JSHandle key1(thread, JSTaggedValue(1)); ++ JSHandle key0(thread_, JSTaggedValue(0)); ++ PropertyDescriptor desc0(thread_, JSHandle(thread_, JSTaggedValue(1)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key0, desc0); ++ JSHandle key1(thread_, JSTaggedValue(1)); + // 2.5 : test case +- PropertyDescriptor desc1(thread, JSHandle(thread, JSTaggedValue(2.5)), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key1, desc1); ++ PropertyDescriptor desc1(thread_, JSHandle(thread_, JSTaggedValue(2.5)), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key1, desc1); + // 2 : test case +- JSHandle key2(thread, JSTaggedValue(2)); ++ JSHandle key2(thread_, JSTaggedValue(2)); + JSHandle value2(factory->NewFromCanBeCompressString("abc")); +- JSObject::SetProperty(thread, JSHandle(obj), key2, value2); ++ JSObject::SetProperty(thread_, JSHandle(obj), key2, value2); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetCallArg(0, obj.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsJson::Stringify(ecmaRuntimeCallInfo.get()); + ASSERT_TRUE(result.IsString()); + } +diff --git a/tests/runtime/builtins/builtins_map_test.cpp b/tests/runtime/builtins/builtins_map_test.cpp +index 28f0aa8..4b2ad69 100644 +--- a/tests/runtime/builtins/builtins_map_test.cpp ++++ b/tests/runtime/builtins/builtins_map_test.cpp +@@ -53,17 +53,17 @@ public: + + void SetUp() override + { +- TestHelper::CreateEcmaVMWithScope(instance, thread, scope); ++ TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); + } + + void TearDown() override + { +- TestHelper::DestroyEcmaVMWithScope(instance, scope); ++ TestHelper::DestroyEcmaVMWithScope(instance_, scope_); + } + +- PandaVM *instance {nullptr}; +- EcmaHandleScope *scope {nullptr}; +- JSThread *thread {nullptr}; ++ PandaVM *instance_ {nullptr}; ++ EcmaHandleScope *scope_ {nullptr}; ++ JSThread *thread_ {nullptr}; + + class TestClass : public base::BuiltinsBase { + public: +@@ -97,18 +97,18 @@ JSMap *CreateBuiltinsMap(JSThread *thread) + // new Map("abrupt").toString() + TEST_F(BuiltinsMapTest, CreateAndGetSize) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); +- JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); ++ JSHandle env = thread_->GetEcmaVM()->GetGlobalEnv(); + JSHandle newTarget(env->GetBuiltinsMapFunction()); +- JSHandle map(thread, CreateBuiltinsMap(thread)); ++ JSHandle map(thread_, CreateBuiltinsMap(thread_)); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(map.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue::Undefined()); + + { +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsMap::GetSize(ecmaRuntimeCallInfo.get()); + + EXPECT_EQ(result.GetRawData(), JSTaggedValue(0).GetRawData()); +@@ -116,19 +116,19 @@ TEST_F(BuiltinsMapTest, CreateAndGetSize) + JSHandle array(factory->NewTaggedArray(5)); + for (int i = 0; i < 5; i++) { + JSHandle internal_array(factory->NewTaggedArray(2)); +- internal_array->Set(thread, 0, JSTaggedValue(i)); +- internal_array->Set(thread, 1, JSTaggedValue(i)); +- auto arr = JSArray::CreateArrayFromList(thread, internal_array); +- array->Set(thread, i, arr); ++ internal_array->Set(thread_, 0, JSTaggedValue(i)); ++ internal_array->Set(thread_, 1, JSTaggedValue(i)); ++ auto arr = JSArray::CreateArrayFromList(thread_, internal_array); ++ array->Set(thread_, i, arr); + } +- JSHandle values = JSArray::CreateArrayFromList(thread, array); +- auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ JSHandle values = JSArray::CreateArrayFromList(thread_, array); ++ auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo1->SetFunction(newTarget.GetTaggedValue()); + ecmaRuntimeCallInfo1->SetThis(map.GetTaggedValue()); + ecmaRuntimeCallInfo1->SetCallArg(0, values.GetTaggedValue()); + ecmaRuntimeCallInfo1->SetNewTarget(newTarget.GetTaggedValue()); + { +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); + JSTaggedValue result1 = BuiltinsMap::MapConstructor(ecmaRuntimeCallInfo1.get()); + + EXPECT_EQ(JSMap::Cast(reinterpret_cast(result1.GetRawData()))->GetSize(), 5); +@@ -137,12 +137,12 @@ TEST_F(BuiltinsMapTest, CreateAndGetSize) + + TEST_F(BuiltinsMapTest, SetAndHas) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + // create jsMap +- JSHandle map(thread, CreateBuiltinsMap(thread)); ++ JSHandle map(thread_, CreateBuiltinsMap(thread_)); + JSHandle key(factory->NewFromCanBeCompressString("key")); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(map.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, key.GetTaggedValue()); +@@ -150,7 +150,7 @@ TEST_F(BuiltinsMapTest, SetAndHas) + + JSMap *jsMap; + { +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result1 = BuiltinsMap::Has(ecmaRuntimeCallInfo.get()); + + EXPECT_EQ(result1.GetRawData(), JSTaggedValue::False().GetRawData()); +@@ -164,13 +164,13 @@ TEST_F(BuiltinsMapTest, SetAndHas) + } + + // test Has() +- auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + ecmaRuntimeCallInfo1->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo1->SetThis(JSTaggedValue(jsMap)); + ecmaRuntimeCallInfo1->SetCallArg(0, key.GetTaggedValue()); + ecmaRuntimeCallInfo1->SetCallArg(1, JSTaggedValue(static_cast(1))); + { +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); + JSTaggedValue result3 = BuiltinsMap::Has(ecmaRuntimeCallInfo1.get()); + + EXPECT_EQ(result3.GetRawData(), JSTaggedValue::True().GetRawData()); +@@ -180,36 +180,36 @@ TEST_F(BuiltinsMapTest, SetAndHas) + TEST_F(BuiltinsMapTest, ForEach) + { + // generate a map has 5 entries{key1:0,key2:1,key3:2,key4:3,key5:4} +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); +- JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); +- JSHandle map(thread, CreateBuiltinsMap(thread)); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); ++ JSHandle env = thread_->GetEcmaVM()->GetGlobalEnv(); ++ JSHandle map(thread_, CreateBuiltinsMap(thread_)); + char keyArray[] = "key0"; + for (int i = 0; i < 5; i++) { + keyArray[3] = '1' + i; + JSHandle key(factory->NewFromCanBeCompressString(keyArray)); +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(map.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, key.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(static_cast(i))); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result1 = BuiltinsMap::Set(ecmaRuntimeCallInfo.get()); + EXPECT_TRUE(result1.IsECMAObject()); + JSMap *jsMap = JSMap::Cast(reinterpret_cast(result1.GetRawData())); + EXPECT_EQ(jsMap->GetSize(), i + 1); + } + // test foreach; +- JSHandle jsArray(JSArray::ArrayCreate(thread, JSTaggedNumber(0))); ++ JSHandle jsArray(JSArray::ArrayCreate(thread_, JSTaggedNumber(0))); + JSHandle func = factory->NewJSFunction(env, reinterpret_cast(TestClass::TestFunc)); + +- auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + ecmaRuntimeCallInfo1->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo1->SetThis(map.GetTaggedValue()); + ecmaRuntimeCallInfo1->SetCallArg(0, func.GetTaggedValue()); + ecmaRuntimeCallInfo1->SetCallArg(1, jsArray.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); + JSTaggedValue result2 = BuiltinsMap::ForEach(ecmaRuntimeCallInfo1.get()); + + EXPECT_EQ(result2.GetRawData(), JSTaggedValue::VALUE_UNDEFINED); +@@ -218,22 +218,22 @@ TEST_F(BuiltinsMapTest, ForEach) + + TEST_F(BuiltinsMapTest, DeleteAndRemove) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + // create jsMap +- JSHandle map(thread, CreateBuiltinsMap(thread)); ++ JSHandle map(thread_, CreateBuiltinsMap(thread_)); + + // add 40 keys + char keyArray[] = "key0"; + for (int i = 0; i < 40; i++) { + keyArray[3] = '1' + i; +- JSHandle key(thread, factory->NewFromCanBeCompressString(keyArray).GetTaggedValue()); +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ JSHandle key(thread_, factory->NewFromCanBeCompressString(keyArray).GetTaggedValue()); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(map.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, key.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(static_cast(i))); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result1 = BuiltinsMap::Set(ecmaRuntimeCallInfo.get()); + + EXPECT_TRUE(result1.IsECMAObject()); +@@ -244,12 +244,12 @@ TEST_F(BuiltinsMapTest, DeleteAndRemove) + keyArray[3] = '1' + 8; + JSHandle deleteKey(factory->NewFromCanBeCompressString(keyArray)); + +- auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo1->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo1->SetThis(map.GetTaggedValue()); + ecmaRuntimeCallInfo1->SetCallArg(0, deleteKey.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); + JSTaggedValue result2 = BuiltinsMap::Has(ecmaRuntimeCallInfo1.get()); + + EXPECT_EQ(result2.GetRawData(), JSTaggedValue::True().GetRawData()); +@@ -275,9 +275,9 @@ TEST_F(BuiltinsMapTest, DeleteAndRemove) + + TEST_F(BuiltinsMapTest, Species) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); +- JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); +- JSHandle map(thread, CreateBuiltinsMap(thread)); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); ++ JSHandle env = thread_->GetEcmaVM()->GetGlobalEnv(); ++ JSHandle map(thread_, CreateBuiltinsMap(thread_)); + + // test species + JSHandle speciesSymbol = env->GetSpeciesSymbol(); +@@ -286,73 +286,73 @@ TEST_F(BuiltinsMapTest, Species) + JSHandle newTarget(env->GetBuiltinsMapFunction()); + + JSTaggedValue value = +- JSObject::GetProperty(thread, JSHandle(newTarget), speciesSymbol).GetValue().GetTaggedValue(); +- JSHandle valueHandle(thread, value); ++ JSObject::GetProperty(thread_, JSHandle(newTarget), speciesSymbol).GetValue().GetTaggedValue(); ++ JSHandle valueHandle(thread_, value); + EXPECT_EQ(value, newTarget.GetTaggedValue()); + + // to string tag + JSHandle toStringTagSymbol = env->GetToStringTagSymbol(); +- JSHandle stringTag(JSObject::GetProperty(thread, map, toStringTagSymbol).GetValue()); ++ JSHandle stringTag(JSObject::GetProperty(thread_, map, toStringTagSymbol).GetValue()); + JSHandle str = factory->NewFromCanBeCompressString("Map"); + EXPECT_TRUE(!stringTag.GetTaggedValue().IsUndefined()); + EXPECT_TRUE(EcmaString::StringsAreEqual(*str, *stringTag)); + +- JSHandle constructor = JSHandle::Cast(JSTaggedValue::ToObject(thread, valueHandle)); +- EXPECT_EQ(JSHandle(map)->GetPrototype(thread), constructor->GetFunctionPrototype()); ++ JSHandle constructor = JSHandle::Cast(JSTaggedValue::ToObject(thread_, valueHandle)); ++ EXPECT_EQ(JSHandle(map)->GetPrototype(thread_), constructor->GetFunctionPrototype()); + + JSHandle key1(factory->NewFromCanBeCompressString("set")); +- JSTaggedValue value1 = JSObject::GetProperty(thread, map, key1).GetValue().GetTaggedValue(); ++ JSTaggedValue value1 = JSObject::GetProperty(thread_, map, key1).GetValue().GetTaggedValue(); + EXPECT_FALSE(value1.IsUndefined()); + + JSHandle key2(factory->NewFromCanBeCompressString("has")); +- JSTaggedValue value2 = JSObject::GetProperty(thread, map, key1).GetValue().GetTaggedValue(); ++ JSTaggedValue value2 = JSObject::GetProperty(thread_, map, key1).GetValue().GetTaggedValue(); + EXPECT_FALSE(value2.IsUndefined()); + + JSHandle key3(factory->NewFromCanBeCompressString("clear")); +- JSTaggedValue value3 = JSObject::GetProperty(thread, map, key1).GetValue().GetTaggedValue(); ++ JSTaggedValue value3 = JSObject::GetProperty(thread_, map, key1).GetValue().GetTaggedValue(); + EXPECT_FALSE(value3.IsUndefined()); + + JSHandle key4(factory->NewFromCanBeCompressString("size")); +- JSTaggedValue value4 = JSObject::GetProperty(thread, map, key1).GetValue().GetTaggedValue(); ++ JSTaggedValue value4 = JSObject::GetProperty(thread_, map, key1).GetValue().GetTaggedValue(); + EXPECT_FALSE(value4.IsUndefined()); + + JSHandle key5(factory->NewFromCanBeCompressString("delete")); +- JSTaggedValue value5 = JSObject::GetProperty(thread, map, key1).GetValue().GetTaggedValue(); ++ JSTaggedValue value5 = JSObject::GetProperty(thread_, map, key1).GetValue().GetTaggedValue(); + EXPECT_FALSE(value5.IsUndefined()); + + JSHandle key6(factory->NewFromCanBeCompressString("forEach")); +- JSTaggedValue value6 = JSObject::GetProperty(thread, map, key1).GetValue().GetTaggedValue(); ++ JSTaggedValue value6 = JSObject::GetProperty(thread_, map, key1).GetValue().GetTaggedValue(); + EXPECT_FALSE(value6.IsUndefined()); + + JSHandle key7(factory->NewFromCanBeCompressString("get")); +- JSTaggedValue value7 = JSObject::GetProperty(thread, map, key1).GetValue().GetTaggedValue(); ++ JSTaggedValue value7 = JSObject::GetProperty(thread_, map, key1).GetValue().GetTaggedValue(); + EXPECT_FALSE(value7.IsUndefined()); + } + + TEST_F(BuiltinsMapTest, GetIterator) + { +- JSHandle map(thread, CreateBuiltinsMap(thread)); +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); ++ JSHandle map(thread_, CreateBuiltinsMap(thread_)); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(map.GetTaggedValue()); +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + + // test Values() + JSTaggedValue result = BuiltinsMap::Values(ecmaRuntimeCallInfo.get()); +- JSHandle iter(thread, result); ++ JSHandle iter(thread_, result); + EXPECT_TRUE(iter->IsJSMapIterator()); + EXPECT_EQ(IterationKind::VALUE, IterationKind(iter->GetIterationKind().GetInt())); + EXPECT_EQ(JSMap::Cast(map.GetTaggedValue().GetTaggedObject())->GetLinkedMap(), iter->GetIteratedMap()); + + // test Keys() + JSTaggedValue result1 = BuiltinsMap::Keys(ecmaRuntimeCallInfo.get()); +- JSHandle iter1(thread, result1); ++ JSHandle iter1(thread_, result1); + EXPECT_TRUE(iter1->IsJSMapIterator()); + EXPECT_EQ(IterationKind::KEY, IterationKind(iter1->GetIterationKind().GetInt())); + + // test entries() + JSTaggedValue result2 = BuiltinsMap::Entries(ecmaRuntimeCallInfo.get()); +- JSHandle iter2(thread, result2); ++ JSHandle iter2(thread_, result2); + EXPECT_TRUE(iter2->IsJSMapIterator()); + EXPECT_EQ(IterationKind::KEY_AND_VALUE, IterationKind(iter2->GetIterationKind().GetInt())); + } +diff --git a/tests/runtime/builtins/builtins_number_test.cpp b/tests/runtime/builtins/builtins_number_test.cpp +index ac964ac..356ffa5 100644 +--- a/tests/runtime/builtins/builtins_number_test.cpp ++++ b/tests/runtime/builtins/builtins_number_test.cpp +@@ -50,33 +50,33 @@ public: + + void SetUp() override + { +- TestHelper::CreateEcmaVMWithScope(instance, thread, scope); ++ TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); + } + + void TearDown() override + { +- TestHelper::DestroyEcmaVMWithScope(instance, scope); ++ TestHelper::DestroyEcmaVMWithScope(instance_, scope_); + } + +- PandaVM *instance {nullptr}; +- EcmaHandleScope *scope {nullptr}; +- JSThread *thread {nullptr}; ++ PandaVM *instance_ {nullptr}; ++ EcmaHandleScope *scope_ {nullptr}; ++ JSThread *thread_ {nullptr}; + }; + + // new Number(10) + TEST_F(BuiltinsNumberTest, NumberConstructor) + { +- JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); ++ JSHandle env = thread_->GetEcmaVM()->GetGlobalEnv(); + + JSHandle number(env->GetNumberFunction()); +- JSHandle globalObject(thread, env->GetGlobalObject()); ++ JSHandle globalObject(thread_, env->GetGlobalObject()); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue(*number), 6); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue(*number), 6); + ecmaRuntimeCallInfo->SetFunction(number.GetTaggedValue()); + ecmaRuntimeCallInfo->SetThis(globalObject.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast(5))); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsNumber::NumberConstructor(ecmaRuntimeCallInfo.get()); + JSTaggedValue value(static_cast(result.GetRawData())); + ASSERT_TRUE(value.IsECMAObject()); +@@ -88,12 +88,12 @@ TEST_F(BuiltinsNumberTest, NumberConstructor) + TEST_F(BuiltinsNumberTest, IsFinite) + { + const double value = -10; +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast(value))); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsNumber::IsFinite(ecmaRuntimeCallInfo.get()); + ASSERT_EQ(result.GetRawData(), JSTaggedValue::True().GetRawData()); + } +@@ -101,12 +101,12 @@ TEST_F(BuiltinsNumberTest, IsFinite) + // Number.isFinite(Number.MAX_VALUE) + TEST_F(BuiltinsNumberTest, IsFinite1) + { +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(base::MAX_VALUE)); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsNumber::IsFinite(ecmaRuntimeCallInfo.get()); + ASSERT_EQ(result.GetRawData(), JSTaggedValue::True().GetRawData()); + } +@@ -114,13 +114,13 @@ TEST_F(BuiltinsNumberTest, IsFinite1) + // Number.isFinite("helloworld") + TEST_F(BuiltinsNumberTest, IsFinite2) + { +- JSHandle test = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("helloworld"); +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ JSHandle test = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("helloworld"); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetCallArg(0, test.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsNumber::IsFinite(ecmaRuntimeCallInfo.get()); + ASSERT_EQ(result.GetRawData(), JSTaggedValue::False().GetRawData()); + } +@@ -128,12 +128,12 @@ TEST_F(BuiltinsNumberTest, IsFinite2) + // Number.isFinite(NaN) + TEST_F(BuiltinsNumberTest, IsFinite3) + { +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(base::NAN_VALUE)); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsNumber::IsFinite(ecmaRuntimeCallInfo.get()); + ASSERT_EQ(result.GetRawData(), JSTaggedValue::False().GetRawData()); + } +@@ -141,12 +141,12 @@ TEST_F(BuiltinsNumberTest, IsFinite3) + // Number.isFinite(Infinity) + TEST_F(BuiltinsNumberTest, IsFinite4) + { +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(base::POSITIVE_INFINITY)); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsNumber::IsFinite(ecmaRuntimeCallInfo.get()); + ASSERT_EQ(result.GetRawData(), JSTaggedValue::False().GetRawData()); + } +@@ -154,12 +154,12 @@ TEST_F(BuiltinsNumberTest, IsFinite4) + // Number.isFinite(undefined) + TEST_F(BuiltinsNumberTest, IsFinite5) + { +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue::Undefined()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsNumber::IsFinite(ecmaRuntimeCallInfo.get()); + ASSERT_EQ(result.GetRawData(), JSTaggedValue::False().GetRawData()); + } +@@ -167,12 +167,12 @@ TEST_F(BuiltinsNumberTest, IsFinite5) + // Number.isFinite(null) + TEST_F(BuiltinsNumberTest, IsFinite6) + { +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue::Null()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsNumber::IsFinite(ecmaRuntimeCallInfo.get()); + ASSERT_EQ(result.GetRawData(), JSTaggedValue::False().GetRawData()); + } +@@ -180,12 +180,12 @@ TEST_F(BuiltinsNumberTest, IsFinite6) + // Number.isInteger(0.1) + TEST_F(BuiltinsNumberTest, IsInteger) + { +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(0.1)); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsNumber::IsInteger(ecmaRuntimeCallInfo.get()); + ASSERT_EQ(result.GetRawData(), JSTaggedValue::False().GetRawData()); + } +@@ -193,12 +193,12 @@ TEST_F(BuiltinsNumberTest, IsInteger) + // Number.isNaN(0.1) + TEST_F(BuiltinsNumberTest, IsNaN) + { +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(0.1)); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsNumber::IsNaN(ecmaRuntimeCallInfo.get()); + ASSERT_EQ(result.GetRawData(), JSTaggedValue::False().GetRawData()); + } +@@ -206,23 +206,23 @@ TEST_F(BuiltinsNumberTest, IsNaN) + // new Number(123.456).toString(7) + TEST_F(BuiltinsNumberTest, ToString) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); +- auto ecmaVM = thread->GetEcmaVM(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); ++ auto ecmaVM = thread_->GetEcmaVM(); + JSHandle env = ecmaVM->GetGlobalEnv(); + + JSHandle numberObject(env->GetNumberFunction()); +- JSHandle value(thread, JSTaggedValue(123.456)); +- JSHandle number = thread->GetEcmaVM()->GetFactory()->NewJSPrimitiveRef(numberObject, value); ++ JSHandle value(thread_, JSTaggedValue(123.456)); ++ JSHandle number = thread_->GetEcmaVM()->GetFactory()->NewJSPrimitiveRef(numberObject, value); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(number.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(7.0)); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsNumber::ToString(ecmaRuntimeCallInfo.get()); + ASSERT_TRUE(result.IsString()); +- JSHandle res(thread, reinterpret_cast(result.GetRawData())); ++ JSHandle res(thread_, reinterpret_cast(result.GetRawData())); + JSHandle correctResult = factory->NewFromCanBeCompressString("234.312256641535441"); + CVector test(res->GetLength() + 1); + res->CopyDataUtf8(test.data(), res->GetLength()); +@@ -232,23 +232,23 @@ TEST_F(BuiltinsNumberTest, ToString) + // new Number(123.456).toExponential(5) + TEST_F(BuiltinsNumberTest, IsExponential) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); +- auto ecmaVM = thread->GetEcmaVM(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); ++ auto ecmaVM = thread_->GetEcmaVM(); + JSHandle env = ecmaVM->GetGlobalEnv(); + + JSHandle numberObject(env->GetNumberFunction()); +- JSHandle value(thread, JSTaggedValue(123.456)); ++ JSHandle value(thread_, JSTaggedValue(123.456)); + JSHandle number = factory->NewJSPrimitiveRef(numberObject, value); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(number.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(5.0)); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsNumber::ToExponential(ecmaRuntimeCallInfo.get()); + ASSERT_TRUE(result.IsString()); +- JSHandle res(thread, reinterpret_cast(result.GetRawData())); ++ JSHandle res(thread_, reinterpret_cast(result.GetRawData())); + JSHandle correctResult = factory->NewFromCanBeCompressString("1.23456e+2"); + CVector test(res->GetLength() + 1); + res->CopyDataUtf8(test.data(), res->GetLength()); +@@ -258,23 +258,23 @@ TEST_F(BuiltinsNumberTest, IsExponential) + // new Number(123.456).toFixed(10) + TEST_F(BuiltinsNumberTest, ToFixed) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); +- auto ecmaVM = thread->GetEcmaVM(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); ++ auto ecmaVM = thread_->GetEcmaVM(); + JSHandle env = ecmaVM->GetGlobalEnv(); + + JSHandle numberObject(env->GetNumberFunction()); +- JSHandle value(thread, JSTaggedValue(123.456)); ++ JSHandle value(thread_, JSTaggedValue(123.456)); + JSHandle number = factory->NewJSPrimitiveRef(numberObject, value); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(number.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(10.0)); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsNumber::ToFixed(ecmaRuntimeCallInfo.get()); + ASSERT_TRUE(result.IsString()); +- JSHandle res(thread, reinterpret_cast(result.GetRawData())); ++ JSHandle res(thread_, reinterpret_cast(result.GetRawData())); + JSHandle correctResult = factory->NewFromCanBeCompressString("123.4560000000"); + ASSERT_TRUE(EcmaString::StringsAreEqual(*res, *correctResult)); + } +@@ -282,23 +282,23 @@ TEST_F(BuiltinsNumberTest, ToFixed) + // new Number(123.456).toFixed(30) + TEST_F(BuiltinsNumberTest, ToFixed1) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); +- auto ecmaVM = thread->GetEcmaVM(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); ++ auto ecmaVM = thread_->GetEcmaVM(); + JSHandle env = ecmaVM->GetGlobalEnv(); + + JSHandle numberObject(env->GetNumberFunction()); +- JSHandle value(thread, JSTaggedValue(123.456)); ++ JSHandle value(thread_, JSTaggedValue(123.456)); + JSHandle number = factory->NewJSPrimitiveRef(numberObject, value); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(number.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(30.0)); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsNumber::ToFixed(ecmaRuntimeCallInfo.get()); + ASSERT_TRUE(result.IsString()); +- JSHandle res(thread, reinterpret_cast(result.GetRawData())); ++ JSHandle res(thread_, reinterpret_cast(result.GetRawData())); + JSHandle correctResult = factory->NewFromCanBeCompressString("123.456000000000003069544618483633"); + ASSERT_TRUE(EcmaString::StringsAreEqual(*res, *correctResult)); + } +@@ -306,23 +306,23 @@ TEST_F(BuiltinsNumberTest, ToFixed1) + // new Number(1e21).toFixed(20) + TEST_F(BuiltinsNumberTest, ToFixed2) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); +- auto ecmaVM = thread->GetEcmaVM(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); ++ auto ecmaVM = thread_->GetEcmaVM(); + JSHandle env = ecmaVM->GetGlobalEnv(); + + JSHandle numberObject(env->GetNumberFunction()); +- JSHandle value(thread, JSTaggedValue(1e21)); ++ JSHandle value(thread_, JSTaggedValue(1e21)); + JSHandle number = factory->NewJSPrimitiveRef(numberObject, value); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(number.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(20.0)); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsNumber::ToFixed(ecmaRuntimeCallInfo.get()); + ASSERT_TRUE(result.IsString()); +- JSHandle res(thread, reinterpret_cast(result.GetRawData())); ++ JSHandle res(thread_, reinterpret_cast(result.GetRawData())); + JSHandle correctResult = factory->NewFromCanBeCompressString("1e+21"); + CVector test(res->GetLength() + 1); + res->CopyDataUtf8(test.data(), res->GetLength()); +@@ -333,23 +333,23 @@ TEST_F(BuiltinsNumberTest, ToFixed2) + // new Number(123.456).toPrecision(8) + TEST_F(BuiltinsNumberTest, ToPrecision) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); +- auto ecmaVM = thread->GetEcmaVM(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); ++ auto ecmaVM = thread_->GetEcmaVM(); + JSHandle env = ecmaVM->GetGlobalEnv(); + + JSHandle numberObject(env->GetNumberFunction()); +- JSHandle value(thread, JSTaggedValue(123.456)); ++ JSHandle value(thread_, JSTaggedValue(123.456)); + JSHandle number = factory->NewJSPrimitiveRef(numberObject, value); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(number.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(8.0)); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsNumber::ToPrecision(ecmaRuntimeCallInfo.get()); + ASSERT_TRUE(result.IsString()); +- JSHandle res(thread, reinterpret_cast(result.GetRawData())); ++ JSHandle res(thread_, reinterpret_cast(result.GetRawData())); + JSHandle correctResult = factory->NewFromCanBeCompressString("123.45600"); + ASSERT_TRUE(EcmaString::StringsAreEqual(*res, *correctResult)); + } +@@ -357,13 +357,13 @@ TEST_F(BuiltinsNumberTest, ToPrecision) + // Number.parseFloat(0x123) + TEST_F(BuiltinsNumberTest, parseFloat) + { +- JSHandle param = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("0x123"); +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ JSHandle param = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("0x123"); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetCallArg(0, param.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsNumber::ParseFloat(ecmaRuntimeCallInfo.get()); + ASSERT_EQ(result.GetRawData(), JSTaggedValue(static_cast(0)).GetRawData()); + } +@@ -371,13 +371,13 @@ TEST_F(BuiltinsNumberTest, parseFloat) + // Number.parseFloat(0x123xx) + TEST_F(BuiltinsNumberTest, parseFloat1) + { +- JSHandle param = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("0x123xx"); +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ JSHandle param = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("0x123xx"); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetCallArg(0, param.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsNumber::ParseFloat(ecmaRuntimeCallInfo.get()); + ASSERT_EQ(result.GetRawData(), JSTaggedValue(static_cast(0)).GetRawData()); + } +@@ -387,14 +387,14 @@ TEST_F(BuiltinsNumberTest, parseInt) + { + const char *number = "0x123"; + +- JSHandle param = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(number); +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ JSHandle param = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(number); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetCallArg(0, param.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(16.0)); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsNumber::ParseInt(ecmaRuntimeCallInfo.get()); + ASSERT_EQ(result.GetRawData(), JSTaggedValue(static_cast(291)).GetRawData()); + } +@@ -407,74 +407,74 @@ TEST_F(BuiltinsNumberTest, StringToDoubleFlags) + + // flags of IGNORE_TRAILING + +- str = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("0a"); ++ str = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("0a"); + sp = Span(str->GetDataUtf8(), str->GetUtf8Length() - 1); + ASSERT_EQ(base::NumberHelper::StringToDouble(sp.begin(), sp.end(), 0, base::IGNORE_TRAILING), 0); +- str = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("0b"); ++ str = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("0b"); + sp = Span(str->GetDataUtf8(), str->GetUtf8Length() - 1); + ASSERT_EQ(base::NumberHelper::StringToDouble(sp.begin(), sp.end(), 0, base::IGNORE_TRAILING), 0); +- str = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("0o"); ++ str = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("0o"); + sp = Span(str->GetDataUtf8(), str->GetUtf8Length() - 1); + ASSERT_EQ(base::NumberHelper::StringToDouble(sp.begin(), sp.end(), 0, base::IGNORE_TRAILING), 0); +- str = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 00x"); ++ str = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 00x"); + sp = Span(str->GetDataUtf8(), str->GetUtf8Length() - 1); + ASSERT_EQ(base::NumberHelper::StringToDouble(sp.begin(), sp.end(), 0, base::IGNORE_TRAILING), 0); +- str = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 000.4_"); ++ str = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 000.4_"); + sp = Span(str->GetDataUtf8(), str->GetUtf8Length() - 1); + ASSERT_EQ(base::NumberHelper::StringToDouble(sp.begin(), sp.end(), 0, base::IGNORE_TRAILING), 0.4); +- str = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 0010.s "); ++ str = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 0010.s "); + sp = Span(str->GetDataUtf8(), str->GetUtf8Length() - 1); + ASSERT_EQ(base::NumberHelper::StringToDouble(sp.begin(), sp.end(), 0, base::IGNORE_TRAILING), 10); +- str = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 0010e2"); ++ str = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 0010e2"); + sp = Span(str->GetDataUtf8(), str->GetUtf8Length() - 1); + ASSERT_EQ(base::NumberHelper::StringToDouble(sp.begin(), sp.end(), 0, base::IGNORE_TRAILING), 1000); +- str = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 0010e+3_0"); ++ str = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 0010e+3_0"); + sp = Span(str->GetDataUtf8(), str->GetUtf8Length() - 1); + ASSERT_EQ(base::NumberHelper::StringToDouble(sp.begin(), sp.end(), 0, base::IGNORE_TRAILING), 10000); + + // flags of ALLOW_HEX +- str = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("0x"); ++ str = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("0x"); + sp = Span(str->GetDataUtf8(), str->GetUtf8Length() - 1); + ASSERT_TRUE(std::isnan(base::NumberHelper::StringToDouble(sp.begin(), sp.end(), 0, base::ALLOW_HEX))); +- str = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 0x10 "); ++ str = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 0x10 "); + sp = Span(str->GetDataUtf8(), str->GetUtf8Length() - 1); + ASSERT_EQ(base::NumberHelper::StringToDouble(sp.begin(), sp.end(), 0, base::ALLOW_HEX), 16); +- str = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("0x1g"); ++ str = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("0x1g"); + sp = Span(str->GetDataUtf8(), str->GetUtf8Length() - 1); + ASSERT_EQ(base::NumberHelper::StringToDouble(sp.begin(), sp.end(), 0, base::ALLOW_HEX + base::IGNORE_TRAILING), 1); +- str = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("0xh"); ++ str = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("0xh"); + sp = Span(str->GetDataUtf8(), str->GetUtf8Length() - 1); + ASSERT_TRUE(std::isnan( + base::NumberHelper::StringToDouble(sp.begin(), sp.end(), 0, base::ALLOW_HEX + base::IGNORE_TRAILING))); + + // flags of ALLOW_OCTAL +- str = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("0O"); ++ str = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("0O"); + sp = Span(str->GetDataUtf8(), str->GetUtf8Length() - 1); + ASSERT_TRUE(std::isnan(base::NumberHelper::StringToDouble(sp.begin(), sp.end(), 0, base::ALLOW_OCTAL))); +- str = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 0o10 "); ++ str = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 0o10 "); + sp = Span(str->GetDataUtf8(), str->GetUtf8Length() - 1); + ASSERT_EQ(base::NumberHelper::StringToDouble(sp.begin(), sp.end(), 0, base::ALLOW_OCTAL), 8); +- str = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("0o1d"); ++ str = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("0o1d"); + sp = Span(str->GetDataUtf8(), str->GetUtf8Length() - 1); + ASSERT_EQ(base::NumberHelper::StringToDouble(sp.begin(), sp.end(), 0, base::ALLOW_OCTAL | base::IGNORE_TRAILING), + 1); +- str = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("0o8"); ++ str = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("0o8"); + sp = Span(str->GetDataUtf8(), str->GetUtf8Length() - 1); + ASSERT_TRUE(std::isnan( + base::NumberHelper::StringToDouble(sp.begin(), sp.end(), 0, base::ALLOW_OCTAL | base::IGNORE_TRAILING))); + + // flags of ALLOW_BINARY +- str = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("0b"); ++ str = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("0b"); + sp = Span(str->GetDataUtf8(), str->GetUtf8Length() - 1); + ASSERT_TRUE(std::isnan(base::NumberHelper::StringToDouble(sp.begin(), sp.end(), 0, base::ALLOW_BINARY))); +- str = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 0b10 "); ++ str = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 0b10 "); + sp = Span(str->GetDataUtf8(), str->GetUtf8Length() - 1); + ASSERT_EQ(base::NumberHelper::StringToDouble(sp.begin(), sp.end(), 0, base::ALLOW_BINARY), 2); +- str = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("0b1d"); ++ str = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("0b1d"); + sp = Span(str->GetDataUtf8(), str->GetUtf8Length() - 1); + ASSERT_EQ(base::NumberHelper::StringToDouble(sp.begin(), sp.end(), 0, base::ALLOW_BINARY | base::IGNORE_TRAILING), + 1); +- str = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("0b2"); ++ str = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("0b2"); + sp = Span(str->GetDataUtf8(), str->GetUtf8Length() - 1); + ASSERT_TRUE(std::isnan( + base::NumberHelper::StringToDouble(sp.begin(), sp.end(), 0, base::ALLOW_BINARY | base::IGNORE_TRAILING))); +@@ -488,112 +488,114 @@ TEST_F(BuiltinsNumberTest, StringToDoubleRadix) + int radix; + + radix = 0; // default 10 +- str = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 100 "); ++ str = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 100 "); + sp = Span(str->GetDataUtf8(), str->GetUtf8Length() - 1); + ASSERT_EQ(base::NumberHelper::StringToDouble(sp.begin(), sp.end(), radix, base::NO_FLAGS), 100); +- str = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 100.3e2 "); ++ str = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 100.3e2 "); + sp = Span(str->GetDataUtf8(), str->GetUtf8Length() - 1); + ASSERT_EQ(base::NumberHelper::StringToDouble(sp.begin(), sp.end(), radix, base::NO_FLAGS), 10030); + radix = 1; +- str = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 0000 "); ++ str = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 0000 "); + sp = Span(str->GetDataUtf8(), str->GetUtf8Length() - 1); + ASSERT_EQ(base::NumberHelper::StringToDouble(sp.begin(), sp.end(), radix, base::NO_FLAGS), 0); +- str = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 0001 "); ++ str = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 0001 "); + sp = Span(str->GetDataUtf8(), str->GetUtf8Length() - 1); + ASSERT_TRUE(std::isnan(base::NumberHelper::StringToDouble(sp.begin(), sp.end(), radix, base::NO_FLAGS))); + radix = 2; +- str = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 100 "); ++ str = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 100 "); + sp = Span(str->GetDataUtf8(), str->GetUtf8Length() - 1); + ASSERT_EQ(base::NumberHelper::StringToDouble(sp.begin(), sp.end(), radix, base::NO_FLAGS), 4); +- str = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 11 "); ++ str = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 11 "); + sp = Span(str->GetDataUtf8(), str->GetUtf8Length() - 1); + ASSERT_EQ(base::NumberHelper::StringToDouble(sp.begin(), sp.end(), radix, base::NO_FLAGS), 3); + radix = 3; +- str = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 100 "); ++ str = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 100 "); + sp = Span(str->GetDataUtf8(), str->GetUtf8Length() - 1); + ASSERT_EQ(base::NumberHelper::StringToDouble(sp.begin(), sp.end(), radix, base::NO_FLAGS), 9); +- str = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 21 "); ++ str = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 21 "); + sp = Span(str->GetDataUtf8(), str->GetUtf8Length() - 1); + ASSERT_EQ(base::NumberHelper::StringToDouble(sp.begin(), sp.end(), radix, base::NO_FLAGS), 7); + radix = 4; +- str = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 100 "); ++ str = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 100 "); + sp = Span(str->GetDataUtf8(), str->GetUtf8Length() - 1); + ASSERT_EQ(base::NumberHelper::StringToDouble(sp.begin(), sp.end(), radix, base::NO_FLAGS), 16); +- str = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 31 "); ++ str = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 31 "); + sp = Span(str->GetDataUtf8(), str->GetUtf8Length() - 1); + ASSERT_EQ(base::NumberHelper::StringToDouble(sp.begin(), sp.end(), radix, base::NO_FLAGS), 13); + radix = 8; +- str = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 100 "); ++ str = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 100 "); + sp = Span(str->GetDataUtf8(), str->GetUtf8Length() - 1); + ASSERT_EQ(base::NumberHelper::StringToDouble(sp.begin(), sp.end(), radix, base::NO_FLAGS), 64); +- str = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 71 "); ++ str = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 71 "); + sp = Span(str->GetDataUtf8(), str->GetUtf8Length() - 1); + ASSERT_EQ(base::NumberHelper::StringToDouble(sp.begin(), sp.end(), radix, base::NO_FLAGS), 57); + radix = 10; +- str = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 100 "); ++ str = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 100 "); + sp = Span(str->GetDataUtf8(), str->GetUtf8Length() - 1); + ASSERT_EQ(base::NumberHelper::StringToDouble(sp.begin(), sp.end(), radix, base::NO_FLAGS), 100); +- str = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 0020 "); ++ str = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 0020 "); + sp = Span(str->GetDataUtf8(), str->GetUtf8Length() - 1); + ASSERT_EQ(base::NumberHelper::StringToDouble(sp.begin(), sp.end(), radix, base::NO_FLAGS), 20); + radix = 16; +- str = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 100 "); ++ str = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 100 "); + sp = Span(str->GetDataUtf8(), str->GetUtf8Length() - 1); + ASSERT_EQ(base::NumberHelper::StringToDouble(sp.begin(), sp.end(), radix, base::NO_FLAGS), 256); +- str = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 1e "); ++ str = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 1e "); + sp = Span(str->GetDataUtf8(), str->GetUtf8Length() - 1); + ASSERT_EQ(base::NumberHelper::StringToDouble(sp.begin(), sp.end(), radix, base::NO_FLAGS), 30); + radix = 18; +- str = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 100 "); ++ str = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 100 "); + sp = Span(str->GetDataUtf8(), str->GetUtf8Length() - 1); + ASSERT_EQ(base::NumberHelper::StringToDouble(sp.begin(), sp.end(), radix, base::NO_FLAGS), 324); +- str = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 1g "); ++ str = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 1g "); + sp = Span(str->GetDataUtf8(), str->GetUtf8Length() - 1); + ASSERT_EQ(base::NumberHelper::StringToDouble(sp.begin(), sp.end(), radix, base::NO_FLAGS), 34); + radix = 25; +- str = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 100 "); ++ str = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 100 "); + sp = Span(str->GetDataUtf8(), str->GetUtf8Length() - 1); + ASSERT_EQ(base::NumberHelper::StringToDouble(sp.begin(), sp.end(), radix, base::NO_FLAGS), 625); +- str = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 1g "); ++ str = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 1g "); + sp = Span(str->GetDataUtf8(), str->GetUtf8Length() - 1); + ASSERT_EQ(base::NumberHelper::StringToDouble(sp.begin(), sp.end(), radix, base::NO_FLAGS), 41); + radix = 36; +- str = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 100 "); ++ str = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 100 "); + sp = Span(str->GetDataUtf8(), str->GetUtf8Length() - 1); + ASSERT_EQ(base::NumberHelper::StringToDouble(sp.begin(), sp.end(), radix, base::NO_FLAGS), 1296); +- str = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 1z "); ++ str = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 1z "); + sp = Span(str->GetDataUtf8(), str->GetUtf8Length() - 1); + ASSERT_EQ(base::NumberHelper::StringToDouble(sp.begin(), sp.end(), radix, base::NO_FLAGS), 71); + } + + TEST_F(BuiltinsNumberTest, NumberToString) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle res = factory->NewFromCanBeCompressString("100"); +- ASSERT_EQ(base::NumberHelper::NumberToString(thread, JSTaggedValue(100))->Compare(*res), 0); ++ ASSERT_EQ(base::NumberHelper::NumberToString(thread_, JSTaggedValue(100))->Compare(*res), 0); + res = factory->NewFromCanBeCompressString("11223344"); +- ASSERT_EQ(base::NumberHelper::NumberToString(thread, JSTaggedValue(11223344))->Compare(*res), 0); ++ ASSERT_EQ(base::NumberHelper::NumberToString(thread_, JSTaggedValue(11223344))->Compare(*res), 0); + res = factory->NewFromCanBeCompressString("1234567890"); +- ASSERT_EQ(base::NumberHelper::NumberToString(thread, JSTaggedValue(1234567890))->Compare(*res), 0); ++ ASSERT_EQ(base::NumberHelper::NumberToString(thread_, JSTaggedValue(1234567890))->Compare(*res), 0); + res = factory->NewFromCanBeCompressString("100"); +- ASSERT_EQ(base::NumberHelper::NumberToString(thread, JSTaggedValue(double(100.0)))->Compare(*res), 0); ++ ASSERT_EQ(base::NumberHelper::NumberToString(thread_, JSTaggedValue(double(100.0)))->Compare(*res), 0); + res = factory->NewFromCanBeCompressString("100.5"); +- ASSERT_EQ(base::NumberHelper::NumberToString(thread, JSTaggedValue(double(100.5)))->Compare(*res), 0); ++ ASSERT_EQ(base::NumberHelper::NumberToString(thread_, JSTaggedValue(double(100.5)))->Compare(*res), 0); + res = factory->NewFromCanBeCompressString("100.25"); +- ASSERT_EQ(base::NumberHelper::NumberToString(thread, JSTaggedValue(double(100.25)))->Compare(*res), 0); ++ ASSERT_EQ(base::NumberHelper::NumberToString(thread_, JSTaggedValue(double(100.25)))->Compare(*res), 0); + res = factory->NewFromCanBeCompressString("100.125"); +- ASSERT_EQ(base::NumberHelper::NumberToString(thread, JSTaggedValue(double(100.125)))->Compare(*res), 0); ++ ASSERT_EQ(base::NumberHelper::NumberToString(thread_, JSTaggedValue(double(100.125)))->Compare(*res), 0); + res = factory->NewFromCanBeCompressString("100.6125"); +- ASSERT_EQ(base::NumberHelper::NumberToString(thread, JSTaggedValue(double(100.6125)))->Compare(*res), 0); ++ ASSERT_EQ(base::NumberHelper::NumberToString(thread_, JSTaggedValue(double(100.6125)))->Compare(*res), 0); + res = factory->NewFromCanBeCompressString("0.0006125"); +- ASSERT_EQ(base::NumberHelper::NumberToString(thread, JSTaggedValue(double(0.0006125)))->Compare(*res), 0); ++ ASSERT_EQ(base::NumberHelper::NumberToString(thread_, JSTaggedValue(double(0.0006125)))->Compare(*res), 0); + res = factory->NewFromCanBeCompressString("-0.0006125"); +- ASSERT_EQ(base::NumberHelper::NumberToString(thread, JSTaggedValue(double(-0.0006125)))->Compare(*res), 0); ++ ASSERT_EQ(base::NumberHelper::NumberToString(thread_, JSTaggedValue(double(-0.0006125)))->Compare(*res), 0); + res = factory->NewFromCanBeCompressString("-1234567890.0006125"); +- ASSERT_EQ(base::NumberHelper::NumberToString(thread, JSTaggedValue(double(-1234567890.0006125)))->Compare(*res), 0); ++ ASSERT_EQ(base::NumberHelper::NumberToString(thread_, JSTaggedValue(double(-1234567890.0006125)))->Compare(*res), ++ 0); + res = factory->NewFromCanBeCompressString("1234567890.0006125"); +- ASSERT_EQ(base::NumberHelper::NumberToString(thread, JSTaggedValue(double(1234567890.0006125)))->Compare(*res), 0); ++ ASSERT_EQ(base::NumberHelper::NumberToString(thread_, JSTaggedValue(double(1234567890.0006125)))->Compare(*res), 0); + res = factory->NewFromCanBeCompressString("11234567890.000612"); +- ASSERT_EQ(base::NumberHelper::NumberToString(thread, JSTaggedValue(double(11234567890.0006125)))->Compare(*res), 0); ++ ASSERT_EQ(base::NumberHelper::NumberToString(thread_, JSTaggedValue(double(11234567890.0006125)))->Compare(*res), ++ 0); + } + } // namespace panda::test +diff --git a/tests/runtime/builtins/builtins_object_test.cpp b/tests/runtime/builtins/builtins_object_test.cpp +index 1dea4d5..18b6e07 100644 +--- a/tests/runtime/builtins/builtins_object_test.cpp ++++ b/tests/runtime/builtins/builtins_object_test.cpp +@@ -47,17 +47,17 @@ public: + + void SetUp() override + { +- TestHelper::CreateEcmaVMWithScope(instance, thread, scope); ++ TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); + } + + void TearDown() override + { +- TestHelper::DestroyEcmaVMWithScope(instance, scope); ++ TestHelper::DestroyEcmaVMWithScope(instance_, scope_); + } + +- PandaVM *instance {nullptr}; +- EcmaHandleScope *scope {nullptr}; +- JSThread *thread {nullptr}; ++ PandaVM *instance_ {nullptr}; ++ EcmaHandleScope *scope_ {nullptr}; ++ JSThread *thread_ {nullptr}; + }; + + JSTaggedValue CreateBuiltinJSObject(JSThread *thread, const CString keyCStr) +@@ -93,60 +93,60 @@ JSObject *TestNewJSObject(JSThread *thread, const JSHandle &dynClass) + // 19.1.1.1Object ( [ value ] ) + TEST_F(BuiltinsObjectTest, ObjectConstructor) + { +- JSHandle function(thread, BuiltinsObjectTestCreate(thread)); +- JSHandle objectFunc(thread, BuiltinsObjectTestCreate(thread)); +- JSHandle globalEnv = thread->GetEcmaVM()->GetGlobalEnv(); ++ JSHandle function(thread_, BuiltinsObjectTestCreate(thread_)); ++ JSHandle objectFunc(thread_, BuiltinsObjectTestCreate(thread_)); ++ JSHandle globalEnv = thread_->GetEcmaVM()->GetGlobalEnv(); + JSHandle objFun(globalEnv->GetObjectFunction()); + +- auto objCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); ++ auto objCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); + objCallInfo->SetFunction(JSTaggedValue::Undefined()); + objCallInfo->SetThis(JSTaggedValue::Undefined()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, objCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, objCallInfo.get()); + JSTaggedValue result = BuiltinsObject::ObjectConstructor(objCallInfo.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + + ASSERT_TRUE(result.IsECMAObject()); +- JSHandle jtHandle(thread, JSTaggedValue(reinterpret_cast(result.GetRawData()))); +- JSTaggedValue resultProto = jtHandle->GetPrototype(thread); ++ JSHandle jtHandle(thread_, JSTaggedValue(reinterpret_cast(result.GetRawData()))); ++ JSTaggedValue resultProto = jtHandle->GetPrototype(thread_); + JSTaggedValue funcProto = objectFunc->GetFunctionPrototype(); + ASSERT_EQ(resultProto, funcProto); + ASSERT_TRUE(jtHandle->IsExtensible()); + + // num_args = 0 + JSHandle object = +- thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle::Cast(function), function); +- auto tgObjCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue(*object), 4); ++ thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle::Cast(function), function); ++ auto tgObjCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue(*object), 4); + tgObjCallInfo->SetFunction(JSTaggedValue(*objFun)); + tgObjCallInfo->SetThis(JSTaggedValue::Undefined()); + tgObjCallInfo->SetNewTarget(JSTaggedValue(*objFun)); + +- prev = TestHelper::SetupFrame(thread, tgObjCallInfo.get()); ++ prev = TestHelper::SetupFrame(thread_, tgObjCallInfo.get()); + JSTaggedValue resultTg = BuiltinsObject::ObjectConstructor(tgObjCallInfo.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + ASSERT_TRUE(resultTg.IsObject()); +- JSHandle jtHandleTg(thread, JSTaggedValue(reinterpret_cast(resultTg.GetRawData()))); +- JSTaggedValue resultProtoTg = jtHandleTg->GetPrototype(thread); ++ JSHandle jtHandleTg(thread_, JSTaggedValue(reinterpret_cast(resultTg.GetRawData()))); ++ JSTaggedValue resultProtoTg = jtHandleTg->GetPrototype(thread_); + JSTaggedValue funcProtoTg = objectFunc->GetFunctionPrototype(); + ASSERT_EQ(resultProtoTg, funcProtoTg); + ASSERT_TRUE(jtHandleTg->IsExtensible()); + + // value is null + JSHandle objectVn = +- thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle::Cast(function), function); +- auto vnObjCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue(*objectVn), 6); ++ thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle::Cast(function), function); ++ auto vnObjCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue(*objectVn), 6); + vnObjCallInfo->SetFunction(JSTaggedValue(*objFun)); + vnObjCallInfo->SetThis(JSTaggedValue::Undefined()); + vnObjCallInfo->SetCallArg(0, JSTaggedValue::Null()); + vnObjCallInfo->SetNewTarget(JSTaggedValue(*objFun)); + +- prev = TestHelper::SetupFrame(thread, vnObjCallInfo.get()); ++ prev = TestHelper::SetupFrame(thread_, vnObjCallInfo.get()); + JSTaggedValue resultVn = BuiltinsObject::ObjectConstructor(vnObjCallInfo.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + + ASSERT_TRUE(resultVn.IsObject()); +- JSHandle jtHandleVn(thread, JSTaggedValue(reinterpret_cast(resultVn.GetRawData()))); +- JSTaggedValue resultProtoVn = jtHandleVn->GetPrototype(thread); ++ JSHandle jtHandleVn(thread_, JSTaggedValue(reinterpret_cast(resultVn.GetRawData()))); ++ JSTaggedValue resultProtoVn = jtHandleVn->GetPrototype(thread_); + JSTaggedValue funcProtoVn = objectFunc->GetFunctionPrototype(); + ASSERT_EQ(resultProtoVn, funcProtoVn); + ASSERT_TRUE(jtHandleVn->IsExtensible()); +@@ -155,197 +155,197 @@ TEST_F(BuiltinsObjectTest, ObjectConstructor) + // 19.1.2.1Object.assign ( target, ...sources ) + TEST_F(BuiltinsObjectTest, Assign) + { +- JSHandle function(thread, BuiltinsObjectTestCreate(thread)); ++ JSHandle function(thread_, BuiltinsObjectTestCreate(thread_)); + JSHandle objHandle1 = +- thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(function), function); ++ thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(function), function); + JSHandle objHandle2 = +- thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(function), function); ++ thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(function), function); + +- JSHandle key1(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("x")); +- JSHandle value1(thread, JSTaggedValue(1)); +- JSObject::SetProperty(thread, JSHandle(objHandle1), key1, value1); +- EXPECT_EQ(JSObject::GetProperty(thread, JSHandle(objHandle1), key1).GetValue()->GetInt(), 1); ++ JSHandle key1(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("x")); ++ JSHandle value1(thread_, JSTaggedValue(1)); ++ JSObject::SetProperty(thread_, JSHandle(objHandle1), key1, value1); ++ EXPECT_EQ(JSObject::GetProperty(thread_, JSHandle(objHandle1), key1).GetValue()->GetInt(), 1); + +- JSHandle key2(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("y")); +- JSHandle value2(thread, JSTaggedValue(2)); +- JSObject::SetProperty(thread, JSHandle(objHandle2), key2, value2); +- EXPECT_EQ(JSObject::GetProperty(thread, JSHandle(objHandle2), key2).GetValue()->GetInt(), 2); ++ JSHandle key2(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("y")); ++ JSHandle value2(thread_, JSTaggedValue(2)); ++ JSObject::SetProperty(thread_, JSHandle(objHandle2), key2, value2); ++ EXPECT_EQ(JSObject::GetProperty(thread_, JSHandle(objHandle2), key2).GetValue()->GetInt(), 2); + +- auto assignObjCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ auto assignObjCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + assignObjCallInfo->SetFunction(JSTaggedValue::Undefined()); + assignObjCallInfo->SetThis(JSTaggedValue::Undefined()); + assignObjCallInfo->SetCallArg(0, objHandle1.GetTaggedValue()); + assignObjCallInfo->SetCallArg(1, objHandle2.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, assignObjCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, assignObjCallInfo.get()); + JSTaggedValue result = BuiltinsObject::Assign(assignObjCallInfo.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + + ASSERT_TRUE(result.IsECMAObject()); +- JSHandle jtHandle(thread, JSTaggedValue(reinterpret_cast(result.GetRawData()))); +- EXPECT_EQ(JSObject::GetProperty(thread, jtHandle, key1).GetValue()->GetInt(), 1); +- EXPECT_EQ(JSObject::GetProperty(thread, jtHandle, key2).GetValue()->GetInt(), 2); ++ JSHandle jtHandle(thread_, JSTaggedValue(reinterpret_cast(result.GetRawData()))); ++ EXPECT_EQ(JSObject::GetProperty(thread_, jtHandle, key1).GetValue()->GetInt(), 1); ++ EXPECT_EQ(JSObject::GetProperty(thread_, jtHandle, key2).GetValue()->GetInt(), 2); + } + + // 19.1.2.2Object.create ( O [ , Properties ] ) + TEST_F(BuiltinsObjectTest, Create) + { +- JSHandle function(thread, BuiltinsObjectTestCreate(thread)); +- JSHandle objectFunc(thread, BuiltinsObjectTestCreate(thread)); +- JSHandle funcProto(thread, objectFunc->GetFunctionPrototype()); ++ JSHandle function(thread_, BuiltinsObjectTestCreate(thread_)); ++ JSHandle objectFunc(thread_, BuiltinsObjectTestCreate(thread_)); ++ JSHandle funcProto(thread_, objectFunc->GetFunctionPrototype()); + + // no prop +- auto objCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto objCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + objCallInfo->SetFunction(JSTaggedValue::Undefined()); + objCallInfo->SetThis(JSTaggedValue::Undefined()); + objCallInfo->SetCallArg(0, funcProto.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, objCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, objCallInfo.get()); + JSTaggedValue result = BuiltinsObject::Create(objCallInfo.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + + ASSERT_TRUE(result.IsECMAObject()); +- JSHandle jtHandle(thread, JSTaggedValue(reinterpret_cast(result.GetRawData()))); +- JSTaggedValue resultProto = jtHandle->GetPrototype(thread); ++ JSHandle jtHandle(thread_, JSTaggedValue(reinterpret_cast(result.GetRawData()))); ++ JSTaggedValue resultProto = jtHandle->GetPrototype(thread_); + ASSERT_EQ(resultProto, funcProto.GetTaggedValue()); + + // has prop +- JSHandle key(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("prop")); ++ JSHandle key(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("prop")); + JSHandle objHandle = +- thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle::Cast(function), function); ++ thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle::Cast(function), function); + EXPECT_TRUE(*objHandle != nullptr); + +- PropertyDescriptor desc(thread); ++ PropertyDescriptor desc(thread_); + desc.SetWritable(false); +- JSHandle descHandle(JSObject::FromPropertyDescriptor(thread, desc)); ++ JSHandle descHandle(JSObject::FromPropertyDescriptor(thread_, desc)); + +- PropertyDescriptor descNw(thread, JSHandle::Cast(descHandle), true, true, true); +- JSObject::DefineOwnProperty(thread, objHandle, key, descNw); ++ PropertyDescriptor descNw(thread_, JSHandle::Cast(descHandle), true, true, true); ++ JSObject::DefineOwnProperty(thread_, objHandle, key, descNw); + +- auto hpObjCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ auto hpObjCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + hpObjCallInfo->SetFunction(JSTaggedValue::Undefined()); + hpObjCallInfo->SetThis(JSTaggedValue::Undefined()); + hpObjCallInfo->SetCallArg(0, funcProto.GetTaggedValue()); + hpObjCallInfo->SetCallArg(1, objHandle.GetTaggedValue()); + +- prev = TestHelper::SetupFrame(thread, hpObjCallInfo.get()); ++ prev = TestHelper::SetupFrame(thread_, hpObjCallInfo.get()); + JSTaggedValue resultHp = BuiltinsObject::Create(hpObjCallInfo.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + + ASSERT_TRUE(resultHp.IsObject()); +- PropertyDescriptor descRes(thread); +- bool success = JSObject::GetOwnProperty(thread, JSHandle(thread, resultHp), key, descRes); ++ PropertyDescriptor descRes(thread_); ++ bool success = JSObject::GetOwnProperty(thread_, JSHandle(thread_, resultHp), key, descRes); + EXPECT_TRUE(success); + EXPECT_TRUE(!descRes.IsWritable()); + + // undefined +- auto unCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto unCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + unCallInfo->SetFunction(JSTaggedValue::Undefined()); + unCallInfo->SetThis(JSTaggedValue::Undefined()); + unCallInfo->SetCallArg(0, JSTaggedValue::Undefined()); + +- prev = TestHelper::SetupFrame(thread, unCallInfo.get()); ++ prev = TestHelper::SetupFrame(thread_, unCallInfo.get()); + JSTaggedValue resultUn = BuiltinsObject::Create(unCallInfo.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + ASSERT_EQ(resultUn.GetRawData(), JSTaggedValue::VALUE_EXCEPTION); + } + + // 19.1.2.3Object.defineProperties ( O, Properties ) + TEST_F(BuiltinsObjectTest, DefineProperties) + { +- JSHandle function(thread, BuiltinsObjectTestCreate(thread)); +- JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); ++ JSHandle function(thread_, BuiltinsObjectTestCreate(thread_)); ++ JSHandle env = thread_->GetEcmaVM()->GetGlobalEnv(); + JSHandle objFunc(env->GetObjectFunction()); + JSHandle objHandle = +- thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(function), function); +- JSHandle key(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("prop")); ++ thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(function), function); ++ JSHandle key(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("prop")); + JSHandle jsobjHandle = +- thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(function), function); ++ thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(function), function); + +- PropertyDescriptor desc(thread); ++ PropertyDescriptor desc(thread_); + desc.SetWritable(false); +- JSHandle descHandle(JSObject::FromPropertyDescriptor(thread, desc)); ++ JSHandle descHandle(JSObject::FromPropertyDescriptor(thread_, desc)); + +- PropertyDescriptor descNw(thread, JSHandle::Cast(descHandle), true, true, true); +- JSObject::DefineOwnProperty(thread, jsobjHandle, key, descNw); ++ PropertyDescriptor descNw(thread_, JSHandle::Cast(descHandle), true, true, true); ++ JSObject::DefineOwnProperty(thread_, jsobjHandle, key, descNw); + +- auto objCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ auto objCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + objCallInfo->SetFunction(JSTaggedValue::Undefined()); + objCallInfo->SetThis(JSTaggedValue::Undefined()); + objCallInfo->SetCallArg(0, objHandle.GetTaggedValue()); + objCallInfo->SetCallArg(1, jsobjHandle.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, objCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, objCallInfo.get()); + JSTaggedValue result = BuiltinsObject::DefineProperties(objCallInfo.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + + ASSERT_TRUE(result.IsECMAObject()); + JSTaggedValue res(reinterpret_cast(result.GetRawData())); +- PropertyDescriptor descRes(thread); +- JSObject::GetOwnProperty(thread, JSHandle(thread, res), key, descRes); ++ PropertyDescriptor descRes(thread_); ++ JSObject::GetOwnProperty(thread_, JSHandle(thread_, res), key, descRes); + EXPECT_TRUE(!descRes.IsWritable()); + } + + // 19.1.2.4Object.defineProperty ( O, P, Attributes ) + TEST_F(BuiltinsObjectTest, DefineProperty) + { +- JSHandle function(thread, BuiltinsObjectTestCreate(thread)); ++ JSHandle function(thread_, BuiltinsObjectTestCreate(thread_)); + +- JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); ++ JSHandle env = thread_->GetEcmaVM()->GetGlobalEnv(); + JSHandle objFunc(env->GetObjectFunction()); + JSHandle attHandle = +- thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(function), function); ++ thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(function), function); + JSHandle objHandle = +- thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(function), function); ++ thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(function), function); + +- PropertyDescriptor desc(thread); ++ PropertyDescriptor desc(thread_); + desc.SetWritable(true); +- JSHandle writableStr = thread->GlobalConstants()->GetHandledWritableString(); +- JSHandle writable(thread, JSTaggedValue(desc.IsWritable())); +- JSObject::CreateDataProperty(thread, attHandle, writableStr, writable); ++ JSHandle writableStr = thread_->GlobalConstants()->GetHandledWritableString(); ++ JSHandle writable(thread_, JSTaggedValue(desc.IsWritable())); ++ JSObject::CreateDataProperty(thread_, attHandle, writableStr, writable); + +- JSHandle key(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("x")); ++ JSHandle key(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("x")); + +- PropertyDescriptor descNw(thread); +- JSObject::GetOwnProperty(thread, objHandle, key, descNw); ++ PropertyDescriptor descNw(thread_); ++ JSObject::GetOwnProperty(thread_, objHandle, key, descNw); + EXPECT_TRUE(!descNw.HasWritable()); + +- auto objCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 10); ++ auto objCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 10); + objCallInfo->SetFunction(JSTaggedValue::Undefined()); + objCallInfo->SetThis(JSTaggedValue::Undefined()); + objCallInfo->SetCallArg(0, objHandle.GetTaggedValue()); + objCallInfo->SetCallArg(1, key.GetTaggedValue()); + objCallInfo->SetCallArg(2, attHandle.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, objCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, objCallInfo.get()); + JSTaggedValue result = BuiltinsObject::DefineProperty(objCallInfo.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + + ASSERT_TRUE(result.IsECMAObject()); + JSTaggedValue res(reinterpret_cast(result.GetRawData())); +- PropertyDescriptor descRes(thread); +- JSObject::GetOwnProperty(thread, JSHandle(thread, res), key, descRes); ++ PropertyDescriptor descRes(thread_); ++ JSObject::GetOwnProperty(thread_, JSHandle(thread_, res), key, descRes); + EXPECT_TRUE(descRes.HasWritable()); + } + + // B.2.2.2 Object.prototype.__defineGetter__ ( P, getter ) + TEST_F(BuiltinsObjectTest, DefineGetter) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + +- JSHandle obj(thread, CreateBuiltinJSObject(thread, "prop")); ++ JSHandle obj(thread_, CreateBuiltinJSObject(thread_, "prop")); + JSHandle key(factory->NewFromString("prop")); +- JSHandle getter(factory->NewJSFunction(thread->GetEcmaVM()->GetGlobalEnv())); ++ JSHandle getter(factory->NewJSFunction(thread_->GetEcmaVM()->GetGlobalEnv())); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(obj.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, key.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(1, getter.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsObject::DefineSetter(ecmaRuntimeCallInfo.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + + ASSERT_EQ(result.GetRawData(), JSTaggedValue::VALUE_UNDEFINED); + } +@@ -353,21 +353,21 @@ TEST_F(BuiltinsObjectTest, DefineGetter) + // B.2.2.3 Object.prototype.__defineSetter__ ( P, setter ) + TEST_F(BuiltinsObjectTest, DefineSetter) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + +- JSHandle obj(thread, CreateBuiltinJSObject(thread, "prop")); ++ JSHandle obj(thread_, CreateBuiltinJSObject(thread_, "prop")); + JSHandle key(factory->NewFromString("prop")); +- JSHandle setter(factory->NewJSFunction(thread->GetEcmaVM()->GetGlobalEnv())); ++ JSHandle setter(factory->NewJSFunction(thread_->GetEcmaVM()->GetGlobalEnv())); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(obj.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, key.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(1, setter.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsObject::DefineGetter(ecmaRuntimeCallInfo.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + + ASSERT_EQ(result.GetRawData(), JSTaggedValue::VALUE_UNDEFINED); + } +@@ -375,46 +375,46 @@ TEST_F(BuiltinsObjectTest, DefineSetter) + // B.2.2.4 Object.prototype.__lookupGetter__ ( P ) + TEST_F(BuiltinsObjectTest, LookupGetter) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + +- JSHandle obj(thread, CreateBuiltinJSObject(thread, "prop")); ++ JSHandle obj(thread_, CreateBuiltinJSObject(thread_, "prop")); + JSHandle key(factory->NewFromString("prop")); +- JSHandle getter(factory->NewJSFunction(thread->GetEcmaVM()->GetGlobalEnv())); ++ JSHandle getter(factory->NewJSFunction(thread_->GetEcmaVM()->GetGlobalEnv())); + + // First - getter should not be defined. +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(obj.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, key.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsObject::LookupGetter(ecmaRuntimeCallInfo.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + + ASSERT_EQ(result.GetRawData(), JSTaggedValue::VALUE_UNDEFINED); + + // Second - set a getter function. +- ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(obj.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, key.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(1, getter.GetTaggedValue()); + +- prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + result = BuiltinsObject::DefineGetter(ecmaRuntimeCallInfo.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + + ASSERT_EQ(result.GetRawData(), JSTaggedValue::VALUE_UNDEFINED); + + // Third - check the getter function if it really exists. +- ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(obj.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, key.GetTaggedValue()); + +- prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + result = BuiltinsObject::LookupGetter(ecmaRuntimeCallInfo.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + + ASSERT_EQ(result, getter.GetTaggedValue()); + } +@@ -422,46 +422,46 @@ TEST_F(BuiltinsObjectTest, LookupGetter) + // B.2.2.5 Object.prototype.__lookupSetter__ ( P ) + TEST_F(BuiltinsObjectTest, LookupSetter) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + +- JSHandle obj(thread, CreateBuiltinJSObject(thread, "prop")); ++ JSHandle obj(thread_, CreateBuiltinJSObject(thread_, "prop")); + JSHandle key(factory->NewFromString("prop")); +- JSHandle setter(factory->NewJSFunction(thread->GetEcmaVM()->GetGlobalEnv())); ++ JSHandle setter(factory->NewJSFunction(thread_->GetEcmaVM()->GetGlobalEnv())); + + // First - setter should not be defined. +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(obj.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, key.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsObject::LookupSetter(ecmaRuntimeCallInfo.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + + ASSERT_EQ(result.GetRawData(), JSTaggedValue::VALUE_UNDEFINED); + + // Second - set a setter function. +- ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(obj.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, key.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(1, setter.GetTaggedValue()); + +- prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + result = BuiltinsObject::DefineSetter(ecmaRuntimeCallInfo.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + + ASSERT_EQ(result.GetRawData(), JSTaggedValue::VALUE_UNDEFINED); + + // Third - check the setter function if it really exists. +- ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(obj.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, key.GetTaggedValue()); + +- prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + result = BuiltinsObject::LookupSetter(ecmaRuntimeCallInfo.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + + ASSERT_EQ(result, setter.GetTaggedValue()); + } +@@ -469,69 +469,69 @@ TEST_F(BuiltinsObjectTest, LookupSetter) + // 19.1.2.5Object.freeze ( O ) + TEST_F(BuiltinsObjectTest, Freeze) + { +- JSHandle function(thread, BuiltinsObjectTestCreate(thread)); ++ JSHandle function(thread_, BuiltinsObjectTestCreate(thread_)); + // An object is extensible by default, so it is also non-frozen. + JSHandle emptyObj = +- thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(function), function); ++ thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(function), function); + emptyObj->GetJSHClass()->SetExtensible(true); +- auto nofreezeObjCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto nofreezeObjCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + nofreezeObjCallInfo->SetFunction(JSTaggedValue::Undefined()); + nofreezeObjCallInfo->SetThis(JSTaggedValue::Undefined()); + nofreezeObjCallInfo->SetCallArg(0, emptyObj.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, nofreezeObjCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, nofreezeObjCallInfo.get()); + JSTaggedValue result = BuiltinsObject::IsFrozen(nofreezeObjCallInfo.get()); + + ASSERT_EQ(result.GetRawData(), JSTaggedValue::False().GetRawData()); + + BuiltinsObject::Freeze(nofreezeObjCallInfo.get()); + JSTaggedValue resultIs = BuiltinsObject::IsFrozen(nofreezeObjCallInfo.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + ASSERT_EQ(resultIs.GetRawData(), JSTaggedValue::True().GetRawData()); + } + + // ES2021 20.1.2.7 Object.fromEntries ( iterable ) + TEST_F(BuiltinsObjectTest, FromEntries) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + +- JSArray *arr1 = JSArray::Cast(JSArray::ArrayCreate(thread, JSTaggedNumber(0)).GetTaggedValue().GetHeapObject()); ++ JSArray *arr1 = JSArray::Cast(JSArray::ArrayCreate(thread_, JSTaggedNumber(0)).GetTaggedValue().GetHeapObject()); + EXPECT_TRUE(arr1 != nullptr); + +- JSArray *arr2 = JSArray::Cast(JSArray::ArrayCreate(thread, JSTaggedNumber(0)).GetTaggedValue().GetHeapObject()); ++ JSArray *arr2 = JSArray::Cast(JSArray::ArrayCreate(thread_, JSTaggedNumber(0)).GetTaggedValue().GetHeapObject()); + EXPECT_TRUE(arr2 != nullptr); + +- JSHandle obj(thread, arr1); ++ JSHandle obj(thread_, arr1); + +- JSHandle prop(thread, arr2); ++ JSHandle prop(thread_, arr2); + JSHandle fooStr = JSHandle(factory->NewFromString("foo")); + JSHandle barStr = JSHandle(factory->NewFromString("bar")); + +- PropertyDescriptor desc0(thread, fooStr, true, true, true); +- PropertyDescriptor desc1(thread, barStr, true, true, true); ++ PropertyDescriptor desc0(thread_, fooStr, true, true, true); ++ PropertyDescriptor desc1(thread_, barStr, true, true, true); + +- JSHandle key0(thread, JSTaggedValue(0)); +- JSHandle key1(thread, JSTaggedValue(1)); ++ JSHandle key0(thread_, JSTaggedValue(0)); ++ JSHandle key1(thread_, JSTaggedValue(1)); + +- JSArray::DefineOwnProperty(thread, prop, key0, desc0); +- JSArray::DefineOwnProperty(thread, prop, key1, desc1); ++ JSArray::DefineOwnProperty(thread_, prop, key0, desc0); ++ JSArray::DefineOwnProperty(thread_, prop, key1, desc1); + +- PropertyDescriptor descProp(thread, JSHandle(prop), true, true, true); +- JSArray::DefineOwnProperty(thread, obj, key0, descProp); ++ PropertyDescriptor descProp(thread_, JSHandle(prop), true, true, true); ++ JSArray::DefineOwnProperty(thread_, obj, key0, descProp); + +- auto objCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto objCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + objCallInfo->SetFunction(JSTaggedValue::Undefined()); + objCallInfo->SetThis(JSTaggedValue::Undefined()); + objCallInfo->SetCallArg(0, obj.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, objCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, objCallInfo.get()); + JSTaggedValue result = BuiltinsObject::FromEntries(objCallInfo.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + + ASSERT_TRUE(result.IsECMAObject()); + +- PropertyDescriptor desc(thread); +- JSObject::GetOwnProperty(thread, JSHandle(thread, result), fooStr, desc); ++ PropertyDescriptor desc(thread_); ++ JSObject::GetOwnProperty(thread_, JSHandle(thread_, result), fooStr, desc); + + ASSERT_TRUE(JSTaggedValue::SameValue(desc.GetValue().GetTaggedValue(), barStr.GetTaggedValue())); + } +@@ -539,94 +539,94 @@ TEST_F(BuiltinsObjectTest, FromEntries) + // 19.1.2.6 Object.getOwnPropertyDescriptor ( O, P ) + TEST_F(BuiltinsObjectTest, GetOwnPropertyDesciptor) + { +- JSHandle function(thread, BuiltinsObjectTestCreate(thread)); ++ JSHandle function(thread_, BuiltinsObjectTestCreate(thread_)); + JSHandle objHandle = +- thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(function), function); ++ thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(function), function); + +- JSHandle key(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("x")); ++ JSHandle key(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("x")); + +- PropertyDescriptor descEnum(thread); ++ PropertyDescriptor descEnum(thread_); + descEnum.SetWritable(true); +- JSTaggedValue::DefinePropertyOrThrow(thread, JSHandle(objHandle), key, descEnum); ++ JSTaggedValue::DefinePropertyOrThrow(thread_, JSHandle(objHandle), key, descEnum); + +- auto objCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ auto objCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + objCallInfo->SetFunction(JSTaggedValue::Undefined()); + objCallInfo->SetThis(JSTaggedValue::Undefined()); + objCallInfo->SetCallArg(0, objHandle.GetTaggedValue()); + objCallInfo->SetCallArg(1, key.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, objCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, objCallInfo.get()); + JSTaggedValue result = BuiltinsObject::GetOwnPropertyDesciptor(objCallInfo.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + + ASSERT_TRUE(result.IsECMAObject()); + +- JSHandle writableStr = thread->GlobalConstants()->GetHandledWritableString(); ++ JSHandle writableStr = thread_->GlobalConstants()->GetHandledWritableString(); + JSTaggedValue jt(reinterpret_cast(result.GetRawData())); +- PropertyDescriptor desc(thread); +- JSObject::GetOwnProperty(thread, JSHandle(thread, jt), writableStr, desc); ++ PropertyDescriptor desc(thread_); ++ JSObject::GetOwnProperty(thread_, JSHandle(thread_, jt), writableStr, desc); + ASSERT_TRUE(JSTaggedValue::SameValue(desc.GetValue().GetTaggedValue(), JSTaggedValue(true))); + } + + // ES2021 20.1.2.9 Object.getOwnPropertyDescriptors ( O ) + TEST_F(BuiltinsObjectTest, GetOwnPropertyDesciptors) + { +- JSHandle function(thread, BuiltinsObjectTestCreate(thread)); ++ JSHandle function(thread_, BuiltinsObjectTestCreate(thread_)); + JSHandle obj_handle = +- thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(function), function); ++ thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(function), function); + +- JSHandle keyX(thread->GetEcmaVM()->GetFactory()->NewFromString("x")); +- JSHandle value(thread, JSTaggedValue(22)); ++ JSHandle keyX(thread_->GetEcmaVM()->GetFactory()->NewFromString("x")); ++ JSHandle value(thread_, JSTaggedValue(22)); + +- JSObject::SetProperty(thread, obj_handle, keyX, value); ++ JSObject::SetProperty(thread_, obj_handle, keyX, value); + +- auto objCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ auto objCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + objCallInfo->SetFunction(JSTaggedValue::Undefined()); + objCallInfo->SetThis(JSTaggedValue::Undefined()); + objCallInfo->SetCallArg(0, obj_handle.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, objCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, objCallInfo.get()); + JSTaggedValue result = BuiltinsObject::GetOwnPropertyDesciptors(objCallInfo.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + + ASSERT_TRUE(result.IsECMAObject()); + +- JSHandle handle(thread, result); ++ JSHandle handle(thread_, result); + +- JSHandle prop = JSObject::GetProperty(thread, handle, keyX).GetValue(); ++ JSHandle prop = JSObject::GetProperty(thread_, handle, keyX).GetValue(); + +- JSHandle value_str = thread->GlobalConstants()->GetHandledValueString(); +- ASSERT_EQ(JSObject::GetProperty(thread, prop, value_str).GetValue()->GetInt(), 22); ++ JSHandle value_str = thread_->GlobalConstants()->GetHandledValueString(); ++ ASSERT_EQ(JSObject::GetProperty(thread_, prop, value_str).GetValue()->GetInt(), 22); + +- JSHandle enumerable_str = thread->GlobalConstants()->GetHandledEnumerableString(); +- ASSERT_EQ(JSObject::GetProperty(thread, prop, enumerable_str).GetValue().GetTaggedValue(), JSTaggedValue(true)); ++ JSHandle enumerable_str = thread_->GlobalConstants()->GetHandledEnumerableString(); ++ ASSERT_EQ(JSObject::GetProperty(thread_, prop, enumerable_str).GetValue().GetTaggedValue(), JSTaggedValue(true)); + +- JSHandle configurable_str = thread->GlobalConstants()->GetHandledConfigurableString(); +- ASSERT_EQ(JSObject::GetProperty(thread, prop, configurable_str).GetValue().GetTaggedValue(), JSTaggedValue(true)); ++ JSHandle configurable_str = thread_->GlobalConstants()->GetHandledConfigurableString(); ++ ASSERT_EQ(JSObject::GetProperty(thread_, prop, configurable_str).GetValue().GetTaggedValue(), JSTaggedValue(true)); + +- JSHandle writable_str = thread->GlobalConstants()->GetHandledWritableString(); +- ASSERT_EQ(JSObject::GetProperty(thread, prop, writable_str).GetValue().GetTaggedValue(), JSTaggedValue(true)); ++ JSHandle writable_str = thread_->GlobalConstants()->GetHandledWritableString(); ++ ASSERT_EQ(JSObject::GetProperty(thread_, prop, writable_str).GetValue().GetTaggedValue(), JSTaggedValue(true)); + } + + // 19.1.2.7 Object.getOwnPropertyNames ( O ) + TEST_F(BuiltinsObjectTest, GetOwnPropertyNames) + { +- JSHandle function(thread, BuiltinsObjectTestCreate(thread)); ++ JSHandle function(thread_, BuiltinsObjectTestCreate(thread_)); + JSHandle objHandle = +- thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(function), function); ++ thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(function), function); + +- JSHandle key(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("x")); +- JSHandle value(thread, JSTaggedValue(1)); +- JSObject::SetProperty(thread, JSHandle(objHandle), key, value); ++ JSHandle key(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("x")); ++ JSHandle value(thread_, JSTaggedValue(1)); ++ JSObject::SetProperty(thread_, JSHandle(objHandle), key, value); + +- auto objCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto objCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + objCallInfo->SetFunction(JSTaggedValue::Undefined()); + objCallInfo->SetThis(JSTaggedValue::Undefined()); + objCallInfo->SetCallArg(0, objHandle.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, objCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, objCallInfo.get()); + JSTaggedValue result = BuiltinsObject::GetOwnPropertyNames(objCallInfo.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + + ASSERT_TRUE(result.IsECMAObject()); + } +@@ -634,23 +634,23 @@ TEST_F(BuiltinsObjectTest, GetOwnPropertyNames) + // 19.1.2.8 Object.getOwnPropertySymbols ( O ) + TEST_F(BuiltinsObjectTest, GetOwnPropertySymbols) + { +- JSHandle function(thread, BuiltinsObjectTestCreate(thread)); ++ JSHandle function(thread_, BuiltinsObjectTestCreate(thread_)); + JSHandle objHandle = +- thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(function), function); +- JSHandle symbolKey = thread->GetEcmaVM()->GetFactory()->NewJSSymbol(); ++ thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(function), function); ++ JSHandle symbolKey = thread_->GetEcmaVM()->GetFactory()->NewJSSymbol(); + JSHandle key(symbolKey); +- JSHandle value(thread, JSTaggedValue(1)); +- JSObject::SetProperty(thread, JSHandle(objHandle), key, value); +- thread->ClearException(); ++ JSHandle value(thread_, JSTaggedValue(1)); ++ JSObject::SetProperty(thread_, JSHandle(objHandle), key, value); ++ thread_->ClearException(); + +- auto objCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto objCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + objCallInfo->SetFunction(JSTaggedValue::Undefined()); + objCallInfo->SetThis(JSTaggedValue::Undefined()); + objCallInfo->SetCallArg(0, objHandle.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, objCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, objCallInfo.get()); + JSTaggedValue result = BuiltinsObject::GetOwnPropertySymbols(objCallInfo.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + + ASSERT_TRUE(result.IsECMAObject()); + } +@@ -659,22 +659,22 @@ TEST_F(BuiltinsObjectTest, GetOwnPropertySymbols) + TEST_F(BuiltinsObjectTest, Is) + { + // js object compare +- JSHandle function(thread, BuiltinsObjectTestCreate(thread)); ++ JSHandle function(thread_, BuiltinsObjectTestCreate(thread_)); + + JSHandle obj1 = +- thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(function), function); ++ thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(function), function); + JSHandle obj2 = +- thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(function), function); ++ thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(function), function); + +- auto objCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ auto objCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + objCallInfo1->SetFunction(JSTaggedValue::Undefined()); + objCallInfo1->SetThis(JSTaggedValue::Undefined()); + objCallInfo1->SetCallArg(0, obj1.GetTaggedValue()); + objCallInfo1->SetCallArg(1, obj2.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, objCallInfo1.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, objCallInfo1.get()); + JSTaggedValue objResult1 = BuiltinsObject::Is(objCallInfo1.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + + ASSERT_EQ(objResult1.GetRawData(), JSTaggedValue::False().GetRawData()); + +@@ -683,69 +683,69 @@ TEST_F(BuiltinsObjectTest, Is) + ASSERT_EQ(objResult2.GetRawData(), JSTaggedValue::True().GetRawData()); + + // string compare +- JSHandle testStrValue1 = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("helloworld"); +- JSHandle testStrValue2 = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("helloworld"); ++ JSHandle testStrValue1 = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("helloworld"); ++ JSHandle testStrValue2 = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("helloworld"); + +- auto strCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ auto strCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + strCallInfo->SetFunction(JSTaggedValue::Undefined()); + strCallInfo->SetThis(JSTaggedValue::Undefined()); + strCallInfo->SetCallArg(0, testStrValue1.GetTaggedValue()); + strCallInfo->SetCallArg(1, testStrValue2.GetTaggedValue()); + +- prev = TestHelper::SetupFrame(thread, strCallInfo.get()); ++ prev = TestHelper::SetupFrame(thread_, strCallInfo.get()); + JSTaggedValue strResult = BuiltinsObject::Is(strCallInfo.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + + ASSERT_EQ(strResult.GetRawData(), JSTaggedValue::True().GetRawData()); + + // bool compare +- auto boolCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ auto boolCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + boolCallInfo->SetFunction(JSTaggedValue::Undefined()); + boolCallInfo->SetThis(JSTaggedValue::Undefined()); + boolCallInfo->SetCallArg(0, JSTaggedValue::True()); + boolCallInfo->SetCallArg(1, JSTaggedValue::False()); + +- prev = TestHelper::SetupFrame(thread, boolCallInfo.get()); ++ prev = TestHelper::SetupFrame(thread_, boolCallInfo.get()); + JSTaggedValue boolResult = BuiltinsObject::Is(boolCallInfo.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + + ASSERT_EQ(boolResult.GetRawData(), JSTaggedValue::False().GetRawData()); + + // number compare +- auto numCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ auto numCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + numCallInfo->SetFunction(JSTaggedValue::Undefined()); + numCallInfo->SetThis(JSTaggedValue::Undefined()); + numCallInfo->SetCallArg(0, JSTaggedValue(static_cast(0))); + numCallInfo->SetCallArg(1, JSTaggedValue(-0.0)); + +- prev = TestHelper::SetupFrame(thread, numCallInfo.get()); ++ prev = TestHelper::SetupFrame(thread_, numCallInfo.get()); + JSTaggedValue numResult = BuiltinsObject::Is(numCallInfo.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + + ASSERT_EQ(numResult.GetRawData(), JSTaggedValue::False().GetRawData()); + + // undefined or null compare +- auto nullCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ auto nullCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + nullCallInfo->SetFunction(JSTaggedValue::Undefined()); + nullCallInfo->SetThis(JSTaggedValue::Undefined()); + nullCallInfo->SetCallArg(0, JSTaggedValue::Null()); + nullCallInfo->SetCallArg(1, JSTaggedValue::Null()); + +- prev = TestHelper::SetupFrame(thread, nullCallInfo.get()); ++ prev = TestHelper::SetupFrame(thread_, nullCallInfo.get()); + JSTaggedValue nullResult = BuiltinsObject::Is(nullCallInfo.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + + ASSERT_EQ(nullResult.GetRawData(), JSTaggedValue::True().GetRawData()); + +- auto undefineCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ auto undefineCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + undefineCallInfo->SetFunction(JSTaggedValue::Undefined()); + undefineCallInfo->SetThis(JSTaggedValue::Undefined()); + undefineCallInfo->SetCallArg(0, JSTaggedValue::Undefined()); + undefineCallInfo->SetCallArg(1, JSTaggedValue::Undefined()); + +- prev = TestHelper::SetupFrame(thread, undefineCallInfo.get()); ++ prev = TestHelper::SetupFrame(thread_, undefineCallInfo.get()); + JSTaggedValue undefineResult = BuiltinsObject::Is(undefineCallInfo.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + + ASSERT_EQ(undefineResult.GetRawData(), JSTaggedValue::True().GetRawData()); + } +@@ -753,20 +753,20 @@ TEST_F(BuiltinsObjectTest, Is) + // 19.1.2.11 Object.isExtensible ( O ) + TEST_F(BuiltinsObjectTest, IsExtensible) + { +- JSHandle function(thread, BuiltinsObjectTestCreate(thread)); ++ JSHandle function(thread_, BuiltinsObjectTestCreate(thread_)); + + // New objects can be extended by default. + JSHandle emptyObj = +- thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(function), function); ++ thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(function), function); + emptyObj->GetJSHClass()->SetExtensible(true); +- auto emptyObjCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto emptyObjCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + emptyObjCallInfo->SetFunction(JSTaggedValue::Undefined()); + emptyObjCallInfo->SetThis(JSTaggedValue::Undefined()); + emptyObjCallInfo->SetCallArg(0, emptyObj.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, emptyObjCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, emptyObjCallInfo.get()); + JSTaggedValue result = BuiltinsObject::IsExtensible(emptyObjCallInfo.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + + ASSERT_EQ(result.GetRawData(), JSTaggedValue::True().GetRawData()); + +@@ -778,20 +778,20 @@ TEST_F(BuiltinsObjectTest, IsExtensible) + // 19.1.2.12 Object.isFrozen ( O ) + TEST_F(BuiltinsObjectTest, IsFrozen) + { +- JSHandle function(thread, BuiltinsObjectTestCreate(thread)); +- JSHandle key(thread->GetEcmaVM()->GetFactory()->NewFromString("x")); +- JSHandle value(thread, JSTaggedValue(1)); ++ JSHandle function(thread_, BuiltinsObjectTestCreate(thread_)); ++ JSHandle key(thread_->GetEcmaVM()->GetFactory()->NewFromString("x")); ++ JSHandle value(thread_, JSTaggedValue(1)); + + // An object is extensible by default, so it is also non-frozen. + JSHandle obj = +- thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle::Cast(function), function); ++ thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle::Cast(function), function); + obj->GetJSHClass()->SetExtensible(true); +- auto emptyObjCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto emptyObjCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + emptyObjCallInfo->SetFunction(JSTaggedValue::Undefined()); + emptyObjCallInfo->SetThis(JSTaggedValue::Undefined()); + emptyObjCallInfo->SetCallArg(0, obj.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, emptyObjCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, emptyObjCallInfo.get()); + + JSTaggedValue result = BuiltinsObject::IsFrozen(emptyObjCallInfo.get()); + ASSERT_EQ(result.GetRawData(), JSTaggedValue::False().GetRawData()); +@@ -799,37 +799,37 @@ TEST_F(BuiltinsObjectTest, IsFrozen) + JSTaggedValue result_nex = BuiltinsObject::IsFrozen(emptyObjCallInfo.get()); + ASSERT_EQ(result_nex.GetRawData(), JSTaggedValue::True().GetRawData()); + +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + +- PropertyDescriptor desc_enum(thread); ++ PropertyDescriptor desc_enum(thread_); + desc_enum.SetConfigurable(true); + desc_enum.SetWritable(false); + obj->GetJSHClass()->SetExtensible(true); +- JSTaggedValue::DefinePropertyOrThrow(thread, JSHandle(obj), key, desc_enum); ++ JSTaggedValue::DefinePropertyOrThrow(thread_, JSHandle(obj), key, desc_enum); + obj->GetJSHClass()->SetExtensible(false); +- auto emptyObjCallInfo2 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto emptyObjCallInfo2 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + emptyObjCallInfo2->SetFunction(JSTaggedValue::Undefined()); + emptyObjCallInfo2->SetThis(JSTaggedValue::Undefined()); + emptyObjCallInfo2->SetCallArg(0, obj.GetTaggedValue()); + +- prev = TestHelper::SetupFrame(thread, emptyObjCallInfo2.get()); ++ prev = TestHelper::SetupFrame(thread_, emptyObjCallInfo2.get()); + JSTaggedValue result_nw = BuiltinsObject::IsFrozen(emptyObjCallInfo2.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + + ASSERT_EQ(result_nw.GetRawData(), JSTaggedValue::False().GetRawData()); + + desc_enum.SetConfigurable(false); + obj->GetJSHClass()->SetExtensible(true); +- JSTaggedValue::DefinePropertyOrThrow(thread, JSHandle(obj), key, desc_enum); ++ JSTaggedValue::DefinePropertyOrThrow(thread_, JSHandle(obj), key, desc_enum); + obj->GetJSHClass()->SetExtensible(false); +- auto emptyObjCallInfo3 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto emptyObjCallInfo3 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + emptyObjCallInfo3->SetFunction(JSTaggedValue::Undefined()); + emptyObjCallInfo3->SetThis(JSTaggedValue::Undefined()); + emptyObjCallInfo3->SetCallArg(0, obj.GetTaggedValue()); + +- prev = TestHelper::SetupFrame(thread, emptyObjCallInfo3.get()); ++ prev = TestHelper::SetupFrame(thread_, emptyObjCallInfo3.get()); + JSTaggedValue result_nc = BuiltinsObject::IsFrozen(emptyObjCallInfo3.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + + ASSERT_EQ(result_nc.GetRawData(), JSTaggedValue::True().GetRawData()); + } +@@ -837,20 +837,20 @@ TEST_F(BuiltinsObjectTest, IsFrozen) + // 19.1.2.13 Object.isSealed ( O ) + TEST_F(BuiltinsObjectTest, IsSealed) + { +- JSHandle function(thread, BuiltinsObjectTestCreate(thread)); ++ JSHandle function(thread_, BuiltinsObjectTestCreate(thread_)); + + // An object is extensible by default, so it is also non-frozen. + JSHandle emptyObj = +- thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(function), function); ++ thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(function), function); + emptyObj->GetJSHClass()->SetExtensible(true); +- auto emptyObjCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto emptyObjCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + emptyObjCallInfo->SetFunction(JSTaggedValue::Undefined()); + emptyObjCallInfo->SetThis(JSTaggedValue::Undefined()); + emptyObjCallInfo->SetCallArg(0, emptyObj.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, emptyObjCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, emptyObjCallInfo.get()); + JSTaggedValue result = BuiltinsObject::IsSealed(emptyObjCallInfo.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + + ASSERT_EQ(result.GetRawData(), JSTaggedValue::False().GetRawData()); + } +@@ -858,15 +858,15 @@ TEST_F(BuiltinsObjectTest, IsSealed) + // Object.keys(obj) + TEST_F(BuiltinsObjectTest, Keys) + { +- JSHandle obj(thread, CreateBuiltinJSObject(thread, "x")); +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ JSHandle obj(thread_, CreateBuiltinJSObject(thread_, "x")); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetCallArg(0, obj.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsObject::Keys(ecmaRuntimeCallInfo.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + + ASSERT_TRUE(result.IsECMAObject()); + } +@@ -874,33 +874,33 @@ TEST_F(BuiltinsObjectTest, Keys) + // Object.preventExtensions(obj) + TEST_F(BuiltinsObjectTest, PreventExtensions) + { +- JSHandle obj = JSHandle(thread, CreateBuiltinJSObject(thread, "x")); ++ JSHandle obj = JSHandle(thread_, CreateBuiltinJSObject(thread_, "x")); + obj->GetJSHClass()->SetExtensible(true); +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetCallArg(0, obj.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsObject::PreventExtensions(ecmaRuntimeCallInfo.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + + ASSERT_TRUE(result.IsECMAObject()); + JSTaggedValue jt(reinterpret_cast(result.GetRawData())); +- JSHandle jtHandle(thread, jt); ++ JSHandle jtHandle(thread_, jt); + ASSERT_TRUE(!jtHandle->IsExtensible()); + } + + // Object.seal(obj) + TEST_F(BuiltinsObjectTest, Seal) + { +- JSHandle obj(thread, CreateBuiltinJSObject(thread, "x")); +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ JSHandle obj(thread_, CreateBuiltinJSObject(thread_, "x")); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetCallArg(0, obj.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsObject::Seal(ecmaRuntimeCallInfo.get()); + + ASSERT_TRUE(result.IsECMAObject()); +@@ -908,77 +908,77 @@ TEST_F(BuiltinsObjectTest, Seal) + + // test isSealed(). + JSTaggedValue res = BuiltinsObject::IsSealed(ecmaRuntimeCallInfo.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + ASSERT_EQ(res.GetRawData(), JSTaggedValue::True().GetRawData()); + } + + // Object.setPrototypeOf(obj, prototype) + TEST_F(BuiltinsObjectTest, SetPrototypeOf) + { +- JSHandle obj(thread, CreateBuiltinJSObject(thread, "x")); +- JSHandle objFather(thread, CreateBuiltinJSObject(thread, "y")); ++ JSHandle obj(thread_, CreateBuiltinJSObject(thread_, "x")); ++ JSHandle objFather(thread_, CreateBuiltinJSObject(thread_, "y")); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetCallArg(0, obj.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(1, objFather.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsObject::SetPrototypeOf(ecmaRuntimeCallInfo.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + + ASSERT_TRUE(result.IsECMAObject()); + ASSERT_EQ(result.GetRawData(), obj.GetTaggedValue().GetRawData()); + + // test obj has property "y". +- JSHandle key(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("y")); +- EXPECT_EQ(JSObject::GetProperty(thread, JSHandle(obj), key).GetValue()->GetInt(), 1); ++ JSHandle key(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("y")); ++ EXPECT_EQ(JSObject::GetProperty(thread_, JSHandle(obj), key).GetValue()->GetInt(), 1); + } + + // Object.values(obj) + TEST_F(BuiltinsObjectTest, Values) + { +- JSHandle obj(thread, CreateBuiltinJSObject(thread, "x")); +- JSHandle key(thread->GetEcmaVM()->GetFactory()->NewFromString("y")); +- JSHandle value(thread, JSTaggedValue(22)); ++ JSHandle obj(thread_, CreateBuiltinJSObject(thread_, "x")); ++ JSHandle key(thread_->GetEcmaVM()->GetFactory()->NewFromString("y")); ++ JSHandle value(thread_, JSTaggedValue(22)); + +- JSObject::SetProperty(thread, obj, key, value); ++ JSObject::SetProperty(thread_, obj, key, value); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetCallArg(0, obj.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsObject::Values(ecmaRuntimeCallInfo.get()); + + EXPECT_TRUE(result.IsECMAObject()); + +- JSHandle handle(thread, result); +- JSHandle index0(thread, JSTaggedValue(0)); +- JSHandle index1(thread, JSTaggedValue(1)); ++ JSHandle handle(thread_, result); ++ JSHandle index0(thread_, JSTaggedValue(0)); ++ JSHandle index1(thread_, JSTaggedValue(1)); + +- ASSERT_EQ(JSObject::GetProperty(thread, JSHandle(handle), index0).GetValue()->GetInt(), 1); +- ASSERT_EQ(JSObject::GetProperty(thread, JSHandle(handle), index1).GetValue()->GetInt(), 22); ++ ASSERT_EQ(JSObject::GetProperty(thread_, JSHandle(handle), index0).GetValue()->GetInt(), 1); ++ ASSERT_EQ(JSObject::GetProperty(thread_, JSHandle(handle), index1).GetValue()->GetInt(), 22); + } + + // obj.hasOwnProperty(prop) + TEST_F(BuiltinsObjectTest, HasOwnProperty) + { +- JSHandle obj(thread, CreateBuiltinJSObject(thread, "x")); ++ JSHandle obj(thread_, CreateBuiltinJSObject(thread_, "x")); + CString keyCStr = "x"; +- JSHandle keyString = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(&keyCStr[0]); ++ JSHandle keyString = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(&keyCStr[0]); + JSHandle key(keyString); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(obj.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, key.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsObject::HasOwnProperty(ecmaRuntimeCallInfo.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + + ASSERT_EQ(result.GetRawData(), JSTaggedValue::True().GetRawData()); + } +@@ -986,47 +986,47 @@ TEST_F(BuiltinsObjectTest, HasOwnProperty) + // prototypeObj.isPrototypeOf(object) + TEST_F(BuiltinsObjectTest, IsPrototypeOfFalse) + { +- JSHandle obj(thread, CreateBuiltinJSObject(thread, "x")); +- JSHandle objFather(thread, CreateBuiltinJSObject(thread, "y")); ++ JSHandle obj(thread_, CreateBuiltinJSObject(thread_, "x")); ++ JSHandle objFather(thread_, CreateBuiltinJSObject(thread_, "y")); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(objFather.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, obj.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result1 = BuiltinsObject::IsPrototypeOf(ecmaRuntimeCallInfo.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + + ASSERT_EQ(result1.GetRawData(), JSTaggedValue::False().GetRawData()); + } + + TEST_F(BuiltinsObjectTest, IsPrototypeOfTrue) + { +- JSHandle obj(thread, CreateBuiltinJSObject(thread, "x")); +- JSHandle objFather(thread, CreateBuiltinJSObject(thread, "y")); ++ JSHandle obj(thread_, CreateBuiltinJSObject(thread_, "x")); ++ JSHandle objFather(thread_, CreateBuiltinJSObject(thread_, "y")); + +- auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + ecmaRuntimeCallInfo1->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo1->SetThis(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo1->SetCallArg(0, obj.GetTaggedValue()); + ecmaRuntimeCallInfo1->SetCallArg(1, objFather.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); + JSTaggedValue result1 = BuiltinsObject::SetPrototypeOf(ecmaRuntimeCallInfo1.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + + ASSERT_TRUE(result1.IsObject()); + ASSERT_EQ(result1.GetRawData(), obj->GetRawData()); + +- auto ecmaRuntimeCallInfo2 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto ecmaRuntimeCallInfo2 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo2->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo2->SetThis(objFather.GetTaggedValue()); + ecmaRuntimeCallInfo2->SetCallArg(0, obj.GetTaggedValue()); + +- prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo2.get()); ++ prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo2.get()); + JSTaggedValue result2 = BuiltinsObject::IsPrototypeOf(ecmaRuntimeCallInfo2.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + + ASSERT_EQ(result2.GetRawData(), JSTaggedValue::True().GetRawData()); + } +@@ -1034,17 +1034,17 @@ TEST_F(BuiltinsObjectTest, IsPrototypeOfTrue) + // obj.propertyIsEnumerable(prop) + TEST_F(BuiltinsObjectTest, PropertyIsEnumerable) + { +- JSHandle obj(thread, CreateBuiltinJSObject(thread, "x")); +- JSHandle key(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("x")); ++ JSHandle obj(thread_, CreateBuiltinJSObject(thread_, "x")); ++ JSHandle key(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("x")); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(obj.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, key.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsObject::PropertyIsEnumerable(ecmaRuntimeCallInfo.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + + ASSERT_EQ(result.GetRawData(), JSTaggedValue::True().GetRawData()); + } +@@ -1052,23 +1052,24 @@ TEST_F(BuiltinsObjectTest, PropertyIsEnumerable) + // obj.toLocaleString() + TEST_F(BuiltinsObjectTest, ToLocaleString) + { +- JSHandle obj(thread, CreateBuiltinJSObject(thread, "x")); +- JSHandle calleeFunc = thread->GetEcmaVM()->GetFactory()->NewJSFunction( +- thread->GetEcmaVM()->GetGlobalEnv(), reinterpret_cast(BuiltinsObject::ToString)); ++ JSHandle obj(thread_, CreateBuiltinJSObject(thread_, "x")); ++ JSHandle calleeFunc = thread_->GetEcmaVM()->GetFactory()->NewJSFunction( ++ thread_->GetEcmaVM()->GetGlobalEnv(), reinterpret_cast(BuiltinsObject::ToString)); + JSHandle calleeValue(calleeFunc); +- JSHandle calleeKey(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("toString")); +- JSObject::SetProperty(thread, obj, calleeKey, calleeValue); ++ JSHandle calleeKey(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("toString")); ++ JSObject::SetProperty(thread_, obj, calleeKey, calleeValue); + +- JSHandle resultValue = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("[object Object]"); ++ JSHandle resultValue = ++ thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("[object Object]"); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(obj.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, obj.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsObject::ToLocaleString(ecmaRuntimeCallInfo.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + + ASSERT_TRUE(result.IsString()); + ASSERT_EQ(resultValue->Compare(reinterpret_cast(result.GetRawData())), 0); +@@ -1077,111 +1078,112 @@ TEST_F(BuiltinsObjectTest, ToLocaleString) + // obj.toString() + TEST_F(BuiltinsObjectTest, ToString) + { +- JSHandle obj = JSHandle(thread, CreateBuiltinJSObject(thread, "x")); ++ JSHandle obj = JSHandle(thread_, CreateBuiltinJSObject(thread_, "x")); + + // object +- JSHandle resultValue = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("[object Object]"); +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); ++ JSHandle resultValue = ++ thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("[object Object]"); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(obj.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsObject::ToString(ecmaRuntimeCallInfo.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + + ASSERT_TRUE(result.IsString()); + ASSERT_EQ(resultValue->Compare(reinterpret_cast(result.GetRawData())), 0); + + // array +- JSHandle arr = thread->GetEcmaVM()->GetFactory()->NewJSArray(); ++ JSHandle arr = thread_->GetEcmaVM()->GetFactory()->NewJSArray(); + JSHandle resultArrValue = +- thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("[object Array]"); +- auto arrEcmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); ++ thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("[object Array]"); ++ auto arrEcmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); + arrEcmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + arrEcmaRuntimeCallInfo->SetThis(arr.GetTaggedValue()); + +- prev = TestHelper::SetupFrame(thread, arrEcmaRuntimeCallInfo.get()); ++ prev = TestHelper::SetupFrame(thread_, arrEcmaRuntimeCallInfo.get()); + JSTaggedValue resultArr = BuiltinsObject::ToString(arrEcmaRuntimeCallInfo.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + + ASSERT_TRUE(resultArr.IsString()); + ASSERT_EQ(resultArrValue->Compare(reinterpret_cast(resultArr.GetRawData())), 0); + + // string +- JSHandle str = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("hello"); ++ JSHandle str = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("hello"); + JSHandle resultStrValue = +- thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("[object String]"); +- auto strEcmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); ++ thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("[object String]"); ++ auto strEcmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); + strEcmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + strEcmaRuntimeCallInfo->SetThis(str.GetTaggedValue()); + +- prev = TestHelper::SetupFrame(thread, strEcmaRuntimeCallInfo.get()); ++ prev = TestHelper::SetupFrame(thread_, strEcmaRuntimeCallInfo.get()); + JSTaggedValue resultStr = BuiltinsObject::ToString(strEcmaRuntimeCallInfo.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + + ASSERT_TRUE(resultStr.IsString()); + ASSERT_EQ(resultStrValue->Compare(reinterpret_cast(resultStr.GetRawData())), 0); + + // function +- JSHandle func = thread->GetEcmaVM()->GetFactory()->NewJSFunction(thread->GetEcmaVM()->GetGlobalEnv()); ++ JSHandle func = thread_->GetEcmaVM()->GetFactory()->NewJSFunction(thread_->GetEcmaVM()->GetGlobalEnv()); + JSHandle resultFuncValue = +- thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("[object Function]"); +- auto funcEcmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); ++ thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("[object Function]"); ++ auto funcEcmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); + funcEcmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + funcEcmaRuntimeCallInfo->SetThis(func.GetTaggedValue()); + +- prev = TestHelper::SetupFrame(thread, funcEcmaRuntimeCallInfo.get()); ++ prev = TestHelper::SetupFrame(thread_, funcEcmaRuntimeCallInfo.get()); + JSTaggedValue resultFunc = BuiltinsObject::ToString(funcEcmaRuntimeCallInfo.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + + ASSERT_TRUE(resultFunc.IsString()); + ASSERT_EQ(resultFuncValue->Compare(reinterpret_cast(resultFunc.GetRawData())), 0); + + // error +- auto ecmaVM = thread->GetEcmaVM(); ++ auto ecmaVM = thread_->GetEcmaVM(); + JSHandle env = ecmaVM->GetGlobalEnv(); + JSHandle errorObject = env->GetErrorFunction(); + JSHandle error = +- thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(errorObject), errorObject); +- JSHandle errorValue = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("[object Error]"); +- auto errorEcmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); ++ thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(errorObject), errorObject); ++ JSHandle errorValue = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("[object Error]"); ++ auto errorEcmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); + errorEcmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + errorEcmaRuntimeCallInfo->SetThis(error.GetTaggedValue()); + +- prev = TestHelper::SetupFrame(thread, errorEcmaRuntimeCallInfo.get()); ++ prev = TestHelper::SetupFrame(thread_, errorEcmaRuntimeCallInfo.get()); + JSTaggedValue resultError = BuiltinsObject::ToString(errorEcmaRuntimeCallInfo.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + + ASSERT_TRUE(resultError.IsString()); + ASSERT_EQ(errorValue->Compare(reinterpret_cast(resultError.GetRawData())), 0); + + // boolean +- JSHandle value(thread, JSTaggedValue::False()); ++ JSHandle value(thread_, JSTaggedValue::False()); + JSHandle booleanObject(env->GetBooleanFunction()); +- JSHandle boolean = thread->GetEcmaVM()->GetFactory()->NewJSPrimitiveRef(booleanObject, value); ++ JSHandle boolean = thread_->GetEcmaVM()->GetFactory()->NewJSPrimitiveRef(booleanObject, value); + JSHandle resultBoolValue = +- thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("[object Boolean]"); +- auto boolEcmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); ++ thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("[object Boolean]"); ++ auto boolEcmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); + boolEcmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + boolEcmaRuntimeCallInfo->SetThis(boolean.GetTaggedValue()); + +- prev = TestHelper::SetupFrame(thread, boolEcmaRuntimeCallInfo.get()); ++ prev = TestHelper::SetupFrame(thread_, boolEcmaRuntimeCallInfo.get()); + JSTaggedValue resultBool = BuiltinsObject::ToString(boolEcmaRuntimeCallInfo.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + + ASSERT_TRUE(resultBool.IsString()); + ASSERT_EQ(resultBoolValue->Compare(reinterpret_cast(resultBool.GetRawData())), 0); + + // number + JSHandle resultNumValue = +- thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("[object Number]"); +- auto numEcmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); ++ thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("[object Number]"); ++ auto numEcmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); + numEcmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + numEcmaRuntimeCallInfo->SetThis(JSTaggedValue(static_cast(0))); + +- prev = TestHelper::SetupFrame(thread, numEcmaRuntimeCallInfo.get()); ++ prev = TestHelper::SetupFrame(thread_, numEcmaRuntimeCallInfo.get()); + JSTaggedValue resultNum = BuiltinsObject::ToString(numEcmaRuntimeCallInfo.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + + ASSERT_TRUE(resultNum.IsString()); + ASSERT_EQ(resultNumValue->Compare(reinterpret_cast(resultNum.GetRawData())), 0); +@@ -1190,15 +1192,15 @@ TEST_F(BuiltinsObjectTest, ToString) + // object.valueOf() + TEST_F(BuiltinsObjectTest, ValueOf) + { +- JSHandle obj(thread, CreateBuiltinJSObject(thread, "x")); +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ JSHandle obj(thread_, CreateBuiltinJSObject(thread_, "x")); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(obj.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, obj.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsObject::ValueOf(ecmaRuntimeCallInfo.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + + ASSERT_TRUE(result.IsECMAObject()); + } +diff --git a/tests/runtime/builtins/builtins_promise_test.cpp b/tests/runtime/builtins/builtins_promise_test.cpp +index b924f24..5d4902b 100644 +--- a/tests/runtime/builtins/builtins_promise_test.cpp ++++ b/tests/runtime/builtins/builtins_promise_test.cpp +@@ -49,17 +49,17 @@ public: + + void SetUp() override + { +- TestHelper::CreateEcmaVMWithScope(instance, thread, scope); ++ TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); + } + + void TearDown() override + { +- TestHelper::DestroyEcmaVMWithScope(instance, scope); ++ TestHelper::DestroyEcmaVMWithScope(instance_, scope_); + } + +- PandaVM *instance {nullptr}; +- EcmaHandleScope *scope {nullptr}; +- JSThread *thread {nullptr}; ++ PandaVM *instance_ {nullptr}; ++ EcmaHandleScope *scope_ {nullptr}; ++ JSThread *thread_ {nullptr}; + }; + + // native function for race2 then_on_rejected() +@@ -128,12 +128,12 @@ JSTaggedValue TestPromiseThenOnRejected(EcmaRuntimeCallInfo *argv) + */ + TEST_F(BuiltinsPromiseTest, Reject1) + { +- JSHandle env = EcmaVM::Cast(instance)->GetGlobalEnv(); ++ JSHandle env = EcmaVM::Cast(instance_)->GetGlobalEnv(); + + JSHandle promise = JSHandle::Cast(env->GetPromiseFunction()); +- JSHandle paramMsg(thread, JSTaggedValue(3)); ++ JSHandle paramMsg(thread_, JSTaggedValue(3)); + +- auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue(*promise), 6); ++ auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue(*promise), 6); + ecmaRuntimeCallInfo1->SetFunction(promise.GetTaggedValue()); + ecmaRuntimeCallInfo1->SetThis(promise.GetTaggedValue()); + ecmaRuntimeCallInfo1->SetCallArg(0, paramMsg.GetTaggedValue()); +@@ -141,9 +141,9 @@ TEST_F(BuiltinsPromiseTest, Reject1) + /** + * @tc.steps: var p1 = Promise.reject(3). + */ +- [[maybe_unused]] auto prevReject = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); ++ [[maybe_unused]] auto prevReject = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); + JSTaggedValue result = BuiltinsPromise::Reject(ecmaRuntimeCallInfo1.get()); +- JSHandle rejectPromise(thread, result); ++ JSHandle rejectPromise(thread_, result); + EXPECT_EQ(JSTaggedValue::SameValue(rejectPromise->GetPromiseState(), + JSTaggedValue(static_cast(PromiseStatus::REJECTED))), + true); +@@ -157,8 +157,8 @@ TEST_F(BuiltinsPromiseTest, Reject1) + */ + TEST_F(BuiltinsPromiseTest, Reject2) + { +- ObjectFactory *factory = EcmaVM::Cast(instance)->GetFactory(); +- JSHandle env = EcmaVM::Cast(instance)->GetGlobalEnv(); ++ ObjectFactory *factory = EcmaVM::Cast(instance_)->GetFactory(); ++ JSHandle env = EcmaVM::Cast(instance_)->GetGlobalEnv(); + + // constructor promise1 + JSHandle promise = JSHandle::Cast(env->GetPromiseFunction()); +@@ -168,14 +168,14 @@ TEST_F(BuiltinsPromiseTest, Reject2) + /** + * @tc.steps: step1. var p1 = Promise.reject("Promise reject") + */ +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, promise.GetTaggedValue(), 6); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, promise.GetTaggedValue(), 6); + ecmaRuntimeCallInfo->SetFunction(promise.GetTaggedValue()); + ecmaRuntimeCallInfo->SetThis(promise.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, paramMsg1.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsPromise::Reject(ecmaRuntimeCallInfo.get()); +- JSHandle promise1(thread, result); ++ JSHandle promise1(thread_, result); + EXPECT_EQ(JSTaggedValue::SameValue(promise1->GetPromiseState(), + JSTaggedValue(static_cast(PromiseStatus::REJECTED))), + true); +@@ -184,14 +184,14 @@ TEST_F(BuiltinsPromiseTest, Reject2) + /** + * @tc.steps: step2. var p2 = Promise.reject(p1) + */ +- auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, promise.GetTaggedValue(), 6); ++ auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, promise.GetTaggedValue(), 6); + ecmaRuntimeCallInfo1->SetFunction(promise.GetTaggedValue()); + ecmaRuntimeCallInfo1->SetThis(promise.GetTaggedValue()); + ecmaRuntimeCallInfo1->SetCallArg(0, promise1.GetTaggedValue()); +- [[maybe_unused]] auto prev1 = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); ++ [[maybe_unused]] auto prev1 = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); + + JSTaggedValue result1 = BuiltinsPromise::Reject(ecmaRuntimeCallInfo1.get()); +- JSHandle promise2(thread, result1); ++ JSHandle promise2(thread_, result1); + EXPECT_NE(*promise1, *promise2); + EXPECT_EQ(JSTaggedValue::SameValue(promise2->GetPromiseState(), + JSTaggedValue(static_cast(PromiseStatus::REJECTED))), +@@ -208,22 +208,22 @@ TEST_F(BuiltinsPromiseTest, Reject2) + */ + TEST_F(BuiltinsPromiseTest, Resolve1) + { +- JSHandle env = EcmaVM::Cast(instance)->GetGlobalEnv(); ++ JSHandle env = EcmaVM::Cast(instance_)->GetGlobalEnv(); + + JSHandle promise = JSHandle::Cast(env->GetPromiseFunction()); +- JSHandle paramMsg(thread, JSTaggedValue(5)); ++ JSHandle paramMsg(thread_, JSTaggedValue(5)); + + /** + * @tc.steps: step1. var p1 = Promise.resolve(12345) + */ +- auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue(*promise), 6); ++ auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue(*promise), 6); + ecmaRuntimeCallInfo1->SetFunction(promise.GetTaggedValue()); + ecmaRuntimeCallInfo1->SetThis(promise.GetTaggedValue()); + ecmaRuntimeCallInfo1->SetCallArg(0, paramMsg.GetTaggedValue()); + +- [[maybe_unused]] auto prevReject = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); ++ [[maybe_unused]] auto prevReject = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); + JSTaggedValue result = BuiltinsPromise::Resolve(ecmaRuntimeCallInfo1.get()); +- JSHandle rejectPromise(thread, result); ++ JSHandle rejectPromise(thread_, result); + EXPECT_EQ(JSTaggedValue::SameValue(rejectPromise->GetPromiseState(), + JSTaggedValue(static_cast(PromiseStatus::FULFILLED))), + true); +@@ -237,8 +237,8 @@ TEST_F(BuiltinsPromiseTest, Resolve1) + */ + TEST_F(BuiltinsPromiseTest, Resolve2) + { +- ObjectFactory *factory = EcmaVM::Cast(instance)->GetFactory(); +- JSHandle env = EcmaVM::Cast(instance)->GetGlobalEnv(); ++ ObjectFactory *factory = EcmaVM::Cast(instance_)->GetFactory(); ++ JSHandle env = EcmaVM::Cast(instance_)->GetGlobalEnv(); + + // constructor promise1 + JSHandle promise = JSHandle::Cast(env->GetPromiseFunction()); +@@ -248,14 +248,14 @@ TEST_F(BuiltinsPromiseTest, Resolve2) + /** + * @tc.steps: step1. var p1 = Promise.reject("Promise reject") + */ +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, promise.GetTaggedValue(), 6); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, promise.GetTaggedValue(), 6); + ecmaRuntimeCallInfo->SetFunction(promise.GetTaggedValue()); + ecmaRuntimeCallInfo->SetThis(promise.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, paramMsg1.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsPromise::Reject(ecmaRuntimeCallInfo.get()); +- JSHandle promise1(thread, result); ++ JSHandle promise1(thread_, result); + EXPECT_EQ(JSTaggedValue::SameValue(promise1->GetPromiseState(), + JSTaggedValue(static_cast(PromiseStatus::REJECTED))), + true); +@@ -265,14 +265,14 @@ TEST_F(BuiltinsPromiseTest, Resolve2) + /** + * @tc.steps: step2. var p2 = Promise.resolve(p1) + */ +- auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, promise.GetTaggedValue(), 6); ++ auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, promise.GetTaggedValue(), 6); + ecmaRuntimeCallInfo1->SetFunction(promise.GetTaggedValue()); + ecmaRuntimeCallInfo1->SetThis(promise.GetTaggedValue()); + ecmaRuntimeCallInfo1->SetCallArg(0, promise1.GetTaggedValue()); +- [[maybe_unused]] auto prev1 = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); ++ [[maybe_unused]] auto prev1 = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); + + JSTaggedValue result1 = BuiltinsPromise::Resolve(ecmaRuntimeCallInfo1.get()); +- JSHandle promise2(thread, result1); ++ JSHandle promise2(thread_, result1); + EXPECT_EQ(*promise1, *promise2); + EXPECT_EQ(JSTaggedValue::SameValue(promise2->GetPromiseState(), + JSTaggedValue(static_cast(PromiseStatus::REJECTED))), +@@ -287,23 +287,23 @@ TEST_F(BuiltinsPromiseTest, Resolve2) + */ + TEST_F(BuiltinsPromiseTest, Race1) + { +- JSHandle env = EcmaVM::Cast(instance)->GetGlobalEnv(); ++ JSHandle env = EcmaVM::Cast(instance_)->GetGlobalEnv(); + + JSHandle promise = JSHandle::Cast(env->GetPromiseFunction()); +- JSHandle paramMsg1(thread, JSTaggedValue(12345)); +- JSHandle paramMsg2(thread, JSTaggedValue(6789)); ++ JSHandle paramMsg1(thread_, JSTaggedValue(12345)); ++ JSHandle paramMsg2(thread_, JSTaggedValue(6789)); + + /** + * @tc.steps: step1. var p1 = Promise.reject(12345) + */ +- auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue(*promise), 6); ++ auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue(*promise), 6); + ecmaRuntimeCallInfo1->SetFunction(promise.GetTaggedValue()); + ecmaRuntimeCallInfo1->SetThis(promise.GetTaggedValue()); + ecmaRuntimeCallInfo1->SetCallArg(0, paramMsg1.GetTaggedValue()); + +- [[maybe_unused]] auto prevReject = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); ++ [[maybe_unused]] auto prevReject = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); + JSTaggedValue result1 = BuiltinsPromise::Reject(ecmaRuntimeCallInfo1.get()); +- JSHandle rejectPromise(thread, result1); ++ JSHandle rejectPromise(thread_, result1); + EXPECT_EQ(JSTaggedValue::SameValue(rejectPromise->GetPromiseState(), + JSTaggedValue(static_cast(PromiseStatus::REJECTED))), + true); +@@ -312,14 +312,14 @@ TEST_F(BuiltinsPromiseTest, Race1) + /** + * @tc.steps: step2. var p2 = Promise.resolve(6789) + */ +- auto ecmaRuntimeCallInfo2 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue(*promise), 6); ++ auto ecmaRuntimeCallInfo2 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue(*promise), 6); + ecmaRuntimeCallInfo2->SetFunction(promise.GetTaggedValue()); + ecmaRuntimeCallInfo2->SetThis(promise.GetTaggedValue()); + ecmaRuntimeCallInfo2->SetCallArg(0, paramMsg2.GetTaggedValue()); + +- [[maybe_unused]] auto prevResolve = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo2.get()); ++ [[maybe_unused]] auto prevResolve = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo2.get()); + JSTaggedValue result2 = BuiltinsPromise::Resolve(ecmaRuntimeCallInfo2.get()); +- JSHandle resolvePromise(thread, result2); ++ JSHandle resolvePromise(thread_, result2); + EXPECT_EQ(JSTaggedValue::SameValue(resolvePromise->GetPromiseState(), + JSTaggedValue(static_cast(PromiseStatus::FULFILLED))), + true); +@@ -328,24 +328,24 @@ TEST_F(BuiltinsPromiseTest, Race1) + /** + * @tc.steps: step3. Construct an array with two elements p1 and p2. array = [p1. p2] + */ +- JSHandle array(JSArray::ArrayCreate(thread, JSTaggedNumber(2))); +- PropertyDescriptor desc(thread, JSHandle::Cast(rejectPromise)); +- JSArray::DefineOwnProperty(thread, array, JSHandle(thread, JSTaggedValue(0)), desc); ++ JSHandle array(JSArray::ArrayCreate(thread_, JSTaggedNumber(2))); ++ PropertyDescriptor desc(thread_, JSHandle::Cast(rejectPromise)); ++ JSArray::DefineOwnProperty(thread_, array, JSHandle(thread_, JSTaggedValue(0)), desc); + +- PropertyDescriptor desc1(thread, JSHandle::Cast(resolvePromise)); +- JSArray::DefineOwnProperty(thread, array, JSHandle(thread, JSTaggedValue(1)), desc1); ++ PropertyDescriptor desc1(thread_, JSHandle::Cast(resolvePromise)); ++ JSArray::DefineOwnProperty(thread_, array, JSHandle(thread_, JSTaggedValue(1)), desc1); + + /** + * @tc.steps: step4. var p3 = Promise.race([p1,p2]); + */ +- auto ecmaRuntimeCallInfo4 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue(*promise), 6); ++ auto ecmaRuntimeCallInfo4 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue(*promise), 6); + ecmaRuntimeCallInfo4->SetFunction(promise.GetTaggedValue()); + ecmaRuntimeCallInfo4->SetThis(promise.GetTaggedValue()); + ecmaRuntimeCallInfo4->SetCallArg(0, array.GetTaggedValue()); + +- [[maybe_unused]] auto prev4 = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo4.get()); ++ [[maybe_unused]] auto prev4 = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo4.get()); + JSTaggedValue result4 = BuiltinsPromise::Race(ecmaRuntimeCallInfo4.get()); +- JSHandle racePromise(thread, result4); ++ JSHandle racePromise(thread_, result4); + EXPECT_EQ(JSTaggedValue::SameValue(racePromise->GetPromiseState(), + JSTaggedValue(static_cast(PromiseStatus::PENDING))), + true); +@@ -360,24 +360,24 @@ TEST_F(BuiltinsPromiseTest, Race1) + */ + TEST_F(BuiltinsPromiseTest, Race2) + { +- ObjectFactory *factory = EcmaVM::Cast(instance)->GetFactory(); +- JSHandle env = EcmaVM::Cast(instance)->GetGlobalEnv(); ++ ObjectFactory *factory = EcmaVM::Cast(instance_)->GetFactory(); ++ JSHandle env = EcmaVM::Cast(instance_)->GetGlobalEnv(); + + JSHandle promise = JSHandle::Cast(env->GetPromiseFunction()); +- JSHandle paramMsg1(thread, JSTaggedValue(12345)); +- JSHandle paramMsg2(thread, JSTaggedValue(6789)); ++ JSHandle paramMsg1(thread_, JSTaggedValue(12345)); ++ JSHandle paramMsg2(thread_, JSTaggedValue(6789)); + + /** + * @tc.steps: step1. var p1 = Promise.reject(12345) + */ +- auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue(*promise), 6); ++ auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue(*promise), 6); + ecmaRuntimeCallInfo1->SetFunction(promise.GetTaggedValue()); + ecmaRuntimeCallInfo1->SetThis(promise.GetTaggedValue()); + ecmaRuntimeCallInfo1->SetCallArg(0, paramMsg1.GetTaggedValue()); + +- [[maybe_unused]] auto prevReject = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); ++ [[maybe_unused]] auto prevReject = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); + JSTaggedValue result1 = BuiltinsPromise::Reject(ecmaRuntimeCallInfo1.get()); +- JSHandle rejectPromise(thread, result1); ++ JSHandle rejectPromise(thread_, result1); + EXPECT_EQ(JSTaggedValue::SameValue(rejectPromise->GetPromiseState(), + JSTaggedValue(static_cast(PromiseStatus::REJECTED))), + true); +@@ -386,14 +386,14 @@ TEST_F(BuiltinsPromiseTest, Race2) + /** + * @tc.steps: step2. var p2 = Promise.resolve(6789) + */ +- auto ecmaRuntimeCallInfo2 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue(*promise), 6); ++ auto ecmaRuntimeCallInfo2 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue(*promise), 6); + ecmaRuntimeCallInfo2->SetFunction(promise.GetTaggedValue()); + ecmaRuntimeCallInfo2->SetThis(promise.GetTaggedValue()); + ecmaRuntimeCallInfo2->SetCallArg(0, paramMsg2.GetTaggedValue()); + +- [[maybe_unused]] auto prevResolve = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo2.get()); ++ [[maybe_unused]] auto prevResolve = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo2.get()); + JSTaggedValue result2 = BuiltinsPromise::Resolve(ecmaRuntimeCallInfo2.get()); +- JSHandle resolvePromise(thread, result2); ++ JSHandle resolvePromise(thread_, result2); + EXPECT_EQ(JSTaggedValue::SameValue(resolvePromise->GetPromiseState(), + JSTaggedValue(static_cast(PromiseStatus::FULFILLED))), + true); +@@ -402,24 +402,24 @@ TEST_F(BuiltinsPromiseTest, Race2) + /** + * @tc.steps: step3. Construct an array with two elements p1 and p2. array = [p1. p2] + */ +- JSHandle array(JSArray::ArrayCreate(thread, JSTaggedNumber(2))); +- PropertyDescriptor desc(thread, JSHandle::Cast(rejectPromise)); +- JSArray::DefineOwnProperty(thread, array, JSHandle(thread, JSTaggedValue(0)), desc); ++ JSHandle array(JSArray::ArrayCreate(thread_, JSTaggedNumber(2))); ++ PropertyDescriptor desc(thread_, JSHandle::Cast(rejectPromise)); ++ JSArray::DefineOwnProperty(thread_, array, JSHandle(thread_, JSTaggedValue(0)), desc); + +- PropertyDescriptor desc1(thread, JSHandle::Cast(resolvePromise)); +- JSArray::DefineOwnProperty(thread, array, JSHandle(thread, JSTaggedValue(1)), desc1); ++ PropertyDescriptor desc1(thread_, JSHandle::Cast(resolvePromise)); ++ JSArray::DefineOwnProperty(thread_, array, JSHandle(thread_, JSTaggedValue(1)), desc1); + + /** + * @tc.steps: step4. var p3 = Promise.race([p1,p2]); + */ +- auto ecmaRuntimeCallInfo4 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue(*promise), 6); ++ auto ecmaRuntimeCallInfo4 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue(*promise), 6); + ecmaRuntimeCallInfo4->SetFunction(promise.GetTaggedValue()); + ecmaRuntimeCallInfo4->SetThis(promise.GetTaggedValue()); + ecmaRuntimeCallInfo4->SetCallArg(0, array.GetTaggedValue()); + +- [[maybe_unused]] auto prev4 = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo4.get()); ++ [[maybe_unused]] auto prev4 = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo4.get()); + JSTaggedValue result4 = BuiltinsPromise::Race(ecmaRuntimeCallInfo4.get()); +- JSHandle racePromise(thread, result4); ++ JSHandle racePromise(thread_, result4); + EXPECT_EQ(JSTaggedValue::SameValue(racePromise->GetPromiseState(), + JSTaggedValue(static_cast(PromiseStatus::PENDING))), + true); +@@ -430,15 +430,15 @@ TEST_F(BuiltinsPromiseTest, Race2) + */ + JSHandle native_func_race_then_onrejected = + factory->NewJSFunction(env, reinterpret_cast(TestPromiseRaceThenOnRejectd)); +- auto ecmaRuntimeCallInfo5 = TestHelper::CreateEcmaRuntimeCallInfo(thread, racePromise.GetTaggedValue(), 8); ++ auto ecmaRuntimeCallInfo5 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, racePromise.GetTaggedValue(), 8); + ecmaRuntimeCallInfo5->SetFunction(racePromise.GetTaggedValue()); + ecmaRuntimeCallInfo5->SetThis(racePromise.GetTaggedValue()); + ecmaRuntimeCallInfo5->SetCallArg(0, JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo5->SetCallArg(1, native_func_race_then_onrejected.GetTaggedValue()); + +- [[maybe_unused]] auto prev5 = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo5.get()); ++ [[maybe_unused]] auto prev5 = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo5.get()); + JSTaggedValue thenResult = BuiltinsPromise::Then(ecmaRuntimeCallInfo5.get()); +- JSHandle thenPromise(thread, thenResult); ++ JSHandle thenPromise(thread_, thenResult); + + EXPECT_TRUE(JSTaggedValue::SameValue(thenPromise->GetPromiseState(), + JSTaggedValue(static_cast(PromiseStatus::PENDING)))); +@@ -447,9 +447,9 @@ TEST_F(BuiltinsPromiseTest, Race2) + /** + * @tc.steps: step6. execute promise queue + */ +- auto microJobQueue = EcmaVM::Cast(instance)->GetMicroJobQueue(); +- if (!thread->HasPendingException()) { +- job::MicroJobQueue::ExecutePendingJob(thread, microJobQueue); ++ auto microJobQueue = EcmaVM::Cast(instance_)->GetMicroJobQueue(); ++ if (!thread_->HasPendingException()) { ++ job::MicroJobQueue::ExecutePendingJob(thread_, microJobQueue); + } + } + +@@ -461,24 +461,24 @@ TEST_F(BuiltinsPromiseTest, Race2) + */ + TEST_F(BuiltinsPromiseTest, All) + { +- ObjectFactory *factory = EcmaVM::Cast(instance)->GetFactory(); +- JSHandle env = EcmaVM::Cast(instance)->GetGlobalEnv(); ++ ObjectFactory *factory = EcmaVM::Cast(instance_)->GetFactory(); ++ JSHandle env = EcmaVM::Cast(instance_)->GetGlobalEnv(); + + JSHandle promise = JSHandle::Cast(env->GetPromiseFunction()); +- JSHandle paramMsg1(thread, JSTaggedValue(111)); +- JSHandle paramMsg2(thread, JSTaggedValue(222)); ++ JSHandle paramMsg1(thread_, JSTaggedValue(111)); ++ JSHandle paramMsg2(thread_, JSTaggedValue(222)); + + /** + * @tc.steps: step1. var p1 = Promise.resolve(111) + */ +- auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue(*promise), 6); ++ auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue(*promise), 6); + ecmaRuntimeCallInfo1->SetFunction(promise.GetTaggedValue()); + ecmaRuntimeCallInfo1->SetThis(promise.GetTaggedValue()); + ecmaRuntimeCallInfo1->SetCallArg(0, paramMsg1.GetTaggedValue()); + +- [[maybe_unused]] auto prevReject = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); ++ [[maybe_unused]] auto prevReject = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); + JSTaggedValue result1 = BuiltinsPromise::Resolve(ecmaRuntimeCallInfo1.get()); +- JSHandle resolvePromise1(thread, result1); ++ JSHandle resolvePromise1(thread_, result1); + EXPECT_EQ(JSTaggedValue::SameValue(resolvePromise1->GetPromiseState(), + JSTaggedValue(static_cast(PromiseStatus::FULFILLED))), + true); +@@ -487,14 +487,14 @@ TEST_F(BuiltinsPromiseTest, All) + /** + * @tc.steps: step2. var p2 = Promise.resolve(222) + */ +- auto ecmaRuntimeCallInfo2 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue(*promise), 6); ++ auto ecmaRuntimeCallInfo2 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue(*promise), 6); + ecmaRuntimeCallInfo2->SetFunction(promise.GetTaggedValue()); + ecmaRuntimeCallInfo2->SetThis(promise.GetTaggedValue()); + ecmaRuntimeCallInfo2->SetCallArg(0, paramMsg2.GetTaggedValue()); + +- [[maybe_unused]] auto prevResolve = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo2.get()); ++ [[maybe_unused]] auto prevResolve = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo2.get()); + JSTaggedValue result2 = BuiltinsPromise::Resolve(ecmaRuntimeCallInfo2.get()); +- JSHandle resolvePromise2(thread, result2); ++ JSHandle resolvePromise2(thread_, result2); + EXPECT_EQ(JSTaggedValue::SameValue(resolvePromise2->GetPromiseState(), + JSTaggedValue(static_cast(PromiseStatus::FULFILLED))), + true); +@@ -503,24 +503,24 @@ TEST_F(BuiltinsPromiseTest, All) + /** + * @tc.steps: step3. Construct an array with two elements p1 and p2. array = [p1. p2] + */ +- JSHandle array(JSArray::ArrayCreate(thread, JSTaggedNumber(2))); +- PropertyDescriptor desc(thread, JSHandle::Cast(resolvePromise1)); +- JSArray::DefineOwnProperty(thread, array, JSHandle(thread, JSTaggedValue(0)), desc); ++ JSHandle array(JSArray::ArrayCreate(thread_, JSTaggedNumber(2))); ++ PropertyDescriptor desc(thread_, JSHandle::Cast(resolvePromise1)); ++ JSArray::DefineOwnProperty(thread_, array, JSHandle(thread_, JSTaggedValue(0)), desc); + +- PropertyDescriptor desc1(thread, JSHandle::Cast(resolvePromise2)); +- JSArray::DefineOwnProperty(thread, array, JSHandle(thread, JSTaggedValue(1)), desc1); ++ PropertyDescriptor desc1(thread_, JSHandle::Cast(resolvePromise2)); ++ JSArray::DefineOwnProperty(thread_, array, JSHandle(thread_, JSTaggedValue(1)), desc1); + + /** + * @tc.steps: step4. var p3 = Promise.all([p1,p2]); + */ +- auto ecmaRuntimeCallInfo4 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue(*promise), 6); ++ auto ecmaRuntimeCallInfo4 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue(*promise), 6); + ecmaRuntimeCallInfo4->SetFunction(promise.GetTaggedValue()); + ecmaRuntimeCallInfo4->SetThis(promise.GetTaggedValue()); + ecmaRuntimeCallInfo4->SetCallArg(0, array.GetTaggedValue()); + +- [[maybe_unused]] auto prev4 = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo4.get()); ++ [[maybe_unused]] auto prev4 = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo4.get()); + JSTaggedValue result4 = BuiltinsPromise::All(ecmaRuntimeCallInfo4.get()); +- JSHandle allPromise(thread, result4); ++ JSHandle allPromise(thread_, result4); + EXPECT_EQ(JSTaggedValue::SameValue(allPromise->GetPromiseState(), + JSTaggedValue(static_cast(PromiseStatus::PENDING))), + true); +@@ -531,15 +531,15 @@ TEST_F(BuiltinsPromiseTest, All) + */ + JSHandle nativeFuncRaceThenOnResolved = + factory->NewJSFunction(env, reinterpret_cast(TestPromiseAllThenOnResolved)); +- auto ecmaRuntimeCallInfo5 = TestHelper::CreateEcmaRuntimeCallInfo(thread, allPromise.GetTaggedValue(), 8); ++ auto ecmaRuntimeCallInfo5 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, allPromise.GetTaggedValue(), 8); + ecmaRuntimeCallInfo5->SetFunction(allPromise.GetTaggedValue()); + ecmaRuntimeCallInfo5->SetThis(allPromise.GetTaggedValue()); + ecmaRuntimeCallInfo5->SetCallArg(0, nativeFuncRaceThenOnResolved.GetTaggedValue()); + ecmaRuntimeCallInfo5->SetCallArg(1, nativeFuncRaceThenOnResolved.GetTaggedValue()); + +- [[maybe_unused]] auto prev5 = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo5.get()); ++ [[maybe_unused]] auto prev5 = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo5.get()); + JSTaggedValue thenResult = BuiltinsPromise::Then(ecmaRuntimeCallInfo5.get()); +- JSHandle thenPromise(thread, thenResult); ++ JSHandle thenPromise(thread_, thenResult); + + EXPECT_TRUE(JSTaggedValue::SameValue(thenPromise->GetPromiseState(), + JSTaggedValue(static_cast(PromiseStatus::PENDING)))); +@@ -548,9 +548,9 @@ TEST_F(BuiltinsPromiseTest, All) + /** + * @tc.steps: step6. execute promise queue + */ +- auto microJobQueue = EcmaVM::Cast(instance)->GetMicroJobQueue(); +- if (!thread->HasPendingException()) { +- job::MicroJobQueue::ExecutePendingJob(thread, microJobQueue); ++ auto microJobQueue = EcmaVM::Cast(instance_)->GetMicroJobQueue(); ++ if (!thread_->HasPendingException()) { ++ job::MicroJobQueue::ExecutePendingJob(thread_, microJobQueue); + } + } + +@@ -561,23 +561,23 @@ TEST_F(BuiltinsPromiseTest, All) + */ + TEST_F(BuiltinsPromiseTest, Catch) + { +- auto env = EcmaVM::Cast(instance)->GetGlobalEnv(); +- auto factory = EcmaVM::Cast(instance)->GetFactory(); ++ auto env = EcmaVM::Cast(instance_)->GetGlobalEnv(); ++ auto factory = EcmaVM::Cast(instance_)->GetFactory(); + + JSHandle promise = JSHandle::Cast(env->GetPromiseFunction()); +- JSHandle paramMsg1(thread, JSTaggedValue(3)); ++ JSHandle paramMsg1(thread_, JSTaggedValue(3)); + + /** + * @tc.steps: step1. var p1 = Promise.reject(3) + */ +- auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue(*promise), 6); ++ auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue(*promise), 6); + ecmaRuntimeCallInfo1->SetFunction(promise.GetTaggedValue()); + ecmaRuntimeCallInfo1->SetThis(promise.GetTaggedValue()); + ecmaRuntimeCallInfo1->SetCallArg(0, paramMsg1.GetTaggedValue()); + +- [[maybe_unused]] auto prevReject = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); ++ [[maybe_unused]] auto prevReject = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); + JSTaggedValue result = BuiltinsPromise::Reject(ecmaRuntimeCallInfo1.get()); +- JSHandle rejectPromise(thread, result); ++ JSHandle rejectPromise(thread_, result); + EXPECT_EQ(JSTaggedValue::SameValue(rejectPromise->GetPromiseState(), + JSTaggedValue(static_cast(PromiseStatus::REJECTED))), + true); +@@ -587,14 +587,14 @@ TEST_F(BuiltinsPromiseTest, Catch) + * @tc.steps: step2. p1 invokes catch() + */ + JSHandle testPromiseCatch = factory->NewJSFunction(env, reinterpret_cast(TestPromiseCatch)); +- auto ecmaRuntimeCallInfo2 = TestHelper::CreateEcmaRuntimeCallInfo(thread, rejectPromise.GetTaggedValue(), 6); ++ auto ecmaRuntimeCallInfo2 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, rejectPromise.GetTaggedValue(), 6); + ecmaRuntimeCallInfo2->SetFunction(rejectPromise.GetTaggedValue()); + ecmaRuntimeCallInfo2->SetThis(rejectPromise.GetTaggedValue()); + ecmaRuntimeCallInfo2->SetCallArg(0, testPromiseCatch.GetTaggedValue()); + +- [[maybe_unused]] auto prevCatch = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo2.get()); ++ [[maybe_unused]] auto prevCatch = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo2.get()); + JSTaggedValue catchResult = BuiltinsPromise::Catch(ecmaRuntimeCallInfo2.get()); +- JSHandle catchPromise(thread, catchResult); ++ JSHandle catchPromise(thread_, catchResult); + + EXPECT_EQ(JSTaggedValue::SameValue(catchPromise->GetPromiseState(), + JSTaggedValue(static_cast(PromiseStatus::PENDING))), +@@ -604,9 +604,9 @@ TEST_F(BuiltinsPromiseTest, Catch) + /** + * @tc.steps: step3. execute promise queue + */ +- auto microJobQueue = EcmaVM::Cast(instance)->GetMicroJobQueue(); +- if (!thread->HasPendingException()) { +- job::MicroJobQueue::ExecutePendingJob(thread, microJobQueue); ++ auto microJobQueue = EcmaVM::Cast(instance_)->GetMicroJobQueue(); ++ if (!thread_->HasPendingException()) { ++ job::MicroJobQueue::ExecutePendingJob(thread_, microJobQueue); + } + } + +@@ -617,8 +617,8 @@ TEST_F(BuiltinsPromiseTest, Catch) + */ + TEST_F(BuiltinsPromiseTest, ThenResolve) + { +- auto env = EcmaVM::Cast(instance)->GetGlobalEnv(); +- auto factory = EcmaVM::Cast(instance)->GetFactory(); ++ auto env = EcmaVM::Cast(instance_)->GetGlobalEnv(); ++ auto factory = EcmaVM::Cast(instance_)->GetFactory(); + + JSHandle promise = JSHandle::Cast(env->GetPromiseFunction()); + JSHandle paramMsg = JSHandle::Cast(factory->NewFromCanBeCompressString("resolve")); +@@ -626,14 +626,14 @@ TEST_F(BuiltinsPromiseTest, ThenResolve) + /** + * @tc.steps: step1. var p1 = Promise.resolve("resolve") + */ +- auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue(*promise), 6); ++ auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue(*promise), 6); + ecmaRuntimeCallInfo1->SetFunction(promise.GetTaggedValue()); + ecmaRuntimeCallInfo1->SetThis(promise.GetTaggedValue()); + ecmaRuntimeCallInfo1->SetCallArg(0, paramMsg.GetTaggedValue()); + +- [[maybe_unused]] auto prevReject = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); ++ [[maybe_unused]] auto prevReject = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); + JSTaggedValue result = BuiltinsPromise::Resolve(ecmaRuntimeCallInfo1.get()); +- JSHandle resolvePromise(thread, result); ++ JSHandle resolvePromise(thread_, result); + EXPECT_EQ(JSTaggedValue::SameValue(resolvePromise->GetPromiseState(), + JSTaggedValue(static_cast(PromiseStatus::FULFILLED))), + true); +@@ -644,15 +644,15 @@ TEST_F(BuiltinsPromiseTest, ThenResolve) + */ + JSHandle testPromiseThenOnResolved = + factory->NewJSFunction(env, reinterpret_cast(TestPromiseThenOnResolved)); +- auto ecmaRuntimeCallInfo2 = TestHelper::CreateEcmaRuntimeCallInfo(thread, resolvePromise.GetTaggedValue(), 8); ++ auto ecmaRuntimeCallInfo2 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, resolvePromise.GetTaggedValue(), 8); + ecmaRuntimeCallInfo2->SetFunction(resolvePromise.GetTaggedValue()); + ecmaRuntimeCallInfo2->SetThis(resolvePromise.GetTaggedValue()); + ecmaRuntimeCallInfo2->SetCallArg(0, testPromiseThenOnResolved.GetTaggedValue()); + ecmaRuntimeCallInfo2->SetCallArg(1, JSTaggedValue::Undefined()); + +- [[maybe_unused]] auto prevThen = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo2.get()); ++ [[maybe_unused]] auto prevThen = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo2.get()); + JSTaggedValue thenResult = BuiltinsPromise::Then(ecmaRuntimeCallInfo2.get()); +- JSHandle thenPromise(thread, thenResult); ++ JSHandle thenPromise(thread_, thenResult); + + EXPECT_EQ(JSTaggedValue::SameValue(thenPromise->GetPromiseState(), + JSTaggedValue(static_cast(PromiseStatus::PENDING))), +@@ -662,9 +662,9 @@ TEST_F(BuiltinsPromiseTest, ThenResolve) + /** + * @tc.steps: step3. execute promise queue + */ +- auto microJobQueue = EcmaVM::Cast(instance)->GetMicroJobQueue(); +- if (!thread->HasPendingException()) { +- job::MicroJobQueue::ExecutePendingJob(thread, microJobQueue); ++ auto microJobQueue = EcmaVM::Cast(instance_)->GetMicroJobQueue(); ++ if (!thread_->HasPendingException()) { ++ job::MicroJobQueue::ExecutePendingJob(thread_, microJobQueue); + } + } + +@@ -675,8 +675,8 @@ TEST_F(BuiltinsPromiseTest, ThenResolve) + */ + TEST_F(BuiltinsPromiseTest, ThenReject) + { +- auto env = EcmaVM::Cast(instance)->GetGlobalEnv(); +- auto factory = EcmaVM::Cast(instance)->GetFactory(); ++ auto env = EcmaVM::Cast(instance_)->GetGlobalEnv(); ++ auto factory = EcmaVM::Cast(instance_)->GetFactory(); + + JSHandle promise = JSHandle::Cast(env->GetPromiseFunction()); + JSHandle paramMsg = JSHandle::Cast(factory->NewFromCanBeCompressString("reject")); +@@ -684,14 +684,14 @@ TEST_F(BuiltinsPromiseTest, ThenReject) + /** + * @tc.steps: step1. var p1 = Promise.Reject(5) + */ +- auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue(*promise), 6); ++ auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue(*promise), 6); + ecmaRuntimeCallInfo1->SetFunction(promise.GetTaggedValue()); + ecmaRuntimeCallInfo1->SetThis(promise.GetTaggedValue()); + ecmaRuntimeCallInfo1->SetCallArg(0, paramMsg.GetTaggedValue()); + +- [[maybe_unused]] auto prevReject = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); ++ [[maybe_unused]] auto prevReject = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); + JSTaggedValue result = BuiltinsPromise::Reject(ecmaRuntimeCallInfo1.get()); +- JSHandle rejectPromise(thread, result); ++ JSHandle rejectPromise(thread_, result); + EXPECT_EQ(JSTaggedValue::SameValue(rejectPromise->GetPromiseState(), + JSTaggedValue(static_cast(PromiseStatus::REJECTED))), + true); +@@ -702,15 +702,15 @@ TEST_F(BuiltinsPromiseTest, ThenReject) + */ + JSHandle testPromiseThenOnRejected = + factory->NewJSFunction(env, reinterpret_cast(TestPromiseThenOnRejected)); +- auto ecmaRuntimeCallInfo2 = TestHelper::CreateEcmaRuntimeCallInfo(thread, rejectPromise.GetTaggedValue(), 8); ++ auto ecmaRuntimeCallInfo2 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, rejectPromise.GetTaggedValue(), 8); + ecmaRuntimeCallInfo2->SetFunction(rejectPromise.GetTaggedValue()); + ecmaRuntimeCallInfo2->SetThis(rejectPromise.GetTaggedValue()); + ecmaRuntimeCallInfo2->SetCallArg(0, testPromiseThenOnRejected.GetTaggedValue()); + ecmaRuntimeCallInfo2->SetCallArg(1, testPromiseThenOnRejected.GetTaggedValue()); + +- [[maybe_unused]] auto prevThen = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo2.get()); ++ [[maybe_unused]] auto prevThen = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo2.get()); + JSTaggedValue thenResult = BuiltinsPromise::Then(ecmaRuntimeCallInfo2.get()); +- JSHandle thenPromise(thread, thenResult); ++ JSHandle thenPromise(thread_, thenResult); + + EXPECT_EQ(JSTaggedValue::SameValue(thenPromise->GetPromiseState(), + JSTaggedValue(static_cast(PromiseStatus::PENDING))), +@@ -719,9 +719,9 @@ TEST_F(BuiltinsPromiseTest, ThenReject) + /** + * @tc.steps: step3. execute promise queue + */ +- auto microJobQueue = EcmaVM::Cast(instance)->GetMicroJobQueue(); +- if (!thread->HasPendingException()) { +- job::MicroJobQueue::ExecutePendingJob(thread, microJobQueue); ++ auto microJobQueue = EcmaVM::Cast(instance_)->GetMicroJobQueue(); ++ if (!thread_->HasPendingException()) { ++ job::MicroJobQueue::ExecutePendingJob(thread_, microJobQueue); + } + } + } // namespace panda::test +diff --git a/tests/runtime/builtins/builtins_proxy_test.cpp b/tests/runtime/builtins/builtins_proxy_test.cpp +index b721cec..e093a71 100644 +--- a/tests/runtime/builtins/builtins_proxy_test.cpp ++++ b/tests/runtime/builtins/builtins_proxy_test.cpp +@@ -45,17 +45,17 @@ public: + + void SetUp() override + { +- TestHelper::CreateEcmaVMWithScope(instance, thread, scope); ++ TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); + } + + void TearDown() override + { +- TestHelper::DestroyEcmaVMWithScope(instance, scope); ++ TestHelper::DestroyEcmaVMWithScope(instance_, scope_); + } + +- PandaVM *instance {nullptr}; +- EcmaHandleScope *scope {nullptr}; +- JSThread *thread {nullptr}; ++ PandaVM *instance_ {nullptr}; ++ EcmaHandleScope *scope_ {nullptr}; ++ JSThread *thread_ {nullptr}; + }; + + JSHandle BuiltinsTestProxyCreate(JSThread *thread) +@@ -72,52 +72,52 @@ JSHandle BuiltinsTestProxyCreate(JSThread *thread) + // 26.2.1.1 Proxy( [ value ] ) + TEST_F(BuiltinsProxyTest, ProxyConstructor) + { +- JSHandle target = BuiltinsTestProxyCreate(thread); +- JSHandle handler = BuiltinsTestProxyCreate(thread); ++ JSHandle target = BuiltinsTestProxyCreate(thread_); ++ JSHandle handler = BuiltinsTestProxyCreate(thread_); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Null(), 8); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Null(), 8); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetCallArg(0, target.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(1, handler.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsProxy::ProxyConstructor(ecmaRuntimeCallInfo.get()); + ASSERT_TRUE(result.IsECMAObject()); +- JSHandle resultHandle(thread, result); ++ JSHandle resultHandle(thread_, result); + EXPECT_TRUE(resultHandle->IsJSProxy()); + } + + // 26.2.2.1 Proxy.revocable ( target, handler ) + TEST_F(BuiltinsProxyTest, Revocable) + { +- JSHandle target = BuiltinsTestProxyCreate(thread); +- JSHandle handler = BuiltinsTestProxyCreate(thread); ++ JSHandle target = BuiltinsTestProxyCreate(thread_); ++ JSHandle handler = BuiltinsTestProxyCreate(thread_); + +- JSHandle globalEnv = thread->GetEcmaVM()->GetGlobalEnv(); ++ JSHandle globalEnv = thread_->GetEcmaVM()->GetGlobalEnv(); + JSHandle proxyFun(globalEnv->GetProxyFunction()); +- JSHandle key(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("prop")); +- PropertyDescriptor desc(thread); ++ JSHandle key(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("prop")); ++ PropertyDescriptor desc(thread_); + desc.SetWritable(false); +- JSObject::DefineOwnProperty(thread, handler, key, desc); ++ JSObject::DefineOwnProperty(thread_, handler, key, desc); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetCallArg(0, target.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(1, handler.GetTaggedValue()); + ecmaRuntimeCallInfo->SetNewTarget(JSTaggedValue(*proxyFun)); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsProxy::Revocable(ecmaRuntimeCallInfo.get()); + ASSERT_TRUE(result.IsECMAObject()); +- JSHandle resultHandle(thread, result); ++ JSHandle resultHandle(thread_, result); + +- auto globalConst = thread->GlobalConstants(); ++ auto globalConst = thread_->GlobalConstants(); + JSHandle proxyKey = globalConst->GetHandledProxyString(); + JSHandle revokeKey = globalConst->GetHandledRevokeString(); + +- JSHandle keys = JSObject::GetOwnPropertyKeys(thread, resultHandle); ++ JSHandle keys = JSObject::GetOwnPropertyKeys(thread_, resultHandle); + bool pflag = false; + bool rflag = false; + for (uint32_t i = 0; i < keys->GetLength(); i++) { +@@ -131,8 +131,8 @@ TEST_F(BuiltinsProxyTest, Revocable) + EXPECT_TRUE(pflag); + EXPECT_TRUE(rflag); + +- PropertyDescriptor descRes(thread); +- JSObject::GetOwnProperty(thread, resultHandle, revokeKey, descRes); ++ PropertyDescriptor descRes(thread_); ++ JSObject::GetOwnProperty(thread_, resultHandle, revokeKey, descRes); + EXPECT_TRUE(descRes.GetValue()->IsProxyRevocFunction()); + } + } // namespace panda::test +diff --git a/tests/runtime/builtins/builtins_reflect_test.cpp b/tests/runtime/builtins/builtins_reflect_test.cpp +index e46255c..fb71398 100644 +--- a/tests/runtime/builtins/builtins_reflect_test.cpp ++++ b/tests/runtime/builtins/builtins_reflect_test.cpp +@@ -47,17 +47,17 @@ public: + + void SetUp() override + { +- TestHelper::CreateEcmaVMWithScope(instance, thread, scope); ++ TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); + } + + void TearDown() override + { +- TestHelper::DestroyEcmaVMWithScope(instance, scope); ++ TestHelper::DestroyEcmaVMWithScope(instance_, scope_); + } + +- PandaVM *instance {nullptr}; +- EcmaHandleScope *scope {nullptr}; +- JSThread *thread {nullptr}; ++ PandaVM *instance_ {nullptr}; ++ EcmaHandleScope *scope_ {nullptr}; ++ JSThread *thread_ {nullptr}; + }; + + // use for create a JSObject of test +@@ -97,72 +97,72 @@ JSTaggedValue TestReflectApply(EcmaRuntimeCallInfo *argv) + // Reflect.apply (target, thisArgument, argumentsList) + TEST_F(BuiltinsReflectTest, ReflectApply) + { +- JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); ++ JSHandle env = thread_->GetEcmaVM()->GetGlobalEnv(); + +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + + // target + JSHandle target = factory->NewJSFunction(env, reinterpret_cast(TestReflectApply)); + // thisArgument +- JSHandle thisArgument = +- factory->NewJSObjectByConstructor(TestObjectCreate(thread), JSHandle(TestObjectCreate(thread))); +- JSObject::SetProperty(thread, JSHandle(thisArgument), ++ JSHandle thisArgument = factory->NewJSObjectByConstructor( ++ TestObjectCreate(thread_), JSHandle(TestObjectCreate(thread_))); ++ JSObject::SetProperty(thread_, JSHandle(thisArgument), + JSHandle(factory->NewFromCanBeCompressString("test_reflect_apply_a")), +- JSHandle(thread, JSTaggedValue(11))); +- JSObject::SetProperty(thread, JSHandle(thisArgument), ++ JSHandle(thread_, JSTaggedValue(11))); ++ JSObject::SetProperty(thread_, JSHandle(thisArgument), + JSHandle(factory->NewFromCanBeCompressString("test_reflect_apply_b")), +- JSHandle(thread, JSTaggedValue(22))); ++ JSHandle(thread_, JSTaggedValue(22))); + // argumentsList +- JSHandle argumentsList(JSArray::ArrayCreate(thread, JSTaggedNumber(2))); +- PropertyDescriptor desc(thread, JSHandle(thread, JSTaggedValue(33))); +- JSArray::DefineOwnProperty(thread, argumentsList, JSHandle(thread, JSTaggedValue(0)), desc); ++ JSHandle argumentsList(JSArray::ArrayCreate(thread_, JSTaggedNumber(2))); ++ PropertyDescriptor desc(thread_, JSHandle(thread_, JSTaggedValue(33))); ++ JSArray::DefineOwnProperty(thread_, argumentsList, JSHandle(thread_, JSTaggedValue(0)), desc); + +- PropertyDescriptor desc1(thread, JSHandle(thread, JSTaggedValue(44))); +- JSArray::DefineOwnProperty(thread, argumentsList, JSHandle(thread, JSTaggedValue(1)), desc1); ++ PropertyDescriptor desc1(thread_, JSHandle(thread_, JSTaggedValue(44))); ++ JSArray::DefineOwnProperty(thread_, argumentsList, JSHandle(thread_, JSTaggedValue(1)), desc1); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 10); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 10); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetCallArg(0, target.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(*thisArgument)); + ecmaRuntimeCallInfo->SetCallArg(2, JSTaggedValue(*argumentsList)); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsReflect::ReflectApply(ecmaRuntimeCallInfo.get()); + ASSERT_EQ(result.GetRawData(), JSTaggedValue(110).GetRawData()); + +- JSObject::DeleteProperty(thread, (thisArgument), ++ JSObject::DeleteProperty(thread_, (thisArgument), + JSHandle(factory->NewFromCanBeCompressString("test_reflect_apply_a"))); +- JSObject::DeleteProperty(thread, (thisArgument), ++ JSObject::DeleteProperty(thread_, (thisArgument), + JSHandle(factory->NewFromCanBeCompressString("test_reflect_apply_b"))); + } + + // Reflect.construct (target, argumentsList [ , newTarget]) + TEST_F(BuiltinsReflectTest, ReflectConstruct) + { +- JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); ++ JSHandle env = thread_->GetEcmaVM()->GetGlobalEnv(); + +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + + // target + JSHandle target = JSHandle::Cast(env->GetStringFunction()); + // argumentsList +- JSHandle argumentsList(JSArray::ArrayCreate(thread, JSTaggedNumber(1))); +- PropertyDescriptor desc(thread, ++ JSHandle argumentsList(JSArray::ArrayCreate(thread_, JSTaggedNumber(1))); ++ PropertyDescriptor desc(thread_, + JSHandle::Cast(factory->NewFromCanBeCompressString("ReflectConstruct"))); +- JSArray::DefineOwnProperty(thread, argumentsList, JSHandle(thread, JSTaggedValue(0)), desc); ++ JSArray::DefineOwnProperty(thread_, argumentsList, JSHandle(thread_, JSTaggedValue(0)), desc); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetCallArg(0, target.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(*argumentsList)); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsReflect::ReflectConstruct(ecmaRuntimeCallInfo.get()); + + ASSERT_TRUE(result.IsECMAObject()); +- JSHandle taggedResult(thread, result); ++ JSHandle taggedResult(thread_, result); + JSHandle refResult = JSHandle::Cast(taggedResult); + JSHandle ruler = factory->NewFromCanBeCompressString("ReflectConstruct"); + ASSERT_EQ(EcmaString::Cast(refResult->GetValue().GetTaggedObject())->Compare(*ruler), 0); +@@ -171,47 +171,47 @@ TEST_F(BuiltinsReflectTest, ReflectConstruct) + // Reflect.defineProperty (target, propertyKey, attributes) + TEST_F(BuiltinsReflectTest, ReflectDefineProperty) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + + // target +- JSHandle target = +- factory->NewJSObjectByConstructor(TestObjectCreate(thread), JSHandle(TestObjectCreate(thread))); ++ JSHandle target = factory->NewJSObjectByConstructor(TestObjectCreate(thread_), ++ JSHandle(TestObjectCreate(thread_))); + // propertyKey + JSHandle key(factory->NewFromCanBeCompressString("test_reflect_define_property")); + // attributes +- JSHandle attributes = +- factory->NewJSObjectByConstructor(TestObjectCreate(thread), JSHandle(TestObjectCreate(thread))); ++ JSHandle attributes = factory->NewJSObjectByConstructor( ++ TestObjectCreate(thread_), JSHandle(TestObjectCreate(thread_))); + // attributes value +- auto globalConst = thread->GlobalConstants(); ++ auto globalConst = thread_->GlobalConstants(); + JSHandle valueKey = globalConst->GetHandledValueString(); +- JSHandle value(thread, JSTaggedValue(100)); +- JSObject::SetProperty(thread, JSHandle(attributes), valueKey, value); ++ JSHandle value(thread_, JSTaggedValue(100)); ++ JSObject::SetProperty(thread_, JSHandle(attributes), valueKey, value); + // attributes writable + JSHandle writableKey = globalConst->GetHandledWritableString(); +- JSHandle writable(thread, JSTaggedValue::True()); +- JSObject::SetProperty(thread, JSHandle(attributes), writableKey, writable); ++ JSHandle writable(thread_, JSTaggedValue::True()); ++ JSObject::SetProperty(thread_, JSHandle(attributes), writableKey, writable); + // attributes enumerable + JSHandle enumerableKey = globalConst->GetHandledEnumerableString(); +- JSHandle enumerable(thread, JSTaggedValue::False()); +- JSObject::SetProperty(thread, JSHandle(attributes), enumerableKey, enumerable); ++ JSHandle enumerable(thread_, JSTaggedValue::False()); ++ JSObject::SetProperty(thread_, JSHandle(attributes), enumerableKey, enumerable); + // attributes configurable + JSHandle configurableKey = globalConst->GetHandledConfigurableString(); +- JSHandle configurable(thread, JSTaggedValue::True()); +- JSObject::SetProperty(thread, JSHandle(attributes), configurableKey, configurable); ++ JSHandle configurable(thread_, JSTaggedValue::True()); ++ JSObject::SetProperty(thread_, JSHandle(attributes), configurableKey, configurable); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 10); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 10); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetCallArg(0, target.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(1, key.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(2, JSTaggedValue(*attributes)); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsReflect::ReflectDefineProperty(ecmaRuntimeCallInfo.get()); + ASSERT_EQ(result.GetRawData(), JSTaggedValue::True().GetRawData()); + +- PropertyDescriptor descRuler(thread); +- JSObject::GetOwnProperty(thread, target, key, descRuler); ++ PropertyDescriptor descRuler(thread_); ++ JSObject::GetOwnProperty(thread_, target, key, descRuler); + ASSERT_EQ(descRuler.GetValue()->GetInt(), 100); + ASSERT_EQ(descRuler.IsWritable(), true); + ASSERT_EQ(descRuler.IsEnumerable(), false); +@@ -221,146 +221,146 @@ TEST_F(BuiltinsReflectTest, ReflectDefineProperty) + // Reflect.deleteProperty (target, propertyKey) + TEST_F(BuiltinsReflectTest, ReflectDeleteProperty) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + + // target +- JSHandle target = +- factory->NewJSObjectByConstructor(TestObjectCreate(thread), JSHandle(TestObjectCreate(thread))); ++ JSHandle target = factory->NewJSObjectByConstructor(TestObjectCreate(thread_), ++ JSHandle(TestObjectCreate(thread_))); + // propertyKey + JSHandle key(factory->NewFromCanBeCompressString("test_reflect_delete_property")); +- JSHandle value(thread, JSTaggedValue(101)); +- JSObject::SetProperty(thread, JSHandle(target), key, value); ++ JSHandle value(thread_, JSTaggedValue(101)); ++ JSObject::SetProperty(thread_, JSHandle(target), key, value); + +- PropertyDescriptor desc(thread); +- ASSERT_EQ(JSObject::GetOwnProperty(thread, target, key, desc), true); ++ PropertyDescriptor desc(thread_); ++ ASSERT_EQ(JSObject::GetOwnProperty(thread_, target, key, desc), true); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetCallArg(0, target.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(1, key.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsReflect::ReflectDeleteProperty(ecmaRuntimeCallInfo.get()); + ASSERT_EQ(result.GetRawData(), JSTaggedValue::True().GetRawData()); +- ASSERT_EQ(JSObject::GetOwnProperty(thread, target, key, desc), false); ++ ASSERT_EQ(JSObject::GetOwnProperty(thread_, target, key, desc), false); + } + + // Reflect.get (target, propertyKey [ , receiver]) + TEST_F(BuiltinsReflectTest, ReflectGet) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + + // target +- JSHandle target = +- factory->NewJSObjectByConstructor(TestObjectCreate(thread), JSHandle(TestObjectCreate(thread))); ++ JSHandle target = factory->NewJSObjectByConstructor(TestObjectCreate(thread_), ++ JSHandle(TestObjectCreate(thread_))); + // propertyKey + JSHandle key(factory->NewFromCanBeCompressString("test_reflect_get")); + // set property +- JSHandle value(thread, JSTaggedValue(101.5)); +- JSObject::SetProperty(thread, JSHandle(target), key, value); ++ JSHandle value(thread_, JSTaggedValue(101.5)); ++ JSObject::SetProperty(thread_, JSHandle(target), key, value); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetCallArg(0, target.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(1, key.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsReflect::ReflectGet(ecmaRuntimeCallInfo.get()); + +- JSHandle resultValue(thread, result); ++ JSHandle resultValue(thread_, result); + ASSERT_EQ(resultValue->GetDouble(), 101.5); + } + + // Reflect.getOwnPropertyDescriptor ( target, propertyKey ) + TEST_F(BuiltinsReflectTest, ReflectGetOwnPropertyDescriptor) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + + // target +- JSHandle target = +- factory->NewJSObjectByConstructor(TestObjectCreate(thread), JSHandle(TestObjectCreate(thread))); ++ JSHandle target = factory->NewJSObjectByConstructor(TestObjectCreate(thread_), ++ JSHandle(TestObjectCreate(thread_))); + // propertyKey + JSHandle key(factory->NewFromCanBeCompressString("test_reflect_get_property_descriptor")); +- PropertyDescriptor desc(thread, JSHandle(thread, JSTaggedValue(102)), true, false, true); +- ASSERT_EQ(JSTaggedValue::DefinePropertyOrThrow(thread, JSHandle(target), key, desc), true); ++ PropertyDescriptor desc(thread_, JSHandle(thread_, JSTaggedValue(102)), true, false, true); ++ ASSERT_EQ(JSTaggedValue::DefinePropertyOrThrow(thread_, JSHandle(target), key, desc), true); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetCallArg(0, target.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(1, key.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsReflect::ReflectGetOwnPropertyDescriptor(ecmaRuntimeCallInfo.get()); + + ASSERT_TRUE(result.IsECMAObject()); + +- JSHandle resultObj(thread, result); ++ JSHandle resultObj(thread_, result); + // test value +- auto globalConst = thread->GlobalConstants(); ++ auto globalConst = thread_->GlobalConstants(); + JSHandle valueKey = globalConst->GetHandledValueString(); +- JSHandle resultValue = JSObject::GetProperty(thread, resultObj, valueKey).GetValue(); ++ JSHandle resultValue = JSObject::GetProperty(thread_, resultObj, valueKey).GetValue(); + ASSERT_EQ(resultValue->GetInt(), 102); + // test writable + JSHandle writableKey = globalConst->GetHandledWritableString(); +- JSHandle resultWritable = JSObject::GetProperty(thread, resultObj, writableKey).GetValue(); ++ JSHandle resultWritable = JSObject::GetProperty(thread_, resultObj, writableKey).GetValue(); + ASSERT_EQ(resultWritable->ToBoolean(), true); + // test enumerable + JSHandle enumerableKey = globalConst->GetHandledEnumerableString(); +- JSHandle resultEnumerable = JSObject::GetProperty(thread, resultObj, enumerableKey).GetValue(); ++ JSHandle resultEnumerable = JSObject::GetProperty(thread_, resultObj, enumerableKey).GetValue(); + ASSERT_EQ(resultEnumerable->ToBoolean(), false); + // test configurable + JSHandle configurableKey = globalConst->GetHandledConfigurableString(); +- JSHandle resultConfigurable = JSObject::GetProperty(thread, resultObj, configurableKey).GetValue(); ++ JSHandle resultConfigurable = JSObject::GetProperty(thread_, resultObj, configurableKey).GetValue(); + ASSERT_EQ(resultConfigurable->ToBoolean(), true); + } + + // Reflect.getPrototypeOf (target) + TEST_F(BuiltinsReflectTest, ReflectGetPrototypeOf) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + +- JSHandle target = +- factory->NewJSObjectByConstructor(TestObjectCreate(thread), JSHandle(TestObjectCreate(thread))); +- JSHandle proto = +- factory->NewJSObjectByConstructor(TestObjectCreate(thread), JSHandle(TestObjectCreate(thread))); ++ JSHandle target = factory->NewJSObjectByConstructor(TestObjectCreate(thread_), ++ JSHandle(TestObjectCreate(thread_))); ++ JSHandle proto = factory->NewJSObjectByConstructor(TestObjectCreate(thread_), ++ JSHandle(TestObjectCreate(thread_))); + +- ASSERT_EQ(JSObject::SetPrototype(thread, target, JSHandle(proto)), true); ++ ASSERT_EQ(JSObject::SetPrototype(thread_, target, JSHandle(proto)), true); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetCallArg(0, target.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsReflect::ReflectGetPrototypeOf(ecmaRuntimeCallInfo.get()); + ASSERT_TRUE(result.IsECMAObject()); +- JSHandle resultObj(thread, JSTaggedValue(reinterpret_cast(result.GetRawData()))); ++ JSHandle resultObj(thread_, JSTaggedValue(reinterpret_cast(result.GetRawData()))); + ASSERT_EQ(JSTaggedValue::SameValue(resultObj.GetTaggedValue(), proto.GetTaggedValue()), true); + } + + // Reflect.has (target, propertyKey) + TEST_F(BuiltinsReflectTest, ReflectHas) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + + // target +- JSHandle target = +- factory->NewJSObjectByConstructor(TestObjectCreate(thread), JSHandle(TestObjectCreate(thread))); ++ JSHandle target = factory->NewJSObjectByConstructor(TestObjectCreate(thread_), ++ JSHandle(TestObjectCreate(thread_))); + // propertyKey + JSHandle key(factory->NewFromCanBeCompressString("test_reflect_has")); +- JSHandle value(thread, JSTaggedValue(103)); +- ASSERT_EQ(JSObject::SetProperty(thread, JSHandle(target), key, value), true); ++ JSHandle value(thread_, JSTaggedValue(103)); ++ ASSERT_EQ(JSObject::SetProperty(thread_, JSHandle(target), key, value), true); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetCallArg(0, target.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(1, key.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsReflect::ReflectHas(ecmaRuntimeCallInfo.get()); + + ASSERT_EQ(result.GetRawData(), JSTaggedValue::True().GetRawData()); +@@ -369,19 +369,19 @@ TEST_F(BuiltinsReflectTest, ReflectHas) + // Reflect.isExtensible (target) + TEST_F(BuiltinsReflectTest, ReflectIsExtensible) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + + // target +- JSHandle target = +- factory->NewJSObjectByConstructor(TestObjectCreate(thread), JSHandle(TestObjectCreate(thread))); ++ JSHandle target = factory->NewJSObjectByConstructor(TestObjectCreate(thread_), ++ JSHandle(TestObjectCreate(thread_))); + target->GetJSHClass()->SetExtensible(false); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetCallArg(0, target.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsReflect::ReflectIsExtensible(ecmaRuntimeCallInfo.get()); + + ASSERT_EQ(result.GetRawData(), JSTaggedValue::False().GetRawData()); +@@ -390,45 +390,45 @@ TEST_F(BuiltinsReflectTest, ReflectIsExtensible) + // Reflect.ownKeys (target) + TEST_F(BuiltinsReflectTest, ReflectOwnKeys) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + + // target +- JSHandle target = +- factory->NewJSObjectByConstructor(TestObjectCreate(thread), JSHandle(TestObjectCreate(thread))); ++ JSHandle target = factory->NewJSObjectByConstructor(TestObjectCreate(thread_), ++ JSHandle(TestObjectCreate(thread_))); + JSHandle key0(factory->NewFromCanBeCompressString("test_reflect_own_keys1")); +- JSHandle value0(thread, JSTaggedValue(104)); +- ASSERT_EQ(JSObject::SetProperty(thread, JSHandle(target), key0, value0), true); ++ JSHandle value0(thread_, JSTaggedValue(104)); ++ ASSERT_EQ(JSObject::SetProperty(thread_, JSHandle(target), key0, value0), true); + JSHandle key1(factory->NewFromCanBeCompressString("test_reflect_own_keys2")); +- JSHandle value1(thread, JSTaggedValue(105)); +- ASSERT_EQ(JSObject::SetProperty(thread, JSHandle(target), key1, value1), true); ++ JSHandle value1(thread_, JSTaggedValue(105)); ++ ASSERT_EQ(JSObject::SetProperty(thread_, JSHandle(target), key1, value1), true); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetCallArg(0, target.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsReflect::ReflectOwnKeys(ecmaRuntimeCallInfo.get()); + + ASSERT_TRUE(result.IsECMAObject()); +- JSHandle resultTaggedValue(thread, reinterpret_cast(result.GetRawData())); ++ JSHandle resultTaggedValue(thread_, reinterpret_cast(result.GetRawData())); + JSHandle resultArray = JSHandle::Cast(resultTaggedValue); + // test length +- JSHandle resultLengthKey = thread->GlobalConstants()->GetHandledLengthString(); ++ JSHandle resultLengthKey = thread_->GlobalConstants()->GetHandledLengthString(); + JSHandle resultLength = +- JSObject::GetProperty(thread, JSHandle(resultArray), resultLengthKey).GetValue(); ++ JSObject::GetProperty(thread_, JSHandle(resultArray), resultLengthKey).GetValue(); + ASSERT_EQ(resultLength->GetInt(), 2); + // test array[0] +- JSHandle resultKey0(thread, JSTaggedValue(0)); ++ JSHandle resultKey0(thread_, JSTaggedValue(0)); + JSHandle resultValue0 = +- JSObject::GetProperty(thread, JSHandle(resultArray), resultKey0).GetValue(); ++ JSObject::GetProperty(thread_, JSHandle(resultArray), resultKey0).GetValue(); + ASSERT_EQ(reinterpret_cast(resultValue0.GetTaggedValue().GetTaggedObject()) + ->Compare(reinterpret_cast(key0.GetTaggedValue().GetTaggedObject())), + 0); + // test array[1] +- JSHandle resultKey1(thread, JSTaggedValue(1)); ++ JSHandle resultKey1(thread_, JSTaggedValue(1)); + JSHandle resultValue1 = +- JSObject::GetProperty(thread, JSHandle(resultArray), resultKey1).GetValue(); ++ JSObject::GetProperty(thread_, JSHandle(resultArray), resultKey1).GetValue(); + ASSERT_EQ(reinterpret_cast(resultValue1.GetTaggedValue().GetTaggedObject()) + ->Compare(reinterpret_cast(key1.GetTaggedValue().GetTaggedObject())), + 0); +@@ -437,19 +437,19 @@ TEST_F(BuiltinsReflectTest, ReflectOwnKeys) + // Reflect.preventExtensions (target) + TEST_F(BuiltinsReflectTest, ReflectPreventExtensions) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + + // target +- JSHandle target = +- factory->NewJSObjectByConstructor(TestObjectCreate(thread), JSHandle(TestObjectCreate(thread))); ++ JSHandle target = factory->NewJSObjectByConstructor(TestObjectCreate(thread_), ++ JSHandle(TestObjectCreate(thread_))); + target->GetJSHClass()->SetExtensible(true); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetCallArg(0, target.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsReflect::ReflectPreventExtensions(ecmaRuntimeCallInfo.get()); + + ASSERT_EQ(result.GetRawData(), JSTaggedValue::True().GetRawData()); +@@ -459,53 +459,53 @@ TEST_F(BuiltinsReflectTest, ReflectPreventExtensions) + // Reflect.set (target, propertyKey, V [ , receiver]) + TEST_F(BuiltinsReflectTest, ReflectSet) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + + // target +- JSHandle target = +- factory->NewJSObjectByConstructor(TestObjectCreate(thread), JSHandle(TestObjectCreate(thread))); ++ JSHandle target = factory->NewJSObjectByConstructor(TestObjectCreate(thread_), ++ JSHandle(TestObjectCreate(thread_))); + // propertyKey + JSHandle key(factory->NewFromCanBeCompressString("test_reflect_set")); + // value +- JSHandle value(thread, JSTaggedValue(106)); ++ JSHandle value(thread_, JSTaggedValue(106)); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 10); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 10); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetCallArg(0, target.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(1, key.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(2, value.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsReflect::ReflectSet(ecmaRuntimeCallInfo.get()); + + ASSERT_EQ(result.GetRawData(), JSTaggedValue::True().GetRawData()); + +- JSHandle ruler = JSObject::GetProperty(thread, JSHandle(target), key).GetValue(); +- ASSERT_EQ(JSTaggedValue::ToInt32(thread, ruler), 106); ++ JSHandle ruler = JSObject::GetProperty(thread_, JSHandle(target), key).GetValue(); ++ ASSERT_EQ(JSTaggedValue::ToInt32(thread_, ruler), 106); + } + + // Reflect.setPrototypeOf (target, proto) + TEST_F(BuiltinsReflectTest, ReflectSetPrototypeOf) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + +- JSHandle target = +- factory->NewJSObjectByConstructor(TestObjectCreate(thread), JSHandle(TestObjectCreate(thread))); +- JSHandle proto = +- factory->NewJSObjectByConstructor(TestObjectCreate(thread), JSHandle(TestObjectCreate(thread))); ++ JSHandle target = factory->NewJSObjectByConstructor(TestObjectCreate(thread_), ++ JSHandle(TestObjectCreate(thread_))); ++ JSHandle proto = factory->NewJSObjectByConstructor(TestObjectCreate(thread_), ++ JSHandle(TestObjectCreate(thread_))); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetCallArg(0, target.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(1, proto.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsReflect::ReflectSetPrototypeOf(ecmaRuntimeCallInfo.get()); + + ASSERT_EQ(result.GetRawData(), JSTaggedValue::True().GetRawData()); +- JSHandle resultObj(thread, target->GetJSHClass()->GetPrototype()); ++ JSHandle resultObj(thread_, target->GetJSHClass()->GetPrototype()); + ASSERT_EQ(JSTaggedValue::SameValue(resultObj.GetTaggedValue(), proto.GetTaggedValue()), true); + } + } // namespace panda::test +diff --git a/tests/runtime/builtins/builtins_regexp_test.cpp b/tests/runtime/builtins/builtins_regexp_test.cpp +index 997ae26..fc228bd 100644 +--- a/tests/runtime/builtins/builtins_regexp_test.cpp ++++ b/tests/runtime/builtins/builtins_regexp_test.cpp +@@ -49,17 +49,17 @@ public: + + void SetUp() override + { +- TestHelper::CreateEcmaVMWithScope(instance, thread, scope); ++ TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); + } + + void TearDown() override + { +- TestHelper::DestroyEcmaVMWithScope(instance, scope); ++ TestHelper::DestroyEcmaVMWithScope(instance_, scope_); + } + +- PandaVM *instance {nullptr}; +- EcmaHandleScope *scope {nullptr}; +- JSThread *thread {nullptr}; ++ PandaVM *instance_ {nullptr}; ++ EcmaHandleScope *scope_ {nullptr}; ++ JSThread *thread_ {nullptr}; + }; + + JSTaggedValue CreateRegExpObjByPatternAndFlags(JSThread *thread, const JSHandle &pattern, +@@ -85,18 +85,18 @@ JSTaggedValue CreateRegExpObjByPatternAndFlags(JSThread *thread, const JSHandle< + TEST_F(BuiltinsRegExpTest, RegExpConstructor1) + { + // invoke RegExpConstructor method +- JSHandle pattern = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("\\w+"); +- JSHandle flags = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("i"); +- JSTaggedValue result = CreateRegExpObjByPatternAndFlags(thread, pattern, flags); ++ JSHandle pattern = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("\\w+"); ++ JSHandle flags = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("i"); ++ JSTaggedValue result = CreateRegExpObjByPatternAndFlags(thread_, pattern, flags); + + // ASSERT IsRegExp() +- JSHandle regexpObject(thread, result); +- ASSERT_TRUE(JSObject::IsRegExp(thread, regexpObject)); ++ JSHandle regexpObject(thread_, result); ++ ASSERT_TRUE(JSObject::IsRegExp(thread_, regexpObject)); + +- JSHandle jsRegexp(thread, JSRegExp::Cast(regexpObject->GetTaggedObject())); +- JSHandle originalSource(thread, jsRegexp->GetOriginalSource()); ++ JSHandle jsRegexp(thread_, JSRegExp::Cast(regexpObject->GetTaggedObject())); ++ JSHandle originalSource(thread_, jsRegexp->GetOriginalSource()); + uint8_t flagsBits = static_cast(jsRegexp->GetOriginalFlags().GetInt()); +- JSHandle originalFlags(thread, BuiltinsRegExp::FlagsBitsToString(thread, flagsBits)); ++ JSHandle originalFlags(thread_, BuiltinsRegExp::FlagsBitsToString(thread_, flagsBits)); + ASSERT_EQ(static_cast(originalSource->GetTaggedObject())->Compare(*pattern), 0); + ASSERT_EQ(static_cast(originalFlags->GetTaggedObject())->Compare(*flags), 0); + } +@@ -104,33 +104,33 @@ TEST_F(BuiltinsRegExpTest, RegExpConstructor1) + TEST_F(BuiltinsRegExpTest, RegExpConstructor2) + { + // invoke RegExpConstructor method +- JSHandle pattern = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("\\w+"); +- JSHandle flags = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("i"); +- JSTaggedValue result1 = CreateRegExpObjByPatternAndFlags(thread, pattern, flags); +- JSHandle value(thread, reinterpret_cast(result1.GetRawData())); ++ JSHandle pattern = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("\\w+"); ++ JSHandle flags = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("i"); ++ JSTaggedValue result1 = CreateRegExpObjByPatternAndFlags(thread_, pattern, flags); ++ JSHandle value(thread_, reinterpret_cast(result1.GetRawData())); + +- JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); ++ JSHandle env = thread_->GetEcmaVM()->GetGlobalEnv(); + JSHandle regexp(env->GetRegExpFunction()); +- JSHandle globalObject(thread, env->GetGlobalObject()); ++ JSHandle globalObject(thread_, env->GetGlobalObject()); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue(*regexp), 8); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue(*regexp), 8); + ecmaRuntimeCallInfo->SetFunction(regexp.GetTaggedValue()); + ecmaRuntimeCallInfo->SetThis(globalObject.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, value.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue::Undefined()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + // invoke RegExpConstructor method + JSTaggedValue result2 = BuiltinsRegExp::RegExpConstructor(ecmaRuntimeCallInfo.get()); + + // ASSERT IsRegExp() +- JSHandle regexpObject(thread, result2); +- ASSERT_TRUE(JSObject::IsRegExp(thread, regexpObject)); ++ JSHandle regexpObject(thread_, result2); ++ ASSERT_TRUE(JSObject::IsRegExp(thread_, regexpObject)); + +- JSHandle jsRegexp(thread, JSRegExp::Cast(regexpObject->GetTaggedObject())); +- JSHandle originalSource(thread, jsRegexp->GetOriginalSource()); ++ JSHandle jsRegexp(thread_, JSRegExp::Cast(regexpObject->GetTaggedObject())); ++ JSHandle originalSource(thread_, jsRegexp->GetOriginalSource()); + uint8_t flagsBits = static_cast(jsRegexp->GetOriginalFlags().GetInt()); +- JSHandle originalFlags(thread, BuiltinsRegExp::FlagsBitsToString(thread, flagsBits)); ++ JSHandle originalFlags(thread_, BuiltinsRegExp::FlagsBitsToString(thread_, flagsBits)); + ASSERT_EQ(static_cast(originalSource->GetTaggedObject())->Compare(*pattern), 0); + ASSERT_EQ(static_cast(originalFlags->GetTaggedObject())->Compare(*flags), 0); + } +@@ -138,34 +138,34 @@ TEST_F(BuiltinsRegExpTest, RegExpConstructor2) + TEST_F(BuiltinsRegExpTest, RegExpConstructor3) + { + // invoke RegExpConstructor method +- JSHandle pattern1 = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("\\w+"); +- JSHandle flags1 = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("i"); +- JSTaggedValue result1 = CreateRegExpObjByPatternAndFlags(thread, pattern1, flags1); +- JSHandle value(thread, reinterpret_cast(result1.GetRawData())); ++ JSHandle pattern1 = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("\\w+"); ++ JSHandle flags1 = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("i"); ++ JSTaggedValue result1 = CreateRegExpObjByPatternAndFlags(thread_, pattern1, flags1); ++ JSHandle value(thread_, reinterpret_cast(result1.GetRawData())); + +- JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); ++ JSHandle env = thread_->GetEcmaVM()->GetGlobalEnv(); + JSHandle regexp(env->GetRegExpFunction()); +- JSHandle globalObject(thread, env->GetGlobalObject()); +- JSHandle flags2 = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("gi"); ++ JSHandle globalObject(thread_, env->GetGlobalObject()); ++ JSHandle flags2 = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("gi"); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue(*regexp), 8); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue(*regexp), 8); + ecmaRuntimeCallInfo->SetFunction(regexp.GetTaggedValue()); + ecmaRuntimeCallInfo->SetThis(globalObject.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, value.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(1, flags2.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + // invoke RegExpConstructor method + JSTaggedValue result2 = BuiltinsRegExp::RegExpConstructor(ecmaRuntimeCallInfo.get()); + + // ASSERT IsRegExp() +- JSHandle regexpObject(thread, result2); +- ASSERT_TRUE(JSObject::IsRegExp(thread, regexpObject)); ++ JSHandle regexpObject(thread_, result2); ++ ASSERT_TRUE(JSObject::IsRegExp(thread_, regexpObject)); + +- JSHandle jsRegexp(thread, JSRegExp::Cast(regexpObject->GetTaggedObject())); +- JSHandle originalSource(thread, jsRegexp->GetOriginalSource()); ++ JSHandle jsRegexp(thread_, JSRegExp::Cast(regexpObject->GetTaggedObject())); ++ JSHandle originalSource(thread_, jsRegexp->GetOriginalSource()); + uint8_t flagsBits = static_cast(jsRegexp->GetOriginalFlags().GetInt()); +- JSHandle originalFlags(thread, BuiltinsRegExp::FlagsBitsToString(thread, flagsBits)); ++ JSHandle originalFlags(thread_, BuiltinsRegExp::FlagsBitsToString(thread_, flagsBits)); + ASSERT_EQ(static_cast(originalSource->GetTaggedObject())->Compare(*pattern1), 0); + ASSERT_EQ(static_cast(originalFlags->GetTaggedObject())->Compare(*flags2), 0); + } +@@ -173,104 +173,104 @@ TEST_F(BuiltinsRegExpTest, RegExpConstructor3) + TEST_F(BuiltinsRegExpTest, GetSource1) + { + // invoke RegExpConstructor method +- JSHandle pattern1 = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(""); +- JSHandle flags1 = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("i"); +- JSTaggedValue result1 = CreateRegExpObjByPatternAndFlags(thread, pattern1, flags1); +- JSHandle result1Handle(thread, result1); ++ JSHandle pattern1 = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(""); ++ JSHandle flags1 = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("i"); ++ JSTaggedValue result1 = CreateRegExpObjByPatternAndFlags(thread_, pattern1, flags1); ++ JSHandle result1Handle(thread_, result1); + + // invoke GetSource method + JSHandle source( +- thread, thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("source").GetTaggedValue()); +- JSHandle sourceResult(JSObject::GetProperty(thread, result1Handle, source).GetValue()); ++ thread_, thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("source").GetTaggedValue()); ++ JSHandle sourceResult(JSObject::GetProperty(thread_, result1Handle, source).GetValue()); + +- JSHandle expect = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("(?:)"); ++ JSHandle expect = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("(?:)"); + ASSERT_EQ(static_cast(sourceResult->GetTaggedObject())->Compare(*expect), 0); + } + + TEST_F(BuiltinsRegExpTest, GetSource2) + { + // invoke RegExpConstructor method +- JSHandle pattern1 = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("/w+"); +- JSHandle flags1 = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("i"); +- JSTaggedValue result1 = CreateRegExpObjByPatternAndFlags(thread, pattern1, flags1); +- JSHandle result1Handle(thread, result1); ++ JSHandle pattern1 = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("/w+"); ++ JSHandle flags1 = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("i"); ++ JSTaggedValue result1 = CreateRegExpObjByPatternAndFlags(thread_, pattern1, flags1); ++ JSHandle result1Handle(thread_, result1); + + // invoke GetSource method +- JSHandle source(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("source")); +- JSHandle sourceResult(JSObject::GetProperty(thread, result1Handle, source).GetValue()); ++ JSHandle source(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("source")); ++ JSHandle sourceResult(JSObject::GetProperty(thread_, result1Handle, source).GetValue()); + +- JSHandle expect = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("\\/w+"); ++ JSHandle expect = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("\\/w+"); + ASSERT_EQ(static_cast(sourceResult->GetTaggedObject())->Compare(*expect), 0); + } + + TEST_F(BuiltinsRegExpTest, Get) + { + // invoke RegExpConstructor method +- JSHandle pattern1 = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("\\w+"); +- JSHandle flags1 = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("gimuy"); +- JSTaggedValue result1 = CreateRegExpObjByPatternAndFlags(thread, pattern1, flags1); +- JSHandle result1Handle(thread, result1); ++ JSHandle pattern1 = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("\\w+"); ++ JSHandle flags1 = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("gimuy"); ++ JSTaggedValue result1 = CreateRegExpObjByPatternAndFlags(thread_, pattern1, flags1); ++ JSHandle result1Handle(thread_, result1); + +- JSHandle global(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("global")); ++ JSHandle global(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("global")); + JSTaggedValue taggedGlobalResult = +- JSTaggedValue(JSObject::GetProperty(thread, result1Handle, global).GetValue().GetTaggedValue()); ++ JSTaggedValue(JSObject::GetProperty(thread_, result1Handle, global).GetValue().GetTaggedValue()); + ASSERT_EQ(taggedGlobalResult.GetRawData(), JSTaggedValue::True().GetRawData()); + +- JSHandle ignoreCase(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("ignoreCase")); ++ JSHandle ignoreCase(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("ignoreCase")); + JSTaggedValue taggedIgnoreCaseResult = +- JSTaggedValue(JSObject::GetProperty(thread, result1Handle, ignoreCase).GetValue().GetTaggedValue()); ++ JSTaggedValue(JSObject::GetProperty(thread_, result1Handle, ignoreCase).GetValue().GetTaggedValue()); + ASSERT_EQ(taggedIgnoreCaseResult.GetRawData(), JSTaggedValue::True().GetRawData()); + +- JSHandle multiline(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("multiline")); ++ JSHandle multiline(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("multiline")); + JSTaggedValue taggedMultilineResult = +- JSTaggedValue(JSObject::GetProperty(thread, result1Handle, multiline).GetValue().GetTaggedValue()); ++ JSTaggedValue(JSObject::GetProperty(thread_, result1Handle, multiline).GetValue().GetTaggedValue()); + ASSERT_EQ(taggedMultilineResult.GetRawData(), JSTaggedValue::True().GetRawData()); + +- JSHandle sticky(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("sticky")); ++ JSHandle sticky(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("sticky")); + JSTaggedValue taggedStickyResult = +- JSTaggedValue(JSObject::GetProperty(thread, result1Handle, sticky).GetValue().GetTaggedValue()); ++ JSTaggedValue(JSObject::GetProperty(thread_, result1Handle, sticky).GetValue().GetTaggedValue()); + ASSERT_EQ(taggedStickyResult.GetRawData(), JSTaggedValue::True().GetRawData()); + +- JSHandle unicode(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("unicode")); ++ JSHandle unicode(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("unicode")); + JSTaggedValue taggedUnicodeResult = +- JSTaggedValue(JSObject::GetProperty(thread, result1Handle, unicode).GetValue().GetTaggedValue()); ++ JSTaggedValue(JSObject::GetProperty(thread_, result1Handle, unicode).GetValue().GetTaggedValue()); + ASSERT_EQ(taggedUnicodeResult.GetRawData(), JSTaggedValue::True().GetRawData()); + } + + TEST_F(BuiltinsRegExpTest, GetFlags) + { + // invoke RegExpConstructor method +- JSHandle pattern1 = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("\\w+"); +- JSHandle flags1 = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("imuyg"); +- JSTaggedValue result1 = CreateRegExpObjByPatternAndFlags(thread, pattern1, flags1); +- JSHandle result1Handle(thread, result1); ++ JSHandle pattern1 = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("\\w+"); ++ JSHandle flags1 = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("imuyg"); ++ JSTaggedValue result1 = CreateRegExpObjByPatternAndFlags(thread_, pattern1, flags1); ++ JSHandle result1Handle(thread_, result1); + + // invoke GetFlags method +- JSHandle flags(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("flags")); +- JSHandle flagsResult(JSObject::GetProperty(thread, result1Handle, flags).GetValue()); ++ JSHandle flags(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("flags")); ++ JSHandle flagsResult(JSObject::GetProperty(thread_, result1Handle, flags).GetValue()); + +- JSHandle expectResult = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("gimuy"); ++ JSHandle expectResult = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("gimuy"); + ASSERT_EQ(static_cast(flagsResult->GetTaggedObject())->Compare(*expectResult), 0); + } + + TEST_F(BuiltinsRegExpTest, toString) + { + // invoke RegExpConstructor method +- JSHandle pattern1 = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("\\w+"); +- JSHandle flags1 = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("imuyg"); +- JSTaggedValue result1 = CreateRegExpObjByPatternAndFlags(thread, pattern1, flags1); +- JSHandle value(thread, reinterpret_cast(result1.GetRawData())); ++ JSHandle pattern1 = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("\\w+"); ++ JSHandle flags1 = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("imuyg"); ++ JSTaggedValue result1 = CreateRegExpObjByPatternAndFlags(thread_, pattern1, flags1); ++ JSHandle value(thread_, reinterpret_cast(result1.GetRawData())); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(value.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + // invoke ToString method + JSTaggedValue toStringResult = BuiltinsRegExp::ToString(ecmaRuntimeCallInfo.get()); + ASSERT_TRUE(toStringResult.IsString()); +- JSHandle toStringResultHandle(thread, toStringResult); +- JSHandle expectResult = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("/\\w+/gimuy"); ++ JSHandle toStringResultHandle(thread_, toStringResult); ++ JSHandle expectResult = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("/\\w+/gimuy"); + ASSERT_EQ(static_cast(toStringResultHandle->GetTaggedObject())->Compare(*expectResult), 0); + } + +@@ -278,57 +278,58 @@ TEST_F(BuiltinsRegExpTest, Exec1) + { + // invoke RegExpConstructor method + JSHandle pattern1 = +- thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("quick\\s(brown).+?(jumps)"); +- JSHandle flags1 = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("ig"); +- JSTaggedValue result1 = CreateRegExpObjByPatternAndFlags(thread, pattern1, flags1); +- JSHandle value(thread, reinterpret_cast(result1.GetRawData())); ++ thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("quick\\s(brown).+?(jumps)"); ++ JSHandle flags1 = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("ig"); ++ JSTaggedValue result1 = CreateRegExpObjByPatternAndFlags(thread_, pattern1, flags1); ++ JSHandle value(thread_, reinterpret_cast(result1.GetRawData())); + + JSHandle inputString = +- thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("The Quick Brown Fox Jumps Over The Lazy Dog"); +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("The Quick Brown Fox Jumps Over The Lazy Dog"); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(value.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, inputString.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + // invoke Exec method + JSTaggedValue results = BuiltinsRegExp::Exec(ecmaRuntimeCallInfo.get()); + +- JSHandle execResult(thread, results); ++ JSHandle execResult(thread_, results); + JSHandle resultZero = +- thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("Quick Brown Fox Jumps"); +- JSHandle resultOne = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("Brown"); +- JSHandle resultTwo = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("Jumps"); ++ thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("Quick Brown Fox Jumps"); ++ JSHandle resultOne = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("Brown"); ++ JSHandle resultTwo = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("Jumps"); + +- JSHandle index(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("index")); +- JSHandle indexHandle(JSObject::GetProperty(thread, execResult, index).GetValue()); +- uint32_t resultIndex = JSTaggedValue::ToUint32(thread, indexHandle); ++ JSHandle index(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("index")); ++ JSHandle indexHandle(JSObject::GetProperty(thread_, execResult, index).GetValue()); ++ uint32_t resultIndex = JSTaggedValue::ToUint32(thread_, indexHandle); + ASSERT_TRUE(resultIndex == 4); + +- JSHandle input(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("input")); ++ JSHandle input(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("input")); + +- JSHandle inputHandle(JSObject::GetProperty(thread, execResult, input).GetValue()); +- JSHandle outputInput = JSTaggedValue::ToString(thread, inputHandle); ++ JSHandle inputHandle(JSObject::GetProperty(thread_, execResult, input).GetValue()); ++ JSHandle outputInput = JSTaggedValue::ToString(thread_, inputHandle); + ASSERT_EQ(outputInput->Compare(*inputString), 0); + +- JSHandle zero(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("0")); +- JSHandle zeroHandle(JSObject::GetProperty(thread, execResult, zero).GetValue()); +- JSHandle outputZero = JSTaggedValue::ToString(thread, zeroHandle); ++ JSHandle zero(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("0")); ++ JSHandle zeroHandle(JSObject::GetProperty(thread_, execResult, zero).GetValue()); ++ JSHandle outputZero = JSTaggedValue::ToString(thread_, zeroHandle); + ASSERT_EQ(outputZero->Compare(*resultZero), 0); + +- JSHandle first(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("1")); +- JSHandle oneHandle(JSObject::GetProperty(thread, execResult, first).GetValue()); +- JSHandle outputOne = JSTaggedValue::ToString(thread, oneHandle); ++ JSHandle first(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("1")); ++ JSHandle oneHandle(JSObject::GetProperty(thread_, execResult, first).GetValue()); ++ JSHandle outputOne = JSTaggedValue::ToString(thread_, oneHandle); + ASSERT_EQ(outputOne->Compare(*resultOne), 0); + +- JSHandle second(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("2")); +- JSHandle twoHandle(JSObject::GetProperty(thread, execResult, second).GetValue()); +- JSHandle outputTwo = JSTaggedValue::ToString(thread, twoHandle); ++ JSHandle second(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("2")); ++ JSHandle twoHandle(JSObject::GetProperty(thread_, execResult, second).GetValue()); ++ JSHandle outputTwo = JSTaggedValue::ToString(thread_, twoHandle); + ASSERT_EQ(outputTwo->Compare(*resultTwo), 0); + + JSHandle regexp = JSHandle::Cast(value); +- JSHandle lastIndexHandle(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("lastIndex")); +- JSHandle lastIndexObj(JSObject::GetProperty(thread, regexp, lastIndexHandle).GetValue()); ++ JSHandle lastIndexHandle( ++ thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("lastIndex")); ++ JSHandle lastIndexObj(JSObject::GetProperty(thread_, regexp, lastIndexHandle).GetValue()); + int lastIndex = lastIndexObj->GetInt(); + ASSERT_TRUE(lastIndex == 25); + } +@@ -337,75 +338,76 @@ TEST_F(BuiltinsRegExpTest, Exec2) + { + // invoke RegExpConstructor method + JSHandle pattern1 = +- thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("((1)|(12))((3)|(23))"); +- JSHandle flags1 = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("ig"); +- JSTaggedValue result1 = CreateRegExpObjByPatternAndFlags(thread, pattern1, flags1); +- JSHandle value(thread, reinterpret_cast(result1.GetRawData())); ++ thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("((1)|(12))((3)|(23))"); ++ JSHandle flags1 = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("ig"); ++ JSTaggedValue result1 = CreateRegExpObjByPatternAndFlags(thread_, pattern1, flags1); ++ JSHandle value(thread_, reinterpret_cast(result1.GetRawData())); + +- JSHandle inputString = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("123"); +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ JSHandle inputString = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("123"); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(value.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, inputString.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + // invoke Exec method + JSTaggedValue results = BuiltinsRegExp::Exec(ecmaRuntimeCallInfo.get()); + +- JSHandle execResult(thread, results); +- JSHandle resultZero = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("123"); +- JSHandle resultOne = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("1"); +- JSHandle resultTwo = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("1"); +- JSHandle resultFour = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("23"); +- JSHandle resultSix = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("23"); ++ JSHandle execResult(thread_, results); ++ JSHandle resultZero = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("123"); ++ JSHandle resultOne = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("1"); ++ JSHandle resultTwo = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("1"); ++ JSHandle resultFour = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("23"); ++ JSHandle resultSix = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("23"); + +- JSHandle index(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("index")); +- JSHandle indexHandle(JSObject::GetProperty(thread, execResult, index).GetValue()); +- uint32_t resultIndex = JSTaggedValue::ToUint32(thread, indexHandle); ++ JSHandle index(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("index")); ++ JSHandle indexHandle(JSObject::GetProperty(thread_, execResult, index).GetValue()); ++ uint32_t resultIndex = JSTaggedValue::ToUint32(thread_, indexHandle); + ASSERT_TRUE(resultIndex == 0); + +- JSHandle input(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("input")); +- JSHandle inputHandle(JSObject::GetProperty(thread, execResult, input).GetValue()); +- JSHandle outputInput = JSTaggedValue::ToString(thread, inputHandle); ++ JSHandle input(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("input")); ++ JSHandle inputHandle(JSObject::GetProperty(thread_, execResult, input).GetValue()); ++ JSHandle outputInput = JSTaggedValue::ToString(thread_, inputHandle); + ASSERT_EQ(outputInput->Compare(*inputString), 0); + +- JSHandle zero(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("0")); +- JSHandle zeroHandle(JSObject::GetProperty(thread, execResult, zero).GetValue()); +- JSHandle outputZero = JSTaggedValue::ToString(thread, zeroHandle); ++ JSHandle zero(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("0")); ++ JSHandle zeroHandle(JSObject::GetProperty(thread_, execResult, zero).GetValue()); ++ JSHandle outputZero = JSTaggedValue::ToString(thread_, zeroHandle); + ASSERT_EQ(outputZero->Compare(*resultZero), 0); + +- JSHandle first(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("1")); +- JSHandle oneHandle(JSObject::GetProperty(thread, execResult, first).GetValue()); +- JSHandle outputOne = JSTaggedValue::ToString(thread, oneHandle); ++ JSHandle first(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("1")); ++ JSHandle oneHandle(JSObject::GetProperty(thread_, execResult, first).GetValue()); ++ JSHandle outputOne = JSTaggedValue::ToString(thread_, oneHandle); + ASSERT_EQ(outputOne->Compare(*resultOne), 0); + +- JSHandle second(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("2")); +- JSHandle twoHandle(JSObject::GetProperty(thread, execResult, second).GetValue()); +- JSHandle outputTwo = JSTaggedValue::ToString(thread, twoHandle); ++ JSHandle second(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("2")); ++ JSHandle twoHandle(JSObject::GetProperty(thread_, execResult, second).GetValue()); ++ JSHandle outputTwo = JSTaggedValue::ToString(thread_, twoHandle); + ASSERT_EQ(outputTwo->Compare(*resultTwo), 0); + + JSHandle regexp = JSHandle::Cast(value); +- JSHandle lastIndexHandle(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("lastIndex")); +- JSHandle lastIndexObj(JSObject::GetProperty(thread, regexp, lastIndexHandle).GetValue()); ++ JSHandle lastIndexHandle( ++ thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("lastIndex")); ++ JSHandle lastIndexObj(JSObject::GetProperty(thread_, regexp, lastIndexHandle).GetValue()); + int lastIndex = lastIndexObj->GetInt(); + ASSERT_TRUE(lastIndex == 3); + +- JSHandle third(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("3")); +- JSHandle thirdHandle(JSObject::GetProperty(thread, execResult, third).GetValue()); ++ JSHandle third(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("3")); ++ JSHandle thirdHandle(JSObject::GetProperty(thread_, execResult, third).GetValue()); + ASSERT_TRUE(thirdHandle->IsUndefined()); + +- JSHandle four(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("4")); +- JSHandle fourHandle(JSObject::GetProperty(thread, execResult, four).GetValue()); +- JSHandle outputFour = JSTaggedValue::ToString(thread, fourHandle); ++ JSHandle four(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("4")); ++ JSHandle fourHandle(JSObject::GetProperty(thread_, execResult, four).GetValue()); ++ JSHandle outputFour = JSTaggedValue::ToString(thread_, fourHandle); + ASSERT_EQ(outputFour->Compare(*resultFour), 0); + +- JSHandle five(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("5")); +- JSHandle fiveHandle(JSObject::GetProperty(thread, execResult, five).GetValue()); ++ JSHandle five(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("5")); ++ JSHandle fiveHandle(JSObject::GetProperty(thread_, execResult, five).GetValue()); + ASSERT_TRUE(fiveHandle->IsUndefined()); + +- JSHandle six(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("6")); +- JSHandle sixHandle(JSObject::GetProperty(thread, execResult, six).GetValue()); +- JSHandle outputSix = JSTaggedValue::ToString(thread, sixHandle); ++ JSHandle six(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("6")); ++ JSHandle sixHandle(JSObject::GetProperty(thread_, execResult, six).GetValue()); ++ JSHandle outputSix = JSTaggedValue::ToString(thread_, sixHandle); + ASSERT_EQ(outputSix->Compare(*resultSix), 0); + } + +@@ -413,28 +415,28 @@ TEST_F(BuiltinsRegExpTest, Match1) + { + // invoke RegExpConstructor method + JSHandle pattern1 = +- thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("quick\\s(brown).+?(jumps)"); +- JSHandle flags1 = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("iug"); +- JSTaggedValue result1 = CreateRegExpObjByPatternAndFlags(thread, pattern1, flags1); +- JSHandle value(thread, reinterpret_cast(result1.GetRawData())); ++ thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("quick\\s(brown).+?(jumps)"); ++ JSHandle flags1 = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("iug"); ++ JSTaggedValue result1 = CreateRegExpObjByPatternAndFlags(thread_, pattern1, flags1); ++ JSHandle value(thread_, reinterpret_cast(result1.GetRawData())); + + JSHandle inputString = +- thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("The Quick Brown Fox Jumps Over The Lazy Dog"); +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("The Quick Brown Fox Jumps Over The Lazy Dog"); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(value.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, inputString.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + // invoke Match method + JSTaggedValue matchResults = BuiltinsRegExp::Match(ecmaRuntimeCallInfo.get()); + +- JSHandle matchResult(thread, matchResults); +- JSHandle zero(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("0")); ++ JSHandle matchResult(thread_, matchResults); ++ JSHandle zero(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("0")); + JSHandle resultZero = +- thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("Quick Brown Fox Jumps"); +- JSHandle zeroHandle(JSObject::GetProperty(thread, matchResult, zero).GetValue()); +- JSHandle outputZero = JSTaggedValue::ToString(thread, zeroHandle); ++ thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("Quick Brown Fox Jumps"); ++ JSHandle zeroHandle(JSObject::GetProperty(thread_, matchResult, zero).GetValue()); ++ JSHandle outputZero = JSTaggedValue::ToString(thread_, zeroHandle); + ASSERT_EQ(outputZero->Compare(*resultZero), 0); + } + +@@ -442,19 +444,19 @@ TEST_F(BuiltinsRegExpTest, Test1) + { + // invoke RegExpConstructor method + JSHandle pattern1 = +- thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("quick\\s(brown).+?(jumps)"); +- JSHandle flags1 = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("iug"); +- JSTaggedValue result1 = CreateRegExpObjByPatternAndFlags(thread, pattern1, flags1); +- JSHandle value(thread, reinterpret_cast(result1.GetRawData())); ++ thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("quick\\s(brown).+?(jumps)"); ++ JSHandle flags1 = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("iug"); ++ JSTaggedValue result1 = CreateRegExpObjByPatternAndFlags(thread_, pattern1, flags1); ++ JSHandle value(thread_, reinterpret_cast(result1.GetRawData())); + + JSHandle inputString = +- thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("The Quick Brown Fox Jumps Over The Lazy Dog"); +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("The Quick Brown Fox Jumps Over The Lazy Dog"); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(value.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, inputString.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + // invoke Test method + JSTaggedValue testResult = BuiltinsRegExp::Test(ecmaRuntimeCallInfo.get()); + ASSERT_EQ(testResult.GetRawData(), JSTaggedValue::True().GetRawData()); +@@ -464,19 +466,19 @@ TEST_F(BuiltinsRegExpTest, Search1) + { + // invoke RegExpConstructor method + JSHandle pattern1 = +- thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("quick\\s(brown).+?(jumps)"); +- JSHandle flags1 = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("iug"); +- JSTaggedValue result1 = CreateRegExpObjByPatternAndFlags(thread, pattern1, flags1); +- JSHandle value(thread, reinterpret_cast(result1.GetRawData())); ++ thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("quick\\s(brown).+?(jumps)"); ++ JSHandle flags1 = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("iug"); ++ JSTaggedValue result1 = CreateRegExpObjByPatternAndFlags(thread_, pattern1, flags1); ++ JSHandle value(thread_, reinterpret_cast(result1.GetRawData())); + + JSHandle inputString = +- thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("The Quick Brown Fox Jumps Over The Lazy Dog"); +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("The Quick Brown Fox Jumps Over The Lazy Dog"); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(value.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, inputString.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + // invoke Search method + JSTaggedValue searchResult = BuiltinsRegExp::Search(ecmaRuntimeCallInfo.get()); + ASSERT_EQ(searchResult.GetRawData(), JSTaggedValue(4).GetRawData()); +@@ -485,27 +487,27 @@ TEST_F(BuiltinsRegExpTest, Search1) + TEST_F(BuiltinsRegExpTest, Split1) + { + // invoke RegExpConstructor method +- JSHandle pattern1 = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("-"); +- JSHandle flags1 = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("iug"); +- JSTaggedValue result1 = CreateRegExpObjByPatternAndFlags(thread, pattern1, flags1); +- JSHandle value(thread, reinterpret_cast(result1.GetRawData())); ++ JSHandle pattern1 = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("-"); ++ JSHandle flags1 = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("iug"); ++ JSTaggedValue result1 = CreateRegExpObjByPatternAndFlags(thread_, pattern1, flags1); ++ JSHandle value(thread_, reinterpret_cast(result1.GetRawData())); + +- JSHandle inputString = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(""); ++ JSHandle inputString = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(""); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(value.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, inputString.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue::Undefined()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + // invoke Split method + JSTaggedValue splitResults = BuiltinsRegExp::Split(ecmaRuntimeCallInfo.get()); +- JSHandle splitResult(thread, splitResults); ++ JSHandle splitResult(thread_, splitResults); + +- JSHandle zero(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("0")); +- JSHandle zeroHandle(JSObject::GetProperty(thread, splitResult, zero).GetValue()); +- JSHandle outputZero = JSTaggedValue::ToString(thread, zeroHandle); ++ JSHandle zero(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("0")); ++ JSHandle zeroHandle(JSObject::GetProperty(thread_, splitResult, zero).GetValue()); ++ JSHandle outputZero = JSTaggedValue::ToString(thread_, zeroHandle); + + ASSERT_EQ(outputZero->Compare(*inputString), 0); + } +@@ -513,54 +515,54 @@ TEST_F(BuiltinsRegExpTest, Split1) + TEST_F(BuiltinsRegExpTest, Split2) + { + // invoke RegExpConstructor method +- JSHandle pattern1 = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("-"); +- JSHandle flags1 = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("iug"); +- JSTaggedValue result1 = CreateRegExpObjByPatternAndFlags(thread, pattern1, flags1); +- JSHandle value(thread, reinterpret_cast(result1.GetRawData())); ++ JSHandle pattern1 = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("-"); ++ JSHandle flags1 = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("iug"); ++ JSTaggedValue result1 = CreateRegExpObjByPatternAndFlags(thread_, pattern1, flags1); ++ JSHandle value(thread_, reinterpret_cast(result1.GetRawData())); + +- JSHandle inputString = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("a-b-c"); ++ JSHandle inputString = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("a-b-c"); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(value.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, inputString.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue::Undefined()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + // invoke Split method + JSTaggedValue splitResults = BuiltinsRegExp::Split(ecmaRuntimeCallInfo.get()); +- JSHandle splitResult(thread, splitResults); +- JSHandle resultZero = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("a"); +- JSHandle resultOne = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("b"); +- JSHandle resultTwo = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("c"); +- +- JSHandle zero(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("0")); +- JSHandle zeroHandle(JSObject::GetProperty(thread, splitResult, zero).GetValue()); +- JSHandle outputZero = JSTaggedValue::ToString(thread, zeroHandle); ++ JSHandle splitResult(thread_, splitResults); ++ JSHandle resultZero = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("a"); ++ JSHandle resultOne = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("b"); ++ JSHandle resultTwo = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("c"); ++ ++ JSHandle zero(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("0")); ++ JSHandle zeroHandle(JSObject::GetProperty(thread_, splitResult, zero).GetValue()); ++ JSHandle outputZero = JSTaggedValue::ToString(thread_, zeroHandle); + ASSERT_EQ(outputZero->Compare(*resultZero), 0); + +- JSHandle first(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("1")); +- JSHandle oneHandle(JSObject::GetProperty(thread, splitResult, first).GetValue()); +- JSHandle outputOne = JSTaggedValue::ToString(thread, oneHandle); ++ JSHandle first(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("1")); ++ JSHandle oneHandle(JSObject::GetProperty(thread_, splitResult, first).GetValue()); ++ JSHandle outputOne = JSTaggedValue::ToString(thread_, oneHandle); + ASSERT_EQ(outputOne->Compare(*resultOne), 0); + +- JSHandle second(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("2")); +- JSHandle twoHandle(JSObject::GetProperty(thread, splitResult, second).GetValue()); +- JSHandle outputTwo = JSTaggedValue::ToString(thread, twoHandle); ++ JSHandle second(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("2")); ++ JSHandle twoHandle(JSObject::GetProperty(thread_, splitResult, second).GetValue()); ++ JSHandle outputTwo = JSTaggedValue::ToString(thread_, twoHandle); + ASSERT_EQ(outputTwo->Compare(*resultTwo), 0); + } + + TEST_F(BuiltinsRegExpTest, GetSpecies) + { + // invoke RegExpConstructor method +- JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); ++ JSHandle env = thread_->GetEcmaVM()->GetGlobalEnv(); + JSHandle speciesSymbol = env->GetSpeciesSymbol(); + EXPECT_TRUE(!speciesSymbol.GetTaggedValue().IsUndefined()); + + JSHandle newTarget(env->GetRegExpFunction()); + + JSTaggedValue value = +- JSObject::GetProperty(thread, JSHandle(newTarget), speciesSymbol).GetValue().GetTaggedValue(); ++ JSObject::GetProperty(thread_, JSHandle(newTarget), speciesSymbol).GetValue().GetTaggedValue(); + EXPECT_EQ(value, newTarget.GetTaggedValue()); + } + +@@ -568,26 +570,26 @@ TEST_F(BuiltinsRegExpTest, Replace1) + { + // invoke RegExpConstructor method + JSHandle pattern1 = +- thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("quick\\s(brown).+?(jumps)"); +- JSHandle flags1 = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("iug"); +- JSTaggedValue result1 = CreateRegExpObjByPatternAndFlags(thread, pattern1, flags1); +- JSHandle value(thread, reinterpret_cast(result1.GetRawData())); ++ thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("quick\\s(brown).+?(jumps)"); ++ JSHandle flags1 = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("iug"); ++ JSTaggedValue result1 = CreateRegExpObjByPatternAndFlags(thread_, pattern1, flags1); ++ JSHandle value(thread_, reinterpret_cast(result1.GetRawData())); + + JSHandle inputString = +- thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("The Quick Brown Fox Jumps Over The Lazy Dog"); ++ thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("The Quick Brown Fox Jumps Over The Lazy Dog"); + JSHandle replaceString = +- thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("$&a $` $\' $2 $01 $$1 $21 $32 a"); +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("$&a $` $\' $2 $01 $$1 $21 $32 a"); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(value.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, inputString.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(1, replaceString.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + // invoke replace method + JSTaggedValue results = BuiltinsRegExp::Replace(ecmaRuntimeCallInfo.get()); +- JSHandle replaceResult(thread, results); +- JSHandle resultZero = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString( ++ JSHandle replaceResult(thread_, results); ++ JSHandle resultZero = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString( + "The Quick Brown Fox Jumpsa The Over The Lazy Dog Jumps Brown $1 Jumps1 $32 a Over The Lazy Dog"); + ASSERT_EQ(static_cast(replaceResult->GetTaggedObject())->Compare(*resultZero), 0); + } +@@ -595,24 +597,24 @@ TEST_F(BuiltinsRegExpTest, Replace1) + TEST_F(BuiltinsRegExpTest, Replace2) + { + // invoke RegExpConstructor method +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle pattern1 = factory->NewFromCanBeCompressString("b(c)(z)?(.)"); + JSHandle flags1 = factory->NewFromCanBeCompressString(""); +- JSTaggedValue result1 = CreateRegExpObjByPatternAndFlags(thread, pattern1, flags1); +- JSHandle value(thread, reinterpret_cast(result1.GetRawData())); ++ JSTaggedValue result1 = CreateRegExpObjByPatternAndFlags(thread_, pattern1, flags1); ++ JSHandle value(thread_, reinterpret_cast(result1.GetRawData())); + + JSHandle inputString = factory->NewFromCanBeCompressString("abcde"); + JSHandle replaceString = factory->NewFromCanBeCompressString("[$01$02$03$04$00]"); +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(value.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, inputString.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(1, replaceString.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + // invoke replace method + JSTaggedValue results = BuiltinsRegExp::Replace(ecmaRuntimeCallInfo.get()); +- JSHandle replaceResult(thread, results); ++ JSHandle replaceResult(thread_, results); + JSHandle resultZero = factory->NewFromCanBeCompressString("a[cd$04$00]e"); + ASSERT_EQ(static_cast(replaceResult->GetTaggedObject())->Compare(*resultZero), 0); + } +@@ -620,32 +622,32 @@ TEST_F(BuiltinsRegExpTest, Replace2) + TEST_F(BuiltinsRegExpTest, Replace3) + { + // invoke RegExpConstructor method +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle pattern1 = factory->NewFromCanBeCompressString("abc"); + JSHandle flags1 = factory->NewFromCanBeCompressString("g"); +- JSTaggedValue result1 = CreateRegExpObjByPatternAndFlags(thread, pattern1, flags1); +- JSHandle value(thread, reinterpret_cast(result1.GetRawData())); ++ JSTaggedValue result1 = CreateRegExpObjByPatternAndFlags(thread_, pattern1, flags1); ++ JSHandle value(thread_, reinterpret_cast(result1.GetRawData())); + + JSHandle inputString = factory->NewFromCanBeCompressString("abcde"); + JSHandle replaceString = factory->NewFromCanBeCompressString(""); +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(value.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, inputString.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(1, replaceString.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + // invoke replace method + JSTaggedValue results = BuiltinsRegExp::Replace(ecmaRuntimeCallInfo.get()); +- JSHandle replaceResult(thread, results); ++ JSHandle replaceResult(thread_, results); + JSHandle resultZero = factory->NewFromCanBeCompressString("de"); + ASSERT_EQ(static_cast(replaceResult->GetTaggedObject())->Compare(*resultZero), 0); + } + + TEST_F(BuiltinsRegExpTest, RegExpParseCache) + { +- RegExpParserCache *regExpParserCache = thread->GetEcmaVM()->GetRegExpParserCache(); +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ RegExpParserCache *regExpParserCache = thread_->GetEcmaVM()->GetRegExpParserCache(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle string1 = factory->NewFromCanBeCompressString("abc"); + JSHandle string2 = factory->NewFromCanBeCompressString("abcd"); + regExpParserCache->SetCache(*string1, 0, JSTaggedValue::True(), 2); +diff --git a/tests/runtime/builtins/builtins_set_test.cpp b/tests/runtime/builtins/builtins_set_test.cpp +index 9be2b95..00a5d39 100644 +--- a/tests/runtime/builtins/builtins_set_test.cpp ++++ b/tests/runtime/builtins/builtins_set_test.cpp +@@ -51,17 +51,17 @@ public: + + void SetUp() override + { +- TestHelper::CreateEcmaVMWithScope(instance, thread, scope); ++ TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); + } + + void TearDown() override + { +- TestHelper::DestroyEcmaVMWithScope(instance, scope); ++ TestHelper::DestroyEcmaVMWithScope(instance_, scope_); + } + +- PandaVM *instance {nullptr}; +- EcmaHandleScope *scope {nullptr}; +- JSThread *thread {nullptr}; ++ PandaVM *instance_ {nullptr}; ++ EcmaHandleScope *scope_ {nullptr}; ++ JSThread *thread_ {nullptr}; + + class TestClass : public base::BuiltinsBase { + public: +@@ -97,17 +97,17 @@ JSSet *CreateBuiltinsSet(JSThread *thread) + // new Set("abrupt").toString() + TEST_F(BuiltinsSetTest, CreateAndGetSize) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); +- JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); ++ JSHandle env = thread_->GetEcmaVM()->GetGlobalEnv(); + JSHandle newTarget(env->GetBuiltinsSetFunction()); +- JSHandle set(thread, CreateBuiltinsSet(thread)); ++ JSHandle set(thread_, CreateBuiltinsSet(thread_)); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(set.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue::Undefined()); + { +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsSet::GetSize(ecmaRuntimeCallInfo.get()); + + EXPECT_EQ(result.GetRawData(), JSTaggedValue(0).GetRawData()); +@@ -115,17 +115,17 @@ TEST_F(BuiltinsSetTest, CreateAndGetSize) + + JSHandle array(factory->NewTaggedArray(5)); + for (int i = 0; i < 5; i++) { +- array->Set(thread, i, JSTaggedValue(i)); ++ array->Set(thread_, i, JSTaggedValue(i)); + } + +- JSHandle values = JSArray::CreateArrayFromList(thread, array); +- auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ JSHandle values = JSArray::CreateArrayFromList(thread_, array); ++ auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo1->SetFunction(newTarget.GetTaggedValue()); + ecmaRuntimeCallInfo1->SetThis(set.GetTaggedValue()); + ecmaRuntimeCallInfo1->SetCallArg(0, values.GetTaggedValue()); + ecmaRuntimeCallInfo1->SetNewTarget(newTarget.GetTaggedValue()); + { +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); + JSTaggedValue result1 = BuiltinsSet::SetConstructor(ecmaRuntimeCallInfo1.get()); + + EXPECT_EQ(JSSet::Cast(reinterpret_cast(result1.GetRawData()))->GetSize(), 5); +@@ -134,17 +134,17 @@ TEST_F(BuiltinsSetTest, CreateAndGetSize) + + TEST_F(BuiltinsSetTest, AddAndHas) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + // create jsSet +- JSHandle set(thread, CreateBuiltinsSet(thread)); +- JSHandle key(thread, factory->NewFromCanBeCompressString("key").GetTaggedValue()); ++ JSHandle set(thread_, CreateBuiltinsSet(thread_)); ++ JSHandle key(thread_, factory->NewFromCanBeCompressString("key").GetTaggedValue()); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(set.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, key.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result1 = BuiltinsSet::Has(ecmaRuntimeCallInfo.get()); + + EXPECT_EQ(result1.GetRawData(), JSTaggedValue::False().GetRawData()); +@@ -156,35 +156,35 @@ TEST_F(BuiltinsSetTest, AddAndHas) + EXPECT_EQ(jsSet->GetSize(), 1); + + // test Has() +- auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo1->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo1->SetThis(JSTaggedValue(jsSet)); + ecmaRuntimeCallInfo1->SetCallArg(0, key.GetTaggedValue()); + { +- [[maybe_unused]] auto prevLocal = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); ++ [[maybe_unused]] auto prevLocal = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); + JSTaggedValue result3 = BuiltinsSet::Has(ecmaRuntimeCallInfo1.get()); + + EXPECT_EQ(result3.GetRawData(), JSTaggedValue::True().GetRawData()); + } + + // test -0.0 +- JSHandle negativeZero(thread, JSTaggedValue(-0.0)); +- JSHandle positiveZero(thread, JSTaggedValue(+0.0)); +- auto ecmaRuntimeCallInfo2 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ JSHandle negativeZero(thread_, JSTaggedValue(-0.0)); ++ JSHandle positiveZero(thread_, JSTaggedValue(+0.0)); ++ auto ecmaRuntimeCallInfo2 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo2->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo2->SetThis(JSTaggedValue(jsSet)); + ecmaRuntimeCallInfo2->SetCallArg(0, negativeZero.GetTaggedValue()); + { +- [[maybe_unused]] auto prevLocal = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo2.get()); ++ [[maybe_unused]] auto prevLocal = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo2.get()); + BuiltinsSet::Add(ecmaRuntimeCallInfo.get()); + } + +- auto ecmaRuntimeCallInfo3 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto ecmaRuntimeCallInfo3 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo3->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo3->SetThis(JSTaggedValue(jsSet)); + ecmaRuntimeCallInfo3->SetCallArg(0, positiveZero.GetTaggedValue()); + { +- [[maybe_unused]] auto prevLocal = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo3.get()); ++ [[maybe_unused]] auto prevLocal = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo3.get()); + JSTaggedValue result4 = BuiltinsSet::Has(ecmaRuntimeCallInfo3.get()); + + EXPECT_EQ(result4.GetRawData(), JSTaggedValue::False().GetRawData()); +@@ -194,18 +194,18 @@ TEST_F(BuiltinsSetTest, AddAndHas) + 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)); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); ++ JSHandle set(thread_, CreateBuiltinsSet(thread_)); + char keyArray[] = "key0"; + for (int i = 0; i < 5; i++) { + keyArray[3] = '1' + i; + JSHandle key(factory->NewFromCanBeCompressString(keyArray)); +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(set.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, key.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result1 = BuiltinsSet::Add(ecmaRuntimeCallInfo.get()); + + EXPECT_TRUE(result1.IsECMAObject()); +@@ -213,17 +213,17 @@ TEST_F(BuiltinsSetTest, ForEach) + EXPECT_EQ(jsSet->GetSize(), i + 1); + } + // test foreach; +- JSHandle jsArray(JSArray::ArrayCreate(thread, JSTaggedNumber(0))); ++ JSHandle jsArray(JSArray::ArrayCreate(thread_, JSTaggedNumber(0))); + JSHandle func = +- factory->NewJSFunction(thread->GetEcmaVM()->GetGlobalEnv(), reinterpret_cast(TestClass::TestFunc)); ++ factory->NewJSFunction(thread_->GetEcmaVM()->GetGlobalEnv(), reinterpret_cast(TestClass::TestFunc)); + +- auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + ecmaRuntimeCallInfo1->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo1->SetThis(set.GetTaggedValue()); + ecmaRuntimeCallInfo1->SetCallArg(0, func.GetTaggedValue()); + ecmaRuntimeCallInfo1->SetCallArg(1, jsArray.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); + JSTaggedValue result2 = BuiltinsSet::ForEach(ecmaRuntimeCallInfo1.get()); + + EXPECT_EQ(result2.GetRawData(), JSTaggedValue::VALUE_UNDEFINED); +@@ -232,9 +232,9 @@ TEST_F(BuiltinsSetTest, ForEach) + + TEST_F(BuiltinsSetTest, DeleteAndRemove) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + // create jsSet +- JSHandle set(thread, CreateBuiltinsSet(thread)); ++ JSHandle set(thread_, CreateBuiltinsSet(thread_)); + + // add 40 keys + char keyArray[] = "key0"; +@@ -242,12 +242,12 @@ TEST_F(BuiltinsSetTest, DeleteAndRemove) + keyArray[3] = '1' + i; + JSHandle key(factory->NewFromCanBeCompressString(keyArray)); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(set.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, key.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result1 = BuiltinsSet::Add(ecmaRuntimeCallInfo.get()); + + EXPECT_TRUE(result1.IsECMAObject()); +@@ -258,12 +258,12 @@ TEST_F(BuiltinsSetTest, DeleteAndRemove) + keyArray[3] = '1' + 8; + JSHandle deleteKey(factory->NewFromCanBeCompressString(keyArray)); + +- auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo1->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo1->SetThis(set.GetTaggedValue()); + ecmaRuntimeCallInfo1->SetCallArg(0, deleteKey.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); + JSTaggedValue result2 = BuiltinsSet::Has(ecmaRuntimeCallInfo1.get()); + + EXPECT_EQ(result2.GetRawData(), JSTaggedValue::True().GetRawData()); +@@ -290,73 +290,73 @@ TEST_F(BuiltinsSetTest, DeleteAndRemove) + + TEST_F(BuiltinsSetTest, Species) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); +- JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); +- JSHandle set(thread, CreateBuiltinsSet(thread)); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); ++ JSHandle env = thread_->GetEcmaVM()->GetGlobalEnv(); ++ JSHandle set(thread_, CreateBuiltinsSet(thread_)); + JSHandle speciesSymbol = env->GetSpeciesSymbol(); + EXPECT_TRUE(!speciesSymbol->IsUndefined()); + + JSHandle newTarget(env->GetBuiltinsSetFunction()); + + JSTaggedValue value = +- JSObject::GetProperty(thread, JSHandle(newTarget), speciesSymbol).GetValue().GetTaggedValue(); +- JSHandle valueHandle(thread, value); ++ JSObject::GetProperty(thread_, JSHandle(newTarget), speciesSymbol).GetValue().GetTaggedValue(); ++ JSHandle valueHandle(thread_, value); + EXPECT_EQ(value, newTarget.GetTaggedValue()); + + // to string tag + JSHandle toStringTagSymbol = env->GetToStringTagSymbol(); +- JSHandle stringTag(JSObject::GetProperty(thread, set, toStringTagSymbol).GetValue()); ++ JSHandle stringTag(JSObject::GetProperty(thread_, set, toStringTagSymbol).GetValue()); + JSHandle str = factory->NewFromCanBeCompressString("Set"); + EXPECT_TRUE(!stringTag.GetTaggedValue().IsUndefined()); + EXPECT_TRUE(EcmaString::StringsAreEqual(*str, *stringTag)); + +- JSHandle constructor = JSHandle::Cast(JSTaggedValue::ToObject(thread, valueHandle)); +- EXPECT_EQ(JSHandle(set)->GetPrototype(thread), constructor->GetFunctionPrototype()); ++ JSHandle constructor = JSHandle::Cast(JSTaggedValue::ToObject(thread_, valueHandle)); ++ EXPECT_EQ(JSHandle(set)->GetPrototype(thread_), constructor->GetFunctionPrototype()); + + JSHandle key1(factory->NewFromCanBeCompressString("add")); +- JSTaggedValue value1 = JSObject::GetProperty(thread, set, key1).GetValue().GetTaggedValue(); ++ JSTaggedValue value1 = JSObject::GetProperty(thread_, set, key1).GetValue().GetTaggedValue(); + EXPECT_FALSE(value1.IsUndefined()); + + JSHandle key2(factory->NewFromCanBeCompressString("has")); +- JSTaggedValue value2 = JSObject::GetProperty(thread, set, key1).GetValue().GetTaggedValue(); ++ JSTaggedValue value2 = JSObject::GetProperty(thread_, set, key1).GetValue().GetTaggedValue(); + EXPECT_FALSE(value2.IsUndefined()); + + JSHandle key3(factory->NewFromCanBeCompressString("clear")); +- JSTaggedValue value3 = JSObject::GetProperty(thread, set, key1).GetValue().GetTaggedValue(); ++ JSTaggedValue value3 = JSObject::GetProperty(thread_, set, key1).GetValue().GetTaggedValue(); + EXPECT_FALSE(value3.IsUndefined()); + + JSHandle key4(factory->NewFromCanBeCompressString("size")); +- JSTaggedValue value4 = JSObject::GetProperty(thread, set, key1).GetValue().GetTaggedValue(); ++ JSTaggedValue value4 = JSObject::GetProperty(thread_, set, key1).GetValue().GetTaggedValue(); + EXPECT_FALSE(value4.IsUndefined()); + + JSHandle key5(factory->NewFromCanBeCompressString("delete")); +- JSTaggedValue value5 = JSObject::GetProperty(thread, set, key1).GetValue().GetTaggedValue(); ++ JSTaggedValue value5 = JSObject::GetProperty(thread_, set, key1).GetValue().GetTaggedValue(); + EXPECT_FALSE(value5.IsUndefined()); + + JSHandle key6(factory->NewFromCanBeCompressString("forEach")); +- JSTaggedValue value6 = JSObject::GetProperty(thread, set, key1).GetValue().GetTaggedValue(); ++ JSTaggedValue value6 = JSObject::GetProperty(thread_, set, key1).GetValue().GetTaggedValue(); + EXPECT_FALSE(value6.IsUndefined()); + } + + TEST_F(BuiltinsSetTest, GetIterator) + { +- JSHandle set(thread, CreateBuiltinsSet(thread)); ++ JSHandle set(thread_, CreateBuiltinsSet(thread_)); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(set.GetTaggedValue()); +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + + // test Values() + JSTaggedValue result = BuiltinsSet::Values(ecmaRuntimeCallInfo.get()); +- JSHandle iter(thread, result); ++ JSHandle iter(thread_, result); + EXPECT_TRUE(iter->IsJSSetIterator()); + EXPECT_EQ(IterationKind::VALUE, IterationKind(iter->GetIterationKind().GetInt())); + EXPECT_EQ(JSSet::Cast(set.GetTaggedValue().GetTaggedObject())->GetLinkedSet(), iter->GetIteratedSet()); + + // test entrys() + JSTaggedValue result2 = BuiltinsSet::Entries(ecmaRuntimeCallInfo.get()); +- JSHandle iter2(thread, result2); ++ JSHandle iter2(thread_, result2); + EXPECT_TRUE(iter2->IsJSSetIterator()); + EXPECT_EQ(IterationKind::KEY_AND_VALUE, IterationKind(iter2->GetIterationKind().GetInt())); + } +diff --git a/tests/runtime/builtins/builtins_string_test.cpp b/tests/runtime/builtins/builtins_string_test.cpp +index 1ab23e7..5f6988e 100644 +--- a/tests/runtime/builtins/builtins_string_test.cpp ++++ b/tests/runtime/builtins/builtins_string_test.cpp +@@ -46,17 +46,17 @@ public: + + void SetUp() override + { +- TestHelper::CreateEcmaVMWithScope(instance, thread, scope); ++ TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); + } + + void TearDown() override + { +- TestHelper::DestroyEcmaVMWithScope(instance, scope); ++ TestHelper::DestroyEcmaVMWithScope(instance_, scope_); + } + +- PandaVM *instance {nullptr}; +- EcmaHandleScope *scope {nullptr}; +- JSThread *thread {nullptr}; ++ PandaVM *instance_ {nullptr}; ++ EcmaHandleScope *scope_ {nullptr}; ++ JSThread *thread_ {nullptr}; + }; + + JSTaggedValue CreateRegExpObjByPatternAndFlags(JSThread *thread, const JSHandle &pattern, +@@ -80,23 +80,23 @@ JSTaggedValue CreateRegExpObjByPatternAndFlags(JSThread *thread, const JSHandle< + + TEST_F(BuiltinsStringTest, StringConstructor1) + { +- JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); ++ JSHandle env = thread_->GetEcmaVM()->GetGlobalEnv(); + +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle string(env->GetStringFunction()); +- JSHandle globalObject(thread, env->GetGlobalObject()); ++ JSHandle globalObject(thread_, env->GetGlobalObject()); + JSHandle string2 = factory->NewFromCanBeCompressString("ABC"); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, string.GetTaggedValue(), 6); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, string.GetTaggedValue(), 6); + ecmaRuntimeCallInfo->SetFunction(string.GetTaggedValue()); + ecmaRuntimeCallInfo->SetThis(globalObject.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, string2.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsString::StringConstructor(ecmaRuntimeCallInfo.get()); + JSTaggedValue value(static_cast(result.GetRawData())); + ASSERT_TRUE(value.IsECMAObject()); +- JSHandle ref(thread, JSPrimitiveRef::Cast(value.GetTaggedObject())); ++ JSHandle ref(thread_, JSPrimitiveRef::Cast(value.GetTaggedObject())); + JSTaggedValue test = factory->NewFromCanBeCompressString("ABC").GetTaggedValue(); + ASSERT_EQ( + EcmaString::Cast(ref->GetValue().GetTaggedObject())->Compare(reinterpret_cast(test.GetRawData())), +@@ -106,23 +106,23 @@ TEST_F(BuiltinsStringTest, StringConstructor1) + // String.fromCharCode(65, 66, 67) + TEST_F(BuiltinsStringTest, fromCharCode1) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + const double arg1 = 65; + const double arg2 = 66; + const double arg3 = 67; + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 10); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 10); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(arg1)); + ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(arg2)); + ecmaRuntimeCallInfo->SetCallArg(2, JSTaggedValue(arg3)); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsString::FromCharCode(ecmaRuntimeCallInfo.get()); + ASSERT_TRUE(result.IsString()); + JSTaggedValue value(static_cast(result.GetRawData())); +- JSHandle valueHandle(thread, JSTaggedValue(value.GetTaggedObject())); ++ JSHandle valueHandle(thread_, JSTaggedValue(value.GetTaggedObject())); + JSTaggedValue test = factory->NewFromCanBeCompressString("ABC").GetTaggedValue(); + ASSERT_EQ( + EcmaString::Cast(valueHandle->GetTaggedObject())->Compare(reinterpret_cast(test.GetRawData())), +@@ -132,22 +132,22 @@ TEST_F(BuiltinsStringTest, fromCharCode1) + // String.fromCodePoint(65, 66, 67) + TEST_F(BuiltinsStringTest, fromCodePoint1) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + const double arg1 = 65; + const double arg2 = 66; + const double arg3 = 67; + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 10); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 10); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(arg1)); + ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(arg2)); + ecmaRuntimeCallInfo->SetCallArg(2, JSTaggedValue(arg3)); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsString::FromCodePoint(ecmaRuntimeCallInfo.get()); + ASSERT_TRUE(result.IsString()); +- JSHandle resultHandle(thread, reinterpret_cast(result.GetRawData())); ++ JSHandle resultHandle(thread_, reinterpret_cast(result.GetRawData())); + JSTaggedValue test = factory->NewFromCanBeCompressString("ABC").GetTaggedValue(); + ASSERT_EQ(resultHandle->Compare(reinterpret_cast(test.GetRawData())), 0); + } +@@ -155,18 +155,18 @@ TEST_F(BuiltinsStringTest, fromCodePoint1) + // "abcabcabc".charAt(5) + TEST_F(BuiltinsStringTest, charAt1) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle thisVal = factory->NewFromCanBeCompressString("abcabcabc"); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(thisVal.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast(5))); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsString::CharAt(ecmaRuntimeCallInfo.get()); + ASSERT_TRUE(result.IsString()); +- JSHandle resultHandle(thread, reinterpret_cast(result.GetRawData())); ++ JSHandle resultHandle(thread_, reinterpret_cast(result.GetRawData())); + JSTaggedValue test = factory->NewFromCanBeCompressString("c").GetTaggedValue(); + ASSERT_EQ(resultHandle->Compare(reinterpret_cast(test.GetRawData())), 0); + } +@@ -174,18 +174,18 @@ TEST_F(BuiltinsStringTest, charAt1) + // "一二三四".charAt(2) + TEST_F(BuiltinsStringTest, charAt2) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle thisVal = factory->NewFromString("一二三四"); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(thisVal.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast(2))); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsString::CharAt(ecmaRuntimeCallInfo.get()); + ASSERT_TRUE(result.IsString()); +- JSHandle resultHandle(thread, reinterpret_cast(result.GetRawData())); ++ JSHandle resultHandle(thread_, reinterpret_cast(result.GetRawData())); + JSTaggedValue test = factory->NewFromString("三").GetTaggedValue(); + ASSERT_EQ(resultHandle->Compare(reinterpret_cast(test.GetRawData())), 0); + } +@@ -193,18 +193,18 @@ TEST_F(BuiltinsStringTest, charAt2) + // "abcabcabc".charAt(-1) + TEST_F(BuiltinsStringTest, charAt3) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle thisVal = factory->NewFromCanBeCompressString("abcabcabc"); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(thisVal.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast(-1))); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsString::CharAt(ecmaRuntimeCallInfo.get()); + ASSERT_TRUE(result.IsString()); +- JSHandle resultHandle(thread, reinterpret_cast(result.GetRawData())); ++ JSHandle resultHandle(thread_, reinterpret_cast(result.GetRawData())); + JSTaggedValue test = factory->GetEmptyString().GetTaggedValue(); + ASSERT_EQ(resultHandle->Compare(reinterpret_cast(test.GetRawData())), 0); + } +@@ -212,15 +212,15 @@ TEST_F(BuiltinsStringTest, charAt3) + // "ABC".charCodeAt(0) + TEST_F(BuiltinsStringTest, charCodeAt1) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle thisVal = factory->NewFromCanBeCompressString("ABC"); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(thisVal.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast(0))); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsString::CharCodeAt(ecmaRuntimeCallInfo.get()); + + ASSERT_EQ(result.GetRawData(), JSTaggedValue(65).GetRawData()); +@@ -229,15 +229,15 @@ TEST_F(BuiltinsStringTest, charCodeAt1) + // "ABC".charCodeAt(-1) + TEST_F(BuiltinsStringTest, charCodeAt2) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle thisVal = factory->NewFromCanBeCompressString("ABC"); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(thisVal.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast(-1))); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsString::CharCodeAt(ecmaRuntimeCallInfo.get()); + + JSTaggedValue test = BuiltinsString::GetTaggedDouble(base::NAN_VALUE); +@@ -247,15 +247,15 @@ TEST_F(BuiltinsStringTest, charCodeAt2) + // "ABC".codePointAt(1) + TEST_F(BuiltinsStringTest, codePointAt1) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle thisVal = factory->NewFromCanBeCompressString("ABC"); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(thisVal.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast(1))); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsString::CodePointAt(ecmaRuntimeCallInfo.get()); + + ASSERT_EQ(result.GetRawData(), JSTaggedValue(66).GetRawData()); +@@ -264,23 +264,23 @@ TEST_F(BuiltinsStringTest, codePointAt1) + // 'a'.concat('b', 'c', 'd') + TEST_F(BuiltinsStringTest, concat1) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle thisStr = factory->NewFromCanBeCompressString("a"); + JSHandle val1 = factory->NewFromCanBeCompressString("b"); + JSHandle val2 = factory->NewFromCanBeCompressString("c"); + JSHandle val3 = factory->NewFromCanBeCompressString("d"); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 10); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 10); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(thisStr.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, val1.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(1, val2.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(2, val3.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsString::Concat(ecmaRuntimeCallInfo.get()); + ASSERT_TRUE(result.IsString()); +- JSHandle resultHandle(thread, reinterpret_cast(result.GetRawData())); ++ JSHandle resultHandle(thread_, reinterpret_cast(result.GetRawData())); + JSTaggedValue test = factory->NewFromCanBeCompressString("abcd").GetTaggedValue(); + ASSERT_EQ(resultHandle->Compare(reinterpret_cast(test.GetRawData())), 0); + } +@@ -288,16 +288,16 @@ TEST_F(BuiltinsStringTest, concat1) + // "abcabcabc".indexof('b') + TEST_F(BuiltinsStringTest, indexof1) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle thisStr = factory->NewFromCanBeCompressString("abcabcabc"); + JSHandle val = factory->NewFromCanBeCompressString("b"); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(thisStr.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, val.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsString::IndexOf(ecmaRuntimeCallInfo.get()); + + ASSERT_EQ(result.GetRawData(), JSTaggedValue(1).GetRawData()); +@@ -306,17 +306,17 @@ TEST_F(BuiltinsStringTest, indexof1) + // "abcabcabc".indexof('b', 2) + TEST_F(BuiltinsStringTest, indexof2) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle thisStr = factory->NewFromCanBeCompressString("abcabcabc"); + JSHandle val = factory->NewFromCanBeCompressString("b"); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(thisStr.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, val.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(static_cast(2))); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsString::IndexOf(ecmaRuntimeCallInfo.get()); + + ASSERT_EQ(result.GetRawData(), JSTaggedValue(4).GetRawData()); +@@ -325,16 +325,16 @@ TEST_F(BuiltinsStringTest, indexof2) + // "abcabcabc".indexof('d') + TEST_F(BuiltinsStringTest, indexof3) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle thisStr = factory->NewFromCanBeCompressString("abcabcabc"); + JSHandle val = factory->NewFromCanBeCompressString("d"); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(thisStr.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, val.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsString::IndexOf(ecmaRuntimeCallInfo.get()); + + ASSERT_EQ(result.GetRawData(), JSTaggedValue(-1).GetRawData()); +@@ -343,16 +343,16 @@ TEST_F(BuiltinsStringTest, indexof3) + // "abcabcabc".lastIndexOf('b') + TEST_F(BuiltinsStringTest, lastIndexOf1) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle thisStr = factory->NewFromCanBeCompressString("abcabcabc"); + JSHandle val = factory->NewFromCanBeCompressString("b"); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(thisStr.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, val.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsString::LastIndexOf(ecmaRuntimeCallInfo.get()); + + ASSERT_EQ(result.GetRawData(), JSTaggedValue(7).GetRawData()); +@@ -360,17 +360,17 @@ TEST_F(BuiltinsStringTest, lastIndexOf1) + // "abcabcabc".lastIndexOf('b', 2) + TEST_F(BuiltinsStringTest, lastIndexOf2) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle thisStr = factory->NewFromCanBeCompressString("abcabcabc"); + JSHandle val = factory->NewFromCanBeCompressString("b"); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(thisStr.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, val.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(static_cast(2))); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsString::LastIndexOf(ecmaRuntimeCallInfo.get()); + + ASSERT_EQ(result.GetRawData(), JSTaggedValue(1).GetRawData()); +@@ -379,16 +379,16 @@ TEST_F(BuiltinsStringTest, lastIndexOf2) + // "abcabcabc".lastIndexOf('d') + TEST_F(BuiltinsStringTest, lastIndexOf3) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle thisStr = factory->NewFromCanBeCompressString("abcabcabc"); + JSHandle val = factory->NewFromCanBeCompressString("d"); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(thisStr.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, val.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsString::LastIndexOf(ecmaRuntimeCallInfo.get()); + + ASSERT_EQ(result.GetRawData(), JSTaggedValue(-1).GetRawData()); +@@ -397,16 +397,16 @@ TEST_F(BuiltinsStringTest, lastIndexOf3) + // "abcabcabc".includes('b') + TEST_F(BuiltinsStringTest, Includes2) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle thisStr = factory->NewFromCanBeCompressString("abcabcabc"); + JSHandle val = factory->NewFromCanBeCompressString("b"); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(thisStr.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, val.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsString::Includes(ecmaRuntimeCallInfo.get()); + + ASSERT_EQ(result.GetRawData(), JSTaggedValue::True().GetRawData()); +@@ -415,17 +415,17 @@ TEST_F(BuiltinsStringTest, Includes2) + // "abccccccc".includes('b',2) + TEST_F(BuiltinsStringTest, Includes3) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle thisStr = factory->NewFromCanBeCompressString("abccccccc"); + JSHandle val = factory->NewFromCanBeCompressString("b"); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(thisStr.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, val.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(static_cast(2))); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsString::Includes(ecmaRuntimeCallInfo.get()); + + ASSERT_EQ(result.GetRawData(), JSTaggedValue::False().GetRawData()); +@@ -434,16 +434,16 @@ TEST_F(BuiltinsStringTest, Includes3) + // "一二三四".includes('二') + TEST_F(BuiltinsStringTest, Includes4) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle thisStr = factory->NewFromString("一二三四"); + JSHandle val = factory->NewFromString("二"); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(thisStr.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, val.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsString::Includes(ecmaRuntimeCallInfo.get()); + + ASSERT_EQ(result.GetRawData(), JSTaggedValue::True().GetRawData()); +@@ -452,16 +452,16 @@ TEST_F(BuiltinsStringTest, Includes4) + // "To be, or not to be, that is the question.".startsWith('To be') + TEST_F(BuiltinsStringTest, startsWith1) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle thisStr = factory->NewFromCanBeCompressString("To be, or not to be, that is the question."); + JSHandle val = factory->NewFromCanBeCompressString("To be"); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(thisStr.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, val.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsString::StartsWith(ecmaRuntimeCallInfo.get()); + + ASSERT_EQ(result.GetRawData(), JSTaggedValue::True().GetRawData()); +@@ -470,16 +470,16 @@ TEST_F(BuiltinsStringTest, startsWith1) + // "To be, or not to be, that is the question.".startsWith('not to be') + TEST_F(BuiltinsStringTest, startsWith2) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle thisStr = factory->NewFromCanBeCompressString("To be, or not to be, that is the question."); + JSHandle val = factory->NewFromCanBeCompressString("not to be"); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(thisStr.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, val.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsString::StartsWith(ecmaRuntimeCallInfo.get()); + + ASSERT_EQ(result.GetRawData(), JSTaggedValue::False().GetRawData()); +@@ -488,17 +488,17 @@ TEST_F(BuiltinsStringTest, startsWith2) + // "To be, or not to be, that is the question.".startsWith('not to be', 10) + TEST_F(BuiltinsStringTest, startsWith3) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle thisStr = factory->NewFromCanBeCompressString("To be, or not to be, that is the question."); + JSHandle val = factory->NewFromCanBeCompressString("not to be"); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(thisStr.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, val.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(static_cast(10))); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsString::StartsWith(ecmaRuntimeCallInfo.get()); + + ASSERT_EQ(result.GetRawData(), JSTaggedValue::True().GetRawData()); +@@ -507,16 +507,16 @@ TEST_F(BuiltinsStringTest, startsWith3) + // "To be, or not to be, that is the question.".endsWith('question.') + TEST_F(BuiltinsStringTest, endsWith1) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle thisStr = factory->NewFromCanBeCompressString("To be, or not to be, that is the question."); + JSHandle val = factory->NewFromCanBeCompressString("question."); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(thisStr.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, val.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsString::EndsWith(ecmaRuntimeCallInfo.get()); + + ASSERT_EQ(result.GetRawData(), JSTaggedValue::True().GetRawData()); +@@ -525,16 +525,16 @@ TEST_F(BuiltinsStringTest, endsWith1) + // "To be, or not to be, that is the question.".endsWith('to be') + TEST_F(BuiltinsStringTest, endsWith2) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle thisStr = factory->NewFromCanBeCompressString("To be, or not to be, that is the question."); + JSHandle val = factory->NewFromCanBeCompressString("to be"); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(thisStr.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, val.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsString::EndsWith(ecmaRuntimeCallInfo.get()); + + ASSERT_EQ(result.GetRawData(), JSTaggedValue::False().GetRawData()); +@@ -543,17 +543,17 @@ TEST_F(BuiltinsStringTest, endsWith2) + // "To be, or not to be, that is the question.".endsWith('to be', 19) + TEST_F(BuiltinsStringTest, endsWith3) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle thisStr = factory->NewFromCanBeCompressString("To be, or not to be, that is the question."); + JSHandle val = factory->NewFromCanBeCompressString("to be"); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(thisStr.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, val.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(static_cast(19))); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsString::EndsWith(ecmaRuntimeCallInfo.get()); + + ASSERT_EQ(result.GetRawData(), JSTaggedValue::True().GetRawData()); +@@ -562,18 +562,18 @@ TEST_F(BuiltinsStringTest, endsWith3) + // "有ABC".toLocaleLowerCase() + TEST_F(BuiltinsStringTest, toLocaleLowerCase2) + { +- ASSERT_NE(thread, nullptr); +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ASSERT_NE(thread_, nullptr); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle this_str = factory->NewFromString("有ABC"); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(this_str.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsString::ToLocaleLowerCase(ecmaRuntimeCallInfo.get()); + ASSERT_TRUE(result.IsString()); +- JSHandle result_handle(thread, reinterpret_cast(result.GetRawData())); ++ JSHandle result_handle(thread_, reinterpret_cast(result.GetRawData())); + JSTaggedValue test = factory->NewFromString("有abc").GetTaggedValue(); + ASSERT_EQ(result_handle->Compare(reinterpret_cast(test.GetRawData())), 0); + } +@@ -581,17 +581,17 @@ TEST_F(BuiltinsStringTest, toLocaleLowerCase2) + // "ABC".toLowerCase() + TEST_F(BuiltinsStringTest, toLowerCase1) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle thisStr = factory->NewFromCanBeCompressString("ABC"); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(thisStr.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsString::ToLowerCase(ecmaRuntimeCallInfo.get()); + ASSERT_TRUE(result.IsString()); +- JSHandle resultHandle(thread, reinterpret_cast(result.GetRawData())); ++ JSHandle resultHandle(thread_, reinterpret_cast(result.GetRawData())); + JSHandle test = factory->NewFromCanBeCompressString("abc"); + ASSERT_TRUE(JSTaggedValue::SameValue(resultHandle.GetTaggedValue(), test.GetTaggedValue())); + } +@@ -599,17 +599,17 @@ TEST_F(BuiltinsStringTest, toLowerCase1) + // "abc".toUpperCase() + TEST_F(BuiltinsStringTest, toUpperCase1) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle thisStr = factory->NewFromCanBeCompressString("abc"); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(thisStr.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsString::ToUpperCase(ecmaRuntimeCallInfo.get()); + ASSERT_TRUE(result.IsString()); +- JSHandle resultHandle(thread, reinterpret_cast(result.GetRawData())); ++ JSHandle resultHandle(thread_, reinterpret_cast(result.GetRawData())); + JSTaggedValue test = factory->NewFromCanBeCompressString("ABC").GetTaggedValue(); + ASSERT_EQ(resultHandle->Compare(reinterpret_cast(test.GetRawData())), 0); + } +@@ -617,16 +617,16 @@ TEST_F(BuiltinsStringTest, toUpperCase1) + // "abc".localecompare('b') + TEST_F(BuiltinsStringTest, localecompare1) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle thisStr = factory->NewFromCanBeCompressString("abc"); + JSHandle val = factory->NewFromCanBeCompressString("b"); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(thisStr.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, val.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsString::LocaleCompare(ecmaRuntimeCallInfo.get()); + + ASSERT_EQ(result.GetRawData(), JSTaggedValue(-1).GetRawData()); +@@ -635,16 +635,16 @@ TEST_F(BuiltinsStringTest, localecompare1) + // "abc".localecompare('abc') + TEST_F(BuiltinsStringTest, localecompare2) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle thisStr = factory->NewFromCanBeCompressString("abc"); + JSHandle val = factory->NewFromCanBeCompressString("abc"); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(thisStr.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, val.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsString::LocaleCompare(ecmaRuntimeCallInfo.get()); + + ASSERT_EQ(result.GetRawData(), JSTaggedValue(0).GetRawData()); +@@ -653,16 +653,16 @@ TEST_F(BuiltinsStringTest, localecompare2) + // "abc".localecompare('aa') + TEST_F(BuiltinsStringTest, localecompare3) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle thisStr = factory->NewFromCanBeCompressString("abc"); + JSHandle val = factory->NewFromCanBeCompressString("aa"); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(thisStr.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, val.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsString::LocaleCompare(ecmaRuntimeCallInfo.get()); + + ASSERT_EQ(result.GetRawData(), JSTaggedValue(1).GetRawData()); +@@ -671,20 +671,20 @@ TEST_F(BuiltinsStringTest, localecompare3) + // "abc".normalize('NFC') + TEST_F(BuiltinsStringTest, normalize1) + { +- ASSERT_NE(thread, nullptr); +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ASSERT_NE(thread_, nullptr); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle this_str = factory->NewFromString("abc"); + JSHandle val = factory->NewFromString("NFC"); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(this_str.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, val.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsString::Normalize(ecmaRuntimeCallInfo.get()); + ASSERT_TRUE(result.IsString()); +- JSHandle result_handle(thread, reinterpret_cast(result.GetRawData())); ++ JSHandle result_handle(thread_, reinterpret_cast(result.GetRawData())); + JSTaggedValue test = factory->NewFromString("abc").GetTaggedValue(); + ASSERT_EQ(result_handle->Compare(reinterpret_cast(test.GetRawData())), 0); + } +@@ -692,20 +692,20 @@ TEST_F(BuiltinsStringTest, normalize1) + // "hello".padEnd(10) + TEST_F(BuiltinsStringTest, padEnd1) + { +- ASSERT_NE(thread, nullptr); ++ ASSERT_NE(thread_, nullptr); + +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle this_str = factory->NewFromString("hello"); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(this_str.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast(10))); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsString::padEnd(ecmaRuntimeCallInfo.get()); + ASSERT_TRUE(result.IsString()); +- JSHandle result_handle(thread, reinterpret_cast(result.GetRawData())); ++ JSHandle result_handle(thread_, reinterpret_cast(result.GetRawData())); + JSTaggedValue test = factory->NewFromString("hello ").GetTaggedValue(); + ASSERT_EQ(result_handle->Compare(reinterpret_cast(test.GetRawData())), 0); + } +@@ -713,22 +713,22 @@ TEST_F(BuiltinsStringTest, padEnd1) + // "hello".padEnd(11, world) + TEST_F(BuiltinsStringTest, padEnd2) + { +- ASSERT_NE(thread, nullptr); ++ ASSERT_NE(thread_, nullptr); + +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle this_str = factory->NewFromString("hello"); + JSHandle fillString = factory->NewFromString("world"); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(this_str.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast(11))); + ecmaRuntimeCallInfo->SetCallArg(1, fillString.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsString::padEnd(ecmaRuntimeCallInfo.get()); + ASSERT_TRUE(result.IsString()); +- JSHandle result_handle(thread, reinterpret_cast(result.GetRawData())); ++ JSHandle result_handle(thread_, reinterpret_cast(result.GetRawData())); + JSTaggedValue test = factory->NewFromString("helloworldw").GetTaggedValue(); + ASSERT_EQ(result_handle->Compare(reinterpret_cast(test.GetRawData())), 0); + } +@@ -736,20 +736,20 @@ TEST_F(BuiltinsStringTest, padEnd2) + // "world".padStart(10) + TEST_F(BuiltinsStringTest, padStart1) + { +- ASSERT_NE(thread, nullptr); ++ ASSERT_NE(thread_, nullptr); + +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle this_str = factory->NewFromString("world"); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(this_str.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast(10))); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsString::padStart(ecmaRuntimeCallInfo.get()); + ASSERT_TRUE(result.IsString()); +- JSHandle result_handle(thread, reinterpret_cast(result.GetRawData())); ++ JSHandle result_handle(thread_, reinterpret_cast(result.GetRawData())); + JSTaggedValue test = factory->NewFromString(" world").GetTaggedValue(); + ASSERT_EQ(result_handle->Compare(reinterpret_cast(test.GetRawData())), 0); + } +@@ -757,22 +757,22 @@ TEST_F(BuiltinsStringTest, padStart1) + // "world".padStart(11, "hello") + TEST_F(BuiltinsStringTest, padStart2) + { +- ASSERT_NE(thread, nullptr); ++ ASSERT_NE(thread_, nullptr); + +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle this_str = factory->NewFromString("world"); + JSHandle fillString = factory->NewFromString("hello"); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(this_str.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast(11))); + ecmaRuntimeCallInfo->SetCallArg(1, fillString.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsString::padStart(ecmaRuntimeCallInfo.get()); + ASSERT_TRUE(result.IsString()); +- JSHandle result_handle(thread, reinterpret_cast(result.GetRawData())); ++ JSHandle result_handle(thread_, reinterpret_cast(result.GetRawData())); + JSTaggedValue test = factory->NewFromString("hellohworld").GetTaggedValue(); + ASSERT_EQ(result_handle->Compare(reinterpret_cast(test.GetRawData())), 0); + } +@@ -780,18 +780,18 @@ TEST_F(BuiltinsStringTest, padStart2) + // "abc".repeat(5) + TEST_F(BuiltinsStringTest, repeat1) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle thisStr = factory->NewFromCanBeCompressString("abc"); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(thisStr.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast(5))); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsString::Repeat(ecmaRuntimeCallInfo.get()); + ASSERT_TRUE(result.IsString()); +- JSHandle resultHandle(thread, reinterpret_cast(result.GetRawData())); ++ JSHandle resultHandle(thread_, reinterpret_cast(result.GetRawData())); + JSTaggedValue test = factory->NewFromCanBeCompressString("abcabcabcabcabc").GetTaggedValue(); + ASSERT_EQ(resultHandle->Compare(reinterpret_cast(test.GetRawData())), 0); + } +@@ -799,19 +799,19 @@ TEST_F(BuiltinsStringTest, repeat1) + // 'The morning is upon us.'.slice(4, -2) + TEST_F(BuiltinsStringTest, slice1) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle thisStr = factory->NewFromCanBeCompressString("The morning is upon us."); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(thisStr.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast(4))); + ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(static_cast(-2))); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsString::Slice(ecmaRuntimeCallInfo.get()); + ASSERT_TRUE(result.IsString()); +- JSHandle resultHandle(thread, reinterpret_cast(result.GetRawData())); ++ JSHandle resultHandle(thread_, reinterpret_cast(result.GetRawData())); + JSTaggedValue test = factory->NewFromCanBeCompressString("morning is upon u").GetTaggedValue(); + ASSERT_EQ(resultHandle->Compare(reinterpret_cast(test.GetRawData())), 0); + } +@@ -819,18 +819,18 @@ TEST_F(BuiltinsStringTest, slice1) + // 'The morning is upon us.'.slice(12) + TEST_F(BuiltinsStringTest, slice2) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle thisStr = factory->NewFromCanBeCompressString("The morning is upon us."); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(thisStr.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast(12))); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsString::Slice(ecmaRuntimeCallInfo.get()); + ASSERT_TRUE(result.IsString()); +- JSHandle resultHandle(thread, reinterpret_cast(result.GetRawData())); ++ JSHandle resultHandle(thread_, reinterpret_cast(result.GetRawData())); + JSTaggedValue test = factory->NewFromCanBeCompressString("is upon us.").GetTaggedValue(); + ASSERT_EQ(resultHandle->Compare(reinterpret_cast(test.GetRawData())), 0); + } +@@ -838,19 +838,19 @@ TEST_F(BuiltinsStringTest, slice2) + // 'Mozilla'.substring(3, -3) + TEST_F(BuiltinsStringTest, substring1) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle thisStr = factory->NewFromCanBeCompressString("Mozilla"); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(thisStr.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast(3))); + ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(static_cast(-3))); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsString::Substring(ecmaRuntimeCallInfo.get()); + ASSERT_TRUE(result.IsString()); +- JSHandle resultHandle(thread, reinterpret_cast(result.GetRawData())); ++ JSHandle resultHandle(thread_, reinterpret_cast(result.GetRawData())); + JSTaggedValue test = factory->NewFromCanBeCompressString("Moz").GetTaggedValue(); + ASSERT_EQ(resultHandle->Compare(reinterpret_cast(test.GetRawData())), 0); + } +@@ -858,19 +858,19 @@ TEST_F(BuiltinsStringTest, substring1) + // 'Mozilla'.substring(7, 4) + TEST_F(BuiltinsStringTest, substring2) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle thisStr = factory->NewFromCanBeCompressString("Mozilla"); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(thisStr.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast(7))); + ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(static_cast(4))); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsString::Substring(ecmaRuntimeCallInfo.get()); + ASSERT_TRUE(result.IsString()); +- JSHandle resultHandle(thread, reinterpret_cast(result.GetRawData())); ++ JSHandle resultHandle(thread_, reinterpret_cast(result.GetRawData())); + JSTaggedValue test = factory->NewFromCanBeCompressString("lla").GetTaggedValue(); + ASSERT_EQ(resultHandle->Compare(reinterpret_cast(test.GetRawData())), 0); + } +@@ -878,40 +878,40 @@ TEST_F(BuiltinsStringTest, substring2) + // " Hello world! ".trim() + TEST_F(BuiltinsStringTest, trim1) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle thisStr = factory->NewFromCanBeCompressString(" Hello world! "); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(thisStr.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsString::Trim(ecmaRuntimeCallInfo.get()); + ASSERT_TRUE(result.IsString()); +- JSHandle resultHandle(thread, reinterpret_cast(result.GetRawData())); ++ JSHandle resultHandle(thread_, reinterpret_cast(result.GetRawData())); + JSTaggedValue test = factory->NewFromCanBeCompressString("Hello world!").GetTaggedValue(); + ASSERT_EQ(resultHandle->Compare(reinterpret_cast(test.GetRawData())), 0); + } + + TEST_F(BuiltinsStringTest, trim2) + { +- auto ecmaVM = thread->GetEcmaVM(); ++ auto ecmaVM = thread_->GetEcmaVM(); + JSHandle env = ecmaVM->GetGlobalEnv(); + +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle thisStr = factory->NewFromCanBeCompressString(" Hello world! "); + JSHandle stringObject(env->GetStringFunction()); +- JSHandle value(thread, JSTaggedValue(thisStr.GetTaggedValue().GetTaggedObject())); ++ JSHandle value(thread_, JSTaggedValue(thisStr.GetTaggedValue().GetTaggedObject())); + JSHandle str = factory->NewJSPrimitiveRef(stringObject, value); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(str.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsString::Trim(ecmaRuntimeCallInfo.get()); + ASSERT_TRUE(result.IsString()); +- JSHandle resultHandle(thread, reinterpret_cast(result.GetRawData())); ++ JSHandle resultHandle(thread_, reinterpret_cast(result.GetRawData())); + JSTaggedValue test = factory->NewFromCanBeCompressString("Hello world!").GetTaggedValue(); + ASSERT_EQ(resultHandle->Compare(reinterpret_cast(test.GetRawData())), 0); + } +@@ -919,19 +919,19 @@ TEST_F(BuiltinsStringTest, trim2) + // " Hello world! ".trimEnd() + TEST_F(BuiltinsStringTest, trimEnd1) + { +- ASSERT_NE(thread, nullptr); ++ ASSERT_NE(thread_, nullptr); + +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle this_str = factory->NewFromString(" Hello world! "); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(this_str.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsString::TrimEnd(ecmaRuntimeCallInfo.get()); + ASSERT_TRUE(result.IsString()); +- JSHandle result_handle(thread, reinterpret_cast(result.GetRawData())); ++ JSHandle result_handle(thread_, reinterpret_cast(result.GetRawData())); + JSTaggedValue test = factory->NewFromString(" Hello world!").GetTaggedValue(); + ASSERT_EQ(result_handle->Compare(reinterpret_cast(test.GetRawData())), 0); + } +@@ -939,24 +939,24 @@ TEST_F(BuiltinsStringTest, trimEnd1) + // new String(" Hello world! ").trimEnd() + TEST_F(BuiltinsStringTest, trimEnd2) + { +- ASSERT_NE(thread, nullptr); +- auto ecmaVm = thread->GetEcmaVM(); ++ ASSERT_NE(thread_, nullptr); ++ auto ecmaVm = thread_->GetEcmaVM(); + JSHandle env = ecmaVm->GetGlobalEnv(); + +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle this_str = factory->NewFromString(" Hello world! "); + JSHandle string_object(env->GetStringFunction()); +- JSHandle value(thread, JSTaggedValue(this_str.GetTaggedValue().GetHeapObject())); ++ JSHandle value(thread_, JSTaggedValue(this_str.GetTaggedValue().GetHeapObject())); + JSHandle str = factory->NewJSPrimitiveRef(string_object, value); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(str.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsString::TrimEnd(ecmaRuntimeCallInfo.get()); + ASSERT_TRUE(result.IsString()); +- JSHandle result_handle(thread, reinterpret_cast(result.GetRawData())); ++ JSHandle result_handle(thread_, reinterpret_cast(result.GetRawData())); + JSTaggedValue test = factory->NewFromString(" Hello world!").GetTaggedValue(); + ASSERT_EQ(result_handle->Compare(reinterpret_cast(test.GetRawData())), 0); + } +@@ -964,19 +964,19 @@ TEST_F(BuiltinsStringTest, trimEnd2) + // " Hello world! ".trimStart() + TEST_F(BuiltinsStringTest, trimStart1) + { +- ASSERT_NE(thread, nullptr); ++ ASSERT_NE(thread_, nullptr); + +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle this_str = factory->NewFromString(" Hello world! "); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(this_str.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsString::TrimStart(ecmaRuntimeCallInfo.get()); + ASSERT_TRUE(result.IsString()); +- JSHandle result_handle(thread, reinterpret_cast(result.GetRawData())); ++ JSHandle result_handle(thread_, reinterpret_cast(result.GetRawData())); + JSTaggedValue test = factory->NewFromString("Hello world! ").GetTaggedValue(); + ASSERT_EQ(result_handle->Compare(reinterpret_cast(test.GetRawData())), 0); + } +@@ -984,24 +984,24 @@ TEST_F(BuiltinsStringTest, trimStart1) + // new String(" Hello world! ").trimStart() + TEST_F(BuiltinsStringTest, trimStart2) + { +- ASSERT_NE(thread, nullptr); +- auto ecmaVm = thread->GetEcmaVM(); ++ ASSERT_NE(thread_, nullptr); ++ auto ecmaVm = thread_->GetEcmaVM(); + JSHandle env = ecmaVm->GetGlobalEnv(); + +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle this_str = factory->NewFromString(" Hello world! "); + JSHandle string_object(env->GetStringFunction()); +- JSHandle value(thread, JSTaggedValue(this_str.GetTaggedValue().GetHeapObject())); ++ JSHandle value(thread_, JSTaggedValue(this_str.GetTaggedValue().GetHeapObject())); + JSHandle str = factory->NewJSPrimitiveRef(string_object, value); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(str.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsString::TrimStart(ecmaRuntimeCallInfo.get()); + ASSERT_TRUE(result.IsString()); +- JSHandle result_handle(thread, reinterpret_cast(result.GetRawData())); ++ JSHandle result_handle(thread_, reinterpret_cast(result.GetRawData())); + JSTaggedValue test = factory->NewFromString("Hello world! ").GetTaggedValue(); + ASSERT_EQ(result_handle->Compare(reinterpret_cast(test.GetRawData())), 0); + } +@@ -1009,46 +1009,46 @@ TEST_F(BuiltinsStringTest, trimStart2) + // new String("abcabcabc").toString(); + TEST_F(BuiltinsStringTest, ToString) + { +- auto ecmaVM = thread->GetEcmaVM(); ++ auto ecmaVM = thread_->GetEcmaVM(); + JSHandle env = ecmaVM->GetGlobalEnv(); + +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle thisStr = factory->NewFromCanBeCompressString("abcabcabc"); + JSHandle stringObject(env->GetStringFunction()); +- JSHandle value(thread, JSTaggedValue(thisStr.GetTaggedValue().GetTaggedObject())); ++ JSHandle value(thread_, JSTaggedValue(thisStr.GetTaggedValue().GetTaggedObject())); + JSHandle str = factory->NewJSPrimitiveRef(stringObject, value); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(str.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsString::ToString(ecmaRuntimeCallInfo.get()); + ASSERT_TRUE(result.IsString()); +- JSHandle resultHandle(thread, reinterpret_cast(result.GetRawData())); ++ JSHandle resultHandle(thread_, reinterpret_cast(result.GetRawData())); + JSTaggedValue test = JSTaggedValue(*thisStr); + ASSERT_EQ(result.GetRawData(), test.GetRawData()); + } + + TEST_F(BuiltinsStringTest, ValueOf) + { +- auto ecmaVM = thread->GetEcmaVM(); ++ auto ecmaVM = thread_->GetEcmaVM(); + JSHandle env = ecmaVM->GetGlobalEnv(); + +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle thisStr = factory->NewFromCanBeCompressString("abcabcabc"); + JSHandle stringObject(env->GetStringFunction()); +- JSHandle value(thread, JSTaggedValue(thisStr.GetTaggedValue().GetTaggedObject())); ++ JSHandle value(thread_, JSTaggedValue(thisStr.GetTaggedValue().GetTaggedObject())); + JSHandle str = factory->NewJSPrimitiveRef(stringObject, value); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(str.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsString::ValueOf(ecmaRuntimeCallInfo.get()); + ASSERT_TRUE(result.IsString()); +- JSHandle resultHandle(thread, reinterpret_cast(result.GetRawData())); ++ JSHandle resultHandle(thread_, reinterpret_cast(result.GetRawData())); + JSTaggedValue test = JSTaggedValue(*thisStr); + ASSERT_EQ(result.GetRawData(), test.GetRawData()); + } +@@ -1062,39 +1062,39 @@ static inline JSFunction *BuiltinsStringTestCreate(JSThread *thread) + + TEST_F(BuiltinsStringTest, Raw) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle foo(factory->NewFromCanBeCompressString("foo")); + JSHandle bar(factory->NewFromCanBeCompressString("bar")); + JSHandle baz(factory->NewFromCanBeCompressString("baz")); +- JSHandle rawArray = JSHandle::Cast(JSArray::ArrayCreate(thread, JSTaggedNumber(0))); ++ JSHandle rawArray = JSHandle::Cast(JSArray::ArrayCreate(thread_, JSTaggedNumber(0))); + JSHandle obj(rawArray); +- JSHandle key0(thread, JSTaggedValue(0)); +- PropertyDescriptor desc0(thread, foo); +- JSArray::DefineOwnProperty(thread, obj, key0, desc0); +- JSHandle key1(thread, JSTaggedValue(1)); +- PropertyDescriptor desc1(thread, bar); +- JSArray::DefineOwnProperty(thread, obj, key1, desc1); +- JSHandle key2(thread, JSTaggedValue(2)); +- PropertyDescriptor desc2(thread, baz); +- JSArray::DefineOwnProperty(thread, obj, key2, desc2); +- +- JSHandle constructor(thread, BuiltinsStringTestCreate(thread)); ++ JSHandle key0(thread_, JSTaggedValue(0)); ++ PropertyDescriptor desc0(thread_, foo); ++ JSArray::DefineOwnProperty(thread_, obj, key0, desc0); ++ JSHandle key1(thread_, JSTaggedValue(1)); ++ PropertyDescriptor desc1(thread_, bar); ++ JSArray::DefineOwnProperty(thread_, obj, key1, desc1); ++ JSHandle key2(thread_, JSTaggedValue(2)); ++ PropertyDescriptor desc2(thread_, baz); ++ JSArray::DefineOwnProperty(thread_, obj, key2, desc2); ++ ++ JSHandle constructor(thread_, BuiltinsStringTestCreate(thread_)); + JSHandle templateString( + factory->NewJSObjectByConstructor(JSHandle(constructor), constructor)); + JSHandle rawKey(factory->NewFromCanBeCompressString("raw")); +- JSObject::SetProperty(thread, templateString, rawKey, rawArray); ++ JSObject::SetProperty(thread_, templateString, rawKey, rawArray); + JSHandle test = factory->NewFromCanBeCompressString("foo5barJavaScriptbaz"); + + JSHandle javascript = factory->NewFromCanBeCompressString("JavaScript"); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 10); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 10); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(templateString.GetObject())); + ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(static_cast(5))); + ecmaRuntimeCallInfo->SetCallArg(2, javascript.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsString::Raw(ecmaRuntimeCallInfo.get()); + ASSERT_TRUE(result.IsString()); + ASSERT_TRUE(EcmaString::StringsAreEqual(reinterpret_cast(result.GetRawData()), *test)); +@@ -1102,21 +1102,21 @@ TEST_F(BuiltinsStringTest, Raw) + + TEST_F(BuiltinsStringTest, Replace) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle thisStr = factory->NewFromCanBeCompressString("Twas the night before Xmas..."); + JSHandle searchStr = factory->NewFromCanBeCompressString("Xmas"); + JSHandle replaceStr = factory->NewFromCanBeCompressString("Christmas"); + JSHandle expected = factory->NewFromCanBeCompressString("Twas the night before Christmas..."); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(thisStr.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, searchStr.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(1, replaceStr.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsString::Replace(ecmaRuntimeCallInfo.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + + ASSERT_TRUE(result.IsString()); + ASSERT_TRUE(EcmaString::StringsAreEqual(reinterpret_cast(result.GetRawData()), *expected)); +@@ -1124,51 +1124,51 @@ TEST_F(BuiltinsStringTest, Replace) + JSHandle replaceStr1 = factory->NewFromCanBeCompressString("abc$$"); + JSHandle expected1 = factory->NewFromCanBeCompressString("Twas the night before abc$..."); + +- auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + ecmaRuntimeCallInfo1->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo1->SetThis(thisStr.GetTaggedValue()); + ecmaRuntimeCallInfo1->SetCallArg(0, searchStr.GetTaggedValue()); + ecmaRuntimeCallInfo1->SetCallArg(1, replaceStr1.GetTaggedValue()); + +- prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); ++ prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); + JSTaggedValue result1 = BuiltinsString::Replace(ecmaRuntimeCallInfo1.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + +- JSHandle resultString1(thread, result1); ++ JSHandle resultString1(thread_, result1); + ASSERT_TRUE(result1.IsString()); + ASSERT_TRUE(EcmaString::StringsAreEqual(*resultString1, *expected1)); + + JSHandle replaceStr2 = factory->NewFromCanBeCompressString("abc$$dd"); + JSHandle expected2 = factory->NewFromCanBeCompressString("Twas the night before abc$dd..."); + +- auto ecmaRuntimeCallInfo2 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ auto ecmaRuntimeCallInfo2 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + ecmaRuntimeCallInfo2->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo2->SetThis(thisStr.GetTaggedValue()); + ecmaRuntimeCallInfo2->SetCallArg(0, searchStr.GetTaggedValue()); + ecmaRuntimeCallInfo2->SetCallArg(1, replaceStr2.GetTaggedValue()); + +- prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo2.get()); ++ prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo2.get()); + JSTaggedValue result2 = BuiltinsString::Replace(ecmaRuntimeCallInfo2.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + +- JSHandle resultString2(thread, result2); ++ JSHandle resultString2(thread_, result2); + ASSERT_TRUE(result2.IsString()); + ASSERT_TRUE(EcmaString::StringsAreEqual(*resultString2, *expected2)); + + JSHandle replaceStr3 = factory->NewFromCanBeCompressString("abc$&dd"); + JSHandle expected3 = factory->NewFromCanBeCompressString("Twas the night before abcXmasdd..."); + +- auto ecmaRuntimeCallInfo3 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ auto ecmaRuntimeCallInfo3 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + ecmaRuntimeCallInfo3->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo3->SetThis(thisStr.GetTaggedValue()); + ecmaRuntimeCallInfo3->SetCallArg(0, searchStr.GetTaggedValue()); + ecmaRuntimeCallInfo3->SetCallArg(1, replaceStr3.GetTaggedValue()); + +- prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo3.get()); ++ prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo3.get()); + JSTaggedValue result3 = BuiltinsString::Replace(ecmaRuntimeCallInfo3.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + +- JSHandle resultString3(thread, result3); ++ JSHandle resultString3(thread_, result3); + ASSERT_TRUE(result3.IsString()); + ASSERT_TRUE(EcmaString::StringsAreEqual(*resultString3, *expected3)); + +@@ -1176,38 +1176,38 @@ TEST_F(BuiltinsStringTest, Replace) + JSHandle expected4 = + factory->NewFromCanBeCompressString("Twas the night before abcTwas the night before dd..."); + +- auto ecmaRuntimeCallInfo4 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ auto ecmaRuntimeCallInfo4 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + ecmaRuntimeCallInfo4->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo4->SetThis(thisStr.GetTaggedValue()); + ecmaRuntimeCallInfo4->SetCallArg(0, searchStr.GetTaggedValue()); + ecmaRuntimeCallInfo4->SetCallArg(1, replaceStr4.GetTaggedValue()); + +- prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo4.get()); ++ prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo4.get()); + JSTaggedValue result4 = BuiltinsString::Replace(ecmaRuntimeCallInfo4.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + +- JSHandle resultString4(thread, result4); ++ JSHandle resultString4(thread_, result4); + ASSERT_TRUE(result4.IsString()); + ASSERT_TRUE(EcmaString::StringsAreEqual(*resultString4, *expected4)); + } + + TEST_F(BuiltinsStringTest, Replace2) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle thisStr = factory->NewFromCanBeCompressString("Twas the night before Xmas..."); + JSHandle searchStr = factory->NewFromCanBeCompressString("Xmas"); + JSHandle replaceStr = factory->NewFromCanBeCompressString("abc$\'dd"); + JSHandle expected = factory->NewFromCanBeCompressString("Twas the night before abc...dd..."); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(thisStr.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, searchStr.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(1, replaceStr.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsString::Replace(ecmaRuntimeCallInfo.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + + ASSERT_TRUE(result.IsString()); + ASSERT_TRUE(EcmaString::StringsAreEqual(reinterpret_cast(result.GetRawData()), *expected)); +@@ -1216,17 +1216,17 @@ TEST_F(BuiltinsStringTest, Replace2) + JSHandle expected2 = + factory->NewFromCanBeCompressString("Twas the night before abcTwas the night before dd...$ff..."); + +- auto ecmaRuntimeCallInfo2 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ auto ecmaRuntimeCallInfo2 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + ecmaRuntimeCallInfo2->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo2->SetThis(thisStr.GetTaggedValue()); + ecmaRuntimeCallInfo2->SetCallArg(0, searchStr.GetTaggedValue()); + ecmaRuntimeCallInfo2->SetCallArg(1, replaceStr2.GetTaggedValue()); + +- prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo2.get()); ++ prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo2.get()); + JSTaggedValue result2 = BuiltinsString::Replace(ecmaRuntimeCallInfo2.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + +- JSHandle resultString2(thread, result2); ++ JSHandle resultString2(thread_, result2); + ASSERT_TRUE(result2.IsString()); + ASSERT_TRUE(EcmaString::StringsAreEqual(*resultString2, *expected2)); + +@@ -1234,17 +1234,17 @@ TEST_F(BuiltinsStringTest, Replace2) + JSHandle expected3 = + factory->NewFromCanBeCompressString("Twas the night before abcTwas the night before dd...$..."); + +- auto ecmaRuntimeCallInfo3 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ auto ecmaRuntimeCallInfo3 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + ecmaRuntimeCallInfo3->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo3->SetThis(thisStr.GetTaggedValue()); + ecmaRuntimeCallInfo3->SetCallArg(0, searchStr.GetTaggedValue()); + ecmaRuntimeCallInfo3->SetCallArg(1, replaceStr3.GetTaggedValue()); + +- prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo3.get()); ++ prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo3.get()); + JSTaggedValue result3 = BuiltinsString::Replace(ecmaRuntimeCallInfo3.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + +- JSHandle resultString3(thread, result3); ++ JSHandle resultString3(thread_, result3); + ASSERT_TRUE(result3.IsString()); + ASSERT_TRUE(EcmaString::StringsAreEqual(*resultString3, *expected3)); + +@@ -1252,37 +1252,37 @@ TEST_F(BuiltinsStringTest, Replace2) + JSHandle expected4 = + factory->NewFromCanBeCompressString("Twas the night before abcTwas the night before dd$..."); + +- auto ecmaRuntimeCallInfo4 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ auto ecmaRuntimeCallInfo4 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + ecmaRuntimeCallInfo4->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo4->SetThis(thisStr.GetTaggedValue()); + ecmaRuntimeCallInfo4->SetCallArg(0, searchStr.GetTaggedValue()); + ecmaRuntimeCallInfo4->SetCallArg(1, replaceStr4.GetTaggedValue()); + +- prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo4.get()); ++ prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo4.get()); + JSTaggedValue result4 = BuiltinsString::Replace(ecmaRuntimeCallInfo4.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + + ASSERT_TRUE(result4.IsString()); +- JSHandle resultString4(thread, result4); ++ JSHandle resultString4(thread_, result4); + ASSERT_TRUE(EcmaString::StringsAreEqual(*resultString4, *expected4)); + } + + TEST_F(BuiltinsStringTest, Replace3) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle thisStr = factory->NewFromCanBeCompressString("Twas the night before Xmas..."); + JSHandle searchStr = factory->NewFromCanBeCompressString("Xmas"); + JSHandle replaceStr = factory->NewFromCanBeCompressString("$&a $` $\' $2 $01 $$1 $21 $32 a"); + JSHandle expected = factory->NewFromCanBeCompressString( + "Twas the night before Xmasa Twas the night before ... $2 $01 $1 $21 $32 a..."); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(thisStr.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, searchStr.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(1, replaceStr.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsString::Replace(ecmaRuntimeCallInfo.get()); + + ASSERT_TRUE(result.IsString()); +@@ -1293,26 +1293,26 @@ TEST_F(BuiltinsStringTest, Replace4) + { + // invoke RegExpConstructor method + JSHandle pattern1 = +- thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("quick\\s(brown).+?(jumps)"); +- JSHandle flags1 = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("iug"); +- JSTaggedValue result1 = CreateRegExpObjByPatternAndFlags(thread, pattern1, flags1); +- JSHandle searchStr(thread, reinterpret_cast(result1.GetRawData())); +- JSHandle expected = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString( ++ thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("quick\\s(brown).+?(jumps)"); ++ JSHandle flags1 = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("iug"); ++ JSTaggedValue result1 = CreateRegExpObjByPatternAndFlags(thread_, pattern1, flags1); ++ JSHandle searchStr(thread_, reinterpret_cast(result1.GetRawData())); ++ JSHandle expected = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString( + "The Quick Brown Fox Jumpsa The Over The Lazy Dog Jumps Brown $1 Jumps1 $32 a Over The Lazy Dog"); + + // make dyn_runtime_call_info2 + JSHandle thisStr = +- thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("The Quick Brown Fox Jumps Over The Lazy Dog"); ++ thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("The Quick Brown Fox Jumps Over The Lazy Dog"); + JSHandle replaceStr = +- thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("$&a $` $\' $2 $01 $$1 $21 $32 a"); ++ thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("$&a $` $\' $2 $01 $$1 $21 $32 a"); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(thisStr.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, searchStr.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(1, replaceStr.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsString::Replace(ecmaRuntimeCallInfo.get()); + + ASSERT_TRUE(result.IsString()); +@@ -1321,20 +1321,20 @@ TEST_F(BuiltinsStringTest, Replace4) + + TEST_F(BuiltinsStringTest, ReplaceAll1) + { +- ASSERT_NE(thread, nullptr); +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ASSERT_NE(thread_, nullptr); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle this_str = factory->NewFromString("The Quick Brown Fox Jumps Over The Lazy Dog"); + JSHandle search_str = factory->NewFromString("o"); + JSHandle replace_str = factory->NewFromString("a"); + JSHandle expected = factory->NewFromString("The Quick Brawn Fax Jumps Over The Lazy Dag"); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(this_str.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, search_str.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(1, replace_str.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsString::ReplaceAll(ecmaRuntimeCallInfo.get()); + + ASSERT_TRUE(result.IsString()); +@@ -1343,20 +1343,20 @@ TEST_F(BuiltinsStringTest, ReplaceAll1) + + TEST_F(BuiltinsStringTest, ReplaceAll2) + { +- ASSERT_NE(thread, nullptr); +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ASSERT_NE(thread_, nullptr); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle this_str = factory->NewFromString("xxx"); + JSHandle search_str = factory->NewFromString(""); + JSHandle replace_str = factory->NewFromString("_"); + JSHandle expected = factory->NewFromString("_x_x_x_"); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(this_str.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, search_str.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(1, replace_str.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsString::ReplaceAll(ecmaRuntimeCallInfo.get()); + + ASSERT_TRUE(result.IsString()); +@@ -1365,20 +1365,20 @@ TEST_F(BuiltinsStringTest, ReplaceAll2) + + TEST_F(BuiltinsStringTest, ReplaceAll3) + { +- ASSERT_NE(thread, nullptr); +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ASSERT_NE(thread_, nullptr); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle this_str = factory->NewFromString("xxx"); + JSHandle search_str = factory->NewFromString("x"); + JSHandle replace_str = factory->NewFromString(""); + JSHandle expected = factory->NewFromString(""); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(this_str.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, search_str.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(1, replace_str.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsString::ReplaceAll(ecmaRuntimeCallInfo.get()); + + ASSERT_TRUE(result.IsString()); +@@ -1388,33 +1388,33 @@ TEST_F(BuiltinsStringTest, ReplaceAll3) + TEST_F(BuiltinsStringTest, Split) + { + // invoke RegExpConstructor method +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle thisStr = factory->NewFromCanBeCompressString("Hello World. How are you doing?"); + JSHandle separatorStr = factory->NewFromCanBeCompressString(" "); +- JSHandle limit(thread, JSTaggedValue(3)); ++ JSHandle limit(thread_, JSTaggedValue(3)); + JSHandle expected1 = factory->NewFromCanBeCompressString("Hello"); + JSHandle expected2 = factory->NewFromCanBeCompressString("World."); + JSHandle expected3 = factory->NewFromCanBeCompressString("How"); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(thisStr.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, separatorStr.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(static_cast(3))); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsString::Split(ecmaRuntimeCallInfo.get()); + + ASSERT_TRUE(result.IsECMAObject()); +- JSHandle resultArray(thread, reinterpret_cast(result.GetRawData())); ++ JSHandle resultArray(thread_, reinterpret_cast(result.GetRawData())); + ASSERT_TRUE(resultArray->IsJSArray()); + JSHandle resultObj(resultArray); + JSHandle string1( +- JSObject::GetProperty(thread, resultObj, JSHandle(thread, JSTaggedValue(0))).GetValue()); ++ JSObject::GetProperty(thread_, resultObj, JSHandle(thread_, JSTaggedValue(0))).GetValue()); + JSHandle string2( +- JSObject::GetProperty(thread, resultObj, JSHandle(thread, JSTaggedValue(1))).GetValue()); ++ JSObject::GetProperty(thread_, resultObj, JSHandle(thread_, JSTaggedValue(1))).GetValue()); + JSHandle string3( +- JSObject::GetProperty(thread, resultObj, JSHandle(thread, JSTaggedValue(2))).GetValue()); ++ JSObject::GetProperty(thread_, resultObj, JSHandle(thread_, JSTaggedValue(2))).GetValue()); + ASSERT_TRUE(EcmaString::StringsAreEqual(*string1, *expected1)); + ASSERT_TRUE(EcmaString::StringsAreEqual(*string2, *expected2)); + ASSERT_TRUE(EcmaString::StringsAreEqual(*string3, *expected3)); +@@ -1423,37 +1423,37 @@ TEST_F(BuiltinsStringTest, Split) + TEST_F(BuiltinsStringTest, Split2) + { + // invoke RegExpConstructor method +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle thisStr = factory->NewFromCanBeCompressString("a-b-c"); + JSHandle pattern1 = factory->NewFromCanBeCompressString("-"); + JSHandle flags1 = factory->NewFromCanBeCompressString("iug"); +- JSTaggedValue result1 = CreateRegExpObjByPatternAndFlags(thread, pattern1, flags1); +- JSHandle separatorObj(thread, result1); ++ JSTaggedValue result1 = CreateRegExpObjByPatternAndFlags(thread_, pattern1, flags1); ++ JSHandle separatorObj(thread_, result1); + +- JSHandle limit(thread, JSTaggedValue(3)); ++ JSHandle limit(thread_, JSTaggedValue(3)); + JSHandle expected1 = factory->NewFromCanBeCompressString("a"); + JSHandle expected2 = factory->NewFromCanBeCompressString("b"); + JSHandle expected3 = factory->NewFromCanBeCompressString("c"); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(thisStr.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, separatorObj.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(static_cast(3))); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsString::Split(ecmaRuntimeCallInfo.get()); + + ASSERT_TRUE(result.IsECMAObject()); +- JSHandle resultArray(thread, result); ++ JSHandle resultArray(thread_, result); + ASSERT_TRUE(resultArray->IsJSArray()); + JSHandle resultObj(resultArray); + JSHandle string1( +- JSObject::GetProperty(thread, resultObj, JSHandle(thread, JSTaggedValue(0))).GetValue()); ++ JSObject::GetProperty(thread_, resultObj, JSHandle(thread_, JSTaggedValue(0))).GetValue()); + JSHandle string2( +- JSObject::GetProperty(thread, resultObj, JSHandle(thread, JSTaggedValue(1))).GetValue()); ++ JSObject::GetProperty(thread_, resultObj, JSHandle(thread_, JSTaggedValue(1))).GetValue()); + JSHandle string3( +- JSObject::GetProperty(thread, resultObj, JSHandle(thread, JSTaggedValue(2))).GetValue()); ++ JSObject::GetProperty(thread_, resultObj, JSHandle(thread_, JSTaggedValue(2))).GetValue()); + ASSERT_TRUE(EcmaString::StringsAreEqual(*string1, *expected1)); + ASSERT_TRUE(EcmaString::StringsAreEqual(*string2, *expected2)); + ASSERT_TRUE(EcmaString::StringsAreEqual(*string3, *expected3)); +diff --git a/tests/runtime/builtins/builtins_symbol_test.cpp b/tests/runtime/builtins/builtins_symbol_test.cpp +index d1a4b06..8dea8d3 100644 +--- a/tests/runtime/builtins/builtins_symbol_test.cpp ++++ b/tests/runtime/builtins/builtins_symbol_test.cpp +@@ -51,74 +51,74 @@ public: + + void SetUp() override + { +- TestHelper::CreateEcmaVMWithScope(instance, thread, scope); ++ TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); + } + + void TearDown() override + { +- TestHelper::DestroyEcmaVMWithScope(instance, scope); ++ TestHelper::DestroyEcmaVMWithScope(instance_, scope_); + } + +- PandaVM *instance {nullptr}; +- EcmaHandleScope *scope {nullptr}; +- JSThread *thread {nullptr}; ++ PandaVM *instance_ {nullptr}; ++ EcmaHandleScope *scope_ {nullptr}; ++ JSThread *thread_ {nullptr}; + }; + + // new Symbol.toString() + TEST_F(BuiltinsSymbolTest, SymbolNoParameterToString) + { +- auto ecmaVM = thread->GetEcmaVM(); ++ auto ecmaVM = thread_->GetEcmaVM(); + + JSHandle symbol = ecmaVM->GetFactory()->NewJSSymbol(); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(symbol.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = Symbol::ToString(ecmaRuntimeCallInfo.get()); +- JSHandle resultHandle(thread, reinterpret_cast(result.GetRawData())); ++ JSHandle resultHandle(thread_, reinterpret_cast(result.GetRawData())); + ASSERT_TRUE(result.IsString()); + +- auto symbolValue = ecmascript::base::BuiltinsBase::GetTaggedString(thread, "Symbol()"); ++ auto symbolValue = ecmascript::base::BuiltinsBase::GetTaggedString(thread_, "Symbol()"); + ASSERT_EQ(reinterpret_cast(symbolValue.GetRawData())->Compare(*resultHandle), 0); + } + + // new Symbol("aaa").toString() + TEST_F(BuiltinsSymbolTest, SymbolWithParameterToString) + { +- auto ecmaVM = thread->GetEcmaVM(); ++ auto ecmaVM = thread_->GetEcmaVM(); + + JSHandle symbol = ecmaVM->GetFactory()->NewPublicSymbolWithChar("aaa"); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(symbol.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = Symbol::ToString(ecmaRuntimeCallInfo.get()); +- JSHandle resultHandle(thread, reinterpret_cast(result.GetRawData())); ++ JSHandle resultHandle(thread_, reinterpret_cast(result.GetRawData())); + ASSERT_TRUE(result.IsString()); + +- auto symbolValue = ecmascript::base::BuiltinsBase::GetTaggedString(thread, "Symbol(aaa)"); ++ auto symbolValue = ecmascript::base::BuiltinsBase::GetTaggedString(thread_, "Symbol(aaa)"); + ASSERT_EQ(reinterpret_cast(symbolValue.GetRawData())->Compare(*resultHandle), 0); + } + + // new Symbol().valueOf() + TEST_F(BuiltinsSymbolTest, SymbolNoParameterValueOf) + { +- auto ecmaVM = thread->GetEcmaVM(); ++ auto ecmaVM = thread_->GetEcmaVM(); + JSHandle env = ecmaVM->GetGlobalEnv(); + + JSHandle symbol = ecmaVM->GetFactory()->NewJSSymbol(); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(symbol.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsSymbol::ValueOf(ecmaRuntimeCallInfo.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + EXPECT_TRUE(result.IsSymbol()); + ASSERT_EQ(result.GetRawData() == (JSTaggedValue(*symbol)).GetRawData(), true); + +@@ -126,13 +126,13 @@ TEST_F(BuiltinsSymbolTest, SymbolNoParameterValueOf) + JSHandle symbolValue(symbol); + JSHandle symbolRef = ecmaVM->GetFactory()->NewJSPrimitiveRef(symbolObject, symbolValue); + +- auto otherEcmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); ++ auto otherEcmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); + otherEcmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + otherEcmaRuntimeCallInfo->SetThis(symbolRef.GetTaggedValue()); + +- prev = TestHelper::SetupFrame(thread, otherEcmaRuntimeCallInfo.get()); ++ prev = TestHelper::SetupFrame(thread_, otherEcmaRuntimeCallInfo.get()); + JSTaggedValue otherResult = BuiltinsSymbol::ValueOf(otherEcmaRuntimeCallInfo.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + EXPECT_TRUE(otherResult.IsSymbol()); + ASSERT_EQ(otherResult.GetRawData() == (JSTaggedValue(*symbol)).GetRawData(), true); + } +@@ -140,18 +140,18 @@ TEST_F(BuiltinsSymbolTest, SymbolNoParameterValueOf) + // new Symbol("bbb").valueOf() + TEST_F(BuiltinsSymbolTest, SymbolWithParameterValueOf) + { +- auto ecmaVM = thread->GetEcmaVM(); ++ auto ecmaVM = thread_->GetEcmaVM(); + JSHandle env = ecmaVM->GetGlobalEnv(); + + JSHandle symbol = ecmaVM->GetFactory()->NewPublicSymbolWithChar("bbb"); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(symbol.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsSymbol::ValueOf(ecmaRuntimeCallInfo.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + EXPECT_TRUE(result.IsSymbol()); + ASSERT_EQ(result.GetRawData() == (JSTaggedValue(*symbol)).GetRawData(), true); + +@@ -159,13 +159,13 @@ TEST_F(BuiltinsSymbolTest, SymbolWithParameterValueOf) + JSHandle symbolValue(symbol); + JSHandle symbolRef = ecmaVM->GetFactory()->NewJSPrimitiveRef(symbolObject, symbolValue); + +- auto otherEcmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); ++ auto otherEcmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); + otherEcmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + otherEcmaRuntimeCallInfo->SetThis(symbolRef.GetTaggedValue()); + +- prev = TestHelper::SetupFrame(thread, otherEcmaRuntimeCallInfo.get()); ++ prev = TestHelper::SetupFrame(thread_, otherEcmaRuntimeCallInfo.get()); + JSTaggedValue otherResult = BuiltinsSymbol::ValueOf(otherEcmaRuntimeCallInfo.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + EXPECT_TRUE(otherResult.IsSymbol()); + ASSERT_EQ(otherResult.GetRawData() == (JSTaggedValue(*symbol)).GetRawData(), true); + } +@@ -173,7 +173,7 @@ TEST_F(BuiltinsSymbolTest, SymbolWithParameterValueOf) + // new Symbol().for + TEST_F(BuiltinsSymbolTest, SymbolWithParameterFor) + { +- auto ecmaVM = thread->GetEcmaVM(); ++ auto ecmaVM = thread_->GetEcmaVM(); + JSHandle env = ecmaVM->GetGlobalEnv(); + + JSHandle tableHandle(env->GetRegisterSymbols()); +@@ -181,19 +181,19 @@ TEST_F(BuiltinsSymbolTest, SymbolWithParameterFor) + JSHandle string = ecmaVM->GetFactory()->NewFromCanBeCompressString("ccc"); + ASSERT_EQ(string->GetLength(), 3); + JSHandle string_handle(string); +- ASSERT_EQ(tableHandle->ContainsKey(thread, string_handle.GetTaggedValue()), false); ++ ASSERT_EQ(tableHandle->ContainsKey(thread_, string_handle.GetTaggedValue()), false); + + JSHandle symbol = ecmaVM->GetFactory()->NewSymbolWithTableWithChar("ccc"); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetCallArg(0, string.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsSymbol::For(ecmaRuntimeCallInfo.get()); +- TestHelper::TearDownFrame(thread, prev); +- ASSERT_EQ(tableHandle->ContainsKey(thread, string_handle.GetTaggedValue()), true); ++ TestHelper::TearDownFrame(thread_, prev); ++ ASSERT_EQ(tableHandle->ContainsKey(thread_, string_handle.GetTaggedValue()), true); + + JSTaggedValue target(*symbol); + ASSERT_EQ(result.GetRawData() == target.GetRawData(), true); +@@ -202,63 +202,63 @@ TEST_F(BuiltinsSymbolTest, SymbolWithParameterFor) + // Symbol.keyFor (sym) + TEST_F(BuiltinsSymbolTest, SymbolKeyFor) + { +- auto ecmaVM = thread->GetEcmaVM(); ++ auto ecmaVM = thread_->GetEcmaVM(); + JSHandle env = ecmaVM->GetGlobalEnv(); + + JSHandle symbol = ecmaVM->GetFactory()->NewPublicSymbolWithChar("bbb"); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetCallArg(0, symbol.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsSymbol::KeyFor(ecmaRuntimeCallInfo.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + ASSERT_EQ(result.GetRawData(), JSTaggedValue::VALUE_UNDEFINED); + + JSHandle string = ecmaVM->GetFactory()->NewFromCanBeCompressString("ccc"); + ASSERT_EQ(string->GetLength(), 3); + +- auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo1->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo1->SetThis(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo1->SetCallArg(0, string.GetTaggedValue()); + +- prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); ++ prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); + BuiltinsSymbol::For(ecmaRuntimeCallInfo1.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + + JSHandle otherSymbol = ecmaVM->GetFactory()->NewPublicSymbolWithChar("ccc"); +- auto ecmaRuntimeCallInfo2 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto ecmaRuntimeCallInfo2 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo2->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo2->SetThis(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo2->SetCallArg(0, otherSymbol.GetTaggedValue()); + +- prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo2.get()); ++ prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo2.get()); + JSTaggedValue otherResult = BuiltinsSymbol::KeyFor(ecmaRuntimeCallInfo2.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + ASSERT_TRUE(otherResult.IsString()); + JSHandle tableHandle(env->GetRegisterSymbols()); + JSTaggedValue stringValue(*string); +- ASSERT_EQ(tableHandle->ContainsKey(thread, stringValue), true); ++ ASSERT_EQ(tableHandle->ContainsKey(thread_, stringValue), true); + } + + // Symbol.ToPrimitive() + TEST_F(BuiltinsSymbolTest, SymbolToPrimitive) + { +- auto ecmaVM = thread->GetEcmaVM(); ++ auto ecmaVM = thread_->GetEcmaVM(); + JSHandle env = ecmaVM->GetGlobalEnv(); + + JSHandle symbol = ecmaVM->GetFactory()->NewJSSymbol(); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(symbol.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsSymbol::ToPrimitive(ecmaRuntimeCallInfo.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + EXPECT_TRUE(result.IsSymbol()); + ASSERT_EQ(result.GetRawData() == (JSTaggedValue(*symbol)).GetRawData(), true); + +@@ -266,13 +266,13 @@ TEST_F(BuiltinsSymbolTest, SymbolToPrimitive) + JSHandle symbolValue(symbol); + JSHandle symbolRef = ecmaVM->GetFactory()->NewJSPrimitiveRef(symbolObject, symbolValue); + +- auto otherEcmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); ++ auto otherEcmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); + otherEcmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + otherEcmaRuntimeCallInfo->SetThis(symbolRef.GetTaggedValue()); + +- prev = TestHelper::SetupFrame(thread, otherEcmaRuntimeCallInfo.get()); ++ prev = TestHelper::SetupFrame(thread_, otherEcmaRuntimeCallInfo.get()); + JSTaggedValue otherResult = BuiltinsSymbol::ToPrimitive(otherEcmaRuntimeCallInfo.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + EXPECT_TRUE(otherResult.IsSymbol()); + ASSERT_EQ(otherResult.GetRawData() == (JSTaggedValue(*symbol)).GetRawData(), true); + } +@@ -280,49 +280,50 @@ TEST_F(BuiltinsSymbolTest, SymbolToPrimitive) + // constructor + TEST_F(BuiltinsSymbolTest, SymbolConstructor) + { +- auto ecmaVM = thread->GetEcmaVM(); ++ auto ecmaVM = thread_->GetEcmaVM(); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue::Undefined()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsSymbol::SymbolConstructor(ecmaRuntimeCallInfo.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + EXPECT_TRUE(result.IsSymbol()); + JSSymbol *sym = reinterpret_cast(result.GetRawData()); + ASSERT_EQ(sym->GetDescription().IsUndefined(), true); + + JSHandle string = ecmaVM->GetFactory()->NewFromCanBeCompressString("ddd"); + +- auto otherEcmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto otherEcmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + otherEcmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + otherEcmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); + otherEcmaRuntimeCallInfo->SetCallArg(0, string.GetTaggedValue()); + +- prev = TestHelper::SetupFrame(thread, otherEcmaRuntimeCallInfo.get()); ++ prev = TestHelper::SetupFrame(thread_, otherEcmaRuntimeCallInfo.get()); + JSTaggedValue result1 = BuiltinsSymbol::SymbolConstructor(otherEcmaRuntimeCallInfo.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + JSHandle resultString = JSTaggedValue::ToString( +- thread, JSHandle(thread, reinterpret_cast(result1.GetRawData())->GetDescription())); ++ thread_, ++ JSHandle(thread_, reinterpret_cast(result1.GetRawData())->GetDescription())); + ASSERT_EQ(resultString->Compare(*string), 0); + } + + TEST_F(BuiltinsSymbolTest, SymbolGetter) + { +- auto ecmaVM = thread->GetEcmaVM(); ++ auto ecmaVM = thread_->GetEcmaVM(); + + JSHandle symbol = ecmaVM->GetFactory()->NewPublicSymbolWithChar(""); + JSHandle string = ecmaVM->GetFactory()->NewFromCanBeCompressString(""); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(symbol.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = BuiltinsSymbol::DescriptionGetter(ecmaRuntimeCallInfo.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + ASSERT_TRUE(result.IsString()); + EcmaString *resString = reinterpret_cast(result.GetRawData()); + ASSERT_EQ(resString->GetLength(), 0); +diff --git a/tests/runtime/builtins/builtins_typedarray_test.cpp b/tests/runtime/builtins/builtins_typedarray_test.cpp +index 2258f94..c013bc9 100644 +--- a/tests/runtime/builtins/builtins_typedarray_test.cpp ++++ b/tests/runtime/builtins/builtins_typedarray_test.cpp +@@ -61,18 +61,18 @@ public: + + void SetUp() override + { +- TestHelper::CreateEcmaVMWithScope(instance, thread, scope); ++ TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); + } + + void TearDown() override + { +- TestHelper::DestroyEcmaVMWithScope(instance, scope); ++ TestHelper::DestroyEcmaVMWithScope(instance_, scope_); + } + + protected: +- PandaVM *instance {nullptr}; +- EcmaHandleScope *scope {nullptr}; +- JSThread *thread {nullptr}; ++ PandaVM *instance_ {nullptr}; ++ EcmaHandleScope *scope_ {nullptr}; ++ JSThread *thread_ {nullptr}; + + class TestClass : public base::BuiltinsBase { + public: +@@ -211,16 +211,16 @@ JSTypedArray *CreateTypedArrayFromList(JSThread *thread, const JSHandleGetEcmaVM(); ++ auto ecmaVM = thread_->GetEcmaVM(); + JSHandle env = ecmaVM->GetGlobalEnv(); + JSHandle array(env->GetArrayFunction()); +- JSHandle globalObject(thread, env->GetGlobalObject()); ++ JSHandle globalObject(thread_, env->GetGlobalObject()); + +- auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); ++ auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); + ecmaRuntimeCallInfo1->SetFunction(array.GetTaggedValue()); + ecmaRuntimeCallInfo1->SetThis(globalObject.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); + JSTaggedValue result = TypedArray::Species(ecmaRuntimeCallInfo1.get()); + ASSERT_TRUE(result.IsECMAObject()); + } +@@ -228,138 +228,138 @@ TEST_F(BuiltinsTypedArrayTest, Species) + // ES2021 23.2.3.13 new Array(1,2,3,4,3).includes(searchElement [ , fromIndex ]) + TEST_F(BuiltinsTypedArrayTest, Includes1) + { +- ASSERT_NE(thread, nullptr); ++ ASSERT_NE(thread_, nullptr); + +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + + JSHandle array(factory->NewTaggedArray(5)); +- array->Set(thread, 0, JSTaggedValue(1)); +- array->Set(thread, 1, JSTaggedValue(2)); +- array->Set(thread, 2, JSTaggedValue(3)); +- array->Set(thread, 3, JSTaggedValue(4)); +- array->Set(thread, 4, JSTaggedValue(3)); +- JSHandle obj(thread, CreateTypedArrayFromList(thread, array)); ++ array->Set(thread_, 0, JSTaggedValue(1)); ++ array->Set(thread_, 1, JSTaggedValue(2)); ++ array->Set(thread_, 2, JSTaggedValue(3)); ++ array->Set(thread_, 3, JSTaggedValue(4)); ++ array->Set(thread_, 4, JSTaggedValue(3)); ++ JSHandle obj(thread_, CreateTypedArrayFromList(thread_, array)); + + // new Array(1,2,3,4,3).includes(1,0) +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(obj.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast(1))); + ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(static_cast(0))); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = TypedArray::Includes(ecmaRuntimeCallInfo.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + ASSERT_EQ(result.GetRawData(), JSTaggedValue(true).GetRawData()); + } + + // ES2021 23.2.3.13 new Array(1,2,3,4,3).includes(searchElement [ , fromIndex ]) + TEST_F(BuiltinsTypedArrayTest, Includes2) + { +- ASSERT_NE(thread, nullptr); ++ ASSERT_NE(thread_, nullptr); + +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + + JSHandle array(factory->NewTaggedArray(5)); +- array->Set(thread, 0, JSTaggedValue(1)); +- array->Set(thread, 1, JSTaggedValue(2)); +- array->Set(thread, 2, JSTaggedValue(3)); +- array->Set(thread, 3, JSTaggedValue(4)); +- array->Set(thread, 4, JSTaggedValue(3)); +- JSHandle obj(thread, CreateTypedArrayFromList(thread, array)); ++ array->Set(thread_, 0, JSTaggedValue(1)); ++ array->Set(thread_, 1, JSTaggedValue(2)); ++ array->Set(thread_, 2, JSTaggedValue(3)); ++ array->Set(thread_, 3, JSTaggedValue(4)); ++ array->Set(thread_, 4, JSTaggedValue(3)); ++ JSHandle obj(thread_, CreateTypedArrayFromList(thread_, array)); + + // new Array(1,2,3,4,3).includes(1,3) +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(obj.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast(1))); + ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(static_cast(3))); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = TypedArray::Includes(ecmaRuntimeCallInfo.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + ASSERT_EQ(result.GetRawData(), JSTaggedValue(false).GetRawData()); + } + + // ES2021 23.2.3.13 new Array(1,2,3,4,3).includes(searchElement [ , fromIndex ]) + TEST_F(BuiltinsTypedArrayTest, Includes3) + { +- ASSERT_NE(thread, nullptr); ++ ASSERT_NE(thread_, nullptr); + +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + + JSHandle array(factory->NewTaggedArray(5)); +- array->Set(thread, 0, JSTaggedValue(1)); +- array->Set(thread, 1, JSTaggedValue(2)); +- array->Set(thread, 2, JSTaggedValue(3)); +- array->Set(thread, 3, JSTaggedValue(4)); +- array->Set(thread, 4, JSTaggedValue(3)); +- JSHandle obj(thread, CreateTypedArrayFromList(thread, array)); ++ array->Set(thread_, 0, JSTaggedValue(1)); ++ array->Set(thread_, 1, JSTaggedValue(2)); ++ array->Set(thread_, 2, JSTaggedValue(3)); ++ array->Set(thread_, 3, JSTaggedValue(4)); ++ array->Set(thread_, 4, JSTaggedValue(3)); ++ JSHandle obj(thread_, CreateTypedArrayFromList(thread_, array)); + + // new Array(1,2,3,4,3).includes(5,0) +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(obj.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast(5))); + ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(static_cast(0))); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = TypedArray::Includes(ecmaRuntimeCallInfo.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + ASSERT_EQ(result.GetRawData(), JSTaggedValue(false).GetRawData()); + } + + // ES2021 23.2.3.13 new Array(1,2,3,4,3).includes(searchElement [ , fromIndex ]) + TEST_F(BuiltinsTypedArrayTest, Includes4) + { +- ASSERT_NE(thread, nullptr); ++ ASSERT_NE(thread_, nullptr); + +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + + JSHandle array(factory->NewTaggedArray(5)); +- array->Set(thread, 0, JSTaggedValue(1)); +- array->Set(thread, 1, JSTaggedValue(2)); +- array->Set(thread, 2, JSTaggedValue(3)); +- array->Set(thread, 3, JSTaggedValue(4)); +- array->Set(thread, 4, JSTaggedValue(3)); +- JSHandle obj(thread, CreateTypedArrayFromList(thread, array)); ++ array->Set(thread_, 0, JSTaggedValue(1)); ++ array->Set(thread_, 1, JSTaggedValue(2)); ++ array->Set(thread_, 2, JSTaggedValue(3)); ++ array->Set(thread_, 3, JSTaggedValue(4)); ++ array->Set(thread_, 4, JSTaggedValue(3)); ++ JSHandle obj(thread_, CreateTypedArrayFromList(thread_, array)); + + // new Array(1,2,3,4,3).includes(1) +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(obj.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast(1))); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = TypedArray::Includes(ecmaRuntimeCallInfo.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + ASSERT_EQ(result.GetRawData(), JSTaggedValue(true).GetRawData()); + } + + // ES2021 23.2.3.13 new Array(1,2,3,4,3).includes(searchElement [ , fromIndex ]) + TEST_F(BuiltinsTypedArrayTest, Includes5) + { +- ASSERT_NE(thread, nullptr); ++ ASSERT_NE(thread_, nullptr); + +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + + JSHandle array(factory->NewTaggedArray(5)); +- array->Set(thread, 0, JSTaggedValue(1)); +- array->Set(thread, 1, JSTaggedValue(2)); +- array->Set(thread, 2, JSTaggedValue(3)); +- array->Set(thread, 3, JSTaggedValue(4)); +- array->Set(thread, 4, JSTaggedValue(3)); +- JSHandle obj(thread, CreateTypedArrayFromList(thread, array)); ++ array->Set(thread_, 0, JSTaggedValue(1)); ++ array->Set(thread_, 1, JSTaggedValue(2)); ++ array->Set(thread_, 2, JSTaggedValue(3)); ++ array->Set(thread_, 3, JSTaggedValue(4)); ++ array->Set(thread_, 4, JSTaggedValue(3)); ++ JSHandle obj(thread_, CreateTypedArrayFromList(thread_, array)); + + // new Array(1,2,3,4,3).includes(5) +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(obj.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast(5))); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result = TypedArray::Includes(ecmaRuntimeCallInfo.get()); +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + ASSERT_EQ(result.GetRawData(), JSTaggedValue(false).GetRawData()); + } + } // namespace panda::test +diff --git a/tests/runtime/builtins/builtins_weak_map_test.cpp b/tests/runtime/builtins/builtins_weak_map_test.cpp +index 2af7d22..ba19e07 100644 +--- a/tests/runtime/builtins/builtins_weak_map_test.cpp ++++ b/tests/runtime/builtins/builtins_weak_map_test.cpp +@@ -53,17 +53,17 @@ public: + + void SetUp() override + { +- TestHelper::CreateEcmaVMWithScope(instance, thread, scope); ++ TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); + } + + void TearDown() override + { +- TestHelper::DestroyEcmaVMWithScope(instance, scope); ++ TestHelper::DestroyEcmaVMWithScope(instance_, scope_); + } + +- PandaVM *instance {nullptr}; +- EcmaHandleScope *scope {nullptr}; +- JSThread *thread {nullptr}; ++ PandaVM *instance_ {nullptr}; ++ EcmaHandleScope *scope_ {nullptr}; ++ JSThread *thread_ {nullptr}; + }; + + static JSObject *JSObjectTestCreate(JSThread *thread) +@@ -95,48 +95,48 @@ JSWeakMap *CreateBuiltinsWeakMap(JSThread *thread) + // new Map("abrupt").toString() + TEST_F(BuiltinsWeakMapTest, CreateAndGetSize) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); +- JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); ++ JSHandle env = thread_->GetEcmaVM()->GetGlobalEnv(); + JSHandle newTarget(env->GetBuiltinsWeakMapFunction()); +- JSHandle map(thread, CreateBuiltinsWeakMap(thread)); ++ JSHandle map(thread_, CreateBuiltinsWeakMap(thread_)); + + JSHandle array(factory->NewTaggedArray(1)); + JSHandle internal_array(factory->NewTaggedArray(2)); +- JSTaggedValue value(JSObjectTestCreate(thread)); +- internal_array->Set(thread, 0, value); +- internal_array->Set(thread, 1, JSTaggedValue(0)); +- auto result = JSArray::CreateArrayFromList(thread, internal_array); +- array->Set(thread, 0, result); ++ JSTaggedValue value(JSObjectTestCreate(thread_)); ++ internal_array->Set(thread_, 0, value); ++ internal_array->Set(thread_, 1, JSTaggedValue(0)); ++ auto result = JSArray::CreateArrayFromList(thread_, internal_array); ++ array->Set(thread_, 0, result); + +- JSHandle values = JSArray::CreateArrayFromList(thread, array); ++ JSHandle values = JSArray::CreateArrayFromList(thread_, array); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo->SetFunction(newTarget.GetTaggedValue()); + ecmaRuntimeCallInfo->SetThis(map.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, values.GetTaggedValue()); + ecmaRuntimeCallInfo->SetNewTarget(newTarget.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + + JSTaggedValue result1 = BuiltinsWeakMap::WeakMapConstructor(ecmaRuntimeCallInfo.get()); +- JSHandle weakMap(thread, JSWeakMap::Cast(reinterpret_cast(result1.GetRawData()))); ++ JSHandle weakMap(thread_, JSWeakMap::Cast(reinterpret_cast(result1.GetRawData()))); + EXPECT_EQ(weakMap->GetSize(), 1); + } + + TEST_F(BuiltinsWeakMapTest, SetAndHas) + { + // create jsWeakMap +- JSHandle weakMap(thread, CreateBuiltinsWeakMap(thread)); +- JSHandle key(thread, JSObjectTestCreate(thread)); ++ JSHandle weakMap(thread_, CreateBuiltinsWeakMap(thread_)); ++ JSHandle key(thread_, JSObjectTestCreate(thread_)); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(weakMap.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, key.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(static_cast(1))); + + { +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result1 = BuiltinsWeakMap::Has(ecmaRuntimeCallInfo.get()); + + EXPECT_EQ(result1.GetRawData(), JSTaggedValue::False().GetRawData()); +@@ -149,13 +149,13 @@ TEST_F(BuiltinsWeakMapTest, SetAndHas) + EXPECT_EQ(jsWeakMap->GetSize(), 1); + + // test Has() +- auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + ecmaRuntimeCallInfo1->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo1->SetCallArg(0, key.GetTaggedValue()); + ecmaRuntimeCallInfo1->SetCallArg(1, JSTaggedValue(static_cast(1))); + ecmaRuntimeCallInfo1->SetThis(JSTaggedValue(jsWeakMap)); + { +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); + JSTaggedValue result3 = BuiltinsWeakMap::Has(ecmaRuntimeCallInfo1.get()); + + EXPECT_EQ(result3.GetRawData(), JSTaggedValue::True().GetRawData()); +@@ -165,19 +165,19 @@ TEST_F(BuiltinsWeakMapTest, SetAndHas) + TEST_F(BuiltinsWeakMapTest, DeleteAndRemove) + { + // create jsWeakMap +- JSHandle weakMap(thread, CreateBuiltinsWeakMap(thread)); ++ JSHandle weakMap(thread_, CreateBuiltinsWeakMap(thread_)); + + // add 40 keys + JSTaggedValue lastKey(JSTaggedValue::Undefined()); + for (int i = 0; i < 40; i++) { +- JSHandle key(thread, JSObjectTestCreate(thread)); +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); ++ JSHandle key(thread_, JSObjectTestCreate(thread_)); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(weakMap.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, key.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(static_cast(i))); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result1 = BuiltinsWeakMap::Set(ecmaRuntimeCallInfo.get()); + + EXPECT_TRUE(result1.IsECMAObject()); +@@ -188,12 +188,12 @@ TEST_F(BuiltinsWeakMapTest, DeleteAndRemove) + + // whether jsWeakMap has delete lastKey + +- auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo1->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo1->SetThis(weakMap.GetTaggedValue()); + ecmaRuntimeCallInfo1->SetCallArg(0, lastKey); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); + JSTaggedValue result2 = BuiltinsWeakMap::Has(ecmaRuntimeCallInfo1.get()); + + EXPECT_EQ(result2.GetRawData(), JSTaggedValue::True().GetRawData()); +diff --git a/tests/runtime/builtins/builtins_weak_set_test.cpp b/tests/runtime/builtins/builtins_weak_set_test.cpp +index c8ae14b..11fc288 100644 +--- a/tests/runtime/builtins/builtins_weak_set_test.cpp ++++ b/tests/runtime/builtins/builtins_weak_set_test.cpp +@@ -51,17 +51,17 @@ public: + + void SetUp() override + { +- TestHelper::CreateEcmaVMWithScope(instance, thread, scope); ++ TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); + } + + void TearDown() override + { +- TestHelper::DestroyEcmaVMWithScope(instance, scope); ++ TestHelper::DestroyEcmaVMWithScope(instance_, scope_); + } + +- PandaVM *instance {nullptr}; +- EcmaHandleScope *scope {nullptr}; +- JSThread *thread {nullptr}; ++ PandaVM *instance_ {nullptr}; ++ EcmaHandleScope *scope_ {nullptr}; ++ JSThread *thread_ {nullptr}; + }; + + static JSObject *JSObjectTestCreate(JSThread *thread) +@@ -94,44 +94,44 @@ JSWeakSet *CreateBuiltinsWeakSet(JSThread *thread) + + TEST_F(BuiltinsWeakSetTest, CreateAndGetSize) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); +- JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); ++ JSHandle env = thread_->GetEcmaVM()->GetGlobalEnv(); + JSHandle newTarget(env->GetBuiltinsWeakSetFunction()); +- JSHandle weakSet(thread, CreateBuiltinsWeakSet(thread)); ++ JSHandle weakSet(thread_, CreateBuiltinsWeakSet(thread_)); + + JSHandle array(factory->NewTaggedArray(5)); + for (int i = 0; i < 5; i++) { +- JSHandle key(thread, JSObjectTestCreate(thread)); +- array->Set(thread, i, key.GetTaggedValue()); ++ JSHandle key(thread_, JSObjectTestCreate(thread_)); ++ array->Set(thread_, i, key.GetTaggedValue()); + } + +- JSHandle values = JSArray::CreateArrayFromList(thread, array); +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ JSHandle values = JSArray::CreateArrayFromList(thread_, array); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo->SetFunction(newTarget.GetTaggedValue()); + ecmaRuntimeCallInfo->SetThis(weakSet.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, values.GetTaggedValue()); + ecmaRuntimeCallInfo->SetNewTarget(newTarget.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + + JSTaggedValue result1 = BuiltinsWeakSet::WeakSetConstructor(ecmaRuntimeCallInfo.get()); +- JSHandle weakSetResult(thread, JSWeakSet::Cast(reinterpret_cast(result1.GetRawData()))); ++ JSHandle weakSetResult(thread_, JSWeakSet::Cast(reinterpret_cast(result1.GetRawData()))); + EXPECT_EQ(weakSetResult->GetSize(), 5); + } + + TEST_F(BuiltinsWeakSetTest, AddAndHas) + { + // create jsWeakSet +- JSHandle weakSet(thread, CreateBuiltinsWeakSet(thread)); +- JSHandle key(thread, JSObjectTestCreate(thread)); +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ JSHandle weakSet(thread_, CreateBuiltinsWeakSet(thread_)); ++ JSHandle key(thread_, JSObjectTestCreate(thread_)); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(weakSet.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, key.GetTaggedValue()); + + JSWeakSet *jsWeakSet; + { +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result1 = BuiltinsWeakSet::Has(ecmaRuntimeCallInfo.get()); + + EXPECT_EQ(result1.GetRawData(), JSTaggedValue::False().GetRawData()); +@@ -144,12 +144,12 @@ TEST_F(BuiltinsWeakSetTest, AddAndHas) + } + + // test Has() +- auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo1->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo1->SetThis(JSTaggedValue(jsWeakSet)); + ecmaRuntimeCallInfo1->SetCallArg(0, key.GetTaggedValue()); + { +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); + JSTaggedValue result3 = BuiltinsWeakSet::Has(ecmaRuntimeCallInfo1.get()); + + EXPECT_EQ(result3.GetRawData(), JSTaggedValue::True().GetRawData()); +@@ -159,19 +159,19 @@ TEST_F(BuiltinsWeakSetTest, AddAndHas) + TEST_F(BuiltinsWeakSetTest, DeleteAndRemove) + { + // create jsSet +- JSHandle weakSet(thread, CreateBuiltinsWeakSet(thread)); ++ JSHandle weakSet(thread_, CreateBuiltinsWeakSet(thread_)); + + // add 40 keys + JSTaggedValue lastKey(JSTaggedValue::Undefined()); + for (int i = 0; i < 40; i++) { +- JSHandle key(thread, JSObjectTestCreate(thread)); ++ JSHandle key(thread_, JSObjectTestCreate(thread_)); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(weakSet.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, key.GetTaggedValue()); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + JSTaggedValue result1 = BuiltinsWeakSet::Add(ecmaRuntimeCallInfo.get()); + + EXPECT_TRUE(result1.IsECMAObject()); +@@ -181,12 +181,12 @@ TEST_F(BuiltinsWeakSetTest, DeleteAndRemove) + } + // whether jsWeakSet has delete lastKey + +- auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo1->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo1->SetThis(weakSet.GetTaggedValue()); + ecmaRuntimeCallInfo1->SetCallArg(0, lastKey); + +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); + JSTaggedValue result2 = BuiltinsWeakSet::Has(ecmaRuntimeCallInfo1.get()); + + EXPECT_EQ(result2.GetRawData(), JSTaggedValue::True().GetRawData()); +diff --git a/tests/runtime/common/builtins_test.cpp b/tests/runtime/common/builtins_test.cpp +index e471032..7a6e86e 100644 +--- a/tests/runtime/common/builtins_test.cpp ++++ b/tests/runtime/common/builtins_test.cpp +@@ -34,23 +34,23 @@ class BuiltinsTest : public testing::Test { + public: + void SetUp() override + { +- TestHelper::CreateEcmaVMWithScope(instance, thread, scope); ++ TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); + } + + void TearDown() override + { +- TestHelper::DestroyEcmaVMWithScope(instance, scope); ++ TestHelper::DestroyEcmaVMWithScope(instance_, scope_); + } + +- PandaVM *instance {nullptr}; +- EcmaHandleScope *scope {nullptr}; +- JSThread *thread; ++ PandaVM *instance_ {nullptr}; ++ EcmaHandleScope *scope_ {nullptr}; ++ JSThread *thread_; + }; + + TEST_F(BuiltinsTest, ObjectInit) + { +- ASSERT_NE(thread, nullptr); +- auto ecma_vm = thread->GetEcmaVM(); ++ ASSERT_NE(thread_, nullptr); ++ auto ecma_vm = thread_->GetEcmaVM(); + JSHandle env = ecma_vm->GetGlobalEnv(); + + JSHandle object_function(env->GetObjectFunction()); +@@ -59,8 +59,8 @@ TEST_F(BuiltinsTest, ObjectInit) + + TEST_F(BuiltinsTest, FunctionInit) + { +- ASSERT_NE(thread, nullptr); +- auto ecma_vm = thread->GetEcmaVM(); ++ ASSERT_NE(thread_, nullptr); ++ auto ecma_vm = thread_->GetEcmaVM(); + JSHandle env = ecma_vm->GetGlobalEnv(); + + JSHandle function_function(env->GetFunctionFunction()); +@@ -69,8 +69,8 @@ TEST_F(BuiltinsTest, FunctionInit) + + TEST_F(BuiltinsTest, NumberInit) + { +- ASSERT_NE(thread, nullptr); +- auto ecma_vm = thread->GetEcmaVM(); ++ ASSERT_NE(thread_, nullptr); ++ auto ecma_vm = thread_->GetEcmaVM(); + JSHandle env = ecma_vm->GetGlobalEnv(); + + JSHandle number_function(env->GetNumberFunction()); +@@ -79,8 +79,8 @@ TEST_F(BuiltinsTest, NumberInit) + + TEST_F(BuiltinsTest, SetInit) + { +- ASSERT_NE(thread, nullptr); +- auto ecma_vm = thread->GetEcmaVM(); ++ ASSERT_NE(thread_, nullptr); ++ auto ecma_vm = thread_->GetEcmaVM(); + JSHandle env = ecma_vm->GetGlobalEnv(); + + JSHandle set_function(env->GetBuiltinsSetFunction()); +@@ -89,8 +89,8 @@ TEST_F(BuiltinsTest, SetInit) + + TEST_F(BuiltinsTest, MapInit) + { +- ASSERT_NE(thread, nullptr); +- auto ecma_vm = thread->GetEcmaVM(); ++ ASSERT_NE(thread_, nullptr); ++ auto ecma_vm = thread_->GetEcmaVM(); + JSHandle env = ecma_vm->GetGlobalEnv(); + + JSHandle map_function(env->GetBuiltinsMapFunction()); +@@ -99,21 +99,21 @@ TEST_F(BuiltinsTest, MapInit) + + TEST_F(BuiltinsTest, StrictModeForbiddenAccess) + { +- ASSERT_NE(thread, nullptr); +- auto ecma_vm = thread->GetEcmaVM(); ++ ASSERT_NE(thread_, nullptr); ++ auto ecma_vm = thread_->GetEcmaVM(); + JSHandle env = ecma_vm->GetGlobalEnv(); +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + + JSHandle function = factory->NewJSFunction(env, static_cast(nullptr)); + + JSHandle caller_key(factory->NewFromString("caller")); + JSHandle arguments_key(factory->NewFromString("arguments")); + +- JSObject::GetProperty(thread, JSHandle(function), caller_key); +- ASSERT_EQ(thread->HasPendingException(), true); ++ JSObject::GetProperty(thread_, JSHandle(function), caller_key); ++ ASSERT_EQ(thread_->HasPendingException(), true); + +- JSObject::GetProperty(thread, JSHandle(function), arguments_key); +- ASSERT_EQ(thread->HasPendingException(), true); ++ JSObject::GetProperty(thread_, JSHandle(function), arguments_key); ++ ASSERT_EQ(thread_->HasPendingException(), true); + } + + } // namespace panda::test +diff --git a/tests/runtime/common/ecma_empty_class_check/ecma_empty_class_check.cpp b/tests/runtime/common/ecma_empty_class_check/ecma_empty_class_check.cpp +index 6e3fbe0..136a934 100644 +--- a/tests/runtime/common/ecma_empty_class_check/ecma_empty_class_check.cpp ++++ b/tests/runtime/common/ecma_empty_class_check/ecma_empty_class_check.cpp +@@ -41,11 +41,11 @@ static void CheckNames(const panda_file::File &pf) + panda_file::ClassDataAccessor cda(pf, classId); + cda.EnumerateMethods([&pf](panda_file::MethodDataAccessor &mda) { + auto sd_mname = mda.GetName(); +- std::string mname(reinterpret_cast(sd_mname.data), sd_mname.utf16_length); ++ std::string mname(reinterpret_cast(sd_mname.data_), sd_mname.utf16_length_); + ASSERT(!mname.empty()); + + auto sd_cname = pf.GetStringData(mda.GetClassId()); +- std::string cname(reinterpret_cast(sd_cname.data), sd_cname.utf16_length); ++ std::string cname(reinterpret_cast(sd_cname.data_), sd_cname.utf16_length_); + ASSERT(!cname.empty()); + }); + } +diff --git a/tests/runtime/common/ecma_module_test.cpp b/tests/runtime/common/ecma_module_test.cpp +index 649169e..e921b48 100644 +--- a/tests/runtime/common/ecma_module_test.cpp ++++ b/tests/runtime/common/ecma_module_test.cpp +@@ -36,16 +36,16 @@ public: + + void SetUp() override + { +- TestHelper::CreateEcmaVMWithScope(instance, thread, scope); ++ TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); + } + + void TearDown() override + { +- TestHelper::DestroyEcmaVMWithScope(instance, scope); ++ TestHelper::DestroyEcmaVMWithScope(instance_, scope_); + } +- PandaVM *instance {nullptr}; +- ecmascript::EcmaHandleScope *scope {nullptr}; +- JSThread *thread {nullptr}; ++ PandaVM *instance_ {nullptr}; ++ ecmascript::EcmaHandleScope *scope_ {nullptr}; ++ JSThread *thread_ {nullptr}; + }; + + EcmaModule *EcmaModuleCreate(JSThread *thread) +@@ -68,15 +68,15 @@ TEST_F(EcmaModuleTest, AddItem_001) + int numOfElementsDict = 4; + CString cStrItemName = "key1"; + int intItemValue = 1; +- JSHandle handleEcmaModule(thread, EcmaModuleCreate(thread)); +- JSHandle handleNameDict(NameDictionary::Create(thread, numOfElementsDict)); ++ JSHandle handleEcmaModule(thread_, EcmaModuleCreate(thread_)); ++ JSHandle handleNameDict(NameDictionary::Create(thread_, numOfElementsDict)); + JSHandle handleTagValItemName( +- thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(cStrItemName)); +- JSHandle handleTagValItemValue(thread, JSTaggedValue(intItemValue)); ++ thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(cStrItemName)); ++ JSHandle handleTagValItemValue(thread_, JSTaggedValue(intItemValue)); + +- handleEcmaModule->SetNameDictionary(thread, handleNameDict); // Call SetNameDictionary in TEST_F +- EcmaModule::AddItem(thread, handleEcmaModule, handleTagValItemName, handleTagValItemValue); +- EXPECT_EQ(handleEcmaModule->GetItem(thread, handleTagValItemName)->GetNumber(), intItemValue); ++ handleEcmaModule->SetNameDictionary(thread_, handleNameDict); // Call SetNameDictionary in TEST_F ++ EcmaModule::AddItem(thread_, handleEcmaModule, handleTagValItemName, handleTagValItemValue); ++ EXPECT_EQ(handleEcmaModule->GetItem(thread_, handleTagValItemName)->GetNumber(), intItemValue); + } + + /* +@@ -91,14 +91,14 @@ TEST_F(EcmaModuleTest, AddItem_002) + { + CString cStrItemName = "cStrItemName"; + int intItemValue = 1; +- JSHandle handleEcmaModule(thread, EcmaModuleCreate(thread)); ++ JSHandle handleEcmaModule(thread_, EcmaModuleCreate(thread_)); + JSHandle handleTagValItemName( +- thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(cStrItemName)); +- JSHandle handleTagValItemValue(thread, JSTaggedValue(intItemValue)); ++ thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(cStrItemName)); ++ JSHandle handleTagValItemValue(thread_, JSTaggedValue(intItemValue)); + + // This EcmaModule calls 'SetNameDictionary' function through 'AddItem' function of "ecma_module.cpp". +- EcmaModule::AddItem(thread, handleEcmaModule, handleTagValItemName, handleTagValItemValue); +- EXPECT_EQ(handleEcmaModule->GetItem(thread, handleTagValItemName)->GetNumber(), intItemValue); ++ EcmaModule::AddItem(thread_, handleEcmaModule, handleTagValItemName, handleTagValItemValue); ++ EXPECT_EQ(handleEcmaModule->GetItem(thread_, handleTagValItemName)->GetNumber(), intItemValue); + } + + /* +@@ -112,17 +112,17 @@ TEST_F(EcmaModuleTest, AddItem_002) + */ + TEST_F(EcmaModuleTest, RemoveItem) + { +- ObjectFactory *objFactory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *objFactory = thread_->GetEcmaVM()->GetFactory(); + + CString cStrItemName = "cStrItemName"; + int intItemValue = 1; +- JSHandle handleEcmaModule(thread, EcmaModuleCreate(thread)); ++ JSHandle handleEcmaModule(thread_, EcmaModuleCreate(thread_)); + JSHandle handleTagValItemName(objFactory->NewFromCanBeCompressString(cStrItemName)); +- JSHandle handleTagValItemValue(thread, JSTaggedValue(intItemValue)); ++ JSHandle handleTagValItemValue(thread_, JSTaggedValue(intItemValue)); + +- EcmaModule::AddItem(thread, handleEcmaModule, handleTagValItemName, handleTagValItemValue); +- EcmaModule::RemoveItem(thread, handleEcmaModule, handleTagValItemName); +- EXPECT_TRUE(handleEcmaModule->GetItem(thread, handleTagValItemName)->IsUndefined()); ++ EcmaModule::AddItem(thread_, handleEcmaModule, handleTagValItemName, handleTagValItemValue); ++ EcmaModule::RemoveItem(thread_, handleEcmaModule, handleTagValItemName); ++ EXPECT_TRUE(handleEcmaModule->GetItem(thread_, handleTagValItemName)->IsUndefined()); + } + + /* +@@ -138,23 +138,23 @@ TEST_F(EcmaModuleTest, RemoveItem) + */ + TEST_F(EcmaModuleTest, SetNameDictionary) + { +- ObjectFactory *objFactory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *objFactory = thread_->GetEcmaVM()->GetFactory(); + + int numOfElementsDict = 4; +- JSHandle handleNameDict(NameDictionary::Create(thread, numOfElementsDict)); +- JSHandle handleObjFunc = thread->GetEcmaVM()->GetGlobalEnv()->GetObjectFunction(); ++ JSHandle handleNameDict(NameDictionary::Create(thread_, numOfElementsDict)); ++ JSHandle handleObjFunc = thread_->GetEcmaVM()->GetGlobalEnv()->GetObjectFunction(); + CString keyArray1 = "hello1"; + JSHandle stringKey1 = objFactory->NewFromCanBeCompressString(keyArray1); + JSHandle key1(stringKey1); + JSHandle value1( + objFactory->NewJSObjectByConstructor(JSHandle(handleObjFunc), handleObjFunc)); + JSHandle handleNameDictionaryFrom( +- NameDictionary::Put(thread, handleNameDict, key1, value1, PropertyAttributes::Default())); +- JSHandle handleEcmaModule(thread, EcmaModuleCreate(thread)); ++ NameDictionary::Put(thread_, handleNameDict, key1, value1, PropertyAttributes::Default())); ++ JSHandle handleEcmaModule(thread_, EcmaModuleCreate(thread_)); + +- handleEcmaModule->SetNameDictionary(thread, handleNameDictionaryFrom); ++ handleEcmaModule->SetNameDictionary(thread_, handleNameDictionaryFrom); + JSHandle handleNameDictionaryTo( +- thread, NameDictionary::Cast(handleEcmaModule->GetNameDictionary().GetTaggedObject())); ++ thread_, NameDictionary::Cast(handleEcmaModule->GetNameDictionary().GetTaggedObject())); + EXPECT_EQ(handleNameDictionaryTo->EntriesCount(), 1); + int entry1 = handleNameDictionaryTo->FindEntry(key1.GetTaggedValue()); + EXPECT_TRUE(key1.GetTaggedValue() == handleNameDictionaryTo->GetKey(entry1)); +@@ -172,8 +172,8 @@ TEST_F(EcmaModuleTest, SetNameDictionary) + */ + TEST_F(EcmaModuleTest, ModuleManager_AddModule) + { +- ObjectFactory *objFactory = thread->GetEcmaVM()->GetFactory(); +- ModuleManager *moduleManager = thread->GetEcmaVM()->GetModuleManager(); ++ ObjectFactory *objFactory = thread_->GetEcmaVM()->GetFactory(); ++ ModuleManager *moduleManager = thread_->GetEcmaVM()->GetModuleManager(); + + int numOfElementsDict1 = 4; + int numOfElementsDict2 = 4; +@@ -181,37 +181,37 @@ TEST_F(EcmaModuleTest, ModuleManager_AddModule) + CString cStrItemName2 = "cStrItemName2"; + int intItemValue1 = 1; + int intItemValue2 = 2; +- JSHandle handleNameDict1(NameDictionary::Create(thread, numOfElementsDict1)); +- JSHandle handleNameDict2(NameDictionary::Create(thread, numOfElementsDict2)); ++ JSHandle handleNameDict1(NameDictionary::Create(thread_, numOfElementsDict1)); ++ JSHandle handleNameDict2(NameDictionary::Create(thread_, numOfElementsDict2)); + JSHandle handleItemName1( +- thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(cStrItemName1)); ++ thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(cStrItemName1)); + JSHandle handleItemName2( +- thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(cStrItemName2)); +- JSHandle handleItemValue1(thread, JSTaggedValue(intItemValue1)); +- JSHandle handleItemValue2(thread, JSTaggedValue(intItemValue2)); +- JSHandle handleEcmaModuleAddFrom1(thread, EcmaModuleCreate(thread)); +- JSHandle handleEcmaModuleAddFrom2(thread, EcmaModuleCreate(thread)); +- handleEcmaModuleAddFrom1->SetNameDictionary(thread, handleNameDict1); +- handleEcmaModuleAddFrom2->SetNameDictionary(thread, handleNameDict2); +- +- EcmaModule::AddItem(thread, handleEcmaModuleAddFrom1, handleItemName1, handleItemValue1); +- JSHandle handleTagValEcmaModuleAddFrom1(thread, handleEcmaModuleAddFrom1.GetTaggedValue()); ++ thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(cStrItemName2)); ++ JSHandle handleItemValue1(thread_, JSTaggedValue(intItemValue1)); ++ JSHandle handleItemValue2(thread_, JSTaggedValue(intItemValue2)); ++ JSHandle handleEcmaModuleAddFrom1(thread_, EcmaModuleCreate(thread_)); ++ JSHandle handleEcmaModuleAddFrom2(thread_, EcmaModuleCreate(thread_)); ++ handleEcmaModuleAddFrom1->SetNameDictionary(thread_, handleNameDict1); ++ handleEcmaModuleAddFrom2->SetNameDictionary(thread_, handleNameDict2); ++ ++ EcmaModule::AddItem(thread_, handleEcmaModuleAddFrom1, handleItemName1, handleItemValue1); ++ JSHandle handleTagValEcmaModuleAddFrom1(thread_, handleEcmaModuleAddFrom1.GetTaggedValue()); + std::string stdStrNameEcmaModuleAdd1 = "NameEcmaModule1"; + JSHandle handleTagValNameEcmaModuleAdd1(objFactory->NewFromStdString(stdStrNameEcmaModuleAdd1)); +- EcmaModule::AddItem(thread, handleEcmaModuleAddFrom2, handleItemName2, handleItemValue2); +- JSHandle handleTagValEcmaModuleAddFrom2(thread, handleEcmaModuleAddFrom2.GetTaggedValue()); ++ EcmaModule::AddItem(thread_, handleEcmaModuleAddFrom2, handleItemName2, handleItemValue2); ++ JSHandle handleTagValEcmaModuleAddFrom2(thread_, handleEcmaModuleAddFrom2.GetTaggedValue()); + std::string stdStrNameEcmaModuleAdd2 = "NameEcmaModule2"; + JSHandle handleTagValNameEcmaModuleAdd2(objFactory->NewFromStdString(stdStrNameEcmaModuleAdd2)); + + moduleManager->AddModule(handleTagValNameEcmaModuleAdd1, handleTagValEcmaModuleAddFrom1); + moduleManager->AddModule(handleTagValNameEcmaModuleAdd2, handleTagValEcmaModuleAddFrom2); + JSHandle handleTagValEcmaModuleGet1 = +- moduleManager->GetModule(thread, handleTagValNameEcmaModuleAdd1); ++ moduleManager->GetModule(thread_, handleTagValNameEcmaModuleAdd1); + JSHandle handleTagValEcmaModuleGet2 = +- moduleManager->GetModule(thread, handleTagValNameEcmaModuleAdd2); +- EXPECT_EQ(JSHandle::Cast(handleTagValEcmaModuleGet1)->GetItem(thread, handleItemName1)->GetNumber(), ++ moduleManager->GetModule(thread_, handleTagValNameEcmaModuleAdd2); ++ EXPECT_EQ(JSHandle::Cast(handleTagValEcmaModuleGet1)->GetItem(thread_, handleItemName1)->GetNumber(), + intItemValue1); +- EXPECT_EQ(JSHandle::Cast(handleTagValEcmaModuleGet2)->GetItem(thread, handleItemName2)->GetNumber(), ++ EXPECT_EQ(JSHandle::Cast(handleTagValEcmaModuleGet2)->GetItem(thread_, handleItemName2)->GetNumber(), + intItemValue2); + } + +@@ -227,8 +227,8 @@ TEST_F(EcmaModuleTest, ModuleManager_AddModule) + */ + TEST_F(EcmaModuleTest, ModuleManager_RemoveModule) + { +- ObjectFactory *objFactory = thread->GetEcmaVM()->GetFactory(); +- ModuleManager *moduleManager = thread->GetEcmaVM()->GetModuleManager(); ++ ObjectFactory *objFactory = thread_->GetEcmaVM()->GetFactory(); ++ ModuleManager *moduleManager = thread_->GetEcmaVM()->GetModuleManager(); + + std::string stdStrNameEcmaModuleAdd1 = "NameEcmaModule1"; + std::string stdStrNameEcmaModuleAdd2 = "NameEcmaModule2"; +@@ -240,40 +240,40 @@ TEST_F(EcmaModuleTest, ModuleManager_RemoveModule) + JSHandle handleTagValNameEcmaModuleAdd2(objFactory->NewFromStdString(stdStrNameEcmaModuleAdd2)); + JSHandle handleTagValItemName1(objFactory->NewFromCanBeCompressString("name1")); + JSHandle handleTagValItemName2(objFactory->NewFromCanBeCompressString("name2")); +- JSHandle handleTagValItemValue1(thread, JSTaggedValue(intItemValue1)); +- JSHandle handleTagValItemValue2(thread, JSTaggedValue(intItemValue2)); +- JSHandle handleEcmaModuleAddFrom1(thread, EcmaModuleCreate(thread)); +- JSHandle handleEcmaModuleAddFrom2(thread, EcmaModuleCreate(thread)); +- JSHandle handleNameDict1(NameDictionary::Create(thread, numOfElementsDict1)); +- JSHandle handleNameDict2(NameDictionary::Create(thread, numOfElementsDict2)); +- handleEcmaModuleAddFrom1->SetNameDictionary(thread, handleNameDict1); +- handleEcmaModuleAddFrom2->SetNameDictionary(thread, handleNameDict2); +- EcmaModule::AddItem(thread, handleEcmaModuleAddFrom1, handleTagValItemName1, handleTagValItemValue1); +- EcmaModule::AddItem(thread, handleEcmaModuleAddFrom2, handleTagValItemName2, handleTagValItemValue2); +- JSHandle handleTaggedValueEcmaModuleAddFrom1(thread, handleEcmaModuleAddFrom1.GetTaggedValue()); +- JSHandle handleTaggedValueEcmaModuleAddFrom2(thread, handleEcmaModuleAddFrom2.GetTaggedValue()); ++ JSHandle handleTagValItemValue1(thread_, JSTaggedValue(intItemValue1)); ++ JSHandle handleTagValItemValue2(thread_, JSTaggedValue(intItemValue2)); ++ JSHandle handleEcmaModuleAddFrom1(thread_, EcmaModuleCreate(thread_)); ++ JSHandle handleEcmaModuleAddFrom2(thread_, EcmaModuleCreate(thread_)); ++ JSHandle handleNameDict1(NameDictionary::Create(thread_, numOfElementsDict1)); ++ JSHandle handleNameDict2(NameDictionary::Create(thread_, numOfElementsDict2)); ++ handleEcmaModuleAddFrom1->SetNameDictionary(thread_, handleNameDict1); ++ handleEcmaModuleAddFrom2->SetNameDictionary(thread_, handleNameDict2); ++ EcmaModule::AddItem(thread_, handleEcmaModuleAddFrom1, handleTagValItemName1, handleTagValItemValue1); ++ EcmaModule::AddItem(thread_, handleEcmaModuleAddFrom2, handleTagValItemName2, handleTagValItemValue2); ++ JSHandle handleTaggedValueEcmaModuleAddFrom1(thread_, handleEcmaModuleAddFrom1.GetTaggedValue()); ++ JSHandle handleTaggedValueEcmaModuleAddFrom2(thread_, handleEcmaModuleAddFrom2.GetTaggedValue()); + + moduleManager->AddModule(handleTagValNameEcmaModuleAdd1, handleTaggedValueEcmaModuleAddFrom1); + moduleManager->AddModule(handleTagValNameEcmaModuleAdd2, handleTaggedValueEcmaModuleAddFrom2); +- EXPECT_EQ(JSHandle::Cast(moduleManager->GetModule(thread, handleTagValNameEcmaModuleAdd1)) +- ->GetItem(thread, handleTagValItemName1) ++ EXPECT_EQ(JSHandle::Cast(moduleManager->GetModule(thread_, handleTagValNameEcmaModuleAdd1)) ++ ->GetItem(thread_, handleTagValItemName1) + ->GetNumber(), + intItemValue1); +- EXPECT_EQ(JSHandle::Cast(moduleManager->GetModule(thread, handleTagValNameEcmaModuleAdd2)) +- ->GetItem(thread, handleTagValItemName2) ++ EXPECT_EQ(JSHandle::Cast(moduleManager->GetModule(thread_, handleTagValNameEcmaModuleAdd2)) ++ ->GetItem(thread_, handleTagValItemName2) + ->GetNumber(), + intItemValue2); + + moduleManager->RemoveModule(handleTagValNameEcmaModuleAdd1); +- EXPECT_TRUE(moduleManager->GetModule(thread, handleTagValNameEcmaModuleAdd1)->IsUndefined()); +- EXPECT_EQ(JSHandle::Cast(moduleManager->GetModule(thread, handleTagValNameEcmaModuleAdd2)) +- ->GetItem(thread, handleTagValItemName2) ++ EXPECT_TRUE(moduleManager->GetModule(thread_, handleTagValNameEcmaModuleAdd1)->IsUndefined()); ++ EXPECT_EQ(JSHandle::Cast(moduleManager->GetModule(thread_, handleTagValNameEcmaModuleAdd2)) ++ ->GetItem(thread_, handleTagValItemName2) + ->GetNumber(), + intItemValue2); + + moduleManager->RemoveModule(handleTagValNameEcmaModuleAdd2); +- EXPECT_TRUE(moduleManager->GetModule(thread, handleTagValNameEcmaModuleAdd1)->IsUndefined()); +- EXPECT_TRUE(moduleManager->GetModule(thread, handleTagValNameEcmaModuleAdd2)->IsUndefined()); ++ EXPECT_TRUE(moduleManager->GetModule(thread_, handleTagValNameEcmaModuleAdd1)->IsUndefined()); ++ EXPECT_TRUE(moduleManager->GetModule(thread_, handleTagValNameEcmaModuleAdd2)->IsUndefined()); + } + + /* +@@ -287,7 +287,7 @@ TEST_F(EcmaModuleTest, ModuleManager_RemoveModule) + */ + TEST_F(EcmaModuleTest, ModuleManager_SetCurrentExportModuleName) + { +- ModuleManager *moduleManager = thread->GetEcmaVM()->GetModuleManager(); ++ ModuleManager *moduleManager = thread_->GetEcmaVM()->GetModuleManager(); + + std::string_view strViewNameEcmaModule1 = "NameEcmaModule1"; + std::string_view strViewNameEcmaModule2 = "NameEcmaModule2"; +@@ -308,7 +308,7 @@ TEST_F(EcmaModuleTest, ModuleManager_SetCurrentExportModuleName) + */ + TEST_F(EcmaModuleTest, ModuleManager_GetPrevExportModuleName) + { +- ModuleManager *moduleManager = thread->GetEcmaVM()->GetModuleManager(); ++ ModuleManager *moduleManager = thread_->GetEcmaVM()->GetModuleManager(); + + std::string_view strViewNameEcmaModule1 = "NameEcmaModule1"; + std::string_view strViewNameEcmaModule2 = "NameEcmaModule2"; +@@ -332,7 +332,7 @@ TEST_F(EcmaModuleTest, ModuleManager_GetPrevExportModuleName) + */ + TEST_F(EcmaModuleTest, ModuleManager_RestoreCurrentExportModuleName) + { +- ModuleManager *moduleManager = thread->GetEcmaVM()->GetModuleManager(); ++ ModuleManager *moduleManager = thread_->GetEcmaVM()->GetModuleManager(); + + std::string_view strViewNameEcmaModule1 = "NameEcmaModule1"; + std::string_view strViewNameEcmaModule2 = "NameEcmaModule2"; +@@ -359,8 +359,8 @@ TEST_F(EcmaModuleTest, ModuleManager_RestoreCurrentExportModuleName) + */ + TEST_F(EcmaModuleTest, ModuleManager_AddModuleItem) + { +- ObjectFactory *objFactory = thread->GetEcmaVM()->GetFactory(); +- ModuleManager *moduleManager = thread->GetEcmaVM()->GetModuleManager(); ++ ObjectFactory *objFactory = thread_->GetEcmaVM()->GetFactory(); ++ ModuleManager *moduleManager = thread_->GetEcmaVM()->GetModuleManager(); + + int intItemValue11 = 11; + int intItemValue12 = 12; +@@ -370,10 +370,10 @@ TEST_F(EcmaModuleTest, ModuleManager_AddModuleItem) + JSHandle handleTagValItemName12(objFactory->NewFromCanBeCompressString("cStrItemName12")); + JSHandle handleTagValItemName21(objFactory->NewFromCanBeCompressString("cStrItemName21")); + JSHandle handleTagValItemName22(objFactory->NewFromCanBeCompressString("cStrItemName22")); +- JSHandle handleTagValItemValue11(thread, JSTaggedValue(intItemValue11)); +- JSHandle handleTagValItemValue12(thread, JSTaggedValue(intItemValue12)); +- JSHandle handleTagValItemValue21(thread, JSTaggedValue(intItemValue21)); +- JSHandle handleTagValItemValue22(thread, JSTaggedValue(intItemValue22)); ++ JSHandle handleTagValItemValue11(thread_, JSTaggedValue(intItemValue11)); ++ JSHandle handleTagValItemValue12(thread_, JSTaggedValue(intItemValue12)); ++ JSHandle handleTagValItemValue21(thread_, JSTaggedValue(intItemValue21)); ++ JSHandle handleTagValItemValue22(thread_, JSTaggedValue(intItemValue22)); + JSHandle handleEcmaStrNameEcmaModule1 = objFactory->NewFromString("cStrNameEcmaModule1"); + JSHandle handleEcmaStrNameEcmaModule2 = objFactory->NewFromString("cStrNameEcmaModule2"); + std::string stdStrModuleFileName1 = JSLocale::ConvertToStdString(handleEcmaStrNameEcmaModule1); +@@ -382,31 +382,31 @@ TEST_F(EcmaModuleTest, ModuleManager_AddModuleItem) + JSHandle handleTagValEcmaModuleName2(handleEcmaStrNameEcmaModule2); + + // Test when the module is created through 'NewEmptyEcmaModule' function called at TEST_F. +- JSHandle handleEcmaModule1(thread, EcmaModuleCreate(thread)); +- JSHandle handleTagValEcmaModule1(thread, handleEcmaModule1.GetTaggedValue()); ++ JSHandle handleEcmaModule1(thread_, EcmaModuleCreate(thread_)); ++ JSHandle handleTagValEcmaModule1(thread_, handleEcmaModule1.GetTaggedValue()); + moduleManager->AddModule(handleTagValEcmaModuleName1, handleTagValEcmaModule1); + moduleManager->SetCurrentExportModuleName(stdStrModuleFileName1); +- moduleManager->AddModuleItem(thread, handleTagValItemName11, handleTagValItemValue11); +- moduleManager->AddModuleItem(thread, handleTagValItemName12, handleTagValItemValue12); ++ moduleManager->AddModuleItem(thread_, handleTagValItemName11, handleTagValItemValue11); ++ moduleManager->AddModuleItem(thread_, handleTagValItemName12, handleTagValItemValue12); + +- EXPECT_EQ(moduleManager->GetModuleItem(thread, handleTagValEcmaModule1, handleTagValItemName11)->GetNumber(), ++ EXPECT_EQ(moduleManager->GetModuleItem(thread_, handleTagValEcmaModule1, handleTagValItemName11)->GetNumber(), + intItemValue11); +- EXPECT_EQ(moduleManager->GetModuleItem(thread, handleTagValEcmaModule1, handleTagValItemName12)->GetNumber(), ++ EXPECT_EQ(moduleManager->GetModuleItem(thread_, handleTagValEcmaModule1, handleTagValItemName12)->GetNumber(), + intItemValue12); + + // Test when the module is created through 'NewEmptyEcmaModule' function called at "ecma_module.cpp". + moduleManager->SetCurrentExportModuleName(stdStrModuleFileName2); +- moduleManager->AddModuleItem(thread, handleTagValItemName21, handleTagValItemValue21); +- moduleManager->AddModuleItem(thread, handleTagValItemName22, handleTagValItemValue22); ++ moduleManager->AddModuleItem(thread_, handleTagValItemName21, handleTagValItemValue21); ++ moduleManager->AddModuleItem(thread_, handleTagValItemName22, handleTagValItemValue22); + +- JSHandle handleTagValEcmaModule2 = moduleManager->GetModule(thread, handleTagValEcmaModuleName2); +- EXPECT_EQ(moduleManager->GetModuleItem(thread, handleTagValEcmaModule1, handleTagValItemName11)->GetNumber(), ++ JSHandle handleTagValEcmaModule2 = moduleManager->GetModule(thread_, handleTagValEcmaModuleName2); ++ EXPECT_EQ(moduleManager->GetModuleItem(thread_, handleTagValEcmaModule1, handleTagValItemName11)->GetNumber(), + intItemValue11); +- EXPECT_EQ(moduleManager->GetModuleItem(thread, handleTagValEcmaModule1, handleTagValItemName12)->GetNumber(), ++ EXPECT_EQ(moduleManager->GetModuleItem(thread_, handleTagValEcmaModule1, handleTagValItemName12)->GetNumber(), + intItemValue12); +- EXPECT_EQ(moduleManager->GetModuleItem(thread, handleTagValEcmaModule2, handleTagValItemName21)->GetNumber(), ++ EXPECT_EQ(moduleManager->GetModuleItem(thread_, handleTagValEcmaModule2, handleTagValItemName21)->GetNumber(), + intItemValue21); +- EXPECT_EQ(moduleManager->GetModuleItem(thread, handleTagValEcmaModule2, handleTagValItemName22)->GetNumber(), ++ EXPECT_EQ(moduleManager->GetModuleItem(thread_, handleTagValEcmaModule2, handleTagValItemName22)->GetNumber(), + intItemValue22); + } + +@@ -422,8 +422,8 @@ TEST_F(EcmaModuleTest, ModuleManager_AddModuleItem) + */ + TEST_F(EcmaModuleTest, ModuleManager_CopyModule) + { +- ObjectFactory *objFactory = thread->GetEcmaVM()->GetFactory(); +- ModuleManager *moduleManager = thread->GetEcmaVM()->GetModuleManager(); ++ ObjectFactory *objFactory = thread_->GetEcmaVM()->GetFactory(); ++ ModuleManager *moduleManager = thread_->GetEcmaVM()->GetModuleManager(); + + int intItemValue11 = 11; + int intItemValue12 = 12; +@@ -435,39 +435,45 @@ TEST_F(EcmaModuleTest, ModuleManager_CopyModule) + JSHandle handleTagValItemName12(objFactory->NewFromCanBeCompressString("ItemName12")); + JSHandle handleTagValItemName21(objFactory->NewFromCanBeCompressString("ItemName21")); + JSHandle handleTagValItemName22(objFactory->NewFromCanBeCompressString("ItemName22")); +- JSHandle handleTagValItemValue11(thread, JSTaggedValue(intItemValue11)); +- JSHandle handleTagValItemValue12(thread, JSTaggedValue(intItemValue12)); +- JSHandle handleTagValItemValue21(thread, JSTaggedValue(intItemValue21)); +- JSHandle handleTagValItemValue22(thread, JSTaggedValue(intItemValue22)); +- JSHandle handleEcmaModuleCopyFrom1(thread, EcmaModuleCreate(thread)); +- JSHandle handleEcmaModuleCopyFrom2(thread, EcmaModuleCreate(thread)); +- JSHandle handleTagValEcmaModuleCopyFrom1(thread, handleEcmaModuleCopyFrom1.GetTaggedValue()); +- JSHandle handleTagValEcmaModuleCopyFrom2(thread, handleEcmaModuleCopyFrom2.GetTaggedValue()); +- EcmaModule::AddItem(thread, handleEcmaModuleCopyFrom1, handleTagValItemName11, handleTagValItemValue11); +- EcmaModule::AddItem(thread, handleEcmaModuleCopyFrom1, handleTagValItemName12, handleTagValItemValue12); +- EcmaModule::AddItem(thread, handleEcmaModuleCopyFrom2, handleTagValItemName21, handleTagValItemValue21); +- EcmaModule::AddItem(thread, handleEcmaModuleCopyFrom2, handleTagValItemName22, handleTagValItemValue22); ++ JSHandle handleTagValItemValue11(thread_, JSTaggedValue(intItemValue11)); ++ JSHandle handleTagValItemValue12(thread_, JSTaggedValue(intItemValue12)); ++ JSHandle handleTagValItemValue21(thread_, JSTaggedValue(intItemValue21)); ++ JSHandle handleTagValItemValue22(thread_, JSTaggedValue(intItemValue22)); ++ JSHandle handleEcmaModuleCopyFrom1(thread_, EcmaModuleCreate(thread_)); ++ JSHandle handleEcmaModuleCopyFrom2(thread_, EcmaModuleCreate(thread_)); ++ JSHandle handleTagValEcmaModuleCopyFrom1(thread_, handleEcmaModuleCopyFrom1.GetTaggedValue()); ++ JSHandle handleTagValEcmaModuleCopyFrom2(thread_, handleEcmaModuleCopyFrom2.GetTaggedValue()); ++ EcmaModule::AddItem(thread_, handleEcmaModuleCopyFrom1, handleTagValItemName11, handleTagValItemValue11); ++ EcmaModule::AddItem(thread_, handleEcmaModuleCopyFrom1, handleTagValItemName12, handleTagValItemValue12); ++ EcmaModule::AddItem(thread_, handleEcmaModuleCopyFrom2, handleTagValItemName21, handleTagValItemValue21); ++ EcmaModule::AddItem(thread_, handleEcmaModuleCopyFrom2, handleTagValItemName22, handleTagValItemValue22); + + moduleManager->SetCurrentExportModuleName(fileNameEcmaModuleCopyTo1); +- moduleManager->CopyModule(thread, handleTagValEcmaModuleCopyFrom1); ++ moduleManager->CopyModule(thread_, handleTagValEcmaModuleCopyFrom1); + JSHandle handleTagValEcmaModuleCopyTo1 = moduleManager->GetModule( +- thread, JSHandle::Cast(objFactory->NewFromString(CString(fileNameEcmaModuleCopyTo1)))); +- EXPECT_EQ(intItemValue11, +- moduleManager->GetModuleItem(thread, handleTagValEcmaModuleCopyTo1, handleTagValItemName11)->GetNumber()); +- EXPECT_EQ(intItemValue12, +- moduleManager->GetModuleItem(thread, handleTagValEcmaModuleCopyTo1, handleTagValItemName12)->GetNumber()); ++ thread_, JSHandle::Cast(objFactory->NewFromString(CString(fileNameEcmaModuleCopyTo1)))); ++ EXPECT_EQ( ++ intItemValue11, ++ moduleManager->GetModuleItem(thread_, handleTagValEcmaModuleCopyTo1, handleTagValItemName11)->GetNumber()); ++ EXPECT_EQ( ++ intItemValue12, ++ moduleManager->GetModuleItem(thread_, handleTagValEcmaModuleCopyTo1, handleTagValItemName12)->GetNumber()); + + moduleManager->SetCurrentExportModuleName(fileNameEcmaModuleCopyTo2); +- moduleManager->CopyModule(thread, handleTagValEcmaModuleCopyFrom2); ++ moduleManager->CopyModule(thread_, handleTagValEcmaModuleCopyFrom2); + JSHandle handleTagValEcmaModuleCopyTo2 = moduleManager->GetModule( +- thread, JSHandle::Cast(objFactory->NewFromString(CString(fileNameEcmaModuleCopyTo2)))); +- EXPECT_EQ(intItemValue11, +- moduleManager->GetModuleItem(thread, handleTagValEcmaModuleCopyTo1, handleTagValItemName11)->GetNumber()); +- EXPECT_EQ(intItemValue12, +- moduleManager->GetModuleItem(thread, handleTagValEcmaModuleCopyTo1, handleTagValItemName12)->GetNumber()); +- EXPECT_EQ(intItemValue21, +- moduleManager->GetModuleItem(thread, handleTagValEcmaModuleCopyTo2, handleTagValItemName21)->GetNumber()); +- EXPECT_EQ(intItemValue22, +- moduleManager->GetModuleItem(thread, handleTagValEcmaModuleCopyTo2, handleTagValItemName22)->GetNumber()); ++ thread_, JSHandle::Cast(objFactory->NewFromString(CString(fileNameEcmaModuleCopyTo2)))); ++ EXPECT_EQ( ++ intItemValue11, ++ moduleManager->GetModuleItem(thread_, handleTagValEcmaModuleCopyTo1, handleTagValItemName11)->GetNumber()); ++ EXPECT_EQ( ++ intItemValue12, ++ moduleManager->GetModuleItem(thread_, handleTagValEcmaModuleCopyTo1, handleTagValItemName12)->GetNumber()); ++ EXPECT_EQ( ++ intItemValue21, ++ moduleManager->GetModuleItem(thread_, handleTagValEcmaModuleCopyTo2, handleTagValItemName21)->GetNumber()); ++ EXPECT_EQ( ++ intItemValue22, ++ moduleManager->GetModuleItem(thread_, handleTagValEcmaModuleCopyTo2, handleTagValItemName22)->GetNumber()); + } + } // namespace panda::test +diff --git a/tests/runtime/common/ecma_string_test.cpp b/tests/runtime/common/ecma_string_test.cpp +index 2013fa6..932872c 100644 +--- a/tests/runtime/common/ecma_string_test.cpp ++++ b/tests/runtime/common/ecma_string_test.cpp +@@ -33,16 +33,16 @@ public: + + void SetUp() override + { +- TestHelper::CreateEcmaVMWithScope(instance, thread, scope); ++ TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); + } + + void TearDown() override + { +- TestHelper::DestroyEcmaVMWithScope(instance, scope); ++ TestHelper::DestroyEcmaVMWithScope(instance_, scope_); + } +- PandaVM *instance {nullptr}; +- ecmascript::EcmaHandleScope *scope {nullptr}; +- JSThread *thread {nullptr}; ++ PandaVM *instance_ {nullptr}; ++ ecmascript::EcmaHandleScope *scope_ {nullptr}; ++ JSThread *thread_ {nullptr}; + }; + + /* +@@ -94,15 +94,15 @@ TEST_F(EcmaStringTest, CanBeCompressed) + */ + TEST_F(EcmaStringTest, CreateEmptyString) + { +- EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); ++ EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); + +- JSHandle handleEcmaStrEmpty(thread, EcmaString::CreateEmptyString(ecmaVMPtr)); ++ JSHandle handleEcmaStrEmpty(thread_, EcmaString::CreateEmptyString(ecmaVMPtr)); + EXPECT_EQ(handleEcmaStrEmpty->GetLength(), 0); + EXPECT_TRUE(handleEcmaStrEmpty->IsUtf8()); + EXPECT_FALSE(handleEcmaStrEmpty->IsUtf16()); + + EcmaString::SetCompressedStringsEnabled(false); // Set compressedStringsEnabled false. +- JSHandle handleEcmaStrEmptyDisableComp(thread, EcmaString::CreateEmptyString(ecmaVMPtr)); ++ JSHandle handleEcmaStrEmptyDisableComp(thread_, EcmaString::CreateEmptyString(ecmaVMPtr)); + EXPECT_EQ(handleEcmaStrEmptyDisableComp->GetLength(), 0); + EXPECT_TRUE(handleEcmaStrEmptyDisableComp->IsUtf16()); + EcmaString::SetCompressedStringsEnabled(true); // Set compressedStringsEnabled true(default). +@@ -117,11 +117,11 @@ TEST_F(EcmaStringTest, CreateEmptyString) + */ + TEST_F(EcmaStringTest, AllocStringObject) + { +- EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); ++ EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); + + // AllocStringObject( , true, ). + size_t sizeAllocComp = 5; +- JSHandle handleEcmaStrAllocComp(thread, EcmaString::AllocStringObject(sizeAllocComp, true, ecmaVMPtr)); ++ JSHandle handleEcmaStrAllocComp(thread_, EcmaString::AllocStringObject(sizeAllocComp, true, ecmaVMPtr)); + for (size_t i = 0; i < sizeAllocComp; i++) { + EXPECT_EQ(handleEcmaStrAllocComp->At(i), 0); + } +@@ -131,7 +131,7 @@ TEST_F(EcmaStringTest, AllocStringObject) + + // AllocStringObject( , false, ). + size_t sizeAllocNotComp = 5; +- JSHandle handleEcmaStrAllocNotComp(thread, ++ JSHandle handleEcmaStrAllocNotComp(thread_, + EcmaString::AllocStringObject(sizeAllocNotComp, false, ecmaVMPtr)); + for (size_t i = 0; i < sizeAllocNotComp; i++) { + EXPECT_EQ(handleEcmaStrAllocNotComp->At(i), 0); +@@ -141,7 +141,7 @@ TEST_F(EcmaStringTest, AllocStringObject) + EXPECT_TRUE(handleEcmaStrAllocNotComp->IsUtf16()); + EcmaString::SetCompressedStringsEnabled(false); // Set compressedStringsEnabled false. + JSHandle handleEcmaStrAllocNotCompDisableComp( +- thread, EcmaString::AllocStringObject(sizeAllocNotComp, false, ecmaVMPtr)); ++ thread_, EcmaString::AllocStringObject(sizeAllocNotComp, false, ecmaVMPtr)); + EXPECT_TRUE(handleEcmaStrAllocNotCompDisableComp->IsUtf16()); + EcmaString::SetCompressedStringsEnabled(true); // Set compressedStringsEnabled true(default). + } +@@ -154,10 +154,10 @@ TEST_F(EcmaStringTest, AllocStringObject) + */ + TEST_F(EcmaStringTest, CreateFromUtf8) + { +- EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); ++ EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); + uint8_t arrayU8[] = {"xyz123!@#"}; + size_t lengthEcmaStrU8 = sizeof(arrayU8) - 1; +- JSHandle handleEcmaStrU8(thread, ++ JSHandle handleEcmaStrU8(thread_, + EcmaString::CreateFromUtf8(&arrayU8[0], lengthEcmaStrU8, ecmaVMPtr, true)); + for (size_t i = 0; i < lengthEcmaStrU8; i++) { + EXPECT_EQ(arrayU8[i], handleEcmaStrU8->At(i)); +@@ -176,13 +176,13 @@ TEST_F(EcmaStringTest, CreateFromUtf8) + */ + TEST_F(EcmaStringTest, CreateFromUtf16) + { +- EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); ++ EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); + + // CreateFromUtf16( , , , true). + uint16_t arrayU16Comp[] = {1, 23, 45, 67, 127}; + size_t lengthEcmaStrU16Comp = sizeof(arrayU16Comp) / sizeof(arrayU16Comp[0]); + JSHandle handleEcmaStrU16Comp( +- thread, EcmaString::CreateFromUtf16(&arrayU16Comp[0], lengthEcmaStrU16Comp, ecmaVMPtr, true)); ++ thread_, EcmaString::CreateFromUtf16(&arrayU16Comp[0], lengthEcmaStrU16Comp, ecmaVMPtr, true)); + EXPECT_EQ(handleEcmaStrU16Comp->GetLength(), lengthEcmaStrU16Comp); + EXPECT_TRUE(handleEcmaStrU16Comp->IsUtf8()); + EXPECT_FALSE(handleEcmaStrU16Comp->IsUtf16()); +@@ -191,13 +191,13 @@ TEST_F(EcmaStringTest, CreateFromUtf16) + uint16_t arrayU16NotComp[] = {127, 33, 128, 12, 256, 11100, 65535}; + size_t lengthEcmaStrU16NotComp = sizeof(arrayU16NotComp) / sizeof(arrayU16NotComp[0]); + JSHandle handleEcmaStrU16NotComp( +- thread, EcmaString::CreateFromUtf16(&arrayU16NotComp[0], lengthEcmaStrU16NotComp, ecmaVMPtr, false)); ++ thread_, EcmaString::CreateFromUtf16(&arrayU16NotComp[0], lengthEcmaStrU16NotComp, ecmaVMPtr, false)); + EXPECT_EQ(handleEcmaStrU16NotComp->GetLength(), lengthEcmaStrU16NotComp); + EXPECT_FALSE(handleEcmaStrU16NotComp->IsUtf8()); + EXPECT_TRUE(handleEcmaStrU16NotComp->IsUtf16()); + EcmaString::SetCompressedStringsEnabled(false); // Set compressedStringsEnabled false. + JSHandle handleEcmaStrU16NotCompDisableComp( +- thread, EcmaString::CreateFromUtf16(&arrayU16NotComp[0], lengthEcmaStrU16NotComp, ecmaVMPtr, false)); ++ thread_, EcmaString::CreateFromUtf16(&arrayU16NotComp[0], lengthEcmaStrU16NotComp, ecmaVMPtr, false)); + EXPECT_TRUE(handleEcmaStrU16NotCompDisableComp->IsUtf16()); + EcmaString::SetCompressedStringsEnabled(true); // Set compressedStringsEnabled true(default). + } +@@ -255,24 +255,24 @@ TEST_F(EcmaStringTest, ComputeSizeUtf16) + */ + TEST_F(EcmaStringTest, ObjectSize) + { +- EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); ++ EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); + +- JSHandle handleEcmaStrEmpty(thread, EcmaString::CreateEmptyString(ecmaVMPtr)); ++ JSHandle handleEcmaStrEmpty(thread_, EcmaString::CreateEmptyString(ecmaVMPtr)); + EXPECT_EQ(handleEcmaStrEmpty->ObjectSize(), EcmaString::SIZE + 0); + + size_t lengthEcmaStrAllocComp = 5; +- JSHandle handleEcmaStrAllocComp(thread, ++ JSHandle handleEcmaStrAllocComp(thread_, + EcmaString::AllocStringObject(lengthEcmaStrAllocComp, true, ecmaVMPtr)); + EXPECT_EQ(handleEcmaStrAllocComp->ObjectSize(), EcmaString::SIZE + sizeof(uint8_t) * lengthEcmaStrAllocComp); + + size_t lengthEcmaStrAllocNotComp = 5; + JSHandle handleEcmaStrAllocNotComp( +- thread, EcmaString::AllocStringObject(lengthEcmaStrAllocNotComp, false, ecmaVMPtr)); ++ thread_, EcmaString::AllocStringObject(lengthEcmaStrAllocNotComp, false, ecmaVMPtr)); + EXPECT_EQ(handleEcmaStrAllocNotComp->ObjectSize(), EcmaString::SIZE + sizeof(uint16_t) * lengthEcmaStrAllocNotComp); + + uint8_t arrayU8[] = {"abcde"}; + size_t lengthEcmaStrU8 = sizeof(arrayU8) - 1; +- JSHandle handleEcmaStrU8(thread, ++ JSHandle handleEcmaStrU8(thread_, + EcmaString::CreateFromUtf8(&arrayU8[0], lengthEcmaStrU8, ecmaVMPtr, true)); + EXPECT_EQ(handleEcmaStrU8->ObjectSize(), EcmaString::SIZE + sizeof(uint8_t) * lengthEcmaStrU8); + +@@ -280,14 +280,14 @@ TEST_F(EcmaStringTest, ObjectSize) + uint16_t arrayU16Comp[] = {1, 23, 45, 67, 127}; + size_t lengthEcmaStrU16Comp = sizeof(arrayU16Comp) / sizeof(arrayU16Comp[0]); + JSHandle handleEcmaStrU16Comp( +- thread, EcmaString::CreateFromUtf16(&arrayU16Comp[0], lengthEcmaStrU16Comp, ecmaVMPtr, true)); ++ thread_, EcmaString::CreateFromUtf16(&arrayU16Comp[0], lengthEcmaStrU16Comp, ecmaVMPtr, true)); + EXPECT_EQ(handleEcmaStrU16Comp->ObjectSize(), EcmaString::SIZE + sizeof(uint8_t) * lengthEcmaStrU16Comp); + + // ObjectSize(). EcmaString made by CreateFromUtf16( , , , false). + uint16_t arrayU16NotComp[] = {127, 128, 256, 11100, 65535}; + size_t lengthEcmaStrU16NotComp = sizeof(arrayU16NotComp) / sizeof(arrayU16NotComp[0]); + JSHandle handleEcmaStrU16NotComp( +- thread, EcmaString::CreateFromUtf16(&arrayU16NotComp[0], lengthEcmaStrU16NotComp, ecmaVMPtr, false)); ++ thread_, EcmaString::CreateFromUtf16(&arrayU16NotComp[0], lengthEcmaStrU16NotComp, ecmaVMPtr, false)); + EXPECT_EQ(handleEcmaStrU16NotComp->ObjectSize(), EcmaString::SIZE + sizeof(uint16_t) * lengthEcmaStrU16NotComp); + } + +@@ -300,7 +300,7 @@ TEST_F(EcmaStringTest, ObjectSize) + */ + TEST_F(EcmaStringTest, Compare_001) + { +- EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); ++ EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); + + // Compare(). Between EcmaStrings made by CreateFromUtf8(). + uint8_t arrayU8No1[3] = {1, 23}; +@@ -310,11 +310,11 @@ TEST_F(EcmaStringTest, Compare_001) + uint32_t lengthEcmaStrU8No2 = sizeof(arrayU8No2) - 1; + uint32_t lengthEcmaStrU8No3 = sizeof(arrayU8No3) - 1; + JSHandle handleEcmaStrU8No1( +- thread, EcmaString::CreateFromUtf8(&arrayU8No1[0], lengthEcmaStrU8No1, ecmaVMPtr, true)); ++ thread_, EcmaString::CreateFromUtf8(&arrayU8No1[0], lengthEcmaStrU8No1, ecmaVMPtr, true)); + JSHandle handleEcmaStrU8No2( +- thread, EcmaString::CreateFromUtf8(&arrayU8No2[0], lengthEcmaStrU8No2, ecmaVMPtr, true)); ++ thread_, EcmaString::CreateFromUtf8(&arrayU8No2[0], lengthEcmaStrU8No2, ecmaVMPtr, true)); + JSHandle handleEcmaStrU8No3( +- thread, EcmaString::CreateFromUtf8(&arrayU8No3[0], lengthEcmaStrU8No3, ecmaVMPtr, true)); ++ thread_, EcmaString::CreateFromUtf8(&arrayU8No3[0], lengthEcmaStrU8No3, ecmaVMPtr, true)); + EXPECT_EQ(handleEcmaStrU8No1->Compare(*handleEcmaStrU8No2), -1); + EXPECT_EQ(handleEcmaStrU8No2->Compare(*handleEcmaStrU8No1), 1); + EXPECT_EQ(handleEcmaStrU8No2->Compare(*handleEcmaStrU8No3), 49 - 45); +@@ -330,7 +330,7 @@ TEST_F(EcmaStringTest, Compare_001) + */ + TEST_F(EcmaStringTest, Compare_002) + { +- EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); ++ EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); + + // Compare(). Between EcmaStrings made by CreateFromUtf16( , , , true). + uint16_t arrayU16CompNo1[] = {1, 23}; +@@ -340,11 +340,11 @@ TEST_F(EcmaStringTest, Compare_002) + uint32_t lengthEcmaStrU16CompNo2 = sizeof(arrayU16CompNo2) / sizeof(arrayU16CompNo2[0]); + uint32_t lengthEcmaStrU16CompNo3 = sizeof(arrayU16CompNo3) / sizeof(arrayU16CompNo3[0]); + JSHandle handleEcmaStrU16CompNo1( +- thread, EcmaString::CreateFromUtf16(&arrayU16CompNo1[0], lengthEcmaStrU16CompNo1, ecmaVMPtr, true)); ++ thread_, EcmaString::CreateFromUtf16(&arrayU16CompNo1[0], lengthEcmaStrU16CompNo1, ecmaVMPtr, true)); + JSHandle handleEcmaStrU16CompNo2( +- thread, EcmaString::CreateFromUtf16(&arrayU16CompNo2[0], lengthEcmaStrU16CompNo2, ecmaVMPtr, true)); ++ thread_, EcmaString::CreateFromUtf16(&arrayU16CompNo2[0], lengthEcmaStrU16CompNo2, ecmaVMPtr, true)); + JSHandle handleEcmaStrU16CompNo3( +- thread, EcmaString::CreateFromUtf16(&arrayU16CompNo3[0], lengthEcmaStrU16CompNo3, ecmaVMPtr, true)); ++ thread_, EcmaString::CreateFromUtf16(&arrayU16CompNo3[0], lengthEcmaStrU16CompNo3, ecmaVMPtr, true)); + EXPECT_EQ(handleEcmaStrU16CompNo1->Compare(*handleEcmaStrU16CompNo2), -1); + EXPECT_EQ(handleEcmaStrU16CompNo2->Compare(*handleEcmaStrU16CompNo1), 1); + EXPECT_EQ(handleEcmaStrU16CompNo2->Compare(*handleEcmaStrU16CompNo3), 49 - 45); +@@ -361,7 +361,7 @@ TEST_F(EcmaStringTest, Compare_002) + */ + TEST_F(EcmaStringTest, Compare_003) + { +- EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); ++ EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); + + // Compare(). EcmaString made by CreateFromUtf8() and EcmaString made by CreateFromUtf16( , , , true). + uint8_t arrayU8No1[3] = {1, 23}; +@@ -375,15 +375,15 @@ TEST_F(EcmaStringTest, Compare_003) + uint32_t lengthEcmaStrU16CompNo2 = sizeof(arrayU16CompNo2) / sizeof(arrayU16CompNo2[0]); + uint32_t lengthEcmaStrU16CompNo3 = sizeof(arrayU16CompNo3) / sizeof(arrayU16CompNo3[0]); + JSHandle handleEcmaStrU8No1( +- thread, EcmaString::CreateFromUtf8(&arrayU8No1[0], lengthEcmaStrU8No1, ecmaVMPtr, true)); ++ thread_, EcmaString::CreateFromUtf8(&arrayU8No1[0], lengthEcmaStrU8No1, ecmaVMPtr, true)); + JSHandle handleEcmaStrU8No2( +- thread, EcmaString::CreateFromUtf8(&arrayU8No2[0], lengthEcmaStrU8No2, ecmaVMPtr, true)); ++ thread_, EcmaString::CreateFromUtf8(&arrayU8No2[0], lengthEcmaStrU8No2, ecmaVMPtr, true)); + JSHandle handleEcmaStrU16CompNo1( +- thread, EcmaString::CreateFromUtf16(&arrayU16CompNo1[0], lengthEcmaStrU16CompNo1, ecmaVMPtr, true)); ++ thread_, EcmaString::CreateFromUtf16(&arrayU16CompNo1[0], lengthEcmaStrU16CompNo1, ecmaVMPtr, true)); + JSHandle handleEcmaStrU16CompNo2( +- thread, EcmaString::CreateFromUtf16(&arrayU16CompNo2[0], lengthEcmaStrU16CompNo2, ecmaVMPtr, true)); ++ thread_, EcmaString::CreateFromUtf16(&arrayU16CompNo2[0], lengthEcmaStrU16CompNo2, ecmaVMPtr, true)); + JSHandle handleEcmaStrU16CompNo3( +- thread, EcmaString::CreateFromUtf16(&arrayU16CompNo3[0], lengthEcmaStrU16CompNo3, ecmaVMPtr, true)); ++ thread_, EcmaString::CreateFromUtf16(&arrayU16CompNo3[0], lengthEcmaStrU16CompNo3, ecmaVMPtr, true)); + EXPECT_EQ(handleEcmaStrU8No1->Compare(*handleEcmaStrU16CompNo1), 0); + EXPECT_EQ(handleEcmaStrU16CompNo1->Compare(*handleEcmaStrU8No1), 0); + EXPECT_EQ(handleEcmaStrU8No1->Compare(*handleEcmaStrU16CompNo2), -1); +@@ -401,7 +401,7 @@ TEST_F(EcmaStringTest, Compare_003) + */ + TEST_F(EcmaStringTest, Compare_004) + { +- EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); ++ EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); + + // Compare(). Between EcmaStrings made by CreateFromUtf16( , , , false). + uint16_t arrayU16NotCompNo1[] = {1, 23}; +@@ -411,11 +411,11 @@ TEST_F(EcmaStringTest, Compare_004) + uint32_t lengthEcmaStrU16NotCompNo2 = sizeof(arrayU16NotCompNo2) / sizeof(arrayU16NotCompNo2[0]); + uint32_t lengthEcmaStrU16NotCompNo3 = sizeof(arrayU16NotCompNo3) / sizeof(arrayU16NotCompNo3[0]); + JSHandle handleEcmaStrU16NotCompNo1( +- thread, EcmaString::CreateFromUtf16(&arrayU16NotCompNo1[0], lengthEcmaStrU16NotCompNo1, ecmaVMPtr, false)); ++ thread_, EcmaString::CreateFromUtf16(&arrayU16NotCompNo1[0], lengthEcmaStrU16NotCompNo1, ecmaVMPtr, false)); + JSHandle handleEcmaStrU16NotCompNo2( +- thread, EcmaString::CreateFromUtf16(&arrayU16NotCompNo2[0], lengthEcmaStrU16NotCompNo2, ecmaVMPtr, false)); ++ thread_, EcmaString::CreateFromUtf16(&arrayU16NotCompNo2[0], lengthEcmaStrU16NotCompNo2, ecmaVMPtr, false)); + JSHandle handleEcmaStrU16NotCompNo3( +- thread, EcmaString::CreateFromUtf16(&arrayU16NotCompNo3[0], lengthEcmaStrU16NotCompNo3, ecmaVMPtr, false)); ++ thread_, EcmaString::CreateFromUtf16(&arrayU16NotCompNo3[0], lengthEcmaStrU16NotCompNo3, ecmaVMPtr, false)); + EXPECT_EQ(handleEcmaStrU16NotCompNo1->Compare(*handleEcmaStrU16NotCompNo2), -1); + EXPECT_EQ(handleEcmaStrU16NotCompNo2->Compare(*handleEcmaStrU16NotCompNo1), 1); + EXPECT_EQ(handleEcmaStrU16NotCompNo2->Compare(*handleEcmaStrU16NotCompNo3), 49 - 456); +@@ -431,7 +431,7 @@ TEST_F(EcmaStringTest, Compare_004) + */ + TEST_F(EcmaStringTest, Compare_005) + { +- EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); ++ EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); + + // Compare(). EcmaString made by CreateFromUtf8() and EcmaString made by CreateFromUtf16( , , , false). + uint8_t arrayU8No1[3] = {1, 23}; +@@ -445,15 +445,15 @@ TEST_F(EcmaStringTest, Compare_005) + uint32_t lengthEcmaStrU16NotCompNo2 = sizeof(arrayU16NotCompNo2) / sizeof(arrayU16NotCompNo2[0]); + uint32_t lengthEcmaStrU16NotCompNo3 = sizeof(arrayU16NotCompNo3) / sizeof(arrayU16NotCompNo3[0]); + JSHandle handleEcmaStrU8No1( +- thread, EcmaString::CreateFromUtf8(&arrayU8No1[0], lengthEcmaStrU8No1, ecmaVMPtr, true)); ++ thread_, EcmaString::CreateFromUtf8(&arrayU8No1[0], lengthEcmaStrU8No1, ecmaVMPtr, true)); + JSHandle handleEcmaStrU8No2( +- thread, EcmaString::CreateFromUtf8(&arrayU8No2[0], lengthEcmaStrU8No2, ecmaVMPtr, true)); ++ thread_, EcmaString::CreateFromUtf8(&arrayU8No2[0], lengthEcmaStrU8No2, ecmaVMPtr, true)); + JSHandle handleEcmaStrU16NotCompNo1( +- thread, EcmaString::CreateFromUtf16(&arrayU16NotCompNo1[0], lengthEcmaStrU16NotCompNo1, ecmaVMPtr, false)); ++ thread_, EcmaString::CreateFromUtf16(&arrayU16NotCompNo1[0], lengthEcmaStrU16NotCompNo1, ecmaVMPtr, false)); + JSHandle handleEcmaStrU16NotCompNo2( +- thread, EcmaString::CreateFromUtf16(&arrayU16NotCompNo2[0], lengthEcmaStrU16NotCompNo2, ecmaVMPtr, false)); ++ thread_, EcmaString::CreateFromUtf16(&arrayU16NotCompNo2[0], lengthEcmaStrU16NotCompNo2, ecmaVMPtr, false)); + JSHandle handleEcmaStrU16NotCompNo3( +- thread, EcmaString::CreateFromUtf16(&arrayU16NotCompNo3[0], lengthEcmaStrU16NotCompNo3, ecmaVMPtr, false)); ++ thread_, EcmaString::CreateFromUtf16(&arrayU16NotCompNo3[0], lengthEcmaStrU16NotCompNo3, ecmaVMPtr, false)); + EXPECT_EQ(handleEcmaStrU8No1->Compare(*handleEcmaStrU16NotCompNo1), 0); + EXPECT_EQ(handleEcmaStrU16NotCompNo1->Compare(*handleEcmaStrU8No1), 0); + EXPECT_EQ(handleEcmaStrU8No1->Compare(*handleEcmaStrU16NotCompNo2), -1); +@@ -471,7 +471,7 @@ TEST_F(EcmaStringTest, Compare_005) + */ + TEST_F(EcmaStringTest, Compare_006) + { +- EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); ++ EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); + + // Compare(). EcmaString made by CreateFromUtf16( , , , true) and EcmaString made by CreateFromUtf16( , , , false). + uint16_t arrayU16CompNo1[] = {1, 23}; +@@ -485,15 +485,15 @@ TEST_F(EcmaStringTest, Compare_006) + uint32_t lengthEcmaStrU16NotCompNo2 = sizeof(arrayU16NotCompNo2) / sizeof(arrayU16NotCompNo2[0]); + uint32_t lengthEcmaStrU16NotCompNo3 = sizeof(arrayU16NotCompNo3) / sizeof(arrayU16NotCompNo3[0]); + JSHandle handleEcmaStrU16CompNo1( +- thread, EcmaString::CreateFromUtf16(&arrayU16CompNo1[0], lengthEcmaStrU16CompNo1, ecmaVMPtr, true)); ++ thread_, EcmaString::CreateFromUtf16(&arrayU16CompNo1[0], lengthEcmaStrU16CompNo1, ecmaVMPtr, true)); + JSHandle handleEcmaStrU16CompNo2( +- thread, EcmaString::CreateFromUtf16(&arrayU16CompNo2[0], lengthEcmaStrU16CompNo2, ecmaVMPtr, true)); ++ thread_, EcmaString::CreateFromUtf16(&arrayU16CompNo2[0], lengthEcmaStrU16CompNo2, ecmaVMPtr, true)); + JSHandle handleEcmaStrU16NotCompNo1( +- thread, EcmaString::CreateFromUtf16(&arrayU16NotCompNo1[0], lengthEcmaStrU16NotCompNo1, ecmaVMPtr, false)); ++ thread_, EcmaString::CreateFromUtf16(&arrayU16NotCompNo1[0], lengthEcmaStrU16NotCompNo1, ecmaVMPtr, false)); + JSHandle handleEcmaStrU16NotCompNo2( +- thread, EcmaString::CreateFromUtf16(&arrayU16NotCompNo2[0], lengthEcmaStrU16NotCompNo2, ecmaVMPtr, false)); ++ thread_, EcmaString::CreateFromUtf16(&arrayU16NotCompNo2[0], lengthEcmaStrU16NotCompNo2, ecmaVMPtr, false)); + JSHandle handleEcmaStrU16NotCompNo3( +- thread, EcmaString::CreateFromUtf16(&arrayU16NotCompNo3[0], lengthEcmaStrU16NotCompNo3, ecmaVMPtr, false)); ++ thread_, EcmaString::CreateFromUtf16(&arrayU16NotCompNo3[0], lengthEcmaStrU16NotCompNo3, ecmaVMPtr, false)); + EXPECT_EQ(handleEcmaStrU16CompNo1->Compare(*handleEcmaStrU16NotCompNo1), 0); + EXPECT_EQ(handleEcmaStrU16NotCompNo1->Compare(*handleEcmaStrU16CompNo1), 0); + EXPECT_EQ(handleEcmaStrU16CompNo1->Compare(*handleEcmaStrU16NotCompNo2), -1); +@@ -511,7 +511,7 @@ TEST_F(EcmaStringTest, Compare_006) + */ + TEST_F(EcmaStringTest, Concat_001) + { +- EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); ++ EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); + + // Concat(). EcmaString made by CreateFromUtf8() and EcmaString made by CreateFromUtf8(). + uint8_t arrayFrontU8[] = {"abcdef"}; +@@ -519,11 +519,11 @@ TEST_F(EcmaStringTest, Concat_001) + uint32_t lengthEcmaStrFrontU8 = sizeof(arrayFrontU8) - 1; + uint32_t lengthEcmaStrBackU8 = sizeof(arrayBackU8) - 1; + JSHandle handleEcmaStrFrontU8( +- thread, EcmaString::CreateFromUtf8(&arrayFrontU8[0], lengthEcmaStrFrontU8, ecmaVMPtr, true)); ++ thread_, EcmaString::CreateFromUtf8(&arrayFrontU8[0], lengthEcmaStrFrontU8, ecmaVMPtr, true)); + JSHandle handleEcmaStrBackU8( +- thread, EcmaString::CreateFromUtf8(&arrayBackU8[0], lengthEcmaStrBackU8, ecmaVMPtr, true)); ++ thread_, EcmaString::CreateFromUtf8(&arrayBackU8[0], lengthEcmaStrBackU8, ecmaVMPtr, true)); + JSHandle handleEcmaStrConcatU8( +- thread, EcmaString::Concat(handleEcmaStrFrontU8, handleEcmaStrBackU8, ecmaVMPtr)); ++ thread_, EcmaString::Concat(handleEcmaStrFrontU8, handleEcmaStrBackU8, ecmaVMPtr)); + EXPECT_TRUE(handleEcmaStrConcatU8->IsUtf8()); + for (size_t i = 0; i < lengthEcmaStrFrontU8; i++) { + EXPECT_EQ(handleEcmaStrConcatU8->At(i), arrayFrontU8[i]); +@@ -543,7 +543,7 @@ TEST_F(EcmaStringTest, Concat_001) + */ + TEST_F(EcmaStringTest, Concat_002) + { +- EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); ++ EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); + + // Concat(). EcmaString made by CreateFromUtf16( , , , false) and EcmaString made by CreateFromUtf16( , , , false). + uint16_t arrayFrontU16NotComp[] = {128, 129, 256, 11100, 65535, 100}; +@@ -551,11 +551,11 @@ TEST_F(EcmaStringTest, Concat_002) + uint32_t lengthEcmaStrFrontU16NotComp = sizeof(arrayFrontU16NotComp) / sizeof(arrayFrontU16NotComp[0]); + uint32_t lengthEcmaStrBackU16NotComp = sizeof(arrayBackU16NotComp) / sizeof(arrayBackU16NotComp[0]); + JSHandle handleEcmaStrFrontU16NotComp( +- thread, EcmaString::CreateFromUtf16(&arrayFrontU16NotComp[0], lengthEcmaStrFrontU16NotComp, ecmaVMPtr, false)); ++ thread_, EcmaString::CreateFromUtf16(&arrayFrontU16NotComp[0], lengthEcmaStrFrontU16NotComp, ecmaVMPtr, false)); + JSHandle handleEcmaStrBackU16NotComp( +- thread, EcmaString::CreateFromUtf16(&arrayBackU16NotComp[0], lengthEcmaStrBackU16NotComp, ecmaVMPtr, false)); ++ thread_, EcmaString::CreateFromUtf16(&arrayBackU16NotComp[0], lengthEcmaStrBackU16NotComp, ecmaVMPtr, false)); + JSHandle handleEcmaStrConcatU16NotComp( +- thread, EcmaString::Concat(handleEcmaStrFrontU16NotComp, handleEcmaStrBackU16NotComp, ecmaVMPtr)); ++ thread_, EcmaString::Concat(handleEcmaStrFrontU16NotComp, handleEcmaStrBackU16NotComp, ecmaVMPtr)); + EXPECT_TRUE(handleEcmaStrConcatU16NotComp->IsUtf16()); + for (size_t i = 0; i < lengthEcmaStrFrontU16NotComp; i++) { + EXPECT_EQ(handleEcmaStrConcatU16NotComp->At(i), arrayFrontU16NotComp[i]); +@@ -575,7 +575,7 @@ TEST_F(EcmaStringTest, Concat_002) + */ + TEST_F(EcmaStringTest, Concat_003) + { +- EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); ++ EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); + + // Concat(). EcmaString made by CreateFromUtf8() and EcmaString made by CreateFromUtf16( , , , false). + uint8_t arrayFrontU8[] = {"abcdef"}; +@@ -583,11 +583,11 @@ TEST_F(EcmaStringTest, Concat_003) + uint32_t lengthEcmaStrFrontU8 = sizeof(arrayFrontU8) - 1; + uint32_t lengthEcmaStrBackU16NotComp = sizeof(arrayBackU16NotComp) / sizeof(arrayBackU16NotComp[0]); + JSHandle handleEcmaStrFrontU8( +- thread, EcmaString::CreateFromUtf8(&arrayFrontU8[0], lengthEcmaStrFrontU8, ecmaVMPtr, true)); ++ thread_, EcmaString::CreateFromUtf8(&arrayFrontU8[0], lengthEcmaStrFrontU8, ecmaVMPtr, true)); + JSHandle handleEcmaStrBackU16NotComp( +- thread, EcmaString::CreateFromUtf16(&arrayBackU16NotComp[0], lengthEcmaStrBackU16NotComp, ecmaVMPtr, false)); ++ thread_, EcmaString::CreateFromUtf16(&arrayBackU16NotComp[0], lengthEcmaStrBackU16NotComp, ecmaVMPtr, false)); + JSHandle handleEcmaStrConcatU8U16NotComp( +- thread, EcmaString::Concat(handleEcmaStrFrontU8, handleEcmaStrBackU16NotComp, ecmaVMPtr)); ++ thread_, EcmaString::Concat(handleEcmaStrFrontU8, handleEcmaStrBackU16NotComp, ecmaVMPtr)); + EXPECT_TRUE(handleEcmaStrConcatU8U16NotComp->IsUtf16()); + for (size_t i = 0; i < lengthEcmaStrFrontU8; i++) { + EXPECT_EQ(handleEcmaStrConcatU8U16NotComp->At(i), arrayFrontU8[i]); +@@ -608,7 +608,7 @@ TEST_F(EcmaStringTest, Concat_003) + */ + TEST_F(EcmaStringTest, Concat_004) + { +- EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); ++ EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); + + /* Concat() after SetCompressedStringsEnabled(false). EcmaString made by CreateFromUtf16( , , , false) and + * EcmaString made by CreateFromUtf16( , , , false). +@@ -619,11 +619,11 @@ TEST_F(EcmaStringTest, Concat_004) + uint32_t lengthEcmaStrFrontU16NotComp = sizeof(arrayFrontU16NotComp) / sizeof(arrayFrontU16NotComp[0]); + uint32_t lengthEcmaStrBackU16NotComp = sizeof(arrayBackU16NotComp) / sizeof(arrayBackU16NotComp[0]); + JSHandle handleEcmaStrFrontU16NotComp( +- thread, EcmaString::CreateFromUtf16(&arrayFrontU16NotComp[0], lengthEcmaStrFrontU16NotComp, ecmaVMPtr, false)); ++ thread_, EcmaString::CreateFromUtf16(&arrayFrontU16NotComp[0], lengthEcmaStrFrontU16NotComp, ecmaVMPtr, false)); + JSHandle handleEcmaStrBackU16NotComp( +- thread, EcmaString::CreateFromUtf16(&arrayBackU16NotComp[0], lengthEcmaStrBackU16NotComp, ecmaVMPtr, false)); ++ thread_, EcmaString::CreateFromUtf16(&arrayBackU16NotComp[0], lengthEcmaStrBackU16NotComp, ecmaVMPtr, false)); + JSHandle handleEcmaStrConcatU16NotCompAfterSetFalse( +- thread, EcmaString::Concat(handleEcmaStrFrontU16NotComp, handleEcmaStrBackU16NotComp, ecmaVMPtr)); ++ thread_, EcmaString::Concat(handleEcmaStrFrontU16NotComp, handleEcmaStrBackU16NotComp, ecmaVMPtr)); + EXPECT_TRUE(handleEcmaStrConcatU16NotCompAfterSetFalse->IsUtf16()); + for (size_t i = 0; i < lengthEcmaStrFrontU16NotComp; i++) { + EXPECT_EQ(handleEcmaStrConcatU16NotCompAfterSetFalse->At(i), arrayFrontU16NotComp[i]); +@@ -646,17 +646,17 @@ TEST_F(EcmaStringTest, Concat_004) + */ + TEST_F(EcmaStringTest, FastSubString_001) + { +- EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); ++ EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); + + // FastSubString(). From EcmaString made by CreateFromUtf8(). + uint8_t arrayU8[6] = {3, 7, 19, 54, 99}; + uint32_t lengthEcmaStrU8 = sizeof(arrayU8) - 1; +- JSHandle handleEcmaStrU8(thread, ++ JSHandle handleEcmaStrU8(thread_, + EcmaString::CreateFromUtf8(&arrayU8[0], lengthEcmaStrU8, ecmaVMPtr, true)); + uint32_t indexStartSubU8 = 2; + uint32_t lengthSubU8 = 2; + JSHandle handleEcmaStrSubU8( +- thread, EcmaString::FastSubString(handleEcmaStrU8, indexStartSubU8, lengthSubU8, ecmaVMPtr)); ++ thread_, EcmaString::FastSubString(handleEcmaStrU8, indexStartSubU8, lengthSubU8, ecmaVMPtr)); + for (size_t i = 0; i < lengthSubU8; i++) { + EXPECT_EQ(handleEcmaStrSubU8->At(i), handleEcmaStrU8->At(i + indexStartSubU8)); + } +@@ -672,17 +672,17 @@ TEST_F(EcmaStringTest, FastSubString_001) + */ + TEST_F(EcmaStringTest, FastSubString_002) + { +- EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); ++ EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); + + // FastSubString(). From EcmaString made by CreateFromUtf16( , , , true). + uint16_t arrayU16Comp[] = {1, 12, 34, 56, 127}; + uint32_t lengthEcmaStrU16Comp = sizeof(arrayU16Comp) / sizeof(arrayU16Comp[0]); + JSHandle handleEcmaStrU16Comp( +- thread, EcmaString::CreateFromUtf16(&arrayU16Comp[0], lengthEcmaStrU16Comp, ecmaVMPtr, true)); ++ thread_, EcmaString::CreateFromUtf16(&arrayU16Comp[0], lengthEcmaStrU16Comp, ecmaVMPtr, true)); + uint32_t indexStartSubU16Comp = 0; + uint32_t lengthSubU16Comp = 2; + JSHandle handleEcmaStrSubU16Comp( +- thread, EcmaString::FastSubString(handleEcmaStrU16Comp, indexStartSubU16Comp, lengthSubU16Comp, ecmaVMPtr)); ++ thread_, EcmaString::FastSubString(handleEcmaStrU16Comp, indexStartSubU16Comp, lengthSubU16Comp, ecmaVMPtr)); + for (size_t i = 0; i < lengthSubU16Comp; i++) { + EXPECT_EQ(handleEcmaStrSubU16Comp->At(i), handleEcmaStrU16Comp->At(i + indexStartSubU16Comp)); + } +@@ -698,17 +698,17 @@ TEST_F(EcmaStringTest, FastSubString_002) + */ + TEST_F(EcmaStringTest, FastSubString_003) + { +- EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); ++ EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); + + // FastSubString(). From EcmaString made by CreateFromUtf16( , , , false). + uint16_t arrayU16NotComp[] = {19, 54, 256, 11100, 65535}; + uint32_t lengthEcmaStrU16NotComp = sizeof(arrayU16NotComp) / sizeof(arrayU16NotComp[0]); + JSHandle handleEcmaStrU16NotComp( +- thread, EcmaString::CreateFromUtf16(&arrayU16NotComp[0], lengthEcmaStrU16NotComp, ecmaVMPtr, false)); ++ thread_, EcmaString::CreateFromUtf16(&arrayU16NotComp[0], lengthEcmaStrU16NotComp, ecmaVMPtr, false)); + uint32_t indexStartSubU16NotComp = 0; + uint32_t lengthSubU16NotComp = 2; + JSHandle handleEcmaStrSubU16NotComp( +- thread, ++ thread_, + EcmaString::FastSubString(handleEcmaStrU16NotComp, indexStartSubU16NotComp, lengthSubU16NotComp, ecmaVMPtr)); + for (size_t i = 0; i < lengthSubU16NotComp; i++) { + EXPECT_EQ(handleEcmaStrSubU16NotComp->At(i), handleEcmaStrU16NotComp->At(i + indexStartSubU16NotComp)); +@@ -725,16 +725,16 @@ TEST_F(EcmaStringTest, FastSubString_003) + */ + TEST_F(EcmaStringTest, WriteData_001) + { +- EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); ++ EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); + + // WriteData(). From EcmaString made by CreateFromUtf8() to EcmaString made by AllocStringObject( , true, ). + uint8_t arrayU8WriteFrom[6] = {1, 12, 34, 56, 127}; + uint32_t lengthEcmaStrU8WriteFrom = sizeof(arrayU8WriteFrom) - 1; + JSHandle handleEcmaStrU8WriteFrom( +- thread, EcmaString::CreateFromUtf8(&arrayU8WriteFrom[0], lengthEcmaStrU8WriteFrom, ecmaVMPtr, true)); ++ thread_, EcmaString::CreateFromUtf8(&arrayU8WriteFrom[0], lengthEcmaStrU8WriteFrom, ecmaVMPtr, true)); + size_t sizeEcmaStrU8WriteTo = 5; + JSHandle handleEcmaStrAllocTrueWriteTo( +- thread, EcmaString::AllocStringObject(sizeEcmaStrU8WriteTo, true, ecmaVMPtr)); ++ thread_, EcmaString::AllocStringObject(sizeEcmaStrU8WriteTo, true, ecmaVMPtr)); + uint32_t indexStartWriteFromArrayU8 = 2; + uint32_t lengthWriteFromArrayU8 = 2; + handleEcmaStrAllocTrueWriteTo->WriteData(*handleEcmaStrU8WriteFrom, indexStartWriteFromArrayU8, +@@ -753,13 +753,13 @@ TEST_F(EcmaStringTest, WriteData_001) + */ + TEST_F(EcmaStringTest, WriteData_002) + { +- EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); ++ EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); + + // WriteData(). From char to EcmaString made by AllocStringObject( , true, ). + char u8Write = 'a'; + size_t sizeEcmaStrU8WriteTo = 5; + JSHandle handleEcmaStrAllocTrueWriteTo( +- thread, EcmaString::AllocStringObject(sizeEcmaStrU8WriteTo, true, ecmaVMPtr)); ++ thread_, EcmaString::AllocStringObject(sizeEcmaStrU8WriteTo, true, ecmaVMPtr)); + uint32_t indexAtWriteFromU8 = 4; + handleEcmaStrAllocTrueWriteTo->WriteData(u8Write, indexAtWriteFromU8); + EXPECT_EQ(handleEcmaStrAllocTrueWriteTo->At(indexAtWriteFromU8), u8Write); +@@ -774,7 +774,7 @@ TEST_F(EcmaStringTest, WriteData_002) + */ + TEST_F(EcmaStringTest, WriteData_003) + { +- EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); ++ EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); + + /* WriteData(). From EcmaString made by CreateFromUtf16( , , , false) to EcmaStringU16 made by + * AllocStringObject( , false, ). +@@ -782,10 +782,10 @@ TEST_F(EcmaStringTest, WriteData_003) + uint16_t arrayU16WriteFrom[10] = {67, 777, 1999, 1, 45, 66, 23456, 65535, 127, 333}; + uint32_t lengthEcmaStrU16WriteFrom = sizeof(arrayU16WriteFrom) / sizeof(arrayU16WriteFrom[0]); + JSHandle handleEcmaStrU16WriteFrom( +- thread, EcmaString::CreateFromUtf16(&arrayU16WriteFrom[0], lengthEcmaStrU16WriteFrom, ecmaVMPtr, false)); ++ thread_, EcmaString::CreateFromUtf16(&arrayU16WriteFrom[0], lengthEcmaStrU16WriteFrom, ecmaVMPtr, false)); + size_t sizeEcmaStrU16WriteTo = 10; + JSHandle handleEcmaStrU16WriteTo( +- thread, EcmaString::AllocStringObject(sizeEcmaStrU16WriteTo, false, ecmaVMPtr)); ++ thread_, EcmaString::AllocStringObject(sizeEcmaStrU16WriteTo, false, ecmaVMPtr)); + uint32_t indexStartWriteFromArrayU16 = 3; + uint32_t numBytesWriteFromArrayU16 = 2 * 3; + handleEcmaStrU16WriteTo->WriteData(*handleEcmaStrU16WriteFrom, indexStartWriteFromArrayU16, sizeEcmaStrU16WriteTo, +@@ -804,16 +804,16 @@ TEST_F(EcmaStringTest, WriteData_003) + */ + TEST_F(EcmaStringTest, WriteData_004) + { +- EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); ++ EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); + + // WriteData(). From EcmaString made by CreateFromUtf8() to EcmaString made by AllocStringObject( , false, ). + uint8_t arrayU8WriteFrom[6] = {1, 12, 34, 56, 127}; + uint32_t lengthEcmaStrU8WriteFrom = sizeof(arrayU8WriteFrom) - 1; + JSHandle handleEcmaStrU8WriteFrom( +- thread, EcmaString::CreateFromUtf8(&arrayU8WriteFrom[0], lengthEcmaStrU8WriteFrom, ecmaVMPtr, true)); ++ thread_, EcmaString::CreateFromUtf8(&arrayU8WriteFrom[0], lengthEcmaStrU8WriteFrom, ecmaVMPtr, true)); + size_t sizeEcmaStrU16WriteTo = 10; + JSHandle handleEcmaStrU16WriteTo( +- thread, EcmaString::AllocStringObject(sizeEcmaStrU16WriteTo, false, ecmaVMPtr)); ++ thread_, EcmaString::AllocStringObject(sizeEcmaStrU16WriteTo, false, ecmaVMPtr)); + uint32_t indexStartWriteFromU8ToU16 = 1; + uint32_t numBytesWriteFromU8ToU16 = 4; + handleEcmaStrU16WriteTo->WriteData(*handleEcmaStrU8WriteFrom, indexStartWriteFromU8ToU16, sizeEcmaStrU16WriteTo, +@@ -832,12 +832,12 @@ TEST_F(EcmaStringTest, WriteData_004) + */ + TEST_F(EcmaStringTest, WriteData_005) + { +- EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); ++ EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); + + // WriteData(). From char to EcmaString made by AllocStringObject( , false, ). + size_t sizeEcmaStrU16WriteTo = 10; + JSHandle handleEcmaStrU16WriteTo( +- thread, EcmaString::AllocStringObject(sizeEcmaStrU16WriteTo, false, ecmaVMPtr)); ++ thread_, EcmaString::AllocStringObject(sizeEcmaStrU16WriteTo, false, ecmaVMPtr)); + char u8Write = 'a'; + uint32_t indexAt = 4; + handleEcmaStrU16WriteTo->WriteData(u8Write, indexAt); +@@ -852,19 +852,19 @@ TEST_F(EcmaStringTest, WriteData_005) + */ + TEST_F(EcmaStringTest, GetUtf8Length) + { +- EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); ++ EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); + uint8_t arrayU8[6] = {3, 7, 19, 54, 99}; + uint16_t arrayU16Comp[] = {1, 12, 34, 56, 127}; + uint16_t arrayU16NotComp[] = {19, 54, 256, 11100, 65535}; + uint32_t lengthEcmaStrU8 = sizeof(arrayU8) - 1; + uint32_t lengthEcmaStrU16Comp = sizeof(arrayU16Comp) / sizeof(arrayU16Comp[0]); + uint32_t lengthEcmaStrU16NotComp = sizeof(arrayU16NotComp) / sizeof(arrayU16NotComp[0]); +- JSHandle handleEcmaStrU8(thread, ++ JSHandle handleEcmaStrU8(thread_, + EcmaString::CreateFromUtf8(&arrayU8[0], lengthEcmaStrU8, ecmaVMPtr, true)); + JSHandle handleEcmaStrU16Comp( +- thread, EcmaString::CreateFromUtf16(&arrayU16Comp[0], lengthEcmaStrU16Comp, ecmaVMPtr, true)); ++ thread_, EcmaString::CreateFromUtf16(&arrayU16Comp[0], lengthEcmaStrU16Comp, ecmaVMPtr, true)); + JSHandle handleEcmaStrU16NotComp( +- thread, EcmaString::CreateFromUtf16(&arrayU16NotComp[0], lengthEcmaStrU16NotComp, ecmaVMPtr, false)); ++ thread_, EcmaString::CreateFromUtf16(&arrayU16NotComp[0], lengthEcmaStrU16NotComp, ecmaVMPtr, false)); + EXPECT_EQ(handleEcmaStrU8->GetUtf8Length(), lengthEcmaStrU8 + 1); + EXPECT_EQ(handleEcmaStrU16Comp->GetUtf8Length(), lengthEcmaStrU16Comp + 1); + EXPECT_EQ(handleEcmaStrU16NotComp->GetUtf8Length(), 2 * lengthEcmaStrU16NotComp + 1); +@@ -878,7 +878,7 @@ TEST_F(EcmaStringTest, GetUtf8Length) + */ + TEST_F(EcmaStringTest, GetUtf16Length) + { +- EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); ++ EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); + + uint8_t arrayU8[6] = {3, 7, 19, 54, 99}; + uint16_t arrayU16Comp[] = {1, 12, 34, 56, 127}; +@@ -886,12 +886,12 @@ TEST_F(EcmaStringTest, GetUtf16Length) + uint32_t lengthEcmaStrU8 = sizeof(arrayU8) - 1; + uint32_t lengthEcmaStrU16Comp = sizeof(arrayU16Comp) / sizeof(arrayU16Comp[0]); + uint32_t lengthEcmaStrU16NotComp = sizeof(arrayU16NotComp) / sizeof(arrayU16NotComp[0]); +- JSHandle handleEcmaStrU8(thread, ++ JSHandle handleEcmaStrU8(thread_, + EcmaString::CreateFromUtf8(&arrayU8[0], lengthEcmaStrU8, ecmaVMPtr, true)); + JSHandle handleEcmaStrU16Comp( +- thread, EcmaString::CreateFromUtf16(&arrayU16Comp[0], lengthEcmaStrU16Comp, ecmaVMPtr, true)); ++ thread_, EcmaString::CreateFromUtf16(&arrayU16Comp[0], lengthEcmaStrU16Comp, ecmaVMPtr, true)); + JSHandle handleEcmaStrU16NotComp( +- thread, EcmaString::CreateFromUtf16(&arrayU16NotComp[0], lengthEcmaStrU16NotComp, ecmaVMPtr, false)); ++ thread_, EcmaString::CreateFromUtf16(&arrayU16NotComp[0], lengthEcmaStrU16NotComp, ecmaVMPtr, false)); + EXPECT_EQ(handleEcmaStrU8->GetUtf16Length(), lengthEcmaStrU8); + EXPECT_EQ(handleEcmaStrU16Comp->GetUtf16Length(), lengthEcmaStrU16Comp); + EXPECT_EQ(handleEcmaStrU16NotComp->GetUtf16Length(), lengthEcmaStrU16NotComp); +@@ -905,12 +905,12 @@ TEST_F(EcmaStringTest, GetUtf16Length) + */ + TEST_F(EcmaStringTest, GetDataUtf8) + { +- EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); ++ EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); + + // From EcmaString made by CreateFromUtf8(). + uint8_t arrayU8[] = {"abcde"}; + uint32_t lengthEcmaStrU8 = sizeof(arrayU8) - 1; +- JSHandle handleEcmaStrU8(thread, ++ JSHandle handleEcmaStrU8(thread_, + EcmaString::CreateFromUtf8(&arrayU8[0], lengthEcmaStrU8, ecmaVMPtr, true)); + for (size_t i = 0; i < lengthEcmaStrU8; i++) { + EXPECT_EQ(*(handleEcmaStrU8->GetDataUtf8() + i), arrayU8[i]); +@@ -920,7 +920,7 @@ TEST_F(EcmaStringTest, GetDataUtf8) + uint16_t arrayU16Comp[] = {3, 1, 34, 123, 127, 111, 42, 3, 20, 10}; + uint32_t lengthEcmaStrU16Comp = sizeof(arrayU16Comp) / sizeof(arrayU16Comp[0]); + JSHandle handleEcmaStrU16Comp( +- thread, EcmaString::CreateFromUtf16(&arrayU16Comp[0], lengthEcmaStrU16Comp, ecmaVMPtr, true)); ++ thread_, EcmaString::CreateFromUtf16(&arrayU16Comp[0], lengthEcmaStrU16Comp, ecmaVMPtr, true)); + for (size_t i = 0; i < sizeof(arrayU16Comp) / arrayU16Comp[0]; i++) { + EXPECT_EQ(*(handleEcmaStrU16Comp->GetDataUtf8() + i), arrayU16Comp[i]); + } +@@ -934,13 +934,13 @@ TEST_F(EcmaStringTest, GetDataUtf8) + */ + TEST_F(EcmaStringTest, GetDataUtf16) + { +- EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); ++ EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); + + // From EcmaString made by CreateFromUtf16( , , , false). + uint16_t arrayU16NotComp[] = {67, 777, 1999, 1, 45, 66, 23456, 65535, 127, 333}; + uint32_t lengthEcmaStrU16NotComp = sizeof(arrayU16NotComp) / sizeof(arrayU16NotComp[0]); + JSHandle handleEcmaStrU16NotComp( +- thread, EcmaString::CreateFromUtf16(&arrayU16NotComp[0], lengthEcmaStrU16NotComp, ecmaVMPtr, false)); ++ thread_, EcmaString::CreateFromUtf16(&arrayU16NotComp[0], lengthEcmaStrU16NotComp, ecmaVMPtr, false)); + for (size_t i = 0; i < lengthEcmaStrU16NotComp; i++) { + EXPECT_EQ(*(handleEcmaStrU16NotComp->GetDataUtf16() + i), arrayU16NotComp[i]); + } +@@ -955,13 +955,13 @@ TEST_F(EcmaStringTest, GetDataUtf16) + */ + TEST_F(EcmaStringTest, CopyDataRegionUtf8) + { +- EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); ++ EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); + + // CopyDataRegionUtf8(). From EcmaString made by CreateFromUtf8(). + uint8_t arrayU8CopyFrom[6] = {1, 12, 34, 56, 127}; + uint32_t lengthEcmaStrU8CopyFrom = sizeof(arrayU8CopyFrom) - 1; + JSHandle handleEcmaStrU8CopyFrom( +- thread, EcmaString::CreateFromUtf8(&arrayU8CopyFrom[0], lengthEcmaStrU8CopyFrom, ecmaVMPtr, true)); ++ thread_, EcmaString::CreateFromUtf8(&arrayU8CopyFrom[0], lengthEcmaStrU8CopyFrom, ecmaVMPtr, true)); + const size_t lengthArrayU8Target = 7; + uint8_t defaultByteForU8CopyTo = 1; + uint8_t arrayU8CopyTo[lengthArrayU8Target]; +@@ -984,7 +984,7 @@ TEST_F(EcmaStringTest, CopyDataRegionUtf8) + uint16_t arrayU16CompCopyFrom[] = {1, 12, 34, 56, 127}; + uint32_t lengthEcmaStrU16CompCopyFrom = sizeof(arrayU16CompCopyFrom) / sizeof(arrayU16CompCopyFrom[0]); + JSHandle handleEcmaStrU16CompCopyFrom( +- thread, EcmaString::CreateFromUtf16(&arrayU16CompCopyFrom[0], lengthEcmaStrU16CompCopyFrom, ecmaVMPtr, true)); ++ thread_, EcmaString::CreateFromUtf16(&arrayU16CompCopyFrom[0], lengthEcmaStrU16CompCopyFrom, ecmaVMPtr, true)); + const size_t lengthArrayU16Target = 8; + uint8_t defaultByteForU16CompCopyTo = 1; + uint8_t arrayU16CompCopyTo[lengthArrayU16Target]; +@@ -1013,13 +1013,13 @@ TEST_F(EcmaStringTest, CopyDataRegionUtf8) + */ + TEST_F(EcmaStringTest, CopyDataUtf8) + { +- EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); ++ EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); + + // CopyDataUtf8(). From EcmaString made by CreateFromUtf8(). + uint8_t arrayU8CopyFrom[6] = {1, 12, 34, 56, 127}; + uint32_t lengthEcmaStrU8CopyFrom = sizeof(arrayU8CopyFrom) - 1; + JSHandle handleEcmaStrU8CopyFrom( +- thread, EcmaString::CreateFromUtf8(&arrayU8CopyFrom[0], lengthEcmaStrU8CopyFrom, ecmaVMPtr, true)); ++ thread_, EcmaString::CreateFromUtf8(&arrayU8CopyFrom[0], lengthEcmaStrU8CopyFrom, ecmaVMPtr, true)); + const size_t lengthArrayU8Target = 6; + uint8_t arrayU8CopyTo[lengthArrayU8Target]; + +@@ -1035,7 +1035,7 @@ TEST_F(EcmaStringTest, CopyDataUtf8) + uint16_t arrayU16CompCopyFrom[] = {1, 12, 34, 56, 127}; + uint32_t lengthEcmaStrU16CompCopyFrom = sizeof(arrayU16CompCopyFrom) / sizeof(arrayU16CompCopyFrom[0]); + JSHandle handleEcmaStrU16CompCopyFrom( +- thread, EcmaString::CreateFromUtf16(&arrayU16CompCopyFrom[0], lengthEcmaStrU16CompCopyFrom, ecmaVMPtr, true)); ++ thread_, EcmaString::CreateFromUtf16(&arrayU16CompCopyFrom[0], lengthEcmaStrU16CompCopyFrom, ecmaVMPtr, true)); + const size_t lengthArrayU16Target = 6; + uint8_t arrayU8CompCopyTo[lengthArrayU16Target]; + +@@ -1058,13 +1058,13 @@ TEST_F(EcmaStringTest, CopyDataUtf8) + */ + TEST_F(EcmaStringTest, CopyDataRegionUtf16) + { +- EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); ++ EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); + + // CopyDataRegionUtf16(). From EcmaString made by CreateFromUtf16( , , , false). + uint16_t arrayU16NotCompCopyFrom[10] = {67, 777, 1999, 1, 45, 66, 23456, 65535, 127, 333}; + uint32_t lengthEcmaStrU16NotCompCopyFrom = sizeof(arrayU16NotCompCopyFrom) / sizeof(arrayU16NotCompCopyFrom[0]); + JSHandle handleEcmaStrU16NotCompCopyFrom( +- thread, ++ thread_, + EcmaString::CreateFromUtf16(&arrayU16NotCompCopyFrom[0], lengthEcmaStrU16NotCompCopyFrom, ecmaVMPtr, false)); + const size_t lengthArrayU16Target = 13; + uint16_t arrayU16NotCompCopyTo[lengthArrayU16Target]; +@@ -1095,13 +1095,13 @@ TEST_F(EcmaStringTest, CopyDataRegionUtf16) + */ + TEST_F(EcmaStringTest, CopyDataUtf16) + { +- EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); ++ EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); + + // CopyDataUtf16(). From EcmaString made by CreateFromUtf16( , , , false). + uint16_t arrayU16NotCompCopyFrom[10] = {67, 777, 1999, 1, 45, 66, 23456, 65535, 127, 333}; + uint32_t lengthEcmaStrU16NotCompCopyFrom = sizeof(arrayU16NotCompCopyFrom) / sizeof(arrayU16NotCompCopyFrom[0]); + JSHandle handleEcmaStrU16NotCompCopyFrom( +- thread, ++ thread_, + EcmaString::CreateFromUtf16(&arrayU16NotCompCopyFrom[0], lengthEcmaStrU16NotCompCopyFrom, ecmaVMPtr, false)); + const size_t lengthArrayU16Target = 13; + uint16_t arrayU16NotCompCopyTo[lengthArrayU16Target]; +@@ -1130,7 +1130,7 @@ TEST_F(EcmaStringTest, CopyDataUtf16) + */ + TEST_F(EcmaStringTest, IndexOf_001) + { +- EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); ++ EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); + + // IndexOf(). Find EcmaString made by CreateFromUtf8() From EcmaString made by CreateFromUtf8(). + uint8_t arrayU8From[7] = {23, 25, 1, 3, 39, 80}; +@@ -1138,9 +1138,9 @@ TEST_F(EcmaStringTest, IndexOf_001) + uint32_t lengthEcmaStrU8From = sizeof(arrayU8From) - 1; + uint32_t lengthEcmaStrU8Target = sizeof(arrayU8Target) - 1; + JSHandle handleEcmaStr( +- thread, EcmaString::CreateFromUtf8(&arrayU8From[0], lengthEcmaStrU8From, ecmaVMPtr, true)); ++ thread_, EcmaString::CreateFromUtf8(&arrayU8From[0], lengthEcmaStrU8From, ecmaVMPtr, true)); + JSHandle handleEcmaStr1( +- thread, EcmaString::CreateFromUtf8(&arrayU8Target[0], lengthEcmaStrU8Target, ecmaVMPtr, true)); ++ thread_, EcmaString::CreateFromUtf8(&arrayU8Target[0], lengthEcmaStrU8Target, ecmaVMPtr, true)); + int32_t posStart = 0; + EXPECT_EQ(handleEcmaStr->IndexOf(*handleEcmaStr1, posStart), 2); + EXPECT_EQ(handleEcmaStr1->IndexOf(*handleEcmaStr, posStart), -1); +@@ -1163,7 +1163,7 @@ TEST_F(EcmaStringTest, IndexOf_001) + */ + TEST_F(EcmaStringTest, IndexOf_002) + { +- EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); ++ EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); + + // IndexOf(). Find EcmaString made by CreateFromUtf8() From EcmaString made by CreateFromUtf16( , , , false). + uint8_t arrayU8Target[4] = {1, 3, 39}; +@@ -1171,9 +1171,9 @@ TEST_F(EcmaStringTest, IndexOf_002) + uint32_t lengthEcmaStrU8Target = sizeof(arrayU8Target) - 1; + uint32_t lengthEcmaStrU16NotCompFromNo1 = sizeof(arrayU16NotCompFromNo1) / sizeof(arrayU16NotCompFromNo1[0]); + JSHandle handleEcmaStr( +- thread, EcmaString::CreateFromUtf8(&arrayU8Target[0], lengthEcmaStrU8Target, ecmaVMPtr, true)); ++ thread_, EcmaString::CreateFromUtf8(&arrayU8Target[0], lengthEcmaStrU8Target, ecmaVMPtr, true)); + JSHandle handleEcmaStr1( +- thread, ++ thread_, + EcmaString::CreateFromUtf16(&arrayU16NotCompFromNo1[0], lengthEcmaStrU16NotCompFromNo1, ecmaVMPtr, false)); + int32_t posStart = 0; + EXPECT_EQ(handleEcmaStr1->IndexOf(*handleEcmaStr, posStart), 6); +@@ -1197,7 +1197,7 @@ TEST_F(EcmaStringTest, IndexOf_002) + */ + TEST_F(EcmaStringTest, IndexOf_003) + { +- EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); ++ EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); + + /* IndexOf(). Find EcmaString made by CreateFromUtf16( , , , false) From EcmaString made by + * CreateFromUtf16( , , , false). +@@ -1207,10 +1207,10 @@ TEST_F(EcmaStringTest, IndexOf_003) + uint32_t lengthEcmaStrU16NotCompTarget = sizeof(arrayU16NotCompTarget) / sizeof(arrayU16NotCompTarget[0]); + uint32_t lengthEcmaStrU16NotCompFrom = sizeof(arrayU16NotCompFrom) / sizeof(arrayU16NotCompFrom[0]); + JSHandle handleEcmaStrU16NotCompTarget( +- thread, ++ thread_, + EcmaString::CreateFromUtf16(&arrayU16NotCompTarget[0], lengthEcmaStrU16NotCompTarget, ecmaVMPtr, false)); + JSHandle handleEcmaStrU16NotCompFrom( +- thread, EcmaString::CreateFromUtf16(&arrayU16NotCompFrom[0], lengthEcmaStrU16NotCompFrom, ecmaVMPtr, false)); ++ thread_, EcmaString::CreateFromUtf16(&arrayU16NotCompFrom[0], lengthEcmaStrU16NotCompFrom, ecmaVMPtr, false)); + int32_t posStart = 0; + EXPECT_EQ(handleEcmaStrU16NotCompFrom->IndexOf(*handleEcmaStrU16NotCompTarget, posStart), 4); + EXPECT_EQ(handleEcmaStrU16NotCompTarget->IndexOf(*handleEcmaStrU16NotCompFrom, posStart), -1); +@@ -1233,7 +1233,7 @@ TEST_F(EcmaStringTest, IndexOf_003) + */ + TEST_F(EcmaStringTest, IndexOf_004) + { +- EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); ++ EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); + + // IndexOf(). Find EcmaString made by CreateFromUtf16( , , , false) From EcmaString made by CreateFromUtf8(). + uint16_t ecmaStrU16NotCompTarget[] = {3, 39, 80}; +@@ -1241,10 +1241,10 @@ TEST_F(EcmaStringTest, IndexOf_004) + uint32_t lengthEcmaStrU16NotCompTarget = sizeof(ecmaStrU16NotCompTarget) / sizeof(ecmaStrU16NotCompTarget[0]); + uint32_t lengthEcmaStrU8From = sizeof(arrayU8From) - 1; + JSHandle handleEcmaStrU16NotCompTarget( +- thread, ++ thread_, + EcmaString::CreateFromUtf16(&ecmaStrU16NotCompTarget[0], lengthEcmaStrU16NotCompTarget, ecmaVMPtr, false)); + JSHandle handleEcmaStrU8From( +- thread, EcmaString::CreateFromUtf8(&arrayU8From[0], lengthEcmaStrU8From, ecmaVMPtr, true)); ++ thread_, EcmaString::CreateFromUtf8(&arrayU8From[0], lengthEcmaStrU8From, ecmaVMPtr, true)); + int32_t posStart = 0; + EXPECT_EQ(handleEcmaStrU8From->IndexOf(*handleEcmaStrU16NotCompTarget, posStart), 3); + EXPECT_EQ(handleEcmaStrU16NotCompTarget->IndexOf(*handleEcmaStrU8From, posStart), -1); +@@ -1267,7 +1267,7 @@ TEST_F(EcmaStringTest, IndexOf_004) + */ + TEST_F(EcmaStringTest, StringsAreEqual_001) + { +- EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); ++ EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); + + // StringsAreEqual(). + uint8_t arrayU8No1[4] = {45, 92, 78}; +@@ -1277,11 +1277,11 @@ TEST_F(EcmaStringTest, StringsAreEqual_001) + uint32_t lengthEcmaStrU8No2 = sizeof(arrayU8No2) - 1; + uint32_t lengthEcmaStrU8No3 = sizeof(arrayU8No3) - 1; + JSHandle handleEcmaStrU8No1( +- thread, EcmaString::CreateFromUtf8(&arrayU8No1[0], lengthEcmaStrU8No1, ecmaVMPtr, true)); ++ thread_, EcmaString::CreateFromUtf8(&arrayU8No1[0], lengthEcmaStrU8No1, ecmaVMPtr, true)); + JSHandle handleEcmaStrU8No2( +- thread, EcmaString::CreateFromUtf8(&arrayU8No2[0], lengthEcmaStrU8No2, ecmaVMPtr, true)); ++ thread_, EcmaString::CreateFromUtf8(&arrayU8No2[0], lengthEcmaStrU8No2, ecmaVMPtr, true)); + JSHandle handleEcmaStrU8No3( +- thread, EcmaString::CreateFromUtf8(&arrayU8No3[0], lengthEcmaStrU8No3, ecmaVMPtr, true)); ++ thread_, EcmaString::CreateFromUtf8(&arrayU8No3[0], lengthEcmaStrU8No3, ecmaVMPtr, true)); + EXPECT_TRUE(EcmaString::StringsAreEqual(*handleEcmaStrU8No1, *handleEcmaStrU8No2)); + EXPECT_FALSE(EcmaString::StringsAreEqual(*handleEcmaStrU8No1, *handleEcmaStrU8No3)); + EXPECT_FALSE(EcmaString::StringsAreEqual(*handleEcmaStrU8No3, *handleEcmaStrU8No1)); +@@ -1296,7 +1296,7 @@ TEST_F(EcmaStringTest, StringsAreEqual_001) + */ + TEST_F(EcmaStringTest, StringsAreEqual_002) + { +- EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); ++ EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); + + // StringsAreEqual(). + uint8_t arrayU8No1[4] = {45, 92, 78}; +@@ -1306,11 +1306,11 @@ TEST_F(EcmaStringTest, StringsAreEqual_002) + uint32_t lengthEcmaStrU16CompNo2 = sizeof(arrayU16CompNo2) / sizeof(arrayU16CompNo2[0]); + uint32_t lengthEcmaStrU16CompNo3 = sizeof(arrayU16CompNo3) / sizeof(arrayU16CompNo3[0]); + JSHandle handleEcmaStrU8No1( +- thread, EcmaString::CreateFromUtf8(&arrayU8No1[0], lengthEcmaStrU8No1, ecmaVMPtr, true)); ++ thread_, EcmaString::CreateFromUtf8(&arrayU8No1[0], lengthEcmaStrU8No1, ecmaVMPtr, true)); + JSHandle handleEcmaStrU16CompNo2( +- thread, EcmaString::CreateFromUtf16(&arrayU16CompNo2[0], lengthEcmaStrU16CompNo2, ecmaVMPtr, true)); ++ thread_, EcmaString::CreateFromUtf16(&arrayU16CompNo2[0], lengthEcmaStrU16CompNo2, ecmaVMPtr, true)); + JSHandle handleEcmaStrU16CompNo3( +- thread, EcmaString::CreateFromUtf16(&arrayU16CompNo3[0], lengthEcmaStrU16CompNo3, ecmaVMPtr, true)); ++ thread_, EcmaString::CreateFromUtf16(&arrayU16CompNo3[0], lengthEcmaStrU16CompNo3, ecmaVMPtr, true)); + EXPECT_TRUE(EcmaString::StringsAreEqual(*handleEcmaStrU8No1, *handleEcmaStrU16CompNo2)); + EXPECT_FALSE(EcmaString::StringsAreEqual(*handleEcmaStrU8No1, *handleEcmaStrU16CompNo3)); + } +@@ -1324,7 +1324,7 @@ TEST_F(EcmaStringTest, StringsAreEqual_002) + */ + TEST_F(EcmaStringTest, StringsAreEqual_003) + { +- EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); ++ EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); + + // StringsAreEqual(). + uint16_t arrayU16CompNo1[] = {45, 92, 78}; +@@ -1334,11 +1334,11 @@ TEST_F(EcmaStringTest, StringsAreEqual_003) + uint32_t lengthEcmaStrU16CompNo2 = sizeof(arrayU16CompNo2) / sizeof(arrayU16CompNo2[0]); + uint32_t lengthEcmaStrU16CompNo3 = sizeof(arrayU16CompNo3) / sizeof(arrayU16CompNo3[0]); + JSHandle handleEcmaStrU16CompNo1( +- thread, EcmaString::CreateFromUtf16(&arrayU16CompNo1[0], lengthEcmaStrU16CompNo1, ecmaVMPtr, true)); ++ thread_, EcmaString::CreateFromUtf16(&arrayU16CompNo1[0], lengthEcmaStrU16CompNo1, ecmaVMPtr, true)); + JSHandle handleEcmaStrU16CompNo2( +- thread, EcmaString::CreateFromUtf16(&arrayU16CompNo2[0], lengthEcmaStrU16CompNo2, ecmaVMPtr, true)); ++ thread_, EcmaString::CreateFromUtf16(&arrayU16CompNo2[0], lengthEcmaStrU16CompNo2, ecmaVMPtr, true)); + JSHandle handleEcmaStrU16CompNo3( +- thread, EcmaString::CreateFromUtf16(&arrayU16CompNo3[0], lengthEcmaStrU16CompNo3, ecmaVMPtr, true)); ++ thread_, EcmaString::CreateFromUtf16(&arrayU16CompNo3[0], lengthEcmaStrU16CompNo3, ecmaVMPtr, true)); + EXPECT_TRUE(EcmaString::StringsAreEqual(*handleEcmaStrU16CompNo1, *handleEcmaStrU16CompNo2)); + EXPECT_FALSE(EcmaString::StringsAreEqual(*handleEcmaStrU16CompNo1, *handleEcmaStrU16CompNo3)); + EXPECT_FALSE(EcmaString::StringsAreEqual(*handleEcmaStrU16CompNo3, *handleEcmaStrU16CompNo1)); +@@ -1353,7 +1353,7 @@ TEST_F(EcmaStringTest, StringsAreEqual_003) + */ + TEST_F(EcmaStringTest, StringsAreEqual_004) + { +- EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); ++ EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); + + // StringsAreEqual(). + uint8_t arrayU8No1[4] = {45, 92, 78}; +@@ -1361,9 +1361,9 @@ TEST_F(EcmaStringTest, StringsAreEqual_004) + uint32_t lengthEcmaStrU8No1 = sizeof(arrayU8No1) - 1; + uint32_t lengthEcmaStrU16NotCompNo1 = sizeof(arrayU16NotCompNo1) / sizeof(arrayU16NotCompNo1[0]); + JSHandle handleEcmaStrU8No1( +- thread, EcmaString::CreateFromUtf8(&arrayU8No1[0], lengthEcmaStrU8No1, ecmaVMPtr, true)); ++ thread_, EcmaString::CreateFromUtf8(&arrayU8No1[0], lengthEcmaStrU8No1, ecmaVMPtr, true)); + JSHandle handleEcmaStrU16NotCompNo1( +- thread, EcmaString::CreateFromUtf16(&arrayU16NotCompNo1[0], lengthEcmaStrU16NotCompNo1, ecmaVMPtr, false)); ++ thread_, EcmaString::CreateFromUtf16(&arrayU16NotCompNo1[0], lengthEcmaStrU16NotCompNo1, ecmaVMPtr, false)); + EXPECT_FALSE(EcmaString::StringsAreEqual(*handleEcmaStrU8No1, *handleEcmaStrU16NotCompNo1)); + EXPECT_FALSE(EcmaString::StringsAreEqual(*handleEcmaStrU16NotCompNo1, *handleEcmaStrU8No1)); + } +@@ -1377,7 +1377,7 @@ TEST_F(EcmaStringTest, StringsAreEqual_004) + */ + TEST_F(EcmaStringTest, StringsAreEqual_005) + { +- EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); ++ EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); + + // StringsAreEqual(). + uint16_t arrayU16CompNo1[] = {45, 92, 78}; +@@ -1385,9 +1385,9 @@ TEST_F(EcmaStringTest, StringsAreEqual_005) + uint32_t lengthEcmaStrU16CompNo1 = sizeof(arrayU16CompNo1) / sizeof(arrayU16CompNo1[0]); + uint32_t lengthEcmaStrU16NotCompNo1 = sizeof(arrayU16NotCompNo1) / sizeof(arrayU16NotCompNo1[0]); + JSHandle handleEcmaStrU16CompNo1( +- thread, EcmaString::CreateFromUtf16(&arrayU16CompNo1[0], lengthEcmaStrU16CompNo1, ecmaVMPtr, true)); ++ thread_, EcmaString::CreateFromUtf16(&arrayU16CompNo1[0], lengthEcmaStrU16CompNo1, ecmaVMPtr, true)); + JSHandle handleEcmaStrU16NotCompNo1( +- thread, EcmaString::CreateFromUtf16(&arrayU16NotCompNo1[0], lengthEcmaStrU16NotCompNo1, ecmaVMPtr, false)); ++ thread_, EcmaString::CreateFromUtf16(&arrayU16NotCompNo1[0], lengthEcmaStrU16NotCompNo1, ecmaVMPtr, false)); + EXPECT_FALSE(EcmaString::StringsAreEqual(*handleEcmaStrU16CompNo1, *handleEcmaStrU16NotCompNo1)); + EXPECT_FALSE(EcmaString::StringsAreEqual(*handleEcmaStrU16NotCompNo1, *handleEcmaStrU16CompNo1)); + } +@@ -1401,7 +1401,7 @@ TEST_F(EcmaStringTest, StringsAreEqual_005) + */ + TEST_F(EcmaStringTest, StringsAreEqual_006) + { +- EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); ++ EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); + + // StringsAreEqual(). + uint16_t arrayU16NotCompNo1[] = {234, 345, 127, 2345, 65535, 5}; +@@ -1411,11 +1411,11 @@ TEST_F(EcmaStringTest, StringsAreEqual_006) + uint32_t lengthEcmaStrU16NotCompNo2 = sizeof(arrayU16NotCompNo2) / sizeof(arrayU16NotCompNo2[0]); + uint32_t lengthEcmaStrU16NotCompNo3 = sizeof(arrayU16NotCompNo3) / sizeof(arrayU16NotCompNo3[0]); + JSHandle handleEcmaStrU16NotCompNo1( +- thread, EcmaString::CreateFromUtf16(&arrayU16NotCompNo1[0], lengthEcmaStrU16NotCompNo1, ecmaVMPtr, false)); ++ thread_, EcmaString::CreateFromUtf16(&arrayU16NotCompNo1[0], lengthEcmaStrU16NotCompNo1, ecmaVMPtr, false)); + JSHandle handleEcmaStrU16NotCompNo2( +- thread, EcmaString::CreateFromUtf16(&arrayU16NotCompNo2[0], lengthEcmaStrU16NotCompNo2, ecmaVMPtr, false)); ++ thread_, EcmaString::CreateFromUtf16(&arrayU16NotCompNo2[0], lengthEcmaStrU16NotCompNo2, ecmaVMPtr, false)); + JSHandle handleEcmaStrU16NotCompNo3( +- thread, EcmaString::CreateFromUtf16(&arrayU16NotCompNo3[0], lengthEcmaStrU16NotCompNo3, ecmaVMPtr, false)); ++ thread_, EcmaString::CreateFromUtf16(&arrayU16NotCompNo3[0], lengthEcmaStrU16NotCompNo3, ecmaVMPtr, false)); + EXPECT_TRUE(EcmaString::StringsAreEqual(*handleEcmaStrU16NotCompNo1, *handleEcmaStrU16NotCompNo2)); + EXPECT_FALSE(EcmaString::StringsAreEqual(*handleEcmaStrU16NotCompNo1, *handleEcmaStrU16NotCompNo3)); + EXPECT_FALSE(EcmaString::StringsAreEqual(*handleEcmaStrU16NotCompNo3, *handleEcmaStrU16NotCompNo1)); +@@ -1430,7 +1430,7 @@ TEST_F(EcmaStringTest, StringsAreEqual_006) + */ + TEST_F(EcmaStringTest, StringsAreEqualUtf8_001) + { +- EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); ++ EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); + + // StringsAreEqualUtf8(). EcmaString made by CreateFromUtf8(), Array:U8. + uint8_t arrayU8No1[4] = {45, 92, 78}; +@@ -1440,11 +1440,11 @@ TEST_F(EcmaStringTest, StringsAreEqualUtf8_001) + uint32_t lengthEcmaStrU8No2 = sizeof(arrayU8No2) - 1; + uint32_t lengthEcmaStrU8No3 = sizeof(arrayU8No3) - 1; + JSHandle handleEcmaStrU8No1( +- thread, EcmaString::CreateFromUtf8(&arrayU8No1[0], lengthEcmaStrU8No1, ecmaVMPtr, true)); ++ thread_, EcmaString::CreateFromUtf8(&arrayU8No1[0], lengthEcmaStrU8No1, ecmaVMPtr, true)); + JSHandle handleEcmaStrU8No2( +- thread, EcmaString::CreateFromUtf8(&arrayU8No2[0], lengthEcmaStrU8No2, ecmaVMPtr, true)); ++ thread_, EcmaString::CreateFromUtf8(&arrayU8No2[0], lengthEcmaStrU8No2, ecmaVMPtr, true)); + JSHandle handleEcmaStrU8No3( +- thread, EcmaString::CreateFromUtf8(&arrayU8No3[0], lengthEcmaStrU8No3, ecmaVMPtr, true)); ++ thread_, EcmaString::CreateFromUtf8(&arrayU8No3[0], lengthEcmaStrU8No3, ecmaVMPtr, true)); + EXPECT_TRUE(EcmaString::StringsAreEqualUtf8(*handleEcmaStrU8No1, &arrayU8No1[0], lengthEcmaStrU8No1, true)); + EXPECT_FALSE(EcmaString::StringsAreEqualUtf8(*handleEcmaStrU8No1, &arrayU8No1[0], lengthEcmaStrU8No1, false)); + EXPECT_FALSE(EcmaString::StringsAreEqualUtf8(*handleEcmaStrU8No2, &arrayU8No1[0], lengthEcmaStrU8No1, true)); +@@ -1460,7 +1460,7 @@ TEST_F(EcmaStringTest, StringsAreEqualUtf8_001) + */ + TEST_F(EcmaStringTest, StringsAreEqualUtf8_002) + { +- EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); ++ EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); + + // StringsAreEqualUtf8(). EcmaString made by CreateFromUtf16( , , , true), Array:U8. + uint8_t arrayU8No1[4] = {45, 92, 78}; +@@ -1472,11 +1472,11 @@ TEST_F(EcmaStringTest, StringsAreEqualUtf8_002) + uint32_t lengthEcmaStrU16CompNo2 = sizeof(arrayU16CompNo2) / sizeof(arrayU16CompNo2[0]); + uint32_t lengthEcmaStrU16CompNo3 = sizeof(arrayU16CompNo3) / sizeof(arrayU16CompNo3[0]); + JSHandle handleEcmaStrU16CompNo1( +- thread, EcmaString::CreateFromUtf16(&arrayU16CompNo1[0], lengthEcmaStrU16CompNo1, ecmaVMPtr, true)); ++ thread_, EcmaString::CreateFromUtf16(&arrayU16CompNo1[0], lengthEcmaStrU16CompNo1, ecmaVMPtr, true)); + JSHandle handleEcmaStrU16CompNo2( +- thread, EcmaString::CreateFromUtf16(&arrayU16CompNo2[0], lengthEcmaStrU16CompNo2, ecmaVMPtr, true)); ++ thread_, EcmaString::CreateFromUtf16(&arrayU16CompNo2[0], lengthEcmaStrU16CompNo2, ecmaVMPtr, true)); + JSHandle handleEcmaStrU16CompNo3( +- thread, EcmaString::CreateFromUtf16(&arrayU16CompNo3[0], lengthEcmaStrU16CompNo3, ecmaVMPtr, true)); ++ thread_, EcmaString::CreateFromUtf16(&arrayU16CompNo3[0], lengthEcmaStrU16CompNo3, ecmaVMPtr, true)); + EXPECT_TRUE(EcmaString::StringsAreEqualUtf8(*handleEcmaStrU16CompNo1, &arrayU8No1[0], lengthEcmaStrU8No1, true)); + EXPECT_FALSE(EcmaString::StringsAreEqualUtf8(*handleEcmaStrU16CompNo1, &arrayU8No1[0], lengthEcmaStrU8No1, false)); + EXPECT_FALSE(EcmaString::StringsAreEqualUtf8(*handleEcmaStrU16CompNo2, &arrayU8No1[0], lengthEcmaStrU8No1, true)); +@@ -1492,7 +1492,7 @@ TEST_F(EcmaStringTest, StringsAreEqualUtf8_002) + */ + TEST_F(EcmaStringTest, StringsAreEqualUtf8_003) + { +- EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); ++ EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); + + // StringsAreEqualUtf8(). EcmaString made by CreateFromUtf16( , , , false), Array:U8. + uint8_t arrayU8No1[4] = {45, 92, 78}; +@@ -1506,13 +1506,13 @@ TEST_F(EcmaStringTest, StringsAreEqualUtf8_003) + uint32_t lengthEcmaStrU16NotCompNo3 = sizeof(arrayU16NotCompNo3) / sizeof(arrayU16NotCompNo3[0]); + uint32_t lengthEcmaStrU16NotCompNo4 = sizeof(arrayU16NotCompNo4) / sizeof(arrayU16NotCompNo4[0]); + JSHandle handleEcmaStrU16NotCompNo1( +- thread, EcmaString::CreateFromUtf16(&arrayU16NotCompNo1[0], lengthEcmaStrU16NotCompNo1, ecmaVMPtr, false)); ++ thread_, EcmaString::CreateFromUtf16(&arrayU16NotCompNo1[0], lengthEcmaStrU16NotCompNo1, ecmaVMPtr, false)); + JSHandle handleEcmaStrU16NotCompNo2( +- thread, EcmaString::CreateFromUtf16(&arrayU16NotCompNo2[0], lengthEcmaStrU16NotCompNo2, ecmaVMPtr, false)); ++ thread_, EcmaString::CreateFromUtf16(&arrayU16NotCompNo2[0], lengthEcmaStrU16NotCompNo2, ecmaVMPtr, false)); + JSHandle handleEcmaStrU16NotCompNo3( +- thread, EcmaString::CreateFromUtf16(&arrayU16NotCompNo3[0], lengthEcmaStrU16NotCompNo3, ecmaVMPtr, false)); ++ thread_, EcmaString::CreateFromUtf16(&arrayU16NotCompNo3[0], lengthEcmaStrU16NotCompNo3, ecmaVMPtr, false)); + JSHandle handleEcmaStrU16NotCompNo4( +- thread, EcmaString::CreateFromUtf16(&arrayU16NotCompNo4[0], lengthEcmaStrU16NotCompNo4, ecmaVMPtr, false)); ++ thread_, EcmaString::CreateFromUtf16(&arrayU16NotCompNo4[0], lengthEcmaStrU16NotCompNo4, ecmaVMPtr, false)); + EXPECT_TRUE( + EcmaString::StringsAreEqualUtf8(*handleEcmaStrU16NotCompNo1, &arrayU8No1[0], lengthEcmaStrU8No1, false)); + EXPECT_FALSE( +@@ -1534,7 +1534,7 @@ TEST_F(EcmaStringTest, StringsAreEqualUtf8_003) + */ + TEST_F(EcmaStringTest, StringsAreEqualUtf16_001) + { +- EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); ++ EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); + + // StringsAreEqualUtf16(). EcmaString made by CreateFromUtf8, Array:U16(1-127). + uint8_t arrayU8No1[4] = {45, 92, 78}; +@@ -1546,11 +1546,11 @@ TEST_F(EcmaStringTest, StringsAreEqualUtf16_001) + uint32_t lengthEcmaStrU8No3 = sizeof(arrayU8No3) - 1; + uint32_t lengthEcmaStrU16NotCompNo1 = sizeof(arrayU16NotCompNo1) / sizeof(arrayU16NotCompNo1[0]); + JSHandle handleEcmaStrU8No1( +- thread, EcmaString::CreateFromUtf8(&arrayU8No1[0], lengthEcmaStrU8No1, ecmaVMPtr, true)); ++ thread_, EcmaString::CreateFromUtf8(&arrayU8No1[0], lengthEcmaStrU8No1, ecmaVMPtr, true)); + JSHandle handleEcmaStrU8No2( +- thread, EcmaString::CreateFromUtf8(&arrayU8No2[0], lengthEcmaStrU8No2, ecmaVMPtr, true)); ++ thread_, EcmaString::CreateFromUtf8(&arrayU8No2[0], lengthEcmaStrU8No2, ecmaVMPtr, true)); + JSHandle handleEcmaStrU8No3( +- thread, EcmaString::CreateFromUtf8(&arrayU8No3[0], lengthEcmaStrU8No3, ecmaVMPtr, true)); ++ thread_, EcmaString::CreateFromUtf8(&arrayU8No3[0], lengthEcmaStrU8No3, ecmaVMPtr, true)); + EXPECT_TRUE( + EcmaString::StringsAreEqualUtf16(*handleEcmaStrU8No1, &arrayU16NotCompNo1[0], lengthEcmaStrU16NotCompNo1)); + EXPECT_FALSE( +@@ -1568,7 +1568,7 @@ TEST_F(EcmaStringTest, StringsAreEqualUtf16_001) + */ + TEST_F(EcmaStringTest, StringsAreEqualUtf16_002) + { +- EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); ++ EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); + + // StringsAreEqualUtf16(). EcmaString made by CreateFromUtf16( , , , true), Array:U16(1-127). + uint16_t arrayU16CompNo1[] = {45, 92, 78}; +@@ -1580,13 +1580,13 @@ TEST_F(EcmaStringTest, StringsAreEqualUtf16_002) + uint32_t lengthEcmaStrU16CompNo3 = sizeof(arrayU16CompNo3) / sizeof(arrayU16CompNo3[0]); + uint32_t lengthEcmaStrU16CompNo4 = sizeof(arrayU16CompNo4) / sizeof(arrayU16CompNo4[0]); + JSHandle handleEcmaStrU16CompNo1( +- thread, EcmaString::CreateFromUtf16(&arrayU16CompNo1[0], lengthEcmaStrU16CompNo1, ecmaVMPtr, true)); ++ thread_, EcmaString::CreateFromUtf16(&arrayU16CompNo1[0], lengthEcmaStrU16CompNo1, ecmaVMPtr, true)); + JSHandle handleEcmaStrU16CompNo2( +- thread, EcmaString::CreateFromUtf16(&arrayU16CompNo2[0], lengthEcmaStrU16CompNo2, ecmaVMPtr, true)); ++ thread_, EcmaString::CreateFromUtf16(&arrayU16CompNo2[0], lengthEcmaStrU16CompNo2, ecmaVMPtr, true)); + JSHandle handleEcmaStrU16CompNo3( +- thread, EcmaString::CreateFromUtf16(&arrayU16CompNo3[0], lengthEcmaStrU16CompNo3, ecmaVMPtr, true)); ++ thread_, EcmaString::CreateFromUtf16(&arrayU16CompNo3[0], lengthEcmaStrU16CompNo3, ecmaVMPtr, true)); + JSHandle handleEcmaStrU16CompNo4( +- thread, EcmaString::CreateFromUtf16(&arrayU16CompNo4[0], lengthEcmaStrU16CompNo4, ecmaVMPtr, true)); ++ thread_, EcmaString::CreateFromUtf16(&arrayU16CompNo4[0], lengthEcmaStrU16CompNo4, ecmaVMPtr, true)); + EXPECT_TRUE( + EcmaString::StringsAreEqualUtf16(*handleEcmaStrU16CompNo1, &arrayU16CompNo1[0], lengthEcmaStrU16CompNo1)); + EXPECT_FALSE( +@@ -1606,7 +1606,7 @@ TEST_F(EcmaStringTest, StringsAreEqualUtf16_002) + */ + TEST_F(EcmaStringTest, StringsAreEqualUtf16_003) + { +- EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); ++ EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); + + // StringsAreEqualUtf16(). EcmaString made by CreateFromUtf16( , , , false), Array:U16(0-65535). + uint16_t arrayU16NotCompNo1[] = {25645, 25692, 25678}; +@@ -1618,13 +1618,13 @@ TEST_F(EcmaStringTest, StringsAreEqualUtf16_003) + uint32_t lengthEcmaStrU16NotCompNo3 = sizeof(arrayU16NotCompNo3) / sizeof(arrayU16NotCompNo3[0]); + uint32_t lengthEcmaStrU16NotCompNo4 = sizeof(arrayU16NotCompNo4) / sizeof(arrayU16NotCompNo4[0]); + JSHandle handleEcmaStrU16NotCompNo1( +- thread, EcmaString::CreateFromUtf16(&arrayU16NotCompNo1[0], lengthEcmaStrU16NotCompNo1, ecmaVMPtr, false)); ++ thread_, EcmaString::CreateFromUtf16(&arrayU16NotCompNo1[0], lengthEcmaStrU16NotCompNo1, ecmaVMPtr, false)); + JSHandle handleEcmaStrU16NotCompNo2( +- thread, EcmaString::CreateFromUtf16(&arrayU16NotCompNo2[0], lengthEcmaStrU16NotCompNo2, ecmaVMPtr, false)); ++ thread_, EcmaString::CreateFromUtf16(&arrayU16NotCompNo2[0], lengthEcmaStrU16NotCompNo2, ecmaVMPtr, false)); + JSHandle handleEcmaStrU16NotCompNo3( +- thread, EcmaString::CreateFromUtf16(&arrayU16NotCompNo3[0], lengthEcmaStrU16NotCompNo3, ecmaVMPtr, false)); ++ thread_, EcmaString::CreateFromUtf16(&arrayU16NotCompNo3[0], lengthEcmaStrU16NotCompNo3, ecmaVMPtr, false)); + JSHandle handleEcmaStrU16NotCompNo4( +- thread, EcmaString::CreateFromUtf16(&arrayU16NotCompNo4[0], lengthEcmaStrU16NotCompNo4, ecmaVMPtr, false)); ++ thread_, EcmaString::CreateFromUtf16(&arrayU16NotCompNo4[0], lengthEcmaStrU16NotCompNo4, ecmaVMPtr, false)); + EXPECT_TRUE(EcmaString::StringsAreEqualUtf16(*handleEcmaStrU16NotCompNo1, &arrayU16NotCompNo1[0], + lengthEcmaStrU16NotCompNo1)); + EXPECT_FALSE(EcmaString::StringsAreEqualUtf16(*handleEcmaStrU16NotCompNo1, &arrayU16NotCompNo2[0], +@@ -1682,12 +1682,12 @@ TEST_F(EcmaStringTest, ComputeHashcodeUtf16) + */ + TEST_F(EcmaStringTest, GetHashcode_001) + { +- EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); ++ EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); + + // GetHashcode(). EcmaString made by CreateFromUtf8(). + uint8_t arrayU8[] = {"abc"}; + uint32_t lengthEcmaStrU8 = sizeof(arrayU8) - 1; +- JSHandle handleEcmaStrU8(thread, ++ JSHandle handleEcmaStrU8(thread_, + EcmaString::CreateFromUtf8(&arrayU8[0], lengthEcmaStrU8, ecmaVMPtr, true)); + uint32_t hashExpect = 0; + for (uint32_t i = 0; i < lengthEcmaStrU8; i++) { +@@ -1705,13 +1705,13 @@ TEST_F(EcmaStringTest, GetHashcode_001) + */ + TEST_F(EcmaStringTest, GetHashcode_002) + { +- EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); ++ EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); + + // GetHashcode(). EcmaString made by CreateFromUtf16( , , , true). + uint16_t arrayU16Comp[] = {45, 92, 78, 24}; + uint32_t lengthEcmaStrU16Comp = sizeof(arrayU16Comp) / sizeof(arrayU16Comp[0]); + JSHandle handleEcmaStrU16Comp( +- thread, EcmaString::CreateFromUtf16(&arrayU16Comp[0], lengthEcmaStrU16Comp, ecmaVMPtr, true)); ++ thread_, EcmaString::CreateFromUtf16(&arrayU16Comp[0], lengthEcmaStrU16Comp, ecmaVMPtr, true)); + uint32_t hashExpect = 0; + for (uint32_t i = 0; i < lengthEcmaStrU16Comp; i++) { + hashExpect = hashExpect * 31 + arrayU16Comp[i]; +@@ -1729,13 +1729,13 @@ TEST_F(EcmaStringTest, GetHashcode_002) + */ + TEST_F(EcmaStringTest, GetHashcode_003) + { +- EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); ++ EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); + + // GetHashcode(). EcmaString made by CreateFromUtf16( , , , false). + uint16_t arrayU16NotComp[] = {199, 1, 256, 65535, 777}; + uint32_t lengthEcmaStrU16NotComp = sizeof(arrayU16NotComp) / sizeof(arrayU16NotComp[0]); + JSHandle handleEcmaStrU16NotComp( +- thread, EcmaString::CreateFromUtf16(&arrayU16NotComp[0], lengthEcmaStrU16NotComp, ecmaVMPtr, false)); ++ thread_, EcmaString::CreateFromUtf16(&arrayU16NotComp[0], lengthEcmaStrU16NotComp, ecmaVMPtr, false)); + uint32_t hashExpect = 0; + for (uint32_t i = 0; i < lengthEcmaStrU16NotComp; i++) { + hashExpect = hashExpect * 31 + arrayU16NotComp[i]; +@@ -1744,7 +1744,7 @@ TEST_F(EcmaStringTest, GetHashcode_003) + + EcmaString::SetCompressedStringsEnabled(false); // Set compressedStringsEnabled false. + JSHandle handleEcmaStrU16NotCompDisableComp( +- thread, EcmaString::CreateFromUtf16(&arrayU16NotComp[0], lengthEcmaStrU16NotComp, ecmaVMPtr, false)); ++ thread_, EcmaString::CreateFromUtf16(&arrayU16NotComp[0], lengthEcmaStrU16NotComp, ecmaVMPtr, false)); + EXPECT_EQ(handleEcmaStrU16NotCompDisableComp->GetHashcode(), static_cast(hashExpect)); + EcmaString::SetCompressedStringsEnabled(true); // Set compressedStringsEnabled true(default). + } +@@ -1758,14 +1758,14 @@ TEST_F(EcmaStringTest, GetHashcode_003) + */ + TEST_F(EcmaStringTest, GetHashcode_004) + { +- EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); ++ EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); + + // GetHashcode(). EcmaString made by CreateEmptyString(). +- JSHandle handleEcmaStrEmpty(thread, EcmaString::CreateEmptyString(ecmaVMPtr)); ++ JSHandle handleEcmaStrEmpty(thread_, EcmaString::CreateEmptyString(ecmaVMPtr)); + EXPECT_EQ(handleEcmaStrEmpty->GetHashcode(), 0); + + EcmaString::SetCompressedStringsEnabled(false); // Set compressedStringsEnabled false. +- JSHandle handleEcmaStrEmptyDisableComp(thread, EcmaString::CreateEmptyString(ecmaVMPtr)); ++ JSHandle handleEcmaStrEmptyDisableComp(thread_, EcmaString::CreateEmptyString(ecmaVMPtr)); + EXPECT_EQ(handleEcmaStrEmptyDisableComp->GetHashcode(), 0); + EcmaString::SetCompressedStringsEnabled(true); // Set compressedStringsEnabled true(default). + } +@@ -1780,18 +1780,18 @@ TEST_F(EcmaStringTest, GetHashcode_004) + */ + TEST_F(EcmaStringTest, GetHashcode_005) + { +- EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); ++ EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); + + // GetHashcode(). EcmaString made by AllocStringObject(). + size_t sizeAlloc = 5; +- JSHandle handleEcmaStrAllocComp(thread, EcmaString::AllocStringObject(sizeAlloc, true, ecmaVMPtr)); +- JSHandle handleEcmaStrAllocNotComp(thread, EcmaString::AllocStringObject(sizeAlloc, false, ecmaVMPtr)); ++ JSHandle handleEcmaStrAllocComp(thread_, EcmaString::AllocStringObject(sizeAlloc, true, ecmaVMPtr)); ++ JSHandle handleEcmaStrAllocNotComp(thread_, EcmaString::AllocStringObject(sizeAlloc, false, ecmaVMPtr)); + EXPECT_EQ(handleEcmaStrAllocComp->GetHashcode(), 0); + EXPECT_EQ(handleEcmaStrAllocNotComp->GetHashcode(), 0); + + EcmaString::SetCompressedStringsEnabled(false); // Set compressedStringsEnabled false. + JSHandle handleEcmaStrAllocNotCompDisableComp( +- thread, EcmaString::AllocStringObject(sizeAlloc, false, ecmaVMPtr)); ++ thread_, EcmaString::AllocStringObject(sizeAlloc, false, ecmaVMPtr)); + EXPECT_EQ(handleEcmaStrAllocNotCompDisableComp->GetHashcode(), 0); + EcmaString::SetCompressedStringsEnabled(true); // Set compressedStringsEnabled true(default). + } +@@ -1805,24 +1805,24 @@ TEST_F(EcmaStringTest, GetHashcode_005) + */ + TEST_F(EcmaStringTest, GetCString) + { +- EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); ++ EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); + + uint8_t arrayU8[] = {"abc"}; + uint32_t lengthEcmaStrU8 = sizeof(arrayU8) - 1; +- JSHandle handleEcmaStrU8(thread, ++ JSHandle handleEcmaStrU8(thread_, + EcmaString::CreateFromUtf8(&arrayU8[0], lengthEcmaStrU8, ecmaVMPtr, true)); + EXPECT_STREQ(CString(handleEcmaStrU8->GetCString().get()).c_str(), "abc"); + + uint16_t arrayU16Comp[] = {97, 98, 99}; + uint32_t lengthEcmaStrU16Comp = sizeof(arrayU16Comp) / sizeof(arrayU16Comp[0]); + JSHandle handleEcmaStrU16Comp( +- thread, EcmaString::CreateFromUtf16(&arrayU16Comp[0], lengthEcmaStrU16Comp, ecmaVMPtr, true)); ++ thread_, EcmaString::CreateFromUtf16(&arrayU16Comp[0], lengthEcmaStrU16Comp, ecmaVMPtr, true)); + EXPECT_STREQ(CString(handleEcmaStrU16Comp->GetCString().get()).c_str(), "abc"); + + uint16_t arrayU16NotComp[] = {97, 98, 99}; + uint32_t lengthEcmaStrU16NotComp = sizeof(arrayU16NotComp) / sizeof(arrayU16NotComp[0]); + JSHandle handleEcmaStrU16NotComp( +- thread, EcmaString::CreateFromUtf16(&arrayU16NotComp[0], lengthEcmaStrU16NotComp, ecmaVMPtr, false)); ++ thread_, EcmaString::CreateFromUtf16(&arrayU16NotComp[0], lengthEcmaStrU16NotComp, ecmaVMPtr, false)); + EXPECT_STREQ(CString(handleEcmaStrU16NotComp->GetCString().get()).c_str(), "abc"); + } + +@@ -1835,11 +1835,11 @@ TEST_F(EcmaStringTest, GetCString) + */ + TEST_F(EcmaStringTest, SetIsInternString) + { +- EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); ++ EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); + + uint8_t arrayU8[] = {"abc"}; + uint32_t lengthEcmaStrU8 = sizeof(arrayU8) - 1; +- JSHandle handleEcmaStrU8(thread, ++ JSHandle handleEcmaStrU8(thread_, + EcmaString::CreateFromUtf8(&arrayU8[0], lengthEcmaStrU8, ecmaVMPtr, true)); + EXPECT_FALSE(handleEcmaStrU8->IsInternString()); + handleEcmaStrU8->SetIsInternString(); +@@ -1848,7 +1848,7 @@ TEST_F(EcmaStringTest, SetIsInternString) + uint16_t arrayU16Comp[] = {97, 98, 99}; + uint32_t lengthEcmaStrU16Comp = sizeof(arrayU16Comp) / sizeof(arrayU16Comp[0]); + JSHandle handleEcmaStrU16Comp( +- thread, EcmaString::CreateFromUtf16(&arrayU16Comp[0], lengthEcmaStrU16Comp, ecmaVMPtr, true)); ++ thread_, EcmaString::CreateFromUtf16(&arrayU16Comp[0], lengthEcmaStrU16Comp, ecmaVMPtr, true)); + EXPECT_FALSE(handleEcmaStrU16Comp->IsInternString()); + handleEcmaStrU16Comp->SetIsInternString(); + EXPECT_TRUE(handleEcmaStrU16Comp->IsInternString()); +@@ -1856,7 +1856,7 @@ TEST_F(EcmaStringTest, SetIsInternString) + uint16_t arrayU16NotComp[] = {97, 98, 99}; + uint32_t lengthEcmaStrU16NotComp = sizeof(arrayU16NotComp) / sizeof(arrayU16NotComp[0]); + JSHandle handleEcmaStrU16NotComp( +- thread, EcmaString::CreateFromUtf16(&arrayU16NotComp[0], lengthEcmaStrU16NotComp, ecmaVMPtr, false)); ++ thread_, EcmaString::CreateFromUtf16(&arrayU16NotComp[0], lengthEcmaStrU16NotComp, ecmaVMPtr, false)); + EXPECT_FALSE(handleEcmaStrU16NotComp->IsInternString()); + handleEcmaStrU16NotComp->SetIsInternString(); + EXPECT_TRUE(handleEcmaStrU16NotComp->IsInternString()); +diff --git a/tests/runtime/common/glue_regs_test.cpp b/tests/runtime/common/glue_regs_test.cpp +index 364737f..3db7b4e 100644 +--- a/tests/runtime/common/glue_regs_test.cpp ++++ b/tests/runtime/common/glue_regs_test.cpp +@@ -32,22 +32,22 @@ class GlueRegsTest : public testing::Test { + public: + void SetUp() override + { +- TestHelper::CreateEcmaVMWithScope(instance, thread, scope); ++ TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); + } + + void TearDown() override + { +- TestHelper::DestroyEcmaVMWithScope(instance, scope); ++ TestHelper::DestroyEcmaVMWithScope(instance_, scope_); + } + +- PandaVM *instance {nullptr}; +- ecmascript::EcmaHandleScope *scope {nullptr}; +- JSThread *thread; ++ PandaVM *instance_ {nullptr}; ++ ecmascript::EcmaHandleScope *scope_ {nullptr}; ++ JSThread *thread_; + }; + + TEST_F(GlueRegsTest, ConstantClassTest) + { +- const GlobalEnvConstants *globalConst = thread->GlobalConstants(); ++ const GlobalEnvConstants *globalConst = thread_->GlobalConstants(); + ASSERT_NE(globalConst, nullptr); + + const JSTaggedValue *address = globalConst->BeginSlot(); +@@ -59,7 +59,7 @@ TEST_F(GlueRegsTest, ConstantClassTest) + + TEST_F(GlueRegsTest, ConstantSpecialTest) + { +- auto globalConst = const_cast(thread->GlobalConstants()); ++ auto globalConst = const_cast(thread_->GlobalConstants()); + ASSERT_NE(globalConst, nullptr); + + EXPECT_TRUE(globalConst->GetUndefined().IsUndefined()); +@@ -72,7 +72,7 @@ TEST_F(GlueRegsTest, ConstantSpecialTest) + + TEST_F(GlueRegsTest, ConstantStringTest) + { +- auto globalConst = const_cast(thread->GlobalConstants()); ++ auto globalConst = const_cast(thread_->GlobalConstants()); + ASSERT_NE(globalConst, nullptr); + + #define CONSTANT_STRING_ITERATOR(Type, Name, Index, Desc) \ +@@ -86,7 +86,7 @@ TEST_F(GlueRegsTest, ConstantStringTest) + + TEST_F(GlueRegsTest, ConstantAccessorTest) + { +- auto globalConst = const_cast(thread->GlobalConstants()); ++ auto globalConst = const_cast(thread_->GlobalConstants()); + ASSERT_NE(globalConst, nullptr); + + #define CONSTANT_ACCESSOR_ITERATOR(Type, Name, Index, Desc) \ +diff --git a/tests/runtime/common/huge_object_test.cpp b/tests/runtime/common/huge_object_test.cpp +index 64c271d..3cdf081 100644 +--- a/tests/runtime/common/huge_object_test.cpp ++++ b/tests/runtime/common/huge_object_test.cpp +@@ -39,19 +39,19 @@ public: + + void SetUp() override + { +- TestHelper::CreateEcmaVMWithScope(instance, thread, scope); +- thread->GetEcmaVM()->SetEnableForceGC(false); +- const_cast(thread->GetEcmaVM()->GetHeap())->SetOnlyMarkSemi(false); ++ TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); ++ thread_->GetEcmaVM()->SetEnableForceGC(false); ++ const_cast(thread_->GetEcmaVM()->GetHeap())->SetOnlyMarkSemi(false); + } + + void TearDown() override + { +- TestHelper::DestroyEcmaVMWithScope(instance, scope); ++ TestHelper::DestroyEcmaVMWithScope(instance_, scope_); + } + +- JSThread *thread {nullptr}; +- PandaVM *instance {nullptr}; +- ecmascript::EcmaHandleScope *scope {nullptr}; ++ JSThread *thread_ {nullptr}; ++ PandaVM *instance_ {nullptr}; ++ ecmascript::EcmaHandleScope *scope_ {nullptr}; + }; + + #if !defined(NDEBUG) +@@ -79,12 +79,12 @@ static TaggedArray *LargeArrayTestCreate(JSThread *thread) + TEST_F(HugeObjectTest, LargeArrayKeep) + { + #if !defined(NDEBUG) +- TaggedArray *array = LargeArrayTestCreate(thread); ++ TaggedArray *array = LargeArrayTestCreate(thread_); + EXPECT_TRUE(array != nullptr); +- JSHandle arrayHandle(thread, array); +- JSHandle newObj(thread, JSObjectTestCreate(thread)); +- arrayHandle->Set(thread, 0, newObj.GetTaggedValue()); +- auto ecmaVm = thread->GetEcmaVM(); ++ JSHandle arrayHandle(thread_, array); ++ JSHandle newObj(thread_, JSObjectTestCreate(thread_)); ++ arrayHandle->Set(thread_, 0, newObj.GetTaggedValue()); ++ auto ecmaVm = thread_->GetEcmaVM(); + EXPECT_EQ(*arrayHandle, reinterpret_cast(array)); + ecmaVm->CollectGarbage(TriggerGCType::SEMI_GC); // Trigger GC. + ecmaVm->CollectGarbage(TriggerGCType::HUGE_GC); // Trigger GC. +@@ -96,19 +96,19 @@ TEST_F(HugeObjectTest, LargeArrayKeep) + TEST_F(HugeObjectTest, DISABLED_MultipleArrays) // TODO(vpukhov) + { + #if !defined(NDEBUG) +- auto ecmaVm = thread->GetEcmaVM(); ++ auto ecmaVm = thread_->GetEcmaVM(); + auto heap = ecmaVm->GetHeap(); + Region *firstPage = nullptr; + Region *secondPage = nullptr; + Region *thirdPage = nullptr; +- JSHandle array1(thread, LargeArrayTestCreate(thread)); ++ JSHandle array1(thread_, LargeArrayTestCreate(thread_)); + firstPage = Region::ObjectAddressToRange(*array1); + { + DISALLOW_GARBAGE_COLLECTION; +- [[maybe_unused]] TaggedArray *array2 = LargeArrayTestCreate(thread); ++ [[maybe_unused]] TaggedArray *array2 = LargeArrayTestCreate(thread_); + secondPage = Region::ObjectAddressToRange(array2); + } +- JSHandle array3(thread, LargeArrayTestCreate(thread)); ++ JSHandle array3(thread_, LargeArrayTestCreate(thread_)); + thirdPage = Region::ObjectAddressToRange(*array3); + + EXPECT_EQ(firstPage->GetNext(), secondPage); +diff --git a/tests/runtime/common/js_arguments_test.cpp b/tests/runtime/common/js_arguments_test.cpp +index c0ed517..726d80b 100644 +--- a/tests/runtime/common/js_arguments_test.cpp ++++ b/tests/runtime/common/js_arguments_test.cpp +@@ -37,16 +37,16 @@ public: + + void SetUp() override + { +- TestHelper::CreateEcmaVMWithScope(instance, thread, scope); ++ TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); + } + + void TearDown() override + { +- TestHelper::DestroyEcmaVMWithScope(instance, scope); ++ TestHelper::DestroyEcmaVMWithScope(instance_, scope_); + } +- ecmascript::EcmaHandleScope *scope {nullptr}; +- PandaVM *instance {nullptr}; +- JSThread *thread {nullptr}; ++ ecmascript::EcmaHandleScope *scope_ {nullptr}; ++ PandaVM *instance_ {nullptr}; ++ JSThread *thread_ {nullptr}; + }; + + static JSFunction *JSObjectTestCreate(JSThread *thread) +@@ -58,108 +58,108 @@ static JSFunction *JSObjectTestCreate(JSThread *thread) + + TEST_F(JsArgumentsTest, SetProperty) + { +- JSHandle argFunc(thread, JSObjectTestCreate(thread)); ++ JSHandle argFunc(thread_, JSObjectTestCreate(thread_)); + JSHandle jsarg = +- thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(argFunc), argFunc); +- JSHandle arg = thread->GetEcmaVM()->GetFactory()->NewJSArguments(); ++ thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(argFunc), argFunc); ++ JSHandle arg = thread_->GetEcmaVM()->GetFactory()->NewJSArguments(); + + char array[] = "x"; +- JSHandle key(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(array)); +- JSHandle value(thread, JSTaggedValue(1)); ++ JSHandle key(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(array)); ++ JSHandle value(thread_, JSTaggedValue(1)); + + // receive must be jsarg's conversion + JSHandle receiver = JSHandle::Cast(jsarg); +- EXPECT_TRUE(JSArguments::SetProperty(thread, arg, key, value, receiver)); +- EXPECT_EQ(JSObject::GetProperty(thread, JSHandle(jsarg), key).GetValue()->GetInt(), 1); +- EXPECT_EQ(JSArguments::GetProperty(thread, jsarg, key).GetValue()->GetInt(), 1); +- +- JSHandle value2(thread, JSTaggedValue(2)); +- EXPECT_TRUE(JSArguments::SetProperty(thread, arg, key, value2, receiver)); +- EXPECT_EQ(JSObject::GetProperty(thread, JSHandle(jsarg), key).GetValue()->GetInt(), 2); +- EXPECT_EQ(JSArguments::GetProperty(thread, jsarg, key).GetValue()->GetInt(), 2); ++ EXPECT_TRUE(JSArguments::SetProperty(thread_, arg, key, value, receiver)); ++ EXPECT_EQ(JSObject::GetProperty(thread_, JSHandle(jsarg), key).GetValue()->GetInt(), 1); ++ EXPECT_EQ(JSArguments::GetProperty(thread_, jsarg, key).GetValue()->GetInt(), 1); ++ ++ JSHandle value2(thread_, JSTaggedValue(2)); ++ EXPECT_TRUE(JSArguments::SetProperty(thread_, arg, key, value2, receiver)); ++ EXPECT_EQ(JSObject::GetProperty(thread_, JSHandle(jsarg), key).GetValue()->GetInt(), 2); ++ EXPECT_EQ(JSArguments::GetProperty(thread_, jsarg, key).GetValue()->GetInt(), 2); + } + + TEST_F(JsArgumentsTest, GetProperty) + { +- JSHandle argFunc(thread, JSObjectTestCreate(thread)); ++ JSHandle argFunc(thread_, JSObjectTestCreate(thread_)); + JSHandle jsarg = +- thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(argFunc), argFunc); +- JSHandle arg = thread->GetEcmaVM()->GetFactory()->NewJSArguments(); ++ thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(argFunc), argFunc); ++ JSHandle arg = thread_->GetEcmaVM()->GetFactory()->NewJSArguments(); + + char array[] = "x"; +- JSHandle key(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(array)); +- JSHandle value(thread, JSTaggedValue(1)); ++ JSHandle key(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(array)); ++ JSHandle value(thread_, JSTaggedValue(1)); + + JSHandle receiver = JSHandle::Cast(jsarg); +- JSArguments::SetProperty(thread, arg, key, value, receiver); +- EXPECT_EQ(JSObject::GetProperty(thread, JSHandle(jsarg), key).GetValue()->GetInt(), 1); +- EXPECT_EQ(JSArguments::GetProperty(thread, JSHandle(jsarg), key, receiver).GetValue()->GetInt(), 1); +- +- JSHandle value2(thread, JSTaggedValue(2)); +- JSArguments::SetProperty(thread, arg, key, value2, receiver); +- EXPECT_EQ(JSArguments::GetProperty(thread, jsarg, key).GetValue()->GetInt(), 2); +- EXPECT_EQ(JSObject::GetProperty(thread, JSHandle(jsarg), key).GetValue()->GetInt(), 2); ++ JSArguments::SetProperty(thread_, arg, key, value, receiver); ++ EXPECT_EQ(JSObject::GetProperty(thread_, JSHandle(jsarg), key).GetValue()->GetInt(), 1); ++ EXPECT_EQ(JSArguments::GetProperty(thread_, JSHandle(jsarg), key, receiver).GetValue()->GetInt(), 1); ++ ++ JSHandle value2(thread_, JSTaggedValue(2)); ++ JSArguments::SetProperty(thread_, arg, key, value2, receiver); ++ EXPECT_EQ(JSArguments::GetProperty(thread_, jsarg, key).GetValue()->GetInt(), 2); ++ EXPECT_EQ(JSObject::GetProperty(thread_, JSHandle(jsarg), key).GetValue()->GetInt(), 2); + } + + TEST_F(JsArgumentsTest, DeleteProperty) + { +- JSHandle argFunc(thread, JSObjectTestCreate(thread)); ++ JSHandle argFunc(thread_, JSObjectTestCreate(thread_)); + JSHandle jsarg = +- thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(argFunc), argFunc); +- JSHandle arg = thread->GetEcmaVM()->GetFactory()->NewJSArguments(); ++ thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(argFunc), argFunc); ++ JSHandle arg = thread_->GetEcmaVM()->GetFactory()->NewJSArguments(); + + char array[] = "delete"; +- JSHandle key(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(array)); +- JSHandle value(thread, JSTaggedValue(1)); ++ JSHandle key(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(array)); ++ JSHandle value(thread_, JSTaggedValue(1)); + JSHandle receiver = JSHandle::Cast(jsarg); +- JSArguments::SetProperty(thread, arg, key, value, receiver); +- EXPECT_EQ(JSArguments::GetProperty(thread, jsarg, key).GetValue()->GetInt(), 1); ++ JSArguments::SetProperty(thread_, arg, key, value, receiver); ++ EXPECT_EQ(JSArguments::GetProperty(thread_, jsarg, key).GetValue()->GetInt(), 1); + + // test delete +- bool result = JSArguments::DeleteProperty(thread, JSHandle(jsarg), key); ++ bool result = JSArguments::DeleteProperty(thread_, JSHandle(jsarg), key); + EXPECT_TRUE(result); +- EXPECT_TRUE(JSObject::GetProperty(thread, JSHandle(jsarg), key).GetValue()->IsUndefined()); ++ EXPECT_TRUE(JSObject::GetProperty(thread_, JSHandle(jsarg), key).GetValue()->IsUndefined()); + } + + TEST_F(JsArgumentsTest, DefineOwnProperty) + { +- JSHandle argFunc(thread, JSObjectTestCreate(thread)); ++ JSHandle argFunc(thread_, JSObjectTestCreate(thread_)); + JSHandle jsarg = +- thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(argFunc), argFunc); +- JSHandle arg = thread->GetEcmaVM()->GetFactory()->NewJSArguments(); ++ thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(argFunc), argFunc); ++ JSHandle arg = thread_->GetEcmaVM()->GetFactory()->NewJSArguments(); + +- JSHandle key(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("x")); +- JSHandle value1(thread, JSTaggedValue(1)); +- JSHandle value2(thread, JSTaggedValue(2)); ++ JSHandle key(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("x")); ++ JSHandle value1(thread_, JSTaggedValue(1)); ++ JSHandle value2(thread_, JSTaggedValue(2)); + JSHandle receiver = JSHandle::Cast(jsarg); +- JSArguments::SetProperty(thread, arg, key, value2, receiver); +- EXPECT_EQ(JSObject::GetProperty(thread, JSHandle(jsarg), key).GetValue()->GetInt(), 2); ++ JSArguments::SetProperty(thread_, arg, key, value2, receiver); ++ EXPECT_EQ(JSObject::GetProperty(thread_, JSHandle(jsarg), key).GetValue()->GetInt(), 2); + +- PropertyDescriptor Desc(thread); ++ PropertyDescriptor Desc(thread_); + // set value1 + Desc.SetValue(value1); + Desc.SetWritable(false); +- EXPECT_TRUE(JSArguments::DefineOwnProperty(thread, JSHandle(jsarg), key, Desc)); +- EXPECT_EQ(JSObject::GetProperty(thread, JSHandle(jsarg), key).GetValue()->GetInt(), 1); ++ EXPECT_TRUE(JSArguments::DefineOwnProperty(thread_, JSHandle(jsarg), key, Desc)); ++ EXPECT_EQ(JSObject::GetProperty(thread_, JSHandle(jsarg), key).GetValue()->GetInt(), 1); + } + + TEST_F(JsArgumentsTest, GetOwnProperty) + { +- JSHandle argFunc(thread, JSObjectTestCreate(thread)); ++ JSHandle argFunc(thread_, JSObjectTestCreate(thread_)); + JSHandle jsarg = +- thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(argFunc), argFunc); +- JSHandle arg = thread->GetEcmaVM()->GetFactory()->NewJSArguments(); ++ thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(argFunc), argFunc); ++ JSHandle arg = thread_->GetEcmaVM()->GetFactory()->NewJSArguments(); + +- JSHandle key(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("x")); +- JSHandle value(thread, JSTaggedValue(1)); ++ JSHandle key(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("x")); ++ JSHandle value(thread_, JSTaggedValue(1)); + JSHandle receiver = JSHandle::Cast(jsarg); +- JSArguments::SetProperty(thread, arg, key, value, receiver); ++ JSArguments::SetProperty(thread_, arg, key, value, receiver); + +- PropertyDescriptor Desc(thread); +- JSHandle caller = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("caller"); ++ PropertyDescriptor Desc(thread_); ++ JSHandle caller = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("caller"); + // key is not caller + EXPECT_FALSE(JSTaggedValue::SameValue(key.GetTaggedValue(), caller.GetTaggedValue())); +- EXPECT_TRUE(JSArguments::GetOwnProperty(thread, JSHandle(jsarg), key, Desc)); ++ EXPECT_TRUE(JSArguments::GetOwnProperty(thread_, JSHandle(jsarg), key, Desc)); + EXPECT_EQ(Desc.GetValue()->GetInt(), 1); + } + } // namespace panda::test +diff --git a/tests/runtime/common/js_array_iterator_test.cpp b/tests/runtime/common/js_array_iterator_test.cpp +index a62689c..0fe4b59 100644 +--- a/tests/runtime/common/js_array_iterator_test.cpp ++++ b/tests/runtime/common/js_array_iterator_test.cpp +@@ -36,16 +36,16 @@ public: + + void SetUp() override + { +- TestHelper::CreateEcmaVMWithScope(instance, thread, scope); ++ TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); + } + + void TearDown() override + { +- TestHelper::DestroyEcmaVMWithScope(instance, scope); ++ TestHelper::DestroyEcmaVMWithScope(instance_, scope_); + } +- PandaVM *instance {nullptr}; +- ecmascript::EcmaHandleScope *scope {nullptr}; +- JSThread *thread {nullptr}; ++ PandaVM *instance_ {nullptr}; ++ ecmascript::EcmaHandleScope *scope_ {nullptr}; ++ JSThread *thread_ {nullptr}; + }; + + /* +@@ -58,7 +58,7 @@ public: + */ + TEST_F(JSArrayIteratorTest, SetIteratedArray) + { +- EcmaVM *ecmaVMPtr = thread->GetEcmaVM(); ++ EcmaVM *ecmaVMPtr = thread_->GetEcmaVM(); + ObjectFactory *factory = ecmaVMPtr->GetFactory(); + + uint32_t arrayFrom1[10] = {0, 6, 8, 99, 200, 1, static_cast(-1), static_cast(-199), 33, 100}; +@@ -68,32 +68,32 @@ TEST_F(JSArrayIteratorTest, SetIteratedArray) + JSHandle handleTaggedArrayFrom1(factory->NewTaggedArray(numArrayFrom1)); + JSHandle handleTaggedArrayFrom2(factory->NewTaggedArray(numArrayFrom2)); + for (int i = 0; i < numArrayFrom1; i++) { +- handleTaggedArrayFrom1->Set(thread, i, JSTaggedValue(arrayFrom1[i])); ++ handleTaggedArrayFrom1->Set(thread_, i, JSTaggedValue(arrayFrom1[i])); + } + for (int i = 0; i < numArrayFrom2; i++) { +- handleTaggedArrayFrom2->Set(thread, i, JSTaggedValue(arrayFrom2[i])); ++ handleTaggedArrayFrom2->Set(thread_, i, JSTaggedValue(arrayFrom2[i])); + } +- JSHandle handleJSObjectTaggedArrayFrom1(JSArray::CreateArrayFromList(thread, handleTaggedArrayFrom1)); +- JSHandle handleJSObjectTaggedArrayFrom2(JSArray::CreateArrayFromList(thread, handleTaggedArrayFrom2)); ++ JSHandle handleJSObjectTaggedArrayFrom1(JSArray::CreateArrayFromList(thread_, handleTaggedArrayFrom1)); ++ JSHandle handleJSObjectTaggedArrayFrom2(JSArray::CreateArrayFromList(thread_, handleTaggedArrayFrom2)); + + // Call "SetIteratedArray" function through "NewJSArrayIterator" function of "object_factory.cpp". + JSHandle handleJSArrayIter = + factory->NewJSArrayIterator(handleJSObjectTaggedArrayFrom1, IterationKind::KEY); + +- JSHandle handleJSArrayTo1(thread, JSArray::Cast(handleJSArrayIter->GetIteratedArray().GetTaggedObject())); ++ JSHandle handleJSArrayTo1(thread_, JSArray::Cast(handleJSArrayIter->GetIteratedArray().GetTaggedObject())); + EXPECT_EQ(handleJSArrayTo1->GetArrayLength(), numArrayFrom1); + for (int i = 0; i < numArrayFrom1; i++) { +- EXPECT_EQ(JSArray::FastGetPropertyByValue(thread, JSHandle(handleJSArrayTo1), i)->GetNumber(), ++ EXPECT_EQ(JSArray::FastGetPropertyByValue(thread_, JSHandle(handleJSArrayTo1), i)->GetNumber(), + arrayFrom1[i]); + } + + // Call "SetIteratedArray" function in this TEST_F. +- handleJSArrayIter->SetIteratedArray(thread, handleJSObjectTaggedArrayFrom2); ++ handleJSArrayIter->SetIteratedArray(thread_, handleJSObjectTaggedArrayFrom2); + +- JSHandle handleJSArrayTo2(thread, JSArray::Cast(handleJSArrayIter->GetIteratedArray().GetTaggedObject())); ++ JSHandle handleJSArrayTo2(thread_, JSArray::Cast(handleJSArrayIter->GetIteratedArray().GetTaggedObject())); + EXPECT_EQ(handleJSArrayTo2->GetArrayLength(), numArrayFrom2); + for (int i = 0; i < numArrayFrom2; i++) { +- EXPECT_EQ(JSArray::FastGetPropertyByValue(thread, JSHandle(handleJSArrayTo2), i)->GetNumber(), ++ EXPECT_EQ(JSArray::FastGetPropertyByValue(thread_, JSHandle(handleJSArrayTo2), i)->GetNumber(), + arrayFrom2[i]); + } + } +@@ -108,16 +108,16 @@ TEST_F(JSArrayIteratorTest, SetIteratedArray) + */ + TEST_F(JSArrayIteratorTest, SetNextIndex) + { +- EcmaVM *ecmaVMPtr = thread->GetEcmaVM(); ++ EcmaVM *ecmaVMPtr = thread_->GetEcmaVM(); + ObjectFactory *factory = ecmaVMPtr->GetFactory(); + + uint32_t array[10] = {0, 6, 8, 99, 200, 1, static_cast(-1), static_cast(-199), 33, 100}; + int numArray = sizeof(array) / sizeof(array[0]); + JSHandle handleTaggedArray(factory->NewTaggedArray(numArray)); + for (int i = 0; i < numArray; i++) { +- handleTaggedArray->Set(thread, i, JSTaggedValue(array[i])); ++ handleTaggedArray->Set(thread_, i, JSTaggedValue(array[i])); + } +- JSHandle handleJSObjectTaggedArray(JSArray::CreateArrayFromList(thread, handleTaggedArray)); ++ JSHandle handleJSObjectTaggedArray(JSArray::CreateArrayFromList(thread_, handleTaggedArray)); + + // Call "SetNextIndex" function through "NewJSArrayIterator" function of "object_factory.cpp". + JSHandle handleJSArrayIter = +@@ -126,10 +126,10 @@ TEST_F(JSArrayIteratorTest, SetNextIndex) + + int testQuantity = 100; + for (int i = 1; i <= testQuantity; i++) { +- JSHandle handleTagValNextIndex(thread, JSTaggedValue(i)); ++ JSHandle handleTagValNextIndex(thread_, JSTaggedValue(i)); + + // Call "SetNextIndex" function in this TEST_F. +- handleJSArrayIter->SetNextIndex(thread, handleTagValNextIndex); ++ handleJSArrayIter->SetNextIndex(thread_, handleTagValNextIndex); + EXPECT_EQ(handleJSArrayIter->GetNextIndex().GetNumber(), i); + } + } +@@ -144,19 +144,19 @@ TEST_F(JSArrayIteratorTest, SetNextIndex) + */ + TEST_F(JSArrayIteratorTest, SetIterationKind) + { +- EcmaVM *ecmaVMPtr = thread->GetEcmaVM(); ++ EcmaVM *ecmaVMPtr = thread_->GetEcmaVM(); + ObjectFactory *factory = ecmaVMPtr->GetFactory(); + + uint32_t array[10] = {0, 6, 8, 99, 200, 1, static_cast(-1), static_cast(-199), 33, 100}; + int numArray = sizeof(array) / sizeof(array[0]); + JSHandle handleTaggedArray(factory->NewTaggedArray(numArray)); + for (int i = 0; i < numArray; i++) { +- handleTaggedArray->Set(thread, i, JSTaggedValue(array[i])); ++ handleTaggedArray->Set(thread_, i, JSTaggedValue(array[i])); + } +- JSHandle handleTagVal0(thread, JSTaggedValue(0)); +- JSHandle handleTagVal1(thread, JSTaggedValue(1)); +- JSHandle handleTagVal2(thread, JSTaggedValue(2)); +- JSHandle handleJSObjectTaggedArray(JSArray::CreateArrayFromList(thread, handleTaggedArray)); ++ JSHandle handleTagVal0(thread_, JSTaggedValue(0)); ++ JSHandle handleTagVal1(thread_, JSTaggedValue(1)); ++ JSHandle handleTagVal2(thread_, JSTaggedValue(2)); ++ JSHandle handleJSObjectTaggedArray(JSArray::CreateArrayFromList(thread_, handleTaggedArray)); + + // Call "SetIterationKind" function through "NewJSArrayIterator" function of "object_factory.cpp". + JSHandle handleJSArrayIter = +@@ -168,11 +168,11 @@ TEST_F(JSArrayIteratorTest, SetIterationKind) + EXPECT_EQ(handleJSArrayIter->GetIterationKind().GetNumber(), 2); + + // Call "SetIterationKind" function in this TEST_F. +- handleJSArrayIter->SetIterationKind(thread, handleTagVal0); ++ handleJSArrayIter->SetIterationKind(thread_, handleTagVal0); + EXPECT_EQ(handleJSArrayIter->GetIterationKind().GetNumber(), 0); +- handleJSArrayIter->SetIterationKind(thread, handleTagVal1); ++ handleJSArrayIter->SetIterationKind(thread_, handleTagVal1); + EXPECT_EQ(handleJSArrayIter->GetIterationKind().GetNumber(), 1); +- handleJSArrayIter->SetIterationKind(thread, handleTagVal2); ++ handleJSArrayIter->SetIterationKind(thread_, handleTagVal2); + EXPECT_EQ(handleJSArrayIter->GetIterationKind().GetNumber(), 2); + } + } // namespace panda::test +diff --git a/tests/runtime/common/js_array_test.cpp b/tests/runtime/common/js_array_test.cpp +index 5625398..a4933d1 100644 +--- a/tests/runtime/common/js_array_test.cpp ++++ b/tests/runtime/common/js_array_test.cpp +@@ -40,150 +40,150 @@ class JSArrayTest : public testing::Test { + public: + void SetUp() override + { +- TestHelper::CreateEcmaVMWithScope(instance, thread, scope); ++ TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); + } + + void TearDown() override + { +- TestHelper::DestroyEcmaVMWithScope(instance, scope); ++ TestHelper::DestroyEcmaVMWithScope(instance_, scope_); + } +- PandaVM *instance {nullptr}; +- EcmaHandleScope *scope {nullptr}; +- JSThread *thread {nullptr}; ++ PandaVM *instance_ {nullptr}; ++ EcmaHandleScope *scope_ {nullptr}; ++ JSThread *thread_ {nullptr}; + }; + + TEST_F(JSArrayTest, ArrayCreate) + { +- JSHandle length_key_handle(thread->GlobalConstants()->GetHandledLengthString()); +- JSArray *arr = JSArray::ArrayCreate(thread, JSTaggedNumber(0)).GetObject(); ++ JSHandle length_key_handle(thread_->GlobalConstants()->GetHandledLengthString()); ++ JSArray *arr = JSArray::ArrayCreate(thread_, JSTaggedNumber(0)).GetObject(); + EXPECT_TRUE(arr != nullptr); +- JSHandle obj(thread, arr); +- EXPECT_EQ(JSArray::GetProperty(thread, obj, length_key_handle).GetValue()->GetInt(), 0); ++ JSHandle obj(thread_, arr); ++ EXPECT_EQ(JSArray::GetProperty(thread_, obj, length_key_handle).GetValue()->GetInt(), 0); + +- JSArray *arr2 = JSArray::ArrayCreate(thread, JSTaggedNumber(10)).GetObject(); ++ JSArray *arr2 = JSArray::ArrayCreate(thread_, JSTaggedNumber(10)).GetObject(); + EXPECT_TRUE(arr2 != nullptr); +- JSHandle obj2(thread, arr2); +- EXPECT_EQ(JSArray::GetProperty(thread, obj2, length_key_handle).GetValue()->GetInt(), 10); ++ JSHandle obj2(thread_, arr2); ++ EXPECT_EQ(JSArray::GetProperty(thread_, obj2, length_key_handle).GetValue()->GetInt(), 10); + } + + TEST_F(JSArrayTest, ArraySpeciesCreate) + { +- JSHandle length_key_handle(thread->GlobalConstants()->GetHandledLengthString()); +- JSArray *arr = JSArray::ArrayCreate(thread, JSTaggedNumber(0)).GetObject(); ++ JSHandle length_key_handle(thread_->GlobalConstants()->GetHandledLengthString()); ++ JSArray *arr = JSArray::ArrayCreate(thread_, JSTaggedNumber(0)).GetObject(); + EXPECT_TRUE(arr != nullptr); +- JSHandle obj(thread, arr); +- EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(obj), length_key_handle).GetValue()->GetInt(), 0); ++ JSHandle obj(thread_, arr); ++ EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(obj), length_key_handle).GetValue()->GetInt(), 0); + +- JSArray *arr2 = JSArray::Cast(JSArray::ArraySpeciesCreate(thread, obj, JSTaggedNumber(10)).GetHeapObject()); ++ JSArray *arr2 = JSArray::Cast(JSArray::ArraySpeciesCreate(thread_, obj, JSTaggedNumber(10)).GetHeapObject()); + EXPECT_TRUE(arr2 != nullptr); +- JSHandle obj2(thread, arr2); +- EXPECT_EQ(JSArray::GetProperty(thread, obj2, length_key_handle).GetValue()->GetInt(), 10); ++ JSHandle obj2(thread_, arr2); ++ EXPECT_EQ(JSArray::GetProperty(thread_, obj2, length_key_handle).GetValue()->GetInt(), 10); + } + + TEST_F(JSArrayTest, DefineOwnProperty) + { +- auto ecma_vm = thread->GetEcmaVM(); ++ auto ecma_vm = thread_->GetEcmaVM(); + auto factory = ecma_vm->GetFactory(); +- JSHandle length_key_handle(thread->GlobalConstants()->GetHandledLengthString()); +- JSArray *arr = JSArray::ArrayCreate(thread, JSTaggedNumber(0)).GetObject(); ++ JSHandle length_key_handle(thread_->GlobalConstants()->GetHandledLengthString()); ++ JSArray *arr = JSArray::ArrayCreate(thread_, JSTaggedNumber(0)).GetObject(); + EXPECT_TRUE(arr != nullptr); +- JSHandle obj(thread, arr); +- EXPECT_EQ(JSArray::GetProperty(thread, obj, length_key_handle).GetValue()->GetInt(), 0); ++ JSHandle obj(thread_, arr); ++ EXPECT_EQ(JSArray::GetProperty(thread_, obj, length_key_handle).GetValue()->GetInt(), 0); + +- PropertyDescriptor desc(thread, JSHandle(thread, JSTaggedValue(100)), true, true, true); ++ PropertyDescriptor desc(thread_, JSHandle(thread_, JSTaggedValue(100)), true, true, true); + + EcmaLanguageContext ecmaLanguageContext; + LanguageContext ctx(&ecmaLanguageContext); + EcmaString *string1 = *factory->NewFromString("1"); +- JSHandle key1(thread, static_cast(string1)); +- JSHandle index1(thread, JSTaggedValue(1)); +- EXPECT_TRUE(JSArray::DefineOwnProperty(thread, JSHandle(obj), key1, desc)); +- EXPECT_EQ(JSArray::GetProperty(thread, obj, length_key_handle).GetValue()->GetInt(), 2); +- TaggedValue v = JSArray::GetProperty(thread, obj, key1).GetValue().GetTaggedValue(); ++ JSHandle key1(thread_, static_cast(string1)); ++ JSHandle index1(thread_, JSTaggedValue(1)); ++ EXPECT_TRUE(JSArray::DefineOwnProperty(thread_, JSHandle(obj), key1, desc)); ++ EXPECT_EQ(JSArray::GetProperty(thread_, obj, length_key_handle).GetValue()->GetInt(), 2); ++ TaggedValue v = JSArray::GetProperty(thread_, obj, key1).GetValue().GetTaggedValue(); + EXPECT_EQ(v.GetInt(), 100); +- v = JSArray::GetProperty(thread, obj, index1).GetValue().GetTaggedValue(); ++ v = JSArray::GetProperty(thread_, obj, index1).GetValue().GetTaggedValue(); + EXPECT_EQ(v.GetInt(), 100); +- EXPECT_EQ(JSArray::GetProperty(thread, obj, length_key_handle).GetValue()->GetInt(), 2); ++ EXPECT_EQ(JSArray::GetProperty(thread_, obj, length_key_handle).GetValue()->GetInt(), 2); + + EcmaString *string100 = *factory->NewFromString("100"); +- JSHandle key100(thread, static_cast(string100)); +- JSHandle index100(thread, JSTaggedValue(100)); ++ JSHandle key100(thread_, static_cast(string100)); ++ JSHandle index100(thread_, JSTaggedValue(100)); + +- EXPECT_TRUE(JSArray::DefineOwnProperty(thread, JSHandle(obj), key100, desc)); +- EXPECT_EQ(JSArray::GetProperty(thread, obj, key100).GetValue()->GetInt(), 100); +- EXPECT_EQ(JSArray::GetProperty(thread, obj, index100).GetValue()->GetInt(), 100); +- EXPECT_EQ(JSArray::GetProperty(thread, obj, length_key_handle).GetValue()->GetInt(), 101); ++ EXPECT_TRUE(JSArray::DefineOwnProperty(thread_, JSHandle(obj), key100, desc)); ++ EXPECT_EQ(JSArray::GetProperty(thread_, obj, key100).GetValue()->GetInt(), 100); ++ EXPECT_EQ(JSArray::GetProperty(thread_, obj, index100).GetValue()->GetInt(), 100); ++ EXPECT_EQ(JSArray::GetProperty(thread_, obj, length_key_handle).GetValue()->GetInt(), 101); + + EcmaString *stringx = *factory->NewFromString("2147483646"); +- JSHandle keyx(thread, static_cast(stringx)); +- JSHandle indexx(thread, JSTaggedValue(2147483646U)); // 2147483646U ++ JSHandle keyx(thread_, static_cast(stringx)); ++ JSHandle indexx(thread_, JSTaggedValue(2147483646U)); // 2147483646U + +- EXPECT_TRUE(JSArray::DefineOwnProperty(thread, JSHandle(obj), keyx, desc)); +- EXPECT_EQ(JSArray::GetProperty(thread, obj, keyx).GetValue()->GetInt(), 100); +- EXPECT_EQ(JSArray::GetProperty(thread, obj, indexx).GetValue()->GetInt(), 100); +- EXPECT_EQ(JSArray::GetProperty(thread, obj, length_key_handle).GetValue()->GetInt(), 2147483647); ++ EXPECT_TRUE(JSArray::DefineOwnProperty(thread_, JSHandle(obj), keyx, desc)); ++ EXPECT_EQ(JSArray::GetProperty(thread_, obj, keyx).GetValue()->GetInt(), 100); ++ EXPECT_EQ(JSArray::GetProperty(thread_, obj, indexx).GetValue()->GetInt(), 100); ++ EXPECT_EQ(JSArray::GetProperty(thread_, obj, length_key_handle).GetValue()->GetInt(), 2147483647); + +- EXPECT_TRUE(JSArray::DeleteProperty(thread, JSHandle(obj), indexx)); +- EXPECT_TRUE(JSArray::GetProperty(thread, obj, keyx).GetValue()->IsUndefined()); +- EXPECT_TRUE(JSArray::GetProperty(thread, obj, indexx).GetValue()->IsUndefined()); ++ EXPECT_TRUE(JSArray::DeleteProperty(thread_, JSHandle(obj), indexx)); ++ EXPECT_TRUE(JSArray::GetProperty(thread_, obj, keyx).GetValue()->IsUndefined()); ++ EXPECT_TRUE(JSArray::GetProperty(thread_, obj, indexx).GetValue()->IsUndefined()); + } + + TEST_F(JSArrayTest, Next) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle values(factory->NewTaggedArray(5)); + for (int i = 0; i < 5; i++) { +- values->Set(thread, i, JSTaggedValue(i)); ++ values->Set(thread_, i, JSTaggedValue(i)); + } +- JSHandle array(JSArray::CreateArrayFromList(thread, values)); ++ JSHandle array(JSArray::CreateArrayFromList(thread_, values)); + JSHandle iter(factory->NewJSArrayIterator(array, IterationKind::KEY)); +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + for (int i = 0; i < 5; i++) { + ecmaRuntimeCallInfo->SetThis(iter.GetTaggedValue()); + JSTaggedValue ret = JSArrayIterator::Next(ecmaRuntimeCallInfo.get()); +- JSHandle result(thread, ret); +- EXPECT_EQ(JSIterator::IteratorValue(thread, result)->GetInt(), i); ++ JSHandle result(thread_, ret); ++ EXPECT_EQ(JSIterator::IteratorValue(thread_, result)->GetInt(), i); + } +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + } + + TEST_F(JSArrayTest, Iterator) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle values(factory->NewTaggedArray(5)); + for (int i = 0; i < 5; i++) { +- values->Set(thread, i, JSTaggedValue(i)); ++ values->Set(thread_, i, JSTaggedValue(i)); + } +- JSHandle array(JSArray::CreateArrayFromList(thread, values)); ++ JSHandle array(JSArray::CreateArrayFromList(thread_, values)); + JSHandle key_iter(factory->NewJSArrayIterator(array, IterationKind::KEY)); + JSHandle value_iter(factory->NewJSArrayIterator(array, IterationKind::VALUE)); + JSHandle iter(factory->NewJSArrayIterator(array, IterationKind::KEY_AND_VALUE)); + + for (int i = 0; i < 5; i++) { + if (i == 2) { +- JSHandle key(thread, JSTaggedValue(i)); +- JSObject::DeleteProperty(thread, JSHandle(array), key); ++ JSHandle key(thread_, JSTaggedValue(i)); ++ JSObject::DeleteProperty(thread_, JSHandle(array), key); + } +- JSHandle key_result(JSIterator::IteratorStep(thread, key_iter)); +- JSHandle value_result(JSIterator::IteratorStep(thread, value_iter)); +- JSHandle iter_result(JSIterator::IteratorStep(thread, iter)); +- JSHandle iter_value(JSIterator::IteratorValue(thread, iter_result)); +- JSHandle index_key(thread, JSTaggedValue(0)); +- JSHandle element_key(thread, JSTaggedValue(1)); ++ JSHandle key_result(JSIterator::IteratorStep(thread_, key_iter)); ++ JSHandle value_result(JSIterator::IteratorStep(thread_, value_iter)); ++ JSHandle iter_result(JSIterator::IteratorStep(thread_, iter)); ++ JSHandle iter_value(JSIterator::IteratorValue(thread_, iter_result)); ++ JSHandle index_key(thread_, JSTaggedValue(0)); ++ JSHandle element_key(thread_, JSTaggedValue(1)); + if (i == 2) { +- EXPECT_EQ(i, JSIterator::IteratorValue(thread, key_result)->GetInt()); +- EXPECT_EQ(JSTaggedValue::Undefined(), JSIterator::IteratorValue(thread, value_result).GetTaggedValue()); +- EXPECT_EQ(i, JSObject::GetProperty(thread, iter_value, index_key).GetValue()->GetInt()); ++ EXPECT_EQ(i, JSIterator::IteratorValue(thread_, key_result)->GetInt()); ++ EXPECT_EQ(JSTaggedValue::Undefined(), JSIterator::IteratorValue(thread_, value_result).GetTaggedValue()); ++ EXPECT_EQ(i, JSObject::GetProperty(thread_, iter_value, index_key).GetValue()->GetInt()); + EXPECT_EQ(JSTaggedValue::Undefined(), +- JSObject::GetProperty(thread, iter_value, element_key).GetValue().GetTaggedValue()); ++ JSObject::GetProperty(thread_, iter_value, element_key).GetValue().GetTaggedValue()); + continue; + } +- EXPECT_EQ(i, JSIterator::IteratorValue(thread, key_result)->GetInt()); +- EXPECT_EQ(i, JSIterator::IteratorValue(thread, value_result)->GetInt()); +- EXPECT_EQ(i, JSObject::GetProperty(thread, iter_value, index_key).GetValue()->GetInt()); +- EXPECT_EQ(i, JSObject::GetProperty(thread, iter_value, element_key).GetValue()->GetInt()); ++ EXPECT_EQ(i, JSIterator::IteratorValue(thread_, key_result)->GetInt()); ++ EXPECT_EQ(i, JSIterator::IteratorValue(thread_, value_result)->GetInt()); ++ EXPECT_EQ(i, JSObject::GetProperty(thread_, iter_value, index_key).GetValue()->GetInt()); ++ EXPECT_EQ(i, JSObject::GetProperty(thread_, iter_value, element_key).GetValue()->GetInt()); + } + } + } // namespace panda::test +diff --git a/tests/runtime/common/js_dataview_test.cpp b/tests/runtime/common/js_dataview_test.cpp +index b230219..42315e4 100644 +--- a/tests/runtime/common/js_dataview_test.cpp ++++ b/tests/runtime/common/js_dataview_test.cpp +@@ -36,16 +36,16 @@ public: + + void SetUp() override + { +- TestHelper::CreateEcmaVMWithScope(instance, thread, scope); ++ TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); + } + + void TearDown() override + { +- TestHelper::DestroyEcmaVMWithScope(instance, scope); ++ TestHelper::DestroyEcmaVMWithScope(instance_, scope_); + } +- PandaVM *instance {nullptr}; +- ecmascript::EcmaHandleScope *scope {nullptr}; +- JSThread *thread {nullptr}; ++ PandaVM *instance_ {nullptr}; ++ ecmascript::EcmaHandleScope *scope_ {nullptr}; ++ JSThread *thread_ {nullptr}; + }; + + /* +@@ -78,7 +78,7 @@ TEST_F(JSDataViewTest, GetElementSize) + */ + TEST_F(JSDataViewTest, SetDataView) + { +- EcmaVM *ecmaVMPtr = thread->GetEcmaVM(); ++ EcmaVM *ecmaVMPtr = thread_->GetEcmaVM(); + ObjectFactory *factory = ecmaVMPtr->GetFactory(); + JSHandle handleGlobalEnv = ecmaVMPtr->GetGlobalEnv(); + +@@ -89,16 +89,16 @@ TEST_F(JSDataViewTest, SetDataView) + JSHandle handleTagValFuncArrayBuf(handleFuncArrayBuf); + JSHandle handleArrayBuf( + factory->NewJSObjectByConstructor(handleFuncArrayBuf, handleTagValFuncArrayBuf)); +- handleArrayBuf->SetArrayBufferByteLength(thread, JSTaggedValue(lengthDataArrayBuf)); ++ handleArrayBuf->SetArrayBufferByteLength(thread_, JSTaggedValue(lengthDataArrayBuf)); + + // Call "SetDataView" function through "NewJSDataView" function of "object_factory.cpp" + JSHandle handleDataView = factory->NewJSDataView(handleArrayBuf, offsetDataView, lengthDataView); + EXPECT_TRUE(handleDataView->GetDataView().IsTrue()); + + // Call "SetDataView" function in this TEST_F. +- handleDataView->SetDataView(thread, JSTaggedValue::False()); ++ handleDataView->SetDataView(thread_, JSTaggedValue::False()); + EXPECT_TRUE(handleDataView->GetDataView().IsFalse()); +- handleDataView->SetDataView(thread, JSTaggedValue::True()); ++ handleDataView->SetDataView(thread_, JSTaggedValue::True()); + EXPECT_TRUE(handleDataView->GetDataView().IsTrue()); + } + +@@ -112,7 +112,7 @@ TEST_F(JSDataViewTest, SetDataView) + */ + TEST_F(JSDataViewTest, SetViewedArrayBuffer) + { +- EcmaVM *ecmaVMPtr = thread->GetEcmaVM(); ++ EcmaVM *ecmaVMPtr = thread_->GetEcmaVM(); + ObjectFactory *factory = ecmaVMPtr->GetFactory(); + JSHandle handleFuncArrayBuf(ecmaVMPtr->GetGlobalEnv()->GetArrayBufferFunction()); + JSHandle handleTagValFuncArrayBuf(handleFuncArrayBuf); +@@ -125,21 +125,21 @@ TEST_F(JSDataViewTest, SetViewedArrayBuffer) + factory->NewJSObjectByConstructor(handleFuncArrayBuf, handleTagValFuncArrayBuf)); + JSHandle handleArrayBuf2( + factory->NewJSObjectByConstructor(handleFuncArrayBuf, handleTagValFuncArrayBuf)); +- handleArrayBuf1->SetArrayBufferByteLength(thread, JSTaggedValue(lengthDataArrayBuf1)); +- handleArrayBuf2->SetArrayBufferByteLength(thread, JSTaggedValue(lengthDataArrayBuf2)); ++ handleArrayBuf1->SetArrayBufferByteLength(thread_, JSTaggedValue(lengthDataArrayBuf1)); ++ handleArrayBuf2->SetArrayBufferByteLength(thread_, JSTaggedValue(lengthDataArrayBuf2)); + + // Call "SetViewedArrayBuffer" function through "NewJSDataView" function of "object_factory.cpp" + JSHandle handleDataView = factory->NewJSDataView(handleArrayBuf1, offsetDataView, lengthDataView); +- JSHandle handleTagValDataViewFrom1(thread, handleArrayBuf1.GetTaggedValue()); +- JSHandle handleTagValDataViewTo1(thread, handleDataView->GetViewedArrayBuffer()); +- EXPECT_TRUE(JSTaggedValue::Equal(thread, handleTagValDataViewFrom1, handleTagValDataViewTo1)); ++ JSHandle handleTagValDataViewFrom1(thread_, handleArrayBuf1.GetTaggedValue()); ++ JSHandle handleTagValDataViewTo1(thread_, handleDataView->GetViewedArrayBuffer()); ++ EXPECT_TRUE(JSTaggedValue::Equal(thread_, handleTagValDataViewFrom1, handleTagValDataViewTo1)); + + // Call "SetViewedArrayBuffer" function in this TEST_F. +- handleDataView->SetViewedArrayBuffer(thread, handleArrayBuf2.GetTaggedValue()); +- JSHandle handleTagValDataViewFrom2(thread, handleArrayBuf2.GetTaggedValue()); +- JSHandle handleTagValDataViewTo2(thread, handleDataView->GetViewedArrayBuffer()); +- EXPECT_TRUE(JSTaggedValue::Equal(thread, handleTagValDataViewFrom2, handleTagValDataViewTo2)); +- EXPECT_FALSE(JSTaggedValue::Equal(thread, handleTagValDataViewFrom1, handleTagValDataViewFrom2)); ++ handleDataView->SetViewedArrayBuffer(thread_, handleArrayBuf2.GetTaggedValue()); ++ JSHandle handleTagValDataViewFrom2(thread_, handleArrayBuf2.GetTaggedValue()); ++ JSHandle handleTagValDataViewTo2(thread_, handleDataView->GetViewedArrayBuffer()); ++ EXPECT_TRUE(JSTaggedValue::Equal(thread_, handleTagValDataViewFrom2, handleTagValDataViewTo2)); ++ EXPECT_FALSE(JSTaggedValue::Equal(thread_, handleTagValDataViewFrom1, handleTagValDataViewFrom2)); + } + + /* +@@ -152,7 +152,7 @@ TEST_F(JSDataViewTest, SetViewedArrayBuffer) + */ + TEST_F(JSDataViewTest, SetByteLength) + { +- EcmaVM *ecmaVMPtr = thread->GetEcmaVM(); ++ EcmaVM *ecmaVMPtr = thread_->GetEcmaVM(); + ObjectFactory *factory = ecmaVMPtr->GetFactory(); + JSHandle handleFuncArrayBuf(ecmaVMPtr->GetGlobalEnv()->GetArrayBufferFunction()); + JSHandle handleTagValFuncArrayBuf(handleFuncArrayBuf); +@@ -161,17 +161,17 @@ TEST_F(JSDataViewTest, SetByteLength) + int32_t offsetDataView = 4; + int32_t lengthDataView1 = 4; + int32_t lengthDataView2 = 2; +- JSHandle handleTagValLengthDataView2(thread, JSTaggedValue(lengthDataView2)); ++ JSHandle handleTagValLengthDataView2(thread_, JSTaggedValue(lengthDataView2)); + JSHandle handleArrayBuf( + factory->NewJSObjectByConstructor(handleFuncArrayBuf, handleTagValFuncArrayBuf)); +- handleArrayBuf->SetArrayBufferByteLength(thread, JSTaggedValue(lengthDataArrayBuf)); ++ handleArrayBuf->SetArrayBufferByteLength(thread_, JSTaggedValue(lengthDataArrayBuf)); + + // Call "SetByteLength" function through "NewJSDataView" function of "object_factory.cpp" + JSHandle handleDataView = factory->NewJSDataView(handleArrayBuf, offsetDataView, lengthDataView1); + EXPECT_EQ(handleDataView->GetByteLength().GetNumber(), lengthDataView1); + + // Call "SetByteLength" function in this TEST_F. +- handleDataView->SetByteLength(thread, handleTagValLengthDataView2); ++ handleDataView->SetByteLength(thread_, handleTagValLengthDataView2); + EXPECT_EQ(handleDataView->GetByteLength().GetNumber(), lengthDataView2); + } + +@@ -185,7 +185,7 @@ TEST_F(JSDataViewTest, SetByteLength) + */ + TEST_F(JSDataViewTest, SetByteOffset) + { +- EcmaVM *ecmaVMPtr = thread->GetEcmaVM(); ++ EcmaVM *ecmaVMPtr = thread_->GetEcmaVM(); + ObjectFactory *factory = ecmaVMPtr->GetFactory(); + JSHandle handleFuncArrayBuf1(ecmaVMPtr->GetGlobalEnv()->GetArrayBufferFunction()); + JSHandle handleTagValFuncArrayBuf1(handleFuncArrayBuf1); +@@ -194,17 +194,17 @@ TEST_F(JSDataViewTest, SetByteOffset) + int32_t offsetDataView1 = 4; + int32_t offsetDataView2 = 6; + int32_t lengthDataView = 2; +- JSHandle handleTagValOffsetDataView2(thread, JSTaggedValue(offsetDataView2)); ++ JSHandle handleTagValOffsetDataView2(thread_, JSTaggedValue(offsetDataView2)); + JSHandle handleArrayBuf( + factory->NewJSObjectByConstructor(handleFuncArrayBuf1, handleTagValFuncArrayBuf1)); +- handleArrayBuf->SetArrayBufferByteLength(thread, JSTaggedValue(lengthDataArrayBuf)); ++ handleArrayBuf->SetArrayBufferByteLength(thread_, JSTaggedValue(lengthDataArrayBuf)); + + // Call "SetByteOffset" function through "NewJSDataView" function of "object_factory.cpp" + JSHandle handleDataView = factory->NewJSDataView(handleArrayBuf, offsetDataView1, lengthDataView); + EXPECT_EQ(handleDataView->GetByteOffset().GetNumber(), offsetDataView1); + + // Call "SetByteOffset" function in this TEST_F. +- handleDataView->SetByteOffset(thread, handleTagValOffsetDataView2); ++ handleDataView->SetByteOffset(thread_, handleTagValOffsetDataView2); + EXPECT_EQ(handleDataView->GetByteOffset().GetNumber(), offsetDataView2); + } + } // namespace panda::test +diff --git a/tests/runtime/common/js_date_test.cpp b/tests/runtime/common/js_date_test.cpp +index d2fd80a..2a8ac69 100644 +--- a/tests/runtime/common/js_date_test.cpp ++++ b/tests/runtime/common/js_date_test.cpp +@@ -30,17 +30,17 @@ class JSDateTest : public testing::Test { + public: + void SetUp() override + { +- TestHelper::CreateEcmaVMWithScope(instance, thread, scope); ++ TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); + } + + void TearDown() override + { +- TestHelper::DestroyEcmaVMWithScope(instance, scope); ++ TestHelper::DestroyEcmaVMWithScope(instance_, scope_); + } + +- PandaVM *instance {nullptr}; +- ecmascript::EcmaHandleScope *scope {nullptr}; +- JSThread *thread; ++ PandaVM *instance_ {nullptr}; ++ ecmascript::EcmaHandleScope *scope_ {nullptr}; ++ JSThread *thread_; + }; + + JSDate *JSDateCreate(JSThread *thread) +@@ -57,11 +57,11 @@ JSDate *JSDateCreate(JSThread *thread) + TEST_F(JSDateTest, Create) + { + double tm = 0.0; +- JSHandle js_date(thread, JSDateCreate(thread)); ++ JSHandle js_date(thread_, JSDateCreate(thread_)); + EXPECT_EQ(js_date->GetTimeValue(), JSTaggedValue(tm)); + EXPECT_EQ(js_date->GetLocalOffset(), JSTaggedValue(JSDate::MAX_DOUBLE)); + tm = 28 * 60 * 60 * 1000; +- js_date->SetTimeValue(thread, JSTaggedValue(tm)); ++ js_date->SetTimeValue(thread_, JSTaggedValue(tm)); + + [[maybe_unused]] double temp = js_date->GetTimeValue().GetDouble(); + EXPECT_EQ(js_date->GetTimeValue(), JSTaggedValue(tm)); +diff --git a/tests/runtime/common/js_forin_iterator_test.cpp b/tests/runtime/common/js_forin_iterator_test.cpp +index 244493a..3f4653f 100644 +--- a/tests/runtime/common/js_forin_iterator_test.cpp ++++ b/tests/runtime/common/js_forin_iterator_test.cpp +@@ -29,57 +29,57 @@ class JSForinIteratorTest : public testing::Test { + public: + void SetUp() override + { +- TestHelper::CreateEcmaVMWithScope(instance, thread, scope); ++ TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); + } + + void TearDown() override + { +- TestHelper::DestroyEcmaVMWithScope(instance, scope); ++ TestHelper::DestroyEcmaVMWithScope(instance_, scope_); + } + +- PandaVM *instance {nullptr}; +- ecmascript::EcmaHandleScope *scope {nullptr}; +- JSThread *thread; ++ PandaVM *instance_ {nullptr}; ++ ecmascript::EcmaHandleScope *scope_ {nullptr}; ++ JSThread *thread_; + }; + + TEST_F(JSForinIteratorTest, Create) + { +- JSHandle null_handle(thread, JSTaggedValue::Null()); +- JSHandle grandfather = JSObject::ObjectCreate(thread, null_handle); +- EXPECT_TRUE(grandfather->GetPrototype(thread).IsNull()); ++ JSHandle null_handle(thread_, JSTaggedValue::Null()); ++ JSHandle grandfather = JSObject::ObjectCreate(thread_, null_handle); ++ EXPECT_TRUE(grandfather->GetPrototype(thread_).IsNull()); + +- JSHandle father = JSObject::ObjectCreate(thread, grandfather); ++ JSHandle father = JSObject::ObjectCreate(thread_, grandfather); + +- JSHandle son = JSObject::ObjectCreate(thread, father); ++ JSHandle son = JSObject::ObjectCreate(thread_, father); + +- JSHandle key1(thread->GetEcmaVM()->GetFactory()->NewFromString("key1")); +- JSHandle key2(thread->GetEcmaVM()->GetFactory()->NewFromString("key2")); +- JSHandle key3(thread->GetEcmaVM()->GetFactory()->NewFromString("key3")); +- JSHandle key1_value(thread, JSTaggedValue(1)); +- JSHandle key2_value(thread, JSTaggedValue(2)); +- JSHandle key3_value(thread, JSTaggedValue(3)); ++ JSHandle key1(thread_->GetEcmaVM()->GetFactory()->NewFromString("key1")); ++ JSHandle key2(thread_->GetEcmaVM()->GetFactory()->NewFromString("key2")); ++ JSHandle key3(thread_->GetEcmaVM()->GetFactory()->NewFromString("key3")); ++ JSHandle key1_value(thread_, JSTaggedValue(1)); ++ JSHandle key2_value(thread_, JSTaggedValue(2)); ++ JSHandle key3_value(thread_, JSTaggedValue(3)); + +- JSObject::SetProperty(thread, JSHandle(grandfather), key3, key3_value); +- JSObject::SetProperty(thread, JSHandle(father), key2, key2_value); ++ JSObject::SetProperty(thread_, JSHandle(grandfather), key3, key3_value); ++ JSObject::SetProperty(thread_, JSHandle(father), key2, key2_value); + +- JSObject::SetProperty(thread, JSHandle(son), key1, key1_value); +- JSObject::SetProperty(thread, JSHandle(son), key2, key1_value); +- JSObject::SetProperty(thread, JSHandle(son), key3, key1_value); ++ JSObject::SetProperty(thread_, JSHandle(son), key1, key1_value); ++ JSObject::SetProperty(thread_, JSHandle(son), key2, key1_value); ++ JSObject::SetProperty(thread_, JSHandle(son), key3, key1_value); + +- JSHandle it = thread->GetEcmaVM()->GetFactory()->NewJSForinIterator(JSHandle(son)); +- std::pair n1 = JSForInIterator::NextInternal(thread, it); ++ JSHandle it = thread_->GetEcmaVM()->GetFactory()->NewJSForinIterator(JSHandle(son)); ++ std::pair n1 = JSForInIterator::NextInternal(thread_, it); + EXPECT_EQ(n1.first, key1.GetTaggedValue()); + EXPECT_FALSE(n1.second); + +- std::pair n2 = JSForInIterator::NextInternal(thread, it); ++ std::pair n2 = JSForInIterator::NextInternal(thread_, it); + EXPECT_EQ(n2.first, key2.GetTaggedValue()); + EXPECT_FALSE(n2.second); + +- std::pair n3 = JSForInIterator::NextInternal(thread, it); ++ std::pair n3 = JSForInIterator::NextInternal(thread_, it); + EXPECT_EQ(n3.first, key3.GetTaggedValue()); + EXPECT_FALSE(n3.second); + +- std::pair n4 = JSForInIterator::NextInternal(thread, it); ++ std::pair n4 = JSForInIterator::NextInternal(thread_, it); + EXPECT_EQ(n4.first, JSTaggedValue::Undefined()); + EXPECT_TRUE(n4.second); + } +diff --git a/tests/runtime/common/js_function_test.cpp b/tests/runtime/common/js_function_test.cpp +index 94c2cad..c1cc6c2 100644 +--- a/tests/runtime/common/js_function_test.cpp ++++ b/tests/runtime/common/js_function_test.cpp +@@ -38,17 +38,17 @@ class JSFunctionTest : public testing::Test { + public: + void SetUp() override + { +- TestHelper::CreateEcmaVMWithScope(instance, thread, scope); ++ TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); + } + + void TearDown() override + { +- TestHelper::DestroyEcmaVMWithScope(instance, scope); ++ TestHelper::DestroyEcmaVMWithScope(instance_, scope_); + } + +- PandaVM *instance {nullptr}; +- ecmascript::EcmaHandleScope *scope {nullptr}; +- JSThread *thread; ++ PandaVM *instance_ {nullptr}; ++ ecmascript::EcmaHandleScope *scope_ {nullptr}; ++ JSThread *thread_; + }; + + JSFunction *JSObjectCreate(JSThread *thread) +@@ -60,39 +60,39 @@ JSFunction *JSObjectCreate(JSThread *thread) + + TEST_F(JSFunctionTest, Create) + { +- EcmaVM *ecma_vm = thread->GetEcmaVM(); ++ EcmaVM *ecma_vm = thread_->GetEcmaVM(); + JSHandle env = ecma_vm->GetGlobalEnv(); +- JSHandle fun_handle = thread->GetEcmaVM()->GetFactory()->NewJSFunction(env); ++ JSHandle fun_handle = thread_->GetEcmaVM()->GetFactory()->NewJSFunction(env); + EXPECT_TRUE(*fun_handle != nullptr); + EXPECT_EQ(fun_handle->GetProtoOrDynClass(), JSTaggedValue::Hole()); + +- JSHandle lexicalEnv = thread->GetEcmaVM()->GetFactory()->NewLexicalEnv(0); +- fun_handle->SetLexicalEnv(thread, lexicalEnv.GetTaggedValue()); ++ JSHandle lexicalEnv = thread_->GetEcmaVM()->GetFactory()->NewLexicalEnv(0); ++ fun_handle->SetLexicalEnv(thread_, lexicalEnv.GetTaggedValue()); + EXPECT_EQ(fun_handle->GetLexicalEnv(), lexicalEnv.GetTaggedValue()); + EXPECT_TRUE(*lexicalEnv != nullptr); + } + TEST_F(JSFunctionTest, MakeConstructor) + { +- EcmaVM *ecma_vm = thread->GetEcmaVM(); ++ EcmaVM *ecma_vm = thread_->GetEcmaVM(); + JSHandle env = ecma_vm->GetGlobalEnv(); +- JSHandle func = thread->GetEcmaVM()->GetFactory()->NewJSFunction(env, static_cast(nullptr), +- FunctionKind::BASE_CONSTRUCTOR); ++ JSHandle func = thread_->GetEcmaVM()->GetFactory()->NewJSFunction(env, static_cast(nullptr), ++ FunctionKind::BASE_CONSTRUCTOR); + EXPECT_TRUE(*func != nullptr); + JSHandle func_handle(func); + func->GetJSHClass()->SetExtensible(true); + +- JSHandle null_handle(thread, JSTaggedValue::Null()); +- JSHandle obj = JSObject::ObjectCreate(thread, null_handle); ++ JSHandle null_handle(thread_, JSTaggedValue::Null()); ++ JSHandle obj = JSObject::ObjectCreate(thread_, null_handle); + JSHandle obj_value(obj); + +- JSFunction::MakeConstructor(thread, func, obj_value); ++ JSFunction::MakeConstructor(thread_, func, obj_value); + +- JSHandle constructor_key(thread->GetEcmaVM()->GetFactory()->NewFromString("constructor")); ++ JSHandle constructor_key(thread_->GetEcmaVM()->GetFactory()->NewFromString("constructor")); + +- JSHandle proto_key(thread->GetEcmaVM()->GetFactory()->NewFromString("prototype")); +- JSTaggedValue proto = JSObject::GetProperty(thread, func_handle, proto_key).GetValue().GetTaggedValue(); ++ JSHandle proto_key(thread_->GetEcmaVM()->GetFactory()->NewFromString("prototype")); ++ JSTaggedValue proto = JSObject::GetProperty(thread_, func_handle, proto_key).GetValue().GetTaggedValue(); + JSTaggedValue constructor = +- JSObject::GetProperty(thread, JSHandle(obj), constructor_key).GetValue().GetTaggedValue(); ++ JSObject::GetProperty(thread_, JSHandle(obj), constructor_key).GetValue().GetTaggedValue(); + EXPECT_EQ(constructor, func_handle.GetTaggedValue()); + EXPECT_EQ(proto, obj.GetTaggedValue()); + EXPECT_EQ(func->GetFunctionKind(), FunctionKind::BASE_CONSTRUCTOR); +@@ -100,17 +100,17 @@ TEST_F(JSFunctionTest, MakeConstructor) + + TEST_F(JSFunctionTest, OrdinaryHasInstance) + { +- JSHandle obj_fun(thread, JSObjectCreate(thread)); ++ JSHandle obj_fun(thread_, JSObjectCreate(thread_)); + + JSHandle jsobject = +- thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(obj_fun), obj_fun); +- JSHandle obj(thread, jsobject.GetTaggedValue()); ++ thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(obj_fun), obj_fun); ++ JSHandle obj(thread_, jsobject.GetTaggedValue()); + EXPECT_TRUE(*jsobject != nullptr); + +- EcmaVM *ecma_vm = thread->GetEcmaVM(); ++ EcmaVM *ecma_vm = thread_->GetEcmaVM(); + JSHandle global_env = ecma_vm->GetGlobalEnv(); + JSHandle constructor = global_env->GetObjectFunction(); +- EXPECT_TRUE(ecmascript::JSFunction::OrdinaryHasInstance(thread, constructor, obj)); ++ EXPECT_TRUE(ecmascript::JSFunction::OrdinaryHasInstance(thread_, constructor, obj)); + } + + JSTaggedValue TestInvokeInternal(EcmaRuntimeCallInfo *argv) +@@ -123,23 +123,23 @@ JSTaggedValue TestInvokeInternal(EcmaRuntimeCallInfo *argv) + + TEST_F(JSFunctionTest, Invoke) + { +- EcmaVM *ecmaVM = thread->GetEcmaVM(); ++ EcmaVM *ecmaVM = thread_->GetEcmaVM(); + JSHandle env = ecmaVM->GetGlobalEnv(); +- JSHandle dynclass(thread, JSObjectCreate(thread)); ++ JSHandle dynclass(thread_, JSObjectCreate(thread_)); + JSHandle callee( +- thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle::Cast(dynclass), dynclass)); ++ thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle::Cast(dynclass), dynclass)); + EXPECT_TRUE(*callee != nullptr); + + char keyArray[] = "invoked"; +- JSHandle calleeKey(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(&keyArray[0])); ++ JSHandle calleeKey(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(&keyArray[0])); + JSHandle calleeFunc = +- thread->GetEcmaVM()->GetFactory()->NewJSFunction(env, reinterpret_cast(TestInvokeInternal)); ++ thread_->GetEcmaVM()->GetFactory()->NewJSFunction(env, reinterpret_cast(TestInvokeInternal)); + JSHandle calleeValue(calleeFunc); +- JSObject::SetProperty(thread, JSHandle(callee), calleeKey, calleeValue); ++ JSObject::SetProperty(thread_, JSHandle(callee), calleeKey, calleeValue); + +- InternalCallParams *arguments = thread->GetInternalCallParams(); ++ InternalCallParams *arguments = thread_->GetInternalCallParams(); + arguments->MakeArgv(JSTaggedValue(1)); +- JSTaggedValue res = JSFunction::Invoke(thread, callee, calleeKey, 1, arguments->GetArgv()); ++ JSTaggedValue res = JSFunction::Invoke(thread_, callee, calleeKey, 1, arguments->GetArgv()); + + JSTaggedValue ruler = BuiltinsBase::GetTaggedBoolean(true); + EXPECT_EQ(res.GetRawData(), ruler.GetRawData()); +@@ -147,15 +147,16 @@ TEST_F(JSFunctionTest, Invoke) + + TEST_F(JSFunctionTest, SetSymbolFunctionName) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); +- JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); ++ JSHandle env = thread_->GetEcmaVM()->GetGlobalEnv(); + JSHandle js_function = factory->NewJSFunction(env); + JSHandle symbol = factory->NewPublicSymbolWithChar("name"); + JSHandle name = factory->NewFromString("[name]"); +- JSHandle prefix(thread, JSTaggedValue::Undefined()); +- JSFunction::SetFunctionName(thread, JSHandle(js_function), JSHandle(symbol), prefix); ++ JSHandle prefix(thread_, JSTaggedValue::Undefined()); ++ JSFunction::SetFunctionName(thread_, JSHandle(js_function), JSHandle(symbol), ++ prefix); + JSHandle function_name = +- JSFunctionBase::GetFunctionName(thread, JSHandle(js_function)); ++ JSFunctionBase::GetFunctionName(thread_, JSHandle(js_function)); + EXPECT_TRUE(function_name->IsString()); + EXPECT_TRUE(EcmaString::StringsAreEqual(*(JSHandle(function_name)), *name)); + } +diff --git a/tests/runtime/common/js_handle_test.cpp b/tests/runtime/common/js_handle_test.cpp +index 280a88e..231ae08 100644 +--- a/tests/runtime/common/js_handle_test.cpp ++++ b/tests/runtime/common/js_handle_test.cpp +@@ -37,32 +37,32 @@ public: + + void SetUp() override + { +- TestHelper::CreateEcmaVMWithScope(instance, thread, scope); ++ TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); + } + + void TearDown() override + { +- TestHelper::DestroyEcmaVMWithScope(instance, scope); ++ TestHelper::DestroyEcmaVMWithScope(instance_, scope_); + } + +- PandaVM *instance {nullptr}; +- ecmascript::EcmaHandleScope *scope {nullptr}; +- JSThread *thread {nullptr}; ++ PandaVM *instance_ {nullptr}; ++ ecmascript::EcmaHandleScope *scope_ {nullptr}; ++ JSThread *thread_ {nullptr}; + }; + + TEST_F(JSHandleTest, NewGlobalHandle) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); +- auto global = thread->GetEcmaGlobalStorage(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); ++ auto global = thread_->GetEcmaGlobalStorage(); + + uintptr_t globalString = 0; + { +- [[maybe_unused]] EcmaHandleScope scope_nested(thread); ++ [[maybe_unused]] EcmaHandleScope scope_nested(thread_); + auto string1 = factory->NewFromString("test1"); + globalString = global->NewGlobalHandle(string1.GetTaggedType()); + } + // trigger GC +- thread->GetEcmaVM()->CollectGarbage(TriggerGCType::COMPRESS_FULL_GC); ++ thread_->GetEcmaVM()->CollectGarbage(TriggerGCType::COMPRESS_FULL_GC); + + // check result + EXPECT_TRUE(factory->NewFromString("test1")->Compare(*reinterpret_cast(globalString)) == 0); +@@ -83,13 +83,13 @@ static void FillGlobalString(uintptr_t globalString[], int length, EcmaGlobalSto + + TEST_F(JSHandleTest, NewGlobalHandle1) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); +- auto global = thread->GetEcmaGlobalStorage(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); ++ auto global = thread_->GetEcmaGlobalStorage(); + + uintptr_t globalString[600] = {0}; +- FillGlobalString(globalString, 600, global, factory, thread); ++ FillGlobalString(globalString, 600, global, factory, thread_); + // trigger GC +- thread->GetEcmaVM()->CollectGarbage(TriggerGCType::COMPRESS_FULL_GC); ++ thread_->GetEcmaVM()->CollectGarbage(TriggerGCType::COMPRESS_FULL_GC); + for (int i = 300; i > 200; i--) { + global->DisposeGlobalHandle(globalString[i]); + } +@@ -100,7 +100,7 @@ TEST_F(JSHandleTest, NewGlobalHandle1) + 0); + } + // trigger GC +- thread->GetEcmaVM()->CollectGarbage(TriggerGCType::COMPRESS_FULL_GC); ++ thread_->GetEcmaVM()->CollectGarbage(TriggerGCType::COMPRESS_FULL_GC); + for (int i = 301; i < 600; i++) { + std::string test = "test" + std::to_string(i); + EXPECT_TRUE(factory->NewFromString(test.c_str())->Compare(*reinterpret_cast(globalString[i])) == +@@ -110,11 +110,11 @@ TEST_F(JSHandleTest, NewGlobalHandle1) + + TEST_F(JSHandleTest, DisposeGlobalHandle) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); +- auto global = thread->GetEcmaGlobalStorage(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); ++ auto global = thread_->GetEcmaGlobalStorage(); + + uintptr_t globalString[600] = {0}; +- FillGlobalString(globalString, 600, global, factory, thread); ++ FillGlobalString(globalString, 600, global, factory, thread_); + for (int i = 512; i > 200; i--) { + global->DisposeGlobalHandle(globalString[i]); + } +@@ -129,18 +129,18 @@ TEST_F(JSHandleTest, DisposeGlobalHandle) + + TEST_F(JSHandleTest, DisposeAndNewGlobalHandle) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); +- auto global = thread->GetEcmaGlobalStorage(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); ++ auto global = thread_->GetEcmaGlobalStorage(); + + uintptr_t globalString[768] = {0}; +- FillGlobalString(globalString, 768, global, factory, thread); ++ FillGlobalString(globalString, 768, global, factory, thread_); + for (int i = 767; i > 200; i--) { + global->DisposeGlobalHandle(globalString[i]); + } + // trigger GC +- thread->GetEcmaVM()->CollectGarbage(TriggerGCType::COMPRESS_FULL_GC); ++ thread_->GetEcmaVM()->CollectGarbage(TriggerGCType::COMPRESS_FULL_GC); + { +- [[maybe_unused]] EcmaHandleScope scope_nested(thread); ++ [[maybe_unused]] EcmaHandleScope scope_nested(thread_); + for (int i = 200; i < 400; i++) { + std::string test = "test" + std::to_string(i); + auto string1 = factory->NewFromString(test.c_str()); +@@ -157,25 +157,25 @@ TEST_F(JSHandleTest, DisposeAndNewGlobalHandle) + + TEST_F(JSHandleTest, DISABLED_NewWeakGlobalHandle) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); +- auto global = thread->GetEcmaGlobalStorage(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); ++ auto global = thread_->GetEcmaGlobalStorage(); + + uintptr_t globalString = 0; + { +- [[maybe_unused]] EcmaHandleScope scope_nested(thread); ++ [[maybe_unused]] EcmaHandleScope scope_nested(thread_); + auto string1 = factory->NewFromString("test1"); + globalString = global->NewGlobalHandle(string1.GetTaggedType()); + globalString = global->SetWeak(globalString); + + // trigger GC +- thread->GetEcmaVM()->CollectGarbage(TriggerGCType::COMPRESS_FULL_GC); ++ thread_->GetEcmaVM()->CollectGarbage(TriggerGCType::COMPRESS_FULL_GC); + + // check result + EXPECT_TRUE(factory->NewFromString("test1")->Compare(*reinterpret_cast(globalString)) == 0); + EXPECT_TRUE(global->IsWeak(globalString)); + } + // trigger GC +- thread->GetEcmaVM()->CollectGarbage(TriggerGCType::COMPRESS_FULL_GC); ++ thread_->GetEcmaVM()->CollectGarbage(TriggerGCType::COMPRESS_FULL_GC); + + // check weak reference + JSTaggedType result = *reinterpret_cast(globalString); +@@ -184,12 +184,12 @@ TEST_F(JSHandleTest, DISABLED_NewWeakGlobalHandle) + + TEST_F(JSHandleTest, DISABLED_NewWeakGlobalHandle1) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); +- auto global = thread->GetEcmaGlobalStorage(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); ++ auto global = thread_->GetEcmaGlobalStorage(); + + uintptr_t globalString[800] = {0}; + { +- [[maybe_unused]] EcmaHandleScope scope_nested(thread); ++ [[maybe_unused]] EcmaHandleScope scope_nested(thread_); + for (int i = 0; i < 800; i++) { + std::string test = "test" + std::to_string(i); + auto string1 = factory->NewFromString(test.c_str()); +@@ -201,7 +201,7 @@ TEST_F(JSHandleTest, DISABLED_NewWeakGlobalHandle1) + global->DisposeGlobalHandle(globalString[i]); + } + // trigger GC +- thread->GetEcmaVM()->CollectGarbage(TriggerGCType::COMPRESS_FULL_GC); ++ thread_->GetEcmaVM()->CollectGarbage(TriggerGCType::COMPRESS_FULL_GC); + // check result + for (int i = 0; i <= 200; i++) { + std::string test = "test" + std::to_string(i); +@@ -210,7 +210,7 @@ TEST_F(JSHandleTest, DISABLED_NewWeakGlobalHandle1) + } + } + // trigger GC +- thread->GetEcmaVM()->CollectGarbage(TriggerGCType::COMPRESS_FULL_GC); ++ thread_->GetEcmaVM()->CollectGarbage(TriggerGCType::COMPRESS_FULL_GC); + for (int i = 601; i < 800; i++) { + EXPECT_TRUE(*reinterpret_cast(globalString[i]) == JSTaggedValue::Undefined().GetRawData()); + } +diff --git a/tests/runtime/common/js_iterator_test.cpp b/tests/runtime/common/js_iterator_test.cpp +index 62a98e2..a45400c 100644 +--- a/tests/runtime/common/js_iterator_test.cpp ++++ b/tests/runtime/common/js_iterator_test.cpp +@@ -40,90 +40,90 @@ class JSIteratorTest : public testing::Test { + public: + void SetUp() override + { +- TestHelper::CreateEcmaVMWithScope(instance, thread, scope); ++ TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); + } + + void TearDown() override + { +- TestHelper::DestroyEcmaVMWithScope(instance, scope); ++ TestHelper::DestroyEcmaVMWithScope(instance_, scope_); + } + +- PandaVM *instance {nullptr}; +- ecmascript::EcmaHandleScope *scope {nullptr}; +- JSThread *thread; ++ PandaVM *instance_ {nullptr}; ++ ecmascript::EcmaHandleScope *scope_ {nullptr}; ++ JSThread *thread_; + }; + + TEST_F(JSIteratorTest, GetIterator) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle data(factory->NewTaggedArray(2)); +- data->Set(thread, 0, JSTaggedValue(1)); +- data->Set(thread, 1, JSTaggedValue(1)); +- JSHandle array(JSArray::CreateArrayFromList(thread, data)); +- EXPECT_TRUE(array->IsArray(thread)); +- JSHandle iter(JSIterator::GetIterator(thread, array)); ++ data->Set(thread_, 0, JSTaggedValue(1)); ++ data->Set(thread_, 1, JSTaggedValue(1)); ++ JSHandle array(JSArray::CreateArrayFromList(thread_, data)); ++ EXPECT_TRUE(array->IsArray(thread_)); ++ JSHandle iter(JSIterator::GetIterator(thread_, array)); + EXPECT_TRUE(iter->IsJSArrayIterator()); +- EXPECT_TRUE(iter->GetIteratedArray().IsArray(thread)); ++ EXPECT_TRUE(iter->GetIteratedArray().IsArray(thread_)); + } + + TEST_F(JSIteratorTest, IteratorNext) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); +- JSHandle value_str = thread->GlobalConstants()->GetHandledValueString(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); ++ JSHandle value_str = thread_->GlobalConstants()->GetHandledValueString(); + + JSHandle data(factory->NewTaggedArray(1)); +- data->Set(thread, 0, JSTaggedValue(1)); +- JSHandle array(JSArray::CreateArrayFromList(thread, data)); +- JSHandle iter(JSIterator::GetIterator(thread, array)); +- JSHandle result(JSIterator::IteratorNextOld(thread, iter)); +- JSHandle result_value(JSObject::GetProperty(thread, result, value_str).GetValue()); ++ data->Set(thread_, 0, JSTaggedValue(1)); ++ JSHandle array(JSArray::CreateArrayFromList(thread_, data)); ++ JSHandle iter(JSIterator::GetIterator(thread_, array)); ++ JSHandle result(JSIterator::IteratorNextOld(thread_, iter)); ++ JSHandle result_value(JSObject::GetProperty(thread_, result, value_str).GetValue()); + EXPECT_EQ(result_value->GetInt(), 1); + } + + TEST_F(JSIteratorTest, IteratorComplete) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle data(factory->NewTaggedArray(2)); +- data->Set(thread, 0, JSTaggedValue(1)); +- data->Set(thread, 1, JSTaggedValue(1)); +- JSHandle array(JSArray::CreateArrayFromList(thread, data)); +- JSHandle iter(JSIterator::GetIterator(thread, array)); +- JSHandle result1(JSIterator::IteratorNextOld(thread, iter)); +- EXPECT_EQ(false, JSIterator::IteratorComplete(thread, result1)); +- JSHandle result2(JSIterator::IteratorNextOld(thread, iter)); +- EXPECT_EQ(false, JSIterator::IteratorComplete(thread, result2)); +- JSHandle result3(JSIterator::IteratorNextOld(thread, iter)); +- EXPECT_EQ(true, JSIterator::IteratorComplete(thread, result3)); ++ data->Set(thread_, 0, JSTaggedValue(1)); ++ data->Set(thread_, 1, JSTaggedValue(1)); ++ JSHandle array(JSArray::CreateArrayFromList(thread_, data)); ++ JSHandle iter(JSIterator::GetIterator(thread_, array)); ++ JSHandle result1(JSIterator::IteratorNextOld(thread_, iter)); ++ EXPECT_EQ(false, JSIterator::IteratorComplete(thread_, result1)); ++ JSHandle result2(JSIterator::IteratorNextOld(thread_, iter)); ++ EXPECT_EQ(false, JSIterator::IteratorComplete(thread_, result2)); ++ JSHandle result3(JSIterator::IteratorNextOld(thread_, iter)); ++ EXPECT_EQ(true, JSIterator::IteratorComplete(thread_, result3)); + } + + TEST_F(JSIteratorTest, IteratorValue) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + + JSHandle data(factory->NewTaggedArray(3)); +- data->Set(thread, 0, JSTaggedValue(1)); +- data->Set(thread, 1, JSTaggedValue(1)); +- data->Set(thread, 2, JSTaggedValue(1)); +- JSHandle array(JSArray::CreateArrayFromList(thread, data)); +- JSHandle iter(JSIterator::GetIterator(thread, array)); +- JSHandle result(JSIterator::IteratorNextOld(thread, iter)); +- JSHandle result_value(JSIterator::IteratorValue(thread, result)); ++ data->Set(thread_, 0, JSTaggedValue(1)); ++ data->Set(thread_, 1, JSTaggedValue(1)); ++ data->Set(thread_, 2, JSTaggedValue(1)); ++ JSHandle array(JSArray::CreateArrayFromList(thread_, data)); ++ JSHandle iter(JSIterator::GetIterator(thread_, array)); ++ JSHandle result(JSIterator::IteratorNextOld(thread_, iter)); ++ JSHandle result_value(JSIterator::IteratorValue(thread_, result)); + EXPECT_EQ(result_value->GetInt(), 1); + } + + TEST_F(JSIteratorTest, IteratorStep) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle data(factory->NewTaggedArray(2)); +- data->Set(thread, 0, JSTaggedValue(1)); +- data->Set(thread, 1, JSTaggedValue(2)); +- JSHandle array(JSArray::CreateArrayFromList(thread, data)); +- JSHandle iter(JSIterator::GetIterator(thread, array)); +- JSHandle result1(JSIterator::IteratorStep(thread, iter)); +- EXPECT_EQ(JSIterator::IteratorValue(thread, result1)->GetInt(), 1); +- JSHandle result2(JSIterator::IteratorStep(thread, iter)); +- EXPECT_EQ(JSIterator::IteratorValue(thread, result2)->GetInt(), 2); +- JSHandle result3(JSIterator::IteratorStep(thread, iter)); ++ data->Set(thread_, 0, JSTaggedValue(1)); ++ data->Set(thread_, 1, JSTaggedValue(2)); ++ JSHandle array(JSArray::CreateArrayFromList(thread_, data)); ++ JSHandle iter(JSIterator::GetIterator(thread_, array)); ++ JSHandle result1(JSIterator::IteratorStep(thread_, iter)); ++ EXPECT_EQ(JSIterator::IteratorValue(thread_, result1)->GetInt(), 1); ++ JSHandle result2(JSIterator::IteratorStep(thread_, iter)); ++ EXPECT_EQ(JSIterator::IteratorValue(thread_, result2)->GetInt(), 2); ++ JSHandle result3(JSIterator::IteratorStep(thread_, iter)); + EXPECT_EQ(result3.GetTaggedValue(), JSTaggedValue::False()); + } + +diff --git a/tests/runtime/common/js_map_test.cpp b/tests/runtime/common/js_map_test.cpp +index b041a95..f099b3a 100644 +--- a/tests/runtime/common/js_map_test.cpp ++++ b/tests/runtime/common/js_map_test.cpp +@@ -42,28 +42,28 @@ class JSMapTest : public testing::Test { + public: + void SetUp() override + { +- TestHelper::CreateEcmaVMWithScope(instance, thread, scope); ++ TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); + } + + void TearDown() override + { +- TestHelper::DestroyEcmaVMWithScope(instance, scope); ++ TestHelper::DestroyEcmaVMWithScope(instance_, scope_); + } + +- PandaVM *instance {nullptr}; +- ecmascript::EcmaHandleScope *scope {nullptr}; +- JSThread *thread; ++ PandaVM *instance_ {nullptr}; ++ ecmascript::EcmaHandleScope *scope_ {nullptr}; ++ JSThread *thread_; + + protected: + JSMap *CreateMap() + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); +- JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); ++ JSHandle env = thread_->GetEcmaVM()->GetGlobalEnv(); + JSHandle constructor = env->GetBuiltinsMapFunction(); + JSHandle map = + JSHandle::Cast(factory->NewJSObjectByConstructor(JSHandle(constructor), constructor)); +- JSHandle hashMap = LinkedHashMap::Create(thread); +- map->SetLinkedMap(thread, hashMap); ++ JSHandle hashMap = LinkedHashMap::Create(thread_); ++ map->SetLinkedMap(thread_, hashMap); + return *map; + } + }; +@@ -76,30 +76,30 @@ TEST_F(JSMapTest, MapCreate) + + TEST_F(JSMapTest, AddAndHas) + { +- ObjectFactory *factory_ = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory_ = thread_->GetEcmaVM()->GetFactory(); + // create js_map +- JSHandle map(thread, CreateMap()); ++ JSHandle map(thread_, CreateMap()); + + JSHandle key(factory_->NewFromString("key")); +- JSHandle value(thread, JSTaggedValue(1)); +- JSMap::Set(thread, map, key, value); ++ JSHandle value(thread_, JSTaggedValue(1)); ++ JSMap::Set(thread_, map, key, value); + int hash = LinkedHash::Hash(key.GetTaggedValue()); + EXPECT_TRUE(map->Has(key.GetTaggedValue(), hash)); + } + + TEST_F(JSMapTest, DeleteAndGet) + { +- ObjectFactory *factory_ = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory_ = thread_->GetEcmaVM()->GetFactory(); + // create js_map +- JSHandle map(thread, CreateMap()); ++ JSHandle map(thread_, CreateMap()); + + // add 40 keys + char key_array[] = "key0"; + for (int i = 0; i < 40; i++) { + key_array[3] = '1' + i; + JSHandle key(factory_->NewFromString(key_array)); +- JSHandle value(thread, JSTaggedValue(i)); +- JSMap::Set(thread, map, key, value); ++ JSHandle value(thread_, JSTaggedValue(i)); ++ JSMap::Set(thread_, map, key, value); + int hash = LinkedHash::Hash(key.GetTaggedValue()); + EXPECT_TRUE(map->Has(key.GetTaggedValue(), hash)); + } +@@ -108,7 +108,7 @@ TEST_F(JSMapTest, DeleteAndGet) + key_array[3] = '1' + 8; + JSHandle delete_key(factory_->NewFromString(key_array)); + EXPECT_EQ(map->GetValue(8), JSTaggedValue(8)); +- JSMap::Delete(thread, map, delete_key); ++ JSMap::Delete(thread_, map, delete_key); + int hash = LinkedHash::Hash(delete_key.GetTaggedValue()); + EXPECT_FALSE(map->Has(delete_key.GetTaggedValue(), hash)); + EXPECT_EQ(map->GetSize(), 39); +@@ -116,48 +116,48 @@ TEST_F(JSMapTest, DeleteAndGet) + + TEST_F(JSMapTest, Iterator) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + +- JSHandle map(thread, CreateMap()); ++ JSHandle map(thread_, CreateMap()); + for (int i = 0; i < 5; i++) { +- JSHandle key(thread, JSTaggedValue(i)); +- JSHandle value(thread, JSTaggedValue(i + 10)); +- JSMap::Set(thread, map, key, value); ++ JSHandle key(thread_, JSTaggedValue(i)); ++ JSHandle value(thread_, JSTaggedValue(i + 10)); ++ JSMap::Set(thread_, map, key, value); + } + + JSHandle key_iter(factory->NewJSMapIterator(map, IterationKind::KEY)); + JSHandle value_iter(factory->NewJSMapIterator(map, IterationKind::VALUE)); + JSHandle iter(factory->NewJSMapIterator(map, IterationKind::KEY_AND_VALUE)); + +- JSHandle index_key(thread, JSTaggedValue(0)); +- JSHandle element_key(thread, JSTaggedValue(1)); ++ JSHandle index_key(thread_, JSTaggedValue(0)); ++ JSHandle element_key(thread_, JSTaggedValue(1)); + +- JSHandle key_result0 = JSIterator::IteratorStep(thread, key_iter); +- JSHandle value_result0 = JSIterator::IteratorStep(thread, value_iter); +- JSHandle result0 = JSIterator::IteratorStep(thread, iter); ++ JSHandle key_result0 = JSIterator::IteratorStep(thread_, key_iter); ++ JSHandle value_result0 = JSIterator::IteratorStep(thread_, value_iter); ++ JSHandle result0 = JSIterator::IteratorStep(thread_, iter); + +- EXPECT_EQ(0, JSIterator::IteratorValue(thread, key_result0)->GetInt()); +- EXPECT_EQ(10, JSIterator::IteratorValue(thread, value_result0)->GetInt()); +- JSHandle result0_handle = JSIterator::IteratorValue(thread, result0); +- EXPECT_EQ(0, JSObject::GetProperty(thread, result0_handle, index_key).GetValue()->GetInt()); +- EXPECT_EQ(10, JSObject::GetProperty(thread, result0_handle, element_key).GetValue()->GetInt()); ++ EXPECT_EQ(0, JSIterator::IteratorValue(thread_, key_result0)->GetInt()); ++ EXPECT_EQ(10, JSIterator::IteratorValue(thread_, value_result0)->GetInt()); ++ JSHandle result0_handle = JSIterator::IteratorValue(thread_, result0); ++ EXPECT_EQ(0, JSObject::GetProperty(thread_, result0_handle, index_key).GetValue()->GetInt()); ++ EXPECT_EQ(10, JSObject::GetProperty(thread_, result0_handle, element_key).GetValue()->GetInt()); + +- JSHandle key_result1 = JSIterator::IteratorStep(thread, key_iter); +- EXPECT_EQ(1, JSIterator::IteratorValue(thread, key_result1)->GetInt()); ++ JSHandle key_result1 = JSIterator::IteratorStep(thread_, key_iter); ++ EXPECT_EQ(1, JSIterator::IteratorValue(thread_, key_result1)->GetInt()); + for (int i = 0; i < 3; i++) { +- JSHandle key(thread, JSTaggedValue(i)); +- JSMap::Delete(thread, map, key); ++ JSHandle key(thread_, JSTaggedValue(i)); ++ JSMap::Delete(thread_, map, key); + } +- JSHandle key_result2 = JSIterator::IteratorStep(thread, key_iter); +- EXPECT_EQ(3, JSIterator::IteratorValue(thread, key_result2)->GetInt()); +- JSHandle key_result3 = JSIterator::IteratorStep(thread, key_iter); +- EXPECT_EQ(4, JSIterator::IteratorValue(thread, key_result3)->GetInt()); +- JSHandle key(thread, JSTaggedValue(5)); +- JSMap::Set(thread, map, key, key); +- JSHandle key_result4 = JSIterator::IteratorStep(thread, key_iter); +- +- EXPECT_EQ(5, JSIterator::IteratorValue(thread, key_result4)->GetInt()); +- JSHandle key_result5 = JSIterator::IteratorStep(thread, key_iter); ++ JSHandle key_result2 = JSIterator::IteratorStep(thread_, key_iter); ++ EXPECT_EQ(3, JSIterator::IteratorValue(thread_, key_result2)->GetInt()); ++ JSHandle key_result3 = JSIterator::IteratorStep(thread_, key_iter); ++ EXPECT_EQ(4, JSIterator::IteratorValue(thread_, key_result3)->GetInt()); ++ JSHandle key(thread_, JSTaggedValue(5)); ++ JSMap::Set(thread_, map, key, key); ++ JSHandle key_result4 = JSIterator::IteratorStep(thread_, key_iter); ++ ++ EXPECT_EQ(5, JSIterator::IteratorValue(thread_, key_result4)->GetInt()); ++ JSHandle key_result5 = JSIterator::IteratorStep(thread_, key_iter); + EXPECT_EQ(JSTaggedValue::False(), key_result5.GetTaggedValue()); + } + +diff --git a/tests/runtime/common/js_object_test.cpp b/tests/runtime/common/js_object_test.cpp +index ef33933..63c92f5 100644 +--- a/tests/runtime/common/js_object_test.cpp ++++ b/tests/runtime/common/js_object_test.cpp +@@ -30,17 +30,17 @@ class JSObjectTest : public testing::Test { + public: + void SetUp() override + { +- TestHelper::CreateEcmaVMWithScope(instance, thread, scope); ++ TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); + } + + void TearDown() override + { +- TestHelper::DestroyEcmaVMWithScope(instance, scope); ++ TestHelper::DestroyEcmaVMWithScope(instance_, scope_); + } + +- PandaVM *instance {nullptr}; +- ecmascript::EcmaHandleScope *scope {nullptr}; +- JSThread *thread; ++ PandaVM *instance_ {nullptr}; ++ ecmascript::EcmaHandleScope *scope_ {nullptr}; ++ JSThread *thread_; + }; + + static JSFunction *JSObjectTestCreate(JSThread *thread) +@@ -51,180 +51,181 @@ static JSFunction *JSObjectTestCreate(JSThread *thread) + + TEST_F(JSObjectTest, Create) + { +- JSHandle obj_func(thread, JSObjectTestCreate(thread)); ++ JSHandle obj_func(thread_, JSObjectTestCreate(thread_)); + JSHandle jsobject = +- thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(obj_func), obj_func); ++ thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(obj_func), obj_func); + EXPECT_TRUE(*jsobject != nullptr); + } + + TEST_F(JSObjectTest, SetProperty) + { +- JSHandle obj_func(thread, JSObjectTestCreate(thread)); ++ JSHandle obj_func(thread_, JSObjectTestCreate(thread_)); + JSHandle jsobject = +- thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(obj_func), obj_func); ++ thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(obj_func), obj_func); + EXPECT_TRUE(*jsobject != nullptr); + + char array[] = "x"; +- JSHandle key(thread->GetEcmaVM()->GetFactory()->NewFromString(array)); +- JSHandle value(thread, JSTaggedValue(1)); ++ JSHandle key(thread_->GetEcmaVM()->GetFactory()->NewFromString(array)); ++ JSHandle value(thread_, JSTaggedValue(1)); + +- JSObject::SetProperty(thread, JSHandle(jsobject), key, value); +- EXPECT_EQ(JSObject::GetProperty(thread, JSHandle(jsobject), key).GetValue()->GetInt(), 1); ++ JSObject::SetProperty(thread_, JSHandle(jsobject), key, value); ++ EXPECT_EQ(JSObject::GetProperty(thread_, JSHandle(jsobject), key).GetValue()->GetInt(), 1); + +- JSHandle value2(thread, JSTaggedValue(2)); +- JSObject::SetProperty(thread, JSHandle(jsobject), key, value2); +- EXPECT_EQ(JSObject::GetProperty(thread, JSHandle(jsobject), key).GetValue()->GetInt(), 2); ++ JSHandle value2(thread_, JSTaggedValue(2)); ++ JSObject::SetProperty(thread_, JSHandle(jsobject), key, value2); ++ EXPECT_EQ(JSObject::GetProperty(thread_, JSHandle(jsobject), key).GetValue()->GetInt(), 2); + } + + TEST_F(JSObjectTest, GetProperty) + { +- JSHandle obj_func(thread, JSObjectTestCreate(thread)); ++ JSHandle obj_func(thread_, JSObjectTestCreate(thread_)); + JSHandle obj = +- thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(obj_func), obj_func); ++ thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(obj_func), obj_func); + EXPECT_TRUE(*obj != nullptr); + + char array[] = "x"; +- JSHandle key(thread->GetEcmaVM()->GetFactory()->NewFromString(array)); +- JSHandle value(thread, JSTaggedValue(1)); ++ JSHandle key(thread_->GetEcmaVM()->GetFactory()->NewFromString(array)); ++ JSHandle value(thread_, JSTaggedValue(1)); + +- EXPECT_TRUE(JSObject::GetProperty(thread, JSHandle(obj), key).GetValue()->IsUndefined()); ++ EXPECT_TRUE(JSObject::GetProperty(thread_, JSHandle(obj), key).GetValue()->IsUndefined()); + +- JSObject::SetProperty(thread, JSHandle(obj), key, value); +- EXPECT_EQ(JSObject::GetProperty(thread, JSHandle(obj), key).GetValue()->GetInt(), 1); ++ JSObject::SetProperty(thread_, JSHandle(obj), key, value); ++ EXPECT_EQ(JSObject::GetProperty(thread_, JSHandle(obj), key).GetValue()->GetInt(), 1); + } + + TEST_F(JSObjectTest, DeleteProperty) + { +- JSHandle obj_func(thread, JSObjectTestCreate(thread)); ++ JSHandle obj_func(thread_, JSObjectTestCreate(thread_)); + JSHandle obj = +- thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(obj_func), obj_func); ++ thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(obj_func), obj_func); + EXPECT_TRUE(*obj != nullptr); + + char array[] = "print"; +- JSHandle key(thread->GetEcmaVM()->GetFactory()->NewFromString(array)); +- JSHandle value(thread, JSTaggedValue(1)); ++ JSHandle key(thread_->GetEcmaVM()->GetFactory()->NewFromString(array)); ++ JSHandle value(thread_, JSTaggedValue(1)); + +- JSObject::DeleteProperty(thread, (obj), key); +- EXPECT_TRUE(JSObject::GetProperty(thread, JSHandle(obj), key).GetValue()->IsUndefined()); ++ JSObject::DeleteProperty(thread_, (obj), key); ++ EXPECT_TRUE(JSObject::GetProperty(thread_, JSHandle(obj), key).GetValue()->IsUndefined()); + +- JSObject::SetProperty(thread, JSHandle(obj), key, value); +- EXPECT_EQ(JSObject::GetProperty(thread, JSHandle(obj), key).GetValue()->GetInt(), 1); ++ JSObject::SetProperty(thread_, JSHandle(obj), key, value); ++ EXPECT_EQ(JSObject::GetProperty(thread_, JSHandle(obj), key).GetValue()->GetInt(), 1); + +- JSHandle key2(thread->GetEcmaVM()->GetFactory()->NewFromString("print_test")); +- JSObject::SetProperty(thread, JSHandle(obj), key2, +- JSHandle(thread, JSTaggedValue(10))); +- EXPECT_EQ(JSObject::GetProperty(thread, JSHandle(obj), key2).GetValue()->GetInt(), 10); ++ JSHandle key2(thread_->GetEcmaVM()->GetFactory()->NewFromString("print_test")); ++ JSObject::SetProperty(thread_, JSHandle(obj), key2, ++ JSHandle(thread_, JSTaggedValue(10))); ++ EXPECT_EQ(JSObject::GetProperty(thread_, JSHandle(obj), key2).GetValue()->GetInt(), 10); + +- JSObject::DeleteProperty(thread, (obj), key); +- EXPECT_TRUE(JSObject::GetProperty(thread, JSHandle(obj), key).GetValue()->IsUndefined()); +- EXPECT_EQ(JSObject::GetProperty(thread, JSHandle(obj), key2).GetValue()->GetInt(), 10); ++ JSObject::DeleteProperty(thread_, (obj), key); ++ EXPECT_TRUE(JSObject::GetProperty(thread_, JSHandle(obj), key).GetValue()->IsUndefined()); ++ EXPECT_EQ(JSObject::GetProperty(thread_, JSHandle(obj), key2).GetValue()->GetInt(), 10); + } + + TEST_F(JSObjectTest, DeletePropertyGlobal) + { +- JSHandle global_env = thread->GetEcmaVM()->GetGlobalEnv(); +- JSHandle global(thread, global_env->GetGlobalObject()); +- JSHandle print_key(thread->GetEcmaVM()->GetFactory()->NewFromString("print")); +- JSHandle print_test_key(thread->GetEcmaVM()->GetFactory()->NewFromString("print_test")); ++ JSHandle global_env = thread_->GetEcmaVM()->GetGlobalEnv(); ++ JSHandle global(thread_, global_env->GetGlobalObject()); ++ JSHandle print_key(thread_->GetEcmaVM()->GetFactory()->NewFromString("print")); ++ JSHandle print_test_key(thread_->GetEcmaVM()->GetFactory()->NewFromString("print_test")); + +- JSHandle value = JSObject::GetProperty(thread, global, print_key).GetValue(); ++ JSHandle value = JSObject::GetProperty(thread_, global, print_key).GetValue(); + +- JSObject::SetProperty(thread, global, print_test_key, value); ++ JSObject::SetProperty(thread_, global, print_test_key, value); + +- JSTaggedValue val2 = JSObject::GetProperty(thread, global, print_test_key).GetValue().GetTaggedValue(); ++ JSTaggedValue val2 = JSObject::GetProperty(thread_, global, print_test_key).GetValue().GetTaggedValue(); + EXPECT_EQ(val2, value.GetTaggedValue()); +- JSTaggedValue::DeletePropertyOrThrow(thread, global, print_test_key); +- JSTaggedValue val3 = JSObject::GetProperty(thread, global, print_key).GetValue().GetTaggedValue(); ++ JSTaggedValue::DeletePropertyOrThrow(thread_, global, print_test_key); ++ JSTaggedValue val3 = JSObject::GetProperty(thread_, global, print_key).GetValue().GetTaggedValue(); + EXPECT_NE(val3, JSTaggedValue::Undefined()); + } + + TEST_F(JSObjectTest, GetPropertyInPrototypeChain) + { +- JSHandle null_handle(thread, JSTaggedValue::Null()); +- JSHandle grandfather = JSObject::ObjectCreate(thread, null_handle); +- JSHandle father = JSObject::ObjectCreate(thread, grandfather); +- JSHandle son = JSObject::ObjectCreate(thread, father); +- +- JSHandle son_key(thread->GetEcmaVM()->GetFactory()->NewFromString("key1")); +- JSHandle father_key(thread->GetEcmaVM()->GetFactory()->NewFromString("key2")); +- JSHandle grandfather_key(thread->GetEcmaVM()->GetFactory()->NewFromString("key3")); +- JSHandle son_value(thread, JSTaggedValue(1)); +- JSHandle father_value(thread, JSTaggedValue(2)); +- JSHandle grandfather_value(thread, JSTaggedValue(3)); +- +- JSObject::SetProperty(thread, JSHandle(son), son_key, son_value); +- JSObject::SetProperty(thread, JSHandle(father), father_key, father_value); +- JSObject::SetProperty(thread, JSHandle(grandfather), grandfather_key, grandfather_value); ++ JSHandle null_handle(thread_, JSTaggedValue::Null()); ++ JSHandle grandfather = JSObject::ObjectCreate(thread_, null_handle); ++ JSHandle father = JSObject::ObjectCreate(thread_, grandfather); ++ JSHandle son = JSObject::ObjectCreate(thread_, father); ++ ++ JSHandle son_key(thread_->GetEcmaVM()->GetFactory()->NewFromString("key1")); ++ JSHandle father_key(thread_->GetEcmaVM()->GetFactory()->NewFromString("key2")); ++ JSHandle grandfather_key(thread_->GetEcmaVM()->GetFactory()->NewFromString("key3")); ++ JSHandle son_value(thread_, JSTaggedValue(1)); ++ JSHandle father_value(thread_, JSTaggedValue(2)); ++ JSHandle grandfather_value(thread_, JSTaggedValue(3)); ++ ++ JSObject::SetProperty(thread_, JSHandle(son), son_key, son_value); ++ JSObject::SetProperty(thread_, JSHandle(father), father_key, father_value); ++ JSObject::SetProperty(thread_, JSHandle(grandfather), grandfather_key, grandfather_value); + + EXPECT_EQ(son_value.GetTaggedValue(), +- JSObject::GetProperty(thread, JSHandle(son), son_key).GetValue().GetTaggedValue()); ++ JSObject::GetProperty(thread_, JSHandle(son), son_key).GetValue().GetTaggedValue()); + EXPECT_EQ(father_value.GetTaggedValue(), +- JSObject::GetProperty(thread, JSHandle(son), father_key).GetValue().GetTaggedValue()); +- EXPECT_EQ(grandfather_value.GetTaggedValue(), +- JSObject::GetProperty(thread, JSHandle(son), grandfather_key).GetValue().GetTaggedValue()); ++ JSObject::GetProperty(thread_, JSHandle(son), father_key).GetValue().GetTaggedValue()); ++ EXPECT_EQ( ++ grandfather_value.GetTaggedValue(), ++ JSObject::GetProperty(thread_, JSHandle(son), grandfather_key).GetValue().GetTaggedValue()); + } + + TEST_F(JSObjectTest, PropertyAttribute) + { +- JSHandle constructor(thread, JSObjectTestCreate(thread)); ++ JSHandle constructor(thread_, JSObjectTestCreate(thread_)); + JSHandle obj1 = +- thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(constructor), constructor); ++ thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(constructor), constructor); + JSHandle obj2 = +- thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(constructor), constructor); ++ thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(constructor), constructor); + +- JSHandle key1(thread->GetEcmaVM()->GetFactory()->NewFromString("key3")); +- JSHandle key2(thread->GetEcmaVM()->GetFactory()->NewFromString("key3")); ++ JSHandle key1(thread_->GetEcmaVM()->GetFactory()->NewFromString("key3")); ++ JSHandle key2(thread_->GetEcmaVM()->GetFactory()->NewFromString("key3")); + +- JSHandle value1(thread, JSTaggedValue(1)); +- JSHandle value2(thread, JSTaggedValue(2)); ++ JSHandle value1(thread_, JSTaggedValue(1)); ++ JSHandle value2(thread_, JSTaggedValue(2)); + + // test set property +- PropertyDescriptor desc(thread); ++ PropertyDescriptor desc(thread_); + desc.SetValue(value1); + desc.SetWritable(false); +- JSObject::DefineOwnProperty(thread, obj1, key1, desc); +- JSObject::SetProperty(thread, JSHandle(obj1), key1, value2); +- JSObject::SetProperty(thread, JSHandle(obj2), key1, value1); +- JSObject::SetProperty(thread, JSHandle(obj2), key1, value2); +- EXPECT_EQ(JSObject::GetProperty(thread, JSHandle(obj1), key1).GetValue().GetTaggedValue(), ++ JSObject::DefineOwnProperty(thread_, obj1, key1, desc); ++ JSObject::SetProperty(thread_, JSHandle(obj1), key1, value2); ++ JSObject::SetProperty(thread_, JSHandle(obj2), key1, value1); ++ JSObject::SetProperty(thread_, JSHandle(obj2), key1, value2); ++ EXPECT_EQ(JSObject::GetProperty(thread_, JSHandle(obj1), key1).GetValue().GetTaggedValue(), + value1.GetTaggedValue()); +- EXPECT_EQ(JSObject::GetProperty(thread, JSHandle(obj2), key1).GetValue().GetTaggedValue(), ++ EXPECT_EQ(JSObject::GetProperty(thread_, JSHandle(obj2), key1).GetValue().GetTaggedValue(), + value2.GetTaggedValue()); + + // test delete property +- PropertyDescriptor desc1(thread); ++ PropertyDescriptor desc1(thread_); + desc1.SetValue(value1); + desc1.SetConfigurable(false); +- JSObject::DefineOwnProperty(thread, obj1, key2, desc1); +- JSObject::SetProperty(thread, JSHandle(obj1), key2, value1); +- JSObject::SetProperty(thread, JSHandle(obj2), key2, value1); +- JSObject::DeleteProperty(thread, (obj1), key2); +- JSObject::DeleteProperty(thread, (obj2), key2); +- EXPECT_EQ(JSObject::GetProperty(thread, JSHandle(obj1), key2).GetValue().GetTaggedValue(), ++ JSObject::DefineOwnProperty(thread_, obj1, key2, desc1); ++ JSObject::SetProperty(thread_, JSHandle(obj1), key2, value1); ++ JSObject::SetProperty(thread_, JSHandle(obj2), key2, value1); ++ JSObject::DeleteProperty(thread_, (obj1), key2); ++ JSObject::DeleteProperty(thread_, (obj2), key2); ++ EXPECT_EQ(JSObject::GetProperty(thread_, JSHandle(obj1), key2).GetValue().GetTaggedValue(), + value1.GetTaggedValue()); +- EXPECT_EQ(JSObject::GetProperty(thread, JSHandle(obj2), key2).GetValue().GetTaggedValue(), ++ EXPECT_EQ(JSObject::GetProperty(thread_, JSHandle(obj2), key2).GetValue().GetTaggedValue(), + JSTaggedValue::Undefined()); + } + + TEST_F(JSObjectTest, CreateDataProperty) + { +- JSHandle obj_func(thread, JSObjectTestCreate(thread)); ++ JSHandle obj_func(thread_, JSObjectTestCreate(thread_)); + JSHandle obj = +- thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(obj_func), obj_func); ++ thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(obj_func), obj_func); + EXPECT_TRUE(*obj != nullptr); + + char array[] = "x"; +- JSHandle key(thread->GetEcmaVM()->GetFactory()->NewFromString(array)); +- JSHandle value(thread, JSTaggedValue(1)); ++ JSHandle key(thread_->GetEcmaVM()->GetFactory()->NewFromString(array)); ++ JSHandle value(thread_, JSTaggedValue(1)); + +- bool success = JSObject::CreateDataProperty(thread, obj, key, value); ++ bool success = JSObject::CreateDataProperty(thread_, obj, key, value); + EXPECT_TRUE(success); + +- success = JSTaggedValue::HasOwnProperty(thread, JSHandle::Cast(obj), key); ++ success = JSTaggedValue::HasOwnProperty(thread_, JSHandle::Cast(obj), key); + EXPECT_TRUE(success); + +- PropertyDescriptor desc(thread); +- success = JSObject::GetOwnProperty(thread, obj, key, desc); ++ PropertyDescriptor desc(thread_); ++ success = JSObject::GetOwnProperty(thread_, obj, key, desc); + EXPECT_TRUE(success); + EXPECT_EQ(true, desc.IsWritable()); + EXPECT_EQ(true, desc.IsEnumerable()); +@@ -233,23 +234,23 @@ TEST_F(JSObjectTest, CreateDataProperty) + + TEST_F(JSObjectTest, CreateMethodProperty) + { +- JSHandle obj_func(thread, JSObjectTestCreate(thread)); ++ JSHandle obj_func(thread_, JSObjectTestCreate(thread_)); + JSHandle obj = +- thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(obj_func), obj_func); ++ thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(obj_func), obj_func); + EXPECT_TRUE(*obj != nullptr); + + char array[] = "x"; +- JSHandle key(thread->GetEcmaVM()->GetFactory()->NewFromString(array)); +- JSHandle value(thread, JSTaggedValue(1)); ++ JSHandle key(thread_->GetEcmaVM()->GetFactory()->NewFromString(array)); ++ JSHandle value(thread_, JSTaggedValue(1)); + +- bool success = JSObject::CreateMethodProperty(thread, obj, key, value); ++ bool success = JSObject::CreateMethodProperty(thread_, obj, key, value); + EXPECT_TRUE(success); + +- success = JSTaggedValue::HasOwnProperty(thread, JSHandle::Cast(obj), key); ++ success = JSTaggedValue::HasOwnProperty(thread_, JSHandle::Cast(obj), key); + EXPECT_TRUE(success); + +- PropertyDescriptor desc(thread); +- success = JSObject::GetOwnProperty(thread, obj, key, desc); ++ PropertyDescriptor desc(thread_); ++ success = JSObject::GetOwnProperty(thread_, obj, key, desc); + EXPECT_TRUE(success); + EXPECT_EQ(true, desc.IsWritable()); + EXPECT_EQ(false, desc.IsEnumerable()); +@@ -258,251 +259,251 @@ TEST_F(JSObjectTest, CreateMethodProperty) + + TEST_F(JSObjectTest, DefinePropertyOrThrow) + { +- JSHandle obj_func(thread, JSObjectTestCreate(thread)); ++ JSHandle obj_func(thread_, JSObjectTestCreate(thread_)); + JSHandle obj = +- thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(obj_func), obj_func); ++ thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(obj_func), obj_func); + EXPECT_TRUE(*obj != nullptr); + + char array[] = "x"; +- JSHandle key(thread->GetEcmaVM()->GetFactory()->NewFromString(array)); ++ JSHandle key(thread_->GetEcmaVM()->GetFactory()->NewFromString(array)); + +- PropertyDescriptor desc1(thread, JSHandle(thread, JSTaggedValue(1)), true, true, true); +- bool success = JSTaggedValue::DefinePropertyOrThrow(thread, JSHandle(obj), key, desc1); ++ PropertyDescriptor desc1(thread_, JSHandle(thread_, JSTaggedValue(1)), true, true, true); ++ bool success = JSTaggedValue::DefinePropertyOrThrow(thread_, JSHandle(obj), key, desc1); + EXPECT_TRUE(success); +- PropertyDescriptor desc_res1(thread); +- success = JSObject::GetOwnProperty(thread, obj, key, desc_res1); ++ PropertyDescriptor desc_res1(thread_); ++ success = JSObject::GetOwnProperty(thread_, obj, key, desc_res1); + EXPECT_TRUE(success); + EXPECT_EQ(1, desc_res1.GetValue()->GetInt()); + EXPECT_EQ(true, desc_res1.IsWritable()); + EXPECT_EQ(true, desc_res1.IsEnumerable()); + EXPECT_EQ(true, desc_res1.IsConfigurable()); + +- PropertyDescriptor desc2(thread, false, true, true); +- success = JSTaggedValue::DefinePropertyOrThrow(thread, JSHandle(obj), key, desc2); ++ PropertyDescriptor desc2(thread_, false, true, true); ++ success = JSTaggedValue::DefinePropertyOrThrow(thread_, JSHandle(obj), key, desc2); + EXPECT_TRUE(success); +- PropertyDescriptor desc_res2(thread); +- success = JSObject::GetOwnProperty(thread, obj, key, desc_res2); ++ PropertyDescriptor desc_res2(thread_); ++ success = JSObject::GetOwnProperty(thread_, obj, key, desc_res2); + EXPECT_TRUE(success); + EXPECT_EQ(1, desc_res2.GetValue()->GetInt()); + EXPECT_EQ(false, desc_res2.IsWritable()); + EXPECT_EQ(true, desc_res2.IsEnumerable()); + EXPECT_EQ(true, desc_res2.IsConfigurable()); + +- PropertyDescriptor desc3(thread); ++ PropertyDescriptor desc3(thread_); + desc3.SetWritable(false); + desc3.SetEnumerable(false); + desc3.SetConfigurable(false); +- success = JSTaggedValue::DefinePropertyOrThrow(thread, JSHandle(obj), key, desc3); ++ success = JSTaggedValue::DefinePropertyOrThrow(thread_, JSHandle(obj), key, desc3); + EXPECT_TRUE(success); +- PropertyDescriptor desc_res3(thread); +- success = JSObject::GetOwnProperty(thread, obj, key, desc_res3); ++ PropertyDescriptor desc_res3(thread_); ++ success = JSObject::GetOwnProperty(thread_, obj, key, desc_res3); + EXPECT_TRUE(success); + EXPECT_EQ(1, desc_res3.GetValue()->GetInt()); + EXPECT_EQ(false, desc_res3.IsWritable()); + EXPECT_EQ(false, desc_res3.IsEnumerable()); + EXPECT_EQ(false, desc_res3.IsConfigurable()); + +- PropertyDescriptor desc4(thread, JSHandle(thread, JSTaggedValue(2))); +- success = JSTaggedValue::DefinePropertyOrThrow(thread, JSHandle(obj), key, desc4); ++ PropertyDescriptor desc4(thread_, JSHandle(thread_, JSTaggedValue(2))); ++ success = JSTaggedValue::DefinePropertyOrThrow(thread_, JSHandle(obj), key, desc4); + EXPECT_FALSE(success); + } + + TEST_F(JSObjectTest, HasProperty) + { +- JSHandle obj_func(thread, JSObjectTestCreate(thread)); ++ JSHandle obj_func(thread_, JSObjectTestCreate(thread_)); + JSHandle obj = +- thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(obj_func), obj_func); ++ thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(obj_func), obj_func); + EXPECT_TRUE(*obj != nullptr); + + char array[] = "x"; +- JSHandle key(thread->GetEcmaVM()->GetFactory()->NewFromString(array)); +- JSHandle value(thread, JSTaggedValue(1)); ++ JSHandle key(thread_->GetEcmaVM()->GetFactory()->NewFromString(array)); ++ JSHandle value(thread_, JSTaggedValue(1)); + +- bool flag = JSObject::HasProperty(thread, obj, key); ++ bool flag = JSObject::HasProperty(thread_, obj, key); + EXPECT_FALSE(flag); + +- JSObject::SetProperty(thread, JSHandle(obj), key, value); +- flag = JSObject::HasProperty(thread, obj, key); ++ JSObject::SetProperty(thread_, JSHandle(obj), key, value); ++ flag = JSObject::HasProperty(thread_, obj, key); + EXPECT_TRUE(flag); + +- JSObject::DeleteProperty(thread, (obj), key); +- flag = JSObject::HasProperty(thread, obj, key); ++ JSObject::DeleteProperty(thread_, (obj), key); ++ flag = JSObject::HasProperty(thread_, obj, key); + EXPECT_FALSE(flag); + } + + TEST_F(JSObjectTest, HasPropertyWithProtoType) + { +- JSHandle null_handle(thread, JSTaggedValue::Null()); +- JSHandle grandfather = JSObject::ObjectCreate(thread, null_handle); +- JSHandle father = JSObject::ObjectCreate(thread, grandfather); +- JSHandle son = JSObject::ObjectCreate(thread, father); +- +- auto test_grand = grandfather->GetPrototype(thread); +- auto test_father = father->GetPrototype(thread); +- auto test_son = son->GetPrototype(thread); ++ JSHandle null_handle(thread_, JSTaggedValue::Null()); ++ JSHandle grandfather = JSObject::ObjectCreate(thread_, null_handle); ++ JSHandle father = JSObject::ObjectCreate(thread_, grandfather); ++ JSHandle son = JSObject::ObjectCreate(thread_, father); ++ ++ auto test_grand = grandfather->GetPrototype(thread_); ++ auto test_father = father->GetPrototype(thread_); ++ auto test_son = son->GetPrototype(thread_); + EXPECT_TRUE(test_son != test_father); + EXPECT_TRUE(test_grand != test_father); +- JSHandle son_key(thread->GetEcmaVM()->GetFactory()->NewFromString("key1")); +- JSHandle father_key(thread->GetEcmaVM()->GetFactory()->NewFromString("key2")); +- JSHandle grandfather_key(thread->GetEcmaVM()->GetFactory()->NewFromString("key3")); +- JSHandle son_value(thread, JSTaggedValue(1)); +- JSHandle father_value(thread, JSTaggedValue(2)); +- JSHandle grandfather_value(thread, JSTaggedValue(3)); +- +- JSObject::SetProperty(thread, JSHandle(son), son_key, son_value); +- JSObject::SetProperty(thread, JSHandle(father), father_key, father_value); +- JSObject::SetProperty(thread, JSHandle(grandfather), grandfather_key, grandfather_value); +- +- bool flag = JSObject::HasProperty(thread, son, son_key); ++ JSHandle son_key(thread_->GetEcmaVM()->GetFactory()->NewFromString("key1")); ++ JSHandle father_key(thread_->GetEcmaVM()->GetFactory()->NewFromString("key2")); ++ JSHandle grandfather_key(thread_->GetEcmaVM()->GetFactory()->NewFromString("key3")); ++ JSHandle son_value(thread_, JSTaggedValue(1)); ++ JSHandle father_value(thread_, JSTaggedValue(2)); ++ JSHandle grandfather_value(thread_, JSTaggedValue(3)); ++ ++ JSObject::SetProperty(thread_, JSHandle(son), son_key, son_value); ++ JSObject::SetProperty(thread_, JSHandle(father), father_key, father_value); ++ JSObject::SetProperty(thread_, JSHandle(grandfather), grandfather_key, grandfather_value); ++ ++ bool flag = JSObject::HasProperty(thread_, son, son_key); + EXPECT_TRUE(flag); +- flag = JSObject::HasProperty(thread, son, father_key); ++ flag = JSObject::HasProperty(thread_, son, father_key); + EXPECT_TRUE(flag); +- flag = JSObject::HasProperty(thread, son, grandfather_key); ++ flag = JSObject::HasProperty(thread_, son, grandfather_key); + EXPECT_TRUE(flag); + } + + TEST_F(JSObjectTest, HasOwnProperty) + { +- JSHandle null_handle(thread, JSTaggedValue::Null()); +- JSHandle grandfather = JSObject::ObjectCreate(thread, null_handle); +- JSHandle father = JSObject::ObjectCreate(thread, grandfather); +- JSHandle son = JSObject::ObjectCreate(thread, father); +- +- JSHandle son_key(thread->GetEcmaVM()->GetFactory()->NewFromString("key1")); +- JSHandle father_key(thread->GetEcmaVM()->GetFactory()->NewFromString("key2")); +- JSHandle grandfather_key(thread->GetEcmaVM()->GetFactory()->NewFromString("key3")); +- JSHandle son_value(thread, JSTaggedValue(1)); +- JSHandle father_value(thread, JSTaggedValue(2)); +- JSHandle grandfather_value(thread, JSTaggedValue(3)); +- +- JSObject::SetProperty(thread, JSHandle(son), son_key, son_value); +- JSObject::SetProperty(thread, JSHandle(father), father_key, father_value); +- JSObject::SetProperty(thread, JSHandle(grandfather), grandfather_key, grandfather_value); +- +- bool flag = JSTaggedValue::HasOwnProperty(thread, JSHandle::Cast(son), son_key); ++ JSHandle null_handle(thread_, JSTaggedValue::Null()); ++ JSHandle grandfather = JSObject::ObjectCreate(thread_, null_handle); ++ JSHandle father = JSObject::ObjectCreate(thread_, grandfather); ++ JSHandle son = JSObject::ObjectCreate(thread_, father); ++ ++ JSHandle son_key(thread_->GetEcmaVM()->GetFactory()->NewFromString("key1")); ++ JSHandle father_key(thread_->GetEcmaVM()->GetFactory()->NewFromString("key2")); ++ JSHandle grandfather_key(thread_->GetEcmaVM()->GetFactory()->NewFromString("key3")); ++ JSHandle son_value(thread_, JSTaggedValue(1)); ++ JSHandle father_value(thread_, JSTaggedValue(2)); ++ JSHandle grandfather_value(thread_, JSTaggedValue(3)); ++ ++ JSObject::SetProperty(thread_, JSHandle(son), son_key, son_value); ++ JSObject::SetProperty(thread_, JSHandle(father), father_key, father_value); ++ JSObject::SetProperty(thread_, JSHandle(grandfather), grandfather_key, grandfather_value); ++ ++ bool flag = JSTaggedValue::HasOwnProperty(thread_, JSHandle::Cast(son), son_key); + EXPECT_TRUE(flag); +- flag = JSTaggedValue::HasOwnProperty(thread, JSHandle::Cast(son), father_key); ++ flag = JSTaggedValue::HasOwnProperty(thread_, JSHandle::Cast(son), father_key); + EXPECT_FALSE(flag); +- flag = JSTaggedValue::HasOwnProperty(thread, JSHandle::Cast(son), grandfather_key); ++ flag = JSTaggedValue::HasOwnProperty(thread_, JSHandle::Cast(son), grandfather_key); + EXPECT_FALSE(flag); + } + + TEST_F(JSObjectTest, GetOwnPropertyKeys) + { +- JSHandle constructor(thread, JSObjectTestCreate(thread)); ++ JSHandle constructor(thread_, JSObjectTestCreate(thread_)); + JSHandle obj = +- thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(constructor), constructor); +- +- JSHandle key1(thread->GetEcmaVM()->GetFactory()->NewFromString("x")); +- JSHandle key2(thread->GetEcmaVM()->GetFactory()->NewFromString("y")); +- JSHandle key3(thread->GetEcmaVM()->GetFactory()->NewFromString("3")); +- JSHandle key4(thread->GetEcmaVM()->GetFactory()->NewFromString("4")); +- JSHandle value1(thread, JSTaggedValue(1)); +- JSHandle value2(thread, JSTaggedValue(2)); +- JSHandle value3(thread, JSTaggedValue(3)); +- JSHandle value4(thread, JSTaggedValue(4)); +- +- JSObject::SetProperty(thread, JSHandle(obj), key1, value1); +- JSObject::SetProperty(thread, JSHandle(obj), key2, value2); +- JSObject::SetProperty(thread, JSHandle(obj), key3, value3); +- JSObject::SetProperty(thread, JSHandle(obj), key4, value4); +- +- JSHandle array = JSObject::GetOwnPropertyKeys(thread, obj); ++ thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(constructor), constructor); ++ ++ JSHandle key1(thread_->GetEcmaVM()->GetFactory()->NewFromString("x")); ++ JSHandle key2(thread_->GetEcmaVM()->GetFactory()->NewFromString("y")); ++ JSHandle key3(thread_->GetEcmaVM()->GetFactory()->NewFromString("3")); ++ JSHandle key4(thread_->GetEcmaVM()->GetFactory()->NewFromString("4")); ++ JSHandle value1(thread_, JSTaggedValue(1)); ++ JSHandle value2(thread_, JSTaggedValue(2)); ++ JSHandle value3(thread_, JSTaggedValue(3)); ++ JSHandle value4(thread_, JSTaggedValue(4)); ++ ++ JSObject::SetProperty(thread_, JSHandle(obj), key1, value1); ++ JSObject::SetProperty(thread_, JSHandle(obj), key2, value2); ++ JSObject::SetProperty(thread_, JSHandle(obj), key3, value3); ++ JSObject::SetProperty(thread_, JSHandle(obj), key4, value4); ++ ++ JSHandle array = JSObject::GetOwnPropertyKeys(thread_, obj); + int length = array->GetLength(); + EXPECT_EQ(length, 4); + int sum = 0; + for (int i = 0; i < length; i++) { +- JSHandle key(thread, array->Get(i)); +- sum += JSObject::GetProperty(thread, JSHandle(obj), key).GetValue()->GetInt(); ++ JSHandle key(thread_, array->Get(i)); ++ sum += JSObject::GetProperty(thread_, JSHandle(obj), key).GetValue()->GetInt(); + } + EXPECT_EQ(sum, 10); + } + + TEST_F(JSObjectTest, ObjectCreateMethod) + { +- JSHandle null_handle(thread, JSTaggedValue::Null()); +- JSHandle grandfather = JSObject::ObjectCreate(thread, null_handle); +- JSHandle father = JSObject::ObjectCreate(thread, grandfather); +- JSHandle son = JSObject::ObjectCreate(thread, father); +- +- EXPECT_EQ(son->GetPrototype(thread), father.GetTaggedValue()); +- EXPECT_EQ(father->GetPrototype(thread), grandfather.GetTaggedValue()); +- EXPECT_EQ(grandfather->GetPrototype(thread), JSTaggedValue::Null()); ++ JSHandle null_handle(thread_, JSTaggedValue::Null()); ++ JSHandle grandfather = JSObject::ObjectCreate(thread_, null_handle); ++ JSHandle father = JSObject::ObjectCreate(thread_, grandfather); ++ JSHandle son = JSObject::ObjectCreate(thread_, father); ++ ++ EXPECT_EQ(son->GetPrototype(thread_), father.GetTaggedValue()); ++ EXPECT_EQ(father->GetPrototype(thread_), grandfather.GetTaggedValue()); ++ EXPECT_EQ(grandfather->GetPrototype(thread_), JSTaggedValue::Null()); + } + + TEST_F(JSObjectTest, GetMethod) + { +- JSHandle null_handle(thread, JSTaggedValue::Null()); +- JSHandle obj = JSObject::ObjectCreate(thread, null_handle); +- JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); +- JSHandle func(thread->GetEcmaVM()->GetFactory()->NewJSFunction(env)); ++ JSHandle null_handle(thread_, JSTaggedValue::Null()); ++ JSHandle obj = JSObject::ObjectCreate(thread_, null_handle); ++ JSHandle env = thread_->GetEcmaVM()->GetGlobalEnv(); ++ JSHandle func(thread_->GetEcmaVM()->GetFactory()->NewJSFunction(env)); + EXPECT_TRUE(*func != nullptr); +- JSHandle key(thread->GetEcmaVM()->GetFactory()->NewFromString("1")); +- JSObject::SetProperty(thread, JSHandle(obj), key, func); +- EXPECT_EQ(JSObject::GetProperty(thread, JSHandle(obj), key).GetValue().GetTaggedValue(), ++ JSHandle key(thread_->GetEcmaVM()->GetFactory()->NewFromString("1")); ++ JSObject::SetProperty(thread_, JSHandle(obj), key, func); ++ EXPECT_EQ(JSObject::GetProperty(thread_, JSHandle(obj), key).GetValue().GetTaggedValue(), + func.GetTaggedValue()); + } + + TEST_F(JSObjectTest, EnumerableOwnNames) + { +- JSHandle obj_func(thread, JSObjectTestCreate(thread)); ++ JSHandle obj_func(thread_, JSObjectTestCreate(thread_)); + JSHandle obj = +- thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(obj_func), obj_func); ++ thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(obj_func), obj_func); + EXPECT_TRUE(*obj != nullptr); + + CString tag_c_str = "x"; +- JSHandle tag_string = thread->GetEcmaVM()->GetFactory()->NewFromString(&tag_c_str[0]); ++ JSHandle tag_string = thread_->GetEcmaVM()->GetFactory()->NewFromString(&tag_c_str[0]); + JSHandle key(tag_string); + +- JSHandle value(thread, JSTaggedValue(1)); ++ JSHandle value(thread_, JSTaggedValue(1)); + +- JSObject::SetProperty(thread, JSHandle(obj), key, value); +- EXPECT_EQ(JSObject::GetProperty(thread, JSHandle(obj), key).GetValue()->GetInt(), 1); ++ JSObject::SetProperty(thread_, JSHandle(obj), key, value); ++ EXPECT_EQ(JSObject::GetProperty(thread_, JSHandle(obj), key).GetValue()->GetInt(), 1); + +- JSHandle names = JSObject::EnumerableOwnNames(thread, obj); ++ JSHandle names = JSObject::EnumerableOwnNames(thread_, obj); + +- JSHandle key_from_names(thread, JSTaggedValue(names->Get(0))); +- EXPECT_EQ(JSObject::GetProperty(thread, JSHandle(obj), key_from_names).GetValue()->GetInt(), 1); ++ JSHandle key_from_names(thread_, JSTaggedValue(names->Get(0))); ++ EXPECT_EQ(JSObject::GetProperty(thread_, JSHandle(obj), key_from_names).GetValue()->GetInt(), 1); + +- PropertyDescriptor desc_no_enum(thread); ++ PropertyDescriptor desc_no_enum(thread_); + desc_no_enum.SetEnumerable(false); +- JSTaggedValue::DefinePropertyOrThrow(thread, JSHandle(obj), key, desc_no_enum); +- EXPECT_EQ(JSObject::GetProperty(thread, JSHandle(obj), key).GetValue()->GetInt(), 1); ++ JSTaggedValue::DefinePropertyOrThrow(thread_, JSHandle(obj), key, desc_no_enum); ++ EXPECT_EQ(JSObject::GetProperty(thread_, JSHandle(obj), key).GetValue()->GetInt(), 1); + +- JSHandle names_no_enum = JSObject::EnumerableOwnNames(thread, obj); ++ JSHandle names_no_enum = JSObject::EnumerableOwnNames(thread_, obj); + EXPECT_TRUE(names_no_enum->GetLength() == 0); + +- PropertyDescriptor desc_enum(thread); ++ PropertyDescriptor desc_enum(thread_); + desc_enum.SetConfigurable(false); + desc_enum.SetEnumerable(true); +- JSTaggedValue::DefinePropertyOrThrow(thread, JSHandle(obj), key, desc_enum); +- EXPECT_EQ(JSObject::GetProperty(thread, JSHandle(obj), key).GetValue()->GetInt(), 1); ++ JSTaggedValue::DefinePropertyOrThrow(thread_, JSHandle(obj), key, desc_enum); ++ EXPECT_EQ(JSObject::GetProperty(thread_, JSHandle(obj), key).GetValue()->GetInt(), 1); + +- JSHandle names_no_config = JSObject::EnumerableOwnNames(thread, obj); ++ JSHandle names_no_config = JSObject::EnumerableOwnNames(thread_, obj); + +- JSHandle key_no_config(thread, JSTaggedValue(names_no_config->Get(0))); +- EXPECT_EQ(JSObject::GetProperty(thread, JSHandle(obj), key_no_config).GetValue()->GetInt(), 1); ++ JSHandle key_no_config(thread_, JSTaggedValue(names_no_config->Get(0))); ++ EXPECT_EQ(JSObject::GetProperty(thread_, JSHandle(obj), key_no_config).GetValue()->GetInt(), 1); + } + + TEST_F(JSObjectTest, SetIntegrityLevelSealed) + { +- JSHandle dynclass1(thread, JSObjectTestCreate(thread)); ++ JSHandle dynclass1(thread_, JSObjectTestCreate(thread_)); + JSHandle obj1 = +- thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(dynclass1), dynclass1); ++ thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(dynclass1), dynclass1); + EXPECT_TRUE(*obj1 != nullptr); + CString undefined_c_str = "x"; +- JSHandle key1(thread->GetEcmaVM()->GetFactory()->NewFromString(&undefined_c_str[0])); +- JSHandle value1(thread, JSTaggedValue(1)); +- JSObject::SetProperty(thread, JSHandle(obj1), key1, value1); ++ JSHandle key1(thread_->GetEcmaVM()->GetFactory()->NewFromString(&undefined_c_str[0])); ++ JSHandle value1(thread_, JSTaggedValue(1)); ++ JSObject::SetProperty(thread_, JSHandle(obj1), key1, value1); + + // test SetIntegrityLevel::SEALED + JSHandle jsobject(obj1); +- bool status1 = JSObject::SetIntegrityLevel(thread, jsobject, IntegrityLevel::SEALED); ++ bool status1 = JSObject::SetIntegrityLevel(thread_, jsobject, IntegrityLevel::SEALED); + EXPECT_TRUE(status1); +- EXPECT_EQ(JSObject::GetProperty(thread, JSHandle(obj1), key1).GetValue().GetTaggedValue(), ++ EXPECT_EQ(JSObject::GetProperty(thread_, JSHandle(obj1), key1).GetValue().GetTaggedValue(), + value1.GetTaggedValue()); +- PropertyDescriptor desc1(thread); +- bool success1 = JSObject::GetOwnProperty(thread, jsobject, key1, desc1); ++ PropertyDescriptor desc1(thread_); ++ bool success1 = JSObject::GetOwnProperty(thread_, jsobject, key1, desc1); + EXPECT_TRUE(success1); + EXPECT_EQ(true, desc1.IsWritable()); + EXPECT_EQ(true, desc1.IsEnumerable()); +@@ -511,23 +512,23 @@ TEST_F(JSObjectTest, SetIntegrityLevelSealed) + + TEST_F(JSObjectTest, SetIntegrityLevelFrozen) + { +- JSHandle dynclass1(thread, JSObjectTestCreate(thread)); ++ JSHandle dynclass1(thread_, JSObjectTestCreate(thread_)); + JSHandle obj1 = +- thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(dynclass1), dynclass1); ++ thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(dynclass1), dynclass1); + EXPECT_TRUE(*obj1 != nullptr); + + CString undefined_c_str = "x"; +- JSHandle key1(thread->GetEcmaVM()->GetFactory()->NewFromString(&undefined_c_str[0])); +- JSHandle value1(thread, JSTaggedValue(1)); +- JSObject::SetProperty(thread, JSHandle(obj1), key1, value1); ++ JSHandle key1(thread_->GetEcmaVM()->GetFactory()->NewFromString(&undefined_c_str[0])); ++ JSHandle value1(thread_, JSTaggedValue(1)); ++ JSObject::SetProperty(thread_, JSHandle(obj1), key1, value1); + + // test SetIntegrityLevel::FROZEN +- bool status1 = JSObject::SetIntegrityLevel(thread, obj1, IntegrityLevel::FROZEN); ++ bool status1 = JSObject::SetIntegrityLevel(thread_, obj1, IntegrityLevel::FROZEN); + EXPECT_TRUE(status1); +- EXPECT_EQ(JSObject::GetProperty(thread, JSHandle(obj1), key1).GetValue().GetTaggedValue(), ++ EXPECT_EQ(JSObject::GetProperty(thread_, JSHandle(obj1), key1).GetValue().GetTaggedValue(), + value1.GetTaggedValue()); +- PropertyDescriptor desc1(thread); +- bool success1 = JSObject::GetOwnProperty(thread, obj1, key1, desc1); ++ PropertyDescriptor desc1(thread_); ++ bool success1 = JSObject::GetOwnProperty(thread_, obj1, key1, desc1); + EXPECT_TRUE(success1); + EXPECT_EQ(false, desc1.IsWritable()); + EXPECT_EQ(true, desc1.IsEnumerable()); +@@ -536,71 +537,71 @@ TEST_F(JSObjectTest, SetIntegrityLevelFrozen) + + TEST_F(JSObjectTest, TestIntegrityLevelSealed) + { +- JSHandle dynclass1(thread, JSObjectTestCreate(thread)); ++ JSHandle dynclass1(thread_, JSObjectTestCreate(thread_)); + JSHandle obj1 = +- thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(dynclass1), dynclass1); ++ thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(dynclass1), dynclass1); + CString undefined_c_str = "level"; +- JSHandle key1(thread->GetEcmaVM()->GetFactory()->NewFromString(&undefined_c_str[0])); +- JSHandle value1(thread, JSTaggedValue(1)); +- JSObject::SetProperty(thread, JSHandle(obj1), key1, value1); ++ JSHandle key1(thread_->GetEcmaVM()->GetFactory()->NewFromString(&undefined_c_str[0])); ++ JSHandle value1(thread_, JSTaggedValue(1)); ++ JSObject::SetProperty(thread_, JSHandle(obj1), key1, value1); + obj1->GetJSHClass()->SetExtensible(false); + + // test SetIntegrityLevel::SEALED +- bool status1 = JSObject::SetIntegrityLevel(thread, obj1, IntegrityLevel::SEALED); ++ bool status1 = JSObject::SetIntegrityLevel(thread_, obj1, IntegrityLevel::SEALED); + EXPECT_TRUE(status1); +- EXPECT_EQ(JSObject::GetProperty(thread, JSHandle(obj1), key1).GetValue().GetTaggedValue(), ++ EXPECT_EQ(JSObject::GetProperty(thread_, JSHandle(obj1), key1).GetValue().GetTaggedValue(), + value1.GetTaggedValue()); + +- PropertyDescriptor desc1(thread); +- bool success1 = JSObject::GetOwnProperty(thread, obj1, key1, desc1); ++ PropertyDescriptor desc1(thread_); ++ bool success1 = JSObject::GetOwnProperty(thread_, obj1, key1, desc1); + EXPECT_TRUE(success1); +- EXPECT_EQ(true, JSObject::TestIntegrityLevel(thread, obj1, IntegrityLevel::SEALED)); +- EXPECT_EQ(false, JSObject::TestIntegrityLevel(thread, obj1, IntegrityLevel::FROZEN)); ++ EXPECT_EQ(true, JSObject::TestIntegrityLevel(thread_, obj1, IntegrityLevel::SEALED)); ++ EXPECT_EQ(false, JSObject::TestIntegrityLevel(thread_, obj1, IntegrityLevel::FROZEN)); + } + + TEST_F(JSObjectTest, TestIntegrityLevelFrozen) + { +- JSHandle dynclass1(thread, JSObjectTestCreate(thread)); ++ JSHandle dynclass1(thread_, JSObjectTestCreate(thread_)); + JSHandle obj1 = +- thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(dynclass1), dynclass1); ++ thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(dynclass1), dynclass1); + CString undefined_c_str = "level"; +- JSHandle key1(thread->GetEcmaVM()->GetFactory()->NewFromString(&undefined_c_str[0])); +- JSHandle value1(thread, JSTaggedValue(1)); +- JSObject::SetProperty(thread, JSHandle(obj1), key1, value1); ++ JSHandle key1(thread_->GetEcmaVM()->GetFactory()->NewFromString(&undefined_c_str[0])); ++ JSHandle value1(thread_, JSTaggedValue(1)); ++ JSObject::SetProperty(thread_, JSHandle(obj1), key1, value1); + obj1->GetJSHClass()->SetExtensible(false); + + // test SetIntegrityLevel::FROZEN +- bool status1 = JSObject::SetIntegrityLevel(thread, obj1, IntegrityLevel::FROZEN); ++ bool status1 = JSObject::SetIntegrityLevel(thread_, obj1, IntegrityLevel::FROZEN); + EXPECT_TRUE(status1); +- EXPECT_EQ(JSObject::GetProperty(thread, JSHandle(obj1), key1).GetValue().GetTaggedValue(), ++ EXPECT_EQ(JSObject::GetProperty(thread_, JSHandle(obj1), key1).GetValue().GetTaggedValue(), + value1.GetTaggedValue()); + +- PropertyDescriptor desc1(thread); +- bool success1 = JSObject::GetOwnProperty(thread, obj1, key1, desc1); ++ PropertyDescriptor desc1(thread_); ++ bool success1 = JSObject::GetOwnProperty(thread_, obj1, key1, desc1); + EXPECT_TRUE(success1); +- EXPECT_EQ(true, JSObject::TestIntegrityLevel(thread, obj1, IntegrityLevel::SEALED)); +- EXPECT_EQ(true, JSObject::TestIntegrityLevel(thread, obj1, IntegrityLevel::FROZEN)); ++ EXPECT_EQ(true, JSObject::TestIntegrityLevel(thread_, obj1, IntegrityLevel::SEALED)); ++ EXPECT_EQ(true, JSObject::TestIntegrityLevel(thread_, obj1, IntegrityLevel::FROZEN)); + } + + TEST_F(JSObjectTest, TestIntegrityLevelWithoutProperty) + { +- JSHandle dynclass1(thread, JSObjectTestCreate(thread)); ++ JSHandle dynclass1(thread_, JSObjectTestCreate(thread_)); + JSHandle obj1( +- thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(dynclass1), dynclass1)); ++ thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(dynclass1), dynclass1)); + JSHandle::Cast(obj1)->GetJSHClass()->SetExtensible(false); + CString undefined_c_str = "level"; +- JSHandle key1(thread->GetEcmaVM()->GetFactory()->NewFromString(&undefined_c_str[0])); ++ JSHandle key1(thread_->GetEcmaVM()->GetFactory()->NewFromString(&undefined_c_str[0])); + + // test SetIntegrityLevel::FROZEN + JSHandle jsobject(obj1); +- bool status1 = JSObject::SetIntegrityLevel(thread, jsobject, IntegrityLevel::SEALED); ++ bool status1 = JSObject::SetIntegrityLevel(thread_, jsobject, IntegrityLevel::SEALED); + EXPECT_TRUE(status1); + +- PropertyDescriptor desc1(thread); +- bool success1 = JSObject::GetOwnProperty(thread, jsobject, key1, desc1); ++ PropertyDescriptor desc1(thread_); ++ bool success1 = JSObject::GetOwnProperty(thread_, jsobject, key1, desc1); + EXPECT_TRUE(!success1); +- EXPECT_EQ(true, JSObject::TestIntegrityLevel(thread, jsobject, IntegrityLevel::SEALED)); +- EXPECT_EQ(true, JSObject::TestIntegrityLevel(thread, jsobject, IntegrityLevel::FROZEN)); ++ EXPECT_EQ(true, JSObject::TestIntegrityLevel(thread_, jsobject, IntegrityLevel::SEALED)); ++ EXPECT_EQ(true, JSObject::TestIntegrityLevel(thread_, jsobject, IntegrityLevel::FROZEN)); + } + + JSTaggedValue TestGetter(EcmaRuntimeCallInfo *argv) +@@ -616,26 +617,26 @@ JSTaggedValue TestGetter(EcmaRuntimeCallInfo *argv) + + TEST_F(JSObjectTest, Getter) + { +- JSHandle dynclass1(thread, JSObjectTestCreate(thread)); +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ JSHandle dynclass1(thread_, JSObjectTestCreate(thread_)); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle obj = factory->NewJSObjectByConstructor(JSHandle(dynclass1), dynclass1); + JSHandle key1(factory->NewFromString("x")); + JSHandle key2(factory->NewFromString("y")); +- JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); ++ JSHandle env = thread_->GetEcmaVM()->GetGlobalEnv(); + JSHandle getter = +- thread->GetEcmaVM()->GetFactory()->NewJSFunction(env, reinterpret_cast(TestGetter)); ++ thread_->GetEcmaVM()->GetFactory()->NewJSFunction(env, reinterpret_cast(TestGetter)); + +- PropertyDescriptor desc1(thread); ++ PropertyDescriptor desc1(thread_); + desc1.SetGetter(JSHandle::Cast(getter)); +- bool success1 = JSObject::DefineOwnProperty(thread, obj, key1, desc1); ++ bool success1 = JSObject::DefineOwnProperty(thread_, obj, key1, desc1); + EXPECT_TRUE(success1); + +- PropertyDescriptor desc2(thread); +- desc2.SetValue(JSHandle(thread, JSTaggedValue(1))); +- success1 = JSObject::DefineOwnProperty(thread, obj, key2, desc2); ++ PropertyDescriptor desc2(thread_); ++ desc2.SetValue(JSHandle(thread_, JSTaggedValue(1))); ++ success1 = JSObject::DefineOwnProperty(thread_, obj, key2, desc2); + EXPECT_TRUE(success1); + +- EXPECT_EQ(JSObject::GetProperty(thread, JSHandle(obj), key1).GetValue().GetTaggedValue(), ++ EXPECT_EQ(JSObject::GetProperty(thread_, JSHandle(obj), key1).GetValue().GetTaggedValue(), + JSTaggedValue(2)); + } + +@@ -654,61 +655,61 @@ JSTaggedValue TestSetter(EcmaRuntimeCallInfo *argv) + + TEST_F(JSObjectTest, Setter) + { +- JSHandle dynclass1(thread, JSObjectTestCreate(thread)); +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ JSHandle dynclass1(thread_, JSObjectTestCreate(thread_)); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle obj = factory->NewJSObjectByConstructor(JSHandle(dynclass1), dynclass1); + JSHandle key1(factory->NewFromString("x")); + JSHandle key2(factory->NewFromString("y")); +- JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); ++ JSHandle env = thread_->GetEcmaVM()->GetGlobalEnv(); + JSHandle setter = +- thread->GetEcmaVM()->GetFactory()->NewJSFunction(env, reinterpret_cast(TestSetter)); ++ thread_->GetEcmaVM()->GetFactory()->NewJSFunction(env, reinterpret_cast(TestSetter)); + +- PropertyDescriptor desc1(thread); ++ PropertyDescriptor desc1(thread_); + desc1.SetSetter(JSHandle::Cast(setter)); +- bool success1 = JSObject::DefineOwnProperty(thread, obj, key1, desc1); ++ bool success1 = JSObject::DefineOwnProperty(thread_, obj, key1, desc1); + EXPECT_TRUE(success1); + +- PropertyDescriptor desc2(thread, JSHandle(thread, JSTaggedValue(1)), true, true, true); +- success1 = JSObject::DefineOwnProperty(thread, obj, key2, desc2); ++ PropertyDescriptor desc2(thread_, JSHandle(thread_, JSTaggedValue(1)), true, true, true); ++ success1 = JSObject::DefineOwnProperty(thread_, obj, key2, desc2); + EXPECT_TRUE(success1); + +- JSHandle value_handle(thread, JSTaggedValue::Undefined()); +- EXPECT_TRUE(JSObject::SetProperty(thread, JSHandle(obj), key1, value_handle)); +- EXPECT_EQ(JSObject::GetProperty(thread, JSHandle(obj), key2).GetValue().GetTaggedValue(), ++ JSHandle value_handle(thread_, JSTaggedValue::Undefined()); ++ EXPECT_TRUE(JSObject::SetProperty(thread_, JSHandle(obj), key1, value_handle)); ++ EXPECT_EQ(JSObject::GetProperty(thread_, JSHandle(obj), key2).GetValue().GetTaggedValue(), + JSTaggedValue(2)); + } + + TEST_F(JSObjectTest, SpeciesConstructor) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); +- JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); +- const GlobalEnvConstants *globalConst = thread->GlobalConstants(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); ++ JSHandle env = thread_->GetEcmaVM()->GetGlobalEnv(); ++ const GlobalEnvConstants *globalConst = thread_->GlobalConstants(); + JSHandle constructor_func = + factory->NewJSFunction(env, static_cast(nullptr), FunctionKind::BASE_CONSTRUCTOR); + JSHandle constructor_func_value(constructor_func); + constructor_func->GetJSHClass()->SetExtensible(true); +- JSFunction::NewJSFunctionPrototype(thread, factory, constructor_func); ++ JSFunction::NewJSFunctionPrototype(thread_, factory, constructor_func); + +- JSHandle null_handle(thread, JSTaggedValue::Null()); +- JSHandle undefined_value(thread, JSTaggedValue::Undefined()); +- JSHandle proto_obj = JSObject::ObjectCreate(thread, null_handle); ++ JSHandle null_handle(thread_, JSTaggedValue::Null()); ++ JSHandle undefined_value(thread_, JSTaggedValue::Undefined()); ++ JSHandle proto_obj = JSObject::ObjectCreate(thread_, null_handle); + JSHandle proto_obj_value(proto_obj); + + JSHandle constructor_key = globalConst->GetHandledConstructorString(); +- JSObject::SetProperty(thread, proto_obj_value, constructor_key, constructor_func_value); ++ JSObject::SetProperty(thread_, proto_obj_value, constructor_key, constructor_func_value); + + factory->NewJSObjectByConstructor(constructor_func, JSHandle::Cast(constructor_func)); + JSHandle species_construct = + factory->NewJSFunction(env, static_cast(nullptr), FunctionKind::BASE_CONSTRUCTOR); + JSHandle species_construct_value(species_construct); + constructor_func->GetJSHClass()->SetExtensible(true); +- JSFunction::MakeConstructor(thread, species_construct, undefined_value); ++ JSFunction::MakeConstructor(thread_, species_construct, undefined_value); + + JSHandle species_symbol = env->GetSpeciesSymbol(); +- JSObject::SetProperty(thread, constructor_func_value, species_symbol, species_construct_value); ++ JSObject::SetProperty(thread_, constructor_func_value, species_symbol, species_construct_value); + + JSTaggedValue species_value = +- JSObject::SpeciesConstructor(thread, proto_obj, constructor_func_value).GetTaggedValue(); ++ JSObject::SpeciesConstructor(thread_, proto_obj, constructor_func_value).GetTaggedValue(); + EXPECT_EQ(species_value, species_construct_value.GetTaggedValue()); + } + +@@ -724,32 +725,32 @@ JSTaggedValue TestUndefinedSetter([[maybe_unused]] EcmaRuntimeCallInfo *argv) + + TEST_F(JSObjectTest, GetterIsUndefined) + { +- JSHandle dynclass1(thread, JSObjectTestCreate(thread)); +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ JSHandle dynclass1(thread_, JSObjectTestCreate(thread_)); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle obj = factory->NewJSObjectByConstructor(JSHandle(dynclass1), dynclass1); + JSHandle key(factory->NewFromString("property")); +- JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); ++ JSHandle env = thread_->GetEcmaVM()->GetGlobalEnv(); + JSHandle getter = +- thread->GetEcmaVM()->GetFactory()->NewJSFunction(env, reinterpret_cast(TestUndefinedGetter)); ++ thread_->GetEcmaVM()->GetFactory()->NewJSFunction(env, reinterpret_cast(TestUndefinedGetter)); + JSHandle setter = +- thread->GetEcmaVM()->GetFactory()->NewJSFunction(env, reinterpret_cast(TestUndefinedSetter)); +- JSHandle un_getter(thread, JSTaggedValue::Undefined()); ++ thread_->GetEcmaVM()->GetFactory()->NewJSFunction(env, reinterpret_cast(TestUndefinedSetter)); ++ JSHandle un_getter(thread_, JSTaggedValue::Undefined()); + +- PropertyDescriptor desc1(thread); ++ PropertyDescriptor desc1(thread_); + desc1.SetGetter(JSHandle::Cast(getter)); + desc1.SetSetter(JSHandle::Cast(setter)); + desc1.SetConfigurable(true); + desc1.SetEnumerable(true); +- bool success1 = JSObject::DefineOwnProperty(thread, obj, key, desc1); ++ bool success1 = JSObject::DefineOwnProperty(thread_, obj, key, desc1); + EXPECT_TRUE(success1); + +- PropertyDescriptor desc2(thread); ++ PropertyDescriptor desc2(thread_); + desc2.SetGetter(un_getter); +- bool success2 = JSObject::DefineOwnProperty(thread, obj, key, desc2); ++ bool success2 = JSObject::DefineOwnProperty(thread_, obj, key, desc2); + EXPECT_TRUE(success2); + +- PropertyDescriptor desc(thread); +- bool success = JSObject::GetOwnProperty(thread, obj, key, desc); ++ PropertyDescriptor desc(thread_); ++ bool success = JSObject::GetOwnProperty(thread_, obj, key, desc); + EXPECT_TRUE(success); + EXPECT_TRUE(desc.GetSetter()->IsJSFunction()); + EXPECT_TRUE(desc.GetGetter()->IsUndefined()); +@@ -757,247 +758,247 @@ TEST_F(JSObjectTest, GetterIsUndefined) + + TEST_F(JSObjectTest, SetterIsUndefined) + { +- JSHandle dynclass1(thread, JSObjectTestCreate(thread)); +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ JSHandle dynclass1(thread_, JSObjectTestCreate(thread_)); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle obj = factory->NewJSObjectByConstructor(JSHandle(dynclass1), dynclass1); + JSHandle key(factory->NewFromString("property")); +- JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); ++ JSHandle env = thread_->GetEcmaVM()->GetGlobalEnv(); + JSHandle getter = +- thread->GetEcmaVM()->GetFactory()->NewJSFunction(env, reinterpret_cast(TestUndefinedGetter)); ++ thread_->GetEcmaVM()->GetFactory()->NewJSFunction(env, reinterpret_cast(TestUndefinedGetter)); + JSHandle setter = +- thread->GetEcmaVM()->GetFactory()->NewJSFunction(env, reinterpret_cast(TestUndefinedSetter)); +- JSHandle un_setter(thread, JSTaggedValue::Undefined()); ++ thread_->GetEcmaVM()->GetFactory()->NewJSFunction(env, reinterpret_cast(TestUndefinedSetter)); ++ JSHandle un_setter(thread_, JSTaggedValue::Undefined()); + +- PropertyDescriptor desc1(thread); ++ PropertyDescriptor desc1(thread_); + desc1.SetGetter(JSHandle::Cast(getter)); + desc1.SetSetter(JSHandle::Cast(setter)); + desc1.SetConfigurable(true); + desc1.SetEnumerable(true); +- bool success1 = JSObject::DefineOwnProperty(thread, obj, key, desc1); ++ bool success1 = JSObject::DefineOwnProperty(thread_, obj, key, desc1); + EXPECT_TRUE(success1); + +- PropertyDescriptor desc2(thread); ++ PropertyDescriptor desc2(thread_); + desc2.SetSetter(un_setter); +- bool success2 = JSObject::DefineOwnProperty(thread, obj, key, desc2); ++ bool success2 = JSObject::DefineOwnProperty(thread_, obj, key, desc2); + EXPECT_TRUE(success2); + +- PropertyDescriptor desc(thread); +- bool success = JSObject::GetOwnProperty(thread, obj, key, desc); ++ PropertyDescriptor desc(thread_); ++ bool success = JSObject::GetOwnProperty(thread_, obj, key, desc); + EXPECT_TRUE(success); + EXPECT_TRUE(desc.GetSetter()->IsUndefined()); + +- EXPECT_EQ(JSObject::GetProperty(thread, JSHandle(obj), key).GetValue().GetTaggedValue(), ++ EXPECT_EQ(JSObject::GetProperty(thread_, JSHandle(obj), key).GetValue().GetTaggedValue(), + JSTaggedValue(10)); + } + + TEST_F(JSObjectTest, HClass) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); +- JSHandle objFunc(thread, JSObjectTestCreate(thread)); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); ++ JSHandle objFunc(thread_, JSObjectTestCreate(thread_)); + JSHandle obj1 = factory->NewJSObjectByConstructor(JSHandle(objFunc), objFunc); +- JSHandle hc0(thread, obj1->GetJSHClass()); ++ JSHandle hc0(thread_, obj1->GetJSHClass()); + + JSHandle key1(factory->NewFromCanBeCompressString("x")); + JSHandle key2(factory->NewFromCanBeCompressString("y")); + JSHandle key3(factory->NewFromCanBeCompressString("z")); +- JSHandle value(thread, JSTaggedValue(1)); ++ JSHandle value(thread_, JSTaggedValue(1)); + +- JSObject::SetProperty(thread, JSHandle(obj1), key1, value); +- JSHandle hc1(thread, obj1->GetJSHClass()); ++ JSObject::SetProperty(thread_, JSHandle(obj1), key1, value); ++ JSHandle hc1(thread_, obj1->GetJSHClass()); + EXPECT_NE(hc0.GetTaggedValue(), hc1.GetTaggedValue()); + EXPECT_EQ(hc0.GetTaggedValue(), hc1->GetParent()); + +- JSObject::SetProperty(thread, JSHandle(obj1), key2, value); +- JSHandle hc2(thread, obj1->GetJSHClass()); ++ JSObject::SetProperty(thread_, JSHandle(obj1), key2, value); ++ JSHandle hc2(thread_, obj1->GetJSHClass()); + EXPECT_NE(hc1.GetTaggedValue(), hc2.GetTaggedValue()); + EXPECT_EQ(hc1.GetTaggedValue(), hc2->GetParent()); + + JSHandle obj2 = factory->NewJSObjectByConstructor(JSHandle(objFunc), objFunc); + EXPECT_EQ(hc0.GetTaggedValue().GetTaggedObject(), obj2->GetJSHClass()); + +- JSObject::SetProperty(thread, JSHandle(obj2), key1, value); ++ JSObject::SetProperty(thread_, JSHandle(obj2), key1, value); + EXPECT_EQ(hc1.GetTaggedValue().GetTaggedObject(), obj2->GetJSHClass()); + +- JSObject::SetProperty(thread, JSHandle(obj2), key3, value); +- JSHandle hc3(thread, obj2->GetJSHClass()); ++ JSObject::SetProperty(thread_, JSHandle(obj2), key3, value); ++ JSHandle hc3(thread_, obj2->GetJSHClass()); + EXPECT_NE(hc1.GetTaggedValue().GetTaggedObject(), obj2->GetJSHClass()); + EXPECT_EQ(hc1.GetTaggedValue(), obj2->GetJSHClass()->GetParent()); + + JSHandle obj3 = factory->NewJSObjectByConstructor(JSHandle(objFunc), objFunc); + EXPECT_EQ(hc0.GetTaggedValue().GetTaggedObject(), obj3->GetJSHClass()); +- JSObject::SetProperty(thread, JSHandle(obj3), key1, value); ++ JSObject::SetProperty(thread_, JSHandle(obj3), key1, value); + EXPECT_EQ(hc1.GetTaggedValue().GetTaggedObject(), obj3->GetJSHClass()); + +- JSObject::SetProperty(thread, JSHandle(obj3), key2, value); ++ JSObject::SetProperty(thread_, JSHandle(obj3), key2, value); + EXPECT_EQ(hc2.GetTaggedValue().GetTaggedObject(), obj3->GetJSHClass()); + +- JSObject::SetProperty(thread, JSHandle(obj3), key3, value); ++ JSObject::SetProperty(thread_, JSHandle(obj3), key3, value); + EXPECT_NE(hc3.GetTaggedValue().GetTaggedObject(), obj3->GetJSHClass()); + EXPECT_EQ(hc2.GetTaggedValue(), obj3->GetJSHClass()->GetParent()); + } + + TEST_F(JSObjectTest, FastToSlow) + { +- auto ecmaVM = thread->GetEcmaVM(); ++ auto ecmaVM = thread_->GetEcmaVM(); + ObjectFactory *factory = ecmaVM->GetFactory(); + +- JSHandle objFunc(thread, JSObjectTestCreate(thread)); ++ JSHandle objFunc(thread_, JSObjectTestCreate(thread_)); + JSHandle obj1 = factory->NewJSObjectByConstructor(JSHandle(objFunc), objFunc); + + JSMutableHandle key(factory->NewFromCanBeCompressString("x")); +- JSMutableHandle number(thread, JSTaggedValue(0)); +- JSMutableHandle newkey(thread, JSTaggedValue(0)); +- JSHandle value(thread, JSTaggedValue(1)); ++ JSMutableHandle number(thread_, JSTaggedValue(0)); ++ JSMutableHandle newkey(thread_, JSTaggedValue(0)); ++ JSHandle value(thread_, JSTaggedValue(1)); + + ecmaVM->SetEnableForceGC(false); + for (uint32_t i = 0; i < PropertyAttributes::MAX_CAPACITY_OF_PROPERTIES; i++) { + number.Update(JSTaggedValue(i)); +- number.Update(JSTaggedValue::ToString(thread, number).GetTaggedValue()); +- EcmaString *newString = *factory->ConcatFromString(key, JSTaggedValue::ToString(thread, number)); ++ number.Update(JSTaggedValue::ToString(thread_, number).GetTaggedValue()); ++ EcmaString *newString = *factory->ConcatFromString(key, JSTaggedValue::ToString(thread_, number)); + newkey.Update(JSTaggedValue(newString)); +- JSObject::SetProperty(thread, JSHandle(obj1), newkey, value); ++ JSObject::SetProperty(thread_, JSHandle(obj1), newkey, value); + } + ecmaVM->SetEnableForceGC(true); + + EXPECT_FALSE(TaggedArray::Cast(obj1->GetProperties().GetTaggedObject())->IsDictionaryMode()); + + number.Update(JSTaggedValue(PropertyAttributes::MAX_CAPACITY_OF_PROPERTIES)); +- number.Update(JSTaggedValue::ToString(thread, number).GetTaggedValue()); +- EcmaString *newString = *factory->ConcatFromString(key, JSTaggedValue::ToString(thread, number)); ++ number.Update(JSTaggedValue::ToString(thread_, number).GetTaggedValue()); ++ EcmaString *newString = *factory->ConcatFromString(key, JSTaggedValue::ToString(thread_, number)); + newkey.Update(JSTaggedValue(newString)); +- JSObject::SetProperty(thread, JSHandle(obj1), newkey, value); ++ JSObject::SetProperty(thread_, JSHandle(obj1), newkey, value); + + EXPECT_TRUE(TaggedArray::Cast(obj1->GetProperties().GetTaggedObject())->IsDictionaryMode()); + NameDictionary *dict = NameDictionary::Cast(obj1->GetProperties().GetTaggedObject()); + EXPECT_EQ(dict->EntriesCount(), PropertyAttributes::MAX_CAPACITY_OF_PROPERTIES + 1); +- EXPECT_EQ(dict->NextEnumerationIndex(thread), PropertyAttributes::MAX_CAPACITY_OF_PROPERTIES + 1); ++ EXPECT_EQ(dict->NextEnumerationIndex(thread_), PropertyAttributes::MAX_CAPACITY_OF_PROPERTIES + 1); + } + + TEST_F(JSObjectTest, DeleteMiddle) + { +- auto ecmaVM = thread->GetEcmaVM(); ++ auto ecmaVM = thread_->GetEcmaVM(); + ObjectFactory *factory = ecmaVM->GetFactory(); + +- JSHandle objFunc(thread, JSObjectTestCreate(thread)); ++ JSHandle objFunc(thread_, JSObjectTestCreate(thread_)); + JSHandle obj1 = factory->NewJSObjectByConstructor(JSHandle(objFunc), objFunc); + + JSMutableHandle key(factory->NewFromCanBeCompressString("x")); +- JSMutableHandle number(thread, JSTaggedValue(0)); +- JSMutableHandle newkey(thread, JSTaggedValue(0)); +- JSHandle value(thread, JSTaggedValue(1)); ++ JSMutableHandle number(thread_, JSTaggedValue(0)); ++ JSMutableHandle newkey(thread_, JSTaggedValue(0)); ++ JSHandle value(thread_, JSTaggedValue(1)); + + for (uint32_t i = 0; i < 10; i++) { + number.Update(JSTaggedValue(i)); +- number.Update(JSTaggedValue::ToString(thread, number).GetTaggedValue()); +- EcmaString *newString = *factory->ConcatFromString(key, JSTaggedValue::ToString(thread, number)); ++ number.Update(JSTaggedValue::ToString(thread_, number).GetTaggedValue()); ++ EcmaString *newString = *factory->ConcatFromString(key, JSTaggedValue::ToString(thread_, number)); + newkey.Update(JSTaggedValue(newString)); +- JSObject::SetProperty(thread, JSHandle(obj1), newkey, value); ++ JSObject::SetProperty(thread_, JSHandle(obj1), newkey, value); + } + + EXPECT_FALSE(TaggedArray::Cast(obj1->GetProperties().GetTaggedObject())->IsDictionaryMode()); + + JSMutableHandle key5(factory->NewFromCanBeCompressString("x5")); +- JSObject::DeleteProperty(thread, (obj1), key5); ++ JSObject::DeleteProperty(thread_, (obj1), key5); + + EXPECT_TRUE(TaggedArray::Cast(obj1->GetProperties().GetTaggedObject())->IsDictionaryMode()); + NameDictionary *dict = NameDictionary::Cast(obj1->GetProperties().GetTaggedObject()); + EXPECT_EQ(dict->EntriesCount(), 9); +- EXPECT_FALSE(JSObject::HasProperty(thread, obj1, key5)); ++ EXPECT_FALSE(JSObject::HasProperty(thread_, obj1, key5)); + } + + TEST_F(JSObjectTest, ElementFastToSlow) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); +- JSHandle objFunc(thread, JSObjectTestCreate(thread)); +- JSHandle key0(thread, JSTaggedValue(0)); +- JSHandle key1(thread, JSTaggedValue(1)); +- JSHandle key2(thread, JSTaggedValue(2)); +- JSHandle key2000(thread, JSTaggedValue(2000)); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); ++ JSHandle objFunc(thread_, JSObjectTestCreate(thread_)); ++ JSHandle key0(thread_, JSTaggedValue(0)); ++ JSHandle key1(thread_, JSTaggedValue(1)); ++ JSHandle key2(thread_, JSTaggedValue(2)); ++ JSHandle key2000(thread_, JSTaggedValue(2000)); + JSHandle keyStr(factory->NewFromCanBeCompressString("str")); + + // test dictionary [0,1,2,...,2000] + JSHandle obj1 = factory->NewJSObjectByConstructor(JSHandle(objFunc), objFunc); + EXPECT_TRUE(!TaggedArray::Cast(obj1->GetElements().GetTaggedObject())->IsDictionaryMode()); +- JSObject::SetProperty(thread, JSHandle(obj1), keyStr, key2); +- JSObject::SetProperty(thread, JSHandle(obj1), key0, key0); ++ JSObject::SetProperty(thread_, JSHandle(obj1), keyStr, key2); ++ JSObject::SetProperty(thread_, JSHandle(obj1), key0, key0); + EXPECT_TRUE(!TaggedArray::Cast(obj1->GetElements().GetTaggedObject())->IsDictionaryMode()); +- JSHandle dynClass(thread, obj1->GetJSHClass()); +- JSObject::SetProperty(thread, JSHandle(obj1), key1, key1); ++ JSHandle dynClass(thread_, obj1->GetJSHClass()); ++ JSObject::SetProperty(thread_, JSHandle(obj1), key1, key1); + EXPECT_TRUE(!TaggedArray::Cast(obj1->GetElements().GetTaggedObject())->IsDictionaryMode()); + EXPECT_EQ(obj1->GetJSHClass(), *dynClass); + +- JSObject::SetProperty(thread, JSHandle(obj1), key2000, key2000); ++ JSObject::SetProperty(thread_, JSHandle(obj1), key2000, key2000); + EXPECT_TRUE(TaggedArray::Cast(obj1->GetElements().GetTaggedObject())->IsDictionaryMode()); + JSTaggedValue value = +- JSObject::GetProperty(thread, JSHandle(obj1), keyStr).GetValue().GetTaggedValue(); ++ JSObject::GetProperty(thread_, JSHandle(obj1), keyStr).GetValue().GetTaggedValue(); + EXPECT_EQ(value, key2.GetTaggedValue()); + // test holey [0,,2] + JSHandle obj2 = factory->NewJSObjectByConstructor(JSHandle(objFunc), objFunc); +- JSObject::SetProperty(thread, JSHandle(obj2), key0, key0); ++ JSObject::SetProperty(thread_, JSHandle(obj2), key0, key0); + EXPECT_TRUE(!TaggedArray::Cast(obj2->GetElements().GetTaggedObject())->IsDictionaryMode()); +- JSHandle dynClass2(thread, obj2->GetJSHClass()); +- JSObject::SetProperty(thread, JSHandle(obj2), key2, key2); ++ JSHandle dynClass2(thread_, obj2->GetJSHClass()); ++ JSObject::SetProperty(thread_, JSHandle(obj2), key2, key2); + EXPECT_TRUE(!TaggedArray::Cast(obj2->GetElements().GetTaggedObject())->IsDictionaryMode()); + EXPECT_EQ(obj2->GetJSHClass(), *dynClass2); + // test change attr + JSHandle obj3 = factory->NewJSObjectByConstructor(JSHandle(objFunc), objFunc); +- JSObject::SetProperty(thread, JSHandle(obj3), key0, key0); +- JSObject::SetProperty(thread, JSHandle(obj3), key1, key1); +- JSObject::SetProperty(thread, JSHandle(obj3), key2, key2); ++ JSObject::SetProperty(thread_, JSHandle(obj3), key0, key0); ++ JSObject::SetProperty(thread_, JSHandle(obj3), key1, key1); ++ JSObject::SetProperty(thread_, JSHandle(obj3), key2, key2); + EXPECT_TRUE(!TaggedArray::Cast(obj3->GetElements().GetTaggedObject())->IsDictionaryMode()); +- PropertyDescriptor desc(thread); ++ PropertyDescriptor desc(thread_); + desc.SetValue(key1); + desc.SetWritable(false); +- JSObject::DefineOwnProperty(thread, obj3, key1, desc); ++ JSObject::DefineOwnProperty(thread_, obj3, key1, desc); + EXPECT_TRUE(TaggedArray::Cast(obj3->GetElements().GetTaggedObject())->IsDictionaryMode()); + // test delete element + JSHandle obj4 = factory->NewJSObjectByConstructor(JSHandle(objFunc), objFunc); +- JSObject::SetProperty(thread, JSHandle(obj4), key0, key0); +- JSObject::SetProperty(thread, JSHandle(obj4), key1, key1); +- JSObject::SetProperty(thread, JSHandle(obj4), key2, key2); ++ JSObject::SetProperty(thread_, JSHandle(obj4), key0, key0); ++ JSObject::SetProperty(thread_, JSHandle(obj4), key1, key1); ++ JSObject::SetProperty(thread_, JSHandle(obj4), key2, key2); + EXPECT_TRUE(!TaggedArray::Cast(obj4->GetElements().GetTaggedObject())->IsDictionaryMode()); +- JSObject::DeleteProperty(thread, (obj4), key1); ++ JSObject::DeleteProperty(thread_, (obj4), key1); + EXPECT_TRUE(TaggedArray::Cast(obj4->GetElements().GetTaggedObject())->IsDictionaryMode()); + +- JSHandle value1001(thread, JSTaggedValue(1001)); ++ JSHandle value1001(thread_, JSTaggedValue(1001)); + JSHandle obj100 = factory->NewJSObjectByConstructor(JSHandle(objFunc), objFunc); +- PropertyDescriptor desc1(thread); ++ PropertyDescriptor desc1(thread_); + desc1.SetValue(value1001); + desc1.SetWritable(false); + desc1.SetEnumerable(false); + desc1.SetConfigurable(false); +- JSObject::SetProperty(thread, JSHandle(obj100), key0, key1); +- JSObject::DefineOwnProperty(thread, obj100, key0, desc1); ++ JSObject::SetProperty(thread_, JSHandle(obj100), key0, key1); ++ JSObject::DefineOwnProperty(thread_, obj100, key0, desc1); + JSTaggedValue result1001 = +- JSObject::GetProperty(thread, JSHandle(obj100), key0).GetValue().GetTaggedValue(); ++ JSObject::GetProperty(thread_, JSHandle(obj100), key0).GetValue().GetTaggedValue(); + EXPECT_EQ(result1001, value1001.GetTaggedValue()); + } + + TEST_F(JSObjectTest, EnableProtoChangeMarker) + { +- JSHandle nullHandle(thread, JSTaggedValue::Null()); +- JSHandle obj1 = JSObject::ObjectCreate(thread, nullHandle); +- JSHandle obj2 = JSObject::ObjectCreate(thread, obj1); +- JSHandle obj3 = JSObject::ObjectCreate(thread, obj2); +- +- JSHandle obj1Key(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("key1")); +- JSHandle obj2Key(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("key2")); +- JSHandle obj3Key(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("key3")); +- JSHandle obj1Value(thread, JSTaggedValue(1)); +- JSHandle obj2Value(thread, JSTaggedValue(2)); +- JSHandle obj3Value(thread, JSTaggedValue(3)); +- +- JSObject::SetProperty(thread, JSHandle(obj1), obj1Key, obj1Value); +- JSObject::SetProperty(thread, JSHandle(obj2), obj2Key, obj2Value); +- JSObject::SetProperty(thread, JSHandle(obj3), obj3Key, obj3Value); +- JSHandle obj3Dynclass(thread, obj3->GetJSHClass()); +- JSHandle resultMarker = JSHClass::EnableProtoChangeMarker(thread, obj3Dynclass); ++ JSHandle nullHandle(thread_, JSTaggedValue::Null()); ++ JSHandle obj1 = JSObject::ObjectCreate(thread_, nullHandle); ++ JSHandle obj2 = JSObject::ObjectCreate(thread_, obj1); ++ JSHandle obj3 = JSObject::ObjectCreate(thread_, obj2); ++ ++ JSHandle obj1Key(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("key1")); ++ JSHandle obj2Key(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("key2")); ++ JSHandle obj3Key(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("key3")); ++ JSHandle obj1Value(thread_, JSTaggedValue(1)); ++ JSHandle obj2Value(thread_, JSTaggedValue(2)); ++ JSHandle obj3Value(thread_, JSTaggedValue(3)); ++ ++ JSObject::SetProperty(thread_, JSHandle(obj1), obj1Key, obj1Value); ++ JSObject::SetProperty(thread_, JSHandle(obj2), obj2Key, obj2Value); ++ JSObject::SetProperty(thread_, JSHandle(obj3), obj3Key, obj3Value); ++ JSHandle obj3Dynclass(thread_, obj3->GetJSHClass()); ++ JSHandle resultMarker = JSHClass::EnableProtoChangeMarker(thread_, obj3Dynclass); + EXPECT_TRUE(resultMarker->IsProtoChangeMarker()); + bool hasChanged = ProtoChangeMarker::Cast(resultMarker->GetTaggedObject())->GetHasChanged(); + EXPECT_TRUE(!hasChanged); + +- JSHandle obj1Dynclass(thread, obj1->GetJSHClass()); +- JSHandle obj2Dynclass(thread, obj2->GetJSHClass()); ++ JSHandle obj1Dynclass(thread_, obj1->GetJSHClass()); ++ JSHandle obj2Dynclass(thread_, obj2->GetJSHClass()); + JSTaggedValue obj2Marker = obj2Dynclass->GetProtoChangeMarker(); + EXPECT_TRUE(obj2Marker.IsProtoChangeMarker()); + bool hasChanged2 = ProtoChangeMarker::Cast(obj2Marker.GetTaggedObject())->GetHasChanged(); +@@ -1021,49 +1022,49 @@ TEST_F(JSObjectTest, EnableProtoChangeMarker) + + TEST_F(JSObjectTest, BuildRegisterTree) + { +- JSHandle nullHandle(thread, JSTaggedValue::Null()); +- JSHandle obj1 = JSObject::ObjectCreate(thread, nullHandle); +- JSHandle obj2 = JSObject::ObjectCreate(thread, obj1); +- JSHandle obj3 = JSObject::ObjectCreate(thread, obj2); +- JSHandle obj4 = JSObject::ObjectCreate(thread, obj2); +- JSHandle obj5 = JSObject::ObjectCreate(thread, obj4); +- JSHandle obj6 = JSObject::ObjectCreate(thread, obj2); +- JSHandle obj7 = JSObject::ObjectCreate(thread, obj6); +- +- JSHandle obj1Key(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("key1")); +- JSHandle obj2Key(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("key2")); +- JSHandle obj3Key(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("key3")); +- JSHandle obj4Key(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("key4")); +- JSHandle obj5Key(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("key5")); +- JSHandle obj6Key(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("key6")); +- JSHandle obj7Key(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("key7")); +- +- JSHandle obj1Value(thread, JSTaggedValue(1)); +- JSHandle obj2Value(thread, JSTaggedValue(2)); +- JSHandle obj3Value(thread, JSTaggedValue(3)); +- JSHandle obj4Value(thread, JSTaggedValue(4)); +- JSHandle obj5Value(thread, JSTaggedValue(5)); +- JSHandle obj6Value(thread, JSTaggedValue(6)); +- JSHandle obj7Value(thread, JSTaggedValue(7)); +- +- JSObject::SetProperty(thread, JSHandle(obj1), obj1Key, obj1Value); +- JSObject::SetProperty(thread, JSHandle(obj2), obj2Key, obj2Value); +- JSObject::SetProperty(thread, JSHandle(obj3), obj3Key, obj3Value); +- JSObject::SetProperty(thread, JSHandle(obj4), obj4Key, obj4Value); +- JSObject::SetProperty(thread, JSHandle(obj5), obj5Key, obj5Value); +- JSObject::SetProperty(thread, JSHandle(obj6), obj6Key, obj6Value); +- JSObject::SetProperty(thread, JSHandle(obj7), obj7Key, obj7Value); +- +- JSHandle obj1Dynclass(thread, obj1->GetJSHClass()); +- JSHandle obj2Dynclass(thread, obj2->GetJSHClass()); +- JSHandle obj3Dynclass(thread, obj3->GetJSHClass()); +- JSHandle obj4Dynclass(thread, obj4->GetJSHClass()); +- JSHandle obj5Dynclass(thread, obj5->GetJSHClass()); +- JSHandle obj6Dynclass(thread, obj6->GetJSHClass()); +- JSHandle obj7Dynclass(thread, obj7->GetJSHClass()); +- +- JSHandle result3Marker = JSHClass::EnableProtoChangeMarker(thread, obj3Dynclass); +- JSHandle result5Marker = JSHClass::EnableProtoChangeMarker(thread, obj5Dynclass); ++ JSHandle nullHandle(thread_, JSTaggedValue::Null()); ++ JSHandle obj1 = JSObject::ObjectCreate(thread_, nullHandle); ++ JSHandle obj2 = JSObject::ObjectCreate(thread_, obj1); ++ JSHandle obj3 = JSObject::ObjectCreate(thread_, obj2); ++ JSHandle obj4 = JSObject::ObjectCreate(thread_, obj2); ++ JSHandle obj5 = JSObject::ObjectCreate(thread_, obj4); ++ JSHandle obj6 = JSObject::ObjectCreate(thread_, obj2); ++ JSHandle obj7 = JSObject::ObjectCreate(thread_, obj6); ++ ++ JSHandle obj1Key(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("key1")); ++ JSHandle obj2Key(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("key2")); ++ JSHandle obj3Key(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("key3")); ++ JSHandle obj4Key(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("key4")); ++ JSHandle obj5Key(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("key5")); ++ JSHandle obj6Key(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("key6")); ++ JSHandle obj7Key(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("key7")); ++ ++ JSHandle obj1Value(thread_, JSTaggedValue(1)); ++ JSHandle obj2Value(thread_, JSTaggedValue(2)); ++ JSHandle obj3Value(thread_, JSTaggedValue(3)); ++ JSHandle obj4Value(thread_, JSTaggedValue(4)); ++ JSHandle obj5Value(thread_, JSTaggedValue(5)); ++ JSHandle obj6Value(thread_, JSTaggedValue(6)); ++ JSHandle obj7Value(thread_, JSTaggedValue(7)); ++ ++ JSObject::SetProperty(thread_, JSHandle(obj1), obj1Key, obj1Value); ++ JSObject::SetProperty(thread_, JSHandle(obj2), obj2Key, obj2Value); ++ JSObject::SetProperty(thread_, JSHandle(obj3), obj3Key, obj3Value); ++ JSObject::SetProperty(thread_, JSHandle(obj4), obj4Key, obj4Value); ++ JSObject::SetProperty(thread_, JSHandle(obj5), obj5Key, obj5Value); ++ JSObject::SetProperty(thread_, JSHandle(obj6), obj6Key, obj6Value); ++ JSObject::SetProperty(thread_, JSHandle(obj7), obj7Key, obj7Value); ++ ++ JSHandle obj1Dynclass(thread_, obj1->GetJSHClass()); ++ JSHandle obj2Dynclass(thread_, obj2->GetJSHClass()); ++ JSHandle obj3Dynclass(thread_, obj3->GetJSHClass()); ++ JSHandle obj4Dynclass(thread_, obj4->GetJSHClass()); ++ JSHandle obj5Dynclass(thread_, obj5->GetJSHClass()); ++ JSHandle obj6Dynclass(thread_, obj6->GetJSHClass()); ++ JSHandle obj7Dynclass(thread_, obj7->GetJSHClass()); ++ ++ JSHandle result3Marker = JSHClass::EnableProtoChangeMarker(thread_, obj3Dynclass); ++ JSHandle result5Marker = JSHClass::EnableProtoChangeMarker(thread_, obj5Dynclass); + EXPECT_TRUE(result3Marker->IsProtoChangeMarker()); + EXPECT_TRUE(!(ProtoChangeMarker::Cast(result3Marker->GetTaggedObject())->GetHasChanged())); + EXPECT_TRUE(result5Marker->IsProtoChangeMarker()); +@@ -1072,7 +1073,7 @@ TEST_F(JSObjectTest, BuildRegisterTree) + EXPECT_TRUE(obj4Dynclass->GetProtoChangeMarker().IsProtoChangeMarker()); + EXPECT_TRUE(!obj6Dynclass->GetProtoChangeMarker().IsProtoChangeMarker()); + +- JSHandle result7Marker = JSHClass::EnableProtoChangeMarker(thread, obj7Dynclass); ++ JSHandle result7Marker = JSHClass::EnableProtoChangeMarker(thread_, obj7Dynclass); + EXPECT_TRUE(result7Marker->IsProtoChangeMarker()); + EXPECT_TRUE(!(ProtoChangeMarker::Cast(result7Marker->GetTaggedObject())->GetHasChanged())); + +@@ -1080,7 +1081,7 @@ TEST_F(JSObjectTest, BuildRegisterTree) + EXPECT_TRUE(protoDetails1.IsProtoChangeDetails()); + JSTaggedValue listeners1Value = ProtoChangeDetails::Cast(protoDetails1.GetTaggedObject())->GetChangeListener(); + EXPECT_TRUE(listeners1Value != JSTaggedValue(0)); +- JSHandle listeners1(thread, listeners1Value.GetTaggedObject()); ++ JSHandle listeners1(thread_, listeners1Value.GetTaggedObject()); + JSTaggedValue protoDetails2 = obj2Dynclass->GetProtoChangeDetails(); + EXPECT_TRUE(protoDetails2.IsProtoChangeDetails()); + JSTaggedValue index2 = ProtoChangeDetails::Cast(protoDetails2.GetTaggedObject())->GetRegisterIndex(); +@@ -1088,7 +1089,7 @@ TEST_F(JSObjectTest, BuildRegisterTree) + + JSTaggedValue listeners2Value = ProtoChangeDetails::Cast(protoDetails2.GetTaggedObject())->GetChangeListener(); + EXPECT_TRUE(listeners2Value != JSTaggedValue(0)); +- JSHandle listeners2(thread, listeners2Value.GetTaggedObject()); ++ JSHandle listeners2(thread_, listeners2Value.GetTaggedObject()); + JSTaggedValue protoDetails4 = obj4Dynclass->GetProtoChangeDetails(); + JSTaggedValue protoDetails6 = obj6Dynclass->GetProtoChangeDetails(); + EXPECT_TRUE(protoDetails4.IsProtoChangeDetails()); +@@ -1104,58 +1105,58 @@ TEST_F(JSObjectTest, BuildRegisterTree) + + TEST_F(JSObjectTest, NoticeThroughChain) + { +- JSHandle nullHandle(thread, JSTaggedValue::Null()); +- JSHandle obj1 = JSObject::ObjectCreate(thread, nullHandle); +- JSHandle obj2 = JSObject::ObjectCreate(thread, obj1); +- JSHandle obj3 = JSObject::ObjectCreate(thread, obj2); +- JSHandle obj4 = JSObject::ObjectCreate(thread, obj2); +- JSHandle obj5 = JSObject::ObjectCreate(thread, obj4); +- JSHandle obj6 = JSObject::ObjectCreate(thread, obj2); +- JSHandle obj7 = JSObject::ObjectCreate(thread, obj6); +- +- JSHandle obj1Key(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("key1")); +- JSHandle obj2Key(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("key2")); +- JSHandle obj3Key(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("key3")); +- JSHandle obj4Key(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("key4")); +- JSHandle obj5Key(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("key5")); +- JSHandle obj6Key(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("key6")); +- JSHandle obj7Key(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("key7")); +- +- JSHandle obj1Value(thread, JSTaggedValue(1)); +- JSHandle obj2Value(thread, JSTaggedValue(2)); +- JSHandle obj3Value(thread, JSTaggedValue(3)); +- JSHandle obj4Value(thread, JSTaggedValue(4)); +- JSHandle obj5Value(thread, JSTaggedValue(5)); +- JSHandle obj6Value(thread, JSTaggedValue(6)); +- JSHandle obj7Value(thread, JSTaggedValue(7)); +- +- JSObject::SetProperty(thread, JSHandle(obj1), obj1Key, obj1Value); +- JSObject::SetProperty(thread, JSHandle(obj2), obj2Key, obj2Value); +- JSObject::SetProperty(thread, JSHandle(obj3), obj3Key, obj3Value); +- JSObject::SetProperty(thread, JSHandle(obj4), obj4Key, obj4Value); +- JSObject::SetProperty(thread, JSHandle(obj5), obj5Key, obj5Value); +- JSObject::SetProperty(thread, JSHandle(obj6), obj6Key, obj6Value); +- JSObject::SetProperty(thread, JSHandle(obj7), obj7Key, obj7Value); +- +- JSHandle obj1Dynclass(thread, obj1->GetJSHClass()); +- JSHandle obj2Dynclass(thread, obj2->GetJSHClass()); +- JSHandle obj3Dynclass(thread, obj3->GetJSHClass()); +- JSHandle obj4Dynclass(thread, obj4->GetJSHClass()); +- JSHandle obj5Dynclass(thread, obj5->GetJSHClass()); +- JSHandle obj6Dynclass(thread, obj6->GetJSHClass()); +- JSHandle obj7Dynclass(thread, obj7->GetJSHClass()); +- +- JSHClass::EnableProtoChangeMarker(thread, obj3Dynclass); +- JSHClass::EnableProtoChangeMarker(thread, obj7Dynclass); +- JSHClass::EnableProtoChangeMarker(thread, obj5Dynclass); +- +- JSHClass::NoticeThroughChain(thread, obj2Dynclass); +- JSHClass::UnregisterOnProtoChain(thread, obj2Dynclass); ++ JSHandle nullHandle(thread_, JSTaggedValue::Null()); ++ JSHandle obj1 = JSObject::ObjectCreate(thread_, nullHandle); ++ JSHandle obj2 = JSObject::ObjectCreate(thread_, obj1); ++ JSHandle obj3 = JSObject::ObjectCreate(thread_, obj2); ++ JSHandle obj4 = JSObject::ObjectCreate(thread_, obj2); ++ JSHandle obj5 = JSObject::ObjectCreate(thread_, obj4); ++ JSHandle obj6 = JSObject::ObjectCreate(thread_, obj2); ++ JSHandle obj7 = JSObject::ObjectCreate(thread_, obj6); ++ ++ JSHandle obj1Key(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("key1")); ++ JSHandle obj2Key(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("key2")); ++ JSHandle obj3Key(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("key3")); ++ JSHandle obj4Key(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("key4")); ++ JSHandle obj5Key(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("key5")); ++ JSHandle obj6Key(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("key6")); ++ JSHandle obj7Key(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("key7")); ++ ++ JSHandle obj1Value(thread_, JSTaggedValue(1)); ++ JSHandle obj2Value(thread_, JSTaggedValue(2)); ++ JSHandle obj3Value(thread_, JSTaggedValue(3)); ++ JSHandle obj4Value(thread_, JSTaggedValue(4)); ++ JSHandle obj5Value(thread_, JSTaggedValue(5)); ++ JSHandle obj6Value(thread_, JSTaggedValue(6)); ++ JSHandle obj7Value(thread_, JSTaggedValue(7)); ++ ++ JSObject::SetProperty(thread_, JSHandle(obj1), obj1Key, obj1Value); ++ JSObject::SetProperty(thread_, JSHandle(obj2), obj2Key, obj2Value); ++ JSObject::SetProperty(thread_, JSHandle(obj3), obj3Key, obj3Value); ++ JSObject::SetProperty(thread_, JSHandle(obj4), obj4Key, obj4Value); ++ JSObject::SetProperty(thread_, JSHandle(obj5), obj5Key, obj5Value); ++ JSObject::SetProperty(thread_, JSHandle(obj6), obj6Key, obj6Value); ++ JSObject::SetProperty(thread_, JSHandle(obj7), obj7Key, obj7Value); ++ ++ JSHandle obj1Dynclass(thread_, obj1->GetJSHClass()); ++ JSHandle obj2Dynclass(thread_, obj2->GetJSHClass()); ++ JSHandle obj3Dynclass(thread_, obj3->GetJSHClass()); ++ JSHandle obj4Dynclass(thread_, obj4->GetJSHClass()); ++ JSHandle obj5Dynclass(thread_, obj5->GetJSHClass()); ++ JSHandle obj6Dynclass(thread_, obj6->GetJSHClass()); ++ JSHandle obj7Dynclass(thread_, obj7->GetJSHClass()); ++ ++ JSHClass::EnableProtoChangeMarker(thread_, obj3Dynclass); ++ JSHClass::EnableProtoChangeMarker(thread_, obj7Dynclass); ++ JSHClass::EnableProtoChangeMarker(thread_, obj5Dynclass); ++ ++ JSHClass::NoticeThroughChain(thread_, obj2Dynclass); ++ JSHClass::UnregisterOnProtoChain(thread_, obj2Dynclass); + JSTaggedValue protoDetails1 = obj1Dynclass->GetProtoChangeDetails(); + EXPECT_TRUE(protoDetails1.IsProtoChangeDetails()); + JSTaggedValue listeners1Value = ProtoChangeDetails::Cast(protoDetails1.GetTaggedObject())->GetChangeListener(); + EXPECT_TRUE(listeners1Value != JSTaggedValue(0)); +- JSHandle listeners1(thread, listeners1Value.GetTaggedObject()); ++ JSHandle listeners1(thread_, listeners1Value.GetTaggedObject()); + uint32_t holeIndex = ChangeListener::CheckHole(listeners1); + EXPECT_TRUE(holeIndex == 0); + +@@ -1179,52 +1180,52 @@ TEST_F(JSObjectTest, NoticeThroughChain) + + TEST_F(JSObjectTest, ChangeProtoAndNoticeTheChain) + { +- JSHandle nullHandle(thread, JSTaggedValue::Null()); +- JSHandle obj1 = JSObject::ObjectCreate(thread, nullHandle); +- JSHandle obj2 = JSObject::ObjectCreate(thread, obj1); +- JSHandle obj3 = JSObject::ObjectCreate(thread, obj1); +- JSHandle obj4 = JSObject::ObjectCreate(thread, obj2); +- JSHandle obj5 = JSObject::ObjectCreate(thread, obj4); +- JSHandle obj6 = JSObject::ObjectCreate(thread, obj2); +- JSHandle obj7 = JSObject::ObjectCreate(thread, obj6); +- +- JSHandle obj1Key(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("key1")); +- JSHandle obj2Key(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("key2")); +- JSHandle obj3Key(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("key3")); +- JSHandle obj4Key(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("key4")); +- JSHandle obj5Key(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("key5")); +- JSHandle obj6Key(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("key6")); +- JSHandle obj7Key(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("key7")); +- +- JSHandle obj1Value(thread, JSTaggedValue(1)); +- JSHandle obj2Value(thread, JSTaggedValue(2)); +- JSHandle obj3Value(thread, JSTaggedValue(3)); +- JSHandle obj4Value(thread, JSTaggedValue(4)); +- JSHandle obj5Value(thread, JSTaggedValue(5)); +- JSHandle obj6Value(thread, JSTaggedValue(6)); +- JSHandle obj7Value(thread, JSTaggedValue(7)); +- +- JSObject::SetProperty(thread, JSHandle(obj1), obj1Key, obj1Value); +- JSObject::SetProperty(thread, JSHandle(obj2), obj2Key, obj2Value); +- JSObject::SetProperty(thread, JSHandle(obj3), obj3Key, obj3Value); +- JSObject::SetProperty(thread, JSHandle(obj4), obj4Key, obj4Value); +- JSObject::SetProperty(thread, JSHandle(obj5), obj5Key, obj5Value); +- JSObject::SetProperty(thread, JSHandle(obj6), obj6Key, obj6Value); +- JSObject::SetProperty(thread, JSHandle(obj7), obj7Key, obj7Value); +- +- JSHandle obj5Dynclass(thread, obj5->GetJSHClass()); +- JSHandle obj7Dynclass(thread, obj7->GetJSHClass()); +- +- JSHClass::EnableProtoChangeMarker(thread, obj7Dynclass); +- JSHClass::EnableProtoChangeMarker(thread, obj5Dynclass); +- +- JSObject::SetPrototype(thread, obj2, JSHandle(obj3)); +- +- JSHandle obj1Dynclass(thread, obj1->GetJSHClass()); +- JSHandle obj2Dynclass(thread, obj2->GetJSHClass()); +- JSHandle obj3Dynclass(thread, obj3->GetJSHClass()); +- JSHandle obj4Dynclass(thread, obj4->GetJSHClass()); +- JSHandle obj6Dynclass(thread, obj6->GetJSHClass()); ++ JSHandle nullHandle(thread_, JSTaggedValue::Null()); ++ JSHandle obj1 = JSObject::ObjectCreate(thread_, nullHandle); ++ JSHandle obj2 = JSObject::ObjectCreate(thread_, obj1); ++ JSHandle obj3 = JSObject::ObjectCreate(thread_, obj1); ++ JSHandle obj4 = JSObject::ObjectCreate(thread_, obj2); ++ JSHandle obj5 = JSObject::ObjectCreate(thread_, obj4); ++ JSHandle obj6 = JSObject::ObjectCreate(thread_, obj2); ++ JSHandle obj7 = JSObject::ObjectCreate(thread_, obj6); ++ ++ JSHandle obj1Key(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("key1")); ++ JSHandle obj2Key(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("key2")); ++ JSHandle obj3Key(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("key3")); ++ JSHandle obj4Key(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("key4")); ++ JSHandle obj5Key(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("key5")); ++ JSHandle obj6Key(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("key6")); ++ JSHandle obj7Key(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("key7")); ++ ++ JSHandle obj1Value(thread_, JSTaggedValue(1)); ++ JSHandle obj2Value(thread_, JSTaggedValue(2)); ++ JSHandle obj3Value(thread_, JSTaggedValue(3)); ++ JSHandle obj4Value(thread_, JSTaggedValue(4)); ++ JSHandle obj5Value(thread_, JSTaggedValue(5)); ++ JSHandle obj6Value(thread_, JSTaggedValue(6)); ++ JSHandle obj7Value(thread_, JSTaggedValue(7)); ++ ++ JSObject::SetProperty(thread_, JSHandle(obj1), obj1Key, obj1Value); ++ JSObject::SetProperty(thread_, JSHandle(obj2), obj2Key, obj2Value); ++ JSObject::SetProperty(thread_, JSHandle(obj3), obj3Key, obj3Value); ++ JSObject::SetProperty(thread_, JSHandle(obj4), obj4Key, obj4Value); ++ JSObject::SetProperty(thread_, JSHandle(obj5), obj5Key, obj5Value); ++ JSObject::SetProperty(thread_, JSHandle(obj6), obj6Key, obj6Value); ++ JSObject::SetProperty(thread_, JSHandle(obj7), obj7Key, obj7Value); ++ ++ JSHandle obj5Dynclass(thread_, obj5->GetJSHClass()); ++ JSHandle obj7Dynclass(thread_, obj7->GetJSHClass()); ++ ++ JSHClass::EnableProtoChangeMarker(thread_, obj7Dynclass); ++ JSHClass::EnableProtoChangeMarker(thread_, obj5Dynclass); ++ ++ JSObject::SetPrototype(thread_, obj2, JSHandle(obj3)); ++ ++ JSHandle obj1Dynclass(thread_, obj1->GetJSHClass()); ++ JSHandle obj2Dynclass(thread_, obj2->GetJSHClass()); ++ JSHandle obj3Dynclass(thread_, obj3->GetJSHClass()); ++ JSHandle obj4Dynclass(thread_, obj4->GetJSHClass()); ++ JSHandle obj6Dynclass(thread_, obj6->GetJSHClass()); + + JSTaggedValue obj6Marker = obj6Dynclass->GetProtoChangeMarker(); + EXPECT_TRUE(obj6Marker.IsProtoChangeMarker()); +@@ -1272,8 +1273,8 @@ TEST_F(JSObjectTest, ChangeProtoAndNoticeTheChain) + + TEST_F(JSObjectTest, NativePointerField) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); +- JSHandle objFunc(thread, JSObjectTestCreate(thread)); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); ++ JSHandle objFunc(thread_, JSObjectTestCreate(thread_)); + JSHandle obj = factory->NewJSObjectByConstructor(JSHandle(objFunc), objFunc); + obj->SetHash(87); + EXPECT_TRUE(obj->GetHash() == 87); +diff --git a/tests/runtime/common/js_primitive_ref_test.cpp b/tests/runtime/common/js_primitive_ref_test.cpp +index 92c2adb..40cfd38 100644 +--- a/tests/runtime/common/js_primitive_ref_test.cpp ++++ b/tests/runtime/common/js_primitive_ref_test.cpp +@@ -36,33 +36,33 @@ class JSPrimitiveRefTest : public testing::Test { + public: + void SetUp() override + { +- TestHelper::CreateEcmaVMWithScope(instance, thread, scope); ++ TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); + } + + void TearDown() override + { +- TestHelper::DestroyEcmaVMWithScope(instance, scope); ++ TestHelper::DestroyEcmaVMWithScope(instance_, scope_); + } + +- PandaVM *instance {nullptr}; +- ecmascript::EcmaHandleScope *scope {nullptr}; +- JSThread *thread; ++ PandaVM *instance_ {nullptr}; ++ ecmascript::EcmaHandleScope *scope_ {nullptr}; ++ JSThread *thread_; + }; + + TEST_F(JSPrimitiveRefTest, DISABLED_StringCreate) // issue #5368 + { +- JSHandle hello(thread->GetEcmaVM()->GetFactory()->NewFromString("hello")); +- JSHandle str(JSPrimitiveRef::StringCreate(thread, hello)); ++ JSHandle hello(thread_->GetEcmaVM()->GetFactory()->NewFromString("hello")); ++ JSHandle str(JSPrimitiveRef::StringCreate(thread_, hello)); + +- JSHandle idx(thread->GetEcmaVM()->GetFactory()->NewFromString("0")); +- bool status = JSPrimitiveRef::HasProperty(thread, str, idx); ++ JSHandle idx(thread_->GetEcmaVM()->GetFactory()->NewFromString("0")); ++ bool status = JSPrimitiveRef::HasProperty(thread_, str, idx); + ASSERT_TRUE(status); + +- PropertyDescriptor desc(thread); +- status = JSPrimitiveRef::GetOwnProperty(thread, str, idx, desc); ++ PropertyDescriptor desc(thread_); ++ status = JSPrimitiveRef::GetOwnProperty(thread_, str, idx, desc); + ASSERT_TRUE(status); +- JSHandle h = thread->GetEcmaVM()->GetFactory()->NewFromString("h"); +- JSHandle h2 = JSTaggedValue::ToString(thread, desc.GetValue()); ++ JSHandle h = thread_->GetEcmaVM()->GetFactory()->NewFromString("h"); ++ JSHandle h2 = JSTaggedValue::ToString(thread_, desc.GetValue()); + ASSERT_TRUE(h->Compare(*h2) == 0); + } + +diff --git a/tests/runtime/common/js_promise_test.cpp b/tests/runtime/common/js_promise_test.cpp +index 0387dbd..0bad478 100644 +--- a/tests/runtime/common/js_promise_test.cpp ++++ b/tests/runtime/common/js_promise_test.cpp +@@ -38,90 +38,90 @@ class JSPromiseTest : public testing::Test { + public: + void SetUp() override + { +- TestHelper::CreateEcmaVMWithScope(instance, thread, scope); ++ TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); + } + + void TearDown() override + { +- TestHelper::DestroyEcmaVMWithScope(instance, scope); ++ TestHelper::DestroyEcmaVMWithScope(instance_, scope_); + } + +- JSThread *thread {nullptr}; +- PandaVM *instance {nullptr}; +- ecmascript::EcmaHandleScope *scope {nullptr}; ++ JSThread *thread_ {nullptr}; ++ PandaVM *instance_ {nullptr}; ++ ecmascript::EcmaHandleScope *scope_ {nullptr}; + }; + + TEST_F(JSPromiseTest, CreateResolvingFunctions) + { +- EcmaVM *ecmaVM = thread->GetEcmaVM(); ++ EcmaVM *ecmaVM = thread_->GetEcmaVM(); + JSHandle env = ecmaVM->GetGlobalEnv(); + ObjectFactory *factory = ecmaVM->GetFactory(); + + JSHandle promiseFunc = env->GetPromiseFunction(); + JSHandle jsPromise = + JSHandle::Cast(factory->NewJSObjectByConstructor(JSHandle(promiseFunc), promiseFunc)); +- JSHandle reactions = JSPromise::CreateResolvingFunctions(thread, jsPromise); +- JSHandle resolve(thread, reactions->GetResolveFunction()); +- JSHandle reject(thread, reactions->GetRejectFunction()); ++ JSHandle reactions = JSPromise::CreateResolvingFunctions(thread_, jsPromise); ++ JSHandle resolve(thread_, reactions->GetResolveFunction()); ++ JSHandle reject(thread_, reactions->GetRejectFunction()); + EXPECT_EQ(resolve->IsCallable(), true); + EXPECT_EQ(reject->IsCallable(), true); + } + + TEST_F(JSPromiseTest, NewPromiseCapability) + { +- EcmaVM *ecmaVM = thread->GetEcmaVM(); ++ EcmaVM *ecmaVM = thread_->GetEcmaVM(); + JSHandle env = ecmaVM->GetGlobalEnv(); + JSHandle promise = env->GetPromiseFunction(); + +- JSHandle capbility = JSPromise::NewPromiseCapability(thread, promise); +- JSHandle newPromise(thread, capbility->GetPromise()); ++ JSHandle capbility = JSPromise::NewPromiseCapability(thread_, promise); ++ JSHandle newPromise(thread_, capbility->GetPromise()); + EXPECT_EQ(static_cast(newPromise->GetPromiseState().GetInt()), PromiseStatus::PENDING); + +- JSHandle resolve(thread, capbility->GetResolve()); +- JSHandle reject(thread, capbility->GetReject()); ++ JSHandle resolve(thread_, capbility->GetResolve()); ++ JSHandle reject(thread_, capbility->GetReject()); + EXPECT_EQ(resolve.GetTaggedValue().IsCallable(), true); + EXPECT_EQ(resolve.GetTaggedValue().IsCallable(), true); + +- JSHandle resolve_promise(thread, resolve->GetPromise()); +- JSHandle reject_promise(thread, reject->GetPromise()); ++ JSHandle resolve_promise(thread_, resolve->GetPromise()); ++ JSHandle reject_promise(thread_, reject->GetPromise()); + EXPECT_EQ(JSTaggedValue::SameValue(newPromise.GetTaggedValue(), resolve_promise.GetTaggedValue()), true); + EXPECT_EQ(JSTaggedValue::SameValue(newPromise.GetTaggedValue(), reject_promise.GetTaggedValue()), true); + } + + TEST_F(JSPromiseTest, FullFillPromise) + { +- EcmaVM *ecmaVM = thread->GetEcmaVM(); ++ EcmaVM *ecmaVM = thread_->GetEcmaVM(); + JSHandle env = ecmaVM->GetGlobalEnv(); + JSHandle promise = env->GetPromiseFunction(); +- JSHandle capbility = JSPromise::NewPromiseCapability(thread, promise); +- JSHandle newPromise(thread, capbility->GetPromise()); ++ JSHandle capbility = JSPromise::NewPromiseCapability(thread_, promise); ++ JSHandle newPromise(thread_, capbility->GetPromise()); + EXPECT_EQ(static_cast(newPromise->GetPromiseState().GetInt()), PromiseStatus::PENDING); + EXPECT_EQ(newPromise->GetPromiseResult().IsUndefined(), true); + +- JSHandle resolve(thread, capbility->GetResolve()); +- JSHandle undefined(thread, JSTaggedValue::Undefined()); +- InternalCallParams *arguments = thread->GetInternalCallParams(); ++ JSHandle resolve(thread_, capbility->GetResolve()); ++ JSHandle undefined(thread_, JSTaggedValue::Undefined()); ++ InternalCallParams *arguments = thread_->GetInternalCallParams(); + arguments->MakeArgv(JSTaggedValue(33)); +- JSFunction::Call(thread, resolve, undefined, 1, arguments->GetArgv()); ++ JSFunction::Call(thread_, resolve, undefined, 1, arguments->GetArgv()); + EXPECT_EQ(static_cast(newPromise->GetPromiseState().GetInt()), PromiseStatus::FULFILLED); + EXPECT_EQ(JSTaggedValue::SameValue(newPromise->GetPromiseResult(), JSTaggedValue(33)), true); + } + + TEST_F(JSPromiseTest, RejectPromise) + { +- EcmaVM *ecmaVM = thread->GetEcmaVM(); ++ EcmaVM *ecmaVM = thread_->GetEcmaVM(); + JSHandle env = ecmaVM->GetGlobalEnv(); + JSHandle promise = env->GetPromiseFunction(); +- JSHandle capbility = JSPromise::NewPromiseCapability(thread, promise); +- JSHandle newPromise(thread, capbility->GetPromise()); ++ JSHandle capbility = JSPromise::NewPromiseCapability(thread_, promise); ++ JSHandle newPromise(thread_, capbility->GetPromise()); + EXPECT_EQ(static_cast(newPromise->GetPromiseState().GetInt()), PromiseStatus::PENDING); + EXPECT_EQ(newPromise->GetPromiseResult().IsUndefined(), true); + +- JSHandle reject(thread, capbility->GetReject()); +- JSHandle undefined(thread, JSTaggedValue::Undefined()); +- InternalCallParams *arguments = thread->GetInternalCallParams(); ++ JSHandle reject(thread_, capbility->GetReject()); ++ JSHandle undefined(thread_, JSTaggedValue::Undefined()); ++ InternalCallParams *arguments = thread_->GetInternalCallParams(); + arguments->MakeArgv(JSTaggedValue(44)); +- JSFunction::Call(thread, reject, undefined, 1, arguments->GetArgv()); ++ JSFunction::Call(thread_, reject, undefined, 1, arguments->GetArgv()); + EXPECT_EQ(static_cast(newPromise->GetPromiseState().GetInt()), PromiseStatus::REJECTED); + EXPECT_EQ(JSTaggedValue::SameValue(newPromise->GetPromiseResult(), JSTaggedValue(44)), true); + } +diff --git a/tests/runtime/common/js_proxy_test.cpp b/tests/runtime/common/js_proxy_test.cpp +index 3b1dfd2..a3eaecc 100644 +--- a/tests/runtime/common/js_proxy_test.cpp ++++ b/tests/runtime/common/js_proxy_test.cpp +@@ -39,17 +39,17 @@ class JSProxyTest : public testing::Test { + public: + void SetUp() override + { +- TestHelper::CreateEcmaVMWithScope(instance, thread, scope); ++ TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); + } + + void TearDown() override + { +- TestHelper::DestroyEcmaVMWithScope(instance, scope); ++ TestHelper::DestroyEcmaVMWithScope(instance_, scope_); + } + +- PandaVM *instance {nullptr}; +- ecmascript::EcmaHandleScope *scope {nullptr}; +- JSThread *thread; ++ PandaVM *instance_ {nullptr}; ++ ecmascript::EcmaHandleScope *scope_ {nullptr}; ++ JSThread *thread_; + }; + + static JSFunction *JSObjectTestCreate(JSThread *thread) +@@ -61,25 +61,25 @@ static JSFunction *JSObjectTestCreate(JSThread *thread) + + TEST_F(JSProxyTest, ProxyCreate) + { +- JSHandle dynclass(thread, JSObjectTestCreate(thread)); ++ JSHandle dynclass(thread_, JSObjectTestCreate(thread_)); + JSHandle target_handle( +- thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle::Cast(dynclass), dynclass)); ++ thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle::Cast(dynclass), dynclass)); + +- JSHandle key(thread->GetEcmaVM()->GetFactory()->NewFromString("x")); +- JSHandle value(thread, JSTaggedValue(1)); +- JSObject::SetProperty(thread, target_handle, key, value); +- EXPECT_EQ(JSObject::GetProperty(thread, target_handle, key).GetValue()->GetInt(), 1); ++ JSHandle key(thread_->GetEcmaVM()->GetFactory()->NewFromString("x")); ++ JSHandle value(thread_, JSTaggedValue(1)); ++ JSObject::SetProperty(thread_, target_handle, key, value); ++ EXPECT_EQ(JSObject::GetProperty(thread_, target_handle, key).GetValue()->GetInt(), 1); + + JSHandle handler_handle( +- thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle::Cast(dynclass), dynclass)); ++ thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle::Cast(dynclass), dynclass)); + EXPECT_TRUE(handler_handle->IsECMAObject()); + +- JSHandle proxy_handle = JSProxy::ProxyCreate(thread, target_handle, handler_handle); ++ JSHandle proxy_handle = JSProxy::ProxyCreate(thread_, target_handle, handler_handle); + EXPECT_TRUE(*proxy_handle != nullptr); + +- EXPECT_EQ(JSProxy::GetProperty(thread, proxy_handle, key).GetValue()->GetInt(), 1); +- PropertyDescriptor desc(thread); +- JSProxy::GetOwnProperty(thread, proxy_handle, key, desc); ++ EXPECT_EQ(JSProxy::GetProperty(thread_, proxy_handle, key).GetValue()->GetInt(), 1); ++ PropertyDescriptor desc(thread_); ++ JSProxy::GetOwnProperty(thread_, proxy_handle, key, desc); + EXPECT_EQ(desc.GetValue()->GetInt(), 1); + } + +@@ -91,36 +91,36 @@ JSTaggedValue HandlerGetProperty([[maybe_unused]] EcmaRuntimeCallInfo *argv) + + TEST_F(JSProxyTest, GetProperty) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + // 1. handler has no "get" +- JSHandle dynclass(thread, JSObjectTestCreate(thread)); ++ JSHandle dynclass(thread_, JSObjectTestCreate(thread_)); + JSHandle target_handle(factory->NewJSObjectByConstructor(JSHandle(dynclass), dynclass)); + EXPECT_TRUE(target_handle->IsECMAObject()); + + JSHandle key(factory->NewFromString("x")); +- JSHandle value(thread, JSTaggedValue(1)); +- JSObject::SetProperty(thread, target_handle, key, value); +- EXPECT_EQ(JSObject::GetProperty(thread, target_handle, key).GetValue()->GetInt(), 1); ++ JSHandle value(thread_, JSTaggedValue(1)); ++ JSObject::SetProperty(thread_, target_handle, key, value); ++ EXPECT_EQ(JSObject::GetProperty(thread_, target_handle, key).GetValue()->GetInt(), 1); + + JSHandle handler_handle(factory->NewJSObjectByConstructor(JSHandle(dynclass), dynclass)); + EXPECT_TRUE(handler_handle->IsECMAObject()); + +- JSHandle proxy_handle = JSProxy::ProxyCreate(thread, target_handle, handler_handle); ++ JSHandle proxy_handle = JSProxy::ProxyCreate(thread_, target_handle, handler_handle); + EXPECT_TRUE(*proxy_handle != nullptr); + +- EXPECT_EQ(JSProxy::GetProperty(thread, proxy_handle, key).GetValue()->GetInt(), 1); ++ EXPECT_EQ(JSProxy::GetProperty(thread_, proxy_handle, key).GetValue()->GetInt(), 1); + + // 2. handler has "get" +- EcmaVM *vm = thread->GetEcmaVM(); ++ EcmaVM *vm = thread_->GetEcmaVM(); + JSHandle env = vm->GetGlobalEnv(); +- JSHandle get_key = thread->GlobalConstants()->GetHandledGetString(); ++ JSHandle get_key = thread_->GlobalConstants()->GetHandledGetString(); + JSHandle get_handle(factory->NewJSFunction(env, reinterpret_cast(HandlerGetProperty))); +- JSObject::SetProperty(thread, JSHandle(handler_handle), get_key, get_handle); ++ JSObject::SetProperty(thread_, JSHandle(handler_handle), get_key, get_handle); + +- JSHandle proxy_handle2(JSProxy::ProxyCreate(thread, target_handle, handler_handle)); ++ JSHandle proxy_handle2(JSProxy::ProxyCreate(thread_, target_handle, handler_handle)); + EXPECT_TRUE(*proxy_handle2 != nullptr); + JSHandle key2(factory->NewFromString("y")); +- EXPECT_EQ(JSProxy::GetProperty(thread, proxy_handle2, key2).GetValue()->GetInt(), 10); ++ EXPECT_EQ(JSProxy::GetProperty(thread_, proxy_handle2, key2).GetValue()->GetInt(), 10); + } + + // ES6 9.5.5 [[GetOwnProperty]] (P) +@@ -131,39 +131,39 @@ JSTaggedValue HandlerGetOwnProperty([[maybe_unused]] EcmaRuntimeCallInfo *argv) + + TEST_F(JSProxyTest, GetOwnProperty) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + // 1. handler has no "get" +- JSHandle dynclass(thread, JSObjectTestCreate(thread)); ++ JSHandle dynclass(thread_, JSObjectTestCreate(thread_)); + JSHandle target_handle(factory->NewJSObjectByConstructor(JSHandle(dynclass), dynclass)); + EXPECT_TRUE(target_handle->IsECMAObject()); + + JSHandle key(factory->NewFromString("x")); +- JSHandle value(thread, JSTaggedValue(1)); +- JSObject::SetProperty(thread, target_handle, key, value); +- EXPECT_EQ(JSObject::GetProperty(thread, target_handle, key).GetValue()->GetInt(), 1); ++ JSHandle value(thread_, JSTaggedValue(1)); ++ JSObject::SetProperty(thread_, target_handle, key, value); ++ EXPECT_EQ(JSObject::GetProperty(thread_, target_handle, key).GetValue()->GetInt(), 1); + + JSHandle handler_handle(factory->NewJSObjectByConstructor(JSHandle(dynclass), dynclass)); + EXPECT_TRUE(handler_handle->IsECMAObject()); + +- JSHandle proxy_handle = JSProxy::ProxyCreate(thread, target_handle, handler_handle); ++ JSHandle proxy_handle = JSProxy::ProxyCreate(thread_, target_handle, handler_handle); + EXPECT_TRUE(*proxy_handle != nullptr); + +- PropertyDescriptor desc(thread); +- JSProxy::GetOwnProperty(thread, proxy_handle, key, desc); ++ PropertyDescriptor desc(thread_); ++ JSProxy::GetOwnProperty(thread_, proxy_handle, key, desc); + EXPECT_EQ(desc.GetValue()->GetInt(), 1); + + // 2. handler has "get" +- EcmaVM *vm = thread->GetEcmaVM(); ++ EcmaVM *vm = thread_->GetEcmaVM(); + JSHandle env = vm->GetGlobalEnv(); +- JSHandle define_key = thread->GlobalConstants()->GetHandledGetOwnPropertyDescriptorString(); ++ JSHandle define_key = thread_->GlobalConstants()->GetHandledGetOwnPropertyDescriptorString(); + JSHandle define_handle(factory->NewJSFunction(env, reinterpret_cast(HandlerGetOwnProperty))); +- JSObject::SetProperty(thread, JSHandle(handler_handle), define_key, define_handle); ++ JSObject::SetProperty(thread_, JSHandle(handler_handle), define_key, define_handle); + +- JSHandle proxy_handle2 = JSProxy::ProxyCreate(thread, target_handle, handler_handle); ++ JSHandle proxy_handle2 = JSProxy::ProxyCreate(thread_, target_handle, handler_handle); + EXPECT_TRUE(*proxy_handle2 != nullptr); + JSHandle key2(factory->NewFromString("y")); +- PropertyDescriptor desc2(thread); +- EXPECT_FALSE(JSProxy::GetOwnProperty(thread, proxy_handle2, key2, desc2)); ++ PropertyDescriptor desc2(thread_); ++ EXPECT_FALSE(JSProxy::GetOwnProperty(thread_, proxy_handle2, key2, desc2)); + } + + // ES6 9.5.9 [[Set]] ( P, V, Receiver) +@@ -175,37 +175,37 @@ JSTaggedValue HandlerSetProperty([[maybe_unused]] EcmaRuntimeCallInfo *argv) + TEST_F(JSProxyTest, SetProperty) + { + // 1. handler has no "get" +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + // 1. handler has no "get" +- JSHandle dynclass(thread, JSObjectTestCreate(thread)); ++ JSHandle dynclass(thread_, JSObjectTestCreate(thread_)); + JSHandle target_handle(factory->NewJSObjectByConstructor(JSHandle(dynclass), dynclass)); + EXPECT_TRUE(target_handle->IsECMAObject()); + + JSHandle key(factory->NewFromString("x")); +- JSHandle value(thread, JSTaggedValue(1)); ++ JSHandle value(thread_, JSTaggedValue(1)); + + JSHandle handler_handle(factory->NewJSObjectByConstructor(JSHandle(dynclass), dynclass)); + EXPECT_TRUE(handler_handle->IsECMAObject()); + +- JSHandle proxy_handle = JSProxy::ProxyCreate(thread, target_handle, handler_handle); ++ JSHandle proxy_handle = JSProxy::ProxyCreate(thread_, target_handle, handler_handle); + EXPECT_TRUE(*proxy_handle != nullptr); + +- EXPECT_TRUE(JSProxy::SetProperty(thread, proxy_handle, key, value)); +- EXPECT_EQ(JSProxy::GetProperty(thread, proxy_handle, key).GetValue()->GetInt(), 1); +- EXPECT_EQ(JSObject::GetProperty(thread, target_handle, key).GetValue()->GetInt(), 1); ++ EXPECT_TRUE(JSProxy::SetProperty(thread_, proxy_handle, key, value)); ++ EXPECT_EQ(JSProxy::GetProperty(thread_, proxy_handle, key).GetValue()->GetInt(), 1); ++ EXPECT_EQ(JSObject::GetProperty(thread_, target_handle, key).GetValue()->GetInt(), 1); + + // 2. handler has "set" +- EcmaVM *vm = thread->GetEcmaVM(); ++ EcmaVM *vm = thread_->GetEcmaVM(); + JSHandle env = vm->GetGlobalEnv(); +- JSHandle set_key = thread->GlobalConstants()->GetHandledSetString(); ++ JSHandle set_key = thread_->GlobalConstants()->GetHandledSetString(); + JSHandle set_handle(factory->NewJSFunction(env, reinterpret_cast(HandlerSetProperty))); +- JSObject::SetProperty(thread, JSHandle(handler_handle), set_key, set_handle); ++ JSObject::SetProperty(thread_, JSHandle(handler_handle), set_key, set_handle); + +- JSHandle proxy_handle2(JSProxy::ProxyCreate(thread, target_handle, handler_handle)); ++ JSHandle proxy_handle2(JSProxy::ProxyCreate(thread_, target_handle, handler_handle)); + EXPECT_TRUE(*proxy_handle2 != nullptr); +- JSHandle value2(thread, JSTaggedValue(10)); +- EXPECT_FALSE(JSProxy::SetProperty(thread, proxy_handle2, key, value2)); +- EXPECT_EQ(JSProxy::GetProperty(thread, proxy_handle2, key).GetValue()->GetInt(), 1); ++ JSHandle value2(thread_, JSTaggedValue(10)); ++ EXPECT_FALSE(JSProxy::SetProperty(thread_, proxy_handle2, key, value2)); ++ EXPECT_EQ(JSProxy::GetProperty(thread_, proxy_handle2, key).GetValue()->GetInt(), 1); + } + + // ES6 9.5.6 [[DefineOwnProperty]] (P, Desc) +@@ -216,38 +216,38 @@ JSTaggedValue HandlerDefineOwnProperty([[maybe_unused]] EcmaRuntimeCallInfo *arg + + TEST_F(JSProxyTest, DefineOwnProperty) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + // 1. handler has no "defineProperty" +- JSHandle dynclass(thread, JSObjectTestCreate(thread)); ++ JSHandle dynclass(thread_, JSObjectTestCreate(thread_)); + JSHandle target_handle(factory->NewJSObjectByConstructor(JSHandle(dynclass), dynclass)); + EXPECT_TRUE(target_handle->IsECMAObject()); + + JSHandle key(factory->NewFromString("x")); +- JSHandle value(thread, JSTaggedValue(1)); ++ JSHandle value(thread_, JSTaggedValue(1)); + + JSHandle handler_handle(factory->NewJSObjectByConstructor(JSHandle(dynclass), dynclass)); + EXPECT_TRUE(handler_handle->IsECMAObject()); + +- JSHandle proxy_handle = JSProxy::ProxyCreate(thread, target_handle, handler_handle); ++ JSHandle proxy_handle = JSProxy::ProxyCreate(thread_, target_handle, handler_handle); + EXPECT_TRUE(*proxy_handle != nullptr); + +- PropertyDescriptor desc(thread, JSHandle(thread, JSTaggedValue(1))); +- EXPECT_TRUE(JSProxy::DefineOwnProperty(thread, proxy_handle, key, desc)); +- EXPECT_EQ(JSProxy::GetProperty(thread, proxy_handle, key).GetValue()->GetInt(), 1); +- EXPECT_EQ(JSObject::GetProperty(thread, target_handle, key).GetValue()->GetInt(), 1); ++ PropertyDescriptor desc(thread_, JSHandle(thread_, JSTaggedValue(1))); ++ EXPECT_TRUE(JSProxy::DefineOwnProperty(thread_, proxy_handle, key, desc)); ++ EXPECT_EQ(JSProxy::GetProperty(thread_, proxy_handle, key).GetValue()->GetInt(), 1); ++ EXPECT_EQ(JSObject::GetProperty(thread_, target_handle, key).GetValue()->GetInt(), 1); + + // 2. handler has "defineProperty" +- EcmaVM *vm = thread->GetEcmaVM(); ++ EcmaVM *vm = thread_->GetEcmaVM(); + JSHandle env = vm->GetGlobalEnv(); +- JSHandle set_key = thread->GlobalConstants()->GetHandledDefinePropertyString(); ++ JSHandle set_key = thread_->GlobalConstants()->GetHandledDefinePropertyString(); + JSHandle set_handle(factory->NewJSFunction(env, reinterpret_cast(HandlerDefineOwnProperty))); +- JSObject::SetProperty(thread, JSHandle(handler_handle), set_key, set_handle); ++ JSObject::SetProperty(thread_, JSHandle(handler_handle), set_key, set_handle); + +- JSHandle proxy_handle2 = JSProxy::ProxyCreate(thread, target_handle, handler_handle); ++ JSHandle proxy_handle2 = JSProxy::ProxyCreate(thread_, target_handle, handler_handle); + EXPECT_TRUE(*proxy_handle2 != nullptr); +- PropertyDescriptor desc2(thread, JSHandle(thread, JSTaggedValue(10))); +- EXPECT_FALSE(JSProxy::DefineOwnProperty(thread, proxy_handle, key, desc2)); +- EXPECT_EQ(JSProxy::GetProperty(thread, proxy_handle2, key).GetValue()->GetInt(), 1); ++ PropertyDescriptor desc2(thread_, JSHandle(thread_, JSTaggedValue(10))); ++ EXPECT_FALSE(JSProxy::DefineOwnProperty(thread_, proxy_handle, key, desc2)); ++ EXPECT_EQ(JSProxy::GetProperty(thread_, proxy_handle2, key).GetValue()->GetInt(), 1); + } + + JSTaggedValue HandlerDeleteProperty([[maybe_unused]] EcmaRuntimeCallInfo *argv) +@@ -258,43 +258,43 @@ JSTaggedValue HandlerDeleteProperty([[maybe_unused]] EcmaRuntimeCallInfo *argv) + // ES6 9.5.10 [[Delete]] (P) + TEST_F(JSProxyTest, DeleteProperty) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + // 1. handler has no "deleteProperty" +- JSHandle dynclass(thread, JSObjectTestCreate(thread)); ++ JSHandle dynclass(thread_, JSObjectTestCreate(thread_)); + JSHandle target_handle(factory->NewJSObjectByConstructor(JSHandle(dynclass), dynclass)); + EXPECT_TRUE(target_handle->IsECMAObject()); + + JSHandle key(factory->NewFromString("x")); +- JSHandle value(thread, JSTaggedValue(1)); ++ JSHandle value(thread_, JSTaggedValue(1)); + + JSHandle handler_handle(factory->NewJSObjectByConstructor(JSHandle(dynclass), dynclass)); + EXPECT_TRUE(handler_handle->IsECMAObject()); + +- JSHandle proxy_handle = JSProxy::ProxyCreate(thread, target_handle, handler_handle); ++ JSHandle proxy_handle = JSProxy::ProxyCreate(thread_, target_handle, handler_handle); + EXPECT_TRUE(*proxy_handle != nullptr); + +- PropertyDescriptor desc(thread, JSHandle(thread, JSTaggedValue(1)), true, true, true); +- EXPECT_TRUE(JSProxy::DefineOwnProperty(thread, proxy_handle, key, desc)); +- EXPECT_EQ(JSProxy::GetProperty(thread, proxy_handle, key).GetValue()->GetInt(), 1); +- EXPECT_EQ(JSObject::GetProperty(thread, target_handle, key).GetValue()->GetInt(), 1); +- EXPECT_TRUE(JSProxy::DeleteProperty(thread, proxy_handle, key)); +- PropertyDescriptor res_desc(thread); +- JSProxy::GetOwnProperty(thread, proxy_handle, key, res_desc); ++ PropertyDescriptor desc(thread_, JSHandle(thread_, JSTaggedValue(1)), true, true, true); ++ EXPECT_TRUE(JSProxy::DefineOwnProperty(thread_, proxy_handle, key, desc)); ++ EXPECT_EQ(JSProxy::GetProperty(thread_, proxy_handle, key).GetValue()->GetInt(), 1); ++ EXPECT_EQ(JSObject::GetProperty(thread_, target_handle, key).GetValue()->GetInt(), 1); ++ EXPECT_TRUE(JSProxy::DeleteProperty(thread_, proxy_handle, key)); ++ PropertyDescriptor res_desc(thread_); ++ JSProxy::GetOwnProperty(thread_, proxy_handle, key, res_desc); + EXPECT_TRUE(JSTaggedValue::SameValue(res_desc.GetValue().GetTaggedValue(), JSTaggedValue::Undefined())); + + // 2. handler has "deleteProperty" +- EcmaVM *vm = thread->GetEcmaVM(); ++ EcmaVM *vm = thread_->GetEcmaVM(); + JSHandle env = vm->GetGlobalEnv(); +- JSHandle func_key = thread->GlobalConstants()->GetHandledDeletePropertyString(); ++ JSHandle func_key = thread_->GlobalConstants()->GetHandledDeletePropertyString(); + JSHandle func_handle(factory->NewJSFunction(env, reinterpret_cast(HandlerDeleteProperty))); +- JSObject::SetProperty(thread, JSHandle(handler_handle), func_key, func_handle); ++ JSObject::SetProperty(thread_, JSHandle(handler_handle), func_key, func_handle); + +- JSHandle proxy_handle2 = JSProxy::ProxyCreate(thread, target_handle, handler_handle); ++ JSHandle proxy_handle2 = JSProxy::ProxyCreate(thread_, target_handle, handler_handle); + EXPECT_TRUE(*proxy_handle2 != nullptr); +- PropertyDescriptor desc2(thread, JSHandle(thread, JSTaggedValue(1)), true, true, true); +- EXPECT_TRUE(JSProxy::DefineOwnProperty(thread, proxy_handle2, key, desc2)); +- EXPECT_EQ(JSProxy::GetProperty(thread, proxy_handle2, key).GetValue()->GetInt(), 1); +- EXPECT_FALSE(JSProxy::DeleteProperty(thread, proxy_handle2, key)); ++ PropertyDescriptor desc2(thread_, JSHandle(thread_, JSTaggedValue(1)), true, true, true); ++ EXPECT_TRUE(JSProxy::DefineOwnProperty(thread_, proxy_handle2, key, desc2)); ++ EXPECT_EQ(JSProxy::GetProperty(thread_, proxy_handle2, key).GetValue()->GetInt(), 1); ++ EXPECT_FALSE(JSProxy::DeleteProperty(thread_, proxy_handle2, key)); + } + + JSTaggedValue HandlerGetPrototype([[maybe_unused]] EcmaRuntimeCallInfo *argv) +@@ -305,34 +305,34 @@ JSTaggedValue HandlerGetPrototype([[maybe_unused]] EcmaRuntimeCallInfo *argv) + // ES6 9.5.1 [[GetPrototypeOf]] ( ) + TEST_F(JSProxyTest, GetPrototypeOf) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + // 1. handler has no "GetPrototypeOf" +- JSHandle dynclass(thread, JSObjectTestCreate(thread)); ++ JSHandle dynclass(thread_, JSObjectTestCreate(thread_)); + JSHandle proto(factory->NewJSObjectByConstructor(JSHandle(dynclass), dynclass)); + JSHandle target_handle(factory->NewJSObjectByConstructor(JSHandle(dynclass), dynclass)); + EXPECT_TRUE(target_handle->IsECMAObject()); +- JSObject::SetPrototype(thread, JSHandle(target_handle), proto); ++ JSObject::SetPrototype(thread_, JSHandle(target_handle), proto); + EXPECT_TRUE( +- JSTaggedValue::SameValue(JSHandle(target_handle)->GetPrototype(thread), proto.GetTaggedValue())); ++ JSTaggedValue::SameValue(JSHandle(target_handle)->GetPrototype(thread_), proto.GetTaggedValue())); + + JSHandle handler_handle(factory->NewJSObjectByConstructor(JSHandle(dynclass), dynclass)); + EXPECT_TRUE(handler_handle->IsECMAObject()); + +- JSHandle proxy_handle = JSProxy::ProxyCreate(thread, target_handle, handler_handle); ++ JSHandle proxy_handle = JSProxy::ProxyCreate(thread_, target_handle, handler_handle); + EXPECT_TRUE(*proxy_handle != nullptr); + +- EXPECT_TRUE(JSTaggedValue::SameValue(JSProxy::GetPrototype(thread, proxy_handle), proto.GetTaggedValue())); ++ EXPECT_TRUE(JSTaggedValue::SameValue(JSProxy::GetPrototype(thread_, proxy_handle), proto.GetTaggedValue())); + + // 2. handler has "GetPrototypeOf" +- EcmaVM *vm = thread->GetEcmaVM(); ++ EcmaVM *vm = thread_->GetEcmaVM(); + JSHandle env = vm->GetGlobalEnv(); +- JSHandle func_key = thread->GlobalConstants()->GetHandledGetPrototypeOfString(); ++ JSHandle func_key = thread_->GlobalConstants()->GetHandledGetPrototypeOfString(); + JSHandle func_handle(factory->NewJSFunction(env, reinterpret_cast(HandlerGetPrototype))); +- JSObject::SetProperty(thread, JSHandle(handler_handle), func_key, func_handle); ++ JSObject::SetProperty(thread_, JSHandle(handler_handle), func_key, func_handle); + +- JSHandle proxy_handle2 = JSProxy::ProxyCreate(thread, target_handle, handler_handle); ++ JSHandle proxy_handle2 = JSProxy::ProxyCreate(thread_, target_handle, handler_handle); + EXPECT_TRUE(*proxy_handle2 != nullptr); +- EXPECT_TRUE(JSTaggedValue::SameValue(JSProxy::GetPrototype(thread, proxy_handle2), JSTaggedValue::Null())); ++ EXPECT_TRUE(JSTaggedValue::SameValue(JSProxy::GetPrototype(thread_, proxy_handle2), JSTaggedValue::Null())); + } + + JSTaggedValue HandlerSetPrototype([[maybe_unused]] EcmaRuntimeCallInfo *argv) +@@ -343,9 +343,9 @@ JSTaggedValue HandlerSetPrototype([[maybe_unused]] EcmaRuntimeCallInfo *argv) + // ES6 9.5.2 [[SetPrototypeOf]] (V) + TEST_F(JSProxyTest, SetPrototypeOf) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + // 1. handler has no "SetPrototypeOf" +- JSHandle dynclass(thread, JSObjectTestCreate(thread)); ++ JSHandle dynclass(thread_, JSObjectTestCreate(thread_)); + JSHandle proto(factory->NewJSObjectByConstructor(JSHandle(dynclass), dynclass)); + JSHandle target_handle(factory->NewJSObjectByConstructor(JSHandle(dynclass), dynclass)); + EXPECT_TRUE(target_handle->IsECMAObject()); +@@ -353,23 +353,23 @@ TEST_F(JSProxyTest, SetPrototypeOf) + JSHandle handler_handle(factory->NewJSObjectByConstructor(JSHandle(dynclass), dynclass)); + EXPECT_TRUE(handler_handle->IsECMAObject()); + +- JSHandle proxy_handle = JSProxy::ProxyCreate(thread, target_handle, handler_handle); ++ JSHandle proxy_handle = JSProxy::ProxyCreate(thread_, target_handle, handler_handle); + EXPECT_TRUE(*proxy_handle != nullptr); + +- JSProxy::SetPrototype(thread, proxy_handle, proto); ++ JSProxy::SetPrototype(thread_, proxy_handle, proto); + EXPECT_TRUE( +- JSTaggedValue::SameValue(JSHandle(target_handle)->GetPrototype(thread), proto.GetTaggedValue())); ++ JSTaggedValue::SameValue(JSHandle(target_handle)->GetPrototype(thread_), proto.GetTaggedValue())); + + // 2. handler has "SetPrototypeOf" +- EcmaVM *vm = thread->GetEcmaVM(); ++ EcmaVM *vm = thread_->GetEcmaVM(); + JSHandle env = vm->GetGlobalEnv(); +- JSHandle func_key = thread->GlobalConstants()->GetHandledSetPrototypeOfString(); ++ JSHandle func_key = thread_->GlobalConstants()->GetHandledSetPrototypeOfString(); + JSHandle func_handle(factory->NewJSFunction(env, reinterpret_cast(HandlerSetPrototype))); +- JSObject::SetProperty(thread, JSHandle(handler_handle), func_key, func_handle); ++ JSObject::SetProperty(thread_, JSHandle(handler_handle), func_key, func_handle); + +- JSHandle proxy_handle2 = JSProxy::ProxyCreate(thread, target_handle, handler_handle); ++ JSHandle proxy_handle2 = JSProxy::ProxyCreate(thread_, target_handle, handler_handle); + EXPECT_TRUE(*proxy_handle2 != nullptr); +- EXPECT_FALSE(JSProxy::SetPrototype(thread, proxy_handle2, proto)); ++ EXPECT_FALSE(JSProxy::SetPrototype(thread_, proxy_handle2, proto)); + } + + JSTaggedValue HandlerIsExtensible([[maybe_unused]] EcmaRuntimeCallInfo *argv) +@@ -380,32 +380,32 @@ JSTaggedValue HandlerIsExtensible([[maybe_unused]] EcmaRuntimeCallInfo *argv) + // ES6 9.5.3 [[IsExtensible]] ( ) + TEST_F(JSProxyTest, IsExtensible) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + // 1. handler has no "IsExtensible" +- JSHandle dynclass(thread, JSObjectTestCreate(thread)); ++ JSHandle dynclass(thread_, JSObjectTestCreate(thread_)); + JSHandle target_handle(factory->NewJSObjectByConstructor(JSHandle(dynclass), dynclass)); + EXPECT_TRUE(target_handle->IsECMAObject()); + + JSHandle handler_handle(factory->NewJSObjectByConstructor(JSHandle(dynclass), dynclass)); + EXPECT_TRUE(handler_handle->IsECMAObject()); + +- JSHandle proxy_handle = JSProxy::ProxyCreate(thread, target_handle, handler_handle); ++ JSHandle proxy_handle = JSProxy::ProxyCreate(thread_, target_handle, handler_handle); + EXPECT_TRUE(*proxy_handle != nullptr); + +- bool status1 = JSProxy::IsExtensible(thread, proxy_handle); ++ bool status1 = JSProxy::IsExtensible(thread_, proxy_handle); + bool status2 = JSHandle::Cast(target_handle)->IsExtensible(); + EXPECT_TRUE(status1 == status2); + + // 2. handler has "IsExtensible" +- EcmaVM *vm = thread->GetEcmaVM(); ++ EcmaVM *vm = thread_->GetEcmaVM(); + JSHandle env = vm->GetGlobalEnv(); +- JSHandle func_key = thread->GlobalConstants()->GetHandledIsExtensibleString(); ++ JSHandle func_key = thread_->GlobalConstants()->GetHandledIsExtensibleString(); + JSHandle func_handle(factory->NewJSFunction(env, reinterpret_cast(HandlerIsExtensible))); +- JSObject::SetProperty(thread, JSHandle(handler_handle), func_key, func_handle); ++ JSObject::SetProperty(thread_, JSHandle(handler_handle), func_key, func_handle); + +- JSHandle proxy_handle2 = JSProxy::ProxyCreate(thread, target_handle, handler_handle); ++ JSHandle proxy_handle2 = JSProxy::ProxyCreate(thread_, target_handle, handler_handle); + EXPECT_TRUE(*proxy_handle2 != nullptr); +- EXPECT_FALSE(JSProxy::IsExtensible(thread, proxy_handle2)); ++ EXPECT_FALSE(JSProxy::IsExtensible(thread_, proxy_handle2)); + } + + JSTaggedValue HandlerPreventExtensions([[maybe_unused]] EcmaRuntimeCallInfo *argv) +@@ -416,34 +416,34 @@ JSTaggedValue HandlerPreventExtensions([[maybe_unused]] EcmaRuntimeCallInfo *arg + // ES6 9.5.4 [[PreventExtensions]] ( ) + TEST_F(JSProxyTest, PreventExtensions) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + // 1. handler has no "PreventExtensions" +- JSHandle dynclass(thread, JSObjectTestCreate(thread)); ++ JSHandle dynclass(thread_, JSObjectTestCreate(thread_)); + JSHandle target_handle(factory->NewJSObjectByConstructor(JSHandle(dynclass), dynclass)); + EXPECT_TRUE(target_handle->IsECMAObject()); + + JSHandle handler_handle(factory->NewJSObjectByConstructor(JSHandle(dynclass), dynclass)); + EXPECT_TRUE(handler_handle->IsECMAObject()); + +- JSHandle proxy_handle = JSProxy::ProxyCreate(thread, target_handle, handler_handle); ++ JSHandle proxy_handle = JSProxy::ProxyCreate(thread_, target_handle, handler_handle); + EXPECT_TRUE(*proxy_handle != nullptr); + +- bool status1 = JSProxy::PreventExtensions(thread, proxy_handle); ++ bool status1 = JSProxy::PreventExtensions(thread_, proxy_handle); + EXPECT_TRUE(status1); + bool status2 = JSHandle::Cast(target_handle)->IsExtensible(); + EXPECT_FALSE(status2); + + // 2. handler has "PreventExtensions" +- EcmaVM *vm = thread->GetEcmaVM(); ++ EcmaVM *vm = thread_->GetEcmaVM(); + JSHandle env = vm->GetGlobalEnv(); +- JSHandle func_key = thread->GlobalConstants()->GetHandledPreventExtensionsString(); ++ JSHandle func_key = thread_->GlobalConstants()->GetHandledPreventExtensionsString(); + JSHandle func_handle( + factory->NewJSFunction(env, reinterpret_cast(HandlerPreventExtensions))); +- JSObject::SetProperty(thread, JSHandle(handler_handle), func_key, func_handle); ++ JSObject::SetProperty(thread_, JSHandle(handler_handle), func_key, func_handle); + +- JSHandle proxy_handle2 = JSProxy::ProxyCreate(thread, target_handle, handler_handle); ++ JSHandle proxy_handle2 = JSProxy::ProxyCreate(thread_, target_handle, handler_handle); + EXPECT_TRUE(*proxy_handle2 != nullptr); +- EXPECT_FALSE(JSProxy::PreventExtensions(thread, proxy_handle2)); ++ EXPECT_FALSE(JSProxy::PreventExtensions(thread_, proxy_handle2)); + } + + JSTaggedValue HandlerHasProperty([[maybe_unused]] EcmaRuntimeCallInfo *argv) +@@ -454,34 +454,34 @@ JSTaggedValue HandlerHasProperty([[maybe_unused]] EcmaRuntimeCallInfo *argv) + // ES6 9.5.7 [[HasProperty]] (P) + TEST_F(JSProxyTest, HasProperty) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + // 1. handler has no "HasProperty" +- JSHandle dynclass(thread, JSObjectTestCreate(thread)); ++ JSHandle dynclass(thread_, JSObjectTestCreate(thread_)); + JSHandle target_handle(factory->NewJSObjectByConstructor(JSHandle(dynclass), dynclass)); + EXPECT_TRUE(target_handle->IsECMAObject()); + + JSHandle key(factory->NewFromString("x")); +- PropertyDescriptor desc(thread, JSHandle(thread, JSTaggedValue(1))); +- JSObject::DefineOwnProperty(thread, JSHandle::Cast(target_handle), key, desc); ++ PropertyDescriptor desc(thread_, JSHandle(thread_, JSTaggedValue(1))); ++ JSObject::DefineOwnProperty(thread_, JSHandle::Cast(target_handle), key, desc); + + JSHandle handler_handle(factory->NewJSObjectByConstructor(JSHandle(dynclass), dynclass)); + EXPECT_TRUE(handler_handle->IsECMAObject()); + +- JSHandle proxy_handle = JSProxy::ProxyCreate(thread, target_handle, handler_handle); ++ JSHandle proxy_handle = JSProxy::ProxyCreate(thread_, target_handle, handler_handle); + EXPECT_TRUE(*proxy_handle != nullptr); + +- EXPECT_TRUE(JSProxy::HasProperty(thread, proxy_handle, key)); ++ EXPECT_TRUE(JSProxy::HasProperty(thread_, proxy_handle, key)); + + // 2. handler has "HasProperty" +- EcmaVM *vm = thread->GetEcmaVM(); ++ EcmaVM *vm = thread_->GetEcmaVM(); + JSHandle env = vm->GetGlobalEnv(); +- JSHandle func_key = thread->GlobalConstants()->GetHandledHasString(); ++ JSHandle func_key = thread_->GlobalConstants()->GetHandledHasString(); + JSHandle func_handle(factory->NewJSFunction(env, reinterpret_cast(HandlerHasProperty))); +- JSObject::SetProperty(thread, JSHandle(handler_handle), func_key, func_handle); ++ JSObject::SetProperty(thread_, JSHandle(handler_handle), func_key, func_handle); + +- JSHandle proxy_handle2 = JSProxy::ProxyCreate(thread, target_handle, handler_handle); ++ JSHandle proxy_handle2 = JSProxy::ProxyCreate(thread_, target_handle, handler_handle); + EXPECT_TRUE(*proxy_handle2 != nullptr); +- EXPECT_FALSE(JSProxy::HasProperty(thread, proxy_handle2, key)); ++ EXPECT_FALSE(JSProxy::HasProperty(thread_, proxy_handle2, key)); + } + + JSTaggedValue HandlerOwnPropertyKeys([[maybe_unused]] EcmaRuntimeCallInfo *argv) +@@ -495,22 +495,22 @@ JSTaggedValue HandlerOwnPropertyKeys([[maybe_unused]] EcmaRuntimeCallInfo *argv) + // ES6 9.5.12 [[OwnPropertyKeys]] () + TEST_F(JSProxyTest, OwnPropertyKeys) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + // 1. handler has no "OwnPropertyKeys" +- JSHandle dynclass(thread, JSObjectTestCreate(thread)); ++ JSHandle dynclass(thread_, JSObjectTestCreate(thread_)); + JSHandle target_handle(factory->NewJSObjectByConstructor(JSHandle(dynclass), dynclass)); + EXPECT_TRUE(target_handle->IsECMAObject()); + + JSHandle key(factory->NewFromString("x")); +- PropertyDescriptor desc(thread, JSHandle(thread, JSTaggedValue(1))); +- JSObject::DefineOwnProperty(thread, JSHandle::Cast(target_handle), key, desc); ++ PropertyDescriptor desc(thread_, JSHandle(thread_, JSTaggedValue(1))); ++ JSObject::DefineOwnProperty(thread_, JSHandle::Cast(target_handle), key, desc); + + JSHandle handler_handle(factory->NewJSObjectByConstructor(JSHandle(dynclass), dynclass)); + EXPECT_TRUE(handler_handle->IsECMAObject()); + +- JSHandle proxy_handle = JSProxy::ProxyCreate(thread, target_handle, handler_handle); ++ JSHandle proxy_handle = JSProxy::ProxyCreate(thread_, target_handle, handler_handle); + EXPECT_TRUE(*proxy_handle != nullptr); +- JSHandle res = JSProxy::OwnPropertyKeys(thread, proxy_handle); ++ JSHandle res = JSProxy::OwnPropertyKeys(thread_, proxy_handle); + + EXPECT_TRUE(JSTaggedValue::SameValue(res->Get(0), key.GetTaggedValue())); + +@@ -518,15 +518,15 @@ TEST_F(JSProxyTest, OwnPropertyKeys) + // create new empty target so we wont throw TypeError at (18. - 21.) + JSHandle target_handle2(factory->NewJSObjectByConstructor(JSHandle(dynclass), dynclass)); + EXPECT_TRUE(target_handle2->IsECMAObject()); +- EcmaVM *vm = thread->GetEcmaVM(); ++ EcmaVM *vm = thread_->GetEcmaVM(); + JSHandle env = vm->GetGlobalEnv(); +- JSHandle func_key = thread->GlobalConstants()->GetHandledOwnKeysString(); ++ JSHandle func_key = thread_->GlobalConstants()->GetHandledOwnKeysString(); + JSHandle func_handle(factory->NewJSFunction(env, reinterpret_cast(HandlerOwnPropertyKeys))); +- JSObject::SetProperty(thread, JSHandle(handler_handle), func_key, func_handle); ++ JSObject::SetProperty(thread_, JSHandle(handler_handle), func_key, func_handle); + +- JSHandle proxy_handle2 = JSProxy::ProxyCreate(thread, target_handle2, handler_handle); ++ JSHandle proxy_handle2 = JSProxy::ProxyCreate(thread_, target_handle2, handler_handle); + EXPECT_TRUE(*proxy_handle2 != nullptr); +- JSHandle res2 = JSProxy::OwnPropertyKeys(thread, proxy_handle2); ++ JSHandle res2 = JSProxy::OwnPropertyKeys(thread_, proxy_handle2); + EXPECT_TRUE(res2->GetLength() == 0 || !JSTaggedValue::SameValue(res2->Get(0), key.GetTaggedValue())); + } + +@@ -542,34 +542,34 @@ JSTaggedValue HandlerFunction([[maybe_unused]] EcmaRuntimeCallInfo *argv) + // ES6 9.5.13 [[Call]] (thisArgument, argumentsList) + TEST_F(JSProxyTest, Call) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); +- JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); ++ JSHandle env = thread_->GetEcmaVM()->GetGlobalEnv(); + // 1. handler has no "Call" +- JSHandle dynclass(thread, JSObjectTestCreate(thread)); ++ JSHandle dynclass(thread_, JSObjectTestCreate(thread_)); + JSHandle targetHandle(factory->NewJSFunction(env, reinterpret_cast(HandlerFunction))); + EXPECT_TRUE(targetHandle->IsECMAObject()); + + JSHandle handlerHandle(factory->NewJSObjectByConstructor(JSHandle(dynclass), dynclass)); + EXPECT_TRUE(handlerHandle->IsECMAObject()); + +- JSHandle proxyHandle = JSProxy::ProxyCreate(thread, targetHandle, handlerHandle); ++ JSHandle proxyHandle = JSProxy::ProxyCreate(thread_, targetHandle, handlerHandle); + EXPECT_TRUE(*proxyHandle != nullptr); + JSTaggedValue res = +- JSProxy::CallInternal(thread, proxyHandle, JSHandle::Cast(proxyHandle), 0, nullptr); +- JSHandle taggedRes(thread, res); ++ JSProxy::CallInternal(thread_, proxyHandle, JSHandle::Cast(proxyHandle), 0, nullptr); ++ JSHandle taggedRes(thread_, res); + + EXPECT_TRUE(JSTaggedValue::SameValue(taggedRes.GetTaggedValue(), JSTaggedValue::True())); + + // 2. handler has "Call" +- JSHandle funcKey = thread->GlobalConstants()->GetHandledApplyString(); ++ JSHandle funcKey = thread_->GlobalConstants()->GetHandledApplyString(); + JSHandle funcHandle(factory->NewJSFunction(env, reinterpret_cast(HandlerCall))); +- JSObject::SetProperty(thread, JSHandle(handlerHandle), funcKey, funcHandle); ++ JSObject::SetProperty(thread_, JSHandle(handlerHandle), funcKey, funcHandle); + +- JSHandle proxyHandle2 = JSProxy::ProxyCreate(thread, targetHandle, handlerHandle); ++ JSHandle proxyHandle2 = JSProxy::ProxyCreate(thread_, targetHandle, handlerHandle); + EXPECT_TRUE(*proxyHandle2 != nullptr); + JSTaggedValue res2 = +- JSProxy::CallInternal(thread, proxyHandle2, JSHandle::Cast(proxyHandle2), 0, nullptr); +- JSHandle taggedRes2(thread, res2); ++ JSProxy::CallInternal(thread_, proxyHandle2, JSHandle::Cast(proxyHandle2), 0, nullptr); ++ JSHandle taggedRes2(thread_, res2); + + EXPECT_TRUE(JSTaggedValue::SameValue(taggedRes2.GetTaggedValue(), JSTaggedValue::False())); + } +@@ -602,10 +602,10 @@ JSTaggedValue HandlerConFunc([[maybe_unused]] EcmaRuntimeCallInfo *argv) + // ES6 9.5.14 [[Construct]] ( argumentsList, newTarget) + TEST_F(JSProxyTest, Construct) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); +- JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); ++ JSHandle env = thread_->GetEcmaVM()->GetGlobalEnv(); + // 1. handler has no "Construct" +- JSHandle dynclass(thread, JSObjectTestCreate(thread)); ++ JSHandle dynclass(thread_, JSObjectTestCreate(thread_)); + JSHandle targetHandle(factory->NewJSFunction(env, reinterpret_cast(HandlerConFunc))); + JSHandle::Cast(targetHandle)->GetJSHClass()->SetConstructor(true); + EXPECT_TRUE(targetHandle->IsECMAObject()); +@@ -613,22 +613,22 @@ TEST_F(JSProxyTest, Construct) + JSHandle handlerHandle(factory->NewJSObjectByConstructor(JSHandle(dynclass), dynclass)); + EXPECT_TRUE(handlerHandle->IsECMAObject()); + +- JSHandle proxyHandle = JSProxy::ProxyCreate(thread, targetHandle, handlerHandle); ++ JSHandle proxyHandle = JSProxy::ProxyCreate(thread_, targetHandle, handlerHandle); + EXPECT_TRUE(*proxyHandle != nullptr); +- JSTaggedValue res = JSProxy::ConstructInternal(thread, proxyHandle, 0, nullptr, targetHandle); +- JSHandle taggedRes(thread, res); ++ JSTaggedValue res = JSProxy::ConstructInternal(thread_, proxyHandle, 0, nullptr, targetHandle); ++ JSHandle taggedRes(thread_, res); + JSHandle key(factory->NewFromCanBeCompressString("x")); +- EXPECT_EQ(JSObject::GetProperty(thread, taggedRes, key).GetValue()->GetInt(), 1); ++ EXPECT_EQ(JSObject::GetProperty(thread_, taggedRes, key).GetValue()->GetInt(), 1); + + // 2. handler has "Construct" +- JSHandle funcKey = thread->GlobalConstants()->GetHandledProxyConstructString(); ++ JSHandle funcKey = thread_->GlobalConstants()->GetHandledProxyConstructString(); + JSHandle funcHandle(factory->NewJSFunction(env, reinterpret_cast(HandlerConstruct))); +- JSObject::SetProperty(thread, JSHandle(handlerHandle), funcKey, funcHandle); ++ JSObject::SetProperty(thread_, JSHandle(handlerHandle), funcKey, funcHandle); + +- JSHandle proxyHandle2 = JSProxy::ProxyCreate(thread, targetHandle, handlerHandle); ++ JSHandle proxyHandle2 = JSProxy::ProxyCreate(thread_, targetHandle, handlerHandle); + EXPECT_TRUE(*proxyHandle2 != nullptr); +- JSTaggedValue res2 = JSProxy::ConstructInternal(thread, proxyHandle2, 0, nullptr, targetHandle); +- JSHandle taggedRes2(thread, res2); +- EXPECT_EQ(JSObject::GetProperty(thread, taggedRes2, key).GetValue()->GetInt(), 2); ++ JSTaggedValue res2 = JSProxy::ConstructInternal(thread_, proxyHandle2, 0, nullptr, targetHandle); ++ JSHandle taggedRes2(thread_, res2); ++ EXPECT_EQ(JSObject::GetProperty(thread_, taggedRes2, key).GetValue()->GetInt(), 2); + } + } // namespace panda::test +diff --git a/tests/runtime/common/js_set_iterator_test.cpp b/tests/runtime/common/js_set_iterator_test.cpp +index 035d742..42198e0 100644 +--- a/tests/runtime/common/js_set_iterator_test.cpp ++++ b/tests/runtime/common/js_set_iterator_test.cpp +@@ -37,16 +37,16 @@ public: + + void SetUp() override + { +- TestHelper::CreateEcmaVMWithScope(instance, thread, scope); ++ TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); + } + + void TearDown() override + { +- TestHelper::DestroyEcmaVMWithScope(instance, scope); ++ TestHelper::DestroyEcmaVMWithScope(instance_, scope_); + } +- ecmascript::EcmaHandleScope *scope {nullptr}; +- PandaVM *instance {nullptr}; +- JSThread *thread {nullptr}; ++ ecmascript::EcmaHandleScope *scope_ {nullptr}; ++ PandaVM *instance_ {nullptr}; ++ JSThread *thread_ {nullptr}; + }; + + JSSet *CreateSet(JSThread *thread) +@@ -71,11 +71,11 @@ JSSet *CreateSet(JSThread *thread) + */ + TEST_F(JSSetIteratorTest, CreateSetIterator) + { +- JSHandle jsSet(thread, CreateSet(thread)); ++ JSHandle jsSet(thread_, CreateSet(thread_)); + EXPECT_TRUE(*jsSet != nullptr); + + JSHandle setIteratorValue1 = +- JSSetIterator::CreateSetIterator(thread, JSHandle(jsSet), IterationKind::KEY); ++ JSSetIterator::CreateSetIterator(thread_, JSHandle(jsSet), IterationKind::KEY); + + EXPECT_EQ(setIteratorValue1->IsJSSetIterator(), true); + JSHandle setIterator1(setIteratorValue1); +@@ -86,7 +86,7 @@ TEST_F(JSSetIteratorTest, CreateSetIterator) + EXPECT_EQ(JSTaggedValue::SameValue(iterationKind1, JSTaggedValue(static_cast(IterationKind::KEY))), true); + + JSHandle setIteratorValue2 = +- JSSetIterator::CreateSetIterator(thread, JSHandle(jsSet), IterationKind::VALUE); ++ JSSetIterator::CreateSetIterator(thread_, JSHandle(jsSet), IterationKind::VALUE); + + EXPECT_EQ(setIteratorValue2->IsJSSetIterator(), true); + JSHandle setIterator2(setIteratorValue2); +@@ -106,44 +106,44 @@ TEST_F(JSSetIteratorTest, CreateSetIterator) + */ + TEST_F(JSSetIteratorTest, Next) + { +- JSHandle jsSet(thread, CreateSet(thread)); ++ JSHandle jsSet(thread_, CreateSet(thread_)); + EXPECT_TRUE(*jsSet != nullptr); + + for (int i = 0; i < 3; i++) { +- JSHandle key(thread, JSTaggedValue(i)); +- JSSet::Add(thread, jsSet, key); ++ JSHandle key(thread_, JSTaggedValue(i)); ++ JSSet::Add(thread_, jsSet, key); + } + + // set IterationKind(key or value) + JSHandle setIteratorValue = +- JSSetIterator::CreateSetIterator(thread, JSHandle(jsSet), IterationKind::KEY); ++ JSSetIterator::CreateSetIterator(thread_, JSHandle(jsSet), IterationKind::KEY); + JSHandle setIterator(setIteratorValue); + +- auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); ++ auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); + ecmaRuntimeCallInfo->SetThis(setIteratorValue.GetTaggedValue()); + ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue::Undefined()); +- [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); ++ [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); + + JSTaggedValue result1 = JSSetIterator::Next(ecmaRuntimeCallInfo.get()); + EXPECT_EQ(setIterator->GetNextIndex().GetInt(), 1); +- JSHandle resultObj1(thread, result1); +- EXPECT_EQ(0, JSIterator::IteratorValue(thread, resultObj1)->GetInt()); ++ JSHandle resultObj1(thread_, result1); ++ EXPECT_EQ(0, JSIterator::IteratorValue(thread_, resultObj1)->GetInt()); + + JSTaggedValue result2 = JSSetIterator::Next(ecmaRuntimeCallInfo.get()); + EXPECT_EQ(setIterator->GetNextIndex().GetInt(), 2); +- JSHandle resultObj2(thread, result2); +- EXPECT_EQ(1, JSIterator::IteratorValue(thread, resultObj2)->GetInt()); ++ JSHandle resultObj2(thread_, result2); ++ EXPECT_EQ(1, JSIterator::IteratorValue(thread_, resultObj2)->GetInt()); + + JSTaggedValue result3 = JSSetIterator::Next(ecmaRuntimeCallInfo.get()); + EXPECT_EQ(setIterator->GetNextIndex().GetInt(), 3); +- JSHandle resultObj3(thread, result3); +- EXPECT_EQ(2, JSIterator::IteratorValue(thread, resultObj3)->GetInt()); ++ JSHandle resultObj3(thread_, result3); ++ EXPECT_EQ(2, JSIterator::IteratorValue(thread_, resultObj3)->GetInt()); + + JSTaggedValue result4 = JSSetIterator::Next(ecmaRuntimeCallInfo.get()); +- JSHandle resultObj4(thread, result4); +- EXPECT_EQ(JSIterator::IteratorValue(thread, resultObj4).GetTaggedValue(), JSTaggedValue::Undefined()); ++ JSHandle resultObj4(thread_, result4); ++ EXPECT_EQ(JSIterator::IteratorValue(thread_, resultObj4).GetTaggedValue(), JSTaggedValue::Undefined()); + +- TestHelper::TearDownFrame(thread, prev); ++ TestHelper::TearDownFrame(thread_, prev); + } + } // namespace panda::test +diff --git a/tests/runtime/common/js_set_test.cpp b/tests/runtime/common/js_set_test.cpp +index b30d191..de3b26e 100644 +--- a/tests/runtime/common/js_set_test.cpp ++++ b/tests/runtime/common/js_set_test.cpp +@@ -42,29 +42,29 @@ class JSSetTest : public testing::Test { + public: + void SetUp() override + { +- TestHelper::CreateEcmaVMWithScope(instance, thread, scope); ++ TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); + } + + void TearDown() override + { +- TestHelper::DestroyEcmaVMWithScope(instance, scope); ++ TestHelper::DestroyEcmaVMWithScope(instance_, scope_); + } + +- PandaVM *instance {nullptr}; +- EcmaHandleScope *scope {nullptr}; +- JSThread *thread; ++ PandaVM *instance_ {nullptr}; ++ EcmaHandleScope *scope_ {nullptr}; ++ JSThread *thread_; + + protected: + JSSet *CreateSet() + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); +- JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); ++ JSHandle env = thread_->GetEcmaVM()->GetGlobalEnv(); + + JSHandle constructor = env->GetBuiltinsSetFunction(); + JSHandle set = + JSHandle::Cast(factory->NewJSObjectByConstructor(JSHandle(constructor), constructor)); +- JSHandle hashSet = LinkedHashSet::Create(thread); +- set->SetLinkedSet(thread, hashSet); ++ JSHandle hashSet = LinkedHashSet::Create(thread_); ++ set->SetLinkedSet(thread_, hashSet); + return JSSet::Cast(set.GetTaggedValue().GetTaggedObject()); + } + }; +@@ -77,29 +77,29 @@ TEST_F(JSSetTest, SetCreate) + + TEST_F(JSSetTest, AddAndHas) + { +- ObjectFactory *factory_ = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory_ = thread_->GetEcmaVM()->GetFactory(); + // create js_set +- JSHandle set(thread, CreateSet()); ++ JSHandle set(thread_, CreateSet()); + + // + JSHandle key(factory_->NewFromString("key")); +- JSSet::Add(thread, set, key); ++ JSSet::Add(thread_, set, key); + int hash = LinkedHash::Hash(key.GetTaggedValue()); + EXPECT_TRUE(set->Has(key.GetTaggedValue(), hash)); + } + + TEST_F(JSSetTest, DeleteAndGet) + { +- ObjectFactory *factory_ = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory_ = thread_->GetEcmaVM()->GetFactory(); + // create js_set +- JSHandle set(thread, CreateSet()); ++ JSHandle set(thread_, CreateSet()); + + // add 40 keys + char key_array[] = "key0"; + for (int i = 0; i < 40; i++) { + key_array[3] = '1' + i; + JSHandle key(factory_->NewFromString(key_array)); +- JSSet::Add(thread, set, key); ++ JSSet::Add(thread_, set, key); + int hash = LinkedHash::Hash(key.GetTaggedValue()); + EXPECT_TRUE(set->Has(key.GetTaggedValue(), hash)); + } +@@ -107,7 +107,7 @@ TEST_F(JSSetTest, DeleteAndGet) + // whether js_set has delete key + key_array[3] = '1' + 8; + JSHandle delete_key(factory_->NewFromString(key_array)); +- JSSet::Delete(thread, set, delete_key); ++ JSSet::Delete(thread_, set, delete_key); + int hash = LinkedHash::Hash(delete_key.GetTaggedValue()); + EXPECT_FALSE(set->Has(delete_key.GetTaggedValue(), hash)); + EXPECT_EQ(set->GetSize(), 39); +@@ -115,39 +115,39 @@ TEST_F(JSSetTest, DeleteAndGet) + + TEST_F(JSSetTest, Iterator) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); +- JSHandle set(thread, CreateSet()); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); ++ JSHandle set(thread_, CreateSet()); + for (int i = 0; i < 5; i++) { +- JSHandle key(thread, JSTaggedValue(i)); +- JSSet::Add(thread, set, key); ++ JSHandle key(thread_, JSTaggedValue(i)); ++ JSSet::Add(thread_, set, key); + } + + JSHandle key_iter(factory->NewJSSetIterator(set, IterationKind::KEY)); + JSHandle value_iter(factory->NewJSSetIterator(set, IterationKind::VALUE)); + +- JSHandle key_result0 = JSIterator::IteratorStep(thread, key_iter); +- JSHandle value_result0 = JSIterator::IteratorStep(thread, value_iter); ++ JSHandle key_result0 = JSIterator::IteratorStep(thread_, key_iter); ++ JSHandle value_result0 = JSIterator::IteratorStep(thread_, value_iter); + +- EXPECT_EQ(0, JSIterator::IteratorValue(thread, key_result0)->GetInt()); +- EXPECT_EQ(0, JSIterator::IteratorValue(thread, value_result0)->GetInt()); ++ EXPECT_EQ(0, JSIterator::IteratorValue(thread_, key_result0)->GetInt()); ++ EXPECT_EQ(0, JSIterator::IteratorValue(thread_, value_result0)->GetInt()); + +- JSHandle key_result1 = JSIterator::IteratorStep(thread, key_iter); +- EXPECT_EQ(1, JSIterator::IteratorValue(thread, key_result1)->GetInt()); ++ JSHandle key_result1 = JSIterator::IteratorStep(thread_, key_iter); ++ EXPECT_EQ(1, JSIterator::IteratorValue(thread_, key_result1)->GetInt()); + + for (int i = 0; i < 3; i++) { +- JSHandle key(thread, JSTaggedValue(i)); +- JSSet::Delete(thread, set, key); ++ JSHandle key(thread_, JSTaggedValue(i)); ++ JSSet::Delete(thread_, set, key); + } + +- JSHandle key_result2 = JSIterator::IteratorStep(thread, key_iter); +- EXPECT_EQ(3, JSIterator::IteratorValue(thread, key_result2)->GetInt()); +- JSHandle key_result3 = JSIterator::IteratorStep(thread, key_iter); +- EXPECT_EQ(4, JSIterator::IteratorValue(thread, key_result3)->GetInt()); +- JSHandle key(thread, JSTaggedValue(5)); +- JSSet::Add(thread, set, key); +- JSHandle key_result4 = JSIterator::IteratorStep(thread, key_iter); +- EXPECT_EQ(5, JSIterator::IteratorValue(thread, key_result4)->GetInt()); +- JSHandle key_result5 = JSIterator::IteratorStep(thread, key_iter); ++ JSHandle key_result2 = JSIterator::IteratorStep(thread_, key_iter); ++ EXPECT_EQ(3, JSIterator::IteratorValue(thread_, key_result2)->GetInt()); ++ JSHandle key_result3 = JSIterator::IteratorStep(thread_, key_iter); ++ EXPECT_EQ(4, JSIterator::IteratorValue(thread_, key_result3)->GetInt()); ++ JSHandle key(thread_, JSTaggedValue(5)); ++ JSSet::Add(thread_, set, key); ++ JSHandle key_result4 = JSIterator::IteratorStep(thread_, key_iter); ++ EXPECT_EQ(5, JSIterator::IteratorValue(thread_, key_result4)->GetInt()); ++ JSHandle key_result5 = JSIterator::IteratorStep(thread_, key_iter); + EXPECT_EQ(JSTaggedValue::False(), key_result5.GetTaggedValue()); + } + +diff --git a/tests/runtime/common/js_symbol_test.cpp b/tests/runtime/common/js_symbol_test.cpp +index 40c2819..01b6296 100644 +--- a/tests/runtime/common/js_symbol_test.cpp ++++ b/tests/runtime/common/js_symbol_test.cpp +@@ -38,17 +38,17 @@ class JSSymbolTest : public testing::Test { + public: + void SetUp() override + { +- TestHelper::CreateEcmaVMWithScope(instance, thread, scope); ++ TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); + } + + void TearDown() override + { +- TestHelper::DestroyEcmaVMWithScope(instance, scope); ++ TestHelper::DestroyEcmaVMWithScope(instance_, scope_); + } + +- PandaVM *instance {nullptr}; +- ecmascript::EcmaHandleScope *scope {nullptr}; +- JSThread *thread; ++ PandaVM *instance_ {nullptr}; ++ ecmascript::EcmaHandleScope *scope_ {nullptr}; ++ JSThread *thread_; + }; + + } // namespace panda::test +diff --git a/tests/runtime/common/js_tagged_queue_test.cpp b/tests/runtime/common/js_tagged_queue_test.cpp +index b50a1c8..ac61421 100644 +--- a/tests/runtime/common/js_tagged_queue_test.cpp ++++ b/tests/runtime/common/js_tagged_queue_test.cpp +@@ -33,22 +33,22 @@ class JSTaggedQueueTest : public testing::Test { + public: + void SetUp() override + { +- TestHelper::CreateEcmaVMWithScope(instance, thread, scope); ++ TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); + } + + void TearDown() override + { +- TestHelper::DestroyEcmaVMWithScope(instance, scope); ++ TestHelper::DestroyEcmaVMWithScope(instance_, scope_); + } + +- PandaVM *instance {nullptr}; +- ecmascript::EcmaHandleScope *scope {nullptr}; +- JSThread *thread; ++ PandaVM *instance_ {nullptr}; ++ ecmascript::EcmaHandleScope *scope_ {nullptr}; ++ JSThread *thread_; + }; + + TEST_F(JSTaggedQueueTest, Create) + { +- JSHandle queue = thread->GetEcmaVM()->GetFactory()->NewTaggedQueue(0); ++ JSHandle queue = thread_->GetEcmaVM()->GetFactory()->NewTaggedQueue(0); + EXPECT_TRUE(*queue != nullptr); + EXPECT_TRUE(queue->Empty()); + EXPECT_TRUE(queue->Size() == 0); +@@ -58,50 +58,50 @@ TEST_F(JSTaggedQueueTest, Create) + + TEST_F(JSTaggedQueueTest, PopAndPush) + { +- JSHandle queue = thread->GetEcmaVM()->GetFactory()->NewTaggedQueue(0); ++ JSHandle queue = thread_->GetEcmaVM()->GetFactory()->NewTaggedQueue(0); + EXPECT_TRUE(queue->Empty()); + +- JSHandle queue2(thread, +- TaggedQueue::Push(thread, queue, JSHandle(thread, JSTaggedValue(0)))); ++ JSHandle queue2(thread_, ++ TaggedQueue::Push(thread_, queue, JSHandle(thread_, JSTaggedValue(0)))); + EXPECT_FALSE(queue2->Empty()); + EXPECT_EQ(queue2->Size(), 1); + EXPECT_EQ(queue2->Front(), JSTaggedValue(0)); + EXPECT_EQ(queue2->Back(), JSTaggedValue(0)); + +- JSHandle queue3(thread, +- TaggedQueue::Push(thread, queue2, JSHandle(thread, JSTaggedValue(1)))); ++ JSHandle queue3( ++ thread_, TaggedQueue::Push(thread_, queue2, JSHandle(thread_, JSTaggedValue(1)))); + EXPECT_EQ(queue3->Size(), 2); + EXPECT_EQ(queue3->Front(), JSTaggedValue(0)); + EXPECT_EQ(queue3->Back(), JSTaggedValue(1)); + EXPECT_NE(queue3.GetTaggedValue(), queue2.GetTaggedValue()); + +- JSHandle queue4(thread, +- TaggedQueue::Push(thread, queue3, JSHandle(thread, JSTaggedValue(2)))); ++ JSHandle queue4( ++ thread_, TaggedQueue::Push(thread_, queue3, JSHandle(thread_, JSTaggedValue(2)))); + EXPECT_EQ(queue4->Size(), 3); + EXPECT_EQ(queue4->Front(), JSTaggedValue(0)); + EXPECT_EQ(queue4->Back(), JSTaggedValue(2)); + EXPECT_NE(queue4.GetTaggedValue(), queue3.GetTaggedValue()); + +- JSHandle queue5(thread, +- TaggedQueue::Push(thread, queue4, JSHandle(thread, JSTaggedValue(3)))); ++ JSHandle queue5( ++ thread_, TaggedQueue::Push(thread_, queue4, JSHandle(thread_, JSTaggedValue(3)))); + EXPECT_EQ(queue5->Size(), 4); + EXPECT_EQ(queue5->Front(), JSTaggedValue(0)); + EXPECT_EQ(queue5->Back(), JSTaggedValue(3)); + EXPECT_NE(queue5.GetTaggedValue(), queue4.GetTaggedValue()); + +- EXPECT_EQ(queue5->Pop(thread), JSTaggedValue(0)); ++ EXPECT_EQ(queue5->Pop(thread_), JSTaggedValue(0)); + EXPECT_EQ(queue5->Size(), 3); + EXPECT_EQ(queue5->Front(), JSTaggedValue(1)); + +- EXPECT_EQ(queue5->Pop(thread), JSTaggedValue(1)); ++ EXPECT_EQ(queue5->Pop(thread_), JSTaggedValue(1)); + EXPECT_EQ(queue5->Size(), 2); + EXPECT_EQ(queue5->Front(), JSTaggedValue(2)); + +- EXPECT_EQ(queue5->Pop(thread), JSTaggedValue(2)); ++ EXPECT_EQ(queue5->Pop(thread_), JSTaggedValue(2)); + EXPECT_EQ(queue5->Size(), 1); + EXPECT_EQ(queue5->Front(), JSTaggedValue(3)); + +- EXPECT_EQ(queue5->Pop(thread), JSTaggedValue(3)); ++ EXPECT_EQ(queue5->Pop(thread_), JSTaggedValue(3)); + EXPECT_EQ(queue5->Size(), 0); + EXPECT_EQ(queue5->Front(), JSTaggedValue::Hole()); + EXPECT_TRUE(queue5->Empty()); +diff --git a/tests/runtime/common/js_typed_array_test.cpp b/tests/runtime/common/js_typed_array_test.cpp +index bf7ab75..b228cde 100644 +--- a/tests/runtime/common/js_typed_array_test.cpp ++++ b/tests/runtime/common/js_typed_array_test.cpp +@@ -33,23 +33,24 @@ public: + + void SetUp() override + { +- TestHelper::CreateEcmaVMWithScope(instance, thread, scope); ++ TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); + } + + void TearDown() override + { +- TestHelper::DestroyEcmaVMWithScope(instance, scope); ++ TestHelper::DestroyEcmaVMWithScope(instance_, scope_); + } +- PandaVM *instance {nullptr}; +- EcmaHandleScope *scope {nullptr}; +- JSThread *thread {nullptr}; ++ PandaVM *instance_ {nullptr}; ++ EcmaHandleScope *scope_ {nullptr}; ++ JSThread *thread_ {nullptr}; + +- const CVector cVecJSType {JSType::JS_INT8_ARRAY, JSType::JS_UINT8_ARRAY, JSType::JS_UINT8_CLAMPED_ARRAY, +- JSType::JS_INT16_ARRAY, JSType::JS_UINT16_ARRAY, JSType::JS_INT32_ARRAY, +- JSType::JS_UINT32_ARRAY, JSType::JS_FLOAT32_ARRAY, JSType::JS_FLOAT64_ARRAY}; ++ const CVector c_vec_js_type_ { ++ JSType::JS_INT8_ARRAY, JSType::JS_UINT8_ARRAY, JSType::JS_UINT8_CLAMPED_ARRAY, ++ JSType::JS_INT16_ARRAY, JSType::JS_UINT16_ARRAY, JSType::JS_INT32_ARRAY, ++ JSType::JS_UINT32_ARRAY, JSType::JS_FLOAT32_ARRAY, JSType::JS_FLOAT64_ARRAY}; + + // CVector pushed with JSTaggedValue made from compatible input value for the JSType +- const CVector cVecHandleTagValValueForTypedArray { ++ const CVector c_vec_handle_tag_val_value_for_typed_array_ { + // Use "(S)(...)" cast to make v in "JSTaggedValue(T v) : coretypes::TaggedValue(v) {}" compatible with S + JSTaggedValue((int8_t)(-111)), JSTaggedValue((uint8_t)(222)), JSTaggedValue((uint8_t)(222)), + JSTaggedValue((int16_t)(-31111)), JSTaggedValue((uint16_t)(61111)), +@@ -110,10 +111,10 @@ JSHandle CreateNumberTypedArray(JSThread *thread, JSType jsType) + */ + TEST_F(JSTypedArrayTest, ToPropKey_001) + { +- JSHandle handleUndefined(thread, JSTaggedValue::Undefined()); +- JSHandle handleHole(thread, JSTaggedValue::Hole()); +- JSHandle hnadleTagValEcmaStrPropKeyTo1 = JSTypedArray::ToPropKey(thread, handleUndefined); +- JSHandle hnadleTagValEcmaStrPropKeyTo2 = JSTypedArray::ToPropKey(thread, handleHole); ++ JSHandle handleUndefined(thread_, JSTaggedValue::Undefined()); ++ JSHandle handleHole(thread_, JSTaggedValue::Hole()); ++ JSHandle hnadleTagValEcmaStrPropKeyTo1 = JSTypedArray::ToPropKey(thread_, handleUndefined); ++ JSHandle hnadleTagValEcmaStrPropKeyTo2 = JSTypedArray::ToPropKey(thread_, handleHole); + JSHandle handleEcmaStrPropKeyTo1 = JSHandle::Cast(hnadleTagValEcmaStrPropKeyTo1); + JSHandle handleEcmaStrPropKeyTo2 = JSHandle::Cast(hnadleTagValEcmaStrPropKeyTo2); + EXPECT_NE(0, sizeof(handleUndefined)); +@@ -143,14 +144,14 @@ TEST_F(JSTypedArrayTest, ToPropKey_001) + */ + TEST_F(JSTypedArrayTest, ToPropKey_002) + { +- JSHandle handleTagVal1(thread, JSTaggedValue(0)); +- JSHandle handleTagVal2(thread, JSTaggedValue(-1)); +- JSHandle handleTagVal3(thread, JSTaggedValue(1.789)); +- JSHandle handleTagVal4(thread, JSTaggedValue(-789.1)); +- JSHandle hnadleTagValEcmaStrPropKeyTo1 = JSTypedArray::ToPropKey(thread, handleTagVal1); +- JSHandle hnadleTagValEcmaStrPropKeyTo2 = JSTypedArray::ToPropKey(thread, handleTagVal2); +- JSHandle hnadleTagValEcmaStrPropKeyTo3 = JSTypedArray::ToPropKey(thread, handleTagVal3); +- JSHandle hnadleTagValEcmaStrPropKeyTo4 = JSTypedArray::ToPropKey(thread, handleTagVal4); ++ JSHandle handleTagVal1(thread_, JSTaggedValue(0)); ++ JSHandle handleTagVal2(thread_, JSTaggedValue(-1)); ++ JSHandle handleTagVal3(thread_, JSTaggedValue(1.789)); ++ JSHandle handleTagVal4(thread_, JSTaggedValue(-789.1)); ++ JSHandle hnadleTagValEcmaStrPropKeyTo1 = JSTypedArray::ToPropKey(thread_, handleTagVal1); ++ JSHandle hnadleTagValEcmaStrPropKeyTo2 = JSTypedArray::ToPropKey(thread_, handleTagVal2); ++ JSHandle hnadleTagValEcmaStrPropKeyTo3 = JSTypedArray::ToPropKey(thread_, handleTagVal3); ++ JSHandle hnadleTagValEcmaStrPropKeyTo4 = JSTypedArray::ToPropKey(thread_, handleTagVal4); + JSHandle handleEcmaStrPropKeyTo1 = JSHandle::Cast(hnadleTagValEcmaStrPropKeyTo1); + JSHandle handleEcmaStrPropKeyTo2 = JSHandle::Cast(hnadleTagValEcmaStrPropKeyTo2); + JSHandle handleEcmaStrPropKeyTo3 = JSHandle::Cast(hnadleTagValEcmaStrPropKeyTo3); +@@ -189,40 +190,40 @@ TEST_F(JSTypedArrayTest, ToPropKey_002) + */ + TEST_F(JSTypedArrayTest, TypedArrayCreate) + { +- JSHandle handleInt8Array = CreateNumberTypedArray(thread, JSType::JS_INT8_ARRAY); ++ JSHandle handleInt8Array = CreateNumberTypedArray(thread_, JSType::JS_INT8_ARRAY); + JSHandle handleTagValInt8Array = JSHandle::Cast(handleInt8Array); + EXPECT_TRUE(handleTagValInt8Array->IsJSInt8Array() && handleTagValInt8Array->IsTypedArray()); + +- JSHandle handleUint8Array = CreateNumberTypedArray(thread, JSType::JS_UINT8_ARRAY); ++ JSHandle handleUint8Array = CreateNumberTypedArray(thread_, JSType::JS_UINT8_ARRAY); + JSHandle handleTagValUint8Array = JSHandle::Cast(handleUint8Array); + EXPECT_TRUE(handleTagValUint8Array->IsJSUint8Array() && handleTagValUint8Array->IsTypedArray()); + +- JSHandle handleUint8ClampedArray = CreateNumberTypedArray(thread, JSType::JS_UINT8_CLAMPED_ARRAY); ++ JSHandle handleUint8ClampedArray = CreateNumberTypedArray(thread_, JSType::JS_UINT8_CLAMPED_ARRAY); + JSHandle handleTagValUint8ClampedArray = JSHandle::Cast(handleUint8ClampedArray); + EXPECT_TRUE(handleTagValUint8ClampedArray->IsJSUint8ClampedArray() && + handleTagValUint8ClampedArray->IsTypedArray()); + +- JSHandle handleInt16Array = CreateNumberTypedArray(thread, JSType::JS_INT16_ARRAY); ++ JSHandle handleInt16Array = CreateNumberTypedArray(thread_, JSType::JS_INT16_ARRAY); + JSHandle handleTagValInt16Array = JSHandle::Cast(handleInt16Array); + EXPECT_TRUE(handleTagValInt16Array->IsJSInt16Array() && handleTagValInt16Array->IsTypedArray()); + +- JSHandle handleUint16Array = CreateNumberTypedArray(thread, JSType::JS_UINT16_ARRAY); ++ JSHandle handleUint16Array = CreateNumberTypedArray(thread_, JSType::JS_UINT16_ARRAY); + JSHandle handleTagValUint16Array = JSHandle::Cast(handleUint16Array); + EXPECT_TRUE(handleTagValUint16Array->IsJSUint16Array() && handleTagValUint16Array->IsTypedArray()); + +- JSHandle handleInt32Array = CreateNumberTypedArray(thread, JSType::JS_INT32_ARRAY); ++ JSHandle handleInt32Array = CreateNumberTypedArray(thread_, JSType::JS_INT32_ARRAY); + JSHandle handleTagValInt32Array = JSHandle::Cast(handleInt32Array); + EXPECT_TRUE(handleTagValInt32Array->IsJSInt32Array() && handleTagValInt32Array->IsTypedArray()); + +- JSHandle handleUint32Array = CreateNumberTypedArray(thread, JSType::JS_UINT32_ARRAY); ++ JSHandle handleUint32Array = CreateNumberTypedArray(thread_, JSType::JS_UINT32_ARRAY); + JSHandle handleTagValUint32Array = JSHandle::Cast(handleUint32Array); + EXPECT_TRUE(handleTagValUint32Array->IsJSUint32Array() && handleTagValUint32Array->IsTypedArray()); + +- JSHandle handleFloat32Array = CreateNumberTypedArray(thread, JSType::JS_FLOAT32_ARRAY); ++ JSHandle handleFloat32Array = CreateNumberTypedArray(thread_, JSType::JS_FLOAT32_ARRAY); + JSHandle handleTagValFloat32Array = JSHandle::Cast(handleFloat32Array); + EXPECT_TRUE(handleTagValFloat32Array->IsJSFloat32Array() && handleTagValFloat32Array->IsTypedArray()); + +- JSHandle handleFloat64Array = CreateNumberTypedArray(thread, JSType::JS_FLOAT64_ARRAY); ++ JSHandle handleFloat64Array = CreateNumberTypedArray(thread_, JSType::JS_FLOAT64_ARRAY); + JSHandle handleTagValFloat64Array = JSHandle::Cast(handleFloat64Array); + EXPECT_TRUE(handleTagValFloat64Array->IsJSFloat64Array() && handleTagValFloat64Array->IsTypedArray()); + } +@@ -237,15 +238,15 @@ TEST_F(JSTypedArrayTest, TypedArrayCreate) + */ + TEST_F(JSTypedArrayTest, SetViewedArrayBuffer) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle handleArrayBufferFrom = factory->NewJSArrayBuffer(10); + JSHandle handleTagValArrayBufferFrom = JSHandle::Cast(handleArrayBufferFrom); + +- for (size_t i = 0; i < cVecJSType.size(); i++) { +- JSHandle handleTypedArray = CreateNumberTypedArray(thread, cVecJSType.at(i)); ++ for (size_t i = 0; i < c_vec_js_type_.size(); i++) { ++ JSHandle handleTypedArray = CreateNumberTypedArray(thread_, c_vec_js_type_.at(i)); + + EXPECT_EQ(handleTypedArray->GetViewedArrayBuffer(), JSTaggedValue::Undefined()); +- handleTypedArray->SetViewedArrayBuffer(thread, handleTagValArrayBufferFrom); ++ handleTypedArray->SetViewedArrayBuffer(thread_, handleTagValArrayBufferFrom); + EXPECT_EQ(handleTypedArray->GetViewedArrayBuffer(), handleTagValArrayBufferFrom.GetTaggedValue()); + } + } +@@ -261,15 +262,15 @@ TEST_F(JSTypedArrayTest, SetViewedArrayBuffer) + TEST_F(JSTypedArrayTest, SetTypedArrayName) + { + CString cStrName = "cStrName"; +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle handleEcmaStrNameFrom = factory->NewFromString(cStrName); + JSHandle handleTagValEcmaStrNameFrom = JSHandle::Cast(handleEcmaStrNameFrom); + +- for (size_t i = 0; i < cVecJSType.size(); i++) { +- JSHandle handleTypedArray = CreateNumberTypedArray(thread, cVecJSType.at(i)); ++ for (size_t i = 0; i < c_vec_js_type_.size(); i++) { ++ JSHandle handleTypedArray = CreateNumberTypedArray(thread_, c_vec_js_type_.at(i)); + + EXPECT_EQ(handleTypedArray->GetTypedArrayName(), JSTaggedValue::Undefined()); +- handleTypedArray->SetTypedArrayName(thread, handleTagValEcmaStrNameFrom); ++ handleTypedArray->SetTypedArrayName(thread_, handleTagValEcmaStrNameFrom); + EXPECT_EQ(handleTypedArray->GetTypedArrayName(), handleTagValEcmaStrNameFrom.GetTaggedValue()); + } + } +@@ -285,13 +286,13 @@ TEST_F(JSTypedArrayTest, SetTypedArrayName) + TEST_F(JSTypedArrayTest, SetByteLength) + { + uint32_t u32ByteLength = 2; +- JSHandle handleTagValByteLengthFrom(thread, JSTaggedValue(u32ByteLength)); ++ JSHandle handleTagValByteLengthFrom(thread_, JSTaggedValue(u32ByteLength)); + +- for (size_t i = 0; i < cVecJSType.size(); i++) { +- JSHandle handleTypedArray = CreateNumberTypedArray(thread, cVecJSType.at(i)); ++ for (size_t i = 0; i < c_vec_js_type_.size(); i++) { ++ JSHandle handleTypedArray = CreateNumberTypedArray(thread_, c_vec_js_type_.at(i)); + + EXPECT_EQ(handleTypedArray->GetByteLength(), JSTaggedValue(0)); +- handleTypedArray->SetByteLength(thread, handleTagValByteLengthFrom); ++ handleTypedArray->SetByteLength(thread_, handleTagValByteLengthFrom); + EXPECT_EQ(handleTypedArray->GetByteLength(), handleTagValByteLengthFrom.GetTaggedValue()); + } + } +@@ -307,13 +308,13 @@ TEST_F(JSTypedArrayTest, SetByteLength) + TEST_F(JSTypedArrayTest, SetByteOffset) + { + uint32_t u32ByteOffset = 2; +- JSHandle handleTagValByteOffsetFrom(thread, JSTaggedValue(u32ByteOffset)); ++ JSHandle handleTagValByteOffsetFrom(thread_, JSTaggedValue(u32ByteOffset)); + +- for (size_t i = 0; i < cVecJSType.size(); i++) { +- JSHandle handleTypedArray = CreateNumberTypedArray(thread, cVecJSType.at(i)); ++ for (size_t i = 0; i < c_vec_js_type_.size(); i++) { ++ JSHandle handleTypedArray = CreateNumberTypedArray(thread_, c_vec_js_type_.at(i)); + + EXPECT_EQ(handleTypedArray->GetByteOffset(), JSTaggedValue(0)); +- handleTypedArray->SetByteOffset(thread, handleTagValByteOffsetFrom); ++ handleTypedArray->SetByteOffset(thread_, handleTagValByteOffsetFrom); + EXPECT_EQ(handleTypedArray->GetByteOffset(), handleTagValByteOffsetFrom.GetTaggedValue()); + } + } +@@ -329,13 +330,13 @@ TEST_F(JSTypedArrayTest, SetByteOffset) + TEST_F(JSTypedArrayTest, SetArrayLength) + { + uint32_t u32ArrayLength = 2; +- JSHandle handleTagValArrayLengthFrom(thread, JSTaggedValue(u32ArrayLength)); ++ JSHandle handleTagValArrayLengthFrom(thread_, JSTaggedValue(u32ArrayLength)); + +- for (size_t i = 0; i < cVecJSType.size(); i++) { +- JSHandle handleTypedArray = CreateNumberTypedArray(thread, cVecJSType.at(i)); ++ for (size_t i = 0; i < c_vec_js_type_.size(); i++) { ++ JSHandle handleTypedArray = CreateNumberTypedArray(thread_, c_vec_js_type_.at(i)); + + EXPECT_EQ(handleTypedArray->GetArrayLength(), JSTaggedValue(0)); +- handleTypedArray->SetArrayLength(thread, handleTagValArrayLengthFrom); ++ handleTypedArray->SetArrayLength(thread_, handleTagValArrayLengthFrom); + EXPECT_EQ(handleTypedArray->GetArrayLength(), handleTagValArrayLengthFrom.GetTaggedValue()); + } + } +@@ -351,8 +352,8 @@ TEST_F(JSTypedArrayTest, SetArrayLength) + TEST_F(JSTypedArrayTest, DISABLED_IntegerIndexedElementSet_Int8Array_001) + { + uint32_t numElementsInt8Array = 256; +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); +- JSHandle handleInt8Array = CreateNumberTypedArray(thread, JSType::JS_INT8_ARRAY); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); ++ JSHandle handleInt8Array = CreateNumberTypedArray(thread_, JSType::JS_INT8_ARRAY); + JSHandle handleTagValInt8Array = JSHandle::Cast(handleInt8Array); + + uint32_t sizeElement = +@@ -360,16 +361,16 @@ TEST_F(JSTypedArrayTest, DISABLED_IntegerIndexedElementSet_Int8Array_001) + uint32_t byteLengthViewdArrayBuffer = sizeElement * numElementsInt8Array; + JSHandle handleTagValArrayBufferFrom = + JSHandle::Cast(factory->NewJSArrayBuffer(byteLengthViewdArrayBuffer)); +- handleInt8Array->SetViewedArrayBuffer(thread, handleTagValArrayBufferFrom); +- handleInt8Array->SetArrayLength(thread, JSTaggedValue(numElementsInt8Array)); ++ handleInt8Array->SetViewedArrayBuffer(thread_, handleTagValArrayBufferFrom); ++ handleInt8Array->SetArrayLength(thread_, JSTaggedValue(numElementsInt8Array)); + + CVector cVecOpResult = {}; + for (size_t i = 0; i < numElementsInt8Array; i++) { + EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet( +- thread, handleTagValInt8Array, JSTaggedValue(i), +- JSHandle(thread, JSTaggedValue(std::numeric_limits::min() + i)))); ++ thread_, handleTagValInt8Array, JSTaggedValue(i), ++ JSHandle(thread_, JSTaggedValue(std::numeric_limits::min() + i)))); + OperationResult opResult = +- JSTypedArray::IntegerIndexedElementGet(thread, handleTagValInt8Array, JSTaggedValue(i)); ++ JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValInt8Array, JSTaggedValue(i)); + cVecOpResult.push_back(opResult); + } + for (size_t i = 0; i < numElementsInt8Array; i++) { +@@ -378,31 +379,31 @@ TEST_F(JSTypedArrayTest, DISABLED_IntegerIndexedElementSet_Int8Array_001) + cVecOpResult.clear(); + + OperationResult opResult1 = +- JSTypedArray::IntegerIndexedElementGet(thread, handleTagValInt8Array, JSTaggedValue(-1)); ++ JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValInt8Array, JSTaggedValue(-1)); + OperationResult opResult2 = +- JSTypedArray::IntegerIndexedElementGet(thread, handleTagValInt8Array, JSTaggedValue(-0.0)); ++ JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValInt8Array, JSTaggedValue(-0.0)); + OperationResult opResult3 = +- JSTypedArray::IntegerIndexedElementGet(thread, handleTagValInt8Array, JSTaggedValue(1.1)); ++ JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValInt8Array, JSTaggedValue(1.1)); + OperationResult opResult4 = +- JSTypedArray::IntegerIndexedElementGet(thread, handleTagValInt8Array, JSTaggedValue(numElementsInt8Array)); ++ JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValInt8Array, JSTaggedValue(numElementsInt8Array)); + EXPECT_EQ(opResult1.GetValue().GetTaggedValue(), JSTaggedValue::Undefined()); + EXPECT_EQ(opResult2.GetValue().GetTaggedValue(), JSTaggedValue::Undefined()); + EXPECT_EQ(opResult3.GetValue().GetTaggedValue(), JSTaggedValue::Undefined()); + EXPECT_EQ(opResult4.GetValue().GetTaggedValue(), JSTaggedValue::Undefined()); + +- EXPECT_FALSE(JSTypedArray::IntegerIndexedElementSet(thread, handleTagValInt8Array, JSTaggedValue(-1), +- JSHandle(thread, JSTaggedValue(0)))); +- EXPECT_FALSE(JSTypedArray::IntegerIndexedElementSet(thread, handleTagValInt8Array, ++ EXPECT_FALSE(JSTypedArray::IntegerIndexedElementSet(thread_, handleTagValInt8Array, JSTaggedValue(-1), ++ JSHandle(thread_, JSTaggedValue(0)))); ++ EXPECT_FALSE(JSTypedArray::IntegerIndexedElementSet(thread_, handleTagValInt8Array, + JSTaggedValue(numElementsInt8Array), +- JSHandle(thread, JSTaggedValue(0)))); ++ JSHandle(thread_, JSTaggedValue(0)))); + } + + // Nonstandard input value for Int8Array + TEST_F(JSTypedArrayTest, IntegerIndexedElementSet_Int8Array_002) + { + uint32_t numElementsInt8Array = 16; +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); +- JSHandle handleInt8Array = CreateNumberTypedArray(thread, JSType::JS_INT8_ARRAY); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); ++ JSHandle handleInt8Array = CreateNumberTypedArray(thread_, JSType::JS_INT8_ARRAY); + JSHandle handleTagValInt8Array = JSHandle::Cast(handleInt8Array); + + uint32_t sizeElement = +@@ -410,30 +411,34 @@ TEST_F(JSTypedArrayTest, IntegerIndexedElementSet_Int8Array_002) + uint32_t byteLengthViewdArrayBuffer = sizeElement * numElementsInt8Array; + JSHandle handleTagValArrayBufferFrom = + JSHandle::Cast(factory->NewJSArrayBuffer(byteLengthViewdArrayBuffer)); +- handleInt8Array->SetViewedArrayBuffer(thread, handleTagValArrayBufferFrom); +- handleInt8Array->SetArrayLength(thread, JSTaggedValue(numElementsInt8Array)); ++ handleInt8Array->SetViewedArrayBuffer(thread_, handleTagValArrayBufferFrom); ++ handleInt8Array->SetArrayLength(thread_, JSTaggedValue(numElementsInt8Array)); + + int64_t value1 = -129; // to int8 : 127 + int64_t value2 = 128; // to int8 : -128 + double value3 = 13.4; // to int8 : 13 + double value4 = 13.6; // to int8 : 13 +- JSHandle handleTagValValueSet1(thread, JSTaggedValue(value1)); +- JSHandle handleTagValValueSet2(thread, JSTaggedValue(value2)); +- JSHandle handleTagValValueSet3(thread, JSTaggedValue(value3)); +- JSHandle handleTagValValueSet4(thread, JSTaggedValue(value4)); +- +- EXPECT_TRUE( +- JSTypedArray::IntegerIndexedElementSet(thread, handleTagValInt8Array, JSTaggedValue(0), handleTagValValueSet1)); +- OperationResult opResult1 = JSTypedArray::IntegerIndexedElementGet(thread, handleTagValInt8Array, JSTaggedValue(0)); +- EXPECT_TRUE( +- JSTypedArray::IntegerIndexedElementSet(thread, handleTagValInt8Array, JSTaggedValue(0), handleTagValValueSet2)); +- OperationResult opResult2 = JSTypedArray::IntegerIndexedElementGet(thread, handleTagValInt8Array, JSTaggedValue(0)); +- EXPECT_TRUE( +- JSTypedArray::IntegerIndexedElementSet(thread, handleTagValInt8Array, JSTaggedValue(0), handleTagValValueSet3)); +- OperationResult opResult3 = JSTypedArray::IntegerIndexedElementGet(thread, handleTagValInt8Array, JSTaggedValue(0)); +- EXPECT_TRUE( +- JSTypedArray::IntegerIndexedElementSet(thread, handleTagValInt8Array, JSTaggedValue(0), handleTagValValueSet4)); +- OperationResult opResult4 = JSTypedArray::IntegerIndexedElementGet(thread, handleTagValInt8Array, JSTaggedValue(0)); ++ JSHandle handleTagValValueSet1(thread_, JSTaggedValue(value1)); ++ JSHandle handleTagValValueSet2(thread_, JSTaggedValue(value2)); ++ JSHandle handleTagValValueSet3(thread_, JSTaggedValue(value3)); ++ JSHandle handleTagValValueSet4(thread_, JSTaggedValue(value4)); ++ ++ EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread_, handleTagValInt8Array, JSTaggedValue(0), ++ handleTagValValueSet1)); ++ OperationResult opResult1 = ++ JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValInt8Array, JSTaggedValue(0)); ++ EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread_, handleTagValInt8Array, JSTaggedValue(0), ++ handleTagValValueSet2)); ++ OperationResult opResult2 = ++ JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValInt8Array, JSTaggedValue(0)); ++ EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread_, handleTagValInt8Array, JSTaggedValue(0), ++ handleTagValValueSet3)); ++ OperationResult opResult3 = ++ JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValInt8Array, JSTaggedValue(0)); ++ EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread_, handleTagValInt8Array, JSTaggedValue(0), ++ handleTagValValueSet4)); ++ OperationResult opResult4 = ++ JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValInt8Array, JSTaggedValue(0)); + + EXPECT_NE(value1, opResult1.GetValue().GetTaggedValue().GetNumber()); + EXPECT_NE(value2, opResult2.GetValue().GetTaggedValue().GetNumber()); +@@ -448,8 +453,8 @@ TEST_F(JSTypedArrayTest, IntegerIndexedElementSet_Int8Array_002) + TEST_F(JSTypedArrayTest, IntegerIndexedElementSet_Uint8Array_001) + { + uint32_t numElementsUint8Array = 256; +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); +- JSHandle handleUint8Array = CreateNumberTypedArray(thread, JSType::JS_UINT8_ARRAY); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); ++ JSHandle handleUint8Array = CreateNumberTypedArray(thread_, JSType::JS_UINT8_ARRAY); + JSHandle handleTagValUint8Array = JSHandle::Cast(handleUint8Array); + + uint32_t sizeElement = +@@ -457,16 +462,16 @@ TEST_F(JSTypedArrayTest, IntegerIndexedElementSet_Uint8Array_001) + uint32_t byteLengthViewdArrayBuffer = sizeElement * numElementsUint8Array; + JSHandle handleTagValArrayBufferFrom = + JSHandle::Cast(factory->NewJSArrayBuffer(byteLengthViewdArrayBuffer)); +- handleUint8Array->SetViewedArrayBuffer(thread, handleTagValArrayBufferFrom); +- handleUint8Array->SetArrayLength(thread, JSTaggedValue(numElementsUint8Array)); ++ handleUint8Array->SetViewedArrayBuffer(thread_, handleTagValArrayBufferFrom); ++ handleUint8Array->SetArrayLength(thread_, JSTaggedValue(numElementsUint8Array)); + + CVector cVecOpResult = {}; + for (uint32_t i = 0; i < numElementsUint8Array; i++) { + EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet( +- thread, handleTagValUint8Array, JSTaggedValue(i), +- JSHandle(thread, JSTaggedValue(std::numeric_limits::min() + i)))); ++ thread_, handleTagValUint8Array, JSTaggedValue(i), ++ JSHandle(thread_, JSTaggedValue(std::numeric_limits::min() + i)))); + OperationResult opResult = +- JSTypedArray::IntegerIndexedElementGet(thread, handleTagValUint8Array, JSTaggedValue(i)); ++ JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValUint8Array, JSTaggedValue(i)); + cVecOpResult.push_back(opResult); + } + for (uint32_t i = 0; i < numElementsUint8Array; i++) { +@@ -475,31 +480,31 @@ TEST_F(JSTypedArrayTest, IntegerIndexedElementSet_Uint8Array_001) + cVecOpResult.clear(); + + OperationResult opResult1 = +- JSTypedArray::IntegerIndexedElementGet(thread, handleTagValUint8Array, JSTaggedValue(-1)); ++ JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValUint8Array, JSTaggedValue(-1)); + OperationResult opResult2 = +- JSTypedArray::IntegerIndexedElementGet(thread, handleTagValUint8Array, JSTaggedValue(-0.0)); ++ JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValUint8Array, JSTaggedValue(-0.0)); + OperationResult opResult3 = +- JSTypedArray::IntegerIndexedElementGet(thread, handleTagValUint8Array, JSTaggedValue(1.1)); ++ JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValUint8Array, JSTaggedValue(1.1)); + OperationResult opResult4 = +- JSTypedArray::IntegerIndexedElementGet(thread, handleTagValUint8Array, JSTaggedValue(numElementsUint8Array)); ++ JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValUint8Array, JSTaggedValue(numElementsUint8Array)); + EXPECT_EQ(opResult1.GetValue().GetTaggedValue(), JSTaggedValue::Undefined()); + EXPECT_EQ(opResult2.GetValue().GetTaggedValue(), JSTaggedValue::Undefined()); + EXPECT_EQ(opResult3.GetValue().GetTaggedValue(), JSTaggedValue::Undefined()); + EXPECT_EQ(opResult4.GetValue().GetTaggedValue(), JSTaggedValue::Undefined()); + +- EXPECT_FALSE(JSTypedArray::IntegerIndexedElementSet(thread, handleTagValUint8Array, JSTaggedValue(-1), +- JSHandle(thread, JSTaggedValue(0)))); +- EXPECT_FALSE(JSTypedArray::IntegerIndexedElementSet(thread, handleTagValUint8Array, ++ EXPECT_FALSE(JSTypedArray::IntegerIndexedElementSet(thread_, handleTagValUint8Array, JSTaggedValue(-1), ++ JSHandle(thread_, JSTaggedValue(0)))); ++ EXPECT_FALSE(JSTypedArray::IntegerIndexedElementSet(thread_, handleTagValUint8Array, + JSTaggedValue(numElementsUint8Array), +- JSHandle(thread, JSTaggedValue(0)))); ++ JSHandle(thread_, JSTaggedValue(0)))); + } + + // Nonstandard input value for Uint8Array + TEST_F(JSTypedArrayTest, IntegerIndexedElementSet_Uint8Array_002) + { + uint32_t numElementsUint8Array = 16; +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); +- JSHandle handleUint8Array = CreateNumberTypedArray(thread, JSType::JS_UINT8_ARRAY); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); ++ JSHandle handleUint8Array = CreateNumberTypedArray(thread_, JSType::JS_UINT8_ARRAY); + JSHandle handleTagValUint8Array = JSHandle::Cast(handleUint8Array); + + uint32_t sizeElement = +@@ -507,34 +512,34 @@ TEST_F(JSTypedArrayTest, IntegerIndexedElementSet_Uint8Array_002) + uint32_t byteLengthViewdArrayBuffer = sizeElement * numElementsUint8Array; + JSHandle handleTagValArrayBufferFrom = + JSHandle::Cast(factory->NewJSArrayBuffer(byteLengthViewdArrayBuffer)); +- handleUint8Array->SetViewedArrayBuffer(thread, handleTagValArrayBufferFrom); +- handleUint8Array->SetArrayLength(thread, JSTaggedValue(numElementsUint8Array)); ++ handleUint8Array->SetViewedArrayBuffer(thread_, handleTagValArrayBufferFrom); ++ handleUint8Array->SetArrayLength(thread_, JSTaggedValue(numElementsUint8Array)); + + int64_t value1 = -1; // to uint8 : 255 + int64_t value2 = 256; // to uint8 : 0 + double value3 = 13.4; // to uint8 : 13 + double value4 = 13.6; // to uint8 : 13 +- JSHandle handleTagValValueSet1(thread, JSTaggedValue(value1)); +- JSHandle handleTagValValueSet2(thread, JSTaggedValue(value2)); +- JSHandle handleTagValValueSet3(thread, JSTaggedValue(value3)); +- JSHandle handleTagValValueSet4(thread, JSTaggedValue(value4)); ++ JSHandle handleTagValValueSet1(thread_, JSTaggedValue(value1)); ++ JSHandle handleTagValValueSet2(thread_, JSTaggedValue(value2)); ++ JSHandle handleTagValValueSet3(thread_, JSTaggedValue(value3)); ++ JSHandle handleTagValValueSet4(thread_, JSTaggedValue(value4)); + +- EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread, handleTagValUint8Array, JSTaggedValue(0), ++ EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread_, handleTagValUint8Array, JSTaggedValue(0), + handleTagValValueSet1)); + OperationResult opResult1 = +- JSTypedArray::IntegerIndexedElementGet(thread, handleTagValUint8Array, JSTaggedValue(0)); +- EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread, handleTagValUint8Array, JSTaggedValue(0), ++ JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValUint8Array, JSTaggedValue(0)); ++ EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread_, handleTagValUint8Array, JSTaggedValue(0), + handleTagValValueSet2)); + OperationResult opResult2 = +- JSTypedArray::IntegerIndexedElementGet(thread, handleTagValUint8Array, JSTaggedValue(0)); +- EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread, handleTagValUint8Array, JSTaggedValue(0), ++ JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValUint8Array, JSTaggedValue(0)); ++ EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread_, handleTagValUint8Array, JSTaggedValue(0), + handleTagValValueSet3)); + OperationResult opResult3 = +- JSTypedArray::IntegerIndexedElementGet(thread, handleTagValUint8Array, JSTaggedValue(0)); +- EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread, handleTagValUint8Array, JSTaggedValue(0), ++ JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValUint8Array, JSTaggedValue(0)); ++ EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread_, handleTagValUint8Array, JSTaggedValue(0), + handleTagValValueSet4)); + OperationResult opResult4 = +- JSTypedArray::IntegerIndexedElementGet(thread, handleTagValUint8Array, JSTaggedValue(0)); ++ JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValUint8Array, JSTaggedValue(0)); + + EXPECT_NE(value1, opResult1.GetValue().GetTaggedValue().GetNumber()); + EXPECT_NE(value2, opResult2.GetValue().GetTaggedValue().GetNumber()); +@@ -549,8 +554,8 @@ TEST_F(JSTypedArrayTest, IntegerIndexedElementSet_Uint8Array_002) + TEST_F(JSTypedArrayTest, IntegerIndexedElementSet_Uint8ClampedArray_001) + { + uint32_t numElementsUint8ClampedArray = 256; +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); +- JSHandle handleUint8ClampedArray = CreateNumberTypedArray(thread, JSType::JS_UINT8_CLAMPED_ARRAY); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); ++ JSHandle handleUint8ClampedArray = CreateNumberTypedArray(thread_, JSType::JS_UINT8_CLAMPED_ARRAY); + JSHandle handleTagValUint8ClampedArray = JSHandle::Cast(handleUint8ClampedArray); + + uint32_t sizeElement = +@@ -558,16 +563,16 @@ TEST_F(JSTypedArrayTest, IntegerIndexedElementSet_Uint8ClampedArray_001) + uint32_t byteLengthViewdArrayBuffer = sizeElement * numElementsUint8ClampedArray; + JSHandle handleTagValArrayBufferFrom = + JSHandle::Cast(factory->NewJSArrayBuffer(byteLengthViewdArrayBuffer)); +- handleUint8ClampedArray->SetViewedArrayBuffer(thread, handleTagValArrayBufferFrom); +- handleUint8ClampedArray->SetArrayLength(thread, JSTaggedValue(numElementsUint8ClampedArray)); ++ handleUint8ClampedArray->SetViewedArrayBuffer(thread_, handleTagValArrayBufferFrom); ++ handleUint8ClampedArray->SetArrayLength(thread_, JSTaggedValue(numElementsUint8ClampedArray)); + + CVector cVecOpResult = {}; + for (uint32_t i = 0; i < numElementsUint8ClampedArray; i++) { + EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet( +- thread, handleTagValUint8ClampedArray, JSTaggedValue(i), +- JSHandle(thread, JSTaggedValue(std::numeric_limits::min() + i)))); ++ thread_, handleTagValUint8ClampedArray, JSTaggedValue(i), ++ JSHandle(thread_, JSTaggedValue(std::numeric_limits::min() + i)))); + OperationResult opResult = +- JSTypedArray::IntegerIndexedElementGet(thread, handleTagValUint8ClampedArray, JSTaggedValue(i)); ++ JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValUint8ClampedArray, JSTaggedValue(i)); + cVecOpResult.push_back(opResult); + } + for (uint32_t i = 0; i < numElementsUint8ClampedArray; i++) { +@@ -576,31 +581,31 @@ TEST_F(JSTypedArrayTest, IntegerIndexedElementSet_Uint8ClampedArray_001) + cVecOpResult.clear(); + + OperationResult opResult1 = +- JSTypedArray::IntegerIndexedElementGet(thread, handleTagValUint8ClampedArray, JSTaggedValue(-1)); ++ JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValUint8ClampedArray, JSTaggedValue(-1)); + OperationResult opResult2 = +- JSTypedArray::IntegerIndexedElementGet(thread, handleTagValUint8ClampedArray, JSTaggedValue(-0.0)); ++ JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValUint8ClampedArray, JSTaggedValue(-0.0)); + OperationResult opResult3 = +- JSTypedArray::IntegerIndexedElementGet(thread, handleTagValUint8ClampedArray, JSTaggedValue(1.1)); +- OperationResult opResult4 = JSTypedArray::IntegerIndexedElementGet(thread, handleTagValUint8ClampedArray, ++ JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValUint8ClampedArray, JSTaggedValue(1.1)); ++ OperationResult opResult4 = JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValUint8ClampedArray, + JSTaggedValue(numElementsUint8ClampedArray)); + EXPECT_EQ(opResult1.GetValue().GetTaggedValue(), JSTaggedValue::Undefined()); + EXPECT_EQ(opResult2.GetValue().GetTaggedValue(), JSTaggedValue::Undefined()); + EXPECT_EQ(opResult3.GetValue().GetTaggedValue(), JSTaggedValue::Undefined()); + EXPECT_EQ(opResult4.GetValue().GetTaggedValue(), JSTaggedValue::Undefined()); + +- EXPECT_FALSE(JSTypedArray::IntegerIndexedElementSet(thread, handleTagValUint8ClampedArray, JSTaggedValue(-1), +- JSHandle(thread, JSTaggedValue(0)))); +- EXPECT_FALSE(JSTypedArray::IntegerIndexedElementSet(thread, handleTagValUint8ClampedArray, ++ EXPECT_FALSE(JSTypedArray::IntegerIndexedElementSet(thread_, handleTagValUint8ClampedArray, JSTaggedValue(-1), ++ JSHandle(thread_, JSTaggedValue(0)))); ++ EXPECT_FALSE(JSTypedArray::IntegerIndexedElementSet(thread_, handleTagValUint8ClampedArray, + JSTaggedValue(numElementsUint8ClampedArray), +- JSHandle(thread, JSTaggedValue(0)))); ++ JSHandle(thread_, JSTaggedValue(0)))); + } + + // Nonstandard input value for Uint8ClampedArray + TEST_F(JSTypedArrayTest, IntegerIndexedElementSet_Uint8ClampedArray_002) + { + uint32_t numElementsUint8ClampedArray = 16; +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); +- JSHandle handleUint8ClampedArray = CreateNumberTypedArray(thread, JSType::JS_UINT8_CLAMPED_ARRAY); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); ++ JSHandle handleUint8ClampedArray = CreateNumberTypedArray(thread_, JSType::JS_UINT8_CLAMPED_ARRAY); + JSHandle handleTagValUint8ClampedArray = JSHandle::Cast(handleUint8ClampedArray); + + uint32_t sizeElement = +@@ -608,34 +613,34 @@ TEST_F(JSTypedArrayTest, IntegerIndexedElementSet_Uint8ClampedArray_002) + uint32_t byteLengthViewdArrayBuffer = sizeElement * numElementsUint8ClampedArray; + JSHandle handleTagValArrayBufferFrom = + JSHandle::Cast(factory->NewJSArrayBuffer(byteLengthViewdArrayBuffer)); +- handleUint8ClampedArray->SetViewedArrayBuffer(thread, handleTagValArrayBufferFrom); +- handleUint8ClampedArray->SetArrayLength(thread, JSTaggedValue(numElementsUint8ClampedArray)); ++ handleUint8ClampedArray->SetViewedArrayBuffer(thread_, handleTagValArrayBufferFrom); ++ handleUint8ClampedArray->SetArrayLength(thread_, JSTaggedValue(numElementsUint8ClampedArray)); + + int64_t value1 = -1; // to uint8_clamped : 0 + int64_t value2 = 256; // to uint8_clamped : 255 + double value3 = 13.4; // to uint8_clamped : 13 + double value4 = 13.6; // to uint8_clamped : 14 +- JSHandle handleTagValValueSet1(thread, JSTaggedValue(value1)); +- JSHandle handleTagValValueSet2(thread, JSTaggedValue(value2)); +- JSHandle handleTagValValueSet3(thread, JSTaggedValue(value3)); +- JSHandle handleTagValValueSet4(thread, JSTaggedValue(value4)); ++ JSHandle handleTagValValueSet1(thread_, JSTaggedValue(value1)); ++ JSHandle handleTagValValueSet2(thread_, JSTaggedValue(value2)); ++ JSHandle handleTagValValueSet3(thread_, JSTaggedValue(value3)); ++ JSHandle handleTagValValueSet4(thread_, JSTaggedValue(value4)); + +- EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread, handleTagValUint8ClampedArray, JSTaggedValue(0), ++ EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread_, handleTagValUint8ClampedArray, JSTaggedValue(0), + handleTagValValueSet1)); + OperationResult opResult1 = +- JSTypedArray::IntegerIndexedElementGet(thread, handleTagValUint8ClampedArray, JSTaggedValue(0)); +- EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread, handleTagValUint8ClampedArray, JSTaggedValue(0), ++ JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValUint8ClampedArray, JSTaggedValue(0)); ++ EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread_, handleTagValUint8ClampedArray, JSTaggedValue(0), + handleTagValValueSet2)); + OperationResult opResult2 = +- JSTypedArray::IntegerIndexedElementGet(thread, handleTagValUint8ClampedArray, JSTaggedValue(0)); +- EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread, handleTagValUint8ClampedArray, JSTaggedValue(0), ++ JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValUint8ClampedArray, JSTaggedValue(0)); ++ EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread_, handleTagValUint8ClampedArray, JSTaggedValue(0), + handleTagValValueSet3)); + OperationResult opResult3 = +- JSTypedArray::IntegerIndexedElementGet(thread, handleTagValUint8ClampedArray, JSTaggedValue(0)); +- EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread, handleTagValUint8ClampedArray, JSTaggedValue(0), ++ JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValUint8ClampedArray, JSTaggedValue(0)); ++ EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread_, handleTagValUint8ClampedArray, JSTaggedValue(0), + handleTagValValueSet4)); + OperationResult opResult4 = +- JSTypedArray::IntegerIndexedElementGet(thread, handleTagValUint8ClampedArray, JSTaggedValue(0)); ++ JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValUint8ClampedArray, JSTaggedValue(0)); + + EXPECT_NE(value1, opResult1.GetValue().GetTaggedValue().GetNumber()); + EXPECT_NE(value2, opResult2.GetValue().GetTaggedValue().GetNumber()); +@@ -651,8 +656,8 @@ TEST_F(JSTypedArrayTest, DISABLED_IntegerIndexedElementSet_Int16Array_001) + { + uint32_t numElementsInt16Array = 100; + int16_t scaleForInt16ValueSet = 100; +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); +- JSHandle handleInt16Array = CreateNumberTypedArray(thread, JSType::JS_INT16_ARRAY); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); ++ JSHandle handleInt16Array = CreateNumberTypedArray(thread_, JSType::JS_INT16_ARRAY); + JSHandle handleTagValInt16Array = JSHandle::Cast(handleInt16Array); + + uint32_t sizeElement = +@@ -660,17 +665,17 @@ TEST_F(JSTypedArrayTest, DISABLED_IntegerIndexedElementSet_Int16Array_001) + uint32_t byteLengthViewdArrayBuffer = sizeElement * numElementsInt16Array; + JSHandle handleTagValArrayBufferFrom = + JSHandle::Cast(factory->NewJSArrayBuffer(byteLengthViewdArrayBuffer)); +- handleInt16Array->SetViewedArrayBuffer(thread, handleTagValArrayBufferFrom); +- handleInt16Array->SetArrayLength(thread, JSTaggedValue(numElementsInt16Array)); ++ handleInt16Array->SetViewedArrayBuffer(thread_, handleTagValArrayBufferFrom); ++ handleInt16Array->SetArrayLength(thread_, JSTaggedValue(numElementsInt16Array)); + + CVector cVecOpResult = {}; + for (size_t i = 0; i < numElementsInt16Array; i++) { + EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet( +- thread, handleTagValInt16Array, JSTaggedValue(i), +- JSHandle(thread, ++ thread_, handleTagValInt16Array, JSTaggedValue(i), ++ JSHandle(thread_, + JSTaggedValue(std::numeric_limits::min() + i * scaleForInt16ValueSet)))); + OperationResult opResult = +- JSTypedArray::IntegerIndexedElementGet(thread, handleTagValInt16Array, JSTaggedValue(i)); ++ JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValInt16Array, JSTaggedValue(i)); + cVecOpResult.push_back(opResult); + } + for (size_t i = 0; i < numElementsInt16Array; i++) { +@@ -680,31 +685,31 @@ TEST_F(JSTypedArrayTest, DISABLED_IntegerIndexedElementSet_Int16Array_001) + cVecOpResult.clear(); + + OperationResult opResult1 = +- JSTypedArray::IntegerIndexedElementGet(thread, handleTagValInt16Array, JSTaggedValue(-1)); ++ JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValInt16Array, JSTaggedValue(-1)); + OperationResult opResult2 = +- JSTypedArray::IntegerIndexedElementGet(thread, handleTagValInt16Array, JSTaggedValue(-0.0)); ++ JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValInt16Array, JSTaggedValue(-0.0)); + OperationResult opResult3 = +- JSTypedArray::IntegerIndexedElementGet(thread, handleTagValInt16Array, JSTaggedValue(1.1)); ++ JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValInt16Array, JSTaggedValue(1.1)); + OperationResult opResult4 = +- JSTypedArray::IntegerIndexedElementGet(thread, handleTagValInt16Array, JSTaggedValue(numElementsInt16Array)); ++ JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValInt16Array, JSTaggedValue(numElementsInt16Array)); + EXPECT_EQ(opResult1.GetValue().GetTaggedValue(), JSTaggedValue::Undefined()); + EXPECT_EQ(opResult2.GetValue().GetTaggedValue(), JSTaggedValue::Undefined()); + EXPECT_EQ(opResult3.GetValue().GetTaggedValue(), JSTaggedValue::Undefined()); + EXPECT_EQ(opResult4.GetValue().GetTaggedValue(), JSTaggedValue::Undefined()); + +- EXPECT_FALSE(JSTypedArray::IntegerIndexedElementSet(thread, handleTagValInt16Array, JSTaggedValue(-1), +- JSHandle(thread, JSTaggedValue(0)))); +- EXPECT_FALSE(JSTypedArray::IntegerIndexedElementSet(thread, handleTagValInt16Array, ++ EXPECT_FALSE(JSTypedArray::IntegerIndexedElementSet(thread_, handleTagValInt16Array, JSTaggedValue(-1), ++ JSHandle(thread_, JSTaggedValue(0)))); ++ EXPECT_FALSE(JSTypedArray::IntegerIndexedElementSet(thread_, handleTagValInt16Array, + JSTaggedValue(numElementsInt16Array), +- JSHandle(thread, JSTaggedValue(0)))); ++ JSHandle(thread_, JSTaggedValue(0)))); + } + + // Nonstandard input value for Int16Array + TEST_F(JSTypedArrayTest, IntegerIndexedElementSet_Int16Array_002) + { + uint32_t numElementsInt16Array = 16; +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); +- JSHandle handleInt16Array = CreateNumberTypedArray(thread, JSType::JS_INT16_ARRAY); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); ++ JSHandle handleInt16Array = CreateNumberTypedArray(thread_, JSType::JS_INT16_ARRAY); + JSHandle handleTagValInt16Array = JSHandle::Cast(handleInt16Array); + + uint32_t sizeElement = +@@ -712,34 +717,34 @@ TEST_F(JSTypedArrayTest, IntegerIndexedElementSet_Int16Array_002) + uint32_t byteLengthViewdArrayBuffer = sizeElement * numElementsInt16Array; + JSHandle handleTagValArrayBufferFrom = + JSHandle::Cast(factory->NewJSArrayBuffer(byteLengthViewdArrayBuffer)); +- handleInt16Array->SetViewedArrayBuffer(thread, handleTagValArrayBufferFrom); +- handleInt16Array->SetArrayLength(thread, JSTaggedValue(numElementsInt16Array)); ++ handleInt16Array->SetViewedArrayBuffer(thread_, handleTagValArrayBufferFrom); ++ handleInt16Array->SetArrayLength(thread_, JSTaggedValue(numElementsInt16Array)); + + int64_t value1 = -32769; // to int16 : 32767 + int64_t value2 = 32768; // to int16 : -32768 + double value3 = 13.4; // to int16 : 13 + double value4 = 13.6; // to int16 : 13 +- JSHandle handleTagValValueSet1(thread, JSTaggedValue(value1)); +- JSHandle handleTagValValueSet2(thread, JSTaggedValue(value2)); +- JSHandle handleTagValValueSet3(thread, JSTaggedValue(value3)); +- JSHandle handleTagValValueSet4(thread, JSTaggedValue(value4)); ++ JSHandle handleTagValValueSet1(thread_, JSTaggedValue(value1)); ++ JSHandle handleTagValValueSet2(thread_, JSTaggedValue(value2)); ++ JSHandle handleTagValValueSet3(thread_, JSTaggedValue(value3)); ++ JSHandle handleTagValValueSet4(thread_, JSTaggedValue(value4)); + +- EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread, handleTagValInt16Array, JSTaggedValue(0), ++ EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread_, handleTagValInt16Array, JSTaggedValue(0), + handleTagValValueSet1)); + OperationResult opResult1 = +- JSTypedArray::IntegerIndexedElementGet(thread, handleTagValInt16Array, JSTaggedValue(0)); +- EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread, handleTagValInt16Array, JSTaggedValue(0), ++ JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValInt16Array, JSTaggedValue(0)); ++ EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread_, handleTagValInt16Array, JSTaggedValue(0), + handleTagValValueSet2)); + OperationResult opResult2 = +- JSTypedArray::IntegerIndexedElementGet(thread, handleTagValInt16Array, JSTaggedValue(0)); +- EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread, handleTagValInt16Array, JSTaggedValue(0), ++ JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValInt16Array, JSTaggedValue(0)); ++ EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread_, handleTagValInt16Array, JSTaggedValue(0), + handleTagValValueSet3)); + OperationResult opResult3 = +- JSTypedArray::IntegerIndexedElementGet(thread, handleTagValInt16Array, JSTaggedValue(0)); +- EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread, handleTagValInt16Array, JSTaggedValue(0), ++ JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValInt16Array, JSTaggedValue(0)); ++ EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread_, handleTagValInt16Array, JSTaggedValue(0), + handleTagValValueSet4)); + OperationResult opResult4 = +- JSTypedArray::IntegerIndexedElementGet(thread, handleTagValInt16Array, JSTaggedValue(0)); ++ JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValInt16Array, JSTaggedValue(0)); + + EXPECT_NE(value1, opResult1.GetValue().GetTaggedValue().GetNumber()); + EXPECT_NE(value2, opResult2.GetValue().GetTaggedValue().GetNumber()); +@@ -755,8 +760,8 @@ TEST_F(JSTypedArrayTest, IntegerIndexedElementSet_Uint16Array_001) + { + uint32_t numElementsUint16Array = 100; + uint32_t scaleForUint16ValueSet = 100; +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); +- JSHandle handleUint16Array = CreateNumberTypedArray(thread, JSType::JS_UINT16_ARRAY); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); ++ JSHandle handleUint16Array = CreateNumberTypedArray(thread_, JSType::JS_UINT16_ARRAY); + JSHandle handleTagValUint16Array = JSHandle::Cast(handleUint16Array); + + uint32_t sizeElement = +@@ -764,17 +769,17 @@ TEST_F(JSTypedArrayTest, IntegerIndexedElementSet_Uint16Array_001) + uint32_t byteLengthViewdArrayBuffer = sizeElement * numElementsUint16Array; + JSHandle handleTagValArrayBufferFrom = + JSHandle::Cast(factory->NewJSArrayBuffer(byteLengthViewdArrayBuffer)); +- handleUint16Array->SetViewedArrayBuffer(thread, handleTagValArrayBufferFrom); +- handleUint16Array->SetArrayLength(thread, JSTaggedValue(numElementsUint16Array)); ++ handleUint16Array->SetViewedArrayBuffer(thread_, handleTagValArrayBufferFrom); ++ handleUint16Array->SetArrayLength(thread_, JSTaggedValue(numElementsUint16Array)); + + CVector cVecOpResult = {}; + for (uint32_t i = 0; i < numElementsUint16Array; i++) { + EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet( +- thread, handleTagValUint16Array, JSTaggedValue(i), +- JSHandle(thread, ++ thread_, handleTagValUint16Array, JSTaggedValue(i), ++ JSHandle(thread_, + JSTaggedValue(std::numeric_limits::min() + i * scaleForUint16ValueSet)))); + OperationResult opResult = +- JSTypedArray::IntegerIndexedElementGet(thread, handleTagValUint16Array, JSTaggedValue(i)); ++ JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValUint16Array, JSTaggedValue(i)); + cVecOpResult.push_back(opResult); + } + for (uint32_t i = 0; i < numElementsUint16Array; i++) { +@@ -784,31 +789,31 @@ TEST_F(JSTypedArrayTest, IntegerIndexedElementSet_Uint16Array_001) + cVecOpResult.clear(); + + OperationResult opResult1 = +- JSTypedArray::IntegerIndexedElementGet(thread, handleTagValUint16Array, JSTaggedValue(-1)); ++ JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValUint16Array, JSTaggedValue(-1)); + OperationResult opResult2 = +- JSTypedArray::IntegerIndexedElementGet(thread, handleTagValUint16Array, JSTaggedValue(-0.0)); ++ JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValUint16Array, JSTaggedValue(-0.0)); + OperationResult opResult3 = +- JSTypedArray::IntegerIndexedElementGet(thread, handleTagValUint16Array, JSTaggedValue(1.1)); ++ JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValUint16Array, JSTaggedValue(1.1)); + OperationResult opResult4 = +- JSTypedArray::IntegerIndexedElementGet(thread, handleTagValUint16Array, JSTaggedValue(numElementsUint16Array)); ++ JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValUint16Array, JSTaggedValue(numElementsUint16Array)); + EXPECT_EQ(opResult1.GetValue().GetTaggedValue(), JSTaggedValue::Undefined()); + EXPECT_EQ(opResult2.GetValue().GetTaggedValue(), JSTaggedValue::Undefined()); + EXPECT_EQ(opResult3.GetValue().GetTaggedValue(), JSTaggedValue::Undefined()); + EXPECT_EQ(opResult4.GetValue().GetTaggedValue(), JSTaggedValue::Undefined()); + +- EXPECT_FALSE(JSTypedArray::IntegerIndexedElementSet(thread, handleTagValUint16Array, JSTaggedValue(-1), +- JSHandle(thread, JSTaggedValue(0)))); +- EXPECT_FALSE(JSTypedArray::IntegerIndexedElementSet(thread, handleTagValUint16Array, ++ EXPECT_FALSE(JSTypedArray::IntegerIndexedElementSet(thread_, handleTagValUint16Array, JSTaggedValue(-1), ++ JSHandle(thread_, JSTaggedValue(0)))); ++ EXPECT_FALSE(JSTypedArray::IntegerIndexedElementSet(thread_, handleTagValUint16Array, + JSTaggedValue(numElementsUint16Array), +- JSHandle(thread, JSTaggedValue(0)))); ++ JSHandle(thread_, JSTaggedValue(0)))); + } + + // Nonstandard input value for Uint16Array + TEST_F(JSTypedArrayTest, IntegerIndexedElementSet_Uint16Array_002) + { + uint32_t numElementsUint16Array = 16; +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); +- JSHandle handleUint16Array = CreateNumberTypedArray(thread, JSType::JS_UINT16_ARRAY); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); ++ JSHandle handleUint16Array = CreateNumberTypedArray(thread_, JSType::JS_UINT16_ARRAY); + JSHandle handleTagValUint16Array = JSHandle::Cast(handleUint16Array); + + uint32_t sizeElement = +@@ -816,34 +821,34 @@ TEST_F(JSTypedArrayTest, IntegerIndexedElementSet_Uint16Array_002) + uint32_t byteLengthViewdArrayBuffer = sizeElement * numElementsUint16Array; + JSHandle handleTagValArrayBufferFrom = + JSHandle::Cast(factory->NewJSArrayBuffer(byteLengthViewdArrayBuffer)); +- handleUint16Array->SetViewedArrayBuffer(thread, handleTagValArrayBufferFrom); +- handleUint16Array->SetArrayLength(thread, JSTaggedValue(numElementsUint16Array)); ++ handleUint16Array->SetViewedArrayBuffer(thread_, handleTagValArrayBufferFrom); ++ handleUint16Array->SetArrayLength(thread_, JSTaggedValue(numElementsUint16Array)); + + int64_t value1 = -1; // to uint16 : 65535 + int64_t value2 = 65536; // to uint16 : 0 + double value3 = 13.4; // to uint16 : 13 + double value4 = 13.6; // to uint16 : 13 +- JSHandle handleTagValValueSet1(thread, JSTaggedValue(value1)); +- JSHandle handleTagValValueSet2(thread, JSTaggedValue(value2)); +- JSHandle handleTagValValueSet3(thread, JSTaggedValue(value3)); +- JSHandle handleTagValValueSet4(thread, JSTaggedValue(value4)); ++ JSHandle handleTagValValueSet1(thread_, JSTaggedValue(value1)); ++ JSHandle handleTagValValueSet2(thread_, JSTaggedValue(value2)); ++ JSHandle handleTagValValueSet3(thread_, JSTaggedValue(value3)); ++ JSHandle handleTagValValueSet4(thread_, JSTaggedValue(value4)); + +- EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread, handleTagValUint16Array, JSTaggedValue(0), ++ EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread_, handleTagValUint16Array, JSTaggedValue(0), + handleTagValValueSet1)); + OperationResult opResult1 = +- JSTypedArray::IntegerIndexedElementGet(thread, handleTagValUint16Array, JSTaggedValue(0)); +- EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread, handleTagValUint16Array, JSTaggedValue(0), ++ JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValUint16Array, JSTaggedValue(0)); ++ EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread_, handleTagValUint16Array, JSTaggedValue(0), + handleTagValValueSet2)); + OperationResult opResult2 = +- JSTypedArray::IntegerIndexedElementGet(thread, handleTagValUint16Array, JSTaggedValue(0)); +- EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread, handleTagValUint16Array, JSTaggedValue(0), ++ JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValUint16Array, JSTaggedValue(0)); ++ EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread_, handleTagValUint16Array, JSTaggedValue(0), + handleTagValValueSet3)); + OperationResult opResult3 = +- JSTypedArray::IntegerIndexedElementGet(thread, handleTagValUint16Array, JSTaggedValue(0)); +- EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread, handleTagValUint16Array, JSTaggedValue(0), ++ JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValUint16Array, JSTaggedValue(0)); ++ EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread_, handleTagValUint16Array, JSTaggedValue(0), + handleTagValValueSet4)); + OperationResult opResult4 = +- JSTypedArray::IntegerIndexedElementGet(thread, handleTagValUint16Array, JSTaggedValue(0)); ++ JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValUint16Array, JSTaggedValue(0)); + + EXPECT_NE(value1, opResult1.GetValue().GetTaggedValue().GetNumber()); + EXPECT_NE(value2, opResult2.GetValue().GetTaggedValue().GetNumber()); +@@ -859,8 +864,8 @@ TEST_F(JSTypedArrayTest, DISABLED_IntegerIndexedElementSet_Int32Array_001) + { + uint32_t numElementsInt32Array = 100; + int32_t scaleForInt32ValueSet = 100000; +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); +- JSHandle handleInt32Array = CreateNumberTypedArray(thread, JSType::JS_INT32_ARRAY); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); ++ JSHandle handleInt32Array = CreateNumberTypedArray(thread_, JSType::JS_INT32_ARRAY); + JSHandle handleTagValInt32Array = JSHandle::Cast(handleInt32Array); + + uint32_t sizeElement = +@@ -868,17 +873,17 @@ TEST_F(JSTypedArrayTest, DISABLED_IntegerIndexedElementSet_Int32Array_001) + uint32_t byteLengthViewdArrayBuffer = sizeElement * numElementsInt32Array; + JSHandle handleTagValArrayBufferFrom = + JSHandle::Cast(factory->NewJSArrayBuffer(byteLengthViewdArrayBuffer)); +- handleInt32Array->SetViewedArrayBuffer(thread, handleTagValArrayBufferFrom); +- handleInt32Array->SetArrayLength(thread, JSTaggedValue(numElementsInt32Array)); ++ handleInt32Array->SetViewedArrayBuffer(thread_, handleTagValArrayBufferFrom); ++ handleInt32Array->SetArrayLength(thread_, JSTaggedValue(numElementsInt32Array)); + + CVector cVecOpResult = {}; + for (size_t i = 0; i < numElementsInt32Array; i++) { + EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet( +- thread, handleTagValInt32Array, JSTaggedValue(i), +- JSHandle(thread, ++ thread_, handleTagValInt32Array, JSTaggedValue(i), ++ JSHandle(thread_, + JSTaggedValue(std::numeric_limits::min() + i * scaleForInt32ValueSet)))); + OperationResult opResult = +- JSTypedArray::IntegerIndexedElementGet(thread, handleTagValInt32Array, JSTaggedValue(i)); ++ JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValInt32Array, JSTaggedValue(i)); + cVecOpResult.push_back(opResult); + } + for (size_t i = 0; i < numElementsInt32Array; i++) { +@@ -888,31 +893,31 @@ TEST_F(JSTypedArrayTest, DISABLED_IntegerIndexedElementSet_Int32Array_001) + cVecOpResult.clear(); + + OperationResult opResult1 = +- JSTypedArray::IntegerIndexedElementGet(thread, handleTagValInt32Array, JSTaggedValue(-1)); ++ JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValInt32Array, JSTaggedValue(-1)); + OperationResult opResult2 = +- JSTypedArray::IntegerIndexedElementGet(thread, handleTagValInt32Array, JSTaggedValue(-0.0)); ++ JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValInt32Array, JSTaggedValue(-0.0)); + OperationResult opResult3 = +- JSTypedArray::IntegerIndexedElementGet(thread, handleTagValInt32Array, JSTaggedValue(1.1)); ++ JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValInt32Array, JSTaggedValue(1.1)); + OperationResult opResult4 = +- JSTypedArray::IntegerIndexedElementGet(thread, handleTagValInt32Array, JSTaggedValue(numElementsInt32Array)); ++ JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValInt32Array, JSTaggedValue(numElementsInt32Array)); + EXPECT_EQ(opResult1.GetValue().GetTaggedValue(), JSTaggedValue::Undefined()); + EXPECT_EQ(opResult2.GetValue().GetTaggedValue(), JSTaggedValue::Undefined()); + EXPECT_EQ(opResult3.GetValue().GetTaggedValue(), JSTaggedValue::Undefined()); + EXPECT_EQ(opResult4.GetValue().GetTaggedValue(), JSTaggedValue::Undefined()); + +- EXPECT_FALSE(JSTypedArray::IntegerIndexedElementSet(thread, handleTagValInt32Array, JSTaggedValue(-1), +- JSHandle(thread, JSTaggedValue(0)))); +- EXPECT_FALSE(JSTypedArray::IntegerIndexedElementSet(thread, handleTagValInt32Array, ++ EXPECT_FALSE(JSTypedArray::IntegerIndexedElementSet(thread_, handleTagValInt32Array, JSTaggedValue(-1), ++ JSHandle(thread_, JSTaggedValue(0)))); ++ EXPECT_FALSE(JSTypedArray::IntegerIndexedElementSet(thread_, handleTagValInt32Array, + JSTaggedValue(numElementsInt32Array), +- JSHandle(thread, JSTaggedValue(0)))); ++ JSHandle(thread_, JSTaggedValue(0)))); + } + + // Nonstandard input value for Int32Array + TEST_F(JSTypedArrayTest, IntegerIndexedElementSet_Int32Array_002) + { + uint32_t numElementsInt32Array = 16; +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); +- JSHandle handleInt32Array = CreateNumberTypedArray(thread, JSType::JS_INT32_ARRAY); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); ++ JSHandle handleInt32Array = CreateNumberTypedArray(thread_, JSType::JS_INT32_ARRAY); + JSHandle handleTagValInt32Array = JSHandle::Cast(handleInt32Array); + + uint32_t sizeElement = +@@ -920,34 +925,34 @@ TEST_F(JSTypedArrayTest, IntegerIndexedElementSet_Int32Array_002) + uint32_t byteLengthViewdArrayBuffer = sizeElement * numElementsInt32Array; + JSHandle handleTagValArrayBufferFrom = + JSHandle::Cast(factory->NewJSArrayBuffer(byteLengthViewdArrayBuffer)); +- handleInt32Array->SetViewedArrayBuffer(thread, handleTagValArrayBufferFrom); +- handleInt32Array->SetArrayLength(thread, JSTaggedValue(numElementsInt32Array)); ++ handleInt32Array->SetViewedArrayBuffer(thread_, handleTagValArrayBufferFrom); ++ handleInt32Array->SetArrayLength(thread_, JSTaggedValue(numElementsInt32Array)); + + int64_t value1 = -2147483649; // to int32 : 2147483647 + int64_t value2 = 2147483648; // to int32 : -2147483648 + double value3 = 13.4; // to int32 : 13 + double value4 = 13.6; // to int32 : 13 +- JSHandle handleTagValValueSet1(thread, JSTaggedValue(value1)); +- JSHandle handleTagValValueSet2(thread, JSTaggedValue(value2)); +- JSHandle handleTagValValueSet3(thread, JSTaggedValue(value3)); +- JSHandle handleTagValValueSet4(thread, JSTaggedValue(value4)); ++ JSHandle handleTagValValueSet1(thread_, JSTaggedValue(value1)); ++ JSHandle handleTagValValueSet2(thread_, JSTaggedValue(value2)); ++ JSHandle handleTagValValueSet3(thread_, JSTaggedValue(value3)); ++ JSHandle handleTagValValueSet4(thread_, JSTaggedValue(value4)); + +- EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread, handleTagValInt32Array, JSTaggedValue(0), ++ EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread_, handleTagValInt32Array, JSTaggedValue(0), + handleTagValValueSet1)); + OperationResult opResult1 = +- JSTypedArray::IntegerIndexedElementGet(thread, handleTagValInt32Array, JSTaggedValue(0)); +- EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread, handleTagValInt32Array, JSTaggedValue(0), ++ JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValInt32Array, JSTaggedValue(0)); ++ EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread_, handleTagValInt32Array, JSTaggedValue(0), + handleTagValValueSet2)); + OperationResult opResult2 = +- JSTypedArray::IntegerIndexedElementGet(thread, handleTagValInt32Array, JSTaggedValue(0)); +- EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread, handleTagValInt32Array, JSTaggedValue(0), ++ JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValInt32Array, JSTaggedValue(0)); ++ EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread_, handleTagValInt32Array, JSTaggedValue(0), + handleTagValValueSet3)); + OperationResult opResult3 = +- JSTypedArray::IntegerIndexedElementGet(thread, handleTagValInt32Array, JSTaggedValue(0)); +- EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread, handleTagValInt32Array, JSTaggedValue(0), ++ JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValInt32Array, JSTaggedValue(0)); ++ EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread_, handleTagValInt32Array, JSTaggedValue(0), + handleTagValValueSet4)); + OperationResult opResult4 = +- JSTypedArray::IntegerIndexedElementGet(thread, handleTagValInt32Array, JSTaggedValue(0)); ++ JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValInt32Array, JSTaggedValue(0)); + + EXPECT_NE(value1, opResult1.GetValue().GetTaggedValue().GetNumber()); + EXPECT_NE(value2, opResult2.GetValue().GetTaggedValue().GetNumber()); +@@ -963,8 +968,8 @@ TEST_F(JSTypedArrayTest, IntegerIndexedElementSet_Uint32Array_001) + { + uint32_t numElementsUint32Array = 100; + uint32_t scaleForUint32ValueSet = 100000; +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); +- JSHandle handleUint32Array = CreateNumberTypedArray(thread, JSType::JS_UINT32_ARRAY); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); ++ JSHandle handleUint32Array = CreateNumberTypedArray(thread_, JSType::JS_UINT32_ARRAY); + JSHandle handleTagValUint32Array = JSHandle::Cast(handleUint32Array); + + uint32_t sizeElement = +@@ -972,17 +977,17 @@ TEST_F(JSTypedArrayTest, IntegerIndexedElementSet_Uint32Array_001) + uint32_t byteLengthViewdArrayBuffer = sizeElement * numElementsUint32Array; + JSHandle handleTagValArrayBufferFrom = + JSHandle::Cast(factory->NewJSArrayBuffer(byteLengthViewdArrayBuffer)); +- handleUint32Array->SetViewedArrayBuffer(thread, handleTagValArrayBufferFrom); +- handleUint32Array->SetArrayLength(thread, JSTaggedValue(numElementsUint32Array)); ++ handleUint32Array->SetViewedArrayBuffer(thread_, handleTagValArrayBufferFrom); ++ handleUint32Array->SetArrayLength(thread_, JSTaggedValue(numElementsUint32Array)); + + CVector cVecOpResult = {}; + for (uint32_t i = 0; i < numElementsUint32Array; i++) { + EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet( +- thread, handleTagValUint32Array, JSTaggedValue(i), +- JSHandle(thread, ++ thread_, handleTagValUint32Array, JSTaggedValue(i), ++ JSHandle(thread_, + JSTaggedValue(std::numeric_limits::min() + i * scaleForUint32ValueSet)))); + OperationResult opResult = +- JSTypedArray::IntegerIndexedElementGet(thread, handleTagValUint32Array, JSTaggedValue(i)); ++ JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValUint32Array, JSTaggedValue(i)); + cVecOpResult.push_back(opResult); + } + for (uint32_t i = 0; i < numElementsUint32Array; i++) { +@@ -992,31 +997,31 @@ TEST_F(JSTypedArrayTest, IntegerIndexedElementSet_Uint32Array_001) + cVecOpResult.clear(); + + OperationResult opResult1 = +- JSTypedArray::IntegerIndexedElementGet(thread, handleTagValUint32Array, JSTaggedValue(-1)); ++ JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValUint32Array, JSTaggedValue(-1)); + OperationResult opResult2 = +- JSTypedArray::IntegerIndexedElementGet(thread, handleTagValUint32Array, JSTaggedValue(-0.0)); ++ JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValUint32Array, JSTaggedValue(-0.0)); + OperationResult opResult3 = +- JSTypedArray::IntegerIndexedElementGet(thread, handleTagValUint32Array, JSTaggedValue(1.1)); ++ JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValUint32Array, JSTaggedValue(1.1)); + OperationResult opResult4 = +- JSTypedArray::IntegerIndexedElementGet(thread, handleTagValUint32Array, JSTaggedValue(numElementsUint32Array)); ++ JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValUint32Array, JSTaggedValue(numElementsUint32Array)); + EXPECT_EQ(opResult1.GetValue().GetTaggedValue(), JSTaggedValue::Undefined()); + EXPECT_EQ(opResult2.GetValue().GetTaggedValue(), JSTaggedValue::Undefined()); + EXPECT_EQ(opResult3.GetValue().GetTaggedValue(), JSTaggedValue::Undefined()); + EXPECT_EQ(opResult4.GetValue().GetTaggedValue(), JSTaggedValue::Undefined()); + +- EXPECT_FALSE(JSTypedArray::IntegerIndexedElementSet(thread, handleTagValUint32Array, JSTaggedValue(-1), +- JSHandle(thread, JSTaggedValue(0)))); +- EXPECT_FALSE(JSTypedArray::IntegerIndexedElementSet(thread, handleTagValUint32Array, ++ EXPECT_FALSE(JSTypedArray::IntegerIndexedElementSet(thread_, handleTagValUint32Array, JSTaggedValue(-1), ++ JSHandle(thread_, JSTaggedValue(0)))); ++ EXPECT_FALSE(JSTypedArray::IntegerIndexedElementSet(thread_, handleTagValUint32Array, + JSTaggedValue(numElementsUint32Array), +- JSHandle(thread, JSTaggedValue(0)))); ++ JSHandle(thread_, JSTaggedValue(0)))); + } + + // Nonstandard input value for Uint32Array + TEST_F(JSTypedArrayTest, IntegerIndexedElementSet_Uint32Array_002) + { + int32_t numElementsUint32Array = 16; +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); +- JSHandle handleUint32Array = CreateNumberTypedArray(thread, JSType::JS_UINT32_ARRAY); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); ++ JSHandle handleUint32Array = CreateNumberTypedArray(thread_, JSType::JS_UINT32_ARRAY); + JSHandle handleTagValUint32Array = JSHandle::Cast(handleUint32Array); + + uint32_t sizeElement = +@@ -1024,34 +1029,34 @@ TEST_F(JSTypedArrayTest, IntegerIndexedElementSet_Uint32Array_002) + int32_t byteLengthViewdArrayBuffer = sizeElement * numElementsUint32Array; + JSHandle handleTagValArrayBufferFrom = + JSHandle::Cast(factory->NewJSArrayBuffer(byteLengthViewdArrayBuffer)); +- handleUint32Array->SetViewedArrayBuffer(thread, handleTagValArrayBufferFrom); +- handleUint32Array->SetArrayLength(thread, JSTaggedValue(numElementsUint32Array)); ++ handleUint32Array->SetViewedArrayBuffer(thread_, handleTagValArrayBufferFrom); ++ handleUint32Array->SetArrayLength(thread_, JSTaggedValue(numElementsUint32Array)); + + int64_t value1 = -1; // to uint32 : 4294967295 + int64_t value2 = 4294967296; // to uint32 : 0 + double value3 = 13.4; // to uint32 : 13 + double value4 = 13.6; // to uint32 : 13 +- JSHandle handleTagValValueSet1(thread, JSTaggedValue(value1)); +- JSHandle handleTagValValueSet2(thread, JSTaggedValue(value2)); +- JSHandle handleTagValValueSet3(thread, JSTaggedValue(value3)); +- JSHandle handleTagValValueSet4(thread, JSTaggedValue(value4)); ++ JSHandle handleTagValValueSet1(thread_, JSTaggedValue(value1)); ++ JSHandle handleTagValValueSet2(thread_, JSTaggedValue(value2)); ++ JSHandle handleTagValValueSet3(thread_, JSTaggedValue(value3)); ++ JSHandle handleTagValValueSet4(thread_, JSTaggedValue(value4)); + +- EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread, handleTagValUint32Array, JSTaggedValue(0), ++ EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread_, handleTagValUint32Array, JSTaggedValue(0), + handleTagValValueSet1)); + OperationResult opResult1 = +- JSTypedArray::IntegerIndexedElementGet(thread, handleTagValUint32Array, JSTaggedValue(0)); +- EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread, handleTagValUint32Array, JSTaggedValue(0), ++ JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValUint32Array, JSTaggedValue(0)); ++ EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread_, handleTagValUint32Array, JSTaggedValue(0), + handleTagValValueSet2)); + OperationResult opResult2 = +- JSTypedArray::IntegerIndexedElementGet(thread, handleTagValUint32Array, JSTaggedValue(0)); +- EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread, handleTagValUint32Array, JSTaggedValue(0), ++ JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValUint32Array, JSTaggedValue(0)); ++ EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread_, handleTagValUint32Array, JSTaggedValue(0), + handleTagValValueSet3)); + OperationResult opResult3 = +- JSTypedArray::IntegerIndexedElementGet(thread, handleTagValUint32Array, JSTaggedValue(0)); +- EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread, handleTagValUint32Array, JSTaggedValue(0), ++ JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValUint32Array, JSTaggedValue(0)); ++ EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread_, handleTagValUint32Array, JSTaggedValue(0), + handleTagValValueSet4)); + OperationResult opResult4 = +- JSTypedArray::IntegerIndexedElementGet(thread, handleTagValUint32Array, JSTaggedValue(0)); ++ JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValUint32Array, JSTaggedValue(0)); + + EXPECT_NE(value1, opResult1.GetValue().GetTaggedValue().GetNumber()); + EXPECT_NE(value2, opResult2.GetValue().GetTaggedValue().GetNumber()); +@@ -1066,8 +1071,8 @@ TEST_F(JSTypedArrayTest, IntegerIndexedElementSet_Uint32Array_002) + TEST_F(JSTypedArrayTest, IntegerIndexedElementSet_Float32Array) + { + uint32_t numElementsFloat32Array = 100; +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); +- JSHandle handleFloat32Array = CreateNumberTypedArray(thread, JSType::JS_FLOAT32_ARRAY); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); ++ JSHandle handleFloat32Array = CreateNumberTypedArray(thread_, JSType::JS_FLOAT32_ARRAY); + JSHandle handleTagValFloat32Array = JSHandle::Cast(handleFloat32Array); + + uint32_t sizeElement = +@@ -1075,18 +1080,18 @@ TEST_F(JSTypedArrayTest, IntegerIndexedElementSet_Float32Array) + uint32_t byteLengthViewdArrayBuffer = sizeElement * numElementsFloat32Array; + JSHandle handleTagValArrayBufferFrom = + JSHandle::Cast(factory->NewJSArrayBuffer(byteLengthViewdArrayBuffer)); +- handleFloat32Array->SetViewedArrayBuffer(thread, handleTagValArrayBufferFrom); +- handleFloat32Array->SetArrayLength(thread, JSTaggedValue(numElementsFloat32Array)); ++ handleFloat32Array->SetViewedArrayBuffer(thread_, handleTagValArrayBufferFrom); ++ handleFloat32Array->SetArrayLength(thread_, JSTaggedValue(numElementsFloat32Array)); + + CVector cVecOpResult = {}; + float floatMaxValue = std::numeric_limits::max(); + for (uint32_t i = 0; i < numElementsFloat32Array; i++) { + EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet( +- thread, handleTagValFloat32Array, JSTaggedValue(i), +- JSHandle(thread, ++ thread_, handleTagValFloat32Array, JSTaggedValue(i), ++ JSHandle(thread_, + JSTaggedValue(floatMaxValue - (i * (floatMaxValue / numElementsFloat32Array)))))); + OperationResult opResult = +- JSTypedArray::IntegerIndexedElementGet(thread, handleTagValFloat32Array, JSTaggedValue(i)); ++ JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValFloat32Array, JSTaggedValue(i)); + cVecOpResult.push_back(opResult); + } + for (uint32_t i = 0; i < numElementsFloat32Array; i++) { +@@ -1096,30 +1101,30 @@ TEST_F(JSTypedArrayTest, IntegerIndexedElementSet_Float32Array) + cVecOpResult.clear(); + + OperationResult opResult1 = +- JSTypedArray::IntegerIndexedElementGet(thread, handleTagValFloat32Array, JSTaggedValue(-1)); ++ JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValFloat32Array, JSTaggedValue(-1)); + OperationResult opResult2 = +- JSTypedArray::IntegerIndexedElementGet(thread, handleTagValFloat32Array, JSTaggedValue(-0.0)); ++ JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValFloat32Array, JSTaggedValue(-0.0)); + OperationResult opResult3 = +- JSTypedArray::IntegerIndexedElementGet(thread, handleTagValFloat32Array, JSTaggedValue(1.1)); +- OperationResult opResult4 = JSTypedArray::IntegerIndexedElementGet(thread, handleTagValFloat32Array, ++ JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValFloat32Array, JSTaggedValue(1.1)); ++ OperationResult opResult4 = JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValFloat32Array, + JSTaggedValue(numElementsFloat32Array)); + EXPECT_EQ(opResult1.GetValue().GetTaggedValue(), JSTaggedValue::Undefined()); + EXPECT_EQ(opResult2.GetValue().GetTaggedValue(), JSTaggedValue::Undefined()); + EXPECT_EQ(opResult3.GetValue().GetTaggedValue(), JSTaggedValue::Undefined()); + EXPECT_EQ(opResult4.GetValue().GetTaggedValue(), JSTaggedValue::Undefined()); + +- EXPECT_FALSE(JSTypedArray::IntegerIndexedElementSet(thread, handleTagValFloat32Array, JSTaggedValue(-1), +- JSHandle(thread, JSTaggedValue(0)))); +- EXPECT_FALSE(JSTypedArray::IntegerIndexedElementSet(thread, handleTagValFloat32Array, ++ EXPECT_FALSE(JSTypedArray::IntegerIndexedElementSet(thread_, handleTagValFloat32Array, JSTaggedValue(-1), ++ JSHandle(thread_, JSTaggedValue(0)))); ++ EXPECT_FALSE(JSTypedArray::IntegerIndexedElementSet(thread_, handleTagValFloat32Array, + JSTaggedValue(numElementsFloat32Array), +- JSHandle(thread, JSTaggedValue(0)))); ++ JSHandle(thread_, JSTaggedValue(0)))); + } + + TEST_F(JSTypedArrayTest, IntegerIndexedElementSet_Float64Array) + { + uint32_t numElementsFloat64Array = 100; +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); +- JSHandle handleFloat64Array = CreateNumberTypedArray(thread, JSType::JS_FLOAT64_ARRAY); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); ++ JSHandle handleFloat64Array = CreateNumberTypedArray(thread_, JSType::JS_FLOAT64_ARRAY); + JSHandle handleTagValFloat64Array = JSHandle::Cast(handleFloat64Array); + + uint32_t sizeElement = +@@ -1127,18 +1132,18 @@ TEST_F(JSTypedArrayTest, IntegerIndexedElementSet_Float64Array) + uint32_t byteLengthViewdArrayBuffer = sizeElement * numElementsFloat64Array; + JSHandle handleTagValArrayBufferFrom = + JSHandle::Cast(factory->NewJSArrayBuffer(byteLengthViewdArrayBuffer)); +- handleFloat64Array->SetViewedArrayBuffer(thread, handleTagValArrayBufferFrom); +- handleFloat64Array->SetArrayLength(thread, JSTaggedValue(numElementsFloat64Array)); ++ handleFloat64Array->SetViewedArrayBuffer(thread_, handleTagValArrayBufferFrom); ++ handleFloat64Array->SetArrayLength(thread_, JSTaggedValue(numElementsFloat64Array)); + + CVector cVecOpResult = {}; + double doubleMaxValue = std::numeric_limits::max(); + for (uint32_t i = 0; i < numElementsFloat64Array; i++) { + EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet( +- thread, handleTagValFloat64Array, JSTaggedValue(i), +- JSHandle(thread, ++ thread_, handleTagValFloat64Array, JSTaggedValue(i), ++ JSHandle(thread_, + JSTaggedValue(doubleMaxValue - (i * (doubleMaxValue / numElementsFloat64Array)))))); + OperationResult opResult = +- JSTypedArray::IntegerIndexedElementGet(thread, handleTagValFloat64Array, JSTaggedValue(i)); ++ JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValFloat64Array, JSTaggedValue(i)); + cVecOpResult.push_back(opResult); + } + for (uint32_t i = 0; i < numElementsFloat64Array; i++) { +@@ -1148,23 +1153,23 @@ TEST_F(JSTypedArrayTest, IntegerIndexedElementSet_Float64Array) + cVecOpResult.clear(); + + OperationResult opResult1 = +- JSTypedArray::IntegerIndexedElementGet(thread, handleTagValFloat64Array, JSTaggedValue(-1)); ++ JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValFloat64Array, JSTaggedValue(-1)); + OperationResult opResult2 = +- JSTypedArray::IntegerIndexedElementGet(thread, handleTagValFloat64Array, JSTaggedValue(-0.0)); ++ JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValFloat64Array, JSTaggedValue(-0.0)); + OperationResult opResult3 = +- JSTypedArray::IntegerIndexedElementGet(thread, handleTagValFloat64Array, JSTaggedValue(1.1)); +- OperationResult opResult4 = JSTypedArray::IntegerIndexedElementGet(thread, handleTagValFloat64Array, ++ JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValFloat64Array, JSTaggedValue(1.1)); ++ OperationResult opResult4 = JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValFloat64Array, + JSTaggedValue(numElementsFloat64Array)); + EXPECT_EQ(opResult1.GetValue().GetTaggedValue(), JSTaggedValue::Undefined()); + EXPECT_EQ(opResult2.GetValue().GetTaggedValue(), JSTaggedValue::Undefined()); + EXPECT_EQ(opResult3.GetValue().GetTaggedValue(), JSTaggedValue::Undefined()); + EXPECT_EQ(opResult4.GetValue().GetTaggedValue(), JSTaggedValue::Undefined()); + +- EXPECT_FALSE(JSTypedArray::IntegerIndexedElementSet(thread, handleTagValFloat64Array, JSTaggedValue(-1), +- JSHandle(thread, JSTaggedValue(0)))); +- EXPECT_FALSE(JSTypedArray::IntegerIndexedElementSet(thread, handleTagValFloat64Array, ++ EXPECT_FALSE(JSTypedArray::IntegerIndexedElementSet(thread_, handleTagValFloat64Array, JSTaggedValue(-1), ++ JSHandle(thread_, JSTaggedValue(0)))); ++ EXPECT_FALSE(JSTypedArray::IntegerIndexedElementSet(thread_, handleTagValFloat64Array, + JSTaggedValue(numElementsFloat64Array), +- JSHandle(thread, JSTaggedValue(0)))); ++ JSHandle(thread_, JSTaggedValue(0)))); + } + + /* +@@ -1177,11 +1182,11 @@ TEST_F(JSTypedArrayTest, IntegerIndexedElementSet_Float64Array) + */ + TEST_F(JSTypedArrayTest, FastElementGet_TypedArray) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + +- for (uint32_t j = 0; j < cVecJSType.size(); j++) { ++ for (uint32_t j = 0; j < c_vec_js_type_.size(); j++) { + uint32_t numElementsTypedArray = 10; +- JSHandle handleTypedArray = CreateNumberTypedArray(thread, cVecJSType.at(j)); ++ JSHandle handleTypedArray = CreateNumberTypedArray(thread_, c_vec_js_type_.at(j)); + JSHandle handleTagValTypedArray = JSHandle::Cast(handleTypedArray); + + uint32_t sizeElement = +@@ -1189,22 +1194,24 @@ TEST_F(JSTypedArrayTest, FastElementGet_TypedArray) + uint32_t byteLengthViewdArrayBuffer = sizeElement * numElementsTypedArray; + JSHandle handleTagValArrayBufferFrom = + JSHandle::Cast(factory->NewJSArrayBuffer(byteLengthViewdArrayBuffer)); +- handleTypedArray->SetViewedArrayBuffer(thread, handleTagValArrayBufferFrom); +- handleTypedArray->SetArrayLength(thread, JSTaggedValue(numElementsTypedArray)); ++ handleTypedArray->SetViewedArrayBuffer(thread_, handleTagValArrayBufferFrom); ++ handleTypedArray->SetArrayLength(thread_, JSTaggedValue(numElementsTypedArray)); + +- JSHandle handleTagValValueSet(thread, JSTaggedValue(cVecHandleTagValValueForTypedArray.at(j))); ++ JSHandle handleTagValValueSet(thread_, ++ JSTaggedValue(c_vec_handle_tag_val_value_for_typed_array_.at(j))); + for (uint32_t i = 0; i < numElementsTypedArray; i++) { +- EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread, handleTagValTypedArray, JSTaggedValue(i), ++ EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread_, handleTagValTypedArray, JSTaggedValue(i), + handleTagValValueSet)); + } + for (uint32_t i = 0; i < numElementsTypedArray; i++) { +- OperationResult opResult = JSTypedArray::FastElementGet(thread, handleTagValTypedArray, i); ++ OperationResult opResult = JSTypedArray::FastElementGet(thread_, handleTagValTypedArray, i); + EXPECT_EQ(opResult.GetValue().GetTaggedValue().GetNumber(), + handleTagValValueSet.GetTaggedValue().GetNumber()); + } + +- OperationResult opResult1 = JSTypedArray::FastElementGet(thread, handleTagValTypedArray, -1); +- OperationResult opResult2 = JSTypedArray::FastElementGet(thread, handleTagValTypedArray, numElementsTypedArray); ++ OperationResult opResult1 = JSTypedArray::FastElementGet(thread_, handleTagValTypedArray, -1); ++ OperationResult opResult2 = ++ JSTypedArray::FastElementGet(thread_, handleTagValTypedArray, numElementsTypedArray); + EXPECT_EQ(opResult1.GetValue().GetTaggedValue(), JSTaggedValue::Undefined()); + EXPECT_EQ(opResult2.GetValue().GetTaggedValue(), JSTaggedValue::Undefined()); + } +@@ -1223,13 +1230,13 @@ TEST_F(JSTypedArrayTest, FastElementGet_TypedArray) + */ + TEST_F(JSTypedArrayTest, DefineOwnProperty_TypedArray) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + +- for (size_t j = 0; j < cVecJSType.size(); j++) { ++ for (size_t j = 0; j < c_vec_js_type_.size(); j++) { + int32_t numElementsTypedArray = 10; +- JSHandle handleTagValValueDef(thread, cVecHandleTagValValueForTypedArray.at(j)); +- PropertyDescriptor descFrom1(thread, handleTagValValueDef, true, true, true); +- JSHandle handleTypedArray = CreateNumberTypedArray(thread, cVecJSType.at(j)); ++ JSHandle handleTagValValueDef(thread_, c_vec_handle_tag_val_value_for_typed_array_.at(j)); ++ PropertyDescriptor descFrom1(thread_, handleTagValValueDef, true, true, true); ++ JSHandle handleTypedArray = CreateNumberTypedArray(thread_, c_vec_js_type_.at(j)); + JSHandle handleTagValTypedArray = JSHandle::Cast(handleTypedArray); + + uint32_t sizeElement = +@@ -1237,24 +1244,24 @@ TEST_F(JSTypedArrayTest, DefineOwnProperty_TypedArray) + int32_t byteLengthViewdArrayBuffer = sizeElement * numElementsTypedArray; + JSHandle handleTagValArrayBufferFrom = + JSHandle::Cast(factory->NewJSArrayBuffer(byteLengthViewdArrayBuffer)); +- handleTypedArray->SetViewedArrayBuffer(thread, handleTagValArrayBufferFrom); +- handleTypedArray->SetArrayLength(thread, JSTaggedValue(numElementsTypedArray)); ++ handleTypedArray->SetViewedArrayBuffer(thread_, handleTagValArrayBufferFrom); ++ handleTypedArray->SetArrayLength(thread_, JSTaggedValue(numElementsTypedArray)); + + for (int32_t i = 0; i < numElementsTypedArray; i++) { +- JSHandle handleTagValKey(thread, JSTaggedValue(i)); +- EXPECT_FALSE(JSTypedArray::HasProperty(thread, handleTagValTypedArray, handleTagValKey)); +- EXPECT_TRUE(JSTypedArray::DefineOwnProperty(thread, handleTagValTypedArray, handleTagValKey, descFrom1)); +- EXPECT_TRUE(JSTypedArray::HasProperty(thread, handleTagValTypedArray, handleTagValKey)); ++ JSHandle handleTagValKey(thread_, JSTaggedValue(i)); ++ EXPECT_FALSE(JSTypedArray::HasProperty(thread_, handleTagValTypedArray, handleTagValKey)); ++ EXPECT_TRUE(JSTypedArray::DefineOwnProperty(thread_, handleTagValTypedArray, handleTagValKey, descFrom1)); ++ EXPECT_TRUE(JSTypedArray::HasProperty(thread_, handleTagValTypedArray, handleTagValKey)); + EXPECT_TRUE(JSTaggedValue::StrictEqual( +- thread, handleTagValValueDef, +- JSTypedArray::GetProperty(thread, handleTagValTypedArray, handleTagValKey).GetValue())); ++ thread_, handleTagValValueDef, ++ JSTypedArray::GetProperty(thread_, handleTagValTypedArray, handleTagValKey).GetValue())); + +- PropertyDescriptor descTo1(thread); ++ PropertyDescriptor descTo1(thread_); + EXPECT_FALSE(descTo1.HasWritable() || descTo1.HasEnumerable() || descTo1.HasConfigurable()); +- EXPECT_TRUE(JSTypedArray::GetOwnProperty(thread, handleTagValTypedArray, handleTagValKey, descTo1)); ++ EXPECT_TRUE(JSTypedArray::GetOwnProperty(thread_, handleTagValTypedArray, handleTagValKey, descTo1)); + EXPECT_TRUE(descTo1.HasWritable() && descTo1.HasEnumerable() && descTo1.HasConfigurable()); + EXPECT_TRUE(descTo1.IsWritable() && descTo1.IsEnumerable() && descTo1.IsConfigurable()); +- EXPECT_TRUE(JSTaggedValue::StrictEqual(thread, descTo1.GetValue(), handleTagValValueDef)); ++ EXPECT_TRUE(JSTaggedValue::StrictEqual(thread_, descTo1.GetValue(), handleTagValValueDef)); + } + } + } +@@ -1272,12 +1279,12 @@ TEST_F(JSTypedArrayTest, DefineOwnProperty_TypedArray) + */ + TEST_F(JSTypedArrayTest, SetProperty_TypedArray) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + +- for (size_t j = 0; j < cVecJSType.size(); j++) { ++ for (size_t j = 0; j < c_vec_js_type_.size(); j++) { + int32_t numElementsTypedArray = 10; +- JSHandle handleTagValValueSet(thread, cVecHandleTagValValueForTypedArray.at(j)); +- JSHandle handleTypedArray = CreateNumberTypedArray(thread, cVecJSType.at(j)); ++ JSHandle handleTagValValueSet(thread_, c_vec_handle_tag_val_value_for_typed_array_.at(j)); ++ JSHandle handleTypedArray = CreateNumberTypedArray(thread_, c_vec_js_type_.at(j)); + JSHandle handleTagValTypedArray = JSHandle::Cast(handleTypedArray); + + uint32_t sizeElement = +@@ -1285,18 +1292,18 @@ TEST_F(JSTypedArrayTest, SetProperty_TypedArray) + int32_t byteLengthViewdArrayBuffer = sizeElement * numElementsTypedArray; + JSHandle handleTagValArrayBufferFrom = + JSHandle::Cast(factory->NewJSArrayBuffer(byteLengthViewdArrayBuffer)); +- handleTypedArray->SetViewedArrayBuffer(thread, handleTagValArrayBufferFrom); +- handleTypedArray->SetArrayLength(thread, JSTaggedValue(numElementsTypedArray)); ++ handleTypedArray->SetViewedArrayBuffer(thread_, handleTagValArrayBufferFrom); ++ handleTypedArray->SetArrayLength(thread_, JSTaggedValue(numElementsTypedArray)); + + for (int32_t i = 0; i < numElementsTypedArray; i++) { +- JSHandle handleTagValKey(thread, JSTaggedValue(i)); +- EXPECT_FALSE(JSTypedArray::HasProperty(thread, handleTagValTypedArray, handleTagValKey)); ++ JSHandle handleTagValKey(thread_, JSTaggedValue(i)); ++ EXPECT_FALSE(JSTypedArray::HasProperty(thread_, handleTagValTypedArray, handleTagValKey)); + EXPECT_TRUE( +- JSTypedArray::SetProperty(thread, handleTagValTypedArray, handleTagValKey, handleTagValValueSet)); +- EXPECT_TRUE(JSTypedArray::HasProperty(thread, handleTagValTypedArray, handleTagValKey)); ++ JSTypedArray::SetProperty(thread_, handleTagValTypedArray, handleTagValKey, handleTagValValueSet)); ++ EXPECT_TRUE(JSTypedArray::HasProperty(thread_, handleTagValTypedArray, handleTagValKey)); + EXPECT_TRUE(JSTaggedValue::StrictEqual( +- thread, handleTagValValueSet, +- JSTypedArray::GetProperty(thread, handleTagValTypedArray, handleTagValKey).GetValue())); ++ thread_, handleTagValValueSet, ++ JSTypedArray::GetProperty(thread_, handleTagValTypedArray, handleTagValKey).GetValue())); + } + } + } +@@ -1314,12 +1321,12 @@ TEST_F(JSTypedArrayTest, SetProperty_TypedArray) + */ + TEST_F(JSTypedArrayTest, FastCopyElementToArray_TypedArray) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + +- for (size_t j = 0; j < cVecJSType.size(); j++) { ++ for (size_t j = 0; j < c_vec_js_type_.size(); j++) { + int32_t numElementsTypedArray = 10; +- JSHandle handleTagValValueSet(thread, cVecHandleTagValValueForTypedArray.at(j)); +- JSHandle handleTypedArrayFrom = CreateNumberTypedArray(thread, cVecJSType.at(j)); ++ JSHandle handleTagValValueSet(thread_, c_vec_handle_tag_val_value_for_typed_array_.at(j)); ++ JSHandle handleTypedArrayFrom = CreateNumberTypedArray(thread_, c_vec_js_type_.at(j)); + JSHandle handleTagValTypedArrayFrom = JSHandle::Cast(handleTypedArrayFrom); + + uint32_t sizeElement = +@@ -1328,14 +1335,14 @@ TEST_F(JSTypedArrayTest, FastCopyElementToArray_TypedArray) + JSHandle handleTagValArrayBuffer = + JSHandle::Cast(factory->NewJSArrayBuffer(byteLengthViewdArrayBuffer)); + JSHandle handleTagArrTo = factory->NewTaggedArray(byteLengthViewdArrayBuffer); +- handleTypedArrayFrom->SetViewedArrayBuffer(thread, handleTagValArrayBuffer); +- handleTypedArrayFrom->SetArrayLength(thread, JSTaggedValue(numElementsTypedArray)); ++ handleTypedArrayFrom->SetViewedArrayBuffer(thread_, handleTagValArrayBuffer); ++ handleTypedArrayFrom->SetArrayLength(thread_, JSTaggedValue(numElementsTypedArray)); + + for (int32_t i = 0; i < numElementsTypedArray; i++) { +- EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread, handleTagValTypedArrayFrom, JSTaggedValue(i), ++ EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread_, handleTagValTypedArrayFrom, JSTaggedValue(i), + handleTagValValueSet)); + } +- EXPECT_TRUE(JSTypedArray::FastCopyElementToArray(thread, handleTagValTypedArrayFrom, handleTagArrTo)); ++ EXPECT_TRUE(JSTypedArray::FastCopyElementToArray(thread_, handleTagValTypedArrayFrom, handleTagArrTo)); + for (int32_t i = 0; i < numElementsTypedArray; i++) { + EXPECT_EQ(handleTagArrTo->Get(i), handleTagValValueSet.GetTaggedValue()); + } +diff --git a/tests/runtime/common/js_verification_test.cpp b/tests/runtime/common/js_verification_test.cpp +index 84b1f70..7f4fab3 100644 +--- a/tests/runtime/common/js_verification_test.cpp ++++ b/tests/runtime/common/js_verification_test.cpp +@@ -37,22 +37,22 @@ class JSVerificationTest : public testing::Test { + public: + void SetUp() override + { +- TestHelper::CreateEcmaVMWithScope(instance, thread, scope); ++ TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); + } + + void TearDown() override + { +- TestHelper::DestroyEcmaVMWithScope(instance, scope); ++ TestHelper::DestroyEcmaVMWithScope(instance_, scope_); + } + +- PandaVM *instance {nullptr}; +- EcmaHandleScope *scope {nullptr}; +- JSThread *thread; ++ PandaVM *instance_ {nullptr}; ++ EcmaHandleScope *scope_ {nullptr}; ++ JSThread *thread_; + }; + + TEST_F(JSVerificationTest, DISABLED_IsHeapAddress) // issue #5368 + { +- auto ecmaVm = thread->GetEcmaVM(); ++ auto ecmaVm = thread_->GetEcmaVM(); + auto heap = ecmaVm->GetHeap(); + auto objectFactory = ecmaVm->GetFactory(); + auto verifier = Verification(heap); +@@ -82,7 +82,7 @@ TEST_F(JSVerificationTest, DISABLED_IsHeapAddress) // issue #5368 + + TEST_F(JSVerificationTest, DISABLED_VerifyHeapObjects) // issue #5368 + { +- auto ecmaVm = thread->GetEcmaVM(); ++ auto ecmaVm = thread_->GetEcmaVM(); + auto heap = const_cast(ecmaVm->GetHeap()); + auto objectFactory = ecmaVm->GetFactory(); + EXPECT_TRUE(heap->VerifyHeapObjects() == 0); // failcount is 0 +@@ -90,12 +90,12 @@ TEST_F(JSVerificationTest, DISABLED_VerifyHeapObjects) // issue #5368 + JSTaggedValue oldArray; + auto verifier = Verification(heap); + { +- EcmaHandleScope handleScope(thread); ++ EcmaHandleScope handleScope(thread_); + auto newArray = objectFactory->NewTaggedArray(1, JSTaggedValue::Undefined(), MemSpaceType::SEMI_SPACE); + + oldArray = + (objectFactory->NewTaggedArray(1, JSTaggedValue::Undefined(), MemSpaceType::NON_MOVABLE)).GetTaggedValue(); +- newArray->Set(thread, 0, oldArray); ++ newArray->Set(thread_, 0, oldArray); + } + ecmaVm->GetGC()->WaitForGC(GCTask(GCTaskCause::EXPLICIT_CAUSE)); + EXPECT_TRUE(verifier.VerifyRoot() == 0); +diff --git a/tests/runtime/common/large_object_test.cpp b/tests/runtime/common/large_object_test.cpp +index 6ba931d..2900c28 100644 +--- a/tests/runtime/common/large_object_test.cpp ++++ b/tests/runtime/common/large_object_test.cpp +@@ -35,18 +35,18 @@ class LargeObjectTest : public testing::Test { + public: + void SetUp() override + { +- TestHelper::CreateEcmaVMWithScope(instance, thread, scope); +- thread->GetEcmaVM()->GetFactory()->SetTriggerGc(false); ++ TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); ++ thread_->GetEcmaVM()->GetFactory()->SetTriggerGc(false); + } + + void TearDown() override + { +- TestHelper::DestroyEcmaVMWithScope(instance, scope); ++ TestHelper::DestroyEcmaVMWithScope(instance_, scope_); + } + +- JSThread *thread; +- PandaVM *instance {nullptr}; +- ecmascript::EcmaHandleScope *scope {nullptr}; ++ JSThread *thread_; ++ PandaVM *instance_ {nullptr}; ++ ecmascript::EcmaHandleScope *scope_ {nullptr}; + }; + + #if !defined(NDEBUG) +@@ -74,12 +74,12 @@ static TaggedArray *LargeArrayTestCreate(JSThread *thread) + TEST_F(LargeObjectTest, LargeArrayKeep) + { + #if !defined(NDEBUG) +- TaggedArray *array = LargeArrayTestCreate(thread); ++ TaggedArray *array = LargeArrayTestCreate(thread_); + EXPECT_TRUE(array != nullptr); +- JSHandle arrayHandle(thread, array); +- JSHandle newObj(thread, JSObjectTestCreate(thread)); +- arrayHandle->Set(thread, 0, newObj.GetTaggedValue()); +- auto ecmaVm = thread->GetEcmaVM(); ++ JSHandle arrayHandle(thread_, array); ++ JSHandle newObj(thread_, JSObjectTestCreate(thread_)); ++ arrayHandle->Set(thread_, 0, newObj.GetTaggedValue()); ++ auto ecmaVm = thread_->GetEcmaVM(); + EXPECT_EQ(*arrayHandle, reinterpret_cast(array)); + ecmaVm->GetGC()->WaitForGCInManaged(GCTask(GCTaskCause::EXPLICIT_CAUSE)); // Trigger GC. + ecmaVm->GetGC()->WaitForGCInManaged(GCTask(GCTaskCause::EXPLICIT_CAUSE)); // Trigger GC. +@@ -91,15 +91,15 @@ TEST_F(LargeObjectTest, LargeArrayKeep) + TEST_F(LargeObjectTest, DISABLED_MultipleArrays) // issue #5368 + { + #if !defined(NDEBUG) +- auto ecmaVm = thread->GetEcmaVM(); ++ auto ecmaVm = thread_->GetEcmaVM(); + auto heap = ecmaVm->GetHeap(); + const HugeObjectSpace *space = heap->GetHugeObjectSpace(); +- JSHandle array1(thread, LargeArrayTestCreate(thread)); ++ JSHandle array1(thread_, LargeArrayTestCreate(thread_)); + { + DISALLOW_GARBAGE_COLLECTION; +- [[maybe_unused]] TaggedArray *array2 = LargeArrayTestCreate(thread); ++ [[maybe_unused]] TaggedArray *array2 = LargeArrayTestCreate(thread_); + } +- JSHandle array3(thread, LargeArrayTestCreate(thread)); ++ JSHandle array3(thread_, LargeArrayTestCreate(thread_)); + + Region *firstPage = space->GetRegionList().GetFirst(); + Region *secondPage = firstPage->GetNext(); +diff --git a/tests/runtime/common/lexical_env_test.cpp b/tests/runtime/common/lexical_env_test.cpp +index 520599a..7d2f28f 100644 +--- a/tests/runtime/common/lexical_env_test.cpp ++++ b/tests/runtime/common/lexical_env_test.cpp +@@ -26,22 +26,22 @@ class LexicalEnvTest : public testing::Test { + public: + void SetUp() override + { +- TestHelper::CreateEcmaVMWithScope(instance, thread, scope); ++ TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); + } + + void TearDown() override + { +- TestHelper::DestroyEcmaVMWithScope(instance, scope); ++ TestHelper::DestroyEcmaVMWithScope(instance_, scope_); + } + +- PandaVM *instance {nullptr}; +- ecmascript::EcmaHandleScope *scope {nullptr}; +- JSThread *thread; ++ PandaVM *instance_ {nullptr}; ++ ecmascript::EcmaHandleScope *scope_ {nullptr}; ++ JSThread *thread_; + }; + + TEST_F(LexicalEnvTest, LexicalEnv_Create) + { +- JSHandle lexicalEnv = thread->GetEcmaVM()->GetFactory()->NewLexicalEnv(0); ++ JSHandle lexicalEnv = thread_->GetEcmaVM()->GetFactory()->NewLexicalEnv(0); + EXPECT_TRUE(lexicalEnv.GetTaggedValue().IsObject()); + } + } // namespace panda::test +diff --git a/tests/runtime/common/linked_hash_table_test.cpp b/tests/runtime/common/linked_hash_table_test.cpp +index 5ca6f2d..ed5eb20 100644 +--- a/tests/runtime/common/linked_hash_table_test.cpp ++++ b/tests/runtime/common/linked_hash_table_test.cpp +@@ -43,21 +43,21 @@ public: + + void SetUp() override + { +- TestHelper::CreateEcmaVMWithScope(instance, thread, scope); ++ TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); + } + + void TearDown() override + { +- TestHelper::DestroyEcmaVMWithScope(instance, scope); ++ TestHelper::DestroyEcmaVMWithScope(instance_, scope_); + } + +- PandaVM *instance {nullptr}; +- EcmaHandleScope *scope {nullptr}; +- JSThread *thread {nullptr}; ++ PandaVM *instance_ {nullptr}; ++ EcmaHandleScope *scope_ {nullptr}; ++ JSThread *thread_ {nullptr}; + + JSHandle GetGlobalEnv() + { +- EcmaVM *ecma = thread->GetEcmaVM(); ++ EcmaVM *ecma = thread_->GetEcmaVM(); + return ecma->GetGlobalEnv(); + } + }; +@@ -65,23 +65,23 @@ public: + TEST_F(LinkedHashTableTest, MapCreate) + { + int numOfElement = 64; +- JSHandle dict = LinkedHashMap::Create(thread, numOfElement); ++ JSHandle dict = LinkedHashMap::Create(thread_, numOfElement); + EXPECT_TRUE(*dict != nullptr); + } + + TEST_F(LinkedHashTableTest, SetCreate) + { + int numOfElement = 64; +- JSHandle set = LinkedHashSet::Create(thread, numOfElement); ++ JSHandle set = LinkedHashSet::Create(thread_, numOfElement); + EXPECT_TRUE(*set != nullptr); + } + + TEST_F(LinkedHashTableTest, addKeyAndValue) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + // mock object needed in test + int numOfElement = 64; +- JSHandle dictHandle = LinkedHashMap::Create(thread, numOfElement); ++ JSHandle dictHandle = LinkedHashMap::Create(thread_, numOfElement); + EXPECT_TRUE(*dictHandle != nullptr); + JSHandle objFun = GetGlobalEnv()->GetObjectFunction(); + +@@ -96,7 +96,7 @@ TEST_F(LinkedHashTableTest, addKeyAndValue) + JSHandle value2(factory->NewJSObjectByConstructor(JSHandle(objFun), objFun)); + + // test set() +- dictHandle = LinkedHashMap::Set(thread, dictHandle, key1, value1); ++ dictHandle = LinkedHashMap::Set(thread_, dictHandle, key1, value1); + EXPECT_EQ(dictHandle->NumberOfElements(), 1); + + // test find() +@@ -105,15 +105,15 @@ TEST_F(LinkedHashTableTest, addKeyAndValue) + EXPECT_EQ(key1.GetTaggedValue(), dictHandle->GetKey(entry1)); + EXPECT_EQ(value1.GetTaggedValue(), dictHandle->GetValue(entry1)); + +- dictHandle = LinkedHashMap::Set(thread, dictHandle, key2, value2); ++ dictHandle = LinkedHashMap::Set(thread_, dictHandle, key2, value2); + EXPECT_EQ(dictHandle->NumberOfElements(), 2); + // test remove() +- dictHandle = LinkedHashMap::Delete(thread, dictHandle, key1); ++ dictHandle = LinkedHashMap::Delete(thread_, dictHandle, key1); + EXPECT_EQ(-1, dictHandle->FindElement(key1.GetTaggedValue(), hash)); + EXPECT_EQ(dictHandle->NumberOfElements(), 1); + +- JSHandle undefinedKey(thread, JSTaggedValue::Undefined()); +- dictHandle = LinkedHashMap::Set(thread, dictHandle, undefinedKey, value1); ++ JSHandle undefinedKey(thread_, JSTaggedValue::Undefined()); ++ dictHandle = LinkedHashMap::Set(thread_, dictHandle, undefinedKey, value1); + int undefinedHash = LinkedHash::Hash(undefinedKey.GetTaggedValue()); + int entry2 = dictHandle->FindElement(undefinedKey.GetTaggedValue(), undefinedHash); + EXPECT_EQ(value1.GetTaggedValue(), dictHandle->GetValue(entry2)); +@@ -121,10 +121,10 @@ TEST_F(LinkedHashTableTest, addKeyAndValue) + + TEST_F(LinkedHashTableTest, SetaddKeyAndValue) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + // mock object needed in test + int numOfElement = 64; +- JSHandle setHandle = LinkedHashSet::Create(thread, numOfElement); ++ JSHandle setHandle = LinkedHashSet::Create(thread_, numOfElement); + EXPECT_TRUE(*setHandle != nullptr); + JSHandle objFun = GetGlobalEnv()->GetObjectFunction(); + +@@ -139,31 +139,31 @@ TEST_F(LinkedHashTableTest, SetaddKeyAndValue) + JSHandle value2(factory->NewJSObjectByConstructor(JSHandle(objFun), objFun)); + + // test set() +- setHandle = LinkedHashSet::Add(thread, setHandle, key1); ++ setHandle = LinkedHashSet::Add(thread_, setHandle, key1); + EXPECT_EQ(setHandle->NumberOfElements(), 1); + + // test has() + int hash = LinkedHash::Hash(key1.GetTaggedValue()); + EXPECT_TRUE(setHandle->Has(key1.GetTaggedValue(), hash)); + +- setHandle = LinkedHashSet::Add(thread, setHandle, key2); ++ setHandle = LinkedHashSet::Add(thread_, setHandle, key2); + EXPECT_EQ(setHandle->NumberOfElements(), 2); + // test remove() +- setHandle = LinkedHashSet::Delete(thread, setHandle, key1); ++ setHandle = LinkedHashSet::Delete(thread_, setHandle, key1); + EXPECT_EQ(-1, setHandle->FindElement(key1.GetTaggedValue(), hash)); + EXPECT_EQ(setHandle->NumberOfElements(), 1); + +- JSHandle undefinedKey(thread, JSTaggedValue::Undefined()); +- setHandle = LinkedHashSet::Add(thread, setHandle, undefinedKey); ++ JSHandle undefinedKey(thread_, JSTaggedValue::Undefined()); ++ setHandle = LinkedHashSet::Add(thread_, setHandle, undefinedKey); + int undefinedHash = LinkedHash::Hash(undefinedKey.GetTaggedValue()); + EXPECT_TRUE(setHandle->Has(undefinedKey.GetTaggedValue(), undefinedHash)); + } + + TEST_F(LinkedHashTableTest, GrowCapacity) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + int numOfElement = 8; +- JSHandle dictHandle = LinkedHashMap::Create(thread, numOfElement); ++ JSHandle dictHandle = LinkedHashMap::Create(thread_, numOfElement); + EXPECT_TRUE(*dictHandle != nullptr); + JSHandle objFun(GetGlobalEnv()->GetObjectFunction()); + char keyArray[7] = "hello"; +@@ -171,10 +171,10 @@ TEST_F(LinkedHashTableTest, GrowCapacity) + keyArray[5] = '1' + i; + keyArray[6] = 0; + JSHandle key(factory->NewFromCanBeCompressString(keyArray)); +- JSHandle value(thread, JSTaggedValue(i)); ++ JSHandle value(thread_, JSTaggedValue(i)); + + // test insert() +- dictHandle = LinkedHashMap::Set(thread, dictHandle, key, value); ++ dictHandle = LinkedHashMap::Set(thread_, dictHandle, key, value); + int hash = LinkedHash::Hash(key.GetTaggedValue()); + EXPECT_EQ(i, dictHandle->FindElement(key.GetTaggedValue(), hash)); + } +@@ -194,9 +194,9 @@ TEST_F(LinkedHashTableTest, GrowCapacity) + + TEST_F(LinkedHashTableTest, SetGrowCapacity) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + int numOfElement = 8; +- JSHandle setHandle = LinkedHashSet::Create(thread, numOfElement); ++ JSHandle setHandle = LinkedHashSet::Create(thread_, numOfElement); + EXPECT_TRUE(*setHandle != nullptr); + JSHandle objFun(GetGlobalEnv()->GetObjectFunction()); + // create key and values +@@ -208,7 +208,7 @@ TEST_F(LinkedHashTableTest, SetGrowCapacity) + JSHandle key(stringKey); + + // test insert() +- setHandle = LinkedHashSet::Add(thread, setHandle, key); ++ setHandle = LinkedHashSet::Add(thread_, setHandle, key); + int hash = LinkedHash::Hash(key.GetTaggedValue()); + EXPECT_EQ(i, setHandle->FindElement(key.GetTaggedValue(), hash)); + } +@@ -228,9 +228,9 @@ TEST_F(LinkedHashTableTest, SetGrowCapacity) + + TEST_F(LinkedHashTableTest, ShrinkCapacity) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + int numOfElement = 64; +- JSHandle dictHandle = LinkedHashMap::Create(thread, numOfElement); ++ JSHandle dictHandle = LinkedHashMap::Create(thread_, numOfElement); + EXPECT_TRUE(*dictHandle != nullptr); + JSHandle objFun(GetGlobalEnv()->GetObjectFunction()); + char keyArray[7] = "hello"; +@@ -238,14 +238,14 @@ TEST_F(LinkedHashTableTest, ShrinkCapacity) + keyArray[5] = '1' + i; + keyArray[6] = 0; + JSHandle key(factory->NewFromCanBeCompressString(keyArray)); +- JSHandle value(thread, JSTaggedValue(i)); ++ JSHandle value(thread_, JSTaggedValue(i)); + + // test insert() +- dictHandle = LinkedHashMap::Set(thread, dictHandle, key, value); ++ dictHandle = LinkedHashMap::Set(thread_, dictHandle, key, value); + } + keyArray[5] = '1' + 9; + JSHandle key(factory->NewFromCanBeCompressString(keyArray)); +- dictHandle = LinkedHashMap::Delete(thread, dictHandle, key); ++ dictHandle = LinkedHashMap::Delete(thread_, dictHandle, key); + // test order + for (int i = 0; i < 9; i++) { + keyArray[5] = '1' + i; +@@ -261,9 +261,9 @@ TEST_F(LinkedHashTableTest, ShrinkCapacity) + + TEST_F(LinkedHashTableTest, SetShrinkCapacity) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + int numOfElement = 64; +- JSHandle setHandle = LinkedHashSet::Create(thread, numOfElement); ++ JSHandle setHandle = LinkedHashSet::Create(thread_, numOfElement); + EXPECT_TRUE(*setHandle != nullptr); + JSHandle objFun(GetGlobalEnv()->GetObjectFunction()); + // create key and values +@@ -274,11 +274,11 @@ TEST_F(LinkedHashTableTest, SetShrinkCapacity) + JSHandle key(factory->NewFromCanBeCompressString(keyArray)); + + // test insert() +- setHandle = LinkedHashSet::Add(thread, setHandle, key); ++ setHandle = LinkedHashSet::Add(thread_, setHandle, key); + } + keyArray[5] = '1' + 9; + JSHandle keyHandle(factory->NewFromCanBeCompressString(keyArray)); +- setHandle = LinkedHashSet::Delete(thread, setHandle, keyHandle); ++ setHandle = LinkedHashSet::Delete(thread_, setHandle, keyHandle); + // test order + for (int i = 0; i < 9; i++) { + keyArray[5] = '1' + i; +diff --git a/tests/runtime/common/name_dictionary_test.cpp b/tests/runtime/common/name_dictionary_test.cpp +index 9a9de14..8e50750 100644 +--- a/tests/runtime/common/name_dictionary_test.cpp ++++ b/tests/runtime/common/name_dictionary_test.cpp +@@ -46,17 +46,17 @@ public: + + void SetUp() override + { +- TestHelper::CreateEcmaVMWithScope(instance, thread, scope); ++ TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); + } + + void TearDown() override + { +- TestHelper::DestroyEcmaVMWithScope(instance, scope); ++ TestHelper::DestroyEcmaVMWithScope(instance_, scope_); + } + +- PandaVM *instance {nullptr}; +- EcmaHandleScope *scope {nullptr}; +- JSThread *thread {nullptr}; ++ PandaVM *instance_ {nullptr}; ++ EcmaHandleScope *scope_ {nullptr}; ++ JSThread *thread_ {nullptr}; + }; + + static JSHandle GetGlobalEnv(JSThread *thread) +@@ -68,7 +68,7 @@ static JSHandle GetGlobalEnv(JSThread *thread) + TEST_F(NameDictionaryTest, createDictionary) + { + int numOfElement = 64; +- JSHandle dict = NameDictionary::Create(thread, numOfElement); ++ JSHandle dict = NameDictionary::Create(thread_, numOfElement); + EXPECT_TRUE(*dict != nullptr); + } + +@@ -76,34 +76,34 @@ TEST_F(NameDictionaryTest, addKeyAndValue) + { + // mock object needed in test + int numOfElement = 64; +- JSHandle dictJShandle(NameDictionary::Create(thread, numOfElement)); ++ JSHandle dictJShandle(NameDictionary::Create(thread_, numOfElement)); + EXPECT_TRUE(*dictJShandle != nullptr); + JSMutableHandle dictHandle(dictJShandle); +- JSHandle objFun = GetGlobalEnv(thread)->GetObjectFunction(); ++ JSHandle objFun = GetGlobalEnv(thread_)->GetObjectFunction(); + + // create key and values + JSHandle jsObject = +- thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(objFun), objFun); ++ thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(objFun), objFun); + EXPECT_TRUE(*jsObject != nullptr); + + char keyArray[] = "hello"; +- JSHandle stringKey1 = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(keyArray); ++ JSHandle stringKey1 = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(keyArray); + JSHandle key1(stringKey1); + JSHandle taggedkey1(stringKey1); + JSHandle value1( +- thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(objFun), objFun)); ++ thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(objFun), objFun)); + PropertyAttributes metaData1; + + char key2Array[] = "hello2"; +- JSHandle stringKey2 = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(key2Array); ++ JSHandle stringKey2 = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(key2Array); + JSHandle key2(stringKey2); + JSHandle taggedkey2(stringKey2); + JSHandle value2( +- thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(objFun), objFun)); ++ thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(objFun), objFun)); + PropertyAttributes metaData2; + + // test insert() +- JSHandle dict(NameDictionary::PutIfAbsent(thread, dictHandle, key1, value1, metaData1)); ++ JSHandle dict(NameDictionary::PutIfAbsent(thread_, dictHandle, key1, value1, metaData1)); + dictHandle.Update(dict.GetTaggedValue()); + EXPECT_EQ(dict->EntriesCount(), 1); + +@@ -112,10 +112,10 @@ TEST_F(NameDictionaryTest, addKeyAndValue) + EXPECT_EQ(key1.GetTaggedValue(), JSTaggedValue(dict->GetKey(entry1).GetRawData())); + EXPECT_EQ(value1.GetTaggedValue(), JSTaggedValue(dict->GetValue(entry1).GetRawData())); + +- JSHandle dict2(NameDictionary::PutIfAbsent(thread, dictHandle, key2, value2, metaData2)); ++ JSHandle dict2(NameDictionary::PutIfAbsent(thread_, dictHandle, key2, value2, metaData2)); + EXPECT_EQ(dict2->EntriesCount(), 2); + // test remove() +- dict = NameDictionary::Remove(thread, dictHandle, entry1); ++ dict = NameDictionary::Remove(thread_, dictHandle, entry1); + EXPECT_EQ(-1, dict->FindEntry(key1.GetTaggedValue())); + EXPECT_EQ(dict->EntriesCount(), 1); + } +@@ -123,12 +123,12 @@ TEST_F(NameDictionaryTest, addKeyAndValue) + TEST_F(NameDictionaryTest, GrowCapacity) + { + int numOfElement = 8; +- JSHandle dictHandle(NameDictionary::Create(thread, numOfElement)); ++ JSHandle dictHandle(NameDictionary::Create(thread_, numOfElement)); + EXPECT_TRUE(*dictHandle != nullptr); +- JSHandle objFun = GetGlobalEnv(thread)->GetObjectFunction(); ++ JSHandle objFun = GetGlobalEnv(thread_)->GetObjectFunction(); + // create key and values + JSHandle jsObject = +- thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(objFun), objFun); ++ thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(objFun), objFun); + EXPECT_TRUE(*jsObject != nullptr); + char keyArray[7] = "hello"; + for (int i = 0; i < 9; i++) { +@@ -136,15 +136,15 @@ TEST_F(NameDictionaryTest, GrowCapacity) + keyArray[5] = '1' + i; + keyArray[6] = 0; + +- JSHandle stringKey = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(keyArray); ++ JSHandle stringKey = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(keyArray); + ecmascript::JSHandle key(stringKey); + JSHandle keyHandle(key); +- ecmascript::JSHandle value(thread, JSTaggedValue(i)); ++ ecmascript::JSHandle value(thread_, JSTaggedValue(i)); + JSHandle valueHandle(value); + PropertyAttributes metaData; + + // test insert() +- dictHandle = NameDictionary::PutIfAbsent(thread, tempHandle, keyHandle, valueHandle, metaData); ++ dictHandle = NameDictionary::PutIfAbsent(thread_, tempHandle, keyHandle, valueHandle, metaData); + } + EXPECT_EQ(dictHandle->EntriesCount(), 9); + EXPECT_EQ(dictHandle->Size(), 16); +@@ -153,38 +153,38 @@ TEST_F(NameDictionaryTest, GrowCapacity) + TEST_F(NameDictionaryTest, ShrinkCapacity) + { + int numOfElement = 64; +- JSMutableHandle dictHandle(NameDictionary::Create(thread, numOfElement)); ++ JSMutableHandle dictHandle(NameDictionary::Create(thread_, numOfElement)); + EXPECT_TRUE(*dictHandle != nullptr); +- JSHandle objFun = GetGlobalEnv(thread)->GetObjectFunction(); ++ JSHandle objFun = GetGlobalEnv(thread_)->GetObjectFunction(); + // create key and values + JSHandle jsObject = +- thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(objFun), objFun); ++ thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(objFun), objFun); + EXPECT_TRUE(*jsObject != nullptr); + uint8_t keyArray[7] = "hello"; + +- auto stringTable = thread->GetEcmaVM()->GetEcmaStringTable(); ++ auto stringTable = thread_->GetEcmaVM()->GetEcmaStringTable(); + for (int i = 0; i < 10; i++) { + keyArray[5] = '0' + i; + keyArray[6] = 0; + +- JSHandle key(thread, stringTable->GetOrInternString(keyArray, utf::Mutf8Size(keyArray), true)); +- JSHandle value(thread, JSTaggedValue(i)); ++ JSHandle key(thread_, stringTable->GetOrInternString(keyArray, utf::Mutf8Size(keyArray), true)); ++ JSHandle value(thread_, JSTaggedValue(i)); + PropertyAttributes metaData; + + // test insert() +- JSHandle newDict = NameDictionary::PutIfAbsent(thread, dictHandle, key, value, metaData); ++ JSHandle newDict = NameDictionary::PutIfAbsent(thread_, dictHandle, key, value, metaData); + dictHandle.Update(newDict.GetTaggedValue()); + } + + keyArray[5] = '2'; + keyArray[6] = 0; +- JSHandle arrayHandle(thread, ++ JSHandle arrayHandle(thread_, + stringTable->GetOrInternString(keyArray, utf::Mutf8Size(keyArray), true)); + + int entry = dictHandle->FindEntry(arrayHandle.GetTaggedValue()); + EXPECT_NE(entry, -1); + +- JSHandle newDict1 = NameDictionary::Remove(thread, dictHandle, entry); ++ JSHandle newDict1 = NameDictionary::Remove(thread_, dictHandle, entry); + dictHandle.Update(newDict1.GetTaggedValue()); + EXPECT_EQ(dictHandle->EntriesCount(), 9); + EXPECT_EQ(dictHandle->Size(), 16); +diff --git a/tests/runtime/common/native_pointer_test.cpp b/tests/runtime/common/native_pointer_test.cpp +index 2debf37..1c0a49e 100644 +--- a/tests/runtime/common/native_pointer_test.cpp ++++ b/tests/runtime/common/native_pointer_test.cpp +@@ -41,33 +41,33 @@ public: + + void SetUp() override + { +- TestHelper::CreateEcmaVMWithScope(instance, thread, scope); ++ TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); + } + + void TearDown() override + { +- TestHelper::DestroyEcmaVMWithScope(instance, scope); ++ TestHelper::DestroyEcmaVMWithScope(instance_, scope_); + } + +- PandaVM *instance {nullptr}; +- ecmascript::EcmaHandleScope *scope {nullptr}; +- JSThread *thread {nullptr}; ++ PandaVM *instance_ {nullptr}; ++ ecmascript::EcmaHandleScope *scope_ {nullptr}; ++ JSThread *thread_ {nullptr}; + }; + + TEST_F(NativePointerTest, Print) + { + // mock object needed in test + char array[] = "Hello World!"; +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); +- JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); ++ JSHandle env = thread_->GetEcmaVM()->GetGlobalEnv(); + JSHandle str = factory->NewFromCanBeCompressString(array); + EXPECT_TRUE(*str != nullptr); + + JSHandle jsFunction = factory->NewJSFunction(env); + EXPECT_TRUE(*jsFunction != nullptr); + +- JSMethod *target = thread->GetEcmaVM()->GetMethodForNativeFunction(nullptr); +- jsFunction->SetCallTarget(thread, target); ++ JSMethod *target = thread_->GetEcmaVM()->GetMethodForNativeFunction(nullptr); ++ jsFunction->SetCallTarget(thread_, target); + + // run cpp methed 'Print' + ASSERT_EQ(target, jsFunction->GetCallTarget()); +diff --git a/tests/runtime/common/object_factory_test.cpp b/tests/runtime/common/object_factory_test.cpp +index b23562a..e2d0d9b 100644 +--- a/tests/runtime/common/object_factory_test.cpp ++++ b/tests/runtime/common/object_factory_test.cpp +@@ -46,17 +46,17 @@ public: + + void SetUp() override + { +- TestHelper::CreateEcmaVMWithScope(instance, thread, scope); ++ TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); + } + + void TearDown() override + { +- TestHelper::DestroyEcmaVMWithScope(instance, scope); ++ TestHelper::DestroyEcmaVMWithScope(instance_, scope_); + } + +- PandaVM *instance {nullptr}; +- ecmascript::EcmaHandleScope *scope {nullptr}; +- JSThread *thread {nullptr}; ++ PandaVM *instance_ {nullptr}; ++ ecmascript::EcmaHandleScope *scope_ {nullptr}; ++ JSThread *thread_ {nullptr}; + }; + + JSHandle GetGlobal(JSThread *thread) +@@ -66,50 +66,50 @@ JSHandle GetGlobal(JSThread *thread) + + TEST_F(ObjectFactoryTest, DISABLED_NewJSObjectByConstructor) // TODO(vpukhov) + { +- thread->GetEcmaVM()->SetEnableForceGC(false); +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); +- JSHandle objFun = GetGlobal(thread)->GetObjectFunction(); ++ thread_->GetEcmaVM()->SetEnableForceGC(false); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); ++ JSHandle objFun = GetGlobal(thread_)->GetObjectFunction(); + + // check mem alloc + JSHandle newObj = factory->NewJSObjectByConstructor(JSHandle(objFun), objFun); +- JSHandle newObjCls(thread, newObj->GetJSHClass()); ++ JSHandle newObjCls(thread_, newObj->GetJSHClass()); + EXPECT_TRUE(*newObj != nullptr); + EXPECT_TRUE(*newObjCls != nullptr); + + // check feild +- EXPECT_EQ(newObj->GetProperties(), GetGlobal(thread)->GetEmptyArray().GetTaggedValue()); +- EXPECT_EQ(newObj->GetElements(), GetGlobal(thread)->GetEmptyArray().GetTaggedValue()); ++ EXPECT_EQ(newObj->GetProperties(), GetGlobal(thread_)->GetEmptyArray().GetTaggedValue()); ++ EXPECT_EQ(newObj->GetElements(), GetGlobal(thread_)->GetEmptyArray().GetTaggedValue()); + EXPECT_TRUE(JSTaggedValue(*newObj).IsECMAObject()); + + // check jshclass + JSHClass *cls = *newObjCls; + EXPECT_TRUE(cls->GetObjectSize() == + JSObject::SIZE + JSHClass::DEFAULT_CAPACITY_OF_IN_OBJECTS * JSTaggedValue::TaggedTypeSize()); +- EXPECT_TRUE(cls->GetPrototype() == GetGlobal(thread)->GetObjectFunctionPrototype().GetTaggedValue()); ++ EXPECT_TRUE(cls->GetPrototype() == GetGlobal(thread_)->GetObjectFunctionPrototype().GetTaggedValue()); + EXPECT_TRUE(cls->GetObjectType() == JSType::JS_OBJECT); + + // check gc handle update + auto *prototype = cls->GetPrototype().GetTaggedObject(); +- thread->GetEcmaVM()->CollectGarbage(TriggerGCType::COMPRESS_FULL_GC); ++ thread_->GetEcmaVM()->CollectGarbage(TriggerGCType::COMPRESS_FULL_GC); + // CompressGC not the same + EXPECT_TRUE(prototype != newObjCls->GetPrototype().GetTaggedObject()); +- thread->GetEcmaVM()->SetEnableForceGC(true); ++ thread_->GetEcmaVM()->SetEnableForceGC(true); + } + + TEST_F(ObjectFactoryTest, NewJSFunction) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); +- JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); ++ JSHandle env = thread_->GetEcmaVM()->GetGlobalEnv(); + + // check mem alloc + JSHandle newFun = factory->NewJSFunction(env); +- JSHandle newFunCls(thread, newFun->GetJSHClass()); ++ JSHandle newFunCls(thread_, newFun->GetJSHClass()); + EXPECT_TRUE(*newFun != nullptr); + EXPECT_TRUE(*newFunCls != nullptr); + + // check feild +- EXPECT_EQ(newFun->GetProperties(), GetGlobal(thread)->GetEmptyArray().GetTaggedValue()); +- EXPECT_EQ(newFun->GetElements(), GetGlobal(thread)->GetEmptyArray().GetTaggedValue()); ++ EXPECT_EQ(newFun->GetProperties(), GetGlobal(thread_)->GetEmptyArray().GetTaggedValue()); ++ EXPECT_EQ(newFun->GetElements(), GetGlobal(thread_)->GetEmptyArray().GetTaggedValue()); + EXPECT_EQ(newFun->GetProtoOrDynClass(), JSTaggedValue::Hole()); + EXPECT_EQ(newFun->GetHomeObject(), JSTaggedValue::Undefined()); + EXPECT_TRUE(JSTaggedValue(*newFun).IsJSFunction()); +@@ -118,7 +118,7 @@ TEST_F(ObjectFactoryTest, NewJSFunction) + JSHClass *cls = *newFunCls; + EXPECT_TRUE(cls->GetObjectSize() == + JSFunction::SIZE + JSHClass::DEFAULT_CAPACITY_OF_IN_OBJECTS * JSTaggedValue::TaggedTypeSize()); +- EXPECT_TRUE(cls->GetPrototype() == GetGlobal(thread)->GetFunctionPrototype().GetTaggedValue()); ++ EXPECT_TRUE(cls->GetPrototype() == GetGlobal(thread_)->GetFunctionPrototype().GetTaggedValue()); + EXPECT_TRUE(cls->GetObjectType() == JSType::JS_FUNCTION); + EXPECT_TRUE(cls->IsCallable()); + EXPECT_TRUE(cls->IsExtensible()); +@@ -127,32 +127,32 @@ TEST_F(ObjectFactoryTest, NewJSFunction) + + TEST_F(ObjectFactoryTest, NewJSBoundFunction) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + + // test prepare +- JSHandle funFun(GetGlobal(thread)->GetObjectFunction()); +- JSHandle bound(thread, GetGlobal(thread)->GetObjectFunctionPrototype().GetTaggedValue()); +- const JSHandle array(GetGlobal(thread)->GetEmptyArray()); ++ JSHandle funFun(GetGlobal(thread_)->GetObjectFunction()); ++ JSHandle bound(thread_, GetGlobal(thread_)->GetObjectFunctionPrototype().GetTaggedValue()); ++ const JSHandle array(GetGlobal(thread_)->GetEmptyArray()); + + // check mem alloc + JSHandle targetFunc(funFun); + JSHandle newBoundFun = factory->NewJSBoundFunction(targetFunc, bound, array); +- JSHandle newBoundFunCls(thread, newBoundFun->GetJSHClass()); ++ JSHandle newBoundFunCls(thread_, newBoundFun->GetJSHClass()); + EXPECT_TRUE(*newBoundFun != nullptr); + EXPECT_TRUE(*newBoundFunCls != nullptr); + } + + TEST_F(ObjectFactoryTest, NewJSPrimitiveRef) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + + // test prepare +- JSHandle numberFun(GetGlobal(thread)->GetNumberFunction()); +- JSHandle primitive(thread, JSTaggedValue(1)); ++ JSHandle numberFun(GetGlobal(thread_)->GetNumberFunction()); ++ JSHandle primitive(thread_, JSTaggedValue(1)); + + // check mem alloc + JSHandle newPrimitive = factory->NewJSPrimitiveRef(numberFun, primitive); +- JSHandle newPrimitiveCls(thread, newPrimitive->GetJSHClass()); ++ JSHandle newPrimitiveCls(thread_, newPrimitive->GetJSHClass()); + EXPECT_TRUE(*newPrimitive != nullptr); + EXPECT_TRUE(*newPrimitiveCls != nullptr); + +@@ -161,22 +161,22 @@ TEST_F(ObjectFactoryTest, NewJSPrimitiveRef) + + TEST_F(ObjectFactoryTest, NewLexicalEnv) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + + // check mem alloc + JSHandle newLexicalEnv = factory->NewLexicalEnv(0); +- JSHandle newLexicalEnvCls(thread, newLexicalEnv->GetClass()); ++ JSHandle newLexicalEnvCls(thread_, newLexicalEnv->GetClass()); + EXPECT_TRUE(*newLexicalEnv != nullptr); + EXPECT_TRUE(*newLexicalEnvCls != nullptr); + } + + TEST_F(ObjectFactoryTest, NewJSArray) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + + // check mem alloc + JSHandle newJSAarray = factory->NewJSArray(); +- JSHandle newJSArrayCls(thread, newJSAarray->GetJSHClass()); ++ JSHandle newJSArrayCls(thread_, newJSAarray->GetJSHClass()); + EXPECT_TRUE(*newJSAarray != nullptr); + EXPECT_TRUE(*newJSArrayCls != nullptr); + } +diff --git a/tests/runtime/common/separate_jsvm_test.cpp b/tests/runtime/common/separate_jsvm_test.cpp +index 0b8aa36..83f6cf1 100644 +--- a/tests/runtime/common/separate_jsvm_test.cpp ++++ b/tests/runtime/common/separate_jsvm_test.cpp +@@ -63,7 +63,7 @@ public: + return ecma_vm; + } + +- PandaVM *instance; ++ PandaVM *instance_; + }; + + TEST_F(SepareteJSVMTest, CreateInstance) +diff --git a/tests/runtime/common/symbol_table_test.cpp b/tests/runtime/common/symbol_table_test.cpp +index a5505ad..be6972d 100644 +--- a/tests/runtime/common/symbol_table_test.cpp ++++ b/tests/runtime/common/symbol_table_test.cpp +@@ -37,16 +37,16 @@ public: + + void SetUp() override + { +- TestHelper::CreateEcmaVMWithScope(instance, thread, scope); ++ TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); + } + + void TearDown() override + { +- TestHelper::DestroyEcmaVMWithScope(instance, scope); ++ TestHelper::DestroyEcmaVMWithScope(instance_, scope_); + } +- ecmascript::EcmaHandleScope *scope {nullptr}; +- PandaVM *instance {nullptr}; +- JSThread *thread {nullptr}; ++ ecmascript::EcmaHandleScope *scope_ {nullptr}; ++ PandaVM *instance_ {nullptr}; ++ JSThread *thread_ {nullptr}; + }; + + TEST_F(SymbolTableTest, GetKeyIndex) +@@ -82,7 +82,7 @@ TEST_F(SymbolTableTest, GetEntrySize) + */ + TEST_F(SymbolTableTest, IsMatch) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + + JSHandle symbolTableString = factory->NewFromCanBeCompressString("name"); + JSTaggedValue symbolTableOther = symbolTableString.GetTaggedValue(); +@@ -107,7 +107,7 @@ TEST_F(SymbolTableTest, IsMatch) + */ + TEST_F(SymbolTableTest, Hash_Utf8) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + // test obj is not string + JSHandle jsObJect(factory->NewEmptyJSObject()); + EXPECT_EQ(SymbolTable::Hash(jsObJect.GetTaggedValue()), JSSymbol::ComputeHash()); +@@ -137,7 +137,7 @@ TEST_F(SymbolTableTest, Hash_Utf8) + */ + TEST_F(SymbolTableTest, Hash_Utf16) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + + uint16_t utf16ArrayName1[] = {1, 2, 3}; + uint32_t utf16ArrayNameLen1 = sizeof(utf16ArrayName1) / sizeof(utf16ArrayName1[0]); +@@ -166,7 +166,7 @@ TEST_F(SymbolTableTest, Create) + bool flag = EcmaString::GetCompressedStringsEnabled(); + EXPECT_EQ(flag, true); + +- JSHandle symbolTable = SymbolTable::Create(thread, numberOfElements); ++ JSHandle symbolTable = SymbolTable::Create(thread_, numberOfElements); + EXPECT_TRUE(*symbolTable != nullptr); + } + +@@ -180,30 +180,30 @@ TEST_F(SymbolTableTest, Create) + */ + TEST_F(SymbolTableTest, ContainsKey) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle symbolTableStringKey1 = factory->NewFromCanBeCompressString("key"); + JSHandle symbolTableStringKey2 = factory->NewFromCanBeCompressString("key1"); + JSHandle symbolTableStringKey3 = factory->NewFromCanBeCompressString("value"); + + int numberOfElements = 2; +- JSHandle symbolTable = SymbolTable::Create(thread, numberOfElements); +- EXPECT_EQ(symbolTable->ContainsKey(thread, symbolTableStringKey1.GetTaggedValue()), false); ++ JSHandle symbolTable = SymbolTable::Create(thread_, numberOfElements); ++ EXPECT_EQ(symbolTable->ContainsKey(thread_, symbolTableStringKey1.GetTaggedValue()), false); + +- symbolTable->SetKey(thread, 1, JSTaggedValue::Hole()); +- EXPECT_EQ(symbolTable->ContainsKey(thread, symbolTableStringKey1.GetTaggedValue()), false); ++ symbolTable->SetKey(thread_, 1, JSTaggedValue::Hole()); ++ EXPECT_EQ(symbolTable->ContainsKey(thread_, symbolTableStringKey1.GetTaggedValue()), false); + +- symbolTable->SetKey(thread, 1, JSTaggedValue::Undefined()); +- EXPECT_EQ(symbolTable->ContainsKey(thread, symbolTableStringKey1.GetTaggedValue()), false); ++ symbolTable->SetKey(thread_, 1, JSTaggedValue::Undefined()); ++ EXPECT_EQ(symbolTable->ContainsKey(thread_, symbolTableStringKey1.GetTaggedValue()), false); + +- symbolTable->SetKey(thread, 1, symbolTableStringKey1.GetTaggedValue()); +- EXPECT_EQ(symbolTable->ContainsKey(thread, symbolTableStringKey1.GetTaggedValue()), true); ++ symbolTable->SetKey(thread_, 1, symbolTableStringKey1.GetTaggedValue()); ++ EXPECT_EQ(symbolTable->ContainsKey(thread_, symbolTableStringKey1.GetTaggedValue()), true); + + // the key value has numbers +- symbolTable->SetKey(thread, 1, symbolTableStringKey2.GetTaggedValue()); +- EXPECT_EQ(symbolTable->ContainsKey(thread, symbolTableStringKey2.GetTaggedValue()), false); ++ symbolTable->SetKey(thread_, 1, symbolTableStringKey2.GetTaggedValue()); ++ EXPECT_EQ(symbolTable->ContainsKey(thread_, symbolTableStringKey2.GetTaggedValue()), false); + +- symbolTable->SetKey(thread, 1, symbolTableStringKey3.GetTaggedValue()); +- EXPECT_EQ(symbolTable->ContainsKey(thread, symbolTableStringKey3.GetTaggedValue()), true); ++ symbolTable->SetKey(thread_, 1, symbolTableStringKey3.GetTaggedValue()); ++ EXPECT_EQ(symbolTable->ContainsKey(thread_, symbolTableStringKey3.GetTaggedValue()), true); + } + + /* +@@ -216,19 +216,19 @@ TEST_F(SymbolTableTest, ContainsKey) + */ + TEST_F(SymbolTableTest, GetSymbol) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + int numberOfElements = 2; + + JSHandle symbolTableStringKey = factory->NewFromCanBeCompressString("key"); +- JSHandle symbolTable = SymbolTable::Create(thread, numberOfElements); ++ JSHandle symbolTable = SymbolTable::Create(thread_, numberOfElements); + +- symbolTable->SetKey(thread, 1, symbolTableStringKey.GetTaggedValue()); ++ symbolTable->SetKey(thread_, 1, symbolTableStringKey.GetTaggedValue()); + EXPECT_EQ(symbolTable->GetSymbol(symbolTableStringKey.GetTaggedValue()), JSTaggedValue::Undefined()); + +- symbolTable->SetValue(thread, 0, JSTaggedValue(1)); ++ symbolTable->SetValue(thread_, 0, JSTaggedValue(1)); + EXPECT_EQ(symbolTable->GetSymbol(symbolTableStringKey.GetTaggedValue()), JSTaggedValue::Undefined()); + +- symbolTable->SetValue(thread, 1, JSTaggedValue(1)); ++ symbolTable->SetValue(thread_, 1, JSTaggedValue(1)); + EXPECT_EQ(symbolTable->GetSymbol(symbolTableStringKey.GetTaggedValue()).GetInt(), 1); + } + +@@ -244,27 +244,27 @@ TEST_F(SymbolTableTest, GetSymbol) + */ + TEST_F(SymbolTableTest, FindSymbol) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle symbolTableStringKey1(factory->NewFromCanBeCompressString("key")); + JSHandle symbolTableStringKey2(factory->NewFromCanBeCompressString("key1")); + + int numberOfElements = 2; + JSHandle handleSymbol = factory->NewJSSymbol(); +- JSHandle symbolTable = SymbolTable::Create(thread, numberOfElements); ++ JSHandle symbolTable = SymbolTable::Create(thread_, numberOfElements); + +- JSTaggedValue resultValue1 = symbolTable->FindSymbol(thread, handleSymbol.GetTaggedValue()); ++ JSTaggedValue resultValue1 = symbolTable->FindSymbol(thread_, handleSymbol.GetTaggedValue()); + EXPECT_EQ(JSTaggedValue::SameValue(resultValue1, JSTaggedValue::Undefined()), true); + +- handleSymbol->SetDescription(thread, symbolTableStringKey1.GetTaggedValue()); +- JSTaggedValue resultValue2 = symbolTable->FindSymbol(thread, handleSymbol.GetTaggedValue()); ++ handleSymbol->SetDescription(thread_, symbolTableStringKey1.GetTaggedValue()); ++ JSTaggedValue resultValue2 = symbolTable->FindSymbol(thread_, handleSymbol.GetTaggedValue()); + EXPECT_EQ(JSTaggedValue::SameValue(resultValue2, JSTaggedValue::Undefined()), true); + +- symbolTable->SetKey(thread, 1, symbolTableStringKey1.GetTaggedValue()); +- JSTaggedValue resultValue3 = symbolTable->FindSymbol(thread, handleSymbol.GetTaggedValue()); ++ symbolTable->SetKey(thread_, 1, symbolTableStringKey1.GetTaggedValue()); ++ JSTaggedValue resultValue3 = symbolTable->FindSymbol(thread_, handleSymbol.GetTaggedValue()); + EXPECT_EQ(resultValue3.GetRawData() == symbolTableStringKey1.GetTaggedValue().GetRawData(), true); + +- symbolTable->SetKey(thread, 1, symbolTableStringKey2.GetTaggedValue()); +- JSTaggedValue resultValue4 = symbolTable->FindSymbol(thread, handleSymbol.GetTaggedValue()); ++ symbolTable->SetKey(thread_, 1, symbolTableStringKey2.GetTaggedValue()); ++ JSTaggedValue resultValue4 = symbolTable->FindSymbol(thread_, handleSymbol.GetTaggedValue()); + EXPECT_EQ(JSTaggedValue::SameValue(resultValue4, JSTaggedValue::Undefined()), true); + } + } // namespace panda::test +diff --git a/tests/runtime/common/tagged_value_test.cpp b/tests/runtime/common/tagged_value_test.cpp +index cc65840..1c9afc2 100644 +--- a/tests/runtime/common/tagged_value_test.cpp ++++ b/tests/runtime/common/tagged_value_test.cpp +@@ -38,17 +38,17 @@ class JSTaggedValueTest : public testing::Test { + public: + void SetUp() override + { +- TestHelper::CreateEcmaVMWithScope(instance, thread, scope); ++ TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); + } + + void TearDown() override + { +- TestHelper::DestroyEcmaVMWithScope(instance, scope); ++ TestHelper::DestroyEcmaVMWithScope(instance_, scope_); + } + +- PandaVM *instance {nullptr}; +- ecmascript::EcmaHandleScope *scope {nullptr}; +- JSThread *thread; ++ PandaVM *instance_ {nullptr}; ++ ecmascript::EcmaHandleScope *scope_ {nullptr}; ++ JSThread *thread_; + }; + + TEST_F(JSTaggedValueTest, Double) +@@ -125,31 +125,31 @@ TEST_F(JSTaggedValueTest, ToPrimitive) + JSTaggedValue result; + + JSTaggedValue int_v(100); +- result = JSTaggedValue::ToPrimitive(thread, JSHandle(thread, int_v)); ++ result = JSTaggedValue::ToPrimitive(thread_, JSHandle(thread_, int_v)); + EXPECT_EQ(result.GetInt(), 100); + + JSTaggedValue double_v((double)100.0); +- result = JSTaggedValue::ToPrimitive(thread, JSHandle(thread, double_v)); ++ result = JSTaggedValue::ToPrimitive(thread_, JSHandle(thread_, double_v)); + EXPECT_EQ(result.GetDouble(), (double)100.0); + + JSTaggedValue undefined_v = JSTaggedValue::Undefined(); +- result = JSTaggedValue::ToPrimitive(thread, JSHandle(thread, undefined_v)); ++ result = JSTaggedValue::ToPrimitive(thread_, JSHandle(thread_, undefined_v)); + EXPECT_TRUE(result.IsUndefined()); + + JSTaggedValue hole_v = JSTaggedValue::Hole(); +- result = JSTaggedValue::ToPrimitive(thread, JSHandle(thread, hole_v)); ++ result = JSTaggedValue::ToPrimitive(thread_, JSHandle(thread_, hole_v)); + EXPECT_TRUE(result.IsHole()); + + JSTaggedValue null_v = JSTaggedValue::Null(); +- result = JSTaggedValue::ToPrimitive(thread, JSHandle(thread, null_v)); ++ result = JSTaggedValue::ToPrimitive(thread_, JSHandle(thread_, null_v)); + EXPECT_TRUE(result.IsNull()); + + JSTaggedValue false_v = JSTaggedValue::False(); +- result = JSTaggedValue::ToPrimitive(thread, JSHandle(thread, false_v)); ++ result = JSTaggedValue::ToPrimitive(thread_, JSHandle(thread_, false_v)); + EXPECT_TRUE(result.IsFalse()); + + JSTaggedValue true_v = JSTaggedValue::True(); +- result = JSTaggedValue::ToPrimitive(thread, JSHandle(thread, true_v)); ++ result = JSTaggedValue::ToPrimitive(thread_, JSHandle(thread_, true_v)); + EXPECT_TRUE(result.IsTrue()); + } + +@@ -170,8 +170,8 @@ TEST_F(JSTaggedValueTest, ToBoolean) + EXPECT_FALSE(JSTaggedValue::False().ToBoolean()); + EXPECT_TRUE(JSTaggedValue::True().ToBoolean()); + +- EXPECT_FALSE(thread->GetEcmaVM()->GetFactory()->GetEmptyString().GetTaggedValue().ToBoolean()); +- EXPECT_TRUE(thread->GetEcmaVM()->GetFactory()->NewFromString("test").GetTaggedValue().ToBoolean()); ++ EXPECT_FALSE(thread_->GetEcmaVM()->GetFactory()->GetEmptyString().GetTaggedValue().ToBoolean()); ++ EXPECT_TRUE(thread_->GetEcmaVM()->GetFactory()->NewFromString("test").GetTaggedValue().ToBoolean()); + } + + TEST_F(JSTaggedValueTest, ToNumber) +@@ -179,162 +179,162 @@ TEST_F(JSTaggedValueTest, ToNumber) + JSTaggedNumber result; + + JSTaggedValue int_v(100); +- result = JSTaggedValue::ToNumber(thread, JSHandle(thread, int_v)); ++ result = JSTaggedValue::ToNumber(thread_, JSHandle(thread_, int_v)); + EXPECT_EQ(result.GetNumber(), 100); + + JSTaggedValue double_v((double)100.0); +- result = JSTaggedValue::ToNumber(thread, JSHandle(thread, double_v)); ++ result = JSTaggedValue::ToNumber(thread_, JSHandle(thread_, double_v)); + EXPECT_EQ(result.GetNumber(), (double)100.0); + + JSTaggedValue undefined_v = JSTaggedValue::Undefined(); +- result = JSTaggedValue::ToNumber(thread, JSHandle(thread, undefined_v)); ++ result = JSTaggedValue::ToNumber(thread_, JSHandle(thread_, undefined_v)); + EXPECT_TRUE(std::isnan(result.GetNumber())); + + JSTaggedValue hole_v = JSTaggedValue::Hole(); +- result = JSTaggedValue::ToNumber(thread, JSHandle(thread, hole_v)); ++ result = JSTaggedValue::ToNumber(thread_, JSHandle(thread_, hole_v)); + EXPECT_TRUE(std::isnan(result.GetNumber())); + + JSTaggedValue null_v = JSTaggedValue::Null(); +- result = JSTaggedValue::ToNumber(thread, JSHandle(thread, null_v)); ++ result = JSTaggedValue::ToNumber(thread_, JSHandle(thread_, null_v)); + EXPECT_EQ(result.GetNumber(), 0); + + JSTaggedValue false_v = JSTaggedValue::False(); +- result = JSTaggedValue::ToNumber(thread, JSHandle(thread, false_v)); ++ result = JSTaggedValue::ToNumber(thread_, JSHandle(thread_, false_v)); + EXPECT_EQ(result.GetNumber(), 0); + + JSTaggedValue true_v = JSTaggedValue::True(); +- result = JSTaggedValue::ToNumber(thread, JSHandle(thread, true_v)); ++ result = JSTaggedValue::ToNumber(thread_, JSHandle(thread_, true_v)); + EXPECT_EQ(result.GetNumber(), 1); + +- JSHandle string_v0(thread->GetEcmaVM()->GetFactory()->NewFromString(" 1234 ")); +- result = JSTaggedValue::ToNumber(thread, string_v0); ++ JSHandle string_v0(thread_->GetEcmaVM()->GetFactory()->NewFromString(" 1234 ")); ++ result = JSTaggedValue::ToNumber(thread_, string_v0); + EXPECT_EQ(result.GetNumber(), 1234); + +- JSHandle string_v1(thread->GetEcmaVM()->GetFactory()->NewFromString(" 0b1010 ")); +- result = JSTaggedValue::ToNumber(thread, string_v1); ++ JSHandle string_v1(thread_->GetEcmaVM()->GetFactory()->NewFromString(" 0b1010 ")); ++ result = JSTaggedValue::ToNumber(thread_, string_v1); + EXPECT_EQ(result.GetNumber(), 10); + +- JSHandle string_v2(thread->GetEcmaVM()->GetFactory()->NewFromString(" 0O11 ")); +- result = JSTaggedValue::ToNumber(thread, string_v2); ++ JSHandle string_v2(thread_->GetEcmaVM()->GetFactory()->NewFromString(" 0O11 ")); ++ result = JSTaggedValue::ToNumber(thread_, string_v2); + EXPECT_EQ(result.GetNumber(), 9); + +- JSHandle string_v3(thread->GetEcmaVM()->GetFactory()->NewFromString(" 0x2d ")); +- result = JSTaggedValue::ToNumber(thread, string_v3); ++ JSHandle string_v3(thread_->GetEcmaVM()->GetFactory()->NewFromString(" 0x2d ")); ++ result = JSTaggedValue::ToNumber(thread_, string_v3); + EXPECT_EQ(result.GetNumber(), 45); + +- JSHandle string_v4(thread->GetEcmaVM()->GetFactory()->NewFromString(" 0.000001 ")); +- result = JSTaggedValue::ToNumber(thread, string_v4); ++ JSHandle string_v4(thread_->GetEcmaVM()->GetFactory()->NewFromString(" 0.000001 ")); ++ result = JSTaggedValue::ToNumber(thread_, string_v4); + EXPECT_EQ(result.GetNumber(), 0.000001); + +- JSHandle string_v5(thread->GetEcmaVM()->GetFactory()->NewFromString(" 1.23 ")); +- result = JSTaggedValue::ToNumber(thread, string_v5); ++ JSHandle string_v5(thread_->GetEcmaVM()->GetFactory()->NewFromString(" 1.23 ")); ++ result = JSTaggedValue::ToNumber(thread_, string_v5); + EXPECT_EQ(result.GetNumber(), 1.23); + +- JSHandle string_v6(thread->GetEcmaVM()->GetFactory()->NewFromString(" -1.23e2 ")); +- result = JSTaggedValue::ToNumber(thread, string_v6); ++ JSHandle string_v6(thread_->GetEcmaVM()->GetFactory()->NewFromString(" -1.23e2 ")); ++ result = JSTaggedValue::ToNumber(thread_, string_v6); + EXPECT_EQ(result.GetNumber(), -123); + +- JSHandle string_v7(thread->GetEcmaVM()->GetFactory()->NewFromString(" -123e-2")); +- result = JSTaggedValue::ToNumber(thread, string_v7); ++ JSHandle string_v7(thread_->GetEcmaVM()->GetFactory()->NewFromString(" -123e-2")); ++ result = JSTaggedValue::ToNumber(thread_, string_v7); + EXPECT_EQ(result.GetNumber(), -1.23); + +- JSHandle string_v8(thread->GetEcmaVM()->GetFactory()->NewFromString(" Infinity ")); +- result = JSTaggedValue::ToNumber(thread, string_v8); ++ JSHandle string_v8(thread_->GetEcmaVM()->GetFactory()->NewFromString(" Infinity ")); ++ result = JSTaggedValue::ToNumber(thread_, string_v8); + EXPECT_TRUE(std::isinf(result.GetNumber())); + +- JSHandle string_v9(thread->GetEcmaVM()->GetFactory()->NewFromString("100e307")); +- result = JSTaggedValue::ToNumber(thread, string_v9); ++ JSHandle string_v9(thread_->GetEcmaVM()->GetFactory()->NewFromString("100e307")); ++ result = JSTaggedValue::ToNumber(thread_, string_v9); + EXPECT_TRUE(std::isinf(result.GetNumber())); + +- JSHandle string_v10(thread->GetEcmaVM()->GetFactory()->NewFromString(" .")); +- result = JSTaggedValue::ToNumber(thread, string_v10); ++ JSHandle string_v10(thread_->GetEcmaVM()->GetFactory()->NewFromString(" .")); ++ result = JSTaggedValue::ToNumber(thread_, string_v10); + EXPECT_TRUE(std::isnan(result.GetNumber())); + +- JSHandle string_v11(thread->GetEcmaVM()->GetFactory()->NewFromString("12e+")); +- result = JSTaggedValue::ToNumber(thread, string_v11); ++ JSHandle string_v11(thread_->GetEcmaVM()->GetFactory()->NewFromString("12e+")); ++ result = JSTaggedValue::ToNumber(thread_, string_v11); + EXPECT_TRUE(std::isnan(result.GetNumber())); + +- JSHandle string_v12(thread->GetEcmaVM()->GetFactory()->NewFromString(".e3")); +- result = JSTaggedValue::ToNumber(thread, string_v12); ++ JSHandle string_v12(thread_->GetEcmaVM()->GetFactory()->NewFromString(".e3")); ++ result = JSTaggedValue::ToNumber(thread_, string_v12); + EXPECT_TRUE(std::isnan(result.GetNumber())); + +- JSHandle string_v13(thread->GetEcmaVM()->GetFactory()->NewFromString("23eE")); +- result = JSTaggedValue::ToNumber(thread, string_v13); ++ JSHandle string_v13(thread_->GetEcmaVM()->GetFactory()->NewFromString("23eE")); ++ result = JSTaggedValue::ToNumber(thread_, string_v13); + EXPECT_TRUE(std::isnan(result.GetNumber())); + +- JSHandle string_v14(thread->GetEcmaVM()->GetFactory()->NewFromString("a")); +- result = JSTaggedValue::ToNumber(thread, string_v14); ++ JSHandle string_v14(thread_->GetEcmaVM()->GetFactory()->NewFromString("a")); ++ result = JSTaggedValue::ToNumber(thread_, string_v14); + EXPECT_TRUE(std::isnan(result.GetNumber())); + +- JSHandle string_v15(thread->GetEcmaVM()->GetFactory()->NewFromString("0o12e3")); +- result = JSTaggedValue::ToNumber(thread, string_v15); ++ JSHandle string_v15(thread_->GetEcmaVM()->GetFactory()->NewFromString("0o12e3")); ++ result = JSTaggedValue::ToNumber(thread_, string_v15); + EXPECT_TRUE(std::isnan(result.GetNumber())); + +- JSHandle string_v16(thread->GetEcmaVM()->GetFactory()->NewFromString("0x12.3")); +- result = JSTaggedValue::ToNumber(thread, string_v16); ++ JSHandle string_v16(thread_->GetEcmaVM()->GetFactory()->NewFromString("0x12.3")); ++ result = JSTaggedValue::ToNumber(thread_, string_v16); + EXPECT_TRUE(std::isnan(result.GetNumber())); + +- JSHandle string_v17(thread->GetEcmaVM()->GetFactory()->NewFromString(" 12.4.")); +- result = JSTaggedValue::ToNumber(thread, string_v17); ++ JSHandle string_v17(thread_->GetEcmaVM()->GetFactory()->NewFromString(" 12.4.")); ++ result = JSTaggedValue::ToNumber(thread_, string_v17); + EXPECT_TRUE(std::isnan(result.GetNumber())); + +- JSHandle string_v18(thread->GetEcmaVM()->GetFactory()->NewFromString("123test")); +- result = JSTaggedValue::ToNumber(thread, string_v18); ++ JSHandle string_v18(thread_->GetEcmaVM()->GetFactory()->NewFromString("123test")); ++ result = JSTaggedValue::ToNumber(thread_, string_v18); + EXPECT_TRUE(std::isnan(result.GetNumber())); + +- JSHandle string_v19(thread->GetEcmaVM()->GetFactory()->NewFromString("123test")); +- result = JSTaggedValue::ToNumber(thread, string_v19); ++ JSHandle string_v19(thread_->GetEcmaVM()->GetFactory()->NewFromString("123test")); ++ result = JSTaggedValue::ToNumber(thread_, string_v19); + EXPECT_TRUE(std::isnan(result.GetNumber())); + +- JSHandle string_v20(thread->GetEcmaVM()->GetFactory()->NewFromString(" 0b ")); +- result = JSTaggedValue::ToNumber(thread, string_v20); ++ JSHandle string_v20(thread_->GetEcmaVM()->GetFactory()->NewFromString(" 0b ")); ++ result = JSTaggedValue::ToNumber(thread_, string_v20); + EXPECT_TRUE(std::isnan(result.GetNumber())); + +- JSHandle string_v21(thread->GetEcmaVM()->GetFactory()->NewFromString(" 0b0000 ")); +- result = JSTaggedValue::ToNumber(thread, string_v21); ++ JSHandle string_v21(thread_->GetEcmaVM()->GetFactory()->NewFromString(" 0b0000 ")); ++ result = JSTaggedValue::ToNumber(thread_, string_v21); + EXPECT_EQ(result.GetNumber(), 0); + +- JSHandle string_v22(thread->GetEcmaVM()->GetFactory()->NewFromString(" 0o0000 ")); +- result = JSTaggedValue::ToNumber(thread, string_v22); ++ JSHandle string_v22(thread_->GetEcmaVM()->GetFactory()->NewFromString(" 0o0000 ")); ++ result = JSTaggedValue::ToNumber(thread_, string_v22); + EXPECT_EQ(result.GetNumber(), 0); + +- JSHandle string_v23(thread->GetEcmaVM()->GetFactory()->NewFromString(" 0X0000 ")); +- result = JSTaggedValue::ToNumber(thread, string_v23); ++ JSHandle string_v23(thread_->GetEcmaVM()->GetFactory()->NewFromString(" 0X0000 ")); ++ result = JSTaggedValue::ToNumber(thread_, string_v23); + EXPECT_EQ(result.GetNumber(), 0); + +- JSHandle string_v24(thread->GetEcmaVM()->GetFactory()->NewFromString(" 000.00000 ")); +- result = JSTaggedValue::ToNumber(thread, string_v24); ++ JSHandle string_v24(thread_->GetEcmaVM()->GetFactory()->NewFromString(" 000.00000 ")); ++ result = JSTaggedValue::ToNumber(thread_, string_v24); + EXPECT_EQ(result.GetNumber(), 0); + +- JSHandle string_v25(thread->GetEcmaVM()->GetFactory()->NewFromString("")); +- result = JSTaggedValue::ToNumber(thread, string_v25); ++ JSHandle string_v25(thread_->GetEcmaVM()->GetFactory()->NewFromString("")); ++ result = JSTaggedValue::ToNumber(thread_, string_v25); + EXPECT_EQ(result.GetNumber(), 0); + +- JSHandle string_v26(thread->GetEcmaVM()->GetFactory()->NewFromString(" ")); +- result = JSTaggedValue::ToNumber(thread, string_v26); ++ JSHandle string_v26(thread_->GetEcmaVM()->GetFactory()->NewFromString(" ")); ++ result = JSTaggedValue::ToNumber(thread_, string_v26); + EXPECT_EQ(result.GetNumber(), 0); + +- JSHandle string_v27(thread->GetEcmaVM()->GetFactory()->NewFromString("0")); +- result = JSTaggedValue::ToNumber(thread, string_v27); ++ JSHandle string_v27(thread_->GetEcmaVM()->GetFactory()->NewFromString("0")); ++ result = JSTaggedValue::ToNumber(thread_, string_v27); + EXPECT_EQ(result.GetNumber(), 0); + +- JSHandle string_v28(thread->GetEcmaVM()->GetFactory()->NewFromString(" 0 ")); +- result = JSTaggedValue::ToNumber(thread, string_v28); ++ JSHandle string_v28(thread_->GetEcmaVM()->GetFactory()->NewFromString(" 0 ")); ++ result = JSTaggedValue::ToNumber(thread_, string_v28); + EXPECT_EQ(result.GetNumber(), 0); + +- JSHandle string_v29(thread->GetEcmaVM()->GetFactory()->NewFromString("00000000")); +- result = JSTaggedValue::ToNumber(thread, string_v29); ++ JSHandle string_v29(thread_->GetEcmaVM()->GetFactory()->NewFromString("00000000")); ++ result = JSTaggedValue::ToNumber(thread_, string_v29); + EXPECT_EQ(result.GetNumber(), 0); + +- JSHandle string_v30(thread->GetEcmaVM()->GetFactory()->NewFromString(" 00000000 ")); +- result = JSTaggedValue::ToNumber(thread, string_v30); ++ JSHandle string_v30(thread_->GetEcmaVM()->GetFactory()->NewFromString(" 00000000 ")); ++ result = JSTaggedValue::ToNumber(thread_, string_v30); + EXPECT_EQ(result.GetNumber(), 0); + +- thread->ClearException(); +- JSHandle symbol_v1(thread->GetEcmaVM()->GetFactory()->NewJSSymbol()); +- JSTaggedValue::ToNumber(thread, symbol_v1); +- EXPECT_TRUE(thread->HasPendingException()); +- EXPECT_TRUE(thread->GetException().IsJSError()); ++ thread_->ClearException(); ++ JSHandle symbol_v1(thread_->GetEcmaVM()->GetFactory()->NewJSSymbol()); ++ JSTaggedValue::ToNumber(thread_, symbol_v1); ++ EXPECT_TRUE(thread_->HasPendingException()); ++ EXPECT_TRUE(thread_->GetException().IsJSError()); + } + + TEST_F(JSTaggedValueTest, ToInteger) +@@ -342,35 +342,35 @@ TEST_F(JSTaggedValueTest, ToInteger) + JSTaggedNumber result; + + JSTaggedValue int_v(100); +- result = JSTaggedValue::ToInteger(thread, JSHandle(thread, int_v)); ++ result = JSTaggedValue::ToInteger(thread_, JSHandle(thread_, int_v)); + EXPECT_EQ(result.GetNumber(), 100); + + JSTaggedValue double_v1((double)100.0); +- result = JSTaggedValue::ToInteger(thread, JSHandle(thread, double_v1)); ++ result = JSTaggedValue::ToInteger(thread_, JSHandle(thread_, double_v1)); + EXPECT_EQ(result.GetNumber(), (double)100.0); + + JSTaggedValue double_v2((double)100.123); +- result = JSTaggedValue::ToInteger(thread, JSHandle(thread, double_v2)); ++ result = JSTaggedValue::ToInteger(thread_, JSHandle(thread_, double_v2)); + EXPECT_EQ(result.GetNumber(), (double)100); + + JSTaggedValue undefined_v = JSTaggedValue::Undefined(); +- result = JSTaggedValue::ToInteger(thread, JSHandle(thread, undefined_v)); ++ result = JSTaggedValue::ToInteger(thread_, JSHandle(thread_, undefined_v)); + EXPECT_EQ(result.GetNumber(), 0); + + JSTaggedValue hole_v = JSTaggedValue::Hole(); +- result = JSTaggedValue::ToInteger(thread, JSHandle(thread, hole_v)); ++ result = JSTaggedValue::ToInteger(thread_, JSHandle(thread_, hole_v)); + EXPECT_EQ(result.GetNumber(), 0); + + JSTaggedValue null_v = JSTaggedValue::Null(); +- result = JSTaggedValue::ToInteger(thread, JSHandle(thread, null_v)); ++ result = JSTaggedValue::ToInteger(thread_, JSHandle(thread_, null_v)); + EXPECT_EQ(result.GetNumber(), 0); + + JSTaggedValue false_v = JSTaggedValue::False(); +- result = JSTaggedValue::ToInteger(thread, JSHandle(thread, false_v)); ++ result = JSTaggedValue::ToInteger(thread_, JSHandle(thread_, false_v)); + EXPECT_EQ(result.GetNumber(), 0); + + JSTaggedValue true_v = JSTaggedValue::True(); +- result = JSTaggedValue::ToInteger(thread, JSHandle(thread, true_v)); ++ result = JSTaggedValue::ToInteger(thread_, JSHandle(thread_, true_v)); + EXPECT_EQ(result.GetNumber(), 1); + } + +@@ -379,50 +379,50 @@ TEST_F(JSTaggedValueTest, ToInt32) + int32_t result; + + JSTaggedValue int_v(100); +- result = JSTaggedValue::ToInt32(thread, JSHandle(thread, int_v)); ++ result = JSTaggedValue::ToInt32(thread_, JSHandle(thread_, int_v)); + EXPECT_EQ(result, 100); + + JSTaggedValue double_v1((double)100.0); +- result = JSTaggedValue::ToInt32(thread, JSHandle(thread, double_v1)); ++ result = JSTaggedValue::ToInt32(thread_, JSHandle(thread_, double_v1)); + EXPECT_EQ(result, 100); + + JSTaggedValue double_v2((double)100.123); +- result = JSTaggedValue::ToInt32(thread, JSHandle(thread, double_v2)); ++ result = JSTaggedValue::ToInt32(thread_, JSHandle(thread_, double_v2)); + EXPECT_EQ(result, 100); + + double input_1 = (static_cast(UINT32_MAX) + 1) + 12345; + JSTaggedValue double_v3(input_1); +- result = JSTaggedValue::ToInt32(thread, JSHandle(thread, double_v3)); ++ result = JSTaggedValue::ToInt32(thread_, JSHandle(thread_, double_v3)); + EXPECT_EQ(result, 12345); + + double input_2 = 100 * (static_cast(UINT32_MAX) + 1) + 23456; + JSTaggedValue double_v4(input_2); +- result = JSTaggedValue::ToInt32(thread, JSHandle(thread, double_v4)); ++ result = JSTaggedValue::ToInt32(thread_, JSHandle(thread_, double_v4)); + EXPECT_EQ(result, 23456); + + double input_3 = 100 * (static_cast(UINT32_MAX) + 1) + INT32_MAX + 1 + 23456; + JSTaggedValue double_v5(input_3); +- result = JSTaggedValue::ToInt32(thread, JSHandle(thread, double_v5)); ++ result = JSTaggedValue::ToInt32(thread_, JSHandle(thread_, double_v5)); + EXPECT_EQ(result, 23456 - static_cast(INT32_MAX) - 1); + + JSTaggedValue undefined_v = JSTaggedValue::Undefined(); +- result = JSTaggedValue::ToInt32(thread, JSHandle(thread, undefined_v)); ++ result = JSTaggedValue::ToInt32(thread_, JSHandle(thread_, undefined_v)); + EXPECT_EQ(result, 0); + + JSTaggedValue hole_v = JSTaggedValue::Hole(); +- result = JSTaggedValue::ToInt32(thread, JSHandle(thread, hole_v)); ++ result = JSTaggedValue::ToInt32(thread_, JSHandle(thread_, hole_v)); + EXPECT_EQ(result, 0); + + JSTaggedValue null_v = JSTaggedValue::Null(); +- result = JSTaggedValue::ToInt32(thread, JSHandle(thread, null_v)); ++ result = JSTaggedValue::ToInt32(thread_, JSHandle(thread_, null_v)); + EXPECT_EQ(result, 0); + + JSTaggedValue false_v = JSTaggedValue::False(); +- result = JSTaggedValue::ToInt32(thread, JSHandle(thread, false_v)); ++ result = JSTaggedValue::ToInt32(thread_, JSHandle(thread_, false_v)); + EXPECT_EQ(result, 0); + + JSTaggedValue true_v = JSTaggedValue::True(); +- result = JSTaggedValue::ToInt32(thread, JSHandle(thread, true_v)); ++ result = JSTaggedValue::ToInt32(thread_, JSHandle(thread_, true_v)); + EXPECT_EQ(result, 1); + } + +@@ -431,50 +431,50 @@ TEST_F(JSTaggedValueTest, ToUint32) + uint32_t result; + + JSTaggedValue int_v(100); +- result = JSTaggedValue::ToUint32(thread, JSHandle(thread, int_v)); ++ result = JSTaggedValue::ToUint32(thread_, JSHandle(thread_, int_v)); + EXPECT_EQ(result, 100); + + JSTaggedValue double_v1((double)100.0); +- result = JSTaggedValue::ToUint32(thread, JSHandle(thread, double_v1)); ++ result = JSTaggedValue::ToUint32(thread_, JSHandle(thread_, double_v1)); + EXPECT_EQ(result, 100); + + JSTaggedValue double_v2((double)100.123); +- result = JSTaggedValue::ToUint32(thread, JSHandle(thread, double_v2)); ++ result = JSTaggedValue::ToUint32(thread_, JSHandle(thread_, double_v2)); + EXPECT_EQ(result, 100); + + double input_1 = (static_cast(UINT32_MAX) + 1) + 12345; + JSTaggedValue double_v3(input_1); +- result = JSTaggedValue::ToUint32(thread, JSHandle(thread, double_v3)); ++ result = JSTaggedValue::ToUint32(thread_, JSHandle(thread_, double_v3)); + EXPECT_EQ(result, 12345); + + double input_2 = 100 * (static_cast(UINT32_MAX) + 1) + 23456; + JSTaggedValue double_v4(input_2); +- result = JSTaggedValue::ToUint32(thread, JSHandle(thread, double_v4)); ++ result = JSTaggedValue::ToUint32(thread_, JSHandle(thread_, double_v4)); + EXPECT_EQ(result, 23456); + + double input_3 = 100 * (static_cast(UINT32_MAX) + 1) + INT32_MAX + 1 + 23456; + JSTaggedValue double_v5(input_3); +- result = JSTaggedValue::ToUint32(thread, JSHandle(thread, double_v5)); ++ result = JSTaggedValue::ToUint32(thread_, JSHandle(thread_, double_v5)); + EXPECT_EQ(result, static_cast(INT32_MAX) + 1 + 23456); + + JSTaggedValue undefined_v = JSTaggedValue::Undefined(); +- result = JSTaggedValue::ToUint32(thread, JSHandle(thread, undefined_v)); ++ result = JSTaggedValue::ToUint32(thread_, JSHandle(thread_, undefined_v)); + EXPECT_EQ(result, 0); + + JSTaggedValue hole_v = JSTaggedValue::Hole(); +- result = JSTaggedValue::ToUint32(thread, JSHandle(thread, hole_v)); ++ result = JSTaggedValue::ToUint32(thread_, JSHandle(thread_, hole_v)); + EXPECT_EQ(result, 0); + + JSTaggedValue null_v = JSTaggedValue::Null(); +- result = JSTaggedValue::ToUint32(thread, JSHandle(thread, null_v)); ++ result = JSTaggedValue::ToUint32(thread_, JSHandle(thread_, null_v)); + EXPECT_EQ(result, 0); + + JSTaggedValue false_v = JSTaggedValue::False(); +- result = JSTaggedValue::ToUint32(thread, JSHandle(thread, false_v)); ++ result = JSTaggedValue::ToUint32(thread_, JSHandle(thread_, false_v)); + EXPECT_EQ(result, 0); + + JSTaggedValue true_v = JSTaggedValue::True(); +- result = JSTaggedValue::ToUint32(thread, JSHandle(thread, true_v)); ++ result = JSTaggedValue::ToUint32(thread_, JSHandle(thread_, true_v)); + EXPECT_EQ(result, 1); + } + +@@ -483,50 +483,50 @@ TEST_F(JSTaggedValueTest, ToInt16) + int32_t result; + + JSTaggedValue int_v(100); +- result = JSTaggedValue::ToInt16(thread, JSHandle(thread, int_v)); ++ result = JSTaggedValue::ToInt16(thread_, JSHandle(thread_, int_v)); + EXPECT_EQ(result, 100); + + JSTaggedValue double_v1((double)100.0); +- result = JSTaggedValue::ToInt16(thread, JSHandle(thread, double_v1)); ++ result = JSTaggedValue::ToInt16(thread_, JSHandle(thread_, double_v1)); + EXPECT_EQ(result, 100); + + JSTaggedValue double_v2((double)100.123); +- result = JSTaggedValue::ToInt16(thread, JSHandle(thread, double_v2)); ++ result = JSTaggedValue::ToInt16(thread_, JSHandle(thread_, double_v2)); + EXPECT_EQ(result, 100); + + double input_1 = (static_cast(UINT16_MAX) + 1) + 12345; + JSTaggedValue double_v3(input_1); +- result = JSTaggedValue::ToInt16(thread, JSHandle(thread, double_v3)); ++ result = JSTaggedValue::ToInt16(thread_, JSHandle(thread_, double_v3)); + EXPECT_EQ(result, 12345); + + double input_2 = 100 * (static_cast(UINT16_MAX) + 1) + 23456; + JSTaggedValue double_v4(input_2); +- result = JSTaggedValue::ToInt16(thread, JSHandle(thread, double_v4)); ++ result = JSTaggedValue::ToInt16(thread_, JSHandle(thread_, double_v4)); + EXPECT_EQ(result, 23456); + + double input_3 = 100 * (static_cast(UINT16_MAX) + 1) + INT16_MAX + 1 + 23456; + JSTaggedValue double_v5(input_3); +- result = JSTaggedValue::ToInt16(thread, JSHandle(thread, double_v5)); ++ result = JSTaggedValue::ToInt16(thread_, JSHandle(thread_, double_v5)); + EXPECT_EQ(result, 23456 - static_cast(INT16_MAX) - 1); + + JSTaggedValue undefined_v = JSTaggedValue::Undefined(); +- result = JSTaggedValue::ToInt16(thread, JSHandle(thread, undefined_v)); ++ result = JSTaggedValue::ToInt16(thread_, JSHandle(thread_, undefined_v)); + EXPECT_EQ(result, 0); + + JSTaggedValue hole_v = JSTaggedValue::Hole(); +- result = JSTaggedValue::ToInt16(thread, JSHandle(thread, hole_v)); ++ result = JSTaggedValue::ToInt16(thread_, JSHandle(thread_, hole_v)); + EXPECT_EQ(result, 0); + + JSTaggedValue null_v = JSTaggedValue::Null(); +- result = JSTaggedValue::ToInt16(thread, JSHandle(thread, null_v)); ++ result = JSTaggedValue::ToInt16(thread_, JSHandle(thread_, null_v)); + EXPECT_EQ(result, 0); + + JSTaggedValue false_v = JSTaggedValue::False(); +- result = JSTaggedValue::ToInt16(thread, JSHandle(thread, false_v)); ++ result = JSTaggedValue::ToInt16(thread_, JSHandle(thread_, false_v)); + EXPECT_EQ(result, 0); + + JSTaggedValue true_v = JSTaggedValue::True(); +- result = JSTaggedValue::ToInt16(thread, JSHandle(thread, true_v)); ++ result = JSTaggedValue::ToInt16(thread_, JSHandle(thread_, true_v)); + EXPECT_EQ(result, 1); + } + +@@ -535,50 +535,50 @@ TEST_F(JSTaggedValueTest, ToUint16) + uint32_t result; + + JSTaggedValue int_v(100); +- result = JSTaggedValue::ToUint16(thread, JSHandle(thread, int_v)); ++ result = JSTaggedValue::ToUint16(thread_, JSHandle(thread_, int_v)); + EXPECT_EQ(result, 100); + + JSTaggedValue double_v1((double)100.0); +- result = JSTaggedValue::ToUint16(thread, JSHandle(thread, double_v1)); ++ result = JSTaggedValue::ToUint16(thread_, JSHandle(thread_, double_v1)); + EXPECT_EQ(result, 100); + + JSTaggedValue double_v2((double)100.123); +- result = JSTaggedValue::ToUint16(thread, JSHandle(thread, double_v2)); ++ result = JSTaggedValue::ToUint16(thread_, JSHandle(thread_, double_v2)); + EXPECT_EQ(result, 100); + + double input_1 = (static_cast(UINT16_MAX) + 1) + 12345; + JSTaggedValue double_v3(input_1); +- result = JSTaggedValue::ToUint16(thread, JSHandle(thread, double_v3)); ++ result = JSTaggedValue::ToUint16(thread_, JSHandle(thread_, double_v3)); + EXPECT_EQ(result, 12345); + + double input_2 = 100 * (static_cast(UINT16_MAX) + 1) + 23456; + JSTaggedValue double_v4(input_2); +- result = JSTaggedValue::ToUint16(thread, JSHandle(thread, double_v4)); ++ result = JSTaggedValue::ToUint16(thread_, JSHandle(thread_, double_v4)); + EXPECT_EQ(result, 23456); + + double input_3 = 100 * (static_cast(UINT16_MAX) + 1) + INT16_MAX + 1 + 23456; + JSTaggedValue double_v5(input_3); +- result = JSTaggedValue::ToUint16(thread, JSHandle(thread, double_v5)); ++ result = JSTaggedValue::ToUint16(thread_, JSHandle(thread_, double_v5)); + EXPECT_EQ(result, static_cast(INT16_MAX) + 1 + 23456); + + JSTaggedValue undefined_v = JSTaggedValue::Undefined(); +- result = JSTaggedValue::ToUint16(thread, JSHandle(thread, undefined_v)); ++ result = JSTaggedValue::ToUint16(thread_, JSHandle(thread_, undefined_v)); + EXPECT_EQ(result, 0); + + JSTaggedValue hole_v = JSTaggedValue::Hole(); +- result = JSTaggedValue::ToUint16(thread, JSHandle(thread, hole_v)); ++ result = JSTaggedValue::ToUint16(thread_, JSHandle(thread_, hole_v)); + EXPECT_EQ(result, 0); + + JSTaggedValue null_v = JSTaggedValue::Null(); +- result = JSTaggedValue::ToUint16(thread, JSHandle(thread, null_v)); ++ result = JSTaggedValue::ToUint16(thread_, JSHandle(thread_, null_v)); + EXPECT_EQ(result, 0); + + JSTaggedValue false_v = JSTaggedValue::False(); +- result = JSTaggedValue::ToUint16(thread, JSHandle(thread, false_v)); ++ result = JSTaggedValue::ToUint16(thread_, JSHandle(thread_, false_v)); + EXPECT_EQ(result, 0); + + JSTaggedValue true_v = JSTaggedValue::True(); +- result = JSTaggedValue::ToUint16(thread, JSHandle(thread, true_v)); ++ result = JSTaggedValue::ToUint16(thread_, JSHandle(thread_, true_v)); + EXPECT_EQ(result, 1); + } + +@@ -587,50 +587,50 @@ TEST_F(JSTaggedValueTest, ToInt8) + int32_t result; + + JSTaggedValue int_v(100); +- result = JSTaggedValue::ToInt8(thread, JSHandle(thread, int_v)); ++ result = JSTaggedValue::ToInt8(thread_, JSHandle(thread_, int_v)); + EXPECT_EQ(result, 100); + + JSTaggedValue double_v1((double)100.0); +- result = JSTaggedValue::ToInt8(thread, JSHandle(thread, double_v1)); ++ result = JSTaggedValue::ToInt8(thread_, JSHandle(thread_, double_v1)); + EXPECT_EQ(result, 100); + + JSTaggedValue double_v2((double)100.123); +- result = JSTaggedValue::ToInt8(thread, JSHandle(thread, double_v2)); ++ result = JSTaggedValue::ToInt8(thread_, JSHandle(thread_, double_v2)); + EXPECT_EQ(result, 100); + + double input_1 = (static_cast(UINT8_MAX) + 1) + 45; + JSTaggedValue double_v3(input_1); +- result = JSTaggedValue::ToInt8(thread, JSHandle(thread, double_v3)); ++ result = JSTaggedValue::ToInt8(thread_, JSHandle(thread_, double_v3)); + EXPECT_EQ(result, 45); + + double input_2 = 100 * (static_cast(UINT8_MAX) + 1) + 56; + JSTaggedValue double_v4(input_2); +- result = JSTaggedValue::ToInt8(thread, JSHandle(thread, double_v4)); ++ result = JSTaggedValue::ToInt8(thread_, JSHandle(thread_, double_v4)); + EXPECT_EQ(result, 56); + + double input_3 = 100 * (static_cast(UINT8_MAX) + 1) + INT8_MAX + 1 + 23; + JSTaggedValue double_v5(input_3); +- result = JSTaggedValue::ToInt8(thread, JSHandle(thread, double_v5)); ++ result = JSTaggedValue::ToInt8(thread_, JSHandle(thread_, double_v5)); + EXPECT_EQ(result, 23 - static_cast(INT8_MAX) - 1); + + JSTaggedValue undefined_v = JSTaggedValue::Undefined(); +- result = JSTaggedValue::ToInt8(thread, JSHandle(thread, undefined_v)); ++ result = JSTaggedValue::ToInt8(thread_, JSHandle(thread_, undefined_v)); + EXPECT_EQ(result, 0); + + JSTaggedValue hole_v = JSTaggedValue::Hole(); +- result = JSTaggedValue::ToInt8(thread, JSHandle(thread, hole_v)); ++ result = JSTaggedValue::ToInt8(thread_, JSHandle(thread_, hole_v)); + EXPECT_EQ(result, 0); + + JSTaggedValue null_v = JSTaggedValue::Null(); +- result = JSTaggedValue::ToInt8(thread, JSHandle(thread, null_v)); ++ result = JSTaggedValue::ToInt8(thread_, JSHandle(thread_, null_v)); + EXPECT_EQ(result, 0); + + JSTaggedValue false_v = JSTaggedValue::False(); +- result = JSTaggedValue::ToInt8(thread, JSHandle(thread, false_v)); ++ result = JSTaggedValue::ToInt8(thread_, JSHandle(thread_, false_v)); + EXPECT_EQ(result, 0); + + JSTaggedValue true_v = JSTaggedValue::True(); +- result = JSTaggedValue::ToInt8(thread, JSHandle(thread, true_v)); ++ result = JSTaggedValue::ToInt8(thread_, JSHandle(thread_, true_v)); + EXPECT_EQ(result, 1); + } + +@@ -639,50 +639,50 @@ TEST_F(JSTaggedValueTest, ToUint8) + uint32_t result; + + JSTaggedValue int_v(100); +- result = JSTaggedValue::ToUint8(thread, JSHandle(thread, int_v)); ++ result = JSTaggedValue::ToUint8(thread_, JSHandle(thread_, int_v)); + EXPECT_EQ(result, 100); + + JSTaggedValue double_v1((double)100.0); +- result = JSTaggedValue::ToUint8(thread, JSHandle(thread, double_v1)); ++ result = JSTaggedValue::ToUint8(thread_, JSHandle(thread_, double_v1)); + EXPECT_EQ(result, 100); + + JSTaggedValue double_v2((double)100.123); +- result = JSTaggedValue::ToUint8(thread, JSHandle(thread, double_v2)); ++ result = JSTaggedValue::ToUint8(thread_, JSHandle(thread_, double_v2)); + EXPECT_EQ(result, 100); + + double input_1 = (static_cast(UINT8_MAX) + 1) + 34; + JSTaggedValue double_v3(input_1); +- result = JSTaggedValue::ToUint8(thread, JSHandle(thread, double_v3)); ++ result = JSTaggedValue::ToUint8(thread_, JSHandle(thread_, double_v3)); + EXPECT_EQ(result, 34); + + double input_2 = 100 * (static_cast(UINT8_MAX) + 1) + 45; + JSTaggedValue double_v4(input_2); +- result = JSTaggedValue::ToUint8(thread, JSHandle(thread, double_v4)); ++ result = JSTaggedValue::ToUint8(thread_, JSHandle(thread_, double_v4)); + EXPECT_EQ(result, 45); + + double input_3 = 100 * (static_cast(UINT8_MAX) + 1) + INT8_MAX + 1 + 56; + JSTaggedValue double_v5(input_3); +- result = JSTaggedValue::ToUint8(thread, JSHandle(thread, double_v5)); ++ result = JSTaggedValue::ToUint8(thread_, JSHandle(thread_, double_v5)); + EXPECT_EQ(result, static_cast(INT8_MAX) + 1 + 56); + + JSTaggedValue undefined_v = JSTaggedValue::Undefined(); +- result = JSTaggedValue::ToUint8(thread, JSHandle(thread, undefined_v)); ++ result = JSTaggedValue::ToUint8(thread_, JSHandle(thread_, undefined_v)); + EXPECT_EQ(result, 0); + + JSTaggedValue hole_v = JSTaggedValue::Hole(); +- result = JSTaggedValue::ToUint8(thread, JSHandle(thread, hole_v)); ++ result = JSTaggedValue::ToUint8(thread_, JSHandle(thread_, hole_v)); + EXPECT_EQ(result, 0); + + JSTaggedValue null_v = JSTaggedValue::Null(); +- result = JSTaggedValue::ToUint8(thread, JSHandle(thread, null_v)); ++ result = JSTaggedValue::ToUint8(thread_, JSHandle(thread_, null_v)); + EXPECT_EQ(result, 0); + + JSTaggedValue false_v = JSTaggedValue::False(); +- result = JSTaggedValue::ToUint8(thread, JSHandle(thread, false_v)); ++ result = JSTaggedValue::ToUint8(thread_, JSHandle(thread_, false_v)); + EXPECT_EQ(result, 0); + + JSTaggedValue true_v = JSTaggedValue::True(); +- result = JSTaggedValue::ToUint8(thread, JSHandle(thread, true_v)); ++ result = JSTaggedValue::ToUint8(thread_, JSHandle(thread_, true_v)); + EXPECT_EQ(result, 1); + } + +@@ -691,64 +691,64 @@ TEST_F(JSTaggedValueTest, ToUint8Clamp) + uint32_t result; + + JSTaggedValue int_v1(-100); +- result = JSTaggedValue::ToUint8Clamp(thread, JSHandle(thread, int_v1)); ++ result = JSTaggedValue::ToUint8Clamp(thread_, JSHandle(thread_, int_v1)); + EXPECT_EQ(result, 0); + + JSTaggedValue int_v2(100); +- result = JSTaggedValue::ToUint8Clamp(thread, JSHandle(thread, int_v2)); ++ result = JSTaggedValue::ToUint8Clamp(thread_, JSHandle(thread_, int_v2)); + EXPECT_EQ(result, 100); + + JSTaggedValue int_v3(300); +- result = JSTaggedValue::ToUint8Clamp(thread, JSHandle(thread, int_v3)); ++ result = JSTaggedValue::ToUint8Clamp(thread_, JSHandle(thread_, int_v3)); + EXPECT_EQ(result, 255); + + JSTaggedValue double_v1((double)-100.123); +- result = JSTaggedValue::ToUint8Clamp(thread, JSHandle(thread, double_v1)); ++ result = JSTaggedValue::ToUint8Clamp(thread_, JSHandle(thread_, double_v1)); + EXPECT_EQ(result, 0); + + JSTaggedValue double_v2((double)100.123); +- result = JSTaggedValue::ToUint8Clamp(thread, JSHandle(thread, double_v2)); ++ result = JSTaggedValue::ToUint8Clamp(thread_, JSHandle(thread_, double_v2)); + EXPECT_EQ(result, 100); + + JSTaggedValue double_v3((double)100.55); +- result = JSTaggedValue::ToUint8Clamp(thread, JSHandle(thread, double_v3)); ++ result = JSTaggedValue::ToUint8Clamp(thread_, JSHandle(thread_, double_v3)); + EXPECT_EQ(result, 101); + + JSTaggedValue double_v4((double)99.9); +- result = JSTaggedValue::ToUint8Clamp(thread, JSHandle(thread, double_v4)); ++ result = JSTaggedValue::ToUint8Clamp(thread_, JSHandle(thread_, double_v4)); + EXPECT_EQ(result, 100); + + JSTaggedValue double_v5((double)300.5); +- result = JSTaggedValue::ToUint8Clamp(thread, JSHandle(thread, double_v5)); ++ result = JSTaggedValue::ToUint8Clamp(thread_, JSHandle(thread_, double_v5)); + EXPECT_EQ(result, 255); + + JSTaggedValue undefined_v = JSTaggedValue::Undefined(); +- result = JSTaggedValue::ToUint8Clamp(thread, JSHandle(thread, undefined_v)); ++ result = JSTaggedValue::ToUint8Clamp(thread_, JSHandle(thread_, undefined_v)); + EXPECT_EQ(result, 0); + + JSTaggedValue hole_v = JSTaggedValue::Hole(); +- result = JSTaggedValue::ToUint8Clamp(thread, JSHandle(thread, hole_v)); ++ result = JSTaggedValue::ToUint8Clamp(thread_, JSHandle(thread_, hole_v)); + EXPECT_EQ(result, 0); + + JSTaggedValue null_v = JSTaggedValue::Null(); +- result = JSTaggedValue::ToUint8Clamp(thread, JSHandle(thread, null_v)); ++ result = JSTaggedValue::ToUint8Clamp(thread_, JSHandle(thread_, null_v)); + EXPECT_EQ(result, 0); + + JSTaggedValue false_v = JSTaggedValue::False(); +- result = JSTaggedValue::ToUint8Clamp(thread, JSHandle(thread, false_v)); ++ result = JSTaggedValue::ToUint8Clamp(thread_, JSHandle(thread_, false_v)); + EXPECT_EQ(result, 0); + + JSTaggedValue true_v = JSTaggedValue::True(); +- result = JSTaggedValue::ToUint8Clamp(thread, JSHandle(thread, true_v)); ++ result = JSTaggedValue::ToUint8Clamp(thread_, JSHandle(thread_, true_v)); + EXPECT_EQ(result, 1); + } + + TEST_F(JSTaggedValueTest, ToPropertyKey) + { + JSTaggedValue result; +- JSHandle str = thread->GetEcmaVM()->GetFactory()->NewFromString("null"); ++ JSHandle str = thread_->GetEcmaVM()->GetFactory()->NewFromString("null"); + JSTaggedValue key = str.GetTaggedValue(); +- result = JSTaggedValue::ToPropertyKey(thread, JSHandle(thread, key)).GetTaggedValue(); ++ result = JSTaggedValue::ToPropertyKey(thread_, JSHandle(thread_, key)).GetTaggedValue(); + EXPECT_TRUE(key == result); + } + +@@ -771,95 +771,95 @@ void CheckOkString(JSThread *thread, const JSHandle &tagged, CStr + TEST_F(JSTaggedValueTest, ToString) + { + CString rightCStr = ""; +- CheckOkString(thread, JSHandle(thread, JSTaggedValue()), rightCStr); ++ CheckOkString(thread_, JSHandle(thread_, JSTaggedValue()), rightCStr); + + rightCStr = "undefined"; +- CheckOkString(thread, JSHandle(thread, JSTaggedValue::Undefined()), rightCStr); ++ CheckOkString(thread_, JSHandle(thread_, JSTaggedValue::Undefined()), rightCStr); + + rightCStr = "null"; +- CheckOkString(thread, JSHandle(thread, JSTaggedValue::Null()), rightCStr); ++ CheckOkString(thread_, JSHandle(thread_, JSTaggedValue::Null()), rightCStr); + + rightCStr = "true"; +- CheckOkString(thread, JSHandle(thread, JSTaggedValue::True()), rightCStr); ++ CheckOkString(thread_, JSHandle(thread_, JSTaggedValue::True()), rightCStr); + + rightCStr = "false"; +- CheckOkString(thread, JSHandle(thread, JSTaggedValue::False()), rightCStr); ++ CheckOkString(thread_, JSHandle(thread_, JSTaggedValue::False()), rightCStr); + + rightCStr = "hello world"; +- CheckOkString(thread, +- JSHandle(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(rightCStr)), ++ CheckOkString(thread_, ++ JSHandle(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(rightCStr)), + rightCStr); + + double num = 1; + JSTaggedNumber numberNum = JSTaggedNumber(num); + rightCStr = "1"; +- CheckOkString(thread, JSHandle(thread, numberNum), rightCStr); ++ CheckOkString(thread_, JSHandle(thread_, numberNum), rightCStr); + + num = 1.23; + numberNum = JSTaggedNumber(num); + rightCStr = "1.23"; +- CheckOkString(thread, JSHandle(thread, numberNum), rightCStr); ++ CheckOkString(thread_, JSHandle(thread_, numberNum), rightCStr); + + int numInt = 2; +- JSHandle value1(thread, JSTaggedValue(numInt)); ++ JSHandle value1(thread_, JSTaggedValue(numInt)); + rightCStr = "2"; +- CheckOkString(thread, JSHandle::Cast(JSTaggedValue::ToObject(thread, value1)), rightCStr); ++ CheckOkString(thread_, JSHandle::Cast(JSTaggedValue::ToObject(thread_, value1)), rightCStr); + + num = 1.23; +- JSHandle value2(thread, JSTaggedValue(num)); ++ JSHandle value2(thread_, JSTaggedValue(num)); + rightCStr = "1.23"; +- CheckOkString(thread, JSHandle::Cast(JSTaggedValue::ToObject(thread, value2)), rightCStr); ++ CheckOkString(thread_, JSHandle::Cast(JSTaggedValue::ToObject(thread_, value2)), rightCStr); + + bool valueBool = true; +- JSHandle value3(thread, JSTaggedValue(valueBool)); ++ JSHandle value3(thread_, JSTaggedValue(valueBool)); + rightCStr = "true"; +- CheckOkString(thread, JSHandle::Cast(JSTaggedValue::ToObject(thread, value3)), rightCStr); ++ CheckOkString(thread_, JSHandle::Cast(JSTaggedValue::ToObject(thread_, value3)), rightCStr); + } + + TEST_F(JSTaggedValueTest, CanonicalNumericIndexString) + { + JSTaggedValue result; + +- JSHandle str = thread->GetEcmaVM()->GetFactory()->NewFromString("-0"); ++ JSHandle str = thread_->GetEcmaVM()->GetFactory()->NewFromString("-0"); + JSTaggedValue tmp_str = str.GetTaggedValue(); +- result = JSTaggedValue::CanonicalNumericIndexString(thread, JSHandle(thread, tmp_str)); ++ result = JSTaggedValue::CanonicalNumericIndexString(thread_, JSHandle(thread_, tmp_str)); + EXPECT_EQ(result.GetDouble(), -0.0); + + JSTaggedValue tmp_int(1); +- result = JSTaggedValue::CanonicalNumericIndexString(thread, JSHandle(thread, tmp_int)); ++ result = JSTaggedValue::CanonicalNumericIndexString(thread_, JSHandle(thread_, tmp_int)); + EXPECT_TRUE(result.IsUndefined()); + + JSTaggedValue tmp_double((double)100.0); +- result = JSTaggedValue::CanonicalNumericIndexString(thread, JSHandle(thread, tmp_double)); ++ result = JSTaggedValue::CanonicalNumericIndexString(thread_, JSHandle(thread_, tmp_double)); + EXPECT_TRUE(result.IsUndefined()); + } + + TEST_F(JSTaggedValueTest, ToObject) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + + // int -> JSObject +- JSHandle value1(thread, JSTaggedValue(2)); ++ JSHandle value1(thread_, JSTaggedValue(2)); + JSTaggedValue tagged1 = +- JSTaggedValue(JSHandle::Cast(JSTaggedValue::ToObject(thread, value1))->GetValue()); ++ JSTaggedValue(JSHandle::Cast(JSTaggedValue::ToObject(thread_, value1))->GetValue()); + EXPECT_EQ(tagged1.GetRawData(), JSTaggedValue(2).GetRawData()); + + // double -> JSObject +- JSHandle value2(thread, JSTaggedValue(2.2)); ++ JSHandle value2(thread_, JSTaggedValue(2.2)); + JSTaggedValue tagged2 = +- JSTaggedValue(JSHandle::Cast(JSTaggedValue::ToObject(thread, value2))->GetValue()); ++ JSTaggedValue(JSHandle::Cast(JSTaggedValue::ToObject(thread_, value2))->GetValue()); + EXPECT_EQ(tagged2.GetRawData(), JSTaggedValue(static_cast(2.2)).GetRawData()); + + // bool -> JSObject +- JSHandle value3(thread, JSTaggedValue::True()); ++ JSHandle value3(thread_, JSTaggedValue::True()); + JSTaggedValue tagged3 = +- JSTaggedValue(JSHandle::Cast(JSTaggedValue::ToObject(thread, value3))->GetValue()); ++ JSTaggedValue(JSHandle::Cast(JSTaggedValue::ToObject(thread_, value3))->GetValue()); + EXPECT_EQ(tagged3.GetRawData(), JSTaggedValue::True().GetRawData()); + + // String -> JSObject + JSHandle value4(factory->NewFromString("aaa")); + JSTaggedValue tagged4 = +- JSTaggedValue(JSHandle::Cast(JSTaggedValue::ToObject(thread, value4))->GetValue()); ++ JSTaggedValue(JSHandle::Cast(JSTaggedValue::ToObject(thread_, value4))->GetValue()); + EXPECT_TRUE(tagged4.IsString()); + EXPECT_EQ(reinterpret_cast(tagged4.GetRawData())->Compare(value4.GetObject()), 0); + +@@ -868,18 +868,18 @@ TEST_F(JSTaggedValueTest, ToObject) + JSHandle str = factory->NewFromString("bbb"); + JSHandle value5(symbol); + JSTaggedValue tagged5 = +- JSTaggedValue(JSHandle::Cast(JSTaggedValue::ToObject(thread, value5))->GetValue()); ++ JSTaggedValue(JSHandle::Cast(JSTaggedValue::ToObject(thread_, value5))->GetValue()); + EXPECT_EQ(EcmaString::Cast(reinterpret_cast(tagged5.GetRawData())->GetDescription().GetHeapObject()) + ->Compare(*str), + 0); + EXPECT_TRUE(tagged5.IsSymbol()); + + // JSObject(include all types of objects inherited from JSObject) -> JSObject +- EcmaVM *ecma = thread->GetEcmaVM(); ++ EcmaVM *ecma = thread_->GetEcmaVM(); + JSHandle object_fun = ecma->GetGlobalEnv()->GetObjectFunction(); + JSHandle js_obj = factory->NewJSObjectByConstructor(JSHandle(object_fun), object_fun); + JSHandle value(js_obj); +- EXPECT_EQ(*JSTaggedValue::ToObject(thread, value), *js_obj); ++ EXPECT_EQ(*JSTaggedValue::ToObject(thread_, value), *js_obj); + } + + TEST_F(JSTaggedValueTest, ToLength) +@@ -887,68 +887,68 @@ TEST_F(JSTaggedValueTest, ToLength) + JSTaggedNumber result; + + JSTaggedValue int_v(100); +- result = JSTaggedValue::ToLength(thread, JSHandle(thread, int_v)); ++ result = JSTaggedValue::ToLength(thread_, JSHandle(thread_, int_v)); + EXPECT_EQ(result.GetNumber(), 100); + + JSTaggedValue int_v2(-1); +- result = JSTaggedValue::ToLength(thread, JSHandle(thread, int_v2)); ++ result = JSTaggedValue::ToLength(thread_, JSHandle(thread_, int_v2)); + EXPECT_EQ(result.GetNumber(), 0); + + JSTaggedValue double_v1((double)100.0); +- result = JSTaggedValue::ToLength(thread, JSHandle(thread, double_v1)); ++ result = JSTaggedValue::ToLength(thread_, JSHandle(thread_, double_v1)); + EXPECT_EQ(result.GetNumber(), (double)100.0); + + JSTaggedValue double_v2((double)100.123); +- result = JSTaggedValue::ToLength(thread, JSHandle(thread, double_v2)); ++ result = JSTaggedValue::ToLength(thread_, JSHandle(thread_, double_v2)); + EXPECT_EQ(result.GetNumber(), (double)100); + + JSTaggedValue double_v3((double)-1.0); +- result = JSTaggedValue::ToLength(thread, JSHandle(thread, double_v3)); ++ result = JSTaggedValue::ToLength(thread_, JSHandle(thread_, double_v3)); + EXPECT_EQ(result.GetNumber(), (double)0); + + JSTaggedValue double_v4((double)9007199254740992); +- result = JSTaggedValue::ToLength(thread, JSHandle(thread, double_v4)); ++ result = JSTaggedValue::ToLength(thread_, JSHandle(thread_, double_v4)); + EXPECT_EQ(result.GetNumber(), (double)9007199254740991); + + JSTaggedValue undefined_v = JSTaggedValue::Undefined(); +- result = JSTaggedValue::ToLength(thread, JSHandle(thread, undefined_v)); ++ result = JSTaggedValue::ToLength(thread_, JSHandle(thread_, undefined_v)); + EXPECT_EQ(result.GetNumber(), 0); + + JSTaggedValue hole_v = JSTaggedValue::Hole(); +- result = JSTaggedValue::ToLength(thread, JSHandle(thread, hole_v)); ++ result = JSTaggedValue::ToLength(thread_, JSHandle(thread_, hole_v)); + EXPECT_EQ(result.GetNumber(), 0); + + JSTaggedValue null_v = JSTaggedValue::Null(); +- result = JSTaggedValue::ToLength(thread, JSHandle(thread, null_v)); ++ result = JSTaggedValue::ToLength(thread_, JSHandle(thread_, null_v)); + EXPECT_EQ(result.GetNumber(), 0); + + JSTaggedValue false_v = JSTaggedValue::False(); +- result = JSTaggedValue::ToLength(thread, JSHandle(thread, false_v)); ++ result = JSTaggedValue::ToLength(thread_, JSHandle(thread_, false_v)); + EXPECT_EQ(result.GetNumber(), 0); + + JSTaggedValue true_v = JSTaggedValue::True(); +- result = JSTaggedValue::ToLength(thread, JSHandle(thread, true_v)); ++ result = JSTaggedValue::ToLength(thread_, JSHandle(thread_, true_v)); + EXPECT_EQ(result.GetNumber(), 1); + } + + TEST_F(JSTaggedValueTest, IsArray) + { +- EcmaVM *ecma = thread->GetEcmaVM(); ++ EcmaVM *ecma = thread_->GetEcmaVM(); + JSHandle object_fun = ecma->GetGlobalEnv()->GetArrayFunction(); + + JSHandle js_obj = +- thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(object_fun), object_fun); ++ thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(object_fun), object_fun); + + ASSERT_TRUE(js_obj->IsJSArray()); +- ASSERT_FALSE(JSTaggedValue(1).IsArray(thread)); ++ ASSERT_FALSE(JSTaggedValue(1).IsArray(thread_)); + +- ASSERT_FALSE(thread->GetEcmaVM()->GetFactory()->NewFromString("test").GetTaggedValue().IsArray(thread)); ++ ASSERT_FALSE(thread_->GetEcmaVM()->GetFactory()->NewFromString("test").GetTaggedValue().IsArray(thread_)); + } + + TEST_F(JSTaggedValueTest, IsCallable_IsConstructor_IsExtensible) + { +- JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); +- JSHandle js_function = thread->GetEcmaVM()->GetFactory()->NewJSFunction(env); ++ JSHandle env = thread_->GetEcmaVM()->GetGlobalEnv(); ++ JSHandle js_function = thread_->GetEcmaVM()->GetFactory()->NewJSFunction(env); + JSHClass *js_hclass = js_function->GetJSHClass(); + ASSERT_TRUE(js_function->IsCallable()); + js_hclass->SetConstructor(true); +@@ -959,7 +959,7 @@ TEST_F(JSTaggedValueTest, IsCallable_IsConstructor_IsExtensible) + ASSERT_TRUE(js_function->IsExtensible()); + js_hclass->SetExtensible(false); + ASSERT_FALSE(js_function->IsExtensible()); +- ASSERT_FALSE(JSTaggedValue(1).IsExtensible(thread)); ++ ASSERT_FALSE(JSTaggedValue(1).IsExtensible(thread_)); + ASSERT_FALSE(JSTaggedValue(1).IsConstructor()); + ASSERT_FALSE(JSTaggedValue(1).IsCallable()); + } +@@ -980,25 +980,25 @@ TEST_F(JSTaggedValueTest, IsInteger) + ASSERT_FALSE(JSTaggedValue::Null().IsInteger()); + ASSERT_FALSE(JSTaggedValue::False().IsInteger()); + ASSERT_FALSE(JSTaggedValue::Hole().IsInteger()); +- ASSERT_FALSE(thread->GetEcmaVM()->GetFactory()->NewFromString("test").GetTaggedValue().IsInteger()); ++ ASSERT_FALSE(thread_->GetEcmaVM()->GetFactory()->NewFromString("test").GetTaggedValue().IsInteger()); + } + + TEST_F(JSTaggedValueTest, IsPropertyKey) + { + ASSERT_TRUE(JSTaggedValue::IsPropertyKey( +- JSHandle(thread->GetEcmaVM()->GetFactory()->NewFromString("test")))); ++ JSHandle(thread_->GetEcmaVM()->GetFactory()->NewFromString("test")))); + } + + TEST_F(JSTaggedValueTest, IsRegExp) + { +- JSHandle string = thread->GetEcmaVM()->GetFactory()->NewFromString("test"); ++ JSHandle string = thread_->GetEcmaVM()->GetFactory()->NewFromString("test"); + JSHandle obj = JSHandle::Cast(string); +- ASSERT_FALSE(JSObject::IsRegExp(thread, obj)); ++ ASSERT_FALSE(JSObject::IsRegExp(thread_, obj)); + } + + TEST_F(JSTaggedValueTest, SameValue) + { +- EcmaVM *ecma = thread->GetEcmaVM(); ++ EcmaVM *ecma = thread_->GetEcmaVM(); + JSHandle object_fun = ecma->GetGlobalEnv()->GetObjectFunction(); + + JSHandle js_obj = +@@ -1055,154 +1055,154 @@ TEST_F(JSTaggedValueTest, SameValueZero) + + TEST_F(JSTaggedValueTest, Less) + { +- JSHandle test(thread->GetEcmaVM()->GetFactory()->NewFromString("test")); +- JSHandle test1(thread->GetEcmaVM()->GetFactory()->NewFromString("test1")); +- JSHandle test2(thread->GetEcmaVM()->GetFactory()->NewFromString("test2")); +- +- ASSERT_TRUE(JSTaggedValue::Less(thread, JSHandle(thread, JSTaggedValue(1.0)), +- JSHandle(thread, JSTaggedValue(2.0)))); +- ASSERT_FALSE(JSTaggedValue::Less(thread, JSHandle(thread, JSTaggedValue(0.0)), +- JSHandle(thread, JSTaggedValue(-0.0)))); +- ASSERT_TRUE(JSTaggedValue::Less(thread, JSHandle(thread, JSTaggedValue(1)), +- JSHandle(thread, JSTaggedValue(2)))); +- +- ASSERT_TRUE(JSTaggedValue::Less(thread, test, test1)); +- ASSERT_FALSE(JSTaggedValue::Less(thread, test2, test1)); +- ASSERT_FALSE(JSTaggedValue::Less(thread, JSHandle(thread, JSTaggedValue(1)), test1)); +- ASSERT_FALSE(JSTaggedValue::Less(thread, test2, JSHandle(thread, JSTaggedValue(2)))); +- +- ASSERT_TRUE(JSTaggedValue::Less(thread, +- JSHandle(thread->GetEcmaVM()->GetFactory()->NewFromString("1")), +- JSHandle(thread, JSTaggedValue(2)))); +- ASSERT_TRUE(JSTaggedValue::Less(thread, JSHandle(thread, JSTaggedValue(1)), +- JSHandle(thread->GetEcmaVM()->GetFactory()->NewFromString("2")))); +- +- ASSERT_TRUE(JSTaggedValue::Less(thread, JSHandle(thread, JSTaggedValue::False()), +- JSHandle(thread, JSTaggedValue::True()))); +- ASSERT_FALSE(JSTaggedValue::Less(thread, JSHandle(thread, JSTaggedValue::True()), +- JSHandle(thread, JSTaggedValue::False()))); +- ASSERT_FALSE(JSTaggedValue::Less(thread, JSHandle(thread, JSTaggedValue::Undefined()), +- JSHandle(thread, JSTaggedValue::Null()))); +- ASSERT_FALSE(JSTaggedValue::Less(thread, JSHandle(thread, JSTaggedValue::Null()), +- JSHandle(thread, JSTaggedValue::Undefined()))); ++ JSHandle test(thread_->GetEcmaVM()->GetFactory()->NewFromString("test")); ++ JSHandle test1(thread_->GetEcmaVM()->GetFactory()->NewFromString("test1")); ++ JSHandle test2(thread_->GetEcmaVM()->GetFactory()->NewFromString("test2")); ++ ++ ASSERT_TRUE(JSTaggedValue::Less(thread_, JSHandle(thread_, JSTaggedValue(1.0)), ++ JSHandle(thread_, JSTaggedValue(2.0)))); ++ ASSERT_FALSE(JSTaggedValue::Less(thread_, JSHandle(thread_, JSTaggedValue(0.0)), ++ JSHandle(thread_, JSTaggedValue(-0.0)))); ++ ASSERT_TRUE(JSTaggedValue::Less(thread_, JSHandle(thread_, JSTaggedValue(1)), ++ JSHandle(thread_, JSTaggedValue(2)))); ++ ++ ASSERT_TRUE(JSTaggedValue::Less(thread_, test, test1)); ++ ASSERT_FALSE(JSTaggedValue::Less(thread_, test2, test1)); ++ ASSERT_FALSE(JSTaggedValue::Less(thread_, JSHandle(thread_, JSTaggedValue(1)), test1)); ++ ASSERT_FALSE(JSTaggedValue::Less(thread_, test2, JSHandle(thread_, JSTaggedValue(2)))); ++ ++ ASSERT_TRUE(JSTaggedValue::Less(thread_, ++ JSHandle(thread_->GetEcmaVM()->GetFactory()->NewFromString("1")), ++ JSHandle(thread_, JSTaggedValue(2)))); ++ ASSERT_TRUE(JSTaggedValue::Less(thread_, JSHandle(thread_, JSTaggedValue(1)), ++ JSHandle(thread_->GetEcmaVM()->GetFactory()->NewFromString("2")))); ++ ++ ASSERT_TRUE(JSTaggedValue::Less(thread_, JSHandle(thread_, JSTaggedValue::False()), ++ JSHandle(thread_, JSTaggedValue::True()))); ++ ASSERT_FALSE(JSTaggedValue::Less(thread_, JSHandle(thread_, JSTaggedValue::True()), ++ JSHandle(thread_, JSTaggedValue::False()))); ++ ASSERT_FALSE(JSTaggedValue::Less(thread_, JSHandle(thread_, JSTaggedValue::Undefined()), ++ JSHandle(thread_, JSTaggedValue::Null()))); ++ ASSERT_FALSE(JSTaggedValue::Less(thread_, JSHandle(thread_, JSTaggedValue::Null()), ++ JSHandle(thread_, JSTaggedValue::Undefined()))); + } + + TEST_F(JSTaggedValueTest, Equal) + { +- ASSERT_TRUE(JSTaggedValue::Equal(thread, JSHandle(thread, JSTaggedValue::Undefined()), +- JSHandle(thread, JSTaggedValue::Undefined()))); +- ASSERT_TRUE(JSTaggedValue::Equal(thread, JSHandle(thread, JSTaggedValue::Null()), +- JSHandle(thread, JSTaggedValue::Undefined()))); +- ASSERT_TRUE(JSTaggedValue::Equal(thread, JSHandle(thread, JSTaggedValue::Null()), +- JSHandle(thread, JSTaggedValue::Null()))); +- ASSERT_TRUE(JSTaggedValue::Equal(thread, JSHandle(thread, JSTaggedValue::Null()), +- JSHandle(thread, JSTaggedValue::Undefined()))); +- ASSERT_FALSE(JSTaggedValue::Equal(thread, JSHandle(thread, JSTaggedValue::Null()), +- JSHandle(thread, JSTaggedValue(1)))); +- ASSERT_FALSE(JSTaggedValue::Equal(thread, JSHandle(thread, JSTaggedValue::Null()), +- JSHandle(thread, JSTaggedValue::True()))); +- ASSERT_FALSE(JSTaggedValue::Equal(thread, JSHandle(thread, JSTaggedValue::Null()), +- JSHandle(thread, JSTaggedValue::False()))); ++ ASSERT_TRUE(JSTaggedValue::Equal(thread_, JSHandle(thread_, JSTaggedValue::Undefined()), ++ JSHandle(thread_, JSTaggedValue::Undefined()))); ++ ASSERT_TRUE(JSTaggedValue::Equal(thread_, JSHandle(thread_, JSTaggedValue::Null()), ++ JSHandle(thread_, JSTaggedValue::Undefined()))); ++ ASSERT_TRUE(JSTaggedValue::Equal(thread_, JSHandle(thread_, JSTaggedValue::Null()), ++ JSHandle(thread_, JSTaggedValue::Null()))); ++ ASSERT_TRUE(JSTaggedValue::Equal(thread_, JSHandle(thread_, JSTaggedValue::Null()), ++ JSHandle(thread_, JSTaggedValue::Undefined()))); ++ ASSERT_FALSE(JSTaggedValue::Equal(thread_, JSHandle(thread_, JSTaggedValue::Null()), ++ JSHandle(thread_, JSTaggedValue(1)))); ++ ASSERT_FALSE(JSTaggedValue::Equal(thread_, JSHandle(thread_, JSTaggedValue::Null()), ++ JSHandle(thread_, JSTaggedValue::True()))); ++ ASSERT_FALSE(JSTaggedValue::Equal(thread_, JSHandle(thread_, JSTaggedValue::Null()), ++ JSHandle(thread_, JSTaggedValue::False()))); + + // number compare +- ASSERT_TRUE(JSTaggedValue::Equal(thread, JSHandle(thread, JSTaggedValue(1)), +- JSHandle(thread, JSTaggedValue(1)))); +- ASSERT_FALSE(JSTaggedValue::Equal(thread, JSHandle(thread, JSTaggedValue(1)), +- JSHandle(thread, JSTaggedValue(2)))); +- ASSERT_TRUE(JSTaggedValue::Equal(thread, JSHandle(thread, JSTaggedValue(1.0)), +- JSHandle(thread, JSTaggedValue(1.0)))); +- ASSERT_TRUE(JSTaggedValue::Equal(thread, JSHandle(thread, JSTaggedValue(0.0)), +- JSHandle(thread, JSTaggedValue(0.0)))); +- ASSERT_TRUE(JSTaggedValue::Equal(thread, JSHandle(thread, JSTaggedValue(0.0)), +- JSHandle(thread, JSTaggedValue(-0.0)))); +- ASSERT_TRUE(JSTaggedValue::Equal(thread, JSHandle(thread, JSTaggedValue(0)), +- JSHandle(thread, JSTaggedValue(-0)))); +- ASSERT_TRUE(JSTaggedValue::Equal(thread, JSHandle(thread, JSTaggedValue(1)), +- JSHandle(thread, JSTaggedValue::True()))); +- ASSERT_TRUE(JSTaggedValue::Equal(thread, JSHandle(thread, JSTaggedValue(0)), +- JSHandle(thread, JSTaggedValue::False()))); +- ASSERT_FALSE(JSTaggedValue::Equal(thread, JSHandle(thread, JSTaggedValue(0)), +- JSHandle(thread, JSTaggedValue::Undefined()))); +- ASSERT_FALSE(JSTaggedValue::Equal(thread, JSHandle(thread, JSTaggedValue(0)), +- JSHandle(thread, JSTaggedValue::Null()))); +- +- JSHandle test(thread->GetEcmaVM()->GetFactory()->NewFromString("test")); +- JSHandle test1(thread->GetEcmaVM()->GetFactory()->NewFromString("test1")); +- JSHandle empty(thread->GetEcmaVM()->GetFactory()->NewFromString("")); +- JSHandle char0(thread->GetEcmaVM()->GetFactory()->NewFromString("0")); +- JSHandle char0_point_0(thread->GetEcmaVM()->GetFactory()->NewFromString("0.0")); +- JSHandle char1(thread->GetEcmaVM()->GetFactory()->NewFromString("1")); +- JSHandle char1_point_0(thread->GetEcmaVM()->GetFactory()->NewFromString("1.0")); +- JSHandle char_1(thread->GetEcmaVM()->GetFactory()->NewFromString("-1")); +- JSHandle char_0_point_0(thread->GetEcmaVM()->GetFactory()->NewFromString("-0.0")); +- JSHandle char_0_point_1(thread->GetEcmaVM()->GetFactory()->NewFromString("-0.1")); +- +- ASSERT_TRUE(JSTaggedValue::Equal(thread, JSHandle(thread, JSTaggedValue(0)), char0)); +- ASSERT_TRUE(JSTaggedValue::Equal(thread, JSHandle(thread, JSTaggedValue(0.0)), char0)); +- ASSERT_TRUE(JSTaggedValue::Equal(thread, JSHandle(thread, JSTaggedValue(1.0)), char1)); +- ASSERT_TRUE(JSTaggedValue::Equal(thread, JSHandle(thread, JSTaggedValue(-1.0)), char_1)); +- ASSERT_TRUE(JSTaggedValue::Equal(thread, JSHandle(thread, JSTaggedValue(0.0)), char_0_point_0)); +- ASSERT_FALSE(JSTaggedValue::Equal(thread, JSHandle(thread, JSTaggedValue(0.0)), char_0_point_1)); ++ ASSERT_TRUE(JSTaggedValue::Equal(thread_, JSHandle(thread_, JSTaggedValue(1)), ++ JSHandle(thread_, JSTaggedValue(1)))); ++ ASSERT_FALSE(JSTaggedValue::Equal(thread_, JSHandle(thread_, JSTaggedValue(1)), ++ JSHandle(thread_, JSTaggedValue(2)))); ++ ASSERT_TRUE(JSTaggedValue::Equal(thread_, JSHandle(thread_, JSTaggedValue(1.0)), ++ JSHandle(thread_, JSTaggedValue(1.0)))); ++ ASSERT_TRUE(JSTaggedValue::Equal(thread_, JSHandle(thread_, JSTaggedValue(0.0)), ++ JSHandle(thread_, JSTaggedValue(0.0)))); ++ ASSERT_TRUE(JSTaggedValue::Equal(thread_, JSHandle(thread_, JSTaggedValue(0.0)), ++ JSHandle(thread_, JSTaggedValue(-0.0)))); ++ ASSERT_TRUE(JSTaggedValue::Equal(thread_, JSHandle(thread_, JSTaggedValue(0)), ++ JSHandle(thread_, JSTaggedValue(-0)))); ++ ASSERT_TRUE(JSTaggedValue::Equal(thread_, JSHandle(thread_, JSTaggedValue(1)), ++ JSHandle(thread_, JSTaggedValue::True()))); ++ ASSERT_TRUE(JSTaggedValue::Equal(thread_, JSHandle(thread_, JSTaggedValue(0)), ++ JSHandle(thread_, JSTaggedValue::False()))); ++ ASSERT_FALSE(JSTaggedValue::Equal(thread_, JSHandle(thread_, JSTaggedValue(0)), ++ JSHandle(thread_, JSTaggedValue::Undefined()))); ++ ASSERT_FALSE(JSTaggedValue::Equal(thread_, JSHandle(thread_, JSTaggedValue(0)), ++ JSHandle(thread_, JSTaggedValue::Null()))); ++ ++ JSHandle test(thread_->GetEcmaVM()->GetFactory()->NewFromString("test")); ++ JSHandle test1(thread_->GetEcmaVM()->GetFactory()->NewFromString("test1")); ++ JSHandle empty(thread_->GetEcmaVM()->GetFactory()->NewFromString("")); ++ JSHandle char0(thread_->GetEcmaVM()->GetFactory()->NewFromString("0")); ++ JSHandle char0_point_0(thread_->GetEcmaVM()->GetFactory()->NewFromString("0.0")); ++ JSHandle char1(thread_->GetEcmaVM()->GetFactory()->NewFromString("1")); ++ JSHandle char1_point_0(thread_->GetEcmaVM()->GetFactory()->NewFromString("1.0")); ++ JSHandle char_1(thread_->GetEcmaVM()->GetFactory()->NewFromString("-1")); ++ JSHandle char_0_point_0(thread_->GetEcmaVM()->GetFactory()->NewFromString("-0.0")); ++ JSHandle char_0_point_1(thread_->GetEcmaVM()->GetFactory()->NewFromString("-0.1")); ++ ++ ASSERT_TRUE(JSTaggedValue::Equal(thread_, JSHandle(thread_, JSTaggedValue(0)), char0)); ++ ASSERT_TRUE(JSTaggedValue::Equal(thread_, JSHandle(thread_, JSTaggedValue(0.0)), char0)); ++ ASSERT_TRUE(JSTaggedValue::Equal(thread_, JSHandle(thread_, JSTaggedValue(1.0)), char1)); ++ ASSERT_TRUE(JSTaggedValue::Equal(thread_, JSHandle(thread_, JSTaggedValue(-1.0)), char_1)); ++ ASSERT_TRUE(JSTaggedValue::Equal(thread_, JSHandle(thread_, JSTaggedValue(0.0)), char_0_point_0)); ++ ASSERT_FALSE(JSTaggedValue::Equal(thread_, JSHandle(thread_, JSTaggedValue(0.0)), char_0_point_1)); + + // string compare +- ASSERT_TRUE(JSTaggedValue::Equal(thread, test, test)); +- ASSERT_FALSE(JSTaggedValue::Equal(thread, test, test1)); +- ASSERT_FALSE(JSTaggedValue::Equal(thread, test, empty)); +- ASSERT_TRUE(JSTaggedValue::Equal(thread, empty, empty)); ++ ASSERT_TRUE(JSTaggedValue::Equal(thread_, test, test)); ++ ASSERT_FALSE(JSTaggedValue::Equal(thread_, test, test1)); ++ ASSERT_FALSE(JSTaggedValue::Equal(thread_, test, empty)); ++ ASSERT_TRUE(JSTaggedValue::Equal(thread_, empty, empty)); + + // ASSERT_FALSE(JSTaggedValue::Equal(JSTaggedValue(thread->GetEcmaVM()->GetFactory()->NewFromString(""))), + // JSTaggedValue(1))); +- ASSERT_TRUE(JSTaggedValue::Equal(thread, char1, JSHandle(thread, JSTaggedValue(1)))); ++ ASSERT_TRUE(JSTaggedValue::Equal(thread_, char1, JSHandle(thread_, JSTaggedValue(1)))); + // ASSERT_FALSE(JSTaggedValue::Equal( + // JSTaggedValue(thread->GetEcmaVM()->GetFactory()->NewFromString("aaa"))), + // JSTaggedValue(0))); + // ASSERT_FALSE(JSTaggedValue::Equal( + // JSTaggedValue(thread->GetEcmaVM()->GetFactory()->NewFromString("true"))), + // JSTaggedValue::True())); +- ASSERT_TRUE(JSTaggedValue::Equal(thread, char1, JSHandle(thread, JSTaggedValue::True()))); +- ASSERT_TRUE(JSTaggedValue::Equal(thread, char0, JSHandle(thread, JSTaggedValue::False()))); +- ASSERT_FALSE(JSTaggedValue::Equal(thread, char0, JSHandle(thread, JSTaggedValue::Undefined()))); +- ASSERT_FALSE(JSTaggedValue::Equal(thread, char0, JSHandle(thread, JSTaggedValue::Null()))); ++ ASSERT_TRUE(JSTaggedValue::Equal(thread_, char1, JSHandle(thread_, JSTaggedValue::True()))); ++ ASSERT_TRUE(JSTaggedValue::Equal(thread_, char0, JSHandle(thread_, JSTaggedValue::False()))); ++ ASSERT_FALSE(JSTaggedValue::Equal(thread_, char0, JSHandle(thread_, JSTaggedValue::Undefined()))); ++ ASSERT_FALSE(JSTaggedValue::Equal(thread_, char0, JSHandle(thread_, JSTaggedValue::Null()))); + // boolean compare +- ASSERT_TRUE(JSTaggedValue::Equal(thread, JSHandle(thread, JSTaggedValue::True()), +- JSHandle(thread, JSTaggedValue::True()))); +- ASSERT_TRUE(JSTaggedValue::Equal(thread, JSHandle(thread, JSTaggedValue::False()), +- JSHandle(thread, JSTaggedValue::False()))); +- ASSERT_FALSE(JSTaggedValue::Equal(thread, JSHandle(thread, JSTaggedValue::True()), +- JSHandle(thread, JSTaggedValue::False()))); +- ASSERT_FALSE(JSTaggedValue::Equal(thread, JSHandle(thread, JSTaggedValue::False()), +- JSHandle(thread, JSTaggedValue::True()))); +- ASSERT_TRUE(JSTaggedValue::Equal(thread, JSHandle(thread, JSTaggedValue::True()), +- JSHandle(thread, JSTaggedValue(1)))); +- ASSERT_TRUE(JSTaggedValue::Equal(thread, JSHandle(thread, JSTaggedValue::True()), +- JSHandle(thread, JSTaggedValue(1.0)))); +- ASSERT_FALSE(JSTaggedValue::Equal(thread, JSHandle(thread, JSTaggedValue::True()), +- JSHandle(thread, JSTaggedValue(0)))); +- ASSERT_FALSE(JSTaggedValue::Equal(thread, JSHandle(thread, JSTaggedValue::True()), +- JSHandle(thread, JSTaggedValue(0.0)))); +- ASSERT_TRUE(JSTaggedValue::Equal(thread, JSHandle(thread, JSTaggedValue::False()), +- JSHandle(thread, JSTaggedValue(0)))); +- ASSERT_TRUE(JSTaggedValue::Equal(thread, JSHandle(thread, JSTaggedValue::False()), +- JSHandle(thread, JSTaggedValue(0.0)))); +- ASSERT_FALSE(JSTaggedValue::Equal(thread, JSHandle(thread, JSTaggedValue::False()), +- JSHandle(thread, JSTaggedValue(1)))); +- ASSERT_FALSE(JSTaggedValue::Equal(thread, JSHandle(thread, JSTaggedValue::False()), +- JSHandle(thread, JSTaggedValue(1.0)))); +- ASSERT_TRUE(JSTaggedValue::Equal(thread, JSHandle(thread, JSTaggedValue::False()), char0)); +- ASSERT_TRUE(JSTaggedValue::Equal(thread, JSHandle(thread, JSTaggedValue::False()), char0_point_0)); +- ASSERT_TRUE(JSTaggedValue::Equal(thread, JSHandle(thread, JSTaggedValue::True()), char1)); +- ASSERT_TRUE(JSTaggedValue::Equal(thread, JSHandle(thread, JSTaggedValue::True()), char1_point_0)); +- ASSERT_FALSE(JSTaggedValue::Equal(thread, JSHandle(thread, JSTaggedValue::True()), char0)); +- ASSERT_FALSE(JSTaggedValue::Equal(thread, JSHandle(thread, JSTaggedValue::False()), char1)); ++ ASSERT_TRUE(JSTaggedValue::Equal(thread_, JSHandle(thread_, JSTaggedValue::True()), ++ JSHandle(thread_, JSTaggedValue::True()))); ++ ASSERT_TRUE(JSTaggedValue::Equal(thread_, JSHandle(thread_, JSTaggedValue::False()), ++ JSHandle(thread_, JSTaggedValue::False()))); ++ ASSERT_FALSE(JSTaggedValue::Equal(thread_, JSHandle(thread_, JSTaggedValue::True()), ++ JSHandle(thread_, JSTaggedValue::False()))); ++ ASSERT_FALSE(JSTaggedValue::Equal(thread_, JSHandle(thread_, JSTaggedValue::False()), ++ JSHandle(thread_, JSTaggedValue::True()))); ++ ASSERT_TRUE(JSTaggedValue::Equal(thread_, JSHandle(thread_, JSTaggedValue::True()), ++ JSHandle(thread_, JSTaggedValue(1)))); ++ ASSERT_TRUE(JSTaggedValue::Equal(thread_, JSHandle(thread_, JSTaggedValue::True()), ++ JSHandle(thread_, JSTaggedValue(1.0)))); ++ ASSERT_FALSE(JSTaggedValue::Equal(thread_, JSHandle(thread_, JSTaggedValue::True()), ++ JSHandle(thread_, JSTaggedValue(0)))); ++ ASSERT_FALSE(JSTaggedValue::Equal(thread_, JSHandle(thread_, JSTaggedValue::True()), ++ JSHandle(thread_, JSTaggedValue(0.0)))); ++ ASSERT_TRUE(JSTaggedValue::Equal(thread_, JSHandle(thread_, JSTaggedValue::False()), ++ JSHandle(thread_, JSTaggedValue(0)))); ++ ASSERT_TRUE(JSTaggedValue::Equal(thread_, JSHandle(thread_, JSTaggedValue::False()), ++ JSHandle(thread_, JSTaggedValue(0.0)))); ++ ASSERT_FALSE(JSTaggedValue::Equal(thread_, JSHandle(thread_, JSTaggedValue::False()), ++ JSHandle(thread_, JSTaggedValue(1)))); ++ ASSERT_FALSE(JSTaggedValue::Equal(thread_, JSHandle(thread_, JSTaggedValue::False()), ++ JSHandle(thread_, JSTaggedValue(1.0)))); ++ ASSERT_TRUE(JSTaggedValue::Equal(thread_, JSHandle(thread_, JSTaggedValue::False()), char0)); ++ ASSERT_TRUE(JSTaggedValue::Equal(thread_, JSHandle(thread_, JSTaggedValue::False()), char0_point_0)); ++ ASSERT_TRUE(JSTaggedValue::Equal(thread_, JSHandle(thread_, JSTaggedValue::True()), char1)); ++ ASSERT_TRUE(JSTaggedValue::Equal(thread_, JSHandle(thread_, JSTaggedValue::True()), char1_point_0)); ++ ASSERT_FALSE(JSTaggedValue::Equal(thread_, JSHandle(thread_, JSTaggedValue::True()), char0)); ++ ASSERT_FALSE(JSTaggedValue::Equal(thread_, JSHandle(thread_, JSTaggedValue::False()), char1)); + } + + TEST_F(JSTaggedValueTest, StrictEqual) + { + // This algorithm differs from the SameValue Algorithm in its treatment of signed zeroes and NaNs. +- ASSERT_TRUE(JSTaggedValue::StrictEqual(thread, JSHandle(thread, JSTaggedValue(0.0)), +- JSHandle(thread, JSTaggedValue(-0.0)))); ++ ASSERT_TRUE(JSTaggedValue::StrictEqual(thread_, JSHandle(thread_, JSTaggedValue(0.0)), ++ JSHandle(thread_, JSTaggedValue(-0.0)))); + ASSERT_FALSE(JSTaggedValue::StrictEqual( +- thread, JSHandle(thread, JSTaggedValue(std::numeric_limits::quiet_NaN())), +- JSHandle(thread, JSTaggedValue(std::numeric_limits::quiet_NaN())))); ++ thread_, JSHandle(thread_, JSTaggedValue(std::numeric_limits::quiet_NaN())), ++ JSHandle(thread_, JSTaggedValue(std::numeric_limits::quiet_NaN())))); + } + } // namespace panda::test +diff --git a/tests/runtime/common/test_helper.cpp b/tests/runtime/common/test_helper.cpp +index 9aa89f2..2e8f466 100644 +--- a/tests/runtime/common/test_helper.cpp ++++ b/tests/runtime/common/test_helper.cpp +@@ -21,17 +21,17 @@ using panda::ecmascript::EcmaRuntimeCallInfo; + using panda::ecmascript::JSTaggedValue; + using panda::ecmascript::JSThread; + +-thread_local bool TestHelper::isLeaf = true; +-ecmascript::JSHandle TestHelper::methodFunction_ {}; ++thread_local bool TestHelper::is_leaf_ = true; ++ecmascript::JSHandle TestHelper::method_function_ {}; + + std::unique_ptr TestHelper::CreateEcmaRuntimeCallInfo(JSThread *thread, JSTaggedValue newTgt, + array_size_t argvLength) + { + auto method = thread->GetEcmaVM()->GetMethodForNativeFunction(nullptr); +- if (isLeaf && thread->GetCurrentFrame() != nullptr) { ++ if (is_leaf_ && thread->GetCurrentFrame() != nullptr) { + method->ExitNativeMethodFrame(thread); + } +- isLeaf = true; ++ is_leaf_ = true; + + const uint8_t testDecodedSize = 2; + // argvLength includes number of int64_t to store value and tag of function, 'this' and call args +@@ -48,21 +48,21 @@ std::unique_ptr TestHelper::CreateEcmaRuntimeCallInfo(JSThr + + auto callInfo = std::make_unique(thread, numActualArgs, &frame->GetVReg(0)); + +- callInfo->SetFunction(methodFunction_.GetTaggedValue()); ++ callInfo->SetFunction(method_function_.GetTaggedValue()); + callInfo->SetNewTarget(newTgt); + return callInfo; + } + + Frame *TestHelper::SetupFrame(JSThread *thread, [[maybe_unused]] EcmaRuntimeCallInfo *info) + { +- isLeaf = false; ++ is_leaf_ = false; + ASSERT((void *)info->GetArgAddress(0) == &thread->GetCurrentFrame()->GetVReg(0)); + return thread->GetCurrentFrame()->GetPrevFrame(); + } + + void TestHelper::TearDownFrame([[maybe_unused]] JSThread *thread, [[maybe_unused]] Frame *prev) + { +- isLeaf = true; ++ is_leaf_ = true; + auto frame = thread->GetCurrentFrame(); + while (frame != nullptr && frame->GetPrevFrame() != prev) { + Method::ExitNativeMethodFrame(thread); +diff --git a/tests/runtime/common/test_helper.h b/tests/runtime/common/test_helper.h +index eb039f0..34873ed 100644 +--- a/tests/runtime/common/test_helper.h ++++ b/tests/runtime/common/test_helper.h +@@ -60,7 +60,7 @@ public: + auto globalEnv = ecmaVm->GetGlobalEnv(); + { + ScopedManagedCodeThread s(thread); +- methodFunction_ = ecmaVm->GetFactory()->NewJSFunction(globalEnv); ++ method_function_ = ecmaVm->GetFactory()->NewJSFunction(globalEnv); + } + if (enter_managed_code) { + thread->ManagedCodeBegin(); +@@ -81,8 +81,8 @@ public: + } + + private: +- static thread_local bool isLeaf; +- static ecmascript::JSHandle methodFunction_; ++ static thread_local bool is_leaf_; ++ static ecmascript::JSHandle method_function_; + }; + } // namespace panda::test + +diff --git a/tests/runtime/hprof/heap_tracker_test.cpp b/tests/runtime/hprof/heap_tracker_test.cpp +index 14badab..c982ee7 100644 +--- a/tests/runtime/hprof/heap_tracker_test.cpp ++++ b/tests/runtime/hprof/heap_tracker_test.cpp +@@ -42,40 +42,40 @@ public: + + void SetUp() override + { +- TestHelper::CreateEcmaVMWithScope(instance, thread, scope); +- EcmaVM::Cast(instance)->SetEnableForceGC(false); ++ TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); ++ EcmaVM::Cast(instance_)->SetEnableForceGC(false); + } + + void TearDown() override + { +- TestHelper::DestroyEcmaVMWithScope(instance, scope); ++ TestHelper::DestroyEcmaVMWithScope(instance_, scope_); + } + +- PandaVM *instance {nullptr}; +- EcmaHandleScope *scope {nullptr}; +- JSThread *thread {nullptr}; ++ PandaVM *instance_ {nullptr}; ++ EcmaHandleScope *scope_ {nullptr}; ++ JSThread *thread_ {nullptr}; + }; + + TEST_F(HeapTrackerTest, DISABLED_HeapTracker) // issue #5368 + { +- [[maybe_unused]] EcmaHandleScope handleScope(thread); +- HeapProfilerInterface *heapProfile = HeapProfilerInterface::CreateHeapProfiler(thread); +- heapProfile->StartHeapTracking(thread, 50); ++ [[maybe_unused]] EcmaHandleScope handleScope(thread_); ++ HeapProfilerInterface *heapProfile = HeapProfilerInterface::CreateHeapProfiler(thread_); ++ heapProfile->StartHeapTracking(thread_, 50); + sleep(1); + int count = 100; + while (count-- > 0) { +- thread->GetEcmaVM()->GetFactory()->NewJSAsyncFuncObject(); ++ thread_->GetEcmaVM()->GetFactory()->NewJSAsyncFuncObject(); + } + sleep(1); + count = 100; + while (count-- > 0) { +- thread->GetEcmaVM()->GetFactory()->NewJSSymbol(); ++ thread_->GetEcmaVM()->GetFactory()->NewJSSymbol(); + } + sleep(1); + count = 100; + while (count-- > 0) { +- JSHandle string = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("Hello World"); +- thread->GetEcmaVM()->GetFactory()->NewJSString(JSHandle(string)); ++ JSHandle string = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("Hello World"); ++ thread_->GetEcmaVM()->GetFactory()->NewJSString(JSHandle(string)); + } + + // Create file test.heaptimeline +@@ -84,8 +84,8 @@ TEST_F(HeapTrackerTest, DISABLED_HeapTracker) // issue #5368 + outputString.close(); + outputString.clear(); + +- heapProfile->StopHeapTracking(thread, DumpFormat::JSON, fileName.c_str()); +- HeapProfilerInterface::Destroy(thread, heapProfile); ++ heapProfile->StopHeapTracking(thread_, DumpFormat::JSON, fileName.c_str()); ++ HeapProfilerInterface::Destroy(thread_, heapProfile); + + // Check + fstream inputStream(fileName, std::ios::in); +diff --git a/tests/runtime/hprof/hprof_test.cpp b/tests/runtime/hprof/hprof_test.cpp +index 8c9048b..85093eb 100644 +--- a/tests/runtime/hprof/hprof_test.cpp ++++ b/tests/runtime/hprof/hprof_test.cpp +@@ -28,23 +28,23 @@ class HProfTest : public testing::Test { + public: + void SetUp() override + { +- TestHelper::CreateEcmaVMWithScope(instance, thread, scope); ++ TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); + } + + void TearDown() override + { +- TestHelper::DestroyEcmaVMWithScope(instance, scope); ++ TestHelper::DestroyEcmaVMWithScope(instance_, scope_); + } + + protected: +- PandaVM *instance; +- JSThread *thread; +- EcmaHandleScope *scope {nullptr}; ++ PandaVM *instance_; ++ JSThread *thread_; ++ EcmaHandleScope *scope_ {nullptr}; + }; + + class HProfTestHelper { + public: +- explicit HProfTestHelper(const CString &aFilePath) : filePath(aFilePath) {} ++ explicit HProfTestHelper(const CString &aFilePath) : file_path_(aFilePath) {} + ~HProfTestHelper() = default; + + bool IsFileExist() +@@ -59,7 +59,7 @@ public: + { + int code = 0; + if (IsFileExist()) { +- code = std::remove(filePath.c_str()); ++ code = std::remove(file_path_.c_str()); + } + return code == 0 ? true : false; + } +@@ -68,10 +68,10 @@ public: + { + int retry = 2; + RemoveExistingFile(); +- HeapProfilerInterface::DumpHeapSnapShot(thread, DumpFormat::JSON, filePath.c_str()); ++ HeapProfilerInterface::DumpHeapSnapShot(thread, DumpFormat::JSON, file_path_.c_str()); + while (!IsFileExist() && retry > 0) { + retry--; +- HeapProfilerInterface::DumpHeapSnapShot(thread, DumpFormat::JSON, filePath.c_str()); ++ HeapProfilerInterface::DumpHeapSnapShot(thread, DumpFormat::JSON, file_path_.c_str()); + } + return IsFileExist(); + } +@@ -85,7 +85,7 @@ public: + } else { + CString line; + int i = 1; +- while (getline(inputFile, line)) { ++ while (getline(input_file_, line)) { + if (i == lineId && line.find(lineHeader) != line.npos) { + all_same = true; + break; +@@ -106,7 +106,7 @@ public: + } + CString line; + int i = 1; +- while (getline(inputFile, line)) { ++ while (getline(input_file_, line)) { + if (i > 10 && line.find(dataLable) != line.npos) { // Hit the line + CString::size_type pos = 0; + int loop = 0; +@@ -132,7 +132,7 @@ public: + } + CString line_bk; // The Last Line + CString line; +- while (getline(inputFile, line)) { ++ while (getline(input_file_, line)) { + line_bk = line; + } + SafeCloseFile(); +@@ -147,7 +147,7 @@ public: + } + CString line; + int i = 1; +- while (getline(inputFile, line)) { ++ while (getline(input_file_, line)) { + int length = line.length() - typeLable.length() - 1; + if (line.find(typeLable) != line.npos) { // Get + if (line.find(",") == line.npos) { // "trace_function_count" end without "," +@@ -172,7 +172,7 @@ public: + CString line; + bool hit = false; + int loop = 0; +- while (getline(inputFile, line)) { ++ while (getline(input_file_, line)) { + if (!hit && line.find(dataLabel) != line.npos) { // Get + loop += 1; // First Line + hit = true; +@@ -201,42 +201,42 @@ public: + private: + bool SafeOpenFile() + { +- inputFile.clear(); +- inputFile.open(filePath.c_str(), std::ios::in); ++ input_file_.clear(); ++ input_file_.open(file_path_.c_str(), std::ios::in); + int retry = 2; +- while (!inputFile.good() && retry > 0) { +- inputFile.open(filePath.c_str(), std::ios::in); ++ while (!input_file_.good() && retry > 0) { ++ input_file_.open(file_path_.c_str(), std::ios::in); + retry--; + } +- return inputFile.good(); ++ return input_file_.good(); + } + + void SafeCloseFile() + { +- inputFile.close(); +- inputFile.clear(); // Reset File status ++ input_file_.close(); ++ input_file_.clear(); // Reset File status + } +- CString filePath; +- std::fstream inputFile; ++ CString file_path_; ++ std::fstream input_file_; + }; + + TEST_F(HProfTest, DISABLED_GenerateFileForManualCheck) + { + HProfTestHelper tester("hprof_json_test.heapsnapshot"); +- ASSERT_TRUE(tester.GenerateHeapDump(thread)); ++ ASSERT_TRUE(tester.GenerateHeapDump(thread_)); + } + + TEST_F(HProfTest, DISABLED_GenerateFile) + { + HProfTestHelper tester("GenerateFile.heapsnapshot"); +- ASSERT_TRUE(tester.GenerateHeapDump(thread)); ++ ASSERT_TRUE(tester.GenerateHeapDump(thread_)); + ASSERT_TRUE(tester.RemoveExistingFile()); + } + + TEST_F(HProfTest, DISABLED_ParseJSONHeader) + { + HProfTestHelper tester("ParseJSONHeader.heapsnapshot"); +- ASSERT_TRUE(tester.GenerateHeapDump(thread)); ++ ASSERT_TRUE(tester.GenerateHeapDump(thread_)); + ASSERT_TRUE(tester.ContrastJSONLineHeader(1, "{\"snapshot\":")); + ASSERT_TRUE(tester.ContrastJSONLineHeader(2, "{\"meta\":")); + ASSERT_TRUE(tester.ContrastJSONLineHeader(3, "{\"node_fields\":")); +@@ -253,7 +253,7 @@ TEST_F(HProfTest, DISABLED_ParseJSONHeader) + TEST_F(HProfTest, DISABLED_ContrastNode) + { + HProfTestHelper tester("ContrastNode.heapsnapshot"); +- ASSERT_TRUE(tester.GenerateHeapDump(thread)); ++ ASSERT_TRUE(tester.GenerateHeapDump(thread_)); + ASSERT_TRUE(tester.ContrastJSONSectionPayload("\"nodes\":", 7)); + ASSERT_TRUE(tester.RemoveExistingFile()); + } +@@ -261,7 +261,7 @@ TEST_F(HProfTest, DISABLED_ContrastNode) + TEST_F(HProfTest, DISABLED_ContrastEdge) + { + HProfTestHelper tester("ContrastEdge.heapsnapshot"); +- ASSERT_TRUE(tester.GenerateHeapDump(thread)); ++ ASSERT_TRUE(tester.GenerateHeapDump(thread_)); + ASSERT_TRUE(tester.ContrastJSONSectionPayload("\"edges\":", 3)); + ASSERT_TRUE(tester.RemoveExistingFile()); + } +@@ -269,7 +269,7 @@ TEST_F(HProfTest, DISABLED_ContrastEdge) + TEST_F(HProfTest, DISABLED_ContrastTraceFunctionInfo) + { + HProfTestHelper tester("ContrastTraceFunctionInfo.heapsnapshot"); +- ASSERT_TRUE(tester.GenerateHeapDump(thread)); ++ ASSERT_TRUE(tester.GenerateHeapDump(thread_)); + ASSERT_TRUE(tester.ContrastJSONSectionPayload("\"trace_function_infos\":", 2)); // Empty + ASSERT_TRUE(tester.RemoveExistingFile()); + } +@@ -277,7 +277,7 @@ TEST_F(HProfTest, DISABLED_ContrastTraceFunctionInfo) + TEST_F(HProfTest, DISABLED_ContrastTraceTree) + { + HProfTestHelper tester("ContrastTraceTree.heapsnapshot"); +- ASSERT_TRUE(tester.GenerateHeapDump(thread)); ++ ASSERT_TRUE(tester.GenerateHeapDump(thread_)); + ASSERT_TRUE(tester.ContrastJSONSectionPayload("\"trace_tree\":", 2)); // Empty + ASSERT_TRUE(tester.RemoveExistingFile()); + } +@@ -285,7 +285,7 @@ TEST_F(HProfTest, DISABLED_ContrastTraceTree) + TEST_F(HProfTest, DISABLED_ContrastSamples) + { + HProfTestHelper tester("ContrastSamples.heapsnapshot"); +- ASSERT_TRUE(tester.GenerateHeapDump(thread)); ++ ASSERT_TRUE(tester.GenerateHeapDump(thread_)); + ASSERT_TRUE(tester.ContrastJSONSectionPayload("\"samples\":", 2)); // Empty + ASSERT_TRUE(tester.RemoveExistingFile()); + } +@@ -293,7 +293,7 @@ TEST_F(HProfTest, DISABLED_ContrastSamples) + TEST_F(HProfTest, DISABLED_ContrastLocations) + { + HProfTestHelper tester("ContrastLocations.heapsnapshot"); +- ASSERT_TRUE(tester.GenerateHeapDump(thread)); ++ ASSERT_TRUE(tester.GenerateHeapDump(thread_)); + ASSERT_TRUE(tester.ContrastJSONSectionPayload("\"locations\":", 2)); // Empty + ASSERT_TRUE(tester.RemoveExistingFile()); + } +@@ -301,7 +301,7 @@ TEST_F(HProfTest, DISABLED_ContrastLocations) + TEST_F(HProfTest, DISABLED_ContrastString) + { + HProfTestHelper tester("ContrastString.heapsnapshot"); +- ASSERT_TRUE(tester.GenerateHeapDump(thread)); ++ ASSERT_TRUE(tester.GenerateHeapDump(thread_)); + ASSERT_TRUE(tester.ContrastJSONSectionPayload("\"strings\":[", 1 + 1)); + ASSERT_TRUE(tester.RemoveExistingFile()); + } +@@ -309,7 +309,7 @@ TEST_F(HProfTest, DISABLED_ContrastString) + TEST_F(HProfTest, DISABLED_ContrastClosure) + { + HProfTestHelper tester("ContrastClosure.heapsnapshot"); +- ASSERT_TRUE(tester.GenerateHeapDump(thread)); ++ ASSERT_TRUE(tester.GenerateHeapDump(thread_)); + ASSERT_TRUE(tester.ContrastJSONClousure()); + ASSERT_TRUE(tester.RemoveExistingFile()); + } +@@ -317,7 +317,7 @@ TEST_F(HProfTest, DISABLED_ContrastClosure) + TEST_F(HProfTest, DISABLED_ContrastNodeCount) + { + HProfTestHelper tester("ContrastNodeCount.heapsnapshot"); +- ASSERT_TRUE(tester.GenerateHeapDump(thread)); ++ ASSERT_TRUE(tester.GenerateHeapDump(thread_)); + ASSERT_TRUE(tester.ExtractCountFromMeta("\"node_count\":") == tester.ExtractCountFromPayload("\"nodes\":[")); + ASSERT_TRUE(tester.RemoveExistingFile()); + } +@@ -325,7 +325,7 @@ TEST_F(HProfTest, DISABLED_ContrastNodeCount) + TEST_F(HProfTest, DISABLED_ContrastEdgeCount) + { + HProfTestHelper tester("ContrastEdgeCount.heapsnapshot"); +- ASSERT_TRUE(tester.GenerateHeapDump(thread)); ++ ASSERT_TRUE(tester.GenerateHeapDump(thread_)); + ASSERT_TRUE(tester.ExtractCountFromMeta("\"edge_count\":") == tester.ExtractCountFromPayload("\"edges\":[")); + ASSERT_TRUE(tester.RemoveExistingFile()); + } +@@ -333,7 +333,7 @@ TEST_F(HProfTest, DISABLED_ContrastEdgeCount) + TEST_F(HProfTest, DISABLED_ContrastTraceFunctionInfoCount) + { + HProfTestHelper tester("ContrastTraceFunctionInfoCount.heapsnapshot"); +- ASSERT_TRUE(tester.GenerateHeapDump(thread)); ++ ASSERT_TRUE(tester.GenerateHeapDump(thread_)); + ASSERT_TRUE(tester.ExtractCountFromMeta("\"trace_function_count\":") == + tester.ExtractCountFromPayload("\"trace_function_infos\":")); + ASSERT_TRUE(tester.RemoveExistingFile()); +diff --git a/tests/runtime/mem/g1gc_barrier_test.cpp b/tests/runtime/mem/g1gc_barrier_test.cpp +index 8cda01f..910f415 100644 +--- a/tests/runtime/mem/g1gc_barrier_test.cpp ++++ b/tests/runtime/mem/g1gc_barrier_test.cpp +@@ -78,7 +78,7 @@ public: + if (phase != mem::GCPhase::GC_PHASE_MARK) { + return; + } +- has_concurrent_mark = true; ++ has_concurrent_mark_ = true; + JSThread *thread = test_->thread_; + array_->Set(thread, 0, JSTaggedValue::Undefined()); + array_->Set(thread, 1, replacement_.GetTaggedValue()); +@@ -96,7 +96,7 @@ public: + JSHandle array_; + JSHandle object_; + JSHandle replacement_; +- bool has_concurrent_mark = false; ++ bool has_concurrent_mark_ = false; + }; + + TEST_F(G1GCBarrierTest, TestPreBarrier) +@@ -114,6 +114,6 @@ TEST_F(G1GCBarrierTest, TestPreBarrier) + + GCTask task(GCTaskCause::HEAP_USAGE_THRESHOLD_CAUSE); // trigger concurrent marking + task.Run(*gc); +- ASSERT_TRUE(listener.has_concurrent_mark); ++ ASSERT_TRUE(listener.has_concurrent_mark_); + } + } // namespace panda::ecmascript +diff --git a/tests/runtime/mem/weak_containers_test.cpp b/tests/runtime/mem/weak_containers_test.cpp +index cbc3e26..45f2cfd 100644 +--- a/tests/runtime/mem/weak_containers_test.cpp ++++ b/tests/runtime/mem/weak_containers_test.cpp +@@ -36,8 +36,8 @@ public: + void SetUp() override + { + RuntimeOption option; +- option.SetGcType(RuntimeOption::GC_TYPE::G1_GC); +- option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR); ++ option.SetGcType(RuntimeOption::GcType::G1_GC); ++ option.SetLogLevel(RuntimeOption::LogLevel::ERROR); + vm_ = JSNApi::CreateJSVM(option); + ASSERT_TRUE(vm_ != nullptr) << "Cannot create Runtime"; + thread_ = vm_->GetAssociatedJSThread(); +diff --git a/tests/runtime/napi/jsnapi_tests.cpp b/tests/runtime/napi/jsnapi_tests.cpp +index 8b89562..3e8753f 100644 +--- a/tests/runtime/napi/jsnapi_tests.cpp ++++ b/tests/runtime/napi/jsnapi_tests.cpp +@@ -46,8 +46,8 @@ public: + void SetUp() override + { + RuntimeOption option; +- option.SetGcType(RuntimeOption::GC_TYPE::STW); +- option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR); ++ option.SetGcType(RuntimeOption::GcType::STW); ++ option.SetLogLevel(RuntimeOption::LogLevel::ERROR); + vm_ = JSNApi::CreateJSVM(option); + ASSERT_TRUE(vm_ != nullptr) << "Cannot create Runtime"; + thread_ = vm_->GetAssociatedJSThread(); +@@ -414,15 +414,15 @@ TEST_F(JSNApiTests, ArrayBufferWithBuffer) + { + static bool isFree = false; + struct Data { +- int32_t length; ++ int32_t length_; + }; + const int32_t length = 15; + Data *data = new Data(); +- data->length = length; ++ data->length_ = length; + Deleter deleter = [](void *buffer, void *data_ptr) -> void { + delete[] reinterpret_cast(buffer); + Data *currentData = reinterpret_cast(data_ptr); +- ASSERT_EQ(currentData->length, 15); // 5 : size of arguments ++ ASSERT_EQ(currentData->length_, 15); // 5 : size of arguments + delete currentData; + isFree = true; + }; +diff --git a/tests/runtime/regexp/dyn_buffer_test.cpp b/tests/runtime/regexp/dyn_buffer_test.cpp +index c163e9a..9909214 100644 +--- a/tests/runtime/regexp/dyn_buffer_test.cpp ++++ b/tests/runtime/regexp/dyn_buffer_test.cpp +@@ -30,18 +30,18 @@ class DynBufferTest : public testing::Test { + public: + void SetUp() override + { +- TestHelper::CreateEcmaVMWithScope(instance, thread, scope); +- chunk_ = thread->GetEcmaVM()->GetChunk(); ++ TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); ++ chunk_ = thread_->GetEcmaVM()->GetChunk(); + } + + void TearDown() override + { +- TestHelper::DestroyEcmaVMWithScope(instance, scope); ++ TestHelper::DestroyEcmaVMWithScope(instance_, scope_); + } + +- PandaVM *instance; +- JSThread *thread; +- EcmaHandleScope *scope {nullptr}; ++ PandaVM *instance_; ++ JSThread *thread_; ++ EcmaHandleScope *scope_ {nullptr}; + Chunk *chunk_; + }; + +diff --git a/tests/runtime/regexp/regexp_test.cpp b/tests/runtime/regexp/regexp_test.cpp +index faa9d6e..b32840c 100644 +--- a/tests/runtime/regexp/regexp_test.cpp ++++ b/tests/runtime/regexp/regexp_test.cpp +@@ -42,13 +42,13 @@ public: + + void SetUp() override + { +- TestHelper::CreateEcmaVMWithScope(instance, thread, scope); +- chunk_ = thread->GetEcmaVM()->GetChunk(); ++ TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); ++ chunk_ = thread_->GetEcmaVM()->GetChunk(); + } + + void TearDown() override + { +- TestHelper::DestroyEcmaVMWithScope(instance, scope); ++ TestHelper::DestroyEcmaVMWithScope(instance_, scope_); + } + + bool IsValidAlphaEscapeInAtom(char s) const +@@ -102,9 +102,9 @@ public: + } + + protected: +- PandaVM *instance {nullptr}; +- EcmaHandleScope *scope {nullptr}; +- JSThread *thread {nullptr}; ++ PandaVM *instance_ {nullptr}; ++ EcmaHandleScope *scope_ {nullptr}; ++ JSThread *thread_ {nullptr}; + Chunk *chunk_ {nullptr}; + }; + +@@ -610,7 +610,7 @@ TEST_F(RegExpTest, ParseNoError2) + + TEST_F(RegExpTest, ParseAndExec1) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + RegExpParser parser = RegExpParser(chunk_); + CString source("ab"); + parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 0); +@@ -624,7 +624,7 @@ TEST_F(RegExpTest, ParseAndExec1) + executor.Execute(reinterpret_cast(input.c_str()), 0, input.size(), parser.GetOriginBuffer()); + ASSERT_TRUE(ret); + +- MatchResult result = executor.GetResult(thread, ret); ++ MatchResult result = executor.GetResult(thread_, ret); + ASSERT_EQ(result.captures_.size(), 1); + JSHandle str = factory->NewFromCanBeCompressString("ab"); + ASSERT_TRUE(result.captures_[0].second->Compare(*str) == 0); +@@ -632,7 +632,7 @@ TEST_F(RegExpTest, ParseAndExec1) + + TEST_F(RegExpTest, ParseAndExec2) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + RegExpParser parser = RegExpParser(chunk_); + CString source("(((ab)|(cd)|(de))|((ef)|(gh)|(jk)))"); + parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 0); +@@ -646,7 +646,7 @@ TEST_F(RegExpTest, ParseAndExec2) + executor.Execute(reinterpret_cast(input.c_str()), 0, input.size(), parser.GetOriginBuffer()); + ASSERT_TRUE(ret); + +- MatchResult result = executor.GetResult(thread, ret); ++ MatchResult result = executor.GetResult(thread_, ret); + ASSERT_EQ(result.captures_.size(), 10); + JSHandle str = factory->NewFromCanBeCompressString("ab"); + ASSERT_TRUE(result.captures_[0].second->Compare(*str) == 0); +@@ -663,7 +663,7 @@ TEST_F(RegExpTest, ParseAndExec2) + + TEST_F(RegExpTest, ParseAndExec3) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + RegExpParser parser = RegExpParser(chunk_); + CString source("(aa|aabaac|ba|b|c)*"); + parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 0); +@@ -677,7 +677,7 @@ TEST_F(RegExpTest, ParseAndExec3) + executor.Execute(reinterpret_cast(input.c_str()), 0, input.size(), parser.GetOriginBuffer()); + ASSERT_TRUE(ret); + +- MatchResult result = executor.GetResult(thread, ret); ++ MatchResult result = executor.GetResult(thread_, ret); + ASSERT_EQ(result.captures_.size(), 2); + JSHandle str1 = factory->NewFromCanBeCompressString("aaba"); + JSHandle str2 = factory->NewFromCanBeCompressString("ba"); +@@ -687,7 +687,7 @@ TEST_F(RegExpTest, ParseAndExec3) + + TEST_F(RegExpTest, ParseAndExec4) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + RegExpParser parser = RegExpParser(chunk_); + CString source("a*"); + parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 0); +@@ -701,7 +701,7 @@ TEST_F(RegExpTest, ParseAndExec4) + executor.Execute(reinterpret_cast(input.c_str()), 0, input.size(), parser.GetOriginBuffer()); + ASSERT_TRUE(ret); + +- MatchResult result = executor.GetResult(thread, ret); ++ MatchResult result = executor.GetResult(thread_, ret); + ASSERT_EQ(result.captures_.size(), 1); + JSHandle str = factory->NewFromCanBeCompressString("aa"); + ASSERT_TRUE(result.captures_[0].second->Compare(*str) == 0); +@@ -709,7 +709,7 @@ TEST_F(RegExpTest, ParseAndExec4) + + TEST_F(RegExpTest, ParseAndExec5) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + RegExpParser parser = RegExpParser(chunk_); + CString source("a?"); + parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 0); +@@ -723,7 +723,7 @@ TEST_F(RegExpTest, ParseAndExec5) + executor.Execute(reinterpret_cast(input.c_str()), 0, input.size(), parser.GetOriginBuffer()); + ASSERT_TRUE(ret); + +- MatchResult result = executor.GetResult(thread, ret); ++ MatchResult result = executor.GetResult(thread_, ret); + ASSERT_EQ(result.captures_.size(), 1); + JSHandle str = factory->NewFromCanBeCompressString(""); + ASSERT_TRUE(result.captures_[0].second->Compare(*str) == 0); +@@ -731,7 +731,7 @@ TEST_F(RegExpTest, ParseAndExec5) + + TEST_F(RegExpTest, ParseAndExec6) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + RegExpParser parser = RegExpParser(chunk_); + CString source("(z)((a+)?(b+)?(c))*"); + parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 0); +@@ -745,7 +745,7 @@ TEST_F(RegExpTest, ParseAndExec6) + executor.Execute(reinterpret_cast(input.c_str()), 0, input.size(), parser.GetOriginBuffer()); + ASSERT_TRUE(ret); + +- MatchResult result = executor.GetResult(thread, ret); ++ MatchResult result = executor.GetResult(thread_, ret); + ASSERT_EQ(result.captures_.size(), 6); + JSHandle str1 = factory->NewFromCanBeCompressString("zaacbbbcac"); + JSHandle str2 = factory->NewFromCanBeCompressString("z"); +@@ -762,7 +762,7 @@ TEST_F(RegExpTest, ParseAndExec6) + + TEST_F(RegExpTest, ParseAndExec7) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + RegExpParser parser = RegExpParser(chunk_); + CString source("^abc"); + parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 4); +@@ -776,7 +776,7 @@ TEST_F(RegExpTest, ParseAndExec7) + executor.Execute(reinterpret_cast(input.c_str()), 0, input.size(), parser.GetOriginBuffer()); + ASSERT_TRUE(ret); + +- MatchResult result = executor.GetResult(thread, ret); ++ MatchResult result = executor.GetResult(thread_, ret); + ASSERT_EQ(result.captures_.size(), 1); + JSHandle str = factory->NewFromCanBeCompressString("abc"); + ASSERT_TRUE(result.captures_[0].second->Compare(*str) == 0); +@@ -784,7 +784,7 @@ TEST_F(RegExpTest, ParseAndExec7) + + TEST_F(RegExpTest, ParseAndExec8) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + RegExpParser parser = RegExpParser(chunk_); + CString source("abc$"); + parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 4); +@@ -798,7 +798,7 @@ TEST_F(RegExpTest, ParseAndExec8) + executor.Execute(reinterpret_cast(input.c_str()), 0, input.size(), parser.GetOriginBuffer()); + ASSERT_TRUE(ret); + +- MatchResult result = executor.GetResult(thread, ret); ++ MatchResult result = executor.GetResult(thread_, ret); + ASSERT_EQ(result.captures_.size(), 1); + JSHandle str = factory->NewFromCanBeCompressString("abc"); + ASSERT_TRUE(result.captures_[0].second->Compare(*str) == 0); +@@ -806,7 +806,7 @@ TEST_F(RegExpTest, ParseAndExec8) + + TEST_F(RegExpTest, ParseAndExec9) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + RegExpParser parser = RegExpParser(chunk_); + CString source("er\\B"); + parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 0); +@@ -820,7 +820,7 @@ TEST_F(RegExpTest, ParseAndExec9) + executor.Execute(reinterpret_cast(input.c_str()), 0, input.size(), parser.GetOriginBuffer()); + ASSERT_TRUE(ret); + +- MatchResult result = executor.GetResult(thread, ret); ++ MatchResult result = executor.GetResult(thread_, ret); + ASSERT_EQ(result.captures_.size(), 1); + JSHandle str = factory->NewFromCanBeCompressString("er"); + ASSERT_TRUE(result.captures_[0].second->Compare(*str) == 0); +@@ -828,7 +828,7 @@ TEST_F(RegExpTest, ParseAndExec9) + + TEST_F(RegExpTest, ParseAndExec10) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + RegExpParser parser = RegExpParser(chunk_); + CString source("d\\b"); + parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 0); +@@ -842,7 +842,7 @@ TEST_F(RegExpTest, ParseAndExec10) + executor.Execute(reinterpret_cast(input.c_str()), 0, input.size(), parser.GetOriginBuffer()); + ASSERT_TRUE(ret); + +- MatchResult result = executor.GetResult(thread, ret); ++ MatchResult result = executor.GetResult(thread_, ret); + ASSERT_EQ(result.captures_.size(), 1); + JSHandle str = factory->NewFromCanBeCompressString("d"); + ASSERT_TRUE(result.captures_[0].second->Compare(*str) == 0); +@@ -850,7 +850,7 @@ TEST_F(RegExpTest, ParseAndExec10) + + TEST_F(RegExpTest, ParseAndExec11) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + RegExpParser parser = RegExpParser(chunk_); + CString source("."); + parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 0); +@@ -864,7 +864,7 @@ TEST_F(RegExpTest, ParseAndExec11) + executor.Execute(reinterpret_cast(input.c_str()), 0, input.size(), parser.GetOriginBuffer()); + ASSERT_TRUE(ret); + +- MatchResult result = executor.GetResult(thread, ret); ++ MatchResult result = executor.GetResult(thread_, ret); + ASSERT_EQ(result.captures_.size(), 1); + JSHandle str = factory->NewFromCanBeCompressString("a"); + ASSERT_TRUE(result.captures_[0].second->Compare(*str) == 0); +@@ -872,7 +872,7 @@ TEST_F(RegExpTest, ParseAndExec11) + + TEST_F(RegExpTest, ParseAndExec12) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + RegExpParser parser = RegExpParser(chunk_); + CString source("."); + parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 8); +@@ -886,7 +886,7 @@ TEST_F(RegExpTest, ParseAndExec12) + executor.Execute(reinterpret_cast(input.c_str()), 0, input.size(), parser.GetOriginBuffer()); + ASSERT_TRUE(ret); + +- MatchResult result = executor.GetResult(thread, ret); ++ MatchResult result = executor.GetResult(thread_, ret); + ASSERT_EQ(result.captures_.size(), 1); + JSHandle str = factory->NewFromCanBeCompressString("\n"); + ASSERT_TRUE(result.captures_[0].second->Compare(*str) == 0); +@@ -894,7 +894,7 @@ TEST_F(RegExpTest, ParseAndExec12) + + TEST_F(RegExpTest, ParseAndExec13) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + RegExpParser parser = RegExpParser(chunk_); + CString source("abc"); + parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 4); +@@ -908,7 +908,7 @@ TEST_F(RegExpTest, ParseAndExec13) + executor.Execute(reinterpret_cast(input.c_str()), 0, input.size(), parser.GetOriginBuffer()); + ASSERT_TRUE(ret); + +- MatchResult result = executor.GetResult(thread, ret); ++ MatchResult result = executor.GetResult(thread_, ret); + ASSERT_EQ(result.captures_.size(), 1); + JSHandle str = factory->NewFromCanBeCompressString("abc"); + ASSERT_TRUE(result.captures_[0].second->Compare(*str) == 0); +@@ -916,7 +916,7 @@ TEST_F(RegExpTest, ParseAndExec13) + + TEST_F(RegExpTest, ParseAndExec14) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + RegExpParser parser = RegExpParser(chunk_); + CString source("abc"); + parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 4); +@@ -930,7 +930,7 @@ TEST_F(RegExpTest, ParseAndExec14) + executor.Execute(reinterpret_cast(input.c_str()), 0, input.size(), parser.GetOriginBuffer()); + ASSERT_TRUE(ret); + +- MatchResult result = executor.GetResult(thread, ret); ++ MatchResult result = executor.GetResult(thread_, ret); + ASSERT_EQ(result.captures_.size(), 1); + JSHandle str = factory->NewFromCanBeCompressString("abc"); + ASSERT_TRUE(result.captures_[0].second->Compare(*str) == 0); +@@ -938,7 +938,7 @@ TEST_F(RegExpTest, ParseAndExec14) + + TEST_F(RegExpTest, ParseAndExec15) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + RegExpParser parser = RegExpParser(chunk_); + CString source("a(?=a)"); + parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 0); +@@ -952,7 +952,7 @@ TEST_F(RegExpTest, ParseAndExec15) + executor.Execute(reinterpret_cast(input.c_str()), 0, input.size(), parser.GetOriginBuffer()); + ASSERT_TRUE(ret); + +- MatchResult result = executor.GetResult(thread, ret); ++ MatchResult result = executor.GetResult(thread_, ret); + ASSERT_EQ(result.captures_.size(), 1); + JSHandle str = factory->NewFromCanBeCompressString("a"); + ASSERT_TRUE(result.captures_[0].second->Compare(*str) == 0); +@@ -960,7 +960,7 @@ TEST_F(RegExpTest, ParseAndExec15) + + TEST_F(RegExpTest, ParseAndExec16) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + RegExpParser parser = RegExpParser(chunk_); + CString source("abc"); + parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 2); +@@ -974,7 +974,7 @@ TEST_F(RegExpTest, ParseAndExec16) + executor.Execute(reinterpret_cast(input.c_str()), 0, input.size(), parser.GetOriginBuffer()); + ASSERT_TRUE(ret); + +- MatchResult result = executor.GetResult(thread, ret); ++ MatchResult result = executor.GetResult(thread_, ret); + ASSERT_EQ(result.captures_.size(), 1); + JSHandle str = factory->NewFromCanBeCompressString("ABC"); + ASSERT_TRUE(result.captures_[0].second->Compare(*str) == 0); +@@ -982,7 +982,7 @@ TEST_F(RegExpTest, ParseAndExec16) + + TEST_F(RegExpTest, ParseAndExec17) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + RegExpParser parser = RegExpParser(chunk_); + CString source("a\\n"); + parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 2); +@@ -996,7 +996,7 @@ TEST_F(RegExpTest, ParseAndExec17) + executor.Execute(reinterpret_cast(input.c_str()), 0, input.size(), parser.GetOriginBuffer()); + ASSERT_TRUE(ret); + +- MatchResult result = executor.GetResult(thread, ret); ++ MatchResult result = executor.GetResult(thread_, ret); + ASSERT_EQ(result.captures_.size(), 1); + JSHandle str = factory->NewFromCanBeCompressString("a\n"); + ASSERT_TRUE(result.captures_[0].second->Compare(*str) == 0); +@@ -1020,7 +1020,7 @@ TEST_F(RegExpTest, ParseAndExec18) + + TEST_F(RegExpTest, ParseAndExec19) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + RegExpParser parser = RegExpParser(chunk_); + CString source("a(?!a)"); + parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 0); +@@ -1034,7 +1034,7 @@ TEST_F(RegExpTest, ParseAndExec19) + executor.Execute(reinterpret_cast(input.c_str()), 0, input.size(), parser.GetOriginBuffer()); + ASSERT_TRUE(ret); + +- MatchResult result = executor.GetResult(thread, ret); ++ MatchResult result = executor.GetResult(thread_, ret); + ASSERT_EQ(result.captures_.size(), 1); + JSHandle str = factory->NewFromCanBeCompressString("a"); + ASSERT_TRUE(result.captures_[0].second->Compare(*str) == 0); +@@ -1042,7 +1042,7 @@ TEST_F(RegExpTest, ParseAndExec19) + + TEST_F(RegExpTest, ParseAndExec20) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + RegExpParser parser = RegExpParser(chunk_); + CString source("(?=(a+))"); + parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 0); +@@ -1056,7 +1056,7 @@ TEST_F(RegExpTest, ParseAndExec20) + executor.Execute(reinterpret_cast(input.c_str()), 0, input.size(), parser.GetOriginBuffer()); + ASSERT_TRUE(ret); + +- MatchResult result = executor.GetResult(thread, ret); ++ MatchResult result = executor.GetResult(thread_, ret); + ASSERT_EQ(result.captures_.size(), 2); + JSHandle str1 = factory->NewFromCanBeCompressString(""); + JSHandle str2 = factory->NewFromCanBeCompressString("aaa"); +@@ -1066,7 +1066,7 @@ TEST_F(RegExpTest, ParseAndExec20) + + TEST_F(RegExpTest, ParseAndExec21) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + RegExpParser parser = RegExpParser(chunk_); + CString source("a(?=a(?=b))"); + parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 0); +@@ -1080,7 +1080,7 @@ TEST_F(RegExpTest, ParseAndExec21) + executor.Execute(reinterpret_cast(input.c_str()), 0, input.size(), parser.GetOriginBuffer()); + ASSERT_TRUE(ret); + +- MatchResult result = executor.GetResult(thread, ret); ++ MatchResult result = executor.GetResult(thread_, ret); + ASSERT_EQ(result.captures_.size(), 1); + JSHandle str = factory->NewFromCanBeCompressString("a"); + ASSERT_TRUE(result.captures_[0].second->Compare(*str) == 0); +@@ -1088,7 +1088,7 @@ TEST_F(RegExpTest, ParseAndExec21) + + TEST_F(RegExpTest, ParseAndExec22) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + RegExpParser parser = RegExpParser(chunk_); + CString source(".+:"); + parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 0); +@@ -1102,7 +1102,7 @@ TEST_F(RegExpTest, ParseAndExec22) + executor.Execute(reinterpret_cast(input.c_str()), 0, input.size(), parser.GetOriginBuffer()); + ASSERT_TRUE(ret); + +- MatchResult result = executor.GetResult(thread, ret); ++ MatchResult result = executor.GetResult(thread_, ret); + ASSERT_EQ(result.captures_.size(), 1); + JSHandle str = factory->NewFromCanBeCompressString("aaaa:"); + ASSERT_TRUE(result.captures_[0].second->Compare(*str) == 0); +@@ -1110,7 +1110,7 @@ TEST_F(RegExpTest, ParseAndExec22) + + TEST_F(RegExpTest, ParseAndExec23) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + RegExpParser parser = RegExpParser(chunk_); + CString source("a(?<=a(?(reinterpret_cast(source.c_str())), source.size(), 0); +@@ -1124,7 +1124,7 @@ TEST_F(RegExpTest, ParseAndExec23) + executor.Execute(reinterpret_cast(input.c_str()), 0, input.size(), parser.GetOriginBuffer()); + ASSERT_TRUE(ret); + +- MatchResult result = executor.GetResult(thread, ret); ++ MatchResult result = executor.GetResult(thread_, ret); + ASSERT_EQ(result.captures_.size(), 1); + JSHandle str = factory->NewFromCanBeCompressString("a"); + ASSERT_TRUE(result.captures_[0].second->Compare(*str) == 0); +@@ -1148,7 +1148,7 @@ TEST_F(RegExpTest, ParseAndExec24) + + TEST_F(RegExpTest, ParseAndExec25) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + RegExpParser parser = RegExpParser(chunk_); + CString source("(?<=(ab))"); + parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 0); +@@ -1162,7 +1162,7 @@ TEST_F(RegExpTest, ParseAndExec25) + executor.Execute(reinterpret_cast(input.c_str()), 0, input.size(), parser.GetOriginBuffer()); + ASSERT_TRUE(ret); + +- MatchResult result = executor.GetResult(thread, ret); ++ MatchResult result = executor.GetResult(thread_, ret); + ASSERT_EQ(result.captures_.size(), 2); + JSHandle str1 = factory->NewFromCanBeCompressString(""); + JSHandle str2 = factory->NewFromCanBeCompressString("ab"); +@@ -1172,7 +1172,7 @@ TEST_F(RegExpTest, ParseAndExec25) + + TEST_F(RegExpTest, ParseAndExec26) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + RegExpParser parser = RegExpParser(chunk_); + CString source("[a-z]"); + parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 2); +@@ -1186,7 +1186,7 @@ TEST_F(RegExpTest, ParseAndExec26) + executor.Execute(reinterpret_cast(input.c_str()), 0, input.size(), parser.GetOriginBuffer()); + ASSERT_TRUE(ret); + +- MatchResult result = executor.GetResult(thread, ret); ++ MatchResult result = executor.GetResult(thread_, ret); + ASSERT_EQ(result.captures_.size(), 1); + JSHandle str = factory->NewFromCanBeCompressString("A"); + ASSERT_TRUE(result.captures_[0].second->Compare(*str) == 0); +@@ -1194,7 +1194,7 @@ TEST_F(RegExpTest, ParseAndExec26) + + TEST_F(RegExpTest, ParseAndExec27) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + RegExpParser parser = RegExpParser(chunk_); + CString source("[^a-b]"); + parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 2); +@@ -1208,7 +1208,7 @@ TEST_F(RegExpTest, ParseAndExec27) + executor.Execute(reinterpret_cast(input.c_str()), 0, input.size(), parser.GetOriginBuffer()); + ASSERT_TRUE(ret); + +- MatchResult result = executor.GetResult(thread, ret); ++ MatchResult result = executor.GetResult(thread_, ret); + ASSERT_EQ(result.captures_.size(), 1); + JSHandle str = factory->NewFromCanBeCompressString("Z"); + ASSERT_TRUE(result.captures_[0].second->Compare(*str) == 0); +@@ -1216,7 +1216,7 @@ TEST_F(RegExpTest, ParseAndExec27) + + TEST_F(RegExpTest, ParseAndExec28) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + RegExpParser parser = RegExpParser(chunk_); + CString source("\\s"); + parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 0); +@@ -1230,7 +1230,7 @@ TEST_F(RegExpTest, ParseAndExec28) + executor.Execute(reinterpret_cast(input.c_str()), 0, input.size(), parser.GetOriginBuffer()); + ASSERT_TRUE(ret); + +- MatchResult result = executor.GetResult(thread, ret); ++ MatchResult result = executor.GetResult(thread_, ret); + ASSERT_EQ(result.captures_.size(), 1); + JSHandle str = factory->NewFromCanBeCompressString("\n"); + ASSERT_TRUE(result.captures_[0].second->Compare(*str) == 0); +@@ -1238,7 +1238,7 @@ TEST_F(RegExpTest, ParseAndExec28) + + TEST_F(RegExpTest, ParseAndExec29) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + RegExpParser parser = RegExpParser(chunk_); + CString source("()|"); + parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 0); +@@ -1252,7 +1252,7 @@ TEST_F(RegExpTest, ParseAndExec29) + executor.Execute(reinterpret_cast(input.c_str()), 0, input.size(), parser.GetOriginBuffer()); + ASSERT_TRUE(ret); + +- MatchResult result = executor.GetResult(thread, ret); ++ MatchResult result = executor.GetResult(thread_, ret); + ASSERT_EQ(result.captures_.size(), 2); + JSHandle str = factory->NewFromCanBeCompressString(""); + ASSERT_TRUE(result.captures_[0].second->Compare(*str) == 0); +@@ -1261,7 +1261,7 @@ TEST_F(RegExpTest, ParseAndExec29) + + TEST_F(RegExpTest, ParseAndExec30) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + RegExpParser parser = RegExpParser(chunk_); + CString source("|()"); + parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 0); +@@ -1275,7 +1275,7 @@ TEST_F(RegExpTest, ParseAndExec30) + executor.Execute(reinterpret_cast(input.c_str()), 0, input.size(), parser.GetOriginBuffer()); + ASSERT_TRUE(ret); + +- MatchResult result = executor.GetResult(thread, ret); ++ MatchResult result = executor.GetResult(thread_, ret); + ASSERT_EQ(result.captures_.size(), 2); + JSHandle str = factory->NewFromCanBeCompressString(""); + ASSERT_TRUE(result.captures_[0].second->Compare(*str) == 0); +@@ -1284,7 +1284,7 @@ TEST_F(RegExpTest, ParseAndExec30) + + TEST_F(RegExpTest, ParseAndExec31) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + RegExpParser parser = RegExpParser(chunk_); + CString source("a(a|b)\\1"); + parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 2); +@@ -1296,7 +1296,7 @@ TEST_F(RegExpTest, ParseAndExec31) + bool ret = + executor.Execute(reinterpret_cast(input.c_str()), 0, input.length(), parser.GetOriginBuffer()); + ASSERT_TRUE(ret); +- MatchResult result = executor.GetResult(thread, ret); ++ MatchResult result = executor.GetResult(thread_, ret); + ASSERT_EQ(result.captures_.size(), 2); + JSHandle str1 = factory->NewFromCanBeCompressString("abb"); + JSHandle str2 = factory->NewFromCanBeCompressString("b"); +@@ -1306,7 +1306,7 @@ TEST_F(RegExpTest, ParseAndExec31) + + TEST_F(RegExpTest, ParseAndExec32) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + RegExpParser parser = RegExpParser(chunk_); + CString source("(a(a|b))\\2"); + parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 2); +@@ -1318,7 +1318,7 @@ TEST_F(RegExpTest, ParseAndExec32) + bool ret = + executor.Execute(reinterpret_cast(input.c_str()), 0, input.length(), parser.GetOriginBuffer()); + ASSERT_TRUE(ret); +- MatchResult result = executor.GetResult(thread, ret); ++ MatchResult result = executor.GetResult(thread_, ret); + ASSERT_EQ(result.captures_.size(), 3); + JSHandle str1 = factory->NewFromCanBeCompressString("abb"); + JSHandle str2 = factory->NewFromCanBeCompressString("ab"); +@@ -1330,7 +1330,7 @@ TEST_F(RegExpTest, ParseAndExec32) + + TEST_F(RegExpTest, ParseAndExec33) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + RegExpParser parser = RegExpParser(chunk_); + CString source("qya+"); + parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 2); +@@ -1342,7 +1342,7 @@ TEST_F(RegExpTest, ParseAndExec33) + bool ret = + executor.Execute(reinterpret_cast(input.c_str()), 0, input.length(), parser.GetOriginBuffer()); + ASSERT_TRUE(ret); +- MatchResult result = executor.GetResult(thread, ret); ++ MatchResult result = executor.GetResult(thread_, ret); + ASSERT_EQ(result.captures_.size(), 1); + JSHandle str = factory->NewFromCanBeCompressString("qya"); + ASSERT_TRUE(result.captures_[0].second->Compare(*str) == 0); +@@ -1350,7 +1350,7 @@ TEST_F(RegExpTest, ParseAndExec33) + + TEST_F(RegExpTest, ParseAndExec34) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + RegExpParser parser = RegExpParser(chunk_); + CString source("qy(?=\\s+)"); + parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 2); +@@ -1362,7 +1362,7 @@ TEST_F(RegExpTest, ParseAndExec34) + bool ret = + executor.Execute(reinterpret_cast(input.c_str()), 0, input.length(), parser.GetOriginBuffer()); + ASSERT_TRUE(ret); +- MatchResult result = executor.GetResult(thread, ret); ++ MatchResult result = executor.GetResult(thread_, ret); + ASSERT_EQ(result.captures_.size(), 1); + JSHandle str = factory->NewFromCanBeCompressString("qy"); + ASSERT_TRUE(result.captures_[0].second->Compare(*str) == 0); +@@ -1370,7 +1370,7 @@ TEST_F(RegExpTest, ParseAndExec34) + + TEST_F(RegExpTest, ParseAndExec35) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + RegExpParser parser = RegExpParser(chunk_); + CString source("(\\d{4})-(\\d{2})-(\\d{2})"); + parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 2); +@@ -1382,7 +1382,7 @@ TEST_F(RegExpTest, ParseAndExec35) + bool ret = + executor.Execute(reinterpret_cast(input.c_str()), 0, input.length(), parser.GetOriginBuffer()); + ASSERT_TRUE(ret); +- MatchResult result = executor.GetResult(thread, ret); ++ MatchResult result = executor.GetResult(thread_, ret); + ASSERT_EQ(result.captures_.size(), 4); + JSHandle str1 = factory->NewFromCanBeCompressString("2021-01-09"); + JSHandle str2 = factory->NewFromCanBeCompressString("2021"); +@@ -1396,7 +1396,7 @@ TEST_F(RegExpTest, ParseAndExec35) + + TEST_F(RegExpTest, ParseAndExec36) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + RegExpParser parser = RegExpParser(chunk_); + CString source("quick\\s(brown).+?(jumps)"); + parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 2); +@@ -1408,7 +1408,7 @@ TEST_F(RegExpTest, ParseAndExec36) + bool ret = + executor.Execute(reinterpret_cast(input.c_str()), 0, input.length(), parser.GetOriginBuffer()); + ASSERT_TRUE(ret); +- MatchResult result = executor.GetResult(thread, ret); ++ MatchResult result = executor.GetResult(thread_, ret); + ASSERT_EQ(result.captures_.size(), 3); + JSHandle str1 = factory->NewFromCanBeCompressString("Quick Brown Fox Jumps"); + JSHandle str2 = factory->NewFromCanBeCompressString("Brown"); +@@ -1420,7 +1420,7 @@ TEST_F(RegExpTest, ParseAndExec36) + + TEST_F(RegExpTest, ParseAndExec37) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + RegExpParser parser = RegExpParser(chunk_); + CString source("(ab){1,2}?c"); + parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 2); +@@ -1432,7 +1432,7 @@ TEST_F(RegExpTest, ParseAndExec37) + bool ret = + executor.Execute(reinterpret_cast(input.c_str()), 0, input.length(), parser.GetOriginBuffer()); + ASSERT_TRUE(ret); +- MatchResult result = executor.GetResult(thread, ret); ++ MatchResult result = executor.GetResult(thread_, ret); + ASSERT_EQ(result.captures_.size(), 2); + JSHandle str1 = factory->NewFromCanBeCompressString("abABc"); + JSHandle str2 = factory->NewFromCanBeCompressString("AB"); +@@ -1442,7 +1442,7 @@ TEST_F(RegExpTest, ParseAndExec37) + + TEST_F(RegExpTest, ParseAndExec38) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + RegExpParser parser = RegExpParser(chunk_); + CString source("^(([a-z]+)*[a-z]\\.)+[a-z]{2,}$"); + parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 0); +@@ -1454,7 +1454,7 @@ TEST_F(RegExpTest, ParseAndExec38) + bool ret = + executor.Execute(reinterpret_cast(input.c_str()), 0, input.length(), parser.GetOriginBuffer()); + ASSERT_TRUE(ret); +- MatchResult result = executor.GetResult(thread, ret); ++ MatchResult result = executor.GetResult(thread_, ret); + ASSERT_EQ(result.captures_.size(), 3); + JSHandle str1 = factory->NewFromCanBeCompressString("www.netscape.com"); + JSHandle str2 = factory->NewFromCanBeCompressString("netscape."); +@@ -1466,7 +1466,7 @@ TEST_F(RegExpTest, ParseAndExec38) + + TEST_F(RegExpTest, ParseAndExec39) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + RegExpParser parser = RegExpParser(chunk_); + CString source("(a*)b\\1+"); + parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 0); +@@ -1478,7 +1478,7 @@ TEST_F(RegExpTest, ParseAndExec39) + bool ret = + executor.Execute(reinterpret_cast(input.c_str()), 0, input.length(), parser.GetOriginBuffer()); + ASSERT_TRUE(ret); +- MatchResult result = executor.GetResult(thread, ret); ++ MatchResult result = executor.GetResult(thread_, ret); + ASSERT_EQ(result.captures_.size(), 2); + JSHandle str1 = factory->NewFromCanBeCompressString("b"); + JSHandle str2 = factory->NewFromCanBeCompressString(""); +@@ -1488,7 +1488,7 @@ TEST_F(RegExpTest, ParseAndExec39) + + TEST_F(RegExpTest, ParseAndExec40) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + RegExpParser parser = RegExpParser(chunk_); + CString source("a*?"); + parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 0); +@@ -1500,7 +1500,7 @@ TEST_F(RegExpTest, ParseAndExec40) + bool ret = + executor.Execute(reinterpret_cast(input.c_str()), 0, input.length(), parser.GetOriginBuffer()); + ASSERT_TRUE(ret); +- MatchResult result = executor.GetResult(thread, ret); ++ MatchResult result = executor.GetResult(thread_, ret); + ASSERT_EQ(result.captures_.size(), 1); + JSHandle str = factory->NewFromCanBeCompressString(""); + ASSERT_TRUE(result.captures_[0].second->Compare(*str) == 0); +@@ -1508,7 +1508,7 @@ TEST_F(RegExpTest, ParseAndExec40) + + TEST_F(RegExpTest, ParseAndExec41) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + RegExpParser parser = RegExpParser(chunk_); + CString source("(.*?)a(?!(a+)b\\2c)\\2(.*)"); + parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 0); +@@ -1520,7 +1520,7 @@ TEST_F(RegExpTest, ParseAndExec41) + bool ret = + executor.Execute(reinterpret_cast(input.c_str()), 0, input.length(), parser.GetOriginBuffer()); + ASSERT_TRUE(ret); +- MatchResult result = executor.GetResult(thread, ret); ++ MatchResult result = executor.GetResult(thread_, ret); + ASSERT_EQ(result.captures_.size(), 4); + JSHandle str1 = factory->NewFromCanBeCompressString("baaabaac"); + JSHandle str2 = factory->NewFromCanBeCompressString("ba"); +@@ -1533,7 +1533,7 @@ TEST_F(RegExpTest, ParseAndExec41) + + TEST_F(RegExpTest, ParseAndExec42) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + RegExpParser parser = RegExpParser(chunk_); + CString source("[a-c\\d]+"); + parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 0); +@@ -1545,7 +1545,7 @@ TEST_F(RegExpTest, ParseAndExec42) + bool ret = + executor.Execute(reinterpret_cast(input.c_str()), 0, input.length(), parser.GetOriginBuffer()); + ASSERT_TRUE(ret); +- MatchResult result = executor.GetResult(thread, ret); ++ MatchResult result = executor.GetResult(thread_, ret); + ASSERT_EQ(result.captures_.size(), 1); + JSHandle str = factory->NewFromCanBeCompressString("abc324234"); + ASSERT_TRUE(result.captures_[0].second->Compare(*str) == 0); +@@ -1553,7 +1553,7 @@ TEST_F(RegExpTest, ParseAndExec42) + + TEST_F(RegExpTest, ParseAndExec43) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + RegExpParser parser = RegExpParser(chunk_); + CString source("[\\d][\n][^\\d]"); + parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 0); +@@ -1565,7 +1565,7 @@ TEST_F(RegExpTest, ParseAndExec43) + bool ret = + executor.Execute(reinterpret_cast(input.c_str()), 0, input.length(), parser.GetOriginBuffer()); + ASSERT_TRUE(ret); +- MatchResult result = executor.GetResult(thread, ret); ++ MatchResult result = executor.GetResult(thread_, ret); + ASSERT_EQ(result.captures_.size(), 1); + JSHandle str = factory->NewFromCanBeCompressString("1\nl"); + ASSERT_TRUE(result.captures_[0].second->Compare(*str) == 0); +@@ -1573,7 +1573,7 @@ TEST_F(RegExpTest, ParseAndExec43) + + TEST_F(RegExpTest, ParseAndExec44) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + RegExpParser parser = RegExpParser(chunk_); + CString source(".[\b]."); + parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 0); +@@ -1585,7 +1585,7 @@ TEST_F(RegExpTest, ParseAndExec44) + bool ret = + executor.Execute(reinterpret_cast(input.c_str()), 0, input.length(), parser.GetOriginBuffer()); + ASSERT_TRUE(ret); +- MatchResult result = executor.GetResult(thread, ret); ++ MatchResult result = executor.GetResult(thread_, ret); + ASSERT_EQ(result.captures_.size(), 1); + JSHandle str = factory->NewFromCanBeCompressString("c\bd"); + ASSERT_TRUE(result.captures_[0].second->Compare(*str) == 0); +@@ -1593,7 +1593,7 @@ TEST_F(RegExpTest, ParseAndExec44) + + TEST_F(RegExpTest, ParseAndExec45) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + RegExpParser parser = RegExpParser(chunk_); + CString source("[^\b]+"); + parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 0); +@@ -1605,7 +1605,7 @@ TEST_F(RegExpTest, ParseAndExec45) + bool ret = + executor.Execute(reinterpret_cast(input.c_str()), 0, input.length(), parser.GetOriginBuffer()); + ASSERT_TRUE(ret); +- MatchResult result = executor.GetResult(thread, ret); ++ MatchResult result = executor.GetResult(thread_, ret); + ASSERT_EQ(result.captures_.size(), 1); + JSHandle str = factory->NewFromCanBeCompressString("easy"); + ASSERT_TRUE(result.captures_[0].second->Compare(*str) == 0); +@@ -1613,7 +1613,7 @@ TEST_F(RegExpTest, ParseAndExec45) + + TEST_F(RegExpTest, ParseAndExec46) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + RegExpParser parser = RegExpParser(chunk_); + CString source("([\\S]+([ \t]+[\\S]+)*)[ \t]*=[ \t]*[\\S]+"); + parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 0); +@@ -1625,7 +1625,7 @@ TEST_F(RegExpTest, ParseAndExec46) + bool ret = + executor.Execute(reinterpret_cast(input.c_str()), 0, input.length(), parser.GetOriginBuffer()); + ASSERT_TRUE(ret); +- MatchResult result = executor.GetResult(thread, ret); ++ MatchResult result = executor.GetResult(thread_, ret); + ASSERT_EQ(result.captures_.size(), 3); + JSHandle str1 = factory->NewFromCanBeCompressString("Course_Creator = Test"); + JSHandle str2 = factory->NewFromCanBeCompressString("Course_Creator"); +@@ -1637,7 +1637,7 @@ TEST_F(RegExpTest, ParseAndExec46) + + TEST_F(RegExpTest, ParseAndExec47) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + RegExpParser parser = RegExpParser(chunk_); + CString source("[^o]t\\b"); + parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 2); +@@ -1649,7 +1649,7 @@ TEST_F(RegExpTest, ParseAndExec47) + bool ret = + executor.Execute(reinterpret_cast(input.c_str()), 0, input.length(), parser.GetOriginBuffer()); + ASSERT_TRUE(ret); +- MatchResult result = executor.GetResult(thread, ret); ++ MatchResult result = executor.GetResult(thread_, ret); + ASSERT_EQ(result.captures_.size(), 1); + JSHandle str = factory->NewFromCanBeCompressString("et"); + ASSERT_TRUE(result.captures_[0].second->Compare(*str) == 0); +@@ -1657,7 +1657,7 @@ TEST_F(RegExpTest, ParseAndExec47) + + TEST_F(RegExpTest, ParseAndExec49) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + RegExpParser parser = RegExpParser(chunk_); + CString source("(a(b)\\4(5)(5))"); + parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 2); +@@ -1669,7 +1669,7 @@ TEST_F(RegExpTest, ParseAndExec49) + bool ret = + executor.Execute(reinterpret_cast(input.c_str()), 0, input.length(), parser.GetOriginBuffer()); + ASSERT_TRUE(ret); +- MatchResult result = executor.GetResult(thread, ret); ++ MatchResult result = executor.GetResult(thread_, ret); + ASSERT_EQ(result.captures_.size(), 5); + JSHandle str1 = factory->NewFromCanBeCompressString("ab55"); + JSHandle str2 = factory->NewFromCanBeCompressString("ab55"); +@@ -1685,7 +1685,7 @@ TEST_F(RegExpTest, ParseAndExec49) + + TEST_F(RegExpTest, ParseAndExec50) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + RegExpParser parser = RegExpParser(chunk_); + CString source("(?\\d{4})-(?\\d{2}-(?\\d\\d))"); + parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 0); +@@ -1697,7 +1697,7 @@ TEST_F(RegExpTest, ParseAndExec50) + bool ret = + executor.Execute(reinterpret_cast(input.c_str()), 0, input.length(), parser.GetOriginBuffer()); + ASSERT_TRUE(ret); +- MatchResult result = executor.GetResult(thread, ret); ++ MatchResult result = executor.GetResult(thread_, ret); + ASSERT_EQ(result.captures_.size(), 4); + JSHandle str1 = factory->NewFromCanBeCompressString("2020-12-31"); + JSHandle str2 = factory->NewFromCanBeCompressString("2020"); +@@ -1722,13 +1722,13 @@ TEST_F(RegExpTest, ParseAndExec51) + bool ret = executor.Execute(reinterpret_cast(input.c_str()), 0, input.length() + 1, + parser.GetOriginBuffer(), true); + ASSERT_TRUE(ret); +- MatchResult result = executor.GetResult(thread, ret); ++ MatchResult result = executor.GetResult(thread_, ret); + ASSERT_EQ(result.captures_.size(), 1); + } + + TEST_F(RegExpTest, ParseAndExec52) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + RegExpParser parser = RegExpParser(chunk_); + CString source("(aa).+\\1"); + parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 0); +@@ -1740,7 +1740,7 @@ TEST_F(RegExpTest, ParseAndExec52) + bool ret = + executor.Execute(reinterpret_cast(input.c_str()), 0, input.length(), parser.GetOriginBuffer()); + ASSERT_TRUE(ret); +- MatchResult result = executor.GetResult(thread, ret); ++ MatchResult result = executor.GetResult(thread_, ret); + ASSERT_EQ(result.captures_.size(), 2); + JSHandle str1 = factory->NewFromCanBeCompressString("aabcdaa"); + JSHandle str2 = factory->NewFromCanBeCompressString("aa"); +@@ -1750,7 +1750,7 @@ TEST_F(RegExpTest, ParseAndExec52) + + TEST_F(RegExpTest, ParseAndExec53) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + RegExpParser parser = RegExpParser(chunk_); + CString source("\\x01"); + parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 0); +@@ -1762,7 +1762,7 @@ TEST_F(RegExpTest, ParseAndExec53) + bool ret = executor.Execute(reinterpret_cast(input.c_str()), 0, input.length(), + parser.GetOriginBuffer(), true); + ASSERT_TRUE(ret); +- MatchResult result = executor.GetResult(thread, ret); ++ MatchResult result = executor.GetResult(thread_, ret); + ASSERT_EQ(result.captures_.size(), 1); + JSHandle str = factory->NewFromCanBeCompressString("\u0001"); + ASSERT_TRUE(result.captures_[0].second->Compare(*str) == 0); +@@ -1785,7 +1785,7 @@ TEST_F(RegExpTest, ParseAndExec54) + + TEST_F(RegExpTest, ParseAndExec55) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + RegExpParser parser = RegExpParser(chunk_); + CString source("e\\b"); + parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 0); +@@ -1797,7 +1797,7 @@ TEST_F(RegExpTest, ParseAndExec55) + bool ret = executor.Execute(reinterpret_cast(input.c_str()), 0, input.length(), + parser.GetOriginBuffer(), false); + ASSERT_TRUE(ret); +- MatchResult result = executor.GetResult(thread, ret); ++ MatchResult result = executor.GetResult(thread_, ret); + ASSERT_EQ(result.captures_.size(), 1); + JSHandle str = factory->NewFromCanBeCompressString("e"); + ASSERT_TRUE(result.captures_[0].second->Compare(*str) == 0); +@@ -1805,7 +1805,7 @@ TEST_F(RegExpTest, ParseAndExec55) + + TEST_F(RegExpTest, ParseAndExec56) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + RegExpParser parser = RegExpParser(chunk_); + CString source("a啊"); + parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 0); +@@ -1817,7 +1817,7 @@ TEST_F(RegExpTest, ParseAndExec56) + bool ret = executor.Execute(reinterpret_cast(input.c_str()), 0, input.length(), + parser.GetOriginBuffer(), true); + ASSERT_TRUE(ret); +- MatchResult result = executor.GetResult(thread, ret); ++ MatchResult result = executor.GetResult(thread_, ret); + ASSERT_EQ(result.captures_.size(), 1); + JSHandle str = factory->NewFromString("a啊"); + ASSERT_TRUE(result.captures_[0].second->Compare(*str) == 0); +@@ -1839,7 +1839,7 @@ TEST_F(RegExpTest, ParseAndExec57) + + TEST_F(RegExpTest, ParseAndExec58) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + RegExpParser parser = RegExpParser(chunk_); + CString source("\\udf06"); + parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 0); +@@ -1850,7 +1850,7 @@ TEST_F(RegExpTest, ParseAndExec58) + char16_t data[] = {0xd834, 0xdf06}; + bool ret = executor.Execute(reinterpret_cast(data), 0, 2, parser.GetOriginBuffer(), true); + ASSERT_TRUE(ret); +- MatchResult result = executor.GetResult(thread, ret); ++ MatchResult result = executor.GetResult(thread_, ret); + ASSERT_EQ(result.captures_.size(), 1); + char16_t data1[] = {0xdf06}; + JSHandle str = factory->NewFromUtf16UnCheck(reinterpret_cast(data1), 1, true); +@@ -1859,7 +1859,7 @@ TEST_F(RegExpTest, ParseAndExec58) + + TEST_F(RegExpTest, ParseAndExec59) + { +- ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); ++ ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + RegExpParser parser = RegExpParser(chunk_); + CString source("\\v"); + parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 0); +@@ -1873,7 +1873,7 @@ TEST_F(RegExpTest, ParseAndExec59) + executor.Execute(reinterpret_cast(input.c_str()), 0, input.size(), parser.GetOriginBuffer()); + ASSERT_TRUE(ret); + +- MatchResult result = executor.GetResult(thread, ret); ++ MatchResult result = executor.GetResult(thread_, ret); + ASSERT_EQ(result.captures_.size(), 1); + JSHandle str = factory->NewFromCanBeCompressString("\u000B"); + ASSERT_TRUE(result.captures_[0].second->Compare(*str) == 0); +diff --git a/tests/runtime/snapshot/snapshot_test.cpp b/tests/runtime/snapshot/snapshot_test.cpp +index c531d65..39d4336 100644 +--- a/tests/runtime/snapshot/snapshot_test.cpp ++++ b/tests/runtime/snapshot/snapshot_test.cpp +@@ -33,17 +33,17 @@ class SnapShotTest : public testing::Test { + public: + void SetUp() override + { +- TestHelper::CreateEcmaVMWithScope(instance, thread, scope); ++ TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); + } + + void TearDown() override + { +- TestHelper::DestroyEcmaVMWithScope(instance, scope); ++ TestHelper::DestroyEcmaVMWithScope(instance_, scope_); + } + +- PandaVM *instance {nullptr}; +- EcmaHandleScope *scope {nullptr}; +- JSThread *thread; ++ PandaVM *instance_ {nullptr}; ++ EcmaHandleScope *scope_ {nullptr}; ++ JSThread *thread_; + }; + + TEST_F(SnapShotTest, Serialize) {} +diff --git a/tests/runtime/tooling/api_tests/js/js_breakpoint_test.h b/tests/runtime/tooling/api_tests/js/js_breakpoint_test.h +index 03e6a51..e7b99f4 100644 +--- a/tests/runtime/tooling/api_tests/js/js_breakpoint_test.h ++++ b/tests/runtime/tooling/api_tests/js/js_breakpoint_test.h +@@ -23,30 +23,30 @@ class JsBreakpointTest : public ApiTest { + public: + JsBreakpointTest() + { +- vm_start = [this] { ++ vm_start_ = [this] { + location_ = TestUtil::GetLocation("Sample.js", 22, panda_file_.c_str()); + ASSERT_TRUE(location_.GetMethodId().IsValid()); + return true; + }; + +- breakpoint = [this](PtThread, Method *, const PtLocation &location) { ++ breakpoint_ = [this](PtThread, Method *, const PtLocation &location) { + ASSERT_TRUE(location.GetMethodId().IsValid()); + ASSERT_LOCATION_EQ(location, location_); + ++breakpoint_counter_; + return true; + }; + +- load_module = [this](std::string_view moduleName) { ++ load_module_ = [this](std::string_view moduleName) { + if (moduleName.find(panda_file_.c_str()) == std::string_view::npos) { + return true; + } +- ASSERT_SUCCESS(debug_interface->SetBreakpoint(location_)); +- auto error = debug_interface->SetBreakpoint(location_); ++ ASSERT_SUCCESS(debug_interface_->SetBreakpoint(location_)); ++ auto error = debug_interface_->SetBreakpoint(location_); + ASSERT_FALSE(!error); + return true; + }; + +- vm_death = [this]() { ++ vm_death_ = [this]() { + ASSERT_EQ(breakpoint_counter_, 2U); + return true; + }; +diff --git a/tests/runtime/tooling/api_tests/js/js_enumerate_frames_test.h b/tests/runtime/tooling/api_tests/js/js_enumerate_frames_test.h +index b2167f7..40d32b6 100644 +--- a/tests/runtime/tooling/api_tests/js/js_enumerate_frames_test.h ++++ b/tests/runtime/tooling/api_tests/js/js_enumerate_frames_test.h +@@ -23,23 +23,23 @@ class JsEnumerateFrameTest : public ApiTest { + public: + JsEnumerateFrameTest() + { +- vm_death = [this]() { ++ vm_death_ = [this]() { + ASSERT_EQ(count_frames_, 9U); + return true; + }; + +- method_exit = [this](PtThread thread, Method *method, bool, VRegValue) { ++ method_exit_ = [this](PtThread thread, Method *method, bool, VRegValue) { + if (method->GetFullName() == "_GLOBAL::func_method3_3") { + ASSERT_EQ(count_frames_, 0U); +- debug_interface->EnumerateFrames(thread, callback); ++ debug_interface_->EnumerateFrames(thread, callback_); + ASSERT_EQ(count_frames_, 4U); + } else if (method->GetFullName() == "_GLOBAL::func_method2_2") { + ASSERT_EQ(count_frames_, 4U); +- debug_interface->EnumerateFrames(thread, callback); ++ debug_interface_->EnumerateFrames(thread, callback_); + ASSERT_EQ(count_frames_, 7U); + } else if (method->GetFullName() == "_GLOBAL::func_method1_1") { + ASSERT_EQ(count_frames_, 7U); +- debug_interface->EnumerateFrames(thread, callback); ++ debug_interface_->EnumerateFrames(thread, callback_); + ASSERT_EQ(count_frames_, 9U); + } + return true; +@@ -56,7 +56,7 @@ private: + std::string entry_point_ = "_GLOBAL::func_main_0"; + size_t count_frames_ = 0; + +- std::function callback {[this](const PtFrame &debugFrame) { ++ std::function callback_ {[this](const PtFrame &debugFrame) { + this->count_frames_++; + if (debugFrame.GetArgumentNum() != 1) + return true; +diff --git a/tests/runtime/tooling/api_tests/js/js_exception_events_test.h b/tests/runtime/tooling/api_tests/js/js_exception_events_test.h +index fdce436..198dce5 100644 +--- a/tests/runtime/tooling/api_tests/js/js_exception_events_test.h ++++ b/tests/runtime/tooling/api_tests/js/js_exception_events_test.h +@@ -24,13 +24,13 @@ class JsExceptionEventTest : public ApiTest { + public: + JsExceptionEventTest() + { +- vm_death = [this]() { ++ vm_death_ = [this]() { + ASSERT_EQ(exception_counter_, 1U); + ASSERT_EQ(exception_catch_counter_, 1U); + return true; + }; + +- method_entry = [this](PtThread thread, Method *method) { ++ method_entry_ = [this](PtThread thread, Method *method) { + if (method->GetFullName() == "_GLOBAL::func_main_0") { + ASSERT_TRUE(thread_id_ == PtThread::NONE.GetId()); + thread_id_ = thread.GetId(); +@@ -38,15 +38,15 @@ public: + return true; + }; + +- method_exit = [this](PtThread, Method *method, bool, VRegValue) { ++ method_exit_ = [this](PtThread, Method *method, bool, VRegValue) { + if (method->GetFullName() == "_GLOBAL::func_main_0") { + thread_id_ = PtThread::NONE.GetId(); + } + return true; + }; + +- exception = [this](PtThread thread, Method *, const PtLocation &, ObjectHeader *, Method *, +- const PtLocation &catch_location) { ++ exception_ = [this](PtThread thread, Method *, const PtLocation &, ObjectHeader *, Method *, ++ const PtLocation &catch_location) { + if (thread_id_ != thread.GetId()) { + return true; + } +@@ -56,7 +56,7 @@ public: + return true; + }; + +- exception_catch = [this](PtThread thread, Method *, const PtLocation &location, ObjectHeader *) { ++ exception_catch_ = [this](PtThread thread, Method *, const PtLocation &location, ObjectHeader *) { + if (thread_id_ != thread.GetId()) { + return true; + } +diff --git a/tests/runtime/tooling/api_tests/js/js_frame_pop_test.h b/tests/runtime/tooling/api_tests/js/js_frame_pop_test.h +index 9b1502f..79b3a23 100644 +--- a/tests/runtime/tooling/api_tests/js/js_frame_pop_test.h ++++ b/tests/runtime/tooling/api_tests/js/js_frame_pop_test.h +@@ -23,19 +23,19 @@ class JsFramePopTest : public ApiTest { + public: + JsFramePopTest() + { +- vm_start = [this] { ++ vm_start_ = [this] { + location_ = TestUtil::GetLocation("FramePop.js", 33, panda_file_.c_str()); + ASSERT_TRUE(location_.GetMethodId().IsValid()); + return true; + }; + +- vm_death = [this] { ++ vm_death_ = [this] { + ASSERT_EQ(breakpoint_counter_, 2U); + ASSERT_EQ(frame_pop_counter_, 2U); + return true; + }; + +- scenario = [this]() { ++ scenario_ = [this]() { + PtThread suspended = TestUtil::WaitForBreakpoint(location_); + ASSERT_NE(suspended.GetId(), PtThread::NONE.GetId()); + +@@ -51,27 +51,27 @@ public: + return true; + }; + +- breakpoint = [this](PtThread thread, Method *, const PtLocation &location) { ++ breakpoint_ = [this](PtThread thread, Method *, const PtLocation &location) { + ASSERT_TRUE(location.GetMethodId().IsValid()); + ASSERT_LOCATION_EQ(location, location_); + ++breakpoint_counter_; + TestUtil::SuspendUntilContinue(DebugEvent::BREAKPOINT, thread, location); + if (breakpoint_counter_ == 1) { +- ASSERT_SUCCESS(debug_interface->NotifyFramePop(thread, 0)); +- ASSERT_SUCCESS(debug_interface->NotifyFramePop(thread, 2)); ++ ASSERT_SUCCESS(debug_interface_->NotifyFramePop(thread, 0)); ++ ASSERT_SUCCESS(debug_interface_->NotifyFramePop(thread, 2)); + } + return true; + }; + +- load_module = [this](std::string_view moduleName) { ++ load_module_ = [this](std::string_view moduleName) { + if (moduleName.find(panda_file_.c_str()) == std::string_view::npos) { + return true; + } +- ASSERT_SUCCESS(debug_interface->SetBreakpoint(location_)); ++ ASSERT_SUCCESS(debug_interface_->SetBreakpoint(location_)); + return true; + }; + +- frame_pop = [this](PtThread thread_id, Method *method, bool was_popped_by_exception) { ++ frame_pop_ = [this](PtThread thread_id, Method *method, bool was_popped_by_exception) { + auto method_name = method->GetFullName(); + if (method_name == "_GLOBAL::func_frame0_4") { + ASSERT_EQ(frame_pop_counter_, 0U); +diff --git a/tests/runtime/tooling/api_tests/js/js_get_current_frame_test.h b/tests/runtime/tooling/api_tests/js/js_get_current_frame_test.h +index 129c996..f71ad8b 100644 +--- a/tests/runtime/tooling/api_tests/js/js_get_current_frame_test.h ++++ b/tests/runtime/tooling/api_tests/js/js_get_current_frame_test.h +@@ -23,26 +23,26 @@ class JsCurrentFrameTest : public ApiTest { + public: + JsCurrentFrameTest() + { +- vm_death = [this]() { ++ vm_death_ = [this]() { + ASSERT_EQ(entry_, 111U); + return true; + }; + +- method_exit = [this](PtThread thread, Method *method, bool, VRegValue) { ++ method_exit_ = [this](PtThread thread, Method *method, bool, VRegValue) { + if (method->GetFullName() == "_GLOBAL::func_method3_3") { + ASSERT_EQ(entry_, 0U); + entry_++; +- auto frme = debug_interface->GetCurrentFrame(thread); ++ auto frme = debug_interface_->GetCurrentFrame(thread); + ASSERT_EQ((*frme)->GetMethod(), method); + } else if (method->GetFullName() == "_GLOBAL::func_method2_2") { + ASSERT_EQ(entry_, 1U); + entry_ += 10; +- auto frme = debug_interface->GetCurrentFrame(thread); ++ auto frme = debug_interface_->GetCurrentFrame(thread); + ASSERT_EQ((*frme)->GetMethod(), method); + } else if (method->GetFullName() == "_GLOBAL::func_method1_1") { + ASSERT_EQ(entry_, 11U); + entry_ += 100U; +- auto frme = debug_interface->GetCurrentFrame(thread); ++ auto frme = debug_interface_->GetCurrentFrame(thread); + ASSERT_EQ((*frme)->GetMethod(), method); + } + return true; +diff --git a/tests/runtime/tooling/api_tests/js/js_get_variable_test.h b/tests/runtime/tooling/api_tests/js/js_get_variable_test.h +index 96f2858..fc08cd3 100644 +--- a/tests/runtime/tooling/api_tests/js/js_get_variable_test.h ++++ b/tests/runtime/tooling/api_tests/js/js_get_variable_test.h +@@ -30,23 +30,23 @@ class JsGetVariableTest : public ApiTest { + public: + JsGetVariableTest() + { +- vm_death = [this]() { ++ vm_death_ = [this]() { + const int expectedCount = 1; + ASSERT_EQ(count_checker_, expectedCount); + return true; + }; + +- load_module = [this](std::string_view moduleName) { ++ load_module_ = [this](std::string_view moduleName) { + if (moduleName.find(panda_file_.c_str()) == std::string_view::npos) { + return true; + } + auto location = TestUtil::GetLocation("GetVariable.js", 19, panda_file_.c_str()); // getVariable + ASSERT_TRUE(location.GetMethodId().IsValid()); +- ASSERT_SUCCESS(debug_interface->SetBreakpoint(location)); ++ ASSERT_SUCCESS(debug_interface_->SetBreakpoint(location)); + return true; + }; + +- breakpoint = [this](PtThread thread, Method *method, const PtLocation &location) { ++ breakpoint_ = [this](PtThread thread, Method *method, const PtLocation &location) { + ASSERT_TRUE(CheckSetValues(thread, method, location.GetBytecodeOffset())); + return true; + }; +@@ -97,7 +97,7 @@ public: + int32_t argNumber = TestUtil::GetValueRegister(method, "bl1", offset); + for (auto checker : checkersList) { + VRegValue vregValue; +- ASSERT_SUCCESS(debug_interface->GetVariable(thread, frameDepth, argNumber++, &vregValue)); ++ ASSERT_SUCCESS(debug_interface_->GetVariable(thread, frameDepth, argNumber++, &vregValue)); + ASSERT_TRUE(checker(ecmascript::PtEcmaScriptExtension::VRegValueToTaggedValue(vregValue))); + } + +diff --git a/tests/runtime/tooling/api_tests/js/js_method_event_test.h b/tests/runtime/tooling/api_tests/js/js_method_event_test.h +index 7fa342d..b68febf 100644 +--- a/tests/runtime/tooling/api_tests/js/js_method_event_test.h ++++ b/tests/runtime/tooling/api_tests/js/js_method_event_test.h +@@ -23,19 +23,19 @@ class JsMethodEventTest : public ApiTest { + public: + JsMethodEventTest() + { +- vm_death = [this]() { ++ vm_death_ = [this]() { + ASSERT_EQ(method_entry_exit_count_, 0); + ASSERT_NE(method_entry_count_, 0); + return true; + }; + +- method_entry = [this](PtThread, Method *) { ++ method_entry_ = [this](PtThread, Method *) { + method_entry_exit_count_++; + method_entry_count_++; + return true; + }; + +- method_exit = [this](PtThread, Method *, bool, VRegValue) { ++ method_exit_ = [this](PtThread, Method *, bool, VRegValue) { + method_entry_exit_count_--; + return true; + }; +diff --git a/tests/runtime/tooling/api_tests/js/js_restart_frame_test.h b/tests/runtime/tooling/api_tests/js/js_restart_frame_test.h +index 27858b0..f2ed04c 100644 +--- a/tests/runtime/tooling/api_tests/js/js_restart_frame_test.h ++++ b/tests/runtime/tooling/api_tests/js/js_restart_frame_test.h +@@ -26,40 +26,40 @@ class JsRestartFrameTest : public ApiTest { + public: + JsRestartFrameTest() + { +- vm_start = [this] { ++ vm_start_ = [this] { + location_ = TestUtil::GetLocation("RestartFrame.js", 35, panda_file_.c_str()); + ASSERT_TRUE(location_.GetMethodId().IsValid()); + return true; + }; + +- breakpoint = [this](PtThread thread, Method *, const PtLocation &location) { ++ breakpoint_ = [this](PtThread thread, Method *, const PtLocation &location) { + ASSERT_TRUE(location.GetMethodId().IsValid()); + ASSERT_LOCATION_EQ(location, location_); + ++breakpoint_counter_; + TestUtil::SuspendUntilContinue(DebugEvent::BREAKPOINT, thread, location); + if (breakpoint_counter_ == 1) { +- ASSERT_SUCCESS(debug_interface->RestartFrame(thread, 2)); ++ ASSERT_SUCCESS(debug_interface_->RestartFrame(thread, 2)); + } + if (breakpoint_counter_ == 2) { +- ASSERT_SUCCESS(debug_interface->RestartFrame(thread, 0)); ++ ASSERT_SUCCESS(debug_interface_->RestartFrame(thread, 0)); + } + return true; + }; + +- load_module = [this](std::string_view moduleName) { ++ load_module_ = [this](std::string_view moduleName) { + if (moduleName.find(panda_file_.c_str()) == std::string_view::npos) { + return true; + } +- ASSERT_SUCCESS(debug_interface->SetBreakpoint(location_)); ++ ASSERT_SUCCESS(debug_interface_->SetBreakpoint(location_)); + return true; + }; + +- method_entry = [this](PtThread, Method *) { ++ method_entry_ = [this](PtThread, Method *) { + ++entry_exit_counter_; + return true; + }; + +- method_exit = [this](PtThread, Method *method, bool, VRegValue val) { ++ method_exit_ = [this](PtThread, Method *method, bool, VRegValue val) { + auto moduleName = method->GetFullName(); + if (moduleName == "_GLOBAL::func_2") { + // Force exit always zero +@@ -73,7 +73,7 @@ public: + return true; + }; + +- scenario = [this]() { ++ scenario_ = [this]() { + ASSERT_BREAKPOINT_SUCCESS(location_); + TestUtil::Continue(); + +@@ -87,7 +87,7 @@ public: + return true; + }; + +- vm_death = [this] { ++ vm_death_ = [this] { + // result_ indicate count of calls + // frame0 +1 + // frame1 +10 +diff --git a/tests/runtime/tooling/api_tests/js/js_set_notification_test.h b/tests/runtime/tooling/api_tests/js/js_set_notification_test.h +index c5c325d..d3bd354 100644 +--- a/tests/runtime/tooling/api_tests/js/js_set_notification_test.h ++++ b/tests/runtime/tooling/api_tests/js/js_set_notification_test.h +@@ -24,21 +24,21 @@ class JsSetNotificationTest : public ApiTest { + public: + JsSetNotificationTest() + { +- vm_death = [this]() { ++ vm_death_ = [this]() { + ASSERT_EQ(nn_, 5); + ASSERT_EQ(entry_, 3); + ASSERT_EQ(exit_, 5); + return true; + }; + +- method_entry = [this](PtThread /* thread */, Method *method) { ++ method_entry_ = [this](PtThread /* thread */, Method *method) { + if (method->GetFullName() == "_GLOBAL::func__2") { + ++entry_; + } + return true; + }; + +- method_exit = [this](PtThread thread, Method *method, bool, VRegValue) { ++ method_exit_ = [this](PtThread thread, Method *method, bool, VRegValue) { + if (method->GetFullName() == "_GLOBAL::func__2") { + ++exit_; + ++nn_; +@@ -61,25 +61,25 @@ public: + ASSERT_EQ(exit_, 1); + + // Disable the entry hook globaly +- debug_interface->SetNotification(PtThread::NONE, false, PtHookType::PT_HOOK_TYPE_METHOD_ENTRY); ++ debug_interface_->SetNotification(PtThread::NONE, false, PtHookType::PT_HOOK_TYPE_METHOD_ENTRY); + } else if (nn_ == 2) { + ASSERT_EQ(entry_, 1); + ASSERT_EQ(exit_, 2); + + // Enable the entry hook locally +- debug_interface->SetNotification(thread, true, PtHookType::PT_HOOK_TYPE_METHOD_ENTRY); ++ debug_interface_->SetNotification(thread, true, PtHookType::PT_HOOK_TYPE_METHOD_ENTRY); + } else if (nn_ == 3) { + ASSERT_EQ(entry_, 2); + ASSERT_EQ(exit_, 3); + + // Disable the entry hook locally +- debug_interface->SetNotification(thread, false, PtHookType::PT_HOOK_TYPE_METHOD_ENTRY); ++ debug_interface_->SetNotification(thread, false, PtHookType::PT_HOOK_TYPE_METHOD_ENTRY); + } else if (nn_ == 4) { + ASSERT_EQ(entry_, 2); + ASSERT_EQ(exit_, 4); + + // Enable the entry hook globaly +- debug_interface->SetNotification(PtThread::NONE, true, PtHookType::PT_HOOK_TYPE_METHOD_ENTRY); ++ debug_interface_->SetNotification(PtThread::NONE, true, PtHookType::PT_HOOK_TYPE_METHOD_ENTRY); + } else if (nn_ == 5) { + ASSERT_EQ(entry_, 3); + ASSERT_EQ(exit_, 5); +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 9e92062..2d0c110 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 +@@ -30,13 +30,13 @@ class JsSetVariableTest : public ApiTest { + public: + JsSetVariableTest() + { +- vm_death = [this]() { ++ vm_death_ = [this]() { + ASSERT_TRUE(checked_); + ASSERT_EQ(breakpoint_count_, 4); + return true; + }; + +- load_module = [this](std::string_view moduleName) { ++ load_module_ = [this](std::string_view moduleName) { + if (moduleName.find(panda_file_.c_str()) == std::string_view::npos) { + return true; + } +@@ -47,34 +47,34 @@ public: + return true; + }; + +- breakpoint = [this](PtThread thread, Method *method, PtLocation location) { ++ breakpoint_ = [this](PtThread thread, Method *method, PtLocation location) { + breakpoint_count_ += 1; + auto methodName = method->GetFullName(); + int frameDepth = 0; + uint32_t currOffset = location.GetBytecodeOffset(); + if (methodName == "_GLOBAL::func_setBoolean_1") { + VRegValue value = ecmascript::PtEcmaScriptExtension::TaggedValueToVRegValue(JSTaggedValue(true)); +- ASSERT_SUCCESS(debug_interface->SetVariable( ++ ASSERT_SUCCESS(debug_interface_->SetVariable( + thread, frameDepth, TestUtil::GetValueRegister(method, "value", currOffset), value)); + } else if (methodName == "_GLOBAL::func_setInt_2") { + VRegValue value = + ecmascript::PtEcmaScriptExtension::TaggedValueToVRegValue(JSTaggedValue(123456789)); // 123456789 +- ASSERT_SUCCESS(debug_interface->SetVariable( ++ ASSERT_SUCCESS(debug_interface_->SetVariable( + thread, frameDepth, TestUtil::GetValueRegister(method, "value", currOffset), value)); + } else if (methodName == "_GLOBAL::func_setDouble_3") { + VRegValue value = + ecmascript::PtEcmaScriptExtension::TaggedValueToVRegValue(JSTaggedValue(12345.6789)); // 12345.6789 +- ASSERT_SUCCESS(debug_interface->SetVariable( ++ ASSERT_SUCCESS(debug_interface_->SetVariable( + thread, frameDepth, TestUtil::GetValueRegister(method, "value", currOffset), value)); + } else if (methodName == "_GLOBAL::func_setString_4") { + VRegValue value = ecmascript::JSTestApi::StringToVRegValue("x2348x"); +- ASSERT_SUCCESS(debug_interface->SetVariable( ++ ASSERT_SUCCESS(debug_interface_->SetVariable( + thread, frameDepth, TestUtil::GetValueRegister(method, "value", currOffset), value)); + } + return true; + }; + +- method_entry = [this](PtThread thread, Method *method) { ++ method_entry_ = [this](PtThread thread, Method *method) { + auto methodName = method->GetFullName(); + if (methodName == "_GLOBAL::func_checkData_5") { + checked_ = CheckData(thread, method); +@@ -146,7 +146,7 @@ private: + { + auto location = TestUtil::GetLocation("SetVariable.js", line, panda_file_.c_str()); + ASSERT_TRUE(location.GetMethodId().IsValid()); +- ASSERT_SUCCESS(debug_interface->SetBreakpoint(location)); ++ ASSERT_SUCCESS(debug_interface_->SetBreakpoint(location)); + } + + bool checked_ = false; +diff --git a/tests/runtime/tooling/api_tests/js/js_single_step_test.h b/tests/runtime/tooling/api_tests/js/js_single_step_test.h +index 93b5746..12eadf9 100644 +--- a/tests/runtime/tooling/api_tests/js/js_single_step_test.h ++++ b/tests/runtime/tooling/api_tests/js/js_single_step_test.h +@@ -23,27 +23,27 @@ class JsSingleStepTest : public ApiTest { + public: + JsSingleStepTest() + { +- vm_start = [this] { ++ vm_start_ = [this] { + location_start_ = TestUtil::GetLocation("Sample.js", 19, panda_file_.c_str()); + location_end_ = TestUtil::GetLocation("Sample.js", 22, panda_file_.c_str()); + return true; + }; + +- vm_death = [this]() { ++ vm_death_ = [this]() { + ASSERT_NE(step_count_, 0); + ASSERT_EQ(breakpoint_count_, 2); + return true; + }; + +- load_module = [this](std::string_view moduleName) { ++ load_module_ = [this](std::string_view moduleName) { + if (moduleName.find(panda_file_.c_str()) == std::string_view::npos) { + return true; + } +- ASSERT_SUCCESS(debug_interface->SetBreakpoint(location_end_)); ++ ASSERT_SUCCESS(debug_interface_->SetBreakpoint(location_end_)); + return true; + }; + +- breakpoint = [this](PtThread, Method *, const PtLocation &location) { ++ breakpoint_ = [this](PtThread, Method *, const PtLocation &location) { + ASSERT_TRUE(location.GetMethodId().IsValid()); + ASSERT_LOCATION_EQ(location, location_end_); + // Check's what step signalled before breakpoint +@@ -55,7 +55,7 @@ public: + return true; + }; + +- single_step = [this](PtThread, Method *, const PtLocation &location) { ++ single_step_ = [this](PtThread, Method *, const PtLocation &location) { + ASSERT_TRUE(location.GetMethodId().IsValid()); + if (!collect_steps_) { + if (location_start_ == location) { +diff --git a/tests/runtime/tooling/api_tests/js/js_vm_event_test.h b/tests/runtime/tooling/api_tests/js/js_vm_event_test.h +index 5777a8c..b3733f1 100644 +--- a/tests/runtime/tooling/api_tests/js/js_vm_event_test.h ++++ b/tests/runtime/tooling/api_tests/js/js_vm_event_test.h +@@ -23,21 +23,21 @@ class JsVmEventTest : public ApiTest { + public: + JsVmEventTest() + { +- vm_start = [this]() { +- start_counter++; ++ vm_start_ = [this]() { ++ start_counter_++; + return true; + }; + +- vm_init = [this](PtThread thread) { ++ vm_init_ = [this](PtThread thread) { + init_thread_ = thread.GetId(); + init_counter_++; + return true; + }; + +- vm_death = [this]() { ++ vm_death_ = [this]() { + death_counter_++; + ASSERT_NE(init_thread_, PtThread::NONE.GetId()); +- ASSERT_EQ(start_counter, 1U); ++ ASSERT_EQ(start_counter_, 1U); + ASSERT_EQ(init_counter_, 1U); + return true; + }; +@@ -51,7 +51,7 @@ public: + private: + std::string panda_file_ = "js/Sample.abc"; + std::string entry_point_ = "_GLOBAL::func_main_0"; +- size_t start_counter = 0; ++ size_t start_counter_ = 0; + size_t init_counter_ = 0; + size_t death_counter_ = 0; + uint32_t init_thread_ = PtThread::NONE.GetId(); diff --git a/runtime/base/json_parser.h b/runtime/base/json_parser.h index 82f650eb1dcdd5f6ed9b714d00238960cbaf8411..74fe473dce989b823a84f1d5dbf577f473ba10c5 100644 --- a/runtime/base/json_parser.h +++ b/runtime/base/json_parser.h @@ -77,7 +77,7 @@ public: JSHandle ParseUtf8(EcmaString *str) { ASSERT(str != nullptr); - isAsciiString_ = true; + is_ascii_string_ = true; uint32_t len = str->GetUtf8Length(); CVector buf(len); str->CopyDataUtf8(buf.data(), len); @@ -164,7 +164,7 @@ private: bool ReadJsonStringRange(bool &isFastString, bool &isAscii) { current_++; - if (isAsciiString_) { + if (is_ascii_string_) { return ReadAsciiStringRange(isFastString); } return ReadStringRange(isFastString, isAscii); @@ -173,7 +173,7 @@ private: bool IsFastParseJsonString(bool &isFastString, bool &isAscii) { current_++; - if (isAsciiString_) { + if (is_ascii_string_) { return IsFastParseString(isFastString, isAscii); } return IsFastParseAsciiString(isFastString); @@ -752,7 +752,7 @@ private: return true; } - bool isAsciiString_ {false}; + bool is_ascii_string_ {false}; Text end_ {nullptr}; Text current_ {nullptr}; Text range_ {nullptr}; diff --git a/runtime/base/json_stringifier.cpp b/runtime/base/json_stringifier.cpp index b860b2f1cc3537970970a526ae90a114f6487197..4bb379d05f50419e6d7ba1b92517fd6f0c49d9ec 100644 --- a/runtime/base/json_stringifier.cpp +++ b/runtime/base/json_stringifier.cpp @@ -141,8 +141,8 @@ JSHandle JsonStringifier::Stringify(const JSHandle const JSHandle &gap) { factory_ = thread_->GetEcmaVM()->GetFactory(); - handleValue_.Update(JSTaggedValue::Undefined()); - handleKey_.Update(JSTaggedValue::Undefined()); + handle_value_.Update(JSTaggedValue::Undefined()); + handle_key_.Update(JSTaggedValue::Undefined()); // Let isArray be IsArray(replacer). bool isArray = replacer->IsArray(thread_); // ReturnIfAbrupt(isArray). @@ -236,8 +236,8 @@ JSHandle JsonStringifier::Stringify(const JSHandle JSTaggedValue serializeValue = GetSerializeValue(JSHandle::Cast(wrapper), key, value, replacer); RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSTaggedValue, thread_); - handleValue_.Update(serializeValue); - JSTaggedValue result = SerializeJSONProperty(handleValue_, replacer); + handle_value_.Update(serializeValue); + JSTaggedValue result = SerializeJSONProperty(handle_value_, replacer); RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSTaggedValue, thread_); if (!result.IsUndefined()) { return JSHandle( @@ -248,16 +248,16 @@ JSHandle JsonStringifier::Stringify(const JSHandle void JsonStringifier::AddDeduplicateProp(const JSHandle &property) { - uint32_t propLen = propList_.size(); + uint32_t propLen = prop_list_.size(); for (uint32_t i = 0; i < propLen; i++) { - if (JSTaggedValue::SameValue(propList_[i], property)) { + if (JSTaggedValue::SameValue(prop_list_[i], property)) { return; } } JSHandle primString = JSTaggedValue::ToString(thread_, property); RETURN_IF_ABRUPT_COMPLETION(thread_); JSHandle addVal(thread_, *primString); - propList_.emplace_back(addVal); + prop_list_.emplace_back(addVal); } bool JsonStringifier::CalculateNumberGap(JSTaggedValue gap) @@ -314,10 +314,10 @@ JSTaggedValue JsonStringifier::GetSerializeValue(const JSHandle & } if (UNLIKELY(replacer->IsCallable())) { - handleValue_.Update(tagValue); + handle_value_.Update(tagValue); // a. Let value be Call(ReplacerFunction, holder, «key, value»). InternalCallParams *arguments = thread_->GetInternalCallParams(); - arguments->MakeArgv(key, handleValue_); + arguments->MakeArgv(key, handle_value_); tagValue = JSFunction::Call(thread_, replacer, object, 2, arguments->GetArgv()); // 2: two args // b. ReturnIfAbrupt(value). RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread_); @@ -469,20 +469,20 @@ bool JsonStringifier::SerializeJSONObject(const JSHandle &value, RETURN_VALUE_IF_ABRUPT_COMPLETION(thread_, false); } } else { - uint32_t propLen = propList_.size(); + uint32_t propLen = prop_list_.size(); for (uint32_t i = 0; i < propLen; i++) { JSTaggedValue tagVal = - FastRuntimeStub::FastGetPropertyByValue(thread_, obj.GetTaggedValue(), propList_[i].GetTaggedValue()); - handleValue_.Update(tagVal); - JSTaggedValue serializeValue = GetSerializeValue(value, propList_[i], handleValue_, replacer); + FastRuntimeStub::FastGetPropertyByValue(thread_, obj.GetTaggedValue(), prop_list_[i].GetTaggedValue()); + handle_value_.Update(tagVal); + JSTaggedValue serializeValue = GetSerializeValue(value, prop_list_[i], handle_value_, replacer); RETURN_VALUE_IF_ABRUPT_COMPLETION(thread_, false); if (UNLIKELY(serializeValue.IsUndefined() || serializeValue.IsSymbol() || (serializeValue.IsECMAObject() && serializeValue.IsCallable()))) { continue; } - handleValue_.Update(serializeValue); - SerializeObjectKey(propList_[i], hasContent); - JSTaggedValue res = SerializeJSONProperty(handleValue_, replacer); + handle_value_.Update(serializeValue); + SerializeObjectKey(prop_list_[i], hasContent); + JSTaggedValue res = SerializeJSONProperty(handle_value_, replacer); RETURN_VALUE_IF_ABRUPT_COMPLETION(thread_, false); if (!res.IsUndefined()) { hasContent = true; @@ -523,17 +523,17 @@ bool JsonStringifier::SerializeJSProxy(const JSHandle &object, co RETURN_VALUE_IF_ABRUPT_COMPLETION(thread_, false); uint32_t length = lenNumber.ToUint32(); for (uint32_t i = 0; i < length; i++) { - handleKey_.Update(JSTaggedValue(i)); - JSHandle valHandle = JSProxy::GetProperty(thread_, proxy, handleKey_).GetValue(); + handle_key_.Update(JSTaggedValue(i)); + JSHandle valHandle = JSProxy::GetProperty(thread_, proxy, handle_key_).GetValue(); RETURN_VALUE_IF_ABRUPT_COMPLETION(thread_, false); if (i > 0) { result_ += ","; } result_ += stepBegin; - JSTaggedValue serializeValue = GetSerializeValue(object, handleKey_, valHandle, replacer); + JSTaggedValue serializeValue = GetSerializeValue(object, handle_key_, valHandle, replacer); RETURN_VALUE_IF_ABRUPT_COMPLETION(thread_, false); - handleValue_.Update(serializeValue); - JSTaggedValue res = SerializeJSONProperty(handleValue_, replacer); + handle_value_.Update(serializeValue); + JSTaggedValue res = SerializeJSONProperty(handle_value_, replacer); RETURN_VALUE_IF_ABRUPT_COMPLETION(thread_, false); if (res.IsUndefined()) { result_ += "null"; @@ -575,17 +575,17 @@ bool JsonStringifier::SerializeJSArray(const JSHandle &value, con if (UNLIKELY(tagVal.IsAccessor())) { tagVal = JSObject::CallGetter(thread_, AccessorData::Cast(tagVal.GetTaggedObject()), value); } - handleValue_.Update(tagVal); - handleKey_.Update(JSTaggedNumber(i).ToString(thread_).GetTaggedValue()); + handle_value_.Update(tagVal); + handle_key_.Update(JSTaggedNumber(i).ToString(thread_).GetTaggedValue()); if (i > 0) { result_ += ","; } result_ += stepBegin; - JSTaggedValue serializeValue = GetSerializeValue(value, handleKey_, handleValue_, replacer); + JSTaggedValue serializeValue = GetSerializeValue(value, handle_key_, handle_value_, replacer); RETURN_VALUE_IF_ABRUPT_COMPLETION(thread_, false); - handleValue_.Update(serializeValue); - JSTaggedValue res = SerializeJSONProperty(handleValue_, replacer); + handle_value_.Update(serializeValue); + JSTaggedValue res = SerializeJSONProperty(handle_value_, replacer); RETURN_VALUE_IF_ABRUPT_COMPLETION(thread_, false); if (res.IsUndefined()) { result_ += "null"; @@ -634,8 +634,8 @@ bool JsonStringifier::SerializeElements(const JSHandle &obj, const JSH uint32_t elementsLen = elementsArr->GetLength(); for (uint32_t i = 0; i < elementsLen; ++i) { if (!elementsArr->Get(i).IsHole()) { - handleKey_.Update(JSTaggedValue(i)); - handleValue_.Update(elementsArr->Get(i)); + handle_key_.Update(JSTaggedValue(i)); + handle_value_.Update(elementsArr->Get(i)); hasContent = JsonStringifier::AppendJsonString(obj, replacer, hasContent); RETURN_VALUE_IF_ABRUPT_COMPLETION(thread_, false); } @@ -657,10 +657,10 @@ bool JsonStringifier::SerializeElements(const JSHandle &obj, const JSH std::sort(sortArr.begin(), sortArr.end(), CompareNumber); for (const auto &entry : sortArr) { JSTaggedValue entryKey = entry.GetTaggedValue(); - handleKey_.Update(entryKey); + handle_key_.Update(entryKey); int index = numberDic->FindEntry(entryKey); JSTaggedValue value = numberDic->GetValue(index); - handleValue_.Update(value); + handle_value_.Update(value); hasContent = JsonStringifier::AppendJsonString(obj, replacer, hasContent); RETURN_VALUE_IF_ABRUPT_COMPLETION(thread_, false); } @@ -679,7 +679,7 @@ bool JsonStringifier::SerializeKeys(const JSHandle &obj, const JSHandl if (!key.IsString()) { continue; } - handleKey_.Update(key); + handle_key_.Update(key); TaggedArray *properties = TaggedArray::Cast(obj->GetProperties().GetHeapObject()); PropertyAttributes attr; uint32_t indexOrEntry = 0; @@ -696,7 +696,7 @@ bool JsonStringifier::SerializeKeys(const JSHandle &obj, const JSHandl } else { value = JSTaggedValue::Undefined(); } - handleValue_.Update(value); + handle_value_.Update(value); hasContent = JsonStringifier::AppendJsonString(obj, replacer, hasContent); RETURN_VALUE_IF_ABRUPT_COMPLETION(thread_, false); } @@ -706,15 +706,16 @@ bool JsonStringifier::SerializeKeys(const JSHandle &obj, const JSHandl bool JsonStringifier::AppendJsonString(const JSHandle &obj, const JSHandle &replacer, bool hasContent) { - JSTaggedValue serializeValue = GetSerializeValue(JSHandle(obj), handleKey_, handleValue_, replacer); + JSTaggedValue serializeValue = + GetSerializeValue(JSHandle(obj), handle_key_, handle_value_, replacer); RETURN_VALUE_IF_ABRUPT_COMPLETION(thread_, false); if (UNLIKELY(serializeValue.IsUndefined() || serializeValue.IsSymbol() || (serializeValue.IsECMAObject() && serializeValue.IsCallable()))) { return hasContent; } - handleValue_.Update(serializeValue); - SerializeObjectKey(handleKey_, hasContent); - JSTaggedValue res = SerializeJSONProperty(handleValue_, replacer); + handle_value_.Update(serializeValue); + SerializeObjectKey(handle_key_, hasContent); + JSTaggedValue res = SerializeJSONProperty(handle_value_, replacer); RETURN_VALUE_IF_ABRUPT_COMPLETION(thread_, false); if (!res.IsUndefined()) { return true; diff --git a/runtime/base/json_stringifier.h b/runtime/base/json_stringifier.h index bdc0b784f4845e5f3456f6483db5f7cb2e87ab49..ce6ce2375e87d1361b72af1d244b85d3affae7c0 100644 --- a/runtime/base/json_stringifier.h +++ b/runtime/base/json_stringifier.h @@ -27,8 +27,8 @@ class JsonStringifier { public: explicit JsonStringifier(JSThread *thread) : thread_(thread), - handleKey_(thread, JSTaggedValue::Undefined()), - handleValue_(thread, JSTaggedValue::Undefined()) + handle_key_(thread, JSTaggedValue::Undefined()), + handle_value_(thread, JSTaggedValue::Undefined()) { } @@ -86,9 +86,9 @@ private: JSThread *thread_ {nullptr}; ObjectFactory *factory_ {nullptr}; CVector> stack_; - CVector> propList_; - JSMutableHandle handleKey_; - JSMutableHandle handleValue_; + CVector> prop_list_; + JSMutableHandle handle_key_; + JSMutableHandle handle_value_; }; } // namespace panda::ecmascript::base #endif // ECMASCRIPT_BASE_JSON_STRINGIFY_INL_H diff --git a/runtime/base/utf_helper.cpp b/runtime/base/utf_helper.cpp index bf5a8f68299791d3c87aa320664ebbabfc987f77..6262b941ca6884375323d068ae76876fa0064412 100644 --- a/runtime/base/utf_helper.cpp +++ b/runtime/base/utf_helper.cpp @@ -167,13 +167,13 @@ size_t ConvertRegionUtf16ToUtf8(const uint16_t *utf16In, uint8_t *utf8Out, size_ } // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) Utf8Char ch = ConvertUtf16ToUtf8(utf16In[i], next16Code, modify); - if (utf8Pos + ch.n > utf8Len) { + if (utf8Pos + ch.n_ > utf8Len) { break; } - for (size_t c = 0; c < ch.n; ++c) { - utf8Out[utf8Pos++] = ch.ch[c]; // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic) + for (size_t c = 0; c < ch.n_; ++c) { + utf8Out[utf8Pos++] = ch.ch_[c]; // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic) } - if (ch.n == UtfLength::FOUR) { // Two UTF-16 chars are used + if (ch.n_ == UtfLength::FOUR) { // Two UTF-16 chars are used ++i; } } diff --git a/runtime/base/utf_helper.h b/runtime/base/utf_helper.h index 48728f726ed91219cb9afe86688b682312ad5563..93b37b97bb557041f4678ce0678b2e5f6de1ffcb 100644 --- a/runtime/base/utf_helper.h +++ b/runtime/base/utf_helper.h @@ -52,8 +52,8 @@ enum UtfOffset : uint8_t { SIX = 6, TEN = 10, TWELVE = 12, EIGHTEEN = 18 }; static constexpr size_t MAX_BYTES = 4; struct Utf8Char { - size_t n; - std::array ch; + size_t n_; + std::array ch_; }; uint32_t UTF16Decode(uint16_t lead, uint16_t trail); diff --git a/runtime/builtins.cpp b/runtime/builtins.cpp index 160b0c85d874f4afede2d63cacce101b237906ff..a233d30eed17e5723216d5989f552c688e2398a3 100644 --- a/runtime/builtins.cpp +++ b/runtime/builtins.cpp @@ -1031,10 +1031,10 @@ void Builtins::SetErrorWithRealm(const JSHandle &realm, const JSType void Builtins::GeneralUpdateError(ErrorParameter *error, EcmaEntrypoint constructor, EcmaEntrypoint method, const char *name, JSType type) const { - error->nativeConstructor = constructor; - error->nativeMethod = method; - error->nativePropertyName = name; - error->nativeJstype = type; + error->native_constructor_ = constructor; + error->native_method_ = method; + error->native_property_name_ = name; + error->native_jstype_ = type; } void Builtins::InitializeError(const JSHandle &env, const JSHandle &objFuncDynclass, @@ -1077,22 +1077,22 @@ void Builtins::InitializeError(const JSHandle &env, const JSHandle nativeErrorFuncInstanceDynclass = - factory_->NewEcmaDynClass(JSObject::SIZE, errorParameter.nativeJstype, nativeErrorFuncPrototypeValue); + factory_->NewEcmaDynClass(JSObject::SIZE, errorParameter.native_jstype_, nativeErrorFuncPrototypeValue); // NativeError() = new Error() JSHandle nativeErrorFunction = - factory_->NewJSNativeErrorFunction(env, reinterpret_cast(errorParameter.nativeConstructor)); - InitializeCtor(env, nativeErrorFuncPrototype, nativeErrorFunction, errorParameter.nativePropertyName, + factory_->NewJSNativeErrorFunction(env, reinterpret_cast(errorParameter.native_constructor_)); + InitializeCtor(env, nativeErrorFuncPrototype, nativeErrorFunction, errorParameter.native_property_name_, FunctionLength::ONE); nativeErrorFunction->SetFunctionPrototype(thread_, nativeErrorFuncInstanceDynclass.GetTaggedValue()); // NativeError.prototype method SetFunction(env, nativeErrorFuncPrototype, thread_->GlobalConstants()->GetHandledToStringString(), - errorParameter.nativeMethod, FunctionLength::ZERO); + errorParameter.native_method_, FunctionLength::ZERO); // Error.prototype Attribute - SetAttribute(nativeErrorFuncPrototype, "name", errorParameter.nativePropertyName); + SetAttribute(nativeErrorFuncPrototype, "name", errorParameter.native_property_name_); SetAttribute(nativeErrorFuncPrototype, "message", ""); if (errorTag == JSType::JS_RANGE_ERROR) { @@ -3043,20 +3043,22 @@ JSHandle Builtins::InitializeArkPrivate(const JSHandle &env { JSHandle arkPrivate = factory_->NewEmptyJSObject(); SetFrozenFunction(env, arkPrivate, "Load", ContainersPrivate::Load, FunctionLength::ZERO); - SetConstant(arkPrivate, "ArrayList", JSTaggedValue(static_cast(containers::ContainerTag::ArrayList))); - SetConstant(arkPrivate, "Queue", JSTaggedValue(static_cast(containers::ContainerTag::Queue))); - SetConstant(arkPrivate, "Deque", JSTaggedValue(static_cast(containers::ContainerTag::Deque))); - SetConstant(arkPrivate, "Stack", JSTaggedValue(static_cast(containers::ContainerTag::Stack))); - SetConstant(arkPrivate, "Vector", JSTaggedValue(static_cast(containers::ContainerTag::Vector))); - SetConstant(arkPrivate, "List", JSTaggedValue(static_cast(containers::ContainerTag::List))); - SetConstant(arkPrivate, "LinkedList", JSTaggedValue(static_cast(containers::ContainerTag::LinkedList))); - SetConstant(arkPrivate, "TreeMap", JSTaggedValue(static_cast(containers::ContainerTag::TreeMap))); - SetConstant(arkPrivate, "TreeSet", JSTaggedValue(static_cast(containers::ContainerTag::TreeSet))); - SetConstant(arkPrivate, "HashMap", JSTaggedValue(static_cast(containers::ContainerTag::HashMap))); - SetConstant(arkPrivate, "HashSet", JSTaggedValue(static_cast(containers::ContainerTag::HashSet))); - SetConstant(arkPrivate, "LightWightMap", JSTaggedValue(static_cast(containers::ContainerTag::LightWightMap))); - SetConstant(arkPrivate, "LightWightSet", JSTaggedValue(static_cast(containers::ContainerTag::LightWightSet))); - SetConstant(arkPrivate, "PlainArray", JSTaggedValue(static_cast(containers::ContainerTag::PlainArray))); + SetConstant(arkPrivate, "ArrayList", JSTaggedValue(static_cast(containers::ContainerTag::ARRAY_LIST))); + SetConstant(arkPrivate, "Queue", JSTaggedValue(static_cast(containers::ContainerTag::QUEUE))); + SetConstant(arkPrivate, "Deque", JSTaggedValue(static_cast(containers::ContainerTag::DEQUE))); + SetConstant(arkPrivate, "Stack", JSTaggedValue(static_cast(containers::ContainerTag::STACK))); + SetConstant(arkPrivate, "Vector", JSTaggedValue(static_cast(containers::ContainerTag::VECTOR))); + SetConstant(arkPrivate, "List", JSTaggedValue(static_cast(containers::ContainerTag::LIST))); + SetConstant(arkPrivate, "LinkedList", JSTaggedValue(static_cast(containers::ContainerTag::LINKED_LIST))); + SetConstant(arkPrivate, "TreeMap", JSTaggedValue(static_cast(containers::ContainerTag::TREE_MAP))); + SetConstant(arkPrivate, "TreeSet", JSTaggedValue(static_cast(containers::ContainerTag::TREE_SET))); + SetConstant(arkPrivate, "HashMap", JSTaggedValue(static_cast(containers::ContainerTag::HASH_MAP))); + SetConstant(arkPrivate, "HashSet", JSTaggedValue(static_cast(containers::ContainerTag::HASH_SET))); + SetConstant(arkPrivate, "LightWightMap", + JSTaggedValue(static_cast(containers::ContainerTag::LIGHT_WIGHT_MAP))); + SetConstant(arkPrivate, "LightWightSet", + JSTaggedValue(static_cast(containers::ContainerTag::LIGHT_WIGHT_SET))); + SetConstant(arkPrivate, "PlainArray", JSTaggedValue(static_cast(containers::ContainerTag::PLAIN_ARRAY))); return arkPrivate; } diff --git a/runtime/builtins.h b/runtime/builtins.h index 399ada65af8efdfcb9da7abfc37dbb37948be109..8e02fc42dee1b612570c012bafd6b2832d10197a 100644 --- a/runtime/builtins.h +++ b/runtime/builtins.h @@ -26,10 +26,10 @@ namespace panda::ecmascript { struct ErrorParameter { - EcmaEntrypoint nativeConstructor {nullptr}; - EcmaEntrypoint nativeMethod {nullptr}; - const char *nativePropertyName {nullptr}; - JSType nativeJstype {JSType::INVALID}; + EcmaEntrypoint native_constructor_ {nullptr}; + EcmaEntrypoint native_method_ {nullptr}; + const char *native_property_name_ {nullptr}; + JSType native_jstype_ {JSType::INVALID}; }; enum FunctionLength : uint8_t { ZERO = 0, ONE, TWO, THREE, FOUR }; diff --git a/runtime/builtins/builtins_regexp.cpp b/runtime/builtins/builtins_regexp.cpp index eedeba4aa9431d5076424c389d97b3a6a41b7d89..0995b76dbbf0029476062cd0fa674f793649dbe5 100644 --- a/runtime/builtins/builtins_regexp.cpp +++ b/runtime/builtins/builtins_regexp.cpp @@ -608,7 +608,7 @@ JSTaggedValue BuiltinsRegExp::RegExpReplaceFast(JSThread *thread, JSHandle lastIndexValue(thread, JSTaggedValue(0)); FastRuntimeStub::FastSetPropertyByValue(thread, regexp.GetTaggedValue(), lastIndexHandle.GetTaggedValue(), @@ -1339,7 +1339,7 @@ JSTaggedValue BuiltinsRegExp::RegExpBuiltinExec(JSThread *thread, const JSHandle } return JSTaggedValue::Null(); } - uint32_t endIndex = matchResult.endIndex_; + uint32_t endIndex = matchResult.end_index_; if (global || sticky) { // a. Let setStatus be Set(R, "lastIndex", e, true). FastRuntimeStub::FastSetPropertyByValue(thread, regexp.GetTaggedValue(), lastIndexHandle.GetTaggedValue(), diff --git a/runtime/builtins/builtins_string.cpp b/runtime/builtins/builtins_string.cpp index 639841097e49a77e7f8347761e6f800fdd5bc823..b13fe7cc7f5bb37d6d13fb58dce1ebfd7e84cea7 100644 --- a/runtime/builtins/builtins_string.cpp +++ b/runtime/builtins/builtins_string.cpp @@ -1582,7 +1582,7 @@ JSTaggedValue BuiltinsString::ToLocaleLowerCase(EcmaRuntimeCallInfo *argv) RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); // Let locale be BestAvailableLocale(availableLocales, noExtensionsLocale). - std::string locale = JSLocale::BestAvailableLocale(thread, availableLocales, noExtensionsLocale.base); + std::string locale = JSLocale::BestAvailableLocale(thread, availableLocales, noExtensionsLocale.base_); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); // If locale is undefined, let locale be "und". @@ -1651,7 +1651,7 @@ JSTaggedValue BuiltinsString::ToLocaleUpperCase(EcmaRuntimeCallInfo *argv) RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); // Let locale be BestAvailableLocale(availableLocales, noExtensionsLocale). - std::string locale = JSLocale::BestAvailableLocale(thread, availableLocales, noExtensionsLocale.base); + std::string locale = JSLocale::BestAvailableLocale(thread, availableLocales, noExtensionsLocale.base_); RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); // If locale is undefined, let locale be "und". diff --git a/runtime/class_info_extractor.cpp b/runtime/class_info_extractor.cpp index 2c9c84dd45e676a6920c262fc851b00f2be1ac72..ec94d529ad9e565d233d14dfa41051fc1ef61c62 100644 --- a/runtime/class_info_extractor.cpp +++ b/runtime/class_info_extractor.cpp @@ -104,15 +104,15 @@ bool ClassInfoExtractor::ExtractAndReturnWhetherWithElements(JSThread *thread, c ASSERT(keys->GetLength() == properties->GetLength() && elements->GetLength() == 0); - uint32_t pos = detail.fillStartLoc; + uint32_t pos = detail.fill_start_loc_; bool withElemenstFlag = false; - bool isStaticFlag = detail.ctorMethod != nullptr; + bool isStaticFlag = detail.ctor_method_ != nullptr; bool keysHasNameFlag = false; JSHandle nameString = globalConst->GetHandledNameString(); JSMutableHandle firstValue(thread, JSTaggedValue::Undefined()); JSMutableHandle secondValue(thread, JSTaggedValue::Undefined()); - for (uint32_t index = detail.extractBegin; index < detail.extractEnd; index += 2) { // 2: key-value pair + for (uint32_t index = detail.extract_begin_; index < detail.extract_end_; index += 2) { // 2: key-value pair firstValue.Update(literal->Get(index)); secondValue.Update(literal->Get(index + 1)); ASSERT_PRINT(JSTaggedValue::IsPropertyKey(firstValue), "Key is not a property key"); @@ -146,7 +146,7 @@ bool ClassInfoExtractor::ExtractAndReturnWhetherWithElements(JSThread *thread, c if (LIKELY(!keysHasNameFlag)) { [[maybe_unused]] EcmaHandleScope handleScope(thread); ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - CString clsName = detail.ctorMethod->ParseFunctionName(); + CString clsName = detail.ctor_method_->ParseFunctionName(); JSHandle clsNameHandle = factory->NewFromString(clsName); properties->Set(thread, NAME_INDEX, clsNameHandle); } else { @@ -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_info_extractor.h b/runtime/class_info_extractor.h index 2420f4a0f6375ef0759fb5fcff5a04bc7485ab2a..19fdefab8511e0cbaf3b7228bb230ccbc1dc337f 100644 --- a/runtime/class_info_extractor.h +++ b/runtime/class_info_extractor.h @@ -34,10 +34,10 @@ public: static constexpr uint8_t PROTOTYPE_INDEX = 2; struct ExtractContentsDetail { - uint32_t extractBegin; - uint32_t extractEnd; - uint8_t fillStartLoc; - JSMethod *ctorMethod; + uint32_t extract_begin_; + uint32_t extract_end_; + uint8_t fill_start_loc_; + JSMethod *ctor_method_; }; CAST_CHECK(ClassInfoExtractor, IsClassInfoExtractor); diff --git a/runtime/class_linker/panda_file_translator.cpp b/runtime/class_linker/panda_file_translator.cpp index f1a5d999fb953205d6313dc0b75a9c84bd612ab3..dc2d21d3c7a8af7c836c0895017db7842e319203 100644 --- a/runtime/class_linker/panda_file_translator.cpp +++ b/runtime/class_linker/panda_file_translator.cpp @@ -41,7 +41,7 @@ namespace panda::ecmascript { PandaFileTranslator::PandaFileTranslator(EcmaVM *vm) - : ecmaVm_(vm), factory_(vm->GetFactory()), thread_(vm->GetJSThread()) + : ecma_vm_(vm), factory_(vm->GetFactory()), thread_(vm->GetJSThread()) { } @@ -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()); @@ -162,30 +162,30 @@ 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); auto foundStr = pf.GetStringData(id); auto string = - factory_->GetRawStringFromStringTable(foundStr.data, foundStr.utf16_length, foundStr.is_ascii); + factory_->GetRawStringFromStringTable(foundStr.data_, foundStr.utf16_length_, foundStr.is_ascii_); if (string == nullptr) { LOG(FATAL, ECMASCRIPT) << "Not enough memory"; } 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); @@ -195,7 +195,7 @@ Program *PandaFileTranslator::GenerateProgram(const panda_file::File &pf) constpool->Set(thread_, value.GetConstpoolIndex(), jsFunc.GetTaggedValue()); jsFunc->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); @@ -205,7 +205,7 @@ Program *PandaFileTranslator::GenerateProgram(const panda_file::File &pf) constpool->Set(thread_, value.GetConstpoolIndex(), jsFunc.GetTaggedValue()); jsFunc->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); @@ -224,7 +224,7 @@ Program *PandaFileTranslator::GenerateProgram(const panda_file::File &pf) constpool->Set(thread_, value.GetConstpoolIndex(), jsFunc.GetTaggedValue()); jsFunc->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); @@ -234,7 +234,7 @@ Program *PandaFileTranslator::GenerateProgram(const panda_file::File &pf) constpool->Set(thread_, value.GetConstpoolIndex(), jsFunc.GetTaggedValue()); jsFunc->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); @@ -244,14 +244,14 @@ Program *PandaFileTranslator::GenerateProgram(const panda_file::File &pf) constpool->Set(thread_, value.GetConstpoolIndex(), jsFunc.GetTaggedValue()); jsFunc->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); @@ -296,7 +296,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); @@ -304,7 +304,7 @@ 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); @@ -502,15 +502,15 @@ void PandaFileTranslator::UpdateICOffset(JSMethod *method, uint32_t insSz, const 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; } diff --git a/runtime/class_linker/panda_file_translator.h b/runtime/class_linker/panda_file_translator.h index 4803cbc740cdb5087a6c9a7e97b74c2f4ced2a53..0b830300371d2d411f4e9e624cd01b711b57db1d 100644 --- a/runtime/class_linker/panda_file_translator.h +++ b/runtime/class_linker/panda_file_translator.h @@ -100,14 +100,14 @@ private: void UpdateICOffset(JSMethod *method, uint32_t insSz, 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/containers/containers_private.cpp b/runtime/containers/containers_private.cpp index 4cc3e7b34ff73501be63f5239e4ce6ccc2d58e91..1086d77b052327033f72b5cbfd84d6e50b59a865 100644 --- a/runtime/containers/containers_private.cpp +++ b/runtime/containers/containers_private.cpp @@ -38,7 +38,7 @@ JSTaggedValue ContainersPrivate::Load(EcmaRuntimeCallInfo *msg) ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); JSTaggedValue res = JSTaggedValue::Undefined(); switch (tag) { - case ContainerTag::ArrayList: { + case ContainerTag::ARRAY_LIST: { JSHandle key(factory->NewFromCanBeCompressString("ArrayListConstructor")); JSTaggedValue value = FastRuntimeStub::GetPropertyByName(thread, thisValue.GetTaggedValue(), key.GetTaggedValue()); @@ -51,7 +51,7 @@ JSTaggedValue ContainersPrivate::Load(EcmaRuntimeCallInfo *msg) } break; } - case ContainerTag::Queue: + case ContainerTag::QUEUE: case ContainerTag::END: break; default: diff --git a/runtime/containers/containers_private.h b/runtime/containers/containers_private.h index 705dc53e5a91ffe230fa0a91f8b7c7cdf018a076..3cdeaf66bdae8abf739612e55c9ba67ab63eb257 100644 --- a/runtime/containers/containers_private.h +++ b/runtime/containers/containers_private.h @@ -21,20 +21,20 @@ namespace panda::ecmascript::containers { enum FuncLength : uint8_t { ZERO = 0, ONE, TWO, THREE, FOUR }; enum ContainerTag : uint8_t { - ArrayList = 0, - Queue, - Deque, - Stack, - Vector, - List, - LinkedList, - TreeMap, - TreeSet, - HashMap, - HashSet, - LightWightMap, - LightWightSet, - PlainArray, + ARRAY_LIST = 0, + QUEUE, + DEQUE, + STACK, + VECTOR, + LIST, + LINKED_LIST, + TREE_MAP, + TREE_SET, + HASH_MAP, + HASH_SET, + LIGHT_WIGHT_MAP, + LIGHT_WIGHT_SET, + PLAIN_ARRAY, END }; // Using Lazy-loading container, including ArrayList, Queue, Stack, Vector, List, LinkedList, Deque, diff --git a/runtime/ecma_global_storage-inl.h b/runtime/ecma_global_storage-inl.h index 258aa3b6b776b0efa9771dc41640a2233677df2a..6a481c299492416fbb7470a36ba725cfd8dfaf5f 100644 --- a/runtime/ecma_global_storage-inl.h +++ b/runtime/ecma_global_storage-inl.h @@ -30,16 +30,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; } @@ -51,35 +51,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; } @@ -99,11 +99,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) @@ -162,13 +162,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(); @@ -198,7 +198,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 46c9354a099c63e3026cc3e6d50a5b8df4d00357..d7c7b65f7526f5df996bdd2f5b16e25227b3416f 100644 --- a/runtime/ecma_global_storage.h +++ b/runtime/ecma_global_storage.h @@ -29,13 +29,13 @@ public: explicit EcmaGlobalStorage(Chunk *chunk) : chunk_(chunk) { ASSERT(chunk != nullptr); - topGlobalNodes_ = lastGlobalNodes_ = chunk_->New(false); - topWeakGlobalNodes_ = lastWeakGlobalNodes_ = chunk_->New(true); + top_global_nodes_ = last_global_nodes_ = chunk_->New(false); + top_weak_global_nodes_ = last_weak_global_nodes_ = chunk_->New(true); } ~EcmaGlobalStorage() { - NodeList *next = topGlobalNodes_; + NodeList *next = top_global_nodes_; NodeList *current = nullptr; while (next != nullptr) { current = next; @@ -43,7 +43,7 @@ public: chunk_->Delete(current); } - next = topWeakGlobalNodes_; + next = top_weak_global_nodes_; while (next != nullptr) { current = next; next = current->GetNext(); @@ -95,12 +95,12 @@ public: void SetFree(bool free) { - isFree_ = free; + is_free_ = free; } bool IsFree() const { - return isFree_; + return is_free_; } uintptr_t GetObjectAddress() const @@ -113,15 +113,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 isWeak) : is_weak_(isWeak) { for (int i = 0; i < GLOBAL_BLOCK_SIZE; i++) { - nodeList_[i].SetIndex(i); + node_list_[i].SetIndex(i); } } ~NodeList() = default; @@ -142,17 +142,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) @@ -175,26 +175,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; @@ -208,15 +208,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); @@ -227,7 +227,7 @@ public: template void IterateUsageGlobal(Callback callback) { - NodeList *next = topGlobalNodes_; + NodeList *next = top_global_nodes_; NodeList *current = nullptr; while (next != nullptr) { current = next; @@ -240,7 +240,7 @@ public: template void IterateWeakUsageGlobal(Callback callback) { - NodeList *next = topWeakGlobalNodes_; + NodeList *next = top_weak_global_nodes_; NodeList *current = nullptr; while (next != nullptr) { current = next; @@ -257,13 +257,13 @@ private: inline uintptr_t NewGlobalHandleImplement(NodeList **storage, NodeList **freeList, bool isWeak, JSTaggedType value); Chunk *chunk_ {nullptr}; - 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 d183a49fa408a5cfe29b0eb3fb7bcaf8c4713777..557b5ff30c0d4cd389567293bbd776daa9df3d6c 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 1709fc7c17ef80e25b2f70f0b61ef8332e604e6c..c79b806c666b6ed26c85a0c65d7ffa0775db4d7d 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_macros.h b/runtime/ecma_macros.h index a92a7b37fda5526a3094dc59ea0f3934ed1e4ac6..6931d6ccc45d186e6e9a57fb9e5fc990d34b7b1a 100644 --- a/runtime/ecma_macros.h +++ b/runtime/ecma_macros.h @@ -30,18 +30,18 @@ template static inline T UnalignedLoad(T const *p) { struct Wrapper { - T x; + T x_; } __attribute__((packed, aligned(1))); - return reinterpret_cast(p)->x; + return reinterpret_cast(p)->x_; } template static inline void UnalignedStore(T *p, T v) { struct Wrapper { - T x; + T x_; } __attribute__((packed, aligned(1))); - reinterpret_cast(p)->x = v; + reinterpret_cast(p)->x_ = v; } // NOLINTNEXTLINE(cppcoreguidelines-macro-usage) diff --git a/runtime/ecma_module.cpp b/runtime/ecma_module.cpp index 96790105b7320f012983a9398b4673bd8d67b0f9..4bbb9170d509a39e515d38fccc794f2cefc16b6d 100644 --- a/runtime/ecma_module.cpp +++ b/runtime/ecma_module.cpp @@ -106,7 +106,7 @@ void EcmaModule::DebugPrint(const JSThread *thread, const CString &caller) ModuleManager::ModuleManager(EcmaVM *vm) : vm_(vm) { - ecmaModules_ = NameDictionary::Create(vm_->GetJSThread(), DEAULT_DICTIONART_CAPACITY).GetTaggedValue(); + ecma_modules_ = NameDictionary::Create(vm_->GetJSThread(), DEAULT_DICTIONART_CAPACITY).GetTaggedValue(); } // class ModuleManager @@ -114,8 +114,8 @@ void ModuleManager::AddModule(JSHandle moduleName, JSHandleGetJSThread(); [[maybe_unused]] EcmaHandleScope scope(thread); - JSHandle dict(thread, ecmaModules_); - ecmaModules_ = + JSHandle dict(thread, ecma_modules_); + ecma_modules_ = NameDictionary::Put(thread, dict, moduleName, module, PropertyAttributes::Default()).GetTaggedValue(); } @@ -123,19 +123,19 @@ void ModuleManager::RemoveModule(JSHandle moduleName) { JSThread *thread = vm_->GetJSThread(); [[maybe_unused]] EcmaHandleScope scope(thread); - JSHandle moduleItems(thread, ecmaModules_); + JSHandle moduleItems(thread, ecma_modules_); int entry = moduleItems->FindEntry(moduleName.GetTaggedValue()); if (entry != -1) { - ecmaModules_ = NameDictionary::Remove(thread, moduleItems, entry).GetTaggedValue(); + ecma_modules_ = NameDictionary::Remove(thread, moduleItems, entry).GetTaggedValue(); } } JSHandle ModuleManager::GetModule(const JSThread *thread, [[maybe_unused]] JSHandle moduleName) { - int entry = NameDictionary::Cast(ecmaModules_.GetTaggedObject())->FindEntry(moduleName.GetTaggedValue()); + int entry = NameDictionary::Cast(ecma_modules_.GetTaggedObject())->FindEntry(moduleName.GetTaggedValue()); if (entry != -1) { - return JSHandle(thread, NameDictionary::Cast(ecmaModules_.GetTaggedObject())->GetValue(entry)); + return JSHandle(thread, NameDictionary::Cast(ecma_modules_.GetTaggedObject())->GetValue(entry)); } return thread->GlobalConstants()->GetHandledUndefined(); } @@ -166,19 +166,19 @@ CString ModuleManager::GenerateModuleFullPath(const std::string ¤tPathFile const CString &ModuleManager::GetCurrentExportModuleName() { - return moduleNames_.back(); + return module_names_.back(); } void ModuleManager::SetCurrentExportModuleName(const std::string_view &moduleFile) { - moduleNames_.emplace_back(CString(moduleFile)); // xx/xx/x.abc + module_names_.emplace_back(CString(moduleFile)); // xx/xx/x.abc } void ModuleManager::RestoreCurrentExportModuleName() { - auto s = moduleNames_.size(); + auto s = module_names_.size(); if (s > 0) { - moduleNames_.resize(s - 1); + module_names_.resize(s - 1); return; } UNREACHABLE(); @@ -187,9 +187,9 @@ void ModuleManager::RestoreCurrentExportModuleName() const CString &ModuleManager::GetPrevExportModuleName() { static const int MINIMUM_COUNT = 2; - auto count = moduleNames_.size(); + auto count = module_names_.size(); ASSERT(count >= MINIMUM_COUNT); - return moduleNames_[count - MINIMUM_COUNT]; + return module_names_[count - MINIMUM_COUNT]; } void ModuleManager::AddModuleItem(const JSThread *thread, JSHandle itemName, @@ -241,7 +241,7 @@ void ModuleManager::CopyModule(const JSThread *thread, JSHandle s void ModuleManager::DebugPrint([[maybe_unused]] const JSThread *thread, [[maybe_unused]] const CString &caller) { std::cout << "ModuleStack:"; - for_each(moduleNames_.cbegin(), moduleNames_.cend(), [](const CString &s) -> void { std::cout << s << " "; }); + for_each(module_names_.cbegin(), module_names_.cend(), [](const CString &s) -> void { std::cout << s << " "; }); std::cout << "\n"; } } // namespace panda::ecmascript diff --git a/runtime/ecma_module.h b/runtime/ecma_module.h index 440181eeca125486b6c2c19ab8b12bedeb7f2f0c..a11d2f7d8d95322d65a0812697515ee4c48c97cf 100644 --- a/runtime/ecma_module.h +++ b/runtime/ecma_module.h @@ -92,8 +92,8 @@ private: NO_MOVE_SEMANTIC(ModuleManager); EcmaVM *vm_ {nullptr}; - JSTaggedValue ecmaModules_ {JSTaggedValue::Hole()}; - std::vector moduleNames_ {DEAULT_DICTIONART_CAPACITY}; + JSTaggedValue ecma_modules_ {JSTaggedValue::Hole()}; + std::vector module_names_ {DEAULT_DICTIONART_CAPACITY}; friend class EcmaVM; }; diff --git a/runtime/ecma_runtime_call_info.h b/runtime/ecma_runtime_call_info.h index d3504ca6061024040e87ba5ebb50b0cab891e340..fef062cb64ba3f531ee23170a5b9d5608a3ccc61 100644 --- a/runtime/ecma_runtime_call_info.h +++ b/runtime/ecma_runtime_call_info.h @@ -32,20 +32,20 @@ public: // For builtins interpreter call EcmaRuntimeCallInfo(JSThread *thread, uint32_t numArgs, interpreter::VRegister *args) : thread_(thread), - numArgs_(numArgs), - gprArgs_(reinterpret_cast(args), numArgs), - stackArgs_(nullptr, static_cast(0)) + num_args_(numArgs), + gpr_args_(reinterpret_cast(args), numArgs), + stack_args_(nullptr, static_cast(0)) { - ASSERT(numArgs_ >= NUM_MANDATORY_JSFUNC_ARGS); + ASSERT(num_args_ >= NUM_MANDATORY_JSFUNC_ARGS); } EcmaRuntimeCallInfo(JSThread *thread, uint32_t numArgs, JSTaggedValue *gprArgs, JSTaggedValue *stackArgs) : thread_(thread), - numArgs_(numArgs), - gprArgs_(gprArgs, GetGprArgsCount(numArgs)), - stackArgs_(stackArgs, GetStackArgsCount(numArgs)) + num_args_(numArgs), + gpr_args_(gprArgs, GetGprArgsCount(numArgs)), + stack_args_(stackArgs, GetStackArgsCount(numArgs)) { - ASSERT(numArgs_ >= NUM_MANDATORY_JSFUNC_ARGS); + ASSERT(num_args_ >= NUM_MANDATORY_JSFUNC_ARGS); } ~EcmaRuntimeCallInfo() = default; @@ -107,15 +107,15 @@ 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 { - if (idx < gprArgs_.size()) { - return reinterpret_cast(&gprArgs_[idx]); + if (idx < gpr_args_.size()) { + return reinterpret_cast(&gpr_args_[idx]); } - return reinterpret_cast(&stackArgs_[idx - gprArgs_.size()]); + return reinterpret_cast(&stack_args_[idx - gpr_args_.size()]); } private: @@ -145,9 +145,9 @@ private: private: JSThread *thread_; - uint32_t numArgs_; - Span gprArgs_; - Span stackArgs_; + uint32_t num_args_; + Span gpr_args_; + Span stack_args_; }; } // namespace panda::ecmascript diff --git a/runtime/ecma_string.cpp b/runtime/ecma_string.cpp index 0f462774f9db6eb63770bc2b50faa4f034d5676a..fdaf9a9eaea93c6187474ea8eaf55f0010ccea22 100644 --- a/runtime/ecma_string.cpp +++ b/runtime/ecma_string.cpp @@ -19,7 +19,7 @@ #include "plugins/ecmascript/runtime/mem/c_containers.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, @@ -243,7 +243,7 @@ int32_t EcmaString::IndexOf(const EcmaString *rhs, int32_t pos) const // static bool EcmaString::CanBeCompressed(const uint8_t *utf8Data, uint32_t utf8Len) { - if (!compressedStringsEnabled) { + if (!compressed_strings_enabled_) { return false; } bool isCompressed = true; @@ -263,7 +263,7 @@ bool EcmaString::CanBeCompressed(const uint8_t *utf8Data, uint32_t utf8Len) /* static */ bool EcmaString::CanBeCompressed(const uint16_t *utf16Data, uint32_t utf16Len) { - if (!compressedStringsEnabled) { + if (!compressed_strings_enabled_) { return false; } bool isCompressed = true; @@ -392,7 +392,7 @@ static int32_t ComputeHashForUtf8(const uint8_t *utf8Data) uint32_t EcmaString::ComputeHashcode() const { uint32_t hash; - if (compressedStringsEnabled) { + if (compressed_strings_enabled_) { if (!IsUtf16()) { hash = ComputeHashForData(GetDataUtf8(), GetLength()); } else { diff --git a/runtime/ecma_string.h b/runtime/ecma_string.h index b49a488bb86d9be63c40feed23114ae35a6734b0..749aea6f30ce023b4625fa6d874d9570d581dd03 100644 --- a/runtime/ecma_string.h +++ b/runtime/ecma_string.h @@ -75,12 +75,12 @@ public: 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) @@ -263,12 +263,12 @@ public: 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); @@ -307,7 +307,7 @@ private: uint32_t ComputeHashcode() const; static void CopyUtf16AsUtf8(const uint16_t *utf16From, uint8_t *utf8To, uint32_t utf16Len); - static bool compressedStringsEnabled; + static bool compressed_strings_enabled_; static bool IsASCIICharacter(uint16_t data) { diff --git a/runtime/ecma_string_table.cpp b/runtime/ecma_string_table.cpp index 27d948f016783a1d2537079170a446179f0dddfc..c3699559232b3a76a799686fdaa4ed6449ac1ad8 100644 --- a/runtime/ecma_string_table.cpp +++ b/runtime/ecma_string_table.cpp @@ -68,11 +68,11 @@ ObjectHeader *EcmaStringTable::ResolveString(const panda_file::File &pf, panda_f auto foundStr = pf.GetStringData(id); const auto factory = vm_->GetFactory(); - if (UNLIKELY(foundStr.utf16_length == 0)) { + if (UNLIKELY(foundStr.utf16_length_ == 0)) { return *(factory->GetEmptyString()); } - return EcmaString::Cast(this->GetOrInternString(foundStr.data, foundStr.utf16_length, foundStr.is_ascii)); + return EcmaString::Cast(this->GetOrInternString(foundStr.data_, foundStr.utf16_length_, foundStr.is_ascii_)); } void EcmaStringTable::InternString(EcmaString *string) diff --git a/runtime/ecma_vm.cpp b/runtime/ecma_vm.cpp index dd7d1e4aa4d26f86d1961d2687c622150b22c7b9..e08a9ca629d67db2d7b464de06b78eb430931641 100644 --- a/runtime/ecma_vm.cpp +++ b/runtime/ecma_vm.cpp @@ -183,25 +183,25 @@ Expected EcmaVM::Create(Runtime *runtime, const JSRuntimeOpti } EcmaVM::EcmaVM(JSRuntimeOptions options) - : stringTable_(new EcmaStringTable(this)), - regionFactory_(std::make_unique()), - chunk_(regionFactory_.get()), - nativeMethods_(&chunk_) + : string_table_(new EcmaStringTable(this)), + region_factory_(std::make_unique()), + chunk_(region_factory_.get()), + native_methods_(&chunk_) { options_ = std::move(options); - icEnable_ = options_.IsIcEnable(); - optionalLogEnabled_ = options_.IsEnableOptionalLog(); + ic_enable_ = options_.IsIcEnable(); + optional_log_enabled_ = options_.IsEnableOptionalLog(); rendezvous_ = chunk_.New(this); - snapshotSerializeEnable_ = options_.IsSnapshotSerializeEnabled(); - if (!snapshotSerializeEnable_) { - snapshotDeserializeEnable_ = options_.IsSnapshotDeserializeEnabled(); + snapshot_serialize_enable_ = options_.IsSnapshotSerializeEnabled(); + if (!snapshot_serialize_enable_) { + snapshot_deserialize_enable_ = options_.IsSnapshotDeserializeEnabled(); } - snapshotFileName_ = options_.GetSnapshotFile(); - frameworkAbcFileName_ = options_.GetFrameworkAbcFile(); + snapshot_file_name_ = options_.GetSnapshotFile(); + framework_abc_file_name_ = options_.GetFrameworkAbcFile(); auto runtime = Runtime::GetCurrent(); - notificationManager_ = chunk_.New(runtime->GetInternalAllocator()); - notificationManager_->SetRendezvous(rendezvous_); + notification_manager_ = chunk_.New(runtime->GetInternalAllocator()); + notification_manager_->SetRendezvous(rendezvous_); LanguageContext ctx = Runtime::GetCurrent()->GetLanguageContext(panda_file::SourceLang::ECMASCRIPT); mm_ = CreateMM(ctx, Runtime::GetCurrent()->GetInternalAllocator(), options_); @@ -245,10 +245,10 @@ bool EcmaVM::Initialize() Platform::GetCurrentPlatform()->Initialize(); auto globalConst = const_cast(thread_->GlobalConstants()); - regExpParserCache_ = new RegExpParserCache(); + reg_exp_parser_cache_ = new RegExpParserCache(); heap_ = new Heap(this); heap_->Initialize(); - gcStats_ = chunk_.New(heap_); + gc_stats_ = chunk_.New(heap_); factory_ = chunk_.New(thread_, heap_); if (UNLIKELY(factory_ == nullptr)) { LOG_ECMA(FATAL) << "alloc factory_ failed"; @@ -266,7 +266,7 @@ bool EcmaVM::Initialize() } [[maybe_unused]] EcmaHandleScope scope(thread_); - if (!snapshotDeserializeEnable_ || !VerifyFilePath(snapshotFileName_)) { + if (!snapshot_deserialize_enable_ || !VerifyFilePath(snapshot_file_name_)) { LOG_ECMA(DEBUG) << "EcmaVM::Initialize run builtins"; JSHandle dynClassClassHandle = @@ -277,7 +277,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); @@ -289,7 +289,7 @@ 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())); @@ -298,7 +298,7 @@ bool EcmaVM::Initialize() thread_->LoadFastStubModule(moduleFile.c_str()); #endif SetupRegExpResultCache(); - microJobQueue_ = factory_->NewMicroJobQueue().GetTaggedValue(); + micro_job_queue_ = factory_->NewMicroJobQueue().GetTaggedValue(); { Builtins builtins; @@ -309,21 +309,21 @@ bool EcmaVM::Initialize() } else { LOG_ECMA(DEBUG) << "EcmaVM::Initialize run snapshot"; SnapShot snapShot(this); - std::unique_ptr pf = snapShot.DeserializeGlobalEnvAndProgram(snapshotFileName_); - frameworkPandaFile_ = pf.get(); + std::unique_ptr pf = snapShot.DeserializeGlobalEnvAndProgram(snapshot_file_name_); + framework_panda_file_ = pf.get(); AddPandaFile(pf.release(), false); - SetProgram(Program::Cast(frameworkProgram_.GetTaggedObject()), frameworkPandaFile_); - notificationManager_->LoadModuleEvent(pf->GetFilename()); + SetProgram(Program::Cast(framework_program_.GetTaggedObject()), framework_panda_file_); + notification_manager_->LoadModuleEvent(pf->GetFilename()); globalConst->InitGlobalUndefined(); factory_->ObtainRootClass(GetGlobalEnv()); } - moduleManager_ = new ModuleManager(this); + module_manager_ = new ModuleManager(this); InitializeFinish(); - notificationManager_->VmStartEvent(); - notificationManager_->VmInitializationEvent(thread_->GetThreadId()); + notification_manager_->VmStartEvent(); + notification_manager_->VmInitializationEvent(thread_->GetThreadId()); Platform::GetCurrentPlatform()->PostTask(std::make_unique(heap_)); return true; } @@ -364,8 +364,8 @@ void EcmaVM::InitializeEcmaScriptRunStat() }; static_assert(sizeof(runtimeCallerNames) == sizeof(const char *) * ecmascript::RUNTIME_CALLER_NUMBER, "Invalid runtime caller number"); - runtimeStat_ = chunk_.New(runtimeCallerNames, ecmascript::RUNTIME_CALLER_NUMBER); - if (UNLIKELY(runtimeStat_ == nullptr)) { + runtime_stat_ = chunk_.New(runtimeCallerNames, ecmascript::RUNTIME_CALLER_NUMBER); + if (UNLIKELY(runtime_stat_ == nullptr)) { LOG_ECMA(FATAL) << "alloc runtimeStat_ failed"; UNREACHABLE(); } @@ -374,21 +374,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; } @@ -400,7 +400,7 @@ void EcmaVM::UninitializeThreads() EcmaVM::~EcmaVM() { - vmInitialized_ = false; + vm_initialized_ = false; Platform::GetCurrentPlatform()->Destroy(); ClearNativeMethodsData(); @@ -410,19 +410,19 @@ 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(); - if (gcStats_ != nullptr) { + if (gc_stats_ != nullptr) { if (options_.IsEnableGCStatsPrint()) { - gcStats_->PrintStatisticResult(true); + gc_stats_->PrintStatisticResult(true); } - chunk_.Delete(gcStats_); - gcStats_ = nullptr; + chunk_.Delete(gc_stats_); + gc_stats_ = nullptr; } if (heap_ != nullptr) { @@ -431,12 +431,12 @@ EcmaVM::~EcmaVM() heap_ = nullptr; } - delete regExpParserCache_; - regExpParserCache_ = nullptr; + delete reg_exp_parser_cache_; + reg_exp_parser_cache_ = nullptr; - if (notificationManager_ != nullptr) { - chunk_.Delete(notificationManager_); - notificationManager_ = nullptr; + if (notification_manager_ != nullptr) { + chunk_.Delete(notification_manager_); + notification_manager_ = nullptr; } if (factory_ != nullptr) { @@ -444,19 +444,19 @@ EcmaVM::~EcmaVM() factory_ = nullptr; } - if (stringTable_ != nullptr) { - delete stringTable_; - stringTable_ = nullptr; + if (string_table_ != nullptr) { + delete string_table_; + string_table_ = nullptr; } - if (runtimeStat_ != nullptr) { - chunk_.Delete(runtimeStat_); - runtimeStat_ = nullptr; + if (runtime_stat_ != nullptr) { + chunk_.Delete(runtime_stat_); + runtime_stat_ = nullptr; } - if (moduleManager_ != nullptr) { - delete moduleManager_; - moduleManager_ = nullptr; + if (module_manager_ != nullptr) { + delete module_manager_; + module_manager_ = nullptr; } if (thread_ != nullptr) { @@ -465,8 +465,8 @@ EcmaVM::~EcmaVM() thread_ = nullptr; } - extractorCache_.clear(); - frameworkProgramMethods_.clear(); + extractor_cache_.clear(); + framework_program_methods_.clear(); mem::InternalAllocatorPtr allocator = mm_->GetHeapManager()->GetInternalAllocator(); allocator->Delete(runtime_iface_); @@ -480,15 +480,15 @@ bool EcmaVM::ExecuteFromPf(std::string_view filename, std::string_view entryPoin bool isModule) { 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()); + notification_manager_->LoadModuleEvent(pf->GetFilename()); } else { - pf.reset(frameworkPandaFile_); + pf.reset(framework_panda_file_); } return Execute(std::move(pf), entryPoint, args, isModule); @@ -502,7 +502,7 @@ 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); } @@ -510,11 +510,11 @@ bool EcmaVM::ExecuteFromBuffer(const void *buffer, size_t size, std::string_view 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(); } @@ -571,18 +571,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 = @@ -599,8 +599,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) @@ -611,13 +611,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); } } @@ -633,7 +633,7 @@ Expected EcmaVM::InvokeEntrypointImpl(Method *entrypoint, c const panda_file::File *file = entrypoint->GetPandaFile(); AddPandaFile(file, false); ScopedManagedCodeThread managed_scope(thread_); - return InvokeEcmaEntrypoint(*file, utf::Mutf8AsCString(entrypoint->GetName().data), args); + return InvokeEcmaEntrypoint(*file, utf::Mutf8AsCString(entrypoint->GetName().data_), args); } Expected EcmaVM::InvokeEcmaEntrypoint(const panda_file::File &pf, const CString &methodName, @@ -641,22 +641,22 @@ Expected EcmaVM::InvokeEcmaEntrypoint(const panda_file::Fil { [[maybe_unused]] EcmaHandleScope scope(thread_); JSHandle program; - if (snapshotSerializeEnable_) { + if (snapshot_serialize_enable_) { program = PandaFileTranslator::TranslatePandaFile(this, pf, methodName); auto string = EcmaString::Cast(program->GetLocation().GetTaggedObject()); - auto index = ConvertToString(string).find(frameworkAbcFileName_); + auto index = ConvertToString(string).find(framework_abc_file_name_); if (index != CString::npos) { LOG_ECMA(DEBUG) << "snapShot MakeSnapShotProgramObject abc " << ConvertToString(string); SnapShot snapShot(this); - snapShot.MakeSnapShotProgramObject(*program, &pf, snapshotFileName_); + snapShot.MakeSnapShotProgramObject(*program, &pf, snapshot_file_name_); } } else { - if (&pf != frameworkPandaFile_) { + if (&pf != framework_panda_file_) { program = PandaFileTranslator::TranslatePandaFile(this, pf, methodName); } else { JSHandle string = factory_->NewFromStdStringUnCheck(pf.GetFilename(), true); - program = JSHandle(thread_, frameworkProgram_); + program = JSHandle(thread_, framework_program_); program->SetLocation(thread_, string); RedirectMethod(pf); } @@ -669,7 +669,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; @@ -692,23 +692,23 @@ Expected EcmaVM::InvokeEcmaEntrypoint(const panda_file::Fil void EcmaVM::AddPandaFile(const panda_file::File *pf, bool isModule) { 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, isModule)); } 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 @@ -729,12 +729,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_); @@ -776,17 +776,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; @@ -798,29 +798,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 @@ -849,17 +849,18 @@ 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); } } @@ -884,17 +885,17 @@ bool EcmaVM::VerifyFilePath(const CString &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 @@ -923,28 +924,28 @@ void EcmaVM::StopHeapTracking() 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_->ecma_modules_))); + 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); } @@ -954,17 +955,17 @@ JSHandle EcmaVM::GetModuleByName(JSHandle moduleNa CString relativeFile = ConvertToString(EcmaString::Cast(moduleName->GetTaggedObject())); // generate full path - CString abcPath = moduleManager_->GenerateModuleFullPath(currentPathFile, relativeFile); + CString 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()) { CString file = ConvertToString(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; } @@ -972,24 +973,24 @@ JSHandle EcmaVM::GetModuleByName(JSHandle moduleNa void EcmaVM::ExecuteModule(std::string_view moduleFile, std::string_view entryPoint, const std::vector &args) { - moduleManager_->SetCurrentExportModuleName(moduleFile); + module_manager_->SetCurrentExportModuleName(moduleFile); // Update Current Module EcmaVM::ExecuteFromPf(moduleFile, entryPoint, args, true); // Restore Current Module - moduleManager_->RestoreCurrentExportModuleName(); + module_manager_->RestoreCurrentExportModuleName(); } void EcmaVM::ClearNativeMethodsData() { - for (auto iter : nativeMethods_) { + for (auto iter : native_methods_) { chunk_.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) @@ -1014,8 +1015,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; } @@ -1087,8 +1088,8 @@ void EcmaVM::UpdateVmRefs() // 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 0f46dfce117672e237758155bd34a386e26f37c4..a2b682e079359f6025a323674859db9b0ded894e 100644 --- a/runtime/ecma_vm.h +++ b/runtime/ecma_vm.h @@ -120,7 +120,7 @@ public: bool IsInitialized() const { - return vmInitialized_; + return vm_initialized_; } void HandleLdaStr(Frame *frame, BytecodeId string_id) override; @@ -195,7 +195,7 @@ public: GCStats *GetEcmaGCStats() const { - return gcStats_; + return gc_stats_; } panda::mem::GlobalObjectStorage *GetGlobalObjectStorage() const override @@ -205,8 +205,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); } @@ -296,16 +296,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 @@ -315,7 +315,7 @@ public: bool ICEnable() const { - return icEnable_; + return ic_enable_; } void HandleReferences([[maybe_unused]] const GCTask &task, const mem::GC::ReferenceClearPredicateT &pred) override @@ -334,8 +334,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; } @@ -345,8 +345,8 @@ public: template void EnumerateProgram(Callback cb, const std::string &pandaFile) 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 (pandaFile == std::get<1>(iter)->GetFilename()) { cb(std::get<0>(iter)); break; @@ -356,19 +356,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); @@ -386,7 +386,7 @@ public: RegionFactory *GetRegionFactory() const { - return regionFactory_.get(); + return region_factory_.get(); } Chunk *GetChunk() const @@ -403,24 +403,24 @@ public: 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) { - regexpCache_ = newCache; + regexp_cache_ = newCache; } RuntimeNotificationManager *GetNotificationManager() const { - return notificationManager_; + return notification_manager_; } std::unique_ptr OpenPandaFile(std::string_view location) override; @@ -429,7 +429,7 @@ public: const ChunkVector &GetNativeMethods() const { - return nativeMethods_; + return native_methods_; } void SetEnableForceGC(bool enable) @@ -444,24 +444,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_); } } @@ -532,62 +532,62 @@ private: PandaUniquePtr ecma_reference_processor_; EcmaRendezvous *rendezvous_ {nullptr}; - bool isTestMode_ {false}; + bool is_test_mode_ {false}; // VM startup states. static JSRuntimeOptions options_; - bool icEnable_ {true}; - bool vmInitialized_ {false}; - GCStats *gcStats_ {nullptr}; - bool snapshotSerializeEnable_ {false}; - bool snapshotDeserializeEnable_ {false}; - bool isUncaughtExceptionRegistered_ {false}; + bool ic_enable_ {true}; + bool vm_initialized_ {false}; + GCStats *gc_stats_ {nullptr}; + bool snapshot_serialize_enable_ {false}; + bool snapshot_deserialize_enable_ {false}; + bool is_uncaught_exception_registered_ {false}; // VM memory management. - EcmaStringTable *stringTable_ {nullptr}; - std::unique_ptr regionFactory_; + EcmaStringTable *string_table_ {nullptr}; + std::unique_ptr region_factory_; Chunk chunk_; Heap *heap_ {nullptr}; ObjectFactory *factory_ {nullptr}; - CVector arrayBufferDataList_; + CVector 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()}; - CString frameworkAbcFileName_; - const panda_file::File *frameworkPandaFile_ {nullptr}; - CVector frameworkProgramMethods_; + JSTaggedValue framework_program_ {JSTaggedValue::Hole()}; + CString framework_abc_file_name_; + const panda_file::File *framework_panda_file_ {nullptr}; + CVector framework_program_methods_; // VM resources. - CString snapshotFileName_; - ChunkVector nativeMethods_; - ModuleManager *moduleManager_ {nullptr}; - bool optionalLogEnabled_ {false}; + CString snapshot_file_name_; + ChunkVector native_methods_; + ModuleManager *module_manager_ {nullptr}; + bool optional_log_enabled_ {false}; // weak reference need Redirect address - CVector> pandaFileWithProgram_ - GUARDED_BY(pandaFileWithProgramLock_); - mutable os::memory::Mutex pandaFileWithProgramLock_; + CVector> 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}; - CUnorderedMap> extractorCache_; + RuntimeNotificationManager *notification_manager_ {nullptr}; + CUnorderedMap> 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 465de0ea488ef112d8d1247175fc0d8c1b587912..a66f8acec87251be2a2d7e8867aa2f5454b8e0a2 100644 --- a/runtime/frames.h +++ b/runtime/frames.h @@ -174,13 +174,13 @@ public: OptimizedFrameBase() = default; ~OptimizedFrameBase() = default; // NOLINTNEXTLINE(misc-non-private-member-variables-in-classes) - FrameType type; + FrameType type_; // NOLINTNEXTLINE(misc-non-private-member-variables-in-classes) - JSTaggedType *prev; // for llvm :c-fp ; for interrupt: thread-fp for gc + JSTaggedType *prev_; // for llvm :c-fp ; for interrupt: thread-fp for gc static OptimizedFrameBase *GetFrameFromSp(JSTaggedType *sp) { return reinterpret_cast(reinterpret_cast(sp) - - MEMBER_OFFSET(OptimizedFrameBase, prev)); + MEMBER_OFFSET(OptimizedFrameBase, prev_)); } DEFAULT_MOVE_SEMANTIC(OptimizedFrameBase); DEFAULT_COPY_SEMANTIC(OptimizedFrameBase); @@ -191,13 +191,13 @@ public: OptimizedEntryFrame() = default; ~OptimizedEntryFrame() = default; // NOLINTNEXTLINE(misc-non-private-member-variables-in-classes) - JSTaggedType *prevInterpretedFrameFp; + JSTaggedType *prev_interpreted_frame_fp_; // NOLINTNEXTLINE(misc-non-private-member-variables-in-classes) - OptimizedFrameBase base; + OptimizedFrameBase base_; static OptimizedEntryFrame *GetFrameFromSp(JSTaggedType *sp) { return reinterpret_cast(reinterpret_cast(sp) - - MEMBER_OFFSET(OptimizedEntryFrame, base.prev)); + MEMBER_OFFSET(OptimizedEntryFrame, base_.prev_)); } DEFAULT_MOVE_SEMANTIC(OptimizedEntryFrame); DEFAULT_COPY_SEMANTIC(OptimizedEntryFrame); @@ -208,10 +208,10 @@ public: InterpretedFrameBase() = default; ~InterpretedFrameBase() = default; // NOLINTNEXTLINE(misc-non-private-member-variables-in-classes) - JSTaggedType *prev; // for llvm :c-fp ; for interrupt: thread-fp for gc + JSTaggedType *prev_; // for llvm :c-fp ; for interrupt: thread-fp for gc // NOLINTNEXTLINE(misc-non-private-member-variables-in-classes) - FrameType type; + FrameType type_; DEFAULT_MOVE_SEMANTIC(InterpretedFrameBase); DEFAULT_COPY_SEMANTIC(InterpretedFrameBase); }; @@ -219,48 +219,48 @@ public: // align with 8 // NOLINTNEXTLINE(cppcoreguidelines-pro-type-member-init) struct InterpretedFrame { - const uint8_t *pc; - JSTaggedType *sp; + const uint8_t *pc_; + JSTaggedType *sp_; // aligned with 8 bits - alignas(sizeof(uint64_t)) JSTaggedValue constpool; - JSTaggedValue function; - JSTaggedValue profileTypeInfo; - JSTaggedValue acc; - JSTaggedValue env; - InterpretedFrameBase base; + alignas(sizeof(uint64_t)) JSTaggedValue constpool_; + JSTaggedValue function_; + JSTaggedValue profile_type_info_; + JSTaggedValue acc_; + JSTaggedValue env_; + InterpretedFrameBase base_; static InterpretedFrame *GetFrameFromSp(JSTaggedType *sp) { // 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 - uintptr_t sp; - uintptr_t fp; - uint64_t patchId; + FrameType type_; + JSTaggedType *prev_fp_; // set cursp here + uintptr_t sp_; + uintptr_t fp_; + 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/hprof/heap_profiler.cpp b/runtime/hprof/heap_profiler.cpp index 0f3178b203db82606a12600acecc68b812335fdc..cfcf723c474c105094d7181f1db2f17f1abd66e5 100644 --- a/runtime/hprof/heap_profiler.cpp +++ b/runtime/hprof/heap_profiler.cpp @@ -30,8 +30,8 @@ namespace panda::ecmascript { HeapProfiler::~HeapProfiler() { ClearSnapShot(); - const_cast(heap_->GetRegionFactory())->Delete(jsonSerializer_); - jsonSerializer_ = nullptr; + const_cast(heap_->GetRegionFactory())->Delete(json_serializer_); + json_serializer_ = nullptr; } bool HeapProfiler::DumpHeapSnapShot(JSThread *thread, DumpFormat dumpFormat, const std::string &filePath, bool isVmMode) @@ -44,12 +44,12 @@ bool HeapProfiler::DumpHeapSnapShot(JSThread *thread, DumpFormat dumpFormat, con ASSERT(snapShot != nullptr); std::pair realPath = FilePathValid(filePath); if (realPath.first) { - return jsonSerializer_->Serialize(snapShot, realPath.second); + return json_serializer_->Serialize(snapShot, realPath.second); } std::pair realGenPath = FilePathValid(GenDumpFileName(dumpFormat)); if (realGenPath.first) { - return jsonSerializer_->Serialize(snapShot, realGenPath.second); + return json_serializer_->Serialize(snapShot, realGenPath.second); } UNREACHABLE(); } @@ -61,19 +61,19 @@ bool HeapProfiler::StartHeapTracking(JSThread *thread, double timeInterval, bool if (snapShot == nullptr) { return false; } - heapTracker_ = std::make_unique(snapShot, timeInterval); - thread->GetEcmaVM()->StartHeapTracking(heapTracker_.get()); - heapTracker_->StartTracing(); + heap_tracker_ = std::make_unique(snapShot, timeInterval); + thread->GetEcmaVM()->StartHeapTracking(heap_tracker_.get()); + heap_tracker_->StartTracing(); return true; } bool HeapProfiler::StopHeapTracking(JSThread *thread, [[maybe_unused]] DumpFormat dumpFormat, const std::string &path) { - if (heapTracker_ == nullptr) { + if (heap_tracker_ == nullptr) { return false; } thread->GetEcmaVM()->StopHeapTracking(); - heapTracker_->StopTracing(); + heap_tracker_->StopTracing(); // check path if (path.empty()) { @@ -89,7 +89,7 @@ bool HeapProfiler::StopHeapTracking(JSThread *thread, [[maybe_unused]] DumpForma return false; } snapShot->FinishSnapShot(); - return jsonSerializer_->Serialize(snapShot, realPath.second); + return json_serializer_->Serialize(snapShot, realPath.second); } std::pair HeapProfiler::FilePathValid(const std::string &filePath) @@ -192,7 +192,7 @@ HeapSnapShot *HeapProfiler::MakeHeapSnapShot(JSThread *thread, SampleType sample void HeapProfiler::AddSnapShot(HeapSnapShot *snapshot) { - if (hprofs_.size() >= MAX_NUM_HPROF) { + if (hprofs_.size() >= max_num_hprof_) { ClearSnapShot(); } ASSERT(snapshot != nullptr); diff --git a/runtime/hprof/heap_profiler.h b/runtime/hprof/heap_profiler.h index 4395cb51492e3796ea280c724291c3e16e518dcc..dde84c3abd3e07f418e7d31a4e8f3f3240990ffe 100644 --- a/runtime/hprof/heap_profiler.h +++ b/runtime/hprof/heap_profiler.h @@ -32,8 +32,8 @@ public: NO_COPY_SEMANTIC(HeapProfiler); explicit HeapProfiler(const Heap *heap) : heap_(heap) { - jsonSerializer_ = const_cast(heap->GetRegionFactory())->New(); - if (UNLIKELY(jsonSerializer_ == nullptr)) { + json_serializer_ = const_cast(heap->GetRegionFactory())->New(); + if (UNLIKELY(json_serializer_ == nullptr)) { LOG_ECMA(FATAL) << "alloc snapshot json serializer failed"; UNREACHABLE(); } @@ -66,10 +66,10 @@ private: CString GetTimeStamp(); void ClearSnapShot(); - const size_t MAX_NUM_HPROF = 5; // ~10MB + const size_t max_num_hprof_ = 5; // ~10MB CVector hprofs_; - HeapSnapShotJSONSerializer *jsonSerializer_ {nullptr}; - std::unique_ptr heapTracker_; + HeapSnapShotJSONSerializer *json_serializer_ {nullptr}; + std::unique_ptr heap_tracker_; const Heap *heap_; }; } // namespace panda::ecmascript diff --git a/runtime/hprof/heap_profiler_interface.cpp b/runtime/hprof/heap_profiler_interface.cpp index 9cb907f0fc3bcdacdb4bf9a1d714f013f702ff1f..f7d4e31cdcfbd1f3268fe434b471145953668c23 100644 --- a/runtime/hprof/heap_profiler_interface.cpp +++ b/runtime/hprof/heap_profiler_interface.cpp @@ -18,13 +18,13 @@ #include "plugins/ecmascript/runtime/mem/heap.h" namespace panda::ecmascript { -HeapProfilerInterface *HeapProfilerInterface::heapProfile_ = nullptr; +HeapProfilerInterface *HeapProfilerInterface::heap_profile_ = nullptr; HeapProfilerInterface *HeapProfilerInterface::GetInstance(JSThread *thread) { - if (HeapProfilerInterface::heapProfile_ == nullptr) { - heapProfile_ = HeapProfilerInterface::CreateHeapProfiler(thread); + if (HeapProfilerInterface::heap_profile_ == nullptr) { + heap_profile_ = HeapProfilerInterface::CreateHeapProfiler(thread); } - return HeapProfilerInterface::heapProfile_; + return HeapProfilerInterface::heap_profile_; } void HeapProfilerInterface::DumpHeapSnapShot(JSThread *thread, DumpFormat dumpFormat, const std::string &filePath, diff --git a/runtime/hprof/heap_profiler_interface.h b/runtime/hprof/heap_profiler_interface.h index a338c65fc76d86608614b659ed4573999f0d50b3..f40fccf2e8a42ebf5a8e0b8de327758c1c7baf26 100644 --- a/runtime/hprof/heap_profiler_interface.h +++ b/runtime/hprof/heap_profiler_interface.h @@ -42,7 +42,7 @@ public: NO_COPY_SEMANTIC(HeapProfilerInterface); private: - static HeapProfilerInterface *heapProfile_; + static HeapProfilerInterface *heap_profile_; }; } // namespace panda::ecmascript #endif // ECMASCRIPT_HPROF_HEAP_PROFILER_INTERFACE_H diff --git a/runtime/hprof/heap_snapshot.cpp b/runtime/hprof/heap_snapshot.cpp index 74bf6b08ebc1d6e0dfe2eb7f6e8a03ec464fcec4..f22cb0252b005f5cdb950d7b2555e10b55a541bb 100644 --- a/runtime/hprof/heap_snapshot.cpp +++ b/runtime/hprof/heap_snapshot.cpp @@ -37,7 +37,7 @@ namespace panda::ecmascript { CString *HeapSnapShot::GetString(const CString &as) { - return stringTable_.GetString(as); + return string_table_.GetString(as); } Node *Node::NewNode(const Heap *heap, size_t id, size_t index, CString *name, NodeType type, size_t size, @@ -85,8 +85,8 @@ bool HeapSnapShot::BuildUp(JSThread *thread) bool HeapSnapShot::Verify() { - GetString(CString("HeapVerify:").append(ToCString(totalNodesSize_))); - return (edgeCount_ > nodeCount_) && (totalNodesSize_ > 0); + GetString(CString("HeapVerify:").append(ToCString(total_nodes_size_))); + return (edge_count_ > node_count_) && (total_nodes_size_ > 0); } void HeapSnapShot::PrepareSnapShot() @@ -120,7 +120,7 @@ bool HeapSnapShot::FinishSnapShot() void HeapSnapShot::RecordSampleTime() { - timeStamps_.emplace_back(sequenceId_); + time_stamps_.emplace_back(sequence_id_); } void HeapSnapShot::AddNode(uintptr_t address) @@ -131,7 +131,7 @@ void HeapSnapShot::AddNode(uintptr_t address) void HeapSnapShot::MoveNode(uintptr_t address, uintptr_t forward_address) { int sequenceId = -1; - Node *node = entryMap_.FindAndEraseNode(address); + Node *node = entry_map_.FindAndEraseNode(address); if (node != nullptr) { sequenceId = node->GetId(); EraseNodeUnique(node); @@ -388,7 +388,7 @@ Node *HeapSnapShot::GenerateNode(JSThread *thread, JSTaggedValue entry, int sequ { Node *node = nullptr; if (sequenceId == -1) { - sequenceId = sequenceId_ + SEQ_STEP; + sequenceId = sequence_id_ + SEQ_STEP; } if (entry.IsHeapObject()) { if (entry.IsWeak()) { @@ -404,19 +404,19 @@ Node *HeapSnapShot::GenerateNode(JSThread *thread, JSTaggedValue entry, int sequ auto *baseClass = obj->GetClass(); if (baseClass != nullptr) { auto name = GenerateNodeName(thread, obj); - node = Node::NewNode(heap_, sequenceId, nodeCount_, name, GenerateNodeType(obj.GetObject()), + node = Node::NewNode(heap_, sequenceId, node_count_, name, GenerateNodeType(obj.GetObject()), obj->GetClass()->SizeFromJSHClass(obj.GetObject()), obj.GetObject()); - Node *existNode = entryMap_.FindOrInsertNode(node); // Fast Index + Node *existNode = entry_map_.FindOrInsertNode(node); // Fast Index if (existNode == node) { - if (sequenceId == sequenceId_ + SEQ_STEP) { - sequenceId_ = sequenceId; // Odd Digit + if (sequenceId == sequence_id_ + SEQ_STEP) { + sequence_id_ = sequenceId; // Odd Digit } InsertNodeUnique(node); - ASSERT(entryMap_.FindEntry(node->GetAddress())->GetAddress() == node->GetAddress()); + ASSERT(entry_map_.FindEntry(node->GetAddress())->GetAddress() == node->GetAddress()); } else { existNode->SetLive(true); - ASSERT(entryMap_.FindEntry(node->GetAddress())->GetAddress() == node->GetAddress()); + ASSERT(entry_map_.FindEntry(node->GetAddress())->GetAddress() == node->GetAddress()); const_cast(heap_->GetRegionFactory())->Delete(node); return nullptr; } @@ -446,10 +446,10 @@ Node *HeapSnapShot::GenerateNode(JSThread *thread, JSTaggedValue entry, int sequ } node = - Node::NewNode(heap_, sequenceId, nodeCount_, GetString(primitiveName), NodeType::JS_PRIMITIVE_REF, 0, obj); - entryMap_.InsertEntry(node); // Fast Index - if (sequenceId == sequenceId_ + SEQ_STEP) { - sequenceId_ = sequenceId; // Odd Digit + Node::NewNode(heap_, sequenceId, node_count_, GetString(primitiveName), NodeType::JS_PRIMITIVE_REF, 0, obj); + entry_map_.InsertEntry(node); // Fast Index + if (sequenceId == sequence_id_ + SEQ_STEP) { + sequence_id_ = sequenceId; // Odd Digit } InsertNodeUnique(node); } @@ -463,18 +463,18 @@ Node *HeapSnapShot::GenerateStringNode(JSTaggedValue entry, int sequenceId) size_t selfsize = originStr->ObjectSize(); CString strContent; strContent.append(EntryVisitor::ConvertKey(entry)); - node = Node::NewNode(heap_, sequenceId, nodeCount_, GetString(strContent), NodeType::PRIM_STRING, selfsize, + node = Node::NewNode(heap_, sequenceId, node_count_, GetString(strContent), NodeType::PRIM_STRING, selfsize, entry.GetTaggedObject()); - Node *existNode = entryMap_.FindOrInsertNode(node); // Fast Index + Node *existNode = entry_map_.FindOrInsertNode(node); // Fast Index if (existNode == node) { - if (sequenceId == sequenceId_ + SEQ_STEP) { - sequenceId_ = sequenceId; // Odd Digit + if (sequenceId == sequence_id_ + SEQ_STEP) { + sequence_id_ = sequenceId; // Odd Digit } InsertNodeUnique(node); } else { existNode->SetLive(true); } - ASSERT(entryMap_.FindEntry(node->GetAddress())->GetAddress() == node->GetAddress()); + ASSERT(entry_map_.FindEntry(node->GetAddress())->GetAddress() == node->GetAddress()); if (existNode != node) { const_cast(heap_->GetRegionFactory())->Delete(node); return nullptr; @@ -491,22 +491,22 @@ void HeapSnapShot::FillEdges(JSThread *thread) ASSERT(*iter != nullptr); auto *objFrom = reinterpret_cast((*iter)->GetAddress()); std::vector> nameResources; - JSTaggedValue(objFrom).DumpForSnapshot(thread, nameResources, isVmMode_); + JSTaggedValue(objFrom).DumpForSnapshot(thread, nameResources, is_vm_mode_); JSTaggedValue objValue(objFrom); for (auto const &it : nameResources) { JSTaggedValue toValue = it.second; Node *entryTo = nullptr; if (toValue.IsHeapObject()) { auto *to = reinterpret_cast(toValue.GetHeapObject()); - entryTo = entryMap_.FindEntry(Node::NewAddress(to)); + entryTo = entry_map_.FindEntry(Node::NewAddress(to)); } if (entryTo == nullptr) { entryTo = GenerateNode(thread, toValue); } if (entryTo != nullptr) { - Edge *edge = Edge::NewEdge(heap_, edgeCount_, EdgeType::DEFAULT, *iter, entryTo, GetString(it.first)); + Edge *edge = Edge::NewEdge(heap_, edge_count_, EdgeType::DEFAULT, *iter, entryTo, GetString(it.first)); InsertEdgeUnique(edge); - (*iter)->IncEdgeCount(); // Update Node's edgeCount_ here + (*iter)->IncEdgeCount(); // Update Node's edge_count_ here } } iter++; @@ -525,9 +525,9 @@ void HeapSnapShot::FillEdges(JSThread *thread) } else { valueName.append("NaN"); } - Edge *edge = Edge::NewEdge(heap_, edgeCount_, EdgeType::DEFAULT, (*iter), (*iter), GetString(valueName)); + Edge *edge = Edge::NewEdge(heap_, edge_count_, EdgeType::DEFAULT, (*iter), (*iter), GetString(valueName)); InsertEdgeUnique(edge); - (*iter)->IncEdgeCount(); // Update Node's edgeCount_ here + (*iter)->IncEdgeCount(); // Update Node's edge_count_ here } iter++; } @@ -557,7 +557,7 @@ Node *HeapSnapShot::InsertNodeUnique(Node *node) { AccumulateNodeSize(node->GetSelfSize()); nodes_.emplace_back(node); - nodeCount_++; + node_count_++; return node; } @@ -567,37 +567,37 @@ void HeapSnapShot::EraseNodeUnique(Node *node) if (iter != nodes_.end()) { DecreaseNodeSize(node->GetSelfSize()); nodes_.erase(iter); - nodeCount_--; + node_count_--; } } Edge *HeapSnapShot::InsertEdgeUnique(Edge *edge) { edges_.emplace_back(edge); - edgeCount_++; + edge_count_++; return edge; } void HeapSnapShot::AddSyntheticRoot(JSThread *thread) { Node *syntheticRoot = - Node::NewNode(heap_, 1, nodeCount_, GetString("SyntheticRoot"), NodeType::SYNTHETIC, 0, nullptr); + Node::NewNode(heap_, 1, node_count_, GetString("SyntheticRoot"), NodeType::SYNTHETIC, 0, nullptr); InsertNodeAt(0, syntheticRoot); int edgeOffset = 0; // NOLINTNEXTLINE(cppcoreguidelines-macro-usage) -#define ROOT_EDGE_BUILDER_CORE(type, slot) \ - JSTaggedValue value(slot.GetTaggedType()); \ - if (value.IsHeapObject()) { \ - TaggedObject *root = value.GetTaggedObject(); \ - Node *rootNode = entryMap_.FindEntry(Node::NewAddress(root)); \ - if (rootNode != nullptr) { \ - Edge *edge = \ - Edge::NewEdge(heap_, edgeCount_, EdgeType::SHORTCUT, syntheticRoot, rootNode, GetString("-subroot-")); \ - InsertEdgeAt(edgeOffset, edge); \ - edgeOffset++; \ - syntheticRoot->IncEdgeCount(); \ - } \ +#define ROOT_EDGE_BUILDER_CORE(type, slot) \ + JSTaggedValue value(slot.GetTaggedType()); \ + if (value.IsHeapObject()) { \ + TaggedObject *root = value.GetTaggedObject(); \ + Node *rootNode = entry_map_.FindEntry(Node::NewAddress(root)); \ + if (rootNode != nullptr) { \ + Edge *edge = Edge::NewEdge(heap_, edge_count_, EdgeType::SHORTCUT, syntheticRoot, rootNode, \ + GetString("-subroot-")); \ + InsertEdgeAt(edgeOffset, edge); \ + edgeOffset++; \ + syntheticRoot->IncEdgeCount(); \ + } \ } RootVisitor rootEdgeBuilder = [this, syntheticRoot, &edgeOffset]([[maybe_unused]] Root type, ObjectSlot slot) { @@ -611,7 +611,7 @@ void HeapSnapShot::AddSyntheticRoot(JSThread *thread) } }; #undef ROOT_EDGE_BUILDER_CORE - rootVisitor_.VisitHeapRoots(thread, rootEdgeBuilder, rootRangeEdgeBuilder); + root_visitor_.VisitHeapRoots(thread, rootEdgeBuilder, rootRangeEdgeBuilder); int reindex = 0; for (Node *node : nodes_) { @@ -626,7 +626,7 @@ Node *HeapSnapShot::InsertNodeAt(size_t pos, Node *node) auto iter = nodes_.begin(); std::advance(iter, pos); nodes_.insert(iter, node); - nodeCount_++; + node_count_++; return node; } @@ -634,7 +634,7 @@ Edge *HeapSnapShot::InsertEdgeAt(size_t pos, Edge *edge) { ASSERT(edge != nullptr); edges_.insert(edges_.begin() + pos, edge); - edgeCount_++; + edge_count_++; return edge; } @@ -667,8 +667,8 @@ CString EntryVisitor::ConvertKey(JSTaggedValue key) Node *HeapEntryMap::FindOrInsertNode(Node *node) { ASSERT(node != nullptr); - auto it = nodesMap_.find(node->GetAddress()); - if (it != nodesMap_.end()) { + auto it = nodes_map_.find(node->GetAddress()); + if (it != nodes_map_.end()) { return it->second; } InsertEntry(node); @@ -677,11 +677,11 @@ Node *HeapEntryMap::FindOrInsertNode(Node *node) Node *HeapEntryMap::FindAndEraseNode(Address addr) { - auto it = nodesMap_.find(addr); - if (it != nodesMap_.end()) { + auto it = nodes_map_.find(addr); + if (it != nodes_map_.end()) { Node *node = it->second; - nodesMap_.erase(it); - nodeEntryCount_--; + nodes_map_.erase(it); + node_entry_count_--; return node; } return nullptr; @@ -689,14 +689,14 @@ Node *HeapEntryMap::FindAndEraseNode(Address addr) Node *HeapEntryMap::FindEntry(Address addr) { - auto it = nodesMap_.find(addr); - return it != nodesMap_.end() ? it->second : nullptr; + auto it = nodes_map_.find(addr); + return it != nodes_map_.end() ? it->second : nullptr; } void HeapEntryMap::InsertEntry(Node *node) { - nodeEntryCount_++; - nodesMap_.insert(std::make_pair(node->GetAddress(), node)); + node_entry_count_++; + nodes_map_.insert(std::make_pair(node->GetAddress(), node)); } FrontType NodeTypeConverter::Convert(NodeType type) diff --git a/runtime/hprof/heap_snapshot.h b/runtime/hprof/heap_snapshot.h index f3992946bf6e00403de0d6610083a7700b922d7b..89f11324546f88a8b6c5c305f8a5136602572e99 100644 --- a/runtime/hprof/heap_snapshot.h +++ b/runtime/hprof/heap_snapshot.h @@ -52,9 +52,9 @@ public: name_(name), type_(type), size_(size), - traceId_(traceId), + trace_id_(traceId), address_(address), - isLive_(isLive) + is_live_(isLive) { } uint64_t GetId() const @@ -84,15 +84,15 @@ public: } size_t GetEdgeCount() const { - return edgeCount_; + return edge_count_; } void IncEdgeCount() { - edgeCount_++; + edge_count_++; } uint64_t GetStackTraceId() const { - return traceId_; + return trace_id_; } Address GetAddress() const { @@ -100,11 +100,11 @@ public: } bool IsLive() const { - return isLive_; + return is_live_; } void SetLive(bool isLive) { - isLive_ = isLive; + is_live_ = isLive; } static Node *NewNode(const Heap *heap, size_t id, size_t index, CString *name, NodeType type, size_t size, TaggedObject *entry, bool isLive = true); @@ -125,16 +125,16 @@ private: CString *name_ {nullptr}; NodeType type_ {NodeType::INVALID}; size_t size_ {0}; - size_t edgeCount_ {0}; - uint64_t traceId_ {0}; + size_t edge_count_ {0}; + uint64_t trace_id_ {0}; Address address_ {0x0}; - bool isLive_ {true}; + bool is_live_ {true}; }; class Edge { public: explicit Edge(uint64_t id, EdgeType type, Node *from, Node *to, CString *name) - : id_(id), edgeType_(type), from_(from), to_(to), name_(name) + : id_(id), edge_type_(type), from_(from), to_(to), name_(name) { } uint64_t GetId() const @@ -143,7 +143,7 @@ public: } EdgeType GetType() const { - return edgeType_; + return edge_type_; } const Node *GetFrom() const { @@ -178,7 +178,7 @@ public: private: uint64_t id_ {-1ULL}; - EdgeType edgeType_ {EdgeType::DEFAULT}; + EdgeType edge_type_ {EdgeType::DEFAULT}; Node *from_ {nullptr}; Node *to_ {nullptr}; CString *name_ {nullptr}; @@ -186,7 +186,7 @@ private: class TimeStamp { public: - explicit TimeStamp(int sequenceId) : lastSequenceId_(sequenceId), timeStampUs_(TimeStamp::Now()) {} + explicit TimeStamp(int sequenceId) : last_sequence_id_(sequenceId), time_stamp_us_(TimeStamp::Now()) {} ~TimeStamp() = default; DEFAULT_MOVE_SEMANTIC(TimeStamp); @@ -194,12 +194,12 @@ public: int GetLastSequenceId() const { - return lastSequenceId_; + return last_sequence_id_; } int64_t GetTimeStamp() const { - return timeStampUs_; + return time_stamp_us_; } private: @@ -211,8 +211,8 @@ private: return tv.tv_usec + tv.tv_sec * THOUSAND * THOUSAND; } - int lastSequenceId_ {0}; - int64_t timeStampUs_ {0}; + int last_sequence_id_ {0}; + int64_t time_stamp_us_ {0}; }; class HeapEntryMap { @@ -226,17 +226,17 @@ public: Node *FindEntry(Address addr); size_t GetCapcity() const { - return nodesMap_.size(); + return nodes_map_.size(); } size_t GetEntryCount() const { - return nodeEntryCount_; + return node_entry_count_; } void InsertEntry(Node *node); private: - size_t nodeEntryCount_ {0}; - CUnorderedMap nodesMap_ {}; + size_t node_entry_count_ {0}; + CUnorderedMap nodes_map_ {}; }; class HeapSnapShot { @@ -245,7 +245,7 @@ public: NO_MOVE_SEMANTIC(HeapSnapShot); NO_COPY_SEMANTIC(HeapSnapShot); explicit HeapSnapShot(JSThread *thread, const Heap *heap, const bool isVmMode) - : stringTable_(heap), thread_(thread), heap_(heap), isVmMode_(isVmMode) + : string_table_(heap), thread_(thread), heap_(heap), is_vm_mode_(isVmMode) { } ~HeapSnapShot(); @@ -261,28 +261,28 @@ public: const CVector &GetTimeStamps() const { - return timeStamps_; + return time_stamps_; } size_t GetNodeCount() const { - return nodeCount_; + return node_count_; } size_t GetEdgeCount() const { - return edgeCount_; + return edge_count_; } size_t GetTotalNodeSize() const { - return totalNodesSize_; + return total_nodes_size_; } void AccumulateNodeSize(size_t size) { - totalNodesSize_ += size; + total_nodes_size_ += size; } void DecreaseNodeSize(size_t size) { - totalNodesSize_ -= size; + total_nodes_size_ -= size; } CString *GenerateNodeName(JSThread *thread, const JSHandle &entry); NodeType GenerateNodeType(TaggedObject *entry); @@ -296,14 +296,14 @@ public: } const StringHashMap *GetEcmaStringTable() const { - return &stringTable_; + return &string_table_; } CString *GetString(const CString &as); bool IsInVmMode() const { - return isVmMode_; + return is_vm_mode_; } private: @@ -321,19 +321,19 @@ private: Node *InsertNodeAt(size_t pos, Node *node); Edge *InsertEdgeAt(size_t pos, Edge *edge); - StringHashMap stringTable_; + StringHashMap string_table_; CList nodes_ {}; CVector edges_ {}; - CVector timeStamps_ {}; - std::atomic_int sequenceId_ {1}; // 1 Reversed for SyntheticRoot - int nodeCount_ {0}; - int edgeCount_ {0}; - int totalNodesSize_ {0}; - HeapEntryMap entryMap_; - panda::ecmascript::HeapRootVisitor rootVisitor_; + CVector time_stamps_ {}; + std::atomic_int sequence_id_ {1}; // 1 Reversed for SyntheticRoot + int node_count_ {0}; + int edge_count_ {0}; + int total_nodes_size_ {0}; + HeapEntryMap entry_map_; + panda::ecmascript::HeapRootVisitor root_visitor_; JSThread *thread_; const Heap *heap_; - bool isVmMode_ {true}; + bool is_vm_mode_ {true}; }; class EntryVisitor { diff --git a/runtime/hprof/heap_snapshot_json_serializer.cpp b/runtime/hprof/heap_snapshot_json_serializer.cpp index a811dd6278cffeae2df54971326e0f0cc78c0f85..af9a8a55322836e5893aabb6ef65fb6f8e60b9de 100644 --- a/runtime/hprof/heap_snapshot_json_serializer.cpp +++ b/runtime/hprof/heap_snapshot_json_serializer.cpp @@ -23,10 +23,10 @@ bool HeapSnapShotJSONSerializer::Serialize(HeapSnapShot *snapShot, const CString { // Serialize Node/Edge/String-Table LOG(ERROR, RUNTIME) << "HeapSnapShotJSONSerializer::Serialize begin"; - snapShot_ = snapShot; - ASSERT(snapShot_->GetNodes() != nullptr && snapShot_->GetEdges() != nullptr && - snapShot_->GetEcmaStringTable() != nullptr); - stringBuffer_.str(""); // Clear Buffer + snap_shot_ = snapShot; + ASSERT(snap_shot_->GetNodes() != nullptr && snap_shot_->GetEdges() != nullptr && + snap_shot_->GetEcmaStringTable() != nullptr); + string_buffer_.str(""); // Clear Buffer SerializeSnapShotHeader(); // 1. SerializeNodes(); // 2. @@ -45,62 +45,62 @@ bool HeapSnapShotJSONSerializer::Serialize(HeapSnapShot *snapShot, const CString void HeapSnapShotJSONSerializer::SerializeSnapShotHeader() { - stringBuffer_ << "{\"snapshot\":\n"; // 1. - stringBuffer_ << "{\"meta\":\n"; // 2. + string_buffer_ << "{\"snapshot\":\n"; // 1. + string_buffer_ << "{\"meta\":\n"; // 2. // NOLINTNEXTLINE(modernize-raw-string-literal) - stringBuffer_ << "{\"node_fields\":[\"type\",\"name\",\"id\",\"self_size\",\"edge_count\",\"trace_node_id\","; - stringBuffer_ << "\"detachedness\"],\n"; // 3. + string_buffer_ << "{\"node_fields\":[\"type\",\"name\",\"id\",\"self_size\",\"edge_count\",\"trace_node_id\","; + string_buffer_ << "\"detachedness\"],\n"; // 3. // NOLINTNEXTLINE(modernize-raw-string-literal) - stringBuffer_ << "\"node_types\":[[\"hidden\",\"array\",\"string\",\"object\",\"code\",\"closure\",\"regexp\","; + string_buffer_ << "\"node_types\":[[\"hidden\",\"array\",\"string\",\"object\",\"code\",\"closure\",\"regexp\","; // NOLINTNEXTLINE(modernize-raw-string-literal) - stringBuffer_ << "\"number\",\"native\",\"synthetic\",\"concatenated string\",\"slicedstring\",\"symbol\","; + string_buffer_ << "\"number\",\"native\",\"synthetic\",\"concatenated string\",\"slicedstring\",\"symbol\","; // NOLINTNEXTLINE(modernize-raw-string-literal) - stringBuffer_ << "\"bigint\"],\"string\",\"number\",\"number\",\"number\",\"number\",\"number\"],\n"; // 4. + string_buffer_ << "\"bigint\"],\"string\",\"number\",\"number\",\"number\",\"number\",\"number\"],\n"; // 4. // NOLINTNEXTLINE(modernize-raw-string-literal) - stringBuffer_ << "\"edge_fields\":[\"type\",\"name_or_index\",\"to_node\"],\n"; // 5. + string_buffer_ << "\"edge_fields\":[\"type\",\"name_or_index\",\"to_node\"],\n"; // 5. // NOLINTNEXTLINE(modernize-raw-string-literal) - stringBuffer_ << "\"edge_types\":[[\"context\",\"element\",\"property\",\"internal\",\"hidden\",\"shortcut\","; + string_buffer_ << "\"edge_types\":[[\"context\",\"element\",\"property\",\"internal\",\"hidden\",\"shortcut\","; // NOLINTNEXTLINE(modernize-raw-string-literal) - stringBuffer_ << "\"weak\"],\"string_or_number\",\"node\"],\n"; // 6. + string_buffer_ << "\"weak\"],\"string_or_number\",\"node\"],\n"; // 6. // NOLINTNEXTLINE(modernize-raw-string-literal) - stringBuffer_ << "\"trace_function_info_fields\":[\"function_id\",\"name\",\"script_name\",\"script_id\","; + string_buffer_ << "\"trace_function_info_fields\":[\"function_id\",\"name\",\"script_name\",\"script_id\","; // NOLINTNEXTLINE(modernize-raw-string-literal) - stringBuffer_ << "\"line\",\"column\"],\n"; // 7. + string_buffer_ << "\"line\",\"column\"],\n"; // 7. // NOLINTNEXTLINE(modernize-raw-string-literal) - stringBuffer_ << "\"trace_node_fields\":[\"id\",\"function_info_index\",\"count\",\"size\",\"children\"],\n"; + string_buffer_ << "\"trace_node_fields\":[\"id\",\"function_info_index\",\"count\",\"size\",\"children\"],\n"; // NOLINTNEXTLINE(modernize-raw-string-literal) - stringBuffer_ << "\"sample_fields\":[\"timestamp_us\",\"last_assigned_id\"],\n"; // 9. + string_buffer_ << "\"sample_fields\":[\"timestamp_us\",\"last_assigned_id\"],\n"; // 9. // NOLINTNEXTLINE(modernize-raw-string-literal) - stringBuffer_ << "\"location_fields\":[\"object_index\",\"script_id\",\"line\",\"column\"]},\n"; // 10. - stringBuffer_ << "\"node_count\":" << snapShot_->GetNodeCount() << ",\n"; // 11. - stringBuffer_ << "\"edge_count\":" << snapShot_->GetEdgeCount() << ",\n"; // 12. - stringBuffer_ << "\"trace_function_count\":" - << "0\n"; // 13. - stringBuffer_ << "},\n"; // 14. + string_buffer_ << "\"location_fields\":[\"object_index\",\"script_id\",\"line\",\"column\"]},\n"; // 10. + string_buffer_ << "\"node_count\":" << snap_shot_->GetNodeCount() << ",\n"; // 11. + string_buffer_ << "\"edge_count\":" << snap_shot_->GetEdgeCount() << ",\n"; // 12. + string_buffer_ << "\"trace_function_count\":" + << "0\n"; // 13. + string_buffer_ << "},\n"; // 14. } void HeapSnapShotJSONSerializer::SerializeNodes() { - const CList *nodes = snapShot_->GetNodes(); - const StringHashMap *stringTable = snapShot_->GetEcmaStringTable(); + const CList *nodes = snap_shot_->GetNodes(); + const StringHashMap *stringTable = snap_shot_->GetEcmaStringTable(); ASSERT(nodes != nullptr); - stringBuffer_ << "\"nodes\":["; // Section Header + string_buffer_ << "\"nodes\":["; // Section Header size_t i = 0; for (auto *node : *nodes) { if (i > 0) { - stringBuffer_ << ","; // add comma except first line + string_buffer_ << ","; // add comma except first line } - stringBuffer_ << static_cast(NodeTypeConverter::Convert(node->GetType())) << ","; // 1. - stringBuffer_ << stringTable->GetStringId(node->GetName()) << ","; // 2. - stringBuffer_ << node->GetId() << ","; // 3. - stringBuffer_ << node->GetSelfSize() << ","; // 4. - stringBuffer_ << node->GetEdgeCount() << ","; // 5. - stringBuffer_ << node->GetStackTraceId() << ","; // 6. + string_buffer_ << static_cast(NodeTypeConverter::Convert(node->GetType())) << ","; // 1. + string_buffer_ << stringTable->GetStringId(node->GetName()) << ","; // 2. + string_buffer_ << node->GetId() << ","; // 3. + string_buffer_ << node->GetSelfSize() << ","; // 4. + string_buffer_ << node->GetEdgeCount() << ","; // 5. + string_buffer_ << node->GetStackTraceId() << ","; // 6. if (i == nodes->size() - 1) { // add comma at last the line - stringBuffer_ << "0" - << "],\n"; // 7. detachedness default + string_buffer_ << "0" + << "],\n"; // 7. detachedness default } else { - stringBuffer_ << "0\n"; // 7. + string_buffer_ << "0\n"; // 7. } i++; } @@ -108,22 +108,22 @@ void HeapSnapShotJSONSerializer::SerializeNodes() void HeapSnapShotJSONSerializer::SerializeEdges() { - const CVector *edges = snapShot_->GetEdges(); - const StringHashMap *stringTable = snapShot_->GetEcmaStringTable(); + const CVector *edges = snap_shot_->GetEdges(); + const StringHashMap *stringTable = snap_shot_->GetEcmaStringTable(); ASSERT(edges != nullptr); - stringBuffer_ << "\"edges\":["; + string_buffer_ << "\"edges\":["; size_t i = 0; for (auto *edge : *edges) { if (i > 0) { // add comma except the first line - stringBuffer_ << ","; + string_buffer_ << ","; } - stringBuffer_ << static_cast(edge->GetType()) << ","; // 1. - stringBuffer_ << stringTable->GetStringId(edge->GetName()) << ","; // 2. Use StringId + string_buffer_ << static_cast(edge->GetType()) << ","; // 1. + string_buffer_ << stringTable->GetStringId(edge->GetName()) << ","; // 2. Use StringId if (i == edges->size() - 1) { // add comma at last the line - stringBuffer_ << edge->GetTo()->GetIndex() * Node::NODE_FIELD_COUNT << "],\n"; // 3. + string_buffer_ << edge->GetTo()->GetIndex() * Node::NODE_FIELD_COUNT << "],\n"; // 3. } else { - stringBuffer_ << edge->GetTo()->GetIndex() * Node::NODE_FIELD_COUNT << "\n"; // 3. + string_buffer_ << edge->GetTo()->GetIndex() * Node::NODE_FIELD_COUNT << "\n"; // 3. } i++; } @@ -131,76 +131,76 @@ void HeapSnapShotJSONSerializer::SerializeEdges() void HeapSnapShotJSONSerializer::SerializeTraceFunctionInfo() { - stringBuffer_ << "\"trace_function_infos\":[],\n"; // Empty + string_buffer_ << "\"trace_function_infos\":[],\n"; // Empty } void HeapSnapShotJSONSerializer::SerializeTraceTree() { - stringBuffer_ << "\"trace_tree\":[],\n"; // Empty + string_buffer_ << "\"trace_tree\":[],\n"; // Empty } void HeapSnapShotJSONSerializer::SerializeSamples() { - stringBuffer_ << "\"samples\":["; - const CVector &timeStamps = snapShot_->GetTimeStamps(); + string_buffer_ << "\"samples\":["; + const CVector &timeStamps = snap_shot_->GetTimeStamps(); if (!timeStamps.empty()) { auto firstTimeStamp = timeStamps[0]; bool isFirst = true; for (auto timeStamp : timeStamps) { if (!isFirst) { - stringBuffer_ << "\n, "; + string_buffer_ << "\n, "; } else { isFirst = false; } - stringBuffer_ << timeStamp.GetTimeStamp() - firstTimeStamp.GetTimeStamp() << ", "; - stringBuffer_ << timeStamp.GetLastSequenceId(); + string_buffer_ << timeStamp.GetTimeStamp() - firstTimeStamp.GetTimeStamp() << ", "; + string_buffer_ << timeStamp.GetLastSequenceId(); } } - stringBuffer_ << "],\n"; + string_buffer_ << "],\n"; } void HeapSnapShotJSONSerializer::SerializeLocations() { - stringBuffer_ << "\"locations\":[],\n"; + string_buffer_ << "\"locations\":[],\n"; } void HeapSnapShotJSONSerializer::SerializeStringTable() { - const StringHashMap *stringTable = snapShot_->GetEcmaStringTable(); + const StringHashMap *stringTable = snap_shot_->GetEcmaStringTable(); ASSERT(stringTable != nullptr); - stringBuffer_ << "\"strings\":[\"\",\n"; - stringBuffer_ << "\"\",\n"; - stringBuffer_ << "\"GC roots\",\n"; + string_buffer_ << "\"strings\":[\"\",\n"; + string_buffer_ << "\"\",\n"; + string_buffer_ << "\"GC roots\",\n"; // StringId Range from 3 size_t capcity = stringTable->GetCapcity(); size_t i = 0; for (auto key : stringTable->GetOrderedKeyStorage()) { if (i == capcity - 1) { - stringBuffer_ << "\"" << *(stringTable->GetStringByKey(key)) << "\"\n"; // No Comma for the last line + string_buffer_ << "\"" << *(stringTable->GetStringByKey(key)) << "\"\n"; // No Comma for the last line } else { - stringBuffer_ << "\"" << *(stringTable->GetStringByKey(key)) << "\",\n"; + string_buffer_ << "\"" << *(stringTable->GetStringByKey(key)) << "\",\n"; } i++; } - stringBuffer_ << "]\n"; + string_buffer_ << "]\n"; } void HeapSnapShotJSONSerializer::SerializerSnapShotClosure() { - stringBuffer_ << "}\n"; + string_buffer_ << "}\n"; } void HeapSnapShotJSONSerializer::WriteJSON(const CString &fileName) { std::string fName(fileName); LOG(ERROR, RUNTIME) << "HeapSnapShotJSONSerializer::WriteJSON" << fName; - outputStream_.open(fName, std::ios::out); - if (!outputStream_.good()) { + output_stream_.open(fName, std::ios::out); + if (!output_stream_.good()) { LOG_ECMA(ERROR) << "open file failed"; return; } - outputStream_ << stringBuffer_.str(); - outputStream_.close(); - outputStream_.clear(); // Make sure the next open operation success + output_stream_ << string_buffer_.str(); + output_stream_.close(); + output_stream_.clear(); // Make sure the next open operation success } } // namespace panda::ecmascript diff --git a/runtime/hprof/heap_snapshot_json_serializer.h b/runtime/hprof/heap_snapshot_json_serializer.h index 84ebf89d31079752b1eceb41686b5ea16d7a5999..06ecb3ee62818049eaff72b622cad25ae0469c8b 100644 --- a/runtime/hprof/heap_snapshot_json_serializer.h +++ b/runtime/hprof/heap_snapshot_json_serializer.h @@ -48,9 +48,9 @@ private: void SerializerSnapShotClosure(); void WriteJSON(const CString &fileName); - fstream outputStream_; - HeapSnapShot *snapShot_ {nullptr}; - stringstream stringBuffer_; + fstream output_stream_; + HeapSnapShot *snap_shot_ {nullptr}; + stringstream string_buffer_; }; } // namespace panda::ecmascript #endif // ECMASCRIPT_HPROF_HEAP_SNAPSHOT_SERIALIZER_H diff --git a/runtime/hprof/heap_tracker.cpp b/runtime/hprof/heap_tracker.cpp index c15fd68e9a46ad0315e8d5c6b95d821fc87b2fe1..cd88dbf8672925f91f7adaf80e1004911131c3a4 100644 --- a/runtime/hprof/heap_tracker.cpp +++ b/runtime/hprof/heap_tracker.cpp @@ -22,23 +22,23 @@ static constexpr int32_t MILLI_TO_MICRO = 1000; void HeapTrackerSample::Run() { - while (!isInterrupt_) { - snapShot_->RecordSampleTime(); - usleep(timeInterval_ * MILLI_TO_MICRO); + while (!is_interrupt_) { + snap_shot_->RecordSampleTime(); + usleep(time_interval_ * MILLI_TO_MICRO); } } void HeapTracker::AllocationEvent(uintptr_t address) { - if (snapShot_ != nullptr) { - snapShot_->AddNode(address); + if (snap_shot_ != nullptr) { + snap_shot_->AddNode(address); } } void HeapTracker::MoveEvent(uintptr_t address, uintptr_t forward_address) { - if (snapShot_ != nullptr) { - snapShot_->MoveNode(address, forward_address); + if (snap_shot_ != nullptr) { + snap_shot_->MoveNode(address, forward_address); } } } // namespace panda::ecmascript diff --git a/runtime/hprof/heap_tracker.h b/runtime/hprof/heap_tracker.h index f0d98e1e35ceb1ca0a524a67a70c69f01ed2c588..5617db3e4c29a649850b45791fb05d3e73b1c899 100644 --- a/runtime/hprof/heap_tracker.h +++ b/runtime/hprof/heap_tracker.h @@ -28,24 +28,24 @@ class HeapSnapShot; class HeapTrackerSample { public: explicit HeapTrackerSample(HeapSnapShot *snapShot, double timeInterval) - : timeInterval_(timeInterval), snapShot_(snapShot) + : time_interval_(timeInterval), snap_shot_(snapShot) { } ~HeapTrackerSample() { - isInterrupt_ = true; + is_interrupt_ = true; } void Start() { - isInterrupt_ = false; + is_interrupt_ = false; thread_ = std::thread(&HeapTrackerSample::Run, this); } void Stop() { - isInterrupt_ = true; + is_interrupt_ = true; if (thread_.joinable()) { thread_.join(); } @@ -58,14 +58,14 @@ public: private: std::thread thread_; - std::atomic_bool isInterrupt_ = true; - double timeInterval_ = 0; - HeapSnapShot *snapShot_; + std::atomic_bool is_interrupt_ = true; + double time_interval_ = 0; + HeapSnapShot *snap_shot_; }; class HeapTracker { public: - HeapTracker(HeapSnapShot *snapShot, double timeInterval) : snapShot_(snapShot), sample_(snapShot, timeInterval) {} + HeapTracker(HeapSnapShot *snapShot, double timeInterval) : snap_shot_(snapShot), sample_(snapShot, timeInterval) {} ~HeapTracker() = default; void StartTracing() @@ -85,7 +85,7 @@ public: NO_MOVE_SEMANTIC(HeapTracker); private: - HeapSnapShot *snapShot_; + HeapSnapShot *snap_shot_; HeapTrackerSample sample_; }; } // namespace panda::ecmascript diff --git a/runtime/hprof/string_hashmap.cpp b/runtime/hprof/string_hashmap.cpp index 43c0218ee50a3eabb830ab11323b4a412f475982..82e7c01665fcbe99d68bfb462f2e0860e688b1a5 100644 --- a/runtime/hprof/string_hashmap.cpp +++ b/runtime/hprof/string_hashmap.cpp @@ -25,15 +25,15 @@ CString *StringHashMap::FindOrInsertString(CString *string) } index_++; hashmap_.insert(std::make_pair(key, string)); - orderedKey_.emplace_back(key); - indexMap_.insert(std::make_pair(key, index_)); + ordered_key_.emplace_back(key); + index_map_.insert(std::make_pair(key, index_)); return string; } StringId StringHashMap::GetStringId(const CString *string) const { - auto it = indexMap_.find(GenerateStringKey(string)); - return it != indexMap_.end() ? it->second : 1; // "" + auto it = index_map_.find(GenerateStringKey(string)); + return it != index_map_.end() ? it->second : 1; // "" } CString *StringHashMap::GetStringByKey(StringKey key) const diff --git a/runtime/hprof/string_hashmap.h b/runtime/hprof/string_hashmap.h index 776a750d67213c7ffc848ee25d7ced41423e6c52..b55402a62501f0b4918e96c0a27eb411a7b729e2 100644 --- a/runtime/hprof/string_hashmap.h +++ b/runtime/hprof/string_hashmap.h @@ -49,7 +49,7 @@ public: */ const CVector &GetOrderedKeyStorage() const { - return orderedKey_; + return ordered_key_; } /* * Get string by its hash key @@ -57,8 +57,8 @@ public: CString *GetStringByKey(StringKey key) const; size_t GetCapcity() const { - ASSERT(orderedKey_.size() == hashmap_.size()); - return orderedKey_.size(); + ASSERT(ordered_key_.size() == hashmap_.size()); + return ordered_key_.size(); } /* * For external call to use this StringTable @@ -74,9 +74,9 @@ private: */ void Clear(); const Heap *heap_; - CVector orderedKey_; // Used for Serialize Order - size_t index_ {2}; // 2: Offset the String-Table Header - CUnorderedMap indexMap_; + CVector ordered_key_; // Used for Serialize Order + size_t index_ {2}; // 2: Offset the String-Table Header + CUnorderedMap index_map_; CUnorderedMap hashmap_; }; } // namespace panda::ecmascript diff --git a/runtime/ic/ic_runtime.cpp b/runtime/ic/ic_runtime.cpp index 3c72fc28d465f8a1a9795a46030da446f47da339..b93798ad5f05aa23db405998d6b494343a672731 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, 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 67a09727227f875801dbe43940b1ba9449f2f065..1f8e780f48e1e44897a3c8f6e1ee3ef25797b3dc 100644 --- a/runtime/ic/ic_runtime.h +++ b/runtime/ic/ic_runtime.h @@ -30,7 +30,7 @@ class ObjectOperator; class ICRuntime { public: ICRuntime(JSThread *thread, JSHandle profileTypeInfo, uint32_t slotId, ICKind kind) - : thread_(thread), icAccessor_(thread, profileTypeInfo, slotId, kind) + : thread_(thread), ic_accessor_(thread, profileTypeInfo, slotId, kind) { } @@ -46,12 +46,12 @@ public: void UpdateReceiverHClass(JSHandle receiverHClass) { - receiverHClass_ = receiverHClass; + receiver_h_class_ = receiverHClass; } ICKind GetICKind() const { - return icAccessor_.GetKind(); + return ic_accessor_.GetKind(); } void TraceIC(JSHandle receiver, JSHandle key) const; @@ -60,9 +60,9 @@ 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 { diff --git a/runtime/ic/profile_type_info.cpp b/runtime/ic/profile_type_info.cpp index 306d1aeed291aacda784c30b87a2b778da4ae394..bf331558fd03ae2384f87dfaabc5a589ea31e320 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, GetWeakRef(dynclass.GetTaggedValue())); - profileTypeInfo_->Set(thread_, index + 1, handler.GetTaggedValue()); + profile_type_info_->Set(thread_, index, GetWeakRef(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 a8584fbf28d5dcb6b4dd9904c797ea5ab290b247..0ab0ac705d16e0dde541238419294821f46e237d 100644 --- a/runtime/ic/profile_type_info.h +++ b/runtime/ic/profile_type_info.h @@ -109,7 +109,7 @@ public: }; ProfileTypeAccessor(JSThread *thread, JSHandle profileTypeInfo, uint32_t slotId, ICKind kind) - : thread_(thread), profileTypeInfo_(profileTypeInfo), slotId_(slotId), kind_(kind) + : thread_(thread), profile_type_info_(profileTypeInfo), slot_id_(slotId), kind_(kind) { } ~ProfileTypeAccessor() = default; @@ -144,8 +144,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/intrinsics-inl.h b/runtime/intrinsics-inl.h index 247692b0f5a8ce1939b1c7c1520b32797eefdf0e..3f1424179539060bdd4aa54fda1019f35e1187ac 100644 --- a/runtime/intrinsics-inl.h +++ b/runtime/intrinsics-inl.h @@ -90,7 +90,7 @@ static inline JSTaggedValue HandlerCall(JSThread *thread, JSTaggedValue fn_objec return JSTaggedValue::Exception(); } - LOG(DEBUG, INTERPRETER) << "Method name: " << method->GetName().data; + LOG(DEBUG, INTERPRETER) << "Method name: " << method->GetName().data_; JSTaggedValue ret_value = EcmaInterpreter::ExecuteInvoke(thread, fn_object, num_args, args); if (UNLIKELY(thread->HasPendingException())) { diff --git a/runtime/js_collator.cpp b/runtime/js_collator.cpp index 571c66a03dc1b14c5d2d1d345b505e0cb7e60685..2e83f8db7078bf320af1efefdb4137d59e7baacd 100644 --- a/runtime/js_collator.cpp +++ b/runtime/js_collator.cpp @@ -24,10 +24,10 @@ namespace panda::ecmascript { // NOLINTNEXTLINE (readability-identifier-naming, fuchsia-statically-constructed-objects) const CString JSCollator::uIcuDataColl = U_ICUDATA_NAME U_TREE_SEPARATOR_STRING "coll"; // NOLINTNEXTLINE(fuchsia-statically-constructed-objects) -const std::map JSCollator::caseFirstMap = { +const std::map JSCollator::CASE_FIRST_MAP = { {"upper", CaseFirstOption::UPPER}, {"lower", CaseFirstOption::LOWER}, {"false", CaseFirstOption::FALSE_OPTION}}; // NOLINTNEXTLINE(fuchsia-statically-constructed-objects) -const std::map JSCollator::uColAttributeValueMap = { +const std::map JSCollator::U_COL_ATTRIBUTE_VALUE_MAP = { {CaseFirstOption::UPPER, UCOL_UPPER_FIRST}, {CaseFirstOption::LOWER, UCOL_LOWER_FIRST}, {CaseFirstOption::FALSE_OPTION, UCOL_OFF}, @@ -147,7 +147,7 @@ JSHandle JSCollator::InitializeCollator(JSThread *thread, const JSHa } ResolvedLocale r = JSLocale::ResolveLocale(thread, availableLocales, requestedLocales, matcher, relevantExtensionKeys); - icu::Locale icuLocale = r.localeData; + icu::Locale icuLocale = r.locale_data_; JSHandle localeStr = JSLocale::ToLanguageTag(thread, icuLocale); collator->SetLocale(thread, localeStr.GetTaggedValue()); ASSERT_PRINT(!icuLocale.isBogus(), "icuLocale is bogus"); @@ -156,8 +156,8 @@ JSHandle JSCollator::InitializeCollator(JSThread *thread, const JSHa // if found, set ICU collator UnicodeKeyword to iterator->second UErrorCode status = U_ZERO_ERROR; if (!collation->IsUndefined()) { - auto extensionIter = r.extensions.find("co"); - if (extensionIter != r.extensions.end() && extensionIter->second != collationStr) { + auto extensionIter = r.extensions_.find("co"); + if (extensionIter != r.extensions_.end() && extensionIter->second != collationStr) { icuLocale.setUnicodeKeywordValue("co", nullptr, status); ASSERT_PRINT(U_SUCCESS(status), "icuLocale set co failed"); } @@ -199,8 +199,8 @@ JSHandle JSCollator::InitializeCollator(JSThread *thread, const JSHa icuCollator->setAttribute(UCOL_NUMERIC_COLLATION, numeric ? UCOL_ON : UCOL_OFF, status); ASSERT(U_SUCCESS(status)); } else { - auto extensionIter = r.extensions.find("kn"); - if (extensionIter != r.extensions.end()) { + auto extensionIter = r.extensions_.find("kn"); + if (extensionIter != r.extensions_.end()) { ASSERT(icuCollator.get() != nullptr); bool found = (extensionIter->second == "true"); JSHandle isNumeric(thread, JSTaggedValue(found)); @@ -219,11 +219,11 @@ JSHandle JSCollator::InitializeCollator(JSThread *thread, const JSHa icuCollator->setAttribute(UCOL_CASE_FIRST, OptionToUColAttribute(caseFirst), status); ASSERT(U_SUCCESS(status)); } else { - auto extensionIter = r.extensions.find("kf"); - if (extensionIter != r.extensions.end()) { + auto extensionIter = r.extensions_.find("kf"); + if (extensionIter != r.extensions_.end()) { ASSERT(icuCollator.get() != nullptr); - auto mapIter = caseFirstMap.find(extensionIter->second); - if (mapIter != caseFirstMap.end()) { + auto mapIter = CASE_FIRST_MAP.find(extensionIter->second); + if (mapIter != CASE_FIRST_MAP.end()) { icuCollator->setAttribute(UCOL_CASE_FIRST, OptionToUColAttribute(mapIter->second), status); JSHandle value(thread, JSTaggedValue(static_cast(mapIter->second))); collator->SetCaseFirst(thread, value); @@ -294,8 +294,8 @@ JSHandle JSCollator::InitializeCollator(JSThread *thread, const JSHa UColAttributeValue JSCollator::OptionToUColAttribute(CaseFirstOption caseFirstOption) { - auto iter = uColAttributeValueMap.find(caseFirstOption); - if (iter != uColAttributeValueMap.end()) { + auto iter = U_COL_ATTRIBUTE_VALUE_MAP.find(caseFirstOption); + if (iter != U_COL_ATTRIBUTE_VALUE_MAP.end()) { return iter->second; } UNREACHABLE(); diff --git a/runtime/js_collator.h b/runtime/js_collator.h index f307bbfdff7651bb6ba27de1cb8f8c1e858944ba..da9c32113d194cc731242a4cda7c7a98f955dd2b 100644 --- a/runtime/js_collator.h +++ b/runtime/js_collator.h @@ -30,9 +30,9 @@ public: // NOLINTNEXTLINE (readability-identifier-naming, fuchsia-statically-constructed-objects) static const CString uIcuDataColl; - static const std::map caseFirstMap; + static const std::map CASE_FIRST_MAP; - static const std::map uColAttributeValueMap; + static const std::map U_COL_ATTRIBUTE_VALUE_MAP; CAST_CHECK(JSCollator, IsJSCollator); diff --git a/runtime/js_date_time_format.cpp b/runtime/js_date_time_format.cpp index fcfd45912b40d5b1a2f66e75e3b18d9d9c29e566..5b70dbed82af0eb241536dd77b1c07e11f7465be 100644 --- a/runtime/js_date_time_format.cpp +++ b/runtime/js_date_time_format.cpp @@ -26,15 +26,19 @@ namespace panda::ecmascript { struct CommonDateFormatPart { - int32_t fField = 0; // NOLINT(misc-non-private-member-variables-in-classes) - int32_t fBeginIndex = 0; // NOLINT(misc-non-private-member-variables-in-classes) - int32_t fEndIndex = 0; // NOLINT(misc-non-private-member-variables-in-classes) - int32_t index = 0; // NOLINT(misc-non-private-member-variables-in-classes) - bool isPreExist = false; // NOLINT(misc-non-private-member-variables-in-classes) + int32_t f_field_ = 0; // NOLINT(misc-non-private-member-variables-in-classes) + int32_t f_begin_index_ = 0; // NOLINT(misc-non-private-member-variables-in-classes) + int32_t f_end_index_ = 0; // NOLINT(misc-non-private-member-variables-in-classes) + int32_t index_ = 0; // NOLINT(misc-non-private-member-variables-in-classes) + bool is_pre_exist_ = false; // NOLINT(misc-non-private-member-variables-in-classes) CommonDateFormatPart() = default; CommonDateFormatPart(int32_t fField, int32_t fBeginIndex, int32_t fEndIndex, int32_t index, bool isPreExist) - : fField(fField), fBeginIndex(fBeginIndex), fEndIndex(fEndIndex), index(index), isPreExist(isPreExist) + : f_field_(fField), + f_begin_index_(fBeginIndex), + f_end_index_(fEndIndex), + index_(index), + is_pre_exist_(isPreExist) { } @@ -287,7 +291,7 @@ JSHandle JSDateTimeFormat::InitializeDateTimeFormat(JSThread * JSLocale::ResolveLocale(thread, availableLocales, requestedLocales, matcher, RELEVANT_EXTENSION_KEYS); // 18. Set icuLocale to r.[[locale]]. - icu::Locale icuLocale = resolvedLocale.localeData; + icu::Locale icuLocale = resolvedLocale.locale_data_; ASSERT_PRINT(!icuLocale.isBogus(), "icuLocale is bogus"); UErrorCode status = U_ZERO_ERROR; @@ -333,7 +337,7 @@ JSHandle JSDateTimeFormat::InitializeDateTimeFormat(JSThread * HourCycleOption hcDefault = OptionToHourCycle(generator->getDefaultHourCycle(status)); // b. Let hc be dateTimeFormat.[[HourCycle]]. HourCycleOption hc = HourCycleOption::UNDEFINED; - hc = (hourCycle == HourCycleOption::UNDEFINED) ? OptionToHourCycle(resolvedLocale.extensions.find("hc")->second) + hc = (hourCycle == HourCycleOption::UNDEFINED) ? OptionToHourCycle(resolvedLocale.extensions_.find("hc")->second) : hourCycle; // c. If hc is null, then // i. Set hc to hcDefault. @@ -379,19 +383,19 @@ JSHandle JSDateTimeFormat::InitializeDateTimeFormat(JSThread * std::vector data = GetIcuPatternDesc(hc); for (const IcuPatternDesc &item : data) { // prop be [[TimeZoneName]] - if (item.property == "timeZoneName") { + if (item.property_ == "timeZoneName") { int secondDigitsString = JSLocale::GetNumberOption( thread, dateTimeOptions, globalConst->GetHandledFractionalSecondDigitsString(), 1, 3, 0); skeleton.append(secondDigitsString, 'S'); } - JSHandle property(thread, factory->NewFromStdString(item.property).GetTaggedValue()); + JSHandle property(thread, factory->NewFromStdString(item.property_).GetTaggedValue()); std::string value; - bool isFind = JSLocale::GetOptionOfString(thread, dateTimeOptions, property, item.allowedValues, &value); + bool isFind = JSLocale::GetOptionOfString(thread, dateTimeOptions, property, item.allowed_values_, &value); RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSDateTimeFormat, thread); if (isFind) { - skeleton += item.map.find(value)->second; + skeleton += item.map_.find(value)->second; // [[Hour]] is defined. - isHourDefined = (item.property == "hour") ? true : isHourDefined; + isHourDefined = (item.property_ == "hour") ? true : isHourDefined; } } @@ -461,8 +465,8 @@ JSHandle JSDateTimeFormat::InitializeDateTimeFormat(JSThread * // Set dateTimeFormat.[[locale]]. if (!hour12->IsUndefined() || hourCycle != HourCycleOption::UNDEFINED) { - if ((resolvedLocale.extensions.find("hc") != resolvedLocale.extensions.end()) && - (dtfHourCycle != OptionToHourCycle((resolvedLocale.extensions.find("hc")->second)))) { + if ((resolvedLocale.extensions_.find("hc") != resolvedLocale.extensions_.end()) && + (dtfHourCycle != OptionToHourCycle((resolvedLocale.extensions_.find("hc")->second)))) { resolvedIcuLocaleCopy.setUnicodeKeywordValue("hc", nullptr, status); ASSERT_PRINT(U_SUCCESS(status), "resolvedIcuLocaleCopy set hc failed"); } @@ -673,17 +677,17 @@ JSHandle JSDateTimeFormat::FormatDateTimeToParts(JSThread *thread, // 4. For each part in parts, do for (auto part : parts) { substring.Update( - JSLocale::IcuToString(thread, formattedParts, part.fBeginIndex, part.fEndIndex).GetTaggedValue()); + JSLocale::IcuToString(thread, formattedParts, part.f_begin_index_, part.f_end_index_).GetTaggedValue()); RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSArray, thread); // Let O be ObjectCreate(%ObjectPrototype%). // Perform ! CreateDataPropertyOrThrow(O, "type", part.[[Type]]). // Perform ! CreateDataPropertyOrThrow(O, "value", part.[[Value]]). // Perform ! CreateDataProperty(result, ! ToString(n), O). - if (part.isPreExist) { - JSLocale::PutElement(thread, part.index, result, ConvertFieldIdToDateType(thread, -1), + if (part.is_pre_exist_) { + JSLocale::PutElement(thread, part.index_, result, ConvertFieldIdToDateType(thread, -1), JSHandle::Cast(substring)); } else { - JSLocale::PutElement(thread, part.index, result, ConvertFieldIdToDateType(thread, part.fField), + JSLocale::PutElement(thread, part.index_, result, ConvertFieldIdToDateType(thread, part.f_field_), JSHandle::Cast(substring)); } } @@ -867,7 +871,7 @@ void JSDateTimeFormat::ResolvedOptions(JSThread *thread, const JSHandleGetTimeStyle() == JSTaggedValue(static_cast(DateTimeStyleOption::UNDEFINED))) { for (const auto &item : BuildIcuPatternDescs()) { // fractionalSecondsDigits need to be added before timeZoneName. - if (item.property == "timeZoneName") { + if (item.property_ == "timeZoneName") { int tmpResult = count(pattern.begin(), pattern.end(), 'S'); int fsd = (tmpResult >= STRING_LENGTH_3) ? STRING_LENGTH_3 : tmpResult; if (fsd > 0) { @@ -876,8 +880,8 @@ void JSDateTimeFormat::ResolvedOptions(JSThread *thread, const JSHandle::Cast(factory->NewFromStdString(item.property)); - for (const auto &pair : item.pairs) { + property = JSHandle::Cast(factory->NewFromStdString(item.property_)); + for (const auto &pair : item.pairs_) { if (pattern.find(pair.first) != std::string::npos) { hcValue = JSHandle::Cast(factory->NewFromStdString(pair.second)); JSObject::CreateDataPropertyOrThrow(thread, options, property, hcValue); @@ -1056,18 +1060,18 @@ JSHandle JSDateTimeFormat::ConstructFDateIntervalToJSArray(JSThread *th } for (auto part : parts) { substring.Update( - JSLocale::IcuToString(thread, formattedValue, part.fBeginIndex, part.fEndIndex).GetTaggedValue()); + JSLocale::IcuToString(thread, formattedValue, part.f_begin_index_, part.f_end_index_).GetTaggedValue()); RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSArray, thread); JSHandle element; - if (part.isPreExist) { - element = JSLocale::PutElement(thread, part.index, array, ConvertFieldIdToDateType(thread, -1), + if (part.is_pre_exist_) { + element = JSLocale::PutElement(thread, part.index_, array, ConvertFieldIdToDateType(thread, -1), JSHandle::Cast(substring)); } else { - element = JSLocale::PutElement(thread, part.index, array, ConvertFieldIdToDateType(thread, part.fField), + element = JSLocale::PutElement(thread, part.index_, array, ConvertFieldIdToDateType(thread, part.f_field_), JSHandle::Cast(substring)); } JSHandle value = JSHandle::Cast( - ToValueString(thread, TrackValue(part.fBeginIndex, part.fEndIndex, begin, end))); + ToValueString(thread, TrackValue(part.f_begin_index_, part.f_end_index_, begin, end))); JSObject::SetProperty(thread, element, thread->GlobalConstants()->GetHandledSourceString(), value, true); } return array; @@ -1106,8 +1110,8 @@ std::vector InitializePattern(const IcuPatternDesc &hourData) std::vector items = BuildIcuPatternDescs(); auto item = items.begin(); while (static_cast(item != items.end()) != 0) { - if (item->property != "hour") { - result.emplace_back(IcuPatternDesc(item->property, item->pairs, item->allowedValues)); + if (item->property_ != "hour") { + result.emplace_back(IcuPatternDesc(item->property_, item->pairs_, item->allowed_values_)); } else { result.emplace_back(hourData); } diff --git a/runtime/js_date_time_format.h b/runtime/js_date_time_format.h index 556ea859b17ff736bcf20c6becf3c6a24df3a102..56fa97620bb9d9f50418c370e76bcc7a3cb777de 100644 --- a/runtime/js_date_time_format.h +++ b/runtime/js_date_time_format.h @@ -49,19 +49,21 @@ class IcuPatternDesc { public: IcuPatternDesc(std::string propertyParam, std::vector pairsParam, std::vector allowedValuesParam) - : property(std::move(propertyParam)), pairs(std::move(pairsParam)), allowedValues(std::move(allowedValuesParam)) + : property_(std::move(propertyParam)), + pairs_(std::move(pairsParam)), + allowed_values_(std::move(allowedValuesParam)) { - for (const auto &pair : pairs) { - map.insert(std::make_pair(pair.second, pair.first)); + for (const auto &pair : pairs_) { + map_.insert(std::make_pair(pair.second, pair.first)); } } virtual ~IcuPatternDesc() = default; - std::string property; // NOLINT(misc-non-private-member-variables-in-classes) - std::vector pairs; // NOLINT(misc-non-private-member-variables-in-classes) - std::map map; // NOLINT(misc-non-private-member-variables-in-classes) - std::vector allowedValues; // NOLINT(misc-non-private-member-variables-in-classes) + std::string property_; // NOLINT(misc-non-private-member-variables-in-classes) + std::vector pairs_; // NOLINT(misc-non-private-member-variables-in-classes) + std::map map_; // NOLINT(misc-non-private-member-variables-in-classes) + std::vector allowed_values_; // NOLINT(misc-non-private-member-variables-in-classes) DEFAULT_COPY_SEMANTIC(IcuPatternDesc); // NOLINT(performance-noexcept-move-constructor, hicpp-noexcept-move) @@ -71,18 +73,18 @@ public: class Pattern { public: Pattern(const std::string &data1, const std::string &data2) - : data(InitializePattern( + : data_(InitializePattern( IcuPatternDesc("hour", {{data1, "2-digit"}, {data2, "numeric"}}, {"2-digit", "numeric"}))) { } virtual ~Pattern() = default; std::vector Get() const { - return data; + return data_; } private: - std::vector data {}; + std::vector data_ {}; NO_COPY_SEMANTIC(Pattern); NO_MOVE_SEMANTIC(Pattern); }; diff --git a/runtime/js_hclass.cpp b/runtime/js_hclass.cpp index 62d41219b84bd08a61d38c11c69e852c0c3501fa..15268a8bfd82e7e5e635262a2dcee314b1b8eb18 100644 --- a/runtime/js_hclass.cpp +++ b/runtime/js_hclass.cpp @@ -165,8 +165,8 @@ JSHandle JSHClass::Clone(const JSThread *thread, const JSHandleGetInlinedProperties(); 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()); diff --git a/runtime/js_locale.cpp b/runtime/js_locale.cpp index 6f985b0fce91ad982c830fc4ec89c7f711ec197f..f111c9ba755a2e28159f7d788a91ad32fadc924f 100644 --- a/runtime/js_locale.cpp +++ b/runtime/js_locale.cpp @@ -147,19 +147,19 @@ JSLocale::ParsedLocale JSLocale::HandleLocale(const JSHandle &locale // defined by private agreement. // b. Extensions cannot be used in tags that are entirely private use. if (IsPrivateSubTag(result, len)) { - parsedResult.base = result; + parsedResult.base_ = result; return parsedResult; } // If cannot find "-u-", return the whole string as base. size_t foundExtension = result.find("-u-"); if (foundExtension == std::string::npos) { - parsedResult.base = result; + parsedResult.base_ = result; return parsedResult; } // Let privateIndex be Call(%StringProto_indexOf%, foundLocale, « "-x-" »). size_t praviteIndex = result.find("-x-"); if (praviteIndex != std::string::npos && praviteIndex < foundExtension) { - parsedResult.base = result; + parsedResult.base_ = result; return parsedResult; } const std::string basis = result.substr(INTL_INDEX_ZERO, foundExtension); @@ -168,8 +168,8 @@ JSLocale::ParsedLocale JSLocale::HandleLocale(const JSHandle &locale size_t start = foundExtension + INTL_INDEX_ONE; HandleLocaleExtension(start, extensionEnd, result, len); const std::string end = result.substr(extensionEnd); - parsedResult.base = basis + end; - parsedResult.extension = result.substr(foundExtension, extensionEnd - foundExtension); + parsedResult.base_ = basis + end; + parsedResult.extension_ = result.substr(foundExtension, extensionEnd - foundExtension); return parsedResult; } @@ -337,20 +337,20 @@ JSHandle JSLocale::LookupMatcher(JSThread *thread, const JSHandleNewFromStdString(res); } @@ -360,8 +360,8 @@ JSHandle JSLocale::LookupMatcher(JSThread *thread, const JSHandleNewFromStdString(result.locale); + result.locale_ = defLocale; + return factory->NewFromStdString(result.locale_); } icu::LocaleMatcher BuildLocaleMatcher(JSThread *thread, uint32_t *availableLength, UErrorCode *status, @@ -433,7 +433,7 @@ JSHandle JSLocale::LookupSupportedLocales(JSThread *thread, const J for (uint32_t i = 0; i < length; ++i) { item.Update(requestedLocales->Get(thread, i)); ParsedLocale foundationResult = HandleLocale(item); - std::string availableLocale = BestAvailableLocale(thread, availableLocales, foundationResult.base); + std::string availableLocale = BestAvailableLocale(thread, availableLocales, foundationResult.base_); if (!availableLocale.empty()) { subset->Set(thread, index++, item.GetTaggedValue()); } @@ -784,9 +784,9 @@ ResolvedLocale JSLocale::ResolveLocale(JSThread *thread, const JSHandle tag = ToLanguageTag(thread, foundLocaleData); - result.locale = ConvertToStdString(tag); + result.locale_ = ConvertToStdString(tag); std::string supportedExtension = "-u"; icu::LocaleBuilder localeBuilder; localeBuilder.setLocale(foundLocaleData).clearExtensions(); @@ -868,7 +868,7 @@ ResolvedLocale JSLocale::ResolveLocale(JSThread *thread, const JSHandle(key, value)); + result.extensions_.insert(std::pair(key, value)); supportedExtension += supportedExtensionAddition; } size_t found = foundLocale.find("-u-"); @@ -892,18 +892,18 @@ ResolvedLocale JSLocale::ResolveLocale(JSThread *thread, const JSHandle &t return false; } - tagElements.language = GetOption(thread, options, globalConst->GetHandledLanguageString(), OptionType::STRING, - globalConst->GetHandledUndefined(), globalConst->GetHandledUndefined()); + tagElements.language_ = GetOption(thread, options, globalConst->GetHandledLanguageString(), OptionType::STRING, + globalConst->GetHandledUndefined(), globalConst->GetHandledUndefined()); RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, false); // 4. If language is not undefined, then // a. If language does not match the unicode_language_subtag production, throw a RangeError exception. - if (!tagElements.language->IsUndefined()) { - std::string languageStr = ConvertToStdString(JSHandle::Cast(tagElements.language)); + if (!tagElements.language_->IsUndefined()) { + std::string languageStr = ConvertToStdString(JSHandle::Cast(tagElements.language_)); if (languageStr[INTL_INDEX_ZERO] == '\0' || IsAlpha(languageStr, INTL_INDEX_FOUR, INTL_INDEX_FOUR)) { return false; } } // 5. Let script be ? GetOption(options, "script", "string", undefined, undefined). - tagElements.script = GetOption(thread, options, globalConst->GetHandledScriptString(), OptionType::STRING, - globalConst->GetHandledUndefined(), globalConst->GetHandledUndefined()); + tagElements.script_ = GetOption(thread, options, globalConst->GetHandledScriptString(), OptionType::STRING, + globalConst->GetHandledUndefined(), globalConst->GetHandledUndefined()); RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, false); // 6. If script is not undefined, then // a. If script does not match the unicode_script_subtag production, throw a RangeError exception. - if (!tagElements.script->IsUndefined()) { - std::string scriptStr = JSLocale::ConvertToStdString((JSHandle::Cast(tagElements.script))); + if (!tagElements.script_->IsUndefined()) { + std::string scriptStr = JSLocale::ConvertToStdString((JSHandle::Cast(tagElements.script_))); if (scriptStr[INTL_INDEX_ZERO] == '\0') { return false; } @@ -1102,12 +1102,12 @@ bool JSLocale::ApplyOptionsToTag(JSThread *thread, const JSHandle &t // 7. Let region be ? GetOption(options, "region", "string", undefined, undefined). // 8. If region is not undefined, then // a. If region does not match the unicode_region_subtag production, throw a RangeError exception. - tagElements.region = GetOption(thread, options, globalConst->GetHandledRegionString(), OptionType::STRING, - globalConst->GetHandledUndefined(), globalConst->GetHandledUndefined()); + tagElements.region_ = GetOption(thread, options, globalConst->GetHandledRegionString(), OptionType::STRING, + globalConst->GetHandledUndefined(), globalConst->GetHandledUndefined()); RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, false); - if (!tagElements.region->IsUndefined()) { - std::string regionStr = ConvertToStdString(JSHandle::Cast(tagElements.region)); + if (!tagElements.region_->IsUndefined()) { + std::string regionStr = ConvertToStdString(JSHandle::Cast(tagElements.region_)); if (regionStr[INTL_INDEX_ZERO] == '\0') { return false; } @@ -1239,7 +1239,8 @@ JSHandle JSLocale::InitializeLocale(JSThread *thread, const JSHandle(curIdx_ < length_); + return static_cast(cur_idx_ < length_); } const icu::Locale &next() override { - ASSERT(curIdx_ < length_); + ASSERT(cur_idx_ < length_); UErrorCode status = U_ZERO_ERROR; - locale_ = icu::Locale::forLanguageTag(data_[curIdx_].c_str(), status); + locale_ = icu::Locale::forLanguageTag(data_[cur_idx_].c_str(), status); ASSERT(U_SUCCESS(status)); - curIdx_++; + cur_idx_++; return locale_; } @@ -113,39 +113,39 @@ public: private: std::vector data_ {}; uint32_t length_ {0}; - uint32_t curIdx_ {0}; + uint32_t cur_idx_ {0}; icu::Locale locale_ {}; }; struct ResolvedLocale { - std::string locale {}; - icu::Locale localeData {}; - std::map extensions {}; + std::string locale_ {}; + icu::Locale locale_data_ {}; + std::map extensions_ {}; }; struct MatcherResult { - std::string locale; - std::string extension; + std::string locale_; + std::string extension_; }; struct OptionData { - std::string name; - std::string key; - std::vector possibleValues; - bool isBoolValue = false; + std::string name_; + std::string key_; + std::vector possible_values_; + bool is_bool_value_ = false; }; struct TagElements { - JSHandle language; - JSHandle script; - JSHandle region; + JSHandle language_; + JSHandle script_; + JSHandle region_; }; class JSLocale : public JSObject { public: struct ParsedLocale { - std::string base; - std::string extension; + std::string base_; + std::string extension_; }; static JSLocale *Cast(ObjectHeader *object) diff --git a/runtime/js_method.cpp b/runtime/js_method.cpp index c180ec2242ec5ac23817f27e70484938d9a22d1a..1c57090e8170397dabdab116f430f4510c2a3c1c 100644 --- a/runtime/js_method.cpp +++ b/runtime/js_method.cpp @@ -20,15 +20,15 @@ namespace panda::ecmascript { JSMethod::~JSMethod() { - mem::InternalAllocator<>::GetInternalAllocatorFromRuntime()->Free(icOffsetMapping_); + mem::InternalAllocator<>::GetInternalAllocatorFromRuntime()->Free(ic_offset_mapping_); } // It's not allowed '#' token appear in ECMA function(method) name, which discriminates same names in panda methods. CString JSMethod::ParseFunctionName() const { - auto *name = GetStringDataAnnotation(Method::AnnotationField::FUNCTION_NAME).data; + auto *name = GetStringDataAnnotation(Method::AnnotationField::FUNCTION_NAME).data_; if (name == nullptr) { - name = GetName().data; + name = GetName().data_; } return utf::Mutf8AsCString(name); } @@ -40,14 +40,14 @@ void JSMethod::SetCallTypeFromAnnotation() panda_file::MethodDataAccessor mda(*pandaFile, fieldId); mda.EnumerateAnnotations([&](panda_file::File::EntityId annotation_id) { panda_file::AnnotationDataAccessor ada(*pandaFile, annotation_id); - auto *annotation_name = reinterpret_cast(pandaFile->GetStringData(ada.GetClassId()).data); + auto *annotation_name = reinterpret_cast(pandaFile->GetStringData(ada.GetClassId()).data_); if (::strcmp("L_ESCallTypeAnnotation;", annotation_name) == 0) { uint32_t elem_count = ada.GetCount(); for (uint32_t i = 0; i < elem_count; i++) { panda_file::AnnotationDataAccessor::Elem adae = ada.GetElement(i); - auto *elem_name = reinterpret_cast(pandaFile->GetStringData(adae.GetNameId()).data); + 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 85471ddee79d33917c6fe31b013756872af27540..58fa5fea49fece70df44b3f74ca5f793118ff7f3 100644 --- a/runtime/js_method.h +++ b/runtime/js_method.h @@ -44,14 +44,14 @@ public: panda_file::File::EntityId codeId, uint32_t accessFlags, uint32_t numArgs, const uint16_t *shorty) : Method(klass, pf, fileId, codeId, accessFlags, numArgs, 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; @@ -63,57 +63,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; } uint8_t *GetICOffsetMapping() { - return icOffsetMapping_; + return ic_offset_mapping_; } const uint8_t *GetICOffsetMapping() const { - return icOffsetMapping_; + return ic_offset_mapping_; } void SetICOffsetMapping(uint8_t *mapping) { - icOffsetMapping_ = mapping; + ic_offset_mapping_ = mapping; } static constexpr size_t GetICOffsetMappingOffset() { - return MEMBER_OFFSET(JSMethod, icOffsetMapping_); + return MEMBER_OFFSET(JSMethod, ic_offset_mapping_); } uint32_t GetCallType() const { - return callType_; + return call_type_; } CString ParseFunctionName() const; @@ -123,11 +123,11 @@ public: JSTaggedValue GetLength() const; private: - const uint8_t *bytecodeArray_ {nullptr}; - uint32_t bytecodeArraySize_ {0}; - uint32_t slotSize_ {0}; - uint8_t *icOffsetMapping_ {nullptr}; - uint32_t callType_ {UINT32_MAX}; // UINT32_MAX means not found + const uint8_t *bytecode_array_ {nullptr}; + uint32_t bytecode_array_size_ {0}; + uint32_t slot_size_ {0}; + uint8_t *ic_offset_mapping_ {nullptr}; + uint32_t call_type_ {UINT32_MAX}; // UINT32_MAX means not found }; } // namespace panda::ecmascript diff --git a/runtime/js_number_format.cpp b/runtime/js_number_format.cpp index 7da773c73c887ca8cf6a35555e0e7de63d424910..aeebb4c043660f5007bed934f382f0a3a4e5803e 100644 --- a/runtime/js_number_format.cpp +++ b/runtime/js_number_format.cpp @@ -404,8 +404,8 @@ FractionDigitsOption SetNumberFormatUnitOptions(JSThread *thread, const JSHandle // c. Let mxfdDefault be cDigits. if (style == StyleOption::CURRENCY) { int32_t cDigits = JSNumberFormat::CurrencyDigits(currencyUStr); - fractionDigitsOption.mnfdDefault = cDigits; - fractionDigitsOption.mxfdDefault = cDigits; + fractionDigitsOption.mnfd_default_ = cDigits; + fractionDigitsOption.mxfd_default_ = cDigits; } else { // 18. Else, // a. Let mnfdDefault be 0. @@ -413,11 +413,11 @@ FractionDigitsOption SetNumberFormatUnitOptions(JSThread *thread, const JSHandle // i. Let mxfdDefault be 0. // c. else, // i. Let mxfdDefault be 3. - fractionDigitsOption.mnfdDefault = 0; + fractionDigitsOption.mnfd_default_ = 0; if (style == StyleOption::PERCENT) { - fractionDigitsOption.mxfdDefault = 0; + fractionDigitsOption.mxfd_default_ = 0; } else { - fractionDigitsOption.mxfdDefault = 3; // Max decimal precision is 3 + fractionDigitsOption.mxfd_default_ = 3; // Max decimal precision is 3 } } return fractionDigitsOption; @@ -491,7 +491,7 @@ void JSNumberFormat::InitializeNumberFormat(JSThread *thread, const JSHandle localeStr = JSLocale::ToLanguageTag(thread, icuLocale); numberFormat->SetLocale(thread, localeStr.GetTaggedValue()); @@ -515,8 +515,8 @@ void JSNumberFormat::InitializeNumberFormat(JSThread *thread, const JSHandleGetUnitDisplay(); auto unitDisplay = static_cast(unitDisplayValue.GetInt()); diff --git a/runtime/js_number_format.h b/runtime/js_number_format.h index ae58956b3e580f294bffca5d27896857e79f489e..18debd4b6fa873be63a74f67baea926f26d2e2fe 100644 --- a/runtime/js_number_format.h +++ b/runtime/js_number_format.h @@ -37,8 +37,8 @@ enum class CurrencySignOption : uint8_t { STANDARD = 0x01, ACCOUNTING, EXCEPTION enum class UnitDisplayOption : uint8_t { SHORT = 0x01, NARROW, LONG, EXCEPTION }; struct FractionDigitsOption { - int32_t mnfdDefault = 0; - int32_t mxfdDefault = 0; + int32_t mnfd_default_ = 0; + int32_t mxfd_default_ = 0; }; // NOLINTNEXTLINE(fuchsia-statically-constructed-objects) diff --git a/runtime/js_object.h b/runtime/js_object.h index d23dd1722ab6a853d3da6dd4369f1db81a626890..5be4e8cedbce64ee0d2a0387387e8ec73b81c0cd 100644 --- a/runtime/js_object.h +++ b/runtime/js_object.h @@ -68,9 +68,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) { } @@ -101,7 +101,7 @@ public: inline void SetWritable(bool flag) { writable_ = flag; - hasWritable_ = true; + has_writable_ = true; } inline bool IsEnumerable() const @@ -112,7 +112,7 @@ public: inline void SetEnumerable(bool flag) { enumerable_ = flag; - hasEnumerable_ = true; + has_enumerable_ = true; } inline bool IsConfigurable() const @@ -123,7 +123,7 @@ public: inline void SetConfigurable(bool flag) { configurable_ = flag; - hasConfigurable_ = true; + has_configurable_ = true; } inline bool HasValue() const @@ -133,17 +133,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 @@ -192,7 +192,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 @@ -203,7 +203,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); @@ -214,9 +214,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_ {}; @@ -232,7 +232,7 @@ public: using RepresentationField = IsInlinedPropsField::NextField; using OffsetField = RepresentationField::NextField; - explicit PropertyMetaData(uint32_t metaData) : metaData_(metaData) {} + explicit PropertyMetaData(uint32_t metaData) : meta_data_(metaData) {} ~PropertyMetaData() = default; DEFAULT_NOEXCEPT_MOVE_SEMANTIC(PropertyMetaData); @@ -245,52 +245,52 @@ public: 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) + : meta_data_(metaData) { thread_ = thread; value_ = JSHandle(thread_, value); @@ -316,13 +316,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 { diff --git a/runtime/js_plural_rules.cpp b/runtime/js_plural_rules.cpp index a31b17cf0917ab3cd51b5752ba1b2fb0cd06e9d8..e92a9ce5f250dce1a4dcfdc0bdd45c4d23f29b15 100644 --- a/runtime/js_plural_rules.cpp +++ b/runtime/js_plural_rules.cpp @@ -202,7 +202,7 @@ JSHandle JSPluralRules::InitializePluralRules(JSThread *thread, ResolvedLocale r = JSLocale::ResolveLocale(thread, availableLocales, requestedLocales, matcher, relevantExtensionKeys); RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSPluralRules, thread); - icu::Locale icuLocale = r.localeData; + icu::Locale icuLocale = r.locale_data_; // Get ICU numberFormatter with given locale icu::number::LocalizedNumberFormatter icuNumberFormatter = diff --git a/runtime/js_relative_time_format.cpp b/runtime/js_relative_time_format.cpp index 65a52d3de8d99906e8300d04c30bdc499e560f85..0931f604bfb4112c9d0261108a3a14b3dfb6afb3 100644 --- a/runtime/js_relative_time_format.cpp +++ b/runtime/js_relative_time_format.cpp @@ -87,7 +87,7 @@ JSHandle JSRelativeTimeFormat::InitializeRelativeTimeForma ResolvedLocale r = JSLocale::ResolveLocale(thread, availableLocales, requestedLocales, matcher, relevantExtensionKeys); RETURN_HANDLE_IF_ABRUPT_COMPLETION(JSRelativeTimeFormat, thread); - icu::Locale icuLocale = r.localeData; + icu::Locale icuLocale = r.locale_data_; // 12. Let locale be r.[[Locale]]. JSHandle localeStr = JSLocale::ToLanguageTag(thread, icuLocale); diff --git a/runtime/js_serializer.cpp b/runtime/js_serializer.cpp index 7685ba83fd83f802e49e36505c86cee0feba0e5d..23c9a2dca19c7b4a953ac2e13fc220b7696ad2ac 100644 --- a/runtime/js_serializer.cpp +++ b/runtime/js_serializer.cpp @@ -85,12 +85,12 @@ bool JSSerializer::WritePrimitiveValue(const JSHandle &value) bool JSSerializer::WriteInt(int32_t value) { - size_t oldSize = bufferSize_; + size_t oldSize = buffer_size_; if (!WriteType(SerializationUID::INT32)) { return false; } if (!WriteRawData(&value, sizeof(value))) { - bufferSize_ = oldSize; + buffer_size_ = oldSize; return false; } return true; @@ -98,12 +98,12 @@ bool JSSerializer::WriteInt(int32_t value) bool JSSerializer::WriteInt(uint32_t value) { - size_t oldSize = bufferSize_; + size_t oldSize = buffer_size_; if (!WriteType(SerializationUID::UINT32)) { return false; } if (!WriteRawData(&value, sizeof(value))) { - bufferSize_ = oldSize; + buffer_size_ = oldSize; return false; } return true; @@ -111,12 +111,12 @@ bool JSSerializer::WriteInt(uint32_t value) bool JSSerializer::WriteDouble(double value) { - size_t oldSize = bufferSize_; + size_t oldSize = buffer_size_; if (!WriteType(SerializationUID::DOUBLE)) { return false; } if (!WriteRawData(&value, sizeof(value))) { - bufferSize_ = oldSize; + buffer_size_ = oldSize; return false; } return true; @@ -141,40 +141,40 @@ bool JSSerializer::WriteRawData(const void *data, size_t length) if (length <= 0) { return false; } - if ((bufferSize_ + length) > bufferCapacity_) { + if ((buffer_size_ + length) > buffer_capacity_) { if (!AllocateBuffer(length)) { return false; } } errno_t rc; // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) - rc = memcpy_s(buffer_ + bufferSize_, bufferCapacity_ - bufferSize_, data, length); + rc = memcpy_s(buffer_ + buffer_size_, buffer_capacity_ - buffer_size_, data, length); if (rc != EOK) { LOG(ERROR, RUNTIME) << "Failed to memcpy_s Data"; return false; } - bufferSize_ += length; + buffer_size_ += length; return true; } bool JSSerializer::AllocateBuffer(size_t bytes) { // Get internal heap size - if (sizeLimit_ == 0) { + if (size_limit_ == 0) { uint64_t heapSize = thread_->GetEcmaVM()->GetJSOptions().GetInternalMemorySizeLimit(); - sizeLimit_ = heapSize; + size_limit_ = heapSize; } - size_t oldSize = bufferSize_; + size_t oldSize = buffer_size_; size_t newSize = oldSize + bytes; - if (newSize > sizeLimit_) { + if (newSize > size_limit_) { return false; } - if (bufferCapacity_ == 0) { + if (buffer_capacity_ == 0) { if (bytes < INITIAL_CAPACITY) { // NOLINTNEXTLINE(cppcoreguidelines-no-malloc) buffer_ = reinterpret_cast(malloc(INITIAL_CAPACITY)); if (buffer_ != nullptr) { - bufferCapacity_ = INITIAL_CAPACITY; + buffer_capacity_ = INITIAL_CAPACITY; return true; } return false; @@ -182,12 +182,12 @@ bool JSSerializer::AllocateBuffer(size_t bytes) // NOLINTNEXTLINE(cppcoreguidelines-no-malloc) buffer_ = reinterpret_cast(malloc(bytes)); if (buffer_ != nullptr) { - bufferCapacity_ = bytes; + buffer_capacity_ = bytes; return true; } return false; } - if (newSize > bufferCapacity_) { + if (newSize > buffer_capacity_) { if (!ExpandBuffer(newSize)) { return false; } @@ -197,9 +197,9 @@ bool JSSerializer::AllocateBuffer(size_t bytes) bool JSSerializer::ExpandBuffer([[maybe_unused]] size_t requestedSize) { - size_t newCapacity = bufferCapacity_ * CAPACITY_INCREASE_RATE; + size_t newCapacity = buffer_capacity_ * CAPACITY_INCREASE_RATE; newCapacity = std::max(newCapacity, requestedSize); - if (newCapacity > sizeLimit_) { + if (newCapacity > size_limit_) { return false; } // NOLINTNEXTLINE(cppcoreguidelines-no-malloc) @@ -208,7 +208,7 @@ bool JSSerializer::ExpandBuffer([[maybe_unused]] size_t requestedSize) return false; } errno_t rc; - rc = memcpy_s(newBuffer, newCapacity, buffer_, bufferSize_); + rc = memcpy_s(newBuffer, newCapacity, buffer_, buffer_size_); if (rc != EOK) { LOG(ERROR, RUNTIME) << "Failed to memcpy_s Data"; // NOLINTNEXTLINE(cppcoreguidelines-no-malloc) @@ -218,31 +218,31 @@ bool JSSerializer::ExpandBuffer([[maybe_unused]] size_t requestedSize) // NOLINTNEXTLINE(cppcoreguidelines-no-malloc) free(buffer_); buffer_ = newBuffer; - bufferCapacity_ = newCapacity; + buffer_capacity_ = newCapacity; return true; } // Transfer ownership of buffer, should not use this Serializer after release std::pair JSSerializer::ReleaseBuffer() { - auto res = std::make_pair(buffer_, bufferSize_); + auto res = std::make_pair(buffer_, buffer_size_); buffer_ = nullptr; - bufferSize_ = 0; - bufferCapacity_ = 0; - objectId_ = 0; + buffer_size_ = 0; + buffer_capacity_ = 0; + object_id_ = 0; return res; } bool JSSerializer::IsSerialized(uintptr_t addr) const { - return referenceMap_.find(addr) != referenceMap_.end(); + return reference_map_.find(addr) != reference_map_.end(); } bool JSSerializer::WriteIfSerialized(uintptr_t addr) { - size_t oldSize = bufferSize_; - auto iter = referenceMap_.find(addr); - if (iter == referenceMap_.end()) { + size_t oldSize = buffer_size_; + auto iter = reference_map_.find(addr); + if (iter == reference_map_.end()) { return false; } uint64_t id = iter->second; @@ -250,7 +250,7 @@ bool JSSerializer::WriteIfSerialized(uintptr_t addr) return false; } if (!WriteRawData(&id, sizeof(uint64_t))) { - bufferSize_ = oldSize; + buffer_size_ = oldSize; return false; } return true; @@ -264,8 +264,8 @@ bool JSSerializer::WriteTaggedObject(const JSHandle &value) if (serialized) { return WriteIfSerialized(addr); } - referenceMap_.insert(std::pair(addr, objectId_)); - objectId_++; + reference_map_.insert(std::pair(addr, object_id_)); + object_id_++; TaggedObject *taggedObject = value->GetTaggedObject(); JSType type = taggedObject->GetClass()->GetObjectType(); @@ -320,7 +320,7 @@ bool JSSerializer::WriteTaggedObject(const JSHandle &value) bool JSSerializer::WriteJSError(const JSHandle &value) { - size_t oldSize = bufferSize_; + size_t oldSize = buffer_size_; TaggedObject *taggedObject = value->GetTaggedObject(); JSType errorType = taggedObject->GetClass()->GetObjectType(); if (!WriteJSErrorHeader(errorType)) { @@ -331,7 +331,7 @@ bool JSSerializer::WriteJSError(const JSHandle &value) JSHandle msg = JSObject::GetProperty(thread_, value, handleMsg).GetValue(); // Write error message if (!SerializeJSTaggedValue(msg)) { - bufferSize_ = oldSize; + buffer_size_ = oldSize; return false; } return true; @@ -363,22 +363,22 @@ bool JSSerializer::WriteJSErrorHeader(JSType type) bool JSSerializer::WriteJSDate(const JSHandle &value) { JSHandle date = JSHandle::Cast(value); - size_t oldSize = bufferSize_; + size_t oldSize = buffer_size_; if (!WriteType(SerializationUID::JS_DATE)) { return false; } if (!WritePlainObject(value)) { - bufferSize_ = oldSize; + buffer_size_ = oldSize; return false; } double timeValue = date->GetTimeValue().GetDouble(); if (!WriteDouble(timeValue)) { - bufferSize_ = oldSize; + buffer_size_ = oldSize; return false; } double localOffset = date->GetLocalOffset().GetDouble(); if (!WriteDouble(localOffset)) { - bufferSize_ = oldSize; + buffer_size_ = oldSize; return false; } return true; @@ -387,17 +387,17 @@ bool JSSerializer::WriteJSDate(const JSHandle &value) bool JSSerializer::WriteJSArray(const JSHandle &value) { JSHandle array = JSHandle::Cast(value); - size_t oldSize = bufferSize_; + size_t oldSize = buffer_size_; if (!WriteType(SerializationUID::JS_ARRAY)) { return false; } if (!WritePlainObject(value)) { - bufferSize_ = oldSize; + buffer_size_ = oldSize; return false; } uint32_t arrayLength = static_cast(array->GetLength().GetInt()); if (!WriteInt(arrayLength)) { - bufferSize_ = oldSize; + buffer_size_ = oldSize; return false; } return true; @@ -406,19 +406,19 @@ bool JSSerializer::WriteJSArray(const JSHandle &value) bool JSSerializer::WriteEcmaString(const JSHandle &value) { JSHandle string = JSHandle::Cast(value); - size_t oldSize = bufferSize_; + size_t oldSize = buffer_size_; if (!WriteType(SerializationUID::ECMASTRING)) { return false; } size_t length = string->GetLength(); if (!WriteLength(static_cast(length))) { - bufferSize_ = oldSize; + buffer_size_ = oldSize; return false; } const uint8_t *data = string->GetDataUtf8(); const uint8_t strEnd = '\0'; if (!WriteRawData(data, length) || !WriteRawData(&strEnd, sizeof(uint8_t))) { - bufferSize_ = oldSize; + buffer_size_ = oldSize; return false; } return true; @@ -427,28 +427,28 @@ bool JSSerializer::WriteEcmaString(const JSHandle &value) bool JSSerializer::WriteJSMap(const JSHandle &value) { JSHandle map = JSHandle::Cast(value); - size_t oldSize = bufferSize_; + size_t oldSize = buffer_size_; if (!WriteType(SerializationUID::JS_MAP)) { return false; } if (!WritePlainObject(value)) { - bufferSize_ = oldSize; + buffer_size_ = oldSize; return false; } int size = map->GetSize(); if (!WriteLength(static_cast(size))) { - bufferSize_ = oldSize; + buffer_size_ = oldSize; return false; } for (int i = 0; i < size; i++) { JSHandle key(thread_, map->GetKey(i)); if (!SerializeJSTaggedValue(key)) { - bufferSize_ = oldSize; + buffer_size_ = oldSize; return false; } JSHandle val(thread_, map->GetValue(i)); if (!SerializeJSTaggedValue(val)) { - bufferSize_ = oldSize; + buffer_size_ = oldSize; return false; } } @@ -458,23 +458,23 @@ bool JSSerializer::WriteJSMap(const JSHandle &value) bool JSSerializer::WriteJSSet(const JSHandle &value) { JSHandle set = JSHandle::Cast(value); - size_t oldSize = bufferSize_; + size_t oldSize = buffer_size_; if (!WriteType(SerializationUID::JS_SET)) { return false; } if (!WritePlainObject(value)) { - bufferSize_ = oldSize; + buffer_size_ = oldSize; return false; } int size = set->GetSize(); if (!WriteLength(static_cast(size))) { - bufferSize_ = oldSize; + buffer_size_ = oldSize; return false; } for (int i = 0; i < size; i++) { JSHandle val(thread_, set->GetValue(i)); if (!SerializeJSTaggedValue(val)) { - bufferSize_ = oldSize; + buffer_size_ = oldSize; return false; } } @@ -484,17 +484,17 @@ bool JSSerializer::WriteJSSet(const JSHandle &value) bool JSSerializer::WriteJSRegExp(const JSHandle &value) { JSHandle regExp = JSHandle::Cast(value); - size_t oldSize = bufferSize_; + size_t oldSize = buffer_size_; if (!WriteType(SerializationUID::JS_REG_EXP)) { return false; } if (!WritePlainObject(value)) { - bufferSize_ = oldSize; + buffer_size_ = oldSize; return false; } uint32_t bufferSize = static_cast(regExp->GetLength().GetInt()); if (!WriteLength(bufferSize)) { - bufferSize_ = oldSize; + buffer_size_ = oldSize; return false; } // Write Accessor(ByteCodeBuffer) which is a pointer to a Dynbuffer @@ -502,19 +502,19 @@ bool JSSerializer::WriteJSRegExp(const JSHandle &value) JSHandle np = JSHandle::Cast(bufferValue); void *dynBuffer = np->GetExternalPointer(); if (!WriteRawData(dynBuffer, bufferSize)) { - bufferSize_ = oldSize; + buffer_size_ = oldSize; return false; } // Write Accessor(OriginalSource) JSHandle originalSource(thread_, regExp->GetOriginalSource()); if (!SerializeJSTaggedValue(originalSource)) { - bufferSize_ = oldSize; + buffer_size_ = oldSize; return false; } // Write Accessor(OriginalFlags) JSHandle originalFlags(thread_, regExp->GetOriginalFlags()); if (!SerializeJSTaggedValue(originalFlags)) { - bufferSize_ = oldSize; + buffer_size_ = oldSize; return false; } return true; @@ -523,42 +523,42 @@ bool JSSerializer::WriteJSRegExp(const JSHandle &value) bool JSSerializer::WriteJSTypedArray(const JSHandle &value, SerializationUID uId) { JSHandle typedArray = JSHandle::Cast(value); - size_t oldSize = bufferSize_; + size_t oldSize = buffer_size_; if (!WriteType(uId)) { return false; } if (!WritePlainObject(value)) { - bufferSize_ = oldSize; + buffer_size_ = oldSize; return false; } // Write ACCESSORS(ViewedArrayBuffer) which is a pointer to an ArrayBuffer JSHandle viewedArrayBuffer(thread_, typedArray->GetViewedArrayBuffer()); if (!WriteJSArrayBuffer(viewedArrayBuffer)) { - bufferSize_ = oldSize; + buffer_size_ = oldSize; return false; } // Write ACCESSORS(TypedArrayName) JSHandle typedArrayName(thread_, typedArray->GetTypedArrayName()); if (!SerializeJSTaggedValue(typedArrayName)) { - bufferSize_ = oldSize; + buffer_size_ = oldSize; return false; } // Write ACCESSORS(ByteLength) JSTaggedValue byteLength = typedArray->GetByteLength(); if (!WriteRawData(&byteLength, sizeof(JSTaggedValue))) { - bufferSize_ = oldSize; + buffer_size_ = oldSize; return false; } // Write ACCESSORS(ByteOffset) JSTaggedValue byteOffset = typedArray->GetByteOffset(); if (!WriteRawData(&byteOffset, sizeof(JSTaggedValue))) { - bufferSize_ = oldSize; + buffer_size_ = oldSize; return false; } // Write ACCESSORS(ArrayLength) JSTaggedValue arrayLength = typedArray->GetArrayLength(); if (!WriteRawData(&arrayLength, sizeof(JSTaggedValue))) { - bufferSize_ = oldSize; + buffer_size_ = oldSize; return false; } return true; @@ -566,13 +566,13 @@ bool JSSerializer::WriteJSTypedArray(const JSHandle &value, Seria bool JSSerializer::WriteNativeFunctionPointer(const JSHandle &value) { - size_t oldSize = bufferSize_; + size_t oldSize = buffer_size_; if (!WriteType(SerializationUID::NATIVE_FUNCTION_POINTER)) { return false; } JSTaggedValue pointer = value.GetTaggedValue(); if (!WriteRawData(&pointer, sizeof(JSTaggedValue))) { - bufferSize_ = oldSize; + buffer_size_ = oldSize; return false; } return true; @@ -580,7 +580,7 @@ bool JSSerializer::WriteNativeFunctionPointer(const JSHandle &val bool JSSerializer::WriteJSArrayBuffer(const JSHandle &value) { - size_t oldSize = bufferSize_; + size_t oldSize = buffer_size_; JSHandle arrayBuffer = JSHandle::Cast(value); if (arrayBuffer->IsDetach()) { @@ -594,14 +594,14 @@ bool JSSerializer::WriteJSArrayBuffer(const JSHandle &value) // Write Accessors(ArrayBufferByteLength) JSTaggedValue taggedLength = arrayBuffer->GetArrayBufferByteLength(); if (!WriteRawData(&taggedLength, sizeof(JSTaggedValue))) { - bufferSize_ = oldSize; + buffer_size_ = oldSize; return false; } // write Accessor shared which indicate the C memeory is shared bool shared = arrayBuffer->GetShared().ToBoolean(); if (!WriteBoolean(shared)) { - bufferSize_ = oldSize; + buffer_size_ = oldSize; return false; } @@ -610,7 +610,7 @@ bool JSSerializer::WriteJSArrayBuffer(const JSHandle &value) void *buffer = np->GetExternalPointer(); auto bufferAddr = reinterpret_cast(buffer); if (!WriteRawData(&bufferAddr, sizeof(uint64_t))) { - bufferSize_ = oldSize; + buffer_size_ = oldSize; return false; } } else { @@ -619,14 +619,14 @@ bool JSSerializer::WriteJSArrayBuffer(const JSHandle &value) JSHandle np(thread_, arrayBuffer->GetArrayBufferData()); void *buffer = np->GetExternalPointer(); if (!WriteRawData(buffer, byteLength)) { - bufferSize_ = oldSize; + buffer_size_ = oldSize; return false; } } // write obj properties if (!WritePlainObject(value)) { - bufferSize_ = oldSize; + buffer_size_ = oldSize; return false; } @@ -636,38 +636,38 @@ bool JSSerializer::WriteJSArrayBuffer(const JSHandle &value) bool JSSerializer::WritePlainObject(const JSHandle &objValue) { JSHandle obj = JSHandle::Cast(objValue); - size_t oldSize = bufferSize_; + size_t oldSize = buffer_size_; if (!WriteType(SerializationUID::JS_PLAIN_OBJECT)) { return false; } // Get the number of elements stored in obj uint32_t elementsLength = obj->GetNumberOfElements(); if (!WriteLength(elementsLength)) { - bufferSize_ = oldSize; + buffer_size_ = oldSize; return false; } std::vector keyVector; JSObject::GetALLElementKeysIntoVector(thread_, obj, keyVector); // Write elements' description attributes and value if (keyVector.size() != elementsLength) { - bufferSize_ = oldSize; + buffer_size_ = oldSize; return false; } for (uint32_t i = 0; i < elementsLength; i++) { JSHandle key(thread_, keyVector[i]); if (!SerializeJSTaggedValue(key)) { - bufferSize_ = oldSize; + buffer_size_ = oldSize; return false; } PropertyDescriptor desc(thread_); JSObject::OrdinaryGetOwnProperty(thread_, obj, key, desc); if (!WriteDesc(desc)) { - bufferSize_ = oldSize; + buffer_size_ = oldSize; return false; } JSHandle value = desc.GetValue(); if (!SerializeJSTaggedValue(value)) { - bufferSize_ = oldSize; + buffer_size_ = oldSize; return false; } } @@ -675,34 +675,34 @@ bool JSSerializer::WritePlainObject(const JSHandle &objValue) keyVector.clear(); uint32_t propertiesLength = obj->GetNumberOfKeys(); if (!WriteLength(propertiesLength)) { - bufferSize_ = oldSize; + buffer_size_ = oldSize; return false; } JSObject::GetAllKeys(thread_, obj, keyVector); if (keyVector.size() != propertiesLength) { - bufferSize_ = oldSize; + buffer_size_ = oldSize; return false; } // Write keys' description attributes and related values for (uint32_t i = 0; i < propertiesLength; i++) { if (keyVector.empty()) { - bufferSize_ = oldSize; + buffer_size_ = oldSize; return false; } JSHandle key(thread_, keyVector[i]); if (!SerializeJSTaggedValue(key)) { - bufferSize_ = oldSize; + buffer_size_ = oldSize; return false; } PropertyDescriptor desc(thread_); JSObject::OrdinaryGetOwnProperty(thread_, obj, key, desc); if (!WriteDesc(desc)) { - bufferSize_ = oldSize; + buffer_size_ = oldSize; return false; } JSHandle value = desc.GetValue(); if (!SerializeJSTaggedValue(value)) { - bufferSize_ = oldSize; + buffer_size_ = oldSize; return false; } } @@ -711,35 +711,35 @@ bool JSSerializer::WritePlainObject(const JSHandle &objValue) bool JSSerializer::WriteDesc(const PropertyDescriptor &desc) { - size_t oldSize = bufferSize_; + size_t oldSize = buffer_size_; bool isWritable = desc.IsWritable(); if (!WriteBoolean(isWritable)) { - bufferSize_ = oldSize; + buffer_size_ = oldSize; return false; } bool isEnumerable = desc.IsEnumerable(); if (!WriteBoolean(isEnumerable)) { - bufferSize_ = oldSize; + buffer_size_ = oldSize; return false; } bool isConfigurable = desc.IsConfigurable(); if (!WriteBoolean(isConfigurable)) { - bufferSize_ = oldSize; + buffer_size_ = oldSize; return false; } bool hasWritable = desc.HasWritable(); if (!WriteBoolean(hasWritable)) { - bufferSize_ = oldSize; + buffer_size_ = oldSize; return false; } bool hasEnumerable = desc.HasEnumerable(); if (!WriteBoolean(hasEnumerable)) { - bufferSize_ = oldSize; + buffer_size_ = oldSize; return false; } bool hasConfigurable = desc.HasConfigurable(); if (!WriteBoolean(hasConfigurable)) { - bufferSize_ = oldSize; + buffer_size_ = oldSize; return false; } return true; @@ -943,7 +943,7 @@ JSHandle JSDeserializer::ReadJSError(SerializationUID uid) JSHandle msg = DeserializeJSTaggedValue(); JSHandle handleMsg(msg); JSHandle errorTag = JSHandle::Cast(factory->NewJSError(errorType, handleMsg)); - referenceMap_.insert(std::pair(objectId_++, errorTag)); + reference_map_.insert(std::pair(object_id_++, errorTag)); return errorTag; } @@ -955,7 +955,7 @@ JSHandle JSDeserializer::ReadJSDate() JSHandle date = JSHandle::Cast(factory->NewJSObjectByConstructor(JSHandle(dateFunction), dateFunction)); JSHandle dateTag = JSHandle::Cast(date); - referenceMap_.insert(std::pair(objectId_++, dateTag)); + reference_map_.insert(std::pair(object_id_++, dateTag)); if (!JudgeType(SerializationUID::JS_PLAIN_OBJECT) || !DefinePropertiesAndElements(dateTag)) { return JSHandle(); } @@ -976,7 +976,7 @@ JSHandle JSDeserializer::ReadJSArray() { JSHandle jsArray = thread_->GetEcmaVM()->GetFactory()->NewJSArray(); JSHandle arrayTag = JSHandle::Cast(jsArray); - referenceMap_.insert(std::pair(objectId_++, arrayTag)); + reference_map_.insert(std::pair(object_id_++, arrayTag)); if (!JudgeType(SerializationUID::JS_PLAIN_OBJECT) || !DefinePropertiesAndElements(arrayTag)) { return JSHandle(); } @@ -1002,7 +1002,7 @@ JSHandle JSDeserializer::ReadEcmaString() JSHandle ecmaString = factory->NewFromUtf8(string, stringLength); auto stringTag = JSHandle(ecmaString); - referenceMap_.insert(std::pair(objectId_++, stringTag)); + reference_map_.insert(std::pair(object_id_++, stringTag)); return stringTag; } @@ -1013,7 +1013,7 @@ JSHandle JSDeserializer::ReadPlainObject() JSHandle jsObject = thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(objFunc), objFunc); JSHandle objTag = JSHandle::Cast(jsObject); - referenceMap_.insert(std::pair(objectId_++, objTag)); + reference_map_.insert(std::pair(object_id_++, objTag)); if (!DefinePropertiesAndElements(objTag)) { return JSHandle(); } @@ -1028,7 +1028,7 @@ JSHandle JSDeserializer::ReadJSMap() JSHandle jsMap = JSHandle::Cast(factory->NewJSObjectByConstructor(JSHandle(mapFunction), mapFunction)); JSHandle mapTag = JSHandle::Cast(jsMap); - referenceMap_.insert(std::pair(objectId_++, mapTag)); + reference_map_.insert(std::pair(object_id_++, mapTag)); if (!JudgeType(SerializationUID::JS_PLAIN_OBJECT) || !DefinePropertiesAndElements(mapTag)) { return JSHandle(); } @@ -1060,7 +1060,7 @@ JSHandle JSDeserializer::ReadJSSet() JSHandle jsSet = JSHandle::Cast(factory->NewJSObjectByConstructor(JSHandle(setFunction), setFunction)); JSHandle setTag = JSHandle::Cast(jsSet); - referenceMap_.insert(std::pair(objectId_++, setTag)); + reference_map_.insert(std::pair(object_id_++, setTag)); if (!JudgeType(SerializationUID::JS_PLAIN_OBJECT) || !DefinePropertiesAndElements(setTag)) { return JSHandle(); } @@ -1088,7 +1088,7 @@ JSHandle JSDeserializer::ReadJSRegExp() JSHandle obj = factory->NewJSObjectByConstructor(JSHandle(regexpFunction), regexpFunction); JSHandle regExp = JSHandle::Cast(obj); JSHandle regexpTag = JSHandle::Cast(regExp); - referenceMap_.insert(std::pair(objectId_++, regexpTag)); + reference_map_.insert(std::pair(object_id_++, regexpTag)); if (!JudgeType(SerializationUID::JS_PLAIN_OBJECT) || !DefinePropertiesAndElements(regexpTag)) { return JSHandle(); } @@ -1159,7 +1159,7 @@ JSHandle JSDeserializer::ReadJSTypedArray(SerializationUID uid) JSHandle::Cast(factory->NewJSObjectByConstructor(JSHandle(target), target)); obj = JSHandle::Cast(typedArray); objTag = JSHandle::Cast(obj); - referenceMap_.insert(std::pair(objectId_++, objTag)); + reference_map_.insert(std::pair(object_id_++, objTag)); if (!JudgeType(SerializationUID::JS_PLAIN_OBJECT) || !DefinePropertiesAndElements(objTag)) { return JSHandle(); } @@ -1226,7 +1226,7 @@ JSHandle JSDeserializer::ReadJSArrayBuffer() void *bufferData = ToVoidPtr(*bufferAddr); JSHandle arrayBuffer = factory->NewJSArrayBuffer(bufferData, byteLength, nullptr, nullptr); arrayBufferTag = JSHandle::Cast(arrayBuffer); - referenceMap_.insert(std::pair(objectId_++, arrayBufferTag)); + reference_map_.insert(std::pair(object_id_++, arrayBufferTag)); } else { void *fromBuffer = GetBuffer(byteLength); if (fromBuffer == nullptr) { @@ -1234,7 +1234,7 @@ JSHandle JSDeserializer::ReadJSArrayBuffer() } JSHandle arrayBuffer = factory->NewJSArrayBuffer(byteLength); arrayBufferTag = JSHandle::Cast(arrayBuffer); - referenceMap_.insert(std::pair(objectId_++, arrayBufferTag)); + reference_map_.insert(std::pair(object_id_++, arrayBufferTag)); JSHandle np(thread_, arrayBuffer->GetArrayBufferData()); void *toBuffer = np->GetExternalPointer(); if (memcpy_s(toBuffer, byteLength, fromBuffer, byteLength) != EOK) { @@ -1282,8 +1282,8 @@ JSHandle JSDeserializer::ReadReference() if (!ReadObjectId(&objId)) { return JSHandle(); } - auto objIter = referenceMap_.find(objId); - if (objIter == referenceMap_.end()) { + auto objIter = reference_map_.find(objId); + if (objIter == reference_map_.end()) { return JSHandle(); } return objIter->second; @@ -1407,15 +1407,15 @@ bool Serializer::WriteValue(JSThread *thread, const JSHandle &val if (!PrepareTransfer(thread, transfer)) { return false; } - if (!valueSerializer_.SerializeJSTaggedValue(value)) { + if (!value_serializer_.SerializeJSTaggedValue(value)) { return false; } if (!FinalizeTransfer(thread, transfer)) { return false; } - std::pair pair = valueSerializer_.ReleaseBuffer(); + std::pair pair = value_serializer_.ReleaseBuffer(); data_->value_.reset(pair.first); - data_->dataSize_ = pair.second; + data_->data_size_ = pair.second; return true; } @@ -1441,7 +1441,7 @@ bool Serializer::PrepareTransfer(JSThread *thread, const JSHandle if (!element->IsArrayBuffer()) { return false; } - arrayBufferIdxs_.emplace_back(k); + array_buffer_idxs_.emplace_back(k); } k++; } @@ -1450,7 +1450,7 @@ bool Serializer::PrepareTransfer(JSThread *thread, const JSHandle bool Serializer::FinalizeTransfer(JSThread *thread, const JSHandle &transfer) { - for (int idx : arrayBufferIdxs_) { + for (int idx : array_buffer_idxs_) { JSHandle element = JSArray::FastGetPropertyByValue(thread, transfer, idx); JSArrayBuffer::Cast(element->GetHeapObject())->Detach(thread); } @@ -1459,6 +1459,6 @@ bool Serializer::FinalizeTransfer(JSThread *thread, const JSHandle Deserializer::ReadValue() { - return valueDeserializer_.DeserializeJSTaggedValue(); + return value_deserializer_.DeserializeJSTaggedValue(); } } // namespace panda::ecmascript diff --git a/runtime/js_serializer.h b/runtime/js_serializer.h index 99a12bf186a4ef037a76cfaf753e6e9800e665c2..92cf4321ba8d2a66ef5950dd9d89454403ebd1c5 100644 --- a/runtime/js_serializer.h +++ b/runtime/js_serializer.h @@ -124,13 +124,13 @@ private: JSThread *thread_; uint8_t *buffer_ = nullptr; - uint64_t sizeLimit_ = 0; - size_t bufferSize_ = 0; - size_t bufferCapacity_ = 0; + uint64_t size_limit_ = 0; + size_t buffer_size_ = 0; + size_t buffer_capacity_ = 0; // The Reference map is used for check whether a tagged object has been serialized // Reference map works only if no gc happens during serialization - std::map referenceMap_; - uint64_t objectId_ = 0; + std::map reference_map_; + uint64_t object_id_ = 0; }; class JSDeserializer { @@ -177,8 +177,8 @@ private: uint8_t *begin_ = nullptr; const uint8_t *position_ = nullptr; const uint8_t *const end_ = nullptr; - uint64_t objectId_ = 0; - std::map> referenceMap_; + uint64_t object_id_ = 0; + std::map> reference_map_; }; class SerializationData { @@ -192,7 +192,7 @@ public: } size_t GetSize() const { - return dataSize_; + return data_size_; } NO_MOVE_SEMANTIC(SerializationData); @@ -206,7 +206,7 @@ private: free(ptr); } }; - size_t dataSize_ {0}; + size_t data_size_ {0}; std::unique_ptr value_; private: @@ -215,7 +215,7 @@ private: class Serializer { public: - explicit Serializer(JSThread *thread) : valueSerializer_(thread) {} + explicit Serializer(JSThread *thread) : value_serializer_(thread) {} ~Serializer() = default; bool WriteValue(JSThread *thread, const JSHandle &value, const JSHandle &transfer); @@ -228,15 +228,15 @@ private: bool PrepareTransfer(JSThread *thread, const JSHandle &transfer); bool FinalizeTransfer(JSThread *thread, const JSHandle &transfer); - ecmascript::JSSerializer valueSerializer_; + ecmascript::JSSerializer value_serializer_; std::unique_ptr data_; - CVector arrayBufferIdxs_; + CVector array_buffer_idxs_; }; class Deserializer { public: explicit Deserializer(JSThread *thread, SerializationData *data) - : valueDeserializer_(thread, data->GetData(), data->GetSize()) + : value_deserializer_(thread, data->GetData(), data->GetSize()) { } ~Deserializer() = default; @@ -247,7 +247,7 @@ public: NO_COPY_SEMANTIC(Deserializer); private: - ecmascript::JSDeserializer valueDeserializer_; + ecmascript::JSDeserializer value_deserializer_; }; } // namespace panda::ecmascript diff --git a/runtime/js_thread.cpp b/runtime/js_thread.cpp index e7c5e6abeda0df2c006f602ae1fb9cc603303fb1..18a5c2ba689d25508e190153930a499fba273a93 100644 --- a/runtime/js_thread.cpp +++ b/runtime/js_thread.cpp @@ -28,7 +28,7 @@ namespace panda::ecmascript { JSThread *JSThread::Create(Runtime *runtime, PandaVM *vm) { auto jsThread = new JSThread(runtime, vm); - jsThread->regionFactory_ = EcmaVM::Cast(vm)->GetRegionFactory(); + jsThread->region_factory_ = EcmaVM::Cast(vm)->GetRegionFactory(); jsThread->InitBuffers(); JSThread::SetCurrent(jsThread); jsThread->NativeCodeBegin(); @@ -41,30 +41,30 @@ JSThread::JSThread(Runtime *runtime, PandaVM *vm) { SetLanguageContext(runtime->GetLanguageContext(panda_file::SourceLang::ECMASCRIPT)); auto chunk = EcmaVM::Cast(vm)->GetChunk(); - globalStorage_ = chunk->New(chunk); - internalCallParams_ = new InternalCallParams(); - propertiesCache_ = new PropertiesCache(); + global_storage_ = chunk->New(chunk); + 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; - EcmaVM::Cast(GetVM())->GetChunk()->Delete(globalStorage_); - - regionFactory_ = nullptr; - 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; + EcmaVM::Cast(GetVM())->GetChunk()->Delete(global_storage_); + + region_factory_ = nullptr; + 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; } } @@ -107,18 +107,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())); @@ -128,7 +128,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(); @@ -163,8 +163,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()) { @@ -172,24 +172,24 @@ 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; @@ -197,8 +197,8 @@ uintptr_t *JSThread::ExpandHandleStorage() void JSThread::ShrinkHandleStorage(int prevIndex) { - currentHandleStorageIndex_ = prevIndex; - int32_t lastIndex = handleStorageNodes_.size() - 1; + current_handle_storage_index_ = prevIndex; + 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); @@ -208,11 +208,11 @@ void JSThread::ShrinkHandleStorage(int prevIndex) } #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(); } } } @@ -222,19 +222,19 @@ 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) diff --git a/runtime/js_thread.h b/runtime/js_thread.h index 25901d3dad41132566bda78d588c18f75c6424c1..d17cba4f0e55fc7e6627febe09943e71d23e4ff9 100644 --- a/runtime/js_thread.h +++ b/runtime/js_thread.h @@ -82,29 +82,29 @@ 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); RegionFactory *GetRegionFactory() const { - return regionFactory_; + return region_factory_; } void Iterate(const RootVisitor &v0, const RootRangeVisitor &v1); @@ -114,37 +114,37 @@ public: 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); @@ -163,12 +163,12 @@ public: EcmaGlobalStorage *GetEcmaGlobalStorage() const { - return globalStorage_; + return global_storage_; } const GlobalEnvConstants *GlobalConstants() const { - return &globalConst_; + return &global_const_; } EcmascriptEnvironment *GetEcmascriptEnv() const @@ -183,29 +183,29 @@ public: JSTaggedValue GetFunctionalObject() const { - return functionalObject_; + return functional_object_; } void SetFunctionalObject(JSTaggedValue functionalObject) { - functionalObject_ = functionalObject; + functional_object_ = functionalObject; } JSTaggedValue GetInvocationLexicalEnv() const { - return invocationLexicalEnv_; + return invocation_lexical_env_; } void SetInvocationLexicalEnv(JSTaggedValue invocationLexicalEnv) { - invocationLexicalEnv_ = invocationLexicalEnv; + invocation_lexical_env_ = invocationLexicalEnv; } void NotifyStableArrayElementsGuardians(JSHandle receiver); bool IsStableArrayElementsGuardiansInvalid() const { - return !stableArrayElementsGuardians_; + return !stable_array_elements_guardians_; } void ResetGuardians(); @@ -218,7 +218,7 @@ public: InternalCallParams *GetInternalCallParams() const { - return internalCallParams_; + return internal_call_params_; } ThreadId GetThreadId() const @@ -235,50 +235,50 @@ 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 GetCurrentFrameOffset() { - return MEMBER_OFFSET(JSThread, currentFrame_); + return MEMBER_OFFSET(JSThread, current_frame_); } void SetMarkStatus(MarkStatus status) { - uint64_t newVal = MarkStatusBits::Update(threadStateBitField_, status); - threadStateBitField_ = newVal; + uint64_t newVal = MarkStatusBits::Update(thread_state_bit_field_, status); + thread_state_bit_field_ = newVal; } bool IsReadyToMark() const { - auto status = MarkStatusBits::Decode(threadStateBitField_); + auto status = MarkStatusBits::Decode(thread_state_bit_field_); return status == MarkStatus::READY_TO_MARK; } bool IsMarking() const { - auto status = MarkStatusBits::Decode(threadStateBitField_); + auto status = MarkStatusBits::Decode(thread_state_bit_field_); return status == MarkStatus::MARKING; } bool IsMarkFinished() const { - auto status = MarkStatusBits::Decode(threadStateBitField_); + auto status = MarkStatusBits::Decode(thread_state_bit_field_); return status == MarkStatus::MARK_FINISHED; } @@ -286,22 +286,22 @@ public: void SetGetStackSignal(bool isParseStack) { - getStackSignal_ = isParseStack; + get_stack_signal_ = isParseStack; } bool GetStackSignal() const { - return getStackSignal_; + return get_stack_signal_; } void SetGcState(bool gcState) { - gcState_ = gcState; + gc_state_ = gcState; } bool GetGcState() const { - return gcState_; + return gc_state_; } static constexpr uint32_t GetExceptionOffset() { @@ -321,12 +321,12 @@ public: void SetGlobalObject(JSTaggedValue globalObj) { - globalObj_ = globalObj; + global_obj_ = globalObj; } JSTaggedValue GetGlobalObject() const { - return globalObj_; + return global_obj_; } private: @@ -348,35 +348,35 @@ private: static constexpr int32_t MIN_HANDLE_STORAGE_SIZE = 2; // MM: handles, global-handles, and aot-stubs. - int nestedLevel_ = 0; - RegionFactory *regionFactory_ {nullptr}; - JSTaggedType *handleScopeStorageNext_ {nullptr}; - JSTaggedType *handleScopeStorageEnd_ {nullptr}; - std::vector *> handleStorageNodes_ {}; - int32_t currentHandleStorageIndex_ {-1}; - int32_t handleScopeCount_ {0}; - JSTaggedValue stubCode_ {JSTaggedValue::Hole()}; + int nested_level_ = 0; + RegionFactory *region_factory_ {nullptr}; + 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}; + 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 GlobalHandleCollection; diff --git a/runtime/literal_data_extractor.cpp b/runtime/literal_data_extractor.cpp index 9314e7166aa569050471cdb3d981f54face2682b..97edc8deb189655330fbabf994f3320019bc97b3 100644 --- a/runtime/literal_data_extractor.cpp +++ b/runtime/literal_data_extractor.cpp @@ -62,7 +62,7 @@ void LiteralDataExtractor::ExtractObjectDatas(JSThread *thread, const panda_file } case LiteralTag::STRING: { StringData sd = pf->GetStringData(panda_file::File::EntityId(std::get(value))); - EcmaString *str = factory->GetRawStringFromStringTable(sd.data, sd.utf16_length, sd.is_ascii); + EcmaString *str = factory->GetRawStringFromStringTable(sd.data_, sd.utf16_length_, sd.is_ascii_); jt = JSTaggedValue(str); uint32_t idx = 0; if (JSTaggedValue::ToElementIndex(jt, &idx) && ppos % pairSize == 0) { @@ -144,7 +144,7 @@ JSHandle LiteralDataExtractor::GetDatasIgnoreType(JSThread *thread, } case LiteralTag::STRING: { StringData sd = pf->GetStringData(panda_file::File::EntityId(std::get(value))); - EcmaString *str = factory->GetRawStringFromStringTable(sd.data, sd.utf16_length, sd.is_ascii); + EcmaString *str = factory->GetRawStringFromStringTable(sd.data_, sd.utf16_length_, sd.is_ascii_); jt = JSTaggedValue(str); break; } diff --git a/runtime/mem/allocator-inl.h b/runtime/mem/allocator-inl.h index 413cb1be32f177fcd89a249e60c5c24ac9489474..68f2330e92fb09213d9ed3e83276067b7bcf83a2 100644 --- a/runtime/mem/allocator-inl.h +++ b/runtime/mem/allocator-inl.h @@ -70,10 +70,10 @@ uintptr_t BumpPointerAllocator::Allocate(size_t size) FreeListAllocator::FreeListAllocator(const Space *space) : heap_(space->GetHeap()), type_(space->GetSpaceType()) { - freeList_ = std::make_unique(); - bpAllocator_.Reset(space); - FreeObject::Cast(bpAllocator_.GetTop())->SetAvailable(bpAllocator_.Available()); - FreeObject::Cast(bpAllocator_.GetTop())->SetNext(nullptr); + free_list_ = std::make_unique(); + bp_allocator_.Reset(space); + FreeObject::Cast(bp_allocator_.GetTop())->SetAvailable(bp_allocator_.Available()); + FreeObject::Cast(bp_allocator_.GetTop())->SetNext(nullptr); } void FreeListAllocator::Reset(const Space *space) @@ -81,17 +81,17 @@ void FreeListAllocator::Reset(const Space *space) heap_ = space->GetHeap(); type_ = space->GetSpaceType(); sweeping_ = false; - freeList_ = std::make_unique(); - bpAllocator_.Reset(space); - FreeObject::FillFreeObject(heap_->GetEcmaVM(), bpAllocator_.GetTop(), bpAllocator_.Available()); + free_list_ = std::make_unique(); + bp_allocator_.Reset(space); + FreeObject::FillFreeObject(heap_->GetEcmaVM(), bp_allocator_.GetTop(), bp_allocator_.Available()); } void FreeListAllocator::Reset(Heap *heap) { heap_ = heap; - freeList_ = std::make_unique(); + free_list_ = std::make_unique(); sweeping_ = false; - bpAllocator_.Reset(); + bp_allocator_.Reset(); } void FreeListAllocator::AddFree(Region *region) @@ -106,13 +106,13 @@ uintptr_t FreeListAllocator::Allocate(size_t size) if (UNLIKELY(size < static_cast(TaggedObject::TaggedObjectSize()))) { return 0; } - auto ret = bpAllocator_.Allocate(size); + auto ret = bp_allocator_.Allocate(size); if (LIKELY(ret != 0)) { - FreeObject::FillFreeObject(heap_->GetEcmaVM(), bpAllocator_.GetTop(), bpAllocator_.Available()); - allocationSizeAccumulator_ += size; + FreeObject::FillFreeObject(heap_->GetEcmaVM(), bp_allocator_.GetTop(), bp_allocator_.Available()); + allocation_size_accumulator_ += size; return ret; } - FreeObject *object = freeList_->Allocator(size); + FreeObject *object = free_list_->Allocator(size); if (LIKELY(object != nullptr && !object->IsEmpty())) { return Allocate(object, size); } @@ -120,14 +120,14 @@ uintptr_t FreeListAllocator::Allocate(size_t size) if (sweeping_) { // Concurrent sweep maybe sweep same region heap_->GetSweeper()->FillSweptRegion(type_); - object = freeList_->Allocator(size); + object = free_list_->Allocator(size); if (LIKELY(object != nullptr && !object->IsEmpty())) { return Allocate(object, size); } // Parallel heap_->GetSweeper()->WaitingTaskFinish(type_); - object = freeList_->Allocator(size); + object = free_list_->Allocator(size); if (LIKELY(object != nullptr && !object->IsEmpty())) { return Allocate(object, size); } @@ -139,21 +139,21 @@ uintptr_t FreeListAllocator::Allocate(size_t size) uintptr_t FreeListAllocator::Allocate(FreeObject *object, size_t size) { FreeBumpPoint(); - bpAllocator_.Reset(object->GetBegin(), object->GetEnd()); - auto ret = bpAllocator_.Allocate(size); - if (ret != 0 && bpAllocator_.Available() > 0) { - FreeObject::FillFreeObject(heap_->GetEcmaVM(), bpAllocator_.GetTop(), bpAllocator_.Available()); - allocationSizeAccumulator_ += size; + bp_allocator_.Reset(object->GetBegin(), object->GetEnd()); + auto ret = bp_allocator_.Allocate(size); + if (ret != 0 && bp_allocator_.Available() > 0) { + FreeObject::FillFreeObject(heap_->GetEcmaVM(), bp_allocator_.GetTop(), bp_allocator_.Available()); + allocation_size_accumulator_ += size; } return ret; } void FreeListAllocator::FreeBumpPoint() { - auto begin = bpAllocator_.GetTop(); - auto end = bpAllocator_.GetEnd(); + auto begin = bp_allocator_.GetTop(); + auto end = bp_allocator_.GetEnd(); Free(begin, end); - bpAllocator_.Reset(); + bp_allocator_.Reset(); } void FreeListAllocator::Free(uintptr_t begin, uintptr_t end, bool isAdd) @@ -167,25 +167,25 @@ void FreeListAllocator::Free(uintptr_t begin, uintptr_t end, bool isAdd) return; } - freeList_->Free(begin, size, isAdd); + free_list_->Free(begin, size, isAdd); } void FreeListAllocator::RebuildFreeList() { - bpAllocator_.Reset(); - freeList_->Rebuild(); + bp_allocator_.Reset(); + free_list_->Rebuild(); } void FreeListAllocator::Merge(FreeListAllocator *other) { ASSERT(type_ == other->type_); other->FreeBumpPoint(); - freeList_->Merge(other->freeList_.get()); + free_list_->Merge(other->free_list_.get()); } void FreeListAllocator::FillFreeList(FreeObjectKind *kind) { - freeList_->AddKind(kind); + free_list_->AddKind(kind); } size_t FreeListAllocator::GetAvailableSize() const @@ -193,7 +193,7 @@ size_t FreeListAllocator::GetAvailableSize() const if (sweeping_) { heap_->GetSweeper()->WaitingTaskFinish(type_); } - return freeList_->GetFreeObjectSize(); + return free_list_->GetFreeObjectSize(); } } // namespace panda::ecmascript #endif // ECMASCRIPT_MEM_ALLOCATOR_INL_H diff --git a/runtime/mem/allocator.h b/runtime/mem/allocator.h index 8c9d76e4c0b1ae4939428e9bc116fea053a286ea..0d704122b072c8903d9776629e1f269fda90b9d6 100644 --- a/runtime/mem/allocator.h +++ b/runtime/mem/allocator.h @@ -100,8 +100,8 @@ public: inline void Swap(FreeListAllocator &other) { heap_ = other.heap_; - bpAllocator_.Swap(other.bpAllocator_); - freeList_.swap(other.freeList_); + bp_allocator_.Swap(other.bp_allocator_); + free_list_.swap(other.free_list_); type_ = other.type_; sweeping_ = other.sweeping_; } @@ -122,18 +122,18 @@ public: size_t GetAllocatedSize() const { - return allocationSizeAccumulator_; + return allocation_size_accumulator_; } private: inline uintptr_t Allocate(FreeObject *object, size_t size); - BumpPointerAllocator bpAllocator_; - std::unique_ptr freeList_; + BumpPointerAllocator bp_allocator_; + std::unique_ptr free_list_; Heap *heap_ {nullptr}; MemSpaceType type_ = OLD_SPACE; bool sweeping_ = false; - size_t allocationSizeAccumulator_ = 0; + size_t allocation_size_accumulator_ = 0; }; } // namespace panda::ecmascript diff --git a/runtime/mem/assert_scope-inl.h b/runtime/mem/assert_scope-inl.h index d2bde54fd11230859f3912baebb35d7a3eefb44e..c705fb85ebff64ed840cacbf89f931fbe7046a50 100644 --- a/runtime/mem/assert_scope-inl.h +++ b/runtime/mem/assert_scope-inl.h @@ -24,14 +24,14 @@ namespace panda::ecmascript { static thread_local size_t currentAssertData(~0); template -AssertScopeT::AssertScopeT() : oldData_(currentAssertData) +AssertScopeT::AssertScopeT() : old_data_(currentAssertData) { switch (type) { case AssertType::GARBAGE_COLLECTION_ASSERT: - currentAssertData = AssertGarbageCollectBit::Update(oldData_.value(), isAllow); + currentAssertData = AssertGarbageCollectBit::Update(old_data_.value(), isAllow); break; case AssertType::HEAP_ALLOC_ASSERT: - currentAssertData = AssertHeapAllocBit::Update(oldData_.value(), isAllow); + currentAssertData = AssertHeapAllocBit::Update(old_data_.value(), isAllow); break; default: break; @@ -41,12 +41,12 @@ AssertScopeT::AssertScopeT() : oldData_(currentAssertData) template AssertScopeT::~AssertScopeT() { - if (!oldData_.has_value()) { + if (!old_data_.has_value()) { return; } - currentAssertData = oldData_.value(); - oldData_.reset(); + currentAssertData = old_data_.value(); + old_data_.reset(); } // static diff --git a/runtime/mem/assert_scope.h b/runtime/mem/assert_scope.h index a999f5c401403228e51b55834e9242dfcbab7beb..8f9943d89e4561934cc46aca6a1c28cd02340bc8 100644 --- a/runtime/mem/assert_scope.h +++ b/runtime/mem/assert_scope.h @@ -55,7 +55,7 @@ public: DEFAULT_NOEXCEPT_MOVE_SEMANTIC(AssertScopeT); private: - std::optional oldData_; + std::optional old_data_; }; using DisallowGarbageCollection = AssertScopeT; diff --git a/runtime/mem/chunk.cpp b/runtime/mem/chunk.cpp index 94553801e14161723a91ece3021bc6c4e2df5644..e911cd6a3172430dc47d84f58fd8baac6719d6b2 100644 --- a/runtime/mem/chunk.cpp +++ b/runtime/mem/chunk.cpp @@ -27,8 +27,8 @@ Area *Chunk::NewArea(size_t size) LOG_ECMA_MEM(FATAL) << "OOM Chunk::NewArea area is nullptr"; UNREACHABLE(); } - areaList_.AddNode(area); - currentArea_ = area; + area_list_.AddNode(area); + current_area_ = area; return area; } @@ -36,7 +36,7 @@ uintptr_t Chunk::Expand(size_t size) { ASSERT(end_ - ptr_ < size); - Area *head = currentArea_; + Area *head = current_area_; size_t newSize; if (head != nullptr) { // NOLINTNEXTLINE(hicpp-signed-bitwise) @@ -70,8 +70,8 @@ uintptr_t Chunk::Expand(size_t size) void Chunk::ReleaseMemory() { - while (!areaList_.IsEmpty()) { - Area *node = areaList_.PopBack(); + while (!area_list_.IsEmpty()) { + Area *node = area_list_.PopBack(); factory_->FreeArea(node); } ptr_ = 0; diff --git a/runtime/mem/chunk.h b/runtime/mem/chunk.h index 434451ca865a575e4df08959c8b34f1759f4aa23..955a05d64397381ea2a4b09b853456d84db45a8a 100644 --- a/runtime/mem/chunk.h +++ b/runtime/mem/chunk.h @@ -90,8 +90,8 @@ private: uintptr_t ptr_ {0}; uintptr_t end_ {0}; - Area *currentArea_ {nullptr}; - EcmaList areaList_ {}; + Area *current_area_ {nullptr}; + EcmaList area_list_ {}; RegionFactory *factory_ {nullptr}; }; } // namespace panda::ecmascript diff --git a/runtime/mem/compress_collector.cpp b/runtime/mem/compress_collector.cpp index 1c3c89972a4452ffdb3b7f62a2ec60701b0ae313..0bc689ee99f3d40639df6e46f103e00d7a25e6a3 100644 --- a/runtime/mem/compress_collector.cpp +++ b/runtime/mem/compress_collector.cpp @@ -28,7 +28,7 @@ #include "plugins/ecmascript/runtime/vmstat/runtime_stat.h" namespace panda::ecmascript { -CompressCollector::CompressCollector(Heap *heap) : heap_(heap), workList_(heap->GetWorkList()) {} +CompressCollector::CompressCollector(Heap *heap) : heap_(heap), work_list_(heap->GetWorkList()) {} void CompressCollector::RunPhases() { @@ -46,9 +46,9 @@ void CompressCollector::RunPhases() MarkingPhase(); SweepPhases(); FinishPhase(); - heap_->GetEcmaVM()->GetEcmaGCStats()->StatisticCompressCollector(clockScope.GetPauseTime(), youngAndOldAliveSize_, - youngSpaceCommitSize_, oldSpaceCommitSize_, - nonMoveSpaceFreeSize_, nonMoveSpaceCommitSize_); + heap_->GetEcmaVM()->GetEcmaGCStats()->StatisticCompressCollector( + clockScope.GetPauseTime(), young_and_old_alive_size_, young_space_commit_size_, old_space_commit_size_, + non_move_space_free_size_, non_move_space_commit_size_); ECMA_GC_LOG() << "CompressCollector::RunPhases " << clockScope.TotalSpentTime(); } @@ -70,15 +70,15 @@ void CompressCollector::InitializePhase() } }; heap_->EnumerateNonMovableRegions(callback); - workList_->Initialize(TriggerGCType::COMPRESS_FULL_GC, ParallelGCTaskPhase::COMPRESS_HANDLE_GLOBAL_POOL_TASK); + work_list_->Initialize(TriggerGCType::COMPRESS_FULL_GC, ParallelGCTaskPhase::COMPRESS_HANDLE_GLOBAL_POOL_TASK); heap_->GetCompressGcMarker()->Initialized(); heap_->GetEvacuationAllocator()->Initialize(TriggerGCType::COMPRESS_FULL_GC); - youngAndOldAliveSize_ = 0; - nonMoveSpaceFreeSize_ = 0; - youngSpaceCommitSize_ = heap_->GetFromSpace()->GetCommittedSize(); - oldSpaceCommitSize_ = heap_->GetCompressSpace()->GetCommittedSize(); - nonMoveSpaceCommitSize_ = heap_->GetNonMovableSpace()->GetCommittedSize(); + young_and_old_alive_size_ = 0; + non_move_space_free_size_ = 0; + young_space_commit_size_ = heap_->GetFromSpace()->GetCommittedSize(); + old_space_commit_size_ = heap_->GetCompressSpace()->GetCommittedSize(); + non_move_space_commit_size_ = heap_->GetNonMovableSpace()->GetCommittedSize(); } void CompressCollector::MarkingPhase() @@ -95,7 +95,7 @@ void CompressCollector::SweepPhases() // process weak reference auto totalThreadCount = Platform::GetCurrentPlatform()->GetTotalThreadNum() + 1; // gc thread and main thread for (uint32_t i = 0; i < totalThreadCount; i++) { - ProcessQueue *queue = workList_->GetWeakReferenceQueue(i); + ProcessQueue *queue = work_list_->GetWeakReferenceQueue(i); while (true) { auto obj = queue->PopBack(); @@ -153,7 +153,7 @@ void CompressCollector::SweepPhases() void CompressCollector::FinishPhase() { ECMA_BYTRACE_NAME(BYTRACE_TAG_ARK, "CompressCollector::FinishPhase"); - workList_->Finish(youngAndOldAliveSize_); + work_list_->Finish(young_and_old_alive_size_); heap_->GetEvacuationAllocator()->Finalize(TriggerGCType::COMPRESS_FULL_GC); } } // namespace panda::ecmascript diff --git a/runtime/mem/compress_collector.h b/runtime/mem/compress_collector.h index fa44094c2653b796f37a1589afcc3763adabb0c0..f30e264cd7b3452ddbd853ebf99ed96799a6617e 100644 --- a/runtime/mem/compress_collector.h +++ b/runtime/mem/compress_collector.h @@ -40,14 +40,14 @@ private: void FinishPhase(); Heap *heap_; - size_t youngAndOldAliveSize_ = 0; - size_t nonMoveSpaceFreeSize_ = 0; - size_t youngSpaceCommitSize_ = 0; - size_t oldSpaceCommitSize_ = 0; - size_t nonMoveSpaceCommitSize_ = 0; + size_t young_and_old_alive_size_ = 0; + size_t non_move_space_free_size_ = 0; + size_t young_space_commit_size_ = 0; + size_t old_space_commit_size_ = 0; + size_t non_move_space_commit_size_ = 0; // obtain from heap - WorkerHelper *workList_ {nullptr}; + WorkerHelper *work_list_ {nullptr}; friend class WorkerHelper; friend class Heap; diff --git a/runtime/mem/concurrent_marker.cpp b/runtime/mem/concurrent_marker.cpp index 9518c28716cfb5f6a13f50bce137bec91afbeecb..8d1e1be0ea7b283ccb77e77422653ee298c12b17 100644 --- a/runtime/mem/concurrent_marker.cpp +++ b/runtime/mem/concurrent_marker.cpp @@ -28,7 +28,7 @@ namespace panda::ecmascript { ConcurrentMarker::ConcurrentMarker(Heap *heap) - : heap_(heap), vm_(heap->GetEcmaVM()), thread_(vm_->GetJSThread()), workList_(heap->GetWorkList()) + : heap_(heap), vm_(heap->GetEcmaVM()), thread_(vm_->GetJSThread()), work_list_(heap->GetWorkList()) { } @@ -40,12 +40,12 @@ void ConcurrentMarker::ConcurrentMarking() ECMA_BYTRACE_NAME(BYTRACE_TAG_ARK, "ConcurrentMarker::ConcurrentMarking"); thread_->SetMarkStatus(MarkStatus::MARKING); if (!heap_->IsSemiMarkNeeded()) { - heapObjectSize_ = heap_->GetHeapObjectSize(); + heap_object_size_ = heap_->GetHeapObjectSize(); if (heap_->GetSweeper()->CanSelectCset()) { const_cast(heap_->GetOldSpace())->SelectCSet(); } } else { - heapObjectSize_ = heap_->GetNewSpace()->GetHeapObjectSize(); + heap_object_size_ = heap_->GetNewSpace()->GetHeapObjectSize(); } InitializeMarking(); @@ -58,7 +58,7 @@ void ConcurrentMarker::ConcurrentMarking() void ConcurrentMarker::FinishPhase() { size_t aliveSize = 0; - workList_->Finish(aliveSize); + work_list_->Finish(aliveSize); } void ConcurrentMarker::ReMarking() @@ -76,18 +76,18 @@ void ConcurrentMarker::ReMarking() void ConcurrentMarker::HandleMarkFinished() // js-thread wait for sweep { - os::memory::LockHolder lock(waitMarkingFinishedMutex_); - if (notifyMarkingFinished_) { + os::memory::LockHolder lock(wait_marking_finished_mutex_); + if (notify_marking_finished_) { heap_->CollectGarbage(TriggerGCType::OLD_GC); } } void ConcurrentMarker::WaitConcurrentMarkingFinished() // call in EcmaVm thread, wait for mark finished { - os::memory::LockHolder lock(waitMarkingFinishedMutex_); - if (!notifyMarkingFinished_) { - vmThreadWaitMarkingFinished_ = true; - waitMarkingFinishedCV_.Wait(&waitMarkingFinishedMutex_); + os::memory::LockHolder lock(wait_marking_finished_mutex_); + if (!notify_marking_finished_) { + vm_thread_wait_marking_finished_ = true; + wait_marking_finished_cv_.Wait(&wait_marking_finished_mutex_); } } @@ -95,7 +95,7 @@ void ConcurrentMarker::Reset(bool isClearCSet) { FinishPhase(); thread_->SetMarkStatus(MarkStatus::READY_TO_MARK); - notifyMarkingFinished_ = false; + notify_marking_finished_ = false; duration_ = 0.0; if (isClearCSet) { // Mix space gc clear cset when evacuation allocator finalize @@ -129,7 +129,7 @@ void ConcurrentMarker::InitializeMarking() } else { heap_->EnumerateRegions([](Region *current) { current->ResetAliveObject(); }); } - workList_->Initialize(TriggerGCType::OLD_GC, ParallelGCTaskPhase::CONCURRENT_HANDLE_GLOBAL_POOL_TASK); + work_list_->Initialize(TriggerGCType::OLD_GC, ParallelGCTaskPhase::CONCURRENT_HANDLE_GLOBAL_POOL_TASK); heap_->GetNonMovableMarker()->MarkRoots(0); } @@ -145,12 +145,12 @@ bool ConcurrentMarker::MarkerTask::Run(uint32_t threadId) void ConcurrentMarker::MarkingFinished() { - os::memory::LockHolder lock(waitMarkingFinishedMutex_); + os::memory::LockHolder lock(wait_marking_finished_mutex_); thread_->SetMarkStatus(MarkStatus::MARK_FINISHED); - if (vmThreadWaitMarkingFinished_) { - vmThreadWaitMarkingFinished_ = false; - waitMarkingFinishedCV_.Signal(); + if (vm_thread_wait_marking_finished_) { + vm_thread_wait_marking_finished_ = false; + wait_marking_finished_cv_.Signal(); } - notifyMarkingFinished_ = true; + notify_marking_finished_ = true; } } // namespace panda::ecmascript diff --git a/runtime/mem/concurrent_marker.h b/runtime/mem/concurrent_marker.h index cc5283a26ce68e745a448b232902d745878361df..94b7ea04c93b8b6994dfc355ccb79a5ee2640b4d 100644 --- a/runtime/mem/concurrent_marker.h +++ b/runtime/mem/concurrent_marker.h @@ -49,7 +49,7 @@ public: double GetHeapObjectSize() const { - return heapObjectSize_; + return heap_object_size_; } private: @@ -82,14 +82,14 @@ private: JSThread *thread_ {nullptr}; // obtain from heap - WorkerHelper *workList_ {nullptr}; - size_t heapObjectSize_ {0}; + WorkerHelper *work_list_ {nullptr}; + size_t heap_object_size_ {0}; double duration_ {0.0}; - bool notifyMarkingFinished_ {false}; // notify js-thread that marking is finished and need sweep - bool vmThreadWaitMarkingFinished_ {false}; // jsMainThread waiting for concurrentGC FINISHED - os::memory::Mutex waitMarkingFinishedMutex_; - os::memory::ConditionVariable waitMarkingFinishedCV_; + bool notify_marking_finished_ {false}; // notify js-thread that marking is finished and need sweep + bool vm_thread_wait_marking_finished_ {false}; // jsMainThread waiting for concurrentGC FINISHED + os::memory::Mutex wait_marking_finished_mutex_; + os::memory::ConditionVariable wait_marking_finished_cv_; }; } // namespace panda::ecmascript #endif // ECMASCRIPT_MEM_CONCURRENT_MARKER_H diff --git a/runtime/mem/concurrent_sweeper.cpp b/runtime/mem/concurrent_sweeper.cpp index 33ad87c970016edc431468ad7347e07208a8bdff..75ebc8b84d1d2761f5880183c1ece50c6d8e9dca 100644 --- a/runtime/mem/concurrent_sweeper.cpp +++ b/runtime/mem/concurrent_sweeper.cpp @@ -24,13 +24,13 @@ #include "plugins/ecmascript/runtime/platform/platform.h" namespace panda::ecmascript { -ConcurrentSweeper::ConcurrentSweeper(Heap *heap, bool concurrentSweep) : heap_(heap), concurrentSweep_(concurrentSweep) +ConcurrentSweeper::ConcurrentSweeper(Heap *heap, bool concurrentSweep) : heap_(heap), concurrent_sweep_(concurrentSweep) { } void ConcurrentSweeper::SweepPhases(bool compressGC) { - if (concurrentSweep_) { + if (concurrent_sweep_) { // Add all region to region list. Ensure all task finish if (!compressGC) { heap_->GetOldSpace()->EnumerateNonCollectRegionSet( @@ -41,21 +41,21 @@ void ConcurrentSweeper::SweepPhases(bool compressGC) [this](Region *current) { AddRegion(MACHINE_CODE_SPACE, current); }); // Prepare - isSweeping_ = true; - startSpaceType_ = compressGC ? NON_MOVABLE : OLD_SPACE; - for (int type = startSpaceType_; type < FREE_LIST_NUM; type++) { + is_sweeping_ = true; + start_space_type_ = compressGC ? NON_MOVABLE : OLD_SPACE; + for (int type = start_space_type_; type < FREE_LIST_NUM; type++) { auto spaceType = static_cast(type); FreeListAllocator &allocator = heap_->GetHeapManager()->GetFreeListAllocator(spaceType); - remainderTaskNum_[type] = FREE_LIST_NUM - startSpaceType_; + remainder_task_num_[type] = FREE_LIST_NUM - start_space_type_; allocator.SetSweeping(true); allocator.RebuildFreeList(); } if (!compressGC) { Platform::GetCurrentPlatform()->PostTask(std::make_unique(this, OLD_SPACE)); - canSelectCset_ = true; + can_select_cset_ = true; } else { - canSelectCset_ = false; + can_select_cset_ = false; } Platform::GetCurrentPlatform()->PostTask(std::make_unique(this, NON_MOVABLE)); Platform::GetCurrentPlatform()->PostTask(std::make_unique(this, MACHINE_CODE_SPACE)); @@ -63,9 +63,9 @@ void ConcurrentSweeper::SweepPhases(bool compressGC) if (!compressGC) { SweepSpace(OLD_SPACE, const_cast(heap_->GetOldSpace()), heap_->GetHeapManager()->GetOldSpaceAllocator()); - canSelectCset_ = true; + can_select_cset_ = true; } else { - canSelectCset_ = false; + can_select_cset_ = false; } SweepSpace(NON_MOVABLE, const_cast(heap_->GetNonMovableSpace()), heap_->GetHeapManager()->GetNonMovableSpaceAllocator()); @@ -90,7 +90,7 @@ void ConcurrentSweeper::SweepSpace(MemSpaceType type, bool isMain) if (!isMain) { os::memory::LockHolder holder(mutexs_[type]); - if (--remainderTaskNum_[type] == 0) { + if (--remainder_task_num_[type] == 0) { cvs_[type].SignalAll(); } } @@ -149,7 +149,7 @@ void ConcurrentSweeper::FreeRegion(Region *current, FreeListAllocator &allocator void ConcurrentSweeper::FillSweptRegion(MemSpaceType type) { - if (sweptList_[type].empty()) { + if (swept_list_[type].empty()) { return; } FreeListAllocator &allocator = heap_->GetHeapManager()->GetFreeListAllocator(type); @@ -173,16 +173,16 @@ void ConcurrentSweeper::FreeLiveRange(FreeListAllocator &allocator, Region *curr void ConcurrentSweeper::AddRegion(MemSpaceType type, Region *region) { - sweepingList_[type].emplace_back(region); + sweeping_list_[type].emplace_back(region); } Region *ConcurrentSweeper::GetRegionSafe(MemSpaceType type) { os::memory::LockHolder holder(mutexs_[type]); Region *region = nullptr; - if (!sweepingList_[type].empty()) { - region = sweepingList_[type].back(); - sweepingList_[type].pop_back(); + if (!sweeping_list_[type].empty()) { + region = sweeping_list_[type].back(); + sweeping_list_[type].pop_back(); } return region; } @@ -190,38 +190,38 @@ Region *ConcurrentSweeper::GetRegionSafe(MemSpaceType type) void ConcurrentSweeper::AddSweptRegionSafe(MemSpaceType type, Region *region) { os::memory::LockHolder holder(mutexs_[type]); - sweptList_[type].emplace_back(region); + swept_list_[type].emplace_back(region); } Region *ConcurrentSweeper::GetSweptRegionSafe(MemSpaceType type) { os::memory::LockHolder holder(mutexs_[type]); Region *region = nullptr; - if (!sweptList_[type].empty()) { - region = sweptList_[type].back(); - sweptList_[type].pop_back(); + if (!swept_list_[type].empty()) { + region = swept_list_[type].back(); + swept_list_[type].pop_back(); } return region; } void ConcurrentSweeper::EnsureAllTaskFinished() { - if (!isSweeping_) { + if (!is_sweeping_) { return; } - for (int i = startSpaceType_; i < FREE_LIST_NUM; i++) { + for (int i = start_space_type_; i < FREE_LIST_NUM; i++) { WaitingTaskFinish(static_cast(i)); } - isSweeping_ = false; + is_sweeping_ = false; } void ConcurrentSweeper::WaitingTaskFinish(MemSpaceType type) { - if (remainderTaskNum_[type] > 0) { + if (remainder_task_num_[type] > 0) { SweepSpace(type); { os::memory::LockHolder holder(mutexs_[type]); - while (remainderTaskNum_[type] > 0) { + while (remainder_task_num_[type] > 0) { cvs_[type].Wait(&mutexs_[type]); } } @@ -241,9 +241,9 @@ void ConcurrentSweeper::FinishSweeping(MemSpaceType type) bool ConcurrentSweeper::SweeperTask::Run([[maybe_unused]] uint32_t threadIndex) { - int sweepTypeNum = FREE_LIST_NUM - sweeper_->startSpaceType_; - for (size_t i = sweeper_->startSpaceType_; i < FREE_LIST_NUM; i++) { - auto type = static_cast(((i + type_) % sweepTypeNum) + sweeper_->startSpaceType_); + int sweepTypeNum = FREE_LIST_NUM - sweeper_->start_space_type_; + for (size_t i = sweeper_->start_space_type_; i < FREE_LIST_NUM; i++) { + auto type = static_cast(((i + type_) % sweepTypeNum) + sweeper_->start_space_type_); sweeper_->SweepSpace(type, false); } return true; diff --git a/runtime/mem/concurrent_sweeper.h b/runtime/mem/concurrent_sweeper.h index bbaca4486a3b0a49db46f096b0b02d4322531443..62370c10417eb57cff655558fefa46aa69c53662 100644 --- a/runtime/mem/concurrent_sweeper.h +++ b/runtime/mem/concurrent_sweeper.h @@ -44,12 +44,12 @@ public: bool IsConcurrentSweepEnabled() { - return concurrentSweep_; + return concurrent_sweep_; } bool CanSelectCset() const { - return canSelectCset_; + return can_select_cset_; } private: @@ -84,16 +84,16 @@ private: std::array mutexs_; std::array cvs_; - std::array remainderTaskNum_ = {0, 0, 0}; + std::array remainder_task_num_ = {0, 0, 0}; - std::array, FREE_LIST_NUM> sweepingList_; - std::array, FREE_LIST_NUM> sweptList_; + std::array, FREE_LIST_NUM> sweeping_list_; + std::array, FREE_LIST_NUM> swept_list_; Heap *heap_; - bool concurrentSweep_ {false}; - bool isSweeping_ {false}; - bool canSelectCset_ {false}; - MemSpaceType startSpaceType_ = MemSpaceType::OLD_SPACE; + bool concurrent_sweep_ {false}; + bool is_sweeping_ {false}; + bool can_select_cset_ {false}; + MemSpaceType start_space_type_ = MemSpaceType::OLD_SPACE; }; } // namespace panda::ecmascript #endif // ECMASCRIPT_MEM_CONCURRENT_SWEEPER_H diff --git a/runtime/mem/evacuation_allocator-inl.h b/runtime/mem/evacuation_allocator-inl.h index 915a7ca4abd789b3ca361afea0e7695a5c781180..34d8705d0b0576fc065f66550dcf9f724b0a2486 100644 --- a/runtime/mem/evacuation_allocator-inl.h +++ b/runtime/mem/evacuation_allocator-inl.h @@ -23,24 +23,24 @@ namespace panda::ecmascript { Region *EvacuationAllocator::ExpandOldSpace() { - os::memory::LockHolder lock(oldAllocatorLock_); + os::memory::LockHolder lock(old_allocator_lock_); return heap_->ExpandCompressSpace(); } void EvacuationAllocator::FreeSafe(uintptr_t begin, uintptr_t end) { - os::memory::LockHolder lock(oldAllocatorLock_); - oldSpaceAllocator_.Free(begin, end); + os::memory::LockHolder lock(old_allocator_lock_); + old_space_allocator_.Free(begin, end); } void EvacuationAllocator::Free(uintptr_t begin, uintptr_t end, bool isAdd) { - oldSpaceAllocator_.Free(begin, end, isAdd); + old_space_allocator_.Free(begin, end, isAdd); } void EvacuationAllocator::FillFreeList(FreeObjectKind *kind) { - oldSpaceAllocator_.FillFreeList(kind); + old_space_allocator_.FillFreeList(kind); } } // namespace panda::ecmascript #endif // ECMASCRIPT_MEM_EVACUATION_ALLOCATOR_INL_H diff --git a/runtime/mem/evacuation_allocator.cpp b/runtime/mem/evacuation_allocator.cpp index 5eaebb61573e2248435c3527624c1604e07a234b..d3fe07c46957a2995a9afc26f5f250aecefa3912 100644 --- a/runtime/mem/evacuation_allocator.cpp +++ b/runtime/mem/evacuation_allocator.cpp @@ -30,19 +30,19 @@ void EvacuationAllocator::Initialize(TriggerGCType type) heap_->GetNewSpace()->GetCurrentRegion()->SetHighWaterMark(heapManager->GetNewSpaceAllocator().GetTop()); heap_->InitializeFromSpace(); auto fromSpace = heap_->GetFromSpace(); - newSpaceAllocator_.Reset(fromSpace); + new_space_allocator_.Reset(fromSpace); heap_->FlipNewSpace(); // Reset old space allocator if (type == TriggerGCType::OLD_GC) { - oldSpaceAllocator_.Reset(heap_); + old_space_allocator_.Reset(heap_); } else if (type == TriggerGCType::COMPRESS_FULL_GC) { heap_->InitializeCompressSpace(); auto compressSpace = const_cast(heap_->GetCompressSpace()); auto currentRegion = compressSpace->GetCurrentRegion(); currentRegion->SetAliveObject(currentRegion->GetSize()); - oldSpaceAllocator_.Reset(compressSpace); + old_space_allocator_.Reset(compressSpace); } else { - oldSpaceAllocator_.Swap(heapManager->GetOldSpaceAllocator()); + old_space_allocator_.Swap(heapManager->GetOldSpaceAllocator()); } } @@ -54,72 +54,72 @@ void EvacuationAllocator::Finalize(TriggerGCType type) auto oldSpace = const_cast(heap_->GetOldSpace()); oldSpace->RemoveCSetFromList(); oldSpace->Merge(const_cast(heap_->GetCompressSpace())); - heapManager->GetOldSpaceAllocator().Merge(&oldSpaceAllocator_); + heapManager->GetOldSpaceAllocator().Merge(&old_space_allocator_); } else { if (type == TriggerGCType::COMPRESS_FULL_GC) { heap_->FlipCompressSpace(); } - heapManager->GetOldSpaceAllocator().Swap(oldSpaceAllocator_); + heapManager->GetOldSpaceAllocator().Swap(old_space_allocator_); } - heapManager->GetNewSpaceAllocator().Swap(newSpaceAllocator_); + heapManager->GetNewSpaceAllocator().Swap(new_space_allocator_); // Reclaim Region if (heap_->IsParallelGCEnabled()) { - isFreeTaskFinish_ = false; + is_free_task_finish_ = false; Platform::GetCurrentPlatform()->PostTask(std::make_unique(this, type)); } else { ReclaimRegions(type); } - heap_->SetNewSpaceAgeMark(newSpaceAllocator_.GetTop()); + heap_->SetNewSpaceAgeMark(new_space_allocator_.GetTop()); } bool EvacuationAllocator::AddRegionToOld(Region *region) { if (!region->InYoungGeneration()) { - os::memory::LockHolder lock(oldAllocatorLock_); + os::memory::LockHolder lock(old_allocator_lock_); const_cast(heap_->GetOldSpace())->RemoveRegionFromCSetAndList(region); return heap_->AddRegionToCompressSpace(region); } { - os::memory::LockHolder lock(youngAllocatorLock_); + os::memory::LockHolder lock(young_allocator_lock_); const_cast(heap_->GetFromSpace())->RemoveRegion(region); } - os::memory::LockHolder lock(oldAllocatorLock_); + os::memory::LockHolder lock(old_allocator_lock_); return heap_->AddRegionToCompressSpace(region); } bool EvacuationAllocator::AddRegionToYoung(Region *region) { ASSERT(region->InYoungGeneration()); - os::memory::LockHolder lock(youngAllocatorLock_); + os::memory::LockHolder lock(young_allocator_lock_); const_cast(heap_->GetFromSpace())->RemoveRegion(region); return heap_->AddRegionToToSpace(region); } uintptr_t EvacuationAllocator::AllocateOld(size_t size) { - os::memory::LockHolder lock(oldAllocatorLock_); - uintptr_t result = oldSpaceAllocator_.Allocate(size); + os::memory::LockHolder lock(old_allocator_lock_); + uintptr_t result = old_space_allocator_.Allocate(size); if (UNLIKELY(result == 0)) { // Compress bugfix - if (!heap_->FillOldSpaceAndTryGC(&oldSpaceAllocator_, false)) { + if (!heap_->FillOldSpaceAndTryGC(&old_space_allocator_, false)) { return 0; } - result = oldSpaceAllocator_.Allocate(size); + result = old_space_allocator_.Allocate(size); } return result; } uintptr_t EvacuationAllocator::AllocateYoung(size_t size) { - os::memory::LockHolder lock(youngAllocatorLock_); - uintptr_t result = newSpaceAllocator_.Allocate(size); + os::memory::LockHolder lock(young_allocator_lock_); + uintptr_t result = new_space_allocator_.Allocate(size); if (UNLIKELY(result == 0)) { - if (!heap_->FillNewSpaceAndTryGC(&newSpaceAllocator_, false)) { + if (!heap_->FillNewSpaceAndTryGC(&new_space_allocator_, false)) { return 0; } - result = newSpaceAllocator_.Allocate(size); + result = new_space_allocator_.Allocate(size); } return result; } @@ -132,18 +132,18 @@ void EvacuationAllocator::ReclaimRegions(TriggerGCType gcType) const_cast(heap_->GetOldSpace())->ReclaimRegionCSet(); } const_cast(heap_->GetFromSpace())->ReclaimRegions(); - if (!isFreeTaskFinish_) { + if (!is_free_task_finish_) { os::memory::LockHolder holder(mutex_); - isFreeTaskFinish_ = true; + is_free_task_finish_ = true; condition_.SignalAll(); } } void EvacuationAllocator::WaitFreeTaskFinish() { - if (!isFreeTaskFinish_) { + if (!is_free_task_finish_) { os::memory::LockHolder holder(mutex_); - while (!isFreeTaskFinish_) { + while (!is_free_task_finish_) { condition_.Wait(&mutex_); } } @@ -151,7 +151,7 @@ void EvacuationAllocator::WaitFreeTaskFinish() bool EvacuationAllocator::AsyncFreeRegionTask::Run([[maybe_unused]] uint32_t threadIndex) { - allocator_->ReclaimRegions(gcType_); + allocator_->ReclaimRegions(gc_type_); return true; } } // namespace panda::ecmascript diff --git a/runtime/mem/evacuation_allocator.h b/runtime/mem/evacuation_allocator.h index 309c0cd79974ed7348506c88d93dbdafd1a480ad..fb98851c09e7438b5bf802506ad322f8a8971d59 100644 --- a/runtime/mem/evacuation_allocator.h +++ b/runtime/mem/evacuation_allocator.h @@ -37,7 +37,7 @@ public: inline uintptr_t GetNewSpaceTop() { - return newSpaceAllocator_.GetTop(); + return new_space_allocator_.GetTop(); } bool AddRegionToOld(Region *region); @@ -58,7 +58,7 @@ public: private: class AsyncFreeRegionTask : public Task { public: - AsyncFreeRegionTask(EvacuationAllocator *allocator, TriggerGCType type) : allocator_(allocator), gcType_(type) + AsyncFreeRegionTask(EvacuationAllocator *allocator, TriggerGCType type) : allocator_(allocator), gc_type_(type) { } ~AsyncFreeRegionTask() override = default; @@ -69,15 +69,15 @@ private: private: EvacuationAllocator *allocator_; - TriggerGCType gcType_; + TriggerGCType gc_type_; }; Heap *heap_; - bool isFreeTaskFinish_ = true; - BumpPointerAllocator newSpaceAllocator_; - FreeListAllocator oldSpaceAllocator_; - os::memory::Mutex youngAllocatorLock_; - os::memory::Mutex oldAllocatorLock_; + bool is_free_task_finish_ = true; + BumpPointerAllocator new_space_allocator_; + FreeListAllocator old_space_allocator_; + os::memory::Mutex young_allocator_lock_; + os::memory::Mutex old_allocator_lock_; // Async free region task os::memory::Mutex mutex_; os::memory::ConditionVariable condition_; diff --git a/runtime/mem/free_object_kind.cpp b/runtime/mem/free_object_kind.cpp index fee3869f25f8c62cc099c1c0455cc7fa4f171c18..043726eff1eec654905eba14a2fa316a093f01ad 100644 --- a/runtime/mem/free_object_kind.cpp +++ b/runtime/mem/free_object_kind.cpp @@ -22,16 +22,16 @@ namespace panda::ecmascript { void FreeObjectKind::Free(uintptr_t begin, size_t size) { auto freeObject = FreeObject::Cast(begin); - freeObject->SetNext(freeObject_); - freeObject_ = freeObject; + freeObject->SetNext(free_object_); + free_object_ = freeObject; available_ += size; } void FreeObjectKind::Rebuild() { - freeObject_ = nullptr; + free_object_ = nullptr; available_ = 0; - isAdded_ = false; + is_added_ = false; next_ = nullptr; prev_ = nullptr; } @@ -39,9 +39,9 @@ void FreeObjectKind::Rebuild() FreeObject *FreeObjectKind::SearchSmallFreeObject(size_t size) { FreeObject *curFreeObject = nullptr; - if (freeObject_ != nullptr && freeObject_->Available() >= size) { - curFreeObject = freeObject_; - freeObject_ = freeObject_->GetNext(); + if (free_object_ != nullptr && free_object_->Available() >= size) { + curFreeObject = free_object_; + free_object_ = free_object_->GetNext(); curFreeObject->SetNext(nullptr); available_ -= curFreeObject->Available(); } @@ -50,12 +50,12 @@ FreeObject *FreeObjectKind::SearchSmallFreeObject(size_t size) FreeObject *FreeObjectKind::SearchLargeFreeObject(size_t size) { - FreeObject *prevFreeObject = freeObject_; - FreeObject *curFreeObject = freeObject_; + FreeObject *prevFreeObject = free_object_; + FreeObject *curFreeObject = free_object_; while (curFreeObject != nullptr) { if (curFreeObject->Available() >= size) { - if (curFreeObject == freeObject_) { - freeObject_ = curFreeObject->GetNext(); + if (curFreeObject == free_object_) { + free_object_ = curFreeObject->GetNext(); } else { prevFreeObject->SetNext(curFreeObject->GetNext()); } diff --git a/runtime/mem/free_object_kind.h b/runtime/mem/free_object_kind.h index 046a16df1a390d484339e48cc15e16456efdebed..8333da612accb16ee1c65c5a4d10ad3072e488bf 100644 --- a/runtime/mem/free_object_kind.h +++ b/runtime/mem/free_object_kind.h @@ -27,7 +27,7 @@ class FreeObject; class FreeObjectKind { public: - explicit FreeObjectKind(KindType type) : kindType_(type) + explicit FreeObjectKind(KindType type) : kind_type_(type) { Rebuild(); } @@ -58,10 +58,10 @@ public: private: FreeObjectKind *next_ = nullptr; FreeObjectKind *prev_ = nullptr; - KindType kindType_ = INVALID_KIND_TYPE; + KindType kind_type_ = INVALID_KIND_TYPE; size_t available_ = 0; - bool isAdded_ = false; - FreeObject *freeObject_ = nullptr; + bool is_added_ = false; + FreeObject *free_object_ = nullptr; friend class FreeObjectList; }; diff --git a/runtime/mem/free_object_list-inl.h b/runtime/mem/free_object_list-inl.h index 908c41fb954e4c47fc495866718484eaf4361300..b6f195ade0bc0617839790038270463195fb6d64 100644 --- a/runtime/mem/free_object_list-inl.h +++ b/runtime/mem/free_object_list-inl.h @@ -27,7 +27,7 @@ KindType FreeObjectList::SelectKindType(size_t size) const if (UNLIKELY(size < MIN_SIZE)) { return FreeObjectKind::INVALID_KIND_TYPE; } - return (size >> INTERVAL_OFFSET) - smallKindOffsetIndex; + return (size >> INTERVAL_OFFSET) - small_kind_offset_index_; } if (size < LARGE_KIND_MAX_SIZE) { return MAX_BIT_OF_SIZET - __builtin_clzl(size) + LOG2_OFFSET; @@ -41,17 +41,17 @@ KindType FreeObjectList::SelectKindType(size_t size) const void FreeObjectList::SetNoneEmptyBit(KindType type) { - noneEmptyKindBitMap_ |= 1ULL << static_cast(type); + none_empty_kind_bit_map_ |= 1ULL << static_cast(type); } void FreeObjectList::ClearNoneEmptyBit(KindType type) { - noneEmptyKindBitMap_ &= ~(1ULL << static_cast(type)); + none_empty_kind_bit_map_ &= ~(1ULL << static_cast(type)); } inline size_t FreeObjectList::CalcNextNoneEmptyIndex(KindType start) { - return __builtin_ffsll(noneEmptyKindBitMap_ >> static_cast(start)) + start - 1; + return __builtin_ffsll(none_empty_kind_bit_map_ >> static_cast(start)) + start - 1; } } // namespace panda::ecmascript #endif // ECMASCRIPT_MEM_FREE_OBJECT_LIST_INL_H diff --git a/runtime/mem/free_object_list.cpp b/runtime/mem/free_object_list.cpp index 4a1480b479eef3bf827ca7fd864ff98aa872de86..60387066e4997539ac1cb85ab56ba951abece129 100644 --- a/runtime/mem/free_object_list.cpp +++ b/runtime/mem/free_object_list.cpp @@ -23,25 +23,25 @@ namespace panda::ecmascript { FreeObjectList::FreeObjectList() : kinds_(new FreeObjectKind *[NUMBER_OF_KINDS](), NUMBER_OF_KINDS), - lastKinds_(new FreeObjectKind *[NUMBER_OF_KINDS](), NUMBER_OF_KINDS) + last_kinds_(new FreeObjectKind *[NUMBER_OF_KINDS](), NUMBER_OF_KINDS) { for (int i = 0; i < NUMBER_OF_KINDS; i++) { kinds_[i] = nullptr; - lastKinds_[i] = nullptr; + last_kinds_[i] = nullptr; } - noneEmptyKindBitMap_ = 0; + none_empty_kind_bit_map_ = 0; } FreeObjectList::~FreeObjectList() { delete[] kinds_.data(); - delete[] lastKinds_.data(); - noneEmptyKindBitMap_ = 0; + delete[] last_kinds_.data(); + none_empty_kind_bit_map_ = 0; } FreeObject *FreeObjectList::Allocator(size_t size) { - if (noneEmptyKindBitMap_ == 0) { + if (none_empty_kind_bit_map_ == 0) { return nullptr; } size = AlignUp(size, static_cast(MemAlignment::MEM_ALIGN_OBJECT)); @@ -105,7 +105,7 @@ void FreeObjectList::Free(uintptr_t start, size_t size, bool isAdd) kind->Free(start, size); if (isAdd) { - if (kind->isAdded_) { + if (kind->is_added_) { available_ += size; } else { AddKind(kind); @@ -118,10 +118,10 @@ void FreeObjectList::Rebuild() EnumerateKinds([](FreeObjectKind *kind) { kind->Rebuild(); }); for (int i = 0; i < NUMBER_OF_KINDS; i++) { kinds_[i] = nullptr; - lastKinds_[i] = nullptr; + last_kinds_[i] = nullptr; } available_ = 0; - noneEmptyKindBitMap_ = 0; + none_empty_kind_bit_map_ = 0; } size_t FreeObjectList::GetFreeObjectSize() const @@ -131,10 +131,10 @@ size_t FreeObjectList::GetFreeObjectSize() const bool FreeObjectList::AddKind(FreeObjectKind *kind) { - if (kind == nullptr || kind->Empty() || kind->isAdded_) { + if (kind == nullptr || kind->Empty() || kind->is_added_) { return false; } - KindType type = kind->kindType_; + KindType type = kind->kind_type_; FreeObjectKind *top = kinds_[type]; if (kind == top) { return false; @@ -142,10 +142,10 @@ bool FreeObjectList::AddKind(FreeObjectKind *kind) if (top != nullptr) { top->prev_ = kind; } - kind->isAdded_ = true; + kind->is_added_ = true; kind->next_ = top; - if (lastKinds_[type] == nullptr) { - lastKinds_[type] = kind; + if (last_kinds_[type] == nullptr) { + last_kinds_[type] = kind; } kinds_[type] = kind; SetNoneEmptyBit(type); @@ -158,14 +158,14 @@ void FreeObjectList::RemoveKind(FreeObjectKind *kind) if (kind == nullptr) { return; } - KindType type = kind->kindType_; + KindType type = kind->kind_type_; FreeObjectKind *top = kinds_[type]; - FreeObjectKind *end = lastKinds_[type]; + FreeObjectKind *end = last_kinds_[type]; if (top == kind) { kinds_[type] = top->next_; } if (end == kind) { - lastKinds_[type] = end->prev_; + last_kinds_[type] = end->prev_; } if (kind->prev_ != nullptr) { kind->prev_->next_ = kind->next_; @@ -186,15 +186,15 @@ void FreeObjectList::Merge(FreeObjectList *list) if (kind == nullptr || kind->Empty()) { return; } - KindType type = kind->kindType_; + KindType type = kind->kind_type_; FreeObjectKind *top = kinds_[type]; if (top == nullptr) { top = kind; } else { - lastKinds_[type]->next_ = kind; - kind->prev_ = lastKinds_[type]; + last_kinds_[type]->next_ = kind; + kind->prev_ = last_kinds_[type]; } - lastKinds_[type] = end; + last_kinds_[type] = end; SetNoneEmptyBit(type); }); available_ += list->available_; @@ -225,7 +225,7 @@ template void FreeObjectList::EnumerateTopAndLastKinds(const Callback &cb) const { for (KindType i = 0; i < NUMBER_OF_KINDS; i++) { - cb(kinds_[i], lastKinds_[i]); + cb(kinds_[i], last_kinds_[i]); } } } // namespace panda::ecmascript diff --git a/runtime/mem/free_object_list.h b/runtime/mem/free_object_list.h index 84227ef6e61cbb2223bcdbb46485b9c55d0d7c71..d9d26c97ec945573c8f541d76a8e28fd5fa9c8ab 100644 --- a/runtime/mem/free_object_list.h +++ b/runtime/mem/free_object_list.h @@ -70,7 +70,7 @@ private: static constexpr size_t INTERVAL_OFFSET = 3; static constexpr size_t LOG2_OFFSET = 21; static constexpr size_t MAX_BIT_OF_SIZET = sizeof(size_t) << INTERVAL_OFFSET; - const int smallKindOffsetIndex = 2; + const int small_kind_offset_index_ = 2; inline KindType SelectKindType(size_t size) const; @@ -79,9 +79,9 @@ private: inline size_t CalcNextNoneEmptyIndex(KindType start); size_t available_ = 0; - uint64_t noneEmptyKindBitMap_; + uint64_t none_empty_kind_bit_map_; Span kinds_ {}; - Span lastKinds_ {}; + Span last_kinds_ {}; }; } // namespace panda::ecmascript #endif // ECMASCRIPT_MEM_FREE_OBJECT_LIST_H diff --git a/runtime/mem/gc_stats.cpp b/runtime/mem/gc_stats.cpp index 57e78edfc5db9f26675d6fb663e5f92eda34c1e9..541610491d94479c1acca48453256c35afcdf725 100644 --- a/runtime/mem/gc_stats.cpp +++ b/runtime/mem/gc_stats.cpp @@ -22,66 +22,70 @@ namespace panda::ecmascript { void GCStats::PrintStatisticResult(bool isForce) { LOG(ERROR, RUNTIME) << "GCStats statistic: "; - if ((isForce && semiGCCount_ != 0) || (!isForce && semiGCCount_ != lastSemiGCCount_)) { - lastSemiGCCount_ = semiGCCount_; - LOG(ERROR, RUNTIME) << " SemiCollector statistic: total semi gc count " << semiGCCount_; - LOG(ERROR, RUNTIME) << " MIN pause time: " << PrintTimeMilliseconds(semiGCMinPause_) << "ms" - << " MAX pause time: " << PrintTimeMilliseconds(semiGCMAXPause_) << "ms" - << " total pause time: " << PrintTimeMilliseconds(semiGCTotalPause_) << "ms" - << " average pause time: " << PrintTimeMilliseconds(semiGCTotalPause_ / semiGCCount_) + if ((isForce && semi_gc_count_ != 0) || (!isForce && semi_gc_count_ != last_semi_gc_count_)) { + last_semi_gc_count_ = semi_gc_count_; + LOG(ERROR, RUNTIME) << " SemiCollector statistic: total semi gc count " << semi_gc_count_; + LOG(ERROR, RUNTIME) << " MIN pause time: " << PrintTimeMilliseconds(semi_gc_min_pause_) << "ms" + << " MAX pause time: " << PrintTimeMilliseconds(semi_gcmax_pause_) << "ms" + << " total pause time: " << PrintTimeMilliseconds(semi_gc_total_pause_) << "ms" + << " average pause time: " << PrintTimeMilliseconds(semi_gc_total_pause_ / semi_gc_count_) << "ms" - << " tatal alive size: " << sizeToMB(semiTotalAliveSize_) << "MB" - << " average alive size: " << sizeToMB(semiTotalAliveSize_ / semiGCCount_) << "MB" - << " tatal commit size: " << sizeToMB(semiTotalCommitSize_) << "MB" - << " average commit size: " << sizeToMB(semiTotalCommitSize_ / semiGCCount_) << "MB" - << " semi aliveRate: " << double(semiTotalAliveSize_) / semiTotalCommitSize_ - << " total promote size: " << sizeToMB(semiTotalPromoteSize_) << "MB" - << " average promote size: " << sizeToMB(semiTotalPromoteSize_ / semiGCCount_) << "MB"; + << " tatal alive size: " << sizeToMB(semi_total_alive_size_) << "MB" + << " average alive size: " << sizeToMB(semi_total_alive_size_ / semi_gc_count_) << "MB" + << " tatal commit size: " << sizeToMB(semi_total_commit_size_) << "MB" + << " average commit size: " << sizeToMB(semi_total_commit_size_ / semi_gc_count_) << "MB" + << " semi aliveRate: " << double(semi_total_alive_size_) / semi_total_commit_size_ + << " total promote size: " << sizeToMB(semi_total_promote_size_) << "MB" + << " average promote size: " << sizeToMB(semi_total_promote_size_ / semi_gc_count_) << "MB"; } - if ((isForce && oldGCCount_ != 0) || (!isForce && lastOldGCCount_ != oldGCCount_)) { - lastOldGCCount_ = oldGCCount_; - LOG(ERROR, RUNTIME) << " MixCollector statistic: total old gc count " << oldGCCount_; - LOG(ERROR, RUNTIME) << " MIN pause time: " << PrintTimeMilliseconds(oldGCMinPause_) << "ms" - << " MAX pause time: " << PrintTimeMilliseconds(oldGCMAXPause_) << "ms" - << " total pause time: " << PrintTimeMilliseconds(oldGCTotalPause_) << "ms" - << " average pause time: " << PrintTimeMilliseconds(oldGCTotalPause_ / oldGCCount_) << "ms" - << " total free size: " << sizeToMB(oldTotalFreeSize_) << "MB" - << " average free size: " << sizeToMB(oldTotalFreeSize_ / oldGCCount_) << "MB" - << " old space total commit size: " << sizeToMB(oldSpaceTotalCommitSize_) << "MB" - << " old space average commit size: " << sizeToMB(oldSpaceTotalCommitSize_ / oldGCCount_) + if ((isForce && old_gc_count_ != 0) || (!isForce && last_old_gc_count_ != old_gc_count_)) { + last_old_gc_count_ = old_gc_count_; + LOG(ERROR, RUNTIME) << " MixCollector statistic: total old gc count " << old_gc_count_; + LOG(ERROR, RUNTIME) << " MIN pause time: " << PrintTimeMilliseconds(old_gc_min_pause_) << "ms" + << " MAX pause time: " << PrintTimeMilliseconds(old_gcmax_pause_) << "ms" + << " total pause time: " << PrintTimeMilliseconds(old_gc_total_pause_) << "ms" + << " average pause time: " << PrintTimeMilliseconds(old_gc_total_pause_ / old_gc_count_) + << "ms" + << " total free size: " << sizeToMB(old_total_free_size_) << "MB" + << " average free size: " << sizeToMB(old_total_free_size_ / old_gc_count_) << "MB" + << " old space total commit size: " << sizeToMB(old_space_total_commit_size_) << "MB" + << " old space average commit size: " + << sizeToMB(old_space_total_commit_size_ / old_gc_count_) << "MB" + << " non move space total commit size: " << sizeToMB(old_non_move_total_commit_size_) << "MB" - << " non move space total commit size: " << sizeToMB(oldNonMoveTotalCommitSize_) << "MB" << " non move space average commit size: " - << sizeToMB(oldNonMoveTotalCommitSize_ / oldGCCount_) << "MB" + << sizeToMB(old_non_move_total_commit_size_ / old_gc_count_) << "MB" << " old free rate: " - << static_cast(oldTotalFreeSize_) / - static_cast(oldSpaceTotalCommitSize_ + oldNonMoveTotalCommitSize_); + << static_cast(old_total_free_size_) / + static_cast(old_space_total_commit_size_ + old_non_move_total_commit_size_); } - if ((isForce && compressGCCount_ != 0) || (!isForce && compressGCCount_ != lastCompressGCCount_)) { - lastCompressGCCount_ = compressGCCount_; - LOG(ERROR, RUNTIME) << " compressCollector statistic: total compress gc count " << compressGCCount_; - LOG(ERROR, RUNTIME) << " MIN pause time: " << PrintTimeMilliseconds(compressGCMinPause_) << "ms" - << " MAX pause time: " << PrintTimeMilliseconds(compressGCMaxPause_) << "ms" - << " total pause time: " << PrintTimeMilliseconds(compressGCTotalPause_) << "ms" + if ((isForce && compress_gc_count_ != 0) || (!isForce && compress_gc_count_ != last_compress_gc_count_)) { + last_compress_gc_count_ = compress_gc_count_; + LOG(ERROR, RUNTIME) << " compressCollector statistic: total compress gc count " << compress_gc_count_; + LOG(ERROR, RUNTIME) << " MIN pause time: " << PrintTimeMilliseconds(compress_gc_min_pause_) << "ms" + << " MAX pause time: " << PrintTimeMilliseconds(compress_gc_max_pause_) << "ms" + << " total pause time: " << PrintTimeMilliseconds(compress_gc_total_pause_) << "ms" << " average pause time: " - << PrintTimeMilliseconds(compressGCTotalPause_ / compressGCCount_) << "ms" - << " young and old total alive size: " << sizeToMB(compressYoungAndOldAliveSize_) << "MB" + << PrintTimeMilliseconds(compress_gc_total_pause_ / compress_gc_count_) << "ms" + << " young and old total alive size: " << sizeToMB(compress_young_and_old_alive_size_) + << "MB" << " young and old average alive size: " - << sizeToMB(compressYoungAndOldAliveSize_ / compressGCCount_) << "MB" - << " young total commit size: " << sizeToMB(compressYoungCommitSize_) << "MB" - << " old total commit size: " << sizeToMB(compressOldCommitSize_) << "MB" + << sizeToMB(compress_young_and_old_alive_size_ / compress_gc_count_) << "MB" + << " young total commit size: " << sizeToMB(compress_young_commit_size_) << "MB" + << " old total commit size: " << sizeToMB(compress_old_commit_size_) << "MB" << " young and old average commit size: " - << sizeToMB((compressYoungCommitSize_ + compressOldCommitSize_) / compressGCCount_) << "MB" + << sizeToMB((compress_young_commit_size_ + compress_old_commit_size_) / compress_gc_count_) + << "MB" << " young and old free rate: " - << 1 - static_cast(compressYoungAndOldAliveSize_) / - static_cast(compressYoungCommitSize_ + compressOldCommitSize_) - << " non move total free size: " << sizeToMB(compressNonMoveTotalFreeSize_) << "MB" - << " non move total commit size: " << sizeToMB(compressNonMoveTotalCommitSize_) << "MB" + << 1 - static_cast(compress_young_and_old_alive_size_) / + static_cast(compress_young_commit_size_ + compress_old_commit_size_) + << " non move total free size: " << sizeToMB(compress_non_move_total_free_size_) << "MB" + << " non move total commit size: " << sizeToMB(compress_non_move_total_commit_size_) << "MB" << " non move free rate: " - << static_cast(compressNonMoveTotalFreeSize_) / - static_cast(compressNonMoveTotalCommitSize_); + << static_cast(compress_non_move_total_free_size_) / + static_cast(compress_non_move_total_commit_size_); } if (isForce && heap_ != nullptr) { @@ -97,36 +101,36 @@ void GCStats::PrintStatisticResult(bool isForce) void GCStats::StatisticSemiCollector(Duration time, size_t aliveSize, size_t promoteSize, size_t commitSize) { auto timeToMillion = TimeToMicroseconds(time); - if (semiGCCount_ == 0) { - semiGCMinPause_ = timeToMillion; - semiGCMAXPause_ = timeToMillion; + if (semi_gc_count_ == 0) { + semi_gc_min_pause_ = timeToMillion; + semi_gcmax_pause_ = timeToMillion; } else { - semiGCMinPause_ = std::min(semiGCMinPause_, timeToMillion); - semiGCMAXPause_ = std::max(semiGCMAXPause_, timeToMillion); + semi_gc_min_pause_ = std::min(semi_gc_min_pause_, timeToMillion); + semi_gcmax_pause_ = std::max(semi_gcmax_pause_, timeToMillion); } - semiGCTotalPause_ += timeToMillion; - semiTotalAliveSize_ += aliveSize; - semiTotalCommitSize_ += commitSize; - semiTotalPromoteSize_ += promoteSize; - semiGCCount_++; + semi_gc_total_pause_ += timeToMillion; + semi_total_alive_size_ += aliveSize; + semi_total_commit_size_ += commitSize; + semi_total_promote_size_ += promoteSize; + semi_gc_count_++; } void GCStats::StatisticOldCollector(Duration time, size_t freeSize, size_t oldSpaceCommitSize, size_t nonMoveSpaceCommitSize) { auto timeToMillion = TimeToMicroseconds(time); - if (oldGCCount_ == 0) { - oldGCMinPause_ = timeToMillion; - oldGCMAXPause_ = timeToMillion; + if (old_gc_count_ == 0) { + old_gc_min_pause_ = timeToMillion; + old_gcmax_pause_ = timeToMillion; } else { - oldGCMinPause_ = std::min(oldGCMinPause_, timeToMillion); - oldGCMAXPause_ = std::max(oldGCMAXPause_, timeToMillion); + old_gc_min_pause_ = std::min(old_gc_min_pause_, timeToMillion); + old_gcmax_pause_ = std::max(old_gcmax_pause_, timeToMillion); } - oldGCTotalPause_ += timeToMillion; - oldTotalFreeSize_ += freeSize; - oldSpaceTotalCommitSize_ += oldSpaceCommitSize; - oldNonMoveTotalCommitSize_ += nonMoveSpaceCommitSize; - oldGCCount_++; + old_gc_total_pause_ += timeToMillion; + old_total_free_size_ += freeSize; + old_space_total_commit_size_ += oldSpaceCommitSize; + old_non_move_total_commit_size_ += nonMoveSpaceCommitSize; + old_gc_count_++; } void GCStats::StatisticCompressCollector(Duration time, size_t youngAndOldAliveSize, size_t youngCommitSize, @@ -134,19 +138,19 @@ void GCStats::StatisticCompressCollector(Duration time, size_t youngAndOldAliveS size_t nonMoveSpaceCommitSize) { auto timeToMillion = TimeToMicroseconds(time); - if (compressGCCount_ == 0) { - compressGCMinPause_ = timeToMillion; - compressGCMaxPause_ = timeToMillion; + if (compress_gc_count_ == 0) { + compress_gc_min_pause_ = timeToMillion; + compress_gc_max_pause_ = timeToMillion; } else { - compressGCMinPause_ = std::min(compressGCMinPause_, timeToMillion); - compressGCMaxPause_ = std::max(compressGCMaxPause_, timeToMillion); + compress_gc_min_pause_ = std::min(compress_gc_min_pause_, timeToMillion); + compress_gc_max_pause_ = std::max(compress_gc_max_pause_, timeToMillion); } - compressGCTotalPause_ += timeToMillion; - compressYoungAndOldAliveSize_ += youngAndOldAliveSize; - compressYoungCommitSize_ += youngCommitSize; - compressOldCommitSize_ += oldCommitSize; - compressNonMoveTotalFreeSize_ += nonMoveSpaceFreeSize; - compressNonMoveTotalCommitSize_ += nonMoveSpaceCommitSize; - compressGCCount_++; + compress_gc_total_pause_ += timeToMillion; + compress_young_and_old_alive_size_ += youngAndOldAliveSize; + compress_young_commit_size_ += youngCommitSize; + compress_old_commit_size_ += oldCommitSize; + compress_non_move_total_free_size_ += nonMoveSpaceFreeSize; + compress_non_move_total_commit_size_ += nonMoveSpaceCommitSize; + compress_gc_count_++; } } // namespace panda::ecmascript diff --git a/runtime/mem/gc_stats.h b/runtime/mem/gc_stats.h index 80091309928b8e5357b30d5a09242bb42d609913..4ca20f81377ae9fd4190981b9c47724637cd0322 100644 --- a/runtime/mem/gc_stats.h +++ b/runtime/mem/gc_stats.h @@ -53,34 +53,34 @@ private: return static_cast(size) / MB; } - size_t lastSemiGCCount_ = 0; - size_t semiGCCount_ = 0; - size_t semiGCMinPause_ = 0; - size_t semiGCMAXPause_ = 0; - size_t semiGCTotalPause_ = 0; - size_t semiTotalAliveSize_ = 0; - size_t semiTotalCommitSize_ = 0; - size_t semiTotalPromoteSize_ = 0; - - size_t lastOldGCCount_ = 0; - size_t oldGCCount_ = 0; - size_t oldGCMinPause_ = 0; - size_t oldGCMAXPause_ = 0; - size_t oldGCTotalPause_ = 0; - size_t oldTotalFreeSize_ = 0; - size_t oldSpaceTotalCommitSize_ = 0; - size_t oldNonMoveTotalCommitSize_ = 0; - - size_t lastCompressGCCount_ = 0; - size_t compressGCCount_ = 0; - size_t compressGCMinPause_ = 0; - size_t compressGCMaxPause_ = 0; - size_t compressGCTotalPause_ = 0; - size_t compressYoungAndOldAliveSize_ = 0; - size_t compressYoungCommitSize_ = 0; - size_t compressOldCommitSize_ = 0; - size_t compressNonMoveTotalFreeSize_ = 0; - size_t compressNonMoveTotalCommitSize_ = 0; + size_t last_semi_gc_count_ = 0; + size_t semi_gc_count_ = 0; + size_t semi_gc_min_pause_ = 0; + size_t semi_gcmax_pause_ = 0; + size_t semi_gc_total_pause_ = 0; + size_t semi_total_alive_size_ = 0; + size_t semi_total_commit_size_ = 0; + size_t semi_total_promote_size_ = 0; + + size_t last_old_gc_count_ = 0; + size_t old_gc_count_ = 0; + size_t old_gc_min_pause_ = 0; + size_t old_gcmax_pause_ = 0; + size_t old_gc_total_pause_ = 0; + size_t old_total_free_size_ = 0; + size_t old_space_total_commit_size_ = 0; + size_t old_non_move_total_commit_size_ = 0; + + size_t last_compress_gc_count_ = 0; + size_t compress_gc_count_ = 0; + size_t compress_gc_min_pause_ = 0; + size_t compress_gc_max_pause_ = 0; + size_t compress_gc_total_pause_ = 0; + size_t compress_young_and_old_alive_size_ = 0; + size_t compress_young_commit_size_ = 0; + size_t compress_old_commit_size_ = 0; + size_t compress_non_move_total_free_size_ = 0; + size_t compress_non_move_total_commit_size_ = 0; const Heap *heap_; diff --git a/runtime/mem/heap-inl.h b/runtime/mem/heap-inl.h index 84c3d490b7aa2e1f82adbed1e49312c6e79dc3fc..91d764cfcb37fa6af144693449bb63c3058ff67b 100644 --- a/runtime/mem/heap-inl.h +++ b/runtime/mem/heap-inl.h @@ -29,67 +29,67 @@ namespace panda::ecmascript { template void Heap::EnumerateOldSpaceRegions(const Callback &cb, Region *region) const { - oldSpace_->EnumerateRegions(cb, region); - nonMovableSpace_->EnumerateRegions(cb); - hugeObjectSpace_->EnumerateRegions(cb); - machineCodeSpace_->EnumerateRegions(cb); + old_space_->EnumerateRegions(cb, region); + non_movable_space_->EnumerateRegions(cb); + huge_object_space_->EnumerateRegions(cb); + machine_code_space_->EnumerateRegions(cb); } template void Heap::EnumerateSnapShotSpaceRegions(const Callback &cb) const { - snapshotSpace_->EnumerateRegions(cb); + snapshot_space_->EnumerateRegions(cb); } template void Heap::EnumerateNewSpaceRegions(const Callback &cb) const { - toSpace_->EnumerateRegions(cb); + to_space_->EnumerateRegions(cb); } template void Heap::EnumerateNonMovableRegions(const Callback &cb) const { - snapshotSpace_->EnumerateRegions(cb); - nonMovableSpace_->EnumerateRegions(cb); - hugeObjectSpace_->EnumerateRegions(cb); - machineCodeSpace_->EnumerateRegions(cb); + snapshot_space_->EnumerateRegions(cb); + non_movable_space_->EnumerateRegions(cb); + huge_object_space_->EnumerateRegions(cb); + machine_code_space_->EnumerateRegions(cb); } template void Heap::EnumerateRegions(const Callback &cb) const { - toSpace_->EnumerateRegions(cb); - oldSpace_->EnumerateRegions(cb); - snapshotSpace_->EnumerateRegions(cb); - nonMovableSpace_->EnumerateRegions(cb); - hugeObjectSpace_->EnumerateRegions(cb); - machineCodeSpace_->EnumerateRegions(cb); + to_space_->EnumerateRegions(cb); + old_space_->EnumerateRegions(cb); + snapshot_space_->EnumerateRegions(cb); + non_movable_space_->EnumerateRegions(cb); + huge_object_space_->EnumerateRegions(cb); + machine_code_space_->EnumerateRegions(cb); } template void Heap::IteratorOverObjects(const Callback &cb) const { - toSpace_->IterateOverObjects(cb); - oldSpace_->IterateOverObjects(cb); - nonMovableSpace_->IterateOverObjects(cb); - hugeObjectSpace_->IterateOverObjects(cb); + to_space_->IterateOverObjects(cb); + old_space_->IterateOverObjects(cb); + non_movable_space_->IterateOverObjects(cb); + huge_object_space_->IterateOverObjects(cb); } bool Heap::FillNewSpaceAndTryGC(BumpPointerAllocator *spaceAllocator, bool allowGc) { - if (toSpace_->Expand(spaceAllocator->GetTop())) { - spaceAllocator->Reset(toSpace_); + if (to_space_->Expand(spaceAllocator->GetTop())) { + spaceAllocator->Reset(to_space_); TryTriggerConcurrentMarking(allowGc); return true; } - if (toSpace_->GetCommittedSize() == SEMI_SPACE_SIZE_CAPACITY && + if (to_space_->GetCommittedSize() == SEMI_SPACE_SIZE_CAPACITY && !GetEcmaVM()->GetAssociatedJSThread()->IsReadyToMark()) { - toSpace_->SetMaximumCapacity( + to_space_->SetMaximumCapacity( std::min(SEMI_SPACE_SIZE_CAPACITY + SEMI_SPACE_OVERSHOOT_SIZE, MAX_SEMI_SPACE_SIZE_STARTUP)); - if (toSpace_->Expand(spaceAllocator->GetTop())) { - spaceAllocator->Reset(toSpace_); + if (to_space_->Expand(spaceAllocator->GetTop())) { + spaceAllocator->Reset(to_space_); return true; } } @@ -103,12 +103,12 @@ bool Heap::FillNewSpaceAndTryGC(BumpPointerAllocator *spaceAllocator, bool allow bool Heap::FillOldSpaceAndTryGC(FreeListAllocator *spaceAllocator, bool allowGc) { - if (oldSpace_->Expand()) { + if (old_space_->Expand()) { if (!allowGc) { auto currentRegion = GetCompressSpace()->GetCurrentRegion(); currentRegion->SetAliveObject(currentRegion->GetSize()); } - spaceAllocator->AddFree(oldSpace_->GetCurrentRegion()); + spaceAllocator->AddFree(old_space_->GetCurrentRegion()); return true; } if (allowGc) { @@ -120,8 +120,8 @@ bool Heap::FillOldSpaceAndTryGC(FreeListAllocator *spaceAllocator, bool allowGc) bool Heap::FillNonMovableSpaceAndTryGC(FreeListAllocator *spaceAllocator, bool allowGc) { - if (nonMovableSpace_->Expand()) { - spaceAllocator->AddFree(nonMovableSpace_->GetCurrentRegion()); + if (non_movable_space_->Expand()) { + spaceAllocator->AddFree(non_movable_space_->GetCurrentRegion()); return true; } if (allowGc) { @@ -133,17 +133,17 @@ bool Heap::FillNonMovableSpaceAndTryGC(FreeListAllocator *spaceAllocator, bool a bool Heap::FillSnapShotSpace(BumpPointerAllocator *spaceAllocator) { - bool result = snapshotSpace_->Expand(spaceAllocator->GetTop()); + bool result = snapshot_space_->Expand(spaceAllocator->GetTop()); if (result) { - spaceAllocator->Reset(snapshotSpace_); + spaceAllocator->Reset(snapshot_space_); } return result; } bool Heap::FillMachineCodeSpaceAndTryGC(FreeListAllocator *spaceAllocator, bool allowGc) { - if (machineCodeSpace_->Expand()) { - spaceAllocator->AddFree(machineCodeSpace_->GetCurrentRegion()); + if (machine_code_space_->Expand()) { + spaceAllocator->AddFree(machine_code_space_->GetCurrentRegion()); return true; } if (allowGc) { @@ -155,20 +155,20 @@ bool Heap::FillMachineCodeSpaceAndTryGC(FreeListAllocator *spaceAllocator, bool Region *Heap::ExpandCompressSpace() { - if (compressSpace_->Expand()) { - return compressSpace_->GetCurrentRegion(); + if (compress_space_->Expand()) { + return compress_space_->GetCurrentRegion(); } return nullptr; } bool Heap::AddRegionToCompressSpace(Region *region) { - return compressSpace_->AddRegionToList(region); + return compress_space_->AddRegionToList(region); } bool Heap::AddRegionToToSpace(Region *region) { - return toSpace_->AddRegionToList(region); + return to_space_->AddRegionToList(region); } void Heap::OnAllocateEvent(uintptr_t address) @@ -187,53 +187,53 @@ void Heap::OnMoveEvent(uintptr_t address, uintptr_t forwardAddress) void Heap::SetNewSpaceAgeMark(uintptr_t mark) { - ASSERT(toSpace_ != nullptr); - toSpace_->SetAgeMark(mark); + ASSERT(to_space_ != nullptr); + to_space_->SetAgeMark(mark); } void Heap::SetNewSpaceMaximumCapacity(size_t maximumCapacity) { - ASSERT(toSpace_ != nullptr); - SetMaximumCapacity(toSpace_, maximumCapacity); + ASSERT(to_space_ != nullptr); + SetMaximumCapacity(to_space_, maximumCapacity); } void Heap::InitializeFromSpace() { - if (fromSpace_->GetCommittedSize() == 0) { - fromSpace_->Initialize(); + if (from_space_->GetCommittedSize() == 0) { + from_space_->Initialize(); } } void Heap::InitializeCompressSpace() { - if (compressSpace_->GetCommittedSize() == 0) { - compressSpace_->Initialize(); + if (compress_space_->GetCommittedSize() == 0) { + compress_space_->Initialize(); } } void Heap::SwapSpace() { - ASSERT(toSpace_ != nullptr); - ASSERT(fromSpace_ != nullptr); - toSpace_->Swap(fromSpace_); + ASSERT(to_space_ != nullptr); + ASSERT(from_space_ != nullptr); + to_space_->Swap(from_space_); } void Heap::ReclaimFromSpaceRegions() { - ASSERT(fromSpace_ != nullptr); - fromSpace_->ReclaimRegions(); + ASSERT(from_space_ != nullptr); + from_space_->ReclaimRegions(); } void Heap::SetFromSpaceMaximumCapacity(size_t maximumCapacity) { - ASSERT(fromSpace_ != nullptr); - SetMaximumCapacity(fromSpace_, maximumCapacity); + ASSERT(from_space_ != nullptr); + SetMaximumCapacity(from_space_, maximumCapacity); } void Heap::ResetDelayGCMode() { - ASSERT(memController_ != nullptr); - memController_->ResetDelayGCMode(); + ASSERT(mem_controller_ != nullptr); + mem_controller_->ResetDelayGCMode(); } void Heap::SetMaximumCapacity(SemiSpace *space, size_t maximumCapacity) @@ -255,17 +255,17 @@ void Heap::ClearSlotsRange(Region *current, uintptr_t freeStart, uintptr_t freeE size_t Heap::GetCommittedSize() const { - size_t result = toSpace_->GetCommittedSize() + oldSpace_->GetCommittedSize() + - hugeObjectSpace_->GetCommittedSize() + nonMovableSpace_->GetCommittedSize() + - machineCodeSpace_->GetCommittedSize(); + size_t result = to_space_->GetCommittedSize() + old_space_->GetCommittedSize() + + huge_object_space_->GetCommittedSize() + non_movable_space_->GetCommittedSize() + + machine_code_space_->GetCommittedSize(); return result; } size_t Heap::GetHeapObjectSize() const { - size_t result = toSpace_->GetHeapObjectSize() + oldSpace_->GetHeapObjectSize() + - hugeObjectSpace_->GetHeapObjectSize() + nonMovableSpace_->GetHeapObjectSize() + - machineCodeSpace_->GetCommittedSize(); + size_t result = to_space_->GetHeapObjectSize() + old_space_->GetHeapObjectSize() + + huge_object_space_->GetHeapObjectSize() + non_movable_space_->GetHeapObjectSize() + + machine_code_space_->GetCommittedSize(); return result; } } // namespace panda::ecmascript diff --git a/runtime/mem/heap.cpp b/runtime/mem/heap.cpp index 8af3576336fa33df4d57d3e77d23d6e5f859eb91..b5677329921baacfe6c3a5d90172d27546a487ca 100644 --- a/runtime/mem/heap.cpp +++ b/runtime/mem/heap.cpp @@ -36,33 +36,33 @@ static constexpr int MAX_PARALLEL_THREAD_NUM = 3; namespace panda::ecmascript { -Heap::Heap(EcmaVM *ecmaVm) : ecmaVm_(ecmaVm), regionFactory_(ecmaVm->GetRegionFactory()) {} +Heap::Heap(EcmaVM *ecmaVm) : ecma_vm_(ecmaVm), region_factory_(ecmaVm->GetRegionFactory()) {} void Heap::Initialize() { - memController_ = CreateMemController(this, "no-gc-for-start-up"); + mem_controller_ = CreateMemController(this, "no-gc-for-start-up"); - if (memController_->IsDelayGCMode()) { - toSpace_ = new SemiSpace(this, DEFAULT_SEMI_SPACE_SIZE, MAX_SEMI_SPACE_SIZE_STARTUP); - fromSpace_ = new SemiSpace(this, DEFAULT_SEMI_SPACE_SIZE, MAX_SEMI_SPACE_SIZE_STARTUP); + if (mem_controller_->IsDelayGCMode()) { + to_space_ = new SemiSpace(this, DEFAULT_SEMI_SPACE_SIZE, MAX_SEMI_SPACE_SIZE_STARTUP); + from_space_ = new SemiSpace(this, DEFAULT_SEMI_SPACE_SIZE, MAX_SEMI_SPACE_SIZE_STARTUP); } else { - toSpace_ = new SemiSpace(this); - fromSpace_ = new SemiSpace(this); + to_space_ = new SemiSpace(this); + from_space_ = new SemiSpace(this); } - toSpace_->Initialize(); + to_space_->Initialize(); // not set up from space - oldSpace_ = new OldSpace(this); - compressSpace_ = new OldSpace(this); - oldSpace_->Initialize(); - nonMovableSpace_ = new NonMovableSpace(this); - nonMovableSpace_->Initialize(); - snapshotSpace_ = new SnapShotSpace(this); - machineCodeSpace_ = new MachineCodeSpace(this); - machineCodeSpace_->Initialize(); - hugeObjectSpace_ = new HugeObjectSpace(this); - paralledGc_ = ecmaVm_->GetJSOptions().IsEnableParallelGC(); - concurrentMarkingEnabled_ = ecmaVm_->GetJSOptions().IsEnableConcurrentMark(); + old_space_ = new OldSpace(this); + compress_space_ = new OldSpace(this); + old_space_->Initialize(); + non_movable_space_ = new NonMovableSpace(this); + non_movable_space_->Initialize(); + snapshot_space_ = new SnapShotSpace(this); + machine_code_space_ = new MachineCodeSpace(this); + machine_code_space_->Initialize(); + huge_object_space_ = new HugeObjectSpace(this); + paralled_gc_ = ecma_vm_->GetJSOptions().IsEnableParallelGC(); + concurrent_marking_enabled_ = ecma_vm_->GetJSOptions().IsEnableConcurrentMark(); #if ECMASCRIPT_DISABLE_PARALLEL_GC paralledGc_ = false; #endif @@ -70,113 +70,113 @@ void Heap::Initialize() paralledGc_ = false; concurrentMarkingEnabled_ = false; #endif - workList_ = new WorkerHelper(this, Platform::GetCurrentPlatform()->GetTotalThreadNum() + 1); - semiSpaceCollector_ = new SemiSpaceCollector(this, paralledGc_); - compressCollector_ = new CompressCollector(this); - - derivedPointers_ = new ChunkMap(ecmaVm_->GetChunk()); - mixSpaceCollector_ = new MixSpaceCollector(this); - sweeper_ = new ConcurrentSweeper(this, ecmaVm_->GetJSOptions().IsEnableConcurrentSweep()); - concurrentMarker_ = new ConcurrentMarker(this); - nonMovableMarker_ = new NonMovableMarker(this); - semiGcMarker_ = new SemiGcMarker(this); - compressGcMarker_ = new CompressGcMarker(this); - evacuationAllocator_ = new EvacuationAllocator(this); + work_list_ = new WorkerHelper(this, Platform::GetCurrentPlatform()->GetTotalThreadNum() + 1); + semi_space_collector_ = new SemiSpaceCollector(this, paralled_gc_); + compress_collector_ = new CompressCollector(this); + + derived_pointers_ = new ChunkMap(ecma_vm_->GetChunk()); + mix_space_collector_ = new MixSpaceCollector(this); + sweeper_ = new ConcurrentSweeper(this, ecma_vm_->GetJSOptions().IsEnableConcurrentSweep()); + concurrent_marker_ = new ConcurrentMarker(this); + non_movable_marker_ = new NonMovableMarker(this); + semi_gc_marker_ = new SemiGcMarker(this); + compress_gc_marker_ = new CompressGcMarker(this); + evacuation_allocator_ = new EvacuationAllocator(this); evacuation_ = new ParallelEvacuation(this); } void Heap::FlipNewSpace() { - SemiSpace *newSpace = fromSpace_; - fromSpace_ = toSpace_; - toSpace_ = newSpace; + SemiSpace *newSpace = from_space_; + from_space_ = to_space_; + to_space_ = newSpace; } void Heap::FlipCompressSpace() { - OldSpace *oldSpace = compressSpace_; - compressSpace_ = oldSpace_; - oldSpace_ = oldSpace; + OldSpace *oldSpace = compress_space_; + compress_space_ = old_space_; + old_space_ = oldSpace; } void Heap::Destroy() { Prepare(); - if (toSpace_ != nullptr) { - toSpace_->Destroy(); - delete toSpace_; - toSpace_ = nullptr; - } - if (fromSpace_ != nullptr) { - fromSpace_->Destroy(); - delete fromSpace_; - fromSpace_ = nullptr; - } - if (oldSpace_ != nullptr) { - oldSpace_->Destroy(); - delete oldSpace_; - oldSpace_ = nullptr; - } - if (compressSpace_ != nullptr) { - compressSpace_->Destroy(); - delete compressSpace_; - compressSpace_ = nullptr; - } - if (nonMovableSpace_ != nullptr) { - nonMovableSpace_->Destroy(); - delete nonMovableSpace_; - nonMovableSpace_ = nullptr; - } - if (snapshotSpace_ != nullptr) { - snapshotSpace_->Destroy(); - delete snapshotSpace_; - snapshotSpace_ = nullptr; - } - if (machineCodeSpace_ != nullptr) { - machineCodeSpace_->Destroy(); - delete machineCodeSpace_; - machineCodeSpace_ = nullptr; - } - if (hugeObjectSpace_ != nullptr) { - hugeObjectSpace_->Destroy(); - delete hugeObjectSpace_; - hugeObjectSpace_ = nullptr; - } - - delete workList_; - workList_ = nullptr; - delete semiSpaceCollector_; - semiSpaceCollector_ = nullptr; - delete mixSpaceCollector_; - mixSpaceCollector_ = nullptr; - delete compressCollector_; - compressCollector_ = nullptr; - regionFactory_ = nullptr; - delete memController_; - memController_ = nullptr; + if (to_space_ != nullptr) { + to_space_->Destroy(); + delete to_space_; + to_space_ = nullptr; + } + if (from_space_ != nullptr) { + from_space_->Destroy(); + delete from_space_; + from_space_ = nullptr; + } + if (old_space_ != nullptr) { + old_space_->Destroy(); + delete old_space_; + old_space_ = nullptr; + } + if (compress_space_ != nullptr) { + compress_space_->Destroy(); + delete compress_space_; + compress_space_ = nullptr; + } + if (non_movable_space_ != nullptr) { + non_movable_space_->Destroy(); + delete non_movable_space_; + non_movable_space_ = nullptr; + } + if (snapshot_space_ != nullptr) { + snapshot_space_->Destroy(); + delete snapshot_space_; + snapshot_space_ = nullptr; + } + if (machine_code_space_ != nullptr) { + machine_code_space_->Destroy(); + delete machine_code_space_; + machine_code_space_ = nullptr; + } + if (huge_object_space_ != nullptr) { + huge_object_space_->Destroy(); + delete huge_object_space_; + huge_object_space_ = nullptr; + } + + delete work_list_; + work_list_ = nullptr; + delete semi_space_collector_; + semi_space_collector_ = nullptr; + delete mix_space_collector_; + mix_space_collector_ = nullptr; + delete compress_collector_; + compress_collector_ = nullptr; + region_factory_ = nullptr; + delete mem_controller_; + mem_controller_ = nullptr; delete sweeper_; sweeper_ = nullptr; - delete derivedPointers_; - derivedPointers_ = nullptr; - delete concurrentMarker_; - concurrentMarker_ = nullptr; - delete nonMovableMarker_; - nonMovableMarker_ = nullptr; - delete semiGcMarker_; - semiGcMarker_ = nullptr; - delete compressGcMarker_; - compressGcMarker_ = nullptr; + delete derived_pointers_; + derived_pointers_ = nullptr; + delete concurrent_marker_; + concurrent_marker_ = nullptr; + delete non_movable_marker_; + non_movable_marker_ = nullptr; + delete semi_gc_marker_; + semi_gc_marker_ = nullptr; + delete compress_gc_marker_; + compress_gc_marker_ = nullptr; delete evacuation_; evacuation_ = nullptr; - delete evacuationAllocator_; - evacuationAllocator_ = nullptr; + delete evacuation_allocator_; + evacuation_allocator_ = nullptr; } void Heap::Prepare() { WaitRunningTaskFinished(); sweeper_->EnsureAllTaskFinished(); - evacuationAllocator_->WaitFreeTaskFinish(); + evacuation_allocator_->WaitFreeTaskFinish(); } void Heap::CollectGarbage(TriggerGCType gcType) @@ -200,45 +200,45 @@ void Heap::CollectGarbage(TriggerGCType gcType) #if ECMASCRIPT_SWITCH_GC_MODE_TO_COMPRESS_GC gcType = TriggerGCType::COMPRESS_FULL_GC; #endif - bool isDelayGCMode = memController_->IsDelayGCMode(); - if (isCompressGCRequested_ && GetEcmaVM()->GetAssociatedJSThread()->IsReadyToMark() && + bool isDelayGCMode = mem_controller_->IsDelayGCMode(); + if (is_compress_gc_requested_ && GetEcmaVM()->GetAssociatedJSThread()->IsReadyToMark() && gcType != TriggerGCType::COMPRESS_FULL_GC && !isDelayGCMode) { gcType = TriggerGCType::COMPRESS_FULL_GC; } - memController_->StartCalculationBeforeGC(); + mem_controller_->StartCalculationBeforeGC(); - OPTIONAL_LOG(ecmaVm_, ERROR, ECMASCRIPT) << "Heap::CollectGarbage, gcType = " << gcType << " global CommittedSize" - << GetCommittedSize() << " global limit" << globalSpaceAllocLimit_; + OPTIONAL_LOG(ecma_vm_, ERROR, ECMASCRIPT) << "Heap::CollectGarbage, gcType = " << gcType << " global CommittedSize" + << GetCommittedSize() << " global limit" << global_space_alloc_limit_; switch (gcType) { case TriggerGCType::SEMI_GC: if (isDelayGCMode) { SetFromSpaceMaximumCapacity(SEMI_SPACE_SIZE_CAPACITY); SetNewSpaceMaximumCapacity(SEMI_SPACE_SIZE_CAPACITY); - compressCollector_->RunPhases(); + compress_collector_->RunPhases(); ResetDelayGCMode(); } else { bool isOldGCTriggered = false; - if (!concurrentMarkingEnabled_) { + if (!concurrent_marking_enabled_) { isOldGCTriggered = GetCommittedSize() > HALF_MAX_HEAP_SIZE ? CheckAndTriggerOldGC() : CheckAndTriggerCompressGC(); } if (!isOldGCTriggered) { - mixSpaceCollector_->RunPhases(); + mix_space_collector_->RunPhases(); } } break; case TriggerGCType::OLD_GC: - mixSpaceCollector_->RunPhases(); + mix_space_collector_->RunPhases(); break; case TriggerGCType::NON_MOVE_GC: case TriggerGCType::HUGE_GC: case TriggerGCType::MACHINE_CODE_GC: - mixSpaceCollector_->RunPhases(); + mix_space_collector_->RunPhases(); break; case TriggerGCType::COMPRESS_FULL_GC: - compressCollector_->RunPhases(); - if (isCompressGCRequested_) { - isCompressGCRequested_ = false; + compress_collector_->RunPhases(); + if (is_compress_gc_requested_) { + is_compress_gc_requested_ = false; } break; default: @@ -247,24 +247,24 @@ void Heap::CollectGarbage(TriggerGCType gcType) } if (gcType == TriggerGCType::COMPRESS_FULL_GC || - (gcType != TriggerGCType::SEMI_GC && !isOnlySemi_ && !sweeper_->IsConcurrentSweepEnabled())) { + (gcType != TriggerGCType::SEMI_GC && !is_only_semi_ && !sweeper_->IsConcurrentSweepEnabled())) { // Only when the gc type is not semiGC and after the old space sweeping has been finished, // the limits of old space and global space can be recomputed. RecomputeLimits(); } - memController_->StopCalculationAfterGC(gcType); + mem_controller_->StopCalculationAfterGC(gcType); - if (toSpace_->GetMaximumCapacity() != SEMI_SPACE_SIZE_CAPACITY || - toSpace_->GetCommittedSize() > SEMI_SPACE_SIZE_CAPACITY * SEMI_SPACE_RETENTION_RATIO) { - auto capacity = AlignUp(static_cast(toSpace_->GetCommittedSize() / SEMI_SPACE_RETENTION_RATIO), + if (to_space_->GetMaximumCapacity() != SEMI_SPACE_SIZE_CAPACITY || + to_space_->GetCommittedSize() > SEMI_SPACE_SIZE_CAPACITY * SEMI_SPACE_RETENTION_RATIO) { + auto capacity = AlignUp(static_cast(to_space_->GetCommittedSize() / SEMI_SPACE_RETENTION_RATIO), PANDA_POOL_ALIGNMENT_IN_BYTES); capacity = std::max(capacity, SEMI_SPACE_SIZE_CAPACITY); capacity = std::min(capacity, MAX_SEMI_SPACE_SIZE_STARTUP); - toSpace_->SetMaximumCapacity(capacity); + to_space_->SetMaximumCapacity(capacity); } - OPTIONAL_LOG(ecmaVm_, ERROR, ECMASCRIPT) << " GC after: isOnlySemi_" << isOnlySemi_ << " global CommittedSize" - << GetCommittedSize() << " global limit" << globalSpaceAllocLimit_; + OPTIONAL_LOG(ecma_vm_, ERROR, ECMASCRIPT) << " GC after: isOnlySemi_" << is_only_semi_ << " global CommittedSize" + << GetCommittedSize() << " global limit" << global_space_alloc_limit_; #if ECMASCRIPT_ENABLE_GC_LOG ecmaVm_->GetEcmaGCStats()->PrintStatisticResult(); @@ -293,40 +293,40 @@ size_t Heap::VerifyHeapObjects() const size_t failCount = 0; { VerifyObjectVisitor verifier(this, &failCount); - toSpace_->IterateOverObjects(verifier); + to_space_->IterateOverObjects(verifier); } { VerifyObjectVisitor verifier(this, &failCount); - oldSpace_->IterateOverObjects(verifier); + old_space_->IterateOverObjects(verifier); } { VerifyObjectVisitor verifier(this, &failCount); - nonMovableSpace_->IterateOverObjects(verifier); + non_movable_space_->IterateOverObjects(verifier); } { VerifyObjectVisitor verifier(this, &failCount); - hugeObjectSpace_->IterateOverObjects(verifier); + huge_object_space_->IterateOverObjects(verifier); } return failCount; } void Heap::RecomputeLimits() { - double gcSpeed = memController_->CalculateMarkCompactSpeedPerMS(); - double mutatorSpeed = memController_->GetCurrentOldSpaceAllocationThroughtputPerMS(); - size_t oldSpaceSize = oldSpace_->GetCommittedSize() + hugeObjectSpace_->GetCommittedSize(); - size_t newSpaceCapacity = toSpace_->GetCommittedSize(); - - double growingFactor = memController_->CalculateGrowingFactor(gcSpeed, mutatorSpeed); - auto newOldSpaceLimit = memController_->CalculateAllocLimit(oldSpaceSize, DEFAULT_OLD_SPACE_SIZE, - MAX_OLD_SPACE_SIZE, newSpaceCapacity, growingFactor); - auto newGlobalSpaceLimit = memController_->CalculateAllocLimit(GetCommittedSize(), DEFAULT_HEAP_SIZE, MAX_HEAP_SIZE, - newSpaceCapacity, growingFactor); - globalSpaceAllocLimit_ = newGlobalSpaceLimit; - oldSpaceAllocLimit_ = newOldSpaceLimit; + double gcSpeed = mem_controller_->CalculateMarkCompactSpeedPerMS(); + double mutatorSpeed = mem_controller_->GetCurrentOldSpaceAllocationThroughtputPerMS(); + size_t oldSpaceSize = old_space_->GetCommittedSize() + huge_object_space_->GetCommittedSize(); + size_t newSpaceCapacity = to_space_->GetCommittedSize(); + + double growingFactor = mem_controller_->CalculateGrowingFactor(gcSpeed, mutatorSpeed); + auto newOldSpaceLimit = mem_controller_->CalculateAllocLimit(oldSpaceSize, DEFAULT_OLD_SPACE_SIZE, + MAX_OLD_SPACE_SIZE, newSpaceCapacity, growingFactor); + auto newGlobalSpaceLimit = mem_controller_->CalculateAllocLimit(GetCommittedSize(), DEFAULT_HEAP_SIZE, + MAX_HEAP_SIZE, newSpaceCapacity, growingFactor); + global_space_alloc_limit_ = newGlobalSpaceLimit; + old_space_alloc_limit_ = newOldSpaceLimit; } bool Heap::CheckConcurrentMark(JSThread *thread) @@ -338,7 +338,7 @@ bool Heap::CheckConcurrentMark(JSThread *thread) WaitConcurrentMarkingFinished(); ECMA_GC_LOG() << "wait concurrent marking finish pause time " << clockScope.TotalSpentTime(); } - memController_->RecordAfterConcurrentMark(isOnlySemi_, concurrentMarker_); + mem_controller_->RecordAfterConcurrentMark(is_only_semi_, concurrent_marker_); return true; } return false; @@ -353,7 +353,7 @@ void Heap::TryTriggerConcurrentMarking(bool allowGc) // can exactly allow the new space to allocate to the capacity, semi mark can be triggered. But when it will spend // a lot of time in full mark, the compress full GC will be requested after the spaces reach to limits. And If the // global space is larger than the half max heap size, we will turn to use full mark and trigger mix GC. - if (!concurrentMarkingEnabled_ || !allowGc || !GetEcmaVM()->GetAssociatedJSThread()->IsReadyToMark() || + if (!concurrent_marking_enabled_ || !allowGc || !GetEcmaVM()->GetAssociatedJSThread()->IsReadyToMark() || GetMemController()->IsDelayGCMode()) { return; } @@ -363,22 +363,22 @@ void Heap::TryTriggerConcurrentMarking(bool allowGc) double newSpaceRemainSize = 0; double newSpaceAllocToLimitDuration = 0; double oldSpaceAllocToLimitDuration = 0; - double oldSpaceAllocSpeed = memController_->GetOldSpaceAllocationThroughtPerMS(); - double oldSpaceConcurrentMarkSpeed = memController_->GetFullSpaceConcurrentMarkSpeedPerMS(); - size_t oldSpaceCommittedSize = oldSpace_->GetCommittedSize() + hugeObjectSpace_->GetCommittedSize(); + double oldSpaceAllocSpeed = mem_controller_->GetOldSpaceAllocationThroughtPerMS(); + double oldSpaceConcurrentMarkSpeed = mem_controller_->GetFullSpaceConcurrentMarkSpeedPerMS(); + size_t oldSpaceCommittedSize = old_space_->GetCommittedSize() + huge_object_space_->GetCommittedSize(); size_t globalSpaceCommittedSize = GetCommittedSize(); if (oldSpaceConcurrentMarkSpeed == 0 || oldSpaceAllocSpeed == 0) { if (oldSpaceCommittedSize >= OLD_SPACE_LIMIT_BEGIN) { - isOnlySemi_ = false; + is_only_semi_ = false; ECMA_GC_LOG() << "Trigger the first full mark"; TriggerConcurrentMarking(); } } else { - if (oldSpaceCommittedSize >= oldSpaceAllocLimit_ || globalSpaceCommittedSize >= globalSpaceAllocLimit_) { + if (oldSpaceCommittedSize >= old_space_alloc_limit_ || globalSpaceCommittedSize >= global_space_alloc_limit_) { isFullMarkNeeded = true; } oldSpaceAllocToLimitDuration = - static_cast(oldSpaceAllocLimit_ - oldSpaceCommittedSize) / oldSpaceAllocSpeed; + static_cast(old_space_alloc_limit_ - oldSpaceCommittedSize) / oldSpaceAllocSpeed; oldSpaceMarkDuration = GetHeapObjectSize() / oldSpaceConcurrentMarkSpeed; // oldSpaceRemainSize means the predicted size which can be allocated after the full concurrent mark. double oldSpaceRemainSize = (oldSpaceAllocToLimitDuration - oldSpaceMarkDuration) * oldSpaceAllocSpeed; @@ -387,39 +387,39 @@ void Heap::TryTriggerConcurrentMarking(bool allowGc) } } - double newSpaceAllocSpeed = memController_->GetNewSpaceAllocationThroughtPerMS(); - double newSpaceConcurrentMarkSpeed = memController_->GetNewSpaceConcurrentMarkSpeedPerMS(); + double newSpaceAllocSpeed = mem_controller_->GetNewSpaceAllocationThroughtPerMS(); + double newSpaceConcurrentMarkSpeed = mem_controller_->GetNewSpaceConcurrentMarkSpeedPerMS(); if (newSpaceConcurrentMarkSpeed == 0 || newSpaceAllocSpeed == 0) { - if (toSpace_->GetCommittedSize() >= SEMI_SPACE_TRIGGER_CONCURRENT_MARK) { - isOnlySemi_ = true; + if (to_space_->GetCommittedSize() >= SEMI_SPACE_TRIGGER_CONCURRENT_MARK) { + is_only_semi_ = true; TriggerConcurrentMarking(); ECMA_GC_LOG() << "Trigger the first semi mark"; } return; } newSpaceAllocToLimitDuration = - static_cast(toSpace_->GetMaximumCapacity() - toSpace_->GetCommittedSize()) / newSpaceAllocSpeed; - newSpaceMarkDuration = toSpace_->GetHeapObjectSize() / newSpaceConcurrentMarkSpeed; + static_cast(to_space_->GetMaximumCapacity() - to_space_->GetCommittedSize()) / newSpaceAllocSpeed; + newSpaceMarkDuration = to_space_->GetHeapObjectSize() / newSpaceConcurrentMarkSpeed; // newSpaceRemainSize means the predicted size which can be allocated after the semi concurrent mark. newSpaceRemainSize = (newSpaceAllocToLimitDuration - newSpaceMarkDuration) * newSpaceAllocSpeed; if (isFullMarkNeeded) { if (oldSpaceMarkDuration < newSpaceAllocToLimitDuration && oldSpaceMarkDuration < oldSpaceAllocToLimitDuration) { - isOnlySemi_ = false; + is_only_semi_ = false; TriggerConcurrentMarking(); ECMA_GC_LOG() << "Trigger full mark"; return; } - if (oldSpaceCommittedSize >= oldSpaceAllocLimit_ || globalSpaceCommittedSize >= globalSpaceAllocLimit_) { + if (oldSpaceCommittedSize >= old_space_alloc_limit_ || globalSpaceCommittedSize >= global_space_alloc_limit_) { if (oldSpaceCommittedSize > HALF_MAX_HEAP_SIZE) { - isOnlySemi_ = false; + is_only_semi_ = false; TriggerConcurrentMarking(); ECMA_GC_LOG() << "HEAP is larger than half of the max size. Trigger full mark"; } else { - isCompressGCRequested_ = true; + is_compress_gc_requested_ = true; ECMA_GC_LOG() << "Request compress GC"; } } @@ -427,7 +427,7 @@ void Heap::TryTriggerConcurrentMarking(bool allowGc) } if (newSpaceRemainSize < DEFAULT_REGION_SIZE) { - isOnlySemi_ = true; + is_only_semi_ = true; TriggerConcurrentMarking(); ECMA_GC_LOG() << "Trigger semi mark"; } @@ -435,21 +435,21 @@ void Heap::TryTriggerConcurrentMarking(bool allowGc) void Heap::TriggerConcurrentMarking() { - if (concurrentMarkingEnabled_ && !isCompressGCRequested_) { - concurrentMarker_->ConcurrentMarking(); + if (concurrent_marking_enabled_ && !is_compress_gc_requested_) { + concurrent_marker_->ConcurrentMarking(); } } void Heap::CheckNeedFullMark() { - if ((oldSpace_->GetCommittedSize() + hugeObjectSpace_->GetCommittedSize()) > oldSpaceAllocLimit_) { + if ((old_space_->GetCommittedSize() + huge_object_space_->GetCommittedSize()) > old_space_alloc_limit_) { SetOnlyMarkSemi(false); } } bool Heap::CheckAndTriggerOldGC() { - if ((oldSpace_->GetCommittedSize() + hugeObjectSpace_->GetCommittedSize()) <= oldSpaceAllocLimit_) { + if ((old_space_->GetCommittedSize() + huge_object_space_->GetCommittedSize()) <= old_space_alloc_limit_) { return false; } CollectGarbage(TriggerGCType::OLD_GC); @@ -458,7 +458,7 @@ bool Heap::CheckAndTriggerOldGC() bool Heap::CheckAndTriggerCompressGC() { - if (GetCommittedSize() <= globalSpaceAllocLimit_) { + if (GetCommittedSize() <= global_space_alloc_limit_) { return false; } CollectGarbage(TriggerGCType::COMPRESS_FULL_GC); @@ -467,7 +467,7 @@ bool Heap::CheckAndTriggerCompressGC() bool Heap::CheckAndTriggerNonMovableGC() { - if (nonMovableSpace_->GetCommittedSize() <= DEFAULT_NON_MOVABLE_SPACE_LIMIT) { + if (non_movable_space_->GetCommittedSize() <= DEFAULT_NON_MOVABLE_SPACE_LIMIT) { return false; } CollectGarbage(TriggerGCType::NON_MOVE_GC); @@ -476,7 +476,7 @@ bool Heap::CheckAndTriggerNonMovableGC() bool Heap::CheckAndTriggerMachineCodeGC() { - if (machineCodeSpace_->GetCommittedSize() <= DEFAULT_MACHINE_CODE_SPACE_LIMIT) { + if (machine_code_space_->GetCommittedSize() <= DEFAULT_MACHINE_CODE_SPACE_LIMIT) { return false; } CollectGarbage(TriggerGCType::MACHINE_CODE_GC); @@ -485,10 +485,10 @@ bool Heap::CheckAndTriggerMachineCodeGC() void Heap::UpdateDerivedObjectInStack() { - if (derivedPointers_->empty()) { + if (derived_pointers_->empty()) { return; } - for (auto derived : *derivedPointers_) { + for (auto derived : *derived_pointers_) { auto baseAddr = reinterpret_cast(derived.first.first); JSTaggedValue base = *baseAddr; if (base.IsHeapObject()) { @@ -506,30 +506,30 @@ void Heap::UpdateDerivedObjectInStack() #endif } } - derivedPointers_->clear(); + derived_pointers_->clear(); } void Heap::WaitRunningTaskFinished() { - os::memory::LockHolder holder(waitTaskFinishedMutex_); - while (runningTastCount_ > 0) { - waitTaskFinishedCV_.Wait(&waitTaskFinishedMutex_); + os::memory::LockHolder holder(wait_task_finished_mutex_); + while (running_tast_count_ > 0) { + wait_task_finished_cv_.Wait(&wait_task_finished_mutex_); } } void Heap::WaitConcurrentMarkingFinished() { - concurrentMarker_->WaitConcurrentMarkingFinished(); + concurrent_marker_->WaitConcurrentMarkingFinished(); } void Heap::SetConcurrentMarkingEnable(bool flag) { - concurrentMarkingEnabled_ = flag; + concurrent_marking_enabled_ = flag; } bool Heap::ConcurrentMarkingEnable() const { - return concurrentMarkingEnabled_; + return concurrent_marking_enabled_; } void Heap::PostParallelGCTask(ParallelGCTaskPhase gcTask) @@ -540,29 +540,29 @@ void Heap::PostParallelGCTask(ParallelGCTaskPhase gcTask) void Heap::IncreaseTaskCount() { - os::memory::LockHolder holder(waitTaskFinishedMutex_); - runningTastCount_++; + os::memory::LockHolder holder(wait_task_finished_mutex_); + running_tast_count_++; } bool Heap::CheckCanDistributeTask() { - os::memory::LockHolder holder(waitTaskFinishedMutex_); - return (runningTastCount_ < Platform::GetCurrentPlatform()->GetTotalThreadNum() - 1) && - (runningTastCount_ <= MAX_PARALLEL_THREAD_NUM); + os::memory::LockHolder holder(wait_task_finished_mutex_); + return (running_tast_count_ < Platform::GetCurrentPlatform()->GetTotalThreadNum() - 1) && + (running_tast_count_ <= MAX_PARALLEL_THREAD_NUM); } void Heap::ReduceTaskCount() { - os::memory::LockHolder holder(waitTaskFinishedMutex_); - runningTastCount_--; - if (runningTastCount_ == 0) { - waitTaskFinishedCV_.SignalAll(); + os::memory::LockHolder holder(wait_task_finished_mutex_); + running_tast_count_--; + if (running_tast_count_ == 0) { + wait_task_finished_cv_.SignalAll(); } } bool Heap::ParallelGCTask::Run(uint32_t threadIndex) { - switch (taskPhase_) { + switch (task_phase_) { case ParallelGCTaskPhase::SEMI_HANDLE_THREAD_ROOTS_TASK: heap_->GetSemiGcMarker()->MarkRoots(threadIndex); heap_->GetSemiGcMarker()->ProcessMarkStack(threadIndex); diff --git a/runtime/mem/heap.h b/runtime/mem/heap.h index 2196e9ed0b7c09bd5cab23ec69aa6e92f8f611e9..6c07468e04baf0b4828996223631c7f30019df06 100644 --- a/runtime/mem/heap.h +++ b/runtime/mem/heap.h @@ -55,7 +55,7 @@ public: const SemiSpace *GetNewSpace() const { - return toSpace_; + return to_space_; } inline void SetNewSpaceAgeMark(uintptr_t mark); @@ -64,12 +64,12 @@ public: const SemiSpace *GetFromSpace() const { - return fromSpace_; + return from_space_; } const OldSpace *GetCompressSpace() const { - return compressSpace_; + return compress_space_; } inline void InitializeFromSpace(); @@ -83,37 +83,37 @@ public: const OldSpace *GetOldSpace() const { - return oldSpace_; + return old_space_; } const NonMovableSpace *GetNonMovableSpace() const { - return nonMovableSpace_; + return non_movable_space_; } const HugeObjectSpace *GetHugeObjectSpace() const { - return hugeObjectSpace_; + return huge_object_space_; } const MachineCodeSpace *GetMachineCodeSpace() const { - return machineCodeSpace_; + return machine_code_space_; } SemiSpaceCollector *GetSemiSpaceCollector() const { - return semiSpaceCollector_; + return semi_space_collector_; } MixSpaceCollector *GetMixSpaceCollector() const { - return mixSpaceCollector_; + return mix_space_collector_; } CompressCollector *GetCompressCollector() const { - return compressCollector_; + return compress_collector_; } ConcurrentSweeper *GetSweeper() const @@ -128,22 +128,22 @@ public: EvacuationAllocator *GetEvacuationAllocator() const { - return evacuationAllocator_; + return evacuation_allocator_; } ConcurrentMarker *GetConcurrentMarker() const { - return concurrentMarker_; + return concurrent_marker_; } EcmaVM *GetEcmaVM() const { - return ecmaVm_; + return ecma_vm_; } WorkerHelper *GetWorkList() const { - return workList_; + return work_list_; } void FlipNewSpace(); @@ -183,12 +183,12 @@ public: void SetHeapManager(MemManager *heapManager) { - heapManager_ = heapManager; + heap_manager_ = heapManager; } MemManager *GetHeapManager() const { - return heapManager_; + return heap_manager_; } void StartHeapTracking(HeapTracker *tracker) @@ -222,12 +222,12 @@ public: const RegionFactory *GetRegionFactory() const { - return regionFactory_; + return region_factory_; } SnapShotSpace *GetSnapShotSpace() const { - return snapshotSpace_; + return snapshot_space_; } bool IsLive(TaggedObject *object) const @@ -237,19 +237,19 @@ public: } // semi space - if (toSpace_->IsLive(object)) { + if (to_space_->IsLive(object)) { return true; } // old space - if (oldSpace_->IsLive(object)) { + if (old_space_->IsLive(object)) { return true; } // non movable space - if (nonMovableSpace_->IsLive(object)) { + if (non_movable_space_->IsLive(object)) { return true; } // huge object space - if (hugeObjectSpace_->IsLive(object)) { + if (huge_object_space_->IsLive(object)) { return true; } return false; @@ -258,19 +258,19 @@ public: bool ContainObject(TaggedObject *object) const { // semi space - if (toSpace_->ContainObject(object)) { + if (to_space_->ContainObject(object)) { return true; } // old space - if (oldSpace_->ContainObject(object)) { + if (old_space_->ContainObject(object)) { return true; } // non movable space - if (nonMovableSpace_->ContainObject(object)) { + if (non_movable_space_->ContainObject(object)) { return true; } // huge object space - if (hugeObjectSpace_->ContainObject(object)) { + if (huge_object_space_->ContainObject(object)) { return true; } return false; @@ -280,17 +280,17 @@ public: MemController *GetMemController() const { - return memController_; + return mem_controller_; } size_t GetOldSpaceAllocLimit() { - return oldSpaceAllocLimit_; + return old_space_alloc_limit_; } void SetGlobalSpaceAllocLimit(size_t limit) { - globalSpaceAllocLimit_ = limit; + global_space_alloc_limit_ = limit; } inline void ResetDelayGCMode(); @@ -301,7 +301,7 @@ public: ChunkMap *GetDerivedPointers() const { - return derivedPointers_; + return derived_pointers_; } #if ECMASCRIPT_ENABLE_HEAP_VERIFY bool GetIsVerifying() const @@ -321,7 +321,7 @@ public: bool IsParallelGCEnabled() const { - return paralledGc_; + return paralled_gc_; } void WaitConcurrentMarkingFinished(); @@ -332,27 +332,27 @@ public: inline bool IsSemiMarkNeeded() const { - return isOnlySemi_; + return is_only_semi_; } void SetOnlyMarkSemi(bool onlySemi) { - isOnlySemi_ = onlySemi; + is_only_semi_ = onlySemi; } Marker *GetNonMovableMarker() const { - return nonMovableMarker_; + return non_movable_marker_; } Marker *GetSemiGcMarker() const { - return semiGcMarker_; + return semi_gc_marker_; } Marker *GetCompressGcMarker() const { - return compressGcMarker_; + return compress_gc_marker_; } size_t GetArrayBufferSize() const; @@ -368,7 +368,7 @@ private: class ParallelGCTask : public Task { public: - ParallelGCTask(Heap *heap, ParallelGCTaskPhase taskPhase) : heap_(heap), taskPhase_(taskPhase) {}; + ParallelGCTask(Heap *heap, ParallelGCTaskPhase taskPhase) : heap_(heap), task_phase_(taskPhase) {}; ~ParallelGCTask() override = default; bool Run(uint32_t threadIndex) override; @@ -377,48 +377,48 @@ private: private: Heap *heap_ {nullptr}; - ParallelGCTaskPhase taskPhase_; + ParallelGCTaskPhase task_phase_; }; - EcmaVM *ecmaVm_ {nullptr}; - SemiSpace *fromSpace_ {nullptr}; - SemiSpace *toSpace_ {nullptr}; - OldSpace *oldSpace_ {nullptr}; - OldSpace *compressSpace_ {nullptr}; - HugeObjectSpace *hugeObjectSpace_ {nullptr}; - SnapShotSpace *snapshotSpace_ {nullptr}; - NonMovableSpace *nonMovableSpace_ {nullptr}; - MachineCodeSpace *machineCodeSpace_ {nullptr}; - SemiSpaceCollector *semiSpaceCollector_ {nullptr}; - MixSpaceCollector *mixSpaceCollector_ {nullptr}; - CompressCollector *compressCollector_ {nullptr}; + EcmaVM *ecma_vm_ {nullptr}; + SemiSpace *from_space_ {nullptr}; + SemiSpace *to_space_ {nullptr}; + OldSpace *old_space_ {nullptr}; + OldSpace *compress_space_ {nullptr}; + HugeObjectSpace *huge_object_space_ {nullptr}; + SnapShotSpace *snapshot_space_ {nullptr}; + NonMovableSpace *non_movable_space_ {nullptr}; + MachineCodeSpace *machine_code_space_ {nullptr}; + SemiSpaceCollector *semi_space_collector_ {nullptr}; + MixSpaceCollector *mix_space_collector_ {nullptr}; + CompressCollector *compress_collector_ {nullptr}; ConcurrentSweeper *sweeper_ {nullptr}; - Marker *nonMovableMarker_ {nullptr}; - Marker *semiGcMarker_ {nullptr}; - Marker *compressGcMarker_ {nullptr}; + Marker *non_movable_marker_ {nullptr}; + Marker *semi_gc_marker_ {nullptr}; + Marker *compress_gc_marker_ {nullptr}; ParallelEvacuation *evacuation_ {nullptr}; - EvacuationAllocator *evacuationAllocator_ {nullptr}; - MemManager *heapManager_ {nullptr}; - RegionFactory *regionFactory_ {nullptr}; + EvacuationAllocator *evacuation_allocator_ {nullptr}; + MemManager *heap_manager_ {nullptr}; + RegionFactory *region_factory_ {nullptr}; HeapTracker *tracker_ {nullptr}; - MemController *memController_ {nullptr}; - size_t oldSpaceAllocLimit_ {OLD_SPACE_LIMIT_BEGIN}; - size_t globalSpaceAllocLimit_ {GLOBAL_SPACE_LIMIT_BEGIN}; - ChunkMap *derivedPointers_ {nullptr}; + MemController *mem_controller_ {nullptr}; + size_t old_space_alloc_limit_ {OLD_SPACE_LIMIT_BEGIN}; + size_t global_space_alloc_limit_ {GLOBAL_SPACE_LIMIT_BEGIN}; + ChunkMap *derived_pointers_ {nullptr}; #if ECMASCRIPT_ENABLE_HEAP_VERIFY bool isVerifying_ {false}; #endif - ConcurrentMarker *concurrentMarker_ {nullptr}; - uint32_t runningTastCount_ {0}; - os::memory::Mutex waitTaskFinishedMutex_; - os::memory::ConditionVariable waitTaskFinishedCV_; - bool paralledGc_ {true}; - WorkerHelper *workList_ {nullptr}; + ConcurrentMarker *concurrent_marker_ {nullptr}; + uint32_t running_tast_count_ {0}; + os::memory::Mutex wait_task_finished_mutex_; + os::memory::ConditionVariable wait_task_finished_cv_; + bool paralled_gc_ {true}; + WorkerHelper *work_list_ {nullptr}; - bool concurrentMarkingEnabled_ {true}; - bool isOnlySemi_ {true}; - bool isCompressGCRequested_ {false}; + bool concurrent_marking_enabled_ {true}; + bool is_only_semi_ {true}; + bool is_compress_gc_requested_ {false}; inline void SetMaximumCapacity(SemiSpace *space, size_t maximumCapacity); }; } // namespace panda::ecmascript diff --git a/runtime/mem/mark_stack-inl.h b/runtime/mem/mark_stack-inl.h index a83e6450fbad4fb2751aefcba919909abf01b664..8f1f3ccbb7eb85bab8a707c1ef7546f765958f41 100644 --- a/runtime/mem/mark_stack-inl.h +++ b/runtime/mem/mark_stack-inl.h @@ -24,20 +24,20 @@ template void ContinuousStack::BeginMarking(Heap *heap, ContinuousStack *other) { heap_ = heap; - currentArea_ = other->currentArea_; - if (currentArea_ == nullptr) { - currentArea_ = RegionFactory::AllocateSpace(DEFAULT_MARK_STACK_SIZE); + current_area_ = other->current_area_; + if (current_area_ == nullptr) { + current_area_ = RegionFactory::AllocateSpace(DEFAULT_MARK_STACK_SIZE); } - ResetBegin(currentArea_->GetBegin(), currentArea_->GetEnd()); + ResetBegin(current_area_->GetBegin(), current_area_->GetEnd()); } template void ContinuousStack::FinishMarking(ContinuousStack *other) { - other->currentArea_ = currentArea_; + other->current_area_ = current_area_; - while (!unusedList_.IsEmpty()) { - Area *node = unusedList_.PopBack(); + while (!unused_list_.IsEmpty()) { + Area *node = unused_list_.PopBack(); RegionFactory::FreeSpace(node); } } @@ -46,17 +46,17 @@ template void ContinuousStack::Extend() { auto area = RegionFactory::AllocateSpace(DEFAULT_MARK_STACK_SIZE); - areaList_.AddNode(currentArea_); - currentArea_ = area; - ResetBegin(currentArea_->GetBegin(), currentArea_->GetEnd()); + area_list_.AddNode(current_area_); + current_area_ = area; + ResetBegin(current_area_->GetBegin(), current_area_->GetEnd()); } template void ContinuousStack::Destroy() { - if (currentArea_ != nullptr) { - RegionFactory::FreeSpace(currentArea_); - currentArea_ = nullptr; + if (current_area_ != nullptr) { + RegionFactory::FreeSpace(current_area_); + current_area_ = nullptr; } } } // namespace panda::ecmascript diff --git a/runtime/mem/mark_stack.h b/runtime/mem/mark_stack.h index 2bbdd43fef93c6df9dc98853758f0766cf3d2f3f..25542abc775c24dc4929e4b552598bbda4af2ccc 100644 --- a/runtime/mem/mark_stack.h +++ b/runtime/mem/mark_stack.h @@ -107,11 +107,11 @@ public: T *PopBack() { if (UNLIKELY(top_ <= reinterpret_cast(begin_))) { - if (!areaList_.IsEmpty()) { - unusedList_.AddNode(currentArea_); - Area *last = areaList_.PopBack(); - currentArea_ = last; - ResetTop(currentArea_->GetBegin(), currentArea_->GetEnd()); + if (!area_list_.IsEmpty()) { + unused_list_.AddNode(current_area_); + Area *last = area_list_.PopBack(); + current_area_ = last; + ResetTop(current_area_->GetBegin(), current_area_->GetEnd()); } else { return nullptr; } @@ -133,9 +133,9 @@ private: inline void Extend(); Heap *heap_ {nullptr}; - Area *currentArea_ {nullptr}; - EcmaList areaList_ {}; - EcmaList unusedList_ {}; + Area *current_area_ {nullptr}; + EcmaList area_list_ {}; + EcmaList unused_list_ {}; }; using MarkStack = ContinuousStack; diff --git a/runtime/mem/mem_controller.cpp b/runtime/mem/mem_controller.cpp index 8dcdae6cf1ef8027956aa405145a8822988828fb..45b5269e663dca1abe2352977247235f38f378ee 100644 --- a/runtime/mem/mem_controller.cpp +++ b/runtime/mem/mem_controller.cpp @@ -21,7 +21,7 @@ #include "plugins/ecmascript/runtime/mem/parallel_evacuation.h" namespace panda::ecmascript { -MemController::MemController(Heap *heap, bool isDelayGCMode) : heap_(heap), isDelayGCMode_(isDelayGCMode) {} +MemController::MemController(Heap *heap, bool isDelayGCMode) : heap_(heap), is_delay_gc_mode_(isDelayGCMode) {} double MemController::CalculateAllocLimit(size_t currentSize, size_t minSize, size_t maxSize, [[maybe_unused]] size_t newSpaceCapacity, double factor) const @@ -58,70 +58,74 @@ double MemController::CalculateGrowingFactor(double gcSpeed, double mutatorSpeed void MemController::StartCalculationBeforeGC() { - startCounter_++; - if (startCounter_ != 1) { + start_counter_++; + if (start_counter_ != 1) { return; } auto heapManager = heap_->GetHeapManager(); // It's unnecessary to calculate newSpaceAllocAccumulatorSize. newSpaceAllocBytesSinceGC can be calculated directly. size_t newSpaceAllocBytesSinceGC = heap_->GetNewSpace()->GetAllocatedSizeSinceGC(); - size_t hugeObjectAllocSizeSinceGC = heap_->GetHugeObjectSpace()->GetHeapObjectSize() - hugeObjectAllocSizeSinceGC_; + size_t hugeObjectAllocSizeSinceGC = + heap_->GetHugeObjectSpace()->GetHeapObjectSize() - huge_object_alloc_size_since_gc_; size_t oldSpaceAllocAccumulatorSize = heapManager->GetOldSpaceAllocator().GetAllocatedSize() + heap_->GetEvacuation()->GetPromotedAccumulatorSize(); size_t nonMovableSpaceAllocAccumulatorSize = heapManager->GetNonMovableSpaceAllocator().GetAllocatedSize(); size_t codeSpaceAllocAccumulatorSize = heapManager->GetMachineCodeSpaceAllocator().GetAllocatedSize(); - if (allocTimeMs_ == 0) { - allocTimeMs_ = GetSystemTimeInMs(); - oldSpaceAllocAccumulatorSize_ = oldSpaceAllocAccumulatorSize; - nonMovableSpaceAllocAccumulatorSize_ = nonMovableSpaceAllocAccumulatorSize; - codeSpaceAllocAccumulatorSize_ = codeSpaceAllocAccumulatorSize; + if (alloc_time_ms_ == 0) { + alloc_time_ms_ = GetSystemTimeInMs(); + old_space_alloc_accumulator_size_ = oldSpaceAllocAccumulatorSize; + non_movable_space_alloc_accumulator_size_ = nonMovableSpaceAllocAccumulatorSize; + code_space_alloc_accumulator_size_ = codeSpaceAllocAccumulatorSize; return; } double currentTimeInMs = GetSystemTimeInMs(); - gcStartTime_ = currentTimeInMs; - size_t oldSpaceAllocSize = oldSpaceAllocAccumulatorSize - oldSpaceAllocAccumulatorSize_; - size_t nonMovableSpaceAllocSize = nonMovableSpaceAllocAccumulatorSize - nonMovableSpaceAllocAccumulatorSize_; - size_t codeSpaceAllocSize = codeSpaceAllocAccumulatorSize - codeSpaceAllocAccumulatorSize_; - - double duration = currentTimeInMs - allocTimeMs_; - allocTimeMs_ = currentTimeInMs; - oldSpaceAllocAccumulatorSize_ = oldSpaceAllocAccumulatorSize; - nonMovableSpaceAllocAccumulatorSize_ = nonMovableSpaceAllocAccumulatorSize; - codeSpaceAllocAccumulatorSize_ = codeSpaceAllocAccumulatorSize; - allocDurationSinceGc_ += duration; - newSpaceAllocSizeSinceGC_ += newSpaceAllocBytesSinceGC; - oldSpaceAllocSizeSinceGC_ += oldSpaceAllocSize; - oldSpaceAllocSizeSinceGC_ += hugeObjectAllocSizeSinceGC; - nonMovableSpaceAllocSizeSinceGC_ += nonMovableSpaceAllocSize; - codeSpaceAllocSizeSinceGC_ += codeSpaceAllocSize; + gc_start_time_ = currentTimeInMs; + size_t oldSpaceAllocSize = oldSpaceAllocAccumulatorSize - old_space_alloc_accumulator_size_; + size_t nonMovableSpaceAllocSize = nonMovableSpaceAllocAccumulatorSize - non_movable_space_alloc_accumulator_size_; + size_t codeSpaceAllocSize = codeSpaceAllocAccumulatorSize - code_space_alloc_accumulator_size_; + + double duration = currentTimeInMs - alloc_time_ms_; + alloc_time_ms_ = currentTimeInMs; + old_space_alloc_accumulator_size_ = oldSpaceAllocAccumulatorSize; + non_movable_space_alloc_accumulator_size_ = nonMovableSpaceAllocAccumulatorSize; + code_space_alloc_accumulator_size_ = codeSpaceAllocAccumulatorSize; + alloc_duration_since_gc_ += duration; + new_space_alloc_size_since_gc_ += newSpaceAllocBytesSinceGC; + old_space_alloc_size_since_gc_ += oldSpaceAllocSize; + old_space_alloc_size_since_gc_ += hugeObjectAllocSizeSinceGC; + non_movable_space_alloc_size_since_gc_ += nonMovableSpaceAllocSize; + code_space_alloc_size_since_gc_ += codeSpaceAllocSize; } void MemController::StopCalculationAfterGC(TriggerGCType gcType) { - startCounter_--; - if (startCounter_ != 0) { + start_counter_--; + if (start_counter_ != 0) { return; } - gcEndTime_ = GetSystemTimeInMs(); - allocTimeMs_ = gcEndTime_; - if (allocDurationSinceGc_ > 0) { - recordedNewSpaceAllocations_.Push(MakeBytesAndDuration(newSpaceAllocSizeSinceGC_, allocDurationSinceGc_)); - recordedOldSpaceAllocations_.Push(MakeBytesAndDuration(oldSpaceAllocSizeSinceGC_, allocDurationSinceGc_)); - recordedNonmovableSpaceAllocations_.Push( - MakeBytesAndDuration(nonMovableSpaceAllocSizeSinceGC_, allocDurationSinceGc_)); - recordedCodeSpaceAllocations_.Push(MakeBytesAndDuration(codeSpaceAllocSizeSinceGC_, allocDurationSinceGc_)); + gc_end_time_ = GetSystemTimeInMs(); + alloc_time_ms_ = gc_end_time_; + if (alloc_duration_since_gc_ > 0) { + recorded_new_space_allocations_.Push( + MakeBytesAndDuration(new_space_alloc_size_since_gc_, alloc_duration_since_gc_)); + recorded_old_space_allocations_.Push( + MakeBytesAndDuration(old_space_alloc_size_since_gc_, alloc_duration_since_gc_)); + recorded_nonmovable_space_allocations_.Push( + MakeBytesAndDuration(non_movable_space_alloc_size_since_gc_, alloc_duration_since_gc_)); + recorded_code_space_allocations_.Push( + MakeBytesAndDuration(code_space_alloc_size_since_gc_, alloc_duration_since_gc_)); } - allocDurationSinceGc_ = 0.0; - newSpaceAllocSizeSinceGC_ = 0; - oldSpaceAllocSizeSinceGC_ = 0; - nonMovableSpaceAllocSizeSinceGC_ = 0; - codeSpaceAllocSizeSinceGC_ = 0; + alloc_duration_since_gc_ = 0.0; + new_space_alloc_size_since_gc_ = 0; + old_space_alloc_size_since_gc_ = 0; + non_movable_space_alloc_size_since_gc_ = 0; + code_space_alloc_size_since_gc_ = 0; - hugeObjectAllocSizeSinceGC_ = heap_->GetHugeObjectSpace()->GetHeapObjectSize(); + huge_object_alloc_size_since_gc_ = heap_->GetHugeObjectSpace()->GetHeapObjectSize(); - double duration = gcEndTime_ - gcStartTime_; + double duration = gc_end_time_ - gc_start_time_; switch (gcType) { case TriggerGCType::SEMI_GC: @@ -132,7 +136,7 @@ void MemController::StopCalculationAfterGC(TriggerGCType gcType) case TriggerGCType::OLD_GC: case TriggerGCType::COMPRESS_FULL_GC: { size_t heapObjectSize = heap_->GetHeapObjectSize(); - recordedMarkCompacts_.Push(MakeBytesAndDuration(heapObjectSize, duration)); + recorded_mark_compacts_.Push(MakeBytesAndDuration(heapObjectSize, duration)); break; } default: @@ -145,20 +149,20 @@ void MemController::RecordAfterConcurrentMark(const bool isSemi, const Concurren { double duration = marker->GetDuration(); if (isSemi) { - recordedSemiConcurrentMarks_.Push(MakeBytesAndDuration(marker->GetHeapObjectSize(), duration)); + recorded_semi_concurrent_marks_.Push(MakeBytesAndDuration(marker->GetHeapObjectSize(), duration)); } else { - recordedConcurrentMarks_.Push(MakeBytesAndDuration(marker->GetHeapObjectSize(), duration)); + recorded_concurrent_marks_.Push(MakeBytesAndDuration(marker->GetHeapObjectSize(), duration)); } } double MemController::CalculateMarkCompactSpeedPerMS() { - if (markCompactSpeedCache_ > 0) { - return markCompactSpeedCache_; + if (mark_compact_speed_cache_ > 0) { + return mark_compact_speed_cache_; } - markCompactSpeedCache_ = CalculateAverageSpeed(recordedMarkCompacts_); - if (markCompactSpeedCache_ > 0) { - return markCompactSpeedCache_; + mark_compact_speed_cache_ = CalculateAverageSpeed(recorded_mark_compacts_); + if (mark_compact_speed_cache_ > 0) { + return mark_compact_speed_cache_; } return 0; } @@ -198,29 +202,30 @@ double MemController::CalculateAverageSpeed(const base::GCRingBuffer recordedMarkCompacts_; - base::GCRingBuffer recordedNewSpaceAllocations_; - base::GCRingBuffer recordedOldSpaceAllocations_; - base::GCRingBuffer recordedNonmovableSpaceAllocations_; - base::GCRingBuffer recordedCodeSpaceAllocations_; - - base::GCRingBuffer recordedConcurrentMarks_; - base::GCRingBuffer recordedSemiConcurrentMarks_; - bool isDelayGCMode_ {false}; + double alloc_duration_since_gc_ {0.0}; + size_t new_space_alloc_size_since_gc_ {0}; + size_t old_space_alloc_size_since_gc_ {0}; + size_t non_movable_space_alloc_size_since_gc_ {0}; + size_t code_space_alloc_size_since_gc_ {0}; + size_t huge_object_alloc_size_since_gc_ {0}; + + int start_counter_ {0}; + double mark_compact_speed_cache_ {0.0}; + + base::GCRingBuffer recorded_mark_compacts_; + base::GCRingBuffer recorded_new_space_allocations_; + base::GCRingBuffer recorded_old_space_allocations_; + base::GCRingBuffer recorded_nonmovable_space_allocations_; + base::GCRingBuffer recorded_code_space_allocations_; + + base::GCRingBuffer recorded_concurrent_marks_; + base::GCRingBuffer recorded_semi_concurrent_marks_; + bool is_delay_gc_mode_ {false}; static constexpr double THROUGHPUT_TIME_FRAME_MS = 5000; static constexpr int MILLISECOND_PER_SECOND = 1000; diff --git a/runtime/mem/mem_manager-inl.h b/runtime/mem/mem_manager-inl.h index 90912ec9838a80bc30f072c3c1a2fe9e444b2b04..29b34c0717bfc32ed807631f537545228d6b0049 100644 --- a/runtime/mem/mem_manager-inl.h +++ b/runtime/mem/mem_manager-inl.h @@ -34,7 +34,7 @@ TaggedObject *MemManager::AllocateYoungGenerationOrHugeObject(JSHClass *hclass) TaggedObject *MemManager::AllocateYoungGenerationOrHugeObject(JSHClass *hclass, size_t size) { - auto object = heapManager_->AllocateObject(hclass->GetHClass(), size, DEFAULT_ALIGNMENT, thread_); + auto object = heap_manager_->AllocateObject(hclass->GetHClass(), size, DEFAULT_ALIGNMENT, thread_); // OnAllocateEvent checks object for nullptr // SUPPRESS_CSA_NEXTLINE(alpha.core.CheckObjHeaderTypeRef) heap_->OnAllocateEvent(reinterpret_cast(object)); @@ -54,9 +54,9 @@ TaggedObject *MemManager::AllocateNonMovableOrHugeObject(JSHClass *hclass, size_ { ObjectHeader *object = nullptr; if (hclass == nullptr) { - object = heapManager_->AllocateNonMovableObject(nullptr, size, DEFAULT_ALIGNMENT, thread_); + object = heap_manager_->AllocateNonMovableObject(nullptr, size, DEFAULT_ALIGNMENT, thread_); } else { - object = heapManager_->AllocateNonMovableObject(hclass->GetHClass(), size, DEFAULT_ALIGNMENT, thread_); + object = heap_manager_->AllocateNonMovableObject(hclass->GetHClass(), size, DEFAULT_ALIGNMENT, thread_); } // OnAllocateEvent checks object for nullptr // SUPPRESS_CSA_NEXTLINE(alpha.core.CheckObjHeaderTypeRef) @@ -70,13 +70,13 @@ TaggedObject *MemManager::AllocateNonMovableOrHugeObject(JSHClass *hclass, size_ uintptr_t MemManager::AllocateSnapShotSpace(size_t size) { - uintptr_t object = snapshotSpaceAllocator_.Allocate(size); + uintptr_t object = snapshot_space_allocator_.Allocate(size); if (UNLIKELY(object == 0)) { - if (!heap_->FillSnapShotSpace(&snapshotSpaceAllocator_)) { + if (!heap_->FillSnapShotSpace(&snapshot_space_allocator_)) { LOG_ECMA_MEM(FATAL) << "alloc failed"; UNREACHABLE(); } - object = snapshotSpaceAllocator_.Allocate(size); + object = snapshot_space_allocator_.Allocate(size); if (UNLIKELY(object == 0)) { LOG_ECMA_MEM(FATAL) << "alloc failed"; UNREACHABLE(); @@ -98,7 +98,7 @@ TaggedObject *MemManager::AllocateNonMovableOrHugeObject(JSHClass *hclass) TaggedObject *MemManager::AllocateOldGenerationOrHugeObject(JSHClass *hclass, size_t size) { - auto object = heapManager_->AllocateObject(hclass->GetHClass(), size, DEFAULT_ALIGNMENT, thread_); + auto object = heap_manager_->AllocateObject(hclass->GetHClass(), size, DEFAULT_ALIGNMENT, thread_); // OnAllocateEvent checks object for nullptr // SUPPRESS_CSA_NEXTLINE(alpha.core.CheckObjHeaderTypeRef) heap_->OnAllocateEvent(reinterpret_cast(object)); @@ -111,7 +111,7 @@ TaggedObject *MemManager::AllocateOldGenerationOrHugeObject(JSHClass *hclass, si TaggedObject *MemManager::AllocateHugeObject(JSHClass *hclass, size_t size) { - auto object = heapManager_->AllocateObject(hclass->GetHClass(), size, DEFAULT_ALIGNMENT, thread_); + auto object = heap_manager_->AllocateObject(hclass->GetHClass(), size, DEFAULT_ALIGNMENT, thread_); // OnAllocateEvent checks object for nullptr // SUPPRESS_CSA_NEXTLINE(alpha.core.CheckObjHeaderTypeRef) heap_->OnAllocateEvent(reinterpret_cast(object)); diff --git a/runtime/mem/mem_manager.cpp b/runtime/mem/mem_manager.cpp index 15614ed376dd089285bb363ba0bbbb0c45fd7b25..16ae9262f68b8573a4b2fc166dd8869f355c61fa 100644 --- a/runtime/mem/mem_manager.cpp +++ b/runtime/mem/mem_manager.cpp @@ -19,13 +19,13 @@ namespace panda::ecmascript { MemManager::MemManager(Heap *heap) : heap_(heap), - newSpaceAllocator_(heap->GetNewSpace()), - freeListAllocator_ {FreeListAllocator(heap->GetOldSpace()), FreeListAllocator(heap_->GetNonMovableSpace()), - FreeListAllocator(heap->GetMachineCodeSpace())} + new_space_allocator_(heap->GetNewSpace()), + free_list_allocator_ {FreeListAllocator(heap->GetOldSpace()), FreeListAllocator(heap_->GetNonMovableSpace()), + FreeListAllocator(heap->GetMachineCodeSpace())} { ASSERT(heap != nullptr); heap->SetHeapManager(this); - heapManager_ = heap->GetEcmaVM()->GetHeapManager(); + heap_manager_ = heap->GetEcmaVM()->GetHeapManager(); thread_ = heap->GetEcmaVM()->GetAssociatedJSThread(); } } // namespace panda::ecmascript diff --git a/runtime/mem/mem_manager.h b/runtime/mem/mem_manager.h index bfa1bfc929471fd02cf801743f5b2d8754160394..2a7562796b01124c69a2206cba4b43125cddb654 100644 --- a/runtime/mem/mem_manager.h +++ b/runtime/mem/mem_manager.h @@ -49,41 +49,41 @@ public: FreeListAllocator &GetFreeListAllocator(MemSpaceType type) { - return freeListAllocator_[type]; + return free_list_allocator_[type]; } inline FreeListAllocator &GetOldSpaceAllocator() { - return freeListAllocator_[OLD_SPACE]; + return free_list_allocator_[OLD_SPACE]; } BumpPointerAllocator &GetNewSpaceAllocator() { - return newSpaceAllocator_; + return new_space_allocator_; } inline FreeListAllocator &GetNonMovableSpaceAllocator() { - return freeListAllocator_[NON_MOVABLE]; + return free_list_allocator_[NON_MOVABLE]; } const BumpPointerAllocator &GetSnapShotSpaceAllocator() const { - return snapshotSpaceAllocator_; + return snapshot_space_allocator_; } inline FreeListAllocator &GetMachineCodeSpaceAllocator() { - return freeListAllocator_[MACHINE_CODE_SPACE]; + return free_list_allocator_[MACHINE_CODE_SPACE]; } private: Heap *heap_ {nullptr}; - mem::HeapManager *heapManager_; + mem::HeapManager *heap_manager_; ManagedThread *thread_; - BumpPointerAllocator newSpaceAllocator_; - std::array freeListAllocator_; - BumpPointerAllocator snapshotSpaceAllocator_; + BumpPointerAllocator new_space_allocator_; + std::array free_list_allocator_; + BumpPointerAllocator snapshot_space_allocator_; }; } // namespace panda::ecmascript diff --git a/runtime/mem/mix_space_collector.cpp b/runtime/mem/mix_space_collector.cpp index e16095a7efcfd132d8f941d90cd6f695492ea271..860ba0d85c198ba447b6b9ec12776993583c5c91 100644 --- a/runtime/mem/mix_space_collector.cpp +++ b/runtime/mem/mix_space_collector.cpp @@ -31,7 +31,7 @@ #include "plugins/ecmascript/runtime/vmstat/runtime_stat.h" namespace panda::ecmascript { -MixSpaceCollector::MixSpaceCollector(Heap *heap) : heap_(heap), workList_(heap->GetWorkList()) {} +MixSpaceCollector::MixSpaceCollector(Heap *heap) : heap_(heap), work_list_(heap->GetWorkList()) {} void MixSpaceCollector::RunPhases() { @@ -40,23 +40,23 @@ void MixSpaceCollector::RunPhases() ClockScope clockScope; ECMA_BYTRACE_NAME(BYTRACE_TAG_ARK, "MixSpaceCollector::RunPhases"); - concurrentMark_ = heap_->CheckConcurrentMark(thread); - ECMA_GC_LOG() << "concurrentMark_" << concurrentMark_; + concurrent_mark_ = heap_->CheckConcurrentMark(thread); + ECMA_GC_LOG() << "concurrentMark_" << concurrent_mark_; InitializePhase(); MarkingPhase(); EvacuaPhases(); SweepPhases(); heap_->GetEvacuation()->Finalize(); FinishPhase(); - heap_->GetEcmaVM()->GetEcmaGCStats()->StatisticOldCollector(clockScope.GetPauseTime(), freeSize_, - oldSpaceCommitSize_, nonMoveSpaceCommitSize_); + heap_->GetEcmaVM()->GetEcmaGCStats()->StatisticOldCollector(clockScope.GetPauseTime(), free_size_, + old_space_commit_size_, non_move_space_commit_size_); ECMA_GC_LOG() << "MixSpaceCollector::RunPhases " << clockScope.TotalSpentTime(); } void MixSpaceCollector::InitializePhase() { ECMA_BYTRACE_NAME(BYTRACE_TAG_ARK, "MixSpaceCollector::InitializePhase"); - if (!concurrentMark_) { + if (!concurrent_mark_) { heap_->Prepare(); if (!heap_->IsSemiMarkNeeded() && heap_->GetSweeper()->CanSelectCset()) { const_cast(heap_->GetOldSpace())->SelectCSet(); @@ -80,24 +80,24 @@ void MixSpaceCollector::InitializePhase() } else { heap_->EnumerateRegions([](Region *current) { current->ResetAliveObject(); }); } - workList_->Initialize(TriggerGCType::OLD_GC, ParallelGCTaskPhase::OLD_HANDLE_GLOBAL_POOL_TASK); + work_list_->Initialize(TriggerGCType::OLD_GC, ParallelGCTaskPhase::OLD_HANDLE_GLOBAL_POOL_TASK); - freeSize_ = 0; - hugeSpaceFreeSize_ = 0; - oldSpaceCommitSize_ = heap_->GetOldSpace()->GetCommittedSize(); - nonMoveSpaceCommitSize_ = heap_->GetNonMovableSpace()->GetCommittedSize(); + free_size_ = 0; + huge_space_free_size_ = 0; + old_space_commit_size_ = heap_->GetOldSpace()->GetCommittedSize(); + non_move_space_commit_size_ = heap_->GetNonMovableSpace()->GetCommittedSize(); } } void MixSpaceCollector::FinishPhase() { ECMA_BYTRACE_NAME(BYTRACE_TAG_ARK, "MixSpaceCollector::FinishPhase"); - if (concurrentMark_) { + if (concurrent_mark_) { auto marker = heap_->GetConcurrentMarker(); marker->Reset(false); } else { size_t aliveSize = 0; - workList_->Finish(aliveSize); + work_list_->Finish(aliveSize); heap_->EnumerateRegions([](Region *current) { current->ClearFlag(RegionFlags::IS_IN_PROMOTE_SET); }); } } @@ -105,7 +105,7 @@ void MixSpaceCollector::FinishPhase() void MixSpaceCollector::MarkingPhase() { ECMA_BYTRACE_NAME(BYTRACE_TAG_ARK, "MixSpaceCollector::MarkingPhase"); - if (concurrentMark_) { + if (concurrent_mark_) { [[maybe_unused]] ClockScope scope; heap_->GetConcurrentMarker()->ReMarking(); return; diff --git a/runtime/mem/mix_space_collector.h b/runtime/mem/mix_space_collector.h index 59031fec9cc6fe8b9d09ce562f38fbb4f57fee67..a8bed1448f1be021f1b7a38a44c07bc3b222d5fc 100644 --- a/runtime/mem/mix_space_collector.h +++ b/runtime/mem/mix_space_collector.h @@ -52,13 +52,13 @@ private: void FinishPhase(); Heap *heap_; - size_t freeSize_ {0}; - size_t hugeSpaceFreeSize_ = 0; - size_t oldSpaceCommitSize_ = 0; - size_t nonMoveSpaceCommitSize_ = 0; - bool concurrentMark_ {false}; + size_t free_size_ {0}; + size_t huge_space_free_size_ = 0; + size_t old_space_commit_size_ = 0; + size_t non_move_space_commit_size_ = 0; + bool concurrent_mark_ {false}; // obtain from heap - WorkerHelper *workList_ {nullptr}; + WorkerHelper *work_list_ {nullptr}; friend class WorkerHelper; friend class Heap; diff --git a/runtime/mem/object_xray-inl.h b/runtime/mem/object_xray-inl.h index 004be244acbf8884a6d4fa7a28b526bdfa9a8d50..ba12971e94b1431d75d4af4a1c59a6919b15cab0 100644 --- a/runtime/mem/object_xray-inl.h +++ b/runtime/mem/object_xray-inl.h @@ -66,8 +66,8 @@ namespace panda::ecmascript { void ObjectXRay::VisitVMRoots(const RootVisitor &visitor, const RootRangeVisitor &range_visitor) const { - ecmaVm_->Iterate(visitor); - ecmaVm_->GetJSThread()->Iterate(visitor, range_visitor); + ecma_vm_->Iterate(visitor); + ecma_vm_->GetJSThread()->Iterate(visitor, range_visitor); } template diff --git a/runtime/mem/object_xray.h b/runtime/mem/object_xray.h index 9fe7bc375c3196a220042f97f09a98d50e992209..e4da2a6fcf1746fa61bf045a4f0c0374576cb87f 100644 --- a/runtime/mem/object_xray.h +++ b/runtime/mem/object_xray.h @@ -44,7 +44,7 @@ using WeakRootVisitor = std::function; class ObjectXRay { public: - explicit ObjectXRay(EcmaVM *ecmaVm) : ecmaVm_(ecmaVm) {} + explicit ObjectXRay(EcmaVM *ecmaVm) : ecma_vm_(ecmaVm) {} ~ObjectXRay() = default; inline void VisitVMRoots(const RootVisitor &visitor, const RootRangeVisitor &range_visitor) const; @@ -55,7 +55,7 @@ public: DEFAULT_COPY_SEMANTIC(ObjectXRay); private: - EcmaVM *ecmaVm_ {nullptr}; + EcmaVM *ecma_vm_ {nullptr}; }; } // namespace panda::ecmascript diff --git a/runtime/mem/parallel_evacuation-inl.h b/runtime/mem/parallel_evacuation-inl.h index 5219e799fd1f4ec8efd07de4348cae7852c77aac..3268b4ebef3c0affaa6cd0709173cd70eeff1faf 100644 --- a/runtime/mem/parallel_evacuation-inl.h +++ b/runtime/mem/parallel_evacuation-inl.h @@ -93,19 +93,19 @@ void ParallelEvacuation::AddFragment(std::unique_ptr region) void ParallelEvacuation::AddSweptRegionSafe(Region *region) { os::memory::LockHolder holder(mutex_); - sweptList_.emplace_back(region); + swept_list_.emplace_back(region); } void ParallelEvacuation::FillSweptRegion() { - while (!sweptList_.empty()) { - Region *region = sweptList_.back(); - sweptList_.pop_back(); + while (!swept_list_.empty()) { + Region *region = swept_list_.back(); + swept_list_.pop_back(); region->EnumerateKinds([this](FreeObjectKind *kind) { if (kind == nullptr || kind->Empty()) { return; } - evacuationAllocator_->FillFreeList(kind); + evacuation_allocator_->FillFreeList(kind); }); } } diff --git a/runtime/mem/parallel_evacuation.cpp b/runtime/mem/parallel_evacuation.cpp index 81e1da51990c758dab1265576ff13379cac6d553..488730fcee74f3a2850ae936fd415ed37e0b132a 100644 --- a/runtime/mem/parallel_evacuation.cpp +++ b/runtime/mem/parallel_evacuation.cpp @@ -28,15 +28,15 @@ namespace panda::ecmascript { void ParallelEvacuation::Initialize() { - evacuationAllocator_->Initialize(TriggerGCType::OLD_GC); + evacuation_allocator_->Initialize(TriggerGCType::OLD_GC); allocator_ = new TlabAllocator(heap_, TriggerGCType::COMPRESS_FULL_GC); - ageMark_ = heap_->GetFromSpace()->GetAgeMark(); + age_mark_ = heap_->GetFromSpace()->GetAgeMark(); } void ParallelEvacuation::Finalize() { delete allocator_; - evacuationAllocator_->Finalize(TriggerGCType::OLD_GC); + evacuation_allocator_->Finalize(TriggerGCType::OLD_GC); } void ParallelEvacuation::Evacuate() @@ -91,16 +91,16 @@ void ParallelEvacuation::EvacuateRegion(TlabAllocator *allocator, Region *region bool ret = false; if (isPromoted) { if (region->InYoungGeneration()) { - promotedAccumulatorSize_.fetch_add(region->AliveObject()); + promoted_accumulator_size_.fetch_add(region->AliveObject()); } - ret = evacuationAllocator_->AddRegionToOld(region); + ret = evacuation_allocator_->AddRegionToOld(region); } else { - ret = evacuationAllocator_->AddRegionToYoung(region); + ret = evacuation_allocator_->AddRegionToYoung(region); if (!ret) { if (region->InYoungGeneration()) { - promotedAccumulatorSize_.fetch_add(region->AliveObject()); + promoted_accumulator_size_.fetch_add(region->AliveObject()); } - ret = evacuationAllocator_->AddRegionToOld(region); + ret = evacuation_allocator_->AddRegionToOld(region); } } if (!ret) { @@ -116,14 +116,14 @@ void ParallelEvacuation::EvacuateRegion(TlabAllocator *allocator, Region *region auto size = klass->SizeFromJSHClass(header); uintptr_t address = 0; - if (isPromoted || (region->HasAgeMark() && ToUintPtr(mem) < ageMark_)) { + if (isPromoted || (region->HasAgeMark() && ToUintPtr(mem) < age_mark_)) { address = allocator->Allocate(size, SpaceAlloc::OLD_SPACE); - promotedAccumulatorSize_.fetch_add(size); + promoted_accumulator_size_.fetch_add(size); } else { address = allocator->Allocate(size, SpaceAlloc::YOUNG_SPACE); if (address == 0) { address = allocator->Allocate(size, SpaceAlloc::OLD_SPACE); - promotedAccumulatorSize_.fetch_add(size); + promoted_accumulator_size_.fetch_add(size); } } LOG_IF(address == 0, FATAL, RUNTIME) << "Evacuate object failed:" << size; @@ -145,7 +145,7 @@ void ParallelEvacuation::EvacuateRegion(TlabAllocator *allocator, Region *region void ParallelEvacuation::VerifyHeapObject(TaggedObject *object) { auto klass = object->GetClass(); - objXRay_.VisitObjectBody( + obj_x_ray_.VisitObjectBody( object, klass, [&]([[maybe_unused]] TaggedObject *root, ObjectSlot start, ObjectSlot end) { for (ObjectSlot slot = start; slot < end; slot++) { JSTaggedValue value(slot.GetTaggedType()); @@ -228,7 +228,7 @@ void ParallelEvacuation::UpdateRoot() } }; - objXRay_.VisitVMRoots(gcUpdateYoung, gcUpdateRangeYoung); + obj_x_ray_.VisitVMRoots(gcUpdateYoung, gcUpdateRangeYoung); } void ParallelEvacuation::UpdateWeakReference() @@ -319,7 +319,7 @@ void ParallelEvacuation::UpdateNewRegionReference(Region *region) auto curPtr = region->GetBegin(); uintptr_t endPtr; if (region == current) { - auto top = evacuationAllocator_->GetNewSpaceTop(); + auto top = evacuation_allocator_->GetNewSpaceTop(); endPtr = curPtr + region->GetAllocatedBytes(top); } else { endPtr = curPtr + region->GetAllocatedBytes(); @@ -395,7 +395,7 @@ void ParallelEvacuation::UpdateAndSweepCompressRegionReference(Region *region, b uintptr_t freeEnd = ToUintPtr(mem); if (freeStart != freeEnd) { - evacuationAllocator_->Free(freeStart, freeEnd, isMain); + evacuation_allocator_->Free(freeStart, freeEnd, isMain); } freeStart = freeEnd + klass->SizeFromJSHClass(header); }); @@ -403,7 +403,7 @@ void ParallelEvacuation::UpdateAndSweepCompressRegionReference(Region *region, b uintptr_t freeEnd = region->GetEnd(); CHECK_REGION_END(freeStart, freeEnd); if (freeStart < freeEnd) { - evacuationAllocator_->Free(freeStart, freeEnd, isMain); + evacuation_allocator_->Free(freeStart, freeEnd, isMain); } if (!isMain) { AddSweptRegionSafe(region); @@ -412,7 +412,7 @@ void ParallelEvacuation::UpdateAndSweepCompressRegionReference(Region *region, b void ParallelEvacuation::UpdateNewObjectField(TaggedObject *object, JSHClass *cls) { - objXRay_.VisitObjectBody( + obj_x_ray_.VisitObjectBody( object, cls, [this]([[maybe_unused]] TaggedObject *root, ObjectSlot start, ObjectSlot end) { for (ObjectSlot slot = start; slot < end; slot++) { UpdateObjectSlot(slot); @@ -422,7 +422,7 @@ void ParallelEvacuation::UpdateNewObjectField(TaggedObject *object, JSHClass *cl void ParallelEvacuation::UpdateCompressObjectField(Region *region, TaggedObject *object, JSHClass *cls) { - objXRay_.VisitObjectBody( + obj_x_ray_.VisitObjectBody( object, cls, [this, region]([[maybe_unused]] TaggedObject *root, ObjectSlot start, ObjectSlot end) { for (ObjectSlot slot = start; slot < end; slot++) { if (UpdateObjectSlot(slot)) { diff --git a/runtime/mem/parallel_evacuation.h b/runtime/mem/parallel_evacuation.h index 7ac8170d409a017c9910a44365a1675ca333e406..e17f8a0379d4cc27de37139eb3405004e7c71dcf 100644 --- a/runtime/mem/parallel_evacuation.h +++ b/runtime/mem/parallel_evacuation.h @@ -35,7 +35,7 @@ class TlabAllocator; class ParallelEvacuation { public: explicit ParallelEvacuation(Heap *heap) - : heap_(heap), objXRay_(heap->GetEcmaVM()), evacuationAllocator_(heap_->GetEvacuationAllocator()) + : heap_(heap), obj_x_ray_(heap->GetEcmaVM()), evacuation_allocator_(heap_->GetEvacuationAllocator()) { } ~ParallelEvacuation() = default; @@ -45,7 +45,7 @@ public: size_t GetPromotedAccumulatorSize() const { - return promotedAccumulatorSize_; + return promoted_accumulator_size_; } NO_COPY_SEMANTIC(ParallelEvacuation); @@ -181,14 +181,14 @@ private: Heap *heap_; TlabAllocator *allocator_ {nullptr}; - ObjectXRay objXRay_; - EvacuationAllocator *evacuationAllocator_; + ObjectXRay obj_x_ray_; + EvacuationAllocator *evacuation_allocator_; - uintptr_t ageMark_ {0}; + uintptr_t age_mark_ {0}; std::vector> fragments_; - std::vector sweptList_; + std::vector swept_list_; std::atomic_int parallel_ = 0; - std::atomic promotedAccumulatorSize_ = 0; + std::atomic promoted_accumulator_size_ = 0; os::memory::Mutex mutex_; os::memory::ConditionVariable condition_; }; diff --git a/runtime/mem/parallel_marker-inl.h b/runtime/mem/parallel_marker-inl.h index 8ce6b1e4f66b623cf8c8f7bc0645fb9e52c1e998..7501777eb5d13b33df49fd544a317d44e0827340 100644 --- a/runtime/mem/parallel_marker-inl.h +++ b/runtime/mem/parallel_marker-inl.h @@ -271,7 +271,7 @@ inline SlotStatus SemiGcMarker::EvacuateObject(uint32_t threadId, TaggedObject * inline bool SemiGcMarker::ShouldBePromoted(TaggedObject *object) { Region *region = Region::ObjectAddressToRange(object); - return (region->BelowAgeMark() || (region->HasAgeMark() && ToUintPtr(object) < ageMark_)); + return (region->BelowAgeMark() || (region->HasAgeMark() && ToUintPtr(object) < age_mark_)); } inline void SemiGcMarker::RecordWeakReference(uint32_t threadId, JSTaggedType *ref) diff --git a/runtime/mem/parallel_marker.cpp b/runtime/mem/parallel_marker.cpp index 928ed0a9bcd261099d152a0a8782fcdfee2d8bb4..43d8097641b34a5f362876a0229d2da8accffcb3 100644 --- a/runtime/mem/parallel_marker.cpp +++ b/runtime/mem/parallel_marker.cpp @@ -20,13 +20,14 @@ #ifndef __clang_analyzer__ namespace panda::ecmascript { -Marker::Marker(Heap *heap) : heap_(heap), objXRay_(heap_->GetEcmaVM()) {} +Marker::Marker(Heap *heap) : heap_(heap), obj_x_ray_(heap_->GetEcmaVM()) {} void Marker::MarkRoots(uint32_t threadId) { - objXRay_.VisitVMRoots(std::bind(&Marker::HandleRoots, this, threadId, std::placeholders::_1, std::placeholders::_2), - std::bind(&Marker::HandleRangeRoots, this, threadId, std::placeholders::_1, - std::placeholders::_2, std::placeholders::_3)); + obj_x_ray_.VisitVMRoots( + std::bind(&Marker::HandleRoots, this, threadId, std::placeholders::_1, std::placeholders::_2), + std::bind(&Marker::HandleRangeRoots, this, threadId, std::placeholders::_1, std::placeholders::_2, + std::placeholders::_3)); heap_->GetWorkList()->PushWorkNodeToGlobal(threadId, false); } @@ -65,16 +66,16 @@ void NonMovableMarker::ProcessMarkStack(uint32_t threadId) Region *objectRegion = Region::ObjectAddressToRange(obj); bool needBarrier = !isOnlySemi && !objectRegion->InYoungAndCSetGeneration(); - objXRay_.VisitObjectBody(obj, jsHclass, - std::bind(&Marker::HandleObjectVisitor, this, threadId, objectRegion, - needBarrier, std::placeholders::_1, std::placeholders::_2, - std::placeholders::_3)); + obj_x_ray_.VisitObjectBody(obj, jsHclass, + std::bind(&Marker::HandleObjectVisitor, this, threadId, objectRegion, + needBarrier, std::placeholders::_1, std::placeholders::_2, + std::placeholders::_3)); } } void SemiGcMarker::Initialized() { - ageMark_ = heap_->GetNewSpace()->GetAgeMark(); + age_mark_ = heap_->GetNewSpace()->GetAgeMark(); } void SemiGcMarker::ProcessMarkStack(uint32_t threadId) @@ -90,10 +91,10 @@ void SemiGcMarker::ProcessMarkStack(uint32_t threadId) auto jsHclass = obj->GetClass(); Region *objectRegion = Region::ObjectAddressToRange(obj); bool promoted = !objectRegion->InYoungGeneration(); - objXRay_.VisitObjectBody(obj, jsHclass, - std::bind(&Marker::HandleMoveObjectVisitor, this, threadId, promoted, - std::placeholders::_1, std::placeholders::_2, - std::placeholders::_3)); + obj_x_ray_.VisitObjectBody(obj, jsHclass, + std::bind(&Marker::HandleMoveObjectVisitor, this, threadId, + promoted, std::placeholders::_1, std::placeholders::_2, + std::placeholders::_3)); } } @@ -111,10 +112,10 @@ void CompressGcMarker::ProcessMarkStack(uint32_t threadId) ObjectSlot objectSlot(ToUintPtr(obj)); MarkObject(threadId, jsHclass, objectSlot); - objXRay_.VisitObjectBody(obj, jsHclass, - std::bind(&Marker::HandleMoveObjectVisitor, this, threadId, false, - std::placeholders::_1, std::placeholders::_2, - std::placeholders::_3)); + obj_x_ray_.VisitObjectBody(obj, jsHclass, + std::bind(&Marker::HandleMoveObjectVisitor, this, threadId, false, + std::placeholders::_1, std::placeholders::_2, + std::placeholders::_3)); } } } // namespace panda::ecmascript diff --git a/runtime/mem/parallel_marker.h b/runtime/mem/parallel_marker.h index f01b9730cb2a2ddc2c89e1f3b2f5b16db9d5452f..919e6b7377c6d8e59460531f034ff0c387ae1fc4 100644 --- a/runtime/mem/parallel_marker.h +++ b/runtime/mem/parallel_marker.h @@ -77,8 +77,8 @@ protected: LOG(FATAL, ECMASCRIPT) << "can not call this method"; } - Heap *heap_; // NOLINT(misc-non-private-member-variables-in-classes) - ObjectXRay objXRay_; // NOLINT(misc-non-private-member-variables-in-classes) + Heap *heap_; // NOLINT(misc-non-private-member-variables-in-classes) + ObjectXRay obj_x_ray_; // NOLINT(misc-non-private-member-variables-in-classes) }; class NonMovableMarker : public Marker { @@ -131,7 +131,7 @@ protected: private: inline bool ShouldBePromoted(TaggedObject *object); - uintptr_t ageMark_ {0}; + uintptr_t age_mark_ {0}; }; class CompressGcMarker : public MovableMarker { diff --git a/runtime/mem/parallel_work_helper.cpp b/runtime/mem/parallel_work_helper.cpp index 7628f581c82f7ea970f056cb377a7d84bb2ccddc..d75917b67fe348f917a92d0a54c93e6c7665ab4b 100644 --- a/runtime/mem/parallel_work_helper.cpp +++ b/runtime/mem/parallel_work_helper.cpp @@ -27,27 +27,27 @@ namespace panda::ecmascript { WorkerHelper::WorkerHelper(Heap *heap, uint32_t threadNum) - : heap_(heap), threadNum_(threadNum), markSpace_(0), spaceTop_(0), markSpaceEnd_(0) + : heap_(heap), thread_num_(threadNum), mark_space_(0), space_top_(0), mark_space_end_(0) { - for (uint32_t i = 0; i < threadNum_; i++) { - continuousQueue_[i] = new ProcessQueue(heap); + for (uint32_t i = 0; i < thread_num_; i++) { + continuous_queue_[i] = new ProcessQueue(heap); } - markSpace_ = ToUintPtr(const_cast(heap_->GetRegionFactory())->AllocateBuffer(SPACE_SIZE)); + mark_space_ = ToUintPtr(const_cast(heap_->GetRegionFactory())->AllocateBuffer(SPACE_SIZE)); } WorkerHelper::~WorkerHelper() { - for (uint32_t i = 0; i < threadNum_; i++) { - continuousQueue_[i]->Destroy(); - delete continuousQueue_[i]; - continuousQueue_[i] = nullptr; + for (uint32_t i = 0; i < thread_num_; i++) { + continuous_queue_[i]->Destroy(); + delete continuous_queue_[i]; + continuous_queue_[i] = nullptr; } - const_cast(heap_->GetRegionFactory())->FreeBuffer(reinterpret_cast(markSpace_)); + const_cast(heap_->GetRegionFactory())->FreeBuffer(reinterpret_cast(mark_space_)); } bool WorkerHelper::Push(uint32_t threadId, TaggedObject *object) { - WorkNode *&pushNode = workList_[threadId].pushNode_; + WorkNode *&pushNode = work_list_[threadId].push_node_; if (!pushNode->Push(ToUintPtr(object))) { PushWorkNodeToGlobal(threadId); return pushNode->Push(ToUintPtr(object)); @@ -68,20 +68,20 @@ bool WorkerHelper::Push(uint32_t threadId, TaggedObject *object, Region *region) void WorkerHelper::PushWorkNodeToGlobal(uint32_t threadId, bool postTask) { - WorkNode *&pushNode = workList_[threadId].pushNode_; + WorkNode *&pushNode = work_list_[threadId].push_node_; if (!pushNode->IsEmpty()) { - globalWork_.Push(pushNode); + global_work_.Push(pushNode); pushNode = AllocalWorkNode(); if (postTask && heap_->IsParallelGCEnabled() && heap_->CheckCanDistributeTask()) { - heap_->PostParallelGCTask(parallelTask_); + heap_->PostParallelGCTask(parallel_task_); } } } bool WorkerHelper::Pop(uint32_t threadId, TaggedObject **object) { - WorkNode *&popNode = workList_[threadId].popNode_; - WorkNode *&pushNode = workList_[threadId].pushNode_; + WorkNode *&popNode = work_list_[threadId].pop_node_; + WorkNode *&pushNode = work_list_[threadId].push_node_; if (!popNode->Pop(reinterpret_cast(object))) { if (!pushNode->IsEmpty()) { WorkNode *tmp = popNode; @@ -97,51 +97,51 @@ bool WorkerHelper::Pop(uint32_t threadId, TaggedObject **object) bool WorkerHelper::PopWorkNodeFromGlobal(uint32_t threadId) { - return globalWork_.Pop(&workList_[threadId].popNode_); + return global_work_.Pop(&work_list_[threadId].pop_node_); } void WorkerHelper::Finish(size_t &aliveSize) { - for (uint32_t i = 0; i < threadNum_; i++) { - WorkNodeHolder &holder = workList_[i]; - holder.weakQueue_->FinishMarking(continuousQueue_[i]); - delete holder.weakQueue_; - holder.weakQueue_ = nullptr; + for (uint32_t i = 0; i < thread_num_; i++) { + WorkNodeHolder &holder = work_list_[i]; + holder.weak_queue_->FinishMarking(continuous_queue_[i]); + delete holder.weak_queue_; + holder.weak_queue_ = nullptr; delete holder.allocator_; holder.allocator_ = nullptr; - holder.waitUpdate_.clear(); - aliveSize += holder.aliveSize_; + holder.wait_update_.clear(); + aliveSize += holder.alive_size_; } - while (!unuseSpace_.empty()) { + while (!unuse_space_.empty()) { const_cast(heap_->GetRegionFactory()) - ->FreeBuffer(reinterpret_cast(unuseSpace_.back())); - unuseSpace_.pop_back(); + ->FreeBuffer(reinterpret_cast(unuse_space_.back())); + unuse_space_.pop_back(); } } void WorkerHelper::Finish(size_t &aliveSize, size_t &promoteSize) { Finish(aliveSize); - for (uint32_t i = 0; i < threadNum_; i++) { - WorkNodeHolder &holder = workList_[i]; - promoteSize += holder.aliveSize_; + for (uint32_t i = 0; i < thread_num_; i++) { + WorkNodeHolder &holder = work_list_[i]; + promoteSize += holder.alive_size_; } } void WorkerHelper::Initialize(TriggerGCType gcType, ParallelGCTaskPhase parallelTask) { - parallelTask_ = parallelTask; - spaceTop_ = markSpace_; - markSpaceEnd_ = markSpace_ + SPACE_SIZE; - for (uint32_t i = 0; i < threadNum_; i++) { - WorkNodeHolder &holder = workList_[i]; - holder.pushNode_ = AllocalWorkNode(); - holder.popNode_ = AllocalWorkNode(); - holder.weakQueue_ = new ProcessQueue(); - holder.weakQueue_->BeginMarking(heap_, continuousQueue_[i]); - holder.aliveSize_ = 0; - holder.promoteSize_ = 0; + parallel_task_ = parallelTask; + space_top_ = mark_space_; + mark_space_end_ = mark_space_ + SPACE_SIZE; + for (uint32_t i = 0; i < thread_num_; i++) { + WorkNodeHolder &holder = work_list_[i]; + holder.push_node_ = AllocalWorkNode(); + holder.pop_node_ = AllocalWorkNode(); + holder.weak_queue_ = new ProcessQueue(); + holder.weak_queue_->BeginMarking(heap_, continuous_queue_[i]); + holder.alive_size_ = 0; + holder.promote_size_ = 0; if (gcType == TriggerGCType::SEMI_GC) { holder.allocator_ = new TlabAllocator(heap_, TriggerGCType::SEMI_GC); } else if (gcType == TriggerGCType::COMPRESS_FULL_GC) { @@ -154,21 +154,21 @@ WorkNode *WorkerHelper::AllocalWorkNode() { size_t totalSize = sizeof(WorkNode) + sizeof(Stack) + STACK_AREA_SIZE; // CAS - volatile auto atomicField = reinterpret_cast *>(&spaceTop_); + volatile auto atomicField = reinterpret_cast *>(&space_top_); bool result = false; uintptr_t begin = 0; do { begin = atomicField->load(std::memory_order_acquire); - if (begin + totalSize >= markSpaceEnd_) { + if (begin + totalSize >= mark_space_end_) { os::memory::LockHolder lock(mtx_); begin = atomicField->load(std::memory_order_acquire); - if (begin + totalSize >= markSpaceEnd_) { - unuseSpace_.emplace_back(markSpace_); - markSpace_ = + if (begin + totalSize >= mark_space_end_) { + unuse_space_.emplace_back(mark_space_); + mark_space_ = ToUintPtr(const_cast(heap_->GetRegionFactory())->AllocateBuffer(SPACE_SIZE)); - spaceTop_ = markSpace_; - markSpaceEnd_ = markSpace_ + SPACE_SIZE; - begin = spaceTop_; + space_top_ = mark_space_; + mark_space_end_ = mark_space_ + SPACE_SIZE; + begin = space_top_; } } result = std::atomic_compare_exchange_strong_explicit(atomicField, &begin, begin + totalSize, diff --git a/runtime/mem/parallel_work_helper.h b/runtime/mem/parallel_work_helper.h index f68542137549b125c2362851b4ca2e807fcfa07e..e8c431fd65596813225ac35a00eb6d40337c5c47 100644 --- a/runtime/mem/parallel_work_helper.h +++ b/runtime/mem/parallel_work_helper.h @@ -129,13 +129,13 @@ private: }; struct WorkNodeHolder { - WorkNode *pushNode_ {nullptr}; - WorkNode *popNode_ {nullptr}; - ProcessQueue *weakQueue_ {nullptr}; - std::vector waitUpdate_; + WorkNode *push_node_ {nullptr}; + WorkNode *pop_node_ {nullptr}; + ProcessQueue *weak_queue_ {nullptr}; + std::vector wait_update_; TlabAllocator *allocator_ {nullptr}; - size_t aliveSize_ = 0; - size_t promoteSize_ = 0; + size_t alive_size_ = 0; + size_t promote_size_ = 0; }; class WorkerHelper final { @@ -157,37 +157,37 @@ public: inline void PushWeakReference(uint32_t threadId, JSTaggedType *weak) { - workList_[threadId].weakQueue_->PushBack(weak); + work_list_[threadId].weak_queue_->PushBack(weak); } inline void AddAliveSize(uint32_t threadId, size_t size) { - workList_[threadId].aliveSize_ += size; + work_list_[threadId].alive_size_ += size; } inline void AddPromoteSize(uint32_t threadId, size_t size) { - workList_[threadId].promoteSize_ += size; + work_list_[threadId].promote_size_ += size; } inline ProcessQueue *GetWeakReferenceQueue(uint32_t threadId) const { - return workList_[threadId].weakQueue_; + return work_list_[threadId].weak_queue_; } inline TlabAllocator *GetTlabAllocator(uint32_t threadId) const { - return workList_[threadId].allocator_; + return work_list_[threadId].allocator_; } inline void PushWaitUpdateSlot(uint32_t threadId, SlotNeedUpdate slot) { - workList_[threadId].waitUpdate_.emplace_back(slot); + work_list_[threadId].wait_update_.emplace_back(slot); } inline bool GetSlotNeedUpdate(uint32_t threadId, SlotNeedUpdate *slot) { - std::vector &waitUpdate = workList_[threadId].waitUpdate_; + std::vector &waitUpdate = work_list_[threadId].wait_update_; if (waitUpdate.empty()) { return false; } @@ -203,16 +203,16 @@ private: WorkNode *AllocalWorkNode(); Heap *heap_; - uint32_t threadNum_; - std::array workList_; - std::array *, MAX_PLATFORM_THREAD_NUM + 1> continuousQueue_ {}; - GlobalWorkList globalWork_; - uintptr_t markSpace_; - uintptr_t spaceTop_; - uintptr_t markSpaceEnd_; - std::vector unuseSpace_; + uint32_t thread_num_; + std::array work_list_; + std::array *, MAX_PLATFORM_THREAD_NUM + 1> continuous_queue_ {}; + GlobalWorkList global_work_; + uintptr_t mark_space_; + uintptr_t space_top_; + uintptr_t mark_space_end_; + std::vector unuse_space_; os::memory::Mutex mtx_; - ParallelGCTaskPhase parallelTask_ {}; + ParallelGCTaskPhase parallel_task_ {}; }; } // namespace panda::ecmascript #endif // ECMASCRIPT_MEM_PARALLEL_WORK_HELPER_H diff --git a/runtime/mem/region-inl.h b/runtime/mem/region-inl.h index cdcbca401af035a4454cfeca96cff444d5edab01..37735778adb34b7ca357a00874144b05565c1bc6 100644 --- a/runtime/mem/region-inl.h +++ b/runtime/mem/region-inl.h @@ -32,13 +32,13 @@ inline void Region::SetSpace(Space *space) inline RangeBitmap *Region::GetOrCreateMarkBitmap() { - if (UNLIKELY(markBitmap_ == nullptr)) { + if (UNLIKELY(mark_bitmap_ == nullptr)) { os::memory::LockHolder lock(lock_); - if (markBitmap_ == nullptr) { - markBitmap_ = CreateMarkBitmap(); + if (mark_bitmap_ == nullptr) { + mark_bitmap_ = CreateMarkBitmap(); } } - return markBitmap_; + return mark_bitmap_; } RangeBitmap *Region::CreateMarkBitmap() @@ -66,24 +66,24 @@ RememberedSet *Region::CreateRememberedSet() RememberedSet *Region::GetOrCreateCrossRegionRememberedSet() { - if (UNLIKELY(crossRegionSet_ == nullptr)) { + if (UNLIKELY(cross_region_set_ == nullptr)) { os::memory::LockHolder lock(lock_); - if (crossRegionSet_ == nullptr) { - crossRegionSet_ = CreateRememberedSet(); + if (cross_region_set_ == nullptr) { + cross_region_set_ = CreateRememberedSet(); } } - return crossRegionSet_; + return cross_region_set_; } RememberedSet *Region::GetOrCreateOldToNewRememberedSet() { - if (UNLIKELY(oldToNewSet_ == nullptr)) { + if (UNLIKELY(old_to_new_set_ == nullptr)) { os::memory::LockHolder lock(lock_); - if (oldToNewSet_ == nullptr) { - oldToNewSet_ = CreateRememberedSet(); + if (old_to_new_set_ == nullptr) { + old_to_new_set_ = CreateRememberedSet(); } } - return oldToNewSet_; + return old_to_new_set_; } void Region::InsertCrossRegionRememberedSet(uintptr_t addr) @@ -117,31 +117,31 @@ void Region::AtomicInsertOldToNewRememberedSet(uintptr_t addr) void Region::ClearMarkBitmap() { - if (markBitmap_ != nullptr) { + if (mark_bitmap_ != nullptr) { auto size = RangeBitmap::GetBitMapSizeInByte(GetCapacity()); - const_cast(heap_->GetRegionFactory())->Free(markBitmap_->GetBitMap().Data(), size); - delete markBitmap_; - markBitmap_ = nullptr; + const_cast(heap_->GetRegionFactory())->Free(mark_bitmap_->GetBitMap().Data(), size); + delete mark_bitmap_; + mark_bitmap_ = nullptr; } } void Region::ClearCrossRegionRememberedSet() { - if (crossRegionSet_ != nullptr) { + if (cross_region_set_ != nullptr) { auto size = RememberedSet::GetSizeInByte(GetCapacity()); - const_cast(heap_->GetRegionFactory())->Free(crossRegionSet_->GetBitMap().Data(), size); - delete crossRegionSet_; - crossRegionSet_ = nullptr; + const_cast(heap_->GetRegionFactory())->Free(cross_region_set_->GetBitMap().Data(), size); + delete cross_region_set_; + cross_region_set_ = nullptr; } } void Region::ClearOldToNewRememberedSet() { - if (oldToNewSet_ != nullptr) { + if (old_to_new_set_ != nullptr) { auto size = RememberedSet::GetSizeInByte(GetCapacity()); - const_cast(heap_->GetRegionFactory())->Free(oldToNewSet_->GetBitMap().Data(), size); - delete oldToNewSet_; - oldToNewSet_ = nullptr; + const_cast(heap_->GetRegionFactory())->Free(old_to_new_set_->GetBitMap().Data(), size); + delete old_to_new_set_; + old_to_new_set_ = nullptr; } } } // namespace panda::ecmascript diff --git a/runtime/mem/region.h b/runtime/mem/region.h index fe956eeddc7e0ac2d346d7b8fef1e6447afee995..4a0ba7f988c131d4a03f63ab8248ec3105d0637b 100644 --- a/runtime/mem/region.h +++ b/runtime/mem/region.h @@ -50,12 +50,12 @@ public: Region(Space *space, Heap *heap, uintptr_t allocateBase, uintptr_t begin, uintptr_t end) : space_(space), heap_(heap), - allocateBase_(allocateBase), + allocate_base_(allocateBase), // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) begin_(begin), end_(end), - highWaterMark_(end), - aliveObject_(0) + high_water_mark_(end), + alive_object_(0) { } ~Region() = default; @@ -65,7 +65,7 @@ public: void Reset() { flags_ = 0; - highWaterMark_ = end_; + high_water_mark_ = end_; memset_s(reinterpret_cast(begin_), GetSize(), 0, GetSize()); } @@ -139,17 +139,17 @@ public: RangeBitmap *GetMarkBitmap() { - return markBitmap_; + return mark_bitmap_; } RememberedSet *GetCrossRegionRememberedSet() { - return crossRegionSet_; + return cross_region_set_; } RememberedSet *GetOldToNewRememberedSet() { - return oldToNewSet_; + return old_to_new_set_; } static Region *ObjectAddressToRange(TaggedObject *obj) @@ -222,25 +222,25 @@ public: uintptr_t GetAllocateBase() const { - return allocateBase_; + return allocate_base_; } size_t GetAllocatedBytes(uintptr_t top = 0) { ASSERT(top == 0 || InRange(top)); - return (top == 0) ? (highWaterMark_ - begin_) : (top - begin_); + return (top == 0) ? (high_water_mark_ - begin_) : (top - begin_); } void SetHighWaterMark(uintptr_t mark) { ASSERT(InRange(mark)); - highWaterMark_ = mark; + high_water_mark_ = mark; } int SetCodeExecutableAndReadable() { // NOLINTNEXTLINE(hicpp-signed-bitwise) - int res = mprotect(reinterpret_cast(allocateBase_), GetCapacity(), PROT_EXEC | PROT_READ | PROT_WRITE); + int res = mprotect(reinterpret_cast(allocate_base_), GetCapacity(), PROT_EXEC | PROT_READ | PROT_WRITE); return res; } @@ -298,32 +298,32 @@ public: void IncrementAliveObject(size_t size) { - aliveObject_ += size; + alive_object_ += size; } void DecreaseAliveObject(size_t size) { - aliveObject_ -= size; + alive_object_ -= size; } void SetAliveObject(size_t size) { - aliveObject_ = size; + alive_object_ = size; } void ResetAliveObject() { - aliveObject_ = 0; + alive_object_ = 0; } size_t AliveObject() const { - return aliveObject_; + return alive_object_; } bool MostObjectAlive() const { - return aliveObject_ > MOST_OBJECT_ALIVE_THRESHOLD_PERCENT * GetSize(); + return alive_object_ > MOST_OBJECT_ALIVE_THRESHOLD_PERCENT * GetSize(); } private: @@ -331,17 +331,17 @@ private: Space *space_; Heap *heap_; uintptr_t flags_ {0}; // Memory alignment, only low 32bits are used now - uintptr_t allocateBase_; + uintptr_t allocate_base_; uintptr_t begin_; uintptr_t end_; - uintptr_t highWaterMark_; + uintptr_t high_water_mark_; bool marking_ {false}; - std::atomic_size_t aliveObject_ {0}; + std::atomic_size_t alive_object_ {0}; Region *next_ {nullptr}; Region *prev_ {nullptr}; - RangeBitmap *markBitmap_ {nullptr}; - RememberedSet *crossRegionSet_ {nullptr}; - RememberedSet *oldToNewSet_ {nullptr}; + RangeBitmap *mark_bitmap_ {nullptr}; + RememberedSet *cross_region_set_ {nullptr}; + RememberedSet *old_to_new_set_ {nullptr}; Span kinds_; os::memory::Mutex lock_; friend class SnapShot; diff --git a/runtime/mem/region_factory.cpp b/runtime/mem/region_factory.cpp index d5ceff43f6eb34da97cf11fda4de871a140ac791..4eb9071c557f322e229a776938d24ec5bea56d4b 100644 --- a/runtime/mem/region_factory.cpp +++ b/runtime/mem/region_factory.cpp @@ -41,7 +41,7 @@ Region *RegionFactory::AllocateAlignedRegion(Space *space, size_t capacity) memset_s(mapMem, commitSize, 0, commitSize); #endif if (mapMem == nullptr) { - LOG_ECMA_MEM(FATAL) << "pool is empty " << annoMemoryUsage_.load(std::memory_order_relaxed); + LOG_ECMA_MEM(FATAL) << "pool is empty " << anno_memory_usage_.load(std::memory_order_relaxed); UNREACHABLE(); } IncreaseAnnoMemoryUsage(capacity); @@ -74,9 +74,9 @@ Area *RegionFactory::AllocateArea(size_t capacity) LOG_ECMA_MEM(FATAL) << "capacity must have a size not less than sizeof Area."; UNREACHABLE(); } - if (cachedArea_ != nullptr && capacity <= cachedArea_->GetSize()) { - auto result = cachedArea_; - cachedArea_ = nullptr; + if (cached_area_ != nullptr && capacity <= cached_area_->GetSize()) { + auto result = cached_area_; + cached_area_ = nullptr; return result; } // NOLINTNEXTLINE(cppcoreguidelines-no-malloc) @@ -100,8 +100,8 @@ void RegionFactory::FreeArea(Area *area) if (area == nullptr) { return; } - if (cachedArea_ == nullptr && area->GetSize() <= MAX_CACHED_CHUNK_AREA_SIZE) { - cachedArea_ = area; + if (cached_area_ == nullptr && area->GetSize() <= MAX_CACHED_CHUNK_AREA_SIZE) { + cached_area_ = area; return; } auto size = area->GetSize() + sizeof(Area); diff --git a/runtime/mem/region_factory.h b/runtime/mem/region_factory.h index 2718197c4b26cbc754fbbcf0c7d7de62bc4cd106..f8c02b6eeb28c70e3543070db147b77da2bcd256 100644 --- a/runtime/mem/region_factory.h +++ b/runtime/mem/region_factory.h @@ -32,9 +32,9 @@ public: RegionFactory() = default; virtual ~RegionFactory() { - if (cachedArea_ != nullptr) { - FreeArea(cachedArea_); - cachedArea_ = nullptr; + if (cached_area_ != nullptr) { + FreeArea(cached_area_); + cached_area_ = nullptr; } } @@ -75,48 +75,50 @@ public: void IncreaseAnnoMemoryUsage(size_t bytes) { - size_t current = annoMemoryUsage_.fetch_add(bytes, std::memory_order_relaxed) + bytes; - size_t max = maxAnnoMemoryUsage_.load(std::memory_order_relaxed); - while (current > max && !maxAnnoMemoryUsage_.compare_exchange_weak(max, current, std::memory_order_relaxed)) { + size_t current = anno_memory_usage_.fetch_add(bytes, std::memory_order_relaxed) + bytes; + size_t max = max_anno_memory_usage_.load(std::memory_order_relaxed); + while (current > max && + !max_anno_memory_usage_.compare_exchange_weak(max, current, std::memory_order_relaxed)) { } } void DecreaseAnnoMemoryUsage(size_t bytes) { - annoMemoryUsage_.fetch_sub(bytes, std::memory_order_relaxed); + anno_memory_usage_.fetch_sub(bytes, std::memory_order_relaxed); } size_t GetAnnoMemoryUsage() const { - return annoMemoryUsage_.load(std::memory_order_relaxed); + return anno_memory_usage_.load(std::memory_order_relaxed); } size_t GetMaxAnnoMemoryUsage() const { - return maxAnnoMemoryUsage_.load(std::memory_order_relaxed); + return max_anno_memory_usage_.load(std::memory_order_relaxed); } void IncreaseNativeMemoryUsage(size_t bytes) { - size_t current = nativeMemoryUsage_.fetch_add(bytes, std::memory_order_relaxed) + bytes; - size_t max = maxNativeMemoryUsage_.load(std::memory_order_relaxed); - while (current > max && !maxNativeMemoryUsage_.compare_exchange_weak(max, current, std::memory_order_relaxed)) { + size_t current = native_memory_usage_.fetch_add(bytes, std::memory_order_relaxed) + bytes; + size_t max = max_native_memory_usage_.load(std::memory_order_relaxed); + while (current > max && + !max_native_memory_usage_.compare_exchange_weak(max, current, std::memory_order_relaxed)) { } } void DecreaseNativeMemoryUsage(size_t bytes) { - nativeMemoryUsage_.fetch_sub(bytes, std::memory_order_relaxed); + native_memory_usage_.fetch_sub(bytes, std::memory_order_relaxed); } size_t GetNativeMemoryUsage() const { - return nativeMemoryUsage_.load(std::memory_order_relaxed); + return native_memory_usage_.load(std::memory_order_relaxed); } size_t GetMaxNativeMemoryUsage() const { - return maxNativeMemoryUsage_.load(std::memory_order_relaxed); + return max_native_memory_usage_.load(std::memory_order_relaxed); } void *Allocate(size_t size) @@ -170,11 +172,11 @@ private: #if ECMASCRIPT_ENABLE_ZAP_MEM static constexpr int INVALID_VALUE = 0x7; #endif - Area *cachedArea_ {nullptr}; - std::atomic annoMemoryUsage_ {0}; - std::atomic maxAnnoMemoryUsage_ {0}; - std::atomic nativeMemoryUsage_ {0}; - std::atomic maxNativeMemoryUsage_ {0}; + Area *cached_area_ {nullptr}; + std::atomic anno_memory_usage_ {0}; + std::atomic max_anno_memory_usage_ {0}; + std::atomic native_memory_usage_ {0}; + std::atomic max_native_memory_usage_ {0}; }; } // namespace panda::ecmascript diff --git a/runtime/mem/semi_space_collector.cpp b/runtime/mem/semi_space_collector.cpp index acc7d2905ea81f115ad5292a9d228d1160806e9e..c6d987d869e3d70f6d15ae28aca9533a1bf7fdf5 100644 --- a/runtime/mem/semi_space_collector.cpp +++ b/runtime/mem/semi_space_collector.cpp @@ -31,7 +31,7 @@ namespace panda::ecmascript { SemiSpaceCollector::SemiSpaceCollector(Heap *heap, bool paralledGc) - : heap_(heap), paralledGc_(paralledGc), workList_(heap->GetWorkList()) + : heap_(heap), paralled_gc_(paralledGc), work_list_(heap->GetWorkList()) { } @@ -51,8 +51,8 @@ void SemiSpaceCollector::RunPhases() ParallelMarkingPhase(); SweepPhases(); FinishPhase(); - heap_->GetEcmaVM()->GetEcmaGCStats()->StatisticSemiCollector(clockScope.GetPauseTime(), semiCopiedSize_, - promotedSize_, commitSize_); + heap_->GetEcmaVM()->GetEcmaGCStats()->StatisticSemiCollector(clockScope.GetPauseTime(), semi_copied_size_, + promoted_size_, commit_size_); ECMA_GC_LOG() << "SemiSpaceCollector::RunPhases " << clockScope.TotalSpentTime(); } @@ -60,12 +60,12 @@ void SemiSpaceCollector::InitializePhase() { ECMA_BYTRACE_NAME(BYTRACE_TAG_ARK, "SemiSpaceCollector::InitializePhase"); heap_->Prepare(); - workList_->Initialize(TriggerGCType::SEMI_GC, ParallelGCTaskPhase::SEMI_HANDLE_GLOBAL_POOL_TASK); + work_list_->Initialize(TriggerGCType::SEMI_GC, ParallelGCTaskPhase::SEMI_HANDLE_GLOBAL_POOL_TASK); heap_->GetSemiGcMarker()->Initialized(); heap_->GetEvacuationAllocator()->Initialize(TriggerGCType::SEMI_GC); - promotedSize_ = 0; - semiCopiedSize_ = 0; - commitSize_ = heap_->GetFromSpace()->GetCommittedSize(); + promoted_size_ = 0; + semi_copied_size_ = 0; + commit_size_ = heap_->GetFromSpace()->GetCommittedSize(); } void SemiSpaceCollector::ParallelMarkingPhase() @@ -73,7 +73,7 @@ void SemiSpaceCollector::ParallelMarkingPhase() ECMA_BYTRACE_NAME(BYTRACE_TAG_ARK, "SemiSpaceCollector::ParallelMarkingPhase"); auto region = heap_->GetOldSpace()->GetCurrentRegion(); - if (paralledGc_) { + if (paralled_gc_) { heap_->PostParallelGCTask(ParallelGCTaskPhase::SEMI_HANDLE_THREAD_ROOTS_TASK); heap_->PostParallelGCTask(ParallelGCTaskPhase::SEMI_HANDLE_SNAPSHOT_TASK); heap_->GetSemiGcMarker()->ProcessOldToNew(0, region); @@ -88,7 +88,7 @@ void SemiSpaceCollector::ParallelMarkingPhase() auto totalThreadCount = Platform::GetCurrentPlatform()->GetTotalThreadNum() + 1; // gc thread and main thread for (uint32_t i = 0; i < totalThreadCount; i++) { SlotNeedUpdate needUpdate(nullptr, ObjectSlot(0)); - while (workList_->GetSlotNeedUpdate(i, &needUpdate)) { + while (work_list_->GetSlotNeedUpdate(i, &needUpdate)) { UpdatePromotedSlot(needUpdate.first, needUpdate.second); } } @@ -99,7 +99,7 @@ void SemiSpaceCollector::SweepPhases() ECMA_BYTRACE_NAME(BYTRACE_TAG_ARK, "SemiSpaceCollector::SweepPhases"); auto totalThreadCount = Platform::GetCurrentPlatform()->GetTotalThreadNum() + 1; // gc thread and main thread for (uint32_t i = 0; i < totalThreadCount; i++) { - ProcessQueue *queue = workList_->GetWeakReferenceQueue(i); + ProcessQueue *queue = work_list_->GetWeakReferenceQueue(i); while (true) { auto obj = queue->PopBack(); if (UNLIKELY(obj == nullptr)) { @@ -142,7 +142,7 @@ void SemiSpaceCollector::SweepPhases() void SemiSpaceCollector::FinishPhase() { ECMA_BYTRACE_NAME(BYTRACE_TAG_ARK, "SemiSpaceCollector::FinishPhase"); - workList_->Finish(semiCopiedSize_, promotedSize_); + work_list_->Finish(semi_copied_size_, promoted_size_); heap_->GetEvacuationAllocator()->Finalize(TriggerGCType::SEMI_GC); } } // namespace panda::ecmascript diff --git a/runtime/mem/semi_space_collector.h b/runtime/mem/semi_space_collector.h index 1c127ff74bf6eec97ae7e77c3caca517b394335d..4494d57317b336cda5b5f2b7ab588aa33a62ebd2 100644 --- a/runtime/mem/semi_space_collector.h +++ b/runtime/mem/semi_space_collector.h @@ -61,13 +61,13 @@ private: inline void UpdatePromotedSlot(TaggedObject *object, ObjectSlot slot); Heap *heap_; - size_t promotedSize_ {0}; - size_t semiCopiedSize_ {0}; - size_t commitSize_ = 0; + size_t promoted_size_ {0}; + size_t semi_copied_size_ {0}; + size_t commit_size_ = 0; // obtain from heap - bool paralledGc_ {false}; - WorkerHelper *workList_ {nullptr}; + bool paralled_gc_ {false}; + WorkerHelper *work_list_ {nullptr}; friend class TlabAllocator; friend class WorkerHelper; diff --git a/runtime/mem/slots.h b/runtime/mem/slots.h index a2d3c37ef3c65a58997c19200a586f8d84f636bd..9e705b913b8b73abfa76424ac6b962482447fb32 100644 --- a/runtime/mem/slots.h +++ b/runtime/mem/slots.h @@ -22,7 +22,7 @@ namespace panda::ecmascript { class ObjectSlot { public: - explicit ObjectSlot(uintptr_t slotAddr) : slotAddress_(slotAddr) {} + explicit ObjectSlot(uintptr_t slotAddr) : slot_address_(slotAddr) {} ~ObjectSlot() = default; DEFAULT_COPY_SEMANTIC(ObjectSlot); @@ -36,7 +36,7 @@ public: void Update(JSTaggedType value) { // NOLINTNEXTLINE(clang-analyzer-core.NullDereference) - *reinterpret_cast(slotAddress_) = value; + *reinterpret_cast(slot_address_) = value; } TaggedObject *GetTaggedObjectHeader() const @@ -47,12 +47,12 @@ public: JSTaggedType GetTaggedType() const { // NOLINTNEXTLINE(clang-analyzer-core.NullDereference) - return *reinterpret_cast(slotAddress_); + return *reinterpret_cast(slot_address_); } ObjectSlot &operator++() { - slotAddress_ += sizeof(JSTaggedType); + slot_address_ += sizeof(JSTaggedType); return *this; } @@ -60,42 +60,42 @@ public: ObjectSlot operator++(int) { ObjectSlot ret = *this; - slotAddress_ += sizeof(JSTaggedType); + slot_address_ += sizeof(JSTaggedType); return ret; } uintptr_t SlotAddress() const { - return slotAddress_; + return slot_address_; } bool operator<(const ObjectSlot &other) const { - return slotAddress_ < other.slotAddress_; + return slot_address_ < other.slot_address_; } bool operator<=(const ObjectSlot &other) const { - return slotAddress_ <= other.slotAddress_; + return slot_address_ <= other.slot_address_; } bool operator>(const ObjectSlot &other) const { - return slotAddress_ > other.slotAddress_; + return slot_address_ > other.slot_address_; } bool operator>=(const ObjectSlot &other) const { - return slotAddress_ >= other.slotAddress_; + return slot_address_ >= other.slot_address_; } bool operator==(const ObjectSlot &other) const { - return slotAddress_ == other.slotAddress_; + return slot_address_ == other.slot_address_; } bool operator!=(const ObjectSlot &other) const { - return slotAddress_ != other.slotAddress_; + return slot_address_ != other.slot_address_; } private: - uintptr_t slotAddress_; + uintptr_t slot_address_; }; } // namespace panda::ecmascript diff --git a/runtime/mem/space-inl.h b/runtime/mem/space-inl.h index 068644498775013c81d17c670d489096678cf1f3..3f6825503f5f0fef55a5584bfd9227ac53034891 100644 --- a/runtime/mem/space-inl.h +++ b/runtime/mem/space-inl.h @@ -22,9 +22,9 @@ namespace panda::ecmascript { template void Space::EnumerateRegions(const Callback &cb, Region *end) const { - Region *current = regionList_.GetFirst(); + Region *current = region_list_.GetFirst(); if (end == nullptr) { - end = regionList_.GetLast(); + end = region_list_.GetLast(); } while (current != end) { auto next = current->GetNext(); @@ -40,7 +40,7 @@ void Space::EnumerateRegions(const Callback &cb, Region *end) const template void OldSpace::EnumerateCollectRegionSet(const Callback &cb) const { - for (Region *current : collectRegionSet_) { + for (Region *current : collect_region_set_) { if (current != nullptr) { ASSERT(current->InCollectSet()); cb(current); diff --git a/runtime/mem/space.cpp b/runtime/mem/space.cpp index 5dd04f6cea579cc334c2cc2ddf263aacd9ef6d78..9e284cd3343d14598f70436bdf992e248bf8f08b 100644 --- a/runtime/mem/space.cpp +++ b/runtime/mem/space.cpp @@ -28,57 +28,57 @@ Space::Space(Heap *heap, MemSpaceType spaceType, size_t initialCapacity, size_t : heap_(heap), vm_(heap_->GetEcmaVM()), thread_(vm_->GetJSThread()), - regionFactory_(vm_->GetRegionFactory()), - spaceType_(spaceType), - initialCapacity_(initialCapacity), - maximumCapacity_(maximumCapacity) + region_factory_(vm_->GetRegionFactory()), + space_type_(spaceType), + initial_capacity_(initialCapacity), + maximum_capacity_(maximumCapacity) { } void Space::AddRegion(Region *region) { - LOG_ECMA_MEM(DEBUG) << "Add region:" << region << " to " << ToSpaceTypeName(spaceType_); - regionList_.AddNode(region); + LOG_ECMA_MEM(DEBUG) << "Add region:" << region << " to " << ToSpaceTypeName(space_type_); + region_list_.AddNode(region); IncrementCommitted(region->GetCapacity()); } void Space::AddRegionToFirst(Region *region) { - LOG_ECMA_MEM(DEBUG) << "Add region to first:" << region << " to " << ToSpaceTypeName(spaceType_); - regionList_.AddNodeToFirst(region); + LOG_ECMA_MEM(DEBUG) << "Add region to first:" << region << " to " << ToSpaceTypeName(space_type_); + region_list_.AddNodeToFirst(region); IncrementCommitted(region->GetCapacity()); } void Space::RemoveRegion(Region *region) { - LOG_ECMA_MEM(DEBUG) << "Remove region:" << region << " to " << ToSpaceTypeName(spaceType_); - if (regionList_.HasNode(region)) { - if (spaceType_ == MemSpaceType::OLD_SPACE || spaceType_ == MemSpaceType::NON_MOVABLE || - spaceType_ == MemSpaceType::MACHINE_CODE_SPACE) { + LOG_ECMA_MEM(DEBUG) << "Remove region:" << region << " to " << ToSpaceTypeName(space_type_); + if (region_list_.HasNode(region)) { + if (space_type_ == MemSpaceType::OLD_SPACE || space_type_ == MemSpaceType::NON_MOVABLE || + space_type_ == MemSpaceType::MACHINE_CODE_SPACE) { region->RebuildKind(); } - regionList_.RemoveNode(region); + region_list_.RemoveNode(region); DecrementCommitted(region->GetCapacity()); } } void Space::Initialize() { - Region *region = regionFactory_->AllocateAlignedRegion(this, DEFAULT_REGION_SIZE); - if (spaceType_ == MemSpaceType::SEMI_SPACE) { + Region *region = region_factory_->AllocateAlignedRegion(this, DEFAULT_REGION_SIZE); + if (space_type_ == MemSpaceType::SEMI_SPACE) { region->SetFlag(RegionFlags::IS_IN_YOUNG_GENERATION); - } else if (spaceType_ == MemSpaceType::SNAPSHOT_SPACE) { + } else if (space_type_ == MemSpaceType::SNAPSHOT_SPACE) { region->SetFlag(RegionFlags::IS_IN_SNAPSHOT_GENERATION); - } else if (spaceType_ == MemSpaceType::OLD_SPACE) { + } else if (space_type_ == MemSpaceType::OLD_SPACE) { region->InitializeKind(); region->SetFlag(RegionFlags::IS_IN_OLD_GENERATION); - } else if (spaceType_ == MemSpaceType::MACHINE_CODE_SPACE) { + } else if (space_type_ == MemSpaceType::MACHINE_CODE_SPACE) { region->InitializeKind(); region->SetFlag(RegionFlags::IS_IN_NON_MOVABLE_GENERATION); // NOLINTNEXTLINE(clang-analyzer-deadcode.DeadStores) [[maybe_unused]] int res = region->SetCodeExecutableAndReadable(); LOG_ECMA_MEM(DEBUG) << "Initialize SetCodeExecutableAndReadable" << res; - } else if (spaceType_ == MemSpaceType::NON_MOVABLE) { + } else if (space_type_ == MemSpaceType::NON_MOVABLE) { region->InitializeKind(); region->SetFlag(RegionFlags::IS_IN_NON_MOVABLE_GENERATION); } @@ -89,22 +89,22 @@ void Space::Initialize() void Space::ReclaimRegions() { EnumerateRegions([this](Region *current) { ClearAndFreeRegion(current); }); - regionList_.Clear(); - committedSize_ = 0; + region_list_.Clear(); + committed_size_ = 0; } void Space::ClearAndFreeRegion(Region *region) { - LOG_ECMA_MEM(DEBUG) << "Clear region from:" << region << " to " << ToSpaceTypeName(spaceType_); + LOG_ECMA_MEM(DEBUG) << "Clear region from:" << region << " to " << ToSpaceTypeName(space_type_); region->ClearMarkBitmap(); region->ClearCrossRegionRememberedSet(); region->ClearOldToNewRememberedSet(); DecrementCommitted(region->GetCapacity()); - if (spaceType_ == MemSpaceType::OLD_SPACE || spaceType_ == MemSpaceType::NON_MOVABLE || - spaceType_ == MemSpaceType::MACHINE_CODE_SPACE) { + if (space_type_ == MemSpaceType::OLD_SPACE || space_type_ == MemSpaceType::NON_MOVABLE || + space_type_ == MemSpaceType::MACHINE_CODE_SPACE) { region->DestroyKind(); } - regionFactory_->FreeRegion(region); + region_factory_->FreeRegion(region); } size_t Space::GetHeapObjectSize() const @@ -129,11 +129,11 @@ SemiSpace::SemiSpace(Heap *heap, size_t initialCapacity, size_t maximumCapacity) bool SemiSpace::Expand(uintptr_t top) { - if (committedSize_ >= maximumCapacity_) { + if (committed_size_ >= maximum_capacity_) { return false; } GetCurrentRegion()->SetHighWaterMark(top); - Region *region = regionFactory_->AllocateAlignedRegion(this, DEFAULT_REGION_SIZE); + Region *region = region_factory_->AllocateAlignedRegion(this, DEFAULT_REGION_SIZE); region->SetFlag(RegionFlags::IS_IN_YOUNG_GENERATION); if (!thread_->IsReadyToMark()) { region->SetMarking(true); @@ -161,7 +161,7 @@ void SemiSpace::Swap([[maybe_unused]] SemiSpace *other) {} void SemiSpace::SetAgeMark(uintptr_t mark) { - ageMark_ = mark; + age_mark_ = mark; Region *last = GetCurrentRegion(); last->SetFlag(RegionFlags::HAS_AGE_MARK); @@ -239,7 +239,7 @@ size_t SemiSpace::GetAllocatedSizeSinceGC() const auto top = GetHeap()->GetHeapManager()->GetNewSpaceAllocator().GetTop(); size_t result = 0; if (last->HasAgeMark()) { - result = last->GetAllocatedBytes(top) - last->GetAllocatedBytes(ageMark_); + result = last->GetAllocatedBytes(top) - last->GetAllocatedBytes(age_mark_); return result; } result = last->GetAllocatedBytes(top); @@ -263,11 +263,11 @@ OldSpace::OldSpace(Heap *heap, size_t initialCapacity, size_t maximumCapacity) bool OldSpace::Expand() { - if (committedSize_ >= maximumCapacity_) { - LOG_ECMA_MEM(FATAL) << "Committed size " << committedSize_ << " of old space is too big. "; + if (committed_size_ >= maximum_capacity_) { + LOG_ECMA_MEM(FATAL) << "Committed size " << committed_size_ << " of old space is too big. "; return false; } - Region *region = regionFactory_->AllocateAlignedRegion(this, DEFAULT_REGION_SIZE); + Region *region = region_factory_->AllocateAlignedRegion(this, DEFAULT_REGION_SIZE); region->SetFlag(RegionFlags::IS_IN_OLD_GENERATION); if (!thread_->IsReadyToMark()) { region->SetMarking(true); @@ -354,7 +354,7 @@ size_t OldSpace::GetHeapObjectSize() const { size_t result; size_t availableSize = heap_->GetHeapManager()->GetOldSpaceAllocator().GetAvailableSize(); - result = committedSize_ - availableSize; + result = committed_size_ - availableSize; return result; } @@ -371,21 +371,21 @@ void OldSpace::Merge(Space *fromSpace) void OldSpace::AddRegionToCSet(Region *region) { region->SetFlag(RegionFlags::IS_IN_COLLECT_SET); - collectRegionSet_.emplace_back(region); + collect_region_set_.emplace_back(region); } void OldSpace::ClearRegionFromCSet() { EnumerateCollectRegionSet([](Region *region) { region->ClearFlag(RegionFlags::IS_IN_COLLECT_SET); }); - collectRegionSet_.clear(); + collect_region_set_.clear(); } void OldSpace::RemoveRegionFromCSetAndList(Region *region) { - for (auto current = collectRegionSet_.begin(); current != collectRegionSet_.end(); current++) { + for (auto current = collect_region_set_.begin(); current != collect_region_set_.end(); current++) { if (*current == region) { region->ClearFlag(RegionFlags::IS_IN_COLLECT_SET); - current = collectRegionSet_.erase(current); + current = collect_region_set_.erase(current); break; } } @@ -400,29 +400,29 @@ void OldSpace::RemoveCSetFromList() void OldSpace::ReclaimRegionCSet() { EnumerateCollectRegionSet([this](Region *current) { ClearAndFreeRegion(current); }); - collectRegionSet_.clear(); + collect_region_set_.clear(); } void OldSpace::SelectCSet() { EnumerateRegions([this](Region *region) { if (!region->MostObjectAlive()) { - collectRegionSet_.emplace_back(region); + collect_region_set_.emplace_back(region); } }); - if (collectRegionSet_.size() < PARTIAL_GC_MIN_COLLECT_REGION_SIZE) { + if (collect_region_set_.size() < PARTIAL_GC_MIN_COLLECT_REGION_SIZE) { heap_->SetOnlyMarkSemi(true); - collectRegionSet_.clear(); + collect_region_set_.clear(); return; } // sort - std::sort(collectRegionSet_.begin(), collectRegionSet_.end(), + std::sort(collect_region_set_.begin(), collect_region_set_.end(), [](Region *first, Region *second) { return first->AliveObject() < second->AliveObject(); }); uint64_t selectedRegionNumber = GetSelectedRegionNumber(); - if (collectRegionSet_.size() > selectedRegionNumber) { - collectRegionSet_.resize(selectedRegionNumber); + if (collect_region_set_.size() > selectedRegionNumber) { + collect_region_set_.resize(selectedRegionNumber); } - for (Region *region : collectRegionSet_) { + for (Region *region : collect_region_set_) { region->SetFlag(RegionFlags::IS_IN_COLLECT_SET); } } @@ -434,11 +434,11 @@ NonMovableSpace::NonMovableSpace(Heap *heap, size_t initialCapacity, size_t maxi bool NonMovableSpace::Expand() { - if (committedSize_ >= maximumCapacity_) { - LOG_ECMA_MEM(FATAL) << "Committed size " << committedSize_ << " of non movable space is too big. "; + if (committed_size_ >= maximum_capacity_) { + LOG_ECMA_MEM(FATAL) << "Committed size " << committed_size_ << " of non movable space is too big. "; return false; } - Region *region = regionFactory_->AllocateAlignedRegion(this, DEFAULT_REGION_SIZE); + Region *region = region_factory_->AllocateAlignedRegion(this, DEFAULT_REGION_SIZE); region->SetFlag(IS_IN_NON_MOVABLE_GENERATION); if (!thread_->IsReadyToMark()) { region->SetMarking(true); @@ -463,14 +463,14 @@ SnapShotSpace::SnapShotSpace(Heap *heap, size_t initialCapacity, size_t maximumC bool SnapShotSpace::Expand(uintptr_t top) { - if (committedSize_ >= maximumCapacity_) { + if (committed_size_ >= maximum_capacity_) { return false; } Region *current = GetCurrentRegion(); if (current != nullptr) { current->SetHighWaterMark(top); } - Region *region = regionFactory_->AllocateAlignedRegion(this, DEFAULT_SNAPSHOT_SPACE_SIZE); + Region *region = region_factory_->AllocateAlignedRegion(this, DEFAULT_SNAPSHOT_SPACE_SIZE); region->SetFlag(RegionFlags::IS_IN_SNAPSHOT_GENERATION); if (!thread_->IsReadyToMark()) { region->SetMarking(true); @@ -540,8 +540,8 @@ HugeObjectSpace::HugeObjectSpace(Heap *heap, size_t initialCapacity, size_t maxi uintptr_t HugeObjectSpace::Allocate(size_t objectSize) { - if (committedSize_ >= maximumCapacity_) { - LOG_ECMA_MEM(FATAL) << "Committed size " << committedSize_ << " of huge object space is too big. " + if (committed_size_ >= maximum_capacity_) { + LOG_ECMA_MEM(FATAL) << "Committed size " << committed_size_ << " of huge object space is too big. " << " old space committed: " << heap_->GetOldSpace()->GetCommittedSize() << " old space limit: " << heap_->GetOldSpaceAllocLimit() << " length: " << GetRegionList().GetLength(); @@ -552,7 +552,7 @@ uintptr_t HugeObjectSpace::Allocate(size_t objectSize) LOG_ECMA_MEM(FATAL) << "The size is too big for this allocator. Return nullptr."; return 0; } - Region *region = regionFactory_->AllocateAlignedRegion(this, alignedSize); + Region *region = region_factory_->AllocateAlignedRegion(this, alignedSize); region->SetFlag(RegionFlags::IS_HUGE_OBJECT); if (!thread_->IsReadyToMark()) { region->SetMarking(true); @@ -586,7 +586,7 @@ bool HugeObjectSpace::IsLive(TaggedObject *object) const size_t HugeObjectSpace::GetHeapObjectSize() const { - return committedSize_; + return committed_size_; } void HugeObjectSpace::IterateOverObjects(const std::function &objectVisitor) const @@ -604,11 +604,11 @@ MachineCodeSpace::MachineCodeSpace(Heap *heap, size_t initialCapacity, size_t ma bool MachineCodeSpace::Expand() { - if (committedSize_ >= maximumCapacity_) { - LOG_ECMA_MEM(FATAL) << "Committed size " << committedSize_ << " of machine Code space is too big. "; + if (committed_size_ >= maximum_capacity_) { + LOG_ECMA_MEM(FATAL) << "Committed size " << committed_size_ << " of machine Code space is too big. "; return false; } - Region *region = regionFactory_->AllocateAlignedRegion(this, DEFAULT_REGION_SIZE); + Region *region = region_factory_->AllocateAlignedRegion(this, DEFAULT_REGION_SIZE); region->SetFlag(IS_IN_NON_MOVABLE_GENERATION); region->InitializeKind(); AddRegion(region); @@ -625,7 +625,7 @@ size_t MachineCodeSpace::GetHeapObjectSize() const { size_t result = 0; size_t availableSize = GetHeap()->GetHeapManager()->GetMachineCodeSpaceAllocator().GetAvailableSize(); - result = committedSize_ - availableSize; + result = committed_size_ - availableSize; return result; } } // namespace panda::ecmascript diff --git a/runtime/mem/space.h b/runtime/mem/space.h index 69b78779b648e70e7cd56e6a7d9405093f3eda75..9aa1b9e9bb5f04069a42ee5b3c9e2c743614e31c 100644 --- a/runtime/mem/space.h +++ b/runtime/mem/space.h @@ -90,67 +90,67 @@ public: size_t GetMaximumCapacity() const { - return maximumCapacity_; + return maximum_capacity_; } void SetMaximumCapacity(size_t maximumCapacity) { - maximumCapacity_ = maximumCapacity; + maximum_capacity_ = maximumCapacity; } size_t GetInitialCapacity() const { - return initialCapacity_; + return initial_capacity_; } size_t GetCommittedSize() const { - return committedSize_; + return committed_size_; } void IncrementCommitted(size_t bytes) { - committedSize_ += bytes; + committed_size_ += bytes; } void DecrementCommitted(size_t bytes) { - committedSize_ -= bytes; + committed_size_ -= bytes; } MemSpaceType GetSpaceType() const { - return spaceType_; + return space_type_; } uintptr_t GetAllocateAreaBegin() const { - return regionList_.GetLast()->GetBegin(); + return region_list_.GetLast()->GetBegin(); } uintptr_t GetAllocateAreaEnd() const { - return regionList_.GetLast()->GetEnd(); + return region_list_.GetLast()->GetEnd(); } Region *GetCurrentRegion() const { - return regionList_.GetLast(); + return region_list_.GetLast(); } uint32_t GetRegionCount() { - return regionList_.GetLength(); + return region_list_.GetLength(); } EcmaList &GetRegionList() { - return regionList_; + return region_list_; } const EcmaList &GetRegionList() const { - return regionList_; + return region_list_; } size_t GetHeapObjectSize() const; @@ -177,17 +177,17 @@ protected: // NOLINTNEXTLINE(misc-non-private-member-variables-in-classes) JSThread *thread_ {nullptr}; // NOLINTNEXTLINE(misc-non-private-member-variables-in-classes) - RegionFactory *regionFactory_ {nullptr}; + RegionFactory *region_factory_ {nullptr}; // NOLINTNEXTLINE(misc-non-private-member-variables-in-classes) - EcmaList regionList_ {}; + EcmaList region_list_ {}; // NOLINTNEXTLINE(misc-non-private-member-variables-in-classes) - MemSpaceType spaceType_ {}; + MemSpaceType space_type_ {}; // NOLINTNEXTLINE(misc-non-private-member-variables-in-classes) - size_t initialCapacity_ {0}; + size_t initial_capacity_ {0}; // NOLINTNEXTLINE(misc-non-private-member-variables-in-classes) - size_t maximumCapacity_ {0}; + size_t maximum_capacity_ {0}; // NOLINTNEXTLINE(misc-non-private-member-variables-in-classes) - size_t committedSize_ {0}; + size_t committed_size_ {0}; // NOLINTNEXTLINE(misc-non-private-member-variables-in-classes) }; @@ -203,7 +203,7 @@ public: uintptr_t GetAgeMark() const { - return ageMark_; + return age_mark_; } bool Expand(uintptr_t top); @@ -218,7 +218,7 @@ public: size_t GetAllocatedSizeSinceGC() const; private: - uintptr_t ageMark_ {0}; + uintptr_t age_mark_ {0}; }; class OldSpace : public Space { @@ -247,14 +247,14 @@ public: void SelectCSet(); size_t GetSelectedRegionNumber() const { - return std::max(committedSize_ / PARTIAL_GC_MAX_COLLECT_REGION_RATE, PARTIAL_GC_INITIAL_COLLECT_REGION_SIZE); + return std::max(committed_size_ / PARTIAL_GC_MAX_COLLECT_REGION_RATE, PARTIAL_GC_INITIAL_COLLECT_REGION_SIZE); } private: static constexpr size_t PARTIAL_GC_MAX_COLLECT_REGION_RATE = 1024 * 1024 * 2; static constexpr size_t PARTIAL_GC_INITIAL_COLLECT_REGION_SIZE = 16; static constexpr size_t PARTIAL_GC_MIN_COLLECT_REGION_SIZE = 5; - CVector collectRegionSet_; + CVector collect_region_set_; }; class NonMovableSpace : public Space { diff --git a/runtime/mem/tlab_allocator-inl.h b/runtime/mem/tlab_allocator-inl.h index 23e88678ca08e48f4b44deadf3f87294a8e50a69..81cff08afa762b6774887edbaef75ff26c246298 100644 --- a/runtime/mem/tlab_allocator-inl.h +++ b/runtime/mem/tlab_allocator-inl.h @@ -29,7 +29,7 @@ static constexpr size_t YOUNG_BUFFER_SIZE = 31 * 1024; static constexpr size_t OLD_BUFFER_SIZE = 255 * 1024; TlabAllocator::TlabAllocator(Heap *heap, TriggerGCType gcType) - : heap_(heap), gcType_(gcType), youngEnable_(true), allocator_(heap_->GetEvacuationAllocator()) + : heap_(heap), gc_type_(gcType), young_enable_(true), allocator_(heap_->GetEvacuationAllocator()) { } @@ -40,15 +40,15 @@ TlabAllocator::~TlabAllocator() inline void TlabAllocator::Finalize() { - if (youngerAllocator_.Available() != 0) { - FreeObject::FillFreeObject(heap_->GetEcmaVM(), youngerAllocator_.GetTop(), youngerAllocator_.Available()); - youngerAllocator_.Reset(); + if (younger_allocator_.Available() != 0) { + FreeObject::FillFreeObject(heap_->GetEcmaVM(), younger_allocator_.GetTop(), younger_allocator_.Available()); + younger_allocator_.Reset(); } - if (oldBumpPointerAllocator_.Available() != 0) { - allocator_->FreeSafe(oldBumpPointerAllocator_.GetTop(), oldBumpPointerAllocator_.GetEnd()); - Region *current = Region::ObjectAddressToRange(oldBumpPointerAllocator_.GetTop()); - current->DecreaseAliveObject(oldBumpPointerAllocator_.Available()); - oldBumpPointerAllocator_.Reset(); + if (old_bump_pointer_allocator_.Available() != 0) { + allocator_->FreeSafe(old_bump_pointer_allocator_.GetTop(), old_bump_pointer_allocator_.GetEnd()); + Region *current = Region::ObjectAddressToRange(old_bump_pointer_allocator_.GetTop()); + current->DecreaseAliveObject(old_bump_pointer_allocator_.Available()); + old_bump_pointer_allocator_.Reset(); } } @@ -76,41 +76,41 @@ uintptr_t TlabAllocator::TlabAllocatorYoungSpace(size_t size) LOG(DEBUG, RUNTIME) << "AllocatorYoungSpace:" << address; return address; } - uintptr_t result = youngerAllocator_.Allocate(size); + uintptr_t result = younger_allocator_.Allocate(size); if (result != 0) { return result; } - if (youngerAllocator_.Available() != 0) { - FreeObject::FillFreeObject(heap_->GetEcmaVM(), youngerAllocator_.GetTop(), youngerAllocator_.Available()); + if (younger_allocator_.Available() != 0) { + FreeObject::FillFreeObject(heap_->GetEcmaVM(), younger_allocator_.GetTop(), younger_allocator_.Available()); } - if (!youngEnable_ || !ExpandYoung()) { - youngEnable_ = false; + if (!young_enable_ || !ExpandYoung()) { + young_enable_ = false; return 0; } - return youngerAllocator_.Allocate(size); + return younger_allocator_.Allocate(size); } uintptr_t TlabAllocator::TlabAllocatorOldSpace(size_t size) { size = AlignUp(size, static_cast(MemAlignment::MEM_ALIGN_OBJECT)); - uintptr_t result = oldBumpPointerAllocator_.Allocate(size); + uintptr_t result = old_bump_pointer_allocator_.Allocate(size); if (result != 0) { - FreeObject::FillFreeObject(heap_->GetEcmaVM(), oldBumpPointerAllocator_.GetTop(), - oldBumpPointerAllocator_.Available()); + FreeObject::FillFreeObject(heap_->GetEcmaVM(), old_bump_pointer_allocator_.GetTop(), + old_bump_pointer_allocator_.Available()); return result; } - Region *current = Region::ObjectAddressToRange(oldBumpPointerAllocator_.GetTop()); + Region *current = Region::ObjectAddressToRange(old_bump_pointer_allocator_.GetTop()); if (current != nullptr) { - current->DecreaseAliveObject(oldBumpPointerAllocator_.Available()); + current->DecreaseAliveObject(old_bump_pointer_allocator_.Available()); } - allocator_->FreeSafe(oldBumpPointerAllocator_.GetTop(), oldBumpPointerAllocator_.GetEnd()); + allocator_->FreeSafe(old_bump_pointer_allocator_.GetTop(), old_bump_pointer_allocator_.GetEnd()); if (!ExpandOld()) { return 0; } - result = oldBumpPointerAllocator_.Allocate(size); + result = old_bump_pointer_allocator_.Allocate(size); if (result != 0) { - FreeObject::FillFreeObject(heap_->GetEcmaVM(), oldBumpPointerAllocator_.GetTop(), - oldBumpPointerAllocator_.Available()); + FreeObject::FillFreeObject(heap_->GetEcmaVM(), old_bump_pointer_allocator_.GetTop(), + old_bump_pointer_allocator_.Available()); } return result; } @@ -123,30 +123,30 @@ bool TlabAllocator::ExpandYoung() if (buffer == 0) { return false; } - youngerAllocator_.Reset(buffer, buffer + YOUNG_BUFFER_SIZE); + younger_allocator_.Reset(buffer, buffer + YOUNG_BUFFER_SIZE); return true; } bool TlabAllocator::ExpandOld() { uintptr_t buffer = 0; - if (gcType_ == TriggerGCType::SEMI_GC) { + if (gc_type_ == TriggerGCType::SEMI_GC) { buffer = allocator_->AllocateOld(YOUNG_BUFFER_SIZE); if (buffer == 0) { return false; } - oldBumpPointerAllocator_.Reset(buffer, buffer + YOUNG_BUFFER_SIZE); - FreeObject::FillFreeObject(heap_->GetEcmaVM(), oldBumpPointerAllocator_.GetTop(), - oldBumpPointerAllocator_.Available()); - } else if (gcType_ == TriggerGCType::COMPRESS_FULL_GC) { + old_bump_pointer_allocator_.Reset(buffer, buffer + YOUNG_BUFFER_SIZE); + FreeObject::FillFreeObject(heap_->GetEcmaVM(), old_bump_pointer_allocator_.GetTop(), + old_bump_pointer_allocator_.Available()); + } else if (gc_type_ == TriggerGCType::COMPRESS_FULL_GC) { Region *region = allocator_->ExpandOldSpace(); if (region == nullptr) { return false; } region->SetAliveObject(region->GetSize()); - oldBumpPointerAllocator_.Reset(region->GetBegin(), region->GetEnd()); - FreeObject::FillFreeObject(heap_->GetEcmaVM(), oldBumpPointerAllocator_.GetTop(), - oldBumpPointerAllocator_.Available()); + old_bump_pointer_allocator_.Reset(region->GetBegin(), region->GetEnd()); + FreeObject::FillFreeObject(heap_->GetEcmaVM(), old_bump_pointer_allocator_.GetTop(), + old_bump_pointer_allocator_.Available()); } else { UNREACHABLE(); } diff --git a/runtime/mem/tlab_allocator.h b/runtime/mem/tlab_allocator.h index 70f5579fe69a0a8aa6dad110990682eb1d03e578..41e7e3d456a66c24b23657c11c0a05f1e07cab52 100644 --- a/runtime/mem/tlab_allocator.h +++ b/runtime/mem/tlab_allocator.h @@ -48,11 +48,11 @@ private: inline bool ExpandOld(); Heap *heap_; - TriggerGCType gcType_; - bool youngEnable_; + TriggerGCType gc_type_; + bool young_enable_; - BumpPointerAllocator youngerAllocator_; - BumpPointerAllocator oldBumpPointerAllocator_; + BumpPointerAllocator younger_allocator_; + BumpPointerAllocator old_bump_pointer_allocator_; EvacuationAllocator *allocator_; }; } // namespace panda::ecmascript diff --git a/runtime/mem/verification.cpp b/runtime/mem/verification.cpp index 990abbcbd93f1a50730bfb97e6beb75145743b95..d1050af577caec878633f6bfd464876d0cf7c2a1 100644 --- a/runtime/mem/verification.cpp +++ b/runtime/mem/verification.cpp @@ -24,7 +24,7 @@ namespace panda::ecmascript { void VerifyObjectVisitor::VisitAllObjects(TaggedObject *obj) { auto jsHclass = obj->GetClass(); - objXRay_.VisitObjectBody( + obj_x_ray_.VisitObjectBody( obj, jsHclass, [this]([[maybe_unused]] TaggedObject *root, ObjectSlot start, ObjectSlot end) { for (ObjectSlot slot = start; slot < end; slot++) { JSTaggedValue value(slot.GetTaggedType()); @@ -32,13 +32,13 @@ void VerifyObjectVisitor::VisitAllObjects(TaggedObject *obj) if (!heap_->IsLive(value.GetTaggedWeakRef())) { LOG(ERROR, RUNTIME) << "Heap verify detected a dead object at " << value.GetTaggedObject() << "at object:" << slot.SlotAddress(); - ++(*failCount_); + ++(*fail_count_); } } else if (value.IsHeapObject()) { if (!heap_->IsLive(value.GetTaggedObject())) { LOG(ERROR, RUNTIME) << "Heap verify detected a dead object at " << value.GetTaggedObject() << "at object:" << slot.SlotAddress(); - ++(*failCount_); + ++(*fail_count_); } } } @@ -66,7 +66,7 @@ size_t Verification::VerifyRoot() const } } }; - objXRay_.VisitVMRoots(visit1, visit2); + obj_x_ray_.VisitVMRoots(visit1, visit2); if (failCount > 0) { LOG(ERROR, RUNTIME) << "VerifyRoot detects deadObject count is " << failCount; } diff --git a/runtime/mem/verification.h b/runtime/mem/verification.h index 5a6c65bd305db67045809bbc4e3a9ebc9368cd26..7f6ac4f21efbb457cbd9c312b7225e6e72260476 100644 --- a/runtime/mem/verification.h +++ b/runtime/mem/verification.h @@ -29,7 +29,7 @@ namespace panda::ecmascript { class VerifyObjectVisitor { public: VerifyObjectVisitor(const Heap *heap, size_t *failCount) - : heap_(heap), failCount_(failCount), objXRay_(heap->GetEcmaVM()) + : heap_(heap), fail_count_(failCount), obj_x_ray_(heap->GetEcmaVM()) { } ~VerifyObjectVisitor() = default; @@ -41,20 +41,20 @@ public: size_t GetFailedCount() const { - return *failCount_; + return *fail_count_; } private: void VisitAllObjects(TaggedObject *obj); const Heap *const heap_ {nullptr}; - size_t *const failCount_ {nullptr}; - ObjectXRay objXRay_; + size_t *const fail_count_ {nullptr}; + ObjectXRay obj_x_ray_; }; class Verification { public: - explicit Verification(const Heap *heap) : heap_(heap), objXRay_(heap->GetEcmaVM()) {} + explicit Verification(const Heap *heap) : heap_(heap), obj_x_ray_(heap->GetEcmaVM()) {} ~Verification() = default; size_t VerifyAll() const @@ -73,7 +73,7 @@ private: NO_MOVE_SEMANTIC(Verification); const Heap *heap_ {nullptr}; - ObjectXRay objXRay_; + ObjectXRay obj_x_ray_; }; } // namespace panda::ecmascript diff --git a/runtime/napi/include/jsnapi.h b/runtime/napi/include/jsnapi.h index 1da1a79152c88cba13e58ad0be9c768e7ecc9034..b3d1c83424c76f0d10be45b992a410ecc680f98e 100644 --- a/runtime/napi/include/jsnapi.h +++ b/runtime/napi/include/jsnapi.h @@ -214,9 +214,9 @@ protected: inline LocalScope(const EcmaVM *vm, JSTaggedType value); private: - void *prevNext_ = nullptr; - void *prevEnd_ = nullptr; - int prevHandleStorageIndex_ {-1}; + void *prev_next_ = nullptr; + void *prev_end_ = nullptr; + int prev_handle_storage_index_ {-1}; void *thread_ = nullptr; }; @@ -231,15 +231,15 @@ public: template inline Local Escape(Local current) { - ASSERT(!alreadyEscape_); - alreadyEscape_ = true; - *(reinterpret_cast(escapeHandle_)) = **current; - return Local(escapeHandle_); + ASSERT(!already_escape_); + already_escape_ = true; + *(reinterpret_cast(escape_handle_)) = **current; + return Local(escape_handle_); } private: - bool alreadyEscape_ = false; - uintptr_t escapeHandle_ = 0U; + bool already_escape_ = false; + uintptr_t escape_handle_ = 0U; }; class PUBLIC_API JSExecutionScope { @@ -404,9 +404,9 @@ public: writable_(w), enumerable_(e), configurable_(c), - hasWritable_(true), - hasEnumerable_(true), - hasConfigurable_(true) + has_writable_(true), + has_enumerable_(true), + has_configurable_(true) { } ~PropertyAttribute() = default; @@ -418,7 +418,7 @@ public: void SetWritable(bool flag) { writable_ = flag; - hasWritable_ = true; + has_writable_ = true; } bool IsEnumerable() const { @@ -427,7 +427,7 @@ public: void SetEnumerable(bool flag) { enumerable_ = flag; - hasEnumerable_ = true; + has_enumerable_ = true; } bool IsConfigurable() const { @@ -436,19 +436,19 @@ public: void SetConfigurable(bool flag) { configurable_ = flag; - hasConfigurable_ = true; + has_configurable_ = true; } bool HasWritable() const { - return hasWritable_; + return has_writable_; } bool HasConfigurable() const { - return hasConfigurable_; + return has_configurable_; } bool HasEnumerable() const { - return hasEnumerable_; + return has_enumerable_; } Local GetValue(const EcmaVM *vm) const { @@ -503,9 +503,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; }; class PUBLIC_API ObjectRef : public JSValueRef { @@ -714,8 +714,8 @@ using LOG_PRINT = int (*)(int id, int level, const char *tag, const char *fmt, c class PUBLIC_API RuntimeOption { public: - enum class PUBLIC_API GC_TYPE : uint8_t { EPSILON, GEN_GC, STW, G1_GC }; - enum class PUBLIC_API LOG_LEVEL : uint8_t { + enum class PUBLIC_API GcType : uint8_t { EPSILON, GEN_GC, STW, G1_GC }; + enum class PUBLIC_API LogLevel : uint8_t { DEBUG = 3, INFO = 4, WARN = 5, @@ -723,56 +723,56 @@ public: FATAL = 7, }; - void SetGcType(GC_TYPE type) + void SetGcType(GcType type) { - gcType_ = type; + gc_type_ = type; } void SetGcPoolSize(uint32_t size) { - gcPoolSize_ = size; + gc_pool_size_ = size; } - void SetLogLevel(LOG_LEVEL logLevel) + void SetLogLevel(LogLevel logLevel) { - logLevel_ = logLevel; + log_level_ = logLevel; } void SetLogBufPrint(LOG_PRINT out) { - logBufPrint_ = out; + log_buf_print_ = out; } void SetDebuggerLibraryPath(const std::string &path) { - debuggerLibraryPath_ = path; + debugger_library_path_ = path; } void SetEnableArkTools(bool value) { - enableArkTools_ = value; + enable_ark_tools_ = value; } void SetArkProperties(int prop) { - arkProperties_ = prop; + ark_properties_ = prop; } private: std::string GetGcType() const { std::string gcType; - switch (gcType_) { - case GC_TYPE::GEN_GC: + switch (gc_type_) { + case GcType::GEN_GC: gcType = "gen-gc"; break; - case GC_TYPE::STW: + case GcType::STW: gcType = "stw"; break; - case GC_TYPE::EPSILON: + case GcType::EPSILON: gcType = "epsilon"; break; - case GC_TYPE::G1_GC: + case GcType::G1_GC: gcType = "g1-gc"; break; default: @@ -784,18 +784,18 @@ private: std::string GetLogLevel() const { std::string logLevel; - switch (logLevel_) { - case LOG_LEVEL::INFO: - case LOG_LEVEL::WARN: + switch (log_level_) { + case LogLevel::INFO: + case LogLevel::WARN: logLevel = "info"; break; - case LOG_LEVEL::ERROR: + case LogLevel::ERROR: logLevel = "error"; break; - case LOG_LEVEL::FATAL: + case LogLevel::FATAL: logLevel = "fatal"; break; - case LOG_LEVEL::DEBUG: + case LogLevel::DEBUG: default: logLevel = "debug"; break; @@ -806,48 +806,48 @@ private: uint32_t GetGcPoolSize() const { - return gcPoolSize_; + return gc_pool_size_; } LOG_PRINT GetLogBufPrint() const { - return logBufPrint_; + return log_buf_print_; } std::string GetDebuggerLibraryPath() const { - return debuggerLibraryPath_; + return debugger_library_path_; } bool GetEnableArkTools() const { - return enableArkTools_; + return enable_ark_tools_; } int GetArkProperties() const { - return arkProperties_; + return ark_properties_; } - GC_TYPE gcType_ = GC_TYPE::EPSILON; - LOG_LEVEL logLevel_ = LOG_LEVEL::DEBUG; - uint32_t gcPoolSize_ = DEFAULT_GC_POOL_SIZE; - LOG_PRINT logBufPrint_ {nullptr}; - std::string debuggerLibraryPath_ {}; - bool enableArkTools_ {false}; - int arkProperties_ {-1}; + GcType gc_type_ = GcType::EPSILON; + LogLevel log_level_ = LogLevel::DEBUG; + uint32_t gc_pool_size_ = DEFAULT_GC_POOL_SIZE; + LOG_PRINT log_buf_print_ {nullptr}; + std::string debugger_library_path_ {}; + bool enable_ark_tools_ {false}; + int ark_properties_ {-1}; friend JSNApi; }; class PUBLIC_API PromiseRejectInfo { public: - enum class PUBLIC_API PROMISE_REJECTION_EVENT : uint32_t { REJECT = 0, HANDLE }; + enum class PUBLIC_API PromiseRejectionEvent : uint32_t { REJECT = 0, HANDLE }; PromiseRejectInfo(Local promise, Local reason, - PromiseRejectInfo::PROMISE_REJECTION_EVENT operation, void *data); + PromiseRejectInfo::PromiseRejectionEvent operation, void *data); ~PromiseRejectInfo() = default; Local GetPromise() const; Local GetReason() const; - PromiseRejectInfo::PROMISE_REJECTION_EVENT GetOperation() const; + PromiseRejectInfo::PromiseRejectionEvent GetOperation() const; void *GetData() const; DEFAULT_MOVE_SEMANTIC(PromiseRejectInfo); @@ -856,14 +856,14 @@ public: private: Local promise_ {}; Local reason_ {}; - PROMISE_REJECTION_EVENT operation_ = PROMISE_REJECTION_EVENT::REJECT; + PromiseRejectionEvent operation_ = PromiseRejectionEvent::REJECT; void *data_ {nullptr}; }; class PUBLIC_API JSNApi { public: // JSVM - enum class PUBLIC_API TRIGGER_GC_TYPE : uint8_t { SEMI_GC, OLD_GC, COMPRESS_FULL_GC }; + enum class PUBLIC_API TriggerGcType : uint8_t { SEMI_GC, OLD_GC, COMPRESS_FULL_GC }; static EcmaVM *CreateJSVM(const RuntimeOption &option); static void DestroyJSVM(EcmaVM *ecmaVm); @@ -878,7 +878,7 @@ public: static void ExecutePendingJob(const EcmaVM *vm); // Memory - static void TriggerGC(const EcmaVM *vm, TRIGGER_GC_TYPE gcType = TRIGGER_GC_TYPE::SEMI_GC); + static void TriggerGC(const EcmaVM *vm, TriggerGcType gcType = TriggerGcType::SEMI_GC); // Exception static void ThrowException(const EcmaVM *vm, Local error); static Local GetUncaughtException(const EcmaVM *vm); diff --git a/runtime/napi/jsnapi.cpp b/runtime/napi/jsnapi.cpp index 454a4edf222d343848ca039b1a0f0c00729309fb..d65fcf10bc43f9f858cc4adeb47ed778dc7c3255 100644 --- a/runtime/napi/jsnapi.cpp +++ b/runtime/napi/jsnapi.cpp @@ -112,7 +112,7 @@ constexpr std::string_view ENTRY_POINTER = "_GLOBAL::func_main_0"; class JSNDebuggerAgent : public LibraryAgent, public LibraryAgentLoader { public: JSNDebuggerAgent(os::memory::Mutex &mutex, const char *libraryPath, EcmaVM *vm, bool isDebugMode) - : LibraryAgent(mutex, libraryPath, "StartDebug", "StopDebug"), vm_(vm), isDebugMode_(isDebugMode) + : LibraryAgent(mutex, libraryPath, "StartDebug", "StopDebug"), vm_(vm), is_debug_mode_(isDebugMode) { } @@ -122,7 +122,7 @@ private: ASSERT(resolvedFunction); using StartDebugger = bool (*)(const std::string &, EcmaVM *, bool); - if (!reinterpret_cast(resolvedFunction)("PandaDebugger", vm_, isDebugMode_)) { + if (!reinterpret_cast(resolvedFunction)("PandaDebugger", vm_, is_debug_mode_)) { LOG_ECMA(ERROR) << "'StartDebug' has failed"; return false; } @@ -141,7 +141,7 @@ private: } EcmaVM *vm_; - bool isDebugMode_; + bool is_debug_mode_; }; LoadableAgentHandle s_debugger_agent; // NOLINT(fuchsia-statically-constructed-objects) @@ -230,18 +230,18 @@ void JSNApi::DestroyJSVM(EcmaVM *ecmaVm) } } -void JSNApi::TriggerGC(const EcmaVM *vm, TRIGGER_GC_TYPE gcType) +void JSNApi::TriggerGC(const EcmaVM *vm, TriggerGcType gcType) { if (vm->GetJSThread() != nullptr && vm->IsInitialized()) { ScopedManagedCodeThread s(vm->GetAssociatedThread()); switch (gcType) { - case TRIGGER_GC_TYPE::SEMI_GC: + case TriggerGcType::SEMI_GC: vm->CollectGarbage(ecmascript::TriggerGCType::SEMI_GC); break; - case TRIGGER_GC_TYPE::OLD_GC: + case TriggerGcType::OLD_GC: vm->CollectGarbage(ecmascript::TriggerGCType::OLD_GC); break; - case TRIGGER_GC_TYPE::COMPRESS_FULL_GC: + case TriggerGcType::COMPRESS_FULL_GC: vm->CollectGarbage(ecmascript::TriggerGCType::COMPRESS_FULL_GC); break; default: @@ -399,7 +399,7 @@ void HostPromiseRejectionTracker(const EcmaVM *vm, const JSHandle pro if (promiseRejectCallback != nullptr) { Local promiseVal = JSNApiHelper::ToLocal(JSHandle::Cast(promise)); PromiseRejectInfo promiseRejectInfo(promiseVal, JSNApiHelper::ToLocal(reason), - static_cast(operation), data); + static_cast(operation), data); promiseRejectCallback(reinterpret_cast(&promiseRejectInfo)); } } @@ -420,7 +420,7 @@ void JSNApi::SetHostEnqueueJob(const EcmaVM *vm, Local cb) } PromiseRejectInfo::PromiseRejectInfo(Local promise, Local reason, - PromiseRejectInfo::PROMISE_REJECTION_EVENT operation, void *data) + PromiseRejectInfo::PromiseRejectionEvent operation, void *data) : promise_(promise), reason_(reason), operation_(operation), data_(data) { } @@ -435,7 +435,7 @@ Local PromiseRejectInfo::GetReason() const return reason_; } -PromiseRejectInfo::PROMISE_REJECTION_EVENT PromiseRejectInfo::GetOperation() const +PromiseRejectInfo::PromiseRejectionEvent PromiseRejectInfo::GetOperation() const { return operation_; } @@ -478,9 +478,9 @@ Local JSNApi::GetExportObject(EcmaVM *vm, const std::string &file, co LocalScope::LocalScope(const EcmaVM *vm) : thread_(vm->GetJSThread()) { auto thread = reinterpret_cast(thread_); - prevNext_ = thread->GetHandleScopeStorageNext(); - prevEnd_ = thread->GetHandleScopeStorageEnd(); - prevHandleStorageIndex_ = thread->GetCurrentHandleStorageIndex(); + prev_next_ = thread->GetHandleScopeStorageNext(); + prev_end_ = thread->GetHandleScopeStorageEnd(); + prev_handle_storage_index_ = thread->GetCurrentHandleStorageIndex(); thread->HandleScopeCountAdd(); } @@ -488,9 +488,9 @@ LocalScope::LocalScope(const EcmaVM *vm, JSTaggedType value) : thread_(vm->GetJS { auto thread = reinterpret_cast(thread_); ecmascript::EcmaHandleScope::NewHandle(thread, value); - prevNext_ = thread->GetHandleScopeStorageNext(); - prevEnd_ = thread->GetHandleScopeStorageEnd(); - prevHandleStorageIndex_ = thread->GetCurrentHandleStorageIndex(); + prev_next_ = thread->GetHandleScopeStorageNext(); + prev_end_ = thread->GetHandleScopeStorageEnd(); + prev_handle_storage_index_ = thread->GetCurrentHandleStorageIndex(); thread->HandleScopeCountAdd(); } @@ -498,10 +498,10 @@ LocalScope::~LocalScope() { auto thread = reinterpret_cast(thread_); thread->HandleScopeCountDec(); - thread->SetHandleScopeStorageNext(static_cast(prevNext_)); - if (thread->GetHandleScopeStorageEnd() != prevEnd_) { - thread->SetHandleScopeStorageEnd(static_cast(prevEnd_)); - thread->ShrinkHandleStorage(prevHandleStorageIndex_); + thread->SetHandleScopeStorageNext(static_cast(prev_next_)); + if (thread->GetHandleScopeStorageEnd() != prev_end_) { + thread->SetHandleScopeStorageEnd(static_cast(prev_end_)); + thread->ShrinkHandleStorage(prev_handle_storage_index_); } } @@ -510,7 +510,7 @@ EscapeLocalScope::EscapeLocalScope(const EcmaVM *vm) : LocalScope(vm, 0U) { auto thread = vm->GetJSThread(); // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) - escapeHandle_ = ToUintPtr(thread->GetHandleScopeStorageNext() - 1); + escape_handle_ = ToUintPtr(thread->GetHandleScopeStorageNext() - 1); } // ----------------------------------- NumberRef --------------------------------------- diff --git a/runtime/object_factory-inl.h b/runtime/object_factory-inl.h index d32e1cf65c466432b2b46c22643d521987bed47a..d2598f13a86f8b4fd9f82497cce6bad2e7d6c611 100644 --- a/runtime/object_factory-inl.h +++ b/runtime/object_factory-inl.h @@ -25,13 +25,13 @@ 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, @@ -40,9 +40,9 @@ JSHandle ObjectFactory::NewJSNativePointer(void *externalPointe NewObjectHook(); TaggedObject *header; if (nonMovable) { - header = heapHelper_.AllocateNonMovableOrHugeObject(jsNativePointerClass_); + 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); @@ -55,7 +55,7 @@ LexicalEnv *ObjectFactory::InlineNewLexicalEnv(int numSlots) { NewObjectHook(); size_t size = LexicalEnv::ComputeSize(numSlots); - auto header = heapHelper_.AllocateYoungGenerationOrHugeObject(envClass_, size); + auto header = heap_helper_.AllocateYoungGenerationOrHugeObject(env_class_, size); if (UNLIKELY(header == nullptr)) { return nullptr; } diff --git a/runtime/object_factory.cpp b/runtime/object_factory.cpp index 2095e362a6b91b6036065c654c04f793d73de376..20fd2735065bfad1ab683a5001aac45088a366eb 100644 --- a/runtime/object_factory.cpp +++ b/runtime/object_factory.cpp @@ -92,7 +92,7 @@ using ErrorType = base::ErrorType; using ErrorHelper = base::ErrorHelper; ObjectFactory::ObjectFactory(JSThread *thread, Heap *heap) - : thread_(thread), heapHelper_(heap), vm_(thread->GetEcmaVM()), heap_(heap) + : thread_(thread), heap_helper_(heap), vm_(thread->GetEcmaVM()), heap_(heap) { } @@ -100,7 +100,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); @@ -111,7 +111,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); @@ -119,57 +119,58 @@ 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_none_field_class_ = + JSHClass::Cast(globalConst->GetFreeObjectWithNoneFieldClass().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()); + 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()); - machineCodeClass_ = JSHClass::Cast(globalConst->GetMachineCodeClass().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()); + machine_code_class_ = JSHClass::Cast(globalConst->GetMachineCodeClass().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) @@ -310,7 +311,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; } @@ -334,7 +335,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); @@ -399,7 +400,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); @@ -863,16 +864,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_one_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_none_field_class_); } else { LOG_ECMA(DEBUG) << "Fill free object size is smaller"; } @@ -883,7 +884,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); @@ -894,7 +895,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); } @@ -1231,7 +1232,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()); @@ -1241,7 +1242,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()); @@ -1314,7 +1315,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)); } @@ -1323,7 +1324,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; @@ -1332,7 +1333,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)); @@ -1351,7 +1352,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_); @@ -1364,7 +1365,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_); @@ -1377,7 +1378,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); @@ -1430,7 +1431,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()); @@ -1440,7 +1441,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); @@ -1458,7 +1459,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()); @@ -1469,7 +1470,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()); @@ -1481,7 +1482,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()); @@ -1491,7 +1492,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()); @@ -1502,7 +1503,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()); @@ -1514,7 +1515,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()); @@ -1528,10 +1529,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); @@ -1550,7 +1551,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); @@ -1579,7 +1580,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; @@ -1604,13 +1606,13 @@ JSHandle ObjectFactory::NewTaggedArray(uint32_t length, JSTaggedVal TaggedObject *header = nullptr; switch (spaceType) { case MemSpaceType::SEMI_SPACE: - header = heapHelper_.AllocateYoungGenerationOrHugeObject(arrayClass_, size); + header = heap_helper_.AllocateYoungGenerationOrHugeObject(array_class_, size); break; case MemSpaceType::OLD_SPACE: - header = heapHelper_.AllocateOldGenerationOrHugeObject(arrayClass_, size); + header = heap_helper_.AllocateOldGenerationOrHugeObject(array_class_, size); break; case MemSpaceType::NON_MOVABLE: - header = heapHelper_.AllocateNonMovableOrHugeObject(arrayClass_, size); + header = heap_helper_.AllocateNonMovableOrHugeObject(array_class_, size); break; default: UNREACHABLE(); @@ -1640,7 +1642,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); array->InitializeWithSpecialValue(initVal, length); return array; @@ -1652,7 +1654,7 @@ 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); @@ -1666,13 +1668,13 @@ JSHandle ObjectFactory::NewLinkedHashTable(array_size_t length, JST 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; @@ -1685,7 +1687,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); @@ -1715,7 +1717,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); @@ -1742,7 +1744,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); @@ -1796,7 +1798,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; @@ -1805,7 +1807,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()); @@ -1817,7 +1819,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; @@ -1843,7 +1845,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); @@ -1902,7 +1904,7 @@ EcmaString *ObjectFactory::GetRawStringFromStringTable(const uint8_t *mutf8Data, JSHandle ObjectFactory::NewPropertyBox(const JSHandle &value) { NewObjectHook(); - TaggedObject *header = heapHelper_.AllocateYoungGenerationOrHugeObject(PropertyBoxClass_); + TaggedObject *header = heap_helper_.AllocateYoungGenerationOrHugeObject(property_box_class_); JSHandle box(thread_, header); box->SetValue(thread_, value); return box; @@ -1911,7 +1913,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; @@ -1920,7 +1922,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)); @@ -1933,7 +1935,7 @@ JSHandle ObjectFactory::NewProfileTypeInfo(uint32_t length) ASSERT(length > 0); size_t size = TaggedArray::ComputeSize(JSTaggedValue::TaggedTypeSize(), length); - auto header = heapHelper_.AllocateNonMovableOrHugeObject(arrayClass_, size); + auto header = heap_helper_.AllocateNonMovableOrHugeObject(array_class_, size); JSHandle array(thread_, header); array->InitializeWithSpecialValue(JSTaggedValue::Undefined(), length); @@ -1962,7 +1964,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(); } @@ -2086,7 +2088,7 @@ JSHandle ObjectFactory::NewTransitionHandler() { NewObjectHook(); TransitionHandler *handler = - TransitionHandler::Cast(heapHelper_.AllocateYoungGenerationOrHugeObject(transitionHandlerClass_)); + TransitionHandler::Cast(heap_helper_.AllocateYoungGenerationOrHugeObject(transition_handler_class_)); return JSHandle(thread_, handler); } @@ -2094,7 +2096,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()); @@ -2105,7 +2107,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; @@ -2114,7 +2116,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()); @@ -2177,19 +2179,19 @@ EcmaString *ObjectFactory::ResolveString(uint32_t stringId) auto id = panda_file::File::EntityId(stringId); auto foundStr = pf->GetStringData(id); - return GetRawStringFromStringTable(foundStr.data, foundStr.utf16_length, foundStr.is_ascii); + return GetRawStringFromStringTable(foundStr.data_, foundStr.utf16_length_, foundStr.is_ascii_); } uintptr_t ObjectFactory::NewSpaceBySnapShotAllocator(size_t size) { NewObjectHook(); - return heapHelper_.AllocateSnapShotSpace(size); + return heap_helper_.AllocateSnapShotSpace(size); } JSHandle ObjectFactory::NewMachineCodeObject(size_t length, const uint8_t *data) { NewObjectHook(); - TaggedObject *obj = heapHelper_.AllocateMachineCodeSpaceObject(machineCodeClass_, length + MachineCode::SIZE); + TaggedObject *obj = heap_helper_.AllocateMachineCodeSpaceObject(machine_code_class_, length + MachineCode::SIZE); MachineCode *code = MachineCode::Cast(obj); code->SetInstructionSizeInBytes(thread_, JSTaggedValue(static_cast(length))); if (data != nullptr) { @@ -2202,7 +2204,7 @@ JSHandle ObjectFactory::NewMachineCodeObject(size_t length, const u 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 ae3cbe158923b562581469a258d87f970e20e808..717a5ebbca70c036d21f278c5d48563680e32bca 100644 --- a/runtime/object_factory.h +++ b/runtime/object_factory.h @@ -346,7 +346,7 @@ public: const MemManager &GetHeapManager() const { - return heapHelper_; + return heap_helper_; } // used for creating jsobject by constructor @@ -394,7 +394,7 @@ public: void SetTriggerGc(bool status) { - isTriggerGc_ = status; + is_trigger_gc_ = status; } private: @@ -408,53 +408,53 @@ 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 *machineCodeClass_ {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 *machine_code_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}; Heap *heap_ {nullptr}; diff --git a/runtime/object_operator.cpp b/runtime/object_operator.cpp index d8fc375bea62ff264ad178b1d1e8d541d27ad2a1..fa90e9b8c72c57520d01d83064c4c40d2fca44bd 100644 --- a/runtime/object_operator.cpp +++ b/runtime/object_operator.cpp @@ -36,7 +36,7 @@ void ObjectOperator::HandleKey(const JSHandle &key) if (key->IsInt()) { int32_t keyInt = key->GetInt(); if (keyInt >= 0) { - elementIndex_ = static_cast(keyInt); + element_index_ = static_cast(keyInt); return; } key_ = JSHandle::Cast(base::NumberHelper::NumberToString(thread_, JSTaggedValue(keyInt))); @@ -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); } @@ -539,7 +539,7 @@ bool ObjectOperator::AddProperty(const JSHandle &receiver, const JSHan PropertyAttributes attr) { if (IsElement()) { - return JSObject::AddElementInternal(thread_, receiver, elementIndex_, value, attr); + return JSObject::AddElementInternal(thread_, receiver, element_index_, value, attr); } ResetState(); @@ -612,10 +612,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; } } @@ -627,18 +627,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; diff --git a/runtime/object_operator.h b/runtime/object_operator.h index 10a850f3d512e4fe4da38df47171fa72a76c1bd5..c8b10466831703cb93e8fda031cdd94047af130f 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 @@ -298,10 +298,10 @@ private: 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/platform/platform.cpp b/runtime/platform/platform.cpp index e226a1f5654ca6c35575a2488c43fbc5f58b1a1f..112d0beda5e5870bf3b645f90f7037b4192c95bf 100644 --- a/runtime/platform/platform.cpp +++ b/runtime/platform/platform.cpp @@ -21,7 +21,7 @@ namespace panda::ecmascript { void Platform::Initialize(int threadNum) { os::memory::LockHolder lock(mutex_); - if (isInitialized_++ <= 0) { + if (is_initialized_++ <= 0) { runner_ = std::make_unique(TheMostSuitableThreadNum(threadNum)); } } @@ -29,11 +29,11 @@ void Platform::Initialize(int threadNum) void Platform::Destroy() { os::memory::LockHolder lock(mutex_); - if (isInitialized_ <= 0) { + if (is_initialized_ <= 0) { return; } - isInitialized_--; - if (isInitialized_ == 0) { + is_initialized_--; + if (is_initialized_ == 0) { runner_->TerminateThread(); } else { runner_->TerminateTask(); diff --git a/runtime/platform/platform.h b/runtime/platform/platform.h index 2a4f2b54ad00e891d0b9635bb854507f45bd55b6..077d9f96dbcd9ecb731604d0e056660bbc306901 100644 --- a/runtime/platform/platform.h +++ b/runtime/platform/platform.h @@ -35,7 +35,7 @@ public: { os::memory::LockHolder lock(mutex_); runner_->TerminateThread(); - isInitialized_ = 0; + is_initialized_ = 0; } NO_COPY_SEMANTIC(Platform); @@ -46,7 +46,7 @@ public: void PostTask(std::unique_ptr task) const { - ASSERT(isInitialized_ > 0); + ASSERT(is_initialized_ > 0); runner_->PostTask(std::move(task)); } @@ -64,7 +64,7 @@ private: uint32_t TheMostSuitableThreadNum(uint32_t threadNum) const; std::unique_ptr runner_; - int isInitialized_ = 0; + int is_initialized_ = 0; os::memory::Mutex mutex_; }; } // namespace panda::ecmascript diff --git a/runtime/platform/runner.cpp b/runtime/platform/runner.cpp index a70f59a9fbffeca4a18adfca4e3f0cdb905cbac6..e0bfb0faa203ce2e9b64e7c3639a3971a2d4e650 100644 --- a/runtime/platform/runner.cpp +++ b/runtime/platform/runner.cpp @@ -18,23 +18,23 @@ #include "os/thread.h" namespace panda::ecmascript { -Runner::Runner(uint32_t threadNum) : totalThreadNum_(threadNum) +Runner::Runner(uint32_t threadNum) : total_thread_num_(threadNum) { for (uint32_t i = 0; i < threadNum; i++) { // main thread is 0; std::unique_ptr thread = std::make_unique(&Runner::Run, this, i + 1); os::thread::SetThreadName(thread->native_handle(), "GC_WorkerThread"); - threadPool_.emplace_back(std::move(thread)); + thread_pool_.emplace_back(std::move(thread)); } - for (auto ¤t : runningTask_) { + for (auto ¤t : running_task_) { current = nullptr; } } void Runner::TerminateTask() { - for (auto ¤t : runningTask_) { + for (auto ¤t : running_task_) { auto val = current.load(); if (val != nullptr) { val->Terminated(); @@ -44,22 +44,22 @@ void Runner::TerminateTask() void Runner::TerminateThread() { - taskQueue_.Terminate(); + task_queue_.Terminate(); TerminateTask(); - int threadNum = threadPool_.size(); + int threadNum = thread_pool_.size(); for (int i = 0; i < threadNum; i++) { - threadPool_.at(i)->join(); + thread_pool_.at(i)->join(); } - threadPool_.clear(); + thread_pool_.clear(); } void Runner::Run(uint32_t threadId) { - while (std::unique_ptr task = taskQueue_.PopTask()) { - runningTask_[threadId].store(task.get()); + while (std::unique_ptr task = task_queue_.PopTask()) { + running_task_[threadId].store(task.get()); task->Run(threadId); - runningTask_[threadId].store(nullptr); + running_task_[threadId].store(nullptr); } } } // namespace panda::ecmascript diff --git a/runtime/platform/runner.h b/runtime/platform/runner.h index f5d5cca577628ae1a3f3e0a452f47062e4dd81b7..122ef1e01d947187469a501b707f7412f1490d88 100644 --- a/runtime/platform/runner.h +++ b/runtime/platform/runner.h @@ -37,7 +37,7 @@ public: void PostTask(std::unique_ptr task) { - taskQueue_.PostTask(std::move(task)); + task_queue_.PostTask(std::move(task)); } void TerminateThread(); @@ -45,12 +45,12 @@ public: uint32_t GetTotalThreadNum() const { - return totalThreadNum_; + return total_thread_num_; } bool IsInThreadPool(std::thread::id id) const { - for (auto &thread : threadPool_) { + for (auto &thread : thread_pool_) { if (thread->get_id() == id) { return true; } @@ -61,11 +61,11 @@ public: private: void Run(uint32_t threadId); - std::vector> threadPool_ {}; - TaskQueue taskQueue_ {}; - std::array, MAX_PLATFORM_THREAD_NUM + 1> runningTask_ {}; - uint32_t totalThreadNum_ {0}; - std::vector threadIdToIndexList_; + std::vector> thread_pool_ {}; + TaskQueue task_queue_ {}; + std::array, MAX_PLATFORM_THREAD_NUM + 1> running_task_ {}; + uint32_t total_thread_num_ {0}; + std::vector thread_id_to_index_list_; }; } // namespace panda::ecmascript diff --git a/runtime/regexp/dyn_chunk.cpp b/runtime/regexp/dyn_chunk.cpp index 3b415b9bf1f8be24891a894d1dc2d27356bf5347..d8955713441a59153e6c1e86161dd665da4dc807 100644 --- a/runtime/regexp/dyn_chunk.cpp +++ b/runtime/regexp/dyn_chunk.cpp @@ -19,12 +19,12 @@ namespace panda::ecmascript { int DynChunk::Expand(size_t newSize) { - if (newSize > allocatedSize_) { + if (newSize > allocated_size_) { if (error_) { return FAILURE; } - ASSERT(allocatedSize_ <= std::numeric_limits::max() / ALLOCATE_MULTIPLIER); - size_t size = allocatedSize_ * ALLOCATE_MULTIPLIER; + ASSERT(allocated_size_ <= std::numeric_limits::max() / ALLOCATE_MULTIPLIER); + size_t size = allocated_size_ * ALLOCATE_MULTIPLIER; if (size > newSize) { newSize = size; } @@ -45,7 +45,7 @@ int DynChunk::Expand(size_t newSize) } } buf_ = newBuf; - allocatedSize_ = newSize; + allocated_size_ = newSize; } return SUCCESS; } @@ -69,7 +69,7 @@ int DynChunk::Insert(uint32_t position, size_t len) int DynChunk::Emit(const uint8_t *data, size_t length) { - if (UNLIKELY((size_ + length) > allocatedSize_)) { + if (UNLIKELY((size_ + length) > allocated_size_)) { if (Expand(size_ + length) != 0) { return FAILURE; } @@ -90,7 +90,7 @@ int DynChunk::EmitChar(uint8_t c) int DynChunk::EmitSelf(size_t offset, size_t length) { - if (UNLIKELY((size_ + length) > allocatedSize_)) { + if (UNLIKELY((size_ + length) > allocated_size_)) { if (Expand(size_ + length) != 0) { return FAILURE; } diff --git a/runtime/regexp/dyn_chunk.h b/runtime/regexp/dyn_chunk.h index 61646def712be2e2306263fe4751a8e6c8278a9b..0d03bdb33489fc5ed8b06fcce89b7d56b9fd07cf 100644 --- a/runtime/regexp/dyn_chunk.h +++ b/runtime/regexp/dyn_chunk.h @@ -77,7 +77,7 @@ public: inline size_t GetAllocatedSize() const { - return allocatedSize_; + return allocated_size_; } inline bool GetError() const @@ -142,7 +142,7 @@ private: uint8_t *buf_ {nullptr}; size_t size_ {0}; - size_t allocatedSize_ {0}; + size_t allocated_size_ {0}; bool error_ {false}; Chunk *chunk_ {nullptr}; }; diff --git a/runtime/regexp/regexp_executor.cpp b/runtime/regexp/regexp_executor.cpp index 292c0194895c51af2efb5f04c7979e70c665c24e..e9bb8a5942e52302c86b3d26a273901d83f83461 100644 --- a/runtime/regexp/regexp_executor.cpp +++ b/runtime/regexp/regexp_executor.cpp @@ -28,27 +28,27 @@ bool RegExpExecutor::Execute(const uint8_t *input, uint32_t lastIndex, uint32_t DynChunk buffer(buf, chunk_); input_ = const_cast(input); // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) - inputEnd_ = const_cast(input + length * (isWideChar ? WIDE_CHAR_SIZE : CHAR_SIZE)); + input_end_ = const_cast(input + length * (isWideChar ? WIDE_CHAR_SIZE : CHAR_SIZE)); uint32_t size = buffer.GetU32(0); - nCapture_ = buffer.GetU32(RegExpParser::NUM_CAPTURE__OFFSET); - nStack_ = buffer.GetU32(RegExpParser::NUM_STACK_OFFSET); + n_capture_ = buffer.GetU32(RegExpParser::NUM_CAPTURE__OFFSET); + n_stack_ = buffer.GetU32(RegExpParser::NUM_STACK_OFFSET); flags_ = buffer.GetU32(RegExpParser::FLAGS_OFFSET); - isWideChar_ = isWideChar; + is_wide_char_ = isWideChar; - uint32_t captureResultSize = sizeof(CaptureState) * nCapture_; - uint32_t stackSize = sizeof(uintptr_t) * nStack_; - stateSize_ = sizeof(RegExpState) + captureResultSize + stackSize; - stateStackLen_ = 0; + uint32_t captureResultSize = sizeof(CaptureState) * n_capture_; + uint32_t stackSize = sizeof(uintptr_t) * n_stack_; + state_size_ = sizeof(RegExpState) + captureResultSize + stackSize; + state_stack_len_ = 0; if (captureResultSize != 0) { - captureResultList_ = chunk_->NewArray(nCapture_); - if (memset_s(captureResultList_, captureResultSize, 0, captureResultSize) != EOK) { + capture_result_list_ = chunk_->NewArray(n_capture_); + if (memset_s(capture_result_list_, captureResultSize, 0, captureResultSize) != EOK) { LOG_ECMA(FATAL) << "memset_s failed"; UNREACHABLE(); } } if (stackSize != 0) { - stack_ = chunk_->NewArray(nStack_); + stack_ = chunk_->NewArray(n_stack_); if (memset_s(stack_, stackSize, 0, stackSize) != EOK) { LOG_ECMA(FATAL) << "memset_s failed"; UNREACHABLE(); @@ -68,7 +68,7 @@ bool RegExpExecutor::Execute(const uint8_t *input, uint32_t lastIndex, uint32_t bool RegExpExecutor::MatchFailed(bool isMatched) { while (true) { - if (stateStackLen_ == 0) { + if (state_stack_len_ == 0) { return true; } RegExpState *state = PeekRegExpState(); @@ -99,7 +99,7 @@ bool RegExpExecutor::MatchFailed(bool isMatched) bool RegExpExecutor::HandleFirstSplit() { - if (GetCurrentPC() == RegExpParser::OP_START_OFFSET && stateStackLen_ == 0 && + if (GetCurrentPC() == RegExpParser::OP_START_OFFSET && state_stack_len_ == 0 && (flags_ & RegExpParser::FLAG_STICKY) == 0) { if (IsEOF()) { if (MatchFailed()) { @@ -166,9 +166,9 @@ bool RegExpExecutor::HandleOpWordBoundary(uint8_t opCode) bool preIsWord = false; if (GetCurrentPtr() != input_) { // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) - preIsWord = IsWordChar(PeekPrevChar(currentPtr_, input_)); + preIsWord = IsWordChar(PeekPrevChar(current_ptr_, input_)); } - bool currentIsWord = IsWordChar(PeekChar(currentPtr_, inputEnd_)); + bool currentIsWord = IsWordChar(PeekChar(current_ptr_, input_end_)); if (((opCode == RegExpOpCode::OP_WORD_BOUNDARY) && ((!preIsWord && currentIsWord) || (preIsWord && !currentIsWord))) || ((opCode == RegExpOpCode::OP_NOT_WORD_BOUNDARY) && @@ -189,7 +189,7 @@ bool RegExpExecutor::HandleOpLineStart(uint8_t opCode) } if ((GetCurrentPtr() == input_) || // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) - ((flags_ & RegExpParser::FLAG_MULTILINE) != 0 && PeekPrevChar(currentPtr_, input_) == '\n')) { + ((flags_ & RegExpParser::FLAG_MULTILINE) != 0 && PeekPrevChar(current_ptr_, input_) == '\n')) { Advance(opCode); } else { if (MatchFailed()) { @@ -203,7 +203,7 @@ bool RegExpExecutor::HandleOpLineEnd(uint8_t opCode) { if (IsEOF() || // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) - ((flags_ & RegExpParser::FLAG_MULTILINE) != 0 && PeekChar(currentPtr_, inputEnd_) == '\n')) { + ((flags_ & RegExpParser::FLAG_MULTILINE) != 0 && PeekChar(current_ptr_, input_end_) == '\n')) { Advance(opCode); } else { if (MatchFailed()) { @@ -216,20 +216,20 @@ bool RegExpExecutor::HandleOpLineEnd(uint8_t opCode) void RegExpExecutor::HandleOpSaveStart(const DynChunk &byteCode, uint8_t opCode) { uint32_t captureIndex = byteCode.GetU8(GetCurrentPC() + 1); - ASSERT(captureIndex < nCapture_); + ASSERT(captureIndex < n_capture_); // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) - CaptureState *captureState = &captureResultList_[captureIndex]; - captureState->captureStart = GetCurrentPtr(); + CaptureState *captureState = &capture_result_list_[captureIndex]; + captureState->capture_start_ = GetCurrentPtr(); Advance(opCode); } void RegExpExecutor::HandleOpSaveEnd(const DynChunk &byteCode, uint8_t opCode) { uint32_t captureIndex = byteCode.GetU8(GetCurrentPC() + 1); - ASSERT(captureIndex < nCapture_); + ASSERT(captureIndex < n_capture_); // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) - CaptureState *captureState = &captureResultList_[captureIndex]; - captureState->captureEnd = GetCurrentPtr(); + CaptureState *captureState = &capture_result_list_[captureIndex]; + captureState->capture_end_ = GetCurrentPtr(); Advance(opCode); } @@ -238,9 +238,10 @@ void RegExpExecutor::HandleOpSaveReset(const DynChunk &byteCode, uint8_t opCode) uint32_t catpureStartIndex = byteCode.GetU8(GetCurrentPC() + SAVE_RESET_START); uint32_t catpureEndIndex = byteCode.GetU8(GetCurrentPC() + SAVE_RESET_END); for (uint32_t i = catpureStartIndex; i <= catpureEndIndex; i++) { - CaptureState *captureState = &captureResultList_[i]; // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic) - captureState->captureStart = nullptr; - captureState->captureEnd = nullptr; + CaptureState *captureState = + &capture_result_list_[i]; // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic) + captureState->capture_start_ = nullptr; + captureState->capture_end_ = nullptr; } Advance(opCode); } @@ -270,7 +271,7 @@ bool RegExpExecutor::HandleOpPrev(uint8_t opCode) return false; } } else { - PrevPtr(¤tPtr_, input_); + PrevPtr(¤t_ptr_, input_); Advance(opCode); } return true; @@ -392,13 +393,13 @@ bool RegExpExecutor::HandleOpRange(const DynChunk &byteCode) bool RegExpExecutor::HandleOpBackReference(const DynChunk &byteCode, uint8_t opCode) { uint32_t captureIndex = byteCode.GetU8(GetCurrentPC() + 1); - if (captureIndex >= nCapture_) { + if (captureIndex >= n_capture_) { return !MatchFailed(); } // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) - const uint8_t *captureStart = captureResultList_[captureIndex].captureStart; + const uint8_t *captureStart = capture_result_list_[captureIndex].capture_start_; // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) - const uint8_t *captureEnd = captureResultList_[captureIndex].captureEnd; + const uint8_t *captureEnd = capture_result_list_[captureIndex].capture_end_; if (captureStart == nullptr || captureEnd == nullptr) { Advance(opCode); return true; @@ -414,7 +415,7 @@ bool RegExpExecutor::HandleOpBackReference(const DynChunk &byteCode, uint8_t opC // NOLINTNEXTLINE(readability-identifier-naming) uint32_t c1 = GetChar(&refCptr, captureEnd); // NOLINTNEXTLINE(readability-identifier-naming) - uint32_t c2 = GetChar(¤tPtr_, inputEnd_); + uint32_t c2 = GetChar(¤t_ptr_, input_end_); if (IsIgnoreCase()) { c1 = RegExpParser::Canonicalize(c1, IsUtf16()); c2 = RegExpParser::Canonicalize(c2, IsUtf16()); @@ -441,7 +442,7 @@ bool RegExpExecutor::HandleOpBackReference(const DynChunk &byteCode, uint8_t opC // NOLINTNEXTLINE(readability-identifier-naming) uint32_t c1 = GetPrevChar(&refCptr, captureStart); // NOLINTNEXTLINE(readability-identifier-naming) - uint32_t c2 = GetPrevChar(¤tPtr_, input_); + uint32_t c2 = GetPrevChar(¤t_ptr_, input_); if (IsIgnoreCase()) { c1 = RegExpParser::Canonicalize(c1, IsUtf16()); c2 = RegExpParser::Canonicalize(c2, IsUtf16()); @@ -586,12 +587,13 @@ bool RegExpExecutor::ExecuteInternal(const DynChunk &byteCode, uint32_t pcEnd) void RegExpExecutor::DumpResult(std::ostream &out) const { out << "captures:" << std::endl; - for (uint32_t i = 0; i < nCapture_; i++) { + for (uint32_t i = 0; i < n_capture_; i++) { // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) - CaptureState *captureState = &captureResultList_[i]; - int32_t len = captureState->captureEnd - captureState->captureStart; - if ((captureState->captureStart != nullptr && captureState->captureEnd != nullptr) && (len >= 0)) { - out << i << ":\t" << CString(reinterpret_cast(captureState->captureStart), len) << std::endl; + CaptureState *captureState = &capture_result_list_[i]; + int32_t len = captureState->capture_end_ - captureState->capture_start_; + if ((captureState->capture_start_ != nullptr && captureState->capture_end_ != nullptr) && (len >= 0)) { + out << i << ":\t" << CString(reinterpret_cast(captureState->capture_start_), len) + << std::endl; } else { out << i << ":\t" << "undefined" << std::endl; @@ -604,30 +606,30 @@ MatchResult RegExpExecutor::GetResult(const JSThread *thread, bool isSuccess) co ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); MatchResult result; std::vector>> captures; - result.isSuccess_ = isSuccess; + result.is_success_ = isSuccess; if (isSuccess) { - for (uint32_t i = 0; i < nCapture_; i++) { + for (uint32_t i = 0; i < n_capture_; i++) { // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) - CaptureState *captureState = &captureResultList_[i]; + CaptureState *captureState = &capture_result_list_[i]; if (i == 0) { - result.index_ = captureState->captureStart - input_; - if (isWideChar_) { + result.index_ = captureState->capture_start_ - input_; + if (is_wide_char_) { result.index_ /= WIDE_CHAR_SIZE; } } - int32_t len = captureState->captureEnd - captureState->captureStart; + int32_t len = captureState->capture_end_ - captureState->capture_start_; std::pair> pair; - if ((captureState->captureStart != nullptr && captureState->captureEnd != nullptr) && (len >= 0)) { + if ((captureState->capture_start_ != nullptr && captureState->capture_end_ != nullptr) && (len >= 0)) { pair.first = false; - if (isWideChar_) { + if (is_wide_char_) { // create utf-16 string pair.second = factory->NewFromUtf16UnCheck( - reinterpret_cast(captureState->captureStart), len / 2, false); + reinterpret_cast(captureState->capture_start_), len / 2, false); } else { // create utf-8 string CVector buffer(len + 1); uint8_t *dest = buffer.data(); - if (memcpy_s(dest, len + 1, reinterpret_cast(captureState->captureStart), len) != + if (memcpy_s(dest, len + 1, reinterpret_cast(captureState->capture_start_), len) != EOK) { LOG_ECMA(FATAL) << "memcpy_s failed"; UNREACHABLE(); @@ -643,9 +645,9 @@ MatchResult RegExpExecutor::GetResult(const JSThread *thread, bool isSuccess) co captures.emplace_back(pair); } result.captures_ = captures; - result.endIndex_ = currentPtr_ - input_; - if (isWideChar_) { - result.endIndex_ /= WIDE_CHAR_SIZE; + result.end_index_ = current_ptr_ - input_; + if (is_wide_char_) { + result.end_index_ /= WIDE_CHAR_SIZE; } } return result; @@ -653,56 +655,56 @@ MatchResult RegExpExecutor::GetResult(const JSThread *thread, bool isSuccess) co void RegExpExecutor::PushRegExpState(StateType type, uint32_t pc) { - ReAllocStack(stateStackLen_ + 1); + ReAllocStack(state_stack_len_ + 1); auto state = - reinterpret_cast(stateStack_ + // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic) - stateStackLen_ * stateSize_); + reinterpret_cast(state_stack_ + // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic) + state_stack_len_ * state_size_); state->type_ = type; - state->currentPc_ = pc; - state->currentStack_ = currentStack_; - state->currentPtr_ = GetCurrentPtr(); - size_t listSize = sizeof(CaptureState) * nCapture_; - if (memcpy_s(state->captureResultList_, listSize, GetCaptureResultList(), listSize) != EOK) { + state->current_pc_ = pc; + state->current_stack_ = current_stack_; + state->current_ptr_ = GetCurrentPtr(); + size_t listSize = sizeof(CaptureState) * n_capture_; + if (memcpy_s(state->capture_result_list_, listSize, GetCaptureResultList(), listSize) != EOK) { LOG_ECMA(FATAL) << "memcpy_s failed"; UNREACHABLE(); } uint8_t *stackStart = // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) - reinterpret_cast(state->captureResultList_) + sizeof(CaptureState) * nCapture_; + reinterpret_cast(state->capture_result_list_) + sizeof(CaptureState) * n_capture_; if (stack_ != nullptr) { - size_t stackSize = sizeof(uintptr_t) * nStack_; + size_t stackSize = sizeof(uintptr_t) * n_stack_; if (memcpy_s(stackStart, stackSize, stack_, stackSize) != EOK) { LOG_ECMA(FATAL) << "memcpy_s failed"; UNREACHABLE(); } } - stateStackLen_++; + state_stack_len_++; } RegExpState *RegExpExecutor::PopRegExpState(bool copyCaptrue) { - if (stateStackLen_ != 0) { + if (state_stack_len_ != 0) { auto state = PeekRegExpState(); - size_t listSize = sizeof(CaptureState) * nCapture_; + size_t listSize = sizeof(CaptureState) * n_capture_; if (copyCaptrue) { - if (memcpy_s(GetCaptureResultList(), listSize, state->captureResultList_, listSize) != EOK) { + if (memcpy_s(GetCaptureResultList(), listSize, state->capture_result_list_, listSize) != EOK) { LOG_ECMA(FATAL) << "memcpy_s failed"; UNREACHABLE(); } } - SetCurrentPtr(state->currentPtr_); - SetCurrentPC(state->currentPc_); - currentStack_ = state->currentStack_; + SetCurrentPtr(state->current_ptr_); + SetCurrentPC(state->current_pc_); + current_stack_ = state->current_stack_; // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) - uint8_t *stackStart = reinterpret_cast(state->captureResultList_) + listSize; + uint8_t *stackStart = reinterpret_cast(state->capture_result_list_) + listSize; if (stack_ != nullptr) { - size_t stackSize = sizeof(uintptr_t) * nStack_; + size_t stackSize = sizeof(uintptr_t) * n_stack_; if (memcpy_s(stack_, stackSize, stackStart, stackSize) != EOK) { LOG_ECMA(FATAL) << "memcpy_s failed"; UNREACHABLE(); } } - stateStackLen_--; + state_stack_len_--; return state; } return nullptr; @@ -710,22 +712,22 @@ RegExpState *RegExpExecutor::PopRegExpState(bool copyCaptrue) void RegExpExecutor::ReAllocStack(uint32_t stackLen) { - if (stackLen > stateStackSize_) { - uint32_t newStackSize = std::max(stateStackSize_ * 2, MIN_STACK_SIZE); // 2: double the size - uint32_t stackByteSize = newStackSize * stateSize_; + if (stackLen > state_stack_size_) { + uint32_t newStackSize = std::max(state_stack_size_ * 2, MIN_STACK_SIZE); // 2: double the size + uint32_t stackByteSize = newStackSize * state_size_; auto newStack = chunk_->NewArray(stackByteSize); if (memset_s(newStack, stackByteSize, 0, stackByteSize) != EOK) { LOG_ECMA(FATAL) << "memset_s failed"; UNREACHABLE(); } - if (stateStack_ != nullptr) { - size_t stackSize = stateStackSize_ * stateSize_; - if (memcpy_s(newStack, stackSize, stateStack_, stackSize) != EOK) { + if (state_stack_ != nullptr) { + size_t stackSize = state_stack_size_ * state_size_; + if (memcpy_s(newStack, stackSize, state_stack_, stackSize) != EOK) { return; } } - stateStack_ = newStack; - stateStackSize_ = newStackSize; + state_stack_ = newStack; + state_stack_size_ = newStackSize; } } } // namespace panda::ecmascript diff --git a/runtime/regexp/regexp_executor.h b/runtime/regexp/regexp_executor.h index bc5923343cf092de719542de6f8cdebb090cee7b..d0f14c2c47a440c7cbb3217b9335e75d6db34ffa 100644 --- a/runtime/regexp/regexp_executor.h +++ b/runtime/regexp/regexp_executor.h @@ -23,8 +23,8 @@ namespace panda::ecmascript { class RegExpExecutor { public: struct CaptureState { - const uint8_t *captureStart; - const uint8_t *captureEnd; + const uint8_t *capture_start_; + const uint8_t *capture_end_; }; enum StateType : uint8_t { @@ -35,18 +35,18 @@ public: struct RegExpState { StateType type_ = STATE_SPLIT; - uint32_t currentPc_ = 0; - uint32_t currentStack_ = 0; - const uint8_t *currentPtr_ = nullptr; - __extension__ CaptureState *captureResultList_[0]; // NOLINT(modernize-avoid-c-arrays) + uint32_t current_pc_ = 0; + uint32_t current_stack_ = 0; + const uint8_t *current_ptr_ = nullptr; + __extension__ CaptureState *capture_result_list_[0]; // NOLINT(modernize-avoid-c-arrays) }; struct MatchResult { - uint32_t endIndex_ = 0; + uint32_t end_index_ = 0; uint32_t index_ = 0; // first value is true if result is undefined std::vector>> captures_; - bool isSuccess_ = false; + bool is_success_ = false; }; explicit RegExpExecutor(Chunk *chunk) : chunk_(chunk) @@ -81,30 +81,30 @@ public: inline void Advance(uint8_t opCode, uint32_t offset = 0) { - currentPc_ += offset + RegExpOpCode::GetRegExpOpCode(opCode)->GetSize(); + current_pc_ += offset + RegExpOpCode::GetRegExpOpCode(opCode)->GetSize(); } inline void AdvanceOffset(uint32_t offset) { // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) - currentPc_ += offset; + current_pc_ += offset; } inline uint32_t GetCurrentChar() { - return GetChar(¤tPtr_, inputEnd_); + return GetChar(¤t_ptr_, input_end_); } inline void AdvanceCurrentPtr() { - AdvancePtr(¤tPtr_, inputEnd_); + AdvancePtr(¤t_ptr_, input_end_); } uint32_t GetChar(const uint8_t **pp, const uint8_t *end) const { uint32_t c; const uint8_t *cptr = *pp; - if (!isWideChar_) { + if (!is_wide_char_) { c = *cptr; *pp += 1; // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic) } else { @@ -127,7 +127,7 @@ public: { uint32_t c; const uint8_t *cptr = p; - if (!isWideChar_) { + if (!is_wide_char_) { c = *cptr; } else { uint16_t c1 = *(uint16_t *)cptr; // NOLINT(cppcoreguidelines-pro-type-cstyle-cast) @@ -146,7 +146,7 @@ public: void AdvancePtr(const uint8_t **pp, const uint8_t *end) const { const uint8_t *cptr = *pp; - if (!isWideChar_) { + if (!is_wide_char_) { *pp += 1; // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic) } else { uint16_t c1 = *(uint16_t *)cptr; // NOLINT(cppcoreguidelines-pro-type-cstyle-cast) @@ -165,7 +165,7 @@ public: { uint32_t c; const uint8_t *cptr = p; - if (!isWideChar_) { + if (!is_wide_char_) { c = *(cptr - 1); // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic) } else { cptr -= WIDE_CHAR_SIZE; // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic) @@ -186,7 +186,7 @@ public: { uint32_t c; const uint8_t *cptr = *pp; - if (!isWideChar_) { + if (!is_wide_char_) { c = *(cptr - 1); // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic) cptr -= 1; // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic) *pp = cptr; @@ -211,7 +211,7 @@ public: void PrevPtr(const uint8_t **pp, const uint8_t *start) const { const uint8_t *cptr = *pp; - if (!isWideChar_) { + if (!is_wide_char_) { cptr -= 1; // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic) *pp = cptr; } else { @@ -233,60 +233,60 @@ public: void SetCurrentPC(uint32_t pc) { - currentPc_ = pc; + current_pc_ = pc; } void SetCurrentPtr(const uint8_t *ptr) { - currentPtr_ = ptr; + current_ptr_ = ptr; } bool IsEOF() const { - return currentPtr_ >= inputEnd_; + return current_ptr_ >= input_end_; } uint32_t GetCurrentPC() const { - return currentPc_; + return current_pc_; } void PushStack(uintptr_t val) { - ASSERT(currentStack_ < nStack_); + ASSERT(current_stack_ < n_stack_); // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) - stack_[currentStack_++] = val; + stack_[current_stack_++] = val; } void SetStackValue(uintptr_t val) const { - ASSERT(currentStack_ >= 1); + ASSERT(current_stack_ >= 1); // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) - stack_[currentStack_ - 1] = val; + stack_[current_stack_ - 1] = val; } uintptr_t PopStack() { - ASSERT(currentStack_ >= 1); + ASSERT(current_stack_ >= 1); // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) - return stack_[--currentStack_]; + return stack_[--current_stack_]; } uintptr_t PeekStack() const { - ASSERT(currentStack_ >= 1); + ASSERT(current_stack_ >= 1); // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) - return stack_[currentStack_ - 1]; + return stack_[current_stack_ - 1]; } const uint8_t *GetCurrentPtr() const { - return currentPtr_; + return current_ptr_; } CaptureState *GetCaptureResultList() const { - return captureResultList_; + return capture_result_list_; } void DumpResult(std::ostream &out) const; @@ -299,14 +299,15 @@ public: void DropRegExpState() { - stateStackLen_--; + state_stack_len_--; } RegExpState *PeekRegExpState() const { - ASSERT(stateStackLen_ >= 1); - return reinterpret_cast(stateStack_ + // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic) - (stateStackLen_ - 1) * stateSize_); + ASSERT(state_stack_len_ >= 1); + return reinterpret_cast( + state_stack_ + // NOLINT(cppcoreguidelines-pro-bounds-pointer-arithmetic) + (state_stack_len_ - 1) * state_size_); } void ReAllocStack(uint32_t stackLen); @@ -348,23 +349,23 @@ private: static constexpr uint32_t STACK_MULTIPLIER = 2; static constexpr uint32_t MIN_STACK_SIZE = 8; uint8_t *input_ = nullptr; - uint8_t *inputEnd_ = nullptr; - bool isWideChar_ = false; + uint8_t *input_end_ = nullptr; + bool is_wide_char_ = false; - uint32_t currentPc_ = 0; - const uint8_t *currentPtr_ = nullptr; - CaptureState *captureResultList_ = nullptr; + uint32_t current_pc_ = 0; + const uint8_t *current_ptr_ = nullptr; + CaptureState *capture_result_list_ = nullptr; uintptr_t *stack_ = nullptr; - uint32_t currentStack_ = 0; + uint32_t current_stack_ = 0; - uint32_t nCapture_ = 0; - uint32_t nStack_ = 0; + uint32_t n_capture_ = 0; + uint32_t n_stack_ = 0; uint32_t flags_ = 0; - uint32_t stateStackLen_ = 0; - uint32_t stateStackSize_ = 0; - uint32_t stateSize_ = 0; - uint8_t *stateStack_ = nullptr; + uint32_t state_stack_len_ = 0; + uint32_t state_stack_size_ = 0; + uint32_t state_size_ = 0; + uint8_t *state_stack_ = nullptr; Chunk *chunk_ = nullptr; }; } // namespace panda::ecmascript diff --git a/runtime/regexp/regexp_opcode.cpp b/runtime/regexp/regexp_opcode.cpp index a25a6dbf538006bfdb568b77f6367303f040af96..4b3a6930e8c1c13bbe09d365eb5ba2c845dfe4e8 100644 --- a/runtime/regexp/regexp_opcode.cpp +++ b/runtime/regexp/regexp_opcode.cpp @@ -111,7 +111,7 @@ static std::vector g_intrinsicSet = { &g_range32Opcode, }; -RegExpOpCode::RegExpOpCode(uint8_t opCode, int size) : opCode_(opCode), size_(size) {} +RegExpOpCode::RegExpOpCode(uint8_t opCode, int size) : op_code_(opCode), size_(size) {} /* static */ RegExpOpCode *RegExpOpCode::GetRegExpOpCode(const DynChunk &buf, int pc) @@ -487,9 +487,9 @@ uint32_t RangeOpCode::DumpOpCode(std::ostream &out, const DynChunk &buf, uint32_ uint32_t RangeOpCode::InsertOpCode(DynChunk *buf, const RangeSet &rangeSet) const { buf->EmitChar(GetOpCode()); - size_t size = rangeSet.rangeSet_.size(); + size_t size = rangeSet.range_set_.size(); buf->EmitU16(size); - for (auto range : rangeSet.rangeSet_) { + for (auto range : rangeSet.range_set_) { buf->EmitU16(range.first); buf->EmitU16(range.second); } @@ -514,9 +514,9 @@ uint32_t Range32OpCode::DumpOpCode(std::ostream &out, const DynChunk &buf, uint3 uint32_t Range32OpCode::InsertOpCode(DynChunk *buf, const RangeSet &rangeSet) const { buf->EmitChar(GetOpCode()); - size_t size = rangeSet.rangeSet_.size(); + size_t size = rangeSet.range_set_.size(); buf->EmitU16(size); - for (auto range : rangeSet.rangeSet_) { + for (auto range : rangeSet.range_set_) { buf->EmitU32(range.first); buf->EmitU32(range.second); } @@ -595,10 +595,10 @@ void RangeSet::Insert(uint32_t start, uint32_t end) return; } std::pair pairElement = std::make_pair(start, end); - if (rangeSet_.empty()) { - rangeSet_.emplace_back(pairElement); + if (range_set_.empty()) { + range_set_.emplace_back(pairElement); } else { - for (auto iter = rangeSet_.begin(); iter != rangeSet_.end(); iter++) { + for (auto iter = range_set_.begin(); iter != range_set_.end(); iter++) { if (IsIntersect(start, end, iter->first, iter->second) || IsAdjacent(start, end, iter->first, iter->second)) { iter->first = std::min(iter->first, start); @@ -606,23 +606,23 @@ void RangeSet::Insert(uint32_t start, uint32_t end) return; } if (iter->first > end) { - rangeSet_.insert(iter, pairElement); + range_set_.insert(iter, pairElement); return; } } - rangeSet_.emplace_back(pairElement); + range_set_.emplace_back(pairElement); } } void RangeSet::Insert(const RangeSet &s1) { - if (s1.rangeSet_.empty()) { + if (s1.range_set_.empty()) { return; } - if (rangeSet_.empty()) { - rangeSet_ = s1.rangeSet_; + if (range_set_.empty()) { + range_set_ = s1.range_set_; } else { - for (auto range : s1.rangeSet_) { + for (auto range : s1.range_set_) { Insert(range.first, range.second); } Compress(); @@ -632,28 +632,28 @@ void RangeSet::Insert(const RangeSet &s1) void RangeSet::Invert(bool isUtf16) { uint32_t maxValue = isUtf16 ? UINT32_MAX : UINT16_MAX; - if (rangeSet_.empty()) { - rangeSet_.emplace_back(std::make_pair(0, maxValue)); + if (range_set_.empty()) { + range_set_.emplace_back(std::make_pair(0, maxValue)); return; } - auto iter = rangeSet_.begin(); - auto iter2 = rangeSet_.begin(); + auto iter = range_set_.begin(); + auto iter2 = range_set_.begin(); if (iter->first == 0 && iter->second == maxValue) { - rangeSet_.clear(); + range_set_.clear(); return; } iter2++; uint32_t first = iter->first; - for (iter = rangeSet_.begin(); iter != rangeSet_.end(); iter++) { + for (iter = range_set_.begin(); iter != range_set_.end(); iter++) { if (iter->second == maxValue) { - rangeSet_.erase(iter); + range_set_.erase(iter); break; } iter->first = iter->second + 1; - if (iter2 != rangeSet_.end()) { + if (iter2 != range_set_.end()) { iter->second = iter2->first - 1; iter2++; } else { @@ -662,22 +662,22 @@ void RangeSet::Invert(bool isUtf16) } if (first > 0) { std::pair pair1 = std::make_pair(0, first - 1); - rangeSet_.push_front(pair1); + range_set_.push_front(pair1); } Compress(); } void RangeSet::Compress() { - auto iter = rangeSet_.begin(); - auto iter2 = rangeSet_.begin(); + auto iter = range_set_.begin(); + auto iter2 = range_set_.begin(); iter2++; - while (iter2 != rangeSet_.end()) { + while (iter2 != range_set_.end()) { if (IsIntersect(iter->first, iter->second, iter2->first, iter2->second) || IsAdjacent(iter->first, iter->second, iter2->first, iter2->second)) { iter->first = std::min(iter->first, iter2->first); iter->second = std::max(iter->second, iter2->second); - iter2 = rangeSet_.erase(iter2); + iter2 = range_set_.erase(iter2); } else { iter++; iter2++; diff --git a/runtime/regexp/regexp_opcode.h b/runtime/regexp/regexp_opcode.h index 6cf830d096d6b676249cf30c8680daa8b149b934..aefbac1b2741be8c2fcc2f7dd30246765090756b 100644 --- a/runtime/regexp/regexp_opcode.h +++ b/runtime/regexp/regexp_opcode.h @@ -79,7 +79,7 @@ public: } inline uint8_t GetOpCode() const { - return opCode_; + return op_code_; } inline int GetDynChunkfSize(const DynChunk &buf) const { @@ -88,7 +88,7 @@ public: virtual uint32_t DumpOpCode(std::ostream &out, const DynChunk &buf, uint32_t offset) const = 0; private: - uint8_t opCode_ {0}; + uint8_t op_code_ {0}; uint8_t size_ {0}; }; @@ -316,7 +316,7 @@ public: } explicit RangeSet(const std::list> &rangeSet) { - rangeSet_ = rangeSet; + range_set_ = rangeSet; } ~RangeSet() = default; @@ -331,12 +331,12 @@ public: inline bool operator==(const RangeSet &other) const { - return rangeSet_ == other.rangeSet_; + return range_set_ == other.range_set_; } inline bool IsContain(uint32_t value) const { - for (auto range : rangeSet_) { + for (auto range : range_set_) { if (value >= range.first && value <= range.second) { return true; } @@ -346,8 +346,8 @@ public: inline uint32_t HighestValue() const { - if (!rangeSet_.empty()) { - return rangeSet_.back().second; + if (!range_set_.empty()) { + return range_set_.back().second; } return 0; } @@ -365,7 +365,7 @@ public: private: friend class RangeOpCode; friend class Range32OpCode; - std::list> rangeSet_ {}; + std::list> range_set_ {}; }; class RangeOpCode : public RegExpOpCode { diff --git a/runtime/regexp/regexp_parser.cpp b/runtime/regexp/regexp_parser.cpp index e972e9b2ae8b149cb80fc0c180403003c126af95..895b3145231fbe8c9fe6e38780a191bbefa28bb0 100644 --- a/runtime/regexp/regexp_parser.cpp +++ b/runtime/regexp/regexp_parser.cpp @@ -81,7 +81,7 @@ void RegExpParser::Parse() // NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg) Advance(); SaveStartOpCode saveStartOp; - int captureIndex = captureCount_++; + int captureIndex = capture_count_++; saveStartOp.EmitOpCode(&buffer_, captureIndex); ParseDisjunction(false); if (c0_ != KEY_EOF) { @@ -94,8 +94,8 @@ void RegExpParser::Parse() matchEndOp.EmitOpCode(&buffer_, 0); // dynbuffer head assignments buffer_.PutU32(0, buffer_.size_); - buffer_.PutU32(NUM_CAPTURE__OFFSET, captureCount_); - buffer_.PutU32(NUM_STACK_OFFSET, stackCount_); + buffer_.PutU32(NUM_CAPTURE__OFFSET, capture_count_); + buffer_.PutU32(NUM_STACK_OFFSET, stack_count_); buffer_.PutU32(FLAGS_OFFSET, flags_); #ifndef _NO_DEBUG_ RegExpOpCode::DumpRegExpOpCode(std::cout, buffer_); @@ -108,7 +108,7 @@ void RegExpParser::ParseDisjunction(bool isBackward) PrintF("Parse Disjunction------\n"); size_t start = buffer_.size_; ParseAlternative(isBackward); - if (isError_) { + if (is_error_) { return; } do { @@ -228,7 +228,7 @@ void RegExpParser::ParseAlternative(bool isBackward) { size_t start = buffer_.size_; while (c0_ != '|' && c0_ != KEY_EOF && c0_ != ')') { - if (isError_) { + if (is_error_) { return; } size_t atomBcStart = buffer_.GetSize(); @@ -424,8 +424,8 @@ void RegExpParser::ParseAlternative(bool isBackward) Advance(); break; } - if (isAtom && !isError_) { - ParseQuantifier(atomBcStart, captureIndex, captureCount_ - 1); + if (isAtom && !is_error_) { + ParseQuantifier(atomBcStart, captureIndex, capture_count_ - 1); } if (isBackward) { size_t end = buffer_.GetSize(); @@ -453,9 +453,9 @@ int RegExpParser::FindGroupName(const CString &name) { size_t len = 0; size_t nameLen = name.size(); - const char *p = reinterpret_cast(groupNames_.buf_); + const char *p = reinterpret_cast(group_names_.buf_); // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) - const char *bufEnd = reinterpret_cast(groupNames_.buf_) + groupNames_.size_; + const char *bufEnd = reinterpret_cast(group_names_.buf_) + group_names_.size_; int captureIndex = 1; while (p < bufEnd) { len = strlen(p); @@ -539,7 +539,7 @@ bool RegExpParser::ParseAssertionCapture(int *captureIndex, bool isBackward) ParseError("Duplicate GroupName error."); return false; } - groupNames_.EmitStr(name.c_str()); + group_names_.EmitStr(name.c_str()); // NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg) PrintF("group name %s", name.c_str()); Advance(); @@ -560,10 +560,10 @@ bool RegExpParser::ParseAssertionCapture(int *captureIndex, bool isBackward) return false; } } else { - groupNames_.EmitChar(0); + group_names_.EmitChar(0); parseCapture: isAtom = true; - *captureIndex = captureCount_++; + *captureIndex = capture_count_++; SaveEndOpCode saveEndOp; SaveStartOpCode saveStartOp; if (isBackward) { @@ -713,7 +713,7 @@ void RegExpParser::ParseQuantifier(size_t atomBcStart, int captureStart, int cap return; } if (min != -1 && max != -1) { - stackCount_++; + stack_count_++; PushOpCode pushOp; pushOp.InsertOpCode(&buffer_, atomBcStart); atomBcStart += pushOp.GetSize(); @@ -725,7 +725,7 @@ void RegExpParser::ParseQuantifier(size_t atomBcStart, int captureStart, int cap // zero advance check if (max == INT32_MAX) { - stackCount_++; + stack_count_++; PushCharOpCode pushCharOp; pushCharOp.InsertOpCode(&buffer_, atomBcStart); CheckCharOpCode checkCharOp; @@ -855,7 +855,7 @@ int RegExpParser::ParseAtomEscape(bool isBackward) // NOLINTNEXTLINE(cppcoreguidelines-pro-type-vararg) PrintF("NonZeroDigit %c\n", c0_); int capture = ParseDecimalDigits(); - if (capture > captureCount_ - 1 && capture > ParseCaptureCount(nullptr) - 1) { + if (capture > capture_count_ - 1 && capture > ParseCaptureCount(nullptr) - 1) { ParseError("invalid backreference count"); break; } @@ -1287,7 +1287,7 @@ void RegExpParser::ParseError(const char *errorMessage) PrintF("\n"); SetIsError(); size_t length = strlen(errorMessage) + 1; - if (memcpy_s(errorMsg_, length, errorMessage, length) != EOK) { + if (memcpy_s(error_msg_, length, errorMessage, length) != EOK) { LOG_ECMA(FATAL) << "memcpy_s failed"; UNREACHABLE(); } diff --git a/runtime/regexp/regexp_parser.h b/runtime/regexp/regexp_parser.h index 6dc705be1cbdfdd33f16d6a1bb14cf493bed0d70..06daff44f774d992b5aa15653f235cb8b21479e4 100644 --- a/runtime/regexp/regexp_parser.h +++ b/runtime/regexp/regexp_parser.h @@ -51,7 +51,7 @@ public: static constexpr uint32_t UNICODE_HEX_ADVANCE = 2; static constexpr uint32_t CAPTURE_CONUT_ADVANCE = 3; - explicit RegExpParser(Chunk *chunk) : c0_(KEY_EOF), buffer_(chunk), groupNames_(chunk) {} + explicit RegExpParser(Chunk *chunk) : c0_(KEY_EOF), buffer_(chunk), group_names_(chunk) {} ~RegExpParser() { @@ -95,7 +95,7 @@ public: inline bool IsError() const { - return isError_; + return is_error_; } inline uint8_t *GetOriginBuffer() const @@ -110,8 +110,8 @@ public: inline CString GetErrorMsg() const { - if (isError_) { - return CString(errorMsg_); + if (is_error_) { + return CString(error_msg_); } return CString(""); } @@ -169,7 +169,7 @@ private: pc_ = nullptr; end_ = nullptr; c0_ = KEY_EOF; - isError_ = false; + is_error_ = false; } void Advance() @@ -201,7 +201,7 @@ private: void SetIsError() { - isError_ = true; + is_error_ = true; } void PrintF(const char *fmt, ...); @@ -210,12 +210,12 @@ private: uint8_t *end_ {nullptr}; uint32_t flags_ {0}; int c0_; - int captureCount_ {0}; - int stackCount_ {0}; - bool isError_ {false}; - char errorMsg_[TMP_BUF_SIZE] = {0}; // NOLINT(modernize-avoid-c-arrays) + int capture_count_ {0}; + int stack_count_ {0}; + bool is_error_ {false}; + char error_msg_[TMP_BUF_SIZE] = {0}; // NOLINT(modernize-avoid-c-arrays) DynChunk buffer_; - DynChunk groupNames_; + DynChunk group_names_; }; } // namespace panda::ecmascript #endif // ECMASCRIPT_REGEXP_PARSER_H diff --git a/runtime/regexp/regexp_parser_cache.cpp b/runtime/regexp/regexp_parser_cache.cpp index 3ee4d2e33f9f47d6e7b913cf492dff52c626e6b6..8db95a10ce9827542c8931dfd39f9ec7b1002a9a 100644 --- a/runtime/regexp/regexp_parser_cache.cpp +++ b/runtime/regexp/regexp_parser_cache.cpp @@ -31,8 +31,8 @@ void RegExpParserCache::Clear() for (ParserKey &info : info_) { info.pattern_ = nullptr; info.flags_ = UINT32_MAX; // flags cannot be UINT32_MAX, so it means invalid. - info.codeBuffer_ = JSTaggedValue::Hole(); - info.bufferSize_ = 0; + info.code_buffer_ = JSTaggedValue::Hole(); + info.buffer_size_ = 0; } } @@ -48,7 +48,7 @@ std::pair RegExpParserCache::GetCache(EcmaString *pattern if (info.flags_ != flags || !EcmaString::StringsAreEqual(info.pattern_, pattern)) { return std::pair(JSTaggedValue::Hole(), 0); } - return std::pair(info.codeBuffer_, info.bufferSize_); + return std::pair(info.code_buffer_, info.buffer_size_); } void RegExpParserCache::SetCache(EcmaString *pattern, const uint32_t flags, const JSTaggedValue codeBuffer, @@ -58,7 +58,7 @@ void RegExpParserCache::SetCache(EcmaString *pattern, const uint32_t flags, cons ParserKey &info = info_[hash]; info.pattern_ = pattern; info.flags_ = flags; - info.codeBuffer_ = codeBuffer; - info.bufferSize_ = bufferSize; + info.code_buffer_ = codeBuffer; + info.buffer_size_ = bufferSize; } } // namespace panda::ecmascript diff --git a/runtime/regexp/regexp_parser_cache.h b/runtime/regexp/regexp_parser_cache.h index 874f727ae829437e7186254c39468ee78d5f96e0..65dfb9b027a45a7fd70acd2ee649ea2bfa578ad9 100644 --- a/runtime/regexp/regexp_parser_cache.h +++ b/runtime/regexp/regexp_parser_cache.h @@ -42,8 +42,8 @@ private: struct ParserKey { EcmaString *pattern_ {nullptr}; uint32_t flags_ {UINT32_MAX}; - JSTaggedValue codeBuffer_ {JSTaggedValue::Hole()}; - size_t bufferSize_ {0}; + JSTaggedValue code_buffer_ {JSTaggedValue::Hole()}; + size_t buffer_size_ {0}; }; std::array info_ {}; diff --git a/runtime/snapshot/mem/snapshot.cpp b/runtime/snapshot/mem/snapshot.cpp index 90bfd23990a7c049723826f10d557e15d541a363..28bfbb845419474b3c9594e6ec929d8ee42744ca 100644 --- a/runtime/snapshot/mem/snapshot.cpp +++ b/runtime/snapshot/mem/snapshot.cpp @@ -113,7 +113,7 @@ void SnapShot::MakeSnapShotProgramObject(Program *program, const panda_file::Fil ASSERT(static_cast(write.tellp()) == snapshot_size + sizeof(Header)); write.seekp(panda_file_begin); - write.write(reinterpret_cast(pf->GetBase()), pf->GetHeader()->file_size); + write.write(reinterpret_cast(pf->GetBase()), pf->GetHeader()->file_size_); write.close(); } @@ -137,21 +137,21 @@ std::unique_ptr SnapShot::DeserializeGlobalEnvAndProgram size_t file_size = lseek(fd, 0, SEEK_END); auto readFile = ToUintPtr(mmap(nullptr, file_size, PROT_READ, MAP_PRIVATE, fd, 0)); auto hdr = *ToNativePtr(readFile); - if (hdr.snapshot_size % DEFAULT_SNAPSHOT_SPACE_SIZE != 0) { + if (hdr.snapshot_size_ % DEFAULT_SNAPSHOT_SPACE_SIZE != 0) { LOG_ECMA(FATAL) << "Invalid snapshot file"; UNREACHABLE(); } SnapShotSpace *space = vm_->GetHeap()->GetSnapShotSpace(); uintptr_t snapshot_begin = readFile + sizeof(Header); - for (size_t i = 0; i < hdr.snapshot_size / DEFAULT_SNAPSHOT_SPACE_SIZE; i++) { + for (size_t i = 0; i < hdr.snapshot_size_ / DEFAULT_SNAPSHOT_SPACE_SIZE; i++) { Region *region = const_cast(vm_->GetHeap()->GetRegionFactory()) ->AllocateAlignedRegion(space, DEFAULT_SNAPSHOT_SPACE_SIZE); auto fileRegion = ToNativePtr(snapshot_begin + i * DEFAULT_SNAPSHOT_SPACE_SIZE); - uint64_t base = region->allocateBase_; + uint64_t base = region->allocate_base_; uint64_t begin = (fileRegion->begin_) % DEFAULT_SNAPSHOT_SPACE_SIZE; - uint64_t waterMark = (fileRegion->highWaterMark_) % DEFAULT_SNAPSHOT_SPACE_SIZE; + uint64_t waterMark = (fileRegion->high_water_mark_) % DEFAULT_SNAPSHOT_SPACE_SIZE; if (memcpy_s(region, DEFAULT_SNAPSHOT_SPACE_SIZE, fileRegion, DEFAULT_SNAPSHOT_SPACE_SIZE) != EOK) { LOG_ECMA(FATAL) << "memcpy_s failed"; @@ -161,31 +161,31 @@ std::unique_ptr SnapShot::DeserializeGlobalEnvAndProgram // space region->space_ = space; // allocate_base_ - region->allocateBase_ = base; + region->allocate_base_ = base; // begin_ region->begin_ = ToUintPtr(region) + begin; // end_ region->end_ = ToUintPtr(region) + DEFAULT_SNAPSHOT_SPACE_SIZE; // high_water_mark_ - region->highWaterMark_ = ToUintPtr(region) + waterMark; + region->high_water_mark_ = ToUintPtr(region) + waterMark; // prev_ region->prev_ = nullptr; // next_ region->next_ = nullptr; // mark_bitmap_ - region->markBitmap_ = nullptr; + region->mark_bitmap_ = nullptr; // cross_region_set_ - region->crossRegionSet_ = nullptr; + region->cross_region_set_ = nullptr; // old_to_new_set_ - region->oldToNewSet_ = nullptr; + region->old_to_new_set_ = nullptr; space->AddRegion(region); } - munmap(ToNativePtr(readFile), hdr.panda_file_begin); - uintptr_t panda_file_mem = readFile + hdr.panda_file_begin; + munmap(ToNativePtr(readFile), hdr.panda_file_begin_); + uintptr_t panda_file_mem = readFile + hdr.panda_file_begin_; auto pf = panda_file::File::OpenFromMemory(os::mem::ConstBytePtr(ToNativePtr(panda_file_mem), - file_size - hdr.panda_file_begin, os::mem::MmapDeleter), + file_size - hdr.panda_file_begin_, os::mem::MmapDeleter), fileName); close(fd); // redirect object field diff --git a/runtime/snapshot/mem/snapshot.h b/runtime/snapshot/mem/snapshot.h index 920a2aea9c6618e91f3b924ebf19ab0ff7f85786..fa10e6d878147636fc3ad5ae7bf19700c18bbc8e 100644 --- a/runtime/snapshot/mem/snapshot.h +++ b/runtime/snapshot/mem/snapshot.h @@ -37,8 +37,8 @@ public: private: struct Header { - uint32_t snapshot_size; - uint32_t panda_file_begin; + uint32_t snapshot_size_; + uint32_t panda_file_begin_; }; private: diff --git a/runtime/snapshot/mem/snapshot_serialize.cpp b/runtime/snapshot/mem/snapshot_serialize.cpp index 4f07d05d724e58c749afb6178a8bb1a8959400c5..195809c11cd3582153f086a626221af99fc1d4a4 100644 --- a/runtime/snapshot/mem/snapshot_serialize.cpp +++ b/runtime/snapshot/mem/snapshot_serialize.cpp @@ -579,20 +579,20 @@ static uintptr_t g_nativeTable[] = { SnapShotSerialize::SnapShotSerialize(EcmaVM *vm, bool serialize) : vm_(vm), serialize_(serialize) { - objectArraySize_ = OBJECT_SIZE_EXTEND_PAGE; + object_array_size_ = OBJECT_SIZE_EXTEND_PAGE; if (serialize_) { - addressSlot_ = ToUintPtr(vm_->GetRegionFactory()->Allocate(sizeof(uintptr_t) * OBJECT_SIZE_EXTEND_PAGE)); + address_slot_ = ToUintPtr(vm_->GetRegionFactory()->Allocate(sizeof(uintptr_t) * OBJECT_SIZE_EXTEND_PAGE)); } else { - addressSlot_ = ToUintPtr(vm_->GetRegionFactory()->Allocate(sizeof(uintptr_t) * objectArraySize_)); + address_slot_ = ToUintPtr(vm_->GetRegionFactory()->Allocate(sizeof(uintptr_t) * object_array_size_)); } } SnapShotSerialize::~SnapShotSerialize() { if (serialize_) { - vm_->GetRegionFactory()->Free(ToVoidPtr(addressSlot_), sizeof(uintptr_t) * OBJECT_SIZE_EXTEND_PAGE); + vm_->GetRegionFactory()->Free(ToVoidPtr(address_slot_), sizeof(uintptr_t) * OBJECT_SIZE_EXTEND_PAGE); } else { - vm_->GetRegionFactory()->Free(ToVoidPtr(addressSlot_), sizeof(uintptr_t) * objectArraySize_); + vm_->GetRegionFactory()->Free(ToVoidPtr(address_slot_), sizeof(uintptr_t) * object_array_size_); } } @@ -681,18 +681,18 @@ void SnapShotSerialize::Serialize(TaggedObject *objectHeader, CQueueGetRegionFactory()->Allocate(sizeof(uintptr_t) * objectArraySize_); + auto addr = vm_->GetRegionFactory()->Allocate(sizeof(uintptr_t) * object_array_size_); int size = countNow * ADDRESS_SIZE; - if (memcpy_s(addr, size, ToVoidPtr(addressSlot_), size) != EOK) { + if (memcpy_s(addr, size, ToVoidPtr(address_slot_), size) != EOK) { LOG_ECMA(FATAL) << "memcpy_s failed"; UNREACHABLE(); } - vm_->GetRegionFactory()->Free(ToVoidPtr(addressSlot_), sizeof(uintptr_t) * objectArraySize_); - addressSlot_ = ToUintPtr(addr); + vm_->GetRegionFactory()->Free(ToVoidPtr(address_slot_), sizeof(uintptr_t) * object_array_size_); + address_slot_ = ToUintPtr(addr); } void SnapShotSerialize::RedirectSlot(const panda_file::File *pf) @@ -708,11 +708,11 @@ void SnapShotSerialize::RedirectSlot(const panda_file::File *pf) while (begin < end) { if (others != 0) { for (size_t i = 0; i < others; i++) { - pandaMethod_.emplace_back(begin); + panda_method_.emplace_back(begin); auto method = reinterpret_cast(begin); method->SetPandaFile(pf); method->SetBytecodeArray(method->GetInstructions()); - vm_->frameworkProgramMethods_.emplace_back(method); + vm_->framework_program_methods_.emplace_back(method); begin += METHOD_SIZE; if (begin >= end) { others = others - i - 1; @@ -721,18 +721,18 @@ void SnapShotSerialize::RedirectSlot(const panda_file::File *pf) break; } - if (count_ == objectArraySize_) { + if (count_ == object_array_size_) { ExtendObjectArray(); } SlotBit slot(*reinterpret_cast(begin)); if (slot.GetObjectType() == MASK_METHOD_SPACE_BEGIN) { begin += sizeof(uint64_t); for (size_t i = 0; i < slot.GetObjectSize(); i++) { - pandaMethod_.emplace_back(begin); + panda_method_.emplace_back(begin); auto method = reinterpret_cast(begin); method->SetPandaFile(pf); method->SetBytecodeArray(method->GetInstructions()); - vm_->frameworkProgramMethods_.emplace_back(method); + vm_->framework_program_methods_.emplace_back(method); begin += METHOD_SIZE; if (begin >= end) { others = slot.GetObjectSize() - i - 1; @@ -785,7 +785,7 @@ void SnapShotSerialize::RedirectSlot(const panda_file::File *pf) break; case JSType::PROGRAM: DynProgramDeserialize(GetAddress(i), objectSize); - vm_->frameworkProgram_ = JSTaggedValue(GetAddress(i)); + vm_->framework_program_ = JSTaggedValue(GetAddress(i)); break; case JSType::JS_FUNCTION_BASE: case JSType::JS_FUNCTION: @@ -973,10 +973,10 @@ SlotBit SnapShotSerialize::NativePointerToSlotBit(void *nativePointer) if (nativePointer != nullptr) { // nativePointer uint32_t index = MAX_UINT_32; - if (programSerialize_) { - pandaMethod_.emplace_back(ToUintPtr(nativePointer)); + if (program_serialize_) { + panda_method_.emplace_back(ToUintPtr(nativePointer)); // NOLINTNEXTLINE(bugprone-narrowing-conversions, cppcoreguidelines-narrowing-conversions) - index = pandaMethod_.size() + PROGRAM_NATIVE_METHOD_BEGIN + NATIVE_METHOD_SIZE - 1; + index = panda_method_.size() + PROGRAM_NATIVE_METHOD_BEGIN + NATIVE_METHOD_SIZE - 1; } else { for (size_t i = 0; i < PROGRAM_NATIVE_METHOD_BEGIN; i++) { if (nativePointer == reinterpret_cast(g_nativeTable[i + NATIVE_METHOD_SIZE])) { @@ -1010,11 +1010,11 @@ void *SnapShotSerialize::NativePointerSlotBitToAddr(SlotBit native) void *addr = nullptr; if (index < NATIVE_METHOD_SIZE) { - addr = reinterpret_cast(vm_->nativeMethods_.at(index)); + addr = reinterpret_cast(vm_->native_methods_.at(index)); } else if (index < NATIVE_METHOD_SIZE + PROGRAM_NATIVE_METHOD_BEGIN) { addr = reinterpret_cast(g_nativeTable[index]); } else { - addr = ToVoidPtr(pandaMethod_.at(index - PROGRAM_NATIVE_METHOD_BEGIN - NATIVE_METHOD_SIZE)); + addr = ToVoidPtr(panda_method_.at(index - PROGRAM_NATIVE_METHOD_BEGIN - NATIVE_METHOD_SIZE)); } return addr; } @@ -1221,7 +1221,7 @@ void SnapShotSerialize::SerializePandaFileMethod() { SlotBit slot(0); slot.SetObjectType(MASK_METHOD_SPACE_BEGIN); - slot.SetObjectSize(pandaMethod_.size()); + slot.SetObjectSize(panda_method_.size()); ObjectFactory *factory = vm_->GetFactory(); // panda method space begin @@ -1233,7 +1233,7 @@ void SnapShotSerialize::SerializePandaFileMethod() SetObjectSlotField(snapshotObj, 0, slot.GetValue()); // methods // panda methods - for (auto &it : pandaMethod_) { + for (auto &it : panda_method_) { // write method size_t methodObjSize = METHOD_SIZE; uintptr_t methodObj = factory->NewSpaceBySnapShotAllocator(methodObjSize); diff --git a/runtime/snapshot/mem/snapshot_serialize.h b/runtime/snapshot/mem/snapshot_serialize.h index f14c12876149a353d3d0efe7bd303d0c75a79505..fc9e948eb6a686e60f4754294279a1d30fcce835 100644 --- a/runtime/snapshot/mem/snapshot_serialize.h +++ b/runtime/snapshot/mem/snapshot_serialize.h @@ -39,7 +39,7 @@ public: void SetProgramSerializeStart() { - programSerialize_ = true; + program_serialize_ = true; } void RegisterNativeMethod(); @@ -84,7 +84,7 @@ private: void SetAddressToSlot(size_t index, uintptr_t value) { - auto addr = reinterpret_cast(addressSlot_ + index * ADDRESS_SIZE); + auto addr = reinterpret_cast(address_slot_ + index * ADDRESS_SIZE); // NOLINTNEXTLINE(clang-analyzer-core.CallAndMessage) *addr = value; } @@ -92,7 +92,7 @@ private: template T GetAddress(size_t index) { - return *reinterpret_cast(addressSlot_ + index * ADDRESS_SIZE); + return *reinterpret_cast(address_slot_ + index * ADDRESS_SIZE); } SlotBit NativePointerToSlotBit(void *nativePointer); @@ -101,11 +101,11 @@ private: EcmaVM *vm_ {nullptr}; bool serialize_ {false}; - bool programSerialize_ {false}; + bool program_serialize_ {false}; int count_ {0}; - int objectArraySize_ {0}; - uintptr_t addressSlot_; - CVector pandaMethod_; + int object_array_size_ {0}; + uintptr_t address_slot_; + CVector panda_method_; NO_COPY_SEMANTIC(SnapShotSerialize); NO_MOVE_SEMANTIC(SnapShotSerialize); diff --git a/runtime/tooling/pt_js_extractor.h b/runtime/tooling/pt_js_extractor.h index c65b73c14488dedb63faedd403ebacc2a955eb73..1f52a7ce74dab7495279bed692a17be10590eb9d 100644 --- a/runtime/tooling/pt_js_extractor.h +++ b/runtime/tooling/pt_js_extractor.h @@ -39,8 +39,8 @@ public: for (const auto &method : methods) { auto table = GetLineNumberTable(method); for (const auto &pair : table) { - if (static_cast(pair.line) == line) { - return cb(method, pair.offset); + if (static_cast(pair.line_) == line) { + return cb(method, pair.offset_); } } } @@ -56,25 +56,25 @@ public: size_t column = 0; for (const auto &pair : lineTable) { - if (offset < pair.offset) { + if (offset < pair.offset_) { break; } - if (offset == pair.offset) { - line = pair.line; + if (offset == pair.offset_) { + line = pair.line_; break; } - line = pair.line; + line = pair.line_; } for (const auto &pair : columnTable) { - if (offset < pair.offset) { + if (offset < pair.offset_) { break; } - if (offset == pair.offset) { - column = pair.column; + if (offset == pair.offset_) { + column = pair.column_; break; } - column = pair.column; + column = pair.column_; } return cb(line, column); } diff --git a/runtime/vmstat/caller_stat.cpp b/runtime/vmstat/caller_stat.cpp index d03570835dbcbee9c8773781cba98b0aab119a43..37a2f75124aa2090d4714502f00a41f6d83ef59b 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 a8cd57359750a1d82f6287cb8b983887124a9439..ce0ebb36230489a0c85b64cb59e67c8568940ae2 100644 --- a/runtime/vmstat/caller_stat.h +++ b/runtime/vmstat/caller_stat.h @@ -37,9 +37,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 { @@ -47,29 +47,29 @@ 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: CString 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 { @@ -101,7 +101,7 @@ public: inline void UpdateCallerState() { - callerStat_->UpdateState(elapsed_); + caller_stat_->UpdateState(elapsed_); } private: @@ -109,7 +109,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 093bc7120459c100d9b2478c2119e4043afeeb77..7011bc8bf81c08bb9e3f6c3f3c02dac8ec7cefe4 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(CString(runtimeCallerNames[i]))); + caller_stat_.emplace_back(PandaRuntimeCallerStat(CString(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 @@ CString 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 5c66d071b9130dbfb6c222b5ce5ee396cfb7eada..40fb3390812f71833e9b53e8e451b313ab940308 100644 --- a/runtime/vmstat/runtime_stat.h +++ b/runtime/vmstat/runtime_stat.h @@ -39,8 +39,8 @@ public: void Print() const; private: - PandaRuntimeTimer *currentTimer_ = nullptr; - CVector callerStat_ {}; + PandaRuntimeTimer *current_timer_ = nullptr; + CVector caller_stat_ {}; }; class RuntimeTimerScope { diff --git a/tests/assembler/emitter_test_ecmascript.cpp b/tests/assembler/emitter_test_ecmascript.cpp index 514613e54d0cf8a4c5c044297f664c1c202dc803..afe8368ae96d72a5c5fc57ee979bcbe962023046 100644 --- a/tests/assembler/emitter_test_ecmascript.cpp +++ b/tests/assembler/emitter_test_ecmascript.cpp @@ -59,7 +59,7 @@ TEST(emittertests, get_GLOBAL_lang_for_JS_func) )"; auto res = p.Parse(source); - ASSERT_EQ(p.ShowError().err, Error::ErrorType::ERR_NONE); + ASSERT_EQ(p.ShowError().err_, Error::ErrorType::ERR_NONE); auto pf = AsmEmitter::Emit(res.Value()); ASSERT_NE(pf, nullptr); @@ -88,7 +88,7 @@ TEST(emittertests, ecmascript_debuginfo) std::string source_filename = "source.pa"; auto res = p.Parse(source, source_filename); - ASSERT_EQ(p.ShowError().err, Error::ErrorType::ERR_NONE); + ASSERT_EQ(p.ShowError().err_, Error::ErrorType::ERR_NONE); auto pf = AsmEmitter::Emit(res.Value()); ASSERT_NE(pf, nullptr); diff --git a/tests/assembler/parser_test_ecmascript.cpp b/tests/assembler/parser_test_ecmascript.cpp index d42dd2f1ca57b1e6e17f68e44003a4ce6e1b3f49..ad373478228b83389f753d3fe62cf02c0cdc61c8 100644 --- a/tests/assembler/parser_test_ecmascript.cpp +++ b/tests/assembler/parser_test_ecmascript.cpp @@ -38,6 +38,6 @@ TEST(parsertests, calli_dyn_3args) Error e = p.ShowError(); - ASSERT_EQ(e.err, Error::ErrorType::ERR_NONE); + ASSERT_EQ(e.err_, Error::ErrorType::ERR_NONE); } } \ No newline at end of file diff --git a/tests/compiler/unit_ecma_test.cpp b/tests/compiler/unit_ecma_test.cpp index bcfff009484c376f224174c62a30160785482cde..9b12332735deab5a00dd751c624eb5c9064ecbc7 100644 --- a/tests/compiler/unit_ecma_test.cpp +++ b/tests/compiler/unit_ecma_test.cpp @@ -96,9 +96,9 @@ std::unique_ptr AsmTest::ParseToFile(const char *source, { panda::pandasm::Parser parser; auto res = parser.Parse(source, file_name); - if (parser.ShowError().err != pandasm::Error::ErrorType::ERR_NONE) { - std::cerr << "Parse failed: " << parser.ShowError().message << std::endl - << parser.ShowError().whole_line << std::endl; + if (parser.ShowError().err_ != pandasm::Error::ErrorType::ERR_NONE) { + std::cerr << "Parse failed: " << parser.ShowError().message_ << std::endl + << parser.ShowError().whole_line_ << std::endl; ADD_FAILURE(); return nullptr; } diff --git a/tests/runtime/builtins/builtins_array_test.cpp b/tests/runtime/builtins/builtins_array_test.cpp index ba19fbf0822287f2472c39835bb455df228a7553..daa1c5a4f50cd11e8afdf07b210ffb65d009c748 100644 --- a/tests/runtime/builtins/builtins_array_test.cpp +++ b/tests/runtime/builtins/builtins_array_test.cpp @@ -53,17 +53,17 @@ public: void SetUp() override { - TestHelper::CreateEcmaVMWithScope(instance, thread, scope); + TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); } void TearDown() override { - TestHelper::DestroyEcmaVMWithScope(instance, scope); + TestHelper::DestroyEcmaVMWithScope(instance_, scope_); } - PandaVM *instance {nullptr}; - EcmaHandleScope *scope {nullptr}; - JSThread *thread {nullptr}; + PandaVM *instance_ {nullptr}; + EcmaHandleScope *scope_ {nullptr}; + JSThread *thread_ {nullptr}; class TestClass : public base::BuiltinsBase { public: @@ -184,611 +184,613 @@ JSTaggedValue CreateBuiltinsJSObject(JSThread *thread, const CString keyCStr) TEST_F(BuiltinsArrayTest, ArrayConstructor) { - auto ecmaVM = thread->GetEcmaVM(); + auto ecmaVM = thread_->GetEcmaVM(); JSHandle env = ecmaVM->GetGlobalEnv(); JSHandle array(env->GetArrayFunction()); - JSHandle globalObject(thread, env->GetGlobalObject()); + JSHandle globalObject(thread_, env->GetGlobalObject()); - auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 10); + auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 10); ecmaRuntimeCallInfo1->SetFunction(array.GetTaggedValue()); ecmaRuntimeCallInfo1->SetThis(globalObject.GetTaggedValue()); ecmaRuntimeCallInfo1->SetCallArg(0, JSTaggedValue(static_cast(1))); ecmaRuntimeCallInfo1->SetCallArg(1, JSTaggedValue(static_cast(3))); ecmaRuntimeCallInfo1->SetCallArg(2, JSTaggedValue(static_cast(5))); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); JSTaggedValue result = Array::ArrayConstructor(ecmaRuntimeCallInfo1.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); JSTaggedValue value(static_cast(result.GetRawData())); ASSERT_TRUE(value.IsECMAObject()); - PropertyDescriptor descRes(thread); - JSHandle valueHandle(thread, value); - JSHandle key0(thread, JSTaggedValue(0)); - JSHandle key1(thread, JSTaggedValue(1)); - JSHandle key2(thread, JSTaggedValue(2)); - JSObject::GetOwnProperty(thread, valueHandle, key0, descRes); + PropertyDescriptor descRes(thread_); + JSHandle valueHandle(thread_, value); + JSHandle key0(thread_, JSTaggedValue(0)); + JSHandle key1(thread_, JSTaggedValue(1)); + JSHandle key2(thread_, JSTaggedValue(2)); + JSObject::GetOwnProperty(thread_, valueHandle, key0, descRes); ASSERT_EQ(descRes.GetValue().GetTaggedValue(), JSTaggedValue(1)); - JSObject::GetOwnProperty(thread, valueHandle, key1, descRes); + JSObject::GetOwnProperty(thread_, valueHandle, key1, descRes); ASSERT_EQ(descRes.GetValue().GetTaggedValue(), JSTaggedValue(3)); - JSObject::GetOwnProperty(thread, valueHandle, key2, descRes); + JSObject::GetOwnProperty(thread_, valueHandle, key2, descRes); ASSERT_EQ(descRes.GetValue().GetTaggedValue(), JSTaggedValue(5)); } // 22.1.2.1 Array.from ( items [ , mapfn [ , thisArg ] ] ) TEST_F(BuiltinsArrayTest, From) { - JSHandle lengthKeyHandle = thread->GlobalConstants()->GetHandledLengthString(); - JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread, JSTaggedNumber(0))->GetTaggedObject()); + JSHandle lengthKeyHandle = thread_->GlobalConstants()->GetHandledLengthString(); + JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread_, JSTaggedNumber(0))->GetTaggedObject()); EXPECT_TRUE(arr != nullptr); - JSHandle obj(thread, arr); - EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 0); - - JSHandle key0(thread, JSTaggedValue(0)); - PropertyDescriptor desc0(thread, JSHandle(thread, JSTaggedValue(1)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key0, desc0); - JSHandle key1(thread, JSTaggedValue(1)); - PropertyDescriptor desc1(thread, JSHandle(thread, JSTaggedValue(2)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key1, desc1); - JSHandle key2(thread, JSTaggedValue(2)); - PropertyDescriptor desc2(thread, JSHandle(thread, JSTaggedValue(3)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key2, desc2); - JSHandle key3(thread, JSTaggedValue(3)); - PropertyDescriptor desc3(thread, JSHandle(thread, JSTaggedValue(4)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key3, desc3); - JSHandle key4(thread, JSTaggedValue(4)); - PropertyDescriptor desc4(thread, JSHandle(thread, JSTaggedValue(5)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key4, desc4); - - auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + JSHandle obj(thread_, arr); + EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 0); + + JSHandle key0(thread_, JSTaggedValue(0)); + PropertyDescriptor desc0(thread_, JSHandle(thread_, JSTaggedValue(1)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key0, desc0); + JSHandle key1(thread_, JSTaggedValue(1)); + PropertyDescriptor desc1(thread_, JSHandle(thread_, JSTaggedValue(2)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key1, desc1); + JSHandle key2(thread_, JSTaggedValue(2)); + PropertyDescriptor desc2(thread_, JSHandle(thread_, JSTaggedValue(3)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key2, desc2); + JSHandle key3(thread_, JSTaggedValue(3)); + PropertyDescriptor desc3(thread_, JSHandle(thread_, JSTaggedValue(4)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key3, desc3); + JSHandle key4(thread_, JSTaggedValue(4)); + PropertyDescriptor desc4(thread_, JSHandle(thread_, JSTaggedValue(5)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key4, desc4); + + auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo1->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo1->SetThis(obj.GetTaggedValue()); ecmaRuntimeCallInfo1->SetCallArg(0, obj.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); JSTaggedValue result = Array::From(ecmaRuntimeCallInfo1.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); JSTaggedValue value(static_cast(result.GetRawData())); ASSERT_TRUE(value.IsECMAObject()); - PropertyDescriptor descRes(thread); - JSHandle valueHandle(thread, value); - JSObject::GetOwnProperty(thread, valueHandle, key0, descRes); + PropertyDescriptor descRes(thread_); + JSHandle valueHandle(thread_, value); + JSObject::GetOwnProperty(thread_, valueHandle, key0, descRes); ASSERT_EQ(descRes.GetValue().GetTaggedValue(), JSTaggedValue(1)); - JSObject::GetOwnProperty(thread, valueHandle, key1, descRes); + JSObject::GetOwnProperty(thread_, valueHandle, key1, descRes); ASSERT_EQ(descRes.GetValue().GetTaggedValue(), JSTaggedValue(2)); - JSObject::GetOwnProperty(thread, valueHandle, key2, descRes); + JSObject::GetOwnProperty(thread_, valueHandle, key2, descRes); ASSERT_EQ(descRes.GetValue().GetTaggedValue(), JSTaggedValue(3)); - JSObject::GetOwnProperty(thread, valueHandle, key3, descRes); + JSObject::GetOwnProperty(thread_, valueHandle, key3, descRes); ASSERT_EQ(descRes.GetValue().GetTaggedValue(), JSTaggedValue(4)); - JSObject::GetOwnProperty(thread, valueHandle, key4, descRes); + JSObject::GetOwnProperty(thread_, valueHandle, key4, descRes); ASSERT_EQ(descRes.GetValue().GetTaggedValue(), JSTaggedValue(5)); } // 22.1.2.2 Array.isArray(arg) TEST_F(BuiltinsArrayTest, IsArray) { - JSHandle lengthKeyHandle = thread->GlobalConstants()->GetHandledLengthString(); - JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); + JSHandle lengthKeyHandle = thread_->GlobalConstants()->GetHandledLengthString(); + JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread_, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); EXPECT_TRUE(arr != nullptr); - JSHandle obj(thread, arr); - EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 0); + JSHandle obj(thread_, arr); + EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 0); - auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo1->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo1->SetThis(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo1->SetCallArg(0, obj.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); JSTaggedValue result = Array::IsArray(ecmaRuntimeCallInfo1.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_EQ(result.GetRawData(), JSTaggedValue::True().GetRawData()); - auto ecmaRuntimeCallInfo2 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto ecmaRuntimeCallInfo2 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo2->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo2->SetThis(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo2->SetCallArg(0, JSTaggedValue(static_cast(1))); - prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo2.get()); + prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo2.get()); result = Array::IsArray(ecmaRuntimeCallInfo2.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_EQ(result.GetRawData(), JSTaggedValue::False().GetRawData()); } TEST_F(BuiltinsArrayTest, Of) { - auto ecmaVM = thread->GetEcmaVM(); + auto ecmaVM = thread_->GetEcmaVM(); JSHandle env = ecmaVM->GetGlobalEnv(); JSHandle array(env->GetArrayFunction()); - JSHandle globalObject(thread, env->GetGlobalObject()); + JSHandle globalObject(thread_, env->GetGlobalObject()); - auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 10); + auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 10); ecmaRuntimeCallInfo1->SetFunction(array.GetTaggedValue()); ecmaRuntimeCallInfo1->SetThis(globalObject.GetTaggedValue()); ecmaRuntimeCallInfo1->SetCallArg(0, JSTaggedValue(static_cast(1))); ecmaRuntimeCallInfo1->SetCallArg(1, JSTaggedValue(static_cast(3))); ecmaRuntimeCallInfo1->SetCallArg(2, JSTaggedValue(static_cast(5))); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); JSTaggedValue result = Array::Of(ecmaRuntimeCallInfo1.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); JSTaggedValue value(static_cast(result.GetRawData())); ASSERT_TRUE(value.IsECMAObject()); - PropertyDescriptor descRes(thread); - JSHandle valueHandle(thread, value); - JSHandle key0(thread, JSTaggedValue(0)); - JSHandle key1(thread, JSTaggedValue(1)); - JSHandle key2(thread, JSTaggedValue(2)); + PropertyDescriptor descRes(thread_); + JSHandle valueHandle(thread_, value); + JSHandle key0(thread_, JSTaggedValue(0)); + JSHandle key1(thread_, JSTaggedValue(1)); + JSHandle key2(thread_, JSTaggedValue(2)); - JSObject::GetOwnProperty(thread, valueHandle, key0, descRes); + JSObject::GetOwnProperty(thread_, valueHandle, key0, descRes); ASSERT_EQ(descRes.GetValue().GetTaggedValue(), JSTaggedValue(1)); - JSObject::GetOwnProperty(thread, valueHandle, key1, descRes); + JSObject::GetOwnProperty(thread_, valueHandle, key1, descRes); ASSERT_EQ(descRes.GetValue().GetTaggedValue(), JSTaggedValue(3)); - JSObject::GetOwnProperty(thread, valueHandle, key2, descRes); + JSObject::GetOwnProperty(thread_, valueHandle, key2, descRes); ASSERT_EQ(descRes.GetValue().GetTaggedValue(), JSTaggedValue(5)); } TEST_F(BuiltinsArrayTest, Species) { - auto ecmaVM = thread->GetEcmaVM(); + auto ecmaVM = thread_->GetEcmaVM(); JSHandle env = ecmaVM->GetGlobalEnv(); JSHandle array(env->GetArrayFunction()); - JSHandle globalObject(thread, env->GetGlobalObject()); + JSHandle globalObject(thread_, env->GetGlobalObject()); - auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); + auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); ecmaRuntimeCallInfo1->SetFunction(array.GetTaggedValue()); ecmaRuntimeCallInfo1->SetThis(globalObject.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); JSTaggedValue result = Array::Species(ecmaRuntimeCallInfo1.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_TRUE(result.IsECMAObject()); } TEST_F(BuiltinsArrayTest, Concat) { - JSHandle lengthKeyHandle = thread->GlobalConstants()->GetHandledLengthString(); - JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); + JSHandle lengthKeyHandle = thread_->GlobalConstants()->GetHandledLengthString(); + JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread_, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); EXPECT_TRUE(arr != nullptr); - JSHandle obj(thread, arr); - JSHandle key0(thread, JSTaggedValue(0)); - PropertyDescriptor desc0(thread, JSHandle(thread, JSTaggedValue(1)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key0, desc0); - JSHandle key1(thread, JSTaggedValue(1)); - PropertyDescriptor desc1(thread, JSHandle(thread, JSTaggedValue(2)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key1, desc1); - JSHandle key2(thread, JSTaggedValue(2)); - PropertyDescriptor desc2(thread, JSHandle(thread, JSTaggedValue(3)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key2, desc2); - - JSArray *arr1 = JSArray::ArrayCreate(thread, JSTaggedNumber(0)).GetObject(); + JSHandle obj(thread_, arr); + JSHandle key0(thread_, JSTaggedValue(0)); + PropertyDescriptor desc0(thread_, JSHandle(thread_, JSTaggedValue(1)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key0, desc0); + JSHandle key1(thread_, JSTaggedValue(1)); + PropertyDescriptor desc1(thread_, JSHandle(thread_, JSTaggedValue(2)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key1, desc1); + JSHandle key2(thread_, JSTaggedValue(2)); + PropertyDescriptor desc2(thread_, JSHandle(thread_, JSTaggedValue(3)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key2, desc2); + + JSArray *arr1 = JSArray::ArrayCreate(thread_, JSTaggedNumber(0)).GetObject(); EXPECT_TRUE(arr1 != nullptr); - JSHandle obj1(thread, arr1); - JSHandle key4(thread, JSTaggedValue(0)); - PropertyDescriptor desc4(thread, JSHandle(thread, JSTaggedValue(4)), true, true, true); - JSArray::DefineOwnProperty(thread, obj1, key4, desc4); - JSHandle key5(thread, JSTaggedValue(1)); - PropertyDescriptor desc5(thread, JSHandle(thread, JSTaggedValue(5)), true, true, true); - JSArray::DefineOwnProperty(thread, obj1, key5, desc5); - JSHandle key6(thread, JSTaggedValue(2)); - PropertyDescriptor desc6(thread, JSHandle(thread, JSTaggedValue(6)), true, true, true); - JSArray::DefineOwnProperty(thread, obj1, key6, desc6); - - auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + JSHandle obj1(thread_, arr1); + JSHandle key4(thread_, JSTaggedValue(0)); + PropertyDescriptor desc4(thread_, JSHandle(thread_, JSTaggedValue(4)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj1, key4, desc4); + JSHandle key5(thread_, JSTaggedValue(1)); + PropertyDescriptor desc5(thread_, JSHandle(thread_, JSTaggedValue(5)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj1, key5, desc5); + JSHandle key6(thread_, JSTaggedValue(2)); + PropertyDescriptor desc6(thread_, JSHandle(thread_, JSTaggedValue(6)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj1, key6, desc6); + + auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo1->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo1->SetThis(obj.GetTaggedValue()); ecmaRuntimeCallInfo1->SetCallArg(0, obj1.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); JSTaggedValue result = Array::Concat(ecmaRuntimeCallInfo1.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); JSTaggedValue value(static_cast(result.GetRawData())); ASSERT_TRUE(value.IsECMAObject()); - PropertyDescriptor descRes(thread); - JSHandle valueHandle(thread, value); - JSHandle key7(thread, JSTaggedValue(5)); - EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(valueHandle), lengthKeyHandle).GetValue()->GetInt(), + PropertyDescriptor descRes(thread_); + JSHandle valueHandle(thread_, value); + JSHandle key7(thread_, JSTaggedValue(5)); + EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(valueHandle), lengthKeyHandle).GetValue()->GetInt(), 6); - JSObject::GetOwnProperty(thread, valueHandle, key7, descRes); + JSObject::GetOwnProperty(thread_, valueHandle, key7, descRes); ASSERT_EQ(descRes.GetValue().GetTaggedValue(), JSTaggedValue(6)); } // 22.1.3.3 new Array(1,2,3,4,5).CopyWithin(0,3,5) TEST_F(BuiltinsArrayTest, CopyWithin) { - JSHandle lengthKeyHandle = thread->GlobalConstants()->GetHandledLengthString(); - JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); + JSHandle lengthKeyHandle = thread_->GlobalConstants()->GetHandledLengthString(); + JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread_, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); EXPECT_TRUE(arr != nullptr); - JSHandle obj(thread, arr); - EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 0); - - JSHandle key0(thread, JSTaggedValue(0)); - PropertyDescriptor desc0(thread, JSHandle(thread, JSTaggedValue(1)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key0, desc0); - JSHandle key1(thread, JSTaggedValue(1)); - PropertyDescriptor desc1(thread, JSHandle(thread, JSTaggedValue(2)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key1, desc1); - JSHandle key2(thread, JSTaggedValue(2)); - PropertyDescriptor desc2(thread, JSHandle(thread, JSTaggedValue(3)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key2, desc2); - JSHandle key3(thread, JSTaggedValue(3)); - PropertyDescriptor desc3(thread, JSHandle(thread, JSTaggedValue(4)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key3, desc3); - JSHandle key4(thread, JSTaggedValue(4)); - PropertyDescriptor desc4(thread, JSHandle(thread, JSTaggedValue(5)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key4, desc4); - - auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 10); + JSHandle obj(thread_, arr); + EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 0); + + JSHandle key0(thread_, JSTaggedValue(0)); + PropertyDescriptor desc0(thread_, JSHandle(thread_, JSTaggedValue(1)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key0, desc0); + JSHandle key1(thread_, JSTaggedValue(1)); + PropertyDescriptor desc1(thread_, JSHandle(thread_, JSTaggedValue(2)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key1, desc1); + JSHandle key2(thread_, JSTaggedValue(2)); + PropertyDescriptor desc2(thread_, JSHandle(thread_, JSTaggedValue(3)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key2, desc2); + JSHandle key3(thread_, JSTaggedValue(3)); + PropertyDescriptor desc3(thread_, JSHandle(thread_, JSTaggedValue(4)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key3, desc3); + JSHandle key4(thread_, JSTaggedValue(4)); + PropertyDescriptor desc4(thread_, JSHandle(thread_, JSTaggedValue(5)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key4, desc4); + + auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 10); ecmaRuntimeCallInfo1->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo1->SetThis(obj.GetTaggedValue()); ecmaRuntimeCallInfo1->SetCallArg(0, JSTaggedValue(static_cast(0))); ecmaRuntimeCallInfo1->SetCallArg(1, JSTaggedValue(static_cast(3))); ecmaRuntimeCallInfo1->SetCallArg(2, JSTaggedValue(static_cast(5))); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); JSTaggedValue result = Array::CopyWithin(ecmaRuntimeCallInfo1.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); JSTaggedValue value(static_cast(result.GetRawData())); ASSERT_TRUE(value.IsECMAObject()); - PropertyDescriptor descRes(thread); - JSHandle valueHandle(thread, value); - JSObject::GetOwnProperty(thread, valueHandle, key0, descRes); + PropertyDescriptor descRes(thread_); + JSHandle valueHandle(thread_, value); + JSObject::GetOwnProperty(thread_, valueHandle, key0, descRes); ASSERT_EQ(descRes.GetValue().GetTaggedValue(), JSTaggedValue(4)); - JSObject::GetOwnProperty(thread, valueHandle, key1, descRes); + JSObject::GetOwnProperty(thread_, valueHandle, key1, descRes); ASSERT_EQ(descRes.GetValue().GetTaggedValue(), JSTaggedValue(5)); - JSObject::GetOwnProperty(thread, valueHandle, key2, descRes); + JSObject::GetOwnProperty(thread_, valueHandle, key2, descRes); ASSERT_EQ(descRes.GetValue().GetTaggedValue(), JSTaggedValue(3)); - JSObject::GetOwnProperty(thread, valueHandle, key3, descRes); + JSObject::GetOwnProperty(thread_, valueHandle, key3, descRes); ASSERT_EQ(descRes.GetValue().GetTaggedValue(), JSTaggedValue(4)); - JSObject::GetOwnProperty(thread, valueHandle, key4, descRes); + JSObject::GetOwnProperty(thread_, valueHandle, key4, descRes); ASSERT_EQ(descRes.GetValue().GetTaggedValue(), JSTaggedValue(5)); } TEST_F(BuiltinsArrayTest, Every) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - auto ecmaVM = thread->GetEcmaVM(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + auto ecmaVM = thread_->GetEcmaVM(); JSHandle env = ecmaVM->GetGlobalEnv(); - JSHandle lengthKeyHandle = thread->GlobalConstants()->GetHandledLengthString(); - JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); + JSHandle lengthKeyHandle = thread_->GlobalConstants()->GetHandledLengthString(); + JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread_, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); EXPECT_TRUE(arr != nullptr); - JSHandle obj(thread, arr); - EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 0); + JSHandle obj(thread_, arr); + EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 0); - JSHandle key0(thread, JSTaggedValue(0)); - PropertyDescriptor desc0(thread, JSHandle(thread, JSTaggedValue(100)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key0, desc0); + JSHandle key0(thread_, JSTaggedValue(0)); + PropertyDescriptor desc0(thread_, JSHandle(thread_, JSTaggedValue(100)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key0, desc0); - JSHandle key1(thread, JSTaggedValue(1)); - PropertyDescriptor desc1(thread, JSHandle(thread, JSTaggedValue(200)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key1, desc1); - JSHandle key2(thread, JSTaggedValue(2)); - PropertyDescriptor desc2(thread, JSHandle(thread, JSTaggedValue(300)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key2, desc2); + JSHandle key1(thread_, JSTaggedValue(1)); + PropertyDescriptor desc1(thread_, JSHandle(thread_, JSTaggedValue(200)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key1, desc1); + JSHandle key2(thread_, JSTaggedValue(2)); + PropertyDescriptor desc2(thread_, JSHandle(thread_, JSTaggedValue(300)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key2, desc2); JSHandle jsArray = factory->NewJSArray(); JSHandle func = factory->NewJSFunction(env, reinterpret_cast(TestClass::TestEveryFunc)); - auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); ecmaRuntimeCallInfo1->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo1->SetThis(obj.GetTaggedValue()); ecmaRuntimeCallInfo1->SetCallArg(0, func.GetTaggedValue()); ecmaRuntimeCallInfo1->SetCallArg(1, jsArray.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); JSTaggedValue result2 = Array::Every(ecmaRuntimeCallInfo1.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_EQ(result2.GetRawData(), JSTaggedValue::True().GetRawData()); } TEST_F(BuiltinsArrayTest, Map) { - auto ecmaVM = thread->GetEcmaVM(); + auto ecmaVM = thread_->GetEcmaVM(); JSHandle env = ecmaVM->GetGlobalEnv(); ObjectFactory *factory = ecmaVM->GetFactory(); - JSHandle lengthKeyHandle = thread->GlobalConstants()->GetHandledLengthString(); - JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); + JSHandle lengthKeyHandle = thread_->GlobalConstants()->GetHandledLengthString(); + JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread_, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); EXPECT_TRUE(arr != nullptr); - JSHandle obj(thread, arr); - EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 0); - JSHandle key0(thread, JSTaggedValue(0)); - PropertyDescriptor desc0(thread, JSHandle(thread, JSTaggedValue(50)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key0, desc0); - JSHandle key1(thread, JSTaggedValue(1)); - PropertyDescriptor desc1(thread, JSHandle(thread, JSTaggedValue(200)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key1, desc1); - JSHandle key2(thread, JSTaggedValue(2)); - PropertyDescriptor desc2(thread, JSHandle(thread, JSTaggedValue(3)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key2, desc2); - JSHandle jsArray(JSArray::ArrayCreate(thread, JSTaggedNumber(0))); + JSHandle obj(thread_, arr); + EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 0); + JSHandle key0(thread_, JSTaggedValue(0)); + PropertyDescriptor desc0(thread_, JSHandle(thread_, JSTaggedValue(50)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key0, desc0); + JSHandle key1(thread_, JSTaggedValue(1)); + PropertyDescriptor desc1(thread_, JSHandle(thread_, JSTaggedValue(200)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key1, desc1); + JSHandle key2(thread_, JSTaggedValue(2)); + PropertyDescriptor desc2(thread_, JSHandle(thread_, JSTaggedValue(3)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key2, desc2); + JSHandle jsArray(JSArray::ArrayCreate(thread_, JSTaggedNumber(0))); JSHandle func = factory->NewJSFunction(env, reinterpret_cast(TestClass::TestMapFunc)); - auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); ecmaRuntimeCallInfo1->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo1->SetThis(obj.GetTaggedValue()); ecmaRuntimeCallInfo1->SetCallArg(0, func.GetTaggedValue()); ecmaRuntimeCallInfo1->SetCallArg(1, jsArray.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); JSTaggedValue result = Array::Map(ecmaRuntimeCallInfo1.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); JSTaggedValue value(static_cast(result.GetRawData())); ASSERT_TRUE(value.IsECMAObject()); - PropertyDescriptor descRes(thread); - JSHandle valueHandle(thread, value); - EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(valueHandle), lengthKeyHandle).GetValue()->GetInt(), + PropertyDescriptor descRes(thread_); + JSHandle valueHandle(thread_, value); + EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(valueHandle), lengthKeyHandle).GetValue()->GetInt(), 3); - JSObject::GetOwnProperty(thread, valueHandle, key0, descRes); + JSObject::GetOwnProperty(thread_, valueHandle, key0, descRes); ASSERT_EQ(descRes.GetValue()->GetInt(), 100); - JSObject::GetOwnProperty(thread, valueHandle, key1, descRes); + JSObject::GetOwnProperty(thread_, valueHandle, key1, descRes); ASSERT_EQ(descRes.GetValue()->GetInt(), 400); - JSObject::GetOwnProperty(thread, valueHandle, key2, descRes); + JSObject::GetOwnProperty(thread_, valueHandle, key2, descRes); ASSERT_EQ(descRes.GetValue()->GetInt(), 6); } TEST_F(BuiltinsArrayTest, Reverse) { - JSHandle lengthKeyHandle = thread->GlobalConstants()->GetHandledLengthString(); - JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); + JSHandle lengthKeyHandle = thread_->GlobalConstants()->GetHandledLengthString(); + JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread_, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); EXPECT_TRUE(arr != nullptr); - JSHandle obj(thread, arr); - EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 0); - JSHandle key0(thread, JSTaggedValue(0)); - PropertyDescriptor desc0(thread, JSHandle(thread, JSTaggedValue(50)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key0, desc0); - JSHandle key1(thread, JSTaggedValue(1)); - PropertyDescriptor desc1(thread, JSHandle(thread, JSTaggedValue(200)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key1, desc1); - JSHandle key2(thread, JSTaggedValue(2)); - PropertyDescriptor desc2(thread, JSHandle(thread, JSTaggedValue(3)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key2, desc2); - - auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); + JSHandle obj(thread_, arr); + EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 0); + JSHandle key0(thread_, JSTaggedValue(0)); + PropertyDescriptor desc0(thread_, JSHandle(thread_, JSTaggedValue(50)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key0, desc0); + JSHandle key1(thread_, JSTaggedValue(1)); + PropertyDescriptor desc1(thread_, JSHandle(thread_, JSTaggedValue(200)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key1, desc1); + JSHandle key2(thread_, JSTaggedValue(2)); + PropertyDescriptor desc2(thread_, JSHandle(thread_, JSTaggedValue(3)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key2, desc2); + + auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); ecmaRuntimeCallInfo1->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo1->SetThis(obj.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); JSTaggedValue result = Array::Reverse(ecmaRuntimeCallInfo1.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); JSTaggedValue value(static_cast(result.GetRawData())); ASSERT_TRUE(value.IsECMAObject()); - PropertyDescriptor descRes(thread); - JSHandle valueHandle(thread, value); - EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(valueHandle), lengthKeyHandle).GetValue()->GetInt(), + PropertyDescriptor descRes(thread_); + JSHandle valueHandle(thread_, value); + EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(valueHandle), lengthKeyHandle).GetValue()->GetInt(), 3); - JSObject::GetOwnProperty(thread, valueHandle, key0, descRes); + JSObject::GetOwnProperty(thread_, valueHandle, key0, descRes); ASSERT_EQ(descRes.GetValue().GetTaggedValue(), JSTaggedValue(3)); - JSObject::GetOwnProperty(thread, valueHandle, key1, descRes); + JSObject::GetOwnProperty(thread_, valueHandle, key1, descRes); ASSERT_EQ(descRes.GetValue().GetTaggedValue(), JSTaggedValue(200)); - JSObject::GetOwnProperty(thread, valueHandle, key2, descRes); + JSObject::GetOwnProperty(thread_, valueHandle, key2, descRes); ASSERT_EQ(descRes.GetValue().GetTaggedValue(), JSTaggedValue(50)); - EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 3); - JSObject::GetOwnProperty(thread, obj, key0, descRes); + EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 3); + JSObject::GetOwnProperty(thread_, obj, key0, descRes); ASSERT_EQ(descRes.GetValue().GetTaggedValue(), JSTaggedValue(3)); - JSObject::GetOwnProperty(thread, obj, key1, descRes); + JSObject::GetOwnProperty(thread_, obj, key1, descRes); ASSERT_EQ(descRes.GetValue().GetTaggedValue(), JSTaggedValue(200)); - JSObject::GetOwnProperty(thread, obj, key2, descRes); + JSObject::GetOwnProperty(thread_, obj, key2, descRes); ASSERT_EQ(descRes.GetValue().GetTaggedValue(), JSTaggedValue(50)); } TEST_F(BuiltinsArrayTest, Slice) { - JSHandle lengthKeyHandle = thread->GlobalConstants()->GetHandledLengthString(); - JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); + JSHandle lengthKeyHandle = thread_->GlobalConstants()->GetHandledLengthString(); + JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread_, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); EXPECT_TRUE(arr != nullptr); - JSHandle obj(thread, arr); - EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 0); - JSHandle key0(thread, JSTaggedValue(0)); - PropertyDescriptor desc0(thread, JSHandle(thread, JSTaggedValue(1)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key0, desc0); - JSHandle key1(thread, JSTaggedValue(1)); - PropertyDescriptor desc1(thread, JSHandle(thread, JSTaggedValue(2)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key1, desc1); - JSHandle key2(thread, JSTaggedValue(2)); - PropertyDescriptor desc2(thread, JSHandle(thread, JSTaggedValue(3)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key2, desc2); - JSHandle key3(thread, JSTaggedValue(3)); - PropertyDescriptor desc3(thread, JSHandle(thread, JSTaggedValue(4)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key3, desc3); - JSHandle key4(thread, JSTaggedValue(4)); - PropertyDescriptor desc4(thread, JSHandle(thread, JSTaggedValue(3)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key4, desc4); - - auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + JSHandle obj(thread_, arr); + EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 0); + JSHandle key0(thread_, JSTaggedValue(0)); + PropertyDescriptor desc0(thread_, JSHandle(thread_, JSTaggedValue(1)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key0, desc0); + JSHandle key1(thread_, JSTaggedValue(1)); + PropertyDescriptor desc1(thread_, JSHandle(thread_, JSTaggedValue(2)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key1, desc1); + JSHandle key2(thread_, JSTaggedValue(2)); + PropertyDescriptor desc2(thread_, JSHandle(thread_, JSTaggedValue(3)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key2, desc2); + JSHandle key3(thread_, JSTaggedValue(3)); + PropertyDescriptor desc3(thread_, JSHandle(thread_, JSTaggedValue(4)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key3, desc3); + JSHandle key4(thread_, JSTaggedValue(4)); + PropertyDescriptor desc4(thread_, JSHandle(thread_, JSTaggedValue(3)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key4, desc4); + + auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); ecmaRuntimeCallInfo1->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo1->SetThis(obj.GetTaggedValue()); ecmaRuntimeCallInfo1->SetCallArg(0, JSTaggedValue(static_cast(1))); ecmaRuntimeCallInfo1->SetCallArg(1, JSTaggedValue(static_cast(4))); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); JSTaggedValue result = Array::Slice(ecmaRuntimeCallInfo1.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); JSTaggedValue value(static_cast(result.GetRawData())); ASSERT_TRUE(value.IsECMAObject()); - PropertyDescriptor descRes(thread); - JSHandle valueHandle(thread, value); - EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(valueHandle), lengthKeyHandle).GetValue()->GetInt(), + PropertyDescriptor descRes(thread_); + JSHandle valueHandle(thread_, value); + EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(valueHandle), lengthKeyHandle).GetValue()->GetInt(), 3); - JSObject::GetOwnProperty(thread, valueHandle, key0, descRes); + JSObject::GetOwnProperty(thread_, valueHandle, key0, descRes); ASSERT_EQ(descRes.GetValue().GetTaggedValue(), JSTaggedValue(2)); - JSObject::GetOwnProperty(thread, valueHandle, key1, descRes); + JSObject::GetOwnProperty(thread_, valueHandle, key1, descRes); ASSERT_EQ(descRes.GetValue().GetTaggedValue(), JSTaggedValue(3)); - JSObject::GetOwnProperty(thread, valueHandle, key2, descRes); + JSObject::GetOwnProperty(thread_, valueHandle, key2, descRes); ASSERT_EQ(descRes.GetValue().GetTaggedValue(), JSTaggedValue(4)); } TEST_F(BuiltinsArrayTest, Splice) { - JSHandle lengthKeyHandle = thread->GlobalConstants()->GetHandledLengthString(); - JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); + JSHandle lengthKeyHandle = thread_->GlobalConstants()->GetHandledLengthString(); + JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread_, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); EXPECT_TRUE(arr != nullptr); - JSHandle obj(thread, arr); - EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 0); - JSHandle key0(thread, JSTaggedValue(0)); - PropertyDescriptor desc0(thread, JSHandle(thread, JSTaggedValue(1)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key0, desc0); - JSHandle key1(thread, JSTaggedValue(1)); - PropertyDescriptor desc1(thread, JSHandle(thread, JSTaggedValue(2)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key1, desc1); - JSHandle key2(thread, JSTaggedValue(2)); - PropertyDescriptor desc2(thread, JSHandle(thread, JSTaggedValue(3)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key2, desc2); - JSHandle key3(thread, JSTaggedValue(3)); - PropertyDescriptor desc3(thread, JSHandle(thread, JSTaggedValue(4)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key3, desc3); - JSHandle key4(thread, JSTaggedValue(4)); - PropertyDescriptor desc4(thread, JSHandle(thread, JSTaggedValue(5)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key4, desc4); - - auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 10); + JSHandle obj(thread_, arr); + EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 0); + JSHandle key0(thread_, JSTaggedValue(0)); + PropertyDescriptor desc0(thread_, JSHandle(thread_, JSTaggedValue(1)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key0, desc0); + JSHandle key1(thread_, JSTaggedValue(1)); + PropertyDescriptor desc1(thread_, JSHandle(thread_, JSTaggedValue(2)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key1, desc1); + JSHandle key2(thread_, JSTaggedValue(2)); + PropertyDescriptor desc2(thread_, JSHandle(thread_, JSTaggedValue(3)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key2, desc2); + JSHandle key3(thread_, JSTaggedValue(3)); + PropertyDescriptor desc3(thread_, JSHandle(thread_, JSTaggedValue(4)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key3, desc3); + JSHandle key4(thread_, JSTaggedValue(4)); + PropertyDescriptor desc4(thread_, JSHandle(thread_, JSTaggedValue(5)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key4, desc4); + + auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 10); ecmaRuntimeCallInfo1->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo1->SetThis(obj.GetTaggedValue()); ecmaRuntimeCallInfo1->SetCallArg(0, JSTaggedValue(static_cast(1))); ecmaRuntimeCallInfo1->SetCallArg(1, JSTaggedValue(static_cast(2))); ecmaRuntimeCallInfo1->SetCallArg(2, JSTaggedValue(static_cast(100))); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); JSTaggedValue result = Array::Splice(ecmaRuntimeCallInfo1.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); JSTaggedValue value(static_cast(result.GetRawData())); ASSERT_TRUE(value.IsECMAObject()); - EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 4); + EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 4); - PropertyDescriptor descRes(thread); - JSHandle valueHandle(thread, value); - EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(valueHandle), lengthKeyHandle).GetValue()->GetInt(), + PropertyDescriptor descRes(thread_); + JSHandle valueHandle(thread_, value); + EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(valueHandle), lengthKeyHandle).GetValue()->GetInt(), 2); - JSObject::GetOwnProperty(thread, valueHandle, key0, descRes); + JSObject::GetOwnProperty(thread_, valueHandle, key0, descRes); ASSERT_EQ(descRes.GetValue().GetTaggedValue(), JSTaggedValue(2)); } // ES2019 22.1.3.10 Builtin Array.flat() TEST_F(BuiltinsArrayTest, Flat) { - ASSERT_NE(thread, nullptr); - JSHandle length_key_handle = thread->GlobalConstants()->GetHandledLengthString(); + ASSERT_NE(thread_, nullptr); + JSHandle length_key_handle = thread_->GlobalConstants()->GetHandledLengthString(); - JSArray *arr1 = JSArray::ArrayCreate(thread, JSTaggedNumber(0)).GetObject(); - JSArray *arr2 = JSArray::ArrayCreate(thread, JSTaggedNumber(0)).GetObject(); - JSArray *arr3 = JSArray::ArrayCreate(thread, JSTaggedNumber(0)).GetObject(); + JSArray *arr1 = JSArray::ArrayCreate(thread_, JSTaggedNumber(0)).GetObject(); + JSArray *arr2 = JSArray::ArrayCreate(thread_, JSTaggedNumber(0)).GetObject(); + JSArray *arr3 = JSArray::ArrayCreate(thread_, JSTaggedNumber(0)).GetObject(); EXPECT_TRUE(arr1 != nullptr); EXPECT_TRUE(arr2 != nullptr); EXPECT_TRUE(arr3 != nullptr); - JSHandle obj1(thread, arr1); - JSHandle obj2(thread, arr2); - JSHandle obj3(thread, arr3); + JSHandle obj1(thread_, arr1); + JSHandle obj2(thread_, arr2); + JSHandle obj3(thread_, arr3); - EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(obj1), length_key_handle).GetValue()->GetInt(), 0); - EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(obj2), length_key_handle).GetValue()->GetInt(), 0); - EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(obj3), length_key_handle).GetValue()->GetInt(), 0); + EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(obj1), length_key_handle).GetValue()->GetInt(), 0); + EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(obj2), length_key_handle).GetValue()->GetInt(), 0); + EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(obj3), length_key_handle).GetValue()->GetInt(), 0); - JSHandle key0(thread, JSTaggedValue(0)); - JSHandle key1(thread, JSTaggedValue(1)); - JSHandle key2(thread, JSTaggedValue(2)); + JSHandle key0(thread_, JSTaggedValue(0)); + JSHandle key1(thread_, JSTaggedValue(1)); + JSHandle key2(thread_, JSTaggedValue(2)); // arr1 = [0, 1, arr2] - PropertyDescriptor desc0(thread, JSHandle(thread, JSTaggedValue(0)), true, true, true); - PropertyDescriptor desc1(thread, JSHandle(thread, JSTaggedValue(1)), true, true, true); - PropertyDescriptor desc_nested1(thread, JSHandle(thread, obj2.GetTaggedValue()), true, true, true); - JSArray::DefineOwnProperty(thread, obj1, key0, desc0); - JSArray::DefineOwnProperty(thread, obj1, key1, desc1); - JSArray::DefineOwnProperty(thread, obj1, key2, desc_nested1); + PropertyDescriptor desc0(thread_, JSHandle(thread_, JSTaggedValue(0)), true, true, true); + PropertyDescriptor desc1(thread_, JSHandle(thread_, JSTaggedValue(1)), true, true, true); + PropertyDescriptor desc_nested1(thread_, JSHandle(thread_, obj2.GetTaggedValue()), true, true, true); + JSArray::DefineOwnProperty(thread_, obj1, key0, desc0); + JSArray::DefineOwnProperty(thread_, obj1, key1, desc1); + JSArray::DefineOwnProperty(thread_, obj1, key2, desc_nested1); // arr2 = [2, 3, arr3] - PropertyDescriptor desc2(thread, JSHandle(thread, JSTaggedValue(2)), true, true, true); - PropertyDescriptor desc3(thread, JSHandle(thread, JSTaggedValue(3)), true, true, true); - PropertyDescriptor desc_nested2(thread, JSHandle(thread, obj3.GetTaggedValue()), true, true, true); - JSArray::DefineOwnProperty(thread, obj2, key0, desc2); - JSArray::DefineOwnProperty(thread, obj2, key1, desc3); - JSArray::DefineOwnProperty(thread, obj2, key2, desc_nested2); + PropertyDescriptor desc2(thread_, JSHandle(thread_, JSTaggedValue(2)), true, true, true); + PropertyDescriptor desc3(thread_, JSHandle(thread_, JSTaggedValue(3)), true, true, true); + PropertyDescriptor desc_nested2(thread_, JSHandle(thread_, obj3.GetTaggedValue()), true, true, true); + JSArray::DefineOwnProperty(thread_, obj2, key0, desc2); + JSArray::DefineOwnProperty(thread_, obj2, key1, desc3); + JSArray::DefineOwnProperty(thread_, obj2, key2, desc_nested2); // arr3 = [4, 5] - PropertyDescriptor desc4(thread, JSHandle(thread, JSTaggedValue(4)), true, true, true); - PropertyDescriptor desc5(thread, JSHandle(thread, JSTaggedValue(5)), true, true, true); - JSArray::DefineOwnProperty(thread, obj3, key0, desc4); - JSArray::DefineOwnProperty(thread, obj3, key1, desc5); + PropertyDescriptor desc4(thread_, JSHandle(thread_, JSTaggedValue(4)), true, true, true); + PropertyDescriptor desc5(thread_, JSHandle(thread_, JSTaggedValue(5)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj3, key0, desc4); + JSArray::DefineOwnProperty(thread_, obj3, key1, desc5); // [0, 1, [2, 3, [4, 5]]].flat(2) = [0, 1, 2, 3, 4, 5] - auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo1->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo1->SetThis(obj1.GetTaggedValue()); ecmaRuntimeCallInfo1->SetCallArg(0, JSTaggedValue(static_cast(2))); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); JSTaggedValue result = Array::Flat(ecmaRuntimeCallInfo1.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); - PropertyDescriptor desc_res(thread); + PropertyDescriptor desc_res(thread_); JSTaggedValue value(static_cast(result.GetRawData())); - JSHandle value_handle(thread, value); + JSHandle value_handle(thread_, value); EXPECT_EQ( - JSArray::GetProperty(thread, JSHandle(value_handle), length_key_handle).GetValue()->GetInt(), 6); + JSArray::GetProperty(thread_, JSHandle(value_handle), length_key_handle).GetValue()->GetInt(), + 6); - JSHandle key3(thread, JSTaggedValue(3)); - JSHandle key4(thread, JSTaggedValue(4)); - JSHandle key5(thread, JSTaggedValue(5)); + JSHandle key3(thread_, JSTaggedValue(3)); + JSHandle key4(thread_, JSTaggedValue(4)); + JSHandle key5(thread_, JSTaggedValue(5)); - JSObject::GetOwnProperty(thread, value_handle, key0, desc_res); + JSObject::GetOwnProperty(thread_, value_handle, key0, desc_res); ASSERT_EQ(desc_res.GetValue().GetTaggedValue(), JSTaggedValue(0)); - JSObject::GetOwnProperty(thread, value_handle, key1, desc_res); + JSObject::GetOwnProperty(thread_, value_handle, key1, desc_res); ASSERT_EQ(desc_res.GetValue().GetTaggedValue(), JSTaggedValue(1)); - JSObject::GetOwnProperty(thread, value_handle, key2, desc_res); + JSObject::GetOwnProperty(thread_, value_handle, key2, desc_res); ASSERT_EQ(desc_res.GetValue().GetTaggedValue(), JSTaggedValue(2)); - JSObject::GetOwnProperty(thread, value_handle, key3, desc_res); + JSObject::GetOwnProperty(thread_, value_handle, key3, desc_res); ASSERT_EQ(desc_res.GetValue().GetTaggedValue(), JSTaggedValue(3)); - JSObject::GetOwnProperty(thread, value_handle, key4, desc_res); + JSObject::GetOwnProperty(thread_, value_handle, key4, desc_res); ASSERT_EQ(desc_res.GetValue().GetTaggedValue(), JSTaggedValue(4)); - JSObject::GetOwnProperty(thread, value_handle, key5, desc_res); + JSObject::GetOwnProperty(thread_, value_handle, key5, desc_res); ASSERT_EQ(desc_res.GetValue().GetTaggedValue(), JSTaggedValue(5)); // [0, 1, [2, 3, [4, 5]]].flat() = [0, 1, 2, 3, [4, 5]] - auto ecmaRuntimeCallInfo2 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); + auto ecmaRuntimeCallInfo2 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); ecmaRuntimeCallInfo2->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo2->SetThis(obj1.GetTaggedValue()); - prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo2.get()); + prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo2.get()); result = Array::Flat(ecmaRuntimeCallInfo2.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); JSTaggedValue value2(static_cast(result.GetRawData())); - JSHandle value_handle2(thread, value2); + JSHandle value_handle2(thread_, value2); EXPECT_EQ( - JSArray::GetProperty(thread, JSHandle(value_handle2), length_key_handle).GetValue()->GetInt(), + JSArray::GetProperty(thread_, JSHandle(value_handle2), length_key_handle).GetValue()->GetInt(), 5); - JSObject::GetOwnProperty(thread, value_handle2, key0, desc_res); + JSObject::GetOwnProperty(thread_, value_handle2, key0, desc_res); ASSERT_EQ(desc_res.GetValue().GetTaggedValue(), JSTaggedValue(0)); - JSObject::GetOwnProperty(thread, value_handle2, key1, desc_res); + JSObject::GetOwnProperty(thread_, value_handle2, key1, desc_res); ASSERT_EQ(desc_res.GetValue().GetTaggedValue(), JSTaggedValue(1)); - JSObject::GetOwnProperty(thread, value_handle2, key2, desc_res); + JSObject::GetOwnProperty(thread_, value_handle2, key2, desc_res); ASSERT_EQ(desc_res.GetValue().GetTaggedValue(), JSTaggedValue(2)); - JSObject::GetOwnProperty(thread, value_handle2, key3, desc_res); + JSObject::GetOwnProperty(thread_, value_handle2, key3, desc_res); ASSERT_EQ(desc_res.GetValue().GetTaggedValue(), JSTaggedValue(3)); - JSObject::GetOwnProperty(thread, value_handle2, key4, desc_res); + JSObject::GetOwnProperty(thread_, value_handle2, key4, desc_res); ASSERT_TRUE(desc_res.GetValue().GetTaggedValue().IsECMAObject()); JSTaggedValue inner_arr_value(desc_res.GetValue().GetTaggedValue()); - JSHandle inner_arr_handle(thread, inner_arr_value); + JSHandle inner_arr_handle(thread_, inner_arr_value); - EXPECT_EQ( - JSArray::GetProperty(thread, JSHandle(inner_arr_handle), length_key_handle).GetValue()->GetInt(), - 2); + EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(inner_arr_handle), length_key_handle) + .GetValue() + ->GetInt(), + 2); - JSObject::GetOwnProperty(thread, inner_arr_handle, key0, desc_res); + JSObject::GetOwnProperty(thread_, inner_arr_handle, key0, desc_res); ASSERT_EQ(desc_res.GetValue().GetTaggedValue(), JSTaggedValue(4)); - JSObject::GetOwnProperty(thread, inner_arr_handle, key1, desc_res); + JSObject::GetOwnProperty(thread_, inner_arr_handle, key1, desc_res); ASSERT_EQ(desc_res.GetValue().GetTaggedValue(), JSTaggedValue(5)); } @@ -796,242 +798,243 @@ TEST_F(BuiltinsArrayTest, Flat) TEST_F(BuiltinsArrayTest, FlatMap) { // [[1], [2], [4]].flatMap(x => [x*2]) = [2, 4, 8] - ASSERT_NE(thread, nullptr); - auto ecma_vm = thread->GetEcmaVM(); + ASSERT_NE(thread_, nullptr); + auto ecma_vm = thread_->GetEcmaVM(); JSHandle env = ecma_vm->GetGlobalEnv(); ObjectFactory *factory_ = ecma_vm->GetFactory(); - JSHandle length_key_handle = thread->GlobalConstants()->GetHandledLengthString(); - JSArray *arr = JSArray::ArrayCreate(thread, JSTaggedNumber(0)).GetObject(); - JSArray *arr1 = JSArray::ArrayCreate(thread, JSTaggedNumber(0)).GetObject(); - JSArray *arr2 = JSArray::ArrayCreate(thread, JSTaggedNumber(0)).GetObject(); - JSArray *arr3 = JSArray::ArrayCreate(thread, JSTaggedNumber(0)).GetObject(); + JSHandle length_key_handle = thread_->GlobalConstants()->GetHandledLengthString(); + JSArray *arr = JSArray::ArrayCreate(thread_, JSTaggedNumber(0)).GetObject(); + JSArray *arr1 = JSArray::ArrayCreate(thread_, JSTaggedNumber(0)).GetObject(); + JSArray *arr2 = JSArray::ArrayCreate(thread_, JSTaggedNumber(0)).GetObject(); + JSArray *arr3 = JSArray::ArrayCreate(thread_, JSTaggedNumber(0)).GetObject(); EXPECT_TRUE(arr != nullptr); EXPECT_TRUE(arr1 != nullptr); EXPECT_TRUE(arr2 != nullptr); EXPECT_TRUE(arr3 != nullptr); - JSHandle obj(thread, arr); - JSHandle obj1(thread, arr1); - JSHandle obj2(thread, arr2); - JSHandle obj3(thread, arr3); + JSHandle obj(thread_, arr); + JSHandle obj1(thread_, arr1); + JSHandle obj2(thread_, arr2); + JSHandle obj3(thread_, arr3); - EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(obj), length_key_handle).GetValue()->GetInt(), 0); - EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(obj1), length_key_handle).GetValue()->GetInt(), 0); - EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(obj2), length_key_handle).GetValue()->GetInt(), 0); - EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(obj3), length_key_handle).GetValue()->GetInt(), 0); + EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(obj), length_key_handle).GetValue()->GetInt(), 0); + EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(obj1), length_key_handle).GetValue()->GetInt(), 0); + EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(obj2), length_key_handle).GetValue()->GetInt(), 0); + EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(obj3), length_key_handle).GetValue()->GetInt(), 0); // create [1], [2], [4] elements - JSHandle key0(thread, JSTaggedNumber(0)); - JSHandle key1(thread, JSTaggedNumber(1)); - JSHandle key2(thread, JSTaggedNumber(2)); - PropertyDescriptor desc1(thread, JSHandle(thread, JSTaggedValue(1)), true, true, true); - PropertyDescriptor desc2(thread, JSHandle(thread, JSTaggedValue(2)), true, true, true); - PropertyDescriptor desc4(thread, JSHandle(thread, JSTaggedValue(4)), true, true, true); - JSObject::DefineOwnProperty(thread, obj1, key0, desc1); - JSObject::DefineOwnProperty(thread, obj2, key0, desc2); - JSObject::DefineOwnProperty(thread, obj3, key0, desc4); + JSHandle key0(thread_, JSTaggedNumber(0)); + JSHandle key1(thread_, JSTaggedNumber(1)); + JSHandle key2(thread_, JSTaggedNumber(2)); + PropertyDescriptor desc1(thread_, JSHandle(thread_, JSTaggedValue(1)), true, true, true); + PropertyDescriptor desc2(thread_, JSHandle(thread_, JSTaggedValue(2)), true, true, true); + PropertyDescriptor desc4(thread_, JSHandle(thread_, JSTaggedValue(4)), true, true, true); + JSObject::DefineOwnProperty(thread_, obj1, key0, desc1); + JSObject::DefineOwnProperty(thread_, obj2, key0, desc2); + JSObject::DefineOwnProperty(thread_, obj3, key0, desc4); // arr = [[1], [2], [4]] - PropertyDescriptor obj_desc1(thread, JSHandle(thread, obj1.GetTaggedValue()), true, true, true); - PropertyDescriptor obj_desc2(thread, JSHandle(thread, obj2.GetTaggedValue()), true, true, true); - PropertyDescriptor obj_desc4(thread, JSHandle(thread, obj3.GetTaggedValue()), true, true, true); - JSObject::DefineOwnProperty(thread, obj, key0, obj_desc1); - JSObject::DefineOwnProperty(thread, obj, key1, obj_desc2); - JSObject::DefineOwnProperty(thread, obj, key2, obj_desc4); - - EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(obj1), length_key_handle).GetValue()->GetInt(), 1); - EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(obj2), length_key_handle).GetValue()->GetInt(), 1); - EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(obj3), length_key_handle).GetValue()->GetInt(), 1); - EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(obj), length_key_handle).GetValue()->GetInt(), 3); + PropertyDescriptor obj_desc1(thread_, JSHandle(thread_, obj1.GetTaggedValue()), true, true, true); + PropertyDescriptor obj_desc2(thread_, JSHandle(thread_, obj2.GetTaggedValue()), true, true, true); + PropertyDescriptor obj_desc4(thread_, JSHandle(thread_, obj3.GetTaggedValue()), true, true, true); + JSObject::DefineOwnProperty(thread_, obj, key0, obj_desc1); + JSObject::DefineOwnProperty(thread_, obj, key1, obj_desc2); + JSObject::DefineOwnProperty(thread_, obj, key2, obj_desc4); + + EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(obj1), length_key_handle).GetValue()->GetInt(), 1); + EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(obj2), length_key_handle).GetValue()->GetInt(), 1); + EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(obj3), length_key_handle).GetValue()->GetInt(), 1); + EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(obj), length_key_handle).GetValue()->GetInt(), 3); JSHandle cb = factory_->NewJSFunction(env, reinterpret_cast(TestClass::TestFlatMapFunc)); - auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo1->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo1->SetThis(obj.GetTaggedValue()); ecmaRuntimeCallInfo1->SetCallArg(0, cb.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); JSTaggedValue result = Array::FlatMap(ecmaRuntimeCallInfo1.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); - PropertyDescriptor res_desc(thread); + PropertyDescriptor res_desc(thread_); JSTaggedValue value(static_cast(result.GetRawData())); - JSHandle value_handle(thread, value); + JSHandle value_handle(thread_, value); EXPECT_EQ( - JSArray::GetProperty(thread, JSHandle(value_handle), length_key_handle).GetValue()->GetInt(), 3); + JSArray::GetProperty(thread_, JSHandle(value_handle), length_key_handle).GetValue()->GetInt(), + 3); - JSObject::GetOwnProperty(thread, value_handle, key0, res_desc); + JSObject::GetOwnProperty(thread_, value_handle, key0, res_desc); ASSERT_EQ(res_desc.GetValue().GetTaggedValue(), JSTaggedValue(2)); - JSObject::GetOwnProperty(thread, value_handle, key1, res_desc); + JSObject::GetOwnProperty(thread_, value_handle, key1, res_desc); ASSERT_EQ(res_desc.GetValue().GetTaggedValue(), JSTaggedValue(4)); - JSObject::GetOwnProperty(thread, value_handle, key2, res_desc); + JSObject::GetOwnProperty(thread_, value_handle, key2, res_desc); ASSERT_EQ(res_desc.GetValue().GetTaggedValue(), JSTaggedValue(8)); } // 22.1.3.6 new Array(1,2,3,4,5).Fill(0,1,3) TEST_F(BuiltinsArrayTest, Fill) { - JSHandle lengthKeyHandle = thread->GlobalConstants()->GetHandledLengthString(); - JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); + JSHandle lengthKeyHandle = thread_->GlobalConstants()->GetHandledLengthString(); + JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread_, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); EXPECT_TRUE(arr != nullptr); - JSHandle obj(thread, arr); - EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 0); - - JSHandle key0(thread, JSTaggedValue(0)); - PropertyDescriptor desc0(thread, JSHandle(thread, JSTaggedValue(1)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key0, desc0); - JSHandle key1(thread, JSTaggedValue(1)); - PropertyDescriptor desc1(thread, JSHandle(thread, JSTaggedValue(2)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key1, desc1); - JSHandle key2(thread, JSTaggedValue(2)); - PropertyDescriptor desc2(thread, JSHandle(thread, JSTaggedValue(3)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key2, desc2); - JSHandle key3(thread, JSTaggedValue(3)); - PropertyDescriptor desc3(thread, JSHandle(thread, JSTaggedValue(4)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key3, desc3); - JSHandle key4(thread, JSTaggedValue(4)); - PropertyDescriptor desc4(thread, JSHandle(thread, JSTaggedValue(5)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key4, desc4); - - auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 10); + JSHandle obj(thread_, arr); + EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 0); + + JSHandle key0(thread_, JSTaggedValue(0)); + PropertyDescriptor desc0(thread_, JSHandle(thread_, JSTaggedValue(1)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key0, desc0); + JSHandle key1(thread_, JSTaggedValue(1)); + PropertyDescriptor desc1(thread_, JSHandle(thread_, JSTaggedValue(2)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key1, desc1); + JSHandle key2(thread_, JSTaggedValue(2)); + PropertyDescriptor desc2(thread_, JSHandle(thread_, JSTaggedValue(3)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key2, desc2); + JSHandle key3(thread_, JSTaggedValue(3)); + PropertyDescriptor desc3(thread_, JSHandle(thread_, JSTaggedValue(4)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key3, desc3); + JSHandle key4(thread_, JSTaggedValue(4)); + PropertyDescriptor desc4(thread_, JSHandle(thread_, JSTaggedValue(5)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key4, desc4); + + auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 10); ecmaRuntimeCallInfo1->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo1->SetThis(obj.GetTaggedValue()); ecmaRuntimeCallInfo1->SetCallArg(0, JSTaggedValue(static_cast(0))); ecmaRuntimeCallInfo1->SetCallArg(1, JSTaggedValue(static_cast(1))); ecmaRuntimeCallInfo1->SetCallArg(2, JSTaggedValue(static_cast(3))); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); JSTaggedValue result = Array::Fill(ecmaRuntimeCallInfo1.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); JSTaggedValue value(static_cast(result.GetRawData())); ASSERT_TRUE(value.IsECMAObject()); - PropertyDescriptor descRes(thread); - JSHandle valueHandle(thread, value); - JSObject::GetOwnProperty(thread, valueHandle, key0, descRes); + PropertyDescriptor descRes(thread_); + JSHandle valueHandle(thread_, value); + JSObject::GetOwnProperty(thread_, valueHandle, key0, descRes); ASSERT_EQ(descRes.GetValue().GetTaggedValue(), JSTaggedValue(1)); - JSObject::GetOwnProperty(thread, valueHandle, key1, descRes); + JSObject::GetOwnProperty(thread_, valueHandle, key1, descRes); ASSERT_EQ(descRes.GetValue().GetTaggedValue(), JSTaggedValue(0)); - JSObject::GetOwnProperty(thread, valueHandle, key2, descRes); + JSObject::GetOwnProperty(thread_, valueHandle, key2, descRes); ASSERT_EQ(descRes.GetValue().GetTaggedValue(), JSTaggedValue(0)); - JSObject::GetOwnProperty(thread, valueHandle, key3, descRes); + JSObject::GetOwnProperty(thread_, valueHandle, key3, descRes); ASSERT_EQ(descRes.GetValue().GetTaggedValue(), JSTaggedValue(4)); - JSObject::GetOwnProperty(thread, valueHandle, key4, descRes); + JSObject::GetOwnProperty(thread_, valueHandle, key4, descRes); ASSERT_EQ(descRes.GetValue().GetTaggedValue(), JSTaggedValue(5)); } TEST_F(BuiltinsArrayTest, Find) { - auto ecmaVM = thread->GetEcmaVM(); + auto ecmaVM = thread_->GetEcmaVM(); JSHandle env = ecmaVM->GetGlobalEnv(); ObjectFactory *factory = ecmaVM->GetFactory(); - JSHandle lengthKeyHandle = thread->GlobalConstants()->GetHandledLengthString(); - JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); + JSHandle lengthKeyHandle = thread_->GlobalConstants()->GetHandledLengthString(); + JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread_, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); EXPECT_TRUE(arr != nullptr); - JSHandle obj(thread, arr); - EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 0); - JSHandle key0(thread, JSTaggedValue(0)); - PropertyDescriptor desc0(thread, JSHandle(thread, JSTaggedValue(1)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key0, desc0); - JSHandle key1(thread, JSTaggedValue(1)); - PropertyDescriptor desc1(thread, JSHandle(thread, JSTaggedValue(102)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key1, desc1); - JSHandle key2(thread, JSTaggedValue(2)); - PropertyDescriptor desc2(thread, JSHandle(thread, JSTaggedValue(3)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key2, desc2); - JSHandle jsArray(JSArray::ArrayCreate(thread, JSTaggedNumber(0))); + JSHandle obj(thread_, arr); + EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 0); + JSHandle key0(thread_, JSTaggedValue(0)); + PropertyDescriptor desc0(thread_, JSHandle(thread_, JSTaggedValue(1)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key0, desc0); + JSHandle key1(thread_, JSTaggedValue(1)); + PropertyDescriptor desc1(thread_, JSHandle(thread_, JSTaggedValue(102)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key1, desc1); + JSHandle key2(thread_, JSTaggedValue(2)); + PropertyDescriptor desc2(thread_, JSHandle(thread_, JSTaggedValue(3)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key2, desc2); + JSHandle jsArray(JSArray::ArrayCreate(thread_, JSTaggedNumber(0))); JSHandle func = factory->NewJSFunction(env, reinterpret_cast(TestClass::TestFindFunc)); - auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); ecmaRuntimeCallInfo1->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo1->SetThis(obj.GetTaggedValue()); ecmaRuntimeCallInfo1->SetCallArg(0, func.GetTaggedValue()); ecmaRuntimeCallInfo1->SetCallArg(1, jsArray.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); JSTaggedValue result2 = Array::Find(ecmaRuntimeCallInfo1.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); EXPECT_EQ(result2.GetRawData(), JSTaggedValue(102).GetRawData()); } TEST_F(BuiltinsArrayTest, FindIndex) { - auto ecmaVM = thread->GetEcmaVM(); + auto ecmaVM = thread_->GetEcmaVM(); JSHandle env = ecmaVM->GetGlobalEnv(); ObjectFactory *factory = ecmaVM->GetFactory(); - JSHandle lengthKeyHandle = thread->GlobalConstants()->GetHandledLengthString(); - JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); + JSHandle lengthKeyHandle = thread_->GlobalConstants()->GetHandledLengthString(); + JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread_, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); EXPECT_TRUE(arr != nullptr); - JSHandle obj(thread, arr); - EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 0); + JSHandle obj(thread_, arr); + EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 0); - JSHandle key0(thread, JSTaggedValue(0)); - PropertyDescriptor desc0(thread, JSHandle(thread, JSTaggedValue(1)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key0, desc0); + JSHandle key0(thread_, JSTaggedValue(0)); + PropertyDescriptor desc0(thread_, JSHandle(thread_, JSTaggedValue(1)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key0, desc0); - JSHandle key1(thread, JSTaggedValue(1)); - PropertyDescriptor desc1(thread, JSHandle(thread, JSTaggedValue(2)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key1, desc1); - JSHandle key2(thread, JSTaggedValue(2)); - PropertyDescriptor desc2(thread, JSHandle(thread, JSTaggedValue(30)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key2, desc2); + JSHandle key1(thread_, JSTaggedValue(1)); + PropertyDescriptor desc1(thread_, JSHandle(thread_, JSTaggedValue(2)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key1, desc1); + JSHandle key2(thread_, JSTaggedValue(2)); + PropertyDescriptor desc2(thread_, JSHandle(thread_, JSTaggedValue(30)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key2, desc2); - JSHandle jsArray(JSArray::ArrayCreate(thread, JSTaggedNumber(0))); + JSHandle jsArray(JSArray::ArrayCreate(thread_, JSTaggedNumber(0))); JSHandle func = factory->NewJSFunction(env, reinterpret_cast(TestClass::TestFindIndexFunc)); - auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); ecmaRuntimeCallInfo1->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo1->SetThis(obj.GetTaggedValue()); ecmaRuntimeCallInfo1->SetCallArg(0, func.GetTaggedValue()); ecmaRuntimeCallInfo1->SetCallArg(1, jsArray.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); JSTaggedValue result2 = Array::FindIndex(ecmaRuntimeCallInfo1.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); EXPECT_EQ(result2.GetRawData(), JSTaggedValue(static_cast(2)).GetRawData()); } TEST_F(BuiltinsArrayTest, ForEach) { - auto ecmaVM = thread->GetEcmaVM(); + auto ecmaVM = thread_->GetEcmaVM(); JSHandle env = ecmaVM->GetGlobalEnv(); ObjectFactory *factory = ecmaVM->GetFactory(); - JSHandle lengthKeyHandle = thread->GlobalConstants()->GetHandledLengthString(); - JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); + JSHandle lengthKeyHandle = thread_->GlobalConstants()->GetHandledLengthString(); + JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread_, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); EXPECT_TRUE(arr != nullptr); - JSHandle obj(thread, arr); - EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 0); - - JSHandle key0(thread, JSTaggedValue(0)); - PropertyDescriptor desc0(thread, JSHandle(thread, JSTaggedValue(1)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key0, desc0); - JSHandle key1(thread, JSTaggedValue(1)); - PropertyDescriptor desc1(thread, JSHandle(thread, JSTaggedValue(2)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key1, desc1); - JSHandle key2(thread, JSTaggedValue(2)); - PropertyDescriptor desc2(thread, JSHandle(thread, JSTaggedValue(3)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key2, desc2); - - JSHandle jsArray(JSArray::ArrayCreate(thread, JSTaggedNumber(0))); + JSHandle obj(thread_, arr); + EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 0); + + JSHandle key0(thread_, JSTaggedValue(0)); + PropertyDescriptor desc0(thread_, JSHandle(thread_, JSTaggedValue(1)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key0, desc0); + JSHandle key1(thread_, JSTaggedValue(1)); + PropertyDescriptor desc1(thread_, JSHandle(thread_, JSTaggedValue(2)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key1, desc1); + JSHandle key2(thread_, JSTaggedValue(2)); + PropertyDescriptor desc2(thread_, JSHandle(thread_, JSTaggedValue(3)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key2, desc2); + + JSHandle jsArray(JSArray::ArrayCreate(thread_, JSTaggedNumber(0))); JSHandle func = factory->NewJSFunction(env, reinterpret_cast(TestClass::TestForEachFunc)); - auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); ecmaRuntimeCallInfo1->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo1->SetThis(obj.GetTaggedValue()); ecmaRuntimeCallInfo1->SetCallArg(0, func.GetTaggedValue()); ecmaRuntimeCallInfo1->SetCallArg(1, jsArray.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); JSTaggedValue result2 = Array::ForEach(ecmaRuntimeCallInfo1.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); EXPECT_EQ(result2.GetRawData(), JSTaggedValue::VALUE_UNDEFINED); EXPECT_EQ(jsArray->GetArrayLength(), 3); } @@ -1039,652 +1042,652 @@ TEST_F(BuiltinsArrayTest, ForEach) // ES2021 23.1.3.13 new Array(1,2,3,4,3).includes(searchElement [ , fromIndex ]) TEST_F(BuiltinsArrayTest, Includes1) { - ASSERT_NE(thread, nullptr); + ASSERT_NE(thread_, nullptr); - JSHandle length_key_handle = thread->GlobalConstants()->GetHandledLengthString(); - JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread, JSTaggedNumber(0)).GetTaggedValue().GetHeapObject()); + JSHandle length_key_handle = thread_->GlobalConstants()->GetHandledLengthString(); + JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread_, JSTaggedNumber(0)).GetTaggedValue().GetHeapObject()); EXPECT_TRUE(arr != nullptr); - JSHandle obj(thread, arr); - EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(obj), length_key_handle).GetValue()->GetInt(), 0); - - JSHandle key0(thread, JSTaggedValue(0)); - PropertyDescriptor desc0(thread, JSHandle(thread, JSTaggedValue(1)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key0, desc0); - JSHandle key1(thread, JSTaggedValue(1)); - PropertyDescriptor desc1(thread, JSHandle(thread, JSTaggedValue(2)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key1, desc1); - JSHandle key2(thread, JSTaggedValue(2)); - PropertyDescriptor desc2(thread, JSHandle(thread, JSTaggedValue(3)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key2, desc2); - JSHandle key3(thread, JSTaggedValue(3)); - PropertyDescriptor desc3(thread, JSHandle(thread, JSTaggedValue(4)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key3, desc3); - JSHandle key4(thread, JSTaggedValue(4)); - PropertyDescriptor desc4(thread, JSHandle(thread, JSTaggedValue(3)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key4, desc4); + JSHandle obj(thread_, arr); + EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(obj), length_key_handle).GetValue()->GetInt(), 0); + + JSHandle key0(thread_, JSTaggedValue(0)); + PropertyDescriptor desc0(thread_, JSHandle(thread_, JSTaggedValue(1)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key0, desc0); + JSHandle key1(thread_, JSTaggedValue(1)); + PropertyDescriptor desc1(thread_, JSHandle(thread_, JSTaggedValue(2)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key1, desc1); + JSHandle key2(thread_, JSTaggedValue(2)); + PropertyDescriptor desc2(thread_, JSHandle(thread_, JSTaggedValue(3)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key2, desc2); + JSHandle key3(thread_, JSTaggedValue(3)); + PropertyDescriptor desc3(thread_, JSHandle(thread_, JSTaggedValue(4)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key3, desc3); + JSHandle key4(thread_, JSTaggedValue(4)); + PropertyDescriptor desc4(thread_, JSHandle(thread_, JSTaggedValue(3)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key4, desc4); // new Array(1,2,3,4,3).includes(1,0) - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(obj.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast(1))); ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(static_cast(0))); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = Array::Includes(ecmaRuntimeCallInfo.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_EQ(result.GetRawData(), JSTaggedValue(true).GetRawData()); } // ES2021 23.1.3.13 new Array(1,2,3,4,3).includes(searchElement [ , fromIndex ]) TEST_F(BuiltinsArrayTest, Includes2) { - ASSERT_NE(thread, nullptr); + ASSERT_NE(thread_, nullptr); - JSHandle length_key_handle = thread->GlobalConstants()->GetHandledLengthString(); - JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread, JSTaggedNumber(0)).GetTaggedValue().GetHeapObject()); + JSHandle length_key_handle = thread_->GlobalConstants()->GetHandledLengthString(); + JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread_, JSTaggedNumber(0)).GetTaggedValue().GetHeapObject()); EXPECT_TRUE(arr != nullptr); - JSHandle obj(thread, arr); - EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(obj), length_key_handle).GetValue()->GetInt(), 0); - - JSHandle key0(thread, JSTaggedValue(0)); - PropertyDescriptor desc0(thread, JSHandle(thread, JSTaggedValue(1)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key0, desc0); - JSHandle key1(thread, JSTaggedValue(1)); - PropertyDescriptor desc1(thread, JSHandle(thread, JSTaggedValue(2)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key1, desc1); - JSHandle key2(thread, JSTaggedValue(2)); - PropertyDescriptor desc2(thread, JSHandle(thread, JSTaggedValue(3)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key2, desc2); - JSHandle key3(thread, JSTaggedValue(3)); - PropertyDescriptor desc3(thread, JSHandle(thread, JSTaggedValue(4)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key3, desc3); - JSHandle key4(thread, JSTaggedValue(4)); - PropertyDescriptor desc4(thread, JSHandle(thread, JSTaggedValue(3)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key4, desc4); + JSHandle obj(thread_, arr); + EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(obj), length_key_handle).GetValue()->GetInt(), 0); + + JSHandle key0(thread_, JSTaggedValue(0)); + PropertyDescriptor desc0(thread_, JSHandle(thread_, JSTaggedValue(1)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key0, desc0); + JSHandle key1(thread_, JSTaggedValue(1)); + PropertyDescriptor desc1(thread_, JSHandle(thread_, JSTaggedValue(2)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key1, desc1); + JSHandle key2(thread_, JSTaggedValue(2)); + PropertyDescriptor desc2(thread_, JSHandle(thread_, JSTaggedValue(3)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key2, desc2); + JSHandle key3(thread_, JSTaggedValue(3)); + PropertyDescriptor desc3(thread_, JSHandle(thread_, JSTaggedValue(4)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key3, desc3); + JSHandle key4(thread_, JSTaggedValue(4)); + PropertyDescriptor desc4(thread_, JSHandle(thread_, JSTaggedValue(3)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key4, desc4); // new Array(1,2,3,4,3).includes(1,3) - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(obj.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast(1))); ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(static_cast(3))); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = Array::Includes(ecmaRuntimeCallInfo.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_EQ(result.GetRawData(), JSTaggedValue(false).GetRawData()); } // ES2021 23.1.3.13 new Array(1,2,3,4,3).includes(searchElement [ , fromIndex ]) TEST_F(BuiltinsArrayTest, Includes3) { - ASSERT_NE(thread, nullptr); + ASSERT_NE(thread_, nullptr); - JSHandle length_key_handle = thread->GlobalConstants()->GetHandledLengthString(); - JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread, JSTaggedNumber(0)).GetTaggedValue().GetHeapObject()); + JSHandle length_key_handle = thread_->GlobalConstants()->GetHandledLengthString(); + JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread_, JSTaggedNumber(0)).GetTaggedValue().GetHeapObject()); EXPECT_TRUE(arr != nullptr); - JSHandle obj(thread, arr); - EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(obj), length_key_handle).GetValue()->GetInt(), 0); - - JSHandle key0(thread, JSTaggedValue(0)); - PropertyDescriptor desc0(thread, JSHandle(thread, JSTaggedValue(1)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key0, desc0); - JSHandle key1(thread, JSTaggedValue(1)); - PropertyDescriptor desc1(thread, JSHandle(thread, JSTaggedValue(2)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key1, desc1); - JSHandle key2(thread, JSTaggedValue(2)); - PropertyDescriptor desc2(thread, JSHandle(thread, JSTaggedValue(3)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key2, desc2); - JSHandle key3(thread, JSTaggedValue(3)); - PropertyDescriptor desc3(thread, JSHandle(thread, JSTaggedValue(4)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key3, desc3); - JSHandle key4(thread, JSTaggedValue(4)); - PropertyDescriptor desc4(thread, JSHandle(thread, JSTaggedValue(3)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key4, desc4); + JSHandle obj(thread_, arr); + EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(obj), length_key_handle).GetValue()->GetInt(), 0); + + JSHandle key0(thread_, JSTaggedValue(0)); + PropertyDescriptor desc0(thread_, JSHandle(thread_, JSTaggedValue(1)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key0, desc0); + JSHandle key1(thread_, JSTaggedValue(1)); + PropertyDescriptor desc1(thread_, JSHandle(thread_, JSTaggedValue(2)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key1, desc1); + JSHandle key2(thread_, JSTaggedValue(2)); + PropertyDescriptor desc2(thread_, JSHandle(thread_, JSTaggedValue(3)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key2, desc2); + JSHandle key3(thread_, JSTaggedValue(3)); + PropertyDescriptor desc3(thread_, JSHandle(thread_, JSTaggedValue(4)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key3, desc3); + JSHandle key4(thread_, JSTaggedValue(4)); + PropertyDescriptor desc4(thread_, JSHandle(thread_, JSTaggedValue(3)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key4, desc4); // new Array(1,2,3,4,3).includes(5,0) - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(obj.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast(5))); ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(static_cast(0))); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = Array::Includes(ecmaRuntimeCallInfo.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_EQ(result.GetRawData(), JSTaggedValue(false).GetRawData()); } // ES2021 23.1.3.13 new Array(1,2,3,4,3).includes(searchElement [ , fromIndex ]) TEST_F(BuiltinsArrayTest, Includes4) { - ASSERT_NE(thread, nullptr); + ASSERT_NE(thread_, nullptr); - JSHandle length_key_handle = thread->GlobalConstants()->GetHandledLengthString(); - JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread, JSTaggedNumber(0)).GetTaggedValue().GetHeapObject()); + JSHandle length_key_handle = thread_->GlobalConstants()->GetHandledLengthString(); + JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread_, JSTaggedNumber(0)).GetTaggedValue().GetHeapObject()); EXPECT_TRUE(arr != nullptr); - JSHandle obj(thread, arr); - EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(obj), length_key_handle).GetValue()->GetInt(), 0); - - JSHandle key0(thread, JSTaggedValue(0)); - PropertyDescriptor desc0(thread, JSHandle(thread, JSTaggedValue(1)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key0, desc0); - JSHandle key1(thread, JSTaggedValue(1)); - PropertyDescriptor desc1(thread, JSHandle(thread, JSTaggedValue(2)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key1, desc1); - JSHandle key2(thread, JSTaggedValue(2)); - PropertyDescriptor desc2(thread, JSHandle(thread, JSTaggedValue(3)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key2, desc2); - JSHandle key3(thread, JSTaggedValue(3)); - PropertyDescriptor desc3(thread, JSHandle(thread, JSTaggedValue(4)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key3, desc3); - JSHandle key4(thread, JSTaggedValue(4)); - PropertyDescriptor desc4(thread, JSHandle(thread, JSTaggedValue(3)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key4, desc4); + JSHandle obj(thread_, arr); + EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(obj), length_key_handle).GetValue()->GetInt(), 0); + + JSHandle key0(thread_, JSTaggedValue(0)); + PropertyDescriptor desc0(thread_, JSHandle(thread_, JSTaggedValue(1)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key0, desc0); + JSHandle key1(thread_, JSTaggedValue(1)); + PropertyDescriptor desc1(thread_, JSHandle(thread_, JSTaggedValue(2)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key1, desc1); + JSHandle key2(thread_, JSTaggedValue(2)); + PropertyDescriptor desc2(thread_, JSHandle(thread_, JSTaggedValue(3)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key2, desc2); + JSHandle key3(thread_, JSTaggedValue(3)); + PropertyDescriptor desc3(thread_, JSHandle(thread_, JSTaggedValue(4)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key3, desc3); + JSHandle key4(thread_, JSTaggedValue(4)); + PropertyDescriptor desc4(thread_, JSHandle(thread_, JSTaggedValue(3)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key4, desc4); // new Array(1,2,3,4,3).includes(1) - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(obj.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast(1))); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = Array::Includes(ecmaRuntimeCallInfo.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_EQ(result.GetRawData(), JSTaggedValue(true).GetRawData()); } // ES2021 23.1.3.13 new Array(1,2,3,4,3).includes(searchElement [ , fromIndex ]) TEST_F(BuiltinsArrayTest, Includes5) { - ASSERT_NE(thread, nullptr); + ASSERT_NE(thread_, nullptr); - JSHandle length_key_handle = thread->GlobalConstants()->GetHandledLengthString(); - JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread, JSTaggedNumber(0)).GetTaggedValue().GetHeapObject()); + JSHandle length_key_handle = thread_->GlobalConstants()->GetHandledLengthString(); + JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread_, JSTaggedNumber(0)).GetTaggedValue().GetHeapObject()); EXPECT_TRUE(arr != nullptr); - JSHandle obj(thread, arr); - EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(obj), length_key_handle).GetValue()->GetInt(), 0); - - JSHandle key0(thread, JSTaggedValue(0)); - PropertyDescriptor desc0(thread, JSHandle(thread, JSTaggedValue(1)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key0, desc0); - JSHandle key1(thread, JSTaggedValue(1)); - PropertyDescriptor desc1(thread, JSHandle(thread, JSTaggedValue(2)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key1, desc1); - JSHandle key2(thread, JSTaggedValue(2)); - PropertyDescriptor desc2(thread, JSHandle(thread, JSTaggedValue(3)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key2, desc2); - JSHandle key3(thread, JSTaggedValue(3)); - PropertyDescriptor desc3(thread, JSHandle(thread, JSTaggedValue(4)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key3, desc3); - JSHandle key4(thread, JSTaggedValue(4)); - PropertyDescriptor desc4(thread, JSHandle(thread, JSTaggedValue(3)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key4, desc4); + JSHandle obj(thread_, arr); + EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(obj), length_key_handle).GetValue()->GetInt(), 0); + + JSHandle key0(thread_, JSTaggedValue(0)); + PropertyDescriptor desc0(thread_, JSHandle(thread_, JSTaggedValue(1)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key0, desc0); + JSHandle key1(thread_, JSTaggedValue(1)); + PropertyDescriptor desc1(thread_, JSHandle(thread_, JSTaggedValue(2)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key1, desc1); + JSHandle key2(thread_, JSTaggedValue(2)); + PropertyDescriptor desc2(thread_, JSHandle(thread_, JSTaggedValue(3)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key2, desc2); + JSHandle key3(thread_, JSTaggedValue(3)); + PropertyDescriptor desc3(thread_, JSHandle(thread_, JSTaggedValue(4)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key3, desc3); + JSHandle key4(thread_, JSTaggedValue(4)); + PropertyDescriptor desc4(thread_, JSHandle(thread_, JSTaggedValue(3)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key4, desc4); // new Array(1,2,3,4,3).includes(5) - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(obj.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast(5))); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = Array::Includes(ecmaRuntimeCallInfo.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_EQ(result.GetRawData(), JSTaggedValue(false).GetRawData()); } // 22.1.3.11 new Array(1,2,3,4,3).IndexOf(searchElement [ , fromIndex ]) TEST_F(BuiltinsArrayTest, IndexOf) { - JSHandle lengthKeyHandle = thread->GlobalConstants()->GetHandledLengthString(); - JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); + JSHandle lengthKeyHandle = thread_->GlobalConstants()->GetHandledLengthString(); + JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread_, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); EXPECT_TRUE(arr != nullptr); - JSHandle obj(thread, arr); - EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 0); - - JSHandle key0(thread, JSTaggedValue(0)); - PropertyDescriptor desc0(thread, JSHandle(thread, JSTaggedValue(1)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key0, desc0); - JSHandle key1(thread, JSTaggedValue(1)); - PropertyDescriptor desc1(thread, JSHandle(thread, JSTaggedValue(2)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key1, desc1); - JSHandle key2(thread, JSTaggedValue(2)); - PropertyDescriptor desc2(thread, JSHandle(thread, JSTaggedValue(3)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key2, desc2); - JSHandle key3(thread, JSTaggedValue(3)); - PropertyDescriptor desc3(thread, JSHandle(thread, JSTaggedValue(4)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key3, desc3); - JSHandle key4(thread, JSTaggedValue(4)); - PropertyDescriptor desc4(thread, JSHandle(thread, JSTaggedValue(3)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key4, desc4); - - auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + JSHandle obj(thread_, arr); + EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 0); + + JSHandle key0(thread_, JSTaggedValue(0)); + PropertyDescriptor desc0(thread_, JSHandle(thread_, JSTaggedValue(1)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key0, desc0); + JSHandle key1(thread_, JSTaggedValue(1)); + PropertyDescriptor desc1(thread_, JSHandle(thread_, JSTaggedValue(2)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key1, desc1); + JSHandle key2(thread_, JSTaggedValue(2)); + PropertyDescriptor desc2(thread_, JSHandle(thread_, JSTaggedValue(3)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key2, desc2); + JSHandle key3(thread_, JSTaggedValue(3)); + PropertyDescriptor desc3(thread_, JSHandle(thread_, JSTaggedValue(4)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key3, desc3); + JSHandle key4(thread_, JSTaggedValue(4)); + PropertyDescriptor desc4(thread_, JSHandle(thread_, JSTaggedValue(3)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key4, desc4); + + auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); ecmaRuntimeCallInfo1->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo1->SetThis(obj.GetTaggedValue()); ecmaRuntimeCallInfo1->SetCallArg(0, JSTaggedValue(static_cast(3))); ecmaRuntimeCallInfo1->SetCallArg(1, JSTaggedValue(static_cast(0))); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); JSTaggedValue result = Array::IndexOf(ecmaRuntimeCallInfo1.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_EQ(result.GetRawData(), JSTaggedValue(static_cast(2)).GetRawData()); - auto ecmaRuntimeCallInfo2 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + auto ecmaRuntimeCallInfo2 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); ecmaRuntimeCallInfo2->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo2->SetThis(obj.GetTaggedValue()); ecmaRuntimeCallInfo2->SetCallArg(0, JSTaggedValue(static_cast(3))); ecmaRuntimeCallInfo2->SetCallArg(1, JSTaggedValue(static_cast(3))); - prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo2.get()); + prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo2.get()); result = Array::IndexOf(ecmaRuntimeCallInfo2.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_EQ(result.GetRawData(), JSTaggedValue(static_cast(4)).GetRawData()); - auto ecmaRuntimeCallInfo3 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + auto ecmaRuntimeCallInfo3 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); ecmaRuntimeCallInfo3->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo3->SetThis(obj.GetTaggedValue()); ecmaRuntimeCallInfo3->SetCallArg(0, JSTaggedValue(static_cast(5))); ecmaRuntimeCallInfo3->SetCallArg(1, JSTaggedValue(static_cast(0))); - prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo3.get()); + prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo3.get()); result = Array::IndexOf(ecmaRuntimeCallInfo3.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_EQ(result.GetRawData(), JSTaggedValue(-1).GetRawData()); - auto ecmaRuntimeCallInfo4 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto ecmaRuntimeCallInfo4 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo4->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo4->SetThis(obj.GetTaggedValue()); ecmaRuntimeCallInfo4->SetCallArg(0, JSTaggedValue(static_cast(3))); - prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo4.get()); + prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo4.get()); result = Array::IndexOf(ecmaRuntimeCallInfo4.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_EQ(result.GetRawData(), JSTaggedValue(static_cast(2)).GetRawData()); } // 22.1.3.14 new Array(1,2,3,4,3).LastIndexOf(searchElement [ , fromIndex ]) TEST_F(BuiltinsArrayTest, LastIndexOf) { - JSHandle lengthKeyHandle = thread->GlobalConstants()->GetHandledLengthString(); - JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); + JSHandle lengthKeyHandle = thread_->GlobalConstants()->GetHandledLengthString(); + JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread_, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); EXPECT_TRUE(arr != nullptr); - JSHandle obj(thread, arr); - EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 0); - - JSHandle key0(thread, JSTaggedValue(0)); - PropertyDescriptor desc0(thread, JSHandle(thread, JSTaggedValue(1)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key0, desc0); - JSHandle key1(thread, JSTaggedValue(1)); - PropertyDescriptor desc1(thread, JSHandle(thread, JSTaggedValue(2)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key1, desc1); - JSHandle key2(thread, JSTaggedValue(2)); - PropertyDescriptor desc2(thread, JSHandle(thread, JSTaggedValue(3)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key2, desc2); - JSHandle key3(thread, JSTaggedValue(3)); - PropertyDescriptor desc3(thread, JSHandle(thread, JSTaggedValue(4)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key3, desc3); - JSHandle key4(thread, JSTaggedValue(4)); - PropertyDescriptor desc4(thread, JSHandle(thread, JSTaggedValue(3)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key4, desc4); + JSHandle obj(thread_, arr); + EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 0); + + JSHandle key0(thread_, JSTaggedValue(0)); + PropertyDescriptor desc0(thread_, JSHandle(thread_, JSTaggedValue(1)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key0, desc0); + JSHandle key1(thread_, JSTaggedValue(1)); + PropertyDescriptor desc1(thread_, JSHandle(thread_, JSTaggedValue(2)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key1, desc1); + JSHandle key2(thread_, JSTaggedValue(2)); + PropertyDescriptor desc2(thread_, JSHandle(thread_, JSTaggedValue(3)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key2, desc2); + JSHandle key3(thread_, JSTaggedValue(3)); + PropertyDescriptor desc3(thread_, JSHandle(thread_, JSTaggedValue(4)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key3, desc3); + JSHandle key4(thread_, JSTaggedValue(4)); + PropertyDescriptor desc4(thread_, JSHandle(thread_, JSTaggedValue(3)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key4, desc4); // new Array(1,2,3,4,3).LastIndexOf(3,4) - auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); ecmaRuntimeCallInfo1->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo1->SetThis(obj.GetTaggedValue()); ecmaRuntimeCallInfo1->SetCallArg(0, JSTaggedValue(static_cast(3))); ecmaRuntimeCallInfo1->SetCallArg(1, JSTaggedValue(static_cast(4))); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); JSTaggedValue result = Array::LastIndexOf(ecmaRuntimeCallInfo1.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_EQ(result.GetRawData(), JSTaggedValue(static_cast(4)).GetRawData()); // new Array(1,2,3,4,3).LastIndexOf(3,3) - auto ecmaRuntimeCallInfo2 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + auto ecmaRuntimeCallInfo2 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); ecmaRuntimeCallInfo2->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo2->SetThis(obj.GetTaggedValue()); ecmaRuntimeCallInfo2->SetCallArg(0, JSTaggedValue(static_cast(3))); ecmaRuntimeCallInfo2->SetCallArg(1, JSTaggedValue(static_cast(3))); - prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo2.get()); + prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo2.get()); result = Array::LastIndexOf(ecmaRuntimeCallInfo2.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_EQ(result.GetRawData(), JSTaggedValue(static_cast(2)).GetRawData()); // new Array(1,2,3,4,3).LastIndexOf(5,4) - auto ecmaRuntimeCallInfo3 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + auto ecmaRuntimeCallInfo3 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); ecmaRuntimeCallInfo3->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo3->SetThis(obj.GetTaggedValue()); ecmaRuntimeCallInfo3->SetCallArg(0, JSTaggedValue(static_cast(5))); ecmaRuntimeCallInfo3->SetCallArg(1, JSTaggedValue(static_cast(4))); - prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo3.get()); + prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo3.get()); result = Array::LastIndexOf(ecmaRuntimeCallInfo3.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_EQ(result.GetRawData(), JSTaggedValue(-1).GetRawData()); // new Array(1,2,3,4,3).LastIndexOf(3) - auto ecmaRuntimeCallInfo4 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto ecmaRuntimeCallInfo4 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo4->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo4->SetThis(obj.GetTaggedValue()); ecmaRuntimeCallInfo4->SetCallArg(0, JSTaggedValue(static_cast(3))); - prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo4.get()); + prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo4.get()); result = Array::LastIndexOf(ecmaRuntimeCallInfo4.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_EQ(result.GetRawData(), JSTaggedValue(static_cast(4)).GetRawData()); } // 22.1.3.11 new Array().Pop() TEST_F(BuiltinsArrayTest, Pop) { - JSHandle lengthKeyHandle = thread->GlobalConstants()->GetHandledLengthString(); - JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); + JSHandle lengthKeyHandle = thread_->GlobalConstants()->GetHandledLengthString(); + JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread_, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); EXPECT_TRUE(arr != nullptr); - JSHandle obj(thread, arr); - EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 0); + JSHandle obj(thread_, arr); + EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 0); - auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); + auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); ecmaRuntimeCallInfo1->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo1->SetThis(obj.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); JSTaggedValue result = Array::Pop(ecmaRuntimeCallInfo1.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_EQ(result.GetRawData(), JSTaggedValue::VALUE_UNDEFINED); ASSERT_EQ(result.GetRawData(), JSTaggedValue::VALUE_UNDEFINED); - JSHandle key0(thread, JSTaggedValue(0)); - PropertyDescriptor desc0(thread, JSHandle(thread, JSTaggedValue(1)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key0, desc0); - JSHandle key1(thread, JSTaggedValue(1)); - PropertyDescriptor desc1(thread, JSHandle(thread, JSTaggedValue(2)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key1, desc1); - JSHandle key2(thread, JSTaggedValue(2)); - PropertyDescriptor desc2(thread, JSHandle(thread, JSTaggedValue(3)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key2, desc2); - - auto ecmaRuntimeCallInfo2 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); + JSHandle key0(thread_, JSTaggedValue(0)); + PropertyDescriptor desc0(thread_, JSHandle(thread_, JSTaggedValue(1)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key0, desc0); + JSHandle key1(thread_, JSTaggedValue(1)); + PropertyDescriptor desc1(thread_, JSHandle(thread_, JSTaggedValue(2)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key1, desc1); + JSHandle key2(thread_, JSTaggedValue(2)); + PropertyDescriptor desc2(thread_, JSHandle(thread_, JSTaggedValue(3)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key2, desc2); + + auto ecmaRuntimeCallInfo2 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); ecmaRuntimeCallInfo2->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo2->SetThis(obj.GetTaggedValue()); - prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo2.get()); + prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo2.get()); result = Array::Pop(ecmaRuntimeCallInfo2.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_EQ(result.GetRawData(), JSTaggedValue(3).GetRawData()); } // 22.1.3.11 new Array(1,2,3).Push(...items) TEST_F(BuiltinsArrayTest, Push) { - JSHandle lengthKeyHandle = thread->GlobalConstants()->GetHandledLengthString(); - JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); + JSHandle lengthKeyHandle = thread_->GlobalConstants()->GetHandledLengthString(); + JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread_, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); EXPECT_TRUE(arr != nullptr); - JSHandle obj(thread, arr); - EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 0); - - JSHandle key0(thread, JSTaggedValue(0)); - PropertyDescriptor desc0(thread, JSHandle(thread, JSTaggedValue(1)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key0, desc0); - JSHandle key1(thread, JSTaggedValue(1)); - PropertyDescriptor desc1(thread, JSHandle(thread, JSTaggedValue(2)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key1, desc1); - JSHandle key2(thread, JSTaggedValue(2)); - PropertyDescriptor desc2(thread, JSHandle(thread, JSTaggedValue(3)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key2, desc2); - - auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + JSHandle obj(thread_, arr); + EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 0); + + JSHandle key0(thread_, JSTaggedValue(0)); + PropertyDescriptor desc0(thread_, JSHandle(thread_, JSTaggedValue(1)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key0, desc0); + JSHandle key1(thread_, JSTaggedValue(1)); + PropertyDescriptor desc1(thread_, JSHandle(thread_, JSTaggedValue(2)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key1, desc1); + JSHandle key2(thread_, JSTaggedValue(2)); + PropertyDescriptor desc2(thread_, JSHandle(thread_, JSTaggedValue(3)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key2, desc2); + + auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); ecmaRuntimeCallInfo1->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo1->SetThis(obj.GetTaggedValue()); ecmaRuntimeCallInfo1->SetCallArg(0, JSTaggedValue(static_cast(4))); ecmaRuntimeCallInfo1->SetCallArg(1, JSTaggedValue(static_cast(5))); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); JSTaggedValue result = Array::Push(ecmaRuntimeCallInfo1.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_EQ(result.GetNumber(), 5); - EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 5); - JSHandle key3(thread, JSTaggedValue(3)); - EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(obj), key3).GetValue()->GetInt(), 4); - JSHandle key4(thread, JSTaggedValue(4)); - EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(obj), key4).GetValue()->GetInt(), 5); + EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 5); + JSHandle key3(thread_, JSTaggedValue(3)); + EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(obj), key3).GetValue()->GetInt(), 4); + JSHandle key4(thread_, JSTaggedValue(4)); + EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(obj), key4).GetValue()->GetInt(), 5); } TEST_F(BuiltinsArrayTest, Reduce) { - auto ecmaVM = thread->GetEcmaVM(); + auto ecmaVM = thread_->GetEcmaVM(); JSHandle env = ecmaVM->GetGlobalEnv(); ObjectFactory *factory = ecmaVM->GetFactory(); - JSHandle lengthKeyHandle = thread->GlobalConstants()->GetHandledLengthString(); - JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); + JSHandle lengthKeyHandle = thread_->GlobalConstants()->GetHandledLengthString(); + JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread_, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); EXPECT_TRUE(arr != nullptr); - JSHandle obj(thread, arr); - EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 0); - JSHandle key0(thread, JSTaggedValue(0)); - PropertyDescriptor desc0(thread, JSHandle(thread, JSTaggedValue(1)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key0, desc0); - JSHandle key1(thread, JSTaggedValue(1)); - PropertyDescriptor desc1(thread, JSHandle(thread, JSTaggedValue(2)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key1, desc1); - JSHandle key2(thread, JSTaggedValue(2)); - PropertyDescriptor desc2(thread, JSHandle(thread, JSTaggedValue(3)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key2, desc2); + JSHandle obj(thread_, arr); + EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 0); + JSHandle key0(thread_, JSTaggedValue(0)); + PropertyDescriptor desc0(thread_, JSHandle(thread_, JSTaggedValue(1)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key0, desc0); + JSHandle key1(thread_, JSTaggedValue(1)); + PropertyDescriptor desc1(thread_, JSHandle(thread_, JSTaggedValue(2)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key1, desc1); + JSHandle key2(thread_, JSTaggedValue(2)); + PropertyDescriptor desc2(thread_, JSHandle(thread_, JSTaggedValue(3)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key2, desc2); JSHandle func = factory->NewJSFunction(env, reinterpret_cast(TestClass::TestReduceFunc)); - auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); ecmaRuntimeCallInfo1->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo1->SetThis(obj.GetTaggedValue()); ecmaRuntimeCallInfo1->SetCallArg(0, func.GetTaggedValue()); ecmaRuntimeCallInfo1->SetCallArg(1, JSTaggedValue(static_cast(10))); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); JSTaggedValue result = Array::Reduce(ecmaRuntimeCallInfo1.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_EQ(result.GetRawData(), JSTaggedValue(16).GetRawData()); } TEST_F(BuiltinsArrayTest, ReduceRight) { - auto ecmaVM = thread->GetEcmaVM(); + auto ecmaVM = thread_->GetEcmaVM(); JSHandle env = ecmaVM->GetGlobalEnv(); ObjectFactory *factory = ecmaVM->GetFactory(); - JSHandle lengthKeyHandle = thread->GlobalConstants()->GetHandledLengthString(); - JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); + JSHandle lengthKeyHandle = thread_->GlobalConstants()->GetHandledLengthString(); + JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread_, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); EXPECT_TRUE(arr != nullptr); - JSHandle obj(thread, arr); - EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 0); - JSHandle key0(thread, JSTaggedValue(0)); - PropertyDescriptor desc0(thread, JSHandle(thread, JSTaggedValue(1)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key0, desc0); - JSHandle key1(thread, JSTaggedValue(1)); - PropertyDescriptor desc1(thread, JSHandle(thread, JSTaggedValue(2)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key1, desc1); - JSHandle key2(thread, JSTaggedValue(2)); - PropertyDescriptor desc2(thread, JSHandle(thread, JSTaggedValue(3)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key2, desc2); + JSHandle obj(thread_, arr); + EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 0); + JSHandle key0(thread_, JSTaggedValue(0)); + PropertyDescriptor desc0(thread_, JSHandle(thread_, JSTaggedValue(1)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key0, desc0); + JSHandle key1(thread_, JSTaggedValue(1)); + PropertyDescriptor desc1(thread_, JSHandle(thread_, JSTaggedValue(2)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key1, desc1); + JSHandle key2(thread_, JSTaggedValue(2)); + PropertyDescriptor desc2(thread_, JSHandle(thread_, JSTaggedValue(3)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key2, desc2); JSHandle func = factory->NewJSFunction(env, reinterpret_cast(TestClass::TestReduceRightFunc)); - auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); ecmaRuntimeCallInfo1->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo1->SetThis(obj.GetTaggedValue()); ecmaRuntimeCallInfo1->SetCallArg(0, func.GetTaggedValue()); ecmaRuntimeCallInfo1->SetCallArg(1, JSTaggedValue(static_cast(10))); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); JSTaggedValue result = Array::ReduceRight(ecmaRuntimeCallInfo1.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_EQ(result.GetRawData(), JSTaggedValue(16).GetRawData()); } TEST_F(BuiltinsArrayTest, Shift) { - JSHandle lengthKeyHandle = thread->GlobalConstants()->GetHandledLengthString(); - JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); + JSHandle lengthKeyHandle = thread_->GlobalConstants()->GetHandledLengthString(); + JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread_, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); EXPECT_TRUE(arr != nullptr); - JSHandle obj(thread, arr); - EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 0); - - JSHandle key0(thread, JSTaggedValue(0)); - PropertyDescriptor desc0(thread, JSHandle(thread, JSTaggedValue(1)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key0, desc0); - JSHandle key1(thread, JSTaggedValue(1)); - PropertyDescriptor desc1(thread, JSHandle(thread, JSTaggedValue(2)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key1, desc1); - JSHandle key2(thread, JSTaggedValue(2)); - PropertyDescriptor desc2(thread, JSHandle(thread, JSTaggedValue(3)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key2, desc2); - - auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); + JSHandle obj(thread_, arr); + EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 0); + + JSHandle key0(thread_, JSTaggedValue(0)); + PropertyDescriptor desc0(thread_, JSHandle(thread_, JSTaggedValue(1)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key0, desc0); + JSHandle key1(thread_, JSTaggedValue(1)); + PropertyDescriptor desc1(thread_, JSHandle(thread_, JSTaggedValue(2)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key1, desc1); + JSHandle key2(thread_, JSTaggedValue(2)); + PropertyDescriptor desc2(thread_, JSHandle(thread_, JSTaggedValue(3)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key2, desc2); + + auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); ecmaRuntimeCallInfo1->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo1->SetThis(obj.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); JSTaggedValue result = Array::Shift(ecmaRuntimeCallInfo1.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_EQ(result.GetRawData(), JSTaggedValue(1).GetRawData()); } TEST_F(BuiltinsArrayTest, Some) { - auto ecmaVM = thread->GetEcmaVM(); + auto ecmaVM = thread_->GetEcmaVM(); JSHandle env = ecmaVM->GetGlobalEnv(); ObjectFactory *factory = ecmaVM->GetFactory(); - JSHandle lengthKeyHandle = thread->GlobalConstants()->GetHandledLengthString(); - JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); + JSHandle lengthKeyHandle = thread_->GlobalConstants()->GetHandledLengthString(); + JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread_, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); EXPECT_TRUE(arr != nullptr); - JSHandle obj(thread, arr); - EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 0); - - JSHandle key0(thread, JSTaggedValue(0)); - PropertyDescriptor desc0(thread, JSHandle(thread, JSTaggedValue(1)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key0, desc0); - JSHandle key1(thread, JSTaggedValue(1)); - PropertyDescriptor desc1(thread, JSHandle(thread, JSTaggedValue(20)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key1, desc1); - JSHandle key2(thread, JSTaggedValue(2)); - PropertyDescriptor desc2(thread, JSHandle(thread, JSTaggedValue(3)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key2, desc2); - - JSHandle jsArray(JSArray::ArrayCreate(thread, JSTaggedNumber(0))); + JSHandle obj(thread_, arr); + EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 0); + + JSHandle key0(thread_, JSTaggedValue(0)); + PropertyDescriptor desc0(thread_, JSHandle(thread_, JSTaggedValue(1)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key0, desc0); + JSHandle key1(thread_, JSTaggedValue(1)); + PropertyDescriptor desc1(thread_, JSHandle(thread_, JSTaggedValue(20)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key1, desc1); + JSHandle key2(thread_, JSTaggedValue(2)); + PropertyDescriptor desc2(thread_, JSHandle(thread_, JSTaggedValue(3)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key2, desc2); + + JSHandle jsArray(JSArray::ArrayCreate(thread_, JSTaggedNumber(0))); JSHandle func = factory->NewJSFunction(env, reinterpret_cast(TestClass::TestSomeFunc)); - auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); ecmaRuntimeCallInfo1->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo1->SetThis(obj.GetTaggedValue()); ecmaRuntimeCallInfo1->SetCallArg(0, func.GetTaggedValue()); ecmaRuntimeCallInfo1->SetCallArg(1, jsArray.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); JSTaggedValue result2 = Array::Some(ecmaRuntimeCallInfo1.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_EQ(result2.GetRawData(), JSTaggedValue::True().GetRawData()); } TEST_F(BuiltinsArrayTest, Sort) { - JSHandle lengthKeyHandle = thread->GlobalConstants()->GetHandledLengthString(); - JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); + JSHandle lengthKeyHandle = thread_->GlobalConstants()->GetHandledLengthString(); + JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread_, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); EXPECT_TRUE(arr != nullptr); - JSHandle obj(thread, arr); - EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 0); - - JSHandle key0(thread, JSTaggedValue(0)); - PropertyDescriptor desc0(thread, JSHandle(thread, JSTaggedValue(3)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key0, desc0); - JSHandle key1(thread, JSTaggedValue(1)); - PropertyDescriptor desc1(thread, JSHandle(thread, JSTaggedValue(2)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key1, desc1); - JSHandle key2(thread, JSTaggedValue(2)); - PropertyDescriptor desc2(thread, JSHandle(thread, JSTaggedValue(1)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key2, desc2); - - auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); + JSHandle obj(thread_, arr); + EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 0); + + JSHandle key0(thread_, JSTaggedValue(0)); + PropertyDescriptor desc0(thread_, JSHandle(thread_, JSTaggedValue(3)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key0, desc0); + JSHandle key1(thread_, JSTaggedValue(1)); + PropertyDescriptor desc1(thread_, JSHandle(thread_, JSTaggedValue(2)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key1, desc1); + JSHandle key2(thread_, JSTaggedValue(2)); + PropertyDescriptor desc2(thread_, JSHandle(thread_, JSTaggedValue(1)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key2, desc2); + + auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); ecmaRuntimeCallInfo1->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo1->SetThis(obj.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); JSTaggedValue result2 = Array::Sort(ecmaRuntimeCallInfo1.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); EXPECT_TRUE(result2.IsECMAObject()); JSHandle resultArr = - JSHandle(thread, JSTaggedValue(static_cast(result2.GetRawData()))); - EXPECT_EQ(JSArray::GetProperty(thread, resultArr, key0).GetValue()->GetInt(), 1); - EXPECT_EQ(JSArray::GetProperty(thread, resultArr, key1).GetValue()->GetInt(), 2); - EXPECT_EQ(JSArray::GetProperty(thread, resultArr, key2).GetValue()->GetInt(), 3); + JSHandle(thread_, JSTaggedValue(static_cast(result2.GetRawData()))); + EXPECT_EQ(JSArray::GetProperty(thread_, resultArr, key0).GetValue()->GetInt(), 1); + EXPECT_EQ(JSArray::GetProperty(thread_, resultArr, key1).GetValue()->GetInt(), 2); + EXPECT_EQ(JSArray::GetProperty(thread_, resultArr, key2).GetValue()->GetInt(), 3); } TEST_F(BuiltinsArrayTest, Unshift) { - JSHandle lengthKeyHandle = thread->GlobalConstants()->GetHandledLengthString(); - JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); + JSHandle lengthKeyHandle = thread_->GlobalConstants()->GetHandledLengthString(); + JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread_, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); EXPECT_TRUE(arr != nullptr); - JSHandle obj(thread, arr); - EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 0); - - JSHandle key0(thread, JSTaggedValue(0)); - PropertyDescriptor desc0(thread, JSHandle(thread, JSTaggedValue(1)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key0, desc0); - JSHandle key1(thread, JSTaggedValue(1)); - PropertyDescriptor desc1(thread, JSHandle(thread, JSTaggedValue(2)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key1, desc1); - JSHandle key2(thread, JSTaggedValue(2)); - PropertyDescriptor desc2(thread, JSHandle(thread, JSTaggedValue(3)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key2, desc2); - - auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + JSHandle obj(thread_, arr); + EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 0); + + JSHandle key0(thread_, JSTaggedValue(0)); + PropertyDescriptor desc0(thread_, JSHandle(thread_, JSTaggedValue(1)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key0, desc0); + JSHandle key1(thread_, JSTaggedValue(1)); + PropertyDescriptor desc1(thread_, JSHandle(thread_, JSTaggedValue(2)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key1, desc1); + JSHandle key2(thread_, JSTaggedValue(2)); + PropertyDescriptor desc2(thread_, JSHandle(thread_, JSTaggedValue(3)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key2, desc2); + + auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); ecmaRuntimeCallInfo1->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo1->SetThis(obj.GetTaggedValue()); ecmaRuntimeCallInfo1->SetCallArg(0, JSTaggedValue(static_cast(4))); ecmaRuntimeCallInfo1->SetCallArg(1, JSTaggedValue(static_cast(5))); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); JSTaggedValue result = Array::Unshift(ecmaRuntimeCallInfo1.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_EQ(result.GetRawData(), JSTaggedValue(static_cast(5)).GetRawData()); - EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 5); - JSHandle key3(thread, JSTaggedValue(0)); - EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(obj), key3).GetValue()->GetInt(), 4); - JSHandle key4(thread, JSTaggedValue(1)); - EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(obj), key4).GetValue()->GetInt(), 5); + EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(obj), lengthKeyHandle).GetValue()->GetInt(), 5); + JSHandle key3(thread_, JSTaggedValue(0)); + EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(obj), key3).GetValue()->GetInt(), 4); + JSHandle key4(thread_, JSTaggedValue(1)); + EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(obj), key4).GetValue()->GetInt(), 5); } TEST_F(BuiltinsArrayTest, Join) { - JSHandle lengthKeyHandle = thread->GlobalConstants()->GetHandledLengthString(); - JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); + JSHandle lengthKeyHandle = thread_->GlobalConstants()->GetHandledLengthString(); + JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread_, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); EXPECT_TRUE(arr != nullptr); - JSHandle obj(thread, arr); - EXPECT_EQ(JSArray::GetProperty(thread, obj, lengthKeyHandle).GetValue()->GetInt(), 0); - - JSHandle key0(thread, JSTaggedValue(0)); - PropertyDescriptor desc0(thread, JSHandle(thread, JSTaggedValue(2))); - JSArray::DefineOwnProperty(thread, JSHandle(obj), key0, desc0); - JSHandle key1(thread, JSTaggedValue(1)); - PropertyDescriptor desc1(thread, JSHandle(thread, JSTaggedValue(3))); - JSArray::DefineOwnProperty(thread, JSHandle(obj), key1, desc1); - JSHandle key2(thread, JSTaggedValue(2)); - PropertyDescriptor desc2(thread, JSHandle(thread, JSTaggedValue(4))); - JSArray::DefineOwnProperty(thread, JSHandle(obj), key2, desc2); - - JSHandle str = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("2,3,4"); - auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); + JSHandle obj(thread_, arr); + EXPECT_EQ(JSArray::GetProperty(thread_, obj, lengthKeyHandle).GetValue()->GetInt(), 0); + + JSHandle key0(thread_, JSTaggedValue(0)); + PropertyDescriptor desc0(thread_, JSHandle(thread_, JSTaggedValue(2))); + JSArray::DefineOwnProperty(thread_, JSHandle(obj), key0, desc0); + JSHandle key1(thread_, JSTaggedValue(1)); + PropertyDescriptor desc1(thread_, JSHandle(thread_, JSTaggedValue(3))); + JSArray::DefineOwnProperty(thread_, JSHandle(obj), key1, desc1); + JSHandle key2(thread_, JSTaggedValue(2)); + PropertyDescriptor desc2(thread_, JSHandle(thread_, JSTaggedValue(4))); + JSArray::DefineOwnProperty(thread_, JSHandle(obj), key2, desc2); + + JSHandle str = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("2,3,4"); + auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); ecmaRuntimeCallInfo1->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo1->SetThis(obj.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); JSTaggedValue result = Array::Join(ecmaRuntimeCallInfo1.get()); - TestHelper::TearDownFrame(thread, prev); - JSHandle resultHandle(thread, reinterpret_cast(result.GetRawData())); + TestHelper::TearDownFrame(thread_, prev); + JSHandle resultHandle(thread_, reinterpret_cast(result.GetRawData())); [[maybe_unused]] auto *res = EcmaString::Cast(resultHandle.GetTaggedValue().GetTaggedObject()); ASSERT_EQ(res->Compare(*str), 0); @@ -1692,31 +1695,31 @@ TEST_F(BuiltinsArrayTest, Join) TEST_F(BuiltinsArrayTest, ToString) { - JSHandle lengthKeyHandle = thread->GlobalConstants()->GetHandledLengthString(); - JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); + JSHandle lengthKeyHandle = thread_->GlobalConstants()->GetHandledLengthString(); + JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread_, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); EXPECT_TRUE(arr != nullptr); - JSHandle obj(thread, arr); - EXPECT_EQ(JSArray::GetProperty(thread, obj, lengthKeyHandle).GetValue()->GetInt(), 0); - - JSHandle key0(thread, JSTaggedValue(0)); - PropertyDescriptor desc0(thread, JSHandle(thread, JSTaggedValue(2))); - JSArray::DefineOwnProperty(thread, JSHandle(obj), key0, desc0); - JSHandle key1(thread, JSTaggedValue(1)); - PropertyDescriptor desc1(thread, JSHandle(thread, JSTaggedValue(3))); - JSArray::DefineOwnProperty(thread, JSHandle(obj), key1, desc1); - JSHandle key2(thread, JSTaggedValue(2)); - PropertyDescriptor desc2(thread, JSHandle(thread, JSTaggedValue(4))); - JSArray::DefineOwnProperty(thread, JSHandle(obj), key2, desc2); - - JSHandle str = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("2,3,4"); - auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); + JSHandle obj(thread_, arr); + EXPECT_EQ(JSArray::GetProperty(thread_, obj, lengthKeyHandle).GetValue()->GetInt(), 0); + + JSHandle key0(thread_, JSTaggedValue(0)); + PropertyDescriptor desc0(thread_, JSHandle(thread_, JSTaggedValue(2))); + JSArray::DefineOwnProperty(thread_, JSHandle(obj), key0, desc0); + JSHandle key1(thread_, JSTaggedValue(1)); + PropertyDescriptor desc1(thread_, JSHandle(thread_, JSTaggedValue(3))); + JSArray::DefineOwnProperty(thread_, JSHandle(obj), key1, desc1); + JSHandle key2(thread_, JSTaggedValue(2)); + PropertyDescriptor desc2(thread_, JSHandle(thread_, JSTaggedValue(4))); + JSArray::DefineOwnProperty(thread_, JSHandle(obj), key2, desc2); + + JSHandle str = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("2,3,4"); + auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); ecmaRuntimeCallInfo1->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo1->SetThis(obj.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); JSTaggedValue result = Array::Join(ecmaRuntimeCallInfo1.get()); - TestHelper::TearDownFrame(thread, prev); - JSHandle resultHandle(thread, reinterpret_cast(result.GetRawData())); + TestHelper::TearDownFrame(thread_, prev); + JSHandle resultHandle(thread_, reinterpret_cast(result.GetRawData())); [[maybe_unused]] auto *res = EcmaString::Cast(resultHandle.GetTaggedValue().GetTaggedObject()); ASSERT_EQ(res->Compare(*str), 0); diff --git a/tests/runtime/builtins/builtins_arraybuffer_test.cpp b/tests/runtime/builtins/builtins_arraybuffer_test.cpp index d293abea8a78ba24119526e4ae5c203d7ce840bd..3426be03d95e6f06d5c910934d9b48d24d5134ef 100644 --- a/tests/runtime/builtins/builtins_arraybuffer_test.cpp +++ b/tests/runtime/builtins/builtins_arraybuffer_test.cpp @@ -41,17 +41,17 @@ public: void SetUp() override { - TestHelper::CreateEcmaVMWithScope(instance, thread, scope); + TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); } void TearDown() override { - TestHelper::DestroyEcmaVMWithScope(instance, scope); + TestHelper::DestroyEcmaVMWithScope(instance_, scope_); } - PandaVM *instance {nullptr}; - EcmaHandleScope *scope {nullptr}; - JSThread *thread {nullptr}; + PandaVM *instance_ {nullptr}; + EcmaHandleScope *scope_ {nullptr}; + JSThread *thread_ {nullptr}; }; JSTaggedValue CreateBuiltinsArrayBuffer(JSThread *thread, int32_t length) @@ -73,15 +73,15 @@ JSTaggedValue CreateBuiltinsArrayBuffer(JSThread *thread, int32_t length) // new ArrayBuffer(8) TEST_F(BuiltinsArrayBufferTest, Constructor1) { - JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); - JSHandle arrayBuffer(thread, env->GetArrayBufferFunction().GetTaggedValue()); - JSHandle globalObject(thread, env->GetGlobalObject()); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, arrayBuffer.GetTaggedValue(), 6); + JSHandle env = thread_->GetEcmaVM()->GetGlobalEnv(); + JSHandle arrayBuffer(thread_, env->GetArrayBufferFunction().GetTaggedValue()); + JSHandle globalObject(thread_, env->GetGlobalObject()); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, arrayBuffer.GetTaggedValue(), 6); ecmaRuntimeCallInfo->SetFunction(arrayBuffer.GetTaggedValue()); ecmaRuntimeCallInfo->SetThis(globalObject.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast(8))); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsArrayBuffer::ArrayBufferConstructor(ecmaRuntimeCallInfo.get()); ASSERT_TRUE(result.IsECMAObject()); } @@ -89,13 +89,13 @@ TEST_F(BuiltinsArrayBufferTest, Constructor1) // (new ArrayBuffer(5)).byteLength TEST_F(BuiltinsArrayBufferTest, byteLength1) { - JSTaggedValue tagged = CreateBuiltinsArrayBuffer(thread, 5); - JSHandle arrBuf(thread, JSArrayBuffer::Cast(reinterpret_cast(tagged.GetRawData()))); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); + JSTaggedValue tagged = CreateBuiltinsArrayBuffer(thread_, 5); + JSHandle arrBuf(thread_, JSArrayBuffer::Cast(reinterpret_cast(tagged.GetRawData()))); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(arrBuf.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsArrayBuffer::GetByteLength(ecmaRuntimeCallInfo.get()); ASSERT_EQ(result.GetRawData(), JSTaggedValue(5).GetRawData()); } @@ -103,23 +103,23 @@ TEST_F(BuiltinsArrayBufferTest, byteLength1) // (new ArrayBuffer(10)).slice(1, 5).bytelength TEST_F(BuiltinsArrayBufferTest, slice1) { - JSTaggedValue tagged = CreateBuiltinsArrayBuffer(thread, 10); - JSHandle arrBuf(thread, JSArrayBuffer::Cast(reinterpret_cast(tagged.GetRawData()))); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + JSTaggedValue tagged = CreateBuiltinsArrayBuffer(thread_, 10); + JSHandle arrBuf(thread_, JSArrayBuffer::Cast(reinterpret_cast(tagged.GetRawData()))); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(arrBuf.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast(1))); ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(static_cast(5))); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result1 = BuiltinsArrayBuffer::Slice(ecmaRuntimeCallInfo.get()); - TestHelper::TearDownFrame(thread, prev); - JSHandle arrBuf1(thread, + TestHelper::TearDownFrame(thread_, prev); + JSHandle arrBuf1(thread_, JSArrayBuffer::Cast(reinterpret_cast(result1.GetRawData()))); - auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); + auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); ecmaRuntimeCallInfo1->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo1->SetThis(arrBuf1.GetTaggedValue()); - prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); + prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); JSTaggedValue result2 = BuiltinsArrayBuffer::GetByteLength(ecmaRuntimeCallInfo1.get()); ASSERT_EQ(result2.GetRawData(), JSTaggedValue(4).GetRawData()); diff --git a/tests/runtime/builtins/builtins_boolean_test.cpp b/tests/runtime/builtins/builtins_boolean_test.cpp index a8f70f1b29fc3c27b7e0ea298b10538ca6ae0fc6..fdddf6ff415544252f42323bab1ecfed79595e9b 100644 --- a/tests/runtime/builtins/builtins_boolean_test.cpp +++ b/tests/runtime/builtins/builtins_boolean_test.cpp @@ -43,33 +43,33 @@ public: void SetUp() override { - TestHelper::CreateEcmaVMWithScope(instance, thread, scope); + TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); } void TearDown() override { - TestHelper::DestroyEcmaVMWithScope(instance, scope); + TestHelper::DestroyEcmaVMWithScope(instance_, scope_); } - PandaVM *instance {nullptr}; - EcmaHandleScope *scope {nullptr}; - JSThread *thread {nullptr}; + PandaVM *instance_ {nullptr}; + EcmaHandleScope *scope_ {nullptr}; + JSThread *thread_ {nullptr}; }; // new Boolean(123) TEST_F(BuiltinsBooleanTest, BooleanConstructor) { - JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); + JSHandle env = thread_->GetEcmaVM()->GetGlobalEnv(); JSHandle boolean(env->GetBooleanFunction()); - JSHandle globalObject(thread, env->GetGlobalObject()); + JSHandle globalObject(thread_, env->GetGlobalObject()); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue(*boolean), 6); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue(*boolean), 6); ecmaRuntimeCallInfo->SetFunction(boolean.GetTaggedValue()); ecmaRuntimeCallInfo->SetThis(globalObject.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast(123))); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsBoolean::BooleanConstructor(ecmaRuntimeCallInfo.get()); ASSERT_TRUE(result.IsECMAObject()); @@ -79,17 +79,17 @@ TEST_F(BuiltinsBooleanTest, BooleanConstructor) // new Boolean(undefined) TEST_F(BuiltinsBooleanTest, BooleanConstructor1) { - JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); + JSHandle env = thread_->GetEcmaVM()->GetGlobalEnv(); JSHandle boolean(env->GetBooleanFunction()); - JSHandle globalObject(thread, env->GetGlobalObject()); + JSHandle globalObject(thread_, env->GetGlobalObject()); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue(*boolean), 6); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue(*boolean), 6); ecmaRuntimeCallInfo->SetFunction(boolean.GetTaggedValue()); ecmaRuntimeCallInfo->SetThis(globalObject.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue::Undefined()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsBoolean::BooleanConstructor(ecmaRuntimeCallInfo.get()); ASSERT_TRUE(result.IsECMAObject()); @@ -99,18 +99,18 @@ TEST_F(BuiltinsBooleanTest, BooleanConstructor1) // Boolean("helloworld") TEST_F(BuiltinsBooleanTest, BooleanConstructor2) { - JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); + JSHandle env = thread_->GetEcmaVM()->GetGlobalEnv(); JSHandle boolean(env->GetBooleanFunction()); - JSHandle globalObject(thread, env->GetGlobalObject()); - JSHandle str = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("helloworld"); + JSHandle globalObject(thread_, env->GetGlobalObject()); + JSHandle str = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("helloworld"); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo->SetFunction(boolean.GetTaggedValue()); ecmaRuntimeCallInfo->SetThis(globalObject.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, str.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsBoolean::BooleanConstructor(ecmaRuntimeCallInfo.get()); JSTaggedValue ruler = BuiltinsBase::GetTaggedBoolean(true); @@ -120,48 +120,48 @@ TEST_F(BuiltinsBooleanTest, BooleanConstructor2) // false.toString() TEST_F(BuiltinsBooleanTest, BooleanPrototypeToString) { - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(JSTaggedValue::False()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsBoolean::BooleanPrototypeToString(ecmaRuntimeCallInfo.get()); ASSERT_TRUE(result.IsString()); - JSHandle res(thread, reinterpret_cast(result.GetRawData())); - auto ruler = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("false"); + JSHandle res(thread_, reinterpret_cast(result.GetRawData())); + auto ruler = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("false"); ASSERT_EQ(res->Compare(*ruler), 0); } // (new Boolean(true)).toString() TEST_F(BuiltinsBooleanTest, BooleanPrototypeToString1) { - auto ecmaVM = thread->GetEcmaVM(); + auto ecmaVM = thread_->GetEcmaVM(); JSHandle env = ecmaVM->GetGlobalEnv(); JSHandle booleanObject(env->GetBooleanFunction()); - JSHandle value(thread, JSTaggedValue::True()); - JSHandle boolean = thread->GetEcmaVM()->GetFactory()->NewJSPrimitiveRef(booleanObject, value); + JSHandle value(thread_, JSTaggedValue::True()); + JSHandle boolean = thread_->GetEcmaVM()->GetFactory()->NewJSPrimitiveRef(booleanObject, value); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(boolean.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsBoolean::BooleanPrototypeToString(ecmaRuntimeCallInfo.get()); ASSERT_TRUE(result.IsString()); - JSHandle res(thread, reinterpret_cast(result.GetRawData())); - auto ruler = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("true"); + JSHandle res(thread_, reinterpret_cast(result.GetRawData())); + auto ruler = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("true"); ASSERT_EQ(res->Compare(*ruler), 0); } // true.valueOf() TEST_F(BuiltinsBooleanTest, BooleanPrototypeValueOf) { - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(JSTaggedValue::True()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsBoolean::BooleanPrototypeValueOf(ecmaRuntimeCallInfo.get()); JSTaggedValue ruler = BuiltinsBase::GetTaggedBoolean(true); @@ -171,18 +171,18 @@ TEST_F(BuiltinsBooleanTest, BooleanPrototypeValueOf) // (new Boolean(false)).valueOf() TEST_F(BuiltinsBooleanTest, BooleanPrototypeValueOf1) { - auto ecmaVM = thread->GetEcmaVM(); + auto ecmaVM = thread_->GetEcmaVM(); JSHandle env = ecmaVM->GetGlobalEnv(); JSHandle booleanObject(env->GetBooleanFunction()); - JSHandle value(thread, JSTaggedValue::False()); - JSHandle boolean = thread->GetEcmaVM()->GetFactory()->NewJSPrimitiveRef(booleanObject, value); + JSHandle value(thread_, JSTaggedValue::False()); + JSHandle boolean = thread_->GetEcmaVM()->GetFactory()->NewJSPrimitiveRef(booleanObject, value); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(boolean.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsBoolean::BooleanPrototypeValueOf(ecmaRuntimeCallInfo.get()); JSTaggedValue ruler = BuiltinsBase::GetTaggedBoolean(false); diff --git a/tests/runtime/builtins/builtins_dataview_test.cpp b/tests/runtime/builtins/builtins_dataview_test.cpp index 0f036ccc37aa18666b31ab347ae2fcd71ebc287a..5d528e6fb8d7c119466073fbbb9774cb23152c97 100644 --- a/tests/runtime/builtins/builtins_dataview_test.cpp +++ b/tests/runtime/builtins/builtins_dataview_test.cpp @@ -43,17 +43,17 @@ public: void SetUp() override { - TestHelper::CreateEcmaVMWithScope(instance, thread, scope); + TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); } void TearDown() override { - TestHelper::DestroyEcmaVMWithScope(instance, scope); + TestHelper::DestroyEcmaVMWithScope(instance_, scope_); } - PandaVM *instance {nullptr}; - EcmaHandleScope *scope {nullptr}; - JSThread *thread {nullptr}; + PandaVM *instance_ {nullptr}; + EcmaHandleScope *scope_ {nullptr}; + JSThread *thread_ {nullptr}; }; JSTaggedValue CreateBuiltinsArrayBuffer(JSThread *thread, int32_t length) @@ -106,18 +106,18 @@ void SetUint8(JSThread *thread, const JSHandle &view, int32_t offset // new DataView(new ArrayBuffer(10), 1) TEST_F(BuiltinsDataViewTest, Constructor) { - JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); - JSHandle dataView(thread, env->GetDataViewFunction().GetTaggedValue()); - JSHandle globalObject(thread, env->GetGlobalObject()); - JSTaggedValue tagged = CreateBuiltinsArrayBuffer(thread, 10); - JSHandle arrBuf(thread, JSArrayBuffer::Cast(reinterpret_cast(tagged.GetRawData()))); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue(*dataView), 8); + JSHandle env = thread_->GetEcmaVM()->GetGlobalEnv(); + JSHandle dataView(thread_, env->GetDataViewFunction().GetTaggedValue()); + JSHandle globalObject(thread_, env->GetGlobalObject()); + JSTaggedValue tagged = CreateBuiltinsArrayBuffer(thread_, 10); + JSHandle arrBuf(thread_, JSArrayBuffer::Cast(reinterpret_cast(tagged.GetRawData()))); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue(*dataView), 8); ecmaRuntimeCallInfo->SetFunction(dataView.GetTaggedValue()); ecmaRuntimeCallInfo->SetThis(globalObject.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, arrBuf.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(1)); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsDataView::DataViewConstructor(ecmaRuntimeCallInfo.get()); ASSERT_TRUE(result.IsECMAObject()); } @@ -125,13 +125,13 @@ TEST_F(BuiltinsDataViewTest, Constructor) // new DataView(new ArrayBuffer(10), 1).byteOffset TEST_F(BuiltinsDataViewTest, byteOffset) { - JSTaggedValue tagged = CreateBuiltinsDataView(thread, 10, 1); - JSHandle view(thread, JSDataView::Cast(reinterpret_cast(tagged.GetRawData()))); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); + JSTaggedValue tagged = CreateBuiltinsDataView(thread_, 10, 1); + JSHandle view(thread_, JSDataView::Cast(reinterpret_cast(tagged.GetRawData()))); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(view.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsDataView::GetOffset(ecmaRuntimeCallInfo.get()); ASSERT_EQ(result.GetRawData(), JSTaggedValue(1).GetRawData()); } @@ -139,13 +139,13 @@ TEST_F(BuiltinsDataViewTest, byteOffset) // new DataView(new ArrayBuffer(10), 2).byteLength TEST_F(BuiltinsDataViewTest, byteLength) { - JSTaggedValue tagged = CreateBuiltinsDataView(thread, 10, 2); - JSHandle view(thread, JSDataView::Cast(reinterpret_cast(tagged.GetRawData()))); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); + JSTaggedValue tagged = CreateBuiltinsDataView(thread_, 10, 2); + JSHandle view(thread_, JSDataView::Cast(reinterpret_cast(tagged.GetRawData()))); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(view.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsDataView::GetByteLength(ecmaRuntimeCallInfo.get()); ASSERT_EQ(result.GetRawData(), JSTaggedValue(8).GetRawData()); } @@ -153,13 +153,13 @@ TEST_F(BuiltinsDataViewTest, byteLength) // new DataView(new ArrayBuffer(10), 1).buffer TEST_F(BuiltinsDataViewTest, buffer) { - JSTaggedValue tagged = CreateBuiltinsDataView(thread, 10, 1); - JSHandle view(thread, JSDataView::Cast(reinterpret_cast(tagged.GetRawData()))); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); + JSTaggedValue tagged = CreateBuiltinsDataView(thread_, 10, 1); + JSHandle view(thread_, JSDataView::Cast(reinterpret_cast(tagged.GetRawData()))); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(view.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsDataView::GetBuffer(ecmaRuntimeCallInfo.get()); ASSERT_EQ(result.IsArrayBuffer(), true); } @@ -167,20 +167,20 @@ TEST_F(BuiltinsDataViewTest, buffer) // new DataView(new ArrayBuffer(8), 0).SetUint16/GetUint16 TEST_F(BuiltinsDataViewTest, getUint16) { - JSTaggedValue tagged = CreateBuiltinsDataView(thread, 8, 0); - JSHandle view(thread, JSDataView::Cast(reinterpret_cast(tagged.GetRawData()))); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 10); + JSTaggedValue tagged = CreateBuiltinsDataView(thread_, 8, 0); + JSHandle view(thread_, JSDataView::Cast(reinterpret_cast(tagged.GetRawData()))); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 10); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(view.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(0)); ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(-1870724872)); ecmaRuntimeCallInfo->SetCallArg(2, JSTaggedValue::False()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsDataView::SetUint16(ecmaRuntimeCallInfo.get()); ASSERT_EQ(result.GetRawData(), JSTaggedValue::VALUE_UNDEFINED); - auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); ecmaRuntimeCallInfo1->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo1->SetThis(view.GetTaggedValue()); ecmaRuntimeCallInfo1->SetCallArg(0, JSTaggedValue(0)); @@ -193,20 +193,20 @@ TEST_F(BuiltinsDataViewTest, getUint16) // new DataView(new ArrayBuffer(8), 0).SetInt16/GetInt16 TEST_F(BuiltinsDataViewTest, getInt16) { - JSTaggedValue tagged = CreateBuiltinsDataView(thread, 8, 0); - JSHandle view(thread, JSDataView::Cast(reinterpret_cast(tagged.GetRawData()))); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 10); + JSTaggedValue tagged = CreateBuiltinsDataView(thread_, 8, 0); + JSHandle view(thread_, JSDataView::Cast(reinterpret_cast(tagged.GetRawData()))); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 10); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(view.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(0)); ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(-1870724872)); ecmaRuntimeCallInfo->SetCallArg(2, JSTaggedValue::False()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsDataView::SetInt16(ecmaRuntimeCallInfo.get()); ASSERT_EQ(result.GetRawData(), JSTaggedValue::VALUE_UNDEFINED); - auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); ecmaRuntimeCallInfo1->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo1->SetThis(view.GetTaggedValue()); ecmaRuntimeCallInfo1->SetCallArg(0, JSTaggedValue(0)); @@ -219,20 +219,20 @@ TEST_F(BuiltinsDataViewTest, getInt16) // new DataView(new ArrayBuffer(8), 0).SetUint8/GetUint32 TEST_F(BuiltinsDataViewTest, GetUint32) { - JSTaggedValue tagged = CreateBuiltinsDataView(thread, 8, 0); - JSHandle view(thread, JSDataView::Cast(reinterpret_cast(tagged.GetRawData()))); - SetUint8(thread, view, 0, JSTaggedValue(127)); - SetUint8(thread, view, 1, JSTaggedValue(255)); - SetUint8(thread, view, 2, JSTaggedValue(255)); - SetUint8(thread, view, 3, JSTaggedValue(255)); - - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + JSTaggedValue tagged = CreateBuiltinsDataView(thread_, 8, 0); + JSHandle view(thread_, JSDataView::Cast(reinterpret_cast(tagged.GetRawData()))); + SetUint8(thread_, view, 0, JSTaggedValue(127)); + SetUint8(thread_, view, 1, JSTaggedValue(255)); + SetUint8(thread_, view, 2, JSTaggedValue(255)); + SetUint8(thread_, view, 3, JSTaggedValue(255)); + + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(view.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(0)); ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue::False()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsDataView::GetUint32(ecmaRuntimeCallInfo.get()); ASSERT_EQ(result.GetRawData(), JSTaggedValue(2147483647).GetRawData()); } @@ -240,20 +240,20 @@ TEST_F(BuiltinsDataViewTest, GetUint32) // new DataView(new ArrayBuffer(8), 0).SetUint8/GetInt32 TEST_F(BuiltinsDataViewTest, GetInt32) { - JSTaggedValue tagged = CreateBuiltinsDataView(thread, 8, 0); - JSHandle view(thread, JSDataView::Cast(reinterpret_cast(tagged.GetRawData()))); - SetUint8(thread, view, 0, JSTaggedValue(127)); - SetUint8(thread, view, 1, JSTaggedValue(255)); - SetUint8(thread, view, 2, JSTaggedValue(255)); - SetUint8(thread, view, 3, JSTaggedValue(255)); - - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + JSTaggedValue tagged = CreateBuiltinsDataView(thread_, 8, 0); + JSHandle view(thread_, JSDataView::Cast(reinterpret_cast(tagged.GetRawData()))); + SetUint8(thread_, view, 0, JSTaggedValue(127)); + SetUint8(thread_, view, 1, JSTaggedValue(255)); + SetUint8(thread_, view, 2, JSTaggedValue(255)); + SetUint8(thread_, view, 3, JSTaggedValue(255)); + + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(view.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(0)); ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue::False()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsDataView::GetInt32(ecmaRuntimeCallInfo.get()); ASSERT_EQ(result.GetRawData(), JSTaggedValue(2147483647).GetRawData()); } @@ -261,16 +261,16 @@ TEST_F(BuiltinsDataViewTest, GetInt32) // new DataView(new ArrayBuffer(8), 0).SetUint8/GetInt8 TEST_F(BuiltinsDataViewTest, GetInt8) { - JSTaggedValue tagged = CreateBuiltinsDataView(thread, 8, 0); - JSHandle view(thread, JSDataView::Cast(reinterpret_cast(tagged.GetRawData()))); - SetUint8(thread, view, 0, JSTaggedValue(255)); + JSTaggedValue tagged = CreateBuiltinsDataView(thread_, 8, 0); + JSHandle view(thread_, JSDataView::Cast(reinterpret_cast(tagged.GetRawData()))); + SetUint8(thread_, view, 0, JSTaggedValue(255)); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(view.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(0)); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsDataView::GetInt8(ecmaRuntimeCallInfo.get()); ASSERT_EQ(result.GetRawData(), JSTaggedValue(-1).GetRawData()); } @@ -278,16 +278,16 @@ TEST_F(BuiltinsDataViewTest, GetInt8) // new DataView(new ArrayBuffer(8), 0).SetUint8/GetUint8 TEST_F(BuiltinsDataViewTest, GetUint8) { - JSTaggedValue tagged = CreateBuiltinsDataView(thread, 8, 0); - JSHandle view(thread, JSDataView::Cast(reinterpret_cast(tagged.GetRawData()))); - SetUint8(thread, view, 0, JSTaggedValue(127)); + JSTaggedValue tagged = CreateBuiltinsDataView(thread_, 8, 0); + JSHandle view(thread_, JSDataView::Cast(reinterpret_cast(tagged.GetRawData()))); + SetUint8(thread_, view, 0, JSTaggedValue(127)); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(view.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(0)); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsDataView::GetUint8(ecmaRuntimeCallInfo.get()); ASSERT_EQ(result.GetRawData(), JSTaggedValue(127).GetRawData()); } @@ -295,20 +295,20 @@ TEST_F(BuiltinsDataViewTest, GetUint8) // new DataView(new ArrayBuffer(8), 4).SetUint8/GetFloat32 TEST_F(BuiltinsDataViewTest, GetFloat32) { - JSTaggedValue tagged = CreateBuiltinsDataView(thread, 8, 0); - JSHandle view(thread, JSDataView::Cast(reinterpret_cast(tagged.GetRawData()))); - SetUint8(thread, view, 4, JSTaggedValue(75)); - SetUint8(thread, view, 5, JSTaggedValue(75)); - SetUint8(thread, view, 6, JSTaggedValue(75)); - SetUint8(thread, view, 7, JSTaggedValue(75)); - - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + JSTaggedValue tagged = CreateBuiltinsDataView(thread_, 8, 0); + JSHandle view(thread_, JSDataView::Cast(reinterpret_cast(tagged.GetRawData()))); + SetUint8(thread_, view, 4, JSTaggedValue(75)); + SetUint8(thread_, view, 5, JSTaggedValue(75)); + SetUint8(thread_, view, 6, JSTaggedValue(75)); + SetUint8(thread_, view, 7, JSTaggedValue(75)); + + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(view.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(4)); ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue::False()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsDataView::GetFloat32(ecmaRuntimeCallInfo.get()); ASSERT_EQ(result.GetRawData(), JSTaggedValue(static_cast(13323083)).GetRawData()); } @@ -316,24 +316,24 @@ TEST_F(BuiltinsDataViewTest, GetFloat32) // new DataView(new ArrayBuffer(12), 4).SetUint8/GetFloat64 TEST_F(BuiltinsDataViewTest, GetFloat64) { - JSTaggedValue tagged = CreateBuiltinsDataView(thread, 12, 0); - JSHandle view(thread, JSDataView::Cast(reinterpret_cast(tagged.GetRawData()))); - SetUint8(thread, view, 4, JSTaggedValue(67)); - SetUint8(thread, view, 5, JSTaggedValue(67)); - SetUint8(thread, view, 6, JSTaggedValue(68)); - SetUint8(thread, view, 7, JSTaggedValue(68)); - SetUint8(thread, view, 8, JSTaggedValue(67)); - SetUint8(thread, view, 9, JSTaggedValue(67)); - SetUint8(thread, view, 10, JSTaggedValue(68)); - SetUint8(thread, view, 11, JSTaggedValue(68)); - - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + JSTaggedValue tagged = CreateBuiltinsDataView(thread_, 12, 0); + JSHandle view(thread_, JSDataView::Cast(reinterpret_cast(tagged.GetRawData()))); + SetUint8(thread_, view, 4, JSTaggedValue(67)); + SetUint8(thread_, view, 5, JSTaggedValue(67)); + SetUint8(thread_, view, 6, JSTaggedValue(68)); + SetUint8(thread_, view, 7, JSTaggedValue(68)); + SetUint8(thread_, view, 8, JSTaggedValue(67)); + SetUint8(thread_, view, 9, JSTaggedValue(67)); + SetUint8(thread_, view, 10, JSTaggedValue(68)); + SetUint8(thread_, view, 11, JSTaggedValue(68)); + + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(view.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(4)); ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue::False()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsDataView::GetFloat64(ecmaRuntimeCallInfo.get()); ASSERT_EQ(result.GetRawData(), JSTaggedValue(static_cast(10846169068898440)).GetRawData()); } @@ -341,20 +341,20 @@ TEST_F(BuiltinsDataViewTest, GetFloat64) // new DataView(new ArrayBuffer(8), 0).SetUint32/GetUint32 TEST_F(BuiltinsDataViewTest, SetUint32) { - JSTaggedValue tagged = CreateBuiltinsDataView(thread, 8, 0); - JSHandle view(thread, JSDataView::Cast(reinterpret_cast(tagged.GetRawData()))); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 10); + JSTaggedValue tagged = CreateBuiltinsDataView(thread_, 8, 0); + JSHandle view(thread_, JSDataView::Cast(reinterpret_cast(tagged.GetRawData()))); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 10); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(view.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(0)); ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(0x907f00f8)); ecmaRuntimeCallInfo->SetCallArg(2, JSTaggedValue::True()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsDataView::SetUint32(ecmaRuntimeCallInfo.get()); ASSERT_EQ(result.GetRawData(), JSTaggedValue::VALUE_UNDEFINED); - auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); ecmaRuntimeCallInfo1->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo1->SetThis(view.GetTaggedValue()); ecmaRuntimeCallInfo1->SetCallArg(0, JSTaggedValue(0)); @@ -367,20 +367,20 @@ TEST_F(BuiltinsDataViewTest, SetUint32) // new DataView(new ArrayBuffer(8), 0).SetInt32/GetInt32 TEST_F(BuiltinsDataViewTest, SetInt32) { - JSTaggedValue tagged = CreateBuiltinsDataView(thread, 8, 0); - JSHandle view(thread, JSDataView::Cast(reinterpret_cast(tagged.GetRawData()))); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 10); + JSTaggedValue tagged = CreateBuiltinsDataView(thread_, 8, 0); + JSHandle view(thread_, JSDataView::Cast(reinterpret_cast(tagged.GetRawData()))); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 10); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(view.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(0)); ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(-1870724872)); ecmaRuntimeCallInfo->SetCallArg(2, JSTaggedValue::True()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsDataView::SetInt32(ecmaRuntimeCallInfo.get()); ASSERT_EQ(result.GetRawData(), JSTaggedValue::VALUE_UNDEFINED); - auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); ecmaRuntimeCallInfo1->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo1->SetThis(view.GetTaggedValue()); ecmaRuntimeCallInfo1->SetCallArg(0, JSTaggedValue(0)); @@ -393,18 +393,18 @@ TEST_F(BuiltinsDataViewTest, SetInt32) // new DataView(new ArrayBuffer(8), 0).SetInt8/GetUint8 TEST_F(BuiltinsDataViewTest, SetInt8) { - JSTaggedValue tagged = CreateBuiltinsDataView(thread, 8, 0); - JSHandle view(thread, JSDataView::Cast(reinterpret_cast(tagged.GetRawData()))); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + JSTaggedValue tagged = CreateBuiltinsDataView(thread_, 8, 0); + JSHandle view(thread_, JSDataView::Cast(reinterpret_cast(tagged.GetRawData()))); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(view.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(0)); ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(-1)); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsDataView::SetInt8(ecmaRuntimeCallInfo.get()); ASSERT_EQ(result.GetRawData(), JSTaggedValue::VALUE_UNDEFINED); - auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo1->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo1->SetThis(view.GetTaggedValue()); ecmaRuntimeCallInfo1->SetCallArg(0, JSTaggedValue(0)); @@ -415,20 +415,20 @@ TEST_F(BuiltinsDataViewTest, SetInt8) // new DataView(new ArrayBuffer(4), 0).SetFloat32/GetFloat32 TEST_F(BuiltinsDataViewTest, SetFloat32) { - JSTaggedValue tagged = CreateBuiltinsDataView(thread, 4, 0); - JSHandle view(thread, JSDataView::Cast(reinterpret_cast(tagged.GetRawData()))); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 10); + JSTaggedValue tagged = CreateBuiltinsDataView(thread_, 4, 0); + JSHandle view(thread_, JSDataView::Cast(reinterpret_cast(tagged.GetRawData()))); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 10); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(view.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(0)); ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(42)); ecmaRuntimeCallInfo->SetCallArg(2, JSTaggedValue::True()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsDataView::SetFloat32(ecmaRuntimeCallInfo.get()); ASSERT_EQ(result.GetRawData(), JSTaggedValue::VALUE_UNDEFINED); - auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); ecmaRuntimeCallInfo1->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo1->SetThis(view.GetTaggedValue()); ecmaRuntimeCallInfo1->SetCallArg(0, JSTaggedValue(0)); @@ -441,20 +441,20 @@ TEST_F(BuiltinsDataViewTest, SetFloat32) // new DataView(new ArrayBuffer(8), 0).SetFloat64/GetFloat64 TEST_F(BuiltinsDataViewTest, SetFloat64) { - JSTaggedValue tagged = CreateBuiltinsDataView(thread, 8, 0); - JSHandle view(thread, JSDataView::Cast(reinterpret_cast(tagged.GetRawData()))); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 10); + JSTaggedValue tagged = CreateBuiltinsDataView(thread_, 8, 0); + JSHandle view(thread_, JSDataView::Cast(reinterpret_cast(tagged.GetRawData()))); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 10); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(view.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(0)); ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(42)); ecmaRuntimeCallInfo->SetCallArg(2, JSTaggedValue::True()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsDataView::SetFloat64(ecmaRuntimeCallInfo.get()); ASSERT_EQ(result.GetRawData(), JSTaggedValue::VALUE_UNDEFINED); - auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); ecmaRuntimeCallInfo1->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo1->SetThis(view.GetTaggedValue()); ecmaRuntimeCallInfo1->SetCallArg(0, JSTaggedValue(0)); diff --git a/tests/runtime/builtins/builtins_date_test.cpp b/tests/runtime/builtins/builtins_date_test.cpp index aef29594852b7161f6b6e58b5ba3660430eb0ed5..49dc38fa4a9ca17626fc6487c17e33802acd3d76 100644 --- a/tests/runtime/builtins/builtins_date_test.cpp +++ b/tests/runtime/builtins/builtins_date_test.cpp @@ -46,17 +46,17 @@ public: void SetUp() override { - TestHelper::CreateEcmaVMWithScope(instance, thread, scope); + TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); } void TearDown() override { - TestHelper::DestroyEcmaVMWithScope(instance, scope); + TestHelper::DestroyEcmaVMWithScope(instance_, scope_); } - PandaVM *instance {nullptr}; - EcmaHandleScope *scope {nullptr}; - JSThread *thread {nullptr}; + PandaVM *instance_ {nullptr}; + EcmaHandleScope *scope_ {nullptr}; + JSThread *thread_ {nullptr}; }; JSHandle JSDateCreateTest(JSThread *thread) @@ -81,12 +81,12 @@ static std::unique_ptr CreateAndSetRuntimeCallInfo(JSThread TEST_F(BuiltinsDateTest, SetGetDate) { - JSHandle jsDate = JSDateCreateTest(thread); + JSHandle jsDate = JSDateCreateTest(thread_); - auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread, 6, jsDate.GetTaggedValue()); + auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread_, 6, jsDate.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast(2))); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); [[maybe_unused]] JSTaggedValue result1 = BuiltinsDate::SetDate(ecmaRuntimeCallInfo.get()); JSTaggedValue result2 = BuiltinsDate::GetDate(ecmaRuntimeCallInfo.get()); ASSERT_EQ(result2.GetRawData(), JSTaggedValue(static_cast(2)).GetRawData()); @@ -94,12 +94,12 @@ TEST_F(BuiltinsDateTest, SetGetDate) TEST_F(BuiltinsDateTest, SetGetUTCDate) { - JSHandle jsDate = JSDateCreateTest(thread); + JSHandle jsDate = JSDateCreateTest(thread_); - auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread, 6, jsDate.GetTaggedValue()); + auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread_, 6, jsDate.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast(2))); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); [[maybe_unused]] JSTaggedValue result3 = BuiltinsDate::SetUTCDate(ecmaRuntimeCallInfo.get()); JSTaggedValue result4 = BuiltinsDate::GetUTCDate(ecmaRuntimeCallInfo.get()); ASSERT_EQ(result4.GetRawData(), JSTaggedValue(static_cast(2)).GetRawData()); @@ -107,12 +107,12 @@ TEST_F(BuiltinsDateTest, SetGetUTCDate) TEST_F(BuiltinsDateTest, SetGetMinusUTCDate) { - JSHandle jsDate = JSDateCreateTest(thread); + JSHandle jsDate = JSDateCreateTest(thread_); - auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread, 6, jsDate.GetTaggedValue()); + auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread_, 6, jsDate.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast(-2))); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); [[maybe_unused]] JSTaggedValue result3 = BuiltinsDate::SetUTCDate(ecmaRuntimeCallInfo.get()); JSTaggedValue result4 = BuiltinsDate::GetUTCDate(ecmaRuntimeCallInfo.get()); ASSERT_EQ(result4.GetRawData(), JSTaggedValue(static_cast(29)).GetRawData()); @@ -120,9 +120,9 @@ TEST_F(BuiltinsDateTest, SetGetMinusUTCDate) TEST_F(BuiltinsDateTest, SetGetFullYear) { - JSHandle jsDate = JSDateCreateTest(thread); + JSHandle jsDate = JSDateCreateTest(thread_); - auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread, 10, jsDate.GetTaggedValue()); + auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread_, 10, jsDate.GetTaggedValue()); // 2018 : test case ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast(2018))); // 10 : test case @@ -130,7 +130,7 @@ TEST_F(BuiltinsDateTest, SetGetFullYear) // 2, 6 : test case ecmaRuntimeCallInfo->SetCallArg(2, JSTaggedValue(static_cast(6))); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); BuiltinsDate::SetFullYear(ecmaRuntimeCallInfo.get()); JSTaggedValue result1 = BuiltinsDate::GetFullYear(ecmaRuntimeCallInfo.get()); // 2018 : test case @@ -147,9 +147,9 @@ TEST_F(BuiltinsDateTest, SetGetFullYear) TEST_F(BuiltinsDateTest, SetGetUTCFullYear) { - JSHandle jsDate = JSDateCreateTest(thread); + JSHandle jsDate = JSDateCreateTest(thread_); - auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread, 10, jsDate.GetTaggedValue()); + auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread_, 10, jsDate.GetTaggedValue()); // 2018 : test case ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast(2018))); // 10 : test case @@ -157,7 +157,7 @@ TEST_F(BuiltinsDateTest, SetGetUTCFullYear) // 2, 6 : test case ecmaRuntimeCallInfo->SetCallArg(2, JSTaggedValue(static_cast(6))); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); BuiltinsDate::SetUTCFullYear(ecmaRuntimeCallInfo.get()); JSTaggedValue result4 = BuiltinsDate::GetUTCFullYear(ecmaRuntimeCallInfo.get()); // 2018 : test case @@ -174,13 +174,13 @@ TEST_F(BuiltinsDateTest, SetGetUTCFullYear) TEST_F(BuiltinsDateTest, SetGetMinusFullYear) { - JSHandle jsDate = JSDateCreateTest(thread); - auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread, 10, jsDate.GetTaggedValue()); + JSHandle jsDate = JSDateCreateTest(thread_); + auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread_, 10, jsDate.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast(-2018))); ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(static_cast(-10))); ecmaRuntimeCallInfo->SetCallArg(2, JSTaggedValue(static_cast(-6))); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); BuiltinsDate::SetFullYear(ecmaRuntimeCallInfo.get()); JSTaggedValue result1 = BuiltinsDate::GetFullYear(ecmaRuntimeCallInfo.get()); ASSERT_EQ(result1.GetRawData(), JSTaggedValue(static_cast(-2019)).GetRawData()); @@ -194,14 +194,14 @@ TEST_F(BuiltinsDateTest, SetGetMinusFullYear) TEST_F(BuiltinsDateTest, SetGetMinusUTCFullYear) { - JSHandle jsDate = JSDateCreateTest(thread); + JSHandle jsDate = JSDateCreateTest(thread_); - auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread, 10, jsDate.GetTaggedValue()); + auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread_, 10, jsDate.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast(-2018))); ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(static_cast(-10))); ecmaRuntimeCallInfo->SetCallArg(2, JSTaggedValue(static_cast(-6))); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); BuiltinsDate::SetUTCFullYear(ecmaRuntimeCallInfo.get()); JSTaggedValue result4 = BuiltinsDate::GetUTCFullYear(ecmaRuntimeCallInfo.get()); ASSERT_EQ(result4.GetRawData(), JSTaggedValue(static_cast(-2019)).GetRawData()); @@ -215,15 +215,15 @@ TEST_F(BuiltinsDateTest, SetGetMinusUTCFullYear) TEST_F(BuiltinsDateTest, SetGetHours) { - JSHandle jsDate = JSDateCreateTest(thread); + JSHandle jsDate = JSDateCreateTest(thread_); - auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread, 12, jsDate.GetTaggedValue()); + auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread_, 12, jsDate.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast(18))); ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(static_cast(10))); ecmaRuntimeCallInfo->SetCallArg(2, JSTaggedValue(static_cast(6))); ecmaRuntimeCallInfo->SetCallArg(3, JSTaggedValue(static_cast(111))); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); BuiltinsDate::SetHours(ecmaRuntimeCallInfo.get()); JSTaggedValue result1 = BuiltinsDate::GetHours(ecmaRuntimeCallInfo.get()); ASSERT_EQ(result1.GetRawData(), JSTaggedValue(static_cast(18)).GetRawData()); @@ -240,15 +240,15 @@ TEST_F(BuiltinsDateTest, SetGetHours) TEST_F(BuiltinsDateTest, SetGetUTCHours) { - JSHandle jsDate = JSDateCreateTest(thread); + JSHandle jsDate = JSDateCreateTest(thread_); - auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread, 12, jsDate.GetTaggedValue()); + auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread_, 12, jsDate.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast(18))); ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(static_cast(10))); ecmaRuntimeCallInfo->SetCallArg(2, JSTaggedValue(static_cast(6))); ecmaRuntimeCallInfo->SetCallArg(3, JSTaggedValue(static_cast(111))); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); BuiltinsDate::SetUTCHours(ecmaRuntimeCallInfo.get()); JSTaggedValue result5 = BuiltinsDate::GetUTCHours(ecmaRuntimeCallInfo.get()); ASSERT_EQ(result5.GetRawData(), JSTaggedValue(static_cast(18)).GetRawData()); @@ -265,15 +265,15 @@ TEST_F(BuiltinsDateTest, SetGetUTCHours) TEST_F(BuiltinsDateTest, SetGetMinusHours) { - JSHandle jsDate = JSDateCreateTest(thread); + JSHandle jsDate = JSDateCreateTest(thread_); - auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread, 12, jsDate.GetTaggedValue()); + auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread_, 12, jsDate.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast(-18))); ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(static_cast(-10))); ecmaRuntimeCallInfo->SetCallArg(2, JSTaggedValue(static_cast(-6))); ecmaRuntimeCallInfo->SetCallArg(3, JSTaggedValue(static_cast(-111))); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); BuiltinsDate::SetHours(ecmaRuntimeCallInfo.get()); JSTaggedValue result1 = BuiltinsDate::GetHours(ecmaRuntimeCallInfo.get()); ASSERT_EQ(result1.GetRawData(), JSTaggedValue(static_cast(5)).GetRawData()); @@ -290,15 +290,15 @@ TEST_F(BuiltinsDateTest, SetGetMinusHours) TEST_F(BuiltinsDateTest, SetGetMinusUTCHours) { - JSHandle jsDate = JSDateCreateTest(thread); + JSHandle jsDate = JSDateCreateTest(thread_); - auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread, 12, jsDate.GetTaggedValue()); + auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread_, 12, jsDate.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast(-18))); ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(static_cast(-10))); ecmaRuntimeCallInfo->SetCallArg(2, JSTaggedValue(static_cast(-6))); ecmaRuntimeCallInfo->SetCallArg(3, JSTaggedValue(static_cast(-111))); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); BuiltinsDate::SetUTCHours(ecmaRuntimeCallInfo.get()); JSTaggedValue result5 = BuiltinsDate::GetUTCHours(ecmaRuntimeCallInfo.get()); ASSERT_EQ(result5.GetRawData(), JSTaggedValue(static_cast(5)).GetRawData()); @@ -315,12 +315,12 @@ TEST_F(BuiltinsDateTest, SetGetMinusUTCHours) TEST_F(BuiltinsDateTest, SetGetMilliseconds) { - JSHandle jsDate = JSDateCreateTest(thread); + JSHandle jsDate = JSDateCreateTest(thread_); - auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread, 6, jsDate.GetTaggedValue()); + auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread_, 6, jsDate.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast(100))); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result1 = BuiltinsDate::SetMilliseconds(ecmaRuntimeCallInfo.get()); ASSERT_EQ(result1.GetRawData(), JSTaggedValue(static_cast(100)).GetRawData()); @@ -330,12 +330,12 @@ TEST_F(BuiltinsDateTest, SetGetMilliseconds) TEST_F(BuiltinsDateTest, SetGetUTCMilliseconds) { - JSHandle jsDate = JSDateCreateTest(thread); + JSHandle jsDate = JSDateCreateTest(thread_); - auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread, 6, jsDate.GetTaggedValue()); + auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread_, 6, jsDate.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast(100))); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result3 = BuiltinsDate::SetUTCMilliseconds(ecmaRuntimeCallInfo.get()); ASSERT_EQ(result3.GetRawData(), JSTaggedValue(static_cast(100)).GetRawData()); @@ -345,14 +345,14 @@ TEST_F(BuiltinsDateTest, SetGetUTCMilliseconds) TEST_F(BuiltinsDateTest, SetGetMinutes) { - JSHandle jsDate = JSDateCreateTest(thread); + JSHandle jsDate = JSDateCreateTest(thread_); - auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread, 10, jsDate.GetTaggedValue()); + auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread_, 10, jsDate.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast(10))); ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(static_cast(6))); ecmaRuntimeCallInfo->SetCallArg(2, JSTaggedValue(static_cast(111))); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); BuiltinsDate::SetMinutes(ecmaRuntimeCallInfo.get()); JSTaggedValue result1 = BuiltinsDate::GetMinutes(ecmaRuntimeCallInfo.get()); ASSERT_EQ(result1.GetRawData(), JSTaggedValue(static_cast(10)).GetRawData()); @@ -366,14 +366,14 @@ TEST_F(BuiltinsDateTest, SetGetMinutes) TEST_F(BuiltinsDateTest, SetGetUTCMinutes) { - JSHandle jsDate = JSDateCreateTest(thread); + JSHandle jsDate = JSDateCreateTest(thread_); - auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread, 10, jsDate.GetTaggedValue()); + auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread_, 10, jsDate.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast(10))); ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(static_cast(6))); ecmaRuntimeCallInfo->SetCallArg(2, JSTaggedValue(static_cast(111))); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); BuiltinsDate::SetUTCMinutes(ecmaRuntimeCallInfo.get()); JSTaggedValue result4 = BuiltinsDate::GetUTCMinutes(ecmaRuntimeCallInfo.get()); ASSERT_EQ(result4.GetRawData(), JSTaggedValue(static_cast(10)).GetRawData()); @@ -387,13 +387,13 @@ TEST_F(BuiltinsDateTest, SetGetUTCMinutes) TEST_F(BuiltinsDateTest, SetGetMonth) { - JSHandle jsDate = JSDateCreateTest(thread); + JSHandle jsDate = JSDateCreateTest(thread_); - auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread, 8, jsDate.GetTaggedValue()); + auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread_, 8, jsDate.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast(8))); ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(static_cast(3))); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); BuiltinsDate::SetMonth(ecmaRuntimeCallInfo.get()); JSTaggedValue result1 = BuiltinsDate::GetMonth(ecmaRuntimeCallInfo.get()); ASSERT_EQ(result1.GetRawData(), JSTaggedValue(static_cast(8)).GetRawData()); @@ -404,13 +404,13 @@ TEST_F(BuiltinsDateTest, SetGetMonth) TEST_F(BuiltinsDateTest, SetGetUTCMonth) { - JSHandle jsDate = JSDateCreateTest(thread); + JSHandle jsDate = JSDateCreateTest(thread_); - auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread, 8, jsDate.GetTaggedValue()); + auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread_, 8, jsDate.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast(8))); ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(static_cast(3))); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); BuiltinsDate::SetUTCMonth(ecmaRuntimeCallInfo.get()); JSTaggedValue result3 = BuiltinsDate::GetUTCMonth(ecmaRuntimeCallInfo.get()); ASSERT_EQ(result3.GetRawData(), JSTaggedValue(static_cast(8)).GetRawData()); @@ -421,13 +421,13 @@ TEST_F(BuiltinsDateTest, SetGetUTCMonth) TEST_F(BuiltinsDateTest, SetGetSeconds) { - JSHandle jsDate = JSDateCreateTest(thread); + JSHandle jsDate = JSDateCreateTest(thread_); - auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread, 8, jsDate.GetTaggedValue()); + auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread_, 8, jsDate.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast(59))); ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(static_cast(123))); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); BuiltinsDate::SetSeconds(ecmaRuntimeCallInfo.get()); JSTaggedValue result1 = BuiltinsDate::GetSeconds(ecmaRuntimeCallInfo.get()); ASSERT_EQ(result1.GetRawData(), JSTaggedValue(static_cast(59)).GetRawData()); @@ -438,13 +438,13 @@ TEST_F(BuiltinsDateTest, SetGetSeconds) TEST_F(BuiltinsDateTest, SetGetUTCSeconds) { - JSHandle jsDate = JSDateCreateTest(thread); + JSHandle jsDate = JSDateCreateTest(thread_); - auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread, 8, jsDate.GetTaggedValue()); + auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread_, 8, jsDate.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast(59))); ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(static_cast(123))); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); BuiltinsDate::SetUTCSeconds(ecmaRuntimeCallInfo.get()); JSTaggedValue result3 = BuiltinsDate::GetUTCSeconds(ecmaRuntimeCallInfo.get()); ASSERT_EQ(result3.GetRawData(), JSTaggedValue(static_cast(59)).GetRawData()); @@ -455,12 +455,12 @@ TEST_F(BuiltinsDateTest, SetGetUTCSeconds) TEST_F(BuiltinsDateTest, SetGetTime) { - JSHandle jsDate = JSDateCreateTest(thread); + JSHandle jsDate = JSDateCreateTest(thread_); - auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread, 6, jsDate.GetTaggedValue()); + auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread_, 6, jsDate.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast(2))); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result1 = BuiltinsDate::SetTime(ecmaRuntimeCallInfo.get()); ASSERT_EQ(result1.GetRawData(), JSTaggedValue(static_cast(2)).GetRawData()); @@ -470,18 +470,18 @@ TEST_F(BuiltinsDateTest, SetGetTime) TEST_F(BuiltinsDateTest, UTC) { - auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread, 12, JSTaggedValue::Undefined()); + auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread_, 12, JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(2020.982)); ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(10.23)); ecmaRuntimeCallInfo->SetCallArg(2, JSTaggedValue(4.32)); ecmaRuntimeCallInfo->SetCallArg(3, JSTaggedValue(11.32)); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result1 = BuiltinsDate::UTC(ecmaRuntimeCallInfo.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_EQ(result1.GetRawData(), JSTaggedValue(static_cast(1604487600000)).GetRawData()); - auto ecmaRuntimeCallInfo1 = CreateAndSetRuntimeCallInfo(thread, 18, JSTaggedValue::Undefined()); + auto ecmaRuntimeCallInfo1 = CreateAndSetRuntimeCallInfo(thread_, 18, JSTaggedValue::Undefined()); ecmaRuntimeCallInfo1->SetCallArg(0, JSTaggedValue(2020.982)); ecmaRuntimeCallInfo1->SetCallArg(1, JSTaggedValue(10.23)); ecmaRuntimeCallInfo1->SetCallArg(2, JSTaggedValue(4.32)); @@ -490,35 +490,35 @@ TEST_F(BuiltinsDateTest, UTC) ecmaRuntimeCallInfo1->SetCallArg(5, JSTaggedValue(34.321)); ecmaRuntimeCallInfo1->SetCallArg(6, JSTaggedValue(static_cast(231))); - prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); + prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); result1 = BuiltinsDate::UTC(ecmaRuntimeCallInfo1.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_EQ(result1.GetRawData(), JSTaggedValue(static_cast(1604490334231)).GetRawData()); - auto ecmaRuntimeCallInfo2 = CreateAndSetRuntimeCallInfo(thread, 10, JSTaggedValue::Undefined()); + auto ecmaRuntimeCallInfo2 = CreateAndSetRuntimeCallInfo(thread_, 10, JSTaggedValue::Undefined()); ecmaRuntimeCallInfo2->SetCallArg(0, JSTaggedValue(10.23)); ecmaRuntimeCallInfo2->SetCallArg(1, JSTaggedValue(4.32)); ecmaRuntimeCallInfo2->SetCallArg(2, JSTaggedValue(11.32)); - prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo2.get()); + prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo2.get()); result1 = BuiltinsDate::UTC(ecmaRuntimeCallInfo2.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_EQ(result1.GetRawData(), JSTaggedValue(static_cast(-1882224000000)).GetRawData()); - auto ecmaRuntimeCallInfo3 = CreateAndSetRuntimeCallInfo(thread, 6, JSTaggedValue::Undefined()); + auto ecmaRuntimeCallInfo3 = CreateAndSetRuntimeCallInfo(thread_, 6, JSTaggedValue::Undefined()); ecmaRuntimeCallInfo3->SetCallArg(0, JSTaggedValue(1994.982)); - prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo3.get()); + prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo3.get()); result1 = BuiltinsDate::UTC(ecmaRuntimeCallInfo3.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_EQ(result1.GetRawData(), JSTaggedValue(static_cast(757382400000)).GetRawData()); - auto ecmaRuntimeCallInfo4 = CreateAndSetRuntimeCallInfo(thread, 6, JSTaggedValue::Undefined()); + auto ecmaRuntimeCallInfo4 = CreateAndSetRuntimeCallInfo(thread_, 6, JSTaggedValue::Undefined()); ecmaRuntimeCallInfo4->SetCallArg(0, JSTaggedValue(19999944.982)); - prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo4.get()); + prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo4.get()); result1 = BuiltinsDate::UTC(ecmaRuntimeCallInfo4.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_EQ(result1.GetRawData(), JSTaggedValue(static_cast(base::NAN_VALUE)).GetRawData()); } @@ -606,74 +606,74 @@ void SetAll2(JSThread *thread, const JSHandle &jsDate) TEST_F(BuiltinsDateTest, parse) { JSHandle str = - thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("2020-11-19T12:18:18.132Z"); - auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread, 6, JSTaggedValue::Undefined()); + thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("2020-11-19T12:18:18.132Z"); + auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread_, 6, JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetCallArg(0, str.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result1 = BuiltinsDate::Parse(ecmaRuntimeCallInfo.get()); ASSERT_EQ(result1.GetRawData(), JSTaggedValue(static_cast(1605788298132)).GetRawData()); - JSHandle str1 = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("2020-11-19Z"); - auto ecmaRuntimeCallInfo1 = CreateAndSetRuntimeCallInfo(thread, 6, JSTaggedValue::Undefined()); + JSHandle str1 = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("2020-11-19Z"); + auto ecmaRuntimeCallInfo1 = CreateAndSetRuntimeCallInfo(thread_, 6, JSTaggedValue::Undefined()); ecmaRuntimeCallInfo1->SetCallArg(0, str1.GetTaggedValue()); - prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); + prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); result1 = BuiltinsDate::Parse(ecmaRuntimeCallInfo1.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_EQ(result1.GetRawData(), JSTaggedValue(static_cast(1605744000000)).GetRawData()); JSHandle str2 = - thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("2020-11T12:18:17.231+08:00"); - auto ecmaRuntimeCallInfo2 = CreateAndSetRuntimeCallInfo(thread, 6, JSTaggedValue::Undefined()); + thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("2020-11T12:18:17.231+08:00"); + auto ecmaRuntimeCallInfo2 = CreateAndSetRuntimeCallInfo(thread_, 6, JSTaggedValue::Undefined()); ecmaRuntimeCallInfo2->SetCallArg(0, str2.GetTaggedValue()); - prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo2.get()); + prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo2.get()); result1 = BuiltinsDate::Parse(ecmaRuntimeCallInfo2.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_EQ(result1.GetRawData(), JSTaggedValue(static_cast(1604204297231)).GetRawData()); JSHandle str3 = - thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("Thu Nov 19 2020 20:18:18 GMT+0800"); - auto ecmaRuntimeCallInfo3 = CreateAndSetRuntimeCallInfo(thread, 6, JSTaggedValue::Undefined()); + thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("Thu Nov 19 2020 20:18:18 GMT+0800"); + auto ecmaRuntimeCallInfo3 = CreateAndSetRuntimeCallInfo(thread_, 6, JSTaggedValue::Undefined()); ecmaRuntimeCallInfo3->SetCallArg(0, str3.GetTaggedValue()); - prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo3.get()); + prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo3.get()); result1 = BuiltinsDate::Parse(ecmaRuntimeCallInfo3.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_EQ(result1.GetRawData(), JSTaggedValue(static_cast(1605788298000)).GetRawData()); JSHandle str4 = - thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("Thu 03 Jun 2093 04:18 GMT"); - auto ecmaRuntimeCallInfo4 = CreateAndSetRuntimeCallInfo(thread, 6, JSTaggedValue::Undefined()); + thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("Thu 03 Jun 2093 04:18 GMT"); + auto ecmaRuntimeCallInfo4 = CreateAndSetRuntimeCallInfo(thread_, 6, JSTaggedValue::Undefined()); ecmaRuntimeCallInfo4->SetCallArg(0, str4.GetTaggedValue()); - prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo4.get()); + prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo4.get()); result1 = BuiltinsDate::Parse(ecmaRuntimeCallInfo4.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_EQ(result1.GetRawData(), JSTaggedValue(static_cast(3894841080000)).GetRawData()); - auto ecmaRuntimeCallInfo5 = CreateAndSetRuntimeCallInfo(thread, 6, JSTaggedValue::Undefined()); + auto ecmaRuntimeCallInfo5 = CreateAndSetRuntimeCallInfo(thread_, 6, JSTaggedValue::Undefined()); ecmaRuntimeCallInfo5->SetCallArg(0, JSTaggedValue::Null()); - prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo5.get()); + prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo5.get()); result1 = BuiltinsDate::Parse(ecmaRuntimeCallInfo5.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_EQ(result1.GetRawData(), JSTaggedValue(static_cast(base::NAN_VALUE)).GetRawData()); } TEST_F(BuiltinsDateTest, ToDateString) { JSHandle expect_value = - thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("Tue Nov 06 2018"); - JSHandle jsDate = JSDateCreateTest(thread); - SetAllYearAndHours(thread, jsDate); + thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("Tue Nov 06 2018"); + JSHandle jsDate = JSDateCreateTest(thread_); + SetAllYearAndHours(thread_, jsDate); - auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread, 4, jsDate.GetTaggedValue()); + auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread_, 4, jsDate.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsDate::ToDateString(ecmaRuntimeCallInfo.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_TRUE(result.IsString()); ASSERT_TRUE(EcmaString::StringsAreEqual(reinterpret_cast(result.GetRawData()), *expect_value)); @@ -682,14 +682,14 @@ TEST_F(BuiltinsDateTest, ToDateString) TEST_F(BuiltinsDateTest, ToISOString) { JSHandle expect_value = - thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("2020-11-19T12:18:18.132Z"); - JSHandle jsDate = JSDateCreateTest(thread); - JSDate::Cast(jsDate.GetTaggedValue().GetTaggedObject())->SetTimeValue(thread, JSTaggedValue(1605788298132.0)); - auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread, 4, jsDate.GetTaggedValue()); + thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("2020-11-19T12:18:18.132Z"); + JSHandle jsDate = JSDateCreateTest(thread_); + JSDate::Cast(jsDate.GetTaggedValue().GetTaggedObject())->SetTimeValue(thread_, JSTaggedValue(1605788298132.0)); + auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread_, 4, jsDate.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result1 = BuiltinsDate::ToISOString(ecmaRuntimeCallInfo.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_TRUE(result1.IsString()); ASSERT_TRUE(EcmaString::StringsAreEqual(reinterpret_cast(result1.GetRawData()), *expect_value)); } @@ -697,15 +697,15 @@ TEST_F(BuiltinsDateTest, ToISOString) TEST_F(BuiltinsDateTest, ToISOStringMinus) { JSHandle expect_value = - thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("1831-12-02T21:47:18.382Z"); - JSHandle jsDate = JSDateCreateTest(thread); - JSDate::Cast(jsDate.GetTaggedValue().GetTaggedObject())->SetTimeValue(thread, JSTaggedValue(-4357419161618.0)); + thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("1831-12-02T21:47:18.382Z"); + JSHandle jsDate = JSDateCreateTest(thread_); + JSDate::Cast(jsDate.GetTaggedValue().GetTaggedObject())->SetTimeValue(thread_, JSTaggedValue(-4357419161618.0)); - auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread, 4, jsDate.GetTaggedValue()); + auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread_, 4, jsDate.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result1 = BuiltinsDate::ToISOString(ecmaRuntimeCallInfo.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_TRUE(result1.IsString()); ASSERT_TRUE(EcmaString::StringsAreEqual(reinterpret_cast(result1.GetRawData()), *expect_value)); } @@ -714,14 +714,14 @@ TEST_F(BuiltinsDateTest, ToISOStringMinus) TEST_F(BuiltinsDateTest, ToJSON) { JSHandle expect_value = - thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("2020-11-19T12:18:18.132Z"); - JSHandle jsDate = JSDateCreateTest(thread); - jsDate->SetTimeValue(thread, JSTaggedValue(1605788298132.0)); - auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread, 4, jsDate.GetTaggedValue()); + thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("2020-11-19T12:18:18.132Z"); + JSHandle jsDate = JSDateCreateTest(thread_); + jsDate->SetTimeValue(thread_, JSTaggedValue(1605788298132.0)); + auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread_, 4, jsDate.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result1 = BuiltinsDate::ToJSON(ecmaRuntimeCallInfo.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_TRUE(result1.IsString()); ASSERT_TRUE(EcmaString::StringsAreEqual(reinterpret_cast(result1.GetRawData()), *expect_value)); } @@ -729,12 +729,12 @@ TEST_F(BuiltinsDateTest, ToJSON) TEST_F(BuiltinsDateTest, ToJSONMinus) { JSHandle expect_value = - thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("1831-12-02T21:47:18.382Z"); - JSHandle jsDate = JSDateCreateTest(thread); - jsDate->SetTimeValue(thread, JSTaggedValue(-4357419161618.0)); - auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread, 4, jsDate.GetTaggedValue()); + thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("1831-12-02T21:47:18.382Z"); + JSHandle jsDate = JSDateCreateTest(thread_); + jsDate->SetTimeValue(thread_, JSTaggedValue(-4357419161618.0)); + auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread_, 4, jsDate.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result1 = BuiltinsDate::ToJSON(ecmaRuntimeCallInfo.get()); ASSERT_TRUE(result1.IsString()); ASSERT_TRUE(EcmaString::StringsAreEqual(reinterpret_cast(result1.GetRawData()), *expect_value)); @@ -764,47 +764,47 @@ TEST_F(BuiltinsDateTest, ToString) int localMin = 0; CString localTime; - JSHandle jsDate = JSDateCreateTest(thread); - auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread, 4, jsDate.GetTaggedValue()); + JSHandle jsDate = JSDateCreateTest(thread_); + auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread_, 4, jsDate.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); - SetAllYearAndHours(thread, jsDate); + SetAllYearAndHours(thread_, jsDate); localTime = GetLocalTime(jsDate, localMin); JSTaggedValue result1 = BuiltinsDate::ToString(ecmaRuntimeCallInfo.get()); ASSERT_TRUE(result1.IsString()); - TestHelper::TearDownFrame(thread, prev); - JSHandle result1_val(thread, reinterpret_cast(result1.GetRawData())); + TestHelper::TearDownFrame(thread_, prev); + JSHandle result1_val(thread_, reinterpret_cast(result1.GetRawData())); CString str = "Tue Nov 06 2018 18:10:06 GMT" + localTime; - JSHandle str_handle = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(str); + JSHandle str_handle = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(str); ASSERT_TRUE(EcmaString::StringsAreEqual(*result1_val, *str_handle)); - JSHandle js_date1 = JSDateCreateTest(thread); - auto ecmaRuntimeCallInfo1 = CreateAndSetRuntimeCallInfo(thread, 4, js_date1.GetTaggedValue()); - prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); + JSHandle js_date1 = JSDateCreateTest(thread_); + auto ecmaRuntimeCallInfo1 = CreateAndSetRuntimeCallInfo(thread_, 4, js_date1.GetTaggedValue()); + prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); - SetAll1(thread, js_date1); + SetAll1(thread_, js_date1); localTime = GetLocalTime(js_date1, localMin); JSTaggedValue result2 = BuiltinsDate::ToString(ecmaRuntimeCallInfo1.get()); ASSERT_TRUE(result2.IsString()); - TestHelper::TearDownFrame(thread, prev); - JSHandle result2_val(thread, reinterpret_cast(result2.GetRawData())); + TestHelper::TearDownFrame(thread_, prev); + JSHandle result2_val(thread_, reinterpret_cast(result2.GetRawData())); str = "Mon Dec 31 1900 23:54:16 GMT" + localTime; - str_handle = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(str); + str_handle = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(str); ASSERT_TRUE(EcmaString::StringsAreEqual(*result2_val, *str_handle)); - JSHandle js_date2 = JSDateCreateTest(thread); - auto ecmaRuntimeCallInfo2 = CreateAndSetRuntimeCallInfo(thread, 4, js_date2.GetTaggedValue()); - prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo2.get()); + JSHandle js_date2 = JSDateCreateTest(thread_); + auto ecmaRuntimeCallInfo2 = CreateAndSetRuntimeCallInfo(thread_, 4, js_date2.GetTaggedValue()); + prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo2.get()); - SetAll2(thread, js_date2); + SetAll2(thread_, js_date2); localTime = GetLocalTime(jsDate, localMin); JSTaggedValue result3 = BuiltinsDate::ToString(ecmaRuntimeCallInfo2.get()); ASSERT_TRUE(result3.IsString()); - TestHelper::TearDownFrame(thread, prev); - JSHandle result3_val(thread, reinterpret_cast(result3.GetRawData())); + TestHelper::TearDownFrame(thread_, prev); + JSHandle result3_val(thread_, reinterpret_cast(result3.GetRawData())); str = "Tue Jan 01 1901 00:03:21 GMT" + localTime; - str_handle = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(str); + str_handle = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(str); ASSERT_TRUE(EcmaString::StringsAreEqual(*result3_val, *str_handle)); } @@ -813,53 +813,53 @@ TEST_F(BuiltinsDateTest, ToTimeString) int localMin = 0; CString localTime; - JSHandle jsDate = JSDateCreateTest(thread); - auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread, 4, jsDate.GetTaggedValue()); + JSHandle jsDate = JSDateCreateTest(thread_); + auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread_, 4, jsDate.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); - SetAllYearAndHours(thread, jsDate); + SetAllYearAndHours(thread_, jsDate); localTime = GetLocalTime(jsDate, localMin); JSTaggedValue result1 = BuiltinsDate::ToTimeString(ecmaRuntimeCallInfo.get()); ASSERT_TRUE(result1.IsString()); - JSHandle result1_val(thread, reinterpret_cast(result1.GetRawData())); + JSHandle result1_val(thread_, reinterpret_cast(result1.GetRawData())); CString str = "18:10:06 GMT" + localTime; - JSHandle str_handle = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(str); + JSHandle str_handle = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(str); ASSERT_TRUE(EcmaString::StringsAreEqual(*result1_val, *str_handle)); - JSHandle js_date1 = JSDateCreateTest(thread); - auto ecmaRuntimeCallInfo1 = CreateAndSetRuntimeCallInfo(thread, 4, js_date1.GetTaggedValue()); - prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); - SetAll1(thread, js_date1); + JSHandle js_date1 = JSDateCreateTest(thread_); + auto ecmaRuntimeCallInfo1 = CreateAndSetRuntimeCallInfo(thread_, 4, js_date1.GetTaggedValue()); + prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); + SetAll1(thread_, js_date1); localTime = GetLocalTime(js_date1, localMin); JSTaggedValue result2 = BuiltinsDate::ToTimeString(ecmaRuntimeCallInfo1.get()); ASSERT_TRUE(result2.IsString()); - JSHandle result2_val(thread, reinterpret_cast(result2.GetRawData())); + JSHandle result2_val(thread_, reinterpret_cast(result2.GetRawData())); str = "23:54:16 GMT" + localTime; - str_handle = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(str); + str_handle = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(str); ASSERT_TRUE(EcmaString::StringsAreEqual(*result2_val, *str_handle)); - JSHandle js_date2 = JSDateCreateTest(thread); - auto ecmaRuntimeCallInfo2 = CreateAndSetRuntimeCallInfo(thread, 4, js_date2.GetTaggedValue()); - prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo2.get()); - SetAll2(thread, js_date2); + JSHandle js_date2 = JSDateCreateTest(thread_); + auto ecmaRuntimeCallInfo2 = CreateAndSetRuntimeCallInfo(thread_, 4, js_date2.GetTaggedValue()); + prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo2.get()); + SetAll2(thread_, js_date2); localTime = GetLocalTime(jsDate, localMin); JSTaggedValue result3 = BuiltinsDate::ToTimeString(ecmaRuntimeCallInfo2.get()); ASSERT_TRUE(result3.IsString()); - JSHandle result3_val(thread, reinterpret_cast(result3.GetRawData())); + JSHandle result3_val(thread_, reinterpret_cast(result3.GetRawData())); str = "00:03:21 GMT" + localTime; - str_handle = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(str); + str_handle = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(str); ASSERT_TRUE(EcmaString::StringsAreEqual(*result3_val, *str_handle)); } TEST_F(BuiltinsDateTest, ToUTCString) { JSHandle expect_value = - thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("Thu, 19 Nov 2020 12:18:18 GMT"); - JSHandle jsDate = JSDateCreateTest(thread); - JSDate::Cast(jsDate.GetTaggedValue().GetTaggedObject())->SetTimeValue(thread, JSTaggedValue(1605788298132.0)); - auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread, 4, jsDate.GetTaggedValue()); + thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("Thu, 19 Nov 2020 12:18:18 GMT"); + JSHandle jsDate = JSDateCreateTest(thread_); + JSDate::Cast(jsDate.GetTaggedValue().GetTaggedObject())->SetTimeValue(thread_, JSTaggedValue(1605788298132.0)); + auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread_, 4, jsDate.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result1 = BuiltinsDate::ToUTCString(ecmaRuntimeCallInfo.get()); ASSERT_TRUE(result1.IsString()); ASSERT_TRUE(EcmaString::StringsAreEqual(reinterpret_cast(result1.GetRawData()), *expect_value)); @@ -868,12 +868,12 @@ TEST_F(BuiltinsDateTest, ToUTCString) TEST_F(BuiltinsDateTest, ToUTCStringMinus) { JSHandle expect_value = - thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("Fri, 02 Dec 1831 21:47:18 GMT"); - JSHandle jsDate = JSDateCreateTest(thread); - JSDate::Cast(jsDate.GetTaggedValue().GetTaggedObject())->SetTimeValue(thread, JSTaggedValue(-4357419161618.0)); - auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread, 4, jsDate.GetTaggedValue()); + thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("Fri, 02 Dec 1831 21:47:18 GMT"); + JSHandle jsDate = JSDateCreateTest(thread_); + JSDate::Cast(jsDate.GetTaggedValue().GetTaggedObject())->SetTimeValue(thread_, JSTaggedValue(-4357419161618.0)); + auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread_, 4, jsDate.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result1 = BuiltinsDate::ToUTCString(ecmaRuntimeCallInfo.get()); ASSERT_TRUE(result1.IsString()); ASSERT_TRUE(EcmaString::StringsAreEqual(reinterpret_cast(result1.GetRawData()), *expect_value)); @@ -881,22 +881,22 @@ TEST_F(BuiltinsDateTest, ToUTCStringMinus) TEST_F(BuiltinsDateTest, ValueOf) { - JSHandle jsDate = JSDateCreateTest(thread); - JSDate::Cast(jsDate.GetTaggedValue().GetTaggedObject())->SetTimeValue(thread, JSTaggedValue(1605788298132.0)); - auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread, 4, jsDate.GetTaggedValue()); + JSHandle jsDate = JSDateCreateTest(thread_); + JSDate::Cast(jsDate.GetTaggedValue().GetTaggedObject())->SetTimeValue(thread_, JSTaggedValue(1605788298132.0)); + auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread_, 4, jsDate.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result1 = BuiltinsDate::ValueOf(ecmaRuntimeCallInfo.get()); ASSERT_EQ(result1.GetRawData(), JSTaggedValue(static_cast(1605788298132)).GetRawData()); } TEST_F(BuiltinsDateTest, ValueOfMinus) { - JSHandle jsDate = JSDateCreateTest(thread); - JSDate::Cast(jsDate.GetTaggedValue().GetTaggedObject())->SetTimeValue(thread, JSTaggedValue(-4357419161618.0)); - auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread, 4, jsDate.GetTaggedValue()); + JSHandle jsDate = JSDateCreateTest(thread_); + JSDate::Cast(jsDate.GetTaggedValue().GetTaggedObject())->SetTimeValue(thread_, JSTaggedValue(-4357419161618.0)); + auto ecmaRuntimeCallInfo = CreateAndSetRuntimeCallInfo(thread_, 4, jsDate.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result1 = BuiltinsDate::ValueOf(ecmaRuntimeCallInfo.get()); ASSERT_EQ(result1.GetRawData(), JSTaggedValue(static_cast(-4357419161618)).GetRawData()); } @@ -904,35 +904,35 @@ TEST_F(BuiltinsDateTest, ValueOfMinus) TEST_F(BuiltinsDateTest, DateConstructor) { // case1: test new target is undefined. - JSHandle jsDate = JSDateCreateTest(thread); - JSHandle globalEnv = thread->GetEcmaVM()->GetGlobalEnv(); + JSHandle jsDate = JSDateCreateTest(thread_); + JSHandle globalEnv = thread_->GetEcmaVM()->GetGlobalEnv(); JSHandle date_func(globalEnv->GetDateFunction()); - auto ecmaRuntimeCallInfo1 = CreateAndSetRuntimeCallInfo(thread, 4, JSTaggedValue::Undefined()); + auto ecmaRuntimeCallInfo1 = CreateAndSetRuntimeCallInfo(thread_, 4, JSTaggedValue::Undefined()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); JSTaggedValue result1 = BuiltinsDate::DateConstructor(ecmaRuntimeCallInfo1.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_TRUE(result1.IsString()); // case2: length == 0 - auto ecmaRuntimeCallInfo2 = TestHelper::CreateEcmaRuntimeCallInfo(thread, jsDate.GetTaggedValue(), 4); + auto ecmaRuntimeCallInfo2 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, jsDate.GetTaggedValue(), 4); ecmaRuntimeCallInfo2->SetFunction(date_func.GetTaggedValue()); ecmaRuntimeCallInfo2->SetThis(jsDate.GetTaggedValue()); - prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo2.get()); + prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo2.get()); JSTaggedValue result2 = BuiltinsDate::DateConstructor(ecmaRuntimeCallInfo2.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_TRUE(result2.IsObject()); // case3: length == 1 - auto ecmaRuntimeCallInfo3 = TestHelper::CreateEcmaRuntimeCallInfo(thread, jsDate.GetTaggedValue(), 6); + auto ecmaRuntimeCallInfo3 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, jsDate.GetTaggedValue(), 6); ecmaRuntimeCallInfo3->SetFunction(date_func.GetTaggedValue()); ecmaRuntimeCallInfo3->SetThis(jsDate.GetTaggedValue()); ecmaRuntimeCallInfo3->SetCallArg(0, JSTaggedValue(static_cast(2018))); - prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo3.get()); + prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo3.get()); JSTaggedValue result3 = BuiltinsDate::DateConstructor(ecmaRuntimeCallInfo3.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_TRUE(result3.IsObject()); BuiltinsDate::SetFullYear(ecmaRuntimeCallInfo3.get()); @@ -940,17 +940,17 @@ TEST_F(BuiltinsDateTest, DateConstructor) ASSERT_EQ(result4.GetRawData(), JSTaggedValue(static_cast(2018)).GetRawData()); // case3: length > 1 - auto ecmaRuntimeCallInfo4 = TestHelper::CreateEcmaRuntimeCallInfo(thread, jsDate.GetTaggedValue(), 8); + auto ecmaRuntimeCallInfo4 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, jsDate.GetTaggedValue(), 8); ecmaRuntimeCallInfo4->SetFunction(date_func.GetTaggedValue()); ecmaRuntimeCallInfo4->SetThis(jsDate.GetTaggedValue()); ecmaRuntimeCallInfo4->SetCallArg(0, JSTaggedValue(static_cast(2018))); ecmaRuntimeCallInfo4->SetCallArg(1, JSTaggedValue(static_cast(10))); - prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo4.get()); + prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo4.get()); JSTaggedValue result5 = BuiltinsDate::DateConstructor(ecmaRuntimeCallInfo4.get()); ASSERT_TRUE(result5.IsObject()); - SetAllYearAndHours(thread, jsDate); + SetAllYearAndHours(thread_, jsDate); BuiltinsDate::SetFullYear(ecmaRuntimeCallInfo4.get()); JSTaggedValue result6 = BuiltinsDate::GetFullYear(ecmaRuntimeCallInfo4.get()); ASSERT_EQ(result6.GetRawData(), JSTaggedValue(static_cast(2018)).GetRawData()); diff --git a/tests/runtime/builtins/builtins_errors_test.cpp b/tests/runtime/builtins/builtins_errors_test.cpp index 6630318b5d7a5bf4ca254abe12e0c719e819f9c9..e6ea9004fa424a63560d99603fc2b7c45fc4bbb5 100644 --- a/tests/runtime/builtins/builtins_errors_test.cpp +++ b/tests/runtime/builtins/builtins_errors_test.cpp @@ -57,17 +57,17 @@ public: void SetUp() override { - TestHelper::CreateEcmaVMWithScope(instance, thread, scope); + TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); } void TearDown() override { - TestHelper::DestroyEcmaVMWithScope(instance, scope); + TestHelper::DestroyEcmaVMWithScope(instance_, scope_); } - PandaVM *instance {nullptr}; - EcmaHandleScope *scope {nullptr}; - JSThread *thread {nullptr}; + PandaVM *instance_ {nullptr}; + EcmaHandleScope *scope_ {nullptr}; + JSThread *thread_ {nullptr}; }; /* @@ -80,23 +80,23 @@ TEST_F(BuiltinsErrorsTest, GetJSErrorObject) /** * @tc.steps: step1. Create JSError object */ - ObjectFactory *factory = EcmaVM::Cast(instance)->GetFactory(); + ObjectFactory *factory = EcmaVM::Cast(instance_)->GetFactory(); JSHandle handleObj = factory->GetJSError(ErrorType::TYPE_ERROR); JSHandle msgKey(factory->NewFromCanBeCompressString("message")); - JSHandle nameKey = thread->GlobalConstants()->GetHandledNameString(); + JSHandle nameKey = thread_->GlobalConstants()->GetHandledNameString(); /** * @tc.steps: step2. obtain JSError object prototype chain name property and message property */ JSHandle msgValue( - JSObject::GetProperty(thread, JSHandle(handleObj), msgKey).GetValue()); + JSObject::GetProperty(thread_, JSHandle(handleObj), msgKey).GetValue()); EXPECT_EQ(reinterpret_cast(msgValue->GetRawData()) ->Compare(reinterpret_cast( ecmascript::JSTaggedValue(*factory->NewFromCanBeCompressString("")).GetRawData())), 0); JSHandle nameValue( - JSObject::GetProperty(thread, JSHandle(handleObj), nameKey).GetValue()); + JSObject::GetProperty(thread_, JSHandle(handleObj), nameKey).GetValue()); ASSERT_EQ(reinterpret_cast( ecmascript::JSTaggedValue(*factory->NewFromCanBeCompressString("TypeError")).GetRawData()) ->Compare(reinterpret_cast(nameValue->GetRawData())), @@ -110,19 +110,19 @@ TEST_F(BuiltinsErrorsTest, GetJSErrorObject) */ TEST_F(BuiltinsErrorsTest, GetJSErrorWithMessage) { - ObjectFactory *factory = EcmaVM::Cast(instance)->GetFactory(); + ObjectFactory *factory = EcmaVM::Cast(instance_)->GetFactory(); JSHandle handleObj = factory->GetJSError(ErrorType::TYPE_ERROR, "I am type error"); JSHandle msgKey(factory->NewFromCanBeCompressString("message")); - JSHandle nameKey = thread->GlobalConstants()->GetHandledNameString(); + JSHandle nameKey = thread_->GlobalConstants()->GetHandledNameString(); JSHandle msgValue( - JSObject::GetProperty(thread, JSHandle(handleObj), msgKey).GetValue()); + JSObject::GetProperty(thread_, JSHandle(handleObj), msgKey).GetValue()); ASSERT_EQ(reinterpret_cast( ecmascript::JSTaggedValue(*factory->NewFromCanBeCompressString("I am type error")).GetRawData()) ->Compare(reinterpret_cast(msgValue->GetRawData())), 0); JSHandle nameValue( - JSObject::GetProperty(thread, JSHandle(handleObj), nameKey).GetValue()); + JSObject::GetProperty(thread_, JSHandle(handleObj), nameKey).GetValue()); ASSERT_EQ(reinterpret_cast( ecmascript::JSTaggedValue(*factory->NewFromCanBeCompressString("TypeError")).GetRawData()) ->Compare(reinterpret_cast(nameValue->GetRawData())), @@ -136,31 +136,31 @@ TEST_F(BuiltinsErrorsTest, GetJSErrorWithMessage) */ TEST_F(BuiltinsErrorsTest, ErrorNoParameterConstructor) { - ObjectFactory *factory = EcmaVM::Cast(instance)->GetFactory(); - JSHandle env = EcmaVM::Cast(instance)->GetGlobalEnv(); + ObjectFactory *factory = EcmaVM::Cast(instance_)->GetFactory(); + JSHandle env = EcmaVM::Cast(instance_)->GetGlobalEnv(); JSHandle error(env->GetErrorFunction()); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue(*error), 4); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue(*error), 4); ecmaRuntimeCallInfo->SetFunction(error.GetTaggedValue()); ecmaRuntimeCallInfo->SetThis(JSTaggedValue(*error)); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = Error::ErrorConstructor(ecmaRuntimeCallInfo.get()); EXPECT_TRUE(result.IsECMAObject()); - JSHandle errorObject(thread, reinterpret_cast(result.GetRawData())); + JSHandle errorObject(thread_, reinterpret_cast(result.GetRawData())); JSHandle msgKey(factory->NewFromCanBeCompressString("message")); - JSHandle nameKey = thread->GlobalConstants()->GetHandledNameString(); + JSHandle nameKey = thread_->GlobalConstants()->GetHandledNameString(); - JSHandle msgValue(JSObject::GetProperty(thread, errorObject, msgKey).GetValue()); + JSHandle msgValue(JSObject::GetProperty(thread_, errorObject, msgKey).GetValue()); ASSERT_EQ( reinterpret_cast(ecmascript::JSTaggedValue(*factory->NewFromCanBeCompressString("")).GetRawData()) ->Compare(reinterpret_cast(msgValue->GetRawData())), 0); - JSHandle nameValue(JSObject::GetProperty(thread, errorObject, nameKey).GetValue()); + JSHandle nameValue(JSObject::GetProperty(thread_, errorObject, nameKey).GetValue()); ASSERT_EQ(reinterpret_cast( ecmascript::JSTaggedValue(*factory->NewFromCanBeCompressString("Error")).GetRawData()) ->Compare(reinterpret_cast(nameValue->GetRawData())), @@ -174,33 +174,33 @@ TEST_F(BuiltinsErrorsTest, ErrorNoParameterConstructor) */ TEST_F(BuiltinsErrorsTest, ErrorParameterConstructor) { - ObjectFactory *factory = EcmaVM::Cast(instance)->GetFactory(); - JSHandle env = EcmaVM::Cast(instance)->GetGlobalEnv(); + ObjectFactory *factory = EcmaVM::Cast(instance_)->GetFactory(); + JSHandle env = EcmaVM::Cast(instance_)->GetGlobalEnv(); JSHandle error(env->GetErrorFunction()); JSHandle paramMsg(factory->NewFromCanBeCompressString("Hello Error!")); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue(*error), 6); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue(*error), 6); ecmaRuntimeCallInfo->SetFunction(error.GetTaggedValue()); ecmaRuntimeCallInfo->SetThis(JSTaggedValue(*error)); ecmaRuntimeCallInfo->SetCallArg(0, paramMsg.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = Error::ErrorConstructor(ecmaRuntimeCallInfo.get()); EXPECT_TRUE(result.IsECMAObject()); - JSHandle errorObject(thread, reinterpret_cast(result.GetRawData())); + JSHandle errorObject(thread_, reinterpret_cast(result.GetRawData())); JSHandle msgKey(factory->NewFromCanBeCompressString("message")); - JSHandle nameKey = thread->GlobalConstants()->GetHandledNameString(); - JSHandle msgValue(JSObject::GetProperty(thread, errorObject, msgKey).GetValue()); + JSHandle nameKey = thread_->GlobalConstants()->GetHandledNameString(); + JSHandle msgValue(JSObject::GetProperty(thread_, errorObject, msgKey).GetValue()); ASSERT_EQ(reinterpret_cast( ecmascript::JSTaggedValue(*factory->NewFromCanBeCompressString("Hello Error!")).GetRawData()) ->Compare(reinterpret_cast(msgValue->GetRawData())), 0); - JSHandle nameValue(JSObject::GetProperty(thread, errorObject, nameKey).GetValue()); + JSHandle nameValue(JSObject::GetProperty(thread_, errorObject, nameKey).GetValue()); ASSERT_EQ(reinterpret_cast( ecmascript::JSTaggedValue(*factory->NewFromCanBeCompressString("Error")).GetRawData()) ->Compare(reinterpret_cast(nameValue->GetRawData())), @@ -214,20 +214,20 @@ TEST_F(BuiltinsErrorsTest, ErrorParameterConstructor) */ TEST_F(BuiltinsErrorsTest, ErrorNoParameterToString) { - ObjectFactory *factory = EcmaVM::Cast(instance)->GetFactory(); - JSHandle env = EcmaVM::Cast(instance)->GetGlobalEnv(); + ObjectFactory *factory = EcmaVM::Cast(instance_)->GetFactory(); + JSHandle env = EcmaVM::Cast(instance_)->GetGlobalEnv(); JSHandle errorObject = env->GetErrorFunction(); JSHandle error = factory->NewJSObjectByConstructor(JSHandle(errorObject), errorObject); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(JSTaggedValue(*error)); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = Error::ToString(ecmaRuntimeCallInfo.get()); - JSHandle resultHandle(thread, reinterpret_cast(result.GetRawData())); + JSHandle resultHandle(thread_, reinterpret_cast(result.GetRawData())); EXPECT_TRUE(result.IsString()); EXPECT_EQ(reinterpret_cast( ecmascript::JSTaggedValue(*factory->NewFromCanBeCompressString("Error")).GetRawData()) @@ -242,25 +242,25 @@ TEST_F(BuiltinsErrorsTest, ErrorNoParameterToString) */ TEST_F(BuiltinsErrorsTest, ErrorToString) { - ObjectFactory *factory = EcmaVM::Cast(instance)->GetFactory(); - JSHandle env = EcmaVM::Cast(instance)->GetGlobalEnv(); + ObjectFactory *factory = EcmaVM::Cast(instance_)->GetFactory(); + JSHandle env = EcmaVM::Cast(instance_)->GetGlobalEnv(); JSHandle errorObject = env->GetErrorFunction(); JSHandle error = factory->NewJSObjectByConstructor(JSHandle(errorObject), errorObject); JSHandle handleMsgKey(factory->NewFromCanBeCompressString("message")); JSObject::SetProperty( - thread, JSHandle(error), handleMsgKey, - JSHandle(thread, factory->NewFromCanBeCompressString("This is Error!").GetTaggedValue())); + thread_, JSHandle(error), handleMsgKey, + JSHandle(thread_, factory->NewFromCanBeCompressString("This is Error!").GetTaggedValue())); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(JSTaggedValue(*error)); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = Error::ToString(ecmaRuntimeCallInfo.get()); - JSHandle resultHandle(thread, reinterpret_cast(result.GetRawData())); + JSHandle resultHandle(thread_, reinterpret_cast(result.GetRawData())); EXPECT_TRUE(result.IsString()); EXPECT_EQ(reinterpret_cast( ecmascript::JSTaggedValue(*factory->NewFromCanBeCompressString("Error: This is Error!")).GetRawData()) @@ -275,30 +275,30 @@ TEST_F(BuiltinsErrorsTest, ErrorToString) */ TEST_F(BuiltinsErrorsTest, RangeErrorNoParameterConstructor) { - ObjectFactory *factory = EcmaVM::Cast(instance)->GetFactory(); - JSHandle env = EcmaVM::Cast(instance)->GetGlobalEnv(); + ObjectFactory *factory = EcmaVM::Cast(instance_)->GetFactory(); + JSHandle env = EcmaVM::Cast(instance_)->GetGlobalEnv(); JSHandle error(env->GetRangeErrorFunction()); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); ecmaRuntimeCallInfo->SetFunction(error.GetTaggedValue()); ecmaRuntimeCallInfo->SetThis(JSTaggedValue(*error)); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = RangeError::RangeErrorConstructor(ecmaRuntimeCallInfo.get()); EXPECT_TRUE(result.IsECMAObject()); - JSHandle errorObject(thread, reinterpret_cast(result.GetRawData())); + JSHandle errorObject(thread_, reinterpret_cast(result.GetRawData())); JSHandle msgKey(factory->NewFromCanBeCompressString("message")); - JSHandle nameKey = thread->GlobalConstants()->GetHandledNameString(); + JSHandle nameKey = thread_->GlobalConstants()->GetHandledNameString(); - JSHandle msgValue(JSObject::GetProperty(thread, errorObject, msgKey).GetValue()); + JSHandle msgValue(JSObject::GetProperty(thread_, errorObject, msgKey).GetValue()); ASSERT_EQ( reinterpret_cast(ecmascript::JSTaggedValue(*factory->NewFromCanBeCompressString("")).GetRawData()) ->Compare(reinterpret_cast(JSTaggedValue(msgValue.GetTaggedValue()).GetRawData())), 0); - JSHandle nameValue(JSObject::GetProperty(thread, errorObject, nameKey).GetValue()); + JSHandle nameValue(JSObject::GetProperty(thread_, errorObject, nameKey).GetValue()); ASSERT_EQ(reinterpret_cast( ecmascript::JSTaggedValue(*factory->NewFromCanBeCompressString("RangeError")).GetRawData()) ->Compare(reinterpret_cast(JSTaggedValue(nameValue.GetTaggedValue()).GetRawData())), @@ -312,33 +312,33 @@ TEST_F(BuiltinsErrorsTest, RangeErrorNoParameterConstructor) */ TEST_F(BuiltinsErrorsTest, RangeErrorParameterConstructor) { - ObjectFactory *factory = EcmaVM::Cast(instance)->GetFactory(); - JSHandle env = EcmaVM::Cast(instance)->GetGlobalEnv(); + ObjectFactory *factory = EcmaVM::Cast(instance_)->GetFactory(); + JSHandle env = EcmaVM::Cast(instance_)->GetGlobalEnv(); JSHandle error(env->GetRangeErrorFunction()); JSHandle paramMsg(factory->NewFromCanBeCompressString("Hello RangeError!")); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue(*error), 6); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue(*error), 6); ecmaRuntimeCallInfo->SetFunction(error.GetTaggedValue()); ecmaRuntimeCallInfo->SetThis(JSTaggedValue(*error)); ecmaRuntimeCallInfo->SetCallArg(0, paramMsg.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = RangeError::RangeErrorConstructor(ecmaRuntimeCallInfo.get()); EXPECT_TRUE(result.IsECMAObject()); - JSHandle errorObject(thread, reinterpret_cast(result.GetRawData())); + JSHandle errorObject(thread_, reinterpret_cast(result.GetRawData())); JSHandle msgKey(factory->NewFromCanBeCompressString("message")); - JSHandle nameKey = thread->GlobalConstants()->GetHandledNameString(); + JSHandle nameKey = thread_->GlobalConstants()->GetHandledNameString(); - JSHandle msgValue(JSObject::GetProperty(thread, errorObject, msgKey).GetValue()); + JSHandle msgValue(JSObject::GetProperty(thread_, errorObject, msgKey).GetValue()); ASSERT_EQ(reinterpret_cast( ecmascript::JSTaggedValue(*factory->NewFromCanBeCompressString("Hello RangeError!")).GetRawData()) ->Compare(reinterpret_cast(msgValue->GetRawData())), 0); - JSHandle nameValue(JSObject::GetProperty(thread, errorObject, nameKey).GetValue()); + JSHandle nameValue(JSObject::GetProperty(thread_, errorObject, nameKey).GetValue()); ASSERT_EQ(reinterpret_cast( ecmascript::JSTaggedValue(*factory->NewFromCanBeCompressString("RangeError")).GetRawData()) ->Compare(reinterpret_cast(nameValue->GetRawData())), @@ -352,19 +352,19 @@ TEST_F(BuiltinsErrorsTest, RangeErrorParameterConstructor) */ TEST_F(BuiltinsErrorsTest, RangeErrorNoParameterToString) { - ObjectFactory *factory = EcmaVM::Cast(instance)->GetFactory(); - JSHandle env = EcmaVM::Cast(instance)->GetGlobalEnv(); + ObjectFactory *factory = EcmaVM::Cast(instance_)->GetFactory(); + JSHandle env = EcmaVM::Cast(instance_)->GetGlobalEnv(); JSHandle errorObject = env->GetRangeErrorFunction(); JSHandle error = factory->NewJSObjectByConstructor(JSHandle(errorObject), errorObject); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(JSTaggedValue(*error)); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = RangeError::ToString(ecmaRuntimeCallInfo.get()); - JSHandle resultHandle(thread, result); + JSHandle resultHandle(thread_, result); EXPECT_TRUE(result.IsString()); @@ -381,24 +381,24 @@ TEST_F(BuiltinsErrorsTest, RangeErrorNoParameterToString) */ TEST_F(BuiltinsErrorsTest, RangeErrorToString) { - ObjectFactory *factory = EcmaVM::Cast(instance)->GetFactory(); - JSHandle env = EcmaVM::Cast(instance)->GetGlobalEnv(); + ObjectFactory *factory = EcmaVM::Cast(instance_)->GetFactory(); + JSHandle env = EcmaVM::Cast(instance_)->GetGlobalEnv(); JSHandle errorObject = env->GetRangeErrorFunction(); JSHandle error = factory->NewJSObjectByConstructor(JSHandle(errorObject), errorObject); JSHandle handleMsgKey(factory->NewFromCanBeCompressString("message")); - JSObject::SetProperty(thread, JSHandle(error), handleMsgKey, + JSObject::SetProperty(thread_, JSHandle(error), handleMsgKey, JSHandle(factory->NewFromCanBeCompressString("This is RangeError!"))); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(JSTaggedValue(*error)); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = RangeError::ToString(ecmaRuntimeCallInfo.get()); - JSHandle resultHandle(thread, reinterpret_cast(result.GetRawData())); + JSHandle resultHandle(thread_, reinterpret_cast(result.GetRawData())); EXPECT_TRUE(result.IsString()); EXPECT_EQ(factory->NewFromCanBeCompressString("RangeError: This is RangeError!")->Compare(*resultHandle), 0); } @@ -411,30 +411,30 @@ TEST_F(BuiltinsErrorsTest, RangeErrorToString) */ TEST_F(BuiltinsErrorsTest, ReferenceErrorNoParameterConstructor) { - ObjectFactory *factory = EcmaVM::Cast(instance)->GetFactory(); - JSHandle env = EcmaVM::Cast(instance)->GetGlobalEnv(); + ObjectFactory *factory = EcmaVM::Cast(instance_)->GetFactory(); + JSHandle env = EcmaVM::Cast(instance_)->GetGlobalEnv(); JSHandle error(env->GetReferenceErrorFunction()); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue(*error), 4); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue(*error), 4); ecmaRuntimeCallInfo->SetFunction(error.GetTaggedValue()); ecmaRuntimeCallInfo->SetThis(JSTaggedValue(*error)); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = ReferenceError::ReferenceErrorConstructor(ecmaRuntimeCallInfo.get()); EXPECT_TRUE(result.IsECMAObject()); - JSHandle errorObject(thread, reinterpret_cast(result.GetRawData())); + JSHandle errorObject(thread_, reinterpret_cast(result.GetRawData())); JSHandle msgKey(factory->NewFromCanBeCompressString("message")); - JSHandle nameKey = thread->GlobalConstants()->GetHandledNameString(); + JSHandle nameKey = thread_->GlobalConstants()->GetHandledNameString(); - JSHandle msgValue(JSObject::GetProperty(thread, errorObject, msgKey).GetValue()); + JSHandle msgValue(JSObject::GetProperty(thread_, errorObject, msgKey).GetValue()); ASSERT_EQ( reinterpret_cast(ecmascript::JSTaggedValue(*factory->NewFromCanBeCompressString("")).GetRawData()) ->Compare(reinterpret_cast(msgValue->GetRawData())), 0); - JSHandle nameValue(JSObject::GetProperty(thread, errorObject, nameKey).GetValue()); + JSHandle nameValue(JSObject::GetProperty(thread_, errorObject, nameKey).GetValue()); ASSERT_EQ(reinterpret_cast( ecmascript::JSTaggedValue(*factory->NewFromCanBeCompressString("ReferenceError")).GetRawData()) ->Compare(reinterpret_cast(nameValue->GetRawData())), @@ -448,31 +448,31 @@ TEST_F(BuiltinsErrorsTest, ReferenceErrorNoParameterConstructor) */ TEST_F(BuiltinsErrorsTest, ReferenceErrorParameterConstructor) { - ObjectFactory *factory = EcmaVM::Cast(instance)->GetFactory(); - JSHandle env = EcmaVM::Cast(instance)->GetGlobalEnv(); + ObjectFactory *factory = EcmaVM::Cast(instance_)->GetFactory(); + JSHandle env = EcmaVM::Cast(instance_)->GetGlobalEnv(); JSHandle error(env->GetReferenceErrorFunction()); JSHandle paramMsg(factory->NewFromCanBeCompressString("Hello ReferenceError!")); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue(*error), 6); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue(*error), 6); ecmaRuntimeCallInfo->SetFunction(error.GetTaggedValue()); ecmaRuntimeCallInfo->SetThis(JSTaggedValue(*error)); ecmaRuntimeCallInfo->SetCallArg(0, paramMsg.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = ReferenceError::ReferenceErrorConstructor(ecmaRuntimeCallInfo.get()); EXPECT_TRUE(result.IsECMAObject()); - JSHandle errorObject(thread, reinterpret_cast(result.GetRawData())); + JSHandle errorObject(thread_, reinterpret_cast(result.GetRawData())); JSHandle msgKey(factory->NewFromCanBeCompressString("message")); - JSHandle nameKey = thread->GlobalConstants()->GetHandledNameString(); - JSHandle msgValue(JSObject::GetProperty(thread, errorObject, msgKey).GetValue()); + JSHandle nameKey = thread_->GlobalConstants()->GetHandledNameString(); + JSHandle msgValue(JSObject::GetProperty(thread_, errorObject, msgKey).GetValue()); ASSERT_EQ(reinterpret_cast( ecmascript::JSTaggedValue(*factory->NewFromCanBeCompressString("Hello ReferenceError!")).GetRawData()) ->Compare(reinterpret_cast(msgValue->GetRawData())), 0); - JSHandle nameValue(JSObject::GetProperty(thread, errorObject, nameKey).GetValue()); + JSHandle nameValue(JSObject::GetProperty(thread_, errorObject, nameKey).GetValue()); ASSERT_EQ(reinterpret_cast( ecmascript::JSTaggedValue(*factory->NewFromCanBeCompressString("ReferenceError")).GetRawData()) ->Compare(reinterpret_cast(nameValue->GetRawData())), @@ -486,19 +486,19 @@ TEST_F(BuiltinsErrorsTest, ReferenceErrorParameterConstructor) */ TEST_F(BuiltinsErrorsTest, ReferenceErrorNoParameterToString) { - ObjectFactory *factory = EcmaVM::Cast(instance)->GetFactory(); - JSHandle env = EcmaVM::Cast(instance)->GetGlobalEnv(); + ObjectFactory *factory = EcmaVM::Cast(instance_)->GetFactory(); + JSHandle env = EcmaVM::Cast(instance_)->GetGlobalEnv(); JSHandle errorObject = env->GetReferenceErrorFunction(); JSHandle error = factory->NewJSObjectByConstructor(JSHandle(errorObject), errorObject); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(JSTaggedValue(*error)); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = ReferenceError::ToString(ecmaRuntimeCallInfo.get()); - JSHandle resultHandle(thread, reinterpret_cast(result.GetRawData())); + JSHandle resultHandle(thread_, reinterpret_cast(result.GetRawData())); EXPECT_TRUE(result.IsString()); EXPECT_EQ(reinterpret_cast( ecmascript::JSTaggedValue(*factory->NewFromCanBeCompressString("ReferenceError")).GetRawData()) @@ -513,23 +513,23 @@ TEST_F(BuiltinsErrorsTest, ReferenceErrorNoParameterToString) */ TEST_F(BuiltinsErrorsTest, ReferenceErrorToString) { - ObjectFactory *factory = EcmaVM::Cast(instance)->GetFactory(); - JSHandle env = EcmaVM::Cast(instance)->GetGlobalEnv(); + ObjectFactory *factory = EcmaVM::Cast(instance_)->GetFactory(); + JSHandle env = EcmaVM::Cast(instance_)->GetGlobalEnv(); JSHandle errorObject = env->GetReferenceErrorFunction(); JSHandle error = factory->NewJSObjectByConstructor(JSHandle(errorObject), errorObject); JSHandle handleMsgKey(factory->NewFromCanBeCompressString("message")); - JSObject::SetProperty(thread, JSHandle(error), handleMsgKey, + JSObject::SetProperty(thread_, JSHandle(error), handleMsgKey, JSHandle(factory->NewFromCanBeCompressString("This is ReferenceError!"))); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(JSTaggedValue(*error)); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = ReferenceError::ToString(ecmaRuntimeCallInfo.get()); - JSHandle resultHandle(thread, reinterpret_cast(result.GetRawData())); + JSHandle resultHandle(thread_, reinterpret_cast(result.GetRawData())); EXPECT_TRUE(result.IsString()); EXPECT_EQ(factory->NewFromCanBeCompressString("ReferenceError: This is ReferenceError!")->Compare(*resultHandle), 0); @@ -542,30 +542,30 @@ TEST_F(BuiltinsErrorsTest, ReferenceErrorToString) */ TEST_F(BuiltinsErrorsTest, TypeErrorNoParameterConstructor) { - ObjectFactory *factory = EcmaVM::Cast(instance)->GetFactory(); - JSHandle env = EcmaVM::Cast(instance)->GetGlobalEnv(); + ObjectFactory *factory = EcmaVM::Cast(instance_)->GetFactory(); + JSHandle env = EcmaVM::Cast(instance_)->GetGlobalEnv(); JSHandle error(env->GetTypeErrorFunction()); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue(*error), 4); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue(*error), 4); ecmaRuntimeCallInfo->SetFunction(error.GetTaggedValue()); ecmaRuntimeCallInfo->SetThis(JSTaggedValue(*error)); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = TypeError::TypeErrorConstructor(ecmaRuntimeCallInfo.get()); EXPECT_TRUE(result.IsECMAObject()); - JSHandle errorObject(thread, reinterpret_cast(result.GetRawData())); + JSHandle errorObject(thread_, reinterpret_cast(result.GetRawData())); JSHandle msgKey(factory->NewFromCanBeCompressString("message")); - JSHandle nameKey = thread->GlobalConstants()->GetHandledNameString(); + JSHandle nameKey = thread_->GlobalConstants()->GetHandledNameString(); - JSHandle msgValue(JSObject::GetProperty(thread, errorObject, msgKey).GetValue()); + JSHandle msgValue(JSObject::GetProperty(thread_, errorObject, msgKey).GetValue()); ASSERT_EQ( reinterpret_cast(ecmascript::JSTaggedValue(*factory->NewFromCanBeCompressString("")).GetRawData()) ->Compare(reinterpret_cast(msgValue->GetRawData())), 0); - JSHandle nameValue(JSObject::GetProperty(thread, errorObject, nameKey).GetValue()); + JSHandle nameValue(JSObject::GetProperty(thread_, errorObject, nameKey).GetValue()); EXPECT_EQ(reinterpret_cast(JSTaggedValue(nameValue.GetTaggedValue()).GetRawData()) ->Compare(reinterpret_cast(JSTaggedValue(nameValue.GetTaggedValue()).GetRawData())), 0); @@ -578,32 +578,32 @@ TEST_F(BuiltinsErrorsTest, TypeErrorNoParameterConstructor) */ TEST_F(BuiltinsErrorsTest, TypeErrorParameterConstructor) { - ObjectFactory *factory = EcmaVM::Cast(instance)->GetFactory(); - JSHandle env = EcmaVM::Cast(instance)->GetGlobalEnv(); + ObjectFactory *factory = EcmaVM::Cast(instance_)->GetFactory(); + JSHandle env = EcmaVM::Cast(instance_)->GetGlobalEnv(); JSHandle error(env->GetTypeErrorFunction()); JSHandle paramMsg(factory->NewFromCanBeCompressString("Hello TypeError!")); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue(*error), 6); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue(*error), 6); ecmaRuntimeCallInfo->SetFunction(error.GetTaggedValue()); ecmaRuntimeCallInfo->SetThis(JSTaggedValue(*error)); ecmaRuntimeCallInfo->SetCallArg(0, paramMsg.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = TypeError::TypeErrorConstructor(ecmaRuntimeCallInfo.get()); EXPECT_TRUE(result.IsECMAObject()); - JSHandle errorObject(thread, reinterpret_cast(result.GetRawData())); + JSHandle errorObject(thread_, reinterpret_cast(result.GetRawData())); JSHandle msgKey(factory->NewFromCanBeCompressString("message")); - JSHandle nameKey = thread->GlobalConstants()->GetHandledNameString(); + JSHandle nameKey = thread_->GlobalConstants()->GetHandledNameString(); - JSHandle msgValue(JSObject::GetProperty(thread, errorObject, msgKey).GetValue()); + JSHandle msgValue(JSObject::GetProperty(thread_, errorObject, msgKey).GetValue()); ASSERT_EQ(reinterpret_cast( ecmascript::JSTaggedValue(*factory->NewFromCanBeCompressString("Hello TypeError!")).GetRawData()) ->Compare(reinterpret_cast(msgValue->GetRawData())), 0); - JSHandle nameValue(JSObject::GetProperty(thread, errorObject, nameKey).GetValue()); + JSHandle nameValue(JSObject::GetProperty(thread_, errorObject, nameKey).GetValue()); ASSERT_EQ(reinterpret_cast( ecmascript::JSTaggedValue(*factory->NewFromCanBeCompressString("TypeError")).GetRawData()) ->Compare(reinterpret_cast(nameValue->GetRawData())), @@ -617,19 +617,19 @@ TEST_F(BuiltinsErrorsTest, TypeErrorParameterConstructor) */ TEST_F(BuiltinsErrorsTest, TypeErrorNoParameterToString) { - ObjectFactory *factory = EcmaVM::Cast(instance)->GetFactory(); - JSHandle env = EcmaVM::Cast(instance)->GetGlobalEnv(); + ObjectFactory *factory = EcmaVM::Cast(instance_)->GetFactory(); + JSHandle env = EcmaVM::Cast(instance_)->GetGlobalEnv(); JSHandle errorObject = env->GetTypeErrorFunction(); JSHandle error = factory->NewJSObjectByConstructor(JSHandle(errorObject), errorObject); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(JSTaggedValue(*error)); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = TypeError::ToString(ecmaRuntimeCallInfo.get()); - JSHandle resultHandle(thread, reinterpret_cast(result.GetRawData())); + JSHandle resultHandle(thread_, reinterpret_cast(result.GetRawData())); EXPECT_TRUE(result.IsString()); EXPECT_EQ(reinterpret_cast( ecmascript::JSTaggedValue(*factory->NewFromCanBeCompressString("TypeError")).GetRawData()) @@ -644,23 +644,23 @@ TEST_F(BuiltinsErrorsTest, TypeErrorNoParameterToString) */ TEST_F(BuiltinsErrorsTest, TypeErrorToString) { - ObjectFactory *factory = EcmaVM::Cast(instance)->GetFactory(); - JSHandle env = EcmaVM::Cast(instance)->GetGlobalEnv(); + ObjectFactory *factory = EcmaVM::Cast(instance_)->GetFactory(); + JSHandle env = EcmaVM::Cast(instance_)->GetGlobalEnv(); JSHandle errorObject = env->GetTypeErrorFunction(); JSHandle error = factory->NewJSObjectByConstructor(JSHandle(errorObject), errorObject); JSHandle value(factory->NewFromCanBeCompressString("This is TypeError!")); JSHandle handleMsgKey(factory->NewFromCanBeCompressString("message")); - JSObject::SetProperty(thread, JSHandle(error), handleMsgKey, value); + JSObject::SetProperty(thread_, JSHandle(error), handleMsgKey, value); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(JSTaggedValue(*error)); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = TypeError::ToString(ecmaRuntimeCallInfo.get()); - JSHandle resultHandle(thread, reinterpret_cast(result.GetRawData())); + JSHandle resultHandle(thread_, reinterpret_cast(result.GetRawData())); EXPECT_TRUE(result.IsString()); EXPECT_EQ(factory->NewFromCanBeCompressString("TypeError: This is TypeError!")->Compare(*resultHandle), 0); } @@ -672,30 +672,30 @@ TEST_F(BuiltinsErrorsTest, TypeErrorToString) */ TEST_F(BuiltinsErrorsTest, URIErrorNoParameterConstructor) { - ObjectFactory *factory = EcmaVM::Cast(instance)->GetFactory(); - JSHandle env = EcmaVM::Cast(instance)->GetGlobalEnv(); + ObjectFactory *factory = EcmaVM::Cast(instance_)->GetFactory(); + JSHandle env = EcmaVM::Cast(instance_)->GetGlobalEnv(); JSHandle error(env->GetURIErrorFunction()); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue(*error), 4); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue(*error), 4); ecmaRuntimeCallInfo->SetFunction(error.GetTaggedValue()); ecmaRuntimeCallInfo->SetThis(JSTaggedValue(*error)); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = URIError::URIErrorConstructor(ecmaRuntimeCallInfo.get()); EXPECT_TRUE(result.IsECMAObject()); - JSHandle errorObject(thread, reinterpret_cast(result.GetRawData())); + JSHandle errorObject(thread_, reinterpret_cast(result.GetRawData())); JSHandle msgKey(factory->NewFromCanBeCompressString("message")); - JSHandle nameKey = thread->GlobalConstants()->GetHandledNameString(); + JSHandle nameKey = thread_->GlobalConstants()->GetHandledNameString(); - JSHandle msgValue(JSObject::GetProperty(thread, errorObject, msgKey).GetValue()); + JSHandle msgValue(JSObject::GetProperty(thread_, errorObject, msgKey).GetValue()); ASSERT_EQ( reinterpret_cast(ecmascript::JSTaggedValue(*factory->NewFromCanBeCompressString("")).GetRawData()) ->Compare(reinterpret_cast(msgValue->GetRawData())), 0); - JSHandle nameValue(JSObject::GetProperty(thread, errorObject, nameKey).GetValue()); + JSHandle nameValue(JSObject::GetProperty(thread_, errorObject, nameKey).GetValue()); ASSERT_EQ(reinterpret_cast( ecmascript::JSTaggedValue(*factory->NewFromCanBeCompressString("URIError")).GetRawData()) ->Compare(reinterpret_cast(nameValue->GetRawData())), @@ -709,32 +709,32 @@ TEST_F(BuiltinsErrorsTest, URIErrorNoParameterConstructor) */ TEST_F(BuiltinsErrorsTest, URIErrorParameterConstructor) { - ObjectFactory *factory = EcmaVM::Cast(instance)->GetFactory(); - JSHandle env = EcmaVM::Cast(instance)->GetGlobalEnv(); + ObjectFactory *factory = EcmaVM::Cast(instance_)->GetFactory(); + JSHandle env = EcmaVM::Cast(instance_)->GetGlobalEnv(); JSHandle error(env->GetURIErrorFunction()); JSHandle paramMsg(factory->NewFromCanBeCompressString("Hello URIError!")); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue(*error), 6); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue(*error), 6); ecmaRuntimeCallInfo->SetFunction(error.GetTaggedValue()); ecmaRuntimeCallInfo->SetThis(JSTaggedValue(*error)); ecmaRuntimeCallInfo->SetCallArg(0, paramMsg.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = URIError::URIErrorConstructor(ecmaRuntimeCallInfo.get()); EXPECT_TRUE(result.IsECMAObject()); - JSHandle errorObject(thread, reinterpret_cast(result.GetRawData())); + JSHandle errorObject(thread_, reinterpret_cast(result.GetRawData())); JSHandle msgKey(factory->NewFromCanBeCompressString("message")); - JSHandle nameKey = thread->GlobalConstants()->GetHandledNameString(); + JSHandle nameKey = thread_->GlobalConstants()->GetHandledNameString(); - JSHandle msgValue(JSObject::GetProperty(thread, errorObject, msgKey).GetValue()); + JSHandle msgValue(JSObject::GetProperty(thread_, errorObject, msgKey).GetValue()); ASSERT_EQ(reinterpret_cast( ecmascript::JSTaggedValue(*factory->NewFromCanBeCompressString("Hello URIError!")).GetRawData()) ->Compare(reinterpret_cast(msgValue->GetRawData())), 0); - JSHandle nameValue(JSObject::GetProperty(thread, errorObject, nameKey).GetValue()); + JSHandle nameValue(JSObject::GetProperty(thread_, errorObject, nameKey).GetValue()); ASSERT_EQ(reinterpret_cast( ecmascript::JSTaggedValue(*factory->NewFromCanBeCompressString("URIError")).GetRawData()) ->Compare(reinterpret_cast(nameValue->GetRawData())), @@ -748,19 +748,19 @@ TEST_F(BuiltinsErrorsTest, URIErrorParameterConstructor) */ TEST_F(BuiltinsErrorsTest, URIErrorNoParameterToString) { - ObjectFactory *factory = EcmaVM::Cast(instance)->GetFactory(); - JSHandle env = EcmaVM::Cast(instance)->GetGlobalEnv(); + ObjectFactory *factory = EcmaVM::Cast(instance_)->GetFactory(); + JSHandle env = EcmaVM::Cast(instance_)->GetGlobalEnv(); JSHandle errorObject = env->GetURIErrorFunction(); JSHandle error = factory->NewJSObjectByConstructor(JSHandle(errorObject), errorObject); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(JSTaggedValue(*error)); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = URIError::ToString(ecmaRuntimeCallInfo.get()); - JSHandle resultHandle(thread, reinterpret_cast(result.GetRawData())); + JSHandle resultHandle(thread_, reinterpret_cast(result.GetRawData())); EXPECT_TRUE(result.IsString()); EXPECT_EQ(reinterpret_cast( @@ -776,24 +776,24 @@ TEST_F(BuiltinsErrorsTest, URIErrorNoParameterToString) */ TEST_F(BuiltinsErrorsTest, URIErrorToString) { - ObjectFactory *factory = EcmaVM::Cast(instance)->GetFactory(); - JSHandle env = EcmaVM::Cast(instance)->GetGlobalEnv(); + ObjectFactory *factory = EcmaVM::Cast(instance_)->GetFactory(); + JSHandle env = EcmaVM::Cast(instance_)->GetGlobalEnv(); JSHandle errorObject = env->GetURIErrorFunction(); JSHandle error = factory->NewJSObjectByConstructor(JSHandle(errorObject), errorObject); JSHandle handleMsgKey(factory->NewFromCanBeCompressString("message")); JSObject::SetProperty( - thread, JSHandle(error), handleMsgKey, - JSHandle(thread, factory->NewFromCanBeCompressString("This is URIError!").GetTaggedValue())); + thread_, JSHandle(error), handleMsgKey, + JSHandle(thread_, factory->NewFromCanBeCompressString("This is URIError!").GetTaggedValue())); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(JSTaggedValue(*error)); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = URIError::ToString(ecmaRuntimeCallInfo.get()); - JSHandle resultHandle(thread, reinterpret_cast(result.GetRawData())); + JSHandle resultHandle(thread_, reinterpret_cast(result.GetRawData())); EXPECT_TRUE(result.IsString()); EXPECT_EQ( @@ -810,30 +810,30 @@ TEST_F(BuiltinsErrorsTest, URIErrorToString) */ TEST_F(BuiltinsErrorsTest, SyntaxErrorNoParameterConstructor) { - ObjectFactory *factory = EcmaVM::Cast(instance)->GetFactory(); - JSHandle env = EcmaVM::Cast(instance)->GetGlobalEnv(); + ObjectFactory *factory = EcmaVM::Cast(instance_)->GetFactory(); + JSHandle env = EcmaVM::Cast(instance_)->GetGlobalEnv(); JSHandle error(env->GetSyntaxErrorFunction()); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue(*error), 4); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue(*error), 4); ecmaRuntimeCallInfo->SetFunction(error.GetTaggedValue()); ecmaRuntimeCallInfo->SetThis(JSTaggedValue(*error)); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = SyntaxError::SyntaxErrorConstructor(ecmaRuntimeCallInfo.get()); EXPECT_TRUE(result.IsECMAObject()); - JSHandle errorObject(thread, reinterpret_cast(result.GetRawData())); + JSHandle errorObject(thread_, reinterpret_cast(result.GetRawData())); JSHandle msgKey(factory->NewFromCanBeCompressString("message")); - JSHandle nameKey = thread->GlobalConstants()->GetHandledNameString(); + JSHandle nameKey = thread_->GlobalConstants()->GetHandledNameString(); - JSHandle msgValue(JSObject::GetProperty(thread, errorObject, msgKey).GetValue()); + JSHandle msgValue(JSObject::GetProperty(thread_, errorObject, msgKey).GetValue()); ASSERT_EQ( reinterpret_cast(ecmascript::JSTaggedValue(*factory->NewFromCanBeCompressString("")).GetRawData()) ->Compare(reinterpret_cast(msgValue->GetRawData())), 0); - JSHandle nameValue(JSObject::GetProperty(thread, errorObject, nameKey).GetValue()); + JSHandle nameValue(JSObject::GetProperty(thread_, errorObject, nameKey).GetValue()); ASSERT_EQ(reinterpret_cast( ecmascript::JSTaggedValue(*factory->NewFromCanBeCompressString("SyntaxError")).GetRawData()) ->Compare(reinterpret_cast(nameValue->GetRawData())), @@ -847,32 +847,32 @@ TEST_F(BuiltinsErrorsTest, SyntaxErrorNoParameterConstructor) */ TEST_F(BuiltinsErrorsTest, SyntaxErrorParameterConstructor) { - ObjectFactory *factory = EcmaVM::Cast(instance)->GetFactory(); - JSHandle env = EcmaVM::Cast(instance)->GetGlobalEnv(); + ObjectFactory *factory = EcmaVM::Cast(instance_)->GetFactory(); + JSHandle env = EcmaVM::Cast(instance_)->GetGlobalEnv(); JSHandle error(env->GetSyntaxErrorFunction()); JSHandle paramMsg(factory->NewFromCanBeCompressString("Hello SyntaxError!")); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue(*error), 6); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue(*error), 6); ecmaRuntimeCallInfo->SetFunction(error.GetTaggedValue()); ecmaRuntimeCallInfo->SetThis(JSTaggedValue(*error)); ecmaRuntimeCallInfo->SetCallArg(0, paramMsg.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = SyntaxError::SyntaxErrorConstructor(ecmaRuntimeCallInfo.get()); EXPECT_TRUE(result.IsECMAObject()); - JSHandle errorObject(thread, reinterpret_cast(result.GetRawData())); + JSHandle errorObject(thread_, reinterpret_cast(result.GetRawData())); JSHandle msgKey(factory->NewFromCanBeCompressString("message")); - JSHandle nameKey = thread->GlobalConstants()->GetHandledNameString(); + JSHandle nameKey = thread_->GlobalConstants()->GetHandledNameString(); - JSHandle msgValue(JSObject::GetProperty(thread, errorObject, msgKey).GetValue()); + JSHandle msgValue(JSObject::GetProperty(thread_, errorObject, msgKey).GetValue()); ASSERT_EQ(reinterpret_cast( ecmascript::JSTaggedValue(*factory->NewFromCanBeCompressString("Hello SyntaxError!")).GetRawData()) ->Compare(reinterpret_cast(msgValue->GetRawData())), 0); - JSHandle nameValue(JSObject::GetProperty(thread, errorObject, nameKey).GetValue()); + JSHandle nameValue(JSObject::GetProperty(thread_, errorObject, nameKey).GetValue()); ASSERT_EQ(reinterpret_cast( ecmascript::JSTaggedValue(*factory->NewFromCanBeCompressString("SyntaxError")).GetRawData()) ->Compare(reinterpret_cast(nameValue->GetRawData())), @@ -886,19 +886,19 @@ TEST_F(BuiltinsErrorsTest, SyntaxErrorParameterConstructor) */ TEST_F(BuiltinsErrorsTest, SyntaxErrorNoParameterToString) { - ObjectFactory *factory = EcmaVM::Cast(instance)->GetFactory(); - JSHandle env = EcmaVM::Cast(instance)->GetGlobalEnv(); + ObjectFactory *factory = EcmaVM::Cast(instance_)->GetFactory(); + JSHandle env = EcmaVM::Cast(instance_)->GetGlobalEnv(); JSHandle errorObject = env->GetSyntaxErrorFunction(); JSHandle error = factory->NewJSObjectByConstructor(JSHandle(errorObject), errorObject); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(JSTaggedValue(*error)); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = SyntaxError::ToString(ecmaRuntimeCallInfo.get()); - JSHandle resultHandle(thread, reinterpret_cast(result.GetRawData())); + JSHandle resultHandle(thread_, reinterpret_cast(result.GetRawData())); EXPECT_TRUE(result.IsString()); EXPECT_EQ(reinterpret_cast( @@ -914,23 +914,23 @@ TEST_F(BuiltinsErrorsTest, SyntaxErrorNoParameterToString) */ TEST_F(BuiltinsErrorsTest, SyntaxErrorToString) { - ObjectFactory *factory = EcmaVM::Cast(instance)->GetFactory(); - JSHandle env = EcmaVM::Cast(instance)->GetGlobalEnv(); + ObjectFactory *factory = EcmaVM::Cast(instance_)->GetFactory(); + JSHandle env = EcmaVM::Cast(instance_)->GetGlobalEnv(); JSHandle errorObject = env->GetSyntaxErrorFunction(); JSHandle error = factory->NewJSObjectByConstructor(JSHandle(errorObject), errorObject); JSHandle handleMsgKey(factory->NewFromCanBeCompressString("message")); - JSObject::SetProperty(thread, JSHandle(error), handleMsgKey, + JSObject::SetProperty(thread_, JSHandle(error), handleMsgKey, JSHandle(factory->NewFromCanBeCompressString("This is SyntaxError!"))); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(JSTaggedValue(*error)); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = SyntaxError::ToString(ecmaRuntimeCallInfo.get()); - JSHandle resultHandle(thread, reinterpret_cast(result.GetRawData())); + JSHandle resultHandle(thread_, reinterpret_cast(result.GetRawData())); EXPECT_TRUE(result.IsString()); EXPECT_EQ(factory->NewFromCanBeCompressString("SyntaxError: This is SyntaxError!")->Compare(*resultHandle), 0); @@ -943,30 +943,30 @@ TEST_F(BuiltinsErrorsTest, SyntaxErrorToString) */ TEST_F(BuiltinsErrorsTest, EvalErrorNoParameterConstructor) { - ObjectFactory *factory = EcmaVM::Cast(instance)->GetFactory(); - JSHandle env = EcmaVM::Cast(instance)->GetGlobalEnv(); + ObjectFactory *factory = EcmaVM::Cast(instance_)->GetFactory(); + JSHandle env = EcmaVM::Cast(instance_)->GetGlobalEnv(); JSHandle error(env->GetEvalErrorFunction()); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue(*error), 4); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue(*error), 4); ecmaRuntimeCallInfo->SetFunction(error.GetTaggedValue()); ecmaRuntimeCallInfo->SetThis(JSTaggedValue(*error)); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = EvalError::EvalErrorConstructor(ecmaRuntimeCallInfo.get()); EXPECT_TRUE(result.IsECMAObject()); - JSHandle errorObject(thread, reinterpret_cast(result.GetRawData())); + JSHandle errorObject(thread_, reinterpret_cast(result.GetRawData())); JSHandle msgKey(factory->NewFromCanBeCompressString("message")); - JSHandle nameKey = thread->GlobalConstants()->GetHandledNameString(); + JSHandle nameKey = thread_->GlobalConstants()->GetHandledNameString(); - JSHandle msgValue(JSObject::GetProperty(thread, errorObject, msgKey).GetValue()); + JSHandle msgValue(JSObject::GetProperty(thread_, errorObject, msgKey).GetValue()); ASSERT_EQ( reinterpret_cast(ecmascript::JSTaggedValue(*factory->NewFromCanBeCompressString("")).GetRawData()) ->Compare(reinterpret_cast(msgValue->GetRawData())), 0); - JSHandle nameValue(JSObject::GetProperty(thread, errorObject, nameKey).GetValue()); + JSHandle nameValue(JSObject::GetProperty(thread_, errorObject, nameKey).GetValue()); ASSERT_EQ(reinterpret_cast( ecmascript::JSTaggedValue(*factory->NewFromCanBeCompressString("EvalError")).GetRawData()) ->Compare(reinterpret_cast(nameValue->GetRawData())), @@ -980,32 +980,32 @@ TEST_F(BuiltinsErrorsTest, EvalErrorNoParameterConstructor) */ TEST_F(BuiltinsErrorsTest, EvalErrorParameterConstructor) { - ObjectFactory *factory = EcmaVM::Cast(instance)->GetFactory(); - JSHandle env = EcmaVM::Cast(instance)->GetGlobalEnv(); + ObjectFactory *factory = EcmaVM::Cast(instance_)->GetFactory(); + JSHandle env = EcmaVM::Cast(instance_)->GetGlobalEnv(); JSHandle error(env->GetEvalErrorFunction()); JSHandle paramMsg(factory->NewFromCanBeCompressString("Hello EvalError!")); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue(*error), 6); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue(*error), 6); ecmaRuntimeCallInfo->SetFunction(error.GetTaggedValue()); ecmaRuntimeCallInfo->SetThis(JSTaggedValue(*error)); ecmaRuntimeCallInfo->SetCallArg(0, paramMsg.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = EvalError::EvalErrorConstructor(ecmaRuntimeCallInfo.get()); EXPECT_TRUE(result.IsECMAObject()); - JSHandle errorObject(thread, reinterpret_cast(result.GetRawData())); + JSHandle errorObject(thread_, reinterpret_cast(result.GetRawData())); JSHandle msgKey(factory->NewFromCanBeCompressString("message")); - JSHandle nameKey = thread->GlobalConstants()->GetHandledNameString(); + JSHandle nameKey = thread_->GlobalConstants()->GetHandledNameString(); - JSHandle msgValue(JSObject::GetProperty(thread, errorObject, msgKey).GetValue()); + JSHandle msgValue(JSObject::GetProperty(thread_, errorObject, msgKey).GetValue()); ASSERT_EQ(reinterpret_cast( ecmascript::JSTaggedValue(*factory->NewFromCanBeCompressString("Hello EvalError!")).GetRawData()) ->Compare(reinterpret_cast(msgValue->GetRawData())), 0); - JSHandle nameValue(JSObject::GetProperty(thread, errorObject, nameKey).GetValue()); + JSHandle nameValue(JSObject::GetProperty(thread_, errorObject, nameKey).GetValue()); ASSERT_EQ(reinterpret_cast( ecmascript::JSTaggedValue(*factory->NewFromCanBeCompressString("EvalError")).GetRawData()) ->Compare(reinterpret_cast(nameValue->GetRawData())), @@ -1019,18 +1019,18 @@ TEST_F(BuiltinsErrorsTest, EvalErrorParameterConstructor) */ TEST_F(BuiltinsErrorsTest, EvalErrorNoParameterToString) { - ObjectFactory *factory = EcmaVM::Cast(instance)->GetFactory(); - JSHandle env = EcmaVM::Cast(instance)->GetGlobalEnv(); + ObjectFactory *factory = EcmaVM::Cast(instance_)->GetFactory(); + JSHandle env = EcmaVM::Cast(instance_)->GetGlobalEnv(); JSHandle errorObject = env->GetEvalErrorFunction(); JSHandle error = factory->NewJSObjectByConstructor(JSHandle(errorObject), errorObject); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(JSTaggedValue(*error)); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = EvalError::ToString(ecmaRuntimeCallInfo.get()); - JSHandle resultHandle(thread, reinterpret_cast(result.GetRawData())); + JSHandle resultHandle(thread_, reinterpret_cast(result.GetRawData())); EXPECT_TRUE(result.IsString()); EXPECT_EQ(reinterpret_cast( ecmascript::JSTaggedValue(*factory->NewFromCanBeCompressString("EvalError")).GetRawData()) @@ -1045,24 +1045,24 @@ TEST_F(BuiltinsErrorsTest, EvalErrorNoParameterToString) */ TEST_F(BuiltinsErrorsTest, EvalErrorToString) { - ObjectFactory *factory = EcmaVM::Cast(instance)->GetFactory(); - JSHandle env = EcmaVM::Cast(instance)->GetGlobalEnv(); + ObjectFactory *factory = EcmaVM::Cast(instance_)->GetFactory(); + JSHandle env = EcmaVM::Cast(instance_)->GetGlobalEnv(); JSHandle errorObject = env->GetEvalErrorFunction(); JSHandle error = factory->NewJSObjectByConstructor(JSHandle(errorObject), errorObject); JSHandle handleMsgKey(factory->NewFromCanBeCompressString("message")); JSObject::SetProperty( - thread, JSHandle(error), handleMsgKey, - JSHandle(thread, factory->NewFromCanBeCompressString("This is EvalError!").GetTaggedValue())); + thread_, JSHandle(error), handleMsgKey, + JSHandle(thread_, factory->NewFromCanBeCompressString("This is EvalError!").GetTaggedValue())); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(JSTaggedValue(*error)); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = EvalError::ToString(ecmaRuntimeCallInfo.get()); - JSHandle resultHandle(thread, reinterpret_cast(result.GetRawData())); + JSHandle resultHandle(thread_, reinterpret_cast(result.GetRawData())); EXPECT_TRUE(result.IsString()); EXPECT_EQ(factory->NewFromCanBeCompressString("EvalError: This is EvalError!")->Compare(*resultHandle), 0); } diff --git a/tests/runtime/builtins/builtins_function_test.cpp b/tests/runtime/builtins/builtins_function_test.cpp index 14a9bfc872351049ee68e684d0215f2f186401bc..a7c8cabff046720a22c63da80838287b48dffc56 100644 --- a/tests/runtime/builtins/builtins_function_test.cpp +++ b/tests/runtime/builtins/builtins_function_test.cpp @@ -48,17 +48,17 @@ public: void SetUp() override { - TestHelper::CreateEcmaVMWithScope(instance, thread, scope); + TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); } void TearDown() override { - TestHelper::DestroyEcmaVMWithScope(instance, scope); + TestHelper::DestroyEcmaVMWithScope(instance_, scope_); } - PandaVM *instance {nullptr}; - EcmaHandleScope *scope {nullptr}; - JSThread *thread {nullptr}; + PandaVM *instance_ {nullptr}; + EcmaHandleScope *scope_ {nullptr}; + JSThread *thread_ {nullptr}; }; // native function for test apply and call @@ -91,162 +91,162 @@ JSTaggedValue TestFunctionApplyAndCall(EcmaRuntimeCallInfo *argv) // func.apply(thisArg) TEST_F(BuiltinsFunctionTest, FunctionPrototypeApply) { - JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); + JSHandle env = thread_->GetEcmaVM()->GetGlobalEnv(); - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); // ecma 19.2.3.1: func JSHandle func = factory->NewJSFunction(env, reinterpret_cast(TestFunctionApplyAndCall)); // ecma 19.2.3.1: thisArg - JSHandle thisArg(thread, env->GetGlobalObject()); - JSObject::SetProperty(thread, JSHandle(thisArg), + JSHandle thisArg(thread_, env->GetGlobalObject()); + JSObject::SetProperty(thread_, JSHandle(thisArg), JSHandle(factory->NewFromCanBeCompressString("test_builtins_function_a")), - JSHandle(thread, JSTaggedValue(1))); - JSObject::SetProperty(thread, JSHandle(thisArg), + JSHandle(thread_, JSTaggedValue(1))); + JSObject::SetProperty(thread_, JSHandle(thisArg), JSHandle(factory->NewFromCanBeCompressString("test_builtins_function_b")), - JSHandle(thread, JSTaggedValue(2))); + JSHandle(thread_, JSTaggedValue(2))); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(func.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, (thisArg.GetTaggedValue())); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsFunction::FunctionPrototypeApply(ecmaRuntimeCallInfo.get()); ASSERT_EQ(result.GetRawData(), JSTaggedValue(3).GetRawData()); - JSObject::DeleteProperty(thread, (thisArg), + JSObject::DeleteProperty(thread_, (thisArg), JSHandle(factory->NewFromCanBeCompressString("test_builtins_function_a"))); - JSObject::DeleteProperty(thread, (thisArg), + JSObject::DeleteProperty(thread_, (thisArg), JSHandle(factory->NewFromCanBeCompressString("test_builtins_function_b"))); } // func.apply(thisArg, argArray) TEST_F(BuiltinsFunctionTest, FunctionPrototypeApply1) { - JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); + JSHandle env = thread_->GetEcmaVM()->GetGlobalEnv(); - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); // ecma 19.2.3.1: func JSHandle func = factory->NewJSFunction(env, reinterpret_cast(TestFunctionApplyAndCall)); // ecma 19.2.3.1: thisArg - JSHandle thisArg(thread, env->GetGlobalObject()); - JSObject::SetProperty(thread, JSHandle(thisArg), + JSHandle thisArg(thread_, env->GetGlobalObject()); + JSObject::SetProperty(thread_, JSHandle(thisArg), JSHandle(factory->NewFromCanBeCompressString("test_builtins_function_a")), - JSHandle(thread, JSTaggedValue(10))); - JSObject::SetProperty(thread, JSHandle(thisArg), + JSHandle(thread_, JSTaggedValue(10))); + JSObject::SetProperty(thread_, JSHandle(thisArg), JSHandle(factory->NewFromCanBeCompressString("test_builtins_function_b")), - JSHandle(thread, JSTaggedValue(20))); + JSHandle(thread_, JSTaggedValue(20))); // ecma 19.2.3.1: argArray - JSHandle array(JSArray::ArrayCreate(thread, JSTaggedNumber(2))); - PropertyDescriptor desc(thread, JSHandle(thread, JSTaggedValue(30))); - JSArray::DefineOwnProperty(thread, array, JSHandle(thread, JSTaggedValue(0)), desc); + JSHandle array(JSArray::ArrayCreate(thread_, JSTaggedNumber(2))); + PropertyDescriptor desc(thread_, JSHandle(thread_, JSTaggedValue(30))); + JSArray::DefineOwnProperty(thread_, array, JSHandle(thread_, JSTaggedValue(0)), desc); - PropertyDescriptor desc1(thread, JSHandle(thread, JSTaggedValue(40))); - JSArray::DefineOwnProperty(thread, array, JSHandle(thread, JSTaggedValue(1)), desc1); + PropertyDescriptor desc1(thread_, JSHandle(thread_, JSTaggedValue(40))); + JSArray::DefineOwnProperty(thread_, array, JSHandle(thread_, JSTaggedValue(1)), desc1); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(func.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, (thisArg.GetTaggedValue())); ecmaRuntimeCallInfo->SetCallArg(1, array.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsFunction::FunctionPrototypeApply(ecmaRuntimeCallInfo.get()); ASSERT_EQ(result.GetRawData(), JSTaggedValue(100).GetRawData()); - JSObject::DeleteProperty(thread, (thisArg), + JSObject::DeleteProperty(thread_, (thisArg), JSHandle(factory->NewFromCanBeCompressString("test_builtins_function_a"))); - JSObject::DeleteProperty(thread, (thisArg), + JSObject::DeleteProperty(thread_, (thisArg), JSHandle(factory->NewFromCanBeCompressString("test_builtins_function_b"))); } // target.bind(thisArg) TEST_F(BuiltinsFunctionTest, FunctionPrototypeBind) { - JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); + JSHandle env = thread_->GetEcmaVM()->GetGlobalEnv(); - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); JSHandle target = factory->NewJSFunction(env); - JSFunction::SetFunctionName(thread, JSHandle(target), + JSFunction::SetFunctionName(thread_, JSHandle(target), JSHandle(factory->NewFromCanBeCompressString("target")), - JSHandle(thread, JSTaggedValue::Undefined())); - JSFunction::SetFunctionLength(thread, target, JSTaggedValue(2)); + JSHandle(thread_, JSTaggedValue::Undefined())); + JSFunction::SetFunctionLength(thread_, target, JSTaggedValue(2)); - JSHandle thisArg(thread, env->GetGlobalObject()); + JSHandle thisArg(thread_, env->GetGlobalObject()); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(target.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, (thisArg.GetTaggedValue())); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsFunction::FunctionPrototypeBind(ecmaRuntimeCallInfo.get()); ASSERT_TRUE(result.IsECMAObject()); - JSHandle resultFunc(thread, reinterpret_cast(result.GetRawData())); + JSHandle resultFunc(thread_, reinterpret_cast(result.GetRawData())); // test BoundTarget ASSERT_EQ(resultFunc->GetBoundTarget(), target.GetTaggedValue()); // test BoundThis ASSERT_EQ(resultFunc->GetBoundThis(), thisArg.GetTaggedValue()); // test BoundArguments - JSHandle array(thread, resultFunc->GetBoundArguments()); + JSHandle array(thread_, resultFunc->GetBoundArguments()); ASSERT_EQ(array->GetLength(), 0); // test name property - auto globalConst = thread->GlobalConstants(); + auto globalConst = thread_->GlobalConstants(); JSHandle nameKey = globalConst->GetHandledNameString(); - JSHandle resultFuncHandle(thread, *resultFunc); - JSHandle resultName(JSObject::GetProperty(thread, resultFuncHandle, nameKey).GetValue()); + JSHandle resultFuncHandle(thread_, *resultFunc); + JSHandle resultName(JSObject::GetProperty(thread_, resultFuncHandle, nameKey).GetValue()); JSHandle boundTarget = factory->NewFromCanBeCompressString("bound target"); ASSERT_EQ(resultName->Compare(*boundTarget), 0); // test length property JSHandle lengthKey = globalConst->GetHandledLengthString(); - JSHandle resultLength(JSObject::GetProperty(thread, resultFuncHandle, lengthKey).GetValue()); - ASSERT_EQ(JSTaggedValue::ToNumber(thread, resultLength).GetNumber(), 2.0); + JSHandle resultLength(JSObject::GetProperty(thread_, resultFuncHandle, lengthKey).GetValue()); + ASSERT_EQ(JSTaggedValue::ToNumber(thread_, resultLength).GetNumber(), 2.0); } // target.bind(thisArg, 123, "helloworld") TEST_F(BuiltinsFunctionTest, FunctionPrototypeBind1) { - JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); + JSHandle env = thread_->GetEcmaVM()->GetGlobalEnv(); - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); JSHandle target = factory->NewJSFunction(env); - JSFunction::SetFunctionName(thread, JSHandle(target), + JSFunction::SetFunctionName(thread_, JSHandle(target), JSHandle(factory->NewFromCanBeCompressString("target1")), - JSHandle(thread, JSTaggedValue::Undefined())); - JSFunction::SetFunctionLength(thread, target, JSTaggedValue(5)); + JSHandle(thread_, JSTaggedValue::Undefined())); + JSFunction::SetFunctionLength(thread_, target, JSTaggedValue(5)); - JSHandle thisArg(thread, env->GetGlobalObject()); + JSHandle thisArg(thread_, env->GetGlobalObject()); JSHandle str = factory->NewFromCanBeCompressString("helloworld"); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 10); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 10); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(target.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, thisArg.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(static_cast(123))); ecmaRuntimeCallInfo->SetCallArg(2, str.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsFunction::FunctionPrototypeBind(ecmaRuntimeCallInfo.get()); ASSERT_TRUE(result.IsECMAObject()); - JSHandle resultFunc(thread, reinterpret_cast(result.GetRawData())); + JSHandle resultFunc(thread_, reinterpret_cast(result.GetRawData())); // test BoundTarget ASSERT_EQ(resultFunc->GetBoundTarget(), target.GetTaggedValue()); // test BoundThis ASSERT_EQ(resultFunc->GetBoundThis(), thisArg.GetTaggedValue()); // test BoundArguments - JSHandle array(thread, resultFunc->GetBoundArguments()); + JSHandle array(thread_, resultFunc->GetBoundArguments()); ASSERT_EQ(array->GetLength(), 2); JSTaggedValue elem = array->Get(0); JSTaggedValue elem1 = array->Get(1); @@ -255,54 +255,54 @@ TEST_F(BuiltinsFunctionTest, FunctionPrototypeBind1) ASSERT_EQ(elem1.GetRawData(), str.GetTaggedType()); ASSERT_TRUE(elem1.IsString()); // test name property - auto globalConst = thread->GlobalConstants(); + auto globalConst = thread_->GlobalConstants(); JSHandle nameKey = globalConst->GetHandledNameString(); - JSHandle resultFuncHandle(thread, *resultFunc); - JSHandle resultName(JSObject::GetProperty(thread, resultFuncHandle, nameKey).GetValue()); + JSHandle resultFuncHandle(thread_, *resultFunc); + JSHandle resultName(JSObject::GetProperty(thread_, resultFuncHandle, nameKey).GetValue()); JSHandle rulerName = factory->NewFromCanBeCompressString("bound target1"); ASSERT_EQ(resultName->Compare(*rulerName), 0); // test length property JSHandle lengthKey = globalConst->GetHandledLengthString(); - JSHandle resultLength(JSObject::GetProperty(thread, resultFuncHandle, lengthKey).GetValue()); + JSHandle resultLength(JSObject::GetProperty(thread_, resultFuncHandle, lengthKey).GetValue()); // target.length is 5, (...args) length is 2 - ASSERT_EQ(JSTaggedValue::ToNumber(thread, resultLength).GetNumber(), 3.0); + ASSERT_EQ(JSTaggedValue::ToNumber(thread_, resultLength).GetNumber(), 3.0); } // target.bind(thisArg, 123, "helloworld") set target_name = EmptyString() TEST_F(BuiltinsFunctionTest, FunctionPrototypeBind2) { - JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); + JSHandle env = thread_->GetEcmaVM()->GetGlobalEnv(); - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); JSHandle target = factory->NewJSFunction(env); - PropertyDescriptor nameDesc(thread, JSHandle(thread, JSTaggedValue(123)), false, false, true); - JSTaggedValue::DefinePropertyOrThrow(thread, JSHandle(target), - thread->GlobalConstants()->GetHandledNameString(), nameDesc); - JSFunction::SetFunctionLength(thread, target, JSTaggedValue(5)); + PropertyDescriptor nameDesc(thread_, JSHandle(thread_, JSTaggedValue(123)), false, false, true); + JSTaggedValue::DefinePropertyOrThrow(thread_, JSHandle(target), + thread_->GlobalConstants()->GetHandledNameString(), nameDesc); + JSFunction::SetFunctionLength(thread_, target, JSTaggedValue(5)); - JSHandle thisArg(thread, env->GetGlobalObject()); + JSHandle thisArg(thread_, env->GetGlobalObject()); JSHandle str = factory->NewFromCanBeCompressString("helloworld"); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 10); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 10); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(target.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, (thisArg.GetTaggedValue())); ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(static_cast(123))); ecmaRuntimeCallInfo->SetCallArg(2, str.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsFunction::FunctionPrototypeBind(ecmaRuntimeCallInfo.get()); ASSERT_TRUE(result.IsECMAObject()); - JSHandle resultFunc(thread, reinterpret_cast(result.GetRawData())); + JSHandle resultFunc(thread_, reinterpret_cast(result.GetRawData())); // test BoundTarget ASSERT_EQ(resultFunc->GetBoundTarget(), target.GetTaggedValue()); // test BoundThis ASSERT_EQ(resultFunc->GetBoundThis(), thisArg.GetTaggedValue()); // test BoundArguments - JSHandle array(thread, resultFunc->GetBoundArguments()); + JSHandle array(thread_, resultFunc->GetBoundArguments()); ASSERT_EQ(array->GetLength(), 2); JSTaggedValue elem = array->Get(0); JSTaggedValue elem1 = array->Get(1); @@ -311,75 +311,75 @@ TEST_F(BuiltinsFunctionTest, FunctionPrototypeBind2) ASSERT_EQ(elem1.GetRawData(), str.GetTaggedType()); ASSERT_TRUE(elem1.IsString()); // test name property - auto globalConst = thread->GlobalConstants(); + auto globalConst = thread_->GlobalConstants(); JSHandle nameKey = globalConst->GetHandledNameString(); JSHandle resultFuncHandle(resultFunc); - JSHandle resultName(JSObject::GetProperty(thread, resultFuncHandle, nameKey).GetValue()); + JSHandle resultName(JSObject::GetProperty(thread_, resultFuncHandle, nameKey).GetValue()); JSHandle rulerName = factory->NewFromCanBeCompressString("bound "); ASSERT_EQ(resultName->Compare(*rulerName), 0); // test length property JSHandle lengthKey = globalConst->GetHandledLengthString(); - JSHandle resultLength(JSObject::GetProperty(thread, resultFuncHandle, lengthKey).GetValue()); + JSHandle resultLength(JSObject::GetProperty(thread_, resultFuncHandle, lengthKey).GetValue()); // target.length is 5, (...args) length is 2 - ASSERT_EQ(JSTaggedValue::ToNumber(thread, resultLength).GetNumber(), 3.0); + ASSERT_EQ(JSTaggedValue::ToNumber(thread_, resultLength).GetNumber(), 3.0); } // func.call(thisArg) TEST_F(BuiltinsFunctionTest, FunctionPrototypeCall) { - JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); + JSHandle env = thread_->GetEcmaVM()->GetGlobalEnv(); - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); // ecma 19.2.3.3: func JSHandle func = factory->NewJSFunction(env, reinterpret_cast(TestFunctionApplyAndCall)); // ecma 19.2.3.3: thisArg - JSHandle thisArg(thread, env->GetGlobalObject()); - JSObject::SetProperty(thread, JSHandle(thisArg), + JSHandle thisArg(thread_, env->GetGlobalObject()); + JSObject::SetProperty(thread_, JSHandle(thisArg), JSHandle(factory->NewFromCanBeCompressString("test_builtins_function_a")), - JSHandle(thread, JSTaggedValue(1))); - JSObject::SetProperty(thread, JSHandle(thisArg), + JSHandle(thread_, JSTaggedValue(1))); + JSObject::SetProperty(thread_, JSHandle(thisArg), JSHandle(factory->NewFromCanBeCompressString("test_builtins_function_b")), - JSHandle(thread, JSTaggedValue(2))); + JSHandle(thread_, JSTaggedValue(2))); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(func.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, (thisArg.GetTaggedValue())); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsFunction::FunctionPrototypeCall(ecmaRuntimeCallInfo.get()); ASSERT_EQ(result.GetRawData(), JSTaggedValue(3).GetRawData()); - JSObject::DeleteProperty(thread, (thisArg), + JSObject::DeleteProperty(thread_, (thisArg), JSHandle(factory->NewFromCanBeCompressString("test_builtins_function_a"))); - JSObject::DeleteProperty(thread, (thisArg), + JSObject::DeleteProperty(thread_, (thisArg), JSHandle(factory->NewFromCanBeCompressString("test_builtins_function_b"))); } // func.call(thisArg, 123, 456, 789) TEST_F(BuiltinsFunctionTest, FunctionPrototypeCall1) { - JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); + JSHandle env = thread_->GetEcmaVM()->GetGlobalEnv(); - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); // ecma 19.2.3.3: func JSHandle func = factory->NewJSFunction(env, reinterpret_cast(TestFunctionApplyAndCall)); // ecma 19.2.3.3: thisArg - JSHandle thisArg(thread, env->GetGlobalObject()); - JSObject::SetProperty(thread, JSHandle(thisArg), + JSHandle thisArg(thread_, env->GetGlobalObject()); + JSObject::SetProperty(thread_, JSHandle(thisArg), JSHandle(factory->NewFromCanBeCompressString("test_builtins_function_a")), - JSHandle(thread, JSTaggedValue(1))); - JSObject::SetProperty(thread, JSHandle(thisArg), + JSHandle(thread_, JSTaggedValue(1))); + JSObject::SetProperty(thread_, JSHandle(thisArg), JSHandle(factory->NewFromCanBeCompressString("test_builtins_function_b")), - JSHandle(thread, JSTaggedValue(2))); + JSHandle(thread_, JSTaggedValue(2))); // func thisArg ...args - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 12); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 12); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(func.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, (thisArg.GetTaggedValue())); @@ -387,41 +387,41 @@ TEST_F(BuiltinsFunctionTest, FunctionPrototypeCall1) ecmaRuntimeCallInfo->SetCallArg(2, JSTaggedValue(static_cast(456))); ecmaRuntimeCallInfo->SetCallArg(3, JSTaggedValue(static_cast(789))); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsFunction::FunctionPrototypeCall(ecmaRuntimeCallInfo.get()); ASSERT_EQ(result.GetRawData(), JSTaggedValue(1371).GetRawData()); - JSObject::DeleteProperty(thread, (thisArg), + JSObject::DeleteProperty(thread_, (thisArg), JSHandle(factory->NewFromCanBeCompressString("test_builtins_function_a"))); - JSObject::DeleteProperty(thread, (thisArg), + JSObject::DeleteProperty(thread_, (thisArg), JSHandle(factory->NewFromCanBeCompressString("test_builtins_function_b"))); } TEST_F(BuiltinsFunctionTest, FunctionPrototypeHasInstance) { - JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); + JSHandle env = thread_->GetEcmaVM()->GetGlobalEnv(); JSHandle booleanCtor(env->GetBooleanFunction()); - auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue(*booleanCtor), 6); + auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue(*booleanCtor), 6); ecmaRuntimeCallInfo1->SetFunction(booleanCtor.GetTaggedValue()); ecmaRuntimeCallInfo1->SetThis(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo1->SetCallArg(0, JSTaggedValue(static_cast(123))); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); JSTaggedValue result = BuiltinsBoolean::BooleanConstructor(ecmaRuntimeCallInfo1.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); - JSHandle booleanInstance(thread, result); + JSHandle booleanInstance(thread_, result); - auto ecmaRuntimeCallInfo2 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto ecmaRuntimeCallInfo2 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo2->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo2->SetThis(booleanCtor.GetTaggedValue()); ecmaRuntimeCallInfo2->SetCallArg(0, booleanInstance.GetTaggedValue()); - prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo2.get()); + prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo2.get()); EXPECT_TRUE(BuiltinsFunction::FunctionPrototypeHasInstance(ecmaRuntimeCallInfo2.get()).GetRawData()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); } } // namespace panda::test diff --git a/tests/runtime/builtins/builtins_iterator_test.cpp b/tests/runtime/builtins/builtins_iterator_test.cpp index 3c9340be1d08736e7157c873887430a8adac8fd6..15ee9e67375815c95d5a560a270539beb742dbce 100644 --- a/tests/runtime/builtins/builtins_iterator_test.cpp +++ b/tests/runtime/builtins/builtins_iterator_test.cpp @@ -41,16 +41,16 @@ public: void SetUp() override { - TestHelper::CreateEcmaVMWithScope(instance, thread, scope); + TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); } void TearDown() override { - TestHelper::DestroyEcmaVMWithScope(instance, scope); + TestHelper::DestroyEcmaVMWithScope(instance_, scope_); } - PandaVM *instance {nullptr}; - EcmaHandleScope *scope {nullptr}; - JSThread *thread {nullptr}; + PandaVM *instance_ {nullptr}; + EcmaHandleScope *scope_ {nullptr}; + JSThread *thread_ {nullptr}; }; } // namespace panda::test diff --git a/tests/runtime/builtins/builtins_json_test.cpp b/tests/runtime/builtins/builtins_json_test.cpp index 97502ca11becb80b1c95e8b664cb173e43cade65..c8dedc88f3fc2ade55ec71bdfa77790e47661d58 100644 --- a/tests/runtime/builtins/builtins_json_test.cpp +++ b/tests/runtime/builtins/builtins_json_test.cpp @@ -54,17 +54,17 @@ public: void SetUp() override { - TestHelper::CreateEcmaVMWithScope(instance, thread, scope); + TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); } void TearDown() override { - TestHelper::DestroyEcmaVMWithScope(instance, scope); + TestHelper::DestroyEcmaVMWithScope(instance_, scope_); } - PandaVM *instance {nullptr}; - EcmaHandleScope *scope {nullptr}; - JSThread *thread {nullptr}; + PandaVM *instance_ {nullptr}; + EcmaHandleScope *scope_ {nullptr}; + JSThread *thread_ {nullptr}; class TestClass : public base::BuiltinsBase { public: @@ -143,261 +143,261 @@ JSTaggedValue CreateBuiltinJSObject1(JSThread *thread, const CString keyCStr) TEST_F(BuiltinsJsonTest, Parse10) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); JSHandle msg(factory->NewFromCanBeCompressString( "\t\r \n{\t\r \n \"property\"\t\r \n:\t\r \n{\t\r \n}\t\r \n,\t\r \n \"prop2\"\t\r \n:\t\r \n [\t\r \ntrue\t\r " "\n,\t\r \nnull\t\r \n,123.456\t\r \n] \t\r \n}\t\r \n")); - JSHandle str(JSTaggedValue::ToString(thread, msg)); + JSHandle str(JSTaggedValue::ToString(thread_, msg)); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetCallArg(0, str.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsJson::Parse(ecmaRuntimeCallInfo.get()); ASSERT_TRUE(result.IsECMAObject()); } TEST_F(BuiltinsJsonTest, Parse21) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle env = thread_->GetEcmaVM()->GetGlobalEnv(); JSHandle msg(factory->NewFromCanBeCompressString("[100,2.5,\"abc\"]")); JSHandle handleFunc = factory->NewJSFunction(env, reinterpret_cast(TestClass::TestForParse)); - JSHandle str(JSTaggedValue::ToString(thread, msg)); + JSHandle str(JSTaggedValue::ToString(thread_, msg)); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetCallArg(0, str.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(1, handleFunc.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsJson::Parse(ecmaRuntimeCallInfo.get()); ASSERT_TRUE(result.IsECMAObject()); } TEST_F(BuiltinsJsonTest, Parse) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - JSHandle lengthKeyHandle = thread->GlobalConstants()->GetHandledLengthString(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle lengthKeyHandle = thread_->GlobalConstants()->GetHandledLengthString(); JSHandle msg(factory->NewFromCanBeCompressString("[100,2.5,\"abc\"]")); - JSHandle str(JSTaggedValue::ToString(thread, msg)); + JSHandle str(JSTaggedValue::ToString(thread_, msg)); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetCallArg(0, str.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsJson::Parse(ecmaRuntimeCallInfo.get()); JSTaggedValue value(static_cast(result.GetRawData())); ASSERT_TRUE(value.IsECMAObject()); - JSHandle valueHandle(thread, value); + JSHandle valueHandle(thread_, value); JSHandle lenResult = - JSObject::GetProperty(thread, JSHandle(valueHandle), lengthKeyHandle).GetValue(); - uint32_t length = JSTaggedValue::ToLength(thread, lenResult).ToUint32(); + JSObject::GetProperty(thread_, JSHandle(valueHandle), lengthKeyHandle).GetValue(); + uint32_t length = JSTaggedValue::ToLength(thread_, lenResult).ToUint32(); EXPECT_EQ(length, 3); } TEST_F(BuiltinsJsonTest, Parse2) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); JSHandle msg(factory->NewFromCanBeCompressString("{\"epf\":100,\"key1\":200}")); - JSHandle str(JSTaggedValue::ToString(thread, msg)); + JSHandle str(JSTaggedValue::ToString(thread_, msg)); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetCallArg(0, str.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsJson::Parse(ecmaRuntimeCallInfo.get()); JSTaggedValue value(static_cast(result.GetRawData())); ASSERT_TRUE(value.IsECMAObject()); - JSHandle valueHandle(thread, value); + JSHandle valueHandle(thread_, value); - JSHandle nameList(JSObject::EnumerableOwnNames(thread, valueHandle)); - JSHandle nameResult = JSArray::CreateArrayFromList(thread, nameList); + JSHandle nameList(JSObject::EnumerableOwnNames(thread_, valueHandle)); + JSHandle nameResult = JSArray::CreateArrayFromList(thread_, nameList); JSHandle handleKey(nameResult); JSHandle lengthKey(factory->NewFromCanBeCompressString("length")); - JSHandle lenResult = JSObject::GetProperty(thread, handleKey, lengthKey).GetValue(); - uint32_t length = JSTaggedValue::ToLength(thread, lenResult).ToUint32(); + JSHandle lenResult = JSObject::GetProperty(thread_, handleKey, lengthKey).GetValue(); + uint32_t length = JSTaggedValue::ToLength(thread_, lenResult).ToUint32(); ASSERT_EQ(length, 2); } TEST_F(BuiltinsJsonTest, Stringify11) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); - JSHandle obj = JSHandle(thread, CreateBuiltinJSObject1(thread, "x")); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle env = thread_->GetEcmaVM()->GetGlobalEnv(); + JSHandle obj = JSHandle(thread_, CreateBuiltinJSObject1(thread_, "x")); JSHandle handleFunc = factory->NewJSFunction(env, reinterpret_cast(TestClass::TestForStringfy)); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetCallArg(0, obj.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(1, handleFunc.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsJson::Stringify(ecmaRuntimeCallInfo.get()); ASSERT_TRUE(result.IsString()); } TEST_F(BuiltinsJsonTest, Stringify12) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - JSHandle obj = JSHandle(thread, CreateBuiltinJSObject1(thread, "x")); - JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle obj = JSHandle(thread_, CreateBuiltinJSObject1(thread_, "x")); + JSHandle env = thread_->GetEcmaVM()->GetGlobalEnv(); JSHandle handleFunc = factory->NewJSFunction(env, reinterpret_cast(TestClass::TestForStringfy)); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 10); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 10); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetCallArg(0, obj.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(1, handleFunc.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(2, JSTaggedValue(static_cast(10))); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsJson::Stringify(ecmaRuntimeCallInfo.get()); ASSERT_TRUE(result.IsString()); } TEST_F(BuiltinsJsonTest, Stringify13) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - JSHandle obj = JSHandle(thread, CreateBuiltinJSObject1(thread, "x")); - JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle obj = JSHandle(thread_, CreateBuiltinJSObject1(thread_, "x")); + JSHandle env = thread_->GetEcmaVM()->GetGlobalEnv(); JSHandle handleFunc = factory->NewJSFunction(env, reinterpret_cast(TestClass::TestForStringfy)); JSHandle msg(factory->NewFromCanBeCompressString("tttt")); - JSHandle str(JSTaggedValue::ToString(thread, msg)); + JSHandle str(JSTaggedValue::ToString(thread_, msg)); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 10); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 10); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetCallArg(0, obj.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(1, handleFunc.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(2, str.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsJson::Stringify(ecmaRuntimeCallInfo.get()); ASSERT_TRUE(result.IsString()); } TEST_F(BuiltinsJsonTest, Stringify14) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - JSHandle obj = JSHandle(thread, CreateBuiltinJSObject1(thread, "x")); - JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle obj = JSHandle(thread_, CreateBuiltinJSObject1(thread_, "x")); + JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread_, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); - JSHandle obj1(thread, arr); - JSHandle key0(thread, JSTaggedValue(0)); + JSHandle obj1(thread_, arr); + JSHandle key0(thread_, JSTaggedValue(0)); JSHandle value0(factory->NewFromCanBeCompressString("x")); - JSObject::SetProperty(thread, JSHandle(obj), key0, value0); - JSHandle key1(thread, JSTaggedValue(1)); + JSObject::SetProperty(thread_, JSHandle(obj), key0, value0); + JSHandle key1(thread_, JSTaggedValue(1)); JSHandle value1(factory->NewFromCanBeCompressString("z")); - JSObject::SetProperty(thread, JSHandle(obj), key1, value1); + JSObject::SetProperty(thread_, JSHandle(obj), key1, value1); JSHandle msg(factory->NewFromCanBeCompressString("tttt")); - JSHandle str(JSTaggedValue::ToString(thread, msg)); + JSHandle str(JSTaggedValue::ToString(thread_, msg)); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 10); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 10); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetCallArg(0, obj.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(1, obj1.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(2, str.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsJson::Stringify(ecmaRuntimeCallInfo.get()); ASSERT_TRUE(result.IsString()); } TEST_F(BuiltinsJsonTest, Stringify) { - JSHandle obj = JSHandle(thread, CreateBuiltinJSObject1(thread, "x")); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + JSHandle obj = JSHandle(thread_, CreateBuiltinJSObject1(thread_, "x")); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetCallArg(0, obj.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsJson::Stringify(ecmaRuntimeCallInfo.get()); ASSERT_TRUE(result.IsString()); } TEST_F(BuiltinsJsonTest, Stringify1) { - auto ecmaVM = thread->GetEcmaVM(); + auto ecmaVM = thread_->GetEcmaVM(); ObjectFactory *factory = ecmaVM->GetFactory(); JSHandle env = ecmaVM->GetGlobalEnv(); - JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); + JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread_, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); EXPECT_TRUE(arr != nullptr); - JSHandle obj(thread, arr); - JSHandle key0(thread, JSTaggedValue(0)); + JSHandle obj(thread_, arr); + JSHandle key0(thread_, JSTaggedValue(0)); JSHandle value(factory->NewFromCanBeCompressString("def")); - JSObject::SetProperty(thread, JSHandle(obj), key0, value); + JSObject::SetProperty(thread_, JSHandle(obj), key0, value); - JSHandle key1(thread, JSTaggedValue(1)); - PropertyDescriptor desc1(thread, JSHandle(thread, JSTaggedValue(200)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key1, desc1); + JSHandle key1(thread_, JSTaggedValue(1)); + PropertyDescriptor desc1(thread_, JSHandle(thread_, JSTaggedValue(200)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key1, desc1); - JSHandle key2(thread, JSTaggedValue(2)); + JSHandle key2(thread_, JSTaggedValue(2)); JSHandle value2(factory->NewFromCanBeCompressString("abc")); - JSObject::SetProperty(thread, JSHandle(obj), key2, value2); + JSObject::SetProperty(thread_, JSHandle(obj), key2, value2); JSHandle handleFunc = factory->NewJSFunction(env, reinterpret_cast(TestClass::TestForStringfy)); JSHandle msg(factory->NewFromCanBeCompressString("tttt")); - JSHandle str(JSTaggedValue::ToString(thread, msg)); + JSHandle str(JSTaggedValue::ToString(thread_, msg)); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 10); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 10); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetCallArg(0, obj.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(1, handleFunc.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(2, str.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsJson::Stringify(ecmaRuntimeCallInfo.get()); ASSERT_TRUE(result.IsString()); } TEST_F(BuiltinsJsonTest, Stringify2) { - auto ecmaVM = thread->GetEcmaVM(); + auto ecmaVM = thread_->GetEcmaVM(); ObjectFactory *factory = ecmaVM->GetFactory(); - JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); + JSArray *arr = JSArray::Cast(JSArray::ArrayCreate(thread_, JSTaggedNumber(0)).GetTaggedValue().GetTaggedObject()); EXPECT_TRUE(arr != nullptr); - JSHandle obj(thread, arr); + JSHandle obj(thread_, arr); - JSHandle key0(thread, JSTaggedValue(0)); - PropertyDescriptor desc0(thread, JSHandle(thread, JSTaggedValue(1)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key0, desc0); - JSHandle key1(thread, JSTaggedValue(1)); + JSHandle key0(thread_, JSTaggedValue(0)); + PropertyDescriptor desc0(thread_, JSHandle(thread_, JSTaggedValue(1)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key0, desc0); + JSHandle key1(thread_, JSTaggedValue(1)); // 2.5 : test case - PropertyDescriptor desc1(thread, JSHandle(thread, JSTaggedValue(2.5)), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key1, desc1); + PropertyDescriptor desc1(thread_, JSHandle(thread_, JSTaggedValue(2.5)), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key1, desc1); // 2 : test case - JSHandle key2(thread, JSTaggedValue(2)); + JSHandle key2(thread_, JSTaggedValue(2)); JSHandle value2(factory->NewFromCanBeCompressString("abc")); - JSObject::SetProperty(thread, JSHandle(obj), key2, value2); + JSObject::SetProperty(thread_, JSHandle(obj), key2, value2); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetCallArg(0, obj.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsJson::Stringify(ecmaRuntimeCallInfo.get()); ASSERT_TRUE(result.IsString()); } diff --git a/tests/runtime/builtins/builtins_map_test.cpp b/tests/runtime/builtins/builtins_map_test.cpp index 28f0aa85a02abbc1efff3b7c7db967a8537d75b8..4b2ad69ce57ca06eaa635f2da7adfc7c6f317b2c 100644 --- a/tests/runtime/builtins/builtins_map_test.cpp +++ b/tests/runtime/builtins/builtins_map_test.cpp @@ -53,17 +53,17 @@ public: void SetUp() override { - TestHelper::CreateEcmaVMWithScope(instance, thread, scope); + TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); } void TearDown() override { - TestHelper::DestroyEcmaVMWithScope(instance, scope); + TestHelper::DestroyEcmaVMWithScope(instance_, scope_); } - PandaVM *instance {nullptr}; - EcmaHandleScope *scope {nullptr}; - JSThread *thread {nullptr}; + PandaVM *instance_ {nullptr}; + EcmaHandleScope *scope_ {nullptr}; + JSThread *thread_ {nullptr}; class TestClass : public base::BuiltinsBase { public: @@ -97,18 +97,18 @@ JSMap *CreateBuiltinsMap(JSThread *thread) // new Map("abrupt").toString() TEST_F(BuiltinsMapTest, CreateAndGetSize) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle env = thread_->GetEcmaVM()->GetGlobalEnv(); JSHandle newTarget(env->GetBuiltinsMapFunction()); - JSHandle map(thread, CreateBuiltinsMap(thread)); + JSHandle map(thread_, CreateBuiltinsMap(thread_)); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(map.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue::Undefined()); { - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsMap::GetSize(ecmaRuntimeCallInfo.get()); EXPECT_EQ(result.GetRawData(), JSTaggedValue(0).GetRawData()); @@ -116,19 +116,19 @@ TEST_F(BuiltinsMapTest, CreateAndGetSize) JSHandle array(factory->NewTaggedArray(5)); for (int i = 0; i < 5; i++) { JSHandle internal_array(factory->NewTaggedArray(2)); - internal_array->Set(thread, 0, JSTaggedValue(i)); - internal_array->Set(thread, 1, JSTaggedValue(i)); - auto arr = JSArray::CreateArrayFromList(thread, internal_array); - array->Set(thread, i, arr); + internal_array->Set(thread_, 0, JSTaggedValue(i)); + internal_array->Set(thread_, 1, JSTaggedValue(i)); + auto arr = JSArray::CreateArrayFromList(thread_, internal_array); + array->Set(thread_, i, arr); } - JSHandle values = JSArray::CreateArrayFromList(thread, array); - auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + JSHandle values = JSArray::CreateArrayFromList(thread_, array); + auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo1->SetFunction(newTarget.GetTaggedValue()); ecmaRuntimeCallInfo1->SetThis(map.GetTaggedValue()); ecmaRuntimeCallInfo1->SetCallArg(0, values.GetTaggedValue()); ecmaRuntimeCallInfo1->SetNewTarget(newTarget.GetTaggedValue()); { - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); JSTaggedValue result1 = BuiltinsMap::MapConstructor(ecmaRuntimeCallInfo1.get()); EXPECT_EQ(JSMap::Cast(reinterpret_cast(result1.GetRawData()))->GetSize(), 5); @@ -137,12 +137,12 @@ TEST_F(BuiltinsMapTest, CreateAndGetSize) TEST_F(BuiltinsMapTest, SetAndHas) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); // create jsMap - JSHandle map(thread, CreateBuiltinsMap(thread)); + JSHandle map(thread_, CreateBuiltinsMap(thread_)); JSHandle key(factory->NewFromCanBeCompressString("key")); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(map.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, key.GetTaggedValue()); @@ -150,7 +150,7 @@ TEST_F(BuiltinsMapTest, SetAndHas) JSMap *jsMap; { - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result1 = BuiltinsMap::Has(ecmaRuntimeCallInfo.get()); EXPECT_EQ(result1.GetRawData(), JSTaggedValue::False().GetRawData()); @@ -164,13 +164,13 @@ TEST_F(BuiltinsMapTest, SetAndHas) } // test Has() - auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); ecmaRuntimeCallInfo1->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo1->SetThis(JSTaggedValue(jsMap)); ecmaRuntimeCallInfo1->SetCallArg(0, key.GetTaggedValue()); ecmaRuntimeCallInfo1->SetCallArg(1, JSTaggedValue(static_cast(1))); { - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); JSTaggedValue result3 = BuiltinsMap::Has(ecmaRuntimeCallInfo1.get()); EXPECT_EQ(result3.GetRawData(), JSTaggedValue::True().GetRawData()); @@ -180,36 +180,36 @@ TEST_F(BuiltinsMapTest, SetAndHas) TEST_F(BuiltinsMapTest, ForEach) { // generate a map has 5 entries{key1:0,key2:1,key3:2,key4:3,key5:4} - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); - JSHandle map(thread, CreateBuiltinsMap(thread)); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle env = thread_->GetEcmaVM()->GetGlobalEnv(); + JSHandle map(thread_, CreateBuiltinsMap(thread_)); char keyArray[] = "key0"; for (int i = 0; i < 5; i++) { keyArray[3] = '1' + i; JSHandle key(factory->NewFromCanBeCompressString(keyArray)); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(map.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, key.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(static_cast(i))); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result1 = BuiltinsMap::Set(ecmaRuntimeCallInfo.get()); EXPECT_TRUE(result1.IsECMAObject()); JSMap *jsMap = JSMap::Cast(reinterpret_cast(result1.GetRawData())); EXPECT_EQ(jsMap->GetSize(), i + 1); } // test foreach; - JSHandle jsArray(JSArray::ArrayCreate(thread, JSTaggedNumber(0))); + JSHandle jsArray(JSArray::ArrayCreate(thread_, JSTaggedNumber(0))); JSHandle func = factory->NewJSFunction(env, reinterpret_cast(TestClass::TestFunc)); - auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); ecmaRuntimeCallInfo1->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo1->SetThis(map.GetTaggedValue()); ecmaRuntimeCallInfo1->SetCallArg(0, func.GetTaggedValue()); ecmaRuntimeCallInfo1->SetCallArg(1, jsArray.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); JSTaggedValue result2 = BuiltinsMap::ForEach(ecmaRuntimeCallInfo1.get()); EXPECT_EQ(result2.GetRawData(), JSTaggedValue::VALUE_UNDEFINED); @@ -218,22 +218,22 @@ TEST_F(BuiltinsMapTest, ForEach) TEST_F(BuiltinsMapTest, DeleteAndRemove) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); // create jsMap - JSHandle map(thread, CreateBuiltinsMap(thread)); + JSHandle map(thread_, CreateBuiltinsMap(thread_)); // add 40 keys char keyArray[] = "key0"; for (int i = 0; i < 40; i++) { keyArray[3] = '1' + i; - JSHandle key(thread, factory->NewFromCanBeCompressString(keyArray).GetTaggedValue()); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + JSHandle key(thread_, factory->NewFromCanBeCompressString(keyArray).GetTaggedValue()); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(map.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, key.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(static_cast(i))); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result1 = BuiltinsMap::Set(ecmaRuntimeCallInfo.get()); EXPECT_TRUE(result1.IsECMAObject()); @@ -244,12 +244,12 @@ TEST_F(BuiltinsMapTest, DeleteAndRemove) keyArray[3] = '1' + 8; JSHandle deleteKey(factory->NewFromCanBeCompressString(keyArray)); - auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo1->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo1->SetThis(map.GetTaggedValue()); ecmaRuntimeCallInfo1->SetCallArg(0, deleteKey.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); JSTaggedValue result2 = BuiltinsMap::Has(ecmaRuntimeCallInfo1.get()); EXPECT_EQ(result2.GetRawData(), JSTaggedValue::True().GetRawData()); @@ -275,9 +275,9 @@ TEST_F(BuiltinsMapTest, DeleteAndRemove) TEST_F(BuiltinsMapTest, Species) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); - JSHandle map(thread, CreateBuiltinsMap(thread)); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle env = thread_->GetEcmaVM()->GetGlobalEnv(); + JSHandle map(thread_, CreateBuiltinsMap(thread_)); // test species JSHandle speciesSymbol = env->GetSpeciesSymbol(); @@ -286,73 +286,73 @@ TEST_F(BuiltinsMapTest, Species) JSHandle newTarget(env->GetBuiltinsMapFunction()); JSTaggedValue value = - JSObject::GetProperty(thread, JSHandle(newTarget), speciesSymbol).GetValue().GetTaggedValue(); - JSHandle valueHandle(thread, value); + JSObject::GetProperty(thread_, JSHandle(newTarget), speciesSymbol).GetValue().GetTaggedValue(); + JSHandle valueHandle(thread_, value); EXPECT_EQ(value, newTarget.GetTaggedValue()); // to string tag JSHandle toStringTagSymbol = env->GetToStringTagSymbol(); - JSHandle stringTag(JSObject::GetProperty(thread, map, toStringTagSymbol).GetValue()); + JSHandle stringTag(JSObject::GetProperty(thread_, map, toStringTagSymbol).GetValue()); JSHandle str = factory->NewFromCanBeCompressString("Map"); EXPECT_TRUE(!stringTag.GetTaggedValue().IsUndefined()); EXPECT_TRUE(EcmaString::StringsAreEqual(*str, *stringTag)); - JSHandle constructor = JSHandle::Cast(JSTaggedValue::ToObject(thread, valueHandle)); - EXPECT_EQ(JSHandle(map)->GetPrototype(thread), constructor->GetFunctionPrototype()); + JSHandle constructor = JSHandle::Cast(JSTaggedValue::ToObject(thread_, valueHandle)); + EXPECT_EQ(JSHandle(map)->GetPrototype(thread_), constructor->GetFunctionPrototype()); JSHandle key1(factory->NewFromCanBeCompressString("set")); - JSTaggedValue value1 = JSObject::GetProperty(thread, map, key1).GetValue().GetTaggedValue(); + JSTaggedValue value1 = JSObject::GetProperty(thread_, map, key1).GetValue().GetTaggedValue(); EXPECT_FALSE(value1.IsUndefined()); JSHandle key2(factory->NewFromCanBeCompressString("has")); - JSTaggedValue value2 = JSObject::GetProperty(thread, map, key1).GetValue().GetTaggedValue(); + JSTaggedValue value2 = JSObject::GetProperty(thread_, map, key1).GetValue().GetTaggedValue(); EXPECT_FALSE(value2.IsUndefined()); JSHandle key3(factory->NewFromCanBeCompressString("clear")); - JSTaggedValue value3 = JSObject::GetProperty(thread, map, key1).GetValue().GetTaggedValue(); + JSTaggedValue value3 = JSObject::GetProperty(thread_, map, key1).GetValue().GetTaggedValue(); EXPECT_FALSE(value3.IsUndefined()); JSHandle key4(factory->NewFromCanBeCompressString("size")); - JSTaggedValue value4 = JSObject::GetProperty(thread, map, key1).GetValue().GetTaggedValue(); + JSTaggedValue value4 = JSObject::GetProperty(thread_, map, key1).GetValue().GetTaggedValue(); EXPECT_FALSE(value4.IsUndefined()); JSHandle key5(factory->NewFromCanBeCompressString("delete")); - JSTaggedValue value5 = JSObject::GetProperty(thread, map, key1).GetValue().GetTaggedValue(); + JSTaggedValue value5 = JSObject::GetProperty(thread_, map, key1).GetValue().GetTaggedValue(); EXPECT_FALSE(value5.IsUndefined()); JSHandle key6(factory->NewFromCanBeCompressString("forEach")); - JSTaggedValue value6 = JSObject::GetProperty(thread, map, key1).GetValue().GetTaggedValue(); + JSTaggedValue value6 = JSObject::GetProperty(thread_, map, key1).GetValue().GetTaggedValue(); EXPECT_FALSE(value6.IsUndefined()); JSHandle key7(factory->NewFromCanBeCompressString("get")); - JSTaggedValue value7 = JSObject::GetProperty(thread, map, key1).GetValue().GetTaggedValue(); + JSTaggedValue value7 = JSObject::GetProperty(thread_, map, key1).GetValue().GetTaggedValue(); EXPECT_FALSE(value7.IsUndefined()); } TEST_F(BuiltinsMapTest, GetIterator) { - JSHandle map(thread, CreateBuiltinsMap(thread)); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); + JSHandle map(thread_, CreateBuiltinsMap(thread_)); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(map.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); // test Values() JSTaggedValue result = BuiltinsMap::Values(ecmaRuntimeCallInfo.get()); - JSHandle iter(thread, result); + JSHandle iter(thread_, result); EXPECT_TRUE(iter->IsJSMapIterator()); EXPECT_EQ(IterationKind::VALUE, IterationKind(iter->GetIterationKind().GetInt())); EXPECT_EQ(JSMap::Cast(map.GetTaggedValue().GetTaggedObject())->GetLinkedMap(), iter->GetIteratedMap()); // test Keys() JSTaggedValue result1 = BuiltinsMap::Keys(ecmaRuntimeCallInfo.get()); - JSHandle iter1(thread, result1); + JSHandle iter1(thread_, result1); EXPECT_TRUE(iter1->IsJSMapIterator()); EXPECT_EQ(IterationKind::KEY, IterationKind(iter1->GetIterationKind().GetInt())); // test entries() JSTaggedValue result2 = BuiltinsMap::Entries(ecmaRuntimeCallInfo.get()); - JSHandle iter2(thread, result2); + JSHandle iter2(thread_, result2); EXPECT_TRUE(iter2->IsJSMapIterator()); EXPECT_EQ(IterationKind::KEY_AND_VALUE, IterationKind(iter2->GetIterationKind().GetInt())); } diff --git a/tests/runtime/builtins/builtins_number_test.cpp b/tests/runtime/builtins/builtins_number_test.cpp index ac964aca77e20840b57fc0f59e93c42374bc25ec..356ffa5cb4c373a7259efbf33f9da80e5fdfbf24 100644 --- a/tests/runtime/builtins/builtins_number_test.cpp +++ b/tests/runtime/builtins/builtins_number_test.cpp @@ -50,33 +50,33 @@ public: void SetUp() override { - TestHelper::CreateEcmaVMWithScope(instance, thread, scope); + TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); } void TearDown() override { - TestHelper::DestroyEcmaVMWithScope(instance, scope); + TestHelper::DestroyEcmaVMWithScope(instance_, scope_); } - PandaVM *instance {nullptr}; - EcmaHandleScope *scope {nullptr}; - JSThread *thread {nullptr}; + PandaVM *instance_ {nullptr}; + EcmaHandleScope *scope_ {nullptr}; + JSThread *thread_ {nullptr}; }; // new Number(10) TEST_F(BuiltinsNumberTest, NumberConstructor) { - JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); + JSHandle env = thread_->GetEcmaVM()->GetGlobalEnv(); JSHandle number(env->GetNumberFunction()); - JSHandle globalObject(thread, env->GetGlobalObject()); + JSHandle globalObject(thread_, env->GetGlobalObject()); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue(*number), 6); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue(*number), 6); ecmaRuntimeCallInfo->SetFunction(number.GetTaggedValue()); ecmaRuntimeCallInfo->SetThis(globalObject.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast(5))); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsNumber::NumberConstructor(ecmaRuntimeCallInfo.get()); JSTaggedValue value(static_cast(result.GetRawData())); ASSERT_TRUE(value.IsECMAObject()); @@ -88,12 +88,12 @@ TEST_F(BuiltinsNumberTest, NumberConstructor) TEST_F(BuiltinsNumberTest, IsFinite) { const double value = -10; - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast(value))); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsNumber::IsFinite(ecmaRuntimeCallInfo.get()); ASSERT_EQ(result.GetRawData(), JSTaggedValue::True().GetRawData()); } @@ -101,12 +101,12 @@ TEST_F(BuiltinsNumberTest, IsFinite) // Number.isFinite(Number.MAX_VALUE) TEST_F(BuiltinsNumberTest, IsFinite1) { - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(base::MAX_VALUE)); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsNumber::IsFinite(ecmaRuntimeCallInfo.get()); ASSERT_EQ(result.GetRawData(), JSTaggedValue::True().GetRawData()); } @@ -114,13 +114,13 @@ TEST_F(BuiltinsNumberTest, IsFinite1) // Number.isFinite("helloworld") TEST_F(BuiltinsNumberTest, IsFinite2) { - JSHandle test = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("helloworld"); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + JSHandle test = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("helloworld"); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetCallArg(0, test.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsNumber::IsFinite(ecmaRuntimeCallInfo.get()); ASSERT_EQ(result.GetRawData(), JSTaggedValue::False().GetRawData()); } @@ -128,12 +128,12 @@ TEST_F(BuiltinsNumberTest, IsFinite2) // Number.isFinite(NaN) TEST_F(BuiltinsNumberTest, IsFinite3) { - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(base::NAN_VALUE)); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsNumber::IsFinite(ecmaRuntimeCallInfo.get()); ASSERT_EQ(result.GetRawData(), JSTaggedValue::False().GetRawData()); } @@ -141,12 +141,12 @@ TEST_F(BuiltinsNumberTest, IsFinite3) // Number.isFinite(Infinity) TEST_F(BuiltinsNumberTest, IsFinite4) { - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(base::POSITIVE_INFINITY)); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsNumber::IsFinite(ecmaRuntimeCallInfo.get()); ASSERT_EQ(result.GetRawData(), JSTaggedValue::False().GetRawData()); } @@ -154,12 +154,12 @@ TEST_F(BuiltinsNumberTest, IsFinite4) // Number.isFinite(undefined) TEST_F(BuiltinsNumberTest, IsFinite5) { - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue::Undefined()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsNumber::IsFinite(ecmaRuntimeCallInfo.get()); ASSERT_EQ(result.GetRawData(), JSTaggedValue::False().GetRawData()); } @@ -167,12 +167,12 @@ TEST_F(BuiltinsNumberTest, IsFinite5) // Number.isFinite(null) TEST_F(BuiltinsNumberTest, IsFinite6) { - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue::Null()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsNumber::IsFinite(ecmaRuntimeCallInfo.get()); ASSERT_EQ(result.GetRawData(), JSTaggedValue::False().GetRawData()); } @@ -180,12 +180,12 @@ TEST_F(BuiltinsNumberTest, IsFinite6) // Number.isInteger(0.1) TEST_F(BuiltinsNumberTest, IsInteger) { - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(0.1)); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsNumber::IsInteger(ecmaRuntimeCallInfo.get()); ASSERT_EQ(result.GetRawData(), JSTaggedValue::False().GetRawData()); } @@ -193,12 +193,12 @@ TEST_F(BuiltinsNumberTest, IsInteger) // Number.isNaN(0.1) TEST_F(BuiltinsNumberTest, IsNaN) { - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(0.1)); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsNumber::IsNaN(ecmaRuntimeCallInfo.get()); ASSERT_EQ(result.GetRawData(), JSTaggedValue::False().GetRawData()); } @@ -206,23 +206,23 @@ TEST_F(BuiltinsNumberTest, IsNaN) // new Number(123.456).toString(7) TEST_F(BuiltinsNumberTest, ToString) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - auto ecmaVM = thread->GetEcmaVM(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + auto ecmaVM = thread_->GetEcmaVM(); JSHandle env = ecmaVM->GetGlobalEnv(); JSHandle numberObject(env->GetNumberFunction()); - JSHandle value(thread, JSTaggedValue(123.456)); - JSHandle number = thread->GetEcmaVM()->GetFactory()->NewJSPrimitiveRef(numberObject, value); + JSHandle value(thread_, JSTaggedValue(123.456)); + JSHandle number = thread_->GetEcmaVM()->GetFactory()->NewJSPrimitiveRef(numberObject, value); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(number.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(7.0)); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsNumber::ToString(ecmaRuntimeCallInfo.get()); ASSERT_TRUE(result.IsString()); - JSHandle res(thread, reinterpret_cast(result.GetRawData())); + JSHandle res(thread_, reinterpret_cast(result.GetRawData())); JSHandle correctResult = factory->NewFromCanBeCompressString("234.312256641535441"); CVector test(res->GetLength() + 1); res->CopyDataUtf8(test.data(), res->GetLength()); @@ -232,23 +232,23 @@ TEST_F(BuiltinsNumberTest, ToString) // new Number(123.456).toExponential(5) TEST_F(BuiltinsNumberTest, IsExponential) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - auto ecmaVM = thread->GetEcmaVM(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + auto ecmaVM = thread_->GetEcmaVM(); JSHandle env = ecmaVM->GetGlobalEnv(); JSHandle numberObject(env->GetNumberFunction()); - JSHandle value(thread, JSTaggedValue(123.456)); + JSHandle value(thread_, JSTaggedValue(123.456)); JSHandle number = factory->NewJSPrimitiveRef(numberObject, value); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(number.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(5.0)); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsNumber::ToExponential(ecmaRuntimeCallInfo.get()); ASSERT_TRUE(result.IsString()); - JSHandle res(thread, reinterpret_cast(result.GetRawData())); + JSHandle res(thread_, reinterpret_cast(result.GetRawData())); JSHandle correctResult = factory->NewFromCanBeCompressString("1.23456e+2"); CVector test(res->GetLength() + 1); res->CopyDataUtf8(test.data(), res->GetLength()); @@ -258,23 +258,23 @@ TEST_F(BuiltinsNumberTest, IsExponential) // new Number(123.456).toFixed(10) TEST_F(BuiltinsNumberTest, ToFixed) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - auto ecmaVM = thread->GetEcmaVM(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + auto ecmaVM = thread_->GetEcmaVM(); JSHandle env = ecmaVM->GetGlobalEnv(); JSHandle numberObject(env->GetNumberFunction()); - JSHandle value(thread, JSTaggedValue(123.456)); + JSHandle value(thread_, JSTaggedValue(123.456)); JSHandle number = factory->NewJSPrimitiveRef(numberObject, value); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(number.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(10.0)); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsNumber::ToFixed(ecmaRuntimeCallInfo.get()); ASSERT_TRUE(result.IsString()); - JSHandle res(thread, reinterpret_cast(result.GetRawData())); + JSHandle res(thread_, reinterpret_cast(result.GetRawData())); JSHandle correctResult = factory->NewFromCanBeCompressString("123.4560000000"); ASSERT_TRUE(EcmaString::StringsAreEqual(*res, *correctResult)); } @@ -282,23 +282,23 @@ TEST_F(BuiltinsNumberTest, ToFixed) // new Number(123.456).toFixed(30) TEST_F(BuiltinsNumberTest, ToFixed1) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - auto ecmaVM = thread->GetEcmaVM(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + auto ecmaVM = thread_->GetEcmaVM(); JSHandle env = ecmaVM->GetGlobalEnv(); JSHandle numberObject(env->GetNumberFunction()); - JSHandle value(thread, JSTaggedValue(123.456)); + JSHandle value(thread_, JSTaggedValue(123.456)); JSHandle number = factory->NewJSPrimitiveRef(numberObject, value); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(number.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(30.0)); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsNumber::ToFixed(ecmaRuntimeCallInfo.get()); ASSERT_TRUE(result.IsString()); - JSHandle res(thread, reinterpret_cast(result.GetRawData())); + JSHandle res(thread_, reinterpret_cast(result.GetRawData())); JSHandle correctResult = factory->NewFromCanBeCompressString("123.456000000000003069544618483633"); ASSERT_TRUE(EcmaString::StringsAreEqual(*res, *correctResult)); } @@ -306,23 +306,23 @@ TEST_F(BuiltinsNumberTest, ToFixed1) // new Number(1e21).toFixed(20) TEST_F(BuiltinsNumberTest, ToFixed2) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - auto ecmaVM = thread->GetEcmaVM(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + auto ecmaVM = thread_->GetEcmaVM(); JSHandle env = ecmaVM->GetGlobalEnv(); JSHandle numberObject(env->GetNumberFunction()); - JSHandle value(thread, JSTaggedValue(1e21)); + JSHandle value(thread_, JSTaggedValue(1e21)); JSHandle number = factory->NewJSPrimitiveRef(numberObject, value); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(number.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(20.0)); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsNumber::ToFixed(ecmaRuntimeCallInfo.get()); ASSERT_TRUE(result.IsString()); - JSHandle res(thread, reinterpret_cast(result.GetRawData())); + JSHandle res(thread_, reinterpret_cast(result.GetRawData())); JSHandle correctResult = factory->NewFromCanBeCompressString("1e+21"); CVector test(res->GetLength() + 1); res->CopyDataUtf8(test.data(), res->GetLength()); @@ -333,23 +333,23 @@ TEST_F(BuiltinsNumberTest, ToFixed2) // new Number(123.456).toPrecision(8) TEST_F(BuiltinsNumberTest, ToPrecision) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - auto ecmaVM = thread->GetEcmaVM(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + auto ecmaVM = thread_->GetEcmaVM(); JSHandle env = ecmaVM->GetGlobalEnv(); JSHandle numberObject(env->GetNumberFunction()); - JSHandle value(thread, JSTaggedValue(123.456)); + JSHandle value(thread_, JSTaggedValue(123.456)); JSHandle number = factory->NewJSPrimitiveRef(numberObject, value); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(number.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(8.0)); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsNumber::ToPrecision(ecmaRuntimeCallInfo.get()); ASSERT_TRUE(result.IsString()); - JSHandle res(thread, reinterpret_cast(result.GetRawData())); + JSHandle res(thread_, reinterpret_cast(result.GetRawData())); JSHandle correctResult = factory->NewFromCanBeCompressString("123.45600"); ASSERT_TRUE(EcmaString::StringsAreEqual(*res, *correctResult)); } @@ -357,13 +357,13 @@ TEST_F(BuiltinsNumberTest, ToPrecision) // Number.parseFloat(0x123) TEST_F(BuiltinsNumberTest, parseFloat) { - JSHandle param = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("0x123"); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + JSHandle param = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("0x123"); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetCallArg(0, param.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsNumber::ParseFloat(ecmaRuntimeCallInfo.get()); ASSERT_EQ(result.GetRawData(), JSTaggedValue(static_cast(0)).GetRawData()); } @@ -371,13 +371,13 @@ TEST_F(BuiltinsNumberTest, parseFloat) // Number.parseFloat(0x123xx) TEST_F(BuiltinsNumberTest, parseFloat1) { - JSHandle param = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("0x123xx"); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + JSHandle param = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("0x123xx"); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetCallArg(0, param.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsNumber::ParseFloat(ecmaRuntimeCallInfo.get()); ASSERT_EQ(result.GetRawData(), JSTaggedValue(static_cast(0)).GetRawData()); } @@ -387,14 +387,14 @@ TEST_F(BuiltinsNumberTest, parseInt) { const char *number = "0x123"; - JSHandle param = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(number); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + JSHandle param = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(number); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetCallArg(0, param.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(16.0)); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsNumber::ParseInt(ecmaRuntimeCallInfo.get()); ASSERT_EQ(result.GetRawData(), JSTaggedValue(static_cast(291)).GetRawData()); } @@ -407,74 +407,74 @@ TEST_F(BuiltinsNumberTest, StringToDoubleFlags) // flags of IGNORE_TRAILING - str = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("0a"); + str = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("0a"); sp = Span(str->GetDataUtf8(), str->GetUtf8Length() - 1); ASSERT_EQ(base::NumberHelper::StringToDouble(sp.begin(), sp.end(), 0, base::IGNORE_TRAILING), 0); - str = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("0b"); + str = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("0b"); sp = Span(str->GetDataUtf8(), str->GetUtf8Length() - 1); ASSERT_EQ(base::NumberHelper::StringToDouble(sp.begin(), sp.end(), 0, base::IGNORE_TRAILING), 0); - str = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("0o"); + str = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("0o"); sp = Span(str->GetDataUtf8(), str->GetUtf8Length() - 1); ASSERT_EQ(base::NumberHelper::StringToDouble(sp.begin(), sp.end(), 0, base::IGNORE_TRAILING), 0); - str = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 00x"); + str = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 00x"); sp = Span(str->GetDataUtf8(), str->GetUtf8Length() - 1); ASSERT_EQ(base::NumberHelper::StringToDouble(sp.begin(), sp.end(), 0, base::IGNORE_TRAILING), 0); - str = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 000.4_"); + str = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 000.4_"); sp = Span(str->GetDataUtf8(), str->GetUtf8Length() - 1); ASSERT_EQ(base::NumberHelper::StringToDouble(sp.begin(), sp.end(), 0, base::IGNORE_TRAILING), 0.4); - str = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 0010.s "); + str = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 0010.s "); sp = Span(str->GetDataUtf8(), str->GetUtf8Length() - 1); ASSERT_EQ(base::NumberHelper::StringToDouble(sp.begin(), sp.end(), 0, base::IGNORE_TRAILING), 10); - str = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 0010e2"); + str = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 0010e2"); sp = Span(str->GetDataUtf8(), str->GetUtf8Length() - 1); ASSERT_EQ(base::NumberHelper::StringToDouble(sp.begin(), sp.end(), 0, base::IGNORE_TRAILING), 1000); - str = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 0010e+3_0"); + str = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 0010e+3_0"); sp = Span(str->GetDataUtf8(), str->GetUtf8Length() - 1); ASSERT_EQ(base::NumberHelper::StringToDouble(sp.begin(), sp.end(), 0, base::IGNORE_TRAILING), 10000); // flags of ALLOW_HEX - str = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("0x"); + str = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("0x"); sp = Span(str->GetDataUtf8(), str->GetUtf8Length() - 1); ASSERT_TRUE(std::isnan(base::NumberHelper::StringToDouble(sp.begin(), sp.end(), 0, base::ALLOW_HEX))); - str = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 0x10 "); + str = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 0x10 "); sp = Span(str->GetDataUtf8(), str->GetUtf8Length() - 1); ASSERT_EQ(base::NumberHelper::StringToDouble(sp.begin(), sp.end(), 0, base::ALLOW_HEX), 16); - str = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("0x1g"); + str = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("0x1g"); sp = Span(str->GetDataUtf8(), str->GetUtf8Length() - 1); ASSERT_EQ(base::NumberHelper::StringToDouble(sp.begin(), sp.end(), 0, base::ALLOW_HEX + base::IGNORE_TRAILING), 1); - str = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("0xh"); + str = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("0xh"); sp = Span(str->GetDataUtf8(), str->GetUtf8Length() - 1); ASSERT_TRUE(std::isnan( base::NumberHelper::StringToDouble(sp.begin(), sp.end(), 0, base::ALLOW_HEX + base::IGNORE_TRAILING))); // flags of ALLOW_OCTAL - str = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("0O"); + str = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("0O"); sp = Span(str->GetDataUtf8(), str->GetUtf8Length() - 1); ASSERT_TRUE(std::isnan(base::NumberHelper::StringToDouble(sp.begin(), sp.end(), 0, base::ALLOW_OCTAL))); - str = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 0o10 "); + str = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 0o10 "); sp = Span(str->GetDataUtf8(), str->GetUtf8Length() - 1); ASSERT_EQ(base::NumberHelper::StringToDouble(sp.begin(), sp.end(), 0, base::ALLOW_OCTAL), 8); - str = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("0o1d"); + str = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("0o1d"); sp = Span(str->GetDataUtf8(), str->GetUtf8Length() - 1); ASSERT_EQ(base::NumberHelper::StringToDouble(sp.begin(), sp.end(), 0, base::ALLOW_OCTAL | base::IGNORE_TRAILING), 1); - str = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("0o8"); + str = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("0o8"); sp = Span(str->GetDataUtf8(), str->GetUtf8Length() - 1); ASSERT_TRUE(std::isnan( base::NumberHelper::StringToDouble(sp.begin(), sp.end(), 0, base::ALLOW_OCTAL | base::IGNORE_TRAILING))); // flags of ALLOW_BINARY - str = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("0b"); + str = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("0b"); sp = Span(str->GetDataUtf8(), str->GetUtf8Length() - 1); ASSERT_TRUE(std::isnan(base::NumberHelper::StringToDouble(sp.begin(), sp.end(), 0, base::ALLOW_BINARY))); - str = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 0b10 "); + str = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 0b10 "); sp = Span(str->GetDataUtf8(), str->GetUtf8Length() - 1); ASSERT_EQ(base::NumberHelper::StringToDouble(sp.begin(), sp.end(), 0, base::ALLOW_BINARY), 2); - str = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("0b1d"); + str = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("0b1d"); sp = Span(str->GetDataUtf8(), str->GetUtf8Length() - 1); ASSERT_EQ(base::NumberHelper::StringToDouble(sp.begin(), sp.end(), 0, base::ALLOW_BINARY | base::IGNORE_TRAILING), 1); - str = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("0b2"); + str = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("0b2"); sp = Span(str->GetDataUtf8(), str->GetUtf8Length() - 1); ASSERT_TRUE(std::isnan( base::NumberHelper::StringToDouble(sp.begin(), sp.end(), 0, base::ALLOW_BINARY | base::IGNORE_TRAILING))); @@ -488,112 +488,114 @@ TEST_F(BuiltinsNumberTest, StringToDoubleRadix) int radix; radix = 0; // default 10 - str = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 100 "); + str = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 100 "); sp = Span(str->GetDataUtf8(), str->GetUtf8Length() - 1); ASSERT_EQ(base::NumberHelper::StringToDouble(sp.begin(), sp.end(), radix, base::NO_FLAGS), 100); - str = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 100.3e2 "); + str = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 100.3e2 "); sp = Span(str->GetDataUtf8(), str->GetUtf8Length() - 1); ASSERT_EQ(base::NumberHelper::StringToDouble(sp.begin(), sp.end(), radix, base::NO_FLAGS), 10030); radix = 1; - str = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 0000 "); + str = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 0000 "); sp = Span(str->GetDataUtf8(), str->GetUtf8Length() - 1); ASSERT_EQ(base::NumberHelper::StringToDouble(sp.begin(), sp.end(), radix, base::NO_FLAGS), 0); - str = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 0001 "); + str = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 0001 "); sp = Span(str->GetDataUtf8(), str->GetUtf8Length() - 1); ASSERT_TRUE(std::isnan(base::NumberHelper::StringToDouble(sp.begin(), sp.end(), radix, base::NO_FLAGS))); radix = 2; - str = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 100 "); + str = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 100 "); sp = Span(str->GetDataUtf8(), str->GetUtf8Length() - 1); ASSERT_EQ(base::NumberHelper::StringToDouble(sp.begin(), sp.end(), radix, base::NO_FLAGS), 4); - str = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 11 "); + str = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 11 "); sp = Span(str->GetDataUtf8(), str->GetUtf8Length() - 1); ASSERT_EQ(base::NumberHelper::StringToDouble(sp.begin(), sp.end(), radix, base::NO_FLAGS), 3); radix = 3; - str = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 100 "); + str = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 100 "); sp = Span(str->GetDataUtf8(), str->GetUtf8Length() - 1); ASSERT_EQ(base::NumberHelper::StringToDouble(sp.begin(), sp.end(), radix, base::NO_FLAGS), 9); - str = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 21 "); + str = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 21 "); sp = Span(str->GetDataUtf8(), str->GetUtf8Length() - 1); ASSERT_EQ(base::NumberHelper::StringToDouble(sp.begin(), sp.end(), radix, base::NO_FLAGS), 7); radix = 4; - str = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 100 "); + str = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 100 "); sp = Span(str->GetDataUtf8(), str->GetUtf8Length() - 1); ASSERT_EQ(base::NumberHelper::StringToDouble(sp.begin(), sp.end(), radix, base::NO_FLAGS), 16); - str = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 31 "); + str = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 31 "); sp = Span(str->GetDataUtf8(), str->GetUtf8Length() - 1); ASSERT_EQ(base::NumberHelper::StringToDouble(sp.begin(), sp.end(), radix, base::NO_FLAGS), 13); radix = 8; - str = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 100 "); + str = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 100 "); sp = Span(str->GetDataUtf8(), str->GetUtf8Length() - 1); ASSERT_EQ(base::NumberHelper::StringToDouble(sp.begin(), sp.end(), radix, base::NO_FLAGS), 64); - str = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 71 "); + str = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 71 "); sp = Span(str->GetDataUtf8(), str->GetUtf8Length() - 1); ASSERT_EQ(base::NumberHelper::StringToDouble(sp.begin(), sp.end(), radix, base::NO_FLAGS), 57); radix = 10; - str = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 100 "); + str = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 100 "); sp = Span(str->GetDataUtf8(), str->GetUtf8Length() - 1); ASSERT_EQ(base::NumberHelper::StringToDouble(sp.begin(), sp.end(), radix, base::NO_FLAGS), 100); - str = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 0020 "); + str = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 0020 "); sp = Span(str->GetDataUtf8(), str->GetUtf8Length() - 1); ASSERT_EQ(base::NumberHelper::StringToDouble(sp.begin(), sp.end(), radix, base::NO_FLAGS), 20); radix = 16; - str = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 100 "); + str = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 100 "); sp = Span(str->GetDataUtf8(), str->GetUtf8Length() - 1); ASSERT_EQ(base::NumberHelper::StringToDouble(sp.begin(), sp.end(), radix, base::NO_FLAGS), 256); - str = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 1e "); + str = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 1e "); sp = Span(str->GetDataUtf8(), str->GetUtf8Length() - 1); ASSERT_EQ(base::NumberHelper::StringToDouble(sp.begin(), sp.end(), radix, base::NO_FLAGS), 30); radix = 18; - str = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 100 "); + str = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 100 "); sp = Span(str->GetDataUtf8(), str->GetUtf8Length() - 1); ASSERT_EQ(base::NumberHelper::StringToDouble(sp.begin(), sp.end(), radix, base::NO_FLAGS), 324); - str = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 1g "); + str = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 1g "); sp = Span(str->GetDataUtf8(), str->GetUtf8Length() - 1); ASSERT_EQ(base::NumberHelper::StringToDouble(sp.begin(), sp.end(), radix, base::NO_FLAGS), 34); radix = 25; - str = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 100 "); + str = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 100 "); sp = Span(str->GetDataUtf8(), str->GetUtf8Length() - 1); ASSERT_EQ(base::NumberHelper::StringToDouble(sp.begin(), sp.end(), radix, base::NO_FLAGS), 625); - str = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 1g "); + str = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 1g "); sp = Span(str->GetDataUtf8(), str->GetUtf8Length() - 1); ASSERT_EQ(base::NumberHelper::StringToDouble(sp.begin(), sp.end(), radix, base::NO_FLAGS), 41); radix = 36; - str = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 100 "); + str = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 100 "); sp = Span(str->GetDataUtf8(), str->GetUtf8Length() - 1); ASSERT_EQ(base::NumberHelper::StringToDouble(sp.begin(), sp.end(), radix, base::NO_FLAGS), 1296); - str = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 1z "); + str = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(" 1z "); sp = Span(str->GetDataUtf8(), str->GetUtf8Length() - 1); ASSERT_EQ(base::NumberHelper::StringToDouble(sp.begin(), sp.end(), radix, base::NO_FLAGS), 71); } TEST_F(BuiltinsNumberTest, NumberToString) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); JSHandle res = factory->NewFromCanBeCompressString("100"); - ASSERT_EQ(base::NumberHelper::NumberToString(thread, JSTaggedValue(100))->Compare(*res), 0); + ASSERT_EQ(base::NumberHelper::NumberToString(thread_, JSTaggedValue(100))->Compare(*res), 0); res = factory->NewFromCanBeCompressString("11223344"); - ASSERT_EQ(base::NumberHelper::NumberToString(thread, JSTaggedValue(11223344))->Compare(*res), 0); + ASSERT_EQ(base::NumberHelper::NumberToString(thread_, JSTaggedValue(11223344))->Compare(*res), 0); res = factory->NewFromCanBeCompressString("1234567890"); - ASSERT_EQ(base::NumberHelper::NumberToString(thread, JSTaggedValue(1234567890))->Compare(*res), 0); + ASSERT_EQ(base::NumberHelper::NumberToString(thread_, JSTaggedValue(1234567890))->Compare(*res), 0); res = factory->NewFromCanBeCompressString("100"); - ASSERT_EQ(base::NumberHelper::NumberToString(thread, JSTaggedValue(double(100.0)))->Compare(*res), 0); + ASSERT_EQ(base::NumberHelper::NumberToString(thread_, JSTaggedValue(double(100.0)))->Compare(*res), 0); res = factory->NewFromCanBeCompressString("100.5"); - ASSERT_EQ(base::NumberHelper::NumberToString(thread, JSTaggedValue(double(100.5)))->Compare(*res), 0); + ASSERT_EQ(base::NumberHelper::NumberToString(thread_, JSTaggedValue(double(100.5)))->Compare(*res), 0); res = factory->NewFromCanBeCompressString("100.25"); - ASSERT_EQ(base::NumberHelper::NumberToString(thread, JSTaggedValue(double(100.25)))->Compare(*res), 0); + ASSERT_EQ(base::NumberHelper::NumberToString(thread_, JSTaggedValue(double(100.25)))->Compare(*res), 0); res = factory->NewFromCanBeCompressString("100.125"); - ASSERT_EQ(base::NumberHelper::NumberToString(thread, JSTaggedValue(double(100.125)))->Compare(*res), 0); + ASSERT_EQ(base::NumberHelper::NumberToString(thread_, JSTaggedValue(double(100.125)))->Compare(*res), 0); res = factory->NewFromCanBeCompressString("100.6125"); - ASSERT_EQ(base::NumberHelper::NumberToString(thread, JSTaggedValue(double(100.6125)))->Compare(*res), 0); + ASSERT_EQ(base::NumberHelper::NumberToString(thread_, JSTaggedValue(double(100.6125)))->Compare(*res), 0); res = factory->NewFromCanBeCompressString("0.0006125"); - ASSERT_EQ(base::NumberHelper::NumberToString(thread, JSTaggedValue(double(0.0006125)))->Compare(*res), 0); + ASSERT_EQ(base::NumberHelper::NumberToString(thread_, JSTaggedValue(double(0.0006125)))->Compare(*res), 0); res = factory->NewFromCanBeCompressString("-0.0006125"); - ASSERT_EQ(base::NumberHelper::NumberToString(thread, JSTaggedValue(double(-0.0006125)))->Compare(*res), 0); + ASSERT_EQ(base::NumberHelper::NumberToString(thread_, JSTaggedValue(double(-0.0006125)))->Compare(*res), 0); res = factory->NewFromCanBeCompressString("-1234567890.0006125"); - ASSERT_EQ(base::NumberHelper::NumberToString(thread, JSTaggedValue(double(-1234567890.0006125)))->Compare(*res), 0); + ASSERT_EQ(base::NumberHelper::NumberToString(thread_, JSTaggedValue(double(-1234567890.0006125)))->Compare(*res), + 0); res = factory->NewFromCanBeCompressString("1234567890.0006125"); - ASSERT_EQ(base::NumberHelper::NumberToString(thread, JSTaggedValue(double(1234567890.0006125)))->Compare(*res), 0); + ASSERT_EQ(base::NumberHelper::NumberToString(thread_, JSTaggedValue(double(1234567890.0006125)))->Compare(*res), 0); res = factory->NewFromCanBeCompressString("11234567890.000612"); - ASSERT_EQ(base::NumberHelper::NumberToString(thread, JSTaggedValue(double(11234567890.0006125)))->Compare(*res), 0); + ASSERT_EQ(base::NumberHelper::NumberToString(thread_, JSTaggedValue(double(11234567890.0006125)))->Compare(*res), + 0); } } // namespace panda::test diff --git a/tests/runtime/builtins/builtins_object_test.cpp b/tests/runtime/builtins/builtins_object_test.cpp index 1dea4d5cccfeed4ae2a605ea14c2f2ed9a53528a..18b6e078816b9538502b5c3b7e75a34eddea059e 100644 --- a/tests/runtime/builtins/builtins_object_test.cpp +++ b/tests/runtime/builtins/builtins_object_test.cpp @@ -47,17 +47,17 @@ public: void SetUp() override { - TestHelper::CreateEcmaVMWithScope(instance, thread, scope); + TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); } void TearDown() override { - TestHelper::DestroyEcmaVMWithScope(instance, scope); + TestHelper::DestroyEcmaVMWithScope(instance_, scope_); } - PandaVM *instance {nullptr}; - EcmaHandleScope *scope {nullptr}; - JSThread *thread {nullptr}; + PandaVM *instance_ {nullptr}; + EcmaHandleScope *scope_ {nullptr}; + JSThread *thread_ {nullptr}; }; JSTaggedValue CreateBuiltinJSObject(JSThread *thread, const CString keyCStr) @@ -93,60 +93,60 @@ JSObject *TestNewJSObject(JSThread *thread, const JSHandle &dynClass) // 19.1.1.1Object ( [ value ] ) TEST_F(BuiltinsObjectTest, ObjectConstructor) { - JSHandle function(thread, BuiltinsObjectTestCreate(thread)); - JSHandle objectFunc(thread, BuiltinsObjectTestCreate(thread)); - JSHandle globalEnv = thread->GetEcmaVM()->GetGlobalEnv(); + JSHandle function(thread_, BuiltinsObjectTestCreate(thread_)); + JSHandle objectFunc(thread_, BuiltinsObjectTestCreate(thread_)); + JSHandle globalEnv = thread_->GetEcmaVM()->GetGlobalEnv(); JSHandle objFun(globalEnv->GetObjectFunction()); - auto objCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); + auto objCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); objCallInfo->SetFunction(JSTaggedValue::Undefined()); objCallInfo->SetThis(JSTaggedValue::Undefined()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, objCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, objCallInfo.get()); JSTaggedValue result = BuiltinsObject::ObjectConstructor(objCallInfo.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_TRUE(result.IsECMAObject()); - JSHandle jtHandle(thread, JSTaggedValue(reinterpret_cast(result.GetRawData()))); - JSTaggedValue resultProto = jtHandle->GetPrototype(thread); + JSHandle jtHandle(thread_, JSTaggedValue(reinterpret_cast(result.GetRawData()))); + JSTaggedValue resultProto = jtHandle->GetPrototype(thread_); JSTaggedValue funcProto = objectFunc->GetFunctionPrototype(); ASSERT_EQ(resultProto, funcProto); ASSERT_TRUE(jtHandle->IsExtensible()); // num_args = 0 JSHandle object = - thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle::Cast(function), function); - auto tgObjCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue(*object), 4); + thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle::Cast(function), function); + auto tgObjCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue(*object), 4); tgObjCallInfo->SetFunction(JSTaggedValue(*objFun)); tgObjCallInfo->SetThis(JSTaggedValue::Undefined()); tgObjCallInfo->SetNewTarget(JSTaggedValue(*objFun)); - prev = TestHelper::SetupFrame(thread, tgObjCallInfo.get()); + prev = TestHelper::SetupFrame(thread_, tgObjCallInfo.get()); JSTaggedValue resultTg = BuiltinsObject::ObjectConstructor(tgObjCallInfo.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_TRUE(resultTg.IsObject()); - JSHandle jtHandleTg(thread, JSTaggedValue(reinterpret_cast(resultTg.GetRawData()))); - JSTaggedValue resultProtoTg = jtHandleTg->GetPrototype(thread); + JSHandle jtHandleTg(thread_, JSTaggedValue(reinterpret_cast(resultTg.GetRawData()))); + JSTaggedValue resultProtoTg = jtHandleTg->GetPrototype(thread_); JSTaggedValue funcProtoTg = objectFunc->GetFunctionPrototype(); ASSERT_EQ(resultProtoTg, funcProtoTg); ASSERT_TRUE(jtHandleTg->IsExtensible()); // value is null JSHandle objectVn = - thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle::Cast(function), function); - auto vnObjCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue(*objectVn), 6); + thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle::Cast(function), function); + auto vnObjCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue(*objectVn), 6); vnObjCallInfo->SetFunction(JSTaggedValue(*objFun)); vnObjCallInfo->SetThis(JSTaggedValue::Undefined()); vnObjCallInfo->SetCallArg(0, JSTaggedValue::Null()); vnObjCallInfo->SetNewTarget(JSTaggedValue(*objFun)); - prev = TestHelper::SetupFrame(thread, vnObjCallInfo.get()); + prev = TestHelper::SetupFrame(thread_, vnObjCallInfo.get()); JSTaggedValue resultVn = BuiltinsObject::ObjectConstructor(vnObjCallInfo.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_TRUE(resultVn.IsObject()); - JSHandle jtHandleVn(thread, JSTaggedValue(reinterpret_cast(resultVn.GetRawData()))); - JSTaggedValue resultProtoVn = jtHandleVn->GetPrototype(thread); + JSHandle jtHandleVn(thread_, JSTaggedValue(reinterpret_cast(resultVn.GetRawData()))); + JSTaggedValue resultProtoVn = jtHandleVn->GetPrototype(thread_); JSTaggedValue funcProtoVn = objectFunc->GetFunctionPrototype(); ASSERT_EQ(resultProtoVn, funcProtoVn); ASSERT_TRUE(jtHandleVn->IsExtensible()); @@ -155,197 +155,197 @@ TEST_F(BuiltinsObjectTest, ObjectConstructor) // 19.1.2.1Object.assign ( target, ...sources ) TEST_F(BuiltinsObjectTest, Assign) { - JSHandle function(thread, BuiltinsObjectTestCreate(thread)); + JSHandle function(thread_, BuiltinsObjectTestCreate(thread_)); JSHandle objHandle1 = - thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(function), function); + thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(function), function); JSHandle objHandle2 = - thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(function), function); + thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(function), function); - JSHandle key1(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("x")); - JSHandle value1(thread, JSTaggedValue(1)); - JSObject::SetProperty(thread, JSHandle(objHandle1), key1, value1); - EXPECT_EQ(JSObject::GetProperty(thread, JSHandle(objHandle1), key1).GetValue()->GetInt(), 1); + JSHandle key1(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("x")); + JSHandle value1(thread_, JSTaggedValue(1)); + JSObject::SetProperty(thread_, JSHandle(objHandle1), key1, value1); + EXPECT_EQ(JSObject::GetProperty(thread_, JSHandle(objHandle1), key1).GetValue()->GetInt(), 1); - JSHandle key2(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("y")); - JSHandle value2(thread, JSTaggedValue(2)); - JSObject::SetProperty(thread, JSHandle(objHandle2), key2, value2); - EXPECT_EQ(JSObject::GetProperty(thread, JSHandle(objHandle2), key2).GetValue()->GetInt(), 2); + JSHandle key2(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("y")); + JSHandle value2(thread_, JSTaggedValue(2)); + JSObject::SetProperty(thread_, JSHandle(objHandle2), key2, value2); + EXPECT_EQ(JSObject::GetProperty(thread_, JSHandle(objHandle2), key2).GetValue()->GetInt(), 2); - auto assignObjCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + auto assignObjCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); assignObjCallInfo->SetFunction(JSTaggedValue::Undefined()); assignObjCallInfo->SetThis(JSTaggedValue::Undefined()); assignObjCallInfo->SetCallArg(0, objHandle1.GetTaggedValue()); assignObjCallInfo->SetCallArg(1, objHandle2.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, assignObjCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, assignObjCallInfo.get()); JSTaggedValue result = BuiltinsObject::Assign(assignObjCallInfo.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_TRUE(result.IsECMAObject()); - JSHandle jtHandle(thread, JSTaggedValue(reinterpret_cast(result.GetRawData()))); - EXPECT_EQ(JSObject::GetProperty(thread, jtHandle, key1).GetValue()->GetInt(), 1); - EXPECT_EQ(JSObject::GetProperty(thread, jtHandle, key2).GetValue()->GetInt(), 2); + JSHandle jtHandle(thread_, JSTaggedValue(reinterpret_cast(result.GetRawData()))); + EXPECT_EQ(JSObject::GetProperty(thread_, jtHandle, key1).GetValue()->GetInt(), 1); + EXPECT_EQ(JSObject::GetProperty(thread_, jtHandle, key2).GetValue()->GetInt(), 2); } // 19.1.2.2Object.create ( O [ , Properties ] ) TEST_F(BuiltinsObjectTest, Create) { - JSHandle function(thread, BuiltinsObjectTestCreate(thread)); - JSHandle objectFunc(thread, BuiltinsObjectTestCreate(thread)); - JSHandle funcProto(thread, objectFunc->GetFunctionPrototype()); + JSHandle function(thread_, BuiltinsObjectTestCreate(thread_)); + JSHandle objectFunc(thread_, BuiltinsObjectTestCreate(thread_)); + JSHandle funcProto(thread_, objectFunc->GetFunctionPrototype()); // no prop - auto objCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto objCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); objCallInfo->SetFunction(JSTaggedValue::Undefined()); objCallInfo->SetThis(JSTaggedValue::Undefined()); objCallInfo->SetCallArg(0, funcProto.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, objCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, objCallInfo.get()); JSTaggedValue result = BuiltinsObject::Create(objCallInfo.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_TRUE(result.IsECMAObject()); - JSHandle jtHandle(thread, JSTaggedValue(reinterpret_cast(result.GetRawData()))); - JSTaggedValue resultProto = jtHandle->GetPrototype(thread); + JSHandle jtHandle(thread_, JSTaggedValue(reinterpret_cast(result.GetRawData()))); + JSTaggedValue resultProto = jtHandle->GetPrototype(thread_); ASSERT_EQ(resultProto, funcProto.GetTaggedValue()); // has prop - JSHandle key(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("prop")); + JSHandle key(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("prop")); JSHandle objHandle = - thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle::Cast(function), function); + thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle::Cast(function), function); EXPECT_TRUE(*objHandle != nullptr); - PropertyDescriptor desc(thread); + PropertyDescriptor desc(thread_); desc.SetWritable(false); - JSHandle descHandle(JSObject::FromPropertyDescriptor(thread, desc)); + JSHandle descHandle(JSObject::FromPropertyDescriptor(thread_, desc)); - PropertyDescriptor descNw(thread, JSHandle::Cast(descHandle), true, true, true); - JSObject::DefineOwnProperty(thread, objHandle, key, descNw); + PropertyDescriptor descNw(thread_, JSHandle::Cast(descHandle), true, true, true); + JSObject::DefineOwnProperty(thread_, objHandle, key, descNw); - auto hpObjCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + auto hpObjCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); hpObjCallInfo->SetFunction(JSTaggedValue::Undefined()); hpObjCallInfo->SetThis(JSTaggedValue::Undefined()); hpObjCallInfo->SetCallArg(0, funcProto.GetTaggedValue()); hpObjCallInfo->SetCallArg(1, objHandle.GetTaggedValue()); - prev = TestHelper::SetupFrame(thread, hpObjCallInfo.get()); + prev = TestHelper::SetupFrame(thread_, hpObjCallInfo.get()); JSTaggedValue resultHp = BuiltinsObject::Create(hpObjCallInfo.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_TRUE(resultHp.IsObject()); - PropertyDescriptor descRes(thread); - bool success = JSObject::GetOwnProperty(thread, JSHandle(thread, resultHp), key, descRes); + PropertyDescriptor descRes(thread_); + bool success = JSObject::GetOwnProperty(thread_, JSHandle(thread_, resultHp), key, descRes); EXPECT_TRUE(success); EXPECT_TRUE(!descRes.IsWritable()); // undefined - auto unCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto unCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); unCallInfo->SetFunction(JSTaggedValue::Undefined()); unCallInfo->SetThis(JSTaggedValue::Undefined()); unCallInfo->SetCallArg(0, JSTaggedValue::Undefined()); - prev = TestHelper::SetupFrame(thread, unCallInfo.get()); + prev = TestHelper::SetupFrame(thread_, unCallInfo.get()); JSTaggedValue resultUn = BuiltinsObject::Create(unCallInfo.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_EQ(resultUn.GetRawData(), JSTaggedValue::VALUE_EXCEPTION); } // 19.1.2.3Object.defineProperties ( O, Properties ) TEST_F(BuiltinsObjectTest, DefineProperties) { - JSHandle function(thread, BuiltinsObjectTestCreate(thread)); - JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); + JSHandle function(thread_, BuiltinsObjectTestCreate(thread_)); + JSHandle env = thread_->GetEcmaVM()->GetGlobalEnv(); JSHandle objFunc(env->GetObjectFunction()); JSHandle objHandle = - thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(function), function); - JSHandle key(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("prop")); + thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(function), function); + JSHandle key(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("prop")); JSHandle jsobjHandle = - thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(function), function); + thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(function), function); - PropertyDescriptor desc(thread); + PropertyDescriptor desc(thread_); desc.SetWritable(false); - JSHandle descHandle(JSObject::FromPropertyDescriptor(thread, desc)); + JSHandle descHandle(JSObject::FromPropertyDescriptor(thread_, desc)); - PropertyDescriptor descNw(thread, JSHandle::Cast(descHandle), true, true, true); - JSObject::DefineOwnProperty(thread, jsobjHandle, key, descNw); + PropertyDescriptor descNw(thread_, JSHandle::Cast(descHandle), true, true, true); + JSObject::DefineOwnProperty(thread_, jsobjHandle, key, descNw); - auto objCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + auto objCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); objCallInfo->SetFunction(JSTaggedValue::Undefined()); objCallInfo->SetThis(JSTaggedValue::Undefined()); objCallInfo->SetCallArg(0, objHandle.GetTaggedValue()); objCallInfo->SetCallArg(1, jsobjHandle.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, objCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, objCallInfo.get()); JSTaggedValue result = BuiltinsObject::DefineProperties(objCallInfo.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_TRUE(result.IsECMAObject()); JSTaggedValue res(reinterpret_cast(result.GetRawData())); - PropertyDescriptor descRes(thread); - JSObject::GetOwnProperty(thread, JSHandle(thread, res), key, descRes); + PropertyDescriptor descRes(thread_); + JSObject::GetOwnProperty(thread_, JSHandle(thread_, res), key, descRes); EXPECT_TRUE(!descRes.IsWritable()); } // 19.1.2.4Object.defineProperty ( O, P, Attributes ) TEST_F(BuiltinsObjectTest, DefineProperty) { - JSHandle function(thread, BuiltinsObjectTestCreate(thread)); + JSHandle function(thread_, BuiltinsObjectTestCreate(thread_)); - JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); + JSHandle env = thread_->GetEcmaVM()->GetGlobalEnv(); JSHandle objFunc(env->GetObjectFunction()); JSHandle attHandle = - thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(function), function); + thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(function), function); JSHandle objHandle = - thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(function), function); + thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(function), function); - PropertyDescriptor desc(thread); + PropertyDescriptor desc(thread_); desc.SetWritable(true); - JSHandle writableStr = thread->GlobalConstants()->GetHandledWritableString(); - JSHandle writable(thread, JSTaggedValue(desc.IsWritable())); - JSObject::CreateDataProperty(thread, attHandle, writableStr, writable); + JSHandle writableStr = thread_->GlobalConstants()->GetHandledWritableString(); + JSHandle writable(thread_, JSTaggedValue(desc.IsWritable())); + JSObject::CreateDataProperty(thread_, attHandle, writableStr, writable); - JSHandle key(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("x")); + JSHandle key(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("x")); - PropertyDescriptor descNw(thread); - JSObject::GetOwnProperty(thread, objHandle, key, descNw); + PropertyDescriptor descNw(thread_); + JSObject::GetOwnProperty(thread_, objHandle, key, descNw); EXPECT_TRUE(!descNw.HasWritable()); - auto objCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 10); + auto objCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 10); objCallInfo->SetFunction(JSTaggedValue::Undefined()); objCallInfo->SetThis(JSTaggedValue::Undefined()); objCallInfo->SetCallArg(0, objHandle.GetTaggedValue()); objCallInfo->SetCallArg(1, key.GetTaggedValue()); objCallInfo->SetCallArg(2, attHandle.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, objCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, objCallInfo.get()); JSTaggedValue result = BuiltinsObject::DefineProperty(objCallInfo.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_TRUE(result.IsECMAObject()); JSTaggedValue res(reinterpret_cast(result.GetRawData())); - PropertyDescriptor descRes(thread); - JSObject::GetOwnProperty(thread, JSHandle(thread, res), key, descRes); + PropertyDescriptor descRes(thread_); + JSObject::GetOwnProperty(thread_, JSHandle(thread_, res), key, descRes); EXPECT_TRUE(descRes.HasWritable()); } // B.2.2.2 Object.prototype.__defineGetter__ ( P, getter ) TEST_F(BuiltinsObjectTest, DefineGetter) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); - JSHandle obj(thread, CreateBuiltinJSObject(thread, "prop")); + JSHandle obj(thread_, CreateBuiltinJSObject(thread_, "prop")); JSHandle key(factory->NewFromString("prop")); - JSHandle getter(factory->NewJSFunction(thread->GetEcmaVM()->GetGlobalEnv())); + JSHandle getter(factory->NewJSFunction(thread_->GetEcmaVM()->GetGlobalEnv())); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(obj.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, key.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(1, getter.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsObject::DefineSetter(ecmaRuntimeCallInfo.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_EQ(result.GetRawData(), JSTaggedValue::VALUE_UNDEFINED); } @@ -353,21 +353,21 @@ TEST_F(BuiltinsObjectTest, DefineGetter) // B.2.2.3 Object.prototype.__defineSetter__ ( P, setter ) TEST_F(BuiltinsObjectTest, DefineSetter) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); - JSHandle obj(thread, CreateBuiltinJSObject(thread, "prop")); + JSHandle obj(thread_, CreateBuiltinJSObject(thread_, "prop")); JSHandle key(factory->NewFromString("prop")); - JSHandle setter(factory->NewJSFunction(thread->GetEcmaVM()->GetGlobalEnv())); + JSHandle setter(factory->NewJSFunction(thread_->GetEcmaVM()->GetGlobalEnv())); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(obj.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, key.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(1, setter.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsObject::DefineGetter(ecmaRuntimeCallInfo.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_EQ(result.GetRawData(), JSTaggedValue::VALUE_UNDEFINED); } @@ -375,46 +375,46 @@ TEST_F(BuiltinsObjectTest, DefineSetter) // B.2.2.4 Object.prototype.__lookupGetter__ ( P ) TEST_F(BuiltinsObjectTest, LookupGetter) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); - JSHandle obj(thread, CreateBuiltinJSObject(thread, "prop")); + JSHandle obj(thread_, CreateBuiltinJSObject(thread_, "prop")); JSHandle key(factory->NewFromString("prop")); - JSHandle getter(factory->NewJSFunction(thread->GetEcmaVM()->GetGlobalEnv())); + JSHandle getter(factory->NewJSFunction(thread_->GetEcmaVM()->GetGlobalEnv())); // First - getter should not be defined. - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(obj.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, key.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsObject::LookupGetter(ecmaRuntimeCallInfo.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_EQ(result.GetRawData(), JSTaggedValue::VALUE_UNDEFINED); // Second - set a getter function. - ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(obj.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, key.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(1, getter.GetTaggedValue()); - prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); result = BuiltinsObject::DefineGetter(ecmaRuntimeCallInfo.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_EQ(result.GetRawData(), JSTaggedValue::VALUE_UNDEFINED); // Third - check the getter function if it really exists. - ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(obj.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, key.GetTaggedValue()); - prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); result = BuiltinsObject::LookupGetter(ecmaRuntimeCallInfo.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_EQ(result, getter.GetTaggedValue()); } @@ -422,46 +422,46 @@ TEST_F(BuiltinsObjectTest, LookupGetter) // B.2.2.5 Object.prototype.__lookupSetter__ ( P ) TEST_F(BuiltinsObjectTest, LookupSetter) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); - JSHandle obj(thread, CreateBuiltinJSObject(thread, "prop")); + JSHandle obj(thread_, CreateBuiltinJSObject(thread_, "prop")); JSHandle key(factory->NewFromString("prop")); - JSHandle setter(factory->NewJSFunction(thread->GetEcmaVM()->GetGlobalEnv())); + JSHandle setter(factory->NewJSFunction(thread_->GetEcmaVM()->GetGlobalEnv())); // First - setter should not be defined. - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(obj.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, key.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsObject::LookupSetter(ecmaRuntimeCallInfo.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_EQ(result.GetRawData(), JSTaggedValue::VALUE_UNDEFINED); // Second - set a setter function. - ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(obj.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, key.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(1, setter.GetTaggedValue()); - prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); result = BuiltinsObject::DefineSetter(ecmaRuntimeCallInfo.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_EQ(result.GetRawData(), JSTaggedValue::VALUE_UNDEFINED); // Third - check the setter function if it really exists. - ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(obj.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, key.GetTaggedValue()); - prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); result = BuiltinsObject::LookupSetter(ecmaRuntimeCallInfo.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_EQ(result, setter.GetTaggedValue()); } @@ -469,69 +469,69 @@ TEST_F(BuiltinsObjectTest, LookupSetter) // 19.1.2.5Object.freeze ( O ) TEST_F(BuiltinsObjectTest, Freeze) { - JSHandle function(thread, BuiltinsObjectTestCreate(thread)); + JSHandle function(thread_, BuiltinsObjectTestCreate(thread_)); // An object is extensible by default, so it is also non-frozen. JSHandle emptyObj = - thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(function), function); + thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(function), function); emptyObj->GetJSHClass()->SetExtensible(true); - auto nofreezeObjCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto nofreezeObjCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); nofreezeObjCallInfo->SetFunction(JSTaggedValue::Undefined()); nofreezeObjCallInfo->SetThis(JSTaggedValue::Undefined()); nofreezeObjCallInfo->SetCallArg(0, emptyObj.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, nofreezeObjCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, nofreezeObjCallInfo.get()); JSTaggedValue result = BuiltinsObject::IsFrozen(nofreezeObjCallInfo.get()); ASSERT_EQ(result.GetRawData(), JSTaggedValue::False().GetRawData()); BuiltinsObject::Freeze(nofreezeObjCallInfo.get()); JSTaggedValue resultIs = BuiltinsObject::IsFrozen(nofreezeObjCallInfo.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_EQ(resultIs.GetRawData(), JSTaggedValue::True().GetRawData()); } // ES2021 20.1.2.7 Object.fromEntries ( iterable ) TEST_F(BuiltinsObjectTest, FromEntries) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); - JSArray *arr1 = JSArray::Cast(JSArray::ArrayCreate(thread, JSTaggedNumber(0)).GetTaggedValue().GetHeapObject()); + JSArray *arr1 = JSArray::Cast(JSArray::ArrayCreate(thread_, JSTaggedNumber(0)).GetTaggedValue().GetHeapObject()); EXPECT_TRUE(arr1 != nullptr); - JSArray *arr2 = JSArray::Cast(JSArray::ArrayCreate(thread, JSTaggedNumber(0)).GetTaggedValue().GetHeapObject()); + JSArray *arr2 = JSArray::Cast(JSArray::ArrayCreate(thread_, JSTaggedNumber(0)).GetTaggedValue().GetHeapObject()); EXPECT_TRUE(arr2 != nullptr); - JSHandle obj(thread, arr1); + JSHandle obj(thread_, arr1); - JSHandle prop(thread, arr2); + JSHandle prop(thread_, arr2); JSHandle fooStr = JSHandle(factory->NewFromString("foo")); JSHandle barStr = JSHandle(factory->NewFromString("bar")); - PropertyDescriptor desc0(thread, fooStr, true, true, true); - PropertyDescriptor desc1(thread, barStr, true, true, true); + PropertyDescriptor desc0(thread_, fooStr, true, true, true); + PropertyDescriptor desc1(thread_, barStr, true, true, true); - JSHandle key0(thread, JSTaggedValue(0)); - JSHandle key1(thread, JSTaggedValue(1)); + JSHandle key0(thread_, JSTaggedValue(0)); + JSHandle key1(thread_, JSTaggedValue(1)); - JSArray::DefineOwnProperty(thread, prop, key0, desc0); - JSArray::DefineOwnProperty(thread, prop, key1, desc1); + JSArray::DefineOwnProperty(thread_, prop, key0, desc0); + JSArray::DefineOwnProperty(thread_, prop, key1, desc1); - PropertyDescriptor descProp(thread, JSHandle(prop), true, true, true); - JSArray::DefineOwnProperty(thread, obj, key0, descProp); + PropertyDescriptor descProp(thread_, JSHandle(prop), true, true, true); + JSArray::DefineOwnProperty(thread_, obj, key0, descProp); - auto objCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto objCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); objCallInfo->SetFunction(JSTaggedValue::Undefined()); objCallInfo->SetThis(JSTaggedValue::Undefined()); objCallInfo->SetCallArg(0, obj.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, objCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, objCallInfo.get()); JSTaggedValue result = BuiltinsObject::FromEntries(objCallInfo.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_TRUE(result.IsECMAObject()); - PropertyDescriptor desc(thread); - JSObject::GetOwnProperty(thread, JSHandle(thread, result), fooStr, desc); + PropertyDescriptor desc(thread_); + JSObject::GetOwnProperty(thread_, JSHandle(thread_, result), fooStr, desc); ASSERT_TRUE(JSTaggedValue::SameValue(desc.GetValue().GetTaggedValue(), barStr.GetTaggedValue())); } @@ -539,94 +539,94 @@ TEST_F(BuiltinsObjectTest, FromEntries) // 19.1.2.6 Object.getOwnPropertyDescriptor ( O, P ) TEST_F(BuiltinsObjectTest, GetOwnPropertyDesciptor) { - JSHandle function(thread, BuiltinsObjectTestCreate(thread)); + JSHandle function(thread_, BuiltinsObjectTestCreate(thread_)); JSHandle objHandle = - thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(function), function); + thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(function), function); - JSHandle key(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("x")); + JSHandle key(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("x")); - PropertyDescriptor descEnum(thread); + PropertyDescriptor descEnum(thread_); descEnum.SetWritable(true); - JSTaggedValue::DefinePropertyOrThrow(thread, JSHandle(objHandle), key, descEnum); + JSTaggedValue::DefinePropertyOrThrow(thread_, JSHandle(objHandle), key, descEnum); - auto objCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + auto objCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); objCallInfo->SetFunction(JSTaggedValue::Undefined()); objCallInfo->SetThis(JSTaggedValue::Undefined()); objCallInfo->SetCallArg(0, objHandle.GetTaggedValue()); objCallInfo->SetCallArg(1, key.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, objCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, objCallInfo.get()); JSTaggedValue result = BuiltinsObject::GetOwnPropertyDesciptor(objCallInfo.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_TRUE(result.IsECMAObject()); - JSHandle writableStr = thread->GlobalConstants()->GetHandledWritableString(); + JSHandle writableStr = thread_->GlobalConstants()->GetHandledWritableString(); JSTaggedValue jt(reinterpret_cast(result.GetRawData())); - PropertyDescriptor desc(thread); - JSObject::GetOwnProperty(thread, JSHandle(thread, jt), writableStr, desc); + PropertyDescriptor desc(thread_); + JSObject::GetOwnProperty(thread_, JSHandle(thread_, jt), writableStr, desc); ASSERT_TRUE(JSTaggedValue::SameValue(desc.GetValue().GetTaggedValue(), JSTaggedValue(true))); } // ES2021 20.1.2.9 Object.getOwnPropertyDescriptors ( O ) TEST_F(BuiltinsObjectTest, GetOwnPropertyDesciptors) { - JSHandle function(thread, BuiltinsObjectTestCreate(thread)); + JSHandle function(thread_, BuiltinsObjectTestCreate(thread_)); JSHandle obj_handle = - thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(function), function); + thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(function), function); - JSHandle keyX(thread->GetEcmaVM()->GetFactory()->NewFromString("x")); - JSHandle value(thread, JSTaggedValue(22)); + JSHandle keyX(thread_->GetEcmaVM()->GetFactory()->NewFromString("x")); + JSHandle value(thread_, JSTaggedValue(22)); - JSObject::SetProperty(thread, obj_handle, keyX, value); + JSObject::SetProperty(thread_, obj_handle, keyX, value); - auto objCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + auto objCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); objCallInfo->SetFunction(JSTaggedValue::Undefined()); objCallInfo->SetThis(JSTaggedValue::Undefined()); objCallInfo->SetCallArg(0, obj_handle.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, objCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, objCallInfo.get()); JSTaggedValue result = BuiltinsObject::GetOwnPropertyDesciptors(objCallInfo.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_TRUE(result.IsECMAObject()); - JSHandle handle(thread, result); + JSHandle handle(thread_, result); - JSHandle prop = JSObject::GetProperty(thread, handle, keyX).GetValue(); + JSHandle prop = JSObject::GetProperty(thread_, handle, keyX).GetValue(); - JSHandle value_str = thread->GlobalConstants()->GetHandledValueString(); - ASSERT_EQ(JSObject::GetProperty(thread, prop, value_str).GetValue()->GetInt(), 22); + JSHandle value_str = thread_->GlobalConstants()->GetHandledValueString(); + ASSERT_EQ(JSObject::GetProperty(thread_, prop, value_str).GetValue()->GetInt(), 22); - JSHandle enumerable_str = thread->GlobalConstants()->GetHandledEnumerableString(); - ASSERT_EQ(JSObject::GetProperty(thread, prop, enumerable_str).GetValue().GetTaggedValue(), JSTaggedValue(true)); + JSHandle enumerable_str = thread_->GlobalConstants()->GetHandledEnumerableString(); + ASSERT_EQ(JSObject::GetProperty(thread_, prop, enumerable_str).GetValue().GetTaggedValue(), JSTaggedValue(true)); - JSHandle configurable_str = thread->GlobalConstants()->GetHandledConfigurableString(); - ASSERT_EQ(JSObject::GetProperty(thread, prop, configurable_str).GetValue().GetTaggedValue(), JSTaggedValue(true)); + JSHandle configurable_str = thread_->GlobalConstants()->GetHandledConfigurableString(); + ASSERT_EQ(JSObject::GetProperty(thread_, prop, configurable_str).GetValue().GetTaggedValue(), JSTaggedValue(true)); - JSHandle writable_str = thread->GlobalConstants()->GetHandledWritableString(); - ASSERT_EQ(JSObject::GetProperty(thread, prop, writable_str).GetValue().GetTaggedValue(), JSTaggedValue(true)); + JSHandle writable_str = thread_->GlobalConstants()->GetHandledWritableString(); + ASSERT_EQ(JSObject::GetProperty(thread_, prop, writable_str).GetValue().GetTaggedValue(), JSTaggedValue(true)); } // 19.1.2.7 Object.getOwnPropertyNames ( O ) TEST_F(BuiltinsObjectTest, GetOwnPropertyNames) { - JSHandle function(thread, BuiltinsObjectTestCreate(thread)); + JSHandle function(thread_, BuiltinsObjectTestCreate(thread_)); JSHandle objHandle = - thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(function), function); + thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(function), function); - JSHandle key(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("x")); - JSHandle value(thread, JSTaggedValue(1)); - JSObject::SetProperty(thread, JSHandle(objHandle), key, value); + JSHandle key(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("x")); + JSHandle value(thread_, JSTaggedValue(1)); + JSObject::SetProperty(thread_, JSHandle(objHandle), key, value); - auto objCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto objCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); objCallInfo->SetFunction(JSTaggedValue::Undefined()); objCallInfo->SetThis(JSTaggedValue::Undefined()); objCallInfo->SetCallArg(0, objHandle.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, objCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, objCallInfo.get()); JSTaggedValue result = BuiltinsObject::GetOwnPropertyNames(objCallInfo.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_TRUE(result.IsECMAObject()); } @@ -634,23 +634,23 @@ TEST_F(BuiltinsObjectTest, GetOwnPropertyNames) // 19.1.2.8 Object.getOwnPropertySymbols ( O ) TEST_F(BuiltinsObjectTest, GetOwnPropertySymbols) { - JSHandle function(thread, BuiltinsObjectTestCreate(thread)); + JSHandle function(thread_, BuiltinsObjectTestCreate(thread_)); JSHandle objHandle = - thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(function), function); - JSHandle symbolKey = thread->GetEcmaVM()->GetFactory()->NewJSSymbol(); + thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(function), function); + JSHandle symbolKey = thread_->GetEcmaVM()->GetFactory()->NewJSSymbol(); JSHandle key(symbolKey); - JSHandle value(thread, JSTaggedValue(1)); - JSObject::SetProperty(thread, JSHandle(objHandle), key, value); - thread->ClearException(); + JSHandle value(thread_, JSTaggedValue(1)); + JSObject::SetProperty(thread_, JSHandle(objHandle), key, value); + thread_->ClearException(); - auto objCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto objCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); objCallInfo->SetFunction(JSTaggedValue::Undefined()); objCallInfo->SetThis(JSTaggedValue::Undefined()); objCallInfo->SetCallArg(0, objHandle.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, objCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, objCallInfo.get()); JSTaggedValue result = BuiltinsObject::GetOwnPropertySymbols(objCallInfo.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_TRUE(result.IsECMAObject()); } @@ -659,22 +659,22 @@ TEST_F(BuiltinsObjectTest, GetOwnPropertySymbols) TEST_F(BuiltinsObjectTest, Is) { // js object compare - JSHandle function(thread, BuiltinsObjectTestCreate(thread)); + JSHandle function(thread_, BuiltinsObjectTestCreate(thread_)); JSHandle obj1 = - thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(function), function); + thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(function), function); JSHandle obj2 = - thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(function), function); + thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(function), function); - auto objCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + auto objCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); objCallInfo1->SetFunction(JSTaggedValue::Undefined()); objCallInfo1->SetThis(JSTaggedValue::Undefined()); objCallInfo1->SetCallArg(0, obj1.GetTaggedValue()); objCallInfo1->SetCallArg(1, obj2.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, objCallInfo1.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, objCallInfo1.get()); JSTaggedValue objResult1 = BuiltinsObject::Is(objCallInfo1.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_EQ(objResult1.GetRawData(), JSTaggedValue::False().GetRawData()); @@ -683,69 +683,69 @@ TEST_F(BuiltinsObjectTest, Is) ASSERT_EQ(objResult2.GetRawData(), JSTaggedValue::True().GetRawData()); // string compare - JSHandle testStrValue1 = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("helloworld"); - JSHandle testStrValue2 = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("helloworld"); + JSHandle testStrValue1 = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("helloworld"); + JSHandle testStrValue2 = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("helloworld"); - auto strCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + auto strCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); strCallInfo->SetFunction(JSTaggedValue::Undefined()); strCallInfo->SetThis(JSTaggedValue::Undefined()); strCallInfo->SetCallArg(0, testStrValue1.GetTaggedValue()); strCallInfo->SetCallArg(1, testStrValue2.GetTaggedValue()); - prev = TestHelper::SetupFrame(thread, strCallInfo.get()); + prev = TestHelper::SetupFrame(thread_, strCallInfo.get()); JSTaggedValue strResult = BuiltinsObject::Is(strCallInfo.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_EQ(strResult.GetRawData(), JSTaggedValue::True().GetRawData()); // bool compare - auto boolCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + auto boolCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); boolCallInfo->SetFunction(JSTaggedValue::Undefined()); boolCallInfo->SetThis(JSTaggedValue::Undefined()); boolCallInfo->SetCallArg(0, JSTaggedValue::True()); boolCallInfo->SetCallArg(1, JSTaggedValue::False()); - prev = TestHelper::SetupFrame(thread, boolCallInfo.get()); + prev = TestHelper::SetupFrame(thread_, boolCallInfo.get()); JSTaggedValue boolResult = BuiltinsObject::Is(boolCallInfo.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_EQ(boolResult.GetRawData(), JSTaggedValue::False().GetRawData()); // number compare - auto numCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + auto numCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); numCallInfo->SetFunction(JSTaggedValue::Undefined()); numCallInfo->SetThis(JSTaggedValue::Undefined()); numCallInfo->SetCallArg(0, JSTaggedValue(static_cast(0))); numCallInfo->SetCallArg(1, JSTaggedValue(-0.0)); - prev = TestHelper::SetupFrame(thread, numCallInfo.get()); + prev = TestHelper::SetupFrame(thread_, numCallInfo.get()); JSTaggedValue numResult = BuiltinsObject::Is(numCallInfo.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_EQ(numResult.GetRawData(), JSTaggedValue::False().GetRawData()); // undefined or null compare - auto nullCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + auto nullCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); nullCallInfo->SetFunction(JSTaggedValue::Undefined()); nullCallInfo->SetThis(JSTaggedValue::Undefined()); nullCallInfo->SetCallArg(0, JSTaggedValue::Null()); nullCallInfo->SetCallArg(1, JSTaggedValue::Null()); - prev = TestHelper::SetupFrame(thread, nullCallInfo.get()); + prev = TestHelper::SetupFrame(thread_, nullCallInfo.get()); JSTaggedValue nullResult = BuiltinsObject::Is(nullCallInfo.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_EQ(nullResult.GetRawData(), JSTaggedValue::True().GetRawData()); - auto undefineCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + auto undefineCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); undefineCallInfo->SetFunction(JSTaggedValue::Undefined()); undefineCallInfo->SetThis(JSTaggedValue::Undefined()); undefineCallInfo->SetCallArg(0, JSTaggedValue::Undefined()); undefineCallInfo->SetCallArg(1, JSTaggedValue::Undefined()); - prev = TestHelper::SetupFrame(thread, undefineCallInfo.get()); + prev = TestHelper::SetupFrame(thread_, undefineCallInfo.get()); JSTaggedValue undefineResult = BuiltinsObject::Is(undefineCallInfo.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_EQ(undefineResult.GetRawData(), JSTaggedValue::True().GetRawData()); } @@ -753,20 +753,20 @@ TEST_F(BuiltinsObjectTest, Is) // 19.1.2.11 Object.isExtensible ( O ) TEST_F(BuiltinsObjectTest, IsExtensible) { - JSHandle function(thread, BuiltinsObjectTestCreate(thread)); + JSHandle function(thread_, BuiltinsObjectTestCreate(thread_)); // New objects can be extended by default. JSHandle emptyObj = - thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(function), function); + thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(function), function); emptyObj->GetJSHClass()->SetExtensible(true); - auto emptyObjCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto emptyObjCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); emptyObjCallInfo->SetFunction(JSTaggedValue::Undefined()); emptyObjCallInfo->SetThis(JSTaggedValue::Undefined()); emptyObjCallInfo->SetCallArg(0, emptyObj.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, emptyObjCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, emptyObjCallInfo.get()); JSTaggedValue result = BuiltinsObject::IsExtensible(emptyObjCallInfo.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_EQ(result.GetRawData(), JSTaggedValue::True().GetRawData()); @@ -778,20 +778,20 @@ TEST_F(BuiltinsObjectTest, IsExtensible) // 19.1.2.12 Object.isFrozen ( O ) TEST_F(BuiltinsObjectTest, IsFrozen) { - JSHandle function(thread, BuiltinsObjectTestCreate(thread)); - JSHandle key(thread->GetEcmaVM()->GetFactory()->NewFromString("x")); - JSHandle value(thread, JSTaggedValue(1)); + JSHandle function(thread_, BuiltinsObjectTestCreate(thread_)); + JSHandle key(thread_->GetEcmaVM()->GetFactory()->NewFromString("x")); + JSHandle value(thread_, JSTaggedValue(1)); // An object is extensible by default, so it is also non-frozen. JSHandle obj = - thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle::Cast(function), function); + thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle::Cast(function), function); obj->GetJSHClass()->SetExtensible(true); - auto emptyObjCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto emptyObjCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); emptyObjCallInfo->SetFunction(JSTaggedValue::Undefined()); emptyObjCallInfo->SetThis(JSTaggedValue::Undefined()); emptyObjCallInfo->SetCallArg(0, obj.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, emptyObjCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, emptyObjCallInfo.get()); JSTaggedValue result = BuiltinsObject::IsFrozen(emptyObjCallInfo.get()); ASSERT_EQ(result.GetRawData(), JSTaggedValue::False().GetRawData()); @@ -799,37 +799,37 @@ TEST_F(BuiltinsObjectTest, IsFrozen) JSTaggedValue result_nex = BuiltinsObject::IsFrozen(emptyObjCallInfo.get()); ASSERT_EQ(result_nex.GetRawData(), JSTaggedValue::True().GetRawData()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); - PropertyDescriptor desc_enum(thread); + PropertyDescriptor desc_enum(thread_); desc_enum.SetConfigurable(true); desc_enum.SetWritable(false); obj->GetJSHClass()->SetExtensible(true); - JSTaggedValue::DefinePropertyOrThrow(thread, JSHandle(obj), key, desc_enum); + JSTaggedValue::DefinePropertyOrThrow(thread_, JSHandle(obj), key, desc_enum); obj->GetJSHClass()->SetExtensible(false); - auto emptyObjCallInfo2 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto emptyObjCallInfo2 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); emptyObjCallInfo2->SetFunction(JSTaggedValue::Undefined()); emptyObjCallInfo2->SetThis(JSTaggedValue::Undefined()); emptyObjCallInfo2->SetCallArg(0, obj.GetTaggedValue()); - prev = TestHelper::SetupFrame(thread, emptyObjCallInfo2.get()); + prev = TestHelper::SetupFrame(thread_, emptyObjCallInfo2.get()); JSTaggedValue result_nw = BuiltinsObject::IsFrozen(emptyObjCallInfo2.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_EQ(result_nw.GetRawData(), JSTaggedValue::False().GetRawData()); desc_enum.SetConfigurable(false); obj->GetJSHClass()->SetExtensible(true); - JSTaggedValue::DefinePropertyOrThrow(thread, JSHandle(obj), key, desc_enum); + JSTaggedValue::DefinePropertyOrThrow(thread_, JSHandle(obj), key, desc_enum); obj->GetJSHClass()->SetExtensible(false); - auto emptyObjCallInfo3 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto emptyObjCallInfo3 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); emptyObjCallInfo3->SetFunction(JSTaggedValue::Undefined()); emptyObjCallInfo3->SetThis(JSTaggedValue::Undefined()); emptyObjCallInfo3->SetCallArg(0, obj.GetTaggedValue()); - prev = TestHelper::SetupFrame(thread, emptyObjCallInfo3.get()); + prev = TestHelper::SetupFrame(thread_, emptyObjCallInfo3.get()); JSTaggedValue result_nc = BuiltinsObject::IsFrozen(emptyObjCallInfo3.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_EQ(result_nc.GetRawData(), JSTaggedValue::True().GetRawData()); } @@ -837,20 +837,20 @@ TEST_F(BuiltinsObjectTest, IsFrozen) // 19.1.2.13 Object.isSealed ( O ) TEST_F(BuiltinsObjectTest, IsSealed) { - JSHandle function(thread, BuiltinsObjectTestCreate(thread)); + JSHandle function(thread_, BuiltinsObjectTestCreate(thread_)); // An object is extensible by default, so it is also non-frozen. JSHandle emptyObj = - thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(function), function); + thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(function), function); emptyObj->GetJSHClass()->SetExtensible(true); - auto emptyObjCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto emptyObjCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); emptyObjCallInfo->SetFunction(JSTaggedValue::Undefined()); emptyObjCallInfo->SetThis(JSTaggedValue::Undefined()); emptyObjCallInfo->SetCallArg(0, emptyObj.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, emptyObjCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, emptyObjCallInfo.get()); JSTaggedValue result = BuiltinsObject::IsSealed(emptyObjCallInfo.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_EQ(result.GetRawData(), JSTaggedValue::False().GetRawData()); } @@ -858,15 +858,15 @@ TEST_F(BuiltinsObjectTest, IsSealed) // Object.keys(obj) TEST_F(BuiltinsObjectTest, Keys) { - JSHandle obj(thread, CreateBuiltinJSObject(thread, "x")); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + JSHandle obj(thread_, CreateBuiltinJSObject(thread_, "x")); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetCallArg(0, obj.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsObject::Keys(ecmaRuntimeCallInfo.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_TRUE(result.IsECMAObject()); } @@ -874,33 +874,33 @@ TEST_F(BuiltinsObjectTest, Keys) // Object.preventExtensions(obj) TEST_F(BuiltinsObjectTest, PreventExtensions) { - JSHandle obj = JSHandle(thread, CreateBuiltinJSObject(thread, "x")); + JSHandle obj = JSHandle(thread_, CreateBuiltinJSObject(thread_, "x")); obj->GetJSHClass()->SetExtensible(true); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetCallArg(0, obj.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsObject::PreventExtensions(ecmaRuntimeCallInfo.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_TRUE(result.IsECMAObject()); JSTaggedValue jt(reinterpret_cast(result.GetRawData())); - JSHandle jtHandle(thread, jt); + JSHandle jtHandle(thread_, jt); ASSERT_TRUE(!jtHandle->IsExtensible()); } // Object.seal(obj) TEST_F(BuiltinsObjectTest, Seal) { - JSHandle obj(thread, CreateBuiltinJSObject(thread, "x")); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + JSHandle obj(thread_, CreateBuiltinJSObject(thread_, "x")); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetCallArg(0, obj.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsObject::Seal(ecmaRuntimeCallInfo.get()); ASSERT_TRUE(result.IsECMAObject()); @@ -908,77 +908,77 @@ TEST_F(BuiltinsObjectTest, Seal) // test isSealed(). JSTaggedValue res = BuiltinsObject::IsSealed(ecmaRuntimeCallInfo.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_EQ(res.GetRawData(), JSTaggedValue::True().GetRawData()); } // Object.setPrototypeOf(obj, prototype) TEST_F(BuiltinsObjectTest, SetPrototypeOf) { - JSHandle obj(thread, CreateBuiltinJSObject(thread, "x")); - JSHandle objFather(thread, CreateBuiltinJSObject(thread, "y")); + JSHandle obj(thread_, CreateBuiltinJSObject(thread_, "x")); + JSHandle objFather(thread_, CreateBuiltinJSObject(thread_, "y")); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetCallArg(0, obj.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(1, objFather.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsObject::SetPrototypeOf(ecmaRuntimeCallInfo.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_TRUE(result.IsECMAObject()); ASSERT_EQ(result.GetRawData(), obj.GetTaggedValue().GetRawData()); // test obj has property "y". - JSHandle key(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("y")); - EXPECT_EQ(JSObject::GetProperty(thread, JSHandle(obj), key).GetValue()->GetInt(), 1); + JSHandle key(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("y")); + EXPECT_EQ(JSObject::GetProperty(thread_, JSHandle(obj), key).GetValue()->GetInt(), 1); } // Object.values(obj) TEST_F(BuiltinsObjectTest, Values) { - JSHandle obj(thread, CreateBuiltinJSObject(thread, "x")); - JSHandle key(thread->GetEcmaVM()->GetFactory()->NewFromString("y")); - JSHandle value(thread, JSTaggedValue(22)); + JSHandle obj(thread_, CreateBuiltinJSObject(thread_, "x")); + JSHandle key(thread_->GetEcmaVM()->GetFactory()->NewFromString("y")); + JSHandle value(thread_, JSTaggedValue(22)); - JSObject::SetProperty(thread, obj, key, value); + JSObject::SetProperty(thread_, obj, key, value); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetCallArg(0, obj.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsObject::Values(ecmaRuntimeCallInfo.get()); EXPECT_TRUE(result.IsECMAObject()); - JSHandle handle(thread, result); - JSHandle index0(thread, JSTaggedValue(0)); - JSHandle index1(thread, JSTaggedValue(1)); + JSHandle handle(thread_, result); + JSHandle index0(thread_, JSTaggedValue(0)); + JSHandle index1(thread_, JSTaggedValue(1)); - ASSERT_EQ(JSObject::GetProperty(thread, JSHandle(handle), index0).GetValue()->GetInt(), 1); - ASSERT_EQ(JSObject::GetProperty(thread, JSHandle(handle), index1).GetValue()->GetInt(), 22); + ASSERT_EQ(JSObject::GetProperty(thread_, JSHandle(handle), index0).GetValue()->GetInt(), 1); + ASSERT_EQ(JSObject::GetProperty(thread_, JSHandle(handle), index1).GetValue()->GetInt(), 22); } // obj.hasOwnProperty(prop) TEST_F(BuiltinsObjectTest, HasOwnProperty) { - JSHandle obj(thread, CreateBuiltinJSObject(thread, "x")); + JSHandle obj(thread_, CreateBuiltinJSObject(thread_, "x")); CString keyCStr = "x"; - JSHandle keyString = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(&keyCStr[0]); + JSHandle keyString = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(&keyCStr[0]); JSHandle key(keyString); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(obj.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, key.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsObject::HasOwnProperty(ecmaRuntimeCallInfo.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_EQ(result.GetRawData(), JSTaggedValue::True().GetRawData()); } @@ -986,47 +986,47 @@ TEST_F(BuiltinsObjectTest, HasOwnProperty) // prototypeObj.isPrototypeOf(object) TEST_F(BuiltinsObjectTest, IsPrototypeOfFalse) { - JSHandle obj(thread, CreateBuiltinJSObject(thread, "x")); - JSHandle objFather(thread, CreateBuiltinJSObject(thread, "y")); + JSHandle obj(thread_, CreateBuiltinJSObject(thread_, "x")); + JSHandle objFather(thread_, CreateBuiltinJSObject(thread_, "y")); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(objFather.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, obj.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result1 = BuiltinsObject::IsPrototypeOf(ecmaRuntimeCallInfo.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_EQ(result1.GetRawData(), JSTaggedValue::False().GetRawData()); } TEST_F(BuiltinsObjectTest, IsPrototypeOfTrue) { - JSHandle obj(thread, CreateBuiltinJSObject(thread, "x")); - JSHandle objFather(thread, CreateBuiltinJSObject(thread, "y")); + JSHandle obj(thread_, CreateBuiltinJSObject(thread_, "x")); + JSHandle objFather(thread_, CreateBuiltinJSObject(thread_, "y")); - auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); ecmaRuntimeCallInfo1->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo1->SetThis(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo1->SetCallArg(0, obj.GetTaggedValue()); ecmaRuntimeCallInfo1->SetCallArg(1, objFather.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); JSTaggedValue result1 = BuiltinsObject::SetPrototypeOf(ecmaRuntimeCallInfo1.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_TRUE(result1.IsObject()); ASSERT_EQ(result1.GetRawData(), obj->GetRawData()); - auto ecmaRuntimeCallInfo2 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto ecmaRuntimeCallInfo2 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo2->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo2->SetThis(objFather.GetTaggedValue()); ecmaRuntimeCallInfo2->SetCallArg(0, obj.GetTaggedValue()); - prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo2.get()); + prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo2.get()); JSTaggedValue result2 = BuiltinsObject::IsPrototypeOf(ecmaRuntimeCallInfo2.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_EQ(result2.GetRawData(), JSTaggedValue::True().GetRawData()); } @@ -1034,17 +1034,17 @@ TEST_F(BuiltinsObjectTest, IsPrototypeOfTrue) // obj.propertyIsEnumerable(prop) TEST_F(BuiltinsObjectTest, PropertyIsEnumerable) { - JSHandle obj(thread, CreateBuiltinJSObject(thread, "x")); - JSHandle key(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("x")); + JSHandle obj(thread_, CreateBuiltinJSObject(thread_, "x")); + JSHandle key(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("x")); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(obj.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, key.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsObject::PropertyIsEnumerable(ecmaRuntimeCallInfo.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_EQ(result.GetRawData(), JSTaggedValue::True().GetRawData()); } @@ -1052,23 +1052,24 @@ TEST_F(BuiltinsObjectTest, PropertyIsEnumerable) // obj.toLocaleString() TEST_F(BuiltinsObjectTest, ToLocaleString) { - JSHandle obj(thread, CreateBuiltinJSObject(thread, "x")); - JSHandle calleeFunc = thread->GetEcmaVM()->GetFactory()->NewJSFunction( - thread->GetEcmaVM()->GetGlobalEnv(), reinterpret_cast(BuiltinsObject::ToString)); + JSHandle obj(thread_, CreateBuiltinJSObject(thread_, "x")); + JSHandle calleeFunc = thread_->GetEcmaVM()->GetFactory()->NewJSFunction( + thread_->GetEcmaVM()->GetGlobalEnv(), reinterpret_cast(BuiltinsObject::ToString)); JSHandle calleeValue(calleeFunc); - JSHandle calleeKey(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("toString")); - JSObject::SetProperty(thread, obj, calleeKey, calleeValue); + JSHandle calleeKey(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("toString")); + JSObject::SetProperty(thread_, obj, calleeKey, calleeValue); - JSHandle resultValue = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("[object Object]"); + JSHandle resultValue = + thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("[object Object]"); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(obj.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, obj.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsObject::ToLocaleString(ecmaRuntimeCallInfo.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_TRUE(result.IsString()); ASSERT_EQ(resultValue->Compare(reinterpret_cast(result.GetRawData())), 0); @@ -1077,111 +1078,112 @@ TEST_F(BuiltinsObjectTest, ToLocaleString) // obj.toString() TEST_F(BuiltinsObjectTest, ToString) { - JSHandle obj = JSHandle(thread, CreateBuiltinJSObject(thread, "x")); + JSHandle obj = JSHandle(thread_, CreateBuiltinJSObject(thread_, "x")); // object - JSHandle resultValue = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("[object Object]"); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); + JSHandle resultValue = + thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("[object Object]"); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(obj.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsObject::ToString(ecmaRuntimeCallInfo.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_TRUE(result.IsString()); ASSERT_EQ(resultValue->Compare(reinterpret_cast(result.GetRawData())), 0); // array - JSHandle arr = thread->GetEcmaVM()->GetFactory()->NewJSArray(); + JSHandle arr = thread_->GetEcmaVM()->GetFactory()->NewJSArray(); JSHandle resultArrValue = - thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("[object Array]"); - auto arrEcmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); + thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("[object Array]"); + auto arrEcmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); arrEcmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); arrEcmaRuntimeCallInfo->SetThis(arr.GetTaggedValue()); - prev = TestHelper::SetupFrame(thread, arrEcmaRuntimeCallInfo.get()); + prev = TestHelper::SetupFrame(thread_, arrEcmaRuntimeCallInfo.get()); JSTaggedValue resultArr = BuiltinsObject::ToString(arrEcmaRuntimeCallInfo.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_TRUE(resultArr.IsString()); ASSERT_EQ(resultArrValue->Compare(reinterpret_cast(resultArr.GetRawData())), 0); // string - JSHandle str = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("hello"); + JSHandle str = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("hello"); JSHandle resultStrValue = - thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("[object String]"); - auto strEcmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); + thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("[object String]"); + auto strEcmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); strEcmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); strEcmaRuntimeCallInfo->SetThis(str.GetTaggedValue()); - prev = TestHelper::SetupFrame(thread, strEcmaRuntimeCallInfo.get()); + prev = TestHelper::SetupFrame(thread_, strEcmaRuntimeCallInfo.get()); JSTaggedValue resultStr = BuiltinsObject::ToString(strEcmaRuntimeCallInfo.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_TRUE(resultStr.IsString()); ASSERT_EQ(resultStrValue->Compare(reinterpret_cast(resultStr.GetRawData())), 0); // function - JSHandle func = thread->GetEcmaVM()->GetFactory()->NewJSFunction(thread->GetEcmaVM()->GetGlobalEnv()); + JSHandle func = thread_->GetEcmaVM()->GetFactory()->NewJSFunction(thread_->GetEcmaVM()->GetGlobalEnv()); JSHandle resultFuncValue = - thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("[object Function]"); - auto funcEcmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); + thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("[object Function]"); + auto funcEcmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); funcEcmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); funcEcmaRuntimeCallInfo->SetThis(func.GetTaggedValue()); - prev = TestHelper::SetupFrame(thread, funcEcmaRuntimeCallInfo.get()); + prev = TestHelper::SetupFrame(thread_, funcEcmaRuntimeCallInfo.get()); JSTaggedValue resultFunc = BuiltinsObject::ToString(funcEcmaRuntimeCallInfo.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_TRUE(resultFunc.IsString()); ASSERT_EQ(resultFuncValue->Compare(reinterpret_cast(resultFunc.GetRawData())), 0); // error - auto ecmaVM = thread->GetEcmaVM(); + auto ecmaVM = thread_->GetEcmaVM(); JSHandle env = ecmaVM->GetGlobalEnv(); JSHandle errorObject = env->GetErrorFunction(); JSHandle error = - thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(errorObject), errorObject); - JSHandle errorValue = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("[object Error]"); - auto errorEcmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); + thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(errorObject), errorObject); + JSHandle errorValue = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("[object Error]"); + auto errorEcmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); errorEcmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); errorEcmaRuntimeCallInfo->SetThis(error.GetTaggedValue()); - prev = TestHelper::SetupFrame(thread, errorEcmaRuntimeCallInfo.get()); + prev = TestHelper::SetupFrame(thread_, errorEcmaRuntimeCallInfo.get()); JSTaggedValue resultError = BuiltinsObject::ToString(errorEcmaRuntimeCallInfo.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_TRUE(resultError.IsString()); ASSERT_EQ(errorValue->Compare(reinterpret_cast(resultError.GetRawData())), 0); // boolean - JSHandle value(thread, JSTaggedValue::False()); + JSHandle value(thread_, JSTaggedValue::False()); JSHandle booleanObject(env->GetBooleanFunction()); - JSHandle boolean = thread->GetEcmaVM()->GetFactory()->NewJSPrimitiveRef(booleanObject, value); + JSHandle boolean = thread_->GetEcmaVM()->GetFactory()->NewJSPrimitiveRef(booleanObject, value); JSHandle resultBoolValue = - thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("[object Boolean]"); - auto boolEcmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); + thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("[object Boolean]"); + auto boolEcmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); boolEcmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); boolEcmaRuntimeCallInfo->SetThis(boolean.GetTaggedValue()); - prev = TestHelper::SetupFrame(thread, boolEcmaRuntimeCallInfo.get()); + prev = TestHelper::SetupFrame(thread_, boolEcmaRuntimeCallInfo.get()); JSTaggedValue resultBool = BuiltinsObject::ToString(boolEcmaRuntimeCallInfo.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_TRUE(resultBool.IsString()); ASSERT_EQ(resultBoolValue->Compare(reinterpret_cast(resultBool.GetRawData())), 0); // number JSHandle resultNumValue = - thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("[object Number]"); - auto numEcmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); + thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("[object Number]"); + auto numEcmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); numEcmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); numEcmaRuntimeCallInfo->SetThis(JSTaggedValue(static_cast(0))); - prev = TestHelper::SetupFrame(thread, numEcmaRuntimeCallInfo.get()); + prev = TestHelper::SetupFrame(thread_, numEcmaRuntimeCallInfo.get()); JSTaggedValue resultNum = BuiltinsObject::ToString(numEcmaRuntimeCallInfo.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_TRUE(resultNum.IsString()); ASSERT_EQ(resultNumValue->Compare(reinterpret_cast(resultNum.GetRawData())), 0); @@ -1190,15 +1192,15 @@ TEST_F(BuiltinsObjectTest, ToString) // object.valueOf() TEST_F(BuiltinsObjectTest, ValueOf) { - JSHandle obj(thread, CreateBuiltinJSObject(thread, "x")); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + JSHandle obj(thread_, CreateBuiltinJSObject(thread_, "x")); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(obj.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, obj.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsObject::ValueOf(ecmaRuntimeCallInfo.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_TRUE(result.IsECMAObject()); } diff --git a/tests/runtime/builtins/builtins_promise_test.cpp b/tests/runtime/builtins/builtins_promise_test.cpp index b924f244aaa149d37ac0cb940f24b8838c45543e..5d4902b3657d066317027a53e3ab250903d3e5bc 100644 --- a/tests/runtime/builtins/builtins_promise_test.cpp +++ b/tests/runtime/builtins/builtins_promise_test.cpp @@ -49,17 +49,17 @@ public: void SetUp() override { - TestHelper::CreateEcmaVMWithScope(instance, thread, scope); + TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); } void TearDown() override { - TestHelper::DestroyEcmaVMWithScope(instance, scope); + TestHelper::DestroyEcmaVMWithScope(instance_, scope_); } - PandaVM *instance {nullptr}; - EcmaHandleScope *scope {nullptr}; - JSThread *thread {nullptr}; + PandaVM *instance_ {nullptr}; + EcmaHandleScope *scope_ {nullptr}; + JSThread *thread_ {nullptr}; }; // native function for race2 then_on_rejected() @@ -128,12 +128,12 @@ JSTaggedValue TestPromiseThenOnRejected(EcmaRuntimeCallInfo *argv) */ TEST_F(BuiltinsPromiseTest, Reject1) { - JSHandle env = EcmaVM::Cast(instance)->GetGlobalEnv(); + JSHandle env = EcmaVM::Cast(instance_)->GetGlobalEnv(); JSHandle promise = JSHandle::Cast(env->GetPromiseFunction()); - JSHandle paramMsg(thread, JSTaggedValue(3)); + JSHandle paramMsg(thread_, JSTaggedValue(3)); - auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue(*promise), 6); + auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue(*promise), 6); ecmaRuntimeCallInfo1->SetFunction(promise.GetTaggedValue()); ecmaRuntimeCallInfo1->SetThis(promise.GetTaggedValue()); ecmaRuntimeCallInfo1->SetCallArg(0, paramMsg.GetTaggedValue()); @@ -141,9 +141,9 @@ TEST_F(BuiltinsPromiseTest, Reject1) /** * @tc.steps: var p1 = Promise.reject(3). */ - [[maybe_unused]] auto prevReject = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); + [[maybe_unused]] auto prevReject = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); JSTaggedValue result = BuiltinsPromise::Reject(ecmaRuntimeCallInfo1.get()); - JSHandle rejectPromise(thread, result); + JSHandle rejectPromise(thread_, result); EXPECT_EQ(JSTaggedValue::SameValue(rejectPromise->GetPromiseState(), JSTaggedValue(static_cast(PromiseStatus::REJECTED))), true); @@ -157,8 +157,8 @@ TEST_F(BuiltinsPromiseTest, Reject1) */ TEST_F(BuiltinsPromiseTest, Reject2) { - ObjectFactory *factory = EcmaVM::Cast(instance)->GetFactory(); - JSHandle env = EcmaVM::Cast(instance)->GetGlobalEnv(); + ObjectFactory *factory = EcmaVM::Cast(instance_)->GetFactory(); + JSHandle env = EcmaVM::Cast(instance_)->GetGlobalEnv(); // constructor promise1 JSHandle promise = JSHandle::Cast(env->GetPromiseFunction()); @@ -168,14 +168,14 @@ TEST_F(BuiltinsPromiseTest, Reject2) /** * @tc.steps: step1. var p1 = Promise.reject("Promise reject") */ - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, promise.GetTaggedValue(), 6); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, promise.GetTaggedValue(), 6); ecmaRuntimeCallInfo->SetFunction(promise.GetTaggedValue()); ecmaRuntimeCallInfo->SetThis(promise.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, paramMsg1.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsPromise::Reject(ecmaRuntimeCallInfo.get()); - JSHandle promise1(thread, result); + JSHandle promise1(thread_, result); EXPECT_EQ(JSTaggedValue::SameValue(promise1->GetPromiseState(), JSTaggedValue(static_cast(PromiseStatus::REJECTED))), true); @@ -184,14 +184,14 @@ TEST_F(BuiltinsPromiseTest, Reject2) /** * @tc.steps: step2. var p2 = Promise.reject(p1) */ - auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, promise.GetTaggedValue(), 6); + auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, promise.GetTaggedValue(), 6); ecmaRuntimeCallInfo1->SetFunction(promise.GetTaggedValue()); ecmaRuntimeCallInfo1->SetThis(promise.GetTaggedValue()); ecmaRuntimeCallInfo1->SetCallArg(0, promise1.GetTaggedValue()); - [[maybe_unused]] auto prev1 = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); + [[maybe_unused]] auto prev1 = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); JSTaggedValue result1 = BuiltinsPromise::Reject(ecmaRuntimeCallInfo1.get()); - JSHandle promise2(thread, result1); + JSHandle promise2(thread_, result1); EXPECT_NE(*promise1, *promise2); EXPECT_EQ(JSTaggedValue::SameValue(promise2->GetPromiseState(), JSTaggedValue(static_cast(PromiseStatus::REJECTED))), @@ -208,22 +208,22 @@ TEST_F(BuiltinsPromiseTest, Reject2) */ TEST_F(BuiltinsPromiseTest, Resolve1) { - JSHandle env = EcmaVM::Cast(instance)->GetGlobalEnv(); + JSHandle env = EcmaVM::Cast(instance_)->GetGlobalEnv(); JSHandle promise = JSHandle::Cast(env->GetPromiseFunction()); - JSHandle paramMsg(thread, JSTaggedValue(5)); + JSHandle paramMsg(thread_, JSTaggedValue(5)); /** * @tc.steps: step1. var p1 = Promise.resolve(12345) */ - auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue(*promise), 6); + auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue(*promise), 6); ecmaRuntimeCallInfo1->SetFunction(promise.GetTaggedValue()); ecmaRuntimeCallInfo1->SetThis(promise.GetTaggedValue()); ecmaRuntimeCallInfo1->SetCallArg(0, paramMsg.GetTaggedValue()); - [[maybe_unused]] auto prevReject = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); + [[maybe_unused]] auto prevReject = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); JSTaggedValue result = BuiltinsPromise::Resolve(ecmaRuntimeCallInfo1.get()); - JSHandle rejectPromise(thread, result); + JSHandle rejectPromise(thread_, result); EXPECT_EQ(JSTaggedValue::SameValue(rejectPromise->GetPromiseState(), JSTaggedValue(static_cast(PromiseStatus::FULFILLED))), true); @@ -237,8 +237,8 @@ TEST_F(BuiltinsPromiseTest, Resolve1) */ TEST_F(BuiltinsPromiseTest, Resolve2) { - ObjectFactory *factory = EcmaVM::Cast(instance)->GetFactory(); - JSHandle env = EcmaVM::Cast(instance)->GetGlobalEnv(); + ObjectFactory *factory = EcmaVM::Cast(instance_)->GetFactory(); + JSHandle env = EcmaVM::Cast(instance_)->GetGlobalEnv(); // constructor promise1 JSHandle promise = JSHandle::Cast(env->GetPromiseFunction()); @@ -248,14 +248,14 @@ TEST_F(BuiltinsPromiseTest, Resolve2) /** * @tc.steps: step1. var p1 = Promise.reject("Promise reject") */ - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, promise.GetTaggedValue(), 6); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, promise.GetTaggedValue(), 6); ecmaRuntimeCallInfo->SetFunction(promise.GetTaggedValue()); ecmaRuntimeCallInfo->SetThis(promise.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, paramMsg1.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsPromise::Reject(ecmaRuntimeCallInfo.get()); - JSHandle promise1(thread, result); + JSHandle promise1(thread_, result); EXPECT_EQ(JSTaggedValue::SameValue(promise1->GetPromiseState(), JSTaggedValue(static_cast(PromiseStatus::REJECTED))), true); @@ -265,14 +265,14 @@ TEST_F(BuiltinsPromiseTest, Resolve2) /** * @tc.steps: step2. var p2 = Promise.resolve(p1) */ - auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, promise.GetTaggedValue(), 6); + auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, promise.GetTaggedValue(), 6); ecmaRuntimeCallInfo1->SetFunction(promise.GetTaggedValue()); ecmaRuntimeCallInfo1->SetThis(promise.GetTaggedValue()); ecmaRuntimeCallInfo1->SetCallArg(0, promise1.GetTaggedValue()); - [[maybe_unused]] auto prev1 = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); + [[maybe_unused]] auto prev1 = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); JSTaggedValue result1 = BuiltinsPromise::Resolve(ecmaRuntimeCallInfo1.get()); - JSHandle promise2(thread, result1); + JSHandle promise2(thread_, result1); EXPECT_EQ(*promise1, *promise2); EXPECT_EQ(JSTaggedValue::SameValue(promise2->GetPromiseState(), JSTaggedValue(static_cast(PromiseStatus::REJECTED))), @@ -287,23 +287,23 @@ TEST_F(BuiltinsPromiseTest, Resolve2) */ TEST_F(BuiltinsPromiseTest, Race1) { - JSHandle env = EcmaVM::Cast(instance)->GetGlobalEnv(); + JSHandle env = EcmaVM::Cast(instance_)->GetGlobalEnv(); JSHandle promise = JSHandle::Cast(env->GetPromiseFunction()); - JSHandle paramMsg1(thread, JSTaggedValue(12345)); - JSHandle paramMsg2(thread, JSTaggedValue(6789)); + JSHandle paramMsg1(thread_, JSTaggedValue(12345)); + JSHandle paramMsg2(thread_, JSTaggedValue(6789)); /** * @tc.steps: step1. var p1 = Promise.reject(12345) */ - auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue(*promise), 6); + auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue(*promise), 6); ecmaRuntimeCallInfo1->SetFunction(promise.GetTaggedValue()); ecmaRuntimeCallInfo1->SetThis(promise.GetTaggedValue()); ecmaRuntimeCallInfo1->SetCallArg(0, paramMsg1.GetTaggedValue()); - [[maybe_unused]] auto prevReject = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); + [[maybe_unused]] auto prevReject = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); JSTaggedValue result1 = BuiltinsPromise::Reject(ecmaRuntimeCallInfo1.get()); - JSHandle rejectPromise(thread, result1); + JSHandle rejectPromise(thread_, result1); EXPECT_EQ(JSTaggedValue::SameValue(rejectPromise->GetPromiseState(), JSTaggedValue(static_cast(PromiseStatus::REJECTED))), true); @@ -312,14 +312,14 @@ TEST_F(BuiltinsPromiseTest, Race1) /** * @tc.steps: step2. var p2 = Promise.resolve(6789) */ - auto ecmaRuntimeCallInfo2 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue(*promise), 6); + auto ecmaRuntimeCallInfo2 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue(*promise), 6); ecmaRuntimeCallInfo2->SetFunction(promise.GetTaggedValue()); ecmaRuntimeCallInfo2->SetThis(promise.GetTaggedValue()); ecmaRuntimeCallInfo2->SetCallArg(0, paramMsg2.GetTaggedValue()); - [[maybe_unused]] auto prevResolve = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo2.get()); + [[maybe_unused]] auto prevResolve = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo2.get()); JSTaggedValue result2 = BuiltinsPromise::Resolve(ecmaRuntimeCallInfo2.get()); - JSHandle resolvePromise(thread, result2); + JSHandle resolvePromise(thread_, result2); EXPECT_EQ(JSTaggedValue::SameValue(resolvePromise->GetPromiseState(), JSTaggedValue(static_cast(PromiseStatus::FULFILLED))), true); @@ -328,24 +328,24 @@ TEST_F(BuiltinsPromiseTest, Race1) /** * @tc.steps: step3. Construct an array with two elements p1 and p2. array = [p1. p2] */ - JSHandle array(JSArray::ArrayCreate(thread, JSTaggedNumber(2))); - PropertyDescriptor desc(thread, JSHandle::Cast(rejectPromise)); - JSArray::DefineOwnProperty(thread, array, JSHandle(thread, JSTaggedValue(0)), desc); + JSHandle array(JSArray::ArrayCreate(thread_, JSTaggedNumber(2))); + PropertyDescriptor desc(thread_, JSHandle::Cast(rejectPromise)); + JSArray::DefineOwnProperty(thread_, array, JSHandle(thread_, JSTaggedValue(0)), desc); - PropertyDescriptor desc1(thread, JSHandle::Cast(resolvePromise)); - JSArray::DefineOwnProperty(thread, array, JSHandle(thread, JSTaggedValue(1)), desc1); + PropertyDescriptor desc1(thread_, JSHandle::Cast(resolvePromise)); + JSArray::DefineOwnProperty(thread_, array, JSHandle(thread_, JSTaggedValue(1)), desc1); /** * @tc.steps: step4. var p3 = Promise.race([p1,p2]); */ - auto ecmaRuntimeCallInfo4 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue(*promise), 6); + auto ecmaRuntimeCallInfo4 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue(*promise), 6); ecmaRuntimeCallInfo4->SetFunction(promise.GetTaggedValue()); ecmaRuntimeCallInfo4->SetThis(promise.GetTaggedValue()); ecmaRuntimeCallInfo4->SetCallArg(0, array.GetTaggedValue()); - [[maybe_unused]] auto prev4 = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo4.get()); + [[maybe_unused]] auto prev4 = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo4.get()); JSTaggedValue result4 = BuiltinsPromise::Race(ecmaRuntimeCallInfo4.get()); - JSHandle racePromise(thread, result4); + JSHandle racePromise(thread_, result4); EXPECT_EQ(JSTaggedValue::SameValue(racePromise->GetPromiseState(), JSTaggedValue(static_cast(PromiseStatus::PENDING))), true); @@ -360,24 +360,24 @@ TEST_F(BuiltinsPromiseTest, Race1) */ TEST_F(BuiltinsPromiseTest, Race2) { - ObjectFactory *factory = EcmaVM::Cast(instance)->GetFactory(); - JSHandle env = EcmaVM::Cast(instance)->GetGlobalEnv(); + ObjectFactory *factory = EcmaVM::Cast(instance_)->GetFactory(); + JSHandle env = EcmaVM::Cast(instance_)->GetGlobalEnv(); JSHandle promise = JSHandle::Cast(env->GetPromiseFunction()); - JSHandle paramMsg1(thread, JSTaggedValue(12345)); - JSHandle paramMsg2(thread, JSTaggedValue(6789)); + JSHandle paramMsg1(thread_, JSTaggedValue(12345)); + JSHandle paramMsg2(thread_, JSTaggedValue(6789)); /** * @tc.steps: step1. var p1 = Promise.reject(12345) */ - auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue(*promise), 6); + auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue(*promise), 6); ecmaRuntimeCallInfo1->SetFunction(promise.GetTaggedValue()); ecmaRuntimeCallInfo1->SetThis(promise.GetTaggedValue()); ecmaRuntimeCallInfo1->SetCallArg(0, paramMsg1.GetTaggedValue()); - [[maybe_unused]] auto prevReject = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); + [[maybe_unused]] auto prevReject = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); JSTaggedValue result1 = BuiltinsPromise::Reject(ecmaRuntimeCallInfo1.get()); - JSHandle rejectPromise(thread, result1); + JSHandle rejectPromise(thread_, result1); EXPECT_EQ(JSTaggedValue::SameValue(rejectPromise->GetPromiseState(), JSTaggedValue(static_cast(PromiseStatus::REJECTED))), true); @@ -386,14 +386,14 @@ TEST_F(BuiltinsPromiseTest, Race2) /** * @tc.steps: step2. var p2 = Promise.resolve(6789) */ - auto ecmaRuntimeCallInfo2 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue(*promise), 6); + auto ecmaRuntimeCallInfo2 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue(*promise), 6); ecmaRuntimeCallInfo2->SetFunction(promise.GetTaggedValue()); ecmaRuntimeCallInfo2->SetThis(promise.GetTaggedValue()); ecmaRuntimeCallInfo2->SetCallArg(0, paramMsg2.GetTaggedValue()); - [[maybe_unused]] auto prevResolve = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo2.get()); + [[maybe_unused]] auto prevResolve = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo2.get()); JSTaggedValue result2 = BuiltinsPromise::Resolve(ecmaRuntimeCallInfo2.get()); - JSHandle resolvePromise(thread, result2); + JSHandle resolvePromise(thread_, result2); EXPECT_EQ(JSTaggedValue::SameValue(resolvePromise->GetPromiseState(), JSTaggedValue(static_cast(PromiseStatus::FULFILLED))), true); @@ -402,24 +402,24 @@ TEST_F(BuiltinsPromiseTest, Race2) /** * @tc.steps: step3. Construct an array with two elements p1 and p2. array = [p1. p2] */ - JSHandle array(JSArray::ArrayCreate(thread, JSTaggedNumber(2))); - PropertyDescriptor desc(thread, JSHandle::Cast(rejectPromise)); - JSArray::DefineOwnProperty(thread, array, JSHandle(thread, JSTaggedValue(0)), desc); + JSHandle array(JSArray::ArrayCreate(thread_, JSTaggedNumber(2))); + PropertyDescriptor desc(thread_, JSHandle::Cast(rejectPromise)); + JSArray::DefineOwnProperty(thread_, array, JSHandle(thread_, JSTaggedValue(0)), desc); - PropertyDescriptor desc1(thread, JSHandle::Cast(resolvePromise)); - JSArray::DefineOwnProperty(thread, array, JSHandle(thread, JSTaggedValue(1)), desc1); + PropertyDescriptor desc1(thread_, JSHandle::Cast(resolvePromise)); + JSArray::DefineOwnProperty(thread_, array, JSHandle(thread_, JSTaggedValue(1)), desc1); /** * @tc.steps: step4. var p3 = Promise.race([p1,p2]); */ - auto ecmaRuntimeCallInfo4 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue(*promise), 6); + auto ecmaRuntimeCallInfo4 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue(*promise), 6); ecmaRuntimeCallInfo4->SetFunction(promise.GetTaggedValue()); ecmaRuntimeCallInfo4->SetThis(promise.GetTaggedValue()); ecmaRuntimeCallInfo4->SetCallArg(0, array.GetTaggedValue()); - [[maybe_unused]] auto prev4 = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo4.get()); + [[maybe_unused]] auto prev4 = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo4.get()); JSTaggedValue result4 = BuiltinsPromise::Race(ecmaRuntimeCallInfo4.get()); - JSHandle racePromise(thread, result4); + JSHandle racePromise(thread_, result4); EXPECT_EQ(JSTaggedValue::SameValue(racePromise->GetPromiseState(), JSTaggedValue(static_cast(PromiseStatus::PENDING))), true); @@ -430,15 +430,15 @@ TEST_F(BuiltinsPromiseTest, Race2) */ JSHandle native_func_race_then_onrejected = factory->NewJSFunction(env, reinterpret_cast(TestPromiseRaceThenOnRejectd)); - auto ecmaRuntimeCallInfo5 = TestHelper::CreateEcmaRuntimeCallInfo(thread, racePromise.GetTaggedValue(), 8); + auto ecmaRuntimeCallInfo5 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, racePromise.GetTaggedValue(), 8); ecmaRuntimeCallInfo5->SetFunction(racePromise.GetTaggedValue()); ecmaRuntimeCallInfo5->SetThis(racePromise.GetTaggedValue()); ecmaRuntimeCallInfo5->SetCallArg(0, JSTaggedValue::Undefined()); ecmaRuntimeCallInfo5->SetCallArg(1, native_func_race_then_onrejected.GetTaggedValue()); - [[maybe_unused]] auto prev5 = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo5.get()); + [[maybe_unused]] auto prev5 = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo5.get()); JSTaggedValue thenResult = BuiltinsPromise::Then(ecmaRuntimeCallInfo5.get()); - JSHandle thenPromise(thread, thenResult); + JSHandle thenPromise(thread_, thenResult); EXPECT_TRUE(JSTaggedValue::SameValue(thenPromise->GetPromiseState(), JSTaggedValue(static_cast(PromiseStatus::PENDING)))); @@ -447,9 +447,9 @@ TEST_F(BuiltinsPromiseTest, Race2) /** * @tc.steps: step6. execute promise queue */ - auto microJobQueue = EcmaVM::Cast(instance)->GetMicroJobQueue(); - if (!thread->HasPendingException()) { - job::MicroJobQueue::ExecutePendingJob(thread, microJobQueue); + auto microJobQueue = EcmaVM::Cast(instance_)->GetMicroJobQueue(); + if (!thread_->HasPendingException()) { + job::MicroJobQueue::ExecutePendingJob(thread_, microJobQueue); } } @@ -461,24 +461,24 @@ TEST_F(BuiltinsPromiseTest, Race2) */ TEST_F(BuiltinsPromiseTest, All) { - ObjectFactory *factory = EcmaVM::Cast(instance)->GetFactory(); - JSHandle env = EcmaVM::Cast(instance)->GetGlobalEnv(); + ObjectFactory *factory = EcmaVM::Cast(instance_)->GetFactory(); + JSHandle env = EcmaVM::Cast(instance_)->GetGlobalEnv(); JSHandle promise = JSHandle::Cast(env->GetPromiseFunction()); - JSHandle paramMsg1(thread, JSTaggedValue(111)); - JSHandle paramMsg2(thread, JSTaggedValue(222)); + JSHandle paramMsg1(thread_, JSTaggedValue(111)); + JSHandle paramMsg2(thread_, JSTaggedValue(222)); /** * @tc.steps: step1. var p1 = Promise.resolve(111) */ - auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue(*promise), 6); + auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue(*promise), 6); ecmaRuntimeCallInfo1->SetFunction(promise.GetTaggedValue()); ecmaRuntimeCallInfo1->SetThis(promise.GetTaggedValue()); ecmaRuntimeCallInfo1->SetCallArg(0, paramMsg1.GetTaggedValue()); - [[maybe_unused]] auto prevReject = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); + [[maybe_unused]] auto prevReject = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); JSTaggedValue result1 = BuiltinsPromise::Resolve(ecmaRuntimeCallInfo1.get()); - JSHandle resolvePromise1(thread, result1); + JSHandle resolvePromise1(thread_, result1); EXPECT_EQ(JSTaggedValue::SameValue(resolvePromise1->GetPromiseState(), JSTaggedValue(static_cast(PromiseStatus::FULFILLED))), true); @@ -487,14 +487,14 @@ TEST_F(BuiltinsPromiseTest, All) /** * @tc.steps: step2. var p2 = Promise.resolve(222) */ - auto ecmaRuntimeCallInfo2 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue(*promise), 6); + auto ecmaRuntimeCallInfo2 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue(*promise), 6); ecmaRuntimeCallInfo2->SetFunction(promise.GetTaggedValue()); ecmaRuntimeCallInfo2->SetThis(promise.GetTaggedValue()); ecmaRuntimeCallInfo2->SetCallArg(0, paramMsg2.GetTaggedValue()); - [[maybe_unused]] auto prevResolve = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo2.get()); + [[maybe_unused]] auto prevResolve = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo2.get()); JSTaggedValue result2 = BuiltinsPromise::Resolve(ecmaRuntimeCallInfo2.get()); - JSHandle resolvePromise2(thread, result2); + JSHandle resolvePromise2(thread_, result2); EXPECT_EQ(JSTaggedValue::SameValue(resolvePromise2->GetPromiseState(), JSTaggedValue(static_cast(PromiseStatus::FULFILLED))), true); @@ -503,24 +503,24 @@ TEST_F(BuiltinsPromiseTest, All) /** * @tc.steps: step3. Construct an array with two elements p1 and p2. array = [p1. p2] */ - JSHandle array(JSArray::ArrayCreate(thread, JSTaggedNumber(2))); - PropertyDescriptor desc(thread, JSHandle::Cast(resolvePromise1)); - JSArray::DefineOwnProperty(thread, array, JSHandle(thread, JSTaggedValue(0)), desc); + JSHandle array(JSArray::ArrayCreate(thread_, JSTaggedNumber(2))); + PropertyDescriptor desc(thread_, JSHandle::Cast(resolvePromise1)); + JSArray::DefineOwnProperty(thread_, array, JSHandle(thread_, JSTaggedValue(0)), desc); - PropertyDescriptor desc1(thread, JSHandle::Cast(resolvePromise2)); - JSArray::DefineOwnProperty(thread, array, JSHandle(thread, JSTaggedValue(1)), desc1); + PropertyDescriptor desc1(thread_, JSHandle::Cast(resolvePromise2)); + JSArray::DefineOwnProperty(thread_, array, JSHandle(thread_, JSTaggedValue(1)), desc1); /** * @tc.steps: step4. var p3 = Promise.all([p1,p2]); */ - auto ecmaRuntimeCallInfo4 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue(*promise), 6); + auto ecmaRuntimeCallInfo4 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue(*promise), 6); ecmaRuntimeCallInfo4->SetFunction(promise.GetTaggedValue()); ecmaRuntimeCallInfo4->SetThis(promise.GetTaggedValue()); ecmaRuntimeCallInfo4->SetCallArg(0, array.GetTaggedValue()); - [[maybe_unused]] auto prev4 = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo4.get()); + [[maybe_unused]] auto prev4 = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo4.get()); JSTaggedValue result4 = BuiltinsPromise::All(ecmaRuntimeCallInfo4.get()); - JSHandle allPromise(thread, result4); + JSHandle allPromise(thread_, result4); EXPECT_EQ(JSTaggedValue::SameValue(allPromise->GetPromiseState(), JSTaggedValue(static_cast(PromiseStatus::PENDING))), true); @@ -531,15 +531,15 @@ TEST_F(BuiltinsPromiseTest, All) */ JSHandle nativeFuncRaceThenOnResolved = factory->NewJSFunction(env, reinterpret_cast(TestPromiseAllThenOnResolved)); - auto ecmaRuntimeCallInfo5 = TestHelper::CreateEcmaRuntimeCallInfo(thread, allPromise.GetTaggedValue(), 8); + auto ecmaRuntimeCallInfo5 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, allPromise.GetTaggedValue(), 8); ecmaRuntimeCallInfo5->SetFunction(allPromise.GetTaggedValue()); ecmaRuntimeCallInfo5->SetThis(allPromise.GetTaggedValue()); ecmaRuntimeCallInfo5->SetCallArg(0, nativeFuncRaceThenOnResolved.GetTaggedValue()); ecmaRuntimeCallInfo5->SetCallArg(1, nativeFuncRaceThenOnResolved.GetTaggedValue()); - [[maybe_unused]] auto prev5 = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo5.get()); + [[maybe_unused]] auto prev5 = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo5.get()); JSTaggedValue thenResult = BuiltinsPromise::Then(ecmaRuntimeCallInfo5.get()); - JSHandle thenPromise(thread, thenResult); + JSHandle thenPromise(thread_, thenResult); EXPECT_TRUE(JSTaggedValue::SameValue(thenPromise->GetPromiseState(), JSTaggedValue(static_cast(PromiseStatus::PENDING)))); @@ -548,9 +548,9 @@ TEST_F(BuiltinsPromiseTest, All) /** * @tc.steps: step6. execute promise queue */ - auto microJobQueue = EcmaVM::Cast(instance)->GetMicroJobQueue(); - if (!thread->HasPendingException()) { - job::MicroJobQueue::ExecutePendingJob(thread, microJobQueue); + auto microJobQueue = EcmaVM::Cast(instance_)->GetMicroJobQueue(); + if (!thread_->HasPendingException()) { + job::MicroJobQueue::ExecutePendingJob(thread_, microJobQueue); } } @@ -561,23 +561,23 @@ TEST_F(BuiltinsPromiseTest, All) */ TEST_F(BuiltinsPromiseTest, Catch) { - auto env = EcmaVM::Cast(instance)->GetGlobalEnv(); - auto factory = EcmaVM::Cast(instance)->GetFactory(); + auto env = EcmaVM::Cast(instance_)->GetGlobalEnv(); + auto factory = EcmaVM::Cast(instance_)->GetFactory(); JSHandle promise = JSHandle::Cast(env->GetPromiseFunction()); - JSHandle paramMsg1(thread, JSTaggedValue(3)); + JSHandle paramMsg1(thread_, JSTaggedValue(3)); /** * @tc.steps: step1. var p1 = Promise.reject(3) */ - auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue(*promise), 6); + auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue(*promise), 6); ecmaRuntimeCallInfo1->SetFunction(promise.GetTaggedValue()); ecmaRuntimeCallInfo1->SetThis(promise.GetTaggedValue()); ecmaRuntimeCallInfo1->SetCallArg(0, paramMsg1.GetTaggedValue()); - [[maybe_unused]] auto prevReject = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); + [[maybe_unused]] auto prevReject = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); JSTaggedValue result = BuiltinsPromise::Reject(ecmaRuntimeCallInfo1.get()); - JSHandle rejectPromise(thread, result); + JSHandle rejectPromise(thread_, result); EXPECT_EQ(JSTaggedValue::SameValue(rejectPromise->GetPromiseState(), JSTaggedValue(static_cast(PromiseStatus::REJECTED))), true); @@ -587,14 +587,14 @@ TEST_F(BuiltinsPromiseTest, Catch) * @tc.steps: step2. p1 invokes catch() */ JSHandle testPromiseCatch = factory->NewJSFunction(env, reinterpret_cast(TestPromiseCatch)); - auto ecmaRuntimeCallInfo2 = TestHelper::CreateEcmaRuntimeCallInfo(thread, rejectPromise.GetTaggedValue(), 6); + auto ecmaRuntimeCallInfo2 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, rejectPromise.GetTaggedValue(), 6); ecmaRuntimeCallInfo2->SetFunction(rejectPromise.GetTaggedValue()); ecmaRuntimeCallInfo2->SetThis(rejectPromise.GetTaggedValue()); ecmaRuntimeCallInfo2->SetCallArg(0, testPromiseCatch.GetTaggedValue()); - [[maybe_unused]] auto prevCatch = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo2.get()); + [[maybe_unused]] auto prevCatch = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo2.get()); JSTaggedValue catchResult = BuiltinsPromise::Catch(ecmaRuntimeCallInfo2.get()); - JSHandle catchPromise(thread, catchResult); + JSHandle catchPromise(thread_, catchResult); EXPECT_EQ(JSTaggedValue::SameValue(catchPromise->GetPromiseState(), JSTaggedValue(static_cast(PromiseStatus::PENDING))), @@ -604,9 +604,9 @@ TEST_F(BuiltinsPromiseTest, Catch) /** * @tc.steps: step3. execute promise queue */ - auto microJobQueue = EcmaVM::Cast(instance)->GetMicroJobQueue(); - if (!thread->HasPendingException()) { - job::MicroJobQueue::ExecutePendingJob(thread, microJobQueue); + auto microJobQueue = EcmaVM::Cast(instance_)->GetMicroJobQueue(); + if (!thread_->HasPendingException()) { + job::MicroJobQueue::ExecutePendingJob(thread_, microJobQueue); } } @@ -617,8 +617,8 @@ TEST_F(BuiltinsPromiseTest, Catch) */ TEST_F(BuiltinsPromiseTest, ThenResolve) { - auto env = EcmaVM::Cast(instance)->GetGlobalEnv(); - auto factory = EcmaVM::Cast(instance)->GetFactory(); + auto env = EcmaVM::Cast(instance_)->GetGlobalEnv(); + auto factory = EcmaVM::Cast(instance_)->GetFactory(); JSHandle promise = JSHandle::Cast(env->GetPromiseFunction()); JSHandle paramMsg = JSHandle::Cast(factory->NewFromCanBeCompressString("resolve")); @@ -626,14 +626,14 @@ TEST_F(BuiltinsPromiseTest, ThenResolve) /** * @tc.steps: step1. var p1 = Promise.resolve("resolve") */ - auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue(*promise), 6); + auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue(*promise), 6); ecmaRuntimeCallInfo1->SetFunction(promise.GetTaggedValue()); ecmaRuntimeCallInfo1->SetThis(promise.GetTaggedValue()); ecmaRuntimeCallInfo1->SetCallArg(0, paramMsg.GetTaggedValue()); - [[maybe_unused]] auto prevReject = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); + [[maybe_unused]] auto prevReject = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); JSTaggedValue result = BuiltinsPromise::Resolve(ecmaRuntimeCallInfo1.get()); - JSHandle resolvePromise(thread, result); + JSHandle resolvePromise(thread_, result); EXPECT_EQ(JSTaggedValue::SameValue(resolvePromise->GetPromiseState(), JSTaggedValue(static_cast(PromiseStatus::FULFILLED))), true); @@ -644,15 +644,15 @@ TEST_F(BuiltinsPromiseTest, ThenResolve) */ JSHandle testPromiseThenOnResolved = factory->NewJSFunction(env, reinterpret_cast(TestPromiseThenOnResolved)); - auto ecmaRuntimeCallInfo2 = TestHelper::CreateEcmaRuntimeCallInfo(thread, resolvePromise.GetTaggedValue(), 8); + auto ecmaRuntimeCallInfo2 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, resolvePromise.GetTaggedValue(), 8); ecmaRuntimeCallInfo2->SetFunction(resolvePromise.GetTaggedValue()); ecmaRuntimeCallInfo2->SetThis(resolvePromise.GetTaggedValue()); ecmaRuntimeCallInfo2->SetCallArg(0, testPromiseThenOnResolved.GetTaggedValue()); ecmaRuntimeCallInfo2->SetCallArg(1, JSTaggedValue::Undefined()); - [[maybe_unused]] auto prevThen = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo2.get()); + [[maybe_unused]] auto prevThen = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo2.get()); JSTaggedValue thenResult = BuiltinsPromise::Then(ecmaRuntimeCallInfo2.get()); - JSHandle thenPromise(thread, thenResult); + JSHandle thenPromise(thread_, thenResult); EXPECT_EQ(JSTaggedValue::SameValue(thenPromise->GetPromiseState(), JSTaggedValue(static_cast(PromiseStatus::PENDING))), @@ -662,9 +662,9 @@ TEST_F(BuiltinsPromiseTest, ThenResolve) /** * @tc.steps: step3. execute promise queue */ - auto microJobQueue = EcmaVM::Cast(instance)->GetMicroJobQueue(); - if (!thread->HasPendingException()) { - job::MicroJobQueue::ExecutePendingJob(thread, microJobQueue); + auto microJobQueue = EcmaVM::Cast(instance_)->GetMicroJobQueue(); + if (!thread_->HasPendingException()) { + job::MicroJobQueue::ExecutePendingJob(thread_, microJobQueue); } } @@ -675,8 +675,8 @@ TEST_F(BuiltinsPromiseTest, ThenResolve) */ TEST_F(BuiltinsPromiseTest, ThenReject) { - auto env = EcmaVM::Cast(instance)->GetGlobalEnv(); - auto factory = EcmaVM::Cast(instance)->GetFactory(); + auto env = EcmaVM::Cast(instance_)->GetGlobalEnv(); + auto factory = EcmaVM::Cast(instance_)->GetFactory(); JSHandle promise = JSHandle::Cast(env->GetPromiseFunction()); JSHandle paramMsg = JSHandle::Cast(factory->NewFromCanBeCompressString("reject")); @@ -684,14 +684,14 @@ TEST_F(BuiltinsPromiseTest, ThenReject) /** * @tc.steps: step1. var p1 = Promise.Reject(5) */ - auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue(*promise), 6); + auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue(*promise), 6); ecmaRuntimeCallInfo1->SetFunction(promise.GetTaggedValue()); ecmaRuntimeCallInfo1->SetThis(promise.GetTaggedValue()); ecmaRuntimeCallInfo1->SetCallArg(0, paramMsg.GetTaggedValue()); - [[maybe_unused]] auto prevReject = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); + [[maybe_unused]] auto prevReject = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); JSTaggedValue result = BuiltinsPromise::Reject(ecmaRuntimeCallInfo1.get()); - JSHandle rejectPromise(thread, result); + JSHandle rejectPromise(thread_, result); EXPECT_EQ(JSTaggedValue::SameValue(rejectPromise->GetPromiseState(), JSTaggedValue(static_cast(PromiseStatus::REJECTED))), true); @@ -702,15 +702,15 @@ TEST_F(BuiltinsPromiseTest, ThenReject) */ JSHandle testPromiseThenOnRejected = factory->NewJSFunction(env, reinterpret_cast(TestPromiseThenOnRejected)); - auto ecmaRuntimeCallInfo2 = TestHelper::CreateEcmaRuntimeCallInfo(thread, rejectPromise.GetTaggedValue(), 8); + auto ecmaRuntimeCallInfo2 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, rejectPromise.GetTaggedValue(), 8); ecmaRuntimeCallInfo2->SetFunction(rejectPromise.GetTaggedValue()); ecmaRuntimeCallInfo2->SetThis(rejectPromise.GetTaggedValue()); ecmaRuntimeCallInfo2->SetCallArg(0, testPromiseThenOnRejected.GetTaggedValue()); ecmaRuntimeCallInfo2->SetCallArg(1, testPromiseThenOnRejected.GetTaggedValue()); - [[maybe_unused]] auto prevThen = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo2.get()); + [[maybe_unused]] auto prevThen = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo2.get()); JSTaggedValue thenResult = BuiltinsPromise::Then(ecmaRuntimeCallInfo2.get()); - JSHandle thenPromise(thread, thenResult); + JSHandle thenPromise(thread_, thenResult); EXPECT_EQ(JSTaggedValue::SameValue(thenPromise->GetPromiseState(), JSTaggedValue(static_cast(PromiseStatus::PENDING))), @@ -719,9 +719,9 @@ TEST_F(BuiltinsPromiseTest, ThenReject) /** * @tc.steps: step3. execute promise queue */ - auto microJobQueue = EcmaVM::Cast(instance)->GetMicroJobQueue(); - if (!thread->HasPendingException()) { - job::MicroJobQueue::ExecutePendingJob(thread, microJobQueue); + auto microJobQueue = EcmaVM::Cast(instance_)->GetMicroJobQueue(); + if (!thread_->HasPendingException()) { + job::MicroJobQueue::ExecutePendingJob(thread_, microJobQueue); } } } // namespace panda::test diff --git a/tests/runtime/builtins/builtins_proxy_test.cpp b/tests/runtime/builtins/builtins_proxy_test.cpp index b721cec3109b3eaad2b438eacb37220470c38c1f..e093a7158b7b48675d9fa946ccef76a50274a8e9 100644 --- a/tests/runtime/builtins/builtins_proxy_test.cpp +++ b/tests/runtime/builtins/builtins_proxy_test.cpp @@ -45,17 +45,17 @@ public: void SetUp() override { - TestHelper::CreateEcmaVMWithScope(instance, thread, scope); + TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); } void TearDown() override { - TestHelper::DestroyEcmaVMWithScope(instance, scope); + TestHelper::DestroyEcmaVMWithScope(instance_, scope_); } - PandaVM *instance {nullptr}; - EcmaHandleScope *scope {nullptr}; - JSThread *thread {nullptr}; + PandaVM *instance_ {nullptr}; + EcmaHandleScope *scope_ {nullptr}; + JSThread *thread_ {nullptr}; }; JSHandle BuiltinsTestProxyCreate(JSThread *thread) @@ -72,52 +72,52 @@ JSHandle BuiltinsTestProxyCreate(JSThread *thread) // 26.2.1.1 Proxy( [ value ] ) TEST_F(BuiltinsProxyTest, ProxyConstructor) { - JSHandle target = BuiltinsTestProxyCreate(thread); - JSHandle handler = BuiltinsTestProxyCreate(thread); + JSHandle target = BuiltinsTestProxyCreate(thread_); + JSHandle handler = BuiltinsTestProxyCreate(thread_); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Null(), 8); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Null(), 8); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetCallArg(0, target.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(1, handler.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsProxy::ProxyConstructor(ecmaRuntimeCallInfo.get()); ASSERT_TRUE(result.IsECMAObject()); - JSHandle resultHandle(thread, result); + JSHandle resultHandle(thread_, result); EXPECT_TRUE(resultHandle->IsJSProxy()); } // 26.2.2.1 Proxy.revocable ( target, handler ) TEST_F(BuiltinsProxyTest, Revocable) { - JSHandle target = BuiltinsTestProxyCreate(thread); - JSHandle handler = BuiltinsTestProxyCreate(thread); + JSHandle target = BuiltinsTestProxyCreate(thread_); + JSHandle handler = BuiltinsTestProxyCreate(thread_); - JSHandle globalEnv = thread->GetEcmaVM()->GetGlobalEnv(); + JSHandle globalEnv = thread_->GetEcmaVM()->GetGlobalEnv(); JSHandle proxyFun(globalEnv->GetProxyFunction()); - JSHandle key(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("prop")); - PropertyDescriptor desc(thread); + JSHandle key(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("prop")); + PropertyDescriptor desc(thread_); desc.SetWritable(false); - JSObject::DefineOwnProperty(thread, handler, key, desc); + JSObject::DefineOwnProperty(thread_, handler, key, desc); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetCallArg(0, target.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(1, handler.GetTaggedValue()); ecmaRuntimeCallInfo->SetNewTarget(JSTaggedValue(*proxyFun)); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsProxy::Revocable(ecmaRuntimeCallInfo.get()); ASSERT_TRUE(result.IsECMAObject()); - JSHandle resultHandle(thread, result); + JSHandle resultHandle(thread_, result); - auto globalConst = thread->GlobalConstants(); + auto globalConst = thread_->GlobalConstants(); JSHandle proxyKey = globalConst->GetHandledProxyString(); JSHandle revokeKey = globalConst->GetHandledRevokeString(); - JSHandle keys = JSObject::GetOwnPropertyKeys(thread, resultHandle); + JSHandle keys = JSObject::GetOwnPropertyKeys(thread_, resultHandle); bool pflag = false; bool rflag = false; for (uint32_t i = 0; i < keys->GetLength(); i++) { @@ -131,8 +131,8 @@ TEST_F(BuiltinsProxyTest, Revocable) EXPECT_TRUE(pflag); EXPECT_TRUE(rflag); - PropertyDescriptor descRes(thread); - JSObject::GetOwnProperty(thread, resultHandle, revokeKey, descRes); + PropertyDescriptor descRes(thread_); + JSObject::GetOwnProperty(thread_, resultHandle, revokeKey, descRes); EXPECT_TRUE(descRes.GetValue()->IsProxyRevocFunction()); } } // namespace panda::test diff --git a/tests/runtime/builtins/builtins_reflect_test.cpp b/tests/runtime/builtins/builtins_reflect_test.cpp index e46255cae0f5684f791ca3b91949e5421410d64d..fb713987ce97f090124b17b1f6382f5018f4d58d 100644 --- a/tests/runtime/builtins/builtins_reflect_test.cpp +++ b/tests/runtime/builtins/builtins_reflect_test.cpp @@ -47,17 +47,17 @@ public: void SetUp() override { - TestHelper::CreateEcmaVMWithScope(instance, thread, scope); + TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); } void TearDown() override { - TestHelper::DestroyEcmaVMWithScope(instance, scope); + TestHelper::DestroyEcmaVMWithScope(instance_, scope_); } - PandaVM *instance {nullptr}; - EcmaHandleScope *scope {nullptr}; - JSThread *thread {nullptr}; + PandaVM *instance_ {nullptr}; + EcmaHandleScope *scope_ {nullptr}; + JSThread *thread_ {nullptr}; }; // use for create a JSObject of test @@ -97,72 +97,72 @@ JSTaggedValue TestReflectApply(EcmaRuntimeCallInfo *argv) // Reflect.apply (target, thisArgument, argumentsList) TEST_F(BuiltinsReflectTest, ReflectApply) { - JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); + JSHandle env = thread_->GetEcmaVM()->GetGlobalEnv(); - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); // target JSHandle target = factory->NewJSFunction(env, reinterpret_cast(TestReflectApply)); // thisArgument - JSHandle thisArgument = - factory->NewJSObjectByConstructor(TestObjectCreate(thread), JSHandle(TestObjectCreate(thread))); - JSObject::SetProperty(thread, JSHandle(thisArgument), + JSHandle thisArgument = factory->NewJSObjectByConstructor( + TestObjectCreate(thread_), JSHandle(TestObjectCreate(thread_))); + JSObject::SetProperty(thread_, JSHandle(thisArgument), JSHandle(factory->NewFromCanBeCompressString("test_reflect_apply_a")), - JSHandle(thread, JSTaggedValue(11))); - JSObject::SetProperty(thread, JSHandle(thisArgument), + JSHandle(thread_, JSTaggedValue(11))); + JSObject::SetProperty(thread_, JSHandle(thisArgument), JSHandle(factory->NewFromCanBeCompressString("test_reflect_apply_b")), - JSHandle(thread, JSTaggedValue(22))); + JSHandle(thread_, JSTaggedValue(22))); // argumentsList - JSHandle argumentsList(JSArray::ArrayCreate(thread, JSTaggedNumber(2))); - PropertyDescriptor desc(thread, JSHandle(thread, JSTaggedValue(33))); - JSArray::DefineOwnProperty(thread, argumentsList, JSHandle(thread, JSTaggedValue(0)), desc); + JSHandle argumentsList(JSArray::ArrayCreate(thread_, JSTaggedNumber(2))); + PropertyDescriptor desc(thread_, JSHandle(thread_, JSTaggedValue(33))); + JSArray::DefineOwnProperty(thread_, argumentsList, JSHandle(thread_, JSTaggedValue(0)), desc); - PropertyDescriptor desc1(thread, JSHandle(thread, JSTaggedValue(44))); - JSArray::DefineOwnProperty(thread, argumentsList, JSHandle(thread, JSTaggedValue(1)), desc1); + PropertyDescriptor desc1(thread_, JSHandle(thread_, JSTaggedValue(44))); + JSArray::DefineOwnProperty(thread_, argumentsList, JSHandle(thread_, JSTaggedValue(1)), desc1); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 10); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 10); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetCallArg(0, target.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(*thisArgument)); ecmaRuntimeCallInfo->SetCallArg(2, JSTaggedValue(*argumentsList)); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsReflect::ReflectApply(ecmaRuntimeCallInfo.get()); ASSERT_EQ(result.GetRawData(), JSTaggedValue(110).GetRawData()); - JSObject::DeleteProperty(thread, (thisArgument), + JSObject::DeleteProperty(thread_, (thisArgument), JSHandle(factory->NewFromCanBeCompressString("test_reflect_apply_a"))); - JSObject::DeleteProperty(thread, (thisArgument), + JSObject::DeleteProperty(thread_, (thisArgument), JSHandle(factory->NewFromCanBeCompressString("test_reflect_apply_b"))); } // Reflect.construct (target, argumentsList [ , newTarget]) TEST_F(BuiltinsReflectTest, ReflectConstruct) { - JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); + JSHandle env = thread_->GetEcmaVM()->GetGlobalEnv(); - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); // target JSHandle target = JSHandle::Cast(env->GetStringFunction()); // argumentsList - JSHandle argumentsList(JSArray::ArrayCreate(thread, JSTaggedNumber(1))); - PropertyDescriptor desc(thread, + JSHandle argumentsList(JSArray::ArrayCreate(thread_, JSTaggedNumber(1))); + PropertyDescriptor desc(thread_, JSHandle::Cast(factory->NewFromCanBeCompressString("ReflectConstruct"))); - JSArray::DefineOwnProperty(thread, argumentsList, JSHandle(thread, JSTaggedValue(0)), desc); + JSArray::DefineOwnProperty(thread_, argumentsList, JSHandle(thread_, JSTaggedValue(0)), desc); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetCallArg(0, target.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(*argumentsList)); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsReflect::ReflectConstruct(ecmaRuntimeCallInfo.get()); ASSERT_TRUE(result.IsECMAObject()); - JSHandle taggedResult(thread, result); + JSHandle taggedResult(thread_, result); JSHandle refResult = JSHandle::Cast(taggedResult); JSHandle ruler = factory->NewFromCanBeCompressString("ReflectConstruct"); ASSERT_EQ(EcmaString::Cast(refResult->GetValue().GetTaggedObject())->Compare(*ruler), 0); @@ -171,47 +171,47 @@ TEST_F(BuiltinsReflectTest, ReflectConstruct) // Reflect.defineProperty (target, propertyKey, attributes) TEST_F(BuiltinsReflectTest, ReflectDefineProperty) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); // target - JSHandle target = - factory->NewJSObjectByConstructor(TestObjectCreate(thread), JSHandle(TestObjectCreate(thread))); + JSHandle target = factory->NewJSObjectByConstructor(TestObjectCreate(thread_), + JSHandle(TestObjectCreate(thread_))); // propertyKey JSHandle key(factory->NewFromCanBeCompressString("test_reflect_define_property")); // attributes - JSHandle attributes = - factory->NewJSObjectByConstructor(TestObjectCreate(thread), JSHandle(TestObjectCreate(thread))); + JSHandle attributes = factory->NewJSObjectByConstructor( + TestObjectCreate(thread_), JSHandle(TestObjectCreate(thread_))); // attributes value - auto globalConst = thread->GlobalConstants(); + auto globalConst = thread_->GlobalConstants(); JSHandle valueKey = globalConst->GetHandledValueString(); - JSHandle value(thread, JSTaggedValue(100)); - JSObject::SetProperty(thread, JSHandle(attributes), valueKey, value); + JSHandle value(thread_, JSTaggedValue(100)); + JSObject::SetProperty(thread_, JSHandle(attributes), valueKey, value); // attributes writable JSHandle writableKey = globalConst->GetHandledWritableString(); - JSHandle writable(thread, JSTaggedValue::True()); - JSObject::SetProperty(thread, JSHandle(attributes), writableKey, writable); + JSHandle writable(thread_, JSTaggedValue::True()); + JSObject::SetProperty(thread_, JSHandle(attributes), writableKey, writable); // attributes enumerable JSHandle enumerableKey = globalConst->GetHandledEnumerableString(); - JSHandle enumerable(thread, JSTaggedValue::False()); - JSObject::SetProperty(thread, JSHandle(attributes), enumerableKey, enumerable); + JSHandle enumerable(thread_, JSTaggedValue::False()); + JSObject::SetProperty(thread_, JSHandle(attributes), enumerableKey, enumerable); // attributes configurable JSHandle configurableKey = globalConst->GetHandledConfigurableString(); - JSHandle configurable(thread, JSTaggedValue::True()); - JSObject::SetProperty(thread, JSHandle(attributes), configurableKey, configurable); + JSHandle configurable(thread_, JSTaggedValue::True()); + JSObject::SetProperty(thread_, JSHandle(attributes), configurableKey, configurable); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 10); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 10); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetCallArg(0, target.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(1, key.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(2, JSTaggedValue(*attributes)); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsReflect::ReflectDefineProperty(ecmaRuntimeCallInfo.get()); ASSERT_EQ(result.GetRawData(), JSTaggedValue::True().GetRawData()); - PropertyDescriptor descRuler(thread); - JSObject::GetOwnProperty(thread, target, key, descRuler); + PropertyDescriptor descRuler(thread_); + JSObject::GetOwnProperty(thread_, target, key, descRuler); ASSERT_EQ(descRuler.GetValue()->GetInt(), 100); ASSERT_EQ(descRuler.IsWritable(), true); ASSERT_EQ(descRuler.IsEnumerable(), false); @@ -221,146 +221,146 @@ TEST_F(BuiltinsReflectTest, ReflectDefineProperty) // Reflect.deleteProperty (target, propertyKey) TEST_F(BuiltinsReflectTest, ReflectDeleteProperty) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); // target - JSHandle target = - factory->NewJSObjectByConstructor(TestObjectCreate(thread), JSHandle(TestObjectCreate(thread))); + JSHandle target = factory->NewJSObjectByConstructor(TestObjectCreate(thread_), + JSHandle(TestObjectCreate(thread_))); // propertyKey JSHandle key(factory->NewFromCanBeCompressString("test_reflect_delete_property")); - JSHandle value(thread, JSTaggedValue(101)); - JSObject::SetProperty(thread, JSHandle(target), key, value); + JSHandle value(thread_, JSTaggedValue(101)); + JSObject::SetProperty(thread_, JSHandle(target), key, value); - PropertyDescriptor desc(thread); - ASSERT_EQ(JSObject::GetOwnProperty(thread, target, key, desc), true); + PropertyDescriptor desc(thread_); + ASSERT_EQ(JSObject::GetOwnProperty(thread_, target, key, desc), true); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetCallArg(0, target.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(1, key.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsReflect::ReflectDeleteProperty(ecmaRuntimeCallInfo.get()); ASSERT_EQ(result.GetRawData(), JSTaggedValue::True().GetRawData()); - ASSERT_EQ(JSObject::GetOwnProperty(thread, target, key, desc), false); + ASSERT_EQ(JSObject::GetOwnProperty(thread_, target, key, desc), false); } // Reflect.get (target, propertyKey [ , receiver]) TEST_F(BuiltinsReflectTest, ReflectGet) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); // target - JSHandle target = - factory->NewJSObjectByConstructor(TestObjectCreate(thread), JSHandle(TestObjectCreate(thread))); + JSHandle target = factory->NewJSObjectByConstructor(TestObjectCreate(thread_), + JSHandle(TestObjectCreate(thread_))); // propertyKey JSHandle key(factory->NewFromCanBeCompressString("test_reflect_get")); // set property - JSHandle value(thread, JSTaggedValue(101.5)); - JSObject::SetProperty(thread, JSHandle(target), key, value); + JSHandle value(thread_, JSTaggedValue(101.5)); + JSObject::SetProperty(thread_, JSHandle(target), key, value); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetCallArg(0, target.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(1, key.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsReflect::ReflectGet(ecmaRuntimeCallInfo.get()); - JSHandle resultValue(thread, result); + JSHandle resultValue(thread_, result); ASSERT_EQ(resultValue->GetDouble(), 101.5); } // Reflect.getOwnPropertyDescriptor ( target, propertyKey ) TEST_F(BuiltinsReflectTest, ReflectGetOwnPropertyDescriptor) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); // target - JSHandle target = - factory->NewJSObjectByConstructor(TestObjectCreate(thread), JSHandle(TestObjectCreate(thread))); + JSHandle target = factory->NewJSObjectByConstructor(TestObjectCreate(thread_), + JSHandle(TestObjectCreate(thread_))); // propertyKey JSHandle key(factory->NewFromCanBeCompressString("test_reflect_get_property_descriptor")); - PropertyDescriptor desc(thread, JSHandle(thread, JSTaggedValue(102)), true, false, true); - ASSERT_EQ(JSTaggedValue::DefinePropertyOrThrow(thread, JSHandle(target), key, desc), true); + PropertyDescriptor desc(thread_, JSHandle(thread_, JSTaggedValue(102)), true, false, true); + ASSERT_EQ(JSTaggedValue::DefinePropertyOrThrow(thread_, JSHandle(target), key, desc), true); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetCallArg(0, target.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(1, key.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsReflect::ReflectGetOwnPropertyDescriptor(ecmaRuntimeCallInfo.get()); ASSERT_TRUE(result.IsECMAObject()); - JSHandle resultObj(thread, result); + JSHandle resultObj(thread_, result); // test value - auto globalConst = thread->GlobalConstants(); + auto globalConst = thread_->GlobalConstants(); JSHandle valueKey = globalConst->GetHandledValueString(); - JSHandle resultValue = JSObject::GetProperty(thread, resultObj, valueKey).GetValue(); + JSHandle resultValue = JSObject::GetProperty(thread_, resultObj, valueKey).GetValue(); ASSERT_EQ(resultValue->GetInt(), 102); // test writable JSHandle writableKey = globalConst->GetHandledWritableString(); - JSHandle resultWritable = JSObject::GetProperty(thread, resultObj, writableKey).GetValue(); + JSHandle resultWritable = JSObject::GetProperty(thread_, resultObj, writableKey).GetValue(); ASSERT_EQ(resultWritable->ToBoolean(), true); // test enumerable JSHandle enumerableKey = globalConst->GetHandledEnumerableString(); - JSHandle resultEnumerable = JSObject::GetProperty(thread, resultObj, enumerableKey).GetValue(); + JSHandle resultEnumerable = JSObject::GetProperty(thread_, resultObj, enumerableKey).GetValue(); ASSERT_EQ(resultEnumerable->ToBoolean(), false); // test configurable JSHandle configurableKey = globalConst->GetHandledConfigurableString(); - JSHandle resultConfigurable = JSObject::GetProperty(thread, resultObj, configurableKey).GetValue(); + JSHandle resultConfigurable = JSObject::GetProperty(thread_, resultObj, configurableKey).GetValue(); ASSERT_EQ(resultConfigurable->ToBoolean(), true); } // Reflect.getPrototypeOf (target) TEST_F(BuiltinsReflectTest, ReflectGetPrototypeOf) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); - JSHandle target = - factory->NewJSObjectByConstructor(TestObjectCreate(thread), JSHandle(TestObjectCreate(thread))); - JSHandle proto = - factory->NewJSObjectByConstructor(TestObjectCreate(thread), JSHandle(TestObjectCreate(thread))); + JSHandle target = factory->NewJSObjectByConstructor(TestObjectCreate(thread_), + JSHandle(TestObjectCreate(thread_))); + JSHandle proto = factory->NewJSObjectByConstructor(TestObjectCreate(thread_), + JSHandle(TestObjectCreate(thread_))); - ASSERT_EQ(JSObject::SetPrototype(thread, target, JSHandle(proto)), true); + ASSERT_EQ(JSObject::SetPrototype(thread_, target, JSHandle(proto)), true); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetCallArg(0, target.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsReflect::ReflectGetPrototypeOf(ecmaRuntimeCallInfo.get()); ASSERT_TRUE(result.IsECMAObject()); - JSHandle resultObj(thread, JSTaggedValue(reinterpret_cast(result.GetRawData()))); + JSHandle resultObj(thread_, JSTaggedValue(reinterpret_cast(result.GetRawData()))); ASSERT_EQ(JSTaggedValue::SameValue(resultObj.GetTaggedValue(), proto.GetTaggedValue()), true); } // Reflect.has (target, propertyKey) TEST_F(BuiltinsReflectTest, ReflectHas) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); // target - JSHandle target = - factory->NewJSObjectByConstructor(TestObjectCreate(thread), JSHandle(TestObjectCreate(thread))); + JSHandle target = factory->NewJSObjectByConstructor(TestObjectCreate(thread_), + JSHandle(TestObjectCreate(thread_))); // propertyKey JSHandle key(factory->NewFromCanBeCompressString("test_reflect_has")); - JSHandle value(thread, JSTaggedValue(103)); - ASSERT_EQ(JSObject::SetProperty(thread, JSHandle(target), key, value), true); + JSHandle value(thread_, JSTaggedValue(103)); + ASSERT_EQ(JSObject::SetProperty(thread_, JSHandle(target), key, value), true); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetCallArg(0, target.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(1, key.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsReflect::ReflectHas(ecmaRuntimeCallInfo.get()); ASSERT_EQ(result.GetRawData(), JSTaggedValue::True().GetRawData()); @@ -369,19 +369,19 @@ TEST_F(BuiltinsReflectTest, ReflectHas) // Reflect.isExtensible (target) TEST_F(BuiltinsReflectTest, ReflectIsExtensible) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); // target - JSHandle target = - factory->NewJSObjectByConstructor(TestObjectCreate(thread), JSHandle(TestObjectCreate(thread))); + JSHandle target = factory->NewJSObjectByConstructor(TestObjectCreate(thread_), + JSHandle(TestObjectCreate(thread_))); target->GetJSHClass()->SetExtensible(false); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetCallArg(0, target.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsReflect::ReflectIsExtensible(ecmaRuntimeCallInfo.get()); ASSERT_EQ(result.GetRawData(), JSTaggedValue::False().GetRawData()); @@ -390,45 +390,45 @@ TEST_F(BuiltinsReflectTest, ReflectIsExtensible) // Reflect.ownKeys (target) TEST_F(BuiltinsReflectTest, ReflectOwnKeys) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); // target - JSHandle target = - factory->NewJSObjectByConstructor(TestObjectCreate(thread), JSHandle(TestObjectCreate(thread))); + JSHandle target = factory->NewJSObjectByConstructor(TestObjectCreate(thread_), + JSHandle(TestObjectCreate(thread_))); JSHandle key0(factory->NewFromCanBeCompressString("test_reflect_own_keys1")); - JSHandle value0(thread, JSTaggedValue(104)); - ASSERT_EQ(JSObject::SetProperty(thread, JSHandle(target), key0, value0), true); + JSHandle value0(thread_, JSTaggedValue(104)); + ASSERT_EQ(JSObject::SetProperty(thread_, JSHandle(target), key0, value0), true); JSHandle key1(factory->NewFromCanBeCompressString("test_reflect_own_keys2")); - JSHandle value1(thread, JSTaggedValue(105)); - ASSERT_EQ(JSObject::SetProperty(thread, JSHandle(target), key1, value1), true); + JSHandle value1(thread_, JSTaggedValue(105)); + ASSERT_EQ(JSObject::SetProperty(thread_, JSHandle(target), key1, value1), true); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetCallArg(0, target.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsReflect::ReflectOwnKeys(ecmaRuntimeCallInfo.get()); ASSERT_TRUE(result.IsECMAObject()); - JSHandle resultTaggedValue(thread, reinterpret_cast(result.GetRawData())); + JSHandle resultTaggedValue(thread_, reinterpret_cast(result.GetRawData())); JSHandle resultArray = JSHandle::Cast(resultTaggedValue); // test length - JSHandle resultLengthKey = thread->GlobalConstants()->GetHandledLengthString(); + JSHandle resultLengthKey = thread_->GlobalConstants()->GetHandledLengthString(); JSHandle resultLength = - JSObject::GetProperty(thread, JSHandle(resultArray), resultLengthKey).GetValue(); + JSObject::GetProperty(thread_, JSHandle(resultArray), resultLengthKey).GetValue(); ASSERT_EQ(resultLength->GetInt(), 2); // test array[0] - JSHandle resultKey0(thread, JSTaggedValue(0)); + JSHandle resultKey0(thread_, JSTaggedValue(0)); JSHandle resultValue0 = - JSObject::GetProperty(thread, JSHandle(resultArray), resultKey0).GetValue(); + JSObject::GetProperty(thread_, JSHandle(resultArray), resultKey0).GetValue(); ASSERT_EQ(reinterpret_cast(resultValue0.GetTaggedValue().GetTaggedObject()) ->Compare(reinterpret_cast(key0.GetTaggedValue().GetTaggedObject())), 0); // test array[1] - JSHandle resultKey1(thread, JSTaggedValue(1)); + JSHandle resultKey1(thread_, JSTaggedValue(1)); JSHandle resultValue1 = - JSObject::GetProperty(thread, JSHandle(resultArray), resultKey1).GetValue(); + JSObject::GetProperty(thread_, JSHandle(resultArray), resultKey1).GetValue(); ASSERT_EQ(reinterpret_cast(resultValue1.GetTaggedValue().GetTaggedObject()) ->Compare(reinterpret_cast(key1.GetTaggedValue().GetTaggedObject())), 0); @@ -437,19 +437,19 @@ TEST_F(BuiltinsReflectTest, ReflectOwnKeys) // Reflect.preventExtensions (target) TEST_F(BuiltinsReflectTest, ReflectPreventExtensions) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); // target - JSHandle target = - factory->NewJSObjectByConstructor(TestObjectCreate(thread), JSHandle(TestObjectCreate(thread))); + JSHandle target = factory->NewJSObjectByConstructor(TestObjectCreate(thread_), + JSHandle(TestObjectCreate(thread_))); target->GetJSHClass()->SetExtensible(true); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetCallArg(0, target.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsReflect::ReflectPreventExtensions(ecmaRuntimeCallInfo.get()); ASSERT_EQ(result.GetRawData(), JSTaggedValue::True().GetRawData()); @@ -459,53 +459,53 @@ TEST_F(BuiltinsReflectTest, ReflectPreventExtensions) // Reflect.set (target, propertyKey, V [ , receiver]) TEST_F(BuiltinsReflectTest, ReflectSet) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); // target - JSHandle target = - factory->NewJSObjectByConstructor(TestObjectCreate(thread), JSHandle(TestObjectCreate(thread))); + JSHandle target = factory->NewJSObjectByConstructor(TestObjectCreate(thread_), + JSHandle(TestObjectCreate(thread_))); // propertyKey JSHandle key(factory->NewFromCanBeCompressString("test_reflect_set")); // value - JSHandle value(thread, JSTaggedValue(106)); + JSHandle value(thread_, JSTaggedValue(106)); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 10); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 10); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetCallArg(0, target.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(1, key.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(2, value.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsReflect::ReflectSet(ecmaRuntimeCallInfo.get()); ASSERT_EQ(result.GetRawData(), JSTaggedValue::True().GetRawData()); - JSHandle ruler = JSObject::GetProperty(thread, JSHandle(target), key).GetValue(); - ASSERT_EQ(JSTaggedValue::ToInt32(thread, ruler), 106); + JSHandle ruler = JSObject::GetProperty(thread_, JSHandle(target), key).GetValue(); + ASSERT_EQ(JSTaggedValue::ToInt32(thread_, ruler), 106); } // Reflect.setPrototypeOf (target, proto) TEST_F(BuiltinsReflectTest, ReflectSetPrototypeOf) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); - JSHandle target = - factory->NewJSObjectByConstructor(TestObjectCreate(thread), JSHandle(TestObjectCreate(thread))); - JSHandle proto = - factory->NewJSObjectByConstructor(TestObjectCreate(thread), JSHandle(TestObjectCreate(thread))); + JSHandle target = factory->NewJSObjectByConstructor(TestObjectCreate(thread_), + JSHandle(TestObjectCreate(thread_))); + JSHandle proto = factory->NewJSObjectByConstructor(TestObjectCreate(thread_), + JSHandle(TestObjectCreate(thread_))); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetCallArg(0, target.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(1, proto.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsReflect::ReflectSetPrototypeOf(ecmaRuntimeCallInfo.get()); ASSERT_EQ(result.GetRawData(), JSTaggedValue::True().GetRawData()); - JSHandle resultObj(thread, target->GetJSHClass()->GetPrototype()); + JSHandle resultObj(thread_, target->GetJSHClass()->GetPrototype()); ASSERT_EQ(JSTaggedValue::SameValue(resultObj.GetTaggedValue(), proto.GetTaggedValue()), true); } } // namespace panda::test diff --git a/tests/runtime/builtins/builtins_regexp_test.cpp b/tests/runtime/builtins/builtins_regexp_test.cpp index 997ae260c356bdedbf35a4c713e420ec9e2062a1..fc228bd8e0da58989edda98f815dacdc2b15bb90 100644 --- a/tests/runtime/builtins/builtins_regexp_test.cpp +++ b/tests/runtime/builtins/builtins_regexp_test.cpp @@ -49,17 +49,17 @@ public: void SetUp() override { - TestHelper::CreateEcmaVMWithScope(instance, thread, scope); + TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); } void TearDown() override { - TestHelper::DestroyEcmaVMWithScope(instance, scope); + TestHelper::DestroyEcmaVMWithScope(instance_, scope_); } - PandaVM *instance {nullptr}; - EcmaHandleScope *scope {nullptr}; - JSThread *thread {nullptr}; + PandaVM *instance_ {nullptr}; + EcmaHandleScope *scope_ {nullptr}; + JSThread *thread_ {nullptr}; }; JSTaggedValue CreateRegExpObjByPatternAndFlags(JSThread *thread, const JSHandle &pattern, @@ -85,18 +85,18 @@ JSTaggedValue CreateRegExpObjByPatternAndFlags(JSThread *thread, const JSHandle< TEST_F(BuiltinsRegExpTest, RegExpConstructor1) { // invoke RegExpConstructor method - JSHandle pattern = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("\\w+"); - JSHandle flags = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("i"); - JSTaggedValue result = CreateRegExpObjByPatternAndFlags(thread, pattern, flags); + JSHandle pattern = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("\\w+"); + JSHandle flags = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("i"); + JSTaggedValue result = CreateRegExpObjByPatternAndFlags(thread_, pattern, flags); // ASSERT IsRegExp() - JSHandle regexpObject(thread, result); - ASSERT_TRUE(JSObject::IsRegExp(thread, regexpObject)); + JSHandle regexpObject(thread_, result); + ASSERT_TRUE(JSObject::IsRegExp(thread_, regexpObject)); - JSHandle jsRegexp(thread, JSRegExp::Cast(regexpObject->GetTaggedObject())); - JSHandle originalSource(thread, jsRegexp->GetOriginalSource()); + JSHandle jsRegexp(thread_, JSRegExp::Cast(regexpObject->GetTaggedObject())); + JSHandle originalSource(thread_, jsRegexp->GetOriginalSource()); uint8_t flagsBits = static_cast(jsRegexp->GetOriginalFlags().GetInt()); - JSHandle originalFlags(thread, BuiltinsRegExp::FlagsBitsToString(thread, flagsBits)); + JSHandle originalFlags(thread_, BuiltinsRegExp::FlagsBitsToString(thread_, flagsBits)); ASSERT_EQ(static_cast(originalSource->GetTaggedObject())->Compare(*pattern), 0); ASSERT_EQ(static_cast(originalFlags->GetTaggedObject())->Compare(*flags), 0); } @@ -104,33 +104,33 @@ TEST_F(BuiltinsRegExpTest, RegExpConstructor1) TEST_F(BuiltinsRegExpTest, RegExpConstructor2) { // invoke RegExpConstructor method - JSHandle pattern = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("\\w+"); - JSHandle flags = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("i"); - JSTaggedValue result1 = CreateRegExpObjByPatternAndFlags(thread, pattern, flags); - JSHandle value(thread, reinterpret_cast(result1.GetRawData())); + JSHandle pattern = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("\\w+"); + JSHandle flags = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("i"); + JSTaggedValue result1 = CreateRegExpObjByPatternAndFlags(thread_, pattern, flags); + JSHandle value(thread_, reinterpret_cast(result1.GetRawData())); - JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); + JSHandle env = thread_->GetEcmaVM()->GetGlobalEnv(); JSHandle regexp(env->GetRegExpFunction()); - JSHandle globalObject(thread, env->GetGlobalObject()); + JSHandle globalObject(thread_, env->GetGlobalObject()); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue(*regexp), 8); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue(*regexp), 8); ecmaRuntimeCallInfo->SetFunction(regexp.GetTaggedValue()); ecmaRuntimeCallInfo->SetThis(globalObject.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, value.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue::Undefined()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); // invoke RegExpConstructor method JSTaggedValue result2 = BuiltinsRegExp::RegExpConstructor(ecmaRuntimeCallInfo.get()); // ASSERT IsRegExp() - JSHandle regexpObject(thread, result2); - ASSERT_TRUE(JSObject::IsRegExp(thread, regexpObject)); + JSHandle regexpObject(thread_, result2); + ASSERT_TRUE(JSObject::IsRegExp(thread_, regexpObject)); - JSHandle jsRegexp(thread, JSRegExp::Cast(regexpObject->GetTaggedObject())); - JSHandle originalSource(thread, jsRegexp->GetOriginalSource()); + JSHandle jsRegexp(thread_, JSRegExp::Cast(regexpObject->GetTaggedObject())); + JSHandle originalSource(thread_, jsRegexp->GetOriginalSource()); uint8_t flagsBits = static_cast(jsRegexp->GetOriginalFlags().GetInt()); - JSHandle originalFlags(thread, BuiltinsRegExp::FlagsBitsToString(thread, flagsBits)); + JSHandle originalFlags(thread_, BuiltinsRegExp::FlagsBitsToString(thread_, flagsBits)); ASSERT_EQ(static_cast(originalSource->GetTaggedObject())->Compare(*pattern), 0); ASSERT_EQ(static_cast(originalFlags->GetTaggedObject())->Compare(*flags), 0); } @@ -138,34 +138,34 @@ TEST_F(BuiltinsRegExpTest, RegExpConstructor2) TEST_F(BuiltinsRegExpTest, RegExpConstructor3) { // invoke RegExpConstructor method - JSHandle pattern1 = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("\\w+"); - JSHandle flags1 = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("i"); - JSTaggedValue result1 = CreateRegExpObjByPatternAndFlags(thread, pattern1, flags1); - JSHandle value(thread, reinterpret_cast(result1.GetRawData())); + JSHandle pattern1 = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("\\w+"); + JSHandle flags1 = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("i"); + JSTaggedValue result1 = CreateRegExpObjByPatternAndFlags(thread_, pattern1, flags1); + JSHandle value(thread_, reinterpret_cast(result1.GetRawData())); - JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); + JSHandle env = thread_->GetEcmaVM()->GetGlobalEnv(); JSHandle regexp(env->GetRegExpFunction()); - JSHandle globalObject(thread, env->GetGlobalObject()); - JSHandle flags2 = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("gi"); + JSHandle globalObject(thread_, env->GetGlobalObject()); + JSHandle flags2 = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("gi"); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue(*regexp), 8); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue(*regexp), 8); ecmaRuntimeCallInfo->SetFunction(regexp.GetTaggedValue()); ecmaRuntimeCallInfo->SetThis(globalObject.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, value.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(1, flags2.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); // invoke RegExpConstructor method JSTaggedValue result2 = BuiltinsRegExp::RegExpConstructor(ecmaRuntimeCallInfo.get()); // ASSERT IsRegExp() - JSHandle regexpObject(thread, result2); - ASSERT_TRUE(JSObject::IsRegExp(thread, regexpObject)); + JSHandle regexpObject(thread_, result2); + ASSERT_TRUE(JSObject::IsRegExp(thread_, regexpObject)); - JSHandle jsRegexp(thread, JSRegExp::Cast(regexpObject->GetTaggedObject())); - JSHandle originalSource(thread, jsRegexp->GetOriginalSource()); + JSHandle jsRegexp(thread_, JSRegExp::Cast(regexpObject->GetTaggedObject())); + JSHandle originalSource(thread_, jsRegexp->GetOriginalSource()); uint8_t flagsBits = static_cast(jsRegexp->GetOriginalFlags().GetInt()); - JSHandle originalFlags(thread, BuiltinsRegExp::FlagsBitsToString(thread, flagsBits)); + JSHandle originalFlags(thread_, BuiltinsRegExp::FlagsBitsToString(thread_, flagsBits)); ASSERT_EQ(static_cast(originalSource->GetTaggedObject())->Compare(*pattern1), 0); ASSERT_EQ(static_cast(originalFlags->GetTaggedObject())->Compare(*flags2), 0); } @@ -173,104 +173,104 @@ TEST_F(BuiltinsRegExpTest, RegExpConstructor3) TEST_F(BuiltinsRegExpTest, GetSource1) { // invoke RegExpConstructor method - JSHandle pattern1 = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(""); - JSHandle flags1 = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("i"); - JSTaggedValue result1 = CreateRegExpObjByPatternAndFlags(thread, pattern1, flags1); - JSHandle result1Handle(thread, result1); + JSHandle pattern1 = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(""); + JSHandle flags1 = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("i"); + JSTaggedValue result1 = CreateRegExpObjByPatternAndFlags(thread_, pattern1, flags1); + JSHandle result1Handle(thread_, result1); // invoke GetSource method JSHandle source( - thread, thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("source").GetTaggedValue()); - JSHandle sourceResult(JSObject::GetProperty(thread, result1Handle, source).GetValue()); + thread_, thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("source").GetTaggedValue()); + JSHandle sourceResult(JSObject::GetProperty(thread_, result1Handle, source).GetValue()); - JSHandle expect = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("(?:)"); + JSHandle expect = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("(?:)"); ASSERT_EQ(static_cast(sourceResult->GetTaggedObject())->Compare(*expect), 0); } TEST_F(BuiltinsRegExpTest, GetSource2) { // invoke RegExpConstructor method - JSHandle pattern1 = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("/w+"); - JSHandle flags1 = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("i"); - JSTaggedValue result1 = CreateRegExpObjByPatternAndFlags(thread, pattern1, flags1); - JSHandle result1Handle(thread, result1); + JSHandle pattern1 = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("/w+"); + JSHandle flags1 = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("i"); + JSTaggedValue result1 = CreateRegExpObjByPatternAndFlags(thread_, pattern1, flags1); + JSHandle result1Handle(thread_, result1); // invoke GetSource method - JSHandle source(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("source")); - JSHandle sourceResult(JSObject::GetProperty(thread, result1Handle, source).GetValue()); + JSHandle source(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("source")); + JSHandle sourceResult(JSObject::GetProperty(thread_, result1Handle, source).GetValue()); - JSHandle expect = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("\\/w+"); + JSHandle expect = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("\\/w+"); ASSERT_EQ(static_cast(sourceResult->GetTaggedObject())->Compare(*expect), 0); } TEST_F(BuiltinsRegExpTest, Get) { // invoke RegExpConstructor method - JSHandle pattern1 = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("\\w+"); - JSHandle flags1 = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("gimuy"); - JSTaggedValue result1 = CreateRegExpObjByPatternAndFlags(thread, pattern1, flags1); - JSHandle result1Handle(thread, result1); + JSHandle pattern1 = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("\\w+"); + JSHandle flags1 = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("gimuy"); + JSTaggedValue result1 = CreateRegExpObjByPatternAndFlags(thread_, pattern1, flags1); + JSHandle result1Handle(thread_, result1); - JSHandle global(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("global")); + JSHandle global(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("global")); JSTaggedValue taggedGlobalResult = - JSTaggedValue(JSObject::GetProperty(thread, result1Handle, global).GetValue().GetTaggedValue()); + JSTaggedValue(JSObject::GetProperty(thread_, result1Handle, global).GetValue().GetTaggedValue()); ASSERT_EQ(taggedGlobalResult.GetRawData(), JSTaggedValue::True().GetRawData()); - JSHandle ignoreCase(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("ignoreCase")); + JSHandle ignoreCase(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("ignoreCase")); JSTaggedValue taggedIgnoreCaseResult = - JSTaggedValue(JSObject::GetProperty(thread, result1Handle, ignoreCase).GetValue().GetTaggedValue()); + JSTaggedValue(JSObject::GetProperty(thread_, result1Handle, ignoreCase).GetValue().GetTaggedValue()); ASSERT_EQ(taggedIgnoreCaseResult.GetRawData(), JSTaggedValue::True().GetRawData()); - JSHandle multiline(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("multiline")); + JSHandle multiline(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("multiline")); JSTaggedValue taggedMultilineResult = - JSTaggedValue(JSObject::GetProperty(thread, result1Handle, multiline).GetValue().GetTaggedValue()); + JSTaggedValue(JSObject::GetProperty(thread_, result1Handle, multiline).GetValue().GetTaggedValue()); ASSERT_EQ(taggedMultilineResult.GetRawData(), JSTaggedValue::True().GetRawData()); - JSHandle sticky(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("sticky")); + JSHandle sticky(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("sticky")); JSTaggedValue taggedStickyResult = - JSTaggedValue(JSObject::GetProperty(thread, result1Handle, sticky).GetValue().GetTaggedValue()); + JSTaggedValue(JSObject::GetProperty(thread_, result1Handle, sticky).GetValue().GetTaggedValue()); ASSERT_EQ(taggedStickyResult.GetRawData(), JSTaggedValue::True().GetRawData()); - JSHandle unicode(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("unicode")); + JSHandle unicode(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("unicode")); JSTaggedValue taggedUnicodeResult = - JSTaggedValue(JSObject::GetProperty(thread, result1Handle, unicode).GetValue().GetTaggedValue()); + JSTaggedValue(JSObject::GetProperty(thread_, result1Handle, unicode).GetValue().GetTaggedValue()); ASSERT_EQ(taggedUnicodeResult.GetRawData(), JSTaggedValue::True().GetRawData()); } TEST_F(BuiltinsRegExpTest, GetFlags) { // invoke RegExpConstructor method - JSHandle pattern1 = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("\\w+"); - JSHandle flags1 = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("imuyg"); - JSTaggedValue result1 = CreateRegExpObjByPatternAndFlags(thread, pattern1, flags1); - JSHandle result1Handle(thread, result1); + JSHandle pattern1 = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("\\w+"); + JSHandle flags1 = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("imuyg"); + JSTaggedValue result1 = CreateRegExpObjByPatternAndFlags(thread_, pattern1, flags1); + JSHandle result1Handle(thread_, result1); // invoke GetFlags method - JSHandle flags(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("flags")); - JSHandle flagsResult(JSObject::GetProperty(thread, result1Handle, flags).GetValue()); + JSHandle flags(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("flags")); + JSHandle flagsResult(JSObject::GetProperty(thread_, result1Handle, flags).GetValue()); - JSHandle expectResult = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("gimuy"); + JSHandle expectResult = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("gimuy"); ASSERT_EQ(static_cast(flagsResult->GetTaggedObject())->Compare(*expectResult), 0); } TEST_F(BuiltinsRegExpTest, toString) { // invoke RegExpConstructor method - JSHandle pattern1 = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("\\w+"); - JSHandle flags1 = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("imuyg"); - JSTaggedValue result1 = CreateRegExpObjByPatternAndFlags(thread, pattern1, flags1); - JSHandle value(thread, reinterpret_cast(result1.GetRawData())); + JSHandle pattern1 = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("\\w+"); + JSHandle flags1 = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("imuyg"); + JSTaggedValue result1 = CreateRegExpObjByPatternAndFlags(thread_, pattern1, flags1); + JSHandle value(thread_, reinterpret_cast(result1.GetRawData())); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(value.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); // invoke ToString method JSTaggedValue toStringResult = BuiltinsRegExp::ToString(ecmaRuntimeCallInfo.get()); ASSERT_TRUE(toStringResult.IsString()); - JSHandle toStringResultHandle(thread, toStringResult); - JSHandle expectResult = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("/\\w+/gimuy"); + JSHandle toStringResultHandle(thread_, toStringResult); + JSHandle expectResult = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("/\\w+/gimuy"); ASSERT_EQ(static_cast(toStringResultHandle->GetTaggedObject())->Compare(*expectResult), 0); } @@ -278,57 +278,58 @@ TEST_F(BuiltinsRegExpTest, Exec1) { // invoke RegExpConstructor method JSHandle pattern1 = - thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("quick\\s(brown).+?(jumps)"); - JSHandle flags1 = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("ig"); - JSTaggedValue result1 = CreateRegExpObjByPatternAndFlags(thread, pattern1, flags1); - JSHandle value(thread, reinterpret_cast(result1.GetRawData())); + thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("quick\\s(brown).+?(jumps)"); + JSHandle flags1 = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("ig"); + JSTaggedValue result1 = CreateRegExpObjByPatternAndFlags(thread_, pattern1, flags1); + JSHandle value(thread_, reinterpret_cast(result1.GetRawData())); JSHandle inputString = - thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("The Quick Brown Fox Jumps Over The Lazy Dog"); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("The Quick Brown Fox Jumps Over The Lazy Dog"); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(value.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, inputString.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); // invoke Exec method JSTaggedValue results = BuiltinsRegExp::Exec(ecmaRuntimeCallInfo.get()); - JSHandle execResult(thread, results); + JSHandle execResult(thread_, results); JSHandle resultZero = - thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("Quick Brown Fox Jumps"); - JSHandle resultOne = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("Brown"); - JSHandle resultTwo = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("Jumps"); + thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("Quick Brown Fox Jumps"); + JSHandle resultOne = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("Brown"); + JSHandle resultTwo = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("Jumps"); - JSHandle index(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("index")); - JSHandle indexHandle(JSObject::GetProperty(thread, execResult, index).GetValue()); - uint32_t resultIndex = JSTaggedValue::ToUint32(thread, indexHandle); + JSHandle index(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("index")); + JSHandle indexHandle(JSObject::GetProperty(thread_, execResult, index).GetValue()); + uint32_t resultIndex = JSTaggedValue::ToUint32(thread_, indexHandle); ASSERT_TRUE(resultIndex == 4); - JSHandle input(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("input")); + JSHandle input(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("input")); - JSHandle inputHandle(JSObject::GetProperty(thread, execResult, input).GetValue()); - JSHandle outputInput = JSTaggedValue::ToString(thread, inputHandle); + JSHandle inputHandle(JSObject::GetProperty(thread_, execResult, input).GetValue()); + JSHandle outputInput = JSTaggedValue::ToString(thread_, inputHandle); ASSERT_EQ(outputInput->Compare(*inputString), 0); - JSHandle zero(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("0")); - JSHandle zeroHandle(JSObject::GetProperty(thread, execResult, zero).GetValue()); - JSHandle outputZero = JSTaggedValue::ToString(thread, zeroHandle); + JSHandle zero(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("0")); + JSHandle zeroHandle(JSObject::GetProperty(thread_, execResult, zero).GetValue()); + JSHandle outputZero = JSTaggedValue::ToString(thread_, zeroHandle); ASSERT_EQ(outputZero->Compare(*resultZero), 0); - JSHandle first(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("1")); - JSHandle oneHandle(JSObject::GetProperty(thread, execResult, first).GetValue()); - JSHandle outputOne = JSTaggedValue::ToString(thread, oneHandle); + JSHandle first(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("1")); + JSHandle oneHandle(JSObject::GetProperty(thread_, execResult, first).GetValue()); + JSHandle outputOne = JSTaggedValue::ToString(thread_, oneHandle); ASSERT_EQ(outputOne->Compare(*resultOne), 0); - JSHandle second(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("2")); - JSHandle twoHandle(JSObject::GetProperty(thread, execResult, second).GetValue()); - JSHandle outputTwo = JSTaggedValue::ToString(thread, twoHandle); + JSHandle second(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("2")); + JSHandle twoHandle(JSObject::GetProperty(thread_, execResult, second).GetValue()); + JSHandle outputTwo = JSTaggedValue::ToString(thread_, twoHandle); ASSERT_EQ(outputTwo->Compare(*resultTwo), 0); JSHandle regexp = JSHandle::Cast(value); - JSHandle lastIndexHandle(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("lastIndex")); - JSHandle lastIndexObj(JSObject::GetProperty(thread, regexp, lastIndexHandle).GetValue()); + JSHandle lastIndexHandle( + thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("lastIndex")); + JSHandle lastIndexObj(JSObject::GetProperty(thread_, regexp, lastIndexHandle).GetValue()); int lastIndex = lastIndexObj->GetInt(); ASSERT_TRUE(lastIndex == 25); } @@ -337,75 +338,76 @@ TEST_F(BuiltinsRegExpTest, Exec2) { // invoke RegExpConstructor method JSHandle pattern1 = - thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("((1)|(12))((3)|(23))"); - JSHandle flags1 = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("ig"); - JSTaggedValue result1 = CreateRegExpObjByPatternAndFlags(thread, pattern1, flags1); - JSHandle value(thread, reinterpret_cast(result1.GetRawData())); + thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("((1)|(12))((3)|(23))"); + JSHandle flags1 = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("ig"); + JSTaggedValue result1 = CreateRegExpObjByPatternAndFlags(thread_, pattern1, flags1); + JSHandle value(thread_, reinterpret_cast(result1.GetRawData())); - JSHandle inputString = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("123"); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + JSHandle inputString = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("123"); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(value.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, inputString.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); // invoke Exec method JSTaggedValue results = BuiltinsRegExp::Exec(ecmaRuntimeCallInfo.get()); - JSHandle execResult(thread, results); - JSHandle resultZero = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("123"); - JSHandle resultOne = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("1"); - JSHandle resultTwo = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("1"); - JSHandle resultFour = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("23"); - JSHandle resultSix = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("23"); + JSHandle execResult(thread_, results); + JSHandle resultZero = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("123"); + JSHandle resultOne = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("1"); + JSHandle resultTwo = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("1"); + JSHandle resultFour = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("23"); + JSHandle resultSix = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("23"); - JSHandle index(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("index")); - JSHandle indexHandle(JSObject::GetProperty(thread, execResult, index).GetValue()); - uint32_t resultIndex = JSTaggedValue::ToUint32(thread, indexHandle); + JSHandle index(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("index")); + JSHandle indexHandle(JSObject::GetProperty(thread_, execResult, index).GetValue()); + uint32_t resultIndex = JSTaggedValue::ToUint32(thread_, indexHandle); ASSERT_TRUE(resultIndex == 0); - JSHandle input(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("input")); - JSHandle inputHandle(JSObject::GetProperty(thread, execResult, input).GetValue()); - JSHandle outputInput = JSTaggedValue::ToString(thread, inputHandle); + JSHandle input(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("input")); + JSHandle inputHandle(JSObject::GetProperty(thread_, execResult, input).GetValue()); + JSHandle outputInput = JSTaggedValue::ToString(thread_, inputHandle); ASSERT_EQ(outputInput->Compare(*inputString), 0); - JSHandle zero(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("0")); - JSHandle zeroHandle(JSObject::GetProperty(thread, execResult, zero).GetValue()); - JSHandle outputZero = JSTaggedValue::ToString(thread, zeroHandle); + JSHandle zero(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("0")); + JSHandle zeroHandle(JSObject::GetProperty(thread_, execResult, zero).GetValue()); + JSHandle outputZero = JSTaggedValue::ToString(thread_, zeroHandle); ASSERT_EQ(outputZero->Compare(*resultZero), 0); - JSHandle first(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("1")); - JSHandle oneHandle(JSObject::GetProperty(thread, execResult, first).GetValue()); - JSHandle outputOne = JSTaggedValue::ToString(thread, oneHandle); + JSHandle first(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("1")); + JSHandle oneHandle(JSObject::GetProperty(thread_, execResult, first).GetValue()); + JSHandle outputOne = JSTaggedValue::ToString(thread_, oneHandle); ASSERT_EQ(outputOne->Compare(*resultOne), 0); - JSHandle second(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("2")); - JSHandle twoHandle(JSObject::GetProperty(thread, execResult, second).GetValue()); - JSHandle outputTwo = JSTaggedValue::ToString(thread, twoHandle); + JSHandle second(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("2")); + JSHandle twoHandle(JSObject::GetProperty(thread_, execResult, second).GetValue()); + JSHandle outputTwo = JSTaggedValue::ToString(thread_, twoHandle); ASSERT_EQ(outputTwo->Compare(*resultTwo), 0); JSHandle regexp = JSHandle::Cast(value); - JSHandle lastIndexHandle(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("lastIndex")); - JSHandle lastIndexObj(JSObject::GetProperty(thread, regexp, lastIndexHandle).GetValue()); + JSHandle lastIndexHandle( + thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("lastIndex")); + JSHandle lastIndexObj(JSObject::GetProperty(thread_, regexp, lastIndexHandle).GetValue()); int lastIndex = lastIndexObj->GetInt(); ASSERT_TRUE(lastIndex == 3); - JSHandle third(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("3")); - JSHandle thirdHandle(JSObject::GetProperty(thread, execResult, third).GetValue()); + JSHandle third(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("3")); + JSHandle thirdHandle(JSObject::GetProperty(thread_, execResult, third).GetValue()); ASSERT_TRUE(thirdHandle->IsUndefined()); - JSHandle four(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("4")); - JSHandle fourHandle(JSObject::GetProperty(thread, execResult, four).GetValue()); - JSHandle outputFour = JSTaggedValue::ToString(thread, fourHandle); + JSHandle four(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("4")); + JSHandle fourHandle(JSObject::GetProperty(thread_, execResult, four).GetValue()); + JSHandle outputFour = JSTaggedValue::ToString(thread_, fourHandle); ASSERT_EQ(outputFour->Compare(*resultFour), 0); - JSHandle five(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("5")); - JSHandle fiveHandle(JSObject::GetProperty(thread, execResult, five).GetValue()); + JSHandle five(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("5")); + JSHandle fiveHandle(JSObject::GetProperty(thread_, execResult, five).GetValue()); ASSERT_TRUE(fiveHandle->IsUndefined()); - JSHandle six(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("6")); - JSHandle sixHandle(JSObject::GetProperty(thread, execResult, six).GetValue()); - JSHandle outputSix = JSTaggedValue::ToString(thread, sixHandle); + JSHandle six(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("6")); + JSHandle sixHandle(JSObject::GetProperty(thread_, execResult, six).GetValue()); + JSHandle outputSix = JSTaggedValue::ToString(thread_, sixHandle); ASSERT_EQ(outputSix->Compare(*resultSix), 0); } @@ -413,28 +415,28 @@ TEST_F(BuiltinsRegExpTest, Match1) { // invoke RegExpConstructor method JSHandle pattern1 = - thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("quick\\s(brown).+?(jumps)"); - JSHandle flags1 = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("iug"); - JSTaggedValue result1 = CreateRegExpObjByPatternAndFlags(thread, pattern1, flags1); - JSHandle value(thread, reinterpret_cast(result1.GetRawData())); + thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("quick\\s(brown).+?(jumps)"); + JSHandle flags1 = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("iug"); + JSTaggedValue result1 = CreateRegExpObjByPatternAndFlags(thread_, pattern1, flags1); + JSHandle value(thread_, reinterpret_cast(result1.GetRawData())); JSHandle inputString = - thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("The Quick Brown Fox Jumps Over The Lazy Dog"); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("The Quick Brown Fox Jumps Over The Lazy Dog"); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(value.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, inputString.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); // invoke Match method JSTaggedValue matchResults = BuiltinsRegExp::Match(ecmaRuntimeCallInfo.get()); - JSHandle matchResult(thread, matchResults); - JSHandle zero(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("0")); + JSHandle matchResult(thread_, matchResults); + JSHandle zero(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("0")); JSHandle resultZero = - thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("Quick Brown Fox Jumps"); - JSHandle zeroHandle(JSObject::GetProperty(thread, matchResult, zero).GetValue()); - JSHandle outputZero = JSTaggedValue::ToString(thread, zeroHandle); + thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("Quick Brown Fox Jumps"); + JSHandle zeroHandle(JSObject::GetProperty(thread_, matchResult, zero).GetValue()); + JSHandle outputZero = JSTaggedValue::ToString(thread_, zeroHandle); ASSERT_EQ(outputZero->Compare(*resultZero), 0); } @@ -442,19 +444,19 @@ TEST_F(BuiltinsRegExpTest, Test1) { // invoke RegExpConstructor method JSHandle pattern1 = - thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("quick\\s(brown).+?(jumps)"); - JSHandle flags1 = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("iug"); - JSTaggedValue result1 = CreateRegExpObjByPatternAndFlags(thread, pattern1, flags1); - JSHandle value(thread, reinterpret_cast(result1.GetRawData())); + thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("quick\\s(brown).+?(jumps)"); + JSHandle flags1 = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("iug"); + JSTaggedValue result1 = CreateRegExpObjByPatternAndFlags(thread_, pattern1, flags1); + JSHandle value(thread_, reinterpret_cast(result1.GetRawData())); JSHandle inputString = - thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("The Quick Brown Fox Jumps Over The Lazy Dog"); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("The Quick Brown Fox Jumps Over The Lazy Dog"); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(value.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, inputString.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); // invoke Test method JSTaggedValue testResult = BuiltinsRegExp::Test(ecmaRuntimeCallInfo.get()); ASSERT_EQ(testResult.GetRawData(), JSTaggedValue::True().GetRawData()); @@ -464,19 +466,19 @@ TEST_F(BuiltinsRegExpTest, Search1) { // invoke RegExpConstructor method JSHandle pattern1 = - thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("quick\\s(brown).+?(jumps)"); - JSHandle flags1 = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("iug"); - JSTaggedValue result1 = CreateRegExpObjByPatternAndFlags(thread, pattern1, flags1); - JSHandle value(thread, reinterpret_cast(result1.GetRawData())); + thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("quick\\s(brown).+?(jumps)"); + JSHandle flags1 = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("iug"); + JSTaggedValue result1 = CreateRegExpObjByPatternAndFlags(thread_, pattern1, flags1); + JSHandle value(thread_, reinterpret_cast(result1.GetRawData())); JSHandle inputString = - thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("The Quick Brown Fox Jumps Over The Lazy Dog"); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("The Quick Brown Fox Jumps Over The Lazy Dog"); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(value.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, inputString.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); // invoke Search method JSTaggedValue searchResult = BuiltinsRegExp::Search(ecmaRuntimeCallInfo.get()); ASSERT_EQ(searchResult.GetRawData(), JSTaggedValue(4).GetRawData()); @@ -485,27 +487,27 @@ TEST_F(BuiltinsRegExpTest, Search1) TEST_F(BuiltinsRegExpTest, Split1) { // invoke RegExpConstructor method - JSHandle pattern1 = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("-"); - JSHandle flags1 = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("iug"); - JSTaggedValue result1 = CreateRegExpObjByPatternAndFlags(thread, pattern1, flags1); - JSHandle value(thread, reinterpret_cast(result1.GetRawData())); + JSHandle pattern1 = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("-"); + JSHandle flags1 = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("iug"); + JSTaggedValue result1 = CreateRegExpObjByPatternAndFlags(thread_, pattern1, flags1); + JSHandle value(thread_, reinterpret_cast(result1.GetRawData())); - JSHandle inputString = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(""); + JSHandle inputString = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(""); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(value.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, inputString.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue::Undefined()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); // invoke Split method JSTaggedValue splitResults = BuiltinsRegExp::Split(ecmaRuntimeCallInfo.get()); - JSHandle splitResult(thread, splitResults); + JSHandle splitResult(thread_, splitResults); - JSHandle zero(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("0")); - JSHandle zeroHandle(JSObject::GetProperty(thread, splitResult, zero).GetValue()); - JSHandle outputZero = JSTaggedValue::ToString(thread, zeroHandle); + JSHandle zero(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("0")); + JSHandle zeroHandle(JSObject::GetProperty(thread_, splitResult, zero).GetValue()); + JSHandle outputZero = JSTaggedValue::ToString(thread_, zeroHandle); ASSERT_EQ(outputZero->Compare(*inputString), 0); } @@ -513,54 +515,54 @@ TEST_F(BuiltinsRegExpTest, Split1) TEST_F(BuiltinsRegExpTest, Split2) { // invoke RegExpConstructor method - JSHandle pattern1 = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("-"); - JSHandle flags1 = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("iug"); - JSTaggedValue result1 = CreateRegExpObjByPatternAndFlags(thread, pattern1, flags1); - JSHandle value(thread, reinterpret_cast(result1.GetRawData())); + JSHandle pattern1 = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("-"); + JSHandle flags1 = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("iug"); + JSTaggedValue result1 = CreateRegExpObjByPatternAndFlags(thread_, pattern1, flags1); + JSHandle value(thread_, reinterpret_cast(result1.GetRawData())); - JSHandle inputString = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("a-b-c"); + JSHandle inputString = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("a-b-c"); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(value.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, inputString.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue::Undefined()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); // invoke Split method JSTaggedValue splitResults = BuiltinsRegExp::Split(ecmaRuntimeCallInfo.get()); - JSHandle splitResult(thread, splitResults); - JSHandle resultZero = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("a"); - JSHandle resultOne = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("b"); - JSHandle resultTwo = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("c"); - - JSHandle zero(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("0")); - JSHandle zeroHandle(JSObject::GetProperty(thread, splitResult, zero).GetValue()); - JSHandle outputZero = JSTaggedValue::ToString(thread, zeroHandle); + JSHandle splitResult(thread_, splitResults); + JSHandle resultZero = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("a"); + JSHandle resultOne = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("b"); + JSHandle resultTwo = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("c"); + + JSHandle zero(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("0")); + JSHandle zeroHandle(JSObject::GetProperty(thread_, splitResult, zero).GetValue()); + JSHandle outputZero = JSTaggedValue::ToString(thread_, zeroHandle); ASSERT_EQ(outputZero->Compare(*resultZero), 0); - JSHandle first(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("1")); - JSHandle oneHandle(JSObject::GetProperty(thread, splitResult, first).GetValue()); - JSHandle outputOne = JSTaggedValue::ToString(thread, oneHandle); + JSHandle first(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("1")); + JSHandle oneHandle(JSObject::GetProperty(thread_, splitResult, first).GetValue()); + JSHandle outputOne = JSTaggedValue::ToString(thread_, oneHandle); ASSERT_EQ(outputOne->Compare(*resultOne), 0); - JSHandle second(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("2")); - JSHandle twoHandle(JSObject::GetProperty(thread, splitResult, second).GetValue()); - JSHandle outputTwo = JSTaggedValue::ToString(thread, twoHandle); + JSHandle second(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("2")); + JSHandle twoHandle(JSObject::GetProperty(thread_, splitResult, second).GetValue()); + JSHandle outputTwo = JSTaggedValue::ToString(thread_, twoHandle); ASSERT_EQ(outputTwo->Compare(*resultTwo), 0); } TEST_F(BuiltinsRegExpTest, GetSpecies) { // invoke RegExpConstructor method - JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); + JSHandle env = thread_->GetEcmaVM()->GetGlobalEnv(); JSHandle speciesSymbol = env->GetSpeciesSymbol(); EXPECT_TRUE(!speciesSymbol.GetTaggedValue().IsUndefined()); JSHandle newTarget(env->GetRegExpFunction()); JSTaggedValue value = - JSObject::GetProperty(thread, JSHandle(newTarget), speciesSymbol).GetValue().GetTaggedValue(); + JSObject::GetProperty(thread_, JSHandle(newTarget), speciesSymbol).GetValue().GetTaggedValue(); EXPECT_EQ(value, newTarget.GetTaggedValue()); } @@ -568,26 +570,26 @@ TEST_F(BuiltinsRegExpTest, Replace1) { // invoke RegExpConstructor method JSHandle pattern1 = - thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("quick\\s(brown).+?(jumps)"); - JSHandle flags1 = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("iug"); - JSTaggedValue result1 = CreateRegExpObjByPatternAndFlags(thread, pattern1, flags1); - JSHandle value(thread, reinterpret_cast(result1.GetRawData())); + thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("quick\\s(brown).+?(jumps)"); + JSHandle flags1 = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("iug"); + JSTaggedValue result1 = CreateRegExpObjByPatternAndFlags(thread_, pattern1, flags1); + JSHandle value(thread_, reinterpret_cast(result1.GetRawData())); JSHandle inputString = - thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("The Quick Brown Fox Jumps Over The Lazy Dog"); + thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("The Quick Brown Fox Jumps Over The Lazy Dog"); JSHandle replaceString = - thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("$&a $` $\' $2 $01 $$1 $21 $32 a"); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("$&a $` $\' $2 $01 $$1 $21 $32 a"); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(value.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, inputString.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(1, replaceString.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); // invoke replace method JSTaggedValue results = BuiltinsRegExp::Replace(ecmaRuntimeCallInfo.get()); - JSHandle replaceResult(thread, results); - JSHandle resultZero = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString( + JSHandle replaceResult(thread_, results); + JSHandle resultZero = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString( "The Quick Brown Fox Jumpsa The Over The Lazy Dog Jumps Brown $1 Jumps1 $32 a Over The Lazy Dog"); ASSERT_EQ(static_cast(replaceResult->GetTaggedObject())->Compare(*resultZero), 0); } @@ -595,24 +597,24 @@ TEST_F(BuiltinsRegExpTest, Replace1) TEST_F(BuiltinsRegExpTest, Replace2) { // invoke RegExpConstructor method - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); JSHandle pattern1 = factory->NewFromCanBeCompressString("b(c)(z)?(.)"); JSHandle flags1 = factory->NewFromCanBeCompressString(""); - JSTaggedValue result1 = CreateRegExpObjByPatternAndFlags(thread, pattern1, flags1); - JSHandle value(thread, reinterpret_cast(result1.GetRawData())); + JSTaggedValue result1 = CreateRegExpObjByPatternAndFlags(thread_, pattern1, flags1); + JSHandle value(thread_, reinterpret_cast(result1.GetRawData())); JSHandle inputString = factory->NewFromCanBeCompressString("abcde"); JSHandle replaceString = factory->NewFromCanBeCompressString("[$01$02$03$04$00]"); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(value.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, inputString.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(1, replaceString.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); // invoke replace method JSTaggedValue results = BuiltinsRegExp::Replace(ecmaRuntimeCallInfo.get()); - JSHandle replaceResult(thread, results); + JSHandle replaceResult(thread_, results); JSHandle resultZero = factory->NewFromCanBeCompressString("a[cd$04$00]e"); ASSERT_EQ(static_cast(replaceResult->GetTaggedObject())->Compare(*resultZero), 0); } @@ -620,32 +622,32 @@ TEST_F(BuiltinsRegExpTest, Replace2) TEST_F(BuiltinsRegExpTest, Replace3) { // invoke RegExpConstructor method - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); JSHandle pattern1 = factory->NewFromCanBeCompressString("abc"); JSHandle flags1 = factory->NewFromCanBeCompressString("g"); - JSTaggedValue result1 = CreateRegExpObjByPatternAndFlags(thread, pattern1, flags1); - JSHandle value(thread, reinterpret_cast(result1.GetRawData())); + JSTaggedValue result1 = CreateRegExpObjByPatternAndFlags(thread_, pattern1, flags1); + JSHandle value(thread_, reinterpret_cast(result1.GetRawData())); JSHandle inputString = factory->NewFromCanBeCompressString("abcde"); JSHandle replaceString = factory->NewFromCanBeCompressString(""); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(value.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, inputString.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(1, replaceString.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); // invoke replace method JSTaggedValue results = BuiltinsRegExp::Replace(ecmaRuntimeCallInfo.get()); - JSHandle replaceResult(thread, results); + JSHandle replaceResult(thread_, results); JSHandle resultZero = factory->NewFromCanBeCompressString("de"); ASSERT_EQ(static_cast(replaceResult->GetTaggedObject())->Compare(*resultZero), 0); } TEST_F(BuiltinsRegExpTest, RegExpParseCache) { - RegExpParserCache *regExpParserCache = thread->GetEcmaVM()->GetRegExpParserCache(); - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + RegExpParserCache *regExpParserCache = thread_->GetEcmaVM()->GetRegExpParserCache(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); JSHandle string1 = factory->NewFromCanBeCompressString("abc"); JSHandle string2 = factory->NewFromCanBeCompressString("abcd"); regExpParserCache->SetCache(*string1, 0, JSTaggedValue::True(), 2); diff --git a/tests/runtime/builtins/builtins_set_test.cpp b/tests/runtime/builtins/builtins_set_test.cpp index 9be2b958f533b69afaf64b6342e16250faa9d34e..00a5d397e4a295df3bcfeb26ddff8d5976b5948d 100644 --- a/tests/runtime/builtins/builtins_set_test.cpp +++ b/tests/runtime/builtins/builtins_set_test.cpp @@ -51,17 +51,17 @@ public: void SetUp() override { - TestHelper::CreateEcmaVMWithScope(instance, thread, scope); + TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); } void TearDown() override { - TestHelper::DestroyEcmaVMWithScope(instance, scope); + TestHelper::DestroyEcmaVMWithScope(instance_, scope_); } - PandaVM *instance {nullptr}; - EcmaHandleScope *scope {nullptr}; - JSThread *thread {nullptr}; + PandaVM *instance_ {nullptr}; + EcmaHandleScope *scope_ {nullptr}; + JSThread *thread_ {nullptr}; class TestClass : public base::BuiltinsBase { public: @@ -97,17 +97,17 @@ JSSet *CreateBuiltinsSet(JSThread *thread) // new Set("abrupt").toString() TEST_F(BuiltinsSetTest, CreateAndGetSize) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle env = thread_->GetEcmaVM()->GetGlobalEnv(); JSHandle newTarget(env->GetBuiltinsSetFunction()); - JSHandle set(thread, CreateBuiltinsSet(thread)); + JSHandle set(thread_, CreateBuiltinsSet(thread_)); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(set.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue::Undefined()); { - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsSet::GetSize(ecmaRuntimeCallInfo.get()); EXPECT_EQ(result.GetRawData(), JSTaggedValue(0).GetRawData()); @@ -115,17 +115,17 @@ TEST_F(BuiltinsSetTest, CreateAndGetSize) JSHandle array(factory->NewTaggedArray(5)); for (int i = 0; i < 5; i++) { - array->Set(thread, i, JSTaggedValue(i)); + array->Set(thread_, i, JSTaggedValue(i)); } - JSHandle values = JSArray::CreateArrayFromList(thread, array); - auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + JSHandle values = JSArray::CreateArrayFromList(thread_, array); + auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo1->SetFunction(newTarget.GetTaggedValue()); ecmaRuntimeCallInfo1->SetThis(set.GetTaggedValue()); ecmaRuntimeCallInfo1->SetCallArg(0, values.GetTaggedValue()); ecmaRuntimeCallInfo1->SetNewTarget(newTarget.GetTaggedValue()); { - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); JSTaggedValue result1 = BuiltinsSet::SetConstructor(ecmaRuntimeCallInfo1.get()); EXPECT_EQ(JSSet::Cast(reinterpret_cast(result1.GetRawData()))->GetSize(), 5); @@ -134,17 +134,17 @@ TEST_F(BuiltinsSetTest, CreateAndGetSize) TEST_F(BuiltinsSetTest, AddAndHas) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); // create jsSet - JSHandle set(thread, CreateBuiltinsSet(thread)); - JSHandle key(thread, factory->NewFromCanBeCompressString("key").GetTaggedValue()); + JSHandle set(thread_, CreateBuiltinsSet(thread_)); + JSHandle key(thread_, factory->NewFromCanBeCompressString("key").GetTaggedValue()); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(set.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, key.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result1 = BuiltinsSet::Has(ecmaRuntimeCallInfo.get()); EXPECT_EQ(result1.GetRawData(), JSTaggedValue::False().GetRawData()); @@ -156,35 +156,35 @@ TEST_F(BuiltinsSetTest, AddAndHas) EXPECT_EQ(jsSet->GetSize(), 1); // test Has() - auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo1->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo1->SetThis(JSTaggedValue(jsSet)); ecmaRuntimeCallInfo1->SetCallArg(0, key.GetTaggedValue()); { - [[maybe_unused]] auto prevLocal = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); + [[maybe_unused]] auto prevLocal = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); JSTaggedValue result3 = BuiltinsSet::Has(ecmaRuntimeCallInfo1.get()); EXPECT_EQ(result3.GetRawData(), JSTaggedValue::True().GetRawData()); } // test -0.0 - JSHandle negativeZero(thread, JSTaggedValue(-0.0)); - JSHandle positiveZero(thread, JSTaggedValue(+0.0)); - auto ecmaRuntimeCallInfo2 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + JSHandle negativeZero(thread_, JSTaggedValue(-0.0)); + JSHandle positiveZero(thread_, JSTaggedValue(+0.0)); + auto ecmaRuntimeCallInfo2 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo2->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo2->SetThis(JSTaggedValue(jsSet)); ecmaRuntimeCallInfo2->SetCallArg(0, negativeZero.GetTaggedValue()); { - [[maybe_unused]] auto prevLocal = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo2.get()); + [[maybe_unused]] auto prevLocal = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo2.get()); BuiltinsSet::Add(ecmaRuntimeCallInfo.get()); } - auto ecmaRuntimeCallInfo3 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto ecmaRuntimeCallInfo3 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo3->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo3->SetThis(JSTaggedValue(jsSet)); ecmaRuntimeCallInfo3->SetCallArg(0, positiveZero.GetTaggedValue()); { - [[maybe_unused]] auto prevLocal = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo3.get()); + [[maybe_unused]] auto prevLocal = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo3.get()); JSTaggedValue result4 = BuiltinsSet::Has(ecmaRuntimeCallInfo3.get()); EXPECT_EQ(result4.GetRawData(), JSTaggedValue::False().GetRawData()); @@ -194,18 +194,18 @@ TEST_F(BuiltinsSetTest, AddAndHas) 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)); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle set(thread_, CreateBuiltinsSet(thread_)); char keyArray[] = "key0"; for (int i = 0; i < 5; i++) { keyArray[3] = '1' + i; JSHandle key(factory->NewFromCanBeCompressString(keyArray)); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(set.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, key.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result1 = BuiltinsSet::Add(ecmaRuntimeCallInfo.get()); EXPECT_TRUE(result1.IsECMAObject()); @@ -213,17 +213,17 @@ TEST_F(BuiltinsSetTest, ForEach) EXPECT_EQ(jsSet->GetSize(), i + 1); } // test foreach; - JSHandle jsArray(JSArray::ArrayCreate(thread, JSTaggedNumber(0))); + JSHandle jsArray(JSArray::ArrayCreate(thread_, JSTaggedNumber(0))); JSHandle func = - factory->NewJSFunction(thread->GetEcmaVM()->GetGlobalEnv(), reinterpret_cast(TestClass::TestFunc)); + factory->NewJSFunction(thread_->GetEcmaVM()->GetGlobalEnv(), reinterpret_cast(TestClass::TestFunc)); - auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); ecmaRuntimeCallInfo1->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo1->SetThis(set.GetTaggedValue()); ecmaRuntimeCallInfo1->SetCallArg(0, func.GetTaggedValue()); ecmaRuntimeCallInfo1->SetCallArg(1, jsArray.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); JSTaggedValue result2 = BuiltinsSet::ForEach(ecmaRuntimeCallInfo1.get()); EXPECT_EQ(result2.GetRawData(), JSTaggedValue::VALUE_UNDEFINED); @@ -232,9 +232,9 @@ TEST_F(BuiltinsSetTest, ForEach) TEST_F(BuiltinsSetTest, DeleteAndRemove) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); // create jsSet - JSHandle set(thread, CreateBuiltinsSet(thread)); + JSHandle set(thread_, CreateBuiltinsSet(thread_)); // add 40 keys char keyArray[] = "key0"; @@ -242,12 +242,12 @@ TEST_F(BuiltinsSetTest, DeleteAndRemove) keyArray[3] = '1' + i; JSHandle key(factory->NewFromCanBeCompressString(keyArray)); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(set.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, key.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result1 = BuiltinsSet::Add(ecmaRuntimeCallInfo.get()); EXPECT_TRUE(result1.IsECMAObject()); @@ -258,12 +258,12 @@ TEST_F(BuiltinsSetTest, DeleteAndRemove) keyArray[3] = '1' + 8; JSHandle deleteKey(factory->NewFromCanBeCompressString(keyArray)); - auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo1->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo1->SetThis(set.GetTaggedValue()); ecmaRuntimeCallInfo1->SetCallArg(0, deleteKey.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); JSTaggedValue result2 = BuiltinsSet::Has(ecmaRuntimeCallInfo1.get()); EXPECT_EQ(result2.GetRawData(), JSTaggedValue::True().GetRawData()); @@ -290,73 +290,73 @@ TEST_F(BuiltinsSetTest, DeleteAndRemove) TEST_F(BuiltinsSetTest, Species) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); - JSHandle set(thread, CreateBuiltinsSet(thread)); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle env = thread_->GetEcmaVM()->GetGlobalEnv(); + JSHandle set(thread_, CreateBuiltinsSet(thread_)); JSHandle speciesSymbol = env->GetSpeciesSymbol(); EXPECT_TRUE(!speciesSymbol->IsUndefined()); JSHandle newTarget(env->GetBuiltinsSetFunction()); JSTaggedValue value = - JSObject::GetProperty(thread, JSHandle(newTarget), speciesSymbol).GetValue().GetTaggedValue(); - JSHandle valueHandle(thread, value); + JSObject::GetProperty(thread_, JSHandle(newTarget), speciesSymbol).GetValue().GetTaggedValue(); + JSHandle valueHandle(thread_, value); EXPECT_EQ(value, newTarget.GetTaggedValue()); // to string tag JSHandle toStringTagSymbol = env->GetToStringTagSymbol(); - JSHandle stringTag(JSObject::GetProperty(thread, set, toStringTagSymbol).GetValue()); + JSHandle stringTag(JSObject::GetProperty(thread_, set, toStringTagSymbol).GetValue()); JSHandle str = factory->NewFromCanBeCompressString("Set"); EXPECT_TRUE(!stringTag.GetTaggedValue().IsUndefined()); EXPECT_TRUE(EcmaString::StringsAreEqual(*str, *stringTag)); - JSHandle constructor = JSHandle::Cast(JSTaggedValue::ToObject(thread, valueHandle)); - EXPECT_EQ(JSHandle(set)->GetPrototype(thread), constructor->GetFunctionPrototype()); + JSHandle constructor = JSHandle::Cast(JSTaggedValue::ToObject(thread_, valueHandle)); + EXPECT_EQ(JSHandle(set)->GetPrototype(thread_), constructor->GetFunctionPrototype()); JSHandle key1(factory->NewFromCanBeCompressString("add")); - JSTaggedValue value1 = JSObject::GetProperty(thread, set, key1).GetValue().GetTaggedValue(); + JSTaggedValue value1 = JSObject::GetProperty(thread_, set, key1).GetValue().GetTaggedValue(); EXPECT_FALSE(value1.IsUndefined()); JSHandle key2(factory->NewFromCanBeCompressString("has")); - JSTaggedValue value2 = JSObject::GetProperty(thread, set, key1).GetValue().GetTaggedValue(); + JSTaggedValue value2 = JSObject::GetProperty(thread_, set, key1).GetValue().GetTaggedValue(); EXPECT_FALSE(value2.IsUndefined()); JSHandle key3(factory->NewFromCanBeCompressString("clear")); - JSTaggedValue value3 = JSObject::GetProperty(thread, set, key1).GetValue().GetTaggedValue(); + JSTaggedValue value3 = JSObject::GetProperty(thread_, set, key1).GetValue().GetTaggedValue(); EXPECT_FALSE(value3.IsUndefined()); JSHandle key4(factory->NewFromCanBeCompressString("size")); - JSTaggedValue value4 = JSObject::GetProperty(thread, set, key1).GetValue().GetTaggedValue(); + JSTaggedValue value4 = JSObject::GetProperty(thread_, set, key1).GetValue().GetTaggedValue(); EXPECT_FALSE(value4.IsUndefined()); JSHandle key5(factory->NewFromCanBeCompressString("delete")); - JSTaggedValue value5 = JSObject::GetProperty(thread, set, key1).GetValue().GetTaggedValue(); + JSTaggedValue value5 = JSObject::GetProperty(thread_, set, key1).GetValue().GetTaggedValue(); EXPECT_FALSE(value5.IsUndefined()); JSHandle key6(factory->NewFromCanBeCompressString("forEach")); - JSTaggedValue value6 = JSObject::GetProperty(thread, set, key1).GetValue().GetTaggedValue(); + JSTaggedValue value6 = JSObject::GetProperty(thread_, set, key1).GetValue().GetTaggedValue(); EXPECT_FALSE(value6.IsUndefined()); } TEST_F(BuiltinsSetTest, GetIterator) { - JSHandle set(thread, CreateBuiltinsSet(thread)); + JSHandle set(thread_, CreateBuiltinsSet(thread_)); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(set.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); // test Values() JSTaggedValue result = BuiltinsSet::Values(ecmaRuntimeCallInfo.get()); - JSHandle iter(thread, result); + JSHandle iter(thread_, result); EXPECT_TRUE(iter->IsJSSetIterator()); EXPECT_EQ(IterationKind::VALUE, IterationKind(iter->GetIterationKind().GetInt())); EXPECT_EQ(JSSet::Cast(set.GetTaggedValue().GetTaggedObject())->GetLinkedSet(), iter->GetIteratedSet()); // test entrys() JSTaggedValue result2 = BuiltinsSet::Entries(ecmaRuntimeCallInfo.get()); - JSHandle iter2(thread, result2); + JSHandle iter2(thread_, result2); EXPECT_TRUE(iter2->IsJSSetIterator()); EXPECT_EQ(IterationKind::KEY_AND_VALUE, IterationKind(iter2->GetIterationKind().GetInt())); } diff --git a/tests/runtime/builtins/builtins_string_test.cpp b/tests/runtime/builtins/builtins_string_test.cpp index 1ab23e7380d1aef6c4be976795a172f5ed8097e3..5f6988ec77745c70c0394fed41f6dfcd6c84ae9b 100644 --- a/tests/runtime/builtins/builtins_string_test.cpp +++ b/tests/runtime/builtins/builtins_string_test.cpp @@ -46,17 +46,17 @@ public: void SetUp() override { - TestHelper::CreateEcmaVMWithScope(instance, thread, scope); + TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); } void TearDown() override { - TestHelper::DestroyEcmaVMWithScope(instance, scope); + TestHelper::DestroyEcmaVMWithScope(instance_, scope_); } - PandaVM *instance {nullptr}; - EcmaHandleScope *scope {nullptr}; - JSThread *thread {nullptr}; + PandaVM *instance_ {nullptr}; + EcmaHandleScope *scope_ {nullptr}; + JSThread *thread_ {nullptr}; }; JSTaggedValue CreateRegExpObjByPatternAndFlags(JSThread *thread, const JSHandle &pattern, @@ -80,23 +80,23 @@ JSTaggedValue CreateRegExpObjByPatternAndFlags(JSThread *thread, const JSHandle< TEST_F(BuiltinsStringTest, StringConstructor1) { - JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); + JSHandle env = thread_->GetEcmaVM()->GetGlobalEnv(); - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); JSHandle string(env->GetStringFunction()); - JSHandle globalObject(thread, env->GetGlobalObject()); + JSHandle globalObject(thread_, env->GetGlobalObject()); JSHandle string2 = factory->NewFromCanBeCompressString("ABC"); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, string.GetTaggedValue(), 6); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, string.GetTaggedValue(), 6); ecmaRuntimeCallInfo->SetFunction(string.GetTaggedValue()); ecmaRuntimeCallInfo->SetThis(globalObject.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, string2.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsString::StringConstructor(ecmaRuntimeCallInfo.get()); JSTaggedValue value(static_cast(result.GetRawData())); ASSERT_TRUE(value.IsECMAObject()); - JSHandle ref(thread, JSPrimitiveRef::Cast(value.GetTaggedObject())); + JSHandle ref(thread_, JSPrimitiveRef::Cast(value.GetTaggedObject())); JSTaggedValue test = factory->NewFromCanBeCompressString("ABC").GetTaggedValue(); ASSERT_EQ( EcmaString::Cast(ref->GetValue().GetTaggedObject())->Compare(reinterpret_cast(test.GetRawData())), @@ -106,23 +106,23 @@ TEST_F(BuiltinsStringTest, StringConstructor1) // String.fromCharCode(65, 66, 67) TEST_F(BuiltinsStringTest, fromCharCode1) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); const double arg1 = 65; const double arg2 = 66; const double arg3 = 67; - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 10); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 10); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(arg1)); ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(arg2)); ecmaRuntimeCallInfo->SetCallArg(2, JSTaggedValue(arg3)); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsString::FromCharCode(ecmaRuntimeCallInfo.get()); ASSERT_TRUE(result.IsString()); JSTaggedValue value(static_cast(result.GetRawData())); - JSHandle valueHandle(thread, JSTaggedValue(value.GetTaggedObject())); + JSHandle valueHandle(thread_, JSTaggedValue(value.GetTaggedObject())); JSTaggedValue test = factory->NewFromCanBeCompressString("ABC").GetTaggedValue(); ASSERT_EQ( EcmaString::Cast(valueHandle->GetTaggedObject())->Compare(reinterpret_cast(test.GetRawData())), @@ -132,22 +132,22 @@ TEST_F(BuiltinsStringTest, fromCharCode1) // String.fromCodePoint(65, 66, 67) TEST_F(BuiltinsStringTest, fromCodePoint1) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); const double arg1 = 65; const double arg2 = 66; const double arg3 = 67; - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 10); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 10); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(arg1)); ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(arg2)); ecmaRuntimeCallInfo->SetCallArg(2, JSTaggedValue(arg3)); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsString::FromCodePoint(ecmaRuntimeCallInfo.get()); ASSERT_TRUE(result.IsString()); - JSHandle resultHandle(thread, reinterpret_cast(result.GetRawData())); + JSHandle resultHandle(thread_, reinterpret_cast(result.GetRawData())); JSTaggedValue test = factory->NewFromCanBeCompressString("ABC").GetTaggedValue(); ASSERT_EQ(resultHandle->Compare(reinterpret_cast(test.GetRawData())), 0); } @@ -155,18 +155,18 @@ TEST_F(BuiltinsStringTest, fromCodePoint1) // "abcabcabc".charAt(5) TEST_F(BuiltinsStringTest, charAt1) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); JSHandle thisVal = factory->NewFromCanBeCompressString("abcabcabc"); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(thisVal.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast(5))); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsString::CharAt(ecmaRuntimeCallInfo.get()); ASSERT_TRUE(result.IsString()); - JSHandle resultHandle(thread, reinterpret_cast(result.GetRawData())); + JSHandle resultHandle(thread_, reinterpret_cast(result.GetRawData())); JSTaggedValue test = factory->NewFromCanBeCompressString("c").GetTaggedValue(); ASSERT_EQ(resultHandle->Compare(reinterpret_cast(test.GetRawData())), 0); } @@ -174,18 +174,18 @@ TEST_F(BuiltinsStringTest, charAt1) // "一二三四".charAt(2) TEST_F(BuiltinsStringTest, charAt2) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); JSHandle thisVal = factory->NewFromString("一二三四"); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(thisVal.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast(2))); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsString::CharAt(ecmaRuntimeCallInfo.get()); ASSERT_TRUE(result.IsString()); - JSHandle resultHandle(thread, reinterpret_cast(result.GetRawData())); + JSHandle resultHandle(thread_, reinterpret_cast(result.GetRawData())); JSTaggedValue test = factory->NewFromString("三").GetTaggedValue(); ASSERT_EQ(resultHandle->Compare(reinterpret_cast(test.GetRawData())), 0); } @@ -193,18 +193,18 @@ TEST_F(BuiltinsStringTest, charAt2) // "abcabcabc".charAt(-1) TEST_F(BuiltinsStringTest, charAt3) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); JSHandle thisVal = factory->NewFromCanBeCompressString("abcabcabc"); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(thisVal.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast(-1))); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsString::CharAt(ecmaRuntimeCallInfo.get()); ASSERT_TRUE(result.IsString()); - JSHandle resultHandle(thread, reinterpret_cast(result.GetRawData())); + JSHandle resultHandle(thread_, reinterpret_cast(result.GetRawData())); JSTaggedValue test = factory->GetEmptyString().GetTaggedValue(); ASSERT_EQ(resultHandle->Compare(reinterpret_cast(test.GetRawData())), 0); } @@ -212,15 +212,15 @@ TEST_F(BuiltinsStringTest, charAt3) // "ABC".charCodeAt(0) TEST_F(BuiltinsStringTest, charCodeAt1) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); JSHandle thisVal = factory->NewFromCanBeCompressString("ABC"); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(thisVal.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast(0))); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsString::CharCodeAt(ecmaRuntimeCallInfo.get()); ASSERT_EQ(result.GetRawData(), JSTaggedValue(65).GetRawData()); @@ -229,15 +229,15 @@ TEST_F(BuiltinsStringTest, charCodeAt1) // "ABC".charCodeAt(-1) TEST_F(BuiltinsStringTest, charCodeAt2) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); JSHandle thisVal = factory->NewFromCanBeCompressString("ABC"); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(thisVal.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast(-1))); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsString::CharCodeAt(ecmaRuntimeCallInfo.get()); JSTaggedValue test = BuiltinsString::GetTaggedDouble(base::NAN_VALUE); @@ -247,15 +247,15 @@ TEST_F(BuiltinsStringTest, charCodeAt2) // "ABC".codePointAt(1) TEST_F(BuiltinsStringTest, codePointAt1) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); JSHandle thisVal = factory->NewFromCanBeCompressString("ABC"); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(thisVal.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast(1))); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsString::CodePointAt(ecmaRuntimeCallInfo.get()); ASSERT_EQ(result.GetRawData(), JSTaggedValue(66).GetRawData()); @@ -264,23 +264,23 @@ TEST_F(BuiltinsStringTest, codePointAt1) // 'a'.concat('b', 'c', 'd') TEST_F(BuiltinsStringTest, concat1) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); JSHandle thisStr = factory->NewFromCanBeCompressString("a"); JSHandle val1 = factory->NewFromCanBeCompressString("b"); JSHandle val2 = factory->NewFromCanBeCompressString("c"); JSHandle val3 = factory->NewFromCanBeCompressString("d"); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 10); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 10); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(thisStr.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, val1.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(1, val2.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(2, val3.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsString::Concat(ecmaRuntimeCallInfo.get()); ASSERT_TRUE(result.IsString()); - JSHandle resultHandle(thread, reinterpret_cast(result.GetRawData())); + JSHandle resultHandle(thread_, reinterpret_cast(result.GetRawData())); JSTaggedValue test = factory->NewFromCanBeCompressString("abcd").GetTaggedValue(); ASSERT_EQ(resultHandle->Compare(reinterpret_cast(test.GetRawData())), 0); } @@ -288,16 +288,16 @@ TEST_F(BuiltinsStringTest, concat1) // "abcabcabc".indexof('b') TEST_F(BuiltinsStringTest, indexof1) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); JSHandle thisStr = factory->NewFromCanBeCompressString("abcabcabc"); JSHandle val = factory->NewFromCanBeCompressString("b"); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(thisStr.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, val.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsString::IndexOf(ecmaRuntimeCallInfo.get()); ASSERT_EQ(result.GetRawData(), JSTaggedValue(1).GetRawData()); @@ -306,17 +306,17 @@ TEST_F(BuiltinsStringTest, indexof1) // "abcabcabc".indexof('b', 2) TEST_F(BuiltinsStringTest, indexof2) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); JSHandle thisStr = factory->NewFromCanBeCompressString("abcabcabc"); JSHandle val = factory->NewFromCanBeCompressString("b"); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(thisStr.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, val.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(static_cast(2))); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsString::IndexOf(ecmaRuntimeCallInfo.get()); ASSERT_EQ(result.GetRawData(), JSTaggedValue(4).GetRawData()); @@ -325,16 +325,16 @@ TEST_F(BuiltinsStringTest, indexof2) // "abcabcabc".indexof('d') TEST_F(BuiltinsStringTest, indexof3) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); JSHandle thisStr = factory->NewFromCanBeCompressString("abcabcabc"); JSHandle val = factory->NewFromCanBeCompressString("d"); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(thisStr.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, val.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsString::IndexOf(ecmaRuntimeCallInfo.get()); ASSERT_EQ(result.GetRawData(), JSTaggedValue(-1).GetRawData()); @@ -343,16 +343,16 @@ TEST_F(BuiltinsStringTest, indexof3) // "abcabcabc".lastIndexOf('b') TEST_F(BuiltinsStringTest, lastIndexOf1) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); JSHandle thisStr = factory->NewFromCanBeCompressString("abcabcabc"); JSHandle val = factory->NewFromCanBeCompressString("b"); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(thisStr.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, val.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsString::LastIndexOf(ecmaRuntimeCallInfo.get()); ASSERT_EQ(result.GetRawData(), JSTaggedValue(7).GetRawData()); @@ -360,17 +360,17 @@ TEST_F(BuiltinsStringTest, lastIndexOf1) // "abcabcabc".lastIndexOf('b', 2) TEST_F(BuiltinsStringTest, lastIndexOf2) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); JSHandle thisStr = factory->NewFromCanBeCompressString("abcabcabc"); JSHandle val = factory->NewFromCanBeCompressString("b"); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(thisStr.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, val.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(static_cast(2))); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsString::LastIndexOf(ecmaRuntimeCallInfo.get()); ASSERT_EQ(result.GetRawData(), JSTaggedValue(1).GetRawData()); @@ -379,16 +379,16 @@ TEST_F(BuiltinsStringTest, lastIndexOf2) // "abcabcabc".lastIndexOf('d') TEST_F(BuiltinsStringTest, lastIndexOf3) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); JSHandle thisStr = factory->NewFromCanBeCompressString("abcabcabc"); JSHandle val = factory->NewFromCanBeCompressString("d"); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(thisStr.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, val.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsString::LastIndexOf(ecmaRuntimeCallInfo.get()); ASSERT_EQ(result.GetRawData(), JSTaggedValue(-1).GetRawData()); @@ -397,16 +397,16 @@ TEST_F(BuiltinsStringTest, lastIndexOf3) // "abcabcabc".includes('b') TEST_F(BuiltinsStringTest, Includes2) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); JSHandle thisStr = factory->NewFromCanBeCompressString("abcabcabc"); JSHandle val = factory->NewFromCanBeCompressString("b"); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(thisStr.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, val.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsString::Includes(ecmaRuntimeCallInfo.get()); ASSERT_EQ(result.GetRawData(), JSTaggedValue::True().GetRawData()); @@ -415,17 +415,17 @@ TEST_F(BuiltinsStringTest, Includes2) // "abccccccc".includes('b',2) TEST_F(BuiltinsStringTest, Includes3) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); JSHandle thisStr = factory->NewFromCanBeCompressString("abccccccc"); JSHandle val = factory->NewFromCanBeCompressString("b"); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(thisStr.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, val.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(static_cast(2))); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsString::Includes(ecmaRuntimeCallInfo.get()); ASSERT_EQ(result.GetRawData(), JSTaggedValue::False().GetRawData()); @@ -434,16 +434,16 @@ TEST_F(BuiltinsStringTest, Includes3) // "一二三四".includes('二') TEST_F(BuiltinsStringTest, Includes4) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); JSHandle thisStr = factory->NewFromString("一二三四"); JSHandle val = factory->NewFromString("二"); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(thisStr.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, val.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsString::Includes(ecmaRuntimeCallInfo.get()); ASSERT_EQ(result.GetRawData(), JSTaggedValue::True().GetRawData()); @@ -452,16 +452,16 @@ TEST_F(BuiltinsStringTest, Includes4) // "To be, or not to be, that is the question.".startsWith('To be') TEST_F(BuiltinsStringTest, startsWith1) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); JSHandle thisStr = factory->NewFromCanBeCompressString("To be, or not to be, that is the question."); JSHandle val = factory->NewFromCanBeCompressString("To be"); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(thisStr.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, val.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsString::StartsWith(ecmaRuntimeCallInfo.get()); ASSERT_EQ(result.GetRawData(), JSTaggedValue::True().GetRawData()); @@ -470,16 +470,16 @@ TEST_F(BuiltinsStringTest, startsWith1) // "To be, or not to be, that is the question.".startsWith('not to be') TEST_F(BuiltinsStringTest, startsWith2) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); JSHandle thisStr = factory->NewFromCanBeCompressString("To be, or not to be, that is the question."); JSHandle val = factory->NewFromCanBeCompressString("not to be"); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(thisStr.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, val.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsString::StartsWith(ecmaRuntimeCallInfo.get()); ASSERT_EQ(result.GetRawData(), JSTaggedValue::False().GetRawData()); @@ -488,17 +488,17 @@ TEST_F(BuiltinsStringTest, startsWith2) // "To be, or not to be, that is the question.".startsWith('not to be', 10) TEST_F(BuiltinsStringTest, startsWith3) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); JSHandle thisStr = factory->NewFromCanBeCompressString("To be, or not to be, that is the question."); JSHandle val = factory->NewFromCanBeCompressString("not to be"); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(thisStr.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, val.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(static_cast(10))); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsString::StartsWith(ecmaRuntimeCallInfo.get()); ASSERT_EQ(result.GetRawData(), JSTaggedValue::True().GetRawData()); @@ -507,16 +507,16 @@ TEST_F(BuiltinsStringTest, startsWith3) // "To be, or not to be, that is the question.".endsWith('question.') TEST_F(BuiltinsStringTest, endsWith1) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); JSHandle thisStr = factory->NewFromCanBeCompressString("To be, or not to be, that is the question."); JSHandle val = factory->NewFromCanBeCompressString("question."); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(thisStr.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, val.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsString::EndsWith(ecmaRuntimeCallInfo.get()); ASSERT_EQ(result.GetRawData(), JSTaggedValue::True().GetRawData()); @@ -525,16 +525,16 @@ TEST_F(BuiltinsStringTest, endsWith1) // "To be, or not to be, that is the question.".endsWith('to be') TEST_F(BuiltinsStringTest, endsWith2) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); JSHandle thisStr = factory->NewFromCanBeCompressString("To be, or not to be, that is the question."); JSHandle val = factory->NewFromCanBeCompressString("to be"); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(thisStr.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, val.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsString::EndsWith(ecmaRuntimeCallInfo.get()); ASSERT_EQ(result.GetRawData(), JSTaggedValue::False().GetRawData()); @@ -543,17 +543,17 @@ TEST_F(BuiltinsStringTest, endsWith2) // "To be, or not to be, that is the question.".endsWith('to be', 19) TEST_F(BuiltinsStringTest, endsWith3) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); JSHandle thisStr = factory->NewFromCanBeCompressString("To be, or not to be, that is the question."); JSHandle val = factory->NewFromCanBeCompressString("to be"); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(thisStr.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, val.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(static_cast(19))); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsString::EndsWith(ecmaRuntimeCallInfo.get()); ASSERT_EQ(result.GetRawData(), JSTaggedValue::True().GetRawData()); @@ -562,18 +562,18 @@ TEST_F(BuiltinsStringTest, endsWith3) // "有ABC".toLocaleLowerCase() TEST_F(BuiltinsStringTest, toLocaleLowerCase2) { - ASSERT_NE(thread, nullptr); - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ASSERT_NE(thread_, nullptr); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); JSHandle this_str = factory->NewFromString("有ABC"); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(this_str.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsString::ToLocaleLowerCase(ecmaRuntimeCallInfo.get()); ASSERT_TRUE(result.IsString()); - JSHandle result_handle(thread, reinterpret_cast(result.GetRawData())); + JSHandle result_handle(thread_, reinterpret_cast(result.GetRawData())); JSTaggedValue test = factory->NewFromString("有abc").GetTaggedValue(); ASSERT_EQ(result_handle->Compare(reinterpret_cast(test.GetRawData())), 0); } @@ -581,17 +581,17 @@ TEST_F(BuiltinsStringTest, toLocaleLowerCase2) // "ABC".toLowerCase() TEST_F(BuiltinsStringTest, toLowerCase1) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); JSHandle thisStr = factory->NewFromCanBeCompressString("ABC"); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(thisStr.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsString::ToLowerCase(ecmaRuntimeCallInfo.get()); ASSERT_TRUE(result.IsString()); - JSHandle resultHandle(thread, reinterpret_cast(result.GetRawData())); + JSHandle resultHandle(thread_, reinterpret_cast(result.GetRawData())); JSHandle test = factory->NewFromCanBeCompressString("abc"); ASSERT_TRUE(JSTaggedValue::SameValue(resultHandle.GetTaggedValue(), test.GetTaggedValue())); } @@ -599,17 +599,17 @@ TEST_F(BuiltinsStringTest, toLowerCase1) // "abc".toUpperCase() TEST_F(BuiltinsStringTest, toUpperCase1) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); JSHandle thisStr = factory->NewFromCanBeCompressString("abc"); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(thisStr.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsString::ToUpperCase(ecmaRuntimeCallInfo.get()); ASSERT_TRUE(result.IsString()); - JSHandle resultHandle(thread, reinterpret_cast(result.GetRawData())); + JSHandle resultHandle(thread_, reinterpret_cast(result.GetRawData())); JSTaggedValue test = factory->NewFromCanBeCompressString("ABC").GetTaggedValue(); ASSERT_EQ(resultHandle->Compare(reinterpret_cast(test.GetRawData())), 0); } @@ -617,16 +617,16 @@ TEST_F(BuiltinsStringTest, toUpperCase1) // "abc".localecompare('b') TEST_F(BuiltinsStringTest, localecompare1) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); JSHandle thisStr = factory->NewFromCanBeCompressString("abc"); JSHandle val = factory->NewFromCanBeCompressString("b"); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(thisStr.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, val.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsString::LocaleCompare(ecmaRuntimeCallInfo.get()); ASSERT_EQ(result.GetRawData(), JSTaggedValue(-1).GetRawData()); @@ -635,16 +635,16 @@ TEST_F(BuiltinsStringTest, localecompare1) // "abc".localecompare('abc') TEST_F(BuiltinsStringTest, localecompare2) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); JSHandle thisStr = factory->NewFromCanBeCompressString("abc"); JSHandle val = factory->NewFromCanBeCompressString("abc"); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(thisStr.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, val.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsString::LocaleCompare(ecmaRuntimeCallInfo.get()); ASSERT_EQ(result.GetRawData(), JSTaggedValue(0).GetRawData()); @@ -653,16 +653,16 @@ TEST_F(BuiltinsStringTest, localecompare2) // "abc".localecompare('aa') TEST_F(BuiltinsStringTest, localecompare3) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); JSHandle thisStr = factory->NewFromCanBeCompressString("abc"); JSHandle val = factory->NewFromCanBeCompressString("aa"); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(thisStr.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, val.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsString::LocaleCompare(ecmaRuntimeCallInfo.get()); ASSERT_EQ(result.GetRawData(), JSTaggedValue(1).GetRawData()); @@ -671,20 +671,20 @@ TEST_F(BuiltinsStringTest, localecompare3) // "abc".normalize('NFC') TEST_F(BuiltinsStringTest, normalize1) { - ASSERT_NE(thread, nullptr); - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ASSERT_NE(thread_, nullptr); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); JSHandle this_str = factory->NewFromString("abc"); JSHandle val = factory->NewFromString("NFC"); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(this_str.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, val.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsString::Normalize(ecmaRuntimeCallInfo.get()); ASSERT_TRUE(result.IsString()); - JSHandle result_handle(thread, reinterpret_cast(result.GetRawData())); + JSHandle result_handle(thread_, reinterpret_cast(result.GetRawData())); JSTaggedValue test = factory->NewFromString("abc").GetTaggedValue(); ASSERT_EQ(result_handle->Compare(reinterpret_cast(test.GetRawData())), 0); } @@ -692,20 +692,20 @@ TEST_F(BuiltinsStringTest, normalize1) // "hello".padEnd(10) TEST_F(BuiltinsStringTest, padEnd1) { - ASSERT_NE(thread, nullptr); + ASSERT_NE(thread_, nullptr); - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); JSHandle this_str = factory->NewFromString("hello"); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(this_str.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast(10))); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsString::padEnd(ecmaRuntimeCallInfo.get()); ASSERT_TRUE(result.IsString()); - JSHandle result_handle(thread, reinterpret_cast(result.GetRawData())); + JSHandle result_handle(thread_, reinterpret_cast(result.GetRawData())); JSTaggedValue test = factory->NewFromString("hello ").GetTaggedValue(); ASSERT_EQ(result_handle->Compare(reinterpret_cast(test.GetRawData())), 0); } @@ -713,22 +713,22 @@ TEST_F(BuiltinsStringTest, padEnd1) // "hello".padEnd(11, world) TEST_F(BuiltinsStringTest, padEnd2) { - ASSERT_NE(thread, nullptr); + ASSERT_NE(thread_, nullptr); - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); JSHandle this_str = factory->NewFromString("hello"); JSHandle fillString = factory->NewFromString("world"); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(this_str.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast(11))); ecmaRuntimeCallInfo->SetCallArg(1, fillString.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsString::padEnd(ecmaRuntimeCallInfo.get()); ASSERT_TRUE(result.IsString()); - JSHandle result_handle(thread, reinterpret_cast(result.GetRawData())); + JSHandle result_handle(thread_, reinterpret_cast(result.GetRawData())); JSTaggedValue test = factory->NewFromString("helloworldw").GetTaggedValue(); ASSERT_EQ(result_handle->Compare(reinterpret_cast(test.GetRawData())), 0); } @@ -736,20 +736,20 @@ TEST_F(BuiltinsStringTest, padEnd2) // "world".padStart(10) TEST_F(BuiltinsStringTest, padStart1) { - ASSERT_NE(thread, nullptr); + ASSERT_NE(thread_, nullptr); - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); JSHandle this_str = factory->NewFromString("world"); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(this_str.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast(10))); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsString::padStart(ecmaRuntimeCallInfo.get()); ASSERT_TRUE(result.IsString()); - JSHandle result_handle(thread, reinterpret_cast(result.GetRawData())); + JSHandle result_handle(thread_, reinterpret_cast(result.GetRawData())); JSTaggedValue test = factory->NewFromString(" world").GetTaggedValue(); ASSERT_EQ(result_handle->Compare(reinterpret_cast(test.GetRawData())), 0); } @@ -757,22 +757,22 @@ TEST_F(BuiltinsStringTest, padStart1) // "world".padStart(11, "hello") TEST_F(BuiltinsStringTest, padStart2) { - ASSERT_NE(thread, nullptr); + ASSERT_NE(thread_, nullptr); - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); JSHandle this_str = factory->NewFromString("world"); JSHandle fillString = factory->NewFromString("hello"); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(this_str.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast(11))); ecmaRuntimeCallInfo->SetCallArg(1, fillString.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsString::padStart(ecmaRuntimeCallInfo.get()); ASSERT_TRUE(result.IsString()); - JSHandle result_handle(thread, reinterpret_cast(result.GetRawData())); + JSHandle result_handle(thread_, reinterpret_cast(result.GetRawData())); JSTaggedValue test = factory->NewFromString("hellohworld").GetTaggedValue(); ASSERT_EQ(result_handle->Compare(reinterpret_cast(test.GetRawData())), 0); } @@ -780,18 +780,18 @@ TEST_F(BuiltinsStringTest, padStart2) // "abc".repeat(5) TEST_F(BuiltinsStringTest, repeat1) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); JSHandle thisStr = factory->NewFromCanBeCompressString("abc"); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(thisStr.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast(5))); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsString::Repeat(ecmaRuntimeCallInfo.get()); ASSERT_TRUE(result.IsString()); - JSHandle resultHandle(thread, reinterpret_cast(result.GetRawData())); + JSHandle resultHandle(thread_, reinterpret_cast(result.GetRawData())); JSTaggedValue test = factory->NewFromCanBeCompressString("abcabcabcabcabc").GetTaggedValue(); ASSERT_EQ(resultHandle->Compare(reinterpret_cast(test.GetRawData())), 0); } @@ -799,19 +799,19 @@ TEST_F(BuiltinsStringTest, repeat1) // 'The morning is upon us.'.slice(4, -2) TEST_F(BuiltinsStringTest, slice1) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); JSHandle thisStr = factory->NewFromCanBeCompressString("The morning is upon us."); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(thisStr.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast(4))); ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(static_cast(-2))); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsString::Slice(ecmaRuntimeCallInfo.get()); ASSERT_TRUE(result.IsString()); - JSHandle resultHandle(thread, reinterpret_cast(result.GetRawData())); + JSHandle resultHandle(thread_, reinterpret_cast(result.GetRawData())); JSTaggedValue test = factory->NewFromCanBeCompressString("morning is upon u").GetTaggedValue(); ASSERT_EQ(resultHandle->Compare(reinterpret_cast(test.GetRawData())), 0); } @@ -819,18 +819,18 @@ TEST_F(BuiltinsStringTest, slice1) // 'The morning is upon us.'.slice(12) TEST_F(BuiltinsStringTest, slice2) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); JSHandle thisStr = factory->NewFromCanBeCompressString("The morning is upon us."); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(thisStr.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast(12))); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsString::Slice(ecmaRuntimeCallInfo.get()); ASSERT_TRUE(result.IsString()); - JSHandle resultHandle(thread, reinterpret_cast(result.GetRawData())); + JSHandle resultHandle(thread_, reinterpret_cast(result.GetRawData())); JSTaggedValue test = factory->NewFromCanBeCompressString("is upon us.").GetTaggedValue(); ASSERT_EQ(resultHandle->Compare(reinterpret_cast(test.GetRawData())), 0); } @@ -838,19 +838,19 @@ TEST_F(BuiltinsStringTest, slice2) // 'Mozilla'.substring(3, -3) TEST_F(BuiltinsStringTest, substring1) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); JSHandle thisStr = factory->NewFromCanBeCompressString("Mozilla"); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(thisStr.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast(3))); ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(static_cast(-3))); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsString::Substring(ecmaRuntimeCallInfo.get()); ASSERT_TRUE(result.IsString()); - JSHandle resultHandle(thread, reinterpret_cast(result.GetRawData())); + JSHandle resultHandle(thread_, reinterpret_cast(result.GetRawData())); JSTaggedValue test = factory->NewFromCanBeCompressString("Moz").GetTaggedValue(); ASSERT_EQ(resultHandle->Compare(reinterpret_cast(test.GetRawData())), 0); } @@ -858,19 +858,19 @@ TEST_F(BuiltinsStringTest, substring1) // 'Mozilla'.substring(7, 4) TEST_F(BuiltinsStringTest, substring2) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); JSHandle thisStr = factory->NewFromCanBeCompressString("Mozilla"); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(thisStr.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast(7))); ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(static_cast(4))); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsString::Substring(ecmaRuntimeCallInfo.get()); ASSERT_TRUE(result.IsString()); - JSHandle resultHandle(thread, reinterpret_cast(result.GetRawData())); + JSHandle resultHandle(thread_, reinterpret_cast(result.GetRawData())); JSTaggedValue test = factory->NewFromCanBeCompressString("lla").GetTaggedValue(); ASSERT_EQ(resultHandle->Compare(reinterpret_cast(test.GetRawData())), 0); } @@ -878,40 +878,40 @@ TEST_F(BuiltinsStringTest, substring2) // " Hello world! ".trim() TEST_F(BuiltinsStringTest, trim1) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); JSHandle thisStr = factory->NewFromCanBeCompressString(" Hello world! "); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(thisStr.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsString::Trim(ecmaRuntimeCallInfo.get()); ASSERT_TRUE(result.IsString()); - JSHandle resultHandle(thread, reinterpret_cast(result.GetRawData())); + JSHandle resultHandle(thread_, reinterpret_cast(result.GetRawData())); JSTaggedValue test = factory->NewFromCanBeCompressString("Hello world!").GetTaggedValue(); ASSERT_EQ(resultHandle->Compare(reinterpret_cast(test.GetRawData())), 0); } TEST_F(BuiltinsStringTest, trim2) { - auto ecmaVM = thread->GetEcmaVM(); + auto ecmaVM = thread_->GetEcmaVM(); JSHandle env = ecmaVM->GetGlobalEnv(); - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); JSHandle thisStr = factory->NewFromCanBeCompressString(" Hello world! "); JSHandle stringObject(env->GetStringFunction()); - JSHandle value(thread, JSTaggedValue(thisStr.GetTaggedValue().GetTaggedObject())); + JSHandle value(thread_, JSTaggedValue(thisStr.GetTaggedValue().GetTaggedObject())); JSHandle str = factory->NewJSPrimitiveRef(stringObject, value); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(str.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsString::Trim(ecmaRuntimeCallInfo.get()); ASSERT_TRUE(result.IsString()); - JSHandle resultHandle(thread, reinterpret_cast(result.GetRawData())); + JSHandle resultHandle(thread_, reinterpret_cast(result.GetRawData())); JSTaggedValue test = factory->NewFromCanBeCompressString("Hello world!").GetTaggedValue(); ASSERT_EQ(resultHandle->Compare(reinterpret_cast(test.GetRawData())), 0); } @@ -919,19 +919,19 @@ TEST_F(BuiltinsStringTest, trim2) // " Hello world! ".trimEnd() TEST_F(BuiltinsStringTest, trimEnd1) { - ASSERT_NE(thread, nullptr); + ASSERT_NE(thread_, nullptr); - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); JSHandle this_str = factory->NewFromString(" Hello world! "); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(this_str.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsString::TrimEnd(ecmaRuntimeCallInfo.get()); ASSERT_TRUE(result.IsString()); - JSHandle result_handle(thread, reinterpret_cast(result.GetRawData())); + JSHandle result_handle(thread_, reinterpret_cast(result.GetRawData())); JSTaggedValue test = factory->NewFromString(" Hello world!").GetTaggedValue(); ASSERT_EQ(result_handle->Compare(reinterpret_cast(test.GetRawData())), 0); } @@ -939,24 +939,24 @@ TEST_F(BuiltinsStringTest, trimEnd1) // new String(" Hello world! ").trimEnd() TEST_F(BuiltinsStringTest, trimEnd2) { - ASSERT_NE(thread, nullptr); - auto ecmaVm = thread->GetEcmaVM(); + ASSERT_NE(thread_, nullptr); + auto ecmaVm = thread_->GetEcmaVM(); JSHandle env = ecmaVm->GetGlobalEnv(); - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); JSHandle this_str = factory->NewFromString(" Hello world! "); JSHandle string_object(env->GetStringFunction()); - JSHandle value(thread, JSTaggedValue(this_str.GetTaggedValue().GetHeapObject())); + JSHandle value(thread_, JSTaggedValue(this_str.GetTaggedValue().GetHeapObject())); JSHandle str = factory->NewJSPrimitiveRef(string_object, value); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(str.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsString::TrimEnd(ecmaRuntimeCallInfo.get()); ASSERT_TRUE(result.IsString()); - JSHandle result_handle(thread, reinterpret_cast(result.GetRawData())); + JSHandle result_handle(thread_, reinterpret_cast(result.GetRawData())); JSTaggedValue test = factory->NewFromString(" Hello world!").GetTaggedValue(); ASSERT_EQ(result_handle->Compare(reinterpret_cast(test.GetRawData())), 0); } @@ -964,19 +964,19 @@ TEST_F(BuiltinsStringTest, trimEnd2) // " Hello world! ".trimStart() TEST_F(BuiltinsStringTest, trimStart1) { - ASSERT_NE(thread, nullptr); + ASSERT_NE(thread_, nullptr); - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); JSHandle this_str = factory->NewFromString(" Hello world! "); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(this_str.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsString::TrimStart(ecmaRuntimeCallInfo.get()); ASSERT_TRUE(result.IsString()); - JSHandle result_handle(thread, reinterpret_cast(result.GetRawData())); + JSHandle result_handle(thread_, reinterpret_cast(result.GetRawData())); JSTaggedValue test = factory->NewFromString("Hello world! ").GetTaggedValue(); ASSERT_EQ(result_handle->Compare(reinterpret_cast(test.GetRawData())), 0); } @@ -984,24 +984,24 @@ TEST_F(BuiltinsStringTest, trimStart1) // new String(" Hello world! ").trimStart() TEST_F(BuiltinsStringTest, trimStart2) { - ASSERT_NE(thread, nullptr); - auto ecmaVm = thread->GetEcmaVM(); + ASSERT_NE(thread_, nullptr); + auto ecmaVm = thread_->GetEcmaVM(); JSHandle env = ecmaVm->GetGlobalEnv(); - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); JSHandle this_str = factory->NewFromString(" Hello world! "); JSHandle string_object(env->GetStringFunction()); - JSHandle value(thread, JSTaggedValue(this_str.GetTaggedValue().GetHeapObject())); + JSHandle value(thread_, JSTaggedValue(this_str.GetTaggedValue().GetHeapObject())); JSHandle str = factory->NewJSPrimitiveRef(string_object, value); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(str.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsString::TrimStart(ecmaRuntimeCallInfo.get()); ASSERT_TRUE(result.IsString()); - JSHandle result_handle(thread, reinterpret_cast(result.GetRawData())); + JSHandle result_handle(thread_, reinterpret_cast(result.GetRawData())); JSTaggedValue test = factory->NewFromString("Hello world! ").GetTaggedValue(); ASSERT_EQ(result_handle->Compare(reinterpret_cast(test.GetRawData())), 0); } @@ -1009,46 +1009,46 @@ TEST_F(BuiltinsStringTest, trimStart2) // new String("abcabcabc").toString(); TEST_F(BuiltinsStringTest, ToString) { - auto ecmaVM = thread->GetEcmaVM(); + auto ecmaVM = thread_->GetEcmaVM(); JSHandle env = ecmaVM->GetGlobalEnv(); - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); JSHandle thisStr = factory->NewFromCanBeCompressString("abcabcabc"); JSHandle stringObject(env->GetStringFunction()); - JSHandle value(thread, JSTaggedValue(thisStr.GetTaggedValue().GetTaggedObject())); + JSHandle value(thread_, JSTaggedValue(thisStr.GetTaggedValue().GetTaggedObject())); JSHandle str = factory->NewJSPrimitiveRef(stringObject, value); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(str.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsString::ToString(ecmaRuntimeCallInfo.get()); ASSERT_TRUE(result.IsString()); - JSHandle resultHandle(thread, reinterpret_cast(result.GetRawData())); + JSHandle resultHandle(thread_, reinterpret_cast(result.GetRawData())); JSTaggedValue test = JSTaggedValue(*thisStr); ASSERT_EQ(result.GetRawData(), test.GetRawData()); } TEST_F(BuiltinsStringTest, ValueOf) { - auto ecmaVM = thread->GetEcmaVM(); + auto ecmaVM = thread_->GetEcmaVM(); JSHandle env = ecmaVM->GetGlobalEnv(); - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); JSHandle thisStr = factory->NewFromCanBeCompressString("abcabcabc"); JSHandle stringObject(env->GetStringFunction()); - JSHandle value(thread, JSTaggedValue(thisStr.GetTaggedValue().GetTaggedObject())); + JSHandle value(thread_, JSTaggedValue(thisStr.GetTaggedValue().GetTaggedObject())); JSHandle str = factory->NewJSPrimitiveRef(stringObject, value); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(str.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsString::ValueOf(ecmaRuntimeCallInfo.get()); ASSERT_TRUE(result.IsString()); - JSHandle resultHandle(thread, reinterpret_cast(result.GetRawData())); + JSHandle resultHandle(thread_, reinterpret_cast(result.GetRawData())); JSTaggedValue test = JSTaggedValue(*thisStr); ASSERT_EQ(result.GetRawData(), test.GetRawData()); } @@ -1062,39 +1062,39 @@ static inline JSFunction *BuiltinsStringTestCreate(JSThread *thread) TEST_F(BuiltinsStringTest, Raw) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); JSHandle foo(factory->NewFromCanBeCompressString("foo")); JSHandle bar(factory->NewFromCanBeCompressString("bar")); JSHandle baz(factory->NewFromCanBeCompressString("baz")); - JSHandle rawArray = JSHandle::Cast(JSArray::ArrayCreate(thread, JSTaggedNumber(0))); + JSHandle rawArray = JSHandle::Cast(JSArray::ArrayCreate(thread_, JSTaggedNumber(0))); JSHandle obj(rawArray); - JSHandle key0(thread, JSTaggedValue(0)); - PropertyDescriptor desc0(thread, foo); - JSArray::DefineOwnProperty(thread, obj, key0, desc0); - JSHandle key1(thread, JSTaggedValue(1)); - PropertyDescriptor desc1(thread, bar); - JSArray::DefineOwnProperty(thread, obj, key1, desc1); - JSHandle key2(thread, JSTaggedValue(2)); - PropertyDescriptor desc2(thread, baz); - JSArray::DefineOwnProperty(thread, obj, key2, desc2); - - JSHandle constructor(thread, BuiltinsStringTestCreate(thread)); + JSHandle key0(thread_, JSTaggedValue(0)); + PropertyDescriptor desc0(thread_, foo); + JSArray::DefineOwnProperty(thread_, obj, key0, desc0); + JSHandle key1(thread_, JSTaggedValue(1)); + PropertyDescriptor desc1(thread_, bar); + JSArray::DefineOwnProperty(thread_, obj, key1, desc1); + JSHandle key2(thread_, JSTaggedValue(2)); + PropertyDescriptor desc2(thread_, baz); + JSArray::DefineOwnProperty(thread_, obj, key2, desc2); + + JSHandle constructor(thread_, BuiltinsStringTestCreate(thread_)); JSHandle templateString( factory->NewJSObjectByConstructor(JSHandle(constructor), constructor)); JSHandle rawKey(factory->NewFromCanBeCompressString("raw")); - JSObject::SetProperty(thread, templateString, rawKey, rawArray); + JSObject::SetProperty(thread_, templateString, rawKey, rawArray); JSHandle test = factory->NewFromCanBeCompressString("foo5barJavaScriptbaz"); JSHandle javascript = factory->NewFromCanBeCompressString("JavaScript"); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 10); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 10); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(templateString.GetObject())); ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(static_cast(5))); ecmaRuntimeCallInfo->SetCallArg(2, javascript.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsString::Raw(ecmaRuntimeCallInfo.get()); ASSERT_TRUE(result.IsString()); ASSERT_TRUE(EcmaString::StringsAreEqual(reinterpret_cast(result.GetRawData()), *test)); @@ -1102,21 +1102,21 @@ TEST_F(BuiltinsStringTest, Raw) TEST_F(BuiltinsStringTest, Replace) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); JSHandle thisStr = factory->NewFromCanBeCompressString("Twas the night before Xmas..."); JSHandle searchStr = factory->NewFromCanBeCompressString("Xmas"); JSHandle replaceStr = factory->NewFromCanBeCompressString("Christmas"); JSHandle expected = factory->NewFromCanBeCompressString("Twas the night before Christmas..."); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(thisStr.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, searchStr.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(1, replaceStr.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsString::Replace(ecmaRuntimeCallInfo.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_TRUE(result.IsString()); ASSERT_TRUE(EcmaString::StringsAreEqual(reinterpret_cast(result.GetRawData()), *expected)); @@ -1124,51 +1124,51 @@ TEST_F(BuiltinsStringTest, Replace) JSHandle replaceStr1 = factory->NewFromCanBeCompressString("abc$$"); JSHandle expected1 = factory->NewFromCanBeCompressString("Twas the night before abc$..."); - auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); ecmaRuntimeCallInfo1->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo1->SetThis(thisStr.GetTaggedValue()); ecmaRuntimeCallInfo1->SetCallArg(0, searchStr.GetTaggedValue()); ecmaRuntimeCallInfo1->SetCallArg(1, replaceStr1.GetTaggedValue()); - prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); + prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); JSTaggedValue result1 = BuiltinsString::Replace(ecmaRuntimeCallInfo1.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); - JSHandle resultString1(thread, result1); + JSHandle resultString1(thread_, result1); ASSERT_TRUE(result1.IsString()); ASSERT_TRUE(EcmaString::StringsAreEqual(*resultString1, *expected1)); JSHandle replaceStr2 = factory->NewFromCanBeCompressString("abc$$dd"); JSHandle expected2 = factory->NewFromCanBeCompressString("Twas the night before abc$dd..."); - auto ecmaRuntimeCallInfo2 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + auto ecmaRuntimeCallInfo2 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); ecmaRuntimeCallInfo2->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo2->SetThis(thisStr.GetTaggedValue()); ecmaRuntimeCallInfo2->SetCallArg(0, searchStr.GetTaggedValue()); ecmaRuntimeCallInfo2->SetCallArg(1, replaceStr2.GetTaggedValue()); - prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo2.get()); + prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo2.get()); JSTaggedValue result2 = BuiltinsString::Replace(ecmaRuntimeCallInfo2.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); - JSHandle resultString2(thread, result2); + JSHandle resultString2(thread_, result2); ASSERT_TRUE(result2.IsString()); ASSERT_TRUE(EcmaString::StringsAreEqual(*resultString2, *expected2)); JSHandle replaceStr3 = factory->NewFromCanBeCompressString("abc$&dd"); JSHandle expected3 = factory->NewFromCanBeCompressString("Twas the night before abcXmasdd..."); - auto ecmaRuntimeCallInfo3 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + auto ecmaRuntimeCallInfo3 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); ecmaRuntimeCallInfo3->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo3->SetThis(thisStr.GetTaggedValue()); ecmaRuntimeCallInfo3->SetCallArg(0, searchStr.GetTaggedValue()); ecmaRuntimeCallInfo3->SetCallArg(1, replaceStr3.GetTaggedValue()); - prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo3.get()); + prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo3.get()); JSTaggedValue result3 = BuiltinsString::Replace(ecmaRuntimeCallInfo3.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); - JSHandle resultString3(thread, result3); + JSHandle resultString3(thread_, result3); ASSERT_TRUE(result3.IsString()); ASSERT_TRUE(EcmaString::StringsAreEqual(*resultString3, *expected3)); @@ -1176,38 +1176,38 @@ TEST_F(BuiltinsStringTest, Replace) JSHandle expected4 = factory->NewFromCanBeCompressString("Twas the night before abcTwas the night before dd..."); - auto ecmaRuntimeCallInfo4 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + auto ecmaRuntimeCallInfo4 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); ecmaRuntimeCallInfo4->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo4->SetThis(thisStr.GetTaggedValue()); ecmaRuntimeCallInfo4->SetCallArg(0, searchStr.GetTaggedValue()); ecmaRuntimeCallInfo4->SetCallArg(1, replaceStr4.GetTaggedValue()); - prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo4.get()); + prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo4.get()); JSTaggedValue result4 = BuiltinsString::Replace(ecmaRuntimeCallInfo4.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); - JSHandle resultString4(thread, result4); + JSHandle resultString4(thread_, result4); ASSERT_TRUE(result4.IsString()); ASSERT_TRUE(EcmaString::StringsAreEqual(*resultString4, *expected4)); } TEST_F(BuiltinsStringTest, Replace2) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); JSHandle thisStr = factory->NewFromCanBeCompressString("Twas the night before Xmas..."); JSHandle searchStr = factory->NewFromCanBeCompressString("Xmas"); JSHandle replaceStr = factory->NewFromCanBeCompressString("abc$\'dd"); JSHandle expected = factory->NewFromCanBeCompressString("Twas the night before abc...dd..."); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(thisStr.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, searchStr.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(1, replaceStr.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsString::Replace(ecmaRuntimeCallInfo.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_TRUE(result.IsString()); ASSERT_TRUE(EcmaString::StringsAreEqual(reinterpret_cast(result.GetRawData()), *expected)); @@ -1216,17 +1216,17 @@ TEST_F(BuiltinsStringTest, Replace2) JSHandle expected2 = factory->NewFromCanBeCompressString("Twas the night before abcTwas the night before dd...$ff..."); - auto ecmaRuntimeCallInfo2 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + auto ecmaRuntimeCallInfo2 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); ecmaRuntimeCallInfo2->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo2->SetThis(thisStr.GetTaggedValue()); ecmaRuntimeCallInfo2->SetCallArg(0, searchStr.GetTaggedValue()); ecmaRuntimeCallInfo2->SetCallArg(1, replaceStr2.GetTaggedValue()); - prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo2.get()); + prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo2.get()); JSTaggedValue result2 = BuiltinsString::Replace(ecmaRuntimeCallInfo2.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); - JSHandle resultString2(thread, result2); + JSHandle resultString2(thread_, result2); ASSERT_TRUE(result2.IsString()); ASSERT_TRUE(EcmaString::StringsAreEqual(*resultString2, *expected2)); @@ -1234,17 +1234,17 @@ TEST_F(BuiltinsStringTest, Replace2) JSHandle expected3 = factory->NewFromCanBeCompressString("Twas the night before abcTwas the night before dd...$..."); - auto ecmaRuntimeCallInfo3 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + auto ecmaRuntimeCallInfo3 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); ecmaRuntimeCallInfo3->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo3->SetThis(thisStr.GetTaggedValue()); ecmaRuntimeCallInfo3->SetCallArg(0, searchStr.GetTaggedValue()); ecmaRuntimeCallInfo3->SetCallArg(1, replaceStr3.GetTaggedValue()); - prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo3.get()); + prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo3.get()); JSTaggedValue result3 = BuiltinsString::Replace(ecmaRuntimeCallInfo3.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); - JSHandle resultString3(thread, result3); + JSHandle resultString3(thread_, result3); ASSERT_TRUE(result3.IsString()); ASSERT_TRUE(EcmaString::StringsAreEqual(*resultString3, *expected3)); @@ -1252,37 +1252,37 @@ TEST_F(BuiltinsStringTest, Replace2) JSHandle expected4 = factory->NewFromCanBeCompressString("Twas the night before abcTwas the night before dd$..."); - auto ecmaRuntimeCallInfo4 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + auto ecmaRuntimeCallInfo4 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); ecmaRuntimeCallInfo4->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo4->SetThis(thisStr.GetTaggedValue()); ecmaRuntimeCallInfo4->SetCallArg(0, searchStr.GetTaggedValue()); ecmaRuntimeCallInfo4->SetCallArg(1, replaceStr4.GetTaggedValue()); - prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo4.get()); + prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo4.get()); JSTaggedValue result4 = BuiltinsString::Replace(ecmaRuntimeCallInfo4.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_TRUE(result4.IsString()); - JSHandle resultString4(thread, result4); + JSHandle resultString4(thread_, result4); ASSERT_TRUE(EcmaString::StringsAreEqual(*resultString4, *expected4)); } TEST_F(BuiltinsStringTest, Replace3) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); JSHandle thisStr = factory->NewFromCanBeCompressString("Twas the night before Xmas..."); JSHandle searchStr = factory->NewFromCanBeCompressString("Xmas"); JSHandle replaceStr = factory->NewFromCanBeCompressString("$&a $` $\' $2 $01 $$1 $21 $32 a"); JSHandle expected = factory->NewFromCanBeCompressString( "Twas the night before Xmasa Twas the night before ... $2 $01 $1 $21 $32 a..."); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(thisStr.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, searchStr.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(1, replaceStr.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsString::Replace(ecmaRuntimeCallInfo.get()); ASSERT_TRUE(result.IsString()); @@ -1293,26 +1293,26 @@ TEST_F(BuiltinsStringTest, Replace4) { // invoke RegExpConstructor method JSHandle pattern1 = - thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("quick\\s(brown).+?(jumps)"); - JSHandle flags1 = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("iug"); - JSTaggedValue result1 = CreateRegExpObjByPatternAndFlags(thread, pattern1, flags1); - JSHandle searchStr(thread, reinterpret_cast(result1.GetRawData())); - JSHandle expected = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString( + thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("quick\\s(brown).+?(jumps)"); + JSHandle flags1 = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("iug"); + JSTaggedValue result1 = CreateRegExpObjByPatternAndFlags(thread_, pattern1, flags1); + JSHandle searchStr(thread_, reinterpret_cast(result1.GetRawData())); + JSHandle expected = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString( "The Quick Brown Fox Jumpsa The Over The Lazy Dog Jumps Brown $1 Jumps1 $32 a Over The Lazy Dog"); // make dyn_runtime_call_info2 JSHandle thisStr = - thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("The Quick Brown Fox Jumps Over The Lazy Dog"); + thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("The Quick Brown Fox Jumps Over The Lazy Dog"); JSHandle replaceStr = - thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("$&a $` $\' $2 $01 $$1 $21 $32 a"); + thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("$&a $` $\' $2 $01 $$1 $21 $32 a"); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(thisStr.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, searchStr.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(1, replaceStr.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsString::Replace(ecmaRuntimeCallInfo.get()); ASSERT_TRUE(result.IsString()); @@ -1321,20 +1321,20 @@ TEST_F(BuiltinsStringTest, Replace4) TEST_F(BuiltinsStringTest, ReplaceAll1) { - ASSERT_NE(thread, nullptr); - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ASSERT_NE(thread_, nullptr); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); JSHandle this_str = factory->NewFromString("The Quick Brown Fox Jumps Over The Lazy Dog"); JSHandle search_str = factory->NewFromString("o"); JSHandle replace_str = factory->NewFromString("a"); JSHandle expected = factory->NewFromString("The Quick Brawn Fax Jumps Over The Lazy Dag"); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(this_str.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, search_str.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(1, replace_str.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsString::ReplaceAll(ecmaRuntimeCallInfo.get()); ASSERT_TRUE(result.IsString()); @@ -1343,20 +1343,20 @@ TEST_F(BuiltinsStringTest, ReplaceAll1) TEST_F(BuiltinsStringTest, ReplaceAll2) { - ASSERT_NE(thread, nullptr); - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ASSERT_NE(thread_, nullptr); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); JSHandle this_str = factory->NewFromString("xxx"); JSHandle search_str = factory->NewFromString(""); JSHandle replace_str = factory->NewFromString("_"); JSHandle expected = factory->NewFromString("_x_x_x_"); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(this_str.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, search_str.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(1, replace_str.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsString::ReplaceAll(ecmaRuntimeCallInfo.get()); ASSERT_TRUE(result.IsString()); @@ -1365,20 +1365,20 @@ TEST_F(BuiltinsStringTest, ReplaceAll2) TEST_F(BuiltinsStringTest, ReplaceAll3) { - ASSERT_NE(thread, nullptr); - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ASSERT_NE(thread_, nullptr); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); JSHandle this_str = factory->NewFromString("xxx"); JSHandle search_str = factory->NewFromString("x"); JSHandle replace_str = factory->NewFromString(""); JSHandle expected = factory->NewFromString(""); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(this_str.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, search_str.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(1, replace_str.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsString::ReplaceAll(ecmaRuntimeCallInfo.get()); ASSERT_TRUE(result.IsString()); @@ -1388,33 +1388,33 @@ TEST_F(BuiltinsStringTest, ReplaceAll3) TEST_F(BuiltinsStringTest, Split) { // invoke RegExpConstructor method - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); JSHandle thisStr = factory->NewFromCanBeCompressString("Hello World. How are you doing?"); JSHandle separatorStr = factory->NewFromCanBeCompressString(" "); - JSHandle limit(thread, JSTaggedValue(3)); + JSHandle limit(thread_, JSTaggedValue(3)); JSHandle expected1 = factory->NewFromCanBeCompressString("Hello"); JSHandle expected2 = factory->NewFromCanBeCompressString("World."); JSHandle expected3 = factory->NewFromCanBeCompressString("How"); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(thisStr.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, separatorStr.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(static_cast(3))); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsString::Split(ecmaRuntimeCallInfo.get()); ASSERT_TRUE(result.IsECMAObject()); - JSHandle resultArray(thread, reinterpret_cast(result.GetRawData())); + JSHandle resultArray(thread_, reinterpret_cast(result.GetRawData())); ASSERT_TRUE(resultArray->IsJSArray()); JSHandle resultObj(resultArray); JSHandle string1( - JSObject::GetProperty(thread, resultObj, JSHandle(thread, JSTaggedValue(0))).GetValue()); + JSObject::GetProperty(thread_, resultObj, JSHandle(thread_, JSTaggedValue(0))).GetValue()); JSHandle string2( - JSObject::GetProperty(thread, resultObj, JSHandle(thread, JSTaggedValue(1))).GetValue()); + JSObject::GetProperty(thread_, resultObj, JSHandle(thread_, JSTaggedValue(1))).GetValue()); JSHandle string3( - JSObject::GetProperty(thread, resultObj, JSHandle(thread, JSTaggedValue(2))).GetValue()); + JSObject::GetProperty(thread_, resultObj, JSHandle(thread_, JSTaggedValue(2))).GetValue()); ASSERT_TRUE(EcmaString::StringsAreEqual(*string1, *expected1)); ASSERT_TRUE(EcmaString::StringsAreEqual(*string2, *expected2)); ASSERT_TRUE(EcmaString::StringsAreEqual(*string3, *expected3)); @@ -1423,37 +1423,37 @@ TEST_F(BuiltinsStringTest, Split) TEST_F(BuiltinsStringTest, Split2) { // invoke RegExpConstructor method - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); JSHandle thisStr = factory->NewFromCanBeCompressString("a-b-c"); JSHandle pattern1 = factory->NewFromCanBeCompressString("-"); JSHandle flags1 = factory->NewFromCanBeCompressString("iug"); - JSTaggedValue result1 = CreateRegExpObjByPatternAndFlags(thread, pattern1, flags1); - JSHandle separatorObj(thread, result1); + JSTaggedValue result1 = CreateRegExpObjByPatternAndFlags(thread_, pattern1, flags1); + JSHandle separatorObj(thread_, result1); - JSHandle limit(thread, JSTaggedValue(3)); + JSHandle limit(thread_, JSTaggedValue(3)); JSHandle expected1 = factory->NewFromCanBeCompressString("a"); JSHandle expected2 = factory->NewFromCanBeCompressString("b"); JSHandle expected3 = factory->NewFromCanBeCompressString("c"); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(thisStr.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, separatorObj.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(static_cast(3))); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsString::Split(ecmaRuntimeCallInfo.get()); ASSERT_TRUE(result.IsECMAObject()); - JSHandle resultArray(thread, result); + JSHandle resultArray(thread_, result); ASSERT_TRUE(resultArray->IsJSArray()); JSHandle resultObj(resultArray); JSHandle string1( - JSObject::GetProperty(thread, resultObj, JSHandle(thread, JSTaggedValue(0))).GetValue()); + JSObject::GetProperty(thread_, resultObj, JSHandle(thread_, JSTaggedValue(0))).GetValue()); JSHandle string2( - JSObject::GetProperty(thread, resultObj, JSHandle(thread, JSTaggedValue(1))).GetValue()); + JSObject::GetProperty(thread_, resultObj, JSHandle(thread_, JSTaggedValue(1))).GetValue()); JSHandle string3( - JSObject::GetProperty(thread, resultObj, JSHandle(thread, JSTaggedValue(2))).GetValue()); + JSObject::GetProperty(thread_, resultObj, JSHandle(thread_, JSTaggedValue(2))).GetValue()); ASSERT_TRUE(EcmaString::StringsAreEqual(*string1, *expected1)); ASSERT_TRUE(EcmaString::StringsAreEqual(*string2, *expected2)); ASSERT_TRUE(EcmaString::StringsAreEqual(*string3, *expected3)); diff --git a/tests/runtime/builtins/builtins_symbol_test.cpp b/tests/runtime/builtins/builtins_symbol_test.cpp index d1a4b068fe2aa3202e0ea2b88797187922769a2c..8dea8d329c12f088d0aa411950d63631a6475452 100644 --- a/tests/runtime/builtins/builtins_symbol_test.cpp +++ b/tests/runtime/builtins/builtins_symbol_test.cpp @@ -51,74 +51,74 @@ public: void SetUp() override { - TestHelper::CreateEcmaVMWithScope(instance, thread, scope); + TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); } void TearDown() override { - TestHelper::DestroyEcmaVMWithScope(instance, scope); + TestHelper::DestroyEcmaVMWithScope(instance_, scope_); } - PandaVM *instance {nullptr}; - EcmaHandleScope *scope {nullptr}; - JSThread *thread {nullptr}; + PandaVM *instance_ {nullptr}; + EcmaHandleScope *scope_ {nullptr}; + JSThread *thread_ {nullptr}; }; // new Symbol.toString() TEST_F(BuiltinsSymbolTest, SymbolNoParameterToString) { - auto ecmaVM = thread->GetEcmaVM(); + auto ecmaVM = thread_->GetEcmaVM(); JSHandle symbol = ecmaVM->GetFactory()->NewJSSymbol(); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(symbol.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = Symbol::ToString(ecmaRuntimeCallInfo.get()); - JSHandle resultHandle(thread, reinterpret_cast(result.GetRawData())); + JSHandle resultHandle(thread_, reinterpret_cast(result.GetRawData())); ASSERT_TRUE(result.IsString()); - auto symbolValue = ecmascript::base::BuiltinsBase::GetTaggedString(thread, "Symbol()"); + auto symbolValue = ecmascript::base::BuiltinsBase::GetTaggedString(thread_, "Symbol()"); ASSERT_EQ(reinterpret_cast(symbolValue.GetRawData())->Compare(*resultHandle), 0); } // new Symbol("aaa").toString() TEST_F(BuiltinsSymbolTest, SymbolWithParameterToString) { - auto ecmaVM = thread->GetEcmaVM(); + auto ecmaVM = thread_->GetEcmaVM(); JSHandle symbol = ecmaVM->GetFactory()->NewPublicSymbolWithChar("aaa"); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(symbol.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = Symbol::ToString(ecmaRuntimeCallInfo.get()); - JSHandle resultHandle(thread, reinterpret_cast(result.GetRawData())); + JSHandle resultHandle(thread_, reinterpret_cast(result.GetRawData())); ASSERT_TRUE(result.IsString()); - auto symbolValue = ecmascript::base::BuiltinsBase::GetTaggedString(thread, "Symbol(aaa)"); + auto symbolValue = ecmascript::base::BuiltinsBase::GetTaggedString(thread_, "Symbol(aaa)"); ASSERT_EQ(reinterpret_cast(symbolValue.GetRawData())->Compare(*resultHandle), 0); } // new Symbol().valueOf() TEST_F(BuiltinsSymbolTest, SymbolNoParameterValueOf) { - auto ecmaVM = thread->GetEcmaVM(); + auto ecmaVM = thread_->GetEcmaVM(); JSHandle env = ecmaVM->GetGlobalEnv(); JSHandle symbol = ecmaVM->GetFactory()->NewJSSymbol(); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(symbol.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsSymbol::ValueOf(ecmaRuntimeCallInfo.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); EXPECT_TRUE(result.IsSymbol()); ASSERT_EQ(result.GetRawData() == (JSTaggedValue(*symbol)).GetRawData(), true); @@ -126,13 +126,13 @@ TEST_F(BuiltinsSymbolTest, SymbolNoParameterValueOf) JSHandle symbolValue(symbol); JSHandle symbolRef = ecmaVM->GetFactory()->NewJSPrimitiveRef(symbolObject, symbolValue); - auto otherEcmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); + auto otherEcmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); otherEcmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); otherEcmaRuntimeCallInfo->SetThis(symbolRef.GetTaggedValue()); - prev = TestHelper::SetupFrame(thread, otherEcmaRuntimeCallInfo.get()); + prev = TestHelper::SetupFrame(thread_, otherEcmaRuntimeCallInfo.get()); JSTaggedValue otherResult = BuiltinsSymbol::ValueOf(otherEcmaRuntimeCallInfo.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); EXPECT_TRUE(otherResult.IsSymbol()); ASSERT_EQ(otherResult.GetRawData() == (JSTaggedValue(*symbol)).GetRawData(), true); } @@ -140,18 +140,18 @@ TEST_F(BuiltinsSymbolTest, SymbolNoParameterValueOf) // new Symbol("bbb").valueOf() TEST_F(BuiltinsSymbolTest, SymbolWithParameterValueOf) { - auto ecmaVM = thread->GetEcmaVM(); + auto ecmaVM = thread_->GetEcmaVM(); JSHandle env = ecmaVM->GetGlobalEnv(); JSHandle symbol = ecmaVM->GetFactory()->NewPublicSymbolWithChar("bbb"); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(symbol.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsSymbol::ValueOf(ecmaRuntimeCallInfo.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); EXPECT_TRUE(result.IsSymbol()); ASSERT_EQ(result.GetRawData() == (JSTaggedValue(*symbol)).GetRawData(), true); @@ -159,13 +159,13 @@ TEST_F(BuiltinsSymbolTest, SymbolWithParameterValueOf) JSHandle symbolValue(symbol); JSHandle symbolRef = ecmaVM->GetFactory()->NewJSPrimitiveRef(symbolObject, symbolValue); - auto otherEcmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); + auto otherEcmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); otherEcmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); otherEcmaRuntimeCallInfo->SetThis(symbolRef.GetTaggedValue()); - prev = TestHelper::SetupFrame(thread, otherEcmaRuntimeCallInfo.get()); + prev = TestHelper::SetupFrame(thread_, otherEcmaRuntimeCallInfo.get()); JSTaggedValue otherResult = BuiltinsSymbol::ValueOf(otherEcmaRuntimeCallInfo.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); EXPECT_TRUE(otherResult.IsSymbol()); ASSERT_EQ(otherResult.GetRawData() == (JSTaggedValue(*symbol)).GetRawData(), true); } @@ -173,7 +173,7 @@ TEST_F(BuiltinsSymbolTest, SymbolWithParameterValueOf) // new Symbol().for TEST_F(BuiltinsSymbolTest, SymbolWithParameterFor) { - auto ecmaVM = thread->GetEcmaVM(); + auto ecmaVM = thread_->GetEcmaVM(); JSHandle env = ecmaVM->GetGlobalEnv(); JSHandle tableHandle(env->GetRegisterSymbols()); @@ -181,19 +181,19 @@ TEST_F(BuiltinsSymbolTest, SymbolWithParameterFor) JSHandle string = ecmaVM->GetFactory()->NewFromCanBeCompressString("ccc"); ASSERT_EQ(string->GetLength(), 3); JSHandle string_handle(string); - ASSERT_EQ(tableHandle->ContainsKey(thread, string_handle.GetTaggedValue()), false); + ASSERT_EQ(tableHandle->ContainsKey(thread_, string_handle.GetTaggedValue()), false); JSHandle symbol = ecmaVM->GetFactory()->NewSymbolWithTableWithChar("ccc"); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetCallArg(0, string.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsSymbol::For(ecmaRuntimeCallInfo.get()); - TestHelper::TearDownFrame(thread, prev); - ASSERT_EQ(tableHandle->ContainsKey(thread, string_handle.GetTaggedValue()), true); + TestHelper::TearDownFrame(thread_, prev); + ASSERT_EQ(tableHandle->ContainsKey(thread_, string_handle.GetTaggedValue()), true); JSTaggedValue target(*symbol); ASSERT_EQ(result.GetRawData() == target.GetRawData(), true); @@ -202,63 +202,63 @@ TEST_F(BuiltinsSymbolTest, SymbolWithParameterFor) // Symbol.keyFor (sym) TEST_F(BuiltinsSymbolTest, SymbolKeyFor) { - auto ecmaVM = thread->GetEcmaVM(); + auto ecmaVM = thread_->GetEcmaVM(); JSHandle env = ecmaVM->GetGlobalEnv(); JSHandle symbol = ecmaVM->GetFactory()->NewPublicSymbolWithChar("bbb"); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetCallArg(0, symbol.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsSymbol::KeyFor(ecmaRuntimeCallInfo.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_EQ(result.GetRawData(), JSTaggedValue::VALUE_UNDEFINED); JSHandle string = ecmaVM->GetFactory()->NewFromCanBeCompressString("ccc"); ASSERT_EQ(string->GetLength(), 3); - auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo1->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo1->SetThis(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo1->SetCallArg(0, string.GetTaggedValue()); - prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); + prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); BuiltinsSymbol::For(ecmaRuntimeCallInfo1.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); JSHandle otherSymbol = ecmaVM->GetFactory()->NewPublicSymbolWithChar("ccc"); - auto ecmaRuntimeCallInfo2 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto ecmaRuntimeCallInfo2 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo2->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo2->SetThis(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo2->SetCallArg(0, otherSymbol.GetTaggedValue()); - prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo2.get()); + prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo2.get()); JSTaggedValue otherResult = BuiltinsSymbol::KeyFor(ecmaRuntimeCallInfo2.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_TRUE(otherResult.IsString()); JSHandle tableHandle(env->GetRegisterSymbols()); JSTaggedValue stringValue(*string); - ASSERT_EQ(tableHandle->ContainsKey(thread, stringValue), true); + ASSERT_EQ(tableHandle->ContainsKey(thread_, stringValue), true); } // Symbol.ToPrimitive() TEST_F(BuiltinsSymbolTest, SymbolToPrimitive) { - auto ecmaVM = thread->GetEcmaVM(); + auto ecmaVM = thread_->GetEcmaVM(); JSHandle env = ecmaVM->GetGlobalEnv(); JSHandle symbol = ecmaVM->GetFactory()->NewJSSymbol(); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(symbol.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsSymbol::ToPrimitive(ecmaRuntimeCallInfo.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); EXPECT_TRUE(result.IsSymbol()); ASSERT_EQ(result.GetRawData() == (JSTaggedValue(*symbol)).GetRawData(), true); @@ -266,13 +266,13 @@ TEST_F(BuiltinsSymbolTest, SymbolToPrimitive) JSHandle symbolValue(symbol); JSHandle symbolRef = ecmaVM->GetFactory()->NewJSPrimitiveRef(symbolObject, symbolValue); - auto otherEcmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); + auto otherEcmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); otherEcmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); otherEcmaRuntimeCallInfo->SetThis(symbolRef.GetTaggedValue()); - prev = TestHelper::SetupFrame(thread, otherEcmaRuntimeCallInfo.get()); + prev = TestHelper::SetupFrame(thread_, otherEcmaRuntimeCallInfo.get()); JSTaggedValue otherResult = BuiltinsSymbol::ToPrimitive(otherEcmaRuntimeCallInfo.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); EXPECT_TRUE(otherResult.IsSymbol()); ASSERT_EQ(otherResult.GetRawData() == (JSTaggedValue(*symbol)).GetRawData(), true); } @@ -280,49 +280,50 @@ TEST_F(BuiltinsSymbolTest, SymbolToPrimitive) // constructor TEST_F(BuiltinsSymbolTest, SymbolConstructor) { - auto ecmaVM = thread->GetEcmaVM(); + auto ecmaVM = thread_->GetEcmaVM(); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue::Undefined()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsSymbol::SymbolConstructor(ecmaRuntimeCallInfo.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); EXPECT_TRUE(result.IsSymbol()); JSSymbol *sym = reinterpret_cast(result.GetRawData()); ASSERT_EQ(sym->GetDescription().IsUndefined(), true); JSHandle string = ecmaVM->GetFactory()->NewFromCanBeCompressString("ddd"); - auto otherEcmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto otherEcmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); otherEcmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); otherEcmaRuntimeCallInfo->SetThis(JSTaggedValue::Undefined()); otherEcmaRuntimeCallInfo->SetCallArg(0, string.GetTaggedValue()); - prev = TestHelper::SetupFrame(thread, otherEcmaRuntimeCallInfo.get()); + prev = TestHelper::SetupFrame(thread_, otherEcmaRuntimeCallInfo.get()); JSTaggedValue result1 = BuiltinsSymbol::SymbolConstructor(otherEcmaRuntimeCallInfo.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); JSHandle resultString = JSTaggedValue::ToString( - thread, JSHandle(thread, reinterpret_cast(result1.GetRawData())->GetDescription())); + thread_, + JSHandle(thread_, reinterpret_cast(result1.GetRawData())->GetDescription())); ASSERT_EQ(resultString->Compare(*string), 0); } TEST_F(BuiltinsSymbolTest, SymbolGetter) { - auto ecmaVM = thread->GetEcmaVM(); + auto ecmaVM = thread_->GetEcmaVM(); JSHandle symbol = ecmaVM->GetFactory()->NewPublicSymbolWithChar(""); JSHandle string = ecmaVM->GetFactory()->NewFromCanBeCompressString(""); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(symbol.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = BuiltinsSymbol::DescriptionGetter(ecmaRuntimeCallInfo.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_TRUE(result.IsString()); EcmaString *resString = reinterpret_cast(result.GetRawData()); ASSERT_EQ(resString->GetLength(), 0); diff --git a/tests/runtime/builtins/builtins_typedarray_test.cpp b/tests/runtime/builtins/builtins_typedarray_test.cpp index 2258f94c927379aec8ca63fe7f8874a7e50836b8..c013bc94d186f1f3fec9082c42d8c1d759c12dd2 100644 --- a/tests/runtime/builtins/builtins_typedarray_test.cpp +++ b/tests/runtime/builtins/builtins_typedarray_test.cpp @@ -61,18 +61,18 @@ public: void SetUp() override { - TestHelper::CreateEcmaVMWithScope(instance, thread, scope); + TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); } void TearDown() override { - TestHelper::DestroyEcmaVMWithScope(instance, scope); + TestHelper::DestroyEcmaVMWithScope(instance_, scope_); } protected: - PandaVM *instance {nullptr}; - EcmaHandleScope *scope {nullptr}; - JSThread *thread {nullptr}; + PandaVM *instance_ {nullptr}; + EcmaHandleScope *scope_ {nullptr}; + JSThread *thread_ {nullptr}; class TestClass : public base::BuiltinsBase { public: @@ -211,16 +211,16 @@ JSTypedArray *CreateTypedArrayFromList(JSThread *thread, const JSHandleGetEcmaVM(); + auto ecmaVM = thread_->GetEcmaVM(); JSHandle env = ecmaVM->GetGlobalEnv(); JSHandle array(env->GetArrayFunction()); - JSHandle globalObject(thread, env->GetGlobalObject()); + JSHandle globalObject(thread_, env->GetGlobalObject()); - auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); + auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); ecmaRuntimeCallInfo1->SetFunction(array.GetTaggedValue()); ecmaRuntimeCallInfo1->SetThis(globalObject.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); JSTaggedValue result = TypedArray::Species(ecmaRuntimeCallInfo1.get()); ASSERT_TRUE(result.IsECMAObject()); } @@ -228,138 +228,138 @@ TEST_F(BuiltinsTypedArrayTest, Species) // ES2021 23.2.3.13 new Array(1,2,3,4,3).includes(searchElement [ , fromIndex ]) TEST_F(BuiltinsTypedArrayTest, Includes1) { - ASSERT_NE(thread, nullptr); + ASSERT_NE(thread_, nullptr); - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); JSHandle array(factory->NewTaggedArray(5)); - array->Set(thread, 0, JSTaggedValue(1)); - array->Set(thread, 1, JSTaggedValue(2)); - array->Set(thread, 2, JSTaggedValue(3)); - array->Set(thread, 3, JSTaggedValue(4)); - array->Set(thread, 4, JSTaggedValue(3)); - JSHandle obj(thread, CreateTypedArrayFromList(thread, array)); + array->Set(thread_, 0, JSTaggedValue(1)); + array->Set(thread_, 1, JSTaggedValue(2)); + array->Set(thread_, 2, JSTaggedValue(3)); + array->Set(thread_, 3, JSTaggedValue(4)); + array->Set(thread_, 4, JSTaggedValue(3)); + JSHandle obj(thread_, CreateTypedArrayFromList(thread_, array)); // new Array(1,2,3,4,3).includes(1,0) - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(obj.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast(1))); ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(static_cast(0))); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = TypedArray::Includes(ecmaRuntimeCallInfo.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_EQ(result.GetRawData(), JSTaggedValue(true).GetRawData()); } // ES2021 23.2.3.13 new Array(1,2,3,4,3).includes(searchElement [ , fromIndex ]) TEST_F(BuiltinsTypedArrayTest, Includes2) { - ASSERT_NE(thread, nullptr); + ASSERT_NE(thread_, nullptr); - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); JSHandle array(factory->NewTaggedArray(5)); - array->Set(thread, 0, JSTaggedValue(1)); - array->Set(thread, 1, JSTaggedValue(2)); - array->Set(thread, 2, JSTaggedValue(3)); - array->Set(thread, 3, JSTaggedValue(4)); - array->Set(thread, 4, JSTaggedValue(3)); - JSHandle obj(thread, CreateTypedArrayFromList(thread, array)); + array->Set(thread_, 0, JSTaggedValue(1)); + array->Set(thread_, 1, JSTaggedValue(2)); + array->Set(thread_, 2, JSTaggedValue(3)); + array->Set(thread_, 3, JSTaggedValue(4)); + array->Set(thread_, 4, JSTaggedValue(3)); + JSHandle obj(thread_, CreateTypedArrayFromList(thread_, array)); // new Array(1,2,3,4,3).includes(1,3) - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(obj.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast(1))); ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(static_cast(3))); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = TypedArray::Includes(ecmaRuntimeCallInfo.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_EQ(result.GetRawData(), JSTaggedValue(false).GetRawData()); } // ES2021 23.2.3.13 new Array(1,2,3,4,3).includes(searchElement [ , fromIndex ]) TEST_F(BuiltinsTypedArrayTest, Includes3) { - ASSERT_NE(thread, nullptr); + ASSERT_NE(thread_, nullptr); - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); JSHandle array(factory->NewTaggedArray(5)); - array->Set(thread, 0, JSTaggedValue(1)); - array->Set(thread, 1, JSTaggedValue(2)); - array->Set(thread, 2, JSTaggedValue(3)); - array->Set(thread, 3, JSTaggedValue(4)); - array->Set(thread, 4, JSTaggedValue(3)); - JSHandle obj(thread, CreateTypedArrayFromList(thread, array)); + array->Set(thread_, 0, JSTaggedValue(1)); + array->Set(thread_, 1, JSTaggedValue(2)); + array->Set(thread_, 2, JSTaggedValue(3)); + array->Set(thread_, 3, JSTaggedValue(4)); + array->Set(thread_, 4, JSTaggedValue(3)); + JSHandle obj(thread_, CreateTypedArrayFromList(thread_, array)); // new Array(1,2,3,4,3).includes(5,0) - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(obj.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast(5))); ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(static_cast(0))); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = TypedArray::Includes(ecmaRuntimeCallInfo.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_EQ(result.GetRawData(), JSTaggedValue(false).GetRawData()); } // ES2021 23.2.3.13 new Array(1,2,3,4,3).includes(searchElement [ , fromIndex ]) TEST_F(BuiltinsTypedArrayTest, Includes4) { - ASSERT_NE(thread, nullptr); + ASSERT_NE(thread_, nullptr); - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); JSHandle array(factory->NewTaggedArray(5)); - array->Set(thread, 0, JSTaggedValue(1)); - array->Set(thread, 1, JSTaggedValue(2)); - array->Set(thread, 2, JSTaggedValue(3)); - array->Set(thread, 3, JSTaggedValue(4)); - array->Set(thread, 4, JSTaggedValue(3)); - JSHandle obj(thread, CreateTypedArrayFromList(thread, array)); + array->Set(thread_, 0, JSTaggedValue(1)); + array->Set(thread_, 1, JSTaggedValue(2)); + array->Set(thread_, 2, JSTaggedValue(3)); + array->Set(thread_, 3, JSTaggedValue(4)); + array->Set(thread_, 4, JSTaggedValue(3)); + JSHandle obj(thread_, CreateTypedArrayFromList(thread_, array)); // new Array(1,2,3,4,3).includes(1) - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(obj.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast(1))); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = TypedArray::Includes(ecmaRuntimeCallInfo.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_EQ(result.GetRawData(), JSTaggedValue(true).GetRawData()); } // ES2021 23.2.3.13 new Array(1,2,3,4,3).includes(searchElement [ , fromIndex ]) TEST_F(BuiltinsTypedArrayTest, Includes5) { - ASSERT_NE(thread, nullptr); + ASSERT_NE(thread_, nullptr); - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); JSHandle array(factory->NewTaggedArray(5)); - array->Set(thread, 0, JSTaggedValue(1)); - array->Set(thread, 1, JSTaggedValue(2)); - array->Set(thread, 2, JSTaggedValue(3)); - array->Set(thread, 3, JSTaggedValue(4)); - array->Set(thread, 4, JSTaggedValue(3)); - JSHandle obj(thread, CreateTypedArrayFromList(thread, array)); + array->Set(thread_, 0, JSTaggedValue(1)); + array->Set(thread_, 1, JSTaggedValue(2)); + array->Set(thread_, 2, JSTaggedValue(3)); + array->Set(thread_, 3, JSTaggedValue(4)); + array->Set(thread_, 4, JSTaggedValue(3)); + JSHandle obj(thread_, CreateTypedArrayFromList(thread_, array)); // new Array(1,2,3,4,3).includes(5) - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(obj.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue(static_cast(5))); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result = TypedArray::Includes(ecmaRuntimeCallInfo.get()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); ASSERT_EQ(result.GetRawData(), JSTaggedValue(false).GetRawData()); } } // namespace panda::test diff --git a/tests/runtime/builtins/builtins_weak_map_test.cpp b/tests/runtime/builtins/builtins_weak_map_test.cpp index 2af7d22bd001f2e21c3b6111b0e2ac246fef2e64..ba19e07fd58a1dd69fe8f020550ac212fc8c3be2 100644 --- a/tests/runtime/builtins/builtins_weak_map_test.cpp +++ b/tests/runtime/builtins/builtins_weak_map_test.cpp @@ -53,17 +53,17 @@ public: void SetUp() override { - TestHelper::CreateEcmaVMWithScope(instance, thread, scope); + TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); } void TearDown() override { - TestHelper::DestroyEcmaVMWithScope(instance, scope); + TestHelper::DestroyEcmaVMWithScope(instance_, scope_); } - PandaVM *instance {nullptr}; - EcmaHandleScope *scope {nullptr}; - JSThread *thread {nullptr}; + PandaVM *instance_ {nullptr}; + EcmaHandleScope *scope_ {nullptr}; + JSThread *thread_ {nullptr}; }; static JSObject *JSObjectTestCreate(JSThread *thread) @@ -95,48 +95,48 @@ JSWeakMap *CreateBuiltinsWeakMap(JSThread *thread) // new Map("abrupt").toString() TEST_F(BuiltinsWeakMapTest, CreateAndGetSize) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle env = thread_->GetEcmaVM()->GetGlobalEnv(); JSHandle newTarget(env->GetBuiltinsWeakMapFunction()); - JSHandle map(thread, CreateBuiltinsWeakMap(thread)); + JSHandle map(thread_, CreateBuiltinsWeakMap(thread_)); JSHandle array(factory->NewTaggedArray(1)); JSHandle internal_array(factory->NewTaggedArray(2)); - JSTaggedValue value(JSObjectTestCreate(thread)); - internal_array->Set(thread, 0, value); - internal_array->Set(thread, 1, JSTaggedValue(0)); - auto result = JSArray::CreateArrayFromList(thread, internal_array); - array->Set(thread, 0, result); + JSTaggedValue value(JSObjectTestCreate(thread_)); + internal_array->Set(thread_, 0, value); + internal_array->Set(thread_, 1, JSTaggedValue(0)); + auto result = JSArray::CreateArrayFromList(thread_, internal_array); + array->Set(thread_, 0, result); - JSHandle values = JSArray::CreateArrayFromList(thread, array); + JSHandle values = JSArray::CreateArrayFromList(thread_, array); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo->SetFunction(newTarget.GetTaggedValue()); ecmaRuntimeCallInfo->SetThis(map.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, values.GetTaggedValue()); ecmaRuntimeCallInfo->SetNewTarget(newTarget.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result1 = BuiltinsWeakMap::WeakMapConstructor(ecmaRuntimeCallInfo.get()); - JSHandle weakMap(thread, JSWeakMap::Cast(reinterpret_cast(result1.GetRawData()))); + JSHandle weakMap(thread_, JSWeakMap::Cast(reinterpret_cast(result1.GetRawData()))); EXPECT_EQ(weakMap->GetSize(), 1); } TEST_F(BuiltinsWeakMapTest, SetAndHas) { // create jsWeakMap - JSHandle weakMap(thread, CreateBuiltinsWeakMap(thread)); - JSHandle key(thread, JSObjectTestCreate(thread)); + JSHandle weakMap(thread_, CreateBuiltinsWeakMap(thread_)); + JSHandle key(thread_, JSObjectTestCreate(thread_)); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(weakMap.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, key.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(static_cast(1))); { - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result1 = BuiltinsWeakMap::Has(ecmaRuntimeCallInfo.get()); EXPECT_EQ(result1.GetRawData(), JSTaggedValue::False().GetRawData()); @@ -149,13 +149,13 @@ TEST_F(BuiltinsWeakMapTest, SetAndHas) EXPECT_EQ(jsWeakMap->GetSize(), 1); // test Has() - auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); ecmaRuntimeCallInfo1->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo1->SetCallArg(0, key.GetTaggedValue()); ecmaRuntimeCallInfo1->SetCallArg(1, JSTaggedValue(static_cast(1))); ecmaRuntimeCallInfo1->SetThis(JSTaggedValue(jsWeakMap)); { - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); JSTaggedValue result3 = BuiltinsWeakMap::Has(ecmaRuntimeCallInfo1.get()); EXPECT_EQ(result3.GetRawData(), JSTaggedValue::True().GetRawData()); @@ -165,19 +165,19 @@ TEST_F(BuiltinsWeakMapTest, SetAndHas) TEST_F(BuiltinsWeakMapTest, DeleteAndRemove) { // create jsWeakMap - JSHandle weakMap(thread, CreateBuiltinsWeakMap(thread)); + JSHandle weakMap(thread_, CreateBuiltinsWeakMap(thread_)); // add 40 keys JSTaggedValue lastKey(JSTaggedValue::Undefined()); for (int i = 0; i < 40; i++) { - JSHandle key(thread, JSObjectTestCreate(thread)); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 8); + JSHandle key(thread_, JSObjectTestCreate(thread_)); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 8); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(weakMap.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, key.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(1, JSTaggedValue(static_cast(i))); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result1 = BuiltinsWeakMap::Set(ecmaRuntimeCallInfo.get()); EXPECT_TRUE(result1.IsECMAObject()); @@ -188,12 +188,12 @@ TEST_F(BuiltinsWeakMapTest, DeleteAndRemove) // whether jsWeakMap has delete lastKey - auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo1->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo1->SetThis(weakMap.GetTaggedValue()); ecmaRuntimeCallInfo1->SetCallArg(0, lastKey); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); JSTaggedValue result2 = BuiltinsWeakMap::Has(ecmaRuntimeCallInfo1.get()); EXPECT_EQ(result2.GetRawData(), JSTaggedValue::True().GetRawData()); diff --git a/tests/runtime/builtins/builtins_weak_set_test.cpp b/tests/runtime/builtins/builtins_weak_set_test.cpp index c8ae14baba23983205a15b54aa14d9a22e1723e6..11fc288c0279a66c6206ef9b018772f5b503eddb 100644 --- a/tests/runtime/builtins/builtins_weak_set_test.cpp +++ b/tests/runtime/builtins/builtins_weak_set_test.cpp @@ -51,17 +51,17 @@ public: void SetUp() override { - TestHelper::CreateEcmaVMWithScope(instance, thread, scope); + TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); } void TearDown() override { - TestHelper::DestroyEcmaVMWithScope(instance, scope); + TestHelper::DestroyEcmaVMWithScope(instance_, scope_); } - PandaVM *instance {nullptr}; - EcmaHandleScope *scope {nullptr}; - JSThread *thread {nullptr}; + PandaVM *instance_ {nullptr}; + EcmaHandleScope *scope_ {nullptr}; + JSThread *thread_ {nullptr}; }; static JSObject *JSObjectTestCreate(JSThread *thread) @@ -94,44 +94,44 @@ JSWeakSet *CreateBuiltinsWeakSet(JSThread *thread) TEST_F(BuiltinsWeakSetTest, CreateAndGetSize) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle env = thread_->GetEcmaVM()->GetGlobalEnv(); JSHandle newTarget(env->GetBuiltinsWeakSetFunction()); - JSHandle weakSet(thread, CreateBuiltinsWeakSet(thread)); + JSHandle weakSet(thread_, CreateBuiltinsWeakSet(thread_)); JSHandle array(factory->NewTaggedArray(5)); for (int i = 0; i < 5; i++) { - JSHandle key(thread, JSObjectTestCreate(thread)); - array->Set(thread, i, key.GetTaggedValue()); + JSHandle key(thread_, JSObjectTestCreate(thread_)); + array->Set(thread_, i, key.GetTaggedValue()); } - JSHandle values = JSArray::CreateArrayFromList(thread, array); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + JSHandle values = JSArray::CreateArrayFromList(thread_, array); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo->SetFunction(newTarget.GetTaggedValue()); ecmaRuntimeCallInfo->SetThis(weakSet.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, values.GetTaggedValue()); ecmaRuntimeCallInfo->SetNewTarget(newTarget.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result1 = BuiltinsWeakSet::WeakSetConstructor(ecmaRuntimeCallInfo.get()); - JSHandle weakSetResult(thread, JSWeakSet::Cast(reinterpret_cast(result1.GetRawData()))); + JSHandle weakSetResult(thread_, JSWeakSet::Cast(reinterpret_cast(result1.GetRawData()))); EXPECT_EQ(weakSetResult->GetSize(), 5); } TEST_F(BuiltinsWeakSetTest, AddAndHas) { // create jsWeakSet - JSHandle weakSet(thread, CreateBuiltinsWeakSet(thread)); - JSHandle key(thread, JSObjectTestCreate(thread)); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + JSHandle weakSet(thread_, CreateBuiltinsWeakSet(thread_)); + JSHandle key(thread_, JSObjectTestCreate(thread_)); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(weakSet.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, key.GetTaggedValue()); JSWeakSet *jsWeakSet; { - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result1 = BuiltinsWeakSet::Has(ecmaRuntimeCallInfo.get()); EXPECT_EQ(result1.GetRawData(), JSTaggedValue::False().GetRawData()); @@ -144,12 +144,12 @@ TEST_F(BuiltinsWeakSetTest, AddAndHas) } // test Has() - auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo1->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo1->SetThis(JSTaggedValue(jsWeakSet)); ecmaRuntimeCallInfo1->SetCallArg(0, key.GetTaggedValue()); { - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); JSTaggedValue result3 = BuiltinsWeakSet::Has(ecmaRuntimeCallInfo1.get()); EXPECT_EQ(result3.GetRawData(), JSTaggedValue::True().GetRawData()); @@ -159,19 +159,19 @@ TEST_F(BuiltinsWeakSetTest, AddAndHas) TEST_F(BuiltinsWeakSetTest, DeleteAndRemove) { // create jsSet - JSHandle weakSet(thread, CreateBuiltinsWeakSet(thread)); + JSHandle weakSet(thread_, CreateBuiltinsWeakSet(thread_)); // add 40 keys JSTaggedValue lastKey(JSTaggedValue::Undefined()); for (int i = 0; i < 40; i++) { - JSHandle key(thread, JSObjectTestCreate(thread)); + JSHandle key(thread_, JSObjectTestCreate(thread_)); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(weakSet.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, key.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result1 = BuiltinsWeakSet::Add(ecmaRuntimeCallInfo.get()); EXPECT_TRUE(result1.IsECMAObject()); @@ -181,12 +181,12 @@ TEST_F(BuiltinsWeakSetTest, DeleteAndRemove) } // whether jsWeakSet has delete lastKey - auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto ecmaRuntimeCallInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo1->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo1->SetThis(weakSet.GetTaggedValue()); ecmaRuntimeCallInfo1->SetCallArg(0, lastKey); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo1.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo1.get()); JSTaggedValue result2 = BuiltinsWeakSet::Has(ecmaRuntimeCallInfo1.get()); EXPECT_EQ(result2.GetRawData(), JSTaggedValue::True().GetRawData()); diff --git a/tests/runtime/common/builtins_test.cpp b/tests/runtime/common/builtins_test.cpp index e4710324b1604880e032bdb9496912aa164c5634..7a6e86ecf38a9d5b6f145e77c4d88981a71304b9 100644 --- a/tests/runtime/common/builtins_test.cpp +++ b/tests/runtime/common/builtins_test.cpp @@ -34,23 +34,23 @@ class BuiltinsTest : public testing::Test { public: void SetUp() override { - TestHelper::CreateEcmaVMWithScope(instance, thread, scope); + TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); } void TearDown() override { - TestHelper::DestroyEcmaVMWithScope(instance, scope); + TestHelper::DestroyEcmaVMWithScope(instance_, scope_); } - PandaVM *instance {nullptr}; - EcmaHandleScope *scope {nullptr}; - JSThread *thread; + PandaVM *instance_ {nullptr}; + EcmaHandleScope *scope_ {nullptr}; + JSThread *thread_; }; TEST_F(BuiltinsTest, ObjectInit) { - ASSERT_NE(thread, nullptr); - auto ecma_vm = thread->GetEcmaVM(); + ASSERT_NE(thread_, nullptr); + auto ecma_vm = thread_->GetEcmaVM(); JSHandle env = ecma_vm->GetGlobalEnv(); JSHandle object_function(env->GetObjectFunction()); @@ -59,8 +59,8 @@ TEST_F(BuiltinsTest, ObjectInit) TEST_F(BuiltinsTest, FunctionInit) { - ASSERT_NE(thread, nullptr); - auto ecma_vm = thread->GetEcmaVM(); + ASSERT_NE(thread_, nullptr); + auto ecma_vm = thread_->GetEcmaVM(); JSHandle env = ecma_vm->GetGlobalEnv(); JSHandle function_function(env->GetFunctionFunction()); @@ -69,8 +69,8 @@ TEST_F(BuiltinsTest, FunctionInit) TEST_F(BuiltinsTest, NumberInit) { - ASSERT_NE(thread, nullptr); - auto ecma_vm = thread->GetEcmaVM(); + ASSERT_NE(thread_, nullptr); + auto ecma_vm = thread_->GetEcmaVM(); JSHandle env = ecma_vm->GetGlobalEnv(); JSHandle number_function(env->GetNumberFunction()); @@ -79,8 +79,8 @@ TEST_F(BuiltinsTest, NumberInit) TEST_F(BuiltinsTest, SetInit) { - ASSERT_NE(thread, nullptr); - auto ecma_vm = thread->GetEcmaVM(); + ASSERT_NE(thread_, nullptr); + auto ecma_vm = thread_->GetEcmaVM(); JSHandle env = ecma_vm->GetGlobalEnv(); JSHandle set_function(env->GetBuiltinsSetFunction()); @@ -89,8 +89,8 @@ TEST_F(BuiltinsTest, SetInit) TEST_F(BuiltinsTest, MapInit) { - ASSERT_NE(thread, nullptr); - auto ecma_vm = thread->GetEcmaVM(); + ASSERT_NE(thread_, nullptr); + auto ecma_vm = thread_->GetEcmaVM(); JSHandle env = ecma_vm->GetGlobalEnv(); JSHandle map_function(env->GetBuiltinsMapFunction()); @@ -99,21 +99,21 @@ TEST_F(BuiltinsTest, MapInit) TEST_F(BuiltinsTest, StrictModeForbiddenAccess) { - ASSERT_NE(thread, nullptr); - auto ecma_vm = thread->GetEcmaVM(); + ASSERT_NE(thread_, nullptr); + auto ecma_vm = thread_->GetEcmaVM(); JSHandle env = ecma_vm->GetGlobalEnv(); - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); JSHandle function = factory->NewJSFunction(env, static_cast(nullptr)); JSHandle caller_key(factory->NewFromString("caller")); JSHandle arguments_key(factory->NewFromString("arguments")); - JSObject::GetProperty(thread, JSHandle(function), caller_key); - ASSERT_EQ(thread->HasPendingException(), true); + JSObject::GetProperty(thread_, JSHandle(function), caller_key); + ASSERT_EQ(thread_->HasPendingException(), true); - JSObject::GetProperty(thread, JSHandle(function), arguments_key); - ASSERT_EQ(thread->HasPendingException(), true); + JSObject::GetProperty(thread_, JSHandle(function), arguments_key); + ASSERT_EQ(thread_->HasPendingException(), true); } } // namespace panda::test diff --git a/tests/runtime/common/ecma_empty_class_check/ecma_empty_class_check.cpp b/tests/runtime/common/ecma_empty_class_check/ecma_empty_class_check.cpp index 6e3fbe01c181178290d05915b2921c8e93b5eb13..136a934475e31fba69cc39e721dca42f700f95bf 100644 --- a/tests/runtime/common/ecma_empty_class_check/ecma_empty_class_check.cpp +++ b/tests/runtime/common/ecma_empty_class_check/ecma_empty_class_check.cpp @@ -41,11 +41,11 @@ static void CheckNames(const panda_file::File &pf) panda_file::ClassDataAccessor cda(pf, classId); cda.EnumerateMethods([&pf](panda_file::MethodDataAccessor &mda) { auto sd_mname = mda.GetName(); - std::string mname(reinterpret_cast(sd_mname.data), sd_mname.utf16_length); + std::string mname(reinterpret_cast(sd_mname.data_), sd_mname.utf16_length_); ASSERT(!mname.empty()); auto sd_cname = pf.GetStringData(mda.GetClassId()); - std::string cname(reinterpret_cast(sd_cname.data), sd_cname.utf16_length); + std::string cname(reinterpret_cast(sd_cname.data_), sd_cname.utf16_length_); ASSERT(!cname.empty()); }); } diff --git a/tests/runtime/common/ecma_module_test.cpp b/tests/runtime/common/ecma_module_test.cpp index 649169e6d086cfcf50474b47596e74edcc5a793e..e921b4818a4585e7f79fa594e353a3facbb32ec5 100644 --- a/tests/runtime/common/ecma_module_test.cpp +++ b/tests/runtime/common/ecma_module_test.cpp @@ -36,16 +36,16 @@ public: void SetUp() override { - TestHelper::CreateEcmaVMWithScope(instance, thread, scope); + TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); } void TearDown() override { - TestHelper::DestroyEcmaVMWithScope(instance, scope); + TestHelper::DestroyEcmaVMWithScope(instance_, scope_); } - PandaVM *instance {nullptr}; - ecmascript::EcmaHandleScope *scope {nullptr}; - JSThread *thread {nullptr}; + PandaVM *instance_ {nullptr}; + ecmascript::EcmaHandleScope *scope_ {nullptr}; + JSThread *thread_ {nullptr}; }; EcmaModule *EcmaModuleCreate(JSThread *thread) @@ -68,15 +68,15 @@ TEST_F(EcmaModuleTest, AddItem_001) int numOfElementsDict = 4; CString cStrItemName = "key1"; int intItemValue = 1; - JSHandle handleEcmaModule(thread, EcmaModuleCreate(thread)); - JSHandle handleNameDict(NameDictionary::Create(thread, numOfElementsDict)); + JSHandle handleEcmaModule(thread_, EcmaModuleCreate(thread_)); + JSHandle handleNameDict(NameDictionary::Create(thread_, numOfElementsDict)); JSHandle handleTagValItemName( - thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(cStrItemName)); - JSHandle handleTagValItemValue(thread, JSTaggedValue(intItemValue)); + thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(cStrItemName)); + JSHandle handleTagValItemValue(thread_, JSTaggedValue(intItemValue)); - handleEcmaModule->SetNameDictionary(thread, handleNameDict); // Call SetNameDictionary in TEST_F - EcmaModule::AddItem(thread, handleEcmaModule, handleTagValItemName, handleTagValItemValue); - EXPECT_EQ(handleEcmaModule->GetItem(thread, handleTagValItemName)->GetNumber(), intItemValue); + handleEcmaModule->SetNameDictionary(thread_, handleNameDict); // Call SetNameDictionary in TEST_F + EcmaModule::AddItem(thread_, handleEcmaModule, handleTagValItemName, handleTagValItemValue); + EXPECT_EQ(handleEcmaModule->GetItem(thread_, handleTagValItemName)->GetNumber(), intItemValue); } /* @@ -91,14 +91,14 @@ TEST_F(EcmaModuleTest, AddItem_002) { CString cStrItemName = "cStrItemName"; int intItemValue = 1; - JSHandle handleEcmaModule(thread, EcmaModuleCreate(thread)); + JSHandle handleEcmaModule(thread_, EcmaModuleCreate(thread_)); JSHandle handleTagValItemName( - thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(cStrItemName)); - JSHandle handleTagValItemValue(thread, JSTaggedValue(intItemValue)); + thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(cStrItemName)); + JSHandle handleTagValItemValue(thread_, JSTaggedValue(intItemValue)); // This EcmaModule calls 'SetNameDictionary' function through 'AddItem' function of "ecma_module.cpp". - EcmaModule::AddItem(thread, handleEcmaModule, handleTagValItemName, handleTagValItemValue); - EXPECT_EQ(handleEcmaModule->GetItem(thread, handleTagValItemName)->GetNumber(), intItemValue); + EcmaModule::AddItem(thread_, handleEcmaModule, handleTagValItemName, handleTagValItemValue); + EXPECT_EQ(handleEcmaModule->GetItem(thread_, handleTagValItemName)->GetNumber(), intItemValue); } /* @@ -112,17 +112,17 @@ TEST_F(EcmaModuleTest, AddItem_002) */ TEST_F(EcmaModuleTest, RemoveItem) { - ObjectFactory *objFactory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *objFactory = thread_->GetEcmaVM()->GetFactory(); CString cStrItemName = "cStrItemName"; int intItemValue = 1; - JSHandle handleEcmaModule(thread, EcmaModuleCreate(thread)); + JSHandle handleEcmaModule(thread_, EcmaModuleCreate(thread_)); JSHandle handleTagValItemName(objFactory->NewFromCanBeCompressString(cStrItemName)); - JSHandle handleTagValItemValue(thread, JSTaggedValue(intItemValue)); + JSHandle handleTagValItemValue(thread_, JSTaggedValue(intItemValue)); - EcmaModule::AddItem(thread, handleEcmaModule, handleTagValItemName, handleTagValItemValue); - EcmaModule::RemoveItem(thread, handleEcmaModule, handleTagValItemName); - EXPECT_TRUE(handleEcmaModule->GetItem(thread, handleTagValItemName)->IsUndefined()); + EcmaModule::AddItem(thread_, handleEcmaModule, handleTagValItemName, handleTagValItemValue); + EcmaModule::RemoveItem(thread_, handleEcmaModule, handleTagValItemName); + EXPECT_TRUE(handleEcmaModule->GetItem(thread_, handleTagValItemName)->IsUndefined()); } /* @@ -138,23 +138,23 @@ TEST_F(EcmaModuleTest, RemoveItem) */ TEST_F(EcmaModuleTest, SetNameDictionary) { - ObjectFactory *objFactory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *objFactory = thread_->GetEcmaVM()->GetFactory(); int numOfElementsDict = 4; - JSHandle handleNameDict(NameDictionary::Create(thread, numOfElementsDict)); - JSHandle handleObjFunc = thread->GetEcmaVM()->GetGlobalEnv()->GetObjectFunction(); + JSHandle handleNameDict(NameDictionary::Create(thread_, numOfElementsDict)); + JSHandle handleObjFunc = thread_->GetEcmaVM()->GetGlobalEnv()->GetObjectFunction(); CString keyArray1 = "hello1"; JSHandle stringKey1 = objFactory->NewFromCanBeCompressString(keyArray1); JSHandle key1(stringKey1); JSHandle value1( objFactory->NewJSObjectByConstructor(JSHandle(handleObjFunc), handleObjFunc)); JSHandle handleNameDictionaryFrom( - NameDictionary::Put(thread, handleNameDict, key1, value1, PropertyAttributes::Default())); - JSHandle handleEcmaModule(thread, EcmaModuleCreate(thread)); + NameDictionary::Put(thread_, handleNameDict, key1, value1, PropertyAttributes::Default())); + JSHandle handleEcmaModule(thread_, EcmaModuleCreate(thread_)); - handleEcmaModule->SetNameDictionary(thread, handleNameDictionaryFrom); + handleEcmaModule->SetNameDictionary(thread_, handleNameDictionaryFrom); JSHandle handleNameDictionaryTo( - thread, NameDictionary::Cast(handleEcmaModule->GetNameDictionary().GetTaggedObject())); + thread_, NameDictionary::Cast(handleEcmaModule->GetNameDictionary().GetTaggedObject())); EXPECT_EQ(handleNameDictionaryTo->EntriesCount(), 1); int entry1 = handleNameDictionaryTo->FindEntry(key1.GetTaggedValue()); EXPECT_TRUE(key1.GetTaggedValue() == handleNameDictionaryTo->GetKey(entry1)); @@ -172,8 +172,8 @@ TEST_F(EcmaModuleTest, SetNameDictionary) */ TEST_F(EcmaModuleTest, ModuleManager_AddModule) { - ObjectFactory *objFactory = thread->GetEcmaVM()->GetFactory(); - ModuleManager *moduleManager = thread->GetEcmaVM()->GetModuleManager(); + ObjectFactory *objFactory = thread_->GetEcmaVM()->GetFactory(); + ModuleManager *moduleManager = thread_->GetEcmaVM()->GetModuleManager(); int numOfElementsDict1 = 4; int numOfElementsDict2 = 4; @@ -181,37 +181,37 @@ TEST_F(EcmaModuleTest, ModuleManager_AddModule) CString cStrItemName2 = "cStrItemName2"; int intItemValue1 = 1; int intItemValue2 = 2; - JSHandle handleNameDict1(NameDictionary::Create(thread, numOfElementsDict1)); - JSHandle handleNameDict2(NameDictionary::Create(thread, numOfElementsDict2)); + JSHandle handleNameDict1(NameDictionary::Create(thread_, numOfElementsDict1)); + JSHandle handleNameDict2(NameDictionary::Create(thread_, numOfElementsDict2)); JSHandle handleItemName1( - thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(cStrItemName1)); + thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(cStrItemName1)); JSHandle handleItemName2( - thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(cStrItemName2)); - JSHandle handleItemValue1(thread, JSTaggedValue(intItemValue1)); - JSHandle handleItemValue2(thread, JSTaggedValue(intItemValue2)); - JSHandle handleEcmaModuleAddFrom1(thread, EcmaModuleCreate(thread)); - JSHandle handleEcmaModuleAddFrom2(thread, EcmaModuleCreate(thread)); - handleEcmaModuleAddFrom1->SetNameDictionary(thread, handleNameDict1); - handleEcmaModuleAddFrom2->SetNameDictionary(thread, handleNameDict2); - - EcmaModule::AddItem(thread, handleEcmaModuleAddFrom1, handleItemName1, handleItemValue1); - JSHandle handleTagValEcmaModuleAddFrom1(thread, handleEcmaModuleAddFrom1.GetTaggedValue()); + thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(cStrItemName2)); + JSHandle handleItemValue1(thread_, JSTaggedValue(intItemValue1)); + JSHandle handleItemValue2(thread_, JSTaggedValue(intItemValue2)); + JSHandle handleEcmaModuleAddFrom1(thread_, EcmaModuleCreate(thread_)); + JSHandle handleEcmaModuleAddFrom2(thread_, EcmaModuleCreate(thread_)); + handleEcmaModuleAddFrom1->SetNameDictionary(thread_, handleNameDict1); + handleEcmaModuleAddFrom2->SetNameDictionary(thread_, handleNameDict2); + + EcmaModule::AddItem(thread_, handleEcmaModuleAddFrom1, handleItemName1, handleItemValue1); + JSHandle handleTagValEcmaModuleAddFrom1(thread_, handleEcmaModuleAddFrom1.GetTaggedValue()); std::string stdStrNameEcmaModuleAdd1 = "NameEcmaModule1"; JSHandle handleTagValNameEcmaModuleAdd1(objFactory->NewFromStdString(stdStrNameEcmaModuleAdd1)); - EcmaModule::AddItem(thread, handleEcmaModuleAddFrom2, handleItemName2, handleItemValue2); - JSHandle handleTagValEcmaModuleAddFrom2(thread, handleEcmaModuleAddFrom2.GetTaggedValue()); + EcmaModule::AddItem(thread_, handleEcmaModuleAddFrom2, handleItemName2, handleItemValue2); + JSHandle handleTagValEcmaModuleAddFrom2(thread_, handleEcmaModuleAddFrom2.GetTaggedValue()); std::string stdStrNameEcmaModuleAdd2 = "NameEcmaModule2"; JSHandle handleTagValNameEcmaModuleAdd2(objFactory->NewFromStdString(stdStrNameEcmaModuleAdd2)); moduleManager->AddModule(handleTagValNameEcmaModuleAdd1, handleTagValEcmaModuleAddFrom1); moduleManager->AddModule(handleTagValNameEcmaModuleAdd2, handleTagValEcmaModuleAddFrom2); JSHandle handleTagValEcmaModuleGet1 = - moduleManager->GetModule(thread, handleTagValNameEcmaModuleAdd1); + moduleManager->GetModule(thread_, handleTagValNameEcmaModuleAdd1); JSHandle handleTagValEcmaModuleGet2 = - moduleManager->GetModule(thread, handleTagValNameEcmaModuleAdd2); - EXPECT_EQ(JSHandle::Cast(handleTagValEcmaModuleGet1)->GetItem(thread, handleItemName1)->GetNumber(), + moduleManager->GetModule(thread_, handleTagValNameEcmaModuleAdd2); + EXPECT_EQ(JSHandle::Cast(handleTagValEcmaModuleGet1)->GetItem(thread_, handleItemName1)->GetNumber(), intItemValue1); - EXPECT_EQ(JSHandle::Cast(handleTagValEcmaModuleGet2)->GetItem(thread, handleItemName2)->GetNumber(), + EXPECT_EQ(JSHandle::Cast(handleTagValEcmaModuleGet2)->GetItem(thread_, handleItemName2)->GetNumber(), intItemValue2); } @@ -227,8 +227,8 @@ TEST_F(EcmaModuleTest, ModuleManager_AddModule) */ TEST_F(EcmaModuleTest, ModuleManager_RemoveModule) { - ObjectFactory *objFactory = thread->GetEcmaVM()->GetFactory(); - ModuleManager *moduleManager = thread->GetEcmaVM()->GetModuleManager(); + ObjectFactory *objFactory = thread_->GetEcmaVM()->GetFactory(); + ModuleManager *moduleManager = thread_->GetEcmaVM()->GetModuleManager(); std::string stdStrNameEcmaModuleAdd1 = "NameEcmaModule1"; std::string stdStrNameEcmaModuleAdd2 = "NameEcmaModule2"; @@ -240,40 +240,40 @@ TEST_F(EcmaModuleTest, ModuleManager_RemoveModule) JSHandle handleTagValNameEcmaModuleAdd2(objFactory->NewFromStdString(stdStrNameEcmaModuleAdd2)); JSHandle handleTagValItemName1(objFactory->NewFromCanBeCompressString("name1")); JSHandle handleTagValItemName2(objFactory->NewFromCanBeCompressString("name2")); - JSHandle handleTagValItemValue1(thread, JSTaggedValue(intItemValue1)); - JSHandle handleTagValItemValue2(thread, JSTaggedValue(intItemValue2)); - JSHandle handleEcmaModuleAddFrom1(thread, EcmaModuleCreate(thread)); - JSHandle handleEcmaModuleAddFrom2(thread, EcmaModuleCreate(thread)); - JSHandle handleNameDict1(NameDictionary::Create(thread, numOfElementsDict1)); - JSHandle handleNameDict2(NameDictionary::Create(thread, numOfElementsDict2)); - handleEcmaModuleAddFrom1->SetNameDictionary(thread, handleNameDict1); - handleEcmaModuleAddFrom2->SetNameDictionary(thread, handleNameDict2); - EcmaModule::AddItem(thread, handleEcmaModuleAddFrom1, handleTagValItemName1, handleTagValItemValue1); - EcmaModule::AddItem(thread, handleEcmaModuleAddFrom2, handleTagValItemName2, handleTagValItemValue2); - JSHandle handleTaggedValueEcmaModuleAddFrom1(thread, handleEcmaModuleAddFrom1.GetTaggedValue()); - JSHandle handleTaggedValueEcmaModuleAddFrom2(thread, handleEcmaModuleAddFrom2.GetTaggedValue()); + JSHandle handleTagValItemValue1(thread_, JSTaggedValue(intItemValue1)); + JSHandle handleTagValItemValue2(thread_, JSTaggedValue(intItemValue2)); + JSHandle handleEcmaModuleAddFrom1(thread_, EcmaModuleCreate(thread_)); + JSHandle handleEcmaModuleAddFrom2(thread_, EcmaModuleCreate(thread_)); + JSHandle handleNameDict1(NameDictionary::Create(thread_, numOfElementsDict1)); + JSHandle handleNameDict2(NameDictionary::Create(thread_, numOfElementsDict2)); + handleEcmaModuleAddFrom1->SetNameDictionary(thread_, handleNameDict1); + handleEcmaModuleAddFrom2->SetNameDictionary(thread_, handleNameDict2); + EcmaModule::AddItem(thread_, handleEcmaModuleAddFrom1, handleTagValItemName1, handleTagValItemValue1); + EcmaModule::AddItem(thread_, handleEcmaModuleAddFrom2, handleTagValItemName2, handleTagValItemValue2); + JSHandle handleTaggedValueEcmaModuleAddFrom1(thread_, handleEcmaModuleAddFrom1.GetTaggedValue()); + JSHandle handleTaggedValueEcmaModuleAddFrom2(thread_, handleEcmaModuleAddFrom2.GetTaggedValue()); moduleManager->AddModule(handleTagValNameEcmaModuleAdd1, handleTaggedValueEcmaModuleAddFrom1); moduleManager->AddModule(handleTagValNameEcmaModuleAdd2, handleTaggedValueEcmaModuleAddFrom2); - EXPECT_EQ(JSHandle::Cast(moduleManager->GetModule(thread, handleTagValNameEcmaModuleAdd1)) - ->GetItem(thread, handleTagValItemName1) + EXPECT_EQ(JSHandle::Cast(moduleManager->GetModule(thread_, handleTagValNameEcmaModuleAdd1)) + ->GetItem(thread_, handleTagValItemName1) ->GetNumber(), intItemValue1); - EXPECT_EQ(JSHandle::Cast(moduleManager->GetModule(thread, handleTagValNameEcmaModuleAdd2)) - ->GetItem(thread, handleTagValItemName2) + EXPECT_EQ(JSHandle::Cast(moduleManager->GetModule(thread_, handleTagValNameEcmaModuleAdd2)) + ->GetItem(thread_, handleTagValItemName2) ->GetNumber(), intItemValue2); moduleManager->RemoveModule(handleTagValNameEcmaModuleAdd1); - EXPECT_TRUE(moduleManager->GetModule(thread, handleTagValNameEcmaModuleAdd1)->IsUndefined()); - EXPECT_EQ(JSHandle::Cast(moduleManager->GetModule(thread, handleTagValNameEcmaModuleAdd2)) - ->GetItem(thread, handleTagValItemName2) + EXPECT_TRUE(moduleManager->GetModule(thread_, handleTagValNameEcmaModuleAdd1)->IsUndefined()); + EXPECT_EQ(JSHandle::Cast(moduleManager->GetModule(thread_, handleTagValNameEcmaModuleAdd2)) + ->GetItem(thread_, handleTagValItemName2) ->GetNumber(), intItemValue2); moduleManager->RemoveModule(handleTagValNameEcmaModuleAdd2); - EXPECT_TRUE(moduleManager->GetModule(thread, handleTagValNameEcmaModuleAdd1)->IsUndefined()); - EXPECT_TRUE(moduleManager->GetModule(thread, handleTagValNameEcmaModuleAdd2)->IsUndefined()); + EXPECT_TRUE(moduleManager->GetModule(thread_, handleTagValNameEcmaModuleAdd1)->IsUndefined()); + EXPECT_TRUE(moduleManager->GetModule(thread_, handleTagValNameEcmaModuleAdd2)->IsUndefined()); } /* @@ -287,7 +287,7 @@ TEST_F(EcmaModuleTest, ModuleManager_RemoveModule) */ TEST_F(EcmaModuleTest, ModuleManager_SetCurrentExportModuleName) { - ModuleManager *moduleManager = thread->GetEcmaVM()->GetModuleManager(); + ModuleManager *moduleManager = thread_->GetEcmaVM()->GetModuleManager(); std::string_view strViewNameEcmaModule1 = "NameEcmaModule1"; std::string_view strViewNameEcmaModule2 = "NameEcmaModule2"; @@ -308,7 +308,7 @@ TEST_F(EcmaModuleTest, ModuleManager_SetCurrentExportModuleName) */ TEST_F(EcmaModuleTest, ModuleManager_GetPrevExportModuleName) { - ModuleManager *moduleManager = thread->GetEcmaVM()->GetModuleManager(); + ModuleManager *moduleManager = thread_->GetEcmaVM()->GetModuleManager(); std::string_view strViewNameEcmaModule1 = "NameEcmaModule1"; std::string_view strViewNameEcmaModule2 = "NameEcmaModule2"; @@ -332,7 +332,7 @@ TEST_F(EcmaModuleTest, ModuleManager_GetPrevExportModuleName) */ TEST_F(EcmaModuleTest, ModuleManager_RestoreCurrentExportModuleName) { - ModuleManager *moduleManager = thread->GetEcmaVM()->GetModuleManager(); + ModuleManager *moduleManager = thread_->GetEcmaVM()->GetModuleManager(); std::string_view strViewNameEcmaModule1 = "NameEcmaModule1"; std::string_view strViewNameEcmaModule2 = "NameEcmaModule2"; @@ -359,8 +359,8 @@ TEST_F(EcmaModuleTest, ModuleManager_RestoreCurrentExportModuleName) */ TEST_F(EcmaModuleTest, ModuleManager_AddModuleItem) { - ObjectFactory *objFactory = thread->GetEcmaVM()->GetFactory(); - ModuleManager *moduleManager = thread->GetEcmaVM()->GetModuleManager(); + ObjectFactory *objFactory = thread_->GetEcmaVM()->GetFactory(); + ModuleManager *moduleManager = thread_->GetEcmaVM()->GetModuleManager(); int intItemValue11 = 11; int intItemValue12 = 12; @@ -370,10 +370,10 @@ TEST_F(EcmaModuleTest, ModuleManager_AddModuleItem) JSHandle handleTagValItemName12(objFactory->NewFromCanBeCompressString("cStrItemName12")); JSHandle handleTagValItemName21(objFactory->NewFromCanBeCompressString("cStrItemName21")); JSHandle handleTagValItemName22(objFactory->NewFromCanBeCompressString("cStrItemName22")); - JSHandle handleTagValItemValue11(thread, JSTaggedValue(intItemValue11)); - JSHandle handleTagValItemValue12(thread, JSTaggedValue(intItemValue12)); - JSHandle handleTagValItemValue21(thread, JSTaggedValue(intItemValue21)); - JSHandle handleTagValItemValue22(thread, JSTaggedValue(intItemValue22)); + JSHandle handleTagValItemValue11(thread_, JSTaggedValue(intItemValue11)); + JSHandle handleTagValItemValue12(thread_, JSTaggedValue(intItemValue12)); + JSHandle handleTagValItemValue21(thread_, JSTaggedValue(intItemValue21)); + JSHandle handleTagValItemValue22(thread_, JSTaggedValue(intItemValue22)); JSHandle handleEcmaStrNameEcmaModule1 = objFactory->NewFromString("cStrNameEcmaModule1"); JSHandle handleEcmaStrNameEcmaModule2 = objFactory->NewFromString("cStrNameEcmaModule2"); std::string stdStrModuleFileName1 = JSLocale::ConvertToStdString(handleEcmaStrNameEcmaModule1); @@ -382,31 +382,31 @@ TEST_F(EcmaModuleTest, ModuleManager_AddModuleItem) JSHandle handleTagValEcmaModuleName2(handleEcmaStrNameEcmaModule2); // Test when the module is created through 'NewEmptyEcmaModule' function called at TEST_F. - JSHandle handleEcmaModule1(thread, EcmaModuleCreate(thread)); - JSHandle handleTagValEcmaModule1(thread, handleEcmaModule1.GetTaggedValue()); + JSHandle handleEcmaModule1(thread_, EcmaModuleCreate(thread_)); + JSHandle handleTagValEcmaModule1(thread_, handleEcmaModule1.GetTaggedValue()); moduleManager->AddModule(handleTagValEcmaModuleName1, handleTagValEcmaModule1); moduleManager->SetCurrentExportModuleName(stdStrModuleFileName1); - moduleManager->AddModuleItem(thread, handleTagValItemName11, handleTagValItemValue11); - moduleManager->AddModuleItem(thread, handleTagValItemName12, handleTagValItemValue12); + moduleManager->AddModuleItem(thread_, handleTagValItemName11, handleTagValItemValue11); + moduleManager->AddModuleItem(thread_, handleTagValItemName12, handleTagValItemValue12); - EXPECT_EQ(moduleManager->GetModuleItem(thread, handleTagValEcmaModule1, handleTagValItemName11)->GetNumber(), + EXPECT_EQ(moduleManager->GetModuleItem(thread_, handleTagValEcmaModule1, handleTagValItemName11)->GetNumber(), intItemValue11); - EXPECT_EQ(moduleManager->GetModuleItem(thread, handleTagValEcmaModule1, handleTagValItemName12)->GetNumber(), + EXPECT_EQ(moduleManager->GetModuleItem(thread_, handleTagValEcmaModule1, handleTagValItemName12)->GetNumber(), intItemValue12); // Test when the module is created through 'NewEmptyEcmaModule' function called at "ecma_module.cpp". moduleManager->SetCurrentExportModuleName(stdStrModuleFileName2); - moduleManager->AddModuleItem(thread, handleTagValItemName21, handleTagValItemValue21); - moduleManager->AddModuleItem(thread, handleTagValItemName22, handleTagValItemValue22); + moduleManager->AddModuleItem(thread_, handleTagValItemName21, handleTagValItemValue21); + moduleManager->AddModuleItem(thread_, handleTagValItemName22, handleTagValItemValue22); - JSHandle handleTagValEcmaModule2 = moduleManager->GetModule(thread, handleTagValEcmaModuleName2); - EXPECT_EQ(moduleManager->GetModuleItem(thread, handleTagValEcmaModule1, handleTagValItemName11)->GetNumber(), + JSHandle handleTagValEcmaModule2 = moduleManager->GetModule(thread_, handleTagValEcmaModuleName2); + EXPECT_EQ(moduleManager->GetModuleItem(thread_, handleTagValEcmaModule1, handleTagValItemName11)->GetNumber(), intItemValue11); - EXPECT_EQ(moduleManager->GetModuleItem(thread, handleTagValEcmaModule1, handleTagValItemName12)->GetNumber(), + EXPECT_EQ(moduleManager->GetModuleItem(thread_, handleTagValEcmaModule1, handleTagValItemName12)->GetNumber(), intItemValue12); - EXPECT_EQ(moduleManager->GetModuleItem(thread, handleTagValEcmaModule2, handleTagValItemName21)->GetNumber(), + EXPECT_EQ(moduleManager->GetModuleItem(thread_, handleTagValEcmaModule2, handleTagValItemName21)->GetNumber(), intItemValue21); - EXPECT_EQ(moduleManager->GetModuleItem(thread, handleTagValEcmaModule2, handleTagValItemName22)->GetNumber(), + EXPECT_EQ(moduleManager->GetModuleItem(thread_, handleTagValEcmaModule2, handleTagValItemName22)->GetNumber(), intItemValue22); } @@ -422,8 +422,8 @@ TEST_F(EcmaModuleTest, ModuleManager_AddModuleItem) */ TEST_F(EcmaModuleTest, ModuleManager_CopyModule) { - ObjectFactory *objFactory = thread->GetEcmaVM()->GetFactory(); - ModuleManager *moduleManager = thread->GetEcmaVM()->GetModuleManager(); + ObjectFactory *objFactory = thread_->GetEcmaVM()->GetFactory(); + ModuleManager *moduleManager = thread_->GetEcmaVM()->GetModuleManager(); int intItemValue11 = 11; int intItemValue12 = 12; @@ -435,39 +435,45 @@ TEST_F(EcmaModuleTest, ModuleManager_CopyModule) JSHandle handleTagValItemName12(objFactory->NewFromCanBeCompressString("ItemName12")); JSHandle handleTagValItemName21(objFactory->NewFromCanBeCompressString("ItemName21")); JSHandle handleTagValItemName22(objFactory->NewFromCanBeCompressString("ItemName22")); - JSHandle handleTagValItemValue11(thread, JSTaggedValue(intItemValue11)); - JSHandle handleTagValItemValue12(thread, JSTaggedValue(intItemValue12)); - JSHandle handleTagValItemValue21(thread, JSTaggedValue(intItemValue21)); - JSHandle handleTagValItemValue22(thread, JSTaggedValue(intItemValue22)); - JSHandle handleEcmaModuleCopyFrom1(thread, EcmaModuleCreate(thread)); - JSHandle handleEcmaModuleCopyFrom2(thread, EcmaModuleCreate(thread)); - JSHandle handleTagValEcmaModuleCopyFrom1(thread, handleEcmaModuleCopyFrom1.GetTaggedValue()); - JSHandle handleTagValEcmaModuleCopyFrom2(thread, handleEcmaModuleCopyFrom2.GetTaggedValue()); - EcmaModule::AddItem(thread, handleEcmaModuleCopyFrom1, handleTagValItemName11, handleTagValItemValue11); - EcmaModule::AddItem(thread, handleEcmaModuleCopyFrom1, handleTagValItemName12, handleTagValItemValue12); - EcmaModule::AddItem(thread, handleEcmaModuleCopyFrom2, handleTagValItemName21, handleTagValItemValue21); - EcmaModule::AddItem(thread, handleEcmaModuleCopyFrom2, handleTagValItemName22, handleTagValItemValue22); + JSHandle handleTagValItemValue11(thread_, JSTaggedValue(intItemValue11)); + JSHandle handleTagValItemValue12(thread_, JSTaggedValue(intItemValue12)); + JSHandle handleTagValItemValue21(thread_, JSTaggedValue(intItemValue21)); + JSHandle handleTagValItemValue22(thread_, JSTaggedValue(intItemValue22)); + JSHandle handleEcmaModuleCopyFrom1(thread_, EcmaModuleCreate(thread_)); + JSHandle handleEcmaModuleCopyFrom2(thread_, EcmaModuleCreate(thread_)); + JSHandle handleTagValEcmaModuleCopyFrom1(thread_, handleEcmaModuleCopyFrom1.GetTaggedValue()); + JSHandle handleTagValEcmaModuleCopyFrom2(thread_, handleEcmaModuleCopyFrom2.GetTaggedValue()); + EcmaModule::AddItem(thread_, handleEcmaModuleCopyFrom1, handleTagValItemName11, handleTagValItemValue11); + EcmaModule::AddItem(thread_, handleEcmaModuleCopyFrom1, handleTagValItemName12, handleTagValItemValue12); + EcmaModule::AddItem(thread_, handleEcmaModuleCopyFrom2, handleTagValItemName21, handleTagValItemValue21); + EcmaModule::AddItem(thread_, handleEcmaModuleCopyFrom2, handleTagValItemName22, handleTagValItemValue22); moduleManager->SetCurrentExportModuleName(fileNameEcmaModuleCopyTo1); - moduleManager->CopyModule(thread, handleTagValEcmaModuleCopyFrom1); + moduleManager->CopyModule(thread_, handleTagValEcmaModuleCopyFrom1); JSHandle handleTagValEcmaModuleCopyTo1 = moduleManager->GetModule( - thread, JSHandle::Cast(objFactory->NewFromString(CString(fileNameEcmaModuleCopyTo1)))); - EXPECT_EQ(intItemValue11, - moduleManager->GetModuleItem(thread, handleTagValEcmaModuleCopyTo1, handleTagValItemName11)->GetNumber()); - EXPECT_EQ(intItemValue12, - moduleManager->GetModuleItem(thread, handleTagValEcmaModuleCopyTo1, handleTagValItemName12)->GetNumber()); + thread_, JSHandle::Cast(objFactory->NewFromString(CString(fileNameEcmaModuleCopyTo1)))); + EXPECT_EQ( + intItemValue11, + moduleManager->GetModuleItem(thread_, handleTagValEcmaModuleCopyTo1, handleTagValItemName11)->GetNumber()); + EXPECT_EQ( + intItemValue12, + moduleManager->GetModuleItem(thread_, handleTagValEcmaModuleCopyTo1, handleTagValItemName12)->GetNumber()); moduleManager->SetCurrentExportModuleName(fileNameEcmaModuleCopyTo2); - moduleManager->CopyModule(thread, handleTagValEcmaModuleCopyFrom2); + moduleManager->CopyModule(thread_, handleTagValEcmaModuleCopyFrom2); JSHandle handleTagValEcmaModuleCopyTo2 = moduleManager->GetModule( - thread, JSHandle::Cast(objFactory->NewFromString(CString(fileNameEcmaModuleCopyTo2)))); - EXPECT_EQ(intItemValue11, - moduleManager->GetModuleItem(thread, handleTagValEcmaModuleCopyTo1, handleTagValItemName11)->GetNumber()); - EXPECT_EQ(intItemValue12, - moduleManager->GetModuleItem(thread, handleTagValEcmaModuleCopyTo1, handleTagValItemName12)->GetNumber()); - EXPECT_EQ(intItemValue21, - moduleManager->GetModuleItem(thread, handleTagValEcmaModuleCopyTo2, handleTagValItemName21)->GetNumber()); - EXPECT_EQ(intItemValue22, - moduleManager->GetModuleItem(thread, handleTagValEcmaModuleCopyTo2, handleTagValItemName22)->GetNumber()); + thread_, JSHandle::Cast(objFactory->NewFromString(CString(fileNameEcmaModuleCopyTo2)))); + EXPECT_EQ( + intItemValue11, + moduleManager->GetModuleItem(thread_, handleTagValEcmaModuleCopyTo1, handleTagValItemName11)->GetNumber()); + EXPECT_EQ( + intItemValue12, + moduleManager->GetModuleItem(thread_, handleTagValEcmaModuleCopyTo1, handleTagValItemName12)->GetNumber()); + EXPECT_EQ( + intItemValue21, + moduleManager->GetModuleItem(thread_, handleTagValEcmaModuleCopyTo2, handleTagValItemName21)->GetNumber()); + EXPECT_EQ( + intItemValue22, + moduleManager->GetModuleItem(thread_, handleTagValEcmaModuleCopyTo2, handleTagValItemName22)->GetNumber()); } } // namespace panda::test diff --git a/tests/runtime/common/ecma_string_test.cpp b/tests/runtime/common/ecma_string_test.cpp index 2013fa615bfb30ed9ac562464e4d3bf78bbf0ee8..932872c25e1a3fd84e2d8dde2e9e750e3b2535d9 100644 --- a/tests/runtime/common/ecma_string_test.cpp +++ b/tests/runtime/common/ecma_string_test.cpp @@ -33,16 +33,16 @@ public: void SetUp() override { - TestHelper::CreateEcmaVMWithScope(instance, thread, scope); + TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); } void TearDown() override { - TestHelper::DestroyEcmaVMWithScope(instance, scope); + TestHelper::DestroyEcmaVMWithScope(instance_, scope_); } - PandaVM *instance {nullptr}; - ecmascript::EcmaHandleScope *scope {nullptr}; - JSThread *thread {nullptr}; + PandaVM *instance_ {nullptr}; + ecmascript::EcmaHandleScope *scope_ {nullptr}; + JSThread *thread_ {nullptr}; }; /* @@ -94,15 +94,15 @@ TEST_F(EcmaStringTest, CanBeCompressed) */ TEST_F(EcmaStringTest, CreateEmptyString) { - EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); + EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); - JSHandle handleEcmaStrEmpty(thread, EcmaString::CreateEmptyString(ecmaVMPtr)); + JSHandle handleEcmaStrEmpty(thread_, EcmaString::CreateEmptyString(ecmaVMPtr)); EXPECT_EQ(handleEcmaStrEmpty->GetLength(), 0); EXPECT_TRUE(handleEcmaStrEmpty->IsUtf8()); EXPECT_FALSE(handleEcmaStrEmpty->IsUtf16()); EcmaString::SetCompressedStringsEnabled(false); // Set compressedStringsEnabled false. - JSHandle handleEcmaStrEmptyDisableComp(thread, EcmaString::CreateEmptyString(ecmaVMPtr)); + JSHandle handleEcmaStrEmptyDisableComp(thread_, EcmaString::CreateEmptyString(ecmaVMPtr)); EXPECT_EQ(handleEcmaStrEmptyDisableComp->GetLength(), 0); EXPECT_TRUE(handleEcmaStrEmptyDisableComp->IsUtf16()); EcmaString::SetCompressedStringsEnabled(true); // Set compressedStringsEnabled true(default). @@ -117,11 +117,11 @@ TEST_F(EcmaStringTest, CreateEmptyString) */ TEST_F(EcmaStringTest, AllocStringObject) { - EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); + EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); // AllocStringObject( , true, ). size_t sizeAllocComp = 5; - JSHandle handleEcmaStrAllocComp(thread, EcmaString::AllocStringObject(sizeAllocComp, true, ecmaVMPtr)); + JSHandle handleEcmaStrAllocComp(thread_, EcmaString::AllocStringObject(sizeAllocComp, true, ecmaVMPtr)); for (size_t i = 0; i < sizeAllocComp; i++) { EXPECT_EQ(handleEcmaStrAllocComp->At(i), 0); } @@ -131,7 +131,7 @@ TEST_F(EcmaStringTest, AllocStringObject) // AllocStringObject( , false, ). size_t sizeAllocNotComp = 5; - JSHandle handleEcmaStrAllocNotComp(thread, + JSHandle handleEcmaStrAllocNotComp(thread_, EcmaString::AllocStringObject(sizeAllocNotComp, false, ecmaVMPtr)); for (size_t i = 0; i < sizeAllocNotComp; i++) { EXPECT_EQ(handleEcmaStrAllocNotComp->At(i), 0); @@ -141,7 +141,7 @@ TEST_F(EcmaStringTest, AllocStringObject) EXPECT_TRUE(handleEcmaStrAllocNotComp->IsUtf16()); EcmaString::SetCompressedStringsEnabled(false); // Set compressedStringsEnabled false. JSHandle handleEcmaStrAllocNotCompDisableComp( - thread, EcmaString::AllocStringObject(sizeAllocNotComp, false, ecmaVMPtr)); + thread_, EcmaString::AllocStringObject(sizeAllocNotComp, false, ecmaVMPtr)); EXPECT_TRUE(handleEcmaStrAllocNotCompDisableComp->IsUtf16()); EcmaString::SetCompressedStringsEnabled(true); // Set compressedStringsEnabled true(default). } @@ -154,10 +154,10 @@ TEST_F(EcmaStringTest, AllocStringObject) */ TEST_F(EcmaStringTest, CreateFromUtf8) { - EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); + EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); uint8_t arrayU8[] = {"xyz123!@#"}; size_t lengthEcmaStrU8 = sizeof(arrayU8) - 1; - JSHandle handleEcmaStrU8(thread, + JSHandle handleEcmaStrU8(thread_, EcmaString::CreateFromUtf8(&arrayU8[0], lengthEcmaStrU8, ecmaVMPtr, true)); for (size_t i = 0; i < lengthEcmaStrU8; i++) { EXPECT_EQ(arrayU8[i], handleEcmaStrU8->At(i)); @@ -176,13 +176,13 @@ TEST_F(EcmaStringTest, CreateFromUtf8) */ TEST_F(EcmaStringTest, CreateFromUtf16) { - EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); + EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); // CreateFromUtf16( , , , true). uint16_t arrayU16Comp[] = {1, 23, 45, 67, 127}; size_t lengthEcmaStrU16Comp = sizeof(arrayU16Comp) / sizeof(arrayU16Comp[0]); JSHandle handleEcmaStrU16Comp( - thread, EcmaString::CreateFromUtf16(&arrayU16Comp[0], lengthEcmaStrU16Comp, ecmaVMPtr, true)); + thread_, EcmaString::CreateFromUtf16(&arrayU16Comp[0], lengthEcmaStrU16Comp, ecmaVMPtr, true)); EXPECT_EQ(handleEcmaStrU16Comp->GetLength(), lengthEcmaStrU16Comp); EXPECT_TRUE(handleEcmaStrU16Comp->IsUtf8()); EXPECT_FALSE(handleEcmaStrU16Comp->IsUtf16()); @@ -191,13 +191,13 @@ TEST_F(EcmaStringTest, CreateFromUtf16) uint16_t arrayU16NotComp[] = {127, 33, 128, 12, 256, 11100, 65535}; size_t lengthEcmaStrU16NotComp = sizeof(arrayU16NotComp) / sizeof(arrayU16NotComp[0]); JSHandle handleEcmaStrU16NotComp( - thread, EcmaString::CreateFromUtf16(&arrayU16NotComp[0], lengthEcmaStrU16NotComp, ecmaVMPtr, false)); + thread_, EcmaString::CreateFromUtf16(&arrayU16NotComp[0], lengthEcmaStrU16NotComp, ecmaVMPtr, false)); EXPECT_EQ(handleEcmaStrU16NotComp->GetLength(), lengthEcmaStrU16NotComp); EXPECT_FALSE(handleEcmaStrU16NotComp->IsUtf8()); EXPECT_TRUE(handleEcmaStrU16NotComp->IsUtf16()); EcmaString::SetCompressedStringsEnabled(false); // Set compressedStringsEnabled false. JSHandle handleEcmaStrU16NotCompDisableComp( - thread, EcmaString::CreateFromUtf16(&arrayU16NotComp[0], lengthEcmaStrU16NotComp, ecmaVMPtr, false)); + thread_, EcmaString::CreateFromUtf16(&arrayU16NotComp[0], lengthEcmaStrU16NotComp, ecmaVMPtr, false)); EXPECT_TRUE(handleEcmaStrU16NotCompDisableComp->IsUtf16()); EcmaString::SetCompressedStringsEnabled(true); // Set compressedStringsEnabled true(default). } @@ -255,24 +255,24 @@ TEST_F(EcmaStringTest, ComputeSizeUtf16) */ TEST_F(EcmaStringTest, ObjectSize) { - EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); + EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); - JSHandle handleEcmaStrEmpty(thread, EcmaString::CreateEmptyString(ecmaVMPtr)); + JSHandle handleEcmaStrEmpty(thread_, EcmaString::CreateEmptyString(ecmaVMPtr)); EXPECT_EQ(handleEcmaStrEmpty->ObjectSize(), EcmaString::SIZE + 0); size_t lengthEcmaStrAllocComp = 5; - JSHandle handleEcmaStrAllocComp(thread, + JSHandle handleEcmaStrAllocComp(thread_, EcmaString::AllocStringObject(lengthEcmaStrAllocComp, true, ecmaVMPtr)); EXPECT_EQ(handleEcmaStrAllocComp->ObjectSize(), EcmaString::SIZE + sizeof(uint8_t) * lengthEcmaStrAllocComp); size_t lengthEcmaStrAllocNotComp = 5; JSHandle handleEcmaStrAllocNotComp( - thread, EcmaString::AllocStringObject(lengthEcmaStrAllocNotComp, false, ecmaVMPtr)); + thread_, EcmaString::AllocStringObject(lengthEcmaStrAllocNotComp, false, ecmaVMPtr)); EXPECT_EQ(handleEcmaStrAllocNotComp->ObjectSize(), EcmaString::SIZE + sizeof(uint16_t) * lengthEcmaStrAllocNotComp); uint8_t arrayU8[] = {"abcde"}; size_t lengthEcmaStrU8 = sizeof(arrayU8) - 1; - JSHandle handleEcmaStrU8(thread, + JSHandle handleEcmaStrU8(thread_, EcmaString::CreateFromUtf8(&arrayU8[0], lengthEcmaStrU8, ecmaVMPtr, true)); EXPECT_EQ(handleEcmaStrU8->ObjectSize(), EcmaString::SIZE + sizeof(uint8_t) * lengthEcmaStrU8); @@ -280,14 +280,14 @@ TEST_F(EcmaStringTest, ObjectSize) uint16_t arrayU16Comp[] = {1, 23, 45, 67, 127}; size_t lengthEcmaStrU16Comp = sizeof(arrayU16Comp) / sizeof(arrayU16Comp[0]); JSHandle handleEcmaStrU16Comp( - thread, EcmaString::CreateFromUtf16(&arrayU16Comp[0], lengthEcmaStrU16Comp, ecmaVMPtr, true)); + thread_, EcmaString::CreateFromUtf16(&arrayU16Comp[0], lengthEcmaStrU16Comp, ecmaVMPtr, true)); EXPECT_EQ(handleEcmaStrU16Comp->ObjectSize(), EcmaString::SIZE + sizeof(uint8_t) * lengthEcmaStrU16Comp); // ObjectSize(). EcmaString made by CreateFromUtf16( , , , false). uint16_t arrayU16NotComp[] = {127, 128, 256, 11100, 65535}; size_t lengthEcmaStrU16NotComp = sizeof(arrayU16NotComp) / sizeof(arrayU16NotComp[0]); JSHandle handleEcmaStrU16NotComp( - thread, EcmaString::CreateFromUtf16(&arrayU16NotComp[0], lengthEcmaStrU16NotComp, ecmaVMPtr, false)); + thread_, EcmaString::CreateFromUtf16(&arrayU16NotComp[0], lengthEcmaStrU16NotComp, ecmaVMPtr, false)); EXPECT_EQ(handleEcmaStrU16NotComp->ObjectSize(), EcmaString::SIZE + sizeof(uint16_t) * lengthEcmaStrU16NotComp); } @@ -300,7 +300,7 @@ TEST_F(EcmaStringTest, ObjectSize) */ TEST_F(EcmaStringTest, Compare_001) { - EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); + EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); // Compare(). Between EcmaStrings made by CreateFromUtf8(). uint8_t arrayU8No1[3] = {1, 23}; @@ -310,11 +310,11 @@ TEST_F(EcmaStringTest, Compare_001) uint32_t lengthEcmaStrU8No2 = sizeof(arrayU8No2) - 1; uint32_t lengthEcmaStrU8No3 = sizeof(arrayU8No3) - 1; JSHandle handleEcmaStrU8No1( - thread, EcmaString::CreateFromUtf8(&arrayU8No1[0], lengthEcmaStrU8No1, ecmaVMPtr, true)); + thread_, EcmaString::CreateFromUtf8(&arrayU8No1[0], lengthEcmaStrU8No1, ecmaVMPtr, true)); JSHandle handleEcmaStrU8No2( - thread, EcmaString::CreateFromUtf8(&arrayU8No2[0], lengthEcmaStrU8No2, ecmaVMPtr, true)); + thread_, EcmaString::CreateFromUtf8(&arrayU8No2[0], lengthEcmaStrU8No2, ecmaVMPtr, true)); JSHandle handleEcmaStrU8No3( - thread, EcmaString::CreateFromUtf8(&arrayU8No3[0], lengthEcmaStrU8No3, ecmaVMPtr, true)); + thread_, EcmaString::CreateFromUtf8(&arrayU8No3[0], lengthEcmaStrU8No3, ecmaVMPtr, true)); EXPECT_EQ(handleEcmaStrU8No1->Compare(*handleEcmaStrU8No2), -1); EXPECT_EQ(handleEcmaStrU8No2->Compare(*handleEcmaStrU8No1), 1); EXPECT_EQ(handleEcmaStrU8No2->Compare(*handleEcmaStrU8No3), 49 - 45); @@ -330,7 +330,7 @@ TEST_F(EcmaStringTest, Compare_001) */ TEST_F(EcmaStringTest, Compare_002) { - EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); + EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); // Compare(). Between EcmaStrings made by CreateFromUtf16( , , , true). uint16_t arrayU16CompNo1[] = {1, 23}; @@ -340,11 +340,11 @@ TEST_F(EcmaStringTest, Compare_002) uint32_t lengthEcmaStrU16CompNo2 = sizeof(arrayU16CompNo2) / sizeof(arrayU16CompNo2[0]); uint32_t lengthEcmaStrU16CompNo3 = sizeof(arrayU16CompNo3) / sizeof(arrayU16CompNo3[0]); JSHandle handleEcmaStrU16CompNo1( - thread, EcmaString::CreateFromUtf16(&arrayU16CompNo1[0], lengthEcmaStrU16CompNo1, ecmaVMPtr, true)); + thread_, EcmaString::CreateFromUtf16(&arrayU16CompNo1[0], lengthEcmaStrU16CompNo1, ecmaVMPtr, true)); JSHandle handleEcmaStrU16CompNo2( - thread, EcmaString::CreateFromUtf16(&arrayU16CompNo2[0], lengthEcmaStrU16CompNo2, ecmaVMPtr, true)); + thread_, EcmaString::CreateFromUtf16(&arrayU16CompNo2[0], lengthEcmaStrU16CompNo2, ecmaVMPtr, true)); JSHandle handleEcmaStrU16CompNo3( - thread, EcmaString::CreateFromUtf16(&arrayU16CompNo3[0], lengthEcmaStrU16CompNo3, ecmaVMPtr, true)); + thread_, EcmaString::CreateFromUtf16(&arrayU16CompNo3[0], lengthEcmaStrU16CompNo3, ecmaVMPtr, true)); EXPECT_EQ(handleEcmaStrU16CompNo1->Compare(*handleEcmaStrU16CompNo2), -1); EXPECT_EQ(handleEcmaStrU16CompNo2->Compare(*handleEcmaStrU16CompNo1), 1); EXPECT_EQ(handleEcmaStrU16CompNo2->Compare(*handleEcmaStrU16CompNo3), 49 - 45); @@ -361,7 +361,7 @@ TEST_F(EcmaStringTest, Compare_002) */ TEST_F(EcmaStringTest, Compare_003) { - EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); + EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); // Compare(). EcmaString made by CreateFromUtf8() and EcmaString made by CreateFromUtf16( , , , true). uint8_t arrayU8No1[3] = {1, 23}; @@ -375,15 +375,15 @@ TEST_F(EcmaStringTest, Compare_003) uint32_t lengthEcmaStrU16CompNo2 = sizeof(arrayU16CompNo2) / sizeof(arrayU16CompNo2[0]); uint32_t lengthEcmaStrU16CompNo3 = sizeof(arrayU16CompNo3) / sizeof(arrayU16CompNo3[0]); JSHandle handleEcmaStrU8No1( - thread, EcmaString::CreateFromUtf8(&arrayU8No1[0], lengthEcmaStrU8No1, ecmaVMPtr, true)); + thread_, EcmaString::CreateFromUtf8(&arrayU8No1[0], lengthEcmaStrU8No1, ecmaVMPtr, true)); JSHandle handleEcmaStrU8No2( - thread, EcmaString::CreateFromUtf8(&arrayU8No2[0], lengthEcmaStrU8No2, ecmaVMPtr, true)); + thread_, EcmaString::CreateFromUtf8(&arrayU8No2[0], lengthEcmaStrU8No2, ecmaVMPtr, true)); JSHandle handleEcmaStrU16CompNo1( - thread, EcmaString::CreateFromUtf16(&arrayU16CompNo1[0], lengthEcmaStrU16CompNo1, ecmaVMPtr, true)); + thread_, EcmaString::CreateFromUtf16(&arrayU16CompNo1[0], lengthEcmaStrU16CompNo1, ecmaVMPtr, true)); JSHandle handleEcmaStrU16CompNo2( - thread, EcmaString::CreateFromUtf16(&arrayU16CompNo2[0], lengthEcmaStrU16CompNo2, ecmaVMPtr, true)); + thread_, EcmaString::CreateFromUtf16(&arrayU16CompNo2[0], lengthEcmaStrU16CompNo2, ecmaVMPtr, true)); JSHandle handleEcmaStrU16CompNo3( - thread, EcmaString::CreateFromUtf16(&arrayU16CompNo3[0], lengthEcmaStrU16CompNo3, ecmaVMPtr, true)); + thread_, EcmaString::CreateFromUtf16(&arrayU16CompNo3[0], lengthEcmaStrU16CompNo3, ecmaVMPtr, true)); EXPECT_EQ(handleEcmaStrU8No1->Compare(*handleEcmaStrU16CompNo1), 0); EXPECT_EQ(handleEcmaStrU16CompNo1->Compare(*handleEcmaStrU8No1), 0); EXPECT_EQ(handleEcmaStrU8No1->Compare(*handleEcmaStrU16CompNo2), -1); @@ -401,7 +401,7 @@ TEST_F(EcmaStringTest, Compare_003) */ TEST_F(EcmaStringTest, Compare_004) { - EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); + EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); // Compare(). Between EcmaStrings made by CreateFromUtf16( , , , false). uint16_t arrayU16NotCompNo1[] = {1, 23}; @@ -411,11 +411,11 @@ TEST_F(EcmaStringTest, Compare_004) uint32_t lengthEcmaStrU16NotCompNo2 = sizeof(arrayU16NotCompNo2) / sizeof(arrayU16NotCompNo2[0]); uint32_t lengthEcmaStrU16NotCompNo3 = sizeof(arrayU16NotCompNo3) / sizeof(arrayU16NotCompNo3[0]); JSHandle handleEcmaStrU16NotCompNo1( - thread, EcmaString::CreateFromUtf16(&arrayU16NotCompNo1[0], lengthEcmaStrU16NotCompNo1, ecmaVMPtr, false)); + thread_, EcmaString::CreateFromUtf16(&arrayU16NotCompNo1[0], lengthEcmaStrU16NotCompNo1, ecmaVMPtr, false)); JSHandle handleEcmaStrU16NotCompNo2( - thread, EcmaString::CreateFromUtf16(&arrayU16NotCompNo2[0], lengthEcmaStrU16NotCompNo2, ecmaVMPtr, false)); + thread_, EcmaString::CreateFromUtf16(&arrayU16NotCompNo2[0], lengthEcmaStrU16NotCompNo2, ecmaVMPtr, false)); JSHandle handleEcmaStrU16NotCompNo3( - thread, EcmaString::CreateFromUtf16(&arrayU16NotCompNo3[0], lengthEcmaStrU16NotCompNo3, ecmaVMPtr, false)); + thread_, EcmaString::CreateFromUtf16(&arrayU16NotCompNo3[0], lengthEcmaStrU16NotCompNo3, ecmaVMPtr, false)); EXPECT_EQ(handleEcmaStrU16NotCompNo1->Compare(*handleEcmaStrU16NotCompNo2), -1); EXPECT_EQ(handleEcmaStrU16NotCompNo2->Compare(*handleEcmaStrU16NotCompNo1), 1); EXPECT_EQ(handleEcmaStrU16NotCompNo2->Compare(*handleEcmaStrU16NotCompNo3), 49 - 456); @@ -431,7 +431,7 @@ TEST_F(EcmaStringTest, Compare_004) */ TEST_F(EcmaStringTest, Compare_005) { - EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); + EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); // Compare(). EcmaString made by CreateFromUtf8() and EcmaString made by CreateFromUtf16( , , , false). uint8_t arrayU8No1[3] = {1, 23}; @@ -445,15 +445,15 @@ TEST_F(EcmaStringTest, Compare_005) uint32_t lengthEcmaStrU16NotCompNo2 = sizeof(arrayU16NotCompNo2) / sizeof(arrayU16NotCompNo2[0]); uint32_t lengthEcmaStrU16NotCompNo3 = sizeof(arrayU16NotCompNo3) / sizeof(arrayU16NotCompNo3[0]); JSHandle handleEcmaStrU8No1( - thread, EcmaString::CreateFromUtf8(&arrayU8No1[0], lengthEcmaStrU8No1, ecmaVMPtr, true)); + thread_, EcmaString::CreateFromUtf8(&arrayU8No1[0], lengthEcmaStrU8No1, ecmaVMPtr, true)); JSHandle handleEcmaStrU8No2( - thread, EcmaString::CreateFromUtf8(&arrayU8No2[0], lengthEcmaStrU8No2, ecmaVMPtr, true)); + thread_, EcmaString::CreateFromUtf8(&arrayU8No2[0], lengthEcmaStrU8No2, ecmaVMPtr, true)); JSHandle handleEcmaStrU16NotCompNo1( - thread, EcmaString::CreateFromUtf16(&arrayU16NotCompNo1[0], lengthEcmaStrU16NotCompNo1, ecmaVMPtr, false)); + thread_, EcmaString::CreateFromUtf16(&arrayU16NotCompNo1[0], lengthEcmaStrU16NotCompNo1, ecmaVMPtr, false)); JSHandle handleEcmaStrU16NotCompNo2( - thread, EcmaString::CreateFromUtf16(&arrayU16NotCompNo2[0], lengthEcmaStrU16NotCompNo2, ecmaVMPtr, false)); + thread_, EcmaString::CreateFromUtf16(&arrayU16NotCompNo2[0], lengthEcmaStrU16NotCompNo2, ecmaVMPtr, false)); JSHandle handleEcmaStrU16NotCompNo3( - thread, EcmaString::CreateFromUtf16(&arrayU16NotCompNo3[0], lengthEcmaStrU16NotCompNo3, ecmaVMPtr, false)); + thread_, EcmaString::CreateFromUtf16(&arrayU16NotCompNo3[0], lengthEcmaStrU16NotCompNo3, ecmaVMPtr, false)); EXPECT_EQ(handleEcmaStrU8No1->Compare(*handleEcmaStrU16NotCompNo1), 0); EXPECT_EQ(handleEcmaStrU16NotCompNo1->Compare(*handleEcmaStrU8No1), 0); EXPECT_EQ(handleEcmaStrU8No1->Compare(*handleEcmaStrU16NotCompNo2), -1); @@ -471,7 +471,7 @@ TEST_F(EcmaStringTest, Compare_005) */ TEST_F(EcmaStringTest, Compare_006) { - EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); + EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); // Compare(). EcmaString made by CreateFromUtf16( , , , true) and EcmaString made by CreateFromUtf16( , , , false). uint16_t arrayU16CompNo1[] = {1, 23}; @@ -485,15 +485,15 @@ TEST_F(EcmaStringTest, Compare_006) uint32_t lengthEcmaStrU16NotCompNo2 = sizeof(arrayU16NotCompNo2) / sizeof(arrayU16NotCompNo2[0]); uint32_t lengthEcmaStrU16NotCompNo3 = sizeof(arrayU16NotCompNo3) / sizeof(arrayU16NotCompNo3[0]); JSHandle handleEcmaStrU16CompNo1( - thread, EcmaString::CreateFromUtf16(&arrayU16CompNo1[0], lengthEcmaStrU16CompNo1, ecmaVMPtr, true)); + thread_, EcmaString::CreateFromUtf16(&arrayU16CompNo1[0], lengthEcmaStrU16CompNo1, ecmaVMPtr, true)); JSHandle handleEcmaStrU16CompNo2( - thread, EcmaString::CreateFromUtf16(&arrayU16CompNo2[0], lengthEcmaStrU16CompNo2, ecmaVMPtr, true)); + thread_, EcmaString::CreateFromUtf16(&arrayU16CompNo2[0], lengthEcmaStrU16CompNo2, ecmaVMPtr, true)); JSHandle handleEcmaStrU16NotCompNo1( - thread, EcmaString::CreateFromUtf16(&arrayU16NotCompNo1[0], lengthEcmaStrU16NotCompNo1, ecmaVMPtr, false)); + thread_, EcmaString::CreateFromUtf16(&arrayU16NotCompNo1[0], lengthEcmaStrU16NotCompNo1, ecmaVMPtr, false)); JSHandle handleEcmaStrU16NotCompNo2( - thread, EcmaString::CreateFromUtf16(&arrayU16NotCompNo2[0], lengthEcmaStrU16NotCompNo2, ecmaVMPtr, false)); + thread_, EcmaString::CreateFromUtf16(&arrayU16NotCompNo2[0], lengthEcmaStrU16NotCompNo2, ecmaVMPtr, false)); JSHandle handleEcmaStrU16NotCompNo3( - thread, EcmaString::CreateFromUtf16(&arrayU16NotCompNo3[0], lengthEcmaStrU16NotCompNo3, ecmaVMPtr, false)); + thread_, EcmaString::CreateFromUtf16(&arrayU16NotCompNo3[0], lengthEcmaStrU16NotCompNo3, ecmaVMPtr, false)); EXPECT_EQ(handleEcmaStrU16CompNo1->Compare(*handleEcmaStrU16NotCompNo1), 0); EXPECT_EQ(handleEcmaStrU16NotCompNo1->Compare(*handleEcmaStrU16CompNo1), 0); EXPECT_EQ(handleEcmaStrU16CompNo1->Compare(*handleEcmaStrU16NotCompNo2), -1); @@ -511,7 +511,7 @@ TEST_F(EcmaStringTest, Compare_006) */ TEST_F(EcmaStringTest, Concat_001) { - EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); + EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); // Concat(). EcmaString made by CreateFromUtf8() and EcmaString made by CreateFromUtf8(). uint8_t arrayFrontU8[] = {"abcdef"}; @@ -519,11 +519,11 @@ TEST_F(EcmaStringTest, Concat_001) uint32_t lengthEcmaStrFrontU8 = sizeof(arrayFrontU8) - 1; uint32_t lengthEcmaStrBackU8 = sizeof(arrayBackU8) - 1; JSHandle handleEcmaStrFrontU8( - thread, EcmaString::CreateFromUtf8(&arrayFrontU8[0], lengthEcmaStrFrontU8, ecmaVMPtr, true)); + thread_, EcmaString::CreateFromUtf8(&arrayFrontU8[0], lengthEcmaStrFrontU8, ecmaVMPtr, true)); JSHandle handleEcmaStrBackU8( - thread, EcmaString::CreateFromUtf8(&arrayBackU8[0], lengthEcmaStrBackU8, ecmaVMPtr, true)); + thread_, EcmaString::CreateFromUtf8(&arrayBackU8[0], lengthEcmaStrBackU8, ecmaVMPtr, true)); JSHandle handleEcmaStrConcatU8( - thread, EcmaString::Concat(handleEcmaStrFrontU8, handleEcmaStrBackU8, ecmaVMPtr)); + thread_, EcmaString::Concat(handleEcmaStrFrontU8, handleEcmaStrBackU8, ecmaVMPtr)); EXPECT_TRUE(handleEcmaStrConcatU8->IsUtf8()); for (size_t i = 0; i < lengthEcmaStrFrontU8; i++) { EXPECT_EQ(handleEcmaStrConcatU8->At(i), arrayFrontU8[i]); @@ -543,7 +543,7 @@ TEST_F(EcmaStringTest, Concat_001) */ TEST_F(EcmaStringTest, Concat_002) { - EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); + EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); // Concat(). EcmaString made by CreateFromUtf16( , , , false) and EcmaString made by CreateFromUtf16( , , , false). uint16_t arrayFrontU16NotComp[] = {128, 129, 256, 11100, 65535, 100}; @@ -551,11 +551,11 @@ TEST_F(EcmaStringTest, Concat_002) uint32_t lengthEcmaStrFrontU16NotComp = sizeof(arrayFrontU16NotComp) / sizeof(arrayFrontU16NotComp[0]); uint32_t lengthEcmaStrBackU16NotComp = sizeof(arrayBackU16NotComp) / sizeof(arrayBackU16NotComp[0]); JSHandle handleEcmaStrFrontU16NotComp( - thread, EcmaString::CreateFromUtf16(&arrayFrontU16NotComp[0], lengthEcmaStrFrontU16NotComp, ecmaVMPtr, false)); + thread_, EcmaString::CreateFromUtf16(&arrayFrontU16NotComp[0], lengthEcmaStrFrontU16NotComp, ecmaVMPtr, false)); JSHandle handleEcmaStrBackU16NotComp( - thread, EcmaString::CreateFromUtf16(&arrayBackU16NotComp[0], lengthEcmaStrBackU16NotComp, ecmaVMPtr, false)); + thread_, EcmaString::CreateFromUtf16(&arrayBackU16NotComp[0], lengthEcmaStrBackU16NotComp, ecmaVMPtr, false)); JSHandle handleEcmaStrConcatU16NotComp( - thread, EcmaString::Concat(handleEcmaStrFrontU16NotComp, handleEcmaStrBackU16NotComp, ecmaVMPtr)); + thread_, EcmaString::Concat(handleEcmaStrFrontU16NotComp, handleEcmaStrBackU16NotComp, ecmaVMPtr)); EXPECT_TRUE(handleEcmaStrConcatU16NotComp->IsUtf16()); for (size_t i = 0; i < lengthEcmaStrFrontU16NotComp; i++) { EXPECT_EQ(handleEcmaStrConcatU16NotComp->At(i), arrayFrontU16NotComp[i]); @@ -575,7 +575,7 @@ TEST_F(EcmaStringTest, Concat_002) */ TEST_F(EcmaStringTest, Concat_003) { - EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); + EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); // Concat(). EcmaString made by CreateFromUtf8() and EcmaString made by CreateFromUtf16( , , , false). uint8_t arrayFrontU8[] = {"abcdef"}; @@ -583,11 +583,11 @@ TEST_F(EcmaStringTest, Concat_003) uint32_t lengthEcmaStrFrontU8 = sizeof(arrayFrontU8) - 1; uint32_t lengthEcmaStrBackU16NotComp = sizeof(arrayBackU16NotComp) / sizeof(arrayBackU16NotComp[0]); JSHandle handleEcmaStrFrontU8( - thread, EcmaString::CreateFromUtf8(&arrayFrontU8[0], lengthEcmaStrFrontU8, ecmaVMPtr, true)); + thread_, EcmaString::CreateFromUtf8(&arrayFrontU8[0], lengthEcmaStrFrontU8, ecmaVMPtr, true)); JSHandle handleEcmaStrBackU16NotComp( - thread, EcmaString::CreateFromUtf16(&arrayBackU16NotComp[0], lengthEcmaStrBackU16NotComp, ecmaVMPtr, false)); + thread_, EcmaString::CreateFromUtf16(&arrayBackU16NotComp[0], lengthEcmaStrBackU16NotComp, ecmaVMPtr, false)); JSHandle handleEcmaStrConcatU8U16NotComp( - thread, EcmaString::Concat(handleEcmaStrFrontU8, handleEcmaStrBackU16NotComp, ecmaVMPtr)); + thread_, EcmaString::Concat(handleEcmaStrFrontU8, handleEcmaStrBackU16NotComp, ecmaVMPtr)); EXPECT_TRUE(handleEcmaStrConcatU8U16NotComp->IsUtf16()); for (size_t i = 0; i < lengthEcmaStrFrontU8; i++) { EXPECT_EQ(handleEcmaStrConcatU8U16NotComp->At(i), arrayFrontU8[i]); @@ -608,7 +608,7 @@ TEST_F(EcmaStringTest, Concat_003) */ TEST_F(EcmaStringTest, Concat_004) { - EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); + EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); /* Concat() after SetCompressedStringsEnabled(false). EcmaString made by CreateFromUtf16( , , , false) and * EcmaString made by CreateFromUtf16( , , , false). @@ -619,11 +619,11 @@ TEST_F(EcmaStringTest, Concat_004) uint32_t lengthEcmaStrFrontU16NotComp = sizeof(arrayFrontU16NotComp) / sizeof(arrayFrontU16NotComp[0]); uint32_t lengthEcmaStrBackU16NotComp = sizeof(arrayBackU16NotComp) / sizeof(arrayBackU16NotComp[0]); JSHandle handleEcmaStrFrontU16NotComp( - thread, EcmaString::CreateFromUtf16(&arrayFrontU16NotComp[0], lengthEcmaStrFrontU16NotComp, ecmaVMPtr, false)); + thread_, EcmaString::CreateFromUtf16(&arrayFrontU16NotComp[0], lengthEcmaStrFrontU16NotComp, ecmaVMPtr, false)); JSHandle handleEcmaStrBackU16NotComp( - thread, EcmaString::CreateFromUtf16(&arrayBackU16NotComp[0], lengthEcmaStrBackU16NotComp, ecmaVMPtr, false)); + thread_, EcmaString::CreateFromUtf16(&arrayBackU16NotComp[0], lengthEcmaStrBackU16NotComp, ecmaVMPtr, false)); JSHandle handleEcmaStrConcatU16NotCompAfterSetFalse( - thread, EcmaString::Concat(handleEcmaStrFrontU16NotComp, handleEcmaStrBackU16NotComp, ecmaVMPtr)); + thread_, EcmaString::Concat(handleEcmaStrFrontU16NotComp, handleEcmaStrBackU16NotComp, ecmaVMPtr)); EXPECT_TRUE(handleEcmaStrConcatU16NotCompAfterSetFalse->IsUtf16()); for (size_t i = 0; i < lengthEcmaStrFrontU16NotComp; i++) { EXPECT_EQ(handleEcmaStrConcatU16NotCompAfterSetFalse->At(i), arrayFrontU16NotComp[i]); @@ -646,17 +646,17 @@ TEST_F(EcmaStringTest, Concat_004) */ TEST_F(EcmaStringTest, FastSubString_001) { - EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); + EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); // FastSubString(). From EcmaString made by CreateFromUtf8(). uint8_t arrayU8[6] = {3, 7, 19, 54, 99}; uint32_t lengthEcmaStrU8 = sizeof(arrayU8) - 1; - JSHandle handleEcmaStrU8(thread, + JSHandle handleEcmaStrU8(thread_, EcmaString::CreateFromUtf8(&arrayU8[0], lengthEcmaStrU8, ecmaVMPtr, true)); uint32_t indexStartSubU8 = 2; uint32_t lengthSubU8 = 2; JSHandle handleEcmaStrSubU8( - thread, EcmaString::FastSubString(handleEcmaStrU8, indexStartSubU8, lengthSubU8, ecmaVMPtr)); + thread_, EcmaString::FastSubString(handleEcmaStrU8, indexStartSubU8, lengthSubU8, ecmaVMPtr)); for (size_t i = 0; i < lengthSubU8; i++) { EXPECT_EQ(handleEcmaStrSubU8->At(i), handleEcmaStrU8->At(i + indexStartSubU8)); } @@ -672,17 +672,17 @@ TEST_F(EcmaStringTest, FastSubString_001) */ TEST_F(EcmaStringTest, FastSubString_002) { - EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); + EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); // FastSubString(). From EcmaString made by CreateFromUtf16( , , , true). uint16_t arrayU16Comp[] = {1, 12, 34, 56, 127}; uint32_t lengthEcmaStrU16Comp = sizeof(arrayU16Comp) / sizeof(arrayU16Comp[0]); JSHandle handleEcmaStrU16Comp( - thread, EcmaString::CreateFromUtf16(&arrayU16Comp[0], lengthEcmaStrU16Comp, ecmaVMPtr, true)); + thread_, EcmaString::CreateFromUtf16(&arrayU16Comp[0], lengthEcmaStrU16Comp, ecmaVMPtr, true)); uint32_t indexStartSubU16Comp = 0; uint32_t lengthSubU16Comp = 2; JSHandle handleEcmaStrSubU16Comp( - thread, EcmaString::FastSubString(handleEcmaStrU16Comp, indexStartSubU16Comp, lengthSubU16Comp, ecmaVMPtr)); + thread_, EcmaString::FastSubString(handleEcmaStrU16Comp, indexStartSubU16Comp, lengthSubU16Comp, ecmaVMPtr)); for (size_t i = 0; i < lengthSubU16Comp; i++) { EXPECT_EQ(handleEcmaStrSubU16Comp->At(i), handleEcmaStrU16Comp->At(i + indexStartSubU16Comp)); } @@ -698,17 +698,17 @@ TEST_F(EcmaStringTest, FastSubString_002) */ TEST_F(EcmaStringTest, FastSubString_003) { - EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); + EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); // FastSubString(). From EcmaString made by CreateFromUtf16( , , , false). uint16_t arrayU16NotComp[] = {19, 54, 256, 11100, 65535}; uint32_t lengthEcmaStrU16NotComp = sizeof(arrayU16NotComp) / sizeof(arrayU16NotComp[0]); JSHandle handleEcmaStrU16NotComp( - thread, EcmaString::CreateFromUtf16(&arrayU16NotComp[0], lengthEcmaStrU16NotComp, ecmaVMPtr, false)); + thread_, EcmaString::CreateFromUtf16(&arrayU16NotComp[0], lengthEcmaStrU16NotComp, ecmaVMPtr, false)); uint32_t indexStartSubU16NotComp = 0; uint32_t lengthSubU16NotComp = 2; JSHandle handleEcmaStrSubU16NotComp( - thread, + thread_, EcmaString::FastSubString(handleEcmaStrU16NotComp, indexStartSubU16NotComp, lengthSubU16NotComp, ecmaVMPtr)); for (size_t i = 0; i < lengthSubU16NotComp; i++) { EXPECT_EQ(handleEcmaStrSubU16NotComp->At(i), handleEcmaStrU16NotComp->At(i + indexStartSubU16NotComp)); @@ -725,16 +725,16 @@ TEST_F(EcmaStringTest, FastSubString_003) */ TEST_F(EcmaStringTest, WriteData_001) { - EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); + EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); // WriteData(). From EcmaString made by CreateFromUtf8() to EcmaString made by AllocStringObject( , true, ). uint8_t arrayU8WriteFrom[6] = {1, 12, 34, 56, 127}; uint32_t lengthEcmaStrU8WriteFrom = sizeof(arrayU8WriteFrom) - 1; JSHandle handleEcmaStrU8WriteFrom( - thread, EcmaString::CreateFromUtf8(&arrayU8WriteFrom[0], lengthEcmaStrU8WriteFrom, ecmaVMPtr, true)); + thread_, EcmaString::CreateFromUtf8(&arrayU8WriteFrom[0], lengthEcmaStrU8WriteFrom, ecmaVMPtr, true)); size_t sizeEcmaStrU8WriteTo = 5; JSHandle handleEcmaStrAllocTrueWriteTo( - thread, EcmaString::AllocStringObject(sizeEcmaStrU8WriteTo, true, ecmaVMPtr)); + thread_, EcmaString::AllocStringObject(sizeEcmaStrU8WriteTo, true, ecmaVMPtr)); uint32_t indexStartWriteFromArrayU8 = 2; uint32_t lengthWriteFromArrayU8 = 2; handleEcmaStrAllocTrueWriteTo->WriteData(*handleEcmaStrU8WriteFrom, indexStartWriteFromArrayU8, @@ -753,13 +753,13 @@ TEST_F(EcmaStringTest, WriteData_001) */ TEST_F(EcmaStringTest, WriteData_002) { - EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); + EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); // WriteData(). From char to EcmaString made by AllocStringObject( , true, ). char u8Write = 'a'; size_t sizeEcmaStrU8WriteTo = 5; JSHandle handleEcmaStrAllocTrueWriteTo( - thread, EcmaString::AllocStringObject(sizeEcmaStrU8WriteTo, true, ecmaVMPtr)); + thread_, EcmaString::AllocStringObject(sizeEcmaStrU8WriteTo, true, ecmaVMPtr)); uint32_t indexAtWriteFromU8 = 4; handleEcmaStrAllocTrueWriteTo->WriteData(u8Write, indexAtWriteFromU8); EXPECT_EQ(handleEcmaStrAllocTrueWriteTo->At(indexAtWriteFromU8), u8Write); @@ -774,7 +774,7 @@ TEST_F(EcmaStringTest, WriteData_002) */ TEST_F(EcmaStringTest, WriteData_003) { - EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); + EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); /* WriteData(). From EcmaString made by CreateFromUtf16( , , , false) to EcmaStringU16 made by * AllocStringObject( , false, ). @@ -782,10 +782,10 @@ TEST_F(EcmaStringTest, WriteData_003) uint16_t arrayU16WriteFrom[10] = {67, 777, 1999, 1, 45, 66, 23456, 65535, 127, 333}; uint32_t lengthEcmaStrU16WriteFrom = sizeof(arrayU16WriteFrom) / sizeof(arrayU16WriteFrom[0]); JSHandle handleEcmaStrU16WriteFrom( - thread, EcmaString::CreateFromUtf16(&arrayU16WriteFrom[0], lengthEcmaStrU16WriteFrom, ecmaVMPtr, false)); + thread_, EcmaString::CreateFromUtf16(&arrayU16WriteFrom[0], lengthEcmaStrU16WriteFrom, ecmaVMPtr, false)); size_t sizeEcmaStrU16WriteTo = 10; JSHandle handleEcmaStrU16WriteTo( - thread, EcmaString::AllocStringObject(sizeEcmaStrU16WriteTo, false, ecmaVMPtr)); + thread_, EcmaString::AllocStringObject(sizeEcmaStrU16WriteTo, false, ecmaVMPtr)); uint32_t indexStartWriteFromArrayU16 = 3; uint32_t numBytesWriteFromArrayU16 = 2 * 3; handleEcmaStrU16WriteTo->WriteData(*handleEcmaStrU16WriteFrom, indexStartWriteFromArrayU16, sizeEcmaStrU16WriteTo, @@ -804,16 +804,16 @@ TEST_F(EcmaStringTest, WriteData_003) */ TEST_F(EcmaStringTest, WriteData_004) { - EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); + EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); // WriteData(). From EcmaString made by CreateFromUtf8() to EcmaString made by AllocStringObject( , false, ). uint8_t arrayU8WriteFrom[6] = {1, 12, 34, 56, 127}; uint32_t lengthEcmaStrU8WriteFrom = sizeof(arrayU8WriteFrom) - 1; JSHandle handleEcmaStrU8WriteFrom( - thread, EcmaString::CreateFromUtf8(&arrayU8WriteFrom[0], lengthEcmaStrU8WriteFrom, ecmaVMPtr, true)); + thread_, EcmaString::CreateFromUtf8(&arrayU8WriteFrom[0], lengthEcmaStrU8WriteFrom, ecmaVMPtr, true)); size_t sizeEcmaStrU16WriteTo = 10; JSHandle handleEcmaStrU16WriteTo( - thread, EcmaString::AllocStringObject(sizeEcmaStrU16WriteTo, false, ecmaVMPtr)); + thread_, EcmaString::AllocStringObject(sizeEcmaStrU16WriteTo, false, ecmaVMPtr)); uint32_t indexStartWriteFromU8ToU16 = 1; uint32_t numBytesWriteFromU8ToU16 = 4; handleEcmaStrU16WriteTo->WriteData(*handleEcmaStrU8WriteFrom, indexStartWriteFromU8ToU16, sizeEcmaStrU16WriteTo, @@ -832,12 +832,12 @@ TEST_F(EcmaStringTest, WriteData_004) */ TEST_F(EcmaStringTest, WriteData_005) { - EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); + EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); // WriteData(). From char to EcmaString made by AllocStringObject( , false, ). size_t sizeEcmaStrU16WriteTo = 10; JSHandle handleEcmaStrU16WriteTo( - thread, EcmaString::AllocStringObject(sizeEcmaStrU16WriteTo, false, ecmaVMPtr)); + thread_, EcmaString::AllocStringObject(sizeEcmaStrU16WriteTo, false, ecmaVMPtr)); char u8Write = 'a'; uint32_t indexAt = 4; handleEcmaStrU16WriteTo->WriteData(u8Write, indexAt); @@ -852,19 +852,19 @@ TEST_F(EcmaStringTest, WriteData_005) */ TEST_F(EcmaStringTest, GetUtf8Length) { - EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); + EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); uint8_t arrayU8[6] = {3, 7, 19, 54, 99}; uint16_t arrayU16Comp[] = {1, 12, 34, 56, 127}; uint16_t arrayU16NotComp[] = {19, 54, 256, 11100, 65535}; uint32_t lengthEcmaStrU8 = sizeof(arrayU8) - 1; uint32_t lengthEcmaStrU16Comp = sizeof(arrayU16Comp) / sizeof(arrayU16Comp[0]); uint32_t lengthEcmaStrU16NotComp = sizeof(arrayU16NotComp) / sizeof(arrayU16NotComp[0]); - JSHandle handleEcmaStrU8(thread, + JSHandle handleEcmaStrU8(thread_, EcmaString::CreateFromUtf8(&arrayU8[0], lengthEcmaStrU8, ecmaVMPtr, true)); JSHandle handleEcmaStrU16Comp( - thread, EcmaString::CreateFromUtf16(&arrayU16Comp[0], lengthEcmaStrU16Comp, ecmaVMPtr, true)); + thread_, EcmaString::CreateFromUtf16(&arrayU16Comp[0], lengthEcmaStrU16Comp, ecmaVMPtr, true)); JSHandle handleEcmaStrU16NotComp( - thread, EcmaString::CreateFromUtf16(&arrayU16NotComp[0], lengthEcmaStrU16NotComp, ecmaVMPtr, false)); + thread_, EcmaString::CreateFromUtf16(&arrayU16NotComp[0], lengthEcmaStrU16NotComp, ecmaVMPtr, false)); EXPECT_EQ(handleEcmaStrU8->GetUtf8Length(), lengthEcmaStrU8 + 1); EXPECT_EQ(handleEcmaStrU16Comp->GetUtf8Length(), lengthEcmaStrU16Comp + 1); EXPECT_EQ(handleEcmaStrU16NotComp->GetUtf8Length(), 2 * lengthEcmaStrU16NotComp + 1); @@ -878,7 +878,7 @@ TEST_F(EcmaStringTest, GetUtf8Length) */ TEST_F(EcmaStringTest, GetUtf16Length) { - EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); + EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); uint8_t arrayU8[6] = {3, 7, 19, 54, 99}; uint16_t arrayU16Comp[] = {1, 12, 34, 56, 127}; @@ -886,12 +886,12 @@ TEST_F(EcmaStringTest, GetUtf16Length) uint32_t lengthEcmaStrU8 = sizeof(arrayU8) - 1; uint32_t lengthEcmaStrU16Comp = sizeof(arrayU16Comp) / sizeof(arrayU16Comp[0]); uint32_t lengthEcmaStrU16NotComp = sizeof(arrayU16NotComp) / sizeof(arrayU16NotComp[0]); - JSHandle handleEcmaStrU8(thread, + JSHandle handleEcmaStrU8(thread_, EcmaString::CreateFromUtf8(&arrayU8[0], lengthEcmaStrU8, ecmaVMPtr, true)); JSHandle handleEcmaStrU16Comp( - thread, EcmaString::CreateFromUtf16(&arrayU16Comp[0], lengthEcmaStrU16Comp, ecmaVMPtr, true)); + thread_, EcmaString::CreateFromUtf16(&arrayU16Comp[0], lengthEcmaStrU16Comp, ecmaVMPtr, true)); JSHandle handleEcmaStrU16NotComp( - thread, EcmaString::CreateFromUtf16(&arrayU16NotComp[0], lengthEcmaStrU16NotComp, ecmaVMPtr, false)); + thread_, EcmaString::CreateFromUtf16(&arrayU16NotComp[0], lengthEcmaStrU16NotComp, ecmaVMPtr, false)); EXPECT_EQ(handleEcmaStrU8->GetUtf16Length(), lengthEcmaStrU8); EXPECT_EQ(handleEcmaStrU16Comp->GetUtf16Length(), lengthEcmaStrU16Comp); EXPECT_EQ(handleEcmaStrU16NotComp->GetUtf16Length(), lengthEcmaStrU16NotComp); @@ -905,12 +905,12 @@ TEST_F(EcmaStringTest, GetUtf16Length) */ TEST_F(EcmaStringTest, GetDataUtf8) { - EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); + EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); // From EcmaString made by CreateFromUtf8(). uint8_t arrayU8[] = {"abcde"}; uint32_t lengthEcmaStrU8 = sizeof(arrayU8) - 1; - JSHandle handleEcmaStrU8(thread, + JSHandle handleEcmaStrU8(thread_, EcmaString::CreateFromUtf8(&arrayU8[0], lengthEcmaStrU8, ecmaVMPtr, true)); for (size_t i = 0; i < lengthEcmaStrU8; i++) { EXPECT_EQ(*(handleEcmaStrU8->GetDataUtf8() + i), arrayU8[i]); @@ -920,7 +920,7 @@ TEST_F(EcmaStringTest, GetDataUtf8) uint16_t arrayU16Comp[] = {3, 1, 34, 123, 127, 111, 42, 3, 20, 10}; uint32_t lengthEcmaStrU16Comp = sizeof(arrayU16Comp) / sizeof(arrayU16Comp[0]); JSHandle handleEcmaStrU16Comp( - thread, EcmaString::CreateFromUtf16(&arrayU16Comp[0], lengthEcmaStrU16Comp, ecmaVMPtr, true)); + thread_, EcmaString::CreateFromUtf16(&arrayU16Comp[0], lengthEcmaStrU16Comp, ecmaVMPtr, true)); for (size_t i = 0; i < sizeof(arrayU16Comp) / arrayU16Comp[0]; i++) { EXPECT_EQ(*(handleEcmaStrU16Comp->GetDataUtf8() + i), arrayU16Comp[i]); } @@ -934,13 +934,13 @@ TEST_F(EcmaStringTest, GetDataUtf8) */ TEST_F(EcmaStringTest, GetDataUtf16) { - EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); + EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); // From EcmaString made by CreateFromUtf16( , , , false). uint16_t arrayU16NotComp[] = {67, 777, 1999, 1, 45, 66, 23456, 65535, 127, 333}; uint32_t lengthEcmaStrU16NotComp = sizeof(arrayU16NotComp) / sizeof(arrayU16NotComp[0]); JSHandle handleEcmaStrU16NotComp( - thread, EcmaString::CreateFromUtf16(&arrayU16NotComp[0], lengthEcmaStrU16NotComp, ecmaVMPtr, false)); + thread_, EcmaString::CreateFromUtf16(&arrayU16NotComp[0], lengthEcmaStrU16NotComp, ecmaVMPtr, false)); for (size_t i = 0; i < lengthEcmaStrU16NotComp; i++) { EXPECT_EQ(*(handleEcmaStrU16NotComp->GetDataUtf16() + i), arrayU16NotComp[i]); } @@ -955,13 +955,13 @@ TEST_F(EcmaStringTest, GetDataUtf16) */ TEST_F(EcmaStringTest, CopyDataRegionUtf8) { - EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); + EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); // CopyDataRegionUtf8(). From EcmaString made by CreateFromUtf8(). uint8_t arrayU8CopyFrom[6] = {1, 12, 34, 56, 127}; uint32_t lengthEcmaStrU8CopyFrom = sizeof(arrayU8CopyFrom) - 1; JSHandle handleEcmaStrU8CopyFrom( - thread, EcmaString::CreateFromUtf8(&arrayU8CopyFrom[0], lengthEcmaStrU8CopyFrom, ecmaVMPtr, true)); + thread_, EcmaString::CreateFromUtf8(&arrayU8CopyFrom[0], lengthEcmaStrU8CopyFrom, ecmaVMPtr, true)); const size_t lengthArrayU8Target = 7; uint8_t defaultByteForU8CopyTo = 1; uint8_t arrayU8CopyTo[lengthArrayU8Target]; @@ -984,7 +984,7 @@ TEST_F(EcmaStringTest, CopyDataRegionUtf8) uint16_t arrayU16CompCopyFrom[] = {1, 12, 34, 56, 127}; uint32_t lengthEcmaStrU16CompCopyFrom = sizeof(arrayU16CompCopyFrom) / sizeof(arrayU16CompCopyFrom[0]); JSHandle handleEcmaStrU16CompCopyFrom( - thread, EcmaString::CreateFromUtf16(&arrayU16CompCopyFrom[0], lengthEcmaStrU16CompCopyFrom, ecmaVMPtr, true)); + thread_, EcmaString::CreateFromUtf16(&arrayU16CompCopyFrom[0], lengthEcmaStrU16CompCopyFrom, ecmaVMPtr, true)); const size_t lengthArrayU16Target = 8; uint8_t defaultByteForU16CompCopyTo = 1; uint8_t arrayU16CompCopyTo[lengthArrayU16Target]; @@ -1013,13 +1013,13 @@ TEST_F(EcmaStringTest, CopyDataRegionUtf8) */ TEST_F(EcmaStringTest, CopyDataUtf8) { - EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); + EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); // CopyDataUtf8(). From EcmaString made by CreateFromUtf8(). uint8_t arrayU8CopyFrom[6] = {1, 12, 34, 56, 127}; uint32_t lengthEcmaStrU8CopyFrom = sizeof(arrayU8CopyFrom) - 1; JSHandle handleEcmaStrU8CopyFrom( - thread, EcmaString::CreateFromUtf8(&arrayU8CopyFrom[0], lengthEcmaStrU8CopyFrom, ecmaVMPtr, true)); + thread_, EcmaString::CreateFromUtf8(&arrayU8CopyFrom[0], lengthEcmaStrU8CopyFrom, ecmaVMPtr, true)); const size_t lengthArrayU8Target = 6; uint8_t arrayU8CopyTo[lengthArrayU8Target]; @@ -1035,7 +1035,7 @@ TEST_F(EcmaStringTest, CopyDataUtf8) uint16_t arrayU16CompCopyFrom[] = {1, 12, 34, 56, 127}; uint32_t lengthEcmaStrU16CompCopyFrom = sizeof(arrayU16CompCopyFrom) / sizeof(arrayU16CompCopyFrom[0]); JSHandle handleEcmaStrU16CompCopyFrom( - thread, EcmaString::CreateFromUtf16(&arrayU16CompCopyFrom[0], lengthEcmaStrU16CompCopyFrom, ecmaVMPtr, true)); + thread_, EcmaString::CreateFromUtf16(&arrayU16CompCopyFrom[0], lengthEcmaStrU16CompCopyFrom, ecmaVMPtr, true)); const size_t lengthArrayU16Target = 6; uint8_t arrayU8CompCopyTo[lengthArrayU16Target]; @@ -1058,13 +1058,13 @@ TEST_F(EcmaStringTest, CopyDataUtf8) */ TEST_F(EcmaStringTest, CopyDataRegionUtf16) { - EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); + EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); // CopyDataRegionUtf16(). From EcmaString made by CreateFromUtf16( , , , false). uint16_t arrayU16NotCompCopyFrom[10] = {67, 777, 1999, 1, 45, 66, 23456, 65535, 127, 333}; uint32_t lengthEcmaStrU16NotCompCopyFrom = sizeof(arrayU16NotCompCopyFrom) / sizeof(arrayU16NotCompCopyFrom[0]); JSHandle handleEcmaStrU16NotCompCopyFrom( - thread, + thread_, EcmaString::CreateFromUtf16(&arrayU16NotCompCopyFrom[0], lengthEcmaStrU16NotCompCopyFrom, ecmaVMPtr, false)); const size_t lengthArrayU16Target = 13; uint16_t arrayU16NotCompCopyTo[lengthArrayU16Target]; @@ -1095,13 +1095,13 @@ TEST_F(EcmaStringTest, CopyDataRegionUtf16) */ TEST_F(EcmaStringTest, CopyDataUtf16) { - EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); + EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); // CopyDataUtf16(). From EcmaString made by CreateFromUtf16( , , , false). uint16_t arrayU16NotCompCopyFrom[10] = {67, 777, 1999, 1, 45, 66, 23456, 65535, 127, 333}; uint32_t lengthEcmaStrU16NotCompCopyFrom = sizeof(arrayU16NotCompCopyFrom) / sizeof(arrayU16NotCompCopyFrom[0]); JSHandle handleEcmaStrU16NotCompCopyFrom( - thread, + thread_, EcmaString::CreateFromUtf16(&arrayU16NotCompCopyFrom[0], lengthEcmaStrU16NotCompCopyFrom, ecmaVMPtr, false)); const size_t lengthArrayU16Target = 13; uint16_t arrayU16NotCompCopyTo[lengthArrayU16Target]; @@ -1130,7 +1130,7 @@ TEST_F(EcmaStringTest, CopyDataUtf16) */ TEST_F(EcmaStringTest, IndexOf_001) { - EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); + EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); // IndexOf(). Find EcmaString made by CreateFromUtf8() From EcmaString made by CreateFromUtf8(). uint8_t arrayU8From[7] = {23, 25, 1, 3, 39, 80}; @@ -1138,9 +1138,9 @@ TEST_F(EcmaStringTest, IndexOf_001) uint32_t lengthEcmaStrU8From = sizeof(arrayU8From) - 1; uint32_t lengthEcmaStrU8Target = sizeof(arrayU8Target) - 1; JSHandle handleEcmaStr( - thread, EcmaString::CreateFromUtf8(&arrayU8From[0], lengthEcmaStrU8From, ecmaVMPtr, true)); + thread_, EcmaString::CreateFromUtf8(&arrayU8From[0], lengthEcmaStrU8From, ecmaVMPtr, true)); JSHandle handleEcmaStr1( - thread, EcmaString::CreateFromUtf8(&arrayU8Target[0], lengthEcmaStrU8Target, ecmaVMPtr, true)); + thread_, EcmaString::CreateFromUtf8(&arrayU8Target[0], lengthEcmaStrU8Target, ecmaVMPtr, true)); int32_t posStart = 0; EXPECT_EQ(handleEcmaStr->IndexOf(*handleEcmaStr1, posStart), 2); EXPECT_EQ(handleEcmaStr1->IndexOf(*handleEcmaStr, posStart), -1); @@ -1163,7 +1163,7 @@ TEST_F(EcmaStringTest, IndexOf_001) */ TEST_F(EcmaStringTest, IndexOf_002) { - EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); + EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); // IndexOf(). Find EcmaString made by CreateFromUtf8() From EcmaString made by CreateFromUtf16( , , , false). uint8_t arrayU8Target[4] = {1, 3, 39}; @@ -1171,9 +1171,9 @@ TEST_F(EcmaStringTest, IndexOf_002) uint32_t lengthEcmaStrU8Target = sizeof(arrayU8Target) - 1; uint32_t lengthEcmaStrU16NotCompFromNo1 = sizeof(arrayU16NotCompFromNo1) / sizeof(arrayU16NotCompFromNo1[0]); JSHandle handleEcmaStr( - thread, EcmaString::CreateFromUtf8(&arrayU8Target[0], lengthEcmaStrU8Target, ecmaVMPtr, true)); + thread_, EcmaString::CreateFromUtf8(&arrayU8Target[0], lengthEcmaStrU8Target, ecmaVMPtr, true)); JSHandle handleEcmaStr1( - thread, + thread_, EcmaString::CreateFromUtf16(&arrayU16NotCompFromNo1[0], lengthEcmaStrU16NotCompFromNo1, ecmaVMPtr, false)); int32_t posStart = 0; EXPECT_EQ(handleEcmaStr1->IndexOf(*handleEcmaStr, posStart), 6); @@ -1197,7 +1197,7 @@ TEST_F(EcmaStringTest, IndexOf_002) */ TEST_F(EcmaStringTest, IndexOf_003) { - EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); + EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); /* IndexOf(). Find EcmaString made by CreateFromUtf16( , , , false) From EcmaString made by * CreateFromUtf16( , , , false). @@ -1207,10 +1207,10 @@ TEST_F(EcmaStringTest, IndexOf_003) uint32_t lengthEcmaStrU16NotCompTarget = sizeof(arrayU16NotCompTarget) / sizeof(arrayU16NotCompTarget[0]); uint32_t lengthEcmaStrU16NotCompFrom = sizeof(arrayU16NotCompFrom) / sizeof(arrayU16NotCompFrom[0]); JSHandle handleEcmaStrU16NotCompTarget( - thread, + thread_, EcmaString::CreateFromUtf16(&arrayU16NotCompTarget[0], lengthEcmaStrU16NotCompTarget, ecmaVMPtr, false)); JSHandle handleEcmaStrU16NotCompFrom( - thread, EcmaString::CreateFromUtf16(&arrayU16NotCompFrom[0], lengthEcmaStrU16NotCompFrom, ecmaVMPtr, false)); + thread_, EcmaString::CreateFromUtf16(&arrayU16NotCompFrom[0], lengthEcmaStrU16NotCompFrom, ecmaVMPtr, false)); int32_t posStart = 0; EXPECT_EQ(handleEcmaStrU16NotCompFrom->IndexOf(*handleEcmaStrU16NotCompTarget, posStart), 4); EXPECT_EQ(handleEcmaStrU16NotCompTarget->IndexOf(*handleEcmaStrU16NotCompFrom, posStart), -1); @@ -1233,7 +1233,7 @@ TEST_F(EcmaStringTest, IndexOf_003) */ TEST_F(EcmaStringTest, IndexOf_004) { - EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); + EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); // IndexOf(). Find EcmaString made by CreateFromUtf16( , , , false) From EcmaString made by CreateFromUtf8(). uint16_t ecmaStrU16NotCompTarget[] = {3, 39, 80}; @@ -1241,10 +1241,10 @@ TEST_F(EcmaStringTest, IndexOf_004) uint32_t lengthEcmaStrU16NotCompTarget = sizeof(ecmaStrU16NotCompTarget) / sizeof(ecmaStrU16NotCompTarget[0]); uint32_t lengthEcmaStrU8From = sizeof(arrayU8From) - 1; JSHandle handleEcmaStrU16NotCompTarget( - thread, + thread_, EcmaString::CreateFromUtf16(&ecmaStrU16NotCompTarget[0], lengthEcmaStrU16NotCompTarget, ecmaVMPtr, false)); JSHandle handleEcmaStrU8From( - thread, EcmaString::CreateFromUtf8(&arrayU8From[0], lengthEcmaStrU8From, ecmaVMPtr, true)); + thread_, EcmaString::CreateFromUtf8(&arrayU8From[0], lengthEcmaStrU8From, ecmaVMPtr, true)); int32_t posStart = 0; EXPECT_EQ(handleEcmaStrU8From->IndexOf(*handleEcmaStrU16NotCompTarget, posStart), 3); EXPECT_EQ(handleEcmaStrU16NotCompTarget->IndexOf(*handleEcmaStrU8From, posStart), -1); @@ -1267,7 +1267,7 @@ TEST_F(EcmaStringTest, IndexOf_004) */ TEST_F(EcmaStringTest, StringsAreEqual_001) { - EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); + EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); // StringsAreEqual(). uint8_t arrayU8No1[4] = {45, 92, 78}; @@ -1277,11 +1277,11 @@ TEST_F(EcmaStringTest, StringsAreEqual_001) uint32_t lengthEcmaStrU8No2 = sizeof(arrayU8No2) - 1; uint32_t lengthEcmaStrU8No3 = sizeof(arrayU8No3) - 1; JSHandle handleEcmaStrU8No1( - thread, EcmaString::CreateFromUtf8(&arrayU8No1[0], lengthEcmaStrU8No1, ecmaVMPtr, true)); + thread_, EcmaString::CreateFromUtf8(&arrayU8No1[0], lengthEcmaStrU8No1, ecmaVMPtr, true)); JSHandle handleEcmaStrU8No2( - thread, EcmaString::CreateFromUtf8(&arrayU8No2[0], lengthEcmaStrU8No2, ecmaVMPtr, true)); + thread_, EcmaString::CreateFromUtf8(&arrayU8No2[0], lengthEcmaStrU8No2, ecmaVMPtr, true)); JSHandle handleEcmaStrU8No3( - thread, EcmaString::CreateFromUtf8(&arrayU8No3[0], lengthEcmaStrU8No3, ecmaVMPtr, true)); + thread_, EcmaString::CreateFromUtf8(&arrayU8No3[0], lengthEcmaStrU8No3, ecmaVMPtr, true)); EXPECT_TRUE(EcmaString::StringsAreEqual(*handleEcmaStrU8No1, *handleEcmaStrU8No2)); EXPECT_FALSE(EcmaString::StringsAreEqual(*handleEcmaStrU8No1, *handleEcmaStrU8No3)); EXPECT_FALSE(EcmaString::StringsAreEqual(*handleEcmaStrU8No3, *handleEcmaStrU8No1)); @@ -1296,7 +1296,7 @@ TEST_F(EcmaStringTest, StringsAreEqual_001) */ TEST_F(EcmaStringTest, StringsAreEqual_002) { - EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); + EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); // StringsAreEqual(). uint8_t arrayU8No1[4] = {45, 92, 78}; @@ -1306,11 +1306,11 @@ TEST_F(EcmaStringTest, StringsAreEqual_002) uint32_t lengthEcmaStrU16CompNo2 = sizeof(arrayU16CompNo2) / sizeof(arrayU16CompNo2[0]); uint32_t lengthEcmaStrU16CompNo3 = sizeof(arrayU16CompNo3) / sizeof(arrayU16CompNo3[0]); JSHandle handleEcmaStrU8No1( - thread, EcmaString::CreateFromUtf8(&arrayU8No1[0], lengthEcmaStrU8No1, ecmaVMPtr, true)); + thread_, EcmaString::CreateFromUtf8(&arrayU8No1[0], lengthEcmaStrU8No1, ecmaVMPtr, true)); JSHandle handleEcmaStrU16CompNo2( - thread, EcmaString::CreateFromUtf16(&arrayU16CompNo2[0], lengthEcmaStrU16CompNo2, ecmaVMPtr, true)); + thread_, EcmaString::CreateFromUtf16(&arrayU16CompNo2[0], lengthEcmaStrU16CompNo2, ecmaVMPtr, true)); JSHandle handleEcmaStrU16CompNo3( - thread, EcmaString::CreateFromUtf16(&arrayU16CompNo3[0], lengthEcmaStrU16CompNo3, ecmaVMPtr, true)); + thread_, EcmaString::CreateFromUtf16(&arrayU16CompNo3[0], lengthEcmaStrU16CompNo3, ecmaVMPtr, true)); EXPECT_TRUE(EcmaString::StringsAreEqual(*handleEcmaStrU8No1, *handleEcmaStrU16CompNo2)); EXPECT_FALSE(EcmaString::StringsAreEqual(*handleEcmaStrU8No1, *handleEcmaStrU16CompNo3)); } @@ -1324,7 +1324,7 @@ TEST_F(EcmaStringTest, StringsAreEqual_002) */ TEST_F(EcmaStringTest, StringsAreEqual_003) { - EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); + EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); // StringsAreEqual(). uint16_t arrayU16CompNo1[] = {45, 92, 78}; @@ -1334,11 +1334,11 @@ TEST_F(EcmaStringTest, StringsAreEqual_003) uint32_t lengthEcmaStrU16CompNo2 = sizeof(arrayU16CompNo2) / sizeof(arrayU16CompNo2[0]); uint32_t lengthEcmaStrU16CompNo3 = sizeof(arrayU16CompNo3) / sizeof(arrayU16CompNo3[0]); JSHandle handleEcmaStrU16CompNo1( - thread, EcmaString::CreateFromUtf16(&arrayU16CompNo1[0], lengthEcmaStrU16CompNo1, ecmaVMPtr, true)); + thread_, EcmaString::CreateFromUtf16(&arrayU16CompNo1[0], lengthEcmaStrU16CompNo1, ecmaVMPtr, true)); JSHandle handleEcmaStrU16CompNo2( - thread, EcmaString::CreateFromUtf16(&arrayU16CompNo2[0], lengthEcmaStrU16CompNo2, ecmaVMPtr, true)); + thread_, EcmaString::CreateFromUtf16(&arrayU16CompNo2[0], lengthEcmaStrU16CompNo2, ecmaVMPtr, true)); JSHandle handleEcmaStrU16CompNo3( - thread, EcmaString::CreateFromUtf16(&arrayU16CompNo3[0], lengthEcmaStrU16CompNo3, ecmaVMPtr, true)); + thread_, EcmaString::CreateFromUtf16(&arrayU16CompNo3[0], lengthEcmaStrU16CompNo3, ecmaVMPtr, true)); EXPECT_TRUE(EcmaString::StringsAreEqual(*handleEcmaStrU16CompNo1, *handleEcmaStrU16CompNo2)); EXPECT_FALSE(EcmaString::StringsAreEqual(*handleEcmaStrU16CompNo1, *handleEcmaStrU16CompNo3)); EXPECT_FALSE(EcmaString::StringsAreEqual(*handleEcmaStrU16CompNo3, *handleEcmaStrU16CompNo1)); @@ -1353,7 +1353,7 @@ TEST_F(EcmaStringTest, StringsAreEqual_003) */ TEST_F(EcmaStringTest, StringsAreEqual_004) { - EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); + EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); // StringsAreEqual(). uint8_t arrayU8No1[4] = {45, 92, 78}; @@ -1361,9 +1361,9 @@ TEST_F(EcmaStringTest, StringsAreEqual_004) uint32_t lengthEcmaStrU8No1 = sizeof(arrayU8No1) - 1; uint32_t lengthEcmaStrU16NotCompNo1 = sizeof(arrayU16NotCompNo1) / sizeof(arrayU16NotCompNo1[0]); JSHandle handleEcmaStrU8No1( - thread, EcmaString::CreateFromUtf8(&arrayU8No1[0], lengthEcmaStrU8No1, ecmaVMPtr, true)); + thread_, EcmaString::CreateFromUtf8(&arrayU8No1[0], lengthEcmaStrU8No1, ecmaVMPtr, true)); JSHandle handleEcmaStrU16NotCompNo1( - thread, EcmaString::CreateFromUtf16(&arrayU16NotCompNo1[0], lengthEcmaStrU16NotCompNo1, ecmaVMPtr, false)); + thread_, EcmaString::CreateFromUtf16(&arrayU16NotCompNo1[0], lengthEcmaStrU16NotCompNo1, ecmaVMPtr, false)); EXPECT_FALSE(EcmaString::StringsAreEqual(*handleEcmaStrU8No1, *handleEcmaStrU16NotCompNo1)); EXPECT_FALSE(EcmaString::StringsAreEqual(*handleEcmaStrU16NotCompNo1, *handleEcmaStrU8No1)); } @@ -1377,7 +1377,7 @@ TEST_F(EcmaStringTest, StringsAreEqual_004) */ TEST_F(EcmaStringTest, StringsAreEqual_005) { - EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); + EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); // StringsAreEqual(). uint16_t arrayU16CompNo1[] = {45, 92, 78}; @@ -1385,9 +1385,9 @@ TEST_F(EcmaStringTest, StringsAreEqual_005) uint32_t lengthEcmaStrU16CompNo1 = sizeof(arrayU16CompNo1) / sizeof(arrayU16CompNo1[0]); uint32_t lengthEcmaStrU16NotCompNo1 = sizeof(arrayU16NotCompNo1) / sizeof(arrayU16NotCompNo1[0]); JSHandle handleEcmaStrU16CompNo1( - thread, EcmaString::CreateFromUtf16(&arrayU16CompNo1[0], lengthEcmaStrU16CompNo1, ecmaVMPtr, true)); + thread_, EcmaString::CreateFromUtf16(&arrayU16CompNo1[0], lengthEcmaStrU16CompNo1, ecmaVMPtr, true)); JSHandle handleEcmaStrU16NotCompNo1( - thread, EcmaString::CreateFromUtf16(&arrayU16NotCompNo1[0], lengthEcmaStrU16NotCompNo1, ecmaVMPtr, false)); + thread_, EcmaString::CreateFromUtf16(&arrayU16NotCompNo1[0], lengthEcmaStrU16NotCompNo1, ecmaVMPtr, false)); EXPECT_FALSE(EcmaString::StringsAreEqual(*handleEcmaStrU16CompNo1, *handleEcmaStrU16NotCompNo1)); EXPECT_FALSE(EcmaString::StringsAreEqual(*handleEcmaStrU16NotCompNo1, *handleEcmaStrU16CompNo1)); } @@ -1401,7 +1401,7 @@ TEST_F(EcmaStringTest, StringsAreEqual_005) */ TEST_F(EcmaStringTest, StringsAreEqual_006) { - EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); + EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); // StringsAreEqual(). uint16_t arrayU16NotCompNo1[] = {234, 345, 127, 2345, 65535, 5}; @@ -1411,11 +1411,11 @@ TEST_F(EcmaStringTest, StringsAreEqual_006) uint32_t lengthEcmaStrU16NotCompNo2 = sizeof(arrayU16NotCompNo2) / sizeof(arrayU16NotCompNo2[0]); uint32_t lengthEcmaStrU16NotCompNo3 = sizeof(arrayU16NotCompNo3) / sizeof(arrayU16NotCompNo3[0]); JSHandle handleEcmaStrU16NotCompNo1( - thread, EcmaString::CreateFromUtf16(&arrayU16NotCompNo1[0], lengthEcmaStrU16NotCompNo1, ecmaVMPtr, false)); + thread_, EcmaString::CreateFromUtf16(&arrayU16NotCompNo1[0], lengthEcmaStrU16NotCompNo1, ecmaVMPtr, false)); JSHandle handleEcmaStrU16NotCompNo2( - thread, EcmaString::CreateFromUtf16(&arrayU16NotCompNo2[0], lengthEcmaStrU16NotCompNo2, ecmaVMPtr, false)); + thread_, EcmaString::CreateFromUtf16(&arrayU16NotCompNo2[0], lengthEcmaStrU16NotCompNo2, ecmaVMPtr, false)); JSHandle handleEcmaStrU16NotCompNo3( - thread, EcmaString::CreateFromUtf16(&arrayU16NotCompNo3[0], lengthEcmaStrU16NotCompNo3, ecmaVMPtr, false)); + thread_, EcmaString::CreateFromUtf16(&arrayU16NotCompNo3[0], lengthEcmaStrU16NotCompNo3, ecmaVMPtr, false)); EXPECT_TRUE(EcmaString::StringsAreEqual(*handleEcmaStrU16NotCompNo1, *handleEcmaStrU16NotCompNo2)); EXPECT_FALSE(EcmaString::StringsAreEqual(*handleEcmaStrU16NotCompNo1, *handleEcmaStrU16NotCompNo3)); EXPECT_FALSE(EcmaString::StringsAreEqual(*handleEcmaStrU16NotCompNo3, *handleEcmaStrU16NotCompNo1)); @@ -1430,7 +1430,7 @@ TEST_F(EcmaStringTest, StringsAreEqual_006) */ TEST_F(EcmaStringTest, StringsAreEqualUtf8_001) { - EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); + EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); // StringsAreEqualUtf8(). EcmaString made by CreateFromUtf8(), Array:U8. uint8_t arrayU8No1[4] = {45, 92, 78}; @@ -1440,11 +1440,11 @@ TEST_F(EcmaStringTest, StringsAreEqualUtf8_001) uint32_t lengthEcmaStrU8No2 = sizeof(arrayU8No2) - 1; uint32_t lengthEcmaStrU8No3 = sizeof(arrayU8No3) - 1; JSHandle handleEcmaStrU8No1( - thread, EcmaString::CreateFromUtf8(&arrayU8No1[0], lengthEcmaStrU8No1, ecmaVMPtr, true)); + thread_, EcmaString::CreateFromUtf8(&arrayU8No1[0], lengthEcmaStrU8No1, ecmaVMPtr, true)); JSHandle handleEcmaStrU8No2( - thread, EcmaString::CreateFromUtf8(&arrayU8No2[0], lengthEcmaStrU8No2, ecmaVMPtr, true)); + thread_, EcmaString::CreateFromUtf8(&arrayU8No2[0], lengthEcmaStrU8No2, ecmaVMPtr, true)); JSHandle handleEcmaStrU8No3( - thread, EcmaString::CreateFromUtf8(&arrayU8No3[0], lengthEcmaStrU8No3, ecmaVMPtr, true)); + thread_, EcmaString::CreateFromUtf8(&arrayU8No3[0], lengthEcmaStrU8No3, ecmaVMPtr, true)); EXPECT_TRUE(EcmaString::StringsAreEqualUtf8(*handleEcmaStrU8No1, &arrayU8No1[0], lengthEcmaStrU8No1, true)); EXPECT_FALSE(EcmaString::StringsAreEqualUtf8(*handleEcmaStrU8No1, &arrayU8No1[0], lengthEcmaStrU8No1, false)); EXPECT_FALSE(EcmaString::StringsAreEqualUtf8(*handleEcmaStrU8No2, &arrayU8No1[0], lengthEcmaStrU8No1, true)); @@ -1460,7 +1460,7 @@ TEST_F(EcmaStringTest, StringsAreEqualUtf8_001) */ TEST_F(EcmaStringTest, StringsAreEqualUtf8_002) { - EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); + EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); // StringsAreEqualUtf8(). EcmaString made by CreateFromUtf16( , , , true), Array:U8. uint8_t arrayU8No1[4] = {45, 92, 78}; @@ -1472,11 +1472,11 @@ TEST_F(EcmaStringTest, StringsAreEqualUtf8_002) uint32_t lengthEcmaStrU16CompNo2 = sizeof(arrayU16CompNo2) / sizeof(arrayU16CompNo2[0]); uint32_t lengthEcmaStrU16CompNo3 = sizeof(arrayU16CompNo3) / sizeof(arrayU16CompNo3[0]); JSHandle handleEcmaStrU16CompNo1( - thread, EcmaString::CreateFromUtf16(&arrayU16CompNo1[0], lengthEcmaStrU16CompNo1, ecmaVMPtr, true)); + thread_, EcmaString::CreateFromUtf16(&arrayU16CompNo1[0], lengthEcmaStrU16CompNo1, ecmaVMPtr, true)); JSHandle handleEcmaStrU16CompNo2( - thread, EcmaString::CreateFromUtf16(&arrayU16CompNo2[0], lengthEcmaStrU16CompNo2, ecmaVMPtr, true)); + thread_, EcmaString::CreateFromUtf16(&arrayU16CompNo2[0], lengthEcmaStrU16CompNo2, ecmaVMPtr, true)); JSHandle handleEcmaStrU16CompNo3( - thread, EcmaString::CreateFromUtf16(&arrayU16CompNo3[0], lengthEcmaStrU16CompNo3, ecmaVMPtr, true)); + thread_, EcmaString::CreateFromUtf16(&arrayU16CompNo3[0], lengthEcmaStrU16CompNo3, ecmaVMPtr, true)); EXPECT_TRUE(EcmaString::StringsAreEqualUtf8(*handleEcmaStrU16CompNo1, &arrayU8No1[0], lengthEcmaStrU8No1, true)); EXPECT_FALSE(EcmaString::StringsAreEqualUtf8(*handleEcmaStrU16CompNo1, &arrayU8No1[0], lengthEcmaStrU8No1, false)); EXPECT_FALSE(EcmaString::StringsAreEqualUtf8(*handleEcmaStrU16CompNo2, &arrayU8No1[0], lengthEcmaStrU8No1, true)); @@ -1492,7 +1492,7 @@ TEST_F(EcmaStringTest, StringsAreEqualUtf8_002) */ TEST_F(EcmaStringTest, StringsAreEqualUtf8_003) { - EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); + EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); // StringsAreEqualUtf8(). EcmaString made by CreateFromUtf16( , , , false), Array:U8. uint8_t arrayU8No1[4] = {45, 92, 78}; @@ -1506,13 +1506,13 @@ TEST_F(EcmaStringTest, StringsAreEqualUtf8_003) uint32_t lengthEcmaStrU16NotCompNo3 = sizeof(arrayU16NotCompNo3) / sizeof(arrayU16NotCompNo3[0]); uint32_t lengthEcmaStrU16NotCompNo4 = sizeof(arrayU16NotCompNo4) / sizeof(arrayU16NotCompNo4[0]); JSHandle handleEcmaStrU16NotCompNo1( - thread, EcmaString::CreateFromUtf16(&arrayU16NotCompNo1[0], lengthEcmaStrU16NotCompNo1, ecmaVMPtr, false)); + thread_, EcmaString::CreateFromUtf16(&arrayU16NotCompNo1[0], lengthEcmaStrU16NotCompNo1, ecmaVMPtr, false)); JSHandle handleEcmaStrU16NotCompNo2( - thread, EcmaString::CreateFromUtf16(&arrayU16NotCompNo2[0], lengthEcmaStrU16NotCompNo2, ecmaVMPtr, false)); + thread_, EcmaString::CreateFromUtf16(&arrayU16NotCompNo2[0], lengthEcmaStrU16NotCompNo2, ecmaVMPtr, false)); JSHandle handleEcmaStrU16NotCompNo3( - thread, EcmaString::CreateFromUtf16(&arrayU16NotCompNo3[0], lengthEcmaStrU16NotCompNo3, ecmaVMPtr, false)); + thread_, EcmaString::CreateFromUtf16(&arrayU16NotCompNo3[0], lengthEcmaStrU16NotCompNo3, ecmaVMPtr, false)); JSHandle handleEcmaStrU16NotCompNo4( - thread, EcmaString::CreateFromUtf16(&arrayU16NotCompNo4[0], lengthEcmaStrU16NotCompNo4, ecmaVMPtr, false)); + thread_, EcmaString::CreateFromUtf16(&arrayU16NotCompNo4[0], lengthEcmaStrU16NotCompNo4, ecmaVMPtr, false)); EXPECT_TRUE( EcmaString::StringsAreEqualUtf8(*handleEcmaStrU16NotCompNo1, &arrayU8No1[0], lengthEcmaStrU8No1, false)); EXPECT_FALSE( @@ -1534,7 +1534,7 @@ TEST_F(EcmaStringTest, StringsAreEqualUtf8_003) */ TEST_F(EcmaStringTest, StringsAreEqualUtf16_001) { - EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); + EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); // StringsAreEqualUtf16(). EcmaString made by CreateFromUtf8, Array:U16(1-127). uint8_t arrayU8No1[4] = {45, 92, 78}; @@ -1546,11 +1546,11 @@ TEST_F(EcmaStringTest, StringsAreEqualUtf16_001) uint32_t lengthEcmaStrU8No3 = sizeof(arrayU8No3) - 1; uint32_t lengthEcmaStrU16NotCompNo1 = sizeof(arrayU16NotCompNo1) / sizeof(arrayU16NotCompNo1[0]); JSHandle handleEcmaStrU8No1( - thread, EcmaString::CreateFromUtf8(&arrayU8No1[0], lengthEcmaStrU8No1, ecmaVMPtr, true)); + thread_, EcmaString::CreateFromUtf8(&arrayU8No1[0], lengthEcmaStrU8No1, ecmaVMPtr, true)); JSHandle handleEcmaStrU8No2( - thread, EcmaString::CreateFromUtf8(&arrayU8No2[0], lengthEcmaStrU8No2, ecmaVMPtr, true)); + thread_, EcmaString::CreateFromUtf8(&arrayU8No2[0], lengthEcmaStrU8No2, ecmaVMPtr, true)); JSHandle handleEcmaStrU8No3( - thread, EcmaString::CreateFromUtf8(&arrayU8No3[0], lengthEcmaStrU8No3, ecmaVMPtr, true)); + thread_, EcmaString::CreateFromUtf8(&arrayU8No3[0], lengthEcmaStrU8No3, ecmaVMPtr, true)); EXPECT_TRUE( EcmaString::StringsAreEqualUtf16(*handleEcmaStrU8No1, &arrayU16NotCompNo1[0], lengthEcmaStrU16NotCompNo1)); EXPECT_FALSE( @@ -1568,7 +1568,7 @@ TEST_F(EcmaStringTest, StringsAreEqualUtf16_001) */ TEST_F(EcmaStringTest, StringsAreEqualUtf16_002) { - EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); + EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); // StringsAreEqualUtf16(). EcmaString made by CreateFromUtf16( , , , true), Array:U16(1-127). uint16_t arrayU16CompNo1[] = {45, 92, 78}; @@ -1580,13 +1580,13 @@ TEST_F(EcmaStringTest, StringsAreEqualUtf16_002) uint32_t lengthEcmaStrU16CompNo3 = sizeof(arrayU16CompNo3) / sizeof(arrayU16CompNo3[0]); uint32_t lengthEcmaStrU16CompNo4 = sizeof(arrayU16CompNo4) / sizeof(arrayU16CompNo4[0]); JSHandle handleEcmaStrU16CompNo1( - thread, EcmaString::CreateFromUtf16(&arrayU16CompNo1[0], lengthEcmaStrU16CompNo1, ecmaVMPtr, true)); + thread_, EcmaString::CreateFromUtf16(&arrayU16CompNo1[0], lengthEcmaStrU16CompNo1, ecmaVMPtr, true)); JSHandle handleEcmaStrU16CompNo2( - thread, EcmaString::CreateFromUtf16(&arrayU16CompNo2[0], lengthEcmaStrU16CompNo2, ecmaVMPtr, true)); + thread_, EcmaString::CreateFromUtf16(&arrayU16CompNo2[0], lengthEcmaStrU16CompNo2, ecmaVMPtr, true)); JSHandle handleEcmaStrU16CompNo3( - thread, EcmaString::CreateFromUtf16(&arrayU16CompNo3[0], lengthEcmaStrU16CompNo3, ecmaVMPtr, true)); + thread_, EcmaString::CreateFromUtf16(&arrayU16CompNo3[0], lengthEcmaStrU16CompNo3, ecmaVMPtr, true)); JSHandle handleEcmaStrU16CompNo4( - thread, EcmaString::CreateFromUtf16(&arrayU16CompNo4[0], lengthEcmaStrU16CompNo4, ecmaVMPtr, true)); + thread_, EcmaString::CreateFromUtf16(&arrayU16CompNo4[0], lengthEcmaStrU16CompNo4, ecmaVMPtr, true)); EXPECT_TRUE( EcmaString::StringsAreEqualUtf16(*handleEcmaStrU16CompNo1, &arrayU16CompNo1[0], lengthEcmaStrU16CompNo1)); EXPECT_FALSE( @@ -1606,7 +1606,7 @@ TEST_F(EcmaStringTest, StringsAreEqualUtf16_002) */ TEST_F(EcmaStringTest, StringsAreEqualUtf16_003) { - EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); + EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); // StringsAreEqualUtf16(). EcmaString made by CreateFromUtf16( , , , false), Array:U16(0-65535). uint16_t arrayU16NotCompNo1[] = {25645, 25692, 25678}; @@ -1618,13 +1618,13 @@ TEST_F(EcmaStringTest, StringsAreEqualUtf16_003) uint32_t lengthEcmaStrU16NotCompNo3 = sizeof(arrayU16NotCompNo3) / sizeof(arrayU16NotCompNo3[0]); uint32_t lengthEcmaStrU16NotCompNo4 = sizeof(arrayU16NotCompNo4) / sizeof(arrayU16NotCompNo4[0]); JSHandle handleEcmaStrU16NotCompNo1( - thread, EcmaString::CreateFromUtf16(&arrayU16NotCompNo1[0], lengthEcmaStrU16NotCompNo1, ecmaVMPtr, false)); + thread_, EcmaString::CreateFromUtf16(&arrayU16NotCompNo1[0], lengthEcmaStrU16NotCompNo1, ecmaVMPtr, false)); JSHandle handleEcmaStrU16NotCompNo2( - thread, EcmaString::CreateFromUtf16(&arrayU16NotCompNo2[0], lengthEcmaStrU16NotCompNo2, ecmaVMPtr, false)); + thread_, EcmaString::CreateFromUtf16(&arrayU16NotCompNo2[0], lengthEcmaStrU16NotCompNo2, ecmaVMPtr, false)); JSHandle handleEcmaStrU16NotCompNo3( - thread, EcmaString::CreateFromUtf16(&arrayU16NotCompNo3[0], lengthEcmaStrU16NotCompNo3, ecmaVMPtr, false)); + thread_, EcmaString::CreateFromUtf16(&arrayU16NotCompNo3[0], lengthEcmaStrU16NotCompNo3, ecmaVMPtr, false)); JSHandle handleEcmaStrU16NotCompNo4( - thread, EcmaString::CreateFromUtf16(&arrayU16NotCompNo4[0], lengthEcmaStrU16NotCompNo4, ecmaVMPtr, false)); + thread_, EcmaString::CreateFromUtf16(&arrayU16NotCompNo4[0], lengthEcmaStrU16NotCompNo4, ecmaVMPtr, false)); EXPECT_TRUE(EcmaString::StringsAreEqualUtf16(*handleEcmaStrU16NotCompNo1, &arrayU16NotCompNo1[0], lengthEcmaStrU16NotCompNo1)); EXPECT_FALSE(EcmaString::StringsAreEqualUtf16(*handleEcmaStrU16NotCompNo1, &arrayU16NotCompNo2[0], @@ -1682,12 +1682,12 @@ TEST_F(EcmaStringTest, ComputeHashcodeUtf16) */ TEST_F(EcmaStringTest, GetHashcode_001) { - EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); + EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); // GetHashcode(). EcmaString made by CreateFromUtf8(). uint8_t arrayU8[] = {"abc"}; uint32_t lengthEcmaStrU8 = sizeof(arrayU8) - 1; - JSHandle handleEcmaStrU8(thread, + JSHandle handleEcmaStrU8(thread_, EcmaString::CreateFromUtf8(&arrayU8[0], lengthEcmaStrU8, ecmaVMPtr, true)); uint32_t hashExpect = 0; for (uint32_t i = 0; i < lengthEcmaStrU8; i++) { @@ -1705,13 +1705,13 @@ TEST_F(EcmaStringTest, GetHashcode_001) */ TEST_F(EcmaStringTest, GetHashcode_002) { - EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); + EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); // GetHashcode(). EcmaString made by CreateFromUtf16( , , , true). uint16_t arrayU16Comp[] = {45, 92, 78, 24}; uint32_t lengthEcmaStrU16Comp = sizeof(arrayU16Comp) / sizeof(arrayU16Comp[0]); JSHandle handleEcmaStrU16Comp( - thread, EcmaString::CreateFromUtf16(&arrayU16Comp[0], lengthEcmaStrU16Comp, ecmaVMPtr, true)); + thread_, EcmaString::CreateFromUtf16(&arrayU16Comp[0], lengthEcmaStrU16Comp, ecmaVMPtr, true)); uint32_t hashExpect = 0; for (uint32_t i = 0; i < lengthEcmaStrU16Comp; i++) { hashExpect = hashExpect * 31 + arrayU16Comp[i]; @@ -1729,13 +1729,13 @@ TEST_F(EcmaStringTest, GetHashcode_002) */ TEST_F(EcmaStringTest, GetHashcode_003) { - EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); + EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); // GetHashcode(). EcmaString made by CreateFromUtf16( , , , false). uint16_t arrayU16NotComp[] = {199, 1, 256, 65535, 777}; uint32_t lengthEcmaStrU16NotComp = sizeof(arrayU16NotComp) / sizeof(arrayU16NotComp[0]); JSHandle handleEcmaStrU16NotComp( - thread, EcmaString::CreateFromUtf16(&arrayU16NotComp[0], lengthEcmaStrU16NotComp, ecmaVMPtr, false)); + thread_, EcmaString::CreateFromUtf16(&arrayU16NotComp[0], lengthEcmaStrU16NotComp, ecmaVMPtr, false)); uint32_t hashExpect = 0; for (uint32_t i = 0; i < lengthEcmaStrU16NotComp; i++) { hashExpect = hashExpect * 31 + arrayU16NotComp[i]; @@ -1744,7 +1744,7 @@ TEST_F(EcmaStringTest, GetHashcode_003) EcmaString::SetCompressedStringsEnabled(false); // Set compressedStringsEnabled false. JSHandle handleEcmaStrU16NotCompDisableComp( - thread, EcmaString::CreateFromUtf16(&arrayU16NotComp[0], lengthEcmaStrU16NotComp, ecmaVMPtr, false)); + thread_, EcmaString::CreateFromUtf16(&arrayU16NotComp[0], lengthEcmaStrU16NotComp, ecmaVMPtr, false)); EXPECT_EQ(handleEcmaStrU16NotCompDisableComp->GetHashcode(), static_cast(hashExpect)); EcmaString::SetCompressedStringsEnabled(true); // Set compressedStringsEnabled true(default). } @@ -1758,14 +1758,14 @@ TEST_F(EcmaStringTest, GetHashcode_003) */ TEST_F(EcmaStringTest, GetHashcode_004) { - EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); + EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); // GetHashcode(). EcmaString made by CreateEmptyString(). - JSHandle handleEcmaStrEmpty(thread, EcmaString::CreateEmptyString(ecmaVMPtr)); + JSHandle handleEcmaStrEmpty(thread_, EcmaString::CreateEmptyString(ecmaVMPtr)); EXPECT_EQ(handleEcmaStrEmpty->GetHashcode(), 0); EcmaString::SetCompressedStringsEnabled(false); // Set compressedStringsEnabled false. - JSHandle handleEcmaStrEmptyDisableComp(thread, EcmaString::CreateEmptyString(ecmaVMPtr)); + JSHandle handleEcmaStrEmptyDisableComp(thread_, EcmaString::CreateEmptyString(ecmaVMPtr)); EXPECT_EQ(handleEcmaStrEmptyDisableComp->GetHashcode(), 0); EcmaString::SetCompressedStringsEnabled(true); // Set compressedStringsEnabled true(default). } @@ -1780,18 +1780,18 @@ TEST_F(EcmaStringTest, GetHashcode_004) */ TEST_F(EcmaStringTest, GetHashcode_005) { - EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); + EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); // GetHashcode(). EcmaString made by AllocStringObject(). size_t sizeAlloc = 5; - JSHandle handleEcmaStrAllocComp(thread, EcmaString::AllocStringObject(sizeAlloc, true, ecmaVMPtr)); - JSHandle handleEcmaStrAllocNotComp(thread, EcmaString::AllocStringObject(sizeAlloc, false, ecmaVMPtr)); + JSHandle handleEcmaStrAllocComp(thread_, EcmaString::AllocStringObject(sizeAlloc, true, ecmaVMPtr)); + JSHandle handleEcmaStrAllocNotComp(thread_, EcmaString::AllocStringObject(sizeAlloc, false, ecmaVMPtr)); EXPECT_EQ(handleEcmaStrAllocComp->GetHashcode(), 0); EXPECT_EQ(handleEcmaStrAllocNotComp->GetHashcode(), 0); EcmaString::SetCompressedStringsEnabled(false); // Set compressedStringsEnabled false. JSHandle handleEcmaStrAllocNotCompDisableComp( - thread, EcmaString::AllocStringObject(sizeAlloc, false, ecmaVMPtr)); + thread_, EcmaString::AllocStringObject(sizeAlloc, false, ecmaVMPtr)); EXPECT_EQ(handleEcmaStrAllocNotCompDisableComp->GetHashcode(), 0); EcmaString::SetCompressedStringsEnabled(true); // Set compressedStringsEnabled true(default). } @@ -1805,24 +1805,24 @@ TEST_F(EcmaStringTest, GetHashcode_005) */ TEST_F(EcmaStringTest, GetCString) { - EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); + EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); uint8_t arrayU8[] = {"abc"}; uint32_t lengthEcmaStrU8 = sizeof(arrayU8) - 1; - JSHandle handleEcmaStrU8(thread, + JSHandle handleEcmaStrU8(thread_, EcmaString::CreateFromUtf8(&arrayU8[0], lengthEcmaStrU8, ecmaVMPtr, true)); EXPECT_STREQ(CString(handleEcmaStrU8->GetCString().get()).c_str(), "abc"); uint16_t arrayU16Comp[] = {97, 98, 99}; uint32_t lengthEcmaStrU16Comp = sizeof(arrayU16Comp) / sizeof(arrayU16Comp[0]); JSHandle handleEcmaStrU16Comp( - thread, EcmaString::CreateFromUtf16(&arrayU16Comp[0], lengthEcmaStrU16Comp, ecmaVMPtr, true)); + thread_, EcmaString::CreateFromUtf16(&arrayU16Comp[0], lengthEcmaStrU16Comp, ecmaVMPtr, true)); EXPECT_STREQ(CString(handleEcmaStrU16Comp->GetCString().get()).c_str(), "abc"); uint16_t arrayU16NotComp[] = {97, 98, 99}; uint32_t lengthEcmaStrU16NotComp = sizeof(arrayU16NotComp) / sizeof(arrayU16NotComp[0]); JSHandle handleEcmaStrU16NotComp( - thread, EcmaString::CreateFromUtf16(&arrayU16NotComp[0], lengthEcmaStrU16NotComp, ecmaVMPtr, false)); + thread_, EcmaString::CreateFromUtf16(&arrayU16NotComp[0], lengthEcmaStrU16NotComp, ecmaVMPtr, false)); EXPECT_STREQ(CString(handleEcmaStrU16NotComp->GetCString().get()).c_str(), "abc"); } @@ -1835,11 +1835,11 @@ TEST_F(EcmaStringTest, GetCString) */ TEST_F(EcmaStringTest, SetIsInternString) { - EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance); + EcmaVM *ecmaVMPtr = EcmaVM::Cast(instance_); uint8_t arrayU8[] = {"abc"}; uint32_t lengthEcmaStrU8 = sizeof(arrayU8) - 1; - JSHandle handleEcmaStrU8(thread, + JSHandle handleEcmaStrU8(thread_, EcmaString::CreateFromUtf8(&arrayU8[0], lengthEcmaStrU8, ecmaVMPtr, true)); EXPECT_FALSE(handleEcmaStrU8->IsInternString()); handleEcmaStrU8->SetIsInternString(); @@ -1848,7 +1848,7 @@ TEST_F(EcmaStringTest, SetIsInternString) uint16_t arrayU16Comp[] = {97, 98, 99}; uint32_t lengthEcmaStrU16Comp = sizeof(arrayU16Comp) / sizeof(arrayU16Comp[0]); JSHandle handleEcmaStrU16Comp( - thread, EcmaString::CreateFromUtf16(&arrayU16Comp[0], lengthEcmaStrU16Comp, ecmaVMPtr, true)); + thread_, EcmaString::CreateFromUtf16(&arrayU16Comp[0], lengthEcmaStrU16Comp, ecmaVMPtr, true)); EXPECT_FALSE(handleEcmaStrU16Comp->IsInternString()); handleEcmaStrU16Comp->SetIsInternString(); EXPECT_TRUE(handleEcmaStrU16Comp->IsInternString()); @@ -1856,7 +1856,7 @@ TEST_F(EcmaStringTest, SetIsInternString) uint16_t arrayU16NotComp[] = {97, 98, 99}; uint32_t lengthEcmaStrU16NotComp = sizeof(arrayU16NotComp) / sizeof(arrayU16NotComp[0]); JSHandle handleEcmaStrU16NotComp( - thread, EcmaString::CreateFromUtf16(&arrayU16NotComp[0], lengthEcmaStrU16NotComp, ecmaVMPtr, false)); + thread_, EcmaString::CreateFromUtf16(&arrayU16NotComp[0], lengthEcmaStrU16NotComp, ecmaVMPtr, false)); EXPECT_FALSE(handleEcmaStrU16NotComp->IsInternString()); handleEcmaStrU16NotComp->SetIsInternString(); EXPECT_TRUE(handleEcmaStrU16NotComp->IsInternString()); diff --git a/tests/runtime/common/glue_regs_test.cpp b/tests/runtime/common/glue_regs_test.cpp index 364737fe5592395cc8152a6abb972a390b25531f..3db7b4e0434b0cd8707dfc10cc0481256fc61971 100644 --- a/tests/runtime/common/glue_regs_test.cpp +++ b/tests/runtime/common/glue_regs_test.cpp @@ -32,22 +32,22 @@ class GlueRegsTest : public testing::Test { public: void SetUp() override { - TestHelper::CreateEcmaVMWithScope(instance, thread, scope); + TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); } void TearDown() override { - TestHelper::DestroyEcmaVMWithScope(instance, scope); + TestHelper::DestroyEcmaVMWithScope(instance_, scope_); } - PandaVM *instance {nullptr}; - ecmascript::EcmaHandleScope *scope {nullptr}; - JSThread *thread; + PandaVM *instance_ {nullptr}; + ecmascript::EcmaHandleScope *scope_ {nullptr}; + JSThread *thread_; }; TEST_F(GlueRegsTest, ConstantClassTest) { - const GlobalEnvConstants *globalConst = thread->GlobalConstants(); + const GlobalEnvConstants *globalConst = thread_->GlobalConstants(); ASSERT_NE(globalConst, nullptr); const JSTaggedValue *address = globalConst->BeginSlot(); @@ -59,7 +59,7 @@ TEST_F(GlueRegsTest, ConstantClassTest) TEST_F(GlueRegsTest, ConstantSpecialTest) { - auto globalConst = const_cast(thread->GlobalConstants()); + auto globalConst = const_cast(thread_->GlobalConstants()); ASSERT_NE(globalConst, nullptr); EXPECT_TRUE(globalConst->GetUndefined().IsUndefined()); @@ -72,7 +72,7 @@ TEST_F(GlueRegsTest, ConstantSpecialTest) TEST_F(GlueRegsTest, ConstantStringTest) { - auto globalConst = const_cast(thread->GlobalConstants()); + auto globalConst = const_cast(thread_->GlobalConstants()); ASSERT_NE(globalConst, nullptr); #define CONSTANT_STRING_ITERATOR(Type, Name, Index, Desc) \ @@ -86,7 +86,7 @@ TEST_F(GlueRegsTest, ConstantStringTest) TEST_F(GlueRegsTest, ConstantAccessorTest) { - auto globalConst = const_cast(thread->GlobalConstants()); + auto globalConst = const_cast(thread_->GlobalConstants()); ASSERT_NE(globalConst, nullptr); #define CONSTANT_ACCESSOR_ITERATOR(Type, Name, Index, Desc) \ diff --git a/tests/runtime/common/huge_object_test.cpp b/tests/runtime/common/huge_object_test.cpp index 64c271d0556dfe50aff30185ab71ee676dc889dc..3cdf081cb5fa08ef3b4a80516d6328a3650a5b74 100644 --- a/tests/runtime/common/huge_object_test.cpp +++ b/tests/runtime/common/huge_object_test.cpp @@ -39,19 +39,19 @@ public: void SetUp() override { - TestHelper::CreateEcmaVMWithScope(instance, thread, scope); - thread->GetEcmaVM()->SetEnableForceGC(false); - const_cast(thread->GetEcmaVM()->GetHeap())->SetOnlyMarkSemi(false); + TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); + thread_->GetEcmaVM()->SetEnableForceGC(false); + const_cast(thread_->GetEcmaVM()->GetHeap())->SetOnlyMarkSemi(false); } void TearDown() override { - TestHelper::DestroyEcmaVMWithScope(instance, scope); + TestHelper::DestroyEcmaVMWithScope(instance_, scope_); } - JSThread *thread {nullptr}; - PandaVM *instance {nullptr}; - ecmascript::EcmaHandleScope *scope {nullptr}; + JSThread *thread_ {nullptr}; + PandaVM *instance_ {nullptr}; + ecmascript::EcmaHandleScope *scope_ {nullptr}; }; #if !defined(NDEBUG) @@ -79,12 +79,12 @@ static TaggedArray *LargeArrayTestCreate(JSThread *thread) TEST_F(HugeObjectTest, LargeArrayKeep) { #if !defined(NDEBUG) - TaggedArray *array = LargeArrayTestCreate(thread); + TaggedArray *array = LargeArrayTestCreate(thread_); EXPECT_TRUE(array != nullptr); - JSHandle arrayHandle(thread, array); - JSHandle newObj(thread, JSObjectTestCreate(thread)); - arrayHandle->Set(thread, 0, newObj.GetTaggedValue()); - auto ecmaVm = thread->GetEcmaVM(); + JSHandle arrayHandle(thread_, array); + JSHandle newObj(thread_, JSObjectTestCreate(thread_)); + arrayHandle->Set(thread_, 0, newObj.GetTaggedValue()); + auto ecmaVm = thread_->GetEcmaVM(); EXPECT_EQ(*arrayHandle, reinterpret_cast(array)); ecmaVm->CollectGarbage(TriggerGCType::SEMI_GC); // Trigger GC. ecmaVm->CollectGarbage(TriggerGCType::HUGE_GC); // Trigger GC. @@ -96,19 +96,19 @@ TEST_F(HugeObjectTest, LargeArrayKeep) TEST_F(HugeObjectTest, DISABLED_MultipleArrays) // TODO(vpukhov) { #if !defined(NDEBUG) - auto ecmaVm = thread->GetEcmaVM(); + auto ecmaVm = thread_->GetEcmaVM(); auto heap = ecmaVm->GetHeap(); Region *firstPage = nullptr; Region *secondPage = nullptr; Region *thirdPage = nullptr; - JSHandle array1(thread, LargeArrayTestCreate(thread)); + JSHandle array1(thread_, LargeArrayTestCreate(thread_)); firstPage = Region::ObjectAddressToRange(*array1); { DISALLOW_GARBAGE_COLLECTION; - [[maybe_unused]] TaggedArray *array2 = LargeArrayTestCreate(thread); + [[maybe_unused]] TaggedArray *array2 = LargeArrayTestCreate(thread_); secondPage = Region::ObjectAddressToRange(array2); } - JSHandle array3(thread, LargeArrayTestCreate(thread)); + JSHandle array3(thread_, LargeArrayTestCreate(thread_)); thirdPage = Region::ObjectAddressToRange(*array3); EXPECT_EQ(firstPage->GetNext(), secondPage); diff --git a/tests/runtime/common/js_arguments_test.cpp b/tests/runtime/common/js_arguments_test.cpp index c0ed517f7a933bbf03161af750ee7ef86b3a394c..726d80bb22fa69eeee88f767f120b56106d8688f 100644 --- a/tests/runtime/common/js_arguments_test.cpp +++ b/tests/runtime/common/js_arguments_test.cpp @@ -37,16 +37,16 @@ public: void SetUp() override { - TestHelper::CreateEcmaVMWithScope(instance, thread, scope); + TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); } void TearDown() override { - TestHelper::DestroyEcmaVMWithScope(instance, scope); + TestHelper::DestroyEcmaVMWithScope(instance_, scope_); } - ecmascript::EcmaHandleScope *scope {nullptr}; - PandaVM *instance {nullptr}; - JSThread *thread {nullptr}; + ecmascript::EcmaHandleScope *scope_ {nullptr}; + PandaVM *instance_ {nullptr}; + JSThread *thread_ {nullptr}; }; static JSFunction *JSObjectTestCreate(JSThread *thread) @@ -58,108 +58,108 @@ static JSFunction *JSObjectTestCreate(JSThread *thread) TEST_F(JsArgumentsTest, SetProperty) { - JSHandle argFunc(thread, JSObjectTestCreate(thread)); + JSHandle argFunc(thread_, JSObjectTestCreate(thread_)); JSHandle jsarg = - thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(argFunc), argFunc); - JSHandle arg = thread->GetEcmaVM()->GetFactory()->NewJSArguments(); + thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(argFunc), argFunc); + JSHandle arg = thread_->GetEcmaVM()->GetFactory()->NewJSArguments(); char array[] = "x"; - JSHandle key(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(array)); - JSHandle value(thread, JSTaggedValue(1)); + JSHandle key(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(array)); + JSHandle value(thread_, JSTaggedValue(1)); // receive must be jsarg's conversion JSHandle receiver = JSHandle::Cast(jsarg); - EXPECT_TRUE(JSArguments::SetProperty(thread, arg, key, value, receiver)); - EXPECT_EQ(JSObject::GetProperty(thread, JSHandle(jsarg), key).GetValue()->GetInt(), 1); - EXPECT_EQ(JSArguments::GetProperty(thread, jsarg, key).GetValue()->GetInt(), 1); - - JSHandle value2(thread, JSTaggedValue(2)); - EXPECT_TRUE(JSArguments::SetProperty(thread, arg, key, value2, receiver)); - EXPECT_EQ(JSObject::GetProperty(thread, JSHandle(jsarg), key).GetValue()->GetInt(), 2); - EXPECT_EQ(JSArguments::GetProperty(thread, jsarg, key).GetValue()->GetInt(), 2); + EXPECT_TRUE(JSArguments::SetProperty(thread_, arg, key, value, receiver)); + EXPECT_EQ(JSObject::GetProperty(thread_, JSHandle(jsarg), key).GetValue()->GetInt(), 1); + EXPECT_EQ(JSArguments::GetProperty(thread_, jsarg, key).GetValue()->GetInt(), 1); + + JSHandle value2(thread_, JSTaggedValue(2)); + EXPECT_TRUE(JSArguments::SetProperty(thread_, arg, key, value2, receiver)); + EXPECT_EQ(JSObject::GetProperty(thread_, JSHandle(jsarg), key).GetValue()->GetInt(), 2); + EXPECT_EQ(JSArguments::GetProperty(thread_, jsarg, key).GetValue()->GetInt(), 2); } TEST_F(JsArgumentsTest, GetProperty) { - JSHandle argFunc(thread, JSObjectTestCreate(thread)); + JSHandle argFunc(thread_, JSObjectTestCreate(thread_)); JSHandle jsarg = - thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(argFunc), argFunc); - JSHandle arg = thread->GetEcmaVM()->GetFactory()->NewJSArguments(); + thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(argFunc), argFunc); + JSHandle arg = thread_->GetEcmaVM()->GetFactory()->NewJSArguments(); char array[] = "x"; - JSHandle key(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(array)); - JSHandle value(thread, JSTaggedValue(1)); + JSHandle key(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(array)); + JSHandle value(thread_, JSTaggedValue(1)); JSHandle receiver = JSHandle::Cast(jsarg); - JSArguments::SetProperty(thread, arg, key, value, receiver); - EXPECT_EQ(JSObject::GetProperty(thread, JSHandle(jsarg), key).GetValue()->GetInt(), 1); - EXPECT_EQ(JSArguments::GetProperty(thread, JSHandle(jsarg), key, receiver).GetValue()->GetInt(), 1); - - JSHandle value2(thread, JSTaggedValue(2)); - JSArguments::SetProperty(thread, arg, key, value2, receiver); - EXPECT_EQ(JSArguments::GetProperty(thread, jsarg, key).GetValue()->GetInt(), 2); - EXPECT_EQ(JSObject::GetProperty(thread, JSHandle(jsarg), key).GetValue()->GetInt(), 2); + JSArguments::SetProperty(thread_, arg, key, value, receiver); + EXPECT_EQ(JSObject::GetProperty(thread_, JSHandle(jsarg), key).GetValue()->GetInt(), 1); + EXPECT_EQ(JSArguments::GetProperty(thread_, JSHandle(jsarg), key, receiver).GetValue()->GetInt(), 1); + + JSHandle value2(thread_, JSTaggedValue(2)); + JSArguments::SetProperty(thread_, arg, key, value2, receiver); + EXPECT_EQ(JSArguments::GetProperty(thread_, jsarg, key).GetValue()->GetInt(), 2); + EXPECT_EQ(JSObject::GetProperty(thread_, JSHandle(jsarg), key).GetValue()->GetInt(), 2); } TEST_F(JsArgumentsTest, DeleteProperty) { - JSHandle argFunc(thread, JSObjectTestCreate(thread)); + JSHandle argFunc(thread_, JSObjectTestCreate(thread_)); JSHandle jsarg = - thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(argFunc), argFunc); - JSHandle arg = thread->GetEcmaVM()->GetFactory()->NewJSArguments(); + thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(argFunc), argFunc); + JSHandle arg = thread_->GetEcmaVM()->GetFactory()->NewJSArguments(); char array[] = "delete"; - JSHandle key(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(array)); - JSHandle value(thread, JSTaggedValue(1)); + JSHandle key(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(array)); + JSHandle value(thread_, JSTaggedValue(1)); JSHandle receiver = JSHandle::Cast(jsarg); - JSArguments::SetProperty(thread, arg, key, value, receiver); - EXPECT_EQ(JSArguments::GetProperty(thread, jsarg, key).GetValue()->GetInt(), 1); + JSArguments::SetProperty(thread_, arg, key, value, receiver); + EXPECT_EQ(JSArguments::GetProperty(thread_, jsarg, key).GetValue()->GetInt(), 1); // test delete - bool result = JSArguments::DeleteProperty(thread, JSHandle(jsarg), key); + bool result = JSArguments::DeleteProperty(thread_, JSHandle(jsarg), key); EXPECT_TRUE(result); - EXPECT_TRUE(JSObject::GetProperty(thread, JSHandle(jsarg), key).GetValue()->IsUndefined()); + EXPECT_TRUE(JSObject::GetProperty(thread_, JSHandle(jsarg), key).GetValue()->IsUndefined()); } TEST_F(JsArgumentsTest, DefineOwnProperty) { - JSHandle argFunc(thread, JSObjectTestCreate(thread)); + JSHandle argFunc(thread_, JSObjectTestCreate(thread_)); JSHandle jsarg = - thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(argFunc), argFunc); - JSHandle arg = thread->GetEcmaVM()->GetFactory()->NewJSArguments(); + thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(argFunc), argFunc); + JSHandle arg = thread_->GetEcmaVM()->GetFactory()->NewJSArguments(); - JSHandle key(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("x")); - JSHandle value1(thread, JSTaggedValue(1)); - JSHandle value2(thread, JSTaggedValue(2)); + JSHandle key(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("x")); + JSHandle value1(thread_, JSTaggedValue(1)); + JSHandle value2(thread_, JSTaggedValue(2)); JSHandle receiver = JSHandle::Cast(jsarg); - JSArguments::SetProperty(thread, arg, key, value2, receiver); - EXPECT_EQ(JSObject::GetProperty(thread, JSHandle(jsarg), key).GetValue()->GetInt(), 2); + JSArguments::SetProperty(thread_, arg, key, value2, receiver); + EXPECT_EQ(JSObject::GetProperty(thread_, JSHandle(jsarg), key).GetValue()->GetInt(), 2); - PropertyDescriptor Desc(thread); + PropertyDescriptor Desc(thread_); // set value1 Desc.SetValue(value1); Desc.SetWritable(false); - EXPECT_TRUE(JSArguments::DefineOwnProperty(thread, JSHandle(jsarg), key, Desc)); - EXPECT_EQ(JSObject::GetProperty(thread, JSHandle(jsarg), key).GetValue()->GetInt(), 1); + EXPECT_TRUE(JSArguments::DefineOwnProperty(thread_, JSHandle(jsarg), key, Desc)); + EXPECT_EQ(JSObject::GetProperty(thread_, JSHandle(jsarg), key).GetValue()->GetInt(), 1); } TEST_F(JsArgumentsTest, GetOwnProperty) { - JSHandle argFunc(thread, JSObjectTestCreate(thread)); + JSHandle argFunc(thread_, JSObjectTestCreate(thread_)); JSHandle jsarg = - thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(argFunc), argFunc); - JSHandle arg = thread->GetEcmaVM()->GetFactory()->NewJSArguments(); + thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(argFunc), argFunc); + JSHandle arg = thread_->GetEcmaVM()->GetFactory()->NewJSArguments(); - JSHandle key(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("x")); - JSHandle value(thread, JSTaggedValue(1)); + JSHandle key(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("x")); + JSHandle value(thread_, JSTaggedValue(1)); JSHandle receiver = JSHandle::Cast(jsarg); - JSArguments::SetProperty(thread, arg, key, value, receiver); + JSArguments::SetProperty(thread_, arg, key, value, receiver); - PropertyDescriptor Desc(thread); - JSHandle caller = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("caller"); + PropertyDescriptor Desc(thread_); + JSHandle caller = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("caller"); // key is not caller EXPECT_FALSE(JSTaggedValue::SameValue(key.GetTaggedValue(), caller.GetTaggedValue())); - EXPECT_TRUE(JSArguments::GetOwnProperty(thread, JSHandle(jsarg), key, Desc)); + EXPECT_TRUE(JSArguments::GetOwnProperty(thread_, JSHandle(jsarg), key, Desc)); EXPECT_EQ(Desc.GetValue()->GetInt(), 1); } } // namespace panda::test diff --git a/tests/runtime/common/js_array_iterator_test.cpp b/tests/runtime/common/js_array_iterator_test.cpp index a62689caa29276a6b99da9dc77a2de210674f726..0fe4b59d9db99cc98dfdf085e08c5416ca38d3bc 100644 --- a/tests/runtime/common/js_array_iterator_test.cpp +++ b/tests/runtime/common/js_array_iterator_test.cpp @@ -36,16 +36,16 @@ public: void SetUp() override { - TestHelper::CreateEcmaVMWithScope(instance, thread, scope); + TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); } void TearDown() override { - TestHelper::DestroyEcmaVMWithScope(instance, scope); + TestHelper::DestroyEcmaVMWithScope(instance_, scope_); } - PandaVM *instance {nullptr}; - ecmascript::EcmaHandleScope *scope {nullptr}; - JSThread *thread {nullptr}; + PandaVM *instance_ {nullptr}; + ecmascript::EcmaHandleScope *scope_ {nullptr}; + JSThread *thread_ {nullptr}; }; /* @@ -58,7 +58,7 @@ public: */ TEST_F(JSArrayIteratorTest, SetIteratedArray) { - EcmaVM *ecmaVMPtr = thread->GetEcmaVM(); + EcmaVM *ecmaVMPtr = thread_->GetEcmaVM(); ObjectFactory *factory = ecmaVMPtr->GetFactory(); uint32_t arrayFrom1[10] = {0, 6, 8, 99, 200, 1, static_cast(-1), static_cast(-199), 33, 100}; @@ -68,32 +68,32 @@ TEST_F(JSArrayIteratorTest, SetIteratedArray) JSHandle handleTaggedArrayFrom1(factory->NewTaggedArray(numArrayFrom1)); JSHandle handleTaggedArrayFrom2(factory->NewTaggedArray(numArrayFrom2)); for (int i = 0; i < numArrayFrom1; i++) { - handleTaggedArrayFrom1->Set(thread, i, JSTaggedValue(arrayFrom1[i])); + handleTaggedArrayFrom1->Set(thread_, i, JSTaggedValue(arrayFrom1[i])); } for (int i = 0; i < numArrayFrom2; i++) { - handleTaggedArrayFrom2->Set(thread, i, JSTaggedValue(arrayFrom2[i])); + handleTaggedArrayFrom2->Set(thread_, i, JSTaggedValue(arrayFrom2[i])); } - JSHandle handleJSObjectTaggedArrayFrom1(JSArray::CreateArrayFromList(thread, handleTaggedArrayFrom1)); - JSHandle handleJSObjectTaggedArrayFrom2(JSArray::CreateArrayFromList(thread, handleTaggedArrayFrom2)); + JSHandle handleJSObjectTaggedArrayFrom1(JSArray::CreateArrayFromList(thread_, handleTaggedArrayFrom1)); + JSHandle handleJSObjectTaggedArrayFrom2(JSArray::CreateArrayFromList(thread_, handleTaggedArrayFrom2)); // Call "SetIteratedArray" function through "NewJSArrayIterator" function of "object_factory.cpp". JSHandle handleJSArrayIter = factory->NewJSArrayIterator(handleJSObjectTaggedArrayFrom1, IterationKind::KEY); - JSHandle handleJSArrayTo1(thread, JSArray::Cast(handleJSArrayIter->GetIteratedArray().GetTaggedObject())); + JSHandle handleJSArrayTo1(thread_, JSArray::Cast(handleJSArrayIter->GetIteratedArray().GetTaggedObject())); EXPECT_EQ(handleJSArrayTo1->GetArrayLength(), numArrayFrom1); for (int i = 0; i < numArrayFrom1; i++) { - EXPECT_EQ(JSArray::FastGetPropertyByValue(thread, JSHandle(handleJSArrayTo1), i)->GetNumber(), + EXPECT_EQ(JSArray::FastGetPropertyByValue(thread_, JSHandle(handleJSArrayTo1), i)->GetNumber(), arrayFrom1[i]); } // Call "SetIteratedArray" function in this TEST_F. - handleJSArrayIter->SetIteratedArray(thread, handleJSObjectTaggedArrayFrom2); + handleJSArrayIter->SetIteratedArray(thread_, handleJSObjectTaggedArrayFrom2); - JSHandle handleJSArrayTo2(thread, JSArray::Cast(handleJSArrayIter->GetIteratedArray().GetTaggedObject())); + JSHandle handleJSArrayTo2(thread_, JSArray::Cast(handleJSArrayIter->GetIteratedArray().GetTaggedObject())); EXPECT_EQ(handleJSArrayTo2->GetArrayLength(), numArrayFrom2); for (int i = 0; i < numArrayFrom2; i++) { - EXPECT_EQ(JSArray::FastGetPropertyByValue(thread, JSHandle(handleJSArrayTo2), i)->GetNumber(), + EXPECT_EQ(JSArray::FastGetPropertyByValue(thread_, JSHandle(handleJSArrayTo2), i)->GetNumber(), arrayFrom2[i]); } } @@ -108,16 +108,16 @@ TEST_F(JSArrayIteratorTest, SetIteratedArray) */ TEST_F(JSArrayIteratorTest, SetNextIndex) { - EcmaVM *ecmaVMPtr = thread->GetEcmaVM(); + EcmaVM *ecmaVMPtr = thread_->GetEcmaVM(); ObjectFactory *factory = ecmaVMPtr->GetFactory(); uint32_t array[10] = {0, 6, 8, 99, 200, 1, static_cast(-1), static_cast(-199), 33, 100}; int numArray = sizeof(array) / sizeof(array[0]); JSHandle handleTaggedArray(factory->NewTaggedArray(numArray)); for (int i = 0; i < numArray; i++) { - handleTaggedArray->Set(thread, i, JSTaggedValue(array[i])); + handleTaggedArray->Set(thread_, i, JSTaggedValue(array[i])); } - JSHandle handleJSObjectTaggedArray(JSArray::CreateArrayFromList(thread, handleTaggedArray)); + JSHandle handleJSObjectTaggedArray(JSArray::CreateArrayFromList(thread_, handleTaggedArray)); // Call "SetNextIndex" function through "NewJSArrayIterator" function of "object_factory.cpp". JSHandle handleJSArrayIter = @@ -126,10 +126,10 @@ TEST_F(JSArrayIteratorTest, SetNextIndex) int testQuantity = 100; for (int i = 1; i <= testQuantity; i++) { - JSHandle handleTagValNextIndex(thread, JSTaggedValue(i)); + JSHandle handleTagValNextIndex(thread_, JSTaggedValue(i)); // Call "SetNextIndex" function in this TEST_F. - handleJSArrayIter->SetNextIndex(thread, handleTagValNextIndex); + handleJSArrayIter->SetNextIndex(thread_, handleTagValNextIndex); EXPECT_EQ(handleJSArrayIter->GetNextIndex().GetNumber(), i); } } @@ -144,19 +144,19 @@ TEST_F(JSArrayIteratorTest, SetNextIndex) */ TEST_F(JSArrayIteratorTest, SetIterationKind) { - EcmaVM *ecmaVMPtr = thread->GetEcmaVM(); + EcmaVM *ecmaVMPtr = thread_->GetEcmaVM(); ObjectFactory *factory = ecmaVMPtr->GetFactory(); uint32_t array[10] = {0, 6, 8, 99, 200, 1, static_cast(-1), static_cast(-199), 33, 100}; int numArray = sizeof(array) / sizeof(array[0]); JSHandle handleTaggedArray(factory->NewTaggedArray(numArray)); for (int i = 0; i < numArray; i++) { - handleTaggedArray->Set(thread, i, JSTaggedValue(array[i])); + handleTaggedArray->Set(thread_, i, JSTaggedValue(array[i])); } - JSHandle handleTagVal0(thread, JSTaggedValue(0)); - JSHandle handleTagVal1(thread, JSTaggedValue(1)); - JSHandle handleTagVal2(thread, JSTaggedValue(2)); - JSHandle handleJSObjectTaggedArray(JSArray::CreateArrayFromList(thread, handleTaggedArray)); + JSHandle handleTagVal0(thread_, JSTaggedValue(0)); + JSHandle handleTagVal1(thread_, JSTaggedValue(1)); + JSHandle handleTagVal2(thread_, JSTaggedValue(2)); + JSHandle handleJSObjectTaggedArray(JSArray::CreateArrayFromList(thread_, handleTaggedArray)); // Call "SetIterationKind" function through "NewJSArrayIterator" function of "object_factory.cpp". JSHandle handleJSArrayIter = @@ -168,11 +168,11 @@ TEST_F(JSArrayIteratorTest, SetIterationKind) EXPECT_EQ(handleJSArrayIter->GetIterationKind().GetNumber(), 2); // Call "SetIterationKind" function in this TEST_F. - handleJSArrayIter->SetIterationKind(thread, handleTagVal0); + handleJSArrayIter->SetIterationKind(thread_, handleTagVal0); EXPECT_EQ(handleJSArrayIter->GetIterationKind().GetNumber(), 0); - handleJSArrayIter->SetIterationKind(thread, handleTagVal1); + handleJSArrayIter->SetIterationKind(thread_, handleTagVal1); EXPECT_EQ(handleJSArrayIter->GetIterationKind().GetNumber(), 1); - handleJSArrayIter->SetIterationKind(thread, handleTagVal2); + handleJSArrayIter->SetIterationKind(thread_, handleTagVal2); EXPECT_EQ(handleJSArrayIter->GetIterationKind().GetNumber(), 2); } } // namespace panda::test diff --git a/tests/runtime/common/js_array_test.cpp b/tests/runtime/common/js_array_test.cpp index 5625398ee303dad7a04ded86c4a5f2a110cbf247..a4933d1c34197ef5850621ee9c517a60e199f761 100644 --- a/tests/runtime/common/js_array_test.cpp +++ b/tests/runtime/common/js_array_test.cpp @@ -40,150 +40,150 @@ class JSArrayTest : public testing::Test { public: void SetUp() override { - TestHelper::CreateEcmaVMWithScope(instance, thread, scope); + TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); } void TearDown() override { - TestHelper::DestroyEcmaVMWithScope(instance, scope); + TestHelper::DestroyEcmaVMWithScope(instance_, scope_); } - PandaVM *instance {nullptr}; - EcmaHandleScope *scope {nullptr}; - JSThread *thread {nullptr}; + PandaVM *instance_ {nullptr}; + EcmaHandleScope *scope_ {nullptr}; + JSThread *thread_ {nullptr}; }; TEST_F(JSArrayTest, ArrayCreate) { - JSHandle length_key_handle(thread->GlobalConstants()->GetHandledLengthString()); - JSArray *arr = JSArray::ArrayCreate(thread, JSTaggedNumber(0)).GetObject(); + JSHandle length_key_handle(thread_->GlobalConstants()->GetHandledLengthString()); + JSArray *arr = JSArray::ArrayCreate(thread_, JSTaggedNumber(0)).GetObject(); EXPECT_TRUE(arr != nullptr); - JSHandle obj(thread, arr); - EXPECT_EQ(JSArray::GetProperty(thread, obj, length_key_handle).GetValue()->GetInt(), 0); + JSHandle obj(thread_, arr); + EXPECT_EQ(JSArray::GetProperty(thread_, obj, length_key_handle).GetValue()->GetInt(), 0); - JSArray *arr2 = JSArray::ArrayCreate(thread, JSTaggedNumber(10)).GetObject(); + JSArray *arr2 = JSArray::ArrayCreate(thread_, JSTaggedNumber(10)).GetObject(); EXPECT_TRUE(arr2 != nullptr); - JSHandle obj2(thread, arr2); - EXPECT_EQ(JSArray::GetProperty(thread, obj2, length_key_handle).GetValue()->GetInt(), 10); + JSHandle obj2(thread_, arr2); + EXPECT_EQ(JSArray::GetProperty(thread_, obj2, length_key_handle).GetValue()->GetInt(), 10); } TEST_F(JSArrayTest, ArraySpeciesCreate) { - JSHandle length_key_handle(thread->GlobalConstants()->GetHandledLengthString()); - JSArray *arr = JSArray::ArrayCreate(thread, JSTaggedNumber(0)).GetObject(); + JSHandle length_key_handle(thread_->GlobalConstants()->GetHandledLengthString()); + JSArray *arr = JSArray::ArrayCreate(thread_, JSTaggedNumber(0)).GetObject(); EXPECT_TRUE(arr != nullptr); - JSHandle obj(thread, arr); - EXPECT_EQ(JSArray::GetProperty(thread, JSHandle(obj), length_key_handle).GetValue()->GetInt(), 0); + JSHandle obj(thread_, arr); + EXPECT_EQ(JSArray::GetProperty(thread_, JSHandle(obj), length_key_handle).GetValue()->GetInt(), 0); - JSArray *arr2 = JSArray::Cast(JSArray::ArraySpeciesCreate(thread, obj, JSTaggedNumber(10)).GetHeapObject()); + JSArray *arr2 = JSArray::Cast(JSArray::ArraySpeciesCreate(thread_, obj, JSTaggedNumber(10)).GetHeapObject()); EXPECT_TRUE(arr2 != nullptr); - JSHandle obj2(thread, arr2); - EXPECT_EQ(JSArray::GetProperty(thread, obj2, length_key_handle).GetValue()->GetInt(), 10); + JSHandle obj2(thread_, arr2); + EXPECT_EQ(JSArray::GetProperty(thread_, obj2, length_key_handle).GetValue()->GetInt(), 10); } TEST_F(JSArrayTest, DefineOwnProperty) { - auto ecma_vm = thread->GetEcmaVM(); + auto ecma_vm = thread_->GetEcmaVM(); auto factory = ecma_vm->GetFactory(); - JSHandle length_key_handle(thread->GlobalConstants()->GetHandledLengthString()); - JSArray *arr = JSArray::ArrayCreate(thread, JSTaggedNumber(0)).GetObject(); + JSHandle length_key_handle(thread_->GlobalConstants()->GetHandledLengthString()); + JSArray *arr = JSArray::ArrayCreate(thread_, JSTaggedNumber(0)).GetObject(); EXPECT_TRUE(arr != nullptr); - JSHandle obj(thread, arr); - EXPECT_EQ(JSArray::GetProperty(thread, obj, length_key_handle).GetValue()->GetInt(), 0); + JSHandle obj(thread_, arr); + EXPECT_EQ(JSArray::GetProperty(thread_, obj, length_key_handle).GetValue()->GetInt(), 0); - PropertyDescriptor desc(thread, JSHandle(thread, JSTaggedValue(100)), true, true, true); + PropertyDescriptor desc(thread_, JSHandle(thread_, JSTaggedValue(100)), true, true, true); EcmaLanguageContext ecmaLanguageContext; LanguageContext ctx(&ecmaLanguageContext); EcmaString *string1 = *factory->NewFromString("1"); - JSHandle key1(thread, static_cast(string1)); - JSHandle index1(thread, JSTaggedValue(1)); - EXPECT_TRUE(JSArray::DefineOwnProperty(thread, JSHandle(obj), key1, desc)); - EXPECT_EQ(JSArray::GetProperty(thread, obj, length_key_handle).GetValue()->GetInt(), 2); - TaggedValue v = JSArray::GetProperty(thread, obj, key1).GetValue().GetTaggedValue(); + JSHandle key1(thread_, static_cast(string1)); + JSHandle index1(thread_, JSTaggedValue(1)); + EXPECT_TRUE(JSArray::DefineOwnProperty(thread_, JSHandle(obj), key1, desc)); + EXPECT_EQ(JSArray::GetProperty(thread_, obj, length_key_handle).GetValue()->GetInt(), 2); + TaggedValue v = JSArray::GetProperty(thread_, obj, key1).GetValue().GetTaggedValue(); EXPECT_EQ(v.GetInt(), 100); - v = JSArray::GetProperty(thread, obj, index1).GetValue().GetTaggedValue(); + v = JSArray::GetProperty(thread_, obj, index1).GetValue().GetTaggedValue(); EXPECT_EQ(v.GetInt(), 100); - EXPECT_EQ(JSArray::GetProperty(thread, obj, length_key_handle).GetValue()->GetInt(), 2); + EXPECT_EQ(JSArray::GetProperty(thread_, obj, length_key_handle).GetValue()->GetInt(), 2); EcmaString *string100 = *factory->NewFromString("100"); - JSHandle key100(thread, static_cast(string100)); - JSHandle index100(thread, JSTaggedValue(100)); + JSHandle key100(thread_, static_cast(string100)); + JSHandle index100(thread_, JSTaggedValue(100)); - EXPECT_TRUE(JSArray::DefineOwnProperty(thread, JSHandle(obj), key100, desc)); - EXPECT_EQ(JSArray::GetProperty(thread, obj, key100).GetValue()->GetInt(), 100); - EXPECT_EQ(JSArray::GetProperty(thread, obj, index100).GetValue()->GetInt(), 100); - EXPECT_EQ(JSArray::GetProperty(thread, obj, length_key_handle).GetValue()->GetInt(), 101); + EXPECT_TRUE(JSArray::DefineOwnProperty(thread_, JSHandle(obj), key100, desc)); + EXPECT_EQ(JSArray::GetProperty(thread_, obj, key100).GetValue()->GetInt(), 100); + EXPECT_EQ(JSArray::GetProperty(thread_, obj, index100).GetValue()->GetInt(), 100); + EXPECT_EQ(JSArray::GetProperty(thread_, obj, length_key_handle).GetValue()->GetInt(), 101); EcmaString *stringx = *factory->NewFromString("2147483646"); - JSHandle keyx(thread, static_cast(stringx)); - JSHandle indexx(thread, JSTaggedValue(2147483646U)); // 2147483646U + JSHandle keyx(thread_, static_cast(stringx)); + JSHandle indexx(thread_, JSTaggedValue(2147483646U)); // 2147483646U - EXPECT_TRUE(JSArray::DefineOwnProperty(thread, JSHandle(obj), keyx, desc)); - EXPECT_EQ(JSArray::GetProperty(thread, obj, keyx).GetValue()->GetInt(), 100); - EXPECT_EQ(JSArray::GetProperty(thread, obj, indexx).GetValue()->GetInt(), 100); - EXPECT_EQ(JSArray::GetProperty(thread, obj, length_key_handle).GetValue()->GetInt(), 2147483647); + EXPECT_TRUE(JSArray::DefineOwnProperty(thread_, JSHandle(obj), keyx, desc)); + EXPECT_EQ(JSArray::GetProperty(thread_, obj, keyx).GetValue()->GetInt(), 100); + EXPECT_EQ(JSArray::GetProperty(thread_, obj, indexx).GetValue()->GetInt(), 100); + EXPECT_EQ(JSArray::GetProperty(thread_, obj, length_key_handle).GetValue()->GetInt(), 2147483647); - EXPECT_TRUE(JSArray::DeleteProperty(thread, JSHandle(obj), indexx)); - EXPECT_TRUE(JSArray::GetProperty(thread, obj, keyx).GetValue()->IsUndefined()); - EXPECT_TRUE(JSArray::GetProperty(thread, obj, indexx).GetValue()->IsUndefined()); + EXPECT_TRUE(JSArray::DeleteProperty(thread_, JSHandle(obj), indexx)); + EXPECT_TRUE(JSArray::GetProperty(thread_, obj, keyx).GetValue()->IsUndefined()); + EXPECT_TRUE(JSArray::GetProperty(thread_, obj, indexx).GetValue()->IsUndefined()); } TEST_F(JSArrayTest, Next) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); JSHandle values(factory->NewTaggedArray(5)); for (int i = 0; i < 5; i++) { - values->Set(thread, i, JSTaggedValue(i)); + values->Set(thread_, i, JSTaggedValue(i)); } - JSHandle array(JSArray::CreateArrayFromList(thread, values)); + JSHandle array(JSArray::CreateArrayFromList(thread_, values)); JSHandle iter(factory->NewJSArrayIterator(array, IterationKind::KEY)); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 4); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); for (int i = 0; i < 5; i++) { ecmaRuntimeCallInfo->SetThis(iter.GetTaggedValue()); JSTaggedValue ret = JSArrayIterator::Next(ecmaRuntimeCallInfo.get()); - JSHandle result(thread, ret); - EXPECT_EQ(JSIterator::IteratorValue(thread, result)->GetInt(), i); + JSHandle result(thread_, ret); + EXPECT_EQ(JSIterator::IteratorValue(thread_, result)->GetInt(), i); } - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); } TEST_F(JSArrayTest, Iterator) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); JSHandle values(factory->NewTaggedArray(5)); for (int i = 0; i < 5; i++) { - values->Set(thread, i, JSTaggedValue(i)); + values->Set(thread_, i, JSTaggedValue(i)); } - JSHandle array(JSArray::CreateArrayFromList(thread, values)); + JSHandle array(JSArray::CreateArrayFromList(thread_, values)); JSHandle key_iter(factory->NewJSArrayIterator(array, IterationKind::KEY)); JSHandle value_iter(factory->NewJSArrayIterator(array, IterationKind::VALUE)); JSHandle iter(factory->NewJSArrayIterator(array, IterationKind::KEY_AND_VALUE)); for (int i = 0; i < 5; i++) { if (i == 2) { - JSHandle key(thread, JSTaggedValue(i)); - JSObject::DeleteProperty(thread, JSHandle(array), key); + JSHandle key(thread_, JSTaggedValue(i)); + JSObject::DeleteProperty(thread_, JSHandle(array), key); } - JSHandle key_result(JSIterator::IteratorStep(thread, key_iter)); - JSHandle value_result(JSIterator::IteratorStep(thread, value_iter)); - JSHandle iter_result(JSIterator::IteratorStep(thread, iter)); - JSHandle iter_value(JSIterator::IteratorValue(thread, iter_result)); - JSHandle index_key(thread, JSTaggedValue(0)); - JSHandle element_key(thread, JSTaggedValue(1)); + JSHandle key_result(JSIterator::IteratorStep(thread_, key_iter)); + JSHandle value_result(JSIterator::IteratorStep(thread_, value_iter)); + JSHandle iter_result(JSIterator::IteratorStep(thread_, iter)); + JSHandle iter_value(JSIterator::IteratorValue(thread_, iter_result)); + JSHandle index_key(thread_, JSTaggedValue(0)); + JSHandle element_key(thread_, JSTaggedValue(1)); if (i == 2) { - EXPECT_EQ(i, JSIterator::IteratorValue(thread, key_result)->GetInt()); - EXPECT_EQ(JSTaggedValue::Undefined(), JSIterator::IteratorValue(thread, value_result).GetTaggedValue()); - EXPECT_EQ(i, JSObject::GetProperty(thread, iter_value, index_key).GetValue()->GetInt()); + EXPECT_EQ(i, JSIterator::IteratorValue(thread_, key_result)->GetInt()); + EXPECT_EQ(JSTaggedValue::Undefined(), JSIterator::IteratorValue(thread_, value_result).GetTaggedValue()); + EXPECT_EQ(i, JSObject::GetProperty(thread_, iter_value, index_key).GetValue()->GetInt()); EXPECT_EQ(JSTaggedValue::Undefined(), - JSObject::GetProperty(thread, iter_value, element_key).GetValue().GetTaggedValue()); + JSObject::GetProperty(thread_, iter_value, element_key).GetValue().GetTaggedValue()); continue; } - EXPECT_EQ(i, JSIterator::IteratorValue(thread, key_result)->GetInt()); - EXPECT_EQ(i, JSIterator::IteratorValue(thread, value_result)->GetInt()); - EXPECT_EQ(i, JSObject::GetProperty(thread, iter_value, index_key).GetValue()->GetInt()); - EXPECT_EQ(i, JSObject::GetProperty(thread, iter_value, element_key).GetValue()->GetInt()); + EXPECT_EQ(i, JSIterator::IteratorValue(thread_, key_result)->GetInt()); + EXPECT_EQ(i, JSIterator::IteratorValue(thread_, value_result)->GetInt()); + EXPECT_EQ(i, JSObject::GetProperty(thread_, iter_value, index_key).GetValue()->GetInt()); + EXPECT_EQ(i, JSObject::GetProperty(thread_, iter_value, element_key).GetValue()->GetInt()); } } } // namespace panda::test diff --git a/tests/runtime/common/js_dataview_test.cpp b/tests/runtime/common/js_dataview_test.cpp index b2302190f991e3efb2ee96e0f9b294f33c3fe2ef..42315e4b6db7f0ab11af42f3b9f19d67a64e0f33 100644 --- a/tests/runtime/common/js_dataview_test.cpp +++ b/tests/runtime/common/js_dataview_test.cpp @@ -36,16 +36,16 @@ public: void SetUp() override { - TestHelper::CreateEcmaVMWithScope(instance, thread, scope); + TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); } void TearDown() override { - TestHelper::DestroyEcmaVMWithScope(instance, scope); + TestHelper::DestroyEcmaVMWithScope(instance_, scope_); } - PandaVM *instance {nullptr}; - ecmascript::EcmaHandleScope *scope {nullptr}; - JSThread *thread {nullptr}; + PandaVM *instance_ {nullptr}; + ecmascript::EcmaHandleScope *scope_ {nullptr}; + JSThread *thread_ {nullptr}; }; /* @@ -78,7 +78,7 @@ TEST_F(JSDataViewTest, GetElementSize) */ TEST_F(JSDataViewTest, SetDataView) { - EcmaVM *ecmaVMPtr = thread->GetEcmaVM(); + EcmaVM *ecmaVMPtr = thread_->GetEcmaVM(); ObjectFactory *factory = ecmaVMPtr->GetFactory(); JSHandle handleGlobalEnv = ecmaVMPtr->GetGlobalEnv(); @@ -89,16 +89,16 @@ TEST_F(JSDataViewTest, SetDataView) JSHandle handleTagValFuncArrayBuf(handleFuncArrayBuf); JSHandle handleArrayBuf( factory->NewJSObjectByConstructor(handleFuncArrayBuf, handleTagValFuncArrayBuf)); - handleArrayBuf->SetArrayBufferByteLength(thread, JSTaggedValue(lengthDataArrayBuf)); + handleArrayBuf->SetArrayBufferByteLength(thread_, JSTaggedValue(lengthDataArrayBuf)); // Call "SetDataView" function through "NewJSDataView" function of "object_factory.cpp" JSHandle handleDataView = factory->NewJSDataView(handleArrayBuf, offsetDataView, lengthDataView); EXPECT_TRUE(handleDataView->GetDataView().IsTrue()); // Call "SetDataView" function in this TEST_F. - handleDataView->SetDataView(thread, JSTaggedValue::False()); + handleDataView->SetDataView(thread_, JSTaggedValue::False()); EXPECT_TRUE(handleDataView->GetDataView().IsFalse()); - handleDataView->SetDataView(thread, JSTaggedValue::True()); + handleDataView->SetDataView(thread_, JSTaggedValue::True()); EXPECT_TRUE(handleDataView->GetDataView().IsTrue()); } @@ -112,7 +112,7 @@ TEST_F(JSDataViewTest, SetDataView) */ TEST_F(JSDataViewTest, SetViewedArrayBuffer) { - EcmaVM *ecmaVMPtr = thread->GetEcmaVM(); + EcmaVM *ecmaVMPtr = thread_->GetEcmaVM(); ObjectFactory *factory = ecmaVMPtr->GetFactory(); JSHandle handleFuncArrayBuf(ecmaVMPtr->GetGlobalEnv()->GetArrayBufferFunction()); JSHandle handleTagValFuncArrayBuf(handleFuncArrayBuf); @@ -125,21 +125,21 @@ TEST_F(JSDataViewTest, SetViewedArrayBuffer) factory->NewJSObjectByConstructor(handleFuncArrayBuf, handleTagValFuncArrayBuf)); JSHandle handleArrayBuf2( factory->NewJSObjectByConstructor(handleFuncArrayBuf, handleTagValFuncArrayBuf)); - handleArrayBuf1->SetArrayBufferByteLength(thread, JSTaggedValue(lengthDataArrayBuf1)); - handleArrayBuf2->SetArrayBufferByteLength(thread, JSTaggedValue(lengthDataArrayBuf2)); + handleArrayBuf1->SetArrayBufferByteLength(thread_, JSTaggedValue(lengthDataArrayBuf1)); + handleArrayBuf2->SetArrayBufferByteLength(thread_, JSTaggedValue(lengthDataArrayBuf2)); // Call "SetViewedArrayBuffer" function through "NewJSDataView" function of "object_factory.cpp" JSHandle handleDataView = factory->NewJSDataView(handleArrayBuf1, offsetDataView, lengthDataView); - JSHandle handleTagValDataViewFrom1(thread, handleArrayBuf1.GetTaggedValue()); - JSHandle handleTagValDataViewTo1(thread, handleDataView->GetViewedArrayBuffer()); - EXPECT_TRUE(JSTaggedValue::Equal(thread, handleTagValDataViewFrom1, handleTagValDataViewTo1)); + JSHandle handleTagValDataViewFrom1(thread_, handleArrayBuf1.GetTaggedValue()); + JSHandle handleTagValDataViewTo1(thread_, handleDataView->GetViewedArrayBuffer()); + EXPECT_TRUE(JSTaggedValue::Equal(thread_, handleTagValDataViewFrom1, handleTagValDataViewTo1)); // Call "SetViewedArrayBuffer" function in this TEST_F. - handleDataView->SetViewedArrayBuffer(thread, handleArrayBuf2.GetTaggedValue()); - JSHandle handleTagValDataViewFrom2(thread, handleArrayBuf2.GetTaggedValue()); - JSHandle handleTagValDataViewTo2(thread, handleDataView->GetViewedArrayBuffer()); - EXPECT_TRUE(JSTaggedValue::Equal(thread, handleTagValDataViewFrom2, handleTagValDataViewTo2)); - EXPECT_FALSE(JSTaggedValue::Equal(thread, handleTagValDataViewFrom1, handleTagValDataViewFrom2)); + handleDataView->SetViewedArrayBuffer(thread_, handleArrayBuf2.GetTaggedValue()); + JSHandle handleTagValDataViewFrom2(thread_, handleArrayBuf2.GetTaggedValue()); + JSHandle handleTagValDataViewTo2(thread_, handleDataView->GetViewedArrayBuffer()); + EXPECT_TRUE(JSTaggedValue::Equal(thread_, handleTagValDataViewFrom2, handleTagValDataViewTo2)); + EXPECT_FALSE(JSTaggedValue::Equal(thread_, handleTagValDataViewFrom1, handleTagValDataViewFrom2)); } /* @@ -152,7 +152,7 @@ TEST_F(JSDataViewTest, SetViewedArrayBuffer) */ TEST_F(JSDataViewTest, SetByteLength) { - EcmaVM *ecmaVMPtr = thread->GetEcmaVM(); + EcmaVM *ecmaVMPtr = thread_->GetEcmaVM(); ObjectFactory *factory = ecmaVMPtr->GetFactory(); JSHandle handleFuncArrayBuf(ecmaVMPtr->GetGlobalEnv()->GetArrayBufferFunction()); JSHandle handleTagValFuncArrayBuf(handleFuncArrayBuf); @@ -161,17 +161,17 @@ TEST_F(JSDataViewTest, SetByteLength) int32_t offsetDataView = 4; int32_t lengthDataView1 = 4; int32_t lengthDataView2 = 2; - JSHandle handleTagValLengthDataView2(thread, JSTaggedValue(lengthDataView2)); + JSHandle handleTagValLengthDataView2(thread_, JSTaggedValue(lengthDataView2)); JSHandle handleArrayBuf( factory->NewJSObjectByConstructor(handleFuncArrayBuf, handleTagValFuncArrayBuf)); - handleArrayBuf->SetArrayBufferByteLength(thread, JSTaggedValue(lengthDataArrayBuf)); + handleArrayBuf->SetArrayBufferByteLength(thread_, JSTaggedValue(lengthDataArrayBuf)); // Call "SetByteLength" function through "NewJSDataView" function of "object_factory.cpp" JSHandle handleDataView = factory->NewJSDataView(handleArrayBuf, offsetDataView, lengthDataView1); EXPECT_EQ(handleDataView->GetByteLength().GetNumber(), lengthDataView1); // Call "SetByteLength" function in this TEST_F. - handleDataView->SetByteLength(thread, handleTagValLengthDataView2); + handleDataView->SetByteLength(thread_, handleTagValLengthDataView2); EXPECT_EQ(handleDataView->GetByteLength().GetNumber(), lengthDataView2); } @@ -185,7 +185,7 @@ TEST_F(JSDataViewTest, SetByteLength) */ TEST_F(JSDataViewTest, SetByteOffset) { - EcmaVM *ecmaVMPtr = thread->GetEcmaVM(); + EcmaVM *ecmaVMPtr = thread_->GetEcmaVM(); ObjectFactory *factory = ecmaVMPtr->GetFactory(); JSHandle handleFuncArrayBuf1(ecmaVMPtr->GetGlobalEnv()->GetArrayBufferFunction()); JSHandle handleTagValFuncArrayBuf1(handleFuncArrayBuf1); @@ -194,17 +194,17 @@ TEST_F(JSDataViewTest, SetByteOffset) int32_t offsetDataView1 = 4; int32_t offsetDataView2 = 6; int32_t lengthDataView = 2; - JSHandle handleTagValOffsetDataView2(thread, JSTaggedValue(offsetDataView2)); + JSHandle handleTagValOffsetDataView2(thread_, JSTaggedValue(offsetDataView2)); JSHandle handleArrayBuf( factory->NewJSObjectByConstructor(handleFuncArrayBuf1, handleTagValFuncArrayBuf1)); - handleArrayBuf->SetArrayBufferByteLength(thread, JSTaggedValue(lengthDataArrayBuf)); + handleArrayBuf->SetArrayBufferByteLength(thread_, JSTaggedValue(lengthDataArrayBuf)); // Call "SetByteOffset" function through "NewJSDataView" function of "object_factory.cpp" JSHandle handleDataView = factory->NewJSDataView(handleArrayBuf, offsetDataView1, lengthDataView); EXPECT_EQ(handleDataView->GetByteOffset().GetNumber(), offsetDataView1); // Call "SetByteOffset" function in this TEST_F. - handleDataView->SetByteOffset(thread, handleTagValOffsetDataView2); + handleDataView->SetByteOffset(thread_, handleTagValOffsetDataView2); EXPECT_EQ(handleDataView->GetByteOffset().GetNumber(), offsetDataView2); } } // namespace panda::test diff --git a/tests/runtime/common/js_date_test.cpp b/tests/runtime/common/js_date_test.cpp index d2fd80aca096ccdbb6b4a9127383f05cffa0c62b..2a8ac69ca1578a2b12d6848099302f8a94823781 100644 --- a/tests/runtime/common/js_date_test.cpp +++ b/tests/runtime/common/js_date_test.cpp @@ -30,17 +30,17 @@ class JSDateTest : public testing::Test { public: void SetUp() override { - TestHelper::CreateEcmaVMWithScope(instance, thread, scope); + TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); } void TearDown() override { - TestHelper::DestroyEcmaVMWithScope(instance, scope); + TestHelper::DestroyEcmaVMWithScope(instance_, scope_); } - PandaVM *instance {nullptr}; - ecmascript::EcmaHandleScope *scope {nullptr}; - JSThread *thread; + PandaVM *instance_ {nullptr}; + ecmascript::EcmaHandleScope *scope_ {nullptr}; + JSThread *thread_; }; JSDate *JSDateCreate(JSThread *thread) @@ -57,11 +57,11 @@ JSDate *JSDateCreate(JSThread *thread) TEST_F(JSDateTest, Create) { double tm = 0.0; - JSHandle js_date(thread, JSDateCreate(thread)); + JSHandle js_date(thread_, JSDateCreate(thread_)); EXPECT_EQ(js_date->GetTimeValue(), JSTaggedValue(tm)); EXPECT_EQ(js_date->GetLocalOffset(), JSTaggedValue(JSDate::MAX_DOUBLE)); tm = 28 * 60 * 60 * 1000; - js_date->SetTimeValue(thread, JSTaggedValue(tm)); + js_date->SetTimeValue(thread_, JSTaggedValue(tm)); [[maybe_unused]] double temp = js_date->GetTimeValue().GetDouble(); EXPECT_EQ(js_date->GetTimeValue(), JSTaggedValue(tm)); diff --git a/tests/runtime/common/js_forin_iterator_test.cpp b/tests/runtime/common/js_forin_iterator_test.cpp index 244493aa4de80df588cd597534452f150be97b6f..3f4653f2c19b5ff725cf6caf124b953d6434a5cd 100644 --- a/tests/runtime/common/js_forin_iterator_test.cpp +++ b/tests/runtime/common/js_forin_iterator_test.cpp @@ -29,57 +29,57 @@ class JSForinIteratorTest : public testing::Test { public: void SetUp() override { - TestHelper::CreateEcmaVMWithScope(instance, thread, scope); + TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); } void TearDown() override { - TestHelper::DestroyEcmaVMWithScope(instance, scope); + TestHelper::DestroyEcmaVMWithScope(instance_, scope_); } - PandaVM *instance {nullptr}; - ecmascript::EcmaHandleScope *scope {nullptr}; - JSThread *thread; + PandaVM *instance_ {nullptr}; + ecmascript::EcmaHandleScope *scope_ {nullptr}; + JSThread *thread_; }; TEST_F(JSForinIteratorTest, Create) { - JSHandle null_handle(thread, JSTaggedValue::Null()); - JSHandle grandfather = JSObject::ObjectCreate(thread, null_handle); - EXPECT_TRUE(grandfather->GetPrototype(thread).IsNull()); + JSHandle null_handle(thread_, JSTaggedValue::Null()); + JSHandle grandfather = JSObject::ObjectCreate(thread_, null_handle); + EXPECT_TRUE(grandfather->GetPrototype(thread_).IsNull()); - JSHandle father = JSObject::ObjectCreate(thread, grandfather); + JSHandle father = JSObject::ObjectCreate(thread_, grandfather); - JSHandle son = JSObject::ObjectCreate(thread, father); + JSHandle son = JSObject::ObjectCreate(thread_, father); - JSHandle key1(thread->GetEcmaVM()->GetFactory()->NewFromString("key1")); - JSHandle key2(thread->GetEcmaVM()->GetFactory()->NewFromString("key2")); - JSHandle key3(thread->GetEcmaVM()->GetFactory()->NewFromString("key3")); - JSHandle key1_value(thread, JSTaggedValue(1)); - JSHandle key2_value(thread, JSTaggedValue(2)); - JSHandle key3_value(thread, JSTaggedValue(3)); + JSHandle key1(thread_->GetEcmaVM()->GetFactory()->NewFromString("key1")); + JSHandle key2(thread_->GetEcmaVM()->GetFactory()->NewFromString("key2")); + JSHandle key3(thread_->GetEcmaVM()->GetFactory()->NewFromString("key3")); + JSHandle key1_value(thread_, JSTaggedValue(1)); + JSHandle key2_value(thread_, JSTaggedValue(2)); + JSHandle key3_value(thread_, JSTaggedValue(3)); - JSObject::SetProperty(thread, JSHandle(grandfather), key3, key3_value); - JSObject::SetProperty(thread, JSHandle(father), key2, key2_value); + JSObject::SetProperty(thread_, JSHandle(grandfather), key3, key3_value); + JSObject::SetProperty(thread_, JSHandle(father), key2, key2_value); - JSObject::SetProperty(thread, JSHandle(son), key1, key1_value); - JSObject::SetProperty(thread, JSHandle(son), key2, key1_value); - JSObject::SetProperty(thread, JSHandle(son), key3, key1_value); + JSObject::SetProperty(thread_, JSHandle(son), key1, key1_value); + JSObject::SetProperty(thread_, JSHandle(son), key2, key1_value); + JSObject::SetProperty(thread_, JSHandle(son), key3, key1_value); - JSHandle it = thread->GetEcmaVM()->GetFactory()->NewJSForinIterator(JSHandle(son)); - std::pair n1 = JSForInIterator::NextInternal(thread, it); + JSHandle it = thread_->GetEcmaVM()->GetFactory()->NewJSForinIterator(JSHandle(son)); + std::pair n1 = JSForInIterator::NextInternal(thread_, it); EXPECT_EQ(n1.first, key1.GetTaggedValue()); EXPECT_FALSE(n1.second); - std::pair n2 = JSForInIterator::NextInternal(thread, it); + std::pair n2 = JSForInIterator::NextInternal(thread_, it); EXPECT_EQ(n2.first, key2.GetTaggedValue()); EXPECT_FALSE(n2.second); - std::pair n3 = JSForInIterator::NextInternal(thread, it); + std::pair n3 = JSForInIterator::NextInternal(thread_, it); EXPECT_EQ(n3.first, key3.GetTaggedValue()); EXPECT_FALSE(n3.second); - std::pair n4 = JSForInIterator::NextInternal(thread, it); + std::pair n4 = JSForInIterator::NextInternal(thread_, it); EXPECT_EQ(n4.first, JSTaggedValue::Undefined()); EXPECT_TRUE(n4.second); } diff --git a/tests/runtime/common/js_function_test.cpp b/tests/runtime/common/js_function_test.cpp index 94c2cadca4a7c0c6f8abaa26df6739d442216b17..c1cc6c26b7e7c67389ff7ea46fea7bba9ab79218 100644 --- a/tests/runtime/common/js_function_test.cpp +++ b/tests/runtime/common/js_function_test.cpp @@ -38,17 +38,17 @@ class JSFunctionTest : public testing::Test { public: void SetUp() override { - TestHelper::CreateEcmaVMWithScope(instance, thread, scope); + TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); } void TearDown() override { - TestHelper::DestroyEcmaVMWithScope(instance, scope); + TestHelper::DestroyEcmaVMWithScope(instance_, scope_); } - PandaVM *instance {nullptr}; - ecmascript::EcmaHandleScope *scope {nullptr}; - JSThread *thread; + PandaVM *instance_ {nullptr}; + ecmascript::EcmaHandleScope *scope_ {nullptr}; + JSThread *thread_; }; JSFunction *JSObjectCreate(JSThread *thread) @@ -60,39 +60,39 @@ JSFunction *JSObjectCreate(JSThread *thread) TEST_F(JSFunctionTest, Create) { - EcmaVM *ecma_vm = thread->GetEcmaVM(); + EcmaVM *ecma_vm = thread_->GetEcmaVM(); JSHandle env = ecma_vm->GetGlobalEnv(); - JSHandle fun_handle = thread->GetEcmaVM()->GetFactory()->NewJSFunction(env); + JSHandle fun_handle = thread_->GetEcmaVM()->GetFactory()->NewJSFunction(env); EXPECT_TRUE(*fun_handle != nullptr); EXPECT_EQ(fun_handle->GetProtoOrDynClass(), JSTaggedValue::Hole()); - JSHandle lexicalEnv = thread->GetEcmaVM()->GetFactory()->NewLexicalEnv(0); - fun_handle->SetLexicalEnv(thread, lexicalEnv.GetTaggedValue()); + JSHandle lexicalEnv = thread_->GetEcmaVM()->GetFactory()->NewLexicalEnv(0); + fun_handle->SetLexicalEnv(thread_, lexicalEnv.GetTaggedValue()); EXPECT_EQ(fun_handle->GetLexicalEnv(), lexicalEnv.GetTaggedValue()); EXPECT_TRUE(*lexicalEnv != nullptr); } TEST_F(JSFunctionTest, MakeConstructor) { - EcmaVM *ecma_vm = thread->GetEcmaVM(); + EcmaVM *ecma_vm = thread_->GetEcmaVM(); JSHandle env = ecma_vm->GetGlobalEnv(); - JSHandle func = thread->GetEcmaVM()->GetFactory()->NewJSFunction(env, static_cast(nullptr), - FunctionKind::BASE_CONSTRUCTOR); + JSHandle func = thread_->GetEcmaVM()->GetFactory()->NewJSFunction(env, static_cast(nullptr), + FunctionKind::BASE_CONSTRUCTOR); EXPECT_TRUE(*func != nullptr); JSHandle func_handle(func); func->GetJSHClass()->SetExtensible(true); - JSHandle null_handle(thread, JSTaggedValue::Null()); - JSHandle obj = JSObject::ObjectCreate(thread, null_handle); + JSHandle null_handle(thread_, JSTaggedValue::Null()); + JSHandle obj = JSObject::ObjectCreate(thread_, null_handle); JSHandle obj_value(obj); - JSFunction::MakeConstructor(thread, func, obj_value); + JSFunction::MakeConstructor(thread_, func, obj_value); - JSHandle constructor_key(thread->GetEcmaVM()->GetFactory()->NewFromString("constructor")); + JSHandle constructor_key(thread_->GetEcmaVM()->GetFactory()->NewFromString("constructor")); - JSHandle proto_key(thread->GetEcmaVM()->GetFactory()->NewFromString("prototype")); - JSTaggedValue proto = JSObject::GetProperty(thread, func_handle, proto_key).GetValue().GetTaggedValue(); + JSHandle proto_key(thread_->GetEcmaVM()->GetFactory()->NewFromString("prototype")); + JSTaggedValue proto = JSObject::GetProperty(thread_, func_handle, proto_key).GetValue().GetTaggedValue(); JSTaggedValue constructor = - JSObject::GetProperty(thread, JSHandle(obj), constructor_key).GetValue().GetTaggedValue(); + JSObject::GetProperty(thread_, JSHandle(obj), constructor_key).GetValue().GetTaggedValue(); EXPECT_EQ(constructor, func_handle.GetTaggedValue()); EXPECT_EQ(proto, obj.GetTaggedValue()); EXPECT_EQ(func->GetFunctionKind(), FunctionKind::BASE_CONSTRUCTOR); @@ -100,17 +100,17 @@ TEST_F(JSFunctionTest, MakeConstructor) TEST_F(JSFunctionTest, OrdinaryHasInstance) { - JSHandle obj_fun(thread, JSObjectCreate(thread)); + JSHandle obj_fun(thread_, JSObjectCreate(thread_)); JSHandle jsobject = - thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(obj_fun), obj_fun); - JSHandle obj(thread, jsobject.GetTaggedValue()); + thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(obj_fun), obj_fun); + JSHandle obj(thread_, jsobject.GetTaggedValue()); EXPECT_TRUE(*jsobject != nullptr); - EcmaVM *ecma_vm = thread->GetEcmaVM(); + EcmaVM *ecma_vm = thread_->GetEcmaVM(); JSHandle global_env = ecma_vm->GetGlobalEnv(); JSHandle constructor = global_env->GetObjectFunction(); - EXPECT_TRUE(ecmascript::JSFunction::OrdinaryHasInstance(thread, constructor, obj)); + EXPECT_TRUE(ecmascript::JSFunction::OrdinaryHasInstance(thread_, constructor, obj)); } JSTaggedValue TestInvokeInternal(EcmaRuntimeCallInfo *argv) @@ -123,23 +123,23 @@ JSTaggedValue TestInvokeInternal(EcmaRuntimeCallInfo *argv) TEST_F(JSFunctionTest, Invoke) { - EcmaVM *ecmaVM = thread->GetEcmaVM(); + EcmaVM *ecmaVM = thread_->GetEcmaVM(); JSHandle env = ecmaVM->GetGlobalEnv(); - JSHandle dynclass(thread, JSObjectCreate(thread)); + JSHandle dynclass(thread_, JSObjectCreate(thread_)); JSHandle callee( - thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle::Cast(dynclass), dynclass)); + thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle::Cast(dynclass), dynclass)); EXPECT_TRUE(*callee != nullptr); char keyArray[] = "invoked"; - JSHandle calleeKey(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(&keyArray[0])); + JSHandle calleeKey(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(&keyArray[0])); JSHandle calleeFunc = - thread->GetEcmaVM()->GetFactory()->NewJSFunction(env, reinterpret_cast(TestInvokeInternal)); + thread_->GetEcmaVM()->GetFactory()->NewJSFunction(env, reinterpret_cast(TestInvokeInternal)); JSHandle calleeValue(calleeFunc); - JSObject::SetProperty(thread, JSHandle(callee), calleeKey, calleeValue); + JSObject::SetProperty(thread_, JSHandle(callee), calleeKey, calleeValue); - InternalCallParams *arguments = thread->GetInternalCallParams(); + InternalCallParams *arguments = thread_->GetInternalCallParams(); arguments->MakeArgv(JSTaggedValue(1)); - JSTaggedValue res = JSFunction::Invoke(thread, callee, calleeKey, 1, arguments->GetArgv()); + JSTaggedValue res = JSFunction::Invoke(thread_, callee, calleeKey, 1, arguments->GetArgv()); JSTaggedValue ruler = BuiltinsBase::GetTaggedBoolean(true); EXPECT_EQ(res.GetRawData(), ruler.GetRawData()); @@ -147,15 +147,16 @@ TEST_F(JSFunctionTest, Invoke) TEST_F(JSFunctionTest, SetSymbolFunctionName) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle env = thread_->GetEcmaVM()->GetGlobalEnv(); JSHandle js_function = factory->NewJSFunction(env); JSHandle symbol = factory->NewPublicSymbolWithChar("name"); JSHandle name = factory->NewFromString("[name]"); - JSHandle prefix(thread, JSTaggedValue::Undefined()); - JSFunction::SetFunctionName(thread, JSHandle(js_function), JSHandle(symbol), prefix); + JSHandle prefix(thread_, JSTaggedValue::Undefined()); + JSFunction::SetFunctionName(thread_, JSHandle(js_function), JSHandle(symbol), + prefix); JSHandle function_name = - JSFunctionBase::GetFunctionName(thread, JSHandle(js_function)); + JSFunctionBase::GetFunctionName(thread_, JSHandle(js_function)); EXPECT_TRUE(function_name->IsString()); EXPECT_TRUE(EcmaString::StringsAreEqual(*(JSHandle(function_name)), *name)); } diff --git a/tests/runtime/common/js_handle_test.cpp b/tests/runtime/common/js_handle_test.cpp index 280a88e590b17dcfbecd9616b32edae04f8125be..231ae08cfc6ef24a3fd649ef21eb57a9fa4c938d 100644 --- a/tests/runtime/common/js_handle_test.cpp +++ b/tests/runtime/common/js_handle_test.cpp @@ -37,32 +37,32 @@ public: void SetUp() override { - TestHelper::CreateEcmaVMWithScope(instance, thread, scope); + TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); } void TearDown() override { - TestHelper::DestroyEcmaVMWithScope(instance, scope); + TestHelper::DestroyEcmaVMWithScope(instance_, scope_); } - PandaVM *instance {nullptr}; - ecmascript::EcmaHandleScope *scope {nullptr}; - JSThread *thread {nullptr}; + PandaVM *instance_ {nullptr}; + ecmascript::EcmaHandleScope *scope_ {nullptr}; + JSThread *thread_ {nullptr}; }; TEST_F(JSHandleTest, NewGlobalHandle) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - auto global = thread->GetEcmaGlobalStorage(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + auto global = thread_->GetEcmaGlobalStorage(); uintptr_t globalString = 0; { - [[maybe_unused]] EcmaHandleScope scope_nested(thread); + [[maybe_unused]] EcmaHandleScope scope_nested(thread_); auto string1 = factory->NewFromString("test1"); globalString = global->NewGlobalHandle(string1.GetTaggedType()); } // trigger GC - thread->GetEcmaVM()->CollectGarbage(TriggerGCType::COMPRESS_FULL_GC); + thread_->GetEcmaVM()->CollectGarbage(TriggerGCType::COMPRESS_FULL_GC); // check result EXPECT_TRUE(factory->NewFromString("test1")->Compare(*reinterpret_cast(globalString)) == 0); @@ -83,13 +83,13 @@ static void FillGlobalString(uintptr_t globalString[], int length, EcmaGlobalSto TEST_F(JSHandleTest, NewGlobalHandle1) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - auto global = thread->GetEcmaGlobalStorage(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + auto global = thread_->GetEcmaGlobalStorage(); uintptr_t globalString[600] = {0}; - FillGlobalString(globalString, 600, global, factory, thread); + FillGlobalString(globalString, 600, global, factory, thread_); // trigger GC - thread->GetEcmaVM()->CollectGarbage(TriggerGCType::COMPRESS_FULL_GC); + thread_->GetEcmaVM()->CollectGarbage(TriggerGCType::COMPRESS_FULL_GC); for (int i = 300; i > 200; i--) { global->DisposeGlobalHandle(globalString[i]); } @@ -100,7 +100,7 @@ TEST_F(JSHandleTest, NewGlobalHandle1) 0); } // trigger GC - thread->GetEcmaVM()->CollectGarbage(TriggerGCType::COMPRESS_FULL_GC); + thread_->GetEcmaVM()->CollectGarbage(TriggerGCType::COMPRESS_FULL_GC); for (int i = 301; i < 600; i++) { std::string test = "test" + std::to_string(i); EXPECT_TRUE(factory->NewFromString(test.c_str())->Compare(*reinterpret_cast(globalString[i])) == @@ -110,11 +110,11 @@ TEST_F(JSHandleTest, NewGlobalHandle1) TEST_F(JSHandleTest, DisposeGlobalHandle) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - auto global = thread->GetEcmaGlobalStorage(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + auto global = thread_->GetEcmaGlobalStorage(); uintptr_t globalString[600] = {0}; - FillGlobalString(globalString, 600, global, factory, thread); + FillGlobalString(globalString, 600, global, factory, thread_); for (int i = 512; i > 200; i--) { global->DisposeGlobalHandle(globalString[i]); } @@ -129,18 +129,18 @@ TEST_F(JSHandleTest, DisposeGlobalHandle) TEST_F(JSHandleTest, DisposeAndNewGlobalHandle) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - auto global = thread->GetEcmaGlobalStorage(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + auto global = thread_->GetEcmaGlobalStorage(); uintptr_t globalString[768] = {0}; - FillGlobalString(globalString, 768, global, factory, thread); + FillGlobalString(globalString, 768, global, factory, thread_); for (int i = 767; i > 200; i--) { global->DisposeGlobalHandle(globalString[i]); } // trigger GC - thread->GetEcmaVM()->CollectGarbage(TriggerGCType::COMPRESS_FULL_GC); + thread_->GetEcmaVM()->CollectGarbage(TriggerGCType::COMPRESS_FULL_GC); { - [[maybe_unused]] EcmaHandleScope scope_nested(thread); + [[maybe_unused]] EcmaHandleScope scope_nested(thread_); for (int i = 200; i < 400; i++) { std::string test = "test" + std::to_string(i); auto string1 = factory->NewFromString(test.c_str()); @@ -157,25 +157,25 @@ TEST_F(JSHandleTest, DisposeAndNewGlobalHandle) TEST_F(JSHandleTest, DISABLED_NewWeakGlobalHandle) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - auto global = thread->GetEcmaGlobalStorage(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + auto global = thread_->GetEcmaGlobalStorage(); uintptr_t globalString = 0; { - [[maybe_unused]] EcmaHandleScope scope_nested(thread); + [[maybe_unused]] EcmaHandleScope scope_nested(thread_); auto string1 = factory->NewFromString("test1"); globalString = global->NewGlobalHandle(string1.GetTaggedType()); globalString = global->SetWeak(globalString); // trigger GC - thread->GetEcmaVM()->CollectGarbage(TriggerGCType::COMPRESS_FULL_GC); + thread_->GetEcmaVM()->CollectGarbage(TriggerGCType::COMPRESS_FULL_GC); // check result EXPECT_TRUE(factory->NewFromString("test1")->Compare(*reinterpret_cast(globalString)) == 0); EXPECT_TRUE(global->IsWeak(globalString)); } // trigger GC - thread->GetEcmaVM()->CollectGarbage(TriggerGCType::COMPRESS_FULL_GC); + thread_->GetEcmaVM()->CollectGarbage(TriggerGCType::COMPRESS_FULL_GC); // check weak reference JSTaggedType result = *reinterpret_cast(globalString); @@ -184,12 +184,12 @@ TEST_F(JSHandleTest, DISABLED_NewWeakGlobalHandle) TEST_F(JSHandleTest, DISABLED_NewWeakGlobalHandle1) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - auto global = thread->GetEcmaGlobalStorage(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + auto global = thread_->GetEcmaGlobalStorage(); uintptr_t globalString[800] = {0}; { - [[maybe_unused]] EcmaHandleScope scope_nested(thread); + [[maybe_unused]] EcmaHandleScope scope_nested(thread_); for (int i = 0; i < 800; i++) { std::string test = "test" + std::to_string(i); auto string1 = factory->NewFromString(test.c_str()); @@ -201,7 +201,7 @@ TEST_F(JSHandleTest, DISABLED_NewWeakGlobalHandle1) global->DisposeGlobalHandle(globalString[i]); } // trigger GC - thread->GetEcmaVM()->CollectGarbage(TriggerGCType::COMPRESS_FULL_GC); + thread_->GetEcmaVM()->CollectGarbage(TriggerGCType::COMPRESS_FULL_GC); // check result for (int i = 0; i <= 200; i++) { std::string test = "test" + std::to_string(i); @@ -210,7 +210,7 @@ TEST_F(JSHandleTest, DISABLED_NewWeakGlobalHandle1) } } // trigger GC - thread->GetEcmaVM()->CollectGarbage(TriggerGCType::COMPRESS_FULL_GC); + thread_->GetEcmaVM()->CollectGarbage(TriggerGCType::COMPRESS_FULL_GC); for (int i = 601; i < 800; i++) { EXPECT_TRUE(*reinterpret_cast(globalString[i]) == JSTaggedValue::Undefined().GetRawData()); } diff --git a/tests/runtime/common/js_iterator_test.cpp b/tests/runtime/common/js_iterator_test.cpp index 62a98e21af1173b70627d90821550e3cf0cf9d4b..a45400c2efd4d87545749a51a72aafd48fc48d96 100644 --- a/tests/runtime/common/js_iterator_test.cpp +++ b/tests/runtime/common/js_iterator_test.cpp @@ -40,90 +40,90 @@ class JSIteratorTest : public testing::Test { public: void SetUp() override { - TestHelper::CreateEcmaVMWithScope(instance, thread, scope); + TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); } void TearDown() override { - TestHelper::DestroyEcmaVMWithScope(instance, scope); + TestHelper::DestroyEcmaVMWithScope(instance_, scope_); } - PandaVM *instance {nullptr}; - ecmascript::EcmaHandleScope *scope {nullptr}; - JSThread *thread; + PandaVM *instance_ {nullptr}; + ecmascript::EcmaHandleScope *scope_ {nullptr}; + JSThread *thread_; }; TEST_F(JSIteratorTest, GetIterator) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); JSHandle data(factory->NewTaggedArray(2)); - data->Set(thread, 0, JSTaggedValue(1)); - data->Set(thread, 1, JSTaggedValue(1)); - JSHandle array(JSArray::CreateArrayFromList(thread, data)); - EXPECT_TRUE(array->IsArray(thread)); - JSHandle iter(JSIterator::GetIterator(thread, array)); + data->Set(thread_, 0, JSTaggedValue(1)); + data->Set(thread_, 1, JSTaggedValue(1)); + JSHandle array(JSArray::CreateArrayFromList(thread_, data)); + EXPECT_TRUE(array->IsArray(thread_)); + JSHandle iter(JSIterator::GetIterator(thread_, array)); EXPECT_TRUE(iter->IsJSArrayIterator()); - EXPECT_TRUE(iter->GetIteratedArray().IsArray(thread)); + EXPECT_TRUE(iter->GetIteratedArray().IsArray(thread_)); } TEST_F(JSIteratorTest, IteratorNext) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - JSHandle value_str = thread->GlobalConstants()->GetHandledValueString(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle value_str = thread_->GlobalConstants()->GetHandledValueString(); JSHandle data(factory->NewTaggedArray(1)); - data->Set(thread, 0, JSTaggedValue(1)); - JSHandle array(JSArray::CreateArrayFromList(thread, data)); - JSHandle iter(JSIterator::GetIterator(thread, array)); - JSHandle result(JSIterator::IteratorNextOld(thread, iter)); - JSHandle result_value(JSObject::GetProperty(thread, result, value_str).GetValue()); + data->Set(thread_, 0, JSTaggedValue(1)); + JSHandle array(JSArray::CreateArrayFromList(thread_, data)); + JSHandle iter(JSIterator::GetIterator(thread_, array)); + JSHandle result(JSIterator::IteratorNextOld(thread_, iter)); + JSHandle result_value(JSObject::GetProperty(thread_, result, value_str).GetValue()); EXPECT_EQ(result_value->GetInt(), 1); } TEST_F(JSIteratorTest, IteratorComplete) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); JSHandle data(factory->NewTaggedArray(2)); - data->Set(thread, 0, JSTaggedValue(1)); - data->Set(thread, 1, JSTaggedValue(1)); - JSHandle array(JSArray::CreateArrayFromList(thread, data)); - JSHandle iter(JSIterator::GetIterator(thread, array)); - JSHandle result1(JSIterator::IteratorNextOld(thread, iter)); - EXPECT_EQ(false, JSIterator::IteratorComplete(thread, result1)); - JSHandle result2(JSIterator::IteratorNextOld(thread, iter)); - EXPECT_EQ(false, JSIterator::IteratorComplete(thread, result2)); - JSHandle result3(JSIterator::IteratorNextOld(thread, iter)); - EXPECT_EQ(true, JSIterator::IteratorComplete(thread, result3)); + data->Set(thread_, 0, JSTaggedValue(1)); + data->Set(thread_, 1, JSTaggedValue(1)); + JSHandle array(JSArray::CreateArrayFromList(thread_, data)); + JSHandle iter(JSIterator::GetIterator(thread_, array)); + JSHandle result1(JSIterator::IteratorNextOld(thread_, iter)); + EXPECT_EQ(false, JSIterator::IteratorComplete(thread_, result1)); + JSHandle result2(JSIterator::IteratorNextOld(thread_, iter)); + EXPECT_EQ(false, JSIterator::IteratorComplete(thread_, result2)); + JSHandle result3(JSIterator::IteratorNextOld(thread_, iter)); + EXPECT_EQ(true, JSIterator::IteratorComplete(thread_, result3)); } TEST_F(JSIteratorTest, IteratorValue) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); JSHandle data(factory->NewTaggedArray(3)); - data->Set(thread, 0, JSTaggedValue(1)); - data->Set(thread, 1, JSTaggedValue(1)); - data->Set(thread, 2, JSTaggedValue(1)); - JSHandle array(JSArray::CreateArrayFromList(thread, data)); - JSHandle iter(JSIterator::GetIterator(thread, array)); - JSHandle result(JSIterator::IteratorNextOld(thread, iter)); - JSHandle result_value(JSIterator::IteratorValue(thread, result)); + data->Set(thread_, 0, JSTaggedValue(1)); + data->Set(thread_, 1, JSTaggedValue(1)); + data->Set(thread_, 2, JSTaggedValue(1)); + JSHandle array(JSArray::CreateArrayFromList(thread_, data)); + JSHandle iter(JSIterator::GetIterator(thread_, array)); + JSHandle result(JSIterator::IteratorNextOld(thread_, iter)); + JSHandle result_value(JSIterator::IteratorValue(thread_, result)); EXPECT_EQ(result_value->GetInt(), 1); } TEST_F(JSIteratorTest, IteratorStep) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); JSHandle data(factory->NewTaggedArray(2)); - data->Set(thread, 0, JSTaggedValue(1)); - data->Set(thread, 1, JSTaggedValue(2)); - JSHandle array(JSArray::CreateArrayFromList(thread, data)); - JSHandle iter(JSIterator::GetIterator(thread, array)); - JSHandle result1(JSIterator::IteratorStep(thread, iter)); - EXPECT_EQ(JSIterator::IteratorValue(thread, result1)->GetInt(), 1); - JSHandle result2(JSIterator::IteratorStep(thread, iter)); - EXPECT_EQ(JSIterator::IteratorValue(thread, result2)->GetInt(), 2); - JSHandle result3(JSIterator::IteratorStep(thread, iter)); + data->Set(thread_, 0, JSTaggedValue(1)); + data->Set(thread_, 1, JSTaggedValue(2)); + JSHandle array(JSArray::CreateArrayFromList(thread_, data)); + JSHandle iter(JSIterator::GetIterator(thread_, array)); + JSHandle result1(JSIterator::IteratorStep(thread_, iter)); + EXPECT_EQ(JSIterator::IteratorValue(thread_, result1)->GetInt(), 1); + JSHandle result2(JSIterator::IteratorStep(thread_, iter)); + EXPECT_EQ(JSIterator::IteratorValue(thread_, result2)->GetInt(), 2); + JSHandle result3(JSIterator::IteratorStep(thread_, iter)); EXPECT_EQ(result3.GetTaggedValue(), JSTaggedValue::False()); } diff --git a/tests/runtime/common/js_map_test.cpp b/tests/runtime/common/js_map_test.cpp index b041a951a5f0f4c2f2485ff3270d75c838628e83..f099b3afbe5ab14607791f7d26fc313c4d8fb176 100644 --- a/tests/runtime/common/js_map_test.cpp +++ b/tests/runtime/common/js_map_test.cpp @@ -42,28 +42,28 @@ class JSMapTest : public testing::Test { public: void SetUp() override { - TestHelper::CreateEcmaVMWithScope(instance, thread, scope); + TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); } void TearDown() override { - TestHelper::DestroyEcmaVMWithScope(instance, scope); + TestHelper::DestroyEcmaVMWithScope(instance_, scope_); } - PandaVM *instance {nullptr}; - ecmascript::EcmaHandleScope *scope {nullptr}; - JSThread *thread; + PandaVM *instance_ {nullptr}; + ecmascript::EcmaHandleScope *scope_ {nullptr}; + JSThread *thread_; protected: JSMap *CreateMap() { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle env = thread_->GetEcmaVM()->GetGlobalEnv(); JSHandle constructor = env->GetBuiltinsMapFunction(); JSHandle map = JSHandle::Cast(factory->NewJSObjectByConstructor(JSHandle(constructor), constructor)); - JSHandle hashMap = LinkedHashMap::Create(thread); - map->SetLinkedMap(thread, hashMap); + JSHandle hashMap = LinkedHashMap::Create(thread_); + map->SetLinkedMap(thread_, hashMap); return *map; } }; @@ -76,30 +76,30 @@ TEST_F(JSMapTest, MapCreate) TEST_F(JSMapTest, AddAndHas) { - ObjectFactory *factory_ = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory_ = thread_->GetEcmaVM()->GetFactory(); // create js_map - JSHandle map(thread, CreateMap()); + JSHandle map(thread_, CreateMap()); JSHandle key(factory_->NewFromString("key")); - JSHandle value(thread, JSTaggedValue(1)); - JSMap::Set(thread, map, key, value); + JSHandle value(thread_, JSTaggedValue(1)); + JSMap::Set(thread_, map, key, value); int hash = LinkedHash::Hash(key.GetTaggedValue()); EXPECT_TRUE(map->Has(key.GetTaggedValue(), hash)); } TEST_F(JSMapTest, DeleteAndGet) { - ObjectFactory *factory_ = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory_ = thread_->GetEcmaVM()->GetFactory(); // create js_map - JSHandle map(thread, CreateMap()); + JSHandle map(thread_, CreateMap()); // add 40 keys char key_array[] = "key0"; for (int i = 0; i < 40; i++) { key_array[3] = '1' + i; JSHandle key(factory_->NewFromString(key_array)); - JSHandle value(thread, JSTaggedValue(i)); - JSMap::Set(thread, map, key, value); + JSHandle value(thread_, JSTaggedValue(i)); + JSMap::Set(thread_, map, key, value); int hash = LinkedHash::Hash(key.GetTaggedValue()); EXPECT_TRUE(map->Has(key.GetTaggedValue(), hash)); } @@ -108,7 +108,7 @@ TEST_F(JSMapTest, DeleteAndGet) key_array[3] = '1' + 8; JSHandle delete_key(factory_->NewFromString(key_array)); EXPECT_EQ(map->GetValue(8), JSTaggedValue(8)); - JSMap::Delete(thread, map, delete_key); + JSMap::Delete(thread_, map, delete_key); int hash = LinkedHash::Hash(delete_key.GetTaggedValue()); EXPECT_FALSE(map->Has(delete_key.GetTaggedValue(), hash)); EXPECT_EQ(map->GetSize(), 39); @@ -116,48 +116,48 @@ TEST_F(JSMapTest, DeleteAndGet) TEST_F(JSMapTest, Iterator) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); - JSHandle map(thread, CreateMap()); + JSHandle map(thread_, CreateMap()); for (int i = 0; i < 5; i++) { - JSHandle key(thread, JSTaggedValue(i)); - JSHandle value(thread, JSTaggedValue(i + 10)); - JSMap::Set(thread, map, key, value); + JSHandle key(thread_, JSTaggedValue(i)); + JSHandle value(thread_, JSTaggedValue(i + 10)); + JSMap::Set(thread_, map, key, value); } JSHandle key_iter(factory->NewJSMapIterator(map, IterationKind::KEY)); JSHandle value_iter(factory->NewJSMapIterator(map, IterationKind::VALUE)); JSHandle iter(factory->NewJSMapIterator(map, IterationKind::KEY_AND_VALUE)); - JSHandle index_key(thread, JSTaggedValue(0)); - JSHandle element_key(thread, JSTaggedValue(1)); + JSHandle index_key(thread_, JSTaggedValue(0)); + JSHandle element_key(thread_, JSTaggedValue(1)); - JSHandle key_result0 = JSIterator::IteratorStep(thread, key_iter); - JSHandle value_result0 = JSIterator::IteratorStep(thread, value_iter); - JSHandle result0 = JSIterator::IteratorStep(thread, iter); + JSHandle key_result0 = JSIterator::IteratorStep(thread_, key_iter); + JSHandle value_result0 = JSIterator::IteratorStep(thread_, value_iter); + JSHandle result0 = JSIterator::IteratorStep(thread_, iter); - EXPECT_EQ(0, JSIterator::IteratorValue(thread, key_result0)->GetInt()); - EXPECT_EQ(10, JSIterator::IteratorValue(thread, value_result0)->GetInt()); - JSHandle result0_handle = JSIterator::IteratorValue(thread, result0); - EXPECT_EQ(0, JSObject::GetProperty(thread, result0_handle, index_key).GetValue()->GetInt()); - EXPECT_EQ(10, JSObject::GetProperty(thread, result0_handle, element_key).GetValue()->GetInt()); + EXPECT_EQ(0, JSIterator::IteratorValue(thread_, key_result0)->GetInt()); + EXPECT_EQ(10, JSIterator::IteratorValue(thread_, value_result0)->GetInt()); + JSHandle result0_handle = JSIterator::IteratorValue(thread_, result0); + EXPECT_EQ(0, JSObject::GetProperty(thread_, result0_handle, index_key).GetValue()->GetInt()); + EXPECT_EQ(10, JSObject::GetProperty(thread_, result0_handle, element_key).GetValue()->GetInt()); - JSHandle key_result1 = JSIterator::IteratorStep(thread, key_iter); - EXPECT_EQ(1, JSIterator::IteratorValue(thread, key_result1)->GetInt()); + JSHandle key_result1 = JSIterator::IteratorStep(thread_, key_iter); + EXPECT_EQ(1, JSIterator::IteratorValue(thread_, key_result1)->GetInt()); for (int i = 0; i < 3; i++) { - JSHandle key(thread, JSTaggedValue(i)); - JSMap::Delete(thread, map, key); + JSHandle key(thread_, JSTaggedValue(i)); + JSMap::Delete(thread_, map, key); } - JSHandle key_result2 = JSIterator::IteratorStep(thread, key_iter); - EXPECT_EQ(3, JSIterator::IteratorValue(thread, key_result2)->GetInt()); - JSHandle key_result3 = JSIterator::IteratorStep(thread, key_iter); - EXPECT_EQ(4, JSIterator::IteratorValue(thread, key_result3)->GetInt()); - JSHandle key(thread, JSTaggedValue(5)); - JSMap::Set(thread, map, key, key); - JSHandle key_result4 = JSIterator::IteratorStep(thread, key_iter); - - EXPECT_EQ(5, JSIterator::IteratorValue(thread, key_result4)->GetInt()); - JSHandle key_result5 = JSIterator::IteratorStep(thread, key_iter); + JSHandle key_result2 = JSIterator::IteratorStep(thread_, key_iter); + EXPECT_EQ(3, JSIterator::IteratorValue(thread_, key_result2)->GetInt()); + JSHandle key_result3 = JSIterator::IteratorStep(thread_, key_iter); + EXPECT_EQ(4, JSIterator::IteratorValue(thread_, key_result3)->GetInt()); + JSHandle key(thread_, JSTaggedValue(5)); + JSMap::Set(thread_, map, key, key); + JSHandle key_result4 = JSIterator::IteratorStep(thread_, key_iter); + + EXPECT_EQ(5, JSIterator::IteratorValue(thread_, key_result4)->GetInt()); + JSHandle key_result5 = JSIterator::IteratorStep(thread_, key_iter); EXPECT_EQ(JSTaggedValue::False(), key_result5.GetTaggedValue()); } diff --git a/tests/runtime/common/js_object_test.cpp b/tests/runtime/common/js_object_test.cpp index ef339335762474c160e5b9b544934b97ca8d3cc5..63c92f55cf671e40a065118017666c80f20e6a23 100644 --- a/tests/runtime/common/js_object_test.cpp +++ b/tests/runtime/common/js_object_test.cpp @@ -30,17 +30,17 @@ class JSObjectTest : public testing::Test { public: void SetUp() override { - TestHelper::CreateEcmaVMWithScope(instance, thread, scope); + TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); } void TearDown() override { - TestHelper::DestroyEcmaVMWithScope(instance, scope); + TestHelper::DestroyEcmaVMWithScope(instance_, scope_); } - PandaVM *instance {nullptr}; - ecmascript::EcmaHandleScope *scope {nullptr}; - JSThread *thread; + PandaVM *instance_ {nullptr}; + ecmascript::EcmaHandleScope *scope_ {nullptr}; + JSThread *thread_; }; static JSFunction *JSObjectTestCreate(JSThread *thread) @@ -51,180 +51,181 @@ static JSFunction *JSObjectTestCreate(JSThread *thread) TEST_F(JSObjectTest, Create) { - JSHandle obj_func(thread, JSObjectTestCreate(thread)); + JSHandle obj_func(thread_, JSObjectTestCreate(thread_)); JSHandle jsobject = - thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(obj_func), obj_func); + thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(obj_func), obj_func); EXPECT_TRUE(*jsobject != nullptr); } TEST_F(JSObjectTest, SetProperty) { - JSHandle obj_func(thread, JSObjectTestCreate(thread)); + JSHandle obj_func(thread_, JSObjectTestCreate(thread_)); JSHandle jsobject = - thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(obj_func), obj_func); + thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(obj_func), obj_func); EXPECT_TRUE(*jsobject != nullptr); char array[] = "x"; - JSHandle key(thread->GetEcmaVM()->GetFactory()->NewFromString(array)); - JSHandle value(thread, JSTaggedValue(1)); + JSHandle key(thread_->GetEcmaVM()->GetFactory()->NewFromString(array)); + JSHandle value(thread_, JSTaggedValue(1)); - JSObject::SetProperty(thread, JSHandle(jsobject), key, value); - EXPECT_EQ(JSObject::GetProperty(thread, JSHandle(jsobject), key).GetValue()->GetInt(), 1); + JSObject::SetProperty(thread_, JSHandle(jsobject), key, value); + EXPECT_EQ(JSObject::GetProperty(thread_, JSHandle(jsobject), key).GetValue()->GetInt(), 1); - JSHandle value2(thread, JSTaggedValue(2)); - JSObject::SetProperty(thread, JSHandle(jsobject), key, value2); - EXPECT_EQ(JSObject::GetProperty(thread, JSHandle(jsobject), key).GetValue()->GetInt(), 2); + JSHandle value2(thread_, JSTaggedValue(2)); + JSObject::SetProperty(thread_, JSHandle(jsobject), key, value2); + EXPECT_EQ(JSObject::GetProperty(thread_, JSHandle(jsobject), key).GetValue()->GetInt(), 2); } TEST_F(JSObjectTest, GetProperty) { - JSHandle obj_func(thread, JSObjectTestCreate(thread)); + JSHandle obj_func(thread_, JSObjectTestCreate(thread_)); JSHandle obj = - thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(obj_func), obj_func); + thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(obj_func), obj_func); EXPECT_TRUE(*obj != nullptr); char array[] = "x"; - JSHandle key(thread->GetEcmaVM()->GetFactory()->NewFromString(array)); - JSHandle value(thread, JSTaggedValue(1)); + JSHandle key(thread_->GetEcmaVM()->GetFactory()->NewFromString(array)); + JSHandle value(thread_, JSTaggedValue(1)); - EXPECT_TRUE(JSObject::GetProperty(thread, JSHandle(obj), key).GetValue()->IsUndefined()); + EXPECT_TRUE(JSObject::GetProperty(thread_, JSHandle(obj), key).GetValue()->IsUndefined()); - JSObject::SetProperty(thread, JSHandle(obj), key, value); - EXPECT_EQ(JSObject::GetProperty(thread, JSHandle(obj), key).GetValue()->GetInt(), 1); + JSObject::SetProperty(thread_, JSHandle(obj), key, value); + EXPECT_EQ(JSObject::GetProperty(thread_, JSHandle(obj), key).GetValue()->GetInt(), 1); } TEST_F(JSObjectTest, DeleteProperty) { - JSHandle obj_func(thread, JSObjectTestCreate(thread)); + JSHandle obj_func(thread_, JSObjectTestCreate(thread_)); JSHandle obj = - thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(obj_func), obj_func); + thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(obj_func), obj_func); EXPECT_TRUE(*obj != nullptr); char array[] = "print"; - JSHandle key(thread->GetEcmaVM()->GetFactory()->NewFromString(array)); - JSHandle value(thread, JSTaggedValue(1)); + JSHandle key(thread_->GetEcmaVM()->GetFactory()->NewFromString(array)); + JSHandle value(thread_, JSTaggedValue(1)); - JSObject::DeleteProperty(thread, (obj), key); - EXPECT_TRUE(JSObject::GetProperty(thread, JSHandle(obj), key).GetValue()->IsUndefined()); + JSObject::DeleteProperty(thread_, (obj), key); + EXPECT_TRUE(JSObject::GetProperty(thread_, JSHandle(obj), key).GetValue()->IsUndefined()); - JSObject::SetProperty(thread, JSHandle(obj), key, value); - EXPECT_EQ(JSObject::GetProperty(thread, JSHandle(obj), key).GetValue()->GetInt(), 1); + JSObject::SetProperty(thread_, JSHandle(obj), key, value); + EXPECT_EQ(JSObject::GetProperty(thread_, JSHandle(obj), key).GetValue()->GetInt(), 1); - JSHandle key2(thread->GetEcmaVM()->GetFactory()->NewFromString("print_test")); - JSObject::SetProperty(thread, JSHandle(obj), key2, - JSHandle(thread, JSTaggedValue(10))); - EXPECT_EQ(JSObject::GetProperty(thread, JSHandle(obj), key2).GetValue()->GetInt(), 10); + JSHandle key2(thread_->GetEcmaVM()->GetFactory()->NewFromString("print_test")); + JSObject::SetProperty(thread_, JSHandle(obj), key2, + JSHandle(thread_, JSTaggedValue(10))); + EXPECT_EQ(JSObject::GetProperty(thread_, JSHandle(obj), key2).GetValue()->GetInt(), 10); - JSObject::DeleteProperty(thread, (obj), key); - EXPECT_TRUE(JSObject::GetProperty(thread, JSHandle(obj), key).GetValue()->IsUndefined()); - EXPECT_EQ(JSObject::GetProperty(thread, JSHandle(obj), key2).GetValue()->GetInt(), 10); + JSObject::DeleteProperty(thread_, (obj), key); + EXPECT_TRUE(JSObject::GetProperty(thread_, JSHandle(obj), key).GetValue()->IsUndefined()); + EXPECT_EQ(JSObject::GetProperty(thread_, JSHandle(obj), key2).GetValue()->GetInt(), 10); } TEST_F(JSObjectTest, DeletePropertyGlobal) { - JSHandle global_env = thread->GetEcmaVM()->GetGlobalEnv(); - JSHandle global(thread, global_env->GetGlobalObject()); - JSHandle print_key(thread->GetEcmaVM()->GetFactory()->NewFromString("print")); - JSHandle print_test_key(thread->GetEcmaVM()->GetFactory()->NewFromString("print_test")); + JSHandle global_env = thread_->GetEcmaVM()->GetGlobalEnv(); + JSHandle global(thread_, global_env->GetGlobalObject()); + JSHandle print_key(thread_->GetEcmaVM()->GetFactory()->NewFromString("print")); + JSHandle print_test_key(thread_->GetEcmaVM()->GetFactory()->NewFromString("print_test")); - JSHandle value = JSObject::GetProperty(thread, global, print_key).GetValue(); + JSHandle value = JSObject::GetProperty(thread_, global, print_key).GetValue(); - JSObject::SetProperty(thread, global, print_test_key, value); + JSObject::SetProperty(thread_, global, print_test_key, value); - JSTaggedValue val2 = JSObject::GetProperty(thread, global, print_test_key).GetValue().GetTaggedValue(); + JSTaggedValue val2 = JSObject::GetProperty(thread_, global, print_test_key).GetValue().GetTaggedValue(); EXPECT_EQ(val2, value.GetTaggedValue()); - JSTaggedValue::DeletePropertyOrThrow(thread, global, print_test_key); - JSTaggedValue val3 = JSObject::GetProperty(thread, global, print_key).GetValue().GetTaggedValue(); + JSTaggedValue::DeletePropertyOrThrow(thread_, global, print_test_key); + JSTaggedValue val3 = JSObject::GetProperty(thread_, global, print_key).GetValue().GetTaggedValue(); EXPECT_NE(val3, JSTaggedValue::Undefined()); } TEST_F(JSObjectTest, GetPropertyInPrototypeChain) { - JSHandle null_handle(thread, JSTaggedValue::Null()); - JSHandle grandfather = JSObject::ObjectCreate(thread, null_handle); - JSHandle father = JSObject::ObjectCreate(thread, grandfather); - JSHandle son = JSObject::ObjectCreate(thread, father); - - JSHandle son_key(thread->GetEcmaVM()->GetFactory()->NewFromString("key1")); - JSHandle father_key(thread->GetEcmaVM()->GetFactory()->NewFromString("key2")); - JSHandle grandfather_key(thread->GetEcmaVM()->GetFactory()->NewFromString("key3")); - JSHandle son_value(thread, JSTaggedValue(1)); - JSHandle father_value(thread, JSTaggedValue(2)); - JSHandle grandfather_value(thread, JSTaggedValue(3)); - - JSObject::SetProperty(thread, JSHandle(son), son_key, son_value); - JSObject::SetProperty(thread, JSHandle(father), father_key, father_value); - JSObject::SetProperty(thread, JSHandle(grandfather), grandfather_key, grandfather_value); + JSHandle null_handle(thread_, JSTaggedValue::Null()); + JSHandle grandfather = JSObject::ObjectCreate(thread_, null_handle); + JSHandle father = JSObject::ObjectCreate(thread_, grandfather); + JSHandle son = JSObject::ObjectCreate(thread_, father); + + JSHandle son_key(thread_->GetEcmaVM()->GetFactory()->NewFromString("key1")); + JSHandle father_key(thread_->GetEcmaVM()->GetFactory()->NewFromString("key2")); + JSHandle grandfather_key(thread_->GetEcmaVM()->GetFactory()->NewFromString("key3")); + JSHandle son_value(thread_, JSTaggedValue(1)); + JSHandle father_value(thread_, JSTaggedValue(2)); + JSHandle grandfather_value(thread_, JSTaggedValue(3)); + + JSObject::SetProperty(thread_, JSHandle(son), son_key, son_value); + JSObject::SetProperty(thread_, JSHandle(father), father_key, father_value); + JSObject::SetProperty(thread_, JSHandle(grandfather), grandfather_key, grandfather_value); EXPECT_EQ(son_value.GetTaggedValue(), - JSObject::GetProperty(thread, JSHandle(son), son_key).GetValue().GetTaggedValue()); + JSObject::GetProperty(thread_, JSHandle(son), son_key).GetValue().GetTaggedValue()); EXPECT_EQ(father_value.GetTaggedValue(), - JSObject::GetProperty(thread, JSHandle(son), father_key).GetValue().GetTaggedValue()); - EXPECT_EQ(grandfather_value.GetTaggedValue(), - JSObject::GetProperty(thread, JSHandle(son), grandfather_key).GetValue().GetTaggedValue()); + JSObject::GetProperty(thread_, JSHandle(son), father_key).GetValue().GetTaggedValue()); + EXPECT_EQ( + grandfather_value.GetTaggedValue(), + JSObject::GetProperty(thread_, JSHandle(son), grandfather_key).GetValue().GetTaggedValue()); } TEST_F(JSObjectTest, PropertyAttribute) { - JSHandle constructor(thread, JSObjectTestCreate(thread)); + JSHandle constructor(thread_, JSObjectTestCreate(thread_)); JSHandle obj1 = - thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(constructor), constructor); + thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(constructor), constructor); JSHandle obj2 = - thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(constructor), constructor); + thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(constructor), constructor); - JSHandle key1(thread->GetEcmaVM()->GetFactory()->NewFromString("key3")); - JSHandle key2(thread->GetEcmaVM()->GetFactory()->NewFromString("key3")); + JSHandle key1(thread_->GetEcmaVM()->GetFactory()->NewFromString("key3")); + JSHandle key2(thread_->GetEcmaVM()->GetFactory()->NewFromString("key3")); - JSHandle value1(thread, JSTaggedValue(1)); - JSHandle value2(thread, JSTaggedValue(2)); + JSHandle value1(thread_, JSTaggedValue(1)); + JSHandle value2(thread_, JSTaggedValue(2)); // test set property - PropertyDescriptor desc(thread); + PropertyDescriptor desc(thread_); desc.SetValue(value1); desc.SetWritable(false); - JSObject::DefineOwnProperty(thread, obj1, key1, desc); - JSObject::SetProperty(thread, JSHandle(obj1), key1, value2); - JSObject::SetProperty(thread, JSHandle(obj2), key1, value1); - JSObject::SetProperty(thread, JSHandle(obj2), key1, value2); - EXPECT_EQ(JSObject::GetProperty(thread, JSHandle(obj1), key1).GetValue().GetTaggedValue(), + JSObject::DefineOwnProperty(thread_, obj1, key1, desc); + JSObject::SetProperty(thread_, JSHandle(obj1), key1, value2); + JSObject::SetProperty(thread_, JSHandle(obj2), key1, value1); + JSObject::SetProperty(thread_, JSHandle(obj2), key1, value2); + EXPECT_EQ(JSObject::GetProperty(thread_, JSHandle(obj1), key1).GetValue().GetTaggedValue(), value1.GetTaggedValue()); - EXPECT_EQ(JSObject::GetProperty(thread, JSHandle(obj2), key1).GetValue().GetTaggedValue(), + EXPECT_EQ(JSObject::GetProperty(thread_, JSHandle(obj2), key1).GetValue().GetTaggedValue(), value2.GetTaggedValue()); // test delete property - PropertyDescriptor desc1(thread); + PropertyDescriptor desc1(thread_); desc1.SetValue(value1); desc1.SetConfigurable(false); - JSObject::DefineOwnProperty(thread, obj1, key2, desc1); - JSObject::SetProperty(thread, JSHandle(obj1), key2, value1); - JSObject::SetProperty(thread, JSHandle(obj2), key2, value1); - JSObject::DeleteProperty(thread, (obj1), key2); - JSObject::DeleteProperty(thread, (obj2), key2); - EXPECT_EQ(JSObject::GetProperty(thread, JSHandle(obj1), key2).GetValue().GetTaggedValue(), + JSObject::DefineOwnProperty(thread_, obj1, key2, desc1); + JSObject::SetProperty(thread_, JSHandle(obj1), key2, value1); + JSObject::SetProperty(thread_, JSHandle(obj2), key2, value1); + JSObject::DeleteProperty(thread_, (obj1), key2); + JSObject::DeleteProperty(thread_, (obj2), key2); + EXPECT_EQ(JSObject::GetProperty(thread_, JSHandle(obj1), key2).GetValue().GetTaggedValue(), value1.GetTaggedValue()); - EXPECT_EQ(JSObject::GetProperty(thread, JSHandle(obj2), key2).GetValue().GetTaggedValue(), + EXPECT_EQ(JSObject::GetProperty(thread_, JSHandle(obj2), key2).GetValue().GetTaggedValue(), JSTaggedValue::Undefined()); } TEST_F(JSObjectTest, CreateDataProperty) { - JSHandle obj_func(thread, JSObjectTestCreate(thread)); + JSHandle obj_func(thread_, JSObjectTestCreate(thread_)); JSHandle obj = - thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(obj_func), obj_func); + thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(obj_func), obj_func); EXPECT_TRUE(*obj != nullptr); char array[] = "x"; - JSHandle key(thread->GetEcmaVM()->GetFactory()->NewFromString(array)); - JSHandle value(thread, JSTaggedValue(1)); + JSHandle key(thread_->GetEcmaVM()->GetFactory()->NewFromString(array)); + JSHandle value(thread_, JSTaggedValue(1)); - bool success = JSObject::CreateDataProperty(thread, obj, key, value); + bool success = JSObject::CreateDataProperty(thread_, obj, key, value); EXPECT_TRUE(success); - success = JSTaggedValue::HasOwnProperty(thread, JSHandle::Cast(obj), key); + success = JSTaggedValue::HasOwnProperty(thread_, JSHandle::Cast(obj), key); EXPECT_TRUE(success); - PropertyDescriptor desc(thread); - success = JSObject::GetOwnProperty(thread, obj, key, desc); + PropertyDescriptor desc(thread_); + success = JSObject::GetOwnProperty(thread_, obj, key, desc); EXPECT_TRUE(success); EXPECT_EQ(true, desc.IsWritable()); EXPECT_EQ(true, desc.IsEnumerable()); @@ -233,23 +234,23 @@ TEST_F(JSObjectTest, CreateDataProperty) TEST_F(JSObjectTest, CreateMethodProperty) { - JSHandle obj_func(thread, JSObjectTestCreate(thread)); + JSHandle obj_func(thread_, JSObjectTestCreate(thread_)); JSHandle obj = - thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(obj_func), obj_func); + thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(obj_func), obj_func); EXPECT_TRUE(*obj != nullptr); char array[] = "x"; - JSHandle key(thread->GetEcmaVM()->GetFactory()->NewFromString(array)); - JSHandle value(thread, JSTaggedValue(1)); + JSHandle key(thread_->GetEcmaVM()->GetFactory()->NewFromString(array)); + JSHandle value(thread_, JSTaggedValue(1)); - bool success = JSObject::CreateMethodProperty(thread, obj, key, value); + bool success = JSObject::CreateMethodProperty(thread_, obj, key, value); EXPECT_TRUE(success); - success = JSTaggedValue::HasOwnProperty(thread, JSHandle::Cast(obj), key); + success = JSTaggedValue::HasOwnProperty(thread_, JSHandle::Cast(obj), key); EXPECT_TRUE(success); - PropertyDescriptor desc(thread); - success = JSObject::GetOwnProperty(thread, obj, key, desc); + PropertyDescriptor desc(thread_); + success = JSObject::GetOwnProperty(thread_, obj, key, desc); EXPECT_TRUE(success); EXPECT_EQ(true, desc.IsWritable()); EXPECT_EQ(false, desc.IsEnumerable()); @@ -258,251 +259,251 @@ TEST_F(JSObjectTest, CreateMethodProperty) TEST_F(JSObjectTest, DefinePropertyOrThrow) { - JSHandle obj_func(thread, JSObjectTestCreate(thread)); + JSHandle obj_func(thread_, JSObjectTestCreate(thread_)); JSHandle obj = - thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(obj_func), obj_func); + thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(obj_func), obj_func); EXPECT_TRUE(*obj != nullptr); char array[] = "x"; - JSHandle key(thread->GetEcmaVM()->GetFactory()->NewFromString(array)); + JSHandle key(thread_->GetEcmaVM()->GetFactory()->NewFromString(array)); - PropertyDescriptor desc1(thread, JSHandle(thread, JSTaggedValue(1)), true, true, true); - bool success = JSTaggedValue::DefinePropertyOrThrow(thread, JSHandle(obj), key, desc1); + PropertyDescriptor desc1(thread_, JSHandle(thread_, JSTaggedValue(1)), true, true, true); + bool success = JSTaggedValue::DefinePropertyOrThrow(thread_, JSHandle(obj), key, desc1); EXPECT_TRUE(success); - PropertyDescriptor desc_res1(thread); - success = JSObject::GetOwnProperty(thread, obj, key, desc_res1); + PropertyDescriptor desc_res1(thread_); + success = JSObject::GetOwnProperty(thread_, obj, key, desc_res1); EXPECT_TRUE(success); EXPECT_EQ(1, desc_res1.GetValue()->GetInt()); EXPECT_EQ(true, desc_res1.IsWritable()); EXPECT_EQ(true, desc_res1.IsEnumerable()); EXPECT_EQ(true, desc_res1.IsConfigurable()); - PropertyDescriptor desc2(thread, false, true, true); - success = JSTaggedValue::DefinePropertyOrThrow(thread, JSHandle(obj), key, desc2); + PropertyDescriptor desc2(thread_, false, true, true); + success = JSTaggedValue::DefinePropertyOrThrow(thread_, JSHandle(obj), key, desc2); EXPECT_TRUE(success); - PropertyDescriptor desc_res2(thread); - success = JSObject::GetOwnProperty(thread, obj, key, desc_res2); + PropertyDescriptor desc_res2(thread_); + success = JSObject::GetOwnProperty(thread_, obj, key, desc_res2); EXPECT_TRUE(success); EXPECT_EQ(1, desc_res2.GetValue()->GetInt()); EXPECT_EQ(false, desc_res2.IsWritable()); EXPECT_EQ(true, desc_res2.IsEnumerable()); EXPECT_EQ(true, desc_res2.IsConfigurable()); - PropertyDescriptor desc3(thread); + PropertyDescriptor desc3(thread_); desc3.SetWritable(false); desc3.SetEnumerable(false); desc3.SetConfigurable(false); - success = JSTaggedValue::DefinePropertyOrThrow(thread, JSHandle(obj), key, desc3); + success = JSTaggedValue::DefinePropertyOrThrow(thread_, JSHandle(obj), key, desc3); EXPECT_TRUE(success); - PropertyDescriptor desc_res3(thread); - success = JSObject::GetOwnProperty(thread, obj, key, desc_res3); + PropertyDescriptor desc_res3(thread_); + success = JSObject::GetOwnProperty(thread_, obj, key, desc_res3); EXPECT_TRUE(success); EXPECT_EQ(1, desc_res3.GetValue()->GetInt()); EXPECT_EQ(false, desc_res3.IsWritable()); EXPECT_EQ(false, desc_res3.IsEnumerable()); EXPECT_EQ(false, desc_res3.IsConfigurable()); - PropertyDescriptor desc4(thread, JSHandle(thread, JSTaggedValue(2))); - success = JSTaggedValue::DefinePropertyOrThrow(thread, JSHandle(obj), key, desc4); + PropertyDescriptor desc4(thread_, JSHandle(thread_, JSTaggedValue(2))); + success = JSTaggedValue::DefinePropertyOrThrow(thread_, JSHandle(obj), key, desc4); EXPECT_FALSE(success); } TEST_F(JSObjectTest, HasProperty) { - JSHandle obj_func(thread, JSObjectTestCreate(thread)); + JSHandle obj_func(thread_, JSObjectTestCreate(thread_)); JSHandle obj = - thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(obj_func), obj_func); + thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(obj_func), obj_func); EXPECT_TRUE(*obj != nullptr); char array[] = "x"; - JSHandle key(thread->GetEcmaVM()->GetFactory()->NewFromString(array)); - JSHandle value(thread, JSTaggedValue(1)); + JSHandle key(thread_->GetEcmaVM()->GetFactory()->NewFromString(array)); + JSHandle value(thread_, JSTaggedValue(1)); - bool flag = JSObject::HasProperty(thread, obj, key); + bool flag = JSObject::HasProperty(thread_, obj, key); EXPECT_FALSE(flag); - JSObject::SetProperty(thread, JSHandle(obj), key, value); - flag = JSObject::HasProperty(thread, obj, key); + JSObject::SetProperty(thread_, JSHandle(obj), key, value); + flag = JSObject::HasProperty(thread_, obj, key); EXPECT_TRUE(flag); - JSObject::DeleteProperty(thread, (obj), key); - flag = JSObject::HasProperty(thread, obj, key); + JSObject::DeleteProperty(thread_, (obj), key); + flag = JSObject::HasProperty(thread_, obj, key); EXPECT_FALSE(flag); } TEST_F(JSObjectTest, HasPropertyWithProtoType) { - JSHandle null_handle(thread, JSTaggedValue::Null()); - JSHandle grandfather = JSObject::ObjectCreate(thread, null_handle); - JSHandle father = JSObject::ObjectCreate(thread, grandfather); - JSHandle son = JSObject::ObjectCreate(thread, father); - - auto test_grand = grandfather->GetPrototype(thread); - auto test_father = father->GetPrototype(thread); - auto test_son = son->GetPrototype(thread); + JSHandle null_handle(thread_, JSTaggedValue::Null()); + JSHandle grandfather = JSObject::ObjectCreate(thread_, null_handle); + JSHandle father = JSObject::ObjectCreate(thread_, grandfather); + JSHandle son = JSObject::ObjectCreate(thread_, father); + + auto test_grand = grandfather->GetPrototype(thread_); + auto test_father = father->GetPrototype(thread_); + auto test_son = son->GetPrototype(thread_); EXPECT_TRUE(test_son != test_father); EXPECT_TRUE(test_grand != test_father); - JSHandle son_key(thread->GetEcmaVM()->GetFactory()->NewFromString("key1")); - JSHandle father_key(thread->GetEcmaVM()->GetFactory()->NewFromString("key2")); - JSHandle grandfather_key(thread->GetEcmaVM()->GetFactory()->NewFromString("key3")); - JSHandle son_value(thread, JSTaggedValue(1)); - JSHandle father_value(thread, JSTaggedValue(2)); - JSHandle grandfather_value(thread, JSTaggedValue(3)); - - JSObject::SetProperty(thread, JSHandle(son), son_key, son_value); - JSObject::SetProperty(thread, JSHandle(father), father_key, father_value); - JSObject::SetProperty(thread, JSHandle(grandfather), grandfather_key, grandfather_value); - - bool flag = JSObject::HasProperty(thread, son, son_key); + JSHandle son_key(thread_->GetEcmaVM()->GetFactory()->NewFromString("key1")); + JSHandle father_key(thread_->GetEcmaVM()->GetFactory()->NewFromString("key2")); + JSHandle grandfather_key(thread_->GetEcmaVM()->GetFactory()->NewFromString("key3")); + JSHandle son_value(thread_, JSTaggedValue(1)); + JSHandle father_value(thread_, JSTaggedValue(2)); + JSHandle grandfather_value(thread_, JSTaggedValue(3)); + + JSObject::SetProperty(thread_, JSHandle(son), son_key, son_value); + JSObject::SetProperty(thread_, JSHandle(father), father_key, father_value); + JSObject::SetProperty(thread_, JSHandle(grandfather), grandfather_key, grandfather_value); + + bool flag = JSObject::HasProperty(thread_, son, son_key); EXPECT_TRUE(flag); - flag = JSObject::HasProperty(thread, son, father_key); + flag = JSObject::HasProperty(thread_, son, father_key); EXPECT_TRUE(flag); - flag = JSObject::HasProperty(thread, son, grandfather_key); + flag = JSObject::HasProperty(thread_, son, grandfather_key); EXPECT_TRUE(flag); } TEST_F(JSObjectTest, HasOwnProperty) { - JSHandle null_handle(thread, JSTaggedValue::Null()); - JSHandle grandfather = JSObject::ObjectCreate(thread, null_handle); - JSHandle father = JSObject::ObjectCreate(thread, grandfather); - JSHandle son = JSObject::ObjectCreate(thread, father); - - JSHandle son_key(thread->GetEcmaVM()->GetFactory()->NewFromString("key1")); - JSHandle father_key(thread->GetEcmaVM()->GetFactory()->NewFromString("key2")); - JSHandle grandfather_key(thread->GetEcmaVM()->GetFactory()->NewFromString("key3")); - JSHandle son_value(thread, JSTaggedValue(1)); - JSHandle father_value(thread, JSTaggedValue(2)); - JSHandle grandfather_value(thread, JSTaggedValue(3)); - - JSObject::SetProperty(thread, JSHandle(son), son_key, son_value); - JSObject::SetProperty(thread, JSHandle(father), father_key, father_value); - JSObject::SetProperty(thread, JSHandle(grandfather), grandfather_key, grandfather_value); - - bool flag = JSTaggedValue::HasOwnProperty(thread, JSHandle::Cast(son), son_key); + JSHandle null_handle(thread_, JSTaggedValue::Null()); + JSHandle grandfather = JSObject::ObjectCreate(thread_, null_handle); + JSHandle father = JSObject::ObjectCreate(thread_, grandfather); + JSHandle son = JSObject::ObjectCreate(thread_, father); + + JSHandle son_key(thread_->GetEcmaVM()->GetFactory()->NewFromString("key1")); + JSHandle father_key(thread_->GetEcmaVM()->GetFactory()->NewFromString("key2")); + JSHandle grandfather_key(thread_->GetEcmaVM()->GetFactory()->NewFromString("key3")); + JSHandle son_value(thread_, JSTaggedValue(1)); + JSHandle father_value(thread_, JSTaggedValue(2)); + JSHandle grandfather_value(thread_, JSTaggedValue(3)); + + JSObject::SetProperty(thread_, JSHandle(son), son_key, son_value); + JSObject::SetProperty(thread_, JSHandle(father), father_key, father_value); + JSObject::SetProperty(thread_, JSHandle(grandfather), grandfather_key, grandfather_value); + + bool flag = JSTaggedValue::HasOwnProperty(thread_, JSHandle::Cast(son), son_key); EXPECT_TRUE(flag); - flag = JSTaggedValue::HasOwnProperty(thread, JSHandle::Cast(son), father_key); + flag = JSTaggedValue::HasOwnProperty(thread_, JSHandle::Cast(son), father_key); EXPECT_FALSE(flag); - flag = JSTaggedValue::HasOwnProperty(thread, JSHandle::Cast(son), grandfather_key); + flag = JSTaggedValue::HasOwnProperty(thread_, JSHandle::Cast(son), grandfather_key); EXPECT_FALSE(flag); } TEST_F(JSObjectTest, GetOwnPropertyKeys) { - JSHandle constructor(thread, JSObjectTestCreate(thread)); + JSHandle constructor(thread_, JSObjectTestCreate(thread_)); JSHandle obj = - thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(constructor), constructor); - - JSHandle key1(thread->GetEcmaVM()->GetFactory()->NewFromString("x")); - JSHandle key2(thread->GetEcmaVM()->GetFactory()->NewFromString("y")); - JSHandle key3(thread->GetEcmaVM()->GetFactory()->NewFromString("3")); - JSHandle key4(thread->GetEcmaVM()->GetFactory()->NewFromString("4")); - JSHandle value1(thread, JSTaggedValue(1)); - JSHandle value2(thread, JSTaggedValue(2)); - JSHandle value3(thread, JSTaggedValue(3)); - JSHandle value4(thread, JSTaggedValue(4)); - - JSObject::SetProperty(thread, JSHandle(obj), key1, value1); - JSObject::SetProperty(thread, JSHandle(obj), key2, value2); - JSObject::SetProperty(thread, JSHandle(obj), key3, value3); - JSObject::SetProperty(thread, JSHandle(obj), key4, value4); - - JSHandle array = JSObject::GetOwnPropertyKeys(thread, obj); + thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(constructor), constructor); + + JSHandle key1(thread_->GetEcmaVM()->GetFactory()->NewFromString("x")); + JSHandle key2(thread_->GetEcmaVM()->GetFactory()->NewFromString("y")); + JSHandle key3(thread_->GetEcmaVM()->GetFactory()->NewFromString("3")); + JSHandle key4(thread_->GetEcmaVM()->GetFactory()->NewFromString("4")); + JSHandle value1(thread_, JSTaggedValue(1)); + JSHandle value2(thread_, JSTaggedValue(2)); + JSHandle value3(thread_, JSTaggedValue(3)); + JSHandle value4(thread_, JSTaggedValue(4)); + + JSObject::SetProperty(thread_, JSHandle(obj), key1, value1); + JSObject::SetProperty(thread_, JSHandle(obj), key2, value2); + JSObject::SetProperty(thread_, JSHandle(obj), key3, value3); + JSObject::SetProperty(thread_, JSHandle(obj), key4, value4); + + JSHandle array = JSObject::GetOwnPropertyKeys(thread_, obj); int length = array->GetLength(); EXPECT_EQ(length, 4); int sum = 0; for (int i = 0; i < length; i++) { - JSHandle key(thread, array->Get(i)); - sum += JSObject::GetProperty(thread, JSHandle(obj), key).GetValue()->GetInt(); + JSHandle key(thread_, array->Get(i)); + sum += JSObject::GetProperty(thread_, JSHandle(obj), key).GetValue()->GetInt(); } EXPECT_EQ(sum, 10); } TEST_F(JSObjectTest, ObjectCreateMethod) { - JSHandle null_handle(thread, JSTaggedValue::Null()); - JSHandle grandfather = JSObject::ObjectCreate(thread, null_handle); - JSHandle father = JSObject::ObjectCreate(thread, grandfather); - JSHandle son = JSObject::ObjectCreate(thread, father); - - EXPECT_EQ(son->GetPrototype(thread), father.GetTaggedValue()); - EXPECT_EQ(father->GetPrototype(thread), grandfather.GetTaggedValue()); - EXPECT_EQ(grandfather->GetPrototype(thread), JSTaggedValue::Null()); + JSHandle null_handle(thread_, JSTaggedValue::Null()); + JSHandle grandfather = JSObject::ObjectCreate(thread_, null_handle); + JSHandle father = JSObject::ObjectCreate(thread_, grandfather); + JSHandle son = JSObject::ObjectCreate(thread_, father); + + EXPECT_EQ(son->GetPrototype(thread_), father.GetTaggedValue()); + EXPECT_EQ(father->GetPrototype(thread_), grandfather.GetTaggedValue()); + EXPECT_EQ(grandfather->GetPrototype(thread_), JSTaggedValue::Null()); } TEST_F(JSObjectTest, GetMethod) { - JSHandle null_handle(thread, JSTaggedValue::Null()); - JSHandle obj = JSObject::ObjectCreate(thread, null_handle); - JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); - JSHandle func(thread->GetEcmaVM()->GetFactory()->NewJSFunction(env)); + JSHandle null_handle(thread_, JSTaggedValue::Null()); + JSHandle obj = JSObject::ObjectCreate(thread_, null_handle); + JSHandle env = thread_->GetEcmaVM()->GetGlobalEnv(); + JSHandle func(thread_->GetEcmaVM()->GetFactory()->NewJSFunction(env)); EXPECT_TRUE(*func != nullptr); - JSHandle key(thread->GetEcmaVM()->GetFactory()->NewFromString("1")); - JSObject::SetProperty(thread, JSHandle(obj), key, func); - EXPECT_EQ(JSObject::GetProperty(thread, JSHandle(obj), key).GetValue().GetTaggedValue(), + JSHandle key(thread_->GetEcmaVM()->GetFactory()->NewFromString("1")); + JSObject::SetProperty(thread_, JSHandle(obj), key, func); + EXPECT_EQ(JSObject::GetProperty(thread_, JSHandle(obj), key).GetValue().GetTaggedValue(), func.GetTaggedValue()); } TEST_F(JSObjectTest, EnumerableOwnNames) { - JSHandle obj_func(thread, JSObjectTestCreate(thread)); + JSHandle obj_func(thread_, JSObjectTestCreate(thread_)); JSHandle obj = - thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(obj_func), obj_func); + thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(obj_func), obj_func); EXPECT_TRUE(*obj != nullptr); CString tag_c_str = "x"; - JSHandle tag_string = thread->GetEcmaVM()->GetFactory()->NewFromString(&tag_c_str[0]); + JSHandle tag_string = thread_->GetEcmaVM()->GetFactory()->NewFromString(&tag_c_str[0]); JSHandle key(tag_string); - JSHandle value(thread, JSTaggedValue(1)); + JSHandle value(thread_, JSTaggedValue(1)); - JSObject::SetProperty(thread, JSHandle(obj), key, value); - EXPECT_EQ(JSObject::GetProperty(thread, JSHandle(obj), key).GetValue()->GetInt(), 1); + JSObject::SetProperty(thread_, JSHandle(obj), key, value); + EXPECT_EQ(JSObject::GetProperty(thread_, JSHandle(obj), key).GetValue()->GetInt(), 1); - JSHandle names = JSObject::EnumerableOwnNames(thread, obj); + JSHandle names = JSObject::EnumerableOwnNames(thread_, obj); - JSHandle key_from_names(thread, JSTaggedValue(names->Get(0))); - EXPECT_EQ(JSObject::GetProperty(thread, JSHandle(obj), key_from_names).GetValue()->GetInt(), 1); + JSHandle key_from_names(thread_, JSTaggedValue(names->Get(0))); + EXPECT_EQ(JSObject::GetProperty(thread_, JSHandle(obj), key_from_names).GetValue()->GetInt(), 1); - PropertyDescriptor desc_no_enum(thread); + PropertyDescriptor desc_no_enum(thread_); desc_no_enum.SetEnumerable(false); - JSTaggedValue::DefinePropertyOrThrow(thread, JSHandle(obj), key, desc_no_enum); - EXPECT_EQ(JSObject::GetProperty(thread, JSHandle(obj), key).GetValue()->GetInt(), 1); + JSTaggedValue::DefinePropertyOrThrow(thread_, JSHandle(obj), key, desc_no_enum); + EXPECT_EQ(JSObject::GetProperty(thread_, JSHandle(obj), key).GetValue()->GetInt(), 1); - JSHandle names_no_enum = JSObject::EnumerableOwnNames(thread, obj); + JSHandle names_no_enum = JSObject::EnumerableOwnNames(thread_, obj); EXPECT_TRUE(names_no_enum->GetLength() == 0); - PropertyDescriptor desc_enum(thread); + PropertyDescriptor desc_enum(thread_); desc_enum.SetConfigurable(false); desc_enum.SetEnumerable(true); - JSTaggedValue::DefinePropertyOrThrow(thread, JSHandle(obj), key, desc_enum); - EXPECT_EQ(JSObject::GetProperty(thread, JSHandle(obj), key).GetValue()->GetInt(), 1); + JSTaggedValue::DefinePropertyOrThrow(thread_, JSHandle(obj), key, desc_enum); + EXPECT_EQ(JSObject::GetProperty(thread_, JSHandle(obj), key).GetValue()->GetInt(), 1); - JSHandle names_no_config = JSObject::EnumerableOwnNames(thread, obj); + JSHandle names_no_config = JSObject::EnumerableOwnNames(thread_, obj); - JSHandle key_no_config(thread, JSTaggedValue(names_no_config->Get(0))); - EXPECT_EQ(JSObject::GetProperty(thread, JSHandle(obj), key_no_config).GetValue()->GetInt(), 1); + JSHandle key_no_config(thread_, JSTaggedValue(names_no_config->Get(0))); + EXPECT_EQ(JSObject::GetProperty(thread_, JSHandle(obj), key_no_config).GetValue()->GetInt(), 1); } TEST_F(JSObjectTest, SetIntegrityLevelSealed) { - JSHandle dynclass1(thread, JSObjectTestCreate(thread)); + JSHandle dynclass1(thread_, JSObjectTestCreate(thread_)); JSHandle obj1 = - thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(dynclass1), dynclass1); + thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(dynclass1), dynclass1); EXPECT_TRUE(*obj1 != nullptr); CString undefined_c_str = "x"; - JSHandle key1(thread->GetEcmaVM()->GetFactory()->NewFromString(&undefined_c_str[0])); - JSHandle value1(thread, JSTaggedValue(1)); - JSObject::SetProperty(thread, JSHandle(obj1), key1, value1); + JSHandle key1(thread_->GetEcmaVM()->GetFactory()->NewFromString(&undefined_c_str[0])); + JSHandle value1(thread_, JSTaggedValue(1)); + JSObject::SetProperty(thread_, JSHandle(obj1), key1, value1); // test SetIntegrityLevel::SEALED JSHandle jsobject(obj1); - bool status1 = JSObject::SetIntegrityLevel(thread, jsobject, IntegrityLevel::SEALED); + bool status1 = JSObject::SetIntegrityLevel(thread_, jsobject, IntegrityLevel::SEALED); EXPECT_TRUE(status1); - EXPECT_EQ(JSObject::GetProperty(thread, JSHandle(obj1), key1).GetValue().GetTaggedValue(), + EXPECT_EQ(JSObject::GetProperty(thread_, JSHandle(obj1), key1).GetValue().GetTaggedValue(), value1.GetTaggedValue()); - PropertyDescriptor desc1(thread); - bool success1 = JSObject::GetOwnProperty(thread, jsobject, key1, desc1); + PropertyDescriptor desc1(thread_); + bool success1 = JSObject::GetOwnProperty(thread_, jsobject, key1, desc1); EXPECT_TRUE(success1); EXPECT_EQ(true, desc1.IsWritable()); EXPECT_EQ(true, desc1.IsEnumerable()); @@ -511,23 +512,23 @@ TEST_F(JSObjectTest, SetIntegrityLevelSealed) TEST_F(JSObjectTest, SetIntegrityLevelFrozen) { - JSHandle dynclass1(thread, JSObjectTestCreate(thread)); + JSHandle dynclass1(thread_, JSObjectTestCreate(thread_)); JSHandle obj1 = - thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(dynclass1), dynclass1); + thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(dynclass1), dynclass1); EXPECT_TRUE(*obj1 != nullptr); CString undefined_c_str = "x"; - JSHandle key1(thread->GetEcmaVM()->GetFactory()->NewFromString(&undefined_c_str[0])); - JSHandle value1(thread, JSTaggedValue(1)); - JSObject::SetProperty(thread, JSHandle(obj1), key1, value1); + JSHandle key1(thread_->GetEcmaVM()->GetFactory()->NewFromString(&undefined_c_str[0])); + JSHandle value1(thread_, JSTaggedValue(1)); + JSObject::SetProperty(thread_, JSHandle(obj1), key1, value1); // test SetIntegrityLevel::FROZEN - bool status1 = JSObject::SetIntegrityLevel(thread, obj1, IntegrityLevel::FROZEN); + bool status1 = JSObject::SetIntegrityLevel(thread_, obj1, IntegrityLevel::FROZEN); EXPECT_TRUE(status1); - EXPECT_EQ(JSObject::GetProperty(thread, JSHandle(obj1), key1).GetValue().GetTaggedValue(), + EXPECT_EQ(JSObject::GetProperty(thread_, JSHandle(obj1), key1).GetValue().GetTaggedValue(), value1.GetTaggedValue()); - PropertyDescriptor desc1(thread); - bool success1 = JSObject::GetOwnProperty(thread, obj1, key1, desc1); + PropertyDescriptor desc1(thread_); + bool success1 = JSObject::GetOwnProperty(thread_, obj1, key1, desc1); EXPECT_TRUE(success1); EXPECT_EQ(false, desc1.IsWritable()); EXPECT_EQ(true, desc1.IsEnumerable()); @@ -536,71 +537,71 @@ TEST_F(JSObjectTest, SetIntegrityLevelFrozen) TEST_F(JSObjectTest, TestIntegrityLevelSealed) { - JSHandle dynclass1(thread, JSObjectTestCreate(thread)); + JSHandle dynclass1(thread_, JSObjectTestCreate(thread_)); JSHandle obj1 = - thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(dynclass1), dynclass1); + thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(dynclass1), dynclass1); CString undefined_c_str = "level"; - JSHandle key1(thread->GetEcmaVM()->GetFactory()->NewFromString(&undefined_c_str[0])); - JSHandle value1(thread, JSTaggedValue(1)); - JSObject::SetProperty(thread, JSHandle(obj1), key1, value1); + JSHandle key1(thread_->GetEcmaVM()->GetFactory()->NewFromString(&undefined_c_str[0])); + JSHandle value1(thread_, JSTaggedValue(1)); + JSObject::SetProperty(thread_, JSHandle(obj1), key1, value1); obj1->GetJSHClass()->SetExtensible(false); // test SetIntegrityLevel::SEALED - bool status1 = JSObject::SetIntegrityLevel(thread, obj1, IntegrityLevel::SEALED); + bool status1 = JSObject::SetIntegrityLevel(thread_, obj1, IntegrityLevel::SEALED); EXPECT_TRUE(status1); - EXPECT_EQ(JSObject::GetProperty(thread, JSHandle(obj1), key1).GetValue().GetTaggedValue(), + EXPECT_EQ(JSObject::GetProperty(thread_, JSHandle(obj1), key1).GetValue().GetTaggedValue(), value1.GetTaggedValue()); - PropertyDescriptor desc1(thread); - bool success1 = JSObject::GetOwnProperty(thread, obj1, key1, desc1); + PropertyDescriptor desc1(thread_); + bool success1 = JSObject::GetOwnProperty(thread_, obj1, key1, desc1); EXPECT_TRUE(success1); - EXPECT_EQ(true, JSObject::TestIntegrityLevel(thread, obj1, IntegrityLevel::SEALED)); - EXPECT_EQ(false, JSObject::TestIntegrityLevel(thread, obj1, IntegrityLevel::FROZEN)); + EXPECT_EQ(true, JSObject::TestIntegrityLevel(thread_, obj1, IntegrityLevel::SEALED)); + EXPECT_EQ(false, JSObject::TestIntegrityLevel(thread_, obj1, IntegrityLevel::FROZEN)); } TEST_F(JSObjectTest, TestIntegrityLevelFrozen) { - JSHandle dynclass1(thread, JSObjectTestCreate(thread)); + JSHandle dynclass1(thread_, JSObjectTestCreate(thread_)); JSHandle obj1 = - thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(dynclass1), dynclass1); + thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(dynclass1), dynclass1); CString undefined_c_str = "level"; - JSHandle key1(thread->GetEcmaVM()->GetFactory()->NewFromString(&undefined_c_str[0])); - JSHandle value1(thread, JSTaggedValue(1)); - JSObject::SetProperty(thread, JSHandle(obj1), key1, value1); + JSHandle key1(thread_->GetEcmaVM()->GetFactory()->NewFromString(&undefined_c_str[0])); + JSHandle value1(thread_, JSTaggedValue(1)); + JSObject::SetProperty(thread_, JSHandle(obj1), key1, value1); obj1->GetJSHClass()->SetExtensible(false); // test SetIntegrityLevel::FROZEN - bool status1 = JSObject::SetIntegrityLevel(thread, obj1, IntegrityLevel::FROZEN); + bool status1 = JSObject::SetIntegrityLevel(thread_, obj1, IntegrityLevel::FROZEN); EXPECT_TRUE(status1); - EXPECT_EQ(JSObject::GetProperty(thread, JSHandle(obj1), key1).GetValue().GetTaggedValue(), + EXPECT_EQ(JSObject::GetProperty(thread_, JSHandle(obj1), key1).GetValue().GetTaggedValue(), value1.GetTaggedValue()); - PropertyDescriptor desc1(thread); - bool success1 = JSObject::GetOwnProperty(thread, obj1, key1, desc1); + PropertyDescriptor desc1(thread_); + bool success1 = JSObject::GetOwnProperty(thread_, obj1, key1, desc1); EXPECT_TRUE(success1); - EXPECT_EQ(true, JSObject::TestIntegrityLevel(thread, obj1, IntegrityLevel::SEALED)); - EXPECT_EQ(true, JSObject::TestIntegrityLevel(thread, obj1, IntegrityLevel::FROZEN)); + EXPECT_EQ(true, JSObject::TestIntegrityLevel(thread_, obj1, IntegrityLevel::SEALED)); + EXPECT_EQ(true, JSObject::TestIntegrityLevel(thread_, obj1, IntegrityLevel::FROZEN)); } TEST_F(JSObjectTest, TestIntegrityLevelWithoutProperty) { - JSHandle dynclass1(thread, JSObjectTestCreate(thread)); + JSHandle dynclass1(thread_, JSObjectTestCreate(thread_)); JSHandle obj1( - thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(dynclass1), dynclass1)); + thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(dynclass1), dynclass1)); JSHandle::Cast(obj1)->GetJSHClass()->SetExtensible(false); CString undefined_c_str = "level"; - JSHandle key1(thread->GetEcmaVM()->GetFactory()->NewFromString(&undefined_c_str[0])); + JSHandle key1(thread_->GetEcmaVM()->GetFactory()->NewFromString(&undefined_c_str[0])); // test SetIntegrityLevel::FROZEN JSHandle jsobject(obj1); - bool status1 = JSObject::SetIntegrityLevel(thread, jsobject, IntegrityLevel::SEALED); + bool status1 = JSObject::SetIntegrityLevel(thread_, jsobject, IntegrityLevel::SEALED); EXPECT_TRUE(status1); - PropertyDescriptor desc1(thread); - bool success1 = JSObject::GetOwnProperty(thread, jsobject, key1, desc1); + PropertyDescriptor desc1(thread_); + bool success1 = JSObject::GetOwnProperty(thread_, jsobject, key1, desc1); EXPECT_TRUE(!success1); - EXPECT_EQ(true, JSObject::TestIntegrityLevel(thread, jsobject, IntegrityLevel::SEALED)); - EXPECT_EQ(true, JSObject::TestIntegrityLevel(thread, jsobject, IntegrityLevel::FROZEN)); + EXPECT_EQ(true, JSObject::TestIntegrityLevel(thread_, jsobject, IntegrityLevel::SEALED)); + EXPECT_EQ(true, JSObject::TestIntegrityLevel(thread_, jsobject, IntegrityLevel::FROZEN)); } JSTaggedValue TestGetter(EcmaRuntimeCallInfo *argv) @@ -616,26 +617,26 @@ JSTaggedValue TestGetter(EcmaRuntimeCallInfo *argv) TEST_F(JSObjectTest, Getter) { - JSHandle dynclass1(thread, JSObjectTestCreate(thread)); - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + JSHandle dynclass1(thread_, JSObjectTestCreate(thread_)); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); JSHandle obj = factory->NewJSObjectByConstructor(JSHandle(dynclass1), dynclass1); JSHandle key1(factory->NewFromString("x")); JSHandle key2(factory->NewFromString("y")); - JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); + JSHandle env = thread_->GetEcmaVM()->GetGlobalEnv(); JSHandle getter = - thread->GetEcmaVM()->GetFactory()->NewJSFunction(env, reinterpret_cast(TestGetter)); + thread_->GetEcmaVM()->GetFactory()->NewJSFunction(env, reinterpret_cast(TestGetter)); - PropertyDescriptor desc1(thread); + PropertyDescriptor desc1(thread_); desc1.SetGetter(JSHandle::Cast(getter)); - bool success1 = JSObject::DefineOwnProperty(thread, obj, key1, desc1); + bool success1 = JSObject::DefineOwnProperty(thread_, obj, key1, desc1); EXPECT_TRUE(success1); - PropertyDescriptor desc2(thread); - desc2.SetValue(JSHandle(thread, JSTaggedValue(1))); - success1 = JSObject::DefineOwnProperty(thread, obj, key2, desc2); + PropertyDescriptor desc2(thread_); + desc2.SetValue(JSHandle(thread_, JSTaggedValue(1))); + success1 = JSObject::DefineOwnProperty(thread_, obj, key2, desc2); EXPECT_TRUE(success1); - EXPECT_EQ(JSObject::GetProperty(thread, JSHandle(obj), key1).GetValue().GetTaggedValue(), + EXPECT_EQ(JSObject::GetProperty(thread_, JSHandle(obj), key1).GetValue().GetTaggedValue(), JSTaggedValue(2)); } @@ -654,61 +655,61 @@ JSTaggedValue TestSetter(EcmaRuntimeCallInfo *argv) TEST_F(JSObjectTest, Setter) { - JSHandle dynclass1(thread, JSObjectTestCreate(thread)); - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + JSHandle dynclass1(thread_, JSObjectTestCreate(thread_)); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); JSHandle obj = factory->NewJSObjectByConstructor(JSHandle(dynclass1), dynclass1); JSHandle key1(factory->NewFromString("x")); JSHandle key2(factory->NewFromString("y")); - JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); + JSHandle env = thread_->GetEcmaVM()->GetGlobalEnv(); JSHandle setter = - thread->GetEcmaVM()->GetFactory()->NewJSFunction(env, reinterpret_cast(TestSetter)); + thread_->GetEcmaVM()->GetFactory()->NewJSFunction(env, reinterpret_cast(TestSetter)); - PropertyDescriptor desc1(thread); + PropertyDescriptor desc1(thread_); desc1.SetSetter(JSHandle::Cast(setter)); - bool success1 = JSObject::DefineOwnProperty(thread, obj, key1, desc1); + bool success1 = JSObject::DefineOwnProperty(thread_, obj, key1, desc1); EXPECT_TRUE(success1); - PropertyDescriptor desc2(thread, JSHandle(thread, JSTaggedValue(1)), true, true, true); - success1 = JSObject::DefineOwnProperty(thread, obj, key2, desc2); + PropertyDescriptor desc2(thread_, JSHandle(thread_, JSTaggedValue(1)), true, true, true); + success1 = JSObject::DefineOwnProperty(thread_, obj, key2, desc2); EXPECT_TRUE(success1); - JSHandle value_handle(thread, JSTaggedValue::Undefined()); - EXPECT_TRUE(JSObject::SetProperty(thread, JSHandle(obj), key1, value_handle)); - EXPECT_EQ(JSObject::GetProperty(thread, JSHandle(obj), key2).GetValue().GetTaggedValue(), + JSHandle value_handle(thread_, JSTaggedValue::Undefined()); + EXPECT_TRUE(JSObject::SetProperty(thread_, JSHandle(obj), key1, value_handle)); + EXPECT_EQ(JSObject::GetProperty(thread_, JSHandle(obj), key2).GetValue().GetTaggedValue(), JSTaggedValue(2)); } TEST_F(JSObjectTest, SpeciesConstructor) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); - const GlobalEnvConstants *globalConst = thread->GlobalConstants(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle env = thread_->GetEcmaVM()->GetGlobalEnv(); + const GlobalEnvConstants *globalConst = thread_->GlobalConstants(); JSHandle constructor_func = factory->NewJSFunction(env, static_cast(nullptr), FunctionKind::BASE_CONSTRUCTOR); JSHandle constructor_func_value(constructor_func); constructor_func->GetJSHClass()->SetExtensible(true); - JSFunction::NewJSFunctionPrototype(thread, factory, constructor_func); + JSFunction::NewJSFunctionPrototype(thread_, factory, constructor_func); - JSHandle null_handle(thread, JSTaggedValue::Null()); - JSHandle undefined_value(thread, JSTaggedValue::Undefined()); - JSHandle proto_obj = JSObject::ObjectCreate(thread, null_handle); + JSHandle null_handle(thread_, JSTaggedValue::Null()); + JSHandle undefined_value(thread_, JSTaggedValue::Undefined()); + JSHandle proto_obj = JSObject::ObjectCreate(thread_, null_handle); JSHandle proto_obj_value(proto_obj); JSHandle constructor_key = globalConst->GetHandledConstructorString(); - JSObject::SetProperty(thread, proto_obj_value, constructor_key, constructor_func_value); + JSObject::SetProperty(thread_, proto_obj_value, constructor_key, constructor_func_value); factory->NewJSObjectByConstructor(constructor_func, JSHandle::Cast(constructor_func)); JSHandle species_construct = factory->NewJSFunction(env, static_cast(nullptr), FunctionKind::BASE_CONSTRUCTOR); JSHandle species_construct_value(species_construct); constructor_func->GetJSHClass()->SetExtensible(true); - JSFunction::MakeConstructor(thread, species_construct, undefined_value); + JSFunction::MakeConstructor(thread_, species_construct, undefined_value); JSHandle species_symbol = env->GetSpeciesSymbol(); - JSObject::SetProperty(thread, constructor_func_value, species_symbol, species_construct_value); + JSObject::SetProperty(thread_, constructor_func_value, species_symbol, species_construct_value); JSTaggedValue species_value = - JSObject::SpeciesConstructor(thread, proto_obj, constructor_func_value).GetTaggedValue(); + JSObject::SpeciesConstructor(thread_, proto_obj, constructor_func_value).GetTaggedValue(); EXPECT_EQ(species_value, species_construct_value.GetTaggedValue()); } @@ -724,32 +725,32 @@ JSTaggedValue TestUndefinedSetter([[maybe_unused]] EcmaRuntimeCallInfo *argv) TEST_F(JSObjectTest, GetterIsUndefined) { - JSHandle dynclass1(thread, JSObjectTestCreate(thread)); - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + JSHandle dynclass1(thread_, JSObjectTestCreate(thread_)); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); JSHandle obj = factory->NewJSObjectByConstructor(JSHandle(dynclass1), dynclass1); JSHandle key(factory->NewFromString("property")); - JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); + JSHandle env = thread_->GetEcmaVM()->GetGlobalEnv(); JSHandle getter = - thread->GetEcmaVM()->GetFactory()->NewJSFunction(env, reinterpret_cast(TestUndefinedGetter)); + thread_->GetEcmaVM()->GetFactory()->NewJSFunction(env, reinterpret_cast(TestUndefinedGetter)); JSHandle setter = - thread->GetEcmaVM()->GetFactory()->NewJSFunction(env, reinterpret_cast(TestUndefinedSetter)); - JSHandle un_getter(thread, JSTaggedValue::Undefined()); + thread_->GetEcmaVM()->GetFactory()->NewJSFunction(env, reinterpret_cast(TestUndefinedSetter)); + JSHandle un_getter(thread_, JSTaggedValue::Undefined()); - PropertyDescriptor desc1(thread); + PropertyDescriptor desc1(thread_); desc1.SetGetter(JSHandle::Cast(getter)); desc1.SetSetter(JSHandle::Cast(setter)); desc1.SetConfigurable(true); desc1.SetEnumerable(true); - bool success1 = JSObject::DefineOwnProperty(thread, obj, key, desc1); + bool success1 = JSObject::DefineOwnProperty(thread_, obj, key, desc1); EXPECT_TRUE(success1); - PropertyDescriptor desc2(thread); + PropertyDescriptor desc2(thread_); desc2.SetGetter(un_getter); - bool success2 = JSObject::DefineOwnProperty(thread, obj, key, desc2); + bool success2 = JSObject::DefineOwnProperty(thread_, obj, key, desc2); EXPECT_TRUE(success2); - PropertyDescriptor desc(thread); - bool success = JSObject::GetOwnProperty(thread, obj, key, desc); + PropertyDescriptor desc(thread_); + bool success = JSObject::GetOwnProperty(thread_, obj, key, desc); EXPECT_TRUE(success); EXPECT_TRUE(desc.GetSetter()->IsJSFunction()); EXPECT_TRUE(desc.GetGetter()->IsUndefined()); @@ -757,247 +758,247 @@ TEST_F(JSObjectTest, GetterIsUndefined) TEST_F(JSObjectTest, SetterIsUndefined) { - JSHandle dynclass1(thread, JSObjectTestCreate(thread)); - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + JSHandle dynclass1(thread_, JSObjectTestCreate(thread_)); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); JSHandle obj = factory->NewJSObjectByConstructor(JSHandle(dynclass1), dynclass1); JSHandle key(factory->NewFromString("property")); - JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); + JSHandle env = thread_->GetEcmaVM()->GetGlobalEnv(); JSHandle getter = - thread->GetEcmaVM()->GetFactory()->NewJSFunction(env, reinterpret_cast(TestUndefinedGetter)); + thread_->GetEcmaVM()->GetFactory()->NewJSFunction(env, reinterpret_cast(TestUndefinedGetter)); JSHandle setter = - thread->GetEcmaVM()->GetFactory()->NewJSFunction(env, reinterpret_cast(TestUndefinedSetter)); - JSHandle un_setter(thread, JSTaggedValue::Undefined()); + thread_->GetEcmaVM()->GetFactory()->NewJSFunction(env, reinterpret_cast(TestUndefinedSetter)); + JSHandle un_setter(thread_, JSTaggedValue::Undefined()); - PropertyDescriptor desc1(thread); + PropertyDescriptor desc1(thread_); desc1.SetGetter(JSHandle::Cast(getter)); desc1.SetSetter(JSHandle::Cast(setter)); desc1.SetConfigurable(true); desc1.SetEnumerable(true); - bool success1 = JSObject::DefineOwnProperty(thread, obj, key, desc1); + bool success1 = JSObject::DefineOwnProperty(thread_, obj, key, desc1); EXPECT_TRUE(success1); - PropertyDescriptor desc2(thread); + PropertyDescriptor desc2(thread_); desc2.SetSetter(un_setter); - bool success2 = JSObject::DefineOwnProperty(thread, obj, key, desc2); + bool success2 = JSObject::DefineOwnProperty(thread_, obj, key, desc2); EXPECT_TRUE(success2); - PropertyDescriptor desc(thread); - bool success = JSObject::GetOwnProperty(thread, obj, key, desc); + PropertyDescriptor desc(thread_); + bool success = JSObject::GetOwnProperty(thread_, obj, key, desc); EXPECT_TRUE(success); EXPECT_TRUE(desc.GetSetter()->IsUndefined()); - EXPECT_EQ(JSObject::GetProperty(thread, JSHandle(obj), key).GetValue().GetTaggedValue(), + EXPECT_EQ(JSObject::GetProperty(thread_, JSHandle(obj), key).GetValue().GetTaggedValue(), JSTaggedValue(10)); } TEST_F(JSObjectTest, HClass) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - JSHandle objFunc(thread, JSObjectTestCreate(thread)); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle objFunc(thread_, JSObjectTestCreate(thread_)); JSHandle obj1 = factory->NewJSObjectByConstructor(JSHandle(objFunc), objFunc); - JSHandle hc0(thread, obj1->GetJSHClass()); + JSHandle hc0(thread_, obj1->GetJSHClass()); JSHandle key1(factory->NewFromCanBeCompressString("x")); JSHandle key2(factory->NewFromCanBeCompressString("y")); JSHandle key3(factory->NewFromCanBeCompressString("z")); - JSHandle value(thread, JSTaggedValue(1)); + JSHandle value(thread_, JSTaggedValue(1)); - JSObject::SetProperty(thread, JSHandle(obj1), key1, value); - JSHandle hc1(thread, obj1->GetJSHClass()); + JSObject::SetProperty(thread_, JSHandle(obj1), key1, value); + JSHandle hc1(thread_, obj1->GetJSHClass()); EXPECT_NE(hc0.GetTaggedValue(), hc1.GetTaggedValue()); EXPECT_EQ(hc0.GetTaggedValue(), hc1->GetParent()); - JSObject::SetProperty(thread, JSHandle(obj1), key2, value); - JSHandle hc2(thread, obj1->GetJSHClass()); + JSObject::SetProperty(thread_, JSHandle(obj1), key2, value); + JSHandle hc2(thread_, obj1->GetJSHClass()); EXPECT_NE(hc1.GetTaggedValue(), hc2.GetTaggedValue()); EXPECT_EQ(hc1.GetTaggedValue(), hc2->GetParent()); JSHandle obj2 = factory->NewJSObjectByConstructor(JSHandle(objFunc), objFunc); EXPECT_EQ(hc0.GetTaggedValue().GetTaggedObject(), obj2->GetJSHClass()); - JSObject::SetProperty(thread, JSHandle(obj2), key1, value); + JSObject::SetProperty(thread_, JSHandle(obj2), key1, value); EXPECT_EQ(hc1.GetTaggedValue().GetTaggedObject(), obj2->GetJSHClass()); - JSObject::SetProperty(thread, JSHandle(obj2), key3, value); - JSHandle hc3(thread, obj2->GetJSHClass()); + JSObject::SetProperty(thread_, JSHandle(obj2), key3, value); + JSHandle hc3(thread_, obj2->GetJSHClass()); EXPECT_NE(hc1.GetTaggedValue().GetTaggedObject(), obj2->GetJSHClass()); EXPECT_EQ(hc1.GetTaggedValue(), obj2->GetJSHClass()->GetParent()); JSHandle obj3 = factory->NewJSObjectByConstructor(JSHandle(objFunc), objFunc); EXPECT_EQ(hc0.GetTaggedValue().GetTaggedObject(), obj3->GetJSHClass()); - JSObject::SetProperty(thread, JSHandle(obj3), key1, value); + JSObject::SetProperty(thread_, JSHandle(obj3), key1, value); EXPECT_EQ(hc1.GetTaggedValue().GetTaggedObject(), obj3->GetJSHClass()); - JSObject::SetProperty(thread, JSHandle(obj3), key2, value); + JSObject::SetProperty(thread_, JSHandle(obj3), key2, value); EXPECT_EQ(hc2.GetTaggedValue().GetTaggedObject(), obj3->GetJSHClass()); - JSObject::SetProperty(thread, JSHandle(obj3), key3, value); + JSObject::SetProperty(thread_, JSHandle(obj3), key3, value); EXPECT_NE(hc3.GetTaggedValue().GetTaggedObject(), obj3->GetJSHClass()); EXPECT_EQ(hc2.GetTaggedValue(), obj3->GetJSHClass()->GetParent()); } TEST_F(JSObjectTest, FastToSlow) { - auto ecmaVM = thread->GetEcmaVM(); + auto ecmaVM = thread_->GetEcmaVM(); ObjectFactory *factory = ecmaVM->GetFactory(); - JSHandle objFunc(thread, JSObjectTestCreate(thread)); + JSHandle objFunc(thread_, JSObjectTestCreate(thread_)); JSHandle obj1 = factory->NewJSObjectByConstructor(JSHandle(objFunc), objFunc); JSMutableHandle key(factory->NewFromCanBeCompressString("x")); - JSMutableHandle number(thread, JSTaggedValue(0)); - JSMutableHandle newkey(thread, JSTaggedValue(0)); - JSHandle value(thread, JSTaggedValue(1)); + JSMutableHandle number(thread_, JSTaggedValue(0)); + JSMutableHandle newkey(thread_, JSTaggedValue(0)); + JSHandle value(thread_, JSTaggedValue(1)); ecmaVM->SetEnableForceGC(false); for (uint32_t i = 0; i < PropertyAttributes::MAX_CAPACITY_OF_PROPERTIES; i++) { number.Update(JSTaggedValue(i)); - number.Update(JSTaggedValue::ToString(thread, number).GetTaggedValue()); - EcmaString *newString = *factory->ConcatFromString(key, JSTaggedValue::ToString(thread, number)); + number.Update(JSTaggedValue::ToString(thread_, number).GetTaggedValue()); + EcmaString *newString = *factory->ConcatFromString(key, JSTaggedValue::ToString(thread_, number)); newkey.Update(JSTaggedValue(newString)); - JSObject::SetProperty(thread, JSHandle(obj1), newkey, value); + JSObject::SetProperty(thread_, JSHandle(obj1), newkey, value); } ecmaVM->SetEnableForceGC(true); EXPECT_FALSE(TaggedArray::Cast(obj1->GetProperties().GetTaggedObject())->IsDictionaryMode()); number.Update(JSTaggedValue(PropertyAttributes::MAX_CAPACITY_OF_PROPERTIES)); - number.Update(JSTaggedValue::ToString(thread, number).GetTaggedValue()); - EcmaString *newString = *factory->ConcatFromString(key, JSTaggedValue::ToString(thread, number)); + number.Update(JSTaggedValue::ToString(thread_, number).GetTaggedValue()); + EcmaString *newString = *factory->ConcatFromString(key, JSTaggedValue::ToString(thread_, number)); newkey.Update(JSTaggedValue(newString)); - JSObject::SetProperty(thread, JSHandle(obj1), newkey, value); + JSObject::SetProperty(thread_, JSHandle(obj1), newkey, value); EXPECT_TRUE(TaggedArray::Cast(obj1->GetProperties().GetTaggedObject())->IsDictionaryMode()); NameDictionary *dict = NameDictionary::Cast(obj1->GetProperties().GetTaggedObject()); EXPECT_EQ(dict->EntriesCount(), PropertyAttributes::MAX_CAPACITY_OF_PROPERTIES + 1); - EXPECT_EQ(dict->NextEnumerationIndex(thread), PropertyAttributes::MAX_CAPACITY_OF_PROPERTIES + 1); + EXPECT_EQ(dict->NextEnumerationIndex(thread_), PropertyAttributes::MAX_CAPACITY_OF_PROPERTIES + 1); } TEST_F(JSObjectTest, DeleteMiddle) { - auto ecmaVM = thread->GetEcmaVM(); + auto ecmaVM = thread_->GetEcmaVM(); ObjectFactory *factory = ecmaVM->GetFactory(); - JSHandle objFunc(thread, JSObjectTestCreate(thread)); + JSHandle objFunc(thread_, JSObjectTestCreate(thread_)); JSHandle obj1 = factory->NewJSObjectByConstructor(JSHandle(objFunc), objFunc); JSMutableHandle key(factory->NewFromCanBeCompressString("x")); - JSMutableHandle number(thread, JSTaggedValue(0)); - JSMutableHandle newkey(thread, JSTaggedValue(0)); - JSHandle value(thread, JSTaggedValue(1)); + JSMutableHandle number(thread_, JSTaggedValue(0)); + JSMutableHandle newkey(thread_, JSTaggedValue(0)); + JSHandle value(thread_, JSTaggedValue(1)); for (uint32_t i = 0; i < 10; i++) { number.Update(JSTaggedValue(i)); - number.Update(JSTaggedValue::ToString(thread, number).GetTaggedValue()); - EcmaString *newString = *factory->ConcatFromString(key, JSTaggedValue::ToString(thread, number)); + number.Update(JSTaggedValue::ToString(thread_, number).GetTaggedValue()); + EcmaString *newString = *factory->ConcatFromString(key, JSTaggedValue::ToString(thread_, number)); newkey.Update(JSTaggedValue(newString)); - JSObject::SetProperty(thread, JSHandle(obj1), newkey, value); + JSObject::SetProperty(thread_, JSHandle(obj1), newkey, value); } EXPECT_FALSE(TaggedArray::Cast(obj1->GetProperties().GetTaggedObject())->IsDictionaryMode()); JSMutableHandle key5(factory->NewFromCanBeCompressString("x5")); - JSObject::DeleteProperty(thread, (obj1), key5); + JSObject::DeleteProperty(thread_, (obj1), key5); EXPECT_TRUE(TaggedArray::Cast(obj1->GetProperties().GetTaggedObject())->IsDictionaryMode()); NameDictionary *dict = NameDictionary::Cast(obj1->GetProperties().GetTaggedObject()); EXPECT_EQ(dict->EntriesCount(), 9); - EXPECT_FALSE(JSObject::HasProperty(thread, obj1, key5)); + EXPECT_FALSE(JSObject::HasProperty(thread_, obj1, key5)); } TEST_F(JSObjectTest, ElementFastToSlow) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - JSHandle objFunc(thread, JSObjectTestCreate(thread)); - JSHandle key0(thread, JSTaggedValue(0)); - JSHandle key1(thread, JSTaggedValue(1)); - JSHandle key2(thread, JSTaggedValue(2)); - JSHandle key2000(thread, JSTaggedValue(2000)); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle objFunc(thread_, JSObjectTestCreate(thread_)); + JSHandle key0(thread_, JSTaggedValue(0)); + JSHandle key1(thread_, JSTaggedValue(1)); + JSHandle key2(thread_, JSTaggedValue(2)); + JSHandle key2000(thread_, JSTaggedValue(2000)); JSHandle keyStr(factory->NewFromCanBeCompressString("str")); // test dictionary [0,1,2,...,2000] JSHandle obj1 = factory->NewJSObjectByConstructor(JSHandle(objFunc), objFunc); EXPECT_TRUE(!TaggedArray::Cast(obj1->GetElements().GetTaggedObject())->IsDictionaryMode()); - JSObject::SetProperty(thread, JSHandle(obj1), keyStr, key2); - JSObject::SetProperty(thread, JSHandle(obj1), key0, key0); + JSObject::SetProperty(thread_, JSHandle(obj1), keyStr, key2); + JSObject::SetProperty(thread_, JSHandle(obj1), key0, key0); EXPECT_TRUE(!TaggedArray::Cast(obj1->GetElements().GetTaggedObject())->IsDictionaryMode()); - JSHandle dynClass(thread, obj1->GetJSHClass()); - JSObject::SetProperty(thread, JSHandle(obj1), key1, key1); + JSHandle dynClass(thread_, obj1->GetJSHClass()); + JSObject::SetProperty(thread_, JSHandle(obj1), key1, key1); EXPECT_TRUE(!TaggedArray::Cast(obj1->GetElements().GetTaggedObject())->IsDictionaryMode()); EXPECT_EQ(obj1->GetJSHClass(), *dynClass); - JSObject::SetProperty(thread, JSHandle(obj1), key2000, key2000); + JSObject::SetProperty(thread_, JSHandle(obj1), key2000, key2000); EXPECT_TRUE(TaggedArray::Cast(obj1->GetElements().GetTaggedObject())->IsDictionaryMode()); JSTaggedValue value = - JSObject::GetProperty(thread, JSHandle(obj1), keyStr).GetValue().GetTaggedValue(); + JSObject::GetProperty(thread_, JSHandle(obj1), keyStr).GetValue().GetTaggedValue(); EXPECT_EQ(value, key2.GetTaggedValue()); // test holey [0,,2] JSHandle obj2 = factory->NewJSObjectByConstructor(JSHandle(objFunc), objFunc); - JSObject::SetProperty(thread, JSHandle(obj2), key0, key0); + JSObject::SetProperty(thread_, JSHandle(obj2), key0, key0); EXPECT_TRUE(!TaggedArray::Cast(obj2->GetElements().GetTaggedObject())->IsDictionaryMode()); - JSHandle dynClass2(thread, obj2->GetJSHClass()); - JSObject::SetProperty(thread, JSHandle(obj2), key2, key2); + JSHandle dynClass2(thread_, obj2->GetJSHClass()); + JSObject::SetProperty(thread_, JSHandle(obj2), key2, key2); EXPECT_TRUE(!TaggedArray::Cast(obj2->GetElements().GetTaggedObject())->IsDictionaryMode()); EXPECT_EQ(obj2->GetJSHClass(), *dynClass2); // test change attr JSHandle obj3 = factory->NewJSObjectByConstructor(JSHandle(objFunc), objFunc); - JSObject::SetProperty(thread, JSHandle(obj3), key0, key0); - JSObject::SetProperty(thread, JSHandle(obj3), key1, key1); - JSObject::SetProperty(thread, JSHandle(obj3), key2, key2); + JSObject::SetProperty(thread_, JSHandle(obj3), key0, key0); + JSObject::SetProperty(thread_, JSHandle(obj3), key1, key1); + JSObject::SetProperty(thread_, JSHandle(obj3), key2, key2); EXPECT_TRUE(!TaggedArray::Cast(obj3->GetElements().GetTaggedObject())->IsDictionaryMode()); - PropertyDescriptor desc(thread); + PropertyDescriptor desc(thread_); desc.SetValue(key1); desc.SetWritable(false); - JSObject::DefineOwnProperty(thread, obj3, key1, desc); + JSObject::DefineOwnProperty(thread_, obj3, key1, desc); EXPECT_TRUE(TaggedArray::Cast(obj3->GetElements().GetTaggedObject())->IsDictionaryMode()); // test delete element JSHandle obj4 = factory->NewJSObjectByConstructor(JSHandle(objFunc), objFunc); - JSObject::SetProperty(thread, JSHandle(obj4), key0, key0); - JSObject::SetProperty(thread, JSHandle(obj4), key1, key1); - JSObject::SetProperty(thread, JSHandle(obj4), key2, key2); + JSObject::SetProperty(thread_, JSHandle(obj4), key0, key0); + JSObject::SetProperty(thread_, JSHandle(obj4), key1, key1); + JSObject::SetProperty(thread_, JSHandle(obj4), key2, key2); EXPECT_TRUE(!TaggedArray::Cast(obj4->GetElements().GetTaggedObject())->IsDictionaryMode()); - JSObject::DeleteProperty(thread, (obj4), key1); + JSObject::DeleteProperty(thread_, (obj4), key1); EXPECT_TRUE(TaggedArray::Cast(obj4->GetElements().GetTaggedObject())->IsDictionaryMode()); - JSHandle value1001(thread, JSTaggedValue(1001)); + JSHandle value1001(thread_, JSTaggedValue(1001)); JSHandle obj100 = factory->NewJSObjectByConstructor(JSHandle(objFunc), objFunc); - PropertyDescriptor desc1(thread); + PropertyDescriptor desc1(thread_); desc1.SetValue(value1001); desc1.SetWritable(false); desc1.SetEnumerable(false); desc1.SetConfigurable(false); - JSObject::SetProperty(thread, JSHandle(obj100), key0, key1); - JSObject::DefineOwnProperty(thread, obj100, key0, desc1); + JSObject::SetProperty(thread_, JSHandle(obj100), key0, key1); + JSObject::DefineOwnProperty(thread_, obj100, key0, desc1); JSTaggedValue result1001 = - JSObject::GetProperty(thread, JSHandle(obj100), key0).GetValue().GetTaggedValue(); + JSObject::GetProperty(thread_, JSHandle(obj100), key0).GetValue().GetTaggedValue(); EXPECT_EQ(result1001, value1001.GetTaggedValue()); } TEST_F(JSObjectTest, EnableProtoChangeMarker) { - JSHandle nullHandle(thread, JSTaggedValue::Null()); - JSHandle obj1 = JSObject::ObjectCreate(thread, nullHandle); - JSHandle obj2 = JSObject::ObjectCreate(thread, obj1); - JSHandle obj3 = JSObject::ObjectCreate(thread, obj2); - - JSHandle obj1Key(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("key1")); - JSHandle obj2Key(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("key2")); - JSHandle obj3Key(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("key3")); - JSHandle obj1Value(thread, JSTaggedValue(1)); - JSHandle obj2Value(thread, JSTaggedValue(2)); - JSHandle obj3Value(thread, JSTaggedValue(3)); - - JSObject::SetProperty(thread, JSHandle(obj1), obj1Key, obj1Value); - JSObject::SetProperty(thread, JSHandle(obj2), obj2Key, obj2Value); - JSObject::SetProperty(thread, JSHandle(obj3), obj3Key, obj3Value); - JSHandle obj3Dynclass(thread, obj3->GetJSHClass()); - JSHandle resultMarker = JSHClass::EnableProtoChangeMarker(thread, obj3Dynclass); + JSHandle nullHandle(thread_, JSTaggedValue::Null()); + JSHandle obj1 = JSObject::ObjectCreate(thread_, nullHandle); + JSHandle obj2 = JSObject::ObjectCreate(thread_, obj1); + JSHandle obj3 = JSObject::ObjectCreate(thread_, obj2); + + JSHandle obj1Key(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("key1")); + JSHandle obj2Key(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("key2")); + JSHandle obj3Key(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("key3")); + JSHandle obj1Value(thread_, JSTaggedValue(1)); + JSHandle obj2Value(thread_, JSTaggedValue(2)); + JSHandle obj3Value(thread_, JSTaggedValue(3)); + + JSObject::SetProperty(thread_, JSHandle(obj1), obj1Key, obj1Value); + JSObject::SetProperty(thread_, JSHandle(obj2), obj2Key, obj2Value); + JSObject::SetProperty(thread_, JSHandle(obj3), obj3Key, obj3Value); + JSHandle obj3Dynclass(thread_, obj3->GetJSHClass()); + JSHandle resultMarker = JSHClass::EnableProtoChangeMarker(thread_, obj3Dynclass); EXPECT_TRUE(resultMarker->IsProtoChangeMarker()); bool hasChanged = ProtoChangeMarker::Cast(resultMarker->GetTaggedObject())->GetHasChanged(); EXPECT_TRUE(!hasChanged); - JSHandle obj1Dynclass(thread, obj1->GetJSHClass()); - JSHandle obj2Dynclass(thread, obj2->GetJSHClass()); + JSHandle obj1Dynclass(thread_, obj1->GetJSHClass()); + JSHandle obj2Dynclass(thread_, obj2->GetJSHClass()); JSTaggedValue obj2Marker = obj2Dynclass->GetProtoChangeMarker(); EXPECT_TRUE(obj2Marker.IsProtoChangeMarker()); bool hasChanged2 = ProtoChangeMarker::Cast(obj2Marker.GetTaggedObject())->GetHasChanged(); @@ -1021,49 +1022,49 @@ TEST_F(JSObjectTest, EnableProtoChangeMarker) TEST_F(JSObjectTest, BuildRegisterTree) { - JSHandle nullHandle(thread, JSTaggedValue::Null()); - JSHandle obj1 = JSObject::ObjectCreate(thread, nullHandle); - JSHandle obj2 = JSObject::ObjectCreate(thread, obj1); - JSHandle obj3 = JSObject::ObjectCreate(thread, obj2); - JSHandle obj4 = JSObject::ObjectCreate(thread, obj2); - JSHandle obj5 = JSObject::ObjectCreate(thread, obj4); - JSHandle obj6 = JSObject::ObjectCreate(thread, obj2); - JSHandle obj7 = JSObject::ObjectCreate(thread, obj6); - - JSHandle obj1Key(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("key1")); - JSHandle obj2Key(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("key2")); - JSHandle obj3Key(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("key3")); - JSHandle obj4Key(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("key4")); - JSHandle obj5Key(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("key5")); - JSHandle obj6Key(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("key6")); - JSHandle obj7Key(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("key7")); - - JSHandle obj1Value(thread, JSTaggedValue(1)); - JSHandle obj2Value(thread, JSTaggedValue(2)); - JSHandle obj3Value(thread, JSTaggedValue(3)); - JSHandle obj4Value(thread, JSTaggedValue(4)); - JSHandle obj5Value(thread, JSTaggedValue(5)); - JSHandle obj6Value(thread, JSTaggedValue(6)); - JSHandle obj7Value(thread, JSTaggedValue(7)); - - JSObject::SetProperty(thread, JSHandle(obj1), obj1Key, obj1Value); - JSObject::SetProperty(thread, JSHandle(obj2), obj2Key, obj2Value); - JSObject::SetProperty(thread, JSHandle(obj3), obj3Key, obj3Value); - JSObject::SetProperty(thread, JSHandle(obj4), obj4Key, obj4Value); - JSObject::SetProperty(thread, JSHandle(obj5), obj5Key, obj5Value); - JSObject::SetProperty(thread, JSHandle(obj6), obj6Key, obj6Value); - JSObject::SetProperty(thread, JSHandle(obj7), obj7Key, obj7Value); - - JSHandle obj1Dynclass(thread, obj1->GetJSHClass()); - JSHandle obj2Dynclass(thread, obj2->GetJSHClass()); - JSHandle obj3Dynclass(thread, obj3->GetJSHClass()); - JSHandle obj4Dynclass(thread, obj4->GetJSHClass()); - JSHandle obj5Dynclass(thread, obj5->GetJSHClass()); - JSHandle obj6Dynclass(thread, obj6->GetJSHClass()); - JSHandle obj7Dynclass(thread, obj7->GetJSHClass()); - - JSHandle result3Marker = JSHClass::EnableProtoChangeMarker(thread, obj3Dynclass); - JSHandle result5Marker = JSHClass::EnableProtoChangeMarker(thread, obj5Dynclass); + JSHandle nullHandle(thread_, JSTaggedValue::Null()); + JSHandle obj1 = JSObject::ObjectCreate(thread_, nullHandle); + JSHandle obj2 = JSObject::ObjectCreate(thread_, obj1); + JSHandle obj3 = JSObject::ObjectCreate(thread_, obj2); + JSHandle obj4 = JSObject::ObjectCreate(thread_, obj2); + JSHandle obj5 = JSObject::ObjectCreate(thread_, obj4); + JSHandle obj6 = JSObject::ObjectCreate(thread_, obj2); + JSHandle obj7 = JSObject::ObjectCreate(thread_, obj6); + + JSHandle obj1Key(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("key1")); + JSHandle obj2Key(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("key2")); + JSHandle obj3Key(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("key3")); + JSHandle obj4Key(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("key4")); + JSHandle obj5Key(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("key5")); + JSHandle obj6Key(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("key6")); + JSHandle obj7Key(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("key7")); + + JSHandle obj1Value(thread_, JSTaggedValue(1)); + JSHandle obj2Value(thread_, JSTaggedValue(2)); + JSHandle obj3Value(thread_, JSTaggedValue(3)); + JSHandle obj4Value(thread_, JSTaggedValue(4)); + JSHandle obj5Value(thread_, JSTaggedValue(5)); + JSHandle obj6Value(thread_, JSTaggedValue(6)); + JSHandle obj7Value(thread_, JSTaggedValue(7)); + + JSObject::SetProperty(thread_, JSHandle(obj1), obj1Key, obj1Value); + JSObject::SetProperty(thread_, JSHandle(obj2), obj2Key, obj2Value); + JSObject::SetProperty(thread_, JSHandle(obj3), obj3Key, obj3Value); + JSObject::SetProperty(thread_, JSHandle(obj4), obj4Key, obj4Value); + JSObject::SetProperty(thread_, JSHandle(obj5), obj5Key, obj5Value); + JSObject::SetProperty(thread_, JSHandle(obj6), obj6Key, obj6Value); + JSObject::SetProperty(thread_, JSHandle(obj7), obj7Key, obj7Value); + + JSHandle obj1Dynclass(thread_, obj1->GetJSHClass()); + JSHandle obj2Dynclass(thread_, obj2->GetJSHClass()); + JSHandle obj3Dynclass(thread_, obj3->GetJSHClass()); + JSHandle obj4Dynclass(thread_, obj4->GetJSHClass()); + JSHandle obj5Dynclass(thread_, obj5->GetJSHClass()); + JSHandle obj6Dynclass(thread_, obj6->GetJSHClass()); + JSHandle obj7Dynclass(thread_, obj7->GetJSHClass()); + + JSHandle result3Marker = JSHClass::EnableProtoChangeMarker(thread_, obj3Dynclass); + JSHandle result5Marker = JSHClass::EnableProtoChangeMarker(thread_, obj5Dynclass); EXPECT_TRUE(result3Marker->IsProtoChangeMarker()); EXPECT_TRUE(!(ProtoChangeMarker::Cast(result3Marker->GetTaggedObject())->GetHasChanged())); EXPECT_TRUE(result5Marker->IsProtoChangeMarker()); @@ -1072,7 +1073,7 @@ TEST_F(JSObjectTest, BuildRegisterTree) EXPECT_TRUE(obj4Dynclass->GetProtoChangeMarker().IsProtoChangeMarker()); EXPECT_TRUE(!obj6Dynclass->GetProtoChangeMarker().IsProtoChangeMarker()); - JSHandle result7Marker = JSHClass::EnableProtoChangeMarker(thread, obj7Dynclass); + JSHandle result7Marker = JSHClass::EnableProtoChangeMarker(thread_, obj7Dynclass); EXPECT_TRUE(result7Marker->IsProtoChangeMarker()); EXPECT_TRUE(!(ProtoChangeMarker::Cast(result7Marker->GetTaggedObject())->GetHasChanged())); @@ -1080,7 +1081,7 @@ TEST_F(JSObjectTest, BuildRegisterTree) EXPECT_TRUE(protoDetails1.IsProtoChangeDetails()); JSTaggedValue listeners1Value = ProtoChangeDetails::Cast(protoDetails1.GetTaggedObject())->GetChangeListener(); EXPECT_TRUE(listeners1Value != JSTaggedValue(0)); - JSHandle listeners1(thread, listeners1Value.GetTaggedObject()); + JSHandle listeners1(thread_, listeners1Value.GetTaggedObject()); JSTaggedValue protoDetails2 = obj2Dynclass->GetProtoChangeDetails(); EXPECT_TRUE(protoDetails2.IsProtoChangeDetails()); JSTaggedValue index2 = ProtoChangeDetails::Cast(protoDetails2.GetTaggedObject())->GetRegisterIndex(); @@ -1088,7 +1089,7 @@ TEST_F(JSObjectTest, BuildRegisterTree) JSTaggedValue listeners2Value = ProtoChangeDetails::Cast(protoDetails2.GetTaggedObject())->GetChangeListener(); EXPECT_TRUE(listeners2Value != JSTaggedValue(0)); - JSHandle listeners2(thread, listeners2Value.GetTaggedObject()); + JSHandle listeners2(thread_, listeners2Value.GetTaggedObject()); JSTaggedValue protoDetails4 = obj4Dynclass->GetProtoChangeDetails(); JSTaggedValue protoDetails6 = obj6Dynclass->GetProtoChangeDetails(); EXPECT_TRUE(protoDetails4.IsProtoChangeDetails()); @@ -1104,58 +1105,58 @@ TEST_F(JSObjectTest, BuildRegisterTree) TEST_F(JSObjectTest, NoticeThroughChain) { - JSHandle nullHandle(thread, JSTaggedValue::Null()); - JSHandle obj1 = JSObject::ObjectCreate(thread, nullHandle); - JSHandle obj2 = JSObject::ObjectCreate(thread, obj1); - JSHandle obj3 = JSObject::ObjectCreate(thread, obj2); - JSHandle obj4 = JSObject::ObjectCreate(thread, obj2); - JSHandle obj5 = JSObject::ObjectCreate(thread, obj4); - JSHandle obj6 = JSObject::ObjectCreate(thread, obj2); - JSHandle obj7 = JSObject::ObjectCreate(thread, obj6); - - JSHandle obj1Key(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("key1")); - JSHandle obj2Key(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("key2")); - JSHandle obj3Key(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("key3")); - JSHandle obj4Key(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("key4")); - JSHandle obj5Key(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("key5")); - JSHandle obj6Key(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("key6")); - JSHandle obj7Key(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("key7")); - - JSHandle obj1Value(thread, JSTaggedValue(1)); - JSHandle obj2Value(thread, JSTaggedValue(2)); - JSHandle obj3Value(thread, JSTaggedValue(3)); - JSHandle obj4Value(thread, JSTaggedValue(4)); - JSHandle obj5Value(thread, JSTaggedValue(5)); - JSHandle obj6Value(thread, JSTaggedValue(6)); - JSHandle obj7Value(thread, JSTaggedValue(7)); - - JSObject::SetProperty(thread, JSHandle(obj1), obj1Key, obj1Value); - JSObject::SetProperty(thread, JSHandle(obj2), obj2Key, obj2Value); - JSObject::SetProperty(thread, JSHandle(obj3), obj3Key, obj3Value); - JSObject::SetProperty(thread, JSHandle(obj4), obj4Key, obj4Value); - JSObject::SetProperty(thread, JSHandle(obj5), obj5Key, obj5Value); - JSObject::SetProperty(thread, JSHandle(obj6), obj6Key, obj6Value); - JSObject::SetProperty(thread, JSHandle(obj7), obj7Key, obj7Value); - - JSHandle obj1Dynclass(thread, obj1->GetJSHClass()); - JSHandle obj2Dynclass(thread, obj2->GetJSHClass()); - JSHandle obj3Dynclass(thread, obj3->GetJSHClass()); - JSHandle obj4Dynclass(thread, obj4->GetJSHClass()); - JSHandle obj5Dynclass(thread, obj5->GetJSHClass()); - JSHandle obj6Dynclass(thread, obj6->GetJSHClass()); - JSHandle obj7Dynclass(thread, obj7->GetJSHClass()); - - JSHClass::EnableProtoChangeMarker(thread, obj3Dynclass); - JSHClass::EnableProtoChangeMarker(thread, obj7Dynclass); - JSHClass::EnableProtoChangeMarker(thread, obj5Dynclass); - - JSHClass::NoticeThroughChain(thread, obj2Dynclass); - JSHClass::UnregisterOnProtoChain(thread, obj2Dynclass); + JSHandle nullHandle(thread_, JSTaggedValue::Null()); + JSHandle obj1 = JSObject::ObjectCreate(thread_, nullHandle); + JSHandle obj2 = JSObject::ObjectCreate(thread_, obj1); + JSHandle obj3 = JSObject::ObjectCreate(thread_, obj2); + JSHandle obj4 = JSObject::ObjectCreate(thread_, obj2); + JSHandle obj5 = JSObject::ObjectCreate(thread_, obj4); + JSHandle obj6 = JSObject::ObjectCreate(thread_, obj2); + JSHandle obj7 = JSObject::ObjectCreate(thread_, obj6); + + JSHandle obj1Key(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("key1")); + JSHandle obj2Key(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("key2")); + JSHandle obj3Key(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("key3")); + JSHandle obj4Key(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("key4")); + JSHandle obj5Key(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("key5")); + JSHandle obj6Key(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("key6")); + JSHandle obj7Key(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("key7")); + + JSHandle obj1Value(thread_, JSTaggedValue(1)); + JSHandle obj2Value(thread_, JSTaggedValue(2)); + JSHandle obj3Value(thread_, JSTaggedValue(3)); + JSHandle obj4Value(thread_, JSTaggedValue(4)); + JSHandle obj5Value(thread_, JSTaggedValue(5)); + JSHandle obj6Value(thread_, JSTaggedValue(6)); + JSHandle obj7Value(thread_, JSTaggedValue(7)); + + JSObject::SetProperty(thread_, JSHandle(obj1), obj1Key, obj1Value); + JSObject::SetProperty(thread_, JSHandle(obj2), obj2Key, obj2Value); + JSObject::SetProperty(thread_, JSHandle(obj3), obj3Key, obj3Value); + JSObject::SetProperty(thread_, JSHandle(obj4), obj4Key, obj4Value); + JSObject::SetProperty(thread_, JSHandle(obj5), obj5Key, obj5Value); + JSObject::SetProperty(thread_, JSHandle(obj6), obj6Key, obj6Value); + JSObject::SetProperty(thread_, JSHandle(obj7), obj7Key, obj7Value); + + JSHandle obj1Dynclass(thread_, obj1->GetJSHClass()); + JSHandle obj2Dynclass(thread_, obj2->GetJSHClass()); + JSHandle obj3Dynclass(thread_, obj3->GetJSHClass()); + JSHandle obj4Dynclass(thread_, obj4->GetJSHClass()); + JSHandle obj5Dynclass(thread_, obj5->GetJSHClass()); + JSHandle obj6Dynclass(thread_, obj6->GetJSHClass()); + JSHandle obj7Dynclass(thread_, obj7->GetJSHClass()); + + JSHClass::EnableProtoChangeMarker(thread_, obj3Dynclass); + JSHClass::EnableProtoChangeMarker(thread_, obj7Dynclass); + JSHClass::EnableProtoChangeMarker(thread_, obj5Dynclass); + + JSHClass::NoticeThroughChain(thread_, obj2Dynclass); + JSHClass::UnregisterOnProtoChain(thread_, obj2Dynclass); JSTaggedValue protoDetails1 = obj1Dynclass->GetProtoChangeDetails(); EXPECT_TRUE(protoDetails1.IsProtoChangeDetails()); JSTaggedValue listeners1Value = ProtoChangeDetails::Cast(protoDetails1.GetTaggedObject())->GetChangeListener(); EXPECT_TRUE(listeners1Value != JSTaggedValue(0)); - JSHandle listeners1(thread, listeners1Value.GetTaggedObject()); + JSHandle listeners1(thread_, listeners1Value.GetTaggedObject()); uint32_t holeIndex = ChangeListener::CheckHole(listeners1); EXPECT_TRUE(holeIndex == 0); @@ -1179,52 +1180,52 @@ TEST_F(JSObjectTest, NoticeThroughChain) TEST_F(JSObjectTest, ChangeProtoAndNoticeTheChain) { - JSHandle nullHandle(thread, JSTaggedValue::Null()); - JSHandle obj1 = JSObject::ObjectCreate(thread, nullHandle); - JSHandle obj2 = JSObject::ObjectCreate(thread, obj1); - JSHandle obj3 = JSObject::ObjectCreate(thread, obj1); - JSHandle obj4 = JSObject::ObjectCreate(thread, obj2); - JSHandle obj5 = JSObject::ObjectCreate(thread, obj4); - JSHandle obj6 = JSObject::ObjectCreate(thread, obj2); - JSHandle obj7 = JSObject::ObjectCreate(thread, obj6); - - JSHandle obj1Key(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("key1")); - JSHandle obj2Key(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("key2")); - JSHandle obj3Key(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("key3")); - JSHandle obj4Key(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("key4")); - JSHandle obj5Key(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("key5")); - JSHandle obj6Key(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("key6")); - JSHandle obj7Key(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("key7")); - - JSHandle obj1Value(thread, JSTaggedValue(1)); - JSHandle obj2Value(thread, JSTaggedValue(2)); - JSHandle obj3Value(thread, JSTaggedValue(3)); - JSHandle obj4Value(thread, JSTaggedValue(4)); - JSHandle obj5Value(thread, JSTaggedValue(5)); - JSHandle obj6Value(thread, JSTaggedValue(6)); - JSHandle obj7Value(thread, JSTaggedValue(7)); - - JSObject::SetProperty(thread, JSHandle(obj1), obj1Key, obj1Value); - JSObject::SetProperty(thread, JSHandle(obj2), obj2Key, obj2Value); - JSObject::SetProperty(thread, JSHandle(obj3), obj3Key, obj3Value); - JSObject::SetProperty(thread, JSHandle(obj4), obj4Key, obj4Value); - JSObject::SetProperty(thread, JSHandle(obj5), obj5Key, obj5Value); - JSObject::SetProperty(thread, JSHandle(obj6), obj6Key, obj6Value); - JSObject::SetProperty(thread, JSHandle(obj7), obj7Key, obj7Value); - - JSHandle obj5Dynclass(thread, obj5->GetJSHClass()); - JSHandle obj7Dynclass(thread, obj7->GetJSHClass()); - - JSHClass::EnableProtoChangeMarker(thread, obj7Dynclass); - JSHClass::EnableProtoChangeMarker(thread, obj5Dynclass); - - JSObject::SetPrototype(thread, obj2, JSHandle(obj3)); - - JSHandle obj1Dynclass(thread, obj1->GetJSHClass()); - JSHandle obj2Dynclass(thread, obj2->GetJSHClass()); - JSHandle obj3Dynclass(thread, obj3->GetJSHClass()); - JSHandle obj4Dynclass(thread, obj4->GetJSHClass()); - JSHandle obj6Dynclass(thread, obj6->GetJSHClass()); + JSHandle nullHandle(thread_, JSTaggedValue::Null()); + JSHandle obj1 = JSObject::ObjectCreate(thread_, nullHandle); + JSHandle obj2 = JSObject::ObjectCreate(thread_, obj1); + JSHandle obj3 = JSObject::ObjectCreate(thread_, obj1); + JSHandle obj4 = JSObject::ObjectCreate(thread_, obj2); + JSHandle obj5 = JSObject::ObjectCreate(thread_, obj4); + JSHandle obj6 = JSObject::ObjectCreate(thread_, obj2); + JSHandle obj7 = JSObject::ObjectCreate(thread_, obj6); + + JSHandle obj1Key(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("key1")); + JSHandle obj2Key(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("key2")); + JSHandle obj3Key(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("key3")); + JSHandle obj4Key(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("key4")); + JSHandle obj5Key(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("key5")); + JSHandle obj6Key(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("key6")); + JSHandle obj7Key(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("key7")); + + JSHandle obj1Value(thread_, JSTaggedValue(1)); + JSHandle obj2Value(thread_, JSTaggedValue(2)); + JSHandle obj3Value(thread_, JSTaggedValue(3)); + JSHandle obj4Value(thread_, JSTaggedValue(4)); + JSHandle obj5Value(thread_, JSTaggedValue(5)); + JSHandle obj6Value(thread_, JSTaggedValue(6)); + JSHandle obj7Value(thread_, JSTaggedValue(7)); + + JSObject::SetProperty(thread_, JSHandle(obj1), obj1Key, obj1Value); + JSObject::SetProperty(thread_, JSHandle(obj2), obj2Key, obj2Value); + JSObject::SetProperty(thread_, JSHandle(obj3), obj3Key, obj3Value); + JSObject::SetProperty(thread_, JSHandle(obj4), obj4Key, obj4Value); + JSObject::SetProperty(thread_, JSHandle(obj5), obj5Key, obj5Value); + JSObject::SetProperty(thread_, JSHandle(obj6), obj6Key, obj6Value); + JSObject::SetProperty(thread_, JSHandle(obj7), obj7Key, obj7Value); + + JSHandle obj5Dynclass(thread_, obj5->GetJSHClass()); + JSHandle obj7Dynclass(thread_, obj7->GetJSHClass()); + + JSHClass::EnableProtoChangeMarker(thread_, obj7Dynclass); + JSHClass::EnableProtoChangeMarker(thread_, obj5Dynclass); + + JSObject::SetPrototype(thread_, obj2, JSHandle(obj3)); + + JSHandle obj1Dynclass(thread_, obj1->GetJSHClass()); + JSHandle obj2Dynclass(thread_, obj2->GetJSHClass()); + JSHandle obj3Dynclass(thread_, obj3->GetJSHClass()); + JSHandle obj4Dynclass(thread_, obj4->GetJSHClass()); + JSHandle obj6Dynclass(thread_, obj6->GetJSHClass()); JSTaggedValue obj6Marker = obj6Dynclass->GetProtoChangeMarker(); EXPECT_TRUE(obj6Marker.IsProtoChangeMarker()); @@ -1272,8 +1273,8 @@ TEST_F(JSObjectTest, ChangeProtoAndNoticeTheChain) TEST_F(JSObjectTest, NativePointerField) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - JSHandle objFunc(thread, JSObjectTestCreate(thread)); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle objFunc(thread_, JSObjectTestCreate(thread_)); JSHandle obj = factory->NewJSObjectByConstructor(JSHandle(objFunc), objFunc); obj->SetHash(87); EXPECT_TRUE(obj->GetHash() == 87); diff --git a/tests/runtime/common/js_primitive_ref_test.cpp b/tests/runtime/common/js_primitive_ref_test.cpp index 92c2adb9d86ce7eaf260ab34c69561d28c167b94..40cfd3881d6ab4e0c7b8d5219e76c5d1f47c7a9a 100644 --- a/tests/runtime/common/js_primitive_ref_test.cpp +++ b/tests/runtime/common/js_primitive_ref_test.cpp @@ -36,33 +36,33 @@ class JSPrimitiveRefTest : public testing::Test { public: void SetUp() override { - TestHelper::CreateEcmaVMWithScope(instance, thread, scope); + TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); } void TearDown() override { - TestHelper::DestroyEcmaVMWithScope(instance, scope); + TestHelper::DestroyEcmaVMWithScope(instance_, scope_); } - PandaVM *instance {nullptr}; - ecmascript::EcmaHandleScope *scope {nullptr}; - JSThread *thread; + PandaVM *instance_ {nullptr}; + ecmascript::EcmaHandleScope *scope_ {nullptr}; + JSThread *thread_; }; TEST_F(JSPrimitiveRefTest, DISABLED_StringCreate) // issue #5368 { - JSHandle hello(thread->GetEcmaVM()->GetFactory()->NewFromString("hello")); - JSHandle str(JSPrimitiveRef::StringCreate(thread, hello)); + JSHandle hello(thread_->GetEcmaVM()->GetFactory()->NewFromString("hello")); + JSHandle str(JSPrimitiveRef::StringCreate(thread_, hello)); - JSHandle idx(thread->GetEcmaVM()->GetFactory()->NewFromString("0")); - bool status = JSPrimitiveRef::HasProperty(thread, str, idx); + JSHandle idx(thread_->GetEcmaVM()->GetFactory()->NewFromString("0")); + bool status = JSPrimitiveRef::HasProperty(thread_, str, idx); ASSERT_TRUE(status); - PropertyDescriptor desc(thread); - status = JSPrimitiveRef::GetOwnProperty(thread, str, idx, desc); + PropertyDescriptor desc(thread_); + status = JSPrimitiveRef::GetOwnProperty(thread_, str, idx, desc); ASSERT_TRUE(status); - JSHandle h = thread->GetEcmaVM()->GetFactory()->NewFromString("h"); - JSHandle h2 = JSTaggedValue::ToString(thread, desc.GetValue()); + JSHandle h = thread_->GetEcmaVM()->GetFactory()->NewFromString("h"); + JSHandle h2 = JSTaggedValue::ToString(thread_, desc.GetValue()); ASSERT_TRUE(h->Compare(*h2) == 0); } diff --git a/tests/runtime/common/js_promise_test.cpp b/tests/runtime/common/js_promise_test.cpp index 0387dbd71719820e4181a7a00d100881f03a56c6..0bad4786567e97daf418b79be30c8c88d576e50a 100644 --- a/tests/runtime/common/js_promise_test.cpp +++ b/tests/runtime/common/js_promise_test.cpp @@ -38,90 +38,90 @@ class JSPromiseTest : public testing::Test { public: void SetUp() override { - TestHelper::CreateEcmaVMWithScope(instance, thread, scope); + TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); } void TearDown() override { - TestHelper::DestroyEcmaVMWithScope(instance, scope); + TestHelper::DestroyEcmaVMWithScope(instance_, scope_); } - JSThread *thread {nullptr}; - PandaVM *instance {nullptr}; - ecmascript::EcmaHandleScope *scope {nullptr}; + JSThread *thread_ {nullptr}; + PandaVM *instance_ {nullptr}; + ecmascript::EcmaHandleScope *scope_ {nullptr}; }; TEST_F(JSPromiseTest, CreateResolvingFunctions) { - EcmaVM *ecmaVM = thread->GetEcmaVM(); + EcmaVM *ecmaVM = thread_->GetEcmaVM(); JSHandle env = ecmaVM->GetGlobalEnv(); ObjectFactory *factory = ecmaVM->GetFactory(); JSHandle promiseFunc = env->GetPromiseFunction(); JSHandle jsPromise = JSHandle::Cast(factory->NewJSObjectByConstructor(JSHandle(promiseFunc), promiseFunc)); - JSHandle reactions = JSPromise::CreateResolvingFunctions(thread, jsPromise); - JSHandle resolve(thread, reactions->GetResolveFunction()); - JSHandle reject(thread, reactions->GetRejectFunction()); + JSHandle reactions = JSPromise::CreateResolvingFunctions(thread_, jsPromise); + JSHandle resolve(thread_, reactions->GetResolveFunction()); + JSHandle reject(thread_, reactions->GetRejectFunction()); EXPECT_EQ(resolve->IsCallable(), true); EXPECT_EQ(reject->IsCallable(), true); } TEST_F(JSPromiseTest, NewPromiseCapability) { - EcmaVM *ecmaVM = thread->GetEcmaVM(); + EcmaVM *ecmaVM = thread_->GetEcmaVM(); JSHandle env = ecmaVM->GetGlobalEnv(); JSHandle promise = env->GetPromiseFunction(); - JSHandle capbility = JSPromise::NewPromiseCapability(thread, promise); - JSHandle newPromise(thread, capbility->GetPromise()); + JSHandle capbility = JSPromise::NewPromiseCapability(thread_, promise); + JSHandle newPromise(thread_, capbility->GetPromise()); EXPECT_EQ(static_cast(newPromise->GetPromiseState().GetInt()), PromiseStatus::PENDING); - JSHandle resolve(thread, capbility->GetResolve()); - JSHandle reject(thread, capbility->GetReject()); + JSHandle resolve(thread_, capbility->GetResolve()); + JSHandle reject(thread_, capbility->GetReject()); EXPECT_EQ(resolve.GetTaggedValue().IsCallable(), true); EXPECT_EQ(resolve.GetTaggedValue().IsCallable(), true); - JSHandle resolve_promise(thread, resolve->GetPromise()); - JSHandle reject_promise(thread, reject->GetPromise()); + JSHandle resolve_promise(thread_, resolve->GetPromise()); + JSHandle reject_promise(thread_, reject->GetPromise()); EXPECT_EQ(JSTaggedValue::SameValue(newPromise.GetTaggedValue(), resolve_promise.GetTaggedValue()), true); EXPECT_EQ(JSTaggedValue::SameValue(newPromise.GetTaggedValue(), reject_promise.GetTaggedValue()), true); } TEST_F(JSPromiseTest, FullFillPromise) { - EcmaVM *ecmaVM = thread->GetEcmaVM(); + EcmaVM *ecmaVM = thread_->GetEcmaVM(); JSHandle env = ecmaVM->GetGlobalEnv(); JSHandle promise = env->GetPromiseFunction(); - JSHandle capbility = JSPromise::NewPromiseCapability(thread, promise); - JSHandle newPromise(thread, capbility->GetPromise()); + JSHandle capbility = JSPromise::NewPromiseCapability(thread_, promise); + JSHandle newPromise(thread_, capbility->GetPromise()); EXPECT_EQ(static_cast(newPromise->GetPromiseState().GetInt()), PromiseStatus::PENDING); EXPECT_EQ(newPromise->GetPromiseResult().IsUndefined(), true); - JSHandle resolve(thread, capbility->GetResolve()); - JSHandle undefined(thread, JSTaggedValue::Undefined()); - InternalCallParams *arguments = thread->GetInternalCallParams(); + JSHandle resolve(thread_, capbility->GetResolve()); + JSHandle undefined(thread_, JSTaggedValue::Undefined()); + InternalCallParams *arguments = thread_->GetInternalCallParams(); arguments->MakeArgv(JSTaggedValue(33)); - JSFunction::Call(thread, resolve, undefined, 1, arguments->GetArgv()); + JSFunction::Call(thread_, resolve, undefined, 1, arguments->GetArgv()); EXPECT_EQ(static_cast(newPromise->GetPromiseState().GetInt()), PromiseStatus::FULFILLED); EXPECT_EQ(JSTaggedValue::SameValue(newPromise->GetPromiseResult(), JSTaggedValue(33)), true); } TEST_F(JSPromiseTest, RejectPromise) { - EcmaVM *ecmaVM = thread->GetEcmaVM(); + EcmaVM *ecmaVM = thread_->GetEcmaVM(); JSHandle env = ecmaVM->GetGlobalEnv(); JSHandle promise = env->GetPromiseFunction(); - JSHandle capbility = JSPromise::NewPromiseCapability(thread, promise); - JSHandle newPromise(thread, capbility->GetPromise()); + JSHandle capbility = JSPromise::NewPromiseCapability(thread_, promise); + JSHandle newPromise(thread_, capbility->GetPromise()); EXPECT_EQ(static_cast(newPromise->GetPromiseState().GetInt()), PromiseStatus::PENDING); EXPECT_EQ(newPromise->GetPromiseResult().IsUndefined(), true); - JSHandle reject(thread, capbility->GetReject()); - JSHandle undefined(thread, JSTaggedValue::Undefined()); - InternalCallParams *arguments = thread->GetInternalCallParams(); + JSHandle reject(thread_, capbility->GetReject()); + JSHandle undefined(thread_, JSTaggedValue::Undefined()); + InternalCallParams *arguments = thread_->GetInternalCallParams(); arguments->MakeArgv(JSTaggedValue(44)); - JSFunction::Call(thread, reject, undefined, 1, arguments->GetArgv()); + JSFunction::Call(thread_, reject, undefined, 1, arguments->GetArgv()); EXPECT_EQ(static_cast(newPromise->GetPromiseState().GetInt()), PromiseStatus::REJECTED); EXPECT_EQ(JSTaggedValue::SameValue(newPromise->GetPromiseResult(), JSTaggedValue(44)), true); } diff --git a/tests/runtime/common/js_proxy_test.cpp b/tests/runtime/common/js_proxy_test.cpp index 3b1dfd2e86976f5ca86270cf1f0cf19e42f589f9..a3eaeccae1465ced663d7cca4d913036494ab6d4 100644 --- a/tests/runtime/common/js_proxy_test.cpp +++ b/tests/runtime/common/js_proxy_test.cpp @@ -39,17 +39,17 @@ class JSProxyTest : public testing::Test { public: void SetUp() override { - TestHelper::CreateEcmaVMWithScope(instance, thread, scope); + TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); } void TearDown() override { - TestHelper::DestroyEcmaVMWithScope(instance, scope); + TestHelper::DestroyEcmaVMWithScope(instance_, scope_); } - PandaVM *instance {nullptr}; - ecmascript::EcmaHandleScope *scope {nullptr}; - JSThread *thread; + PandaVM *instance_ {nullptr}; + ecmascript::EcmaHandleScope *scope_ {nullptr}; + JSThread *thread_; }; static JSFunction *JSObjectTestCreate(JSThread *thread) @@ -61,25 +61,25 @@ static JSFunction *JSObjectTestCreate(JSThread *thread) TEST_F(JSProxyTest, ProxyCreate) { - JSHandle dynclass(thread, JSObjectTestCreate(thread)); + JSHandle dynclass(thread_, JSObjectTestCreate(thread_)); JSHandle target_handle( - thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle::Cast(dynclass), dynclass)); + thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle::Cast(dynclass), dynclass)); - JSHandle key(thread->GetEcmaVM()->GetFactory()->NewFromString("x")); - JSHandle value(thread, JSTaggedValue(1)); - JSObject::SetProperty(thread, target_handle, key, value); - EXPECT_EQ(JSObject::GetProperty(thread, target_handle, key).GetValue()->GetInt(), 1); + JSHandle key(thread_->GetEcmaVM()->GetFactory()->NewFromString("x")); + JSHandle value(thread_, JSTaggedValue(1)); + JSObject::SetProperty(thread_, target_handle, key, value); + EXPECT_EQ(JSObject::GetProperty(thread_, target_handle, key).GetValue()->GetInt(), 1); JSHandle handler_handle( - thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle::Cast(dynclass), dynclass)); + thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle::Cast(dynclass), dynclass)); EXPECT_TRUE(handler_handle->IsECMAObject()); - JSHandle proxy_handle = JSProxy::ProxyCreate(thread, target_handle, handler_handle); + JSHandle proxy_handle = JSProxy::ProxyCreate(thread_, target_handle, handler_handle); EXPECT_TRUE(*proxy_handle != nullptr); - EXPECT_EQ(JSProxy::GetProperty(thread, proxy_handle, key).GetValue()->GetInt(), 1); - PropertyDescriptor desc(thread); - JSProxy::GetOwnProperty(thread, proxy_handle, key, desc); + EXPECT_EQ(JSProxy::GetProperty(thread_, proxy_handle, key).GetValue()->GetInt(), 1); + PropertyDescriptor desc(thread_); + JSProxy::GetOwnProperty(thread_, proxy_handle, key, desc); EXPECT_EQ(desc.GetValue()->GetInt(), 1); } @@ -91,36 +91,36 @@ JSTaggedValue HandlerGetProperty([[maybe_unused]] EcmaRuntimeCallInfo *argv) TEST_F(JSProxyTest, GetProperty) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); // 1. handler has no "get" - JSHandle dynclass(thread, JSObjectTestCreate(thread)); + JSHandle dynclass(thread_, JSObjectTestCreate(thread_)); JSHandle target_handle(factory->NewJSObjectByConstructor(JSHandle(dynclass), dynclass)); EXPECT_TRUE(target_handle->IsECMAObject()); JSHandle key(factory->NewFromString("x")); - JSHandle value(thread, JSTaggedValue(1)); - JSObject::SetProperty(thread, target_handle, key, value); - EXPECT_EQ(JSObject::GetProperty(thread, target_handle, key).GetValue()->GetInt(), 1); + JSHandle value(thread_, JSTaggedValue(1)); + JSObject::SetProperty(thread_, target_handle, key, value); + EXPECT_EQ(JSObject::GetProperty(thread_, target_handle, key).GetValue()->GetInt(), 1); JSHandle handler_handle(factory->NewJSObjectByConstructor(JSHandle(dynclass), dynclass)); EXPECT_TRUE(handler_handle->IsECMAObject()); - JSHandle proxy_handle = JSProxy::ProxyCreate(thread, target_handle, handler_handle); + JSHandle proxy_handle = JSProxy::ProxyCreate(thread_, target_handle, handler_handle); EXPECT_TRUE(*proxy_handle != nullptr); - EXPECT_EQ(JSProxy::GetProperty(thread, proxy_handle, key).GetValue()->GetInt(), 1); + EXPECT_EQ(JSProxy::GetProperty(thread_, proxy_handle, key).GetValue()->GetInt(), 1); // 2. handler has "get" - EcmaVM *vm = thread->GetEcmaVM(); + EcmaVM *vm = thread_->GetEcmaVM(); JSHandle env = vm->GetGlobalEnv(); - JSHandle get_key = thread->GlobalConstants()->GetHandledGetString(); + JSHandle get_key = thread_->GlobalConstants()->GetHandledGetString(); JSHandle get_handle(factory->NewJSFunction(env, reinterpret_cast(HandlerGetProperty))); - JSObject::SetProperty(thread, JSHandle(handler_handle), get_key, get_handle); + JSObject::SetProperty(thread_, JSHandle(handler_handle), get_key, get_handle); - JSHandle proxy_handle2(JSProxy::ProxyCreate(thread, target_handle, handler_handle)); + JSHandle proxy_handle2(JSProxy::ProxyCreate(thread_, target_handle, handler_handle)); EXPECT_TRUE(*proxy_handle2 != nullptr); JSHandle key2(factory->NewFromString("y")); - EXPECT_EQ(JSProxy::GetProperty(thread, proxy_handle2, key2).GetValue()->GetInt(), 10); + EXPECT_EQ(JSProxy::GetProperty(thread_, proxy_handle2, key2).GetValue()->GetInt(), 10); } // ES6 9.5.5 [[GetOwnProperty]] (P) @@ -131,39 +131,39 @@ JSTaggedValue HandlerGetOwnProperty([[maybe_unused]] EcmaRuntimeCallInfo *argv) TEST_F(JSProxyTest, GetOwnProperty) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); // 1. handler has no "get" - JSHandle dynclass(thread, JSObjectTestCreate(thread)); + JSHandle dynclass(thread_, JSObjectTestCreate(thread_)); JSHandle target_handle(factory->NewJSObjectByConstructor(JSHandle(dynclass), dynclass)); EXPECT_TRUE(target_handle->IsECMAObject()); JSHandle key(factory->NewFromString("x")); - JSHandle value(thread, JSTaggedValue(1)); - JSObject::SetProperty(thread, target_handle, key, value); - EXPECT_EQ(JSObject::GetProperty(thread, target_handle, key).GetValue()->GetInt(), 1); + JSHandle value(thread_, JSTaggedValue(1)); + JSObject::SetProperty(thread_, target_handle, key, value); + EXPECT_EQ(JSObject::GetProperty(thread_, target_handle, key).GetValue()->GetInt(), 1); JSHandle handler_handle(factory->NewJSObjectByConstructor(JSHandle(dynclass), dynclass)); EXPECT_TRUE(handler_handle->IsECMAObject()); - JSHandle proxy_handle = JSProxy::ProxyCreate(thread, target_handle, handler_handle); + JSHandle proxy_handle = JSProxy::ProxyCreate(thread_, target_handle, handler_handle); EXPECT_TRUE(*proxy_handle != nullptr); - PropertyDescriptor desc(thread); - JSProxy::GetOwnProperty(thread, proxy_handle, key, desc); + PropertyDescriptor desc(thread_); + JSProxy::GetOwnProperty(thread_, proxy_handle, key, desc); EXPECT_EQ(desc.GetValue()->GetInt(), 1); // 2. handler has "get" - EcmaVM *vm = thread->GetEcmaVM(); + EcmaVM *vm = thread_->GetEcmaVM(); JSHandle env = vm->GetGlobalEnv(); - JSHandle define_key = thread->GlobalConstants()->GetHandledGetOwnPropertyDescriptorString(); + JSHandle define_key = thread_->GlobalConstants()->GetHandledGetOwnPropertyDescriptorString(); JSHandle define_handle(factory->NewJSFunction(env, reinterpret_cast(HandlerGetOwnProperty))); - JSObject::SetProperty(thread, JSHandle(handler_handle), define_key, define_handle); + JSObject::SetProperty(thread_, JSHandle(handler_handle), define_key, define_handle); - JSHandle proxy_handle2 = JSProxy::ProxyCreate(thread, target_handle, handler_handle); + JSHandle proxy_handle2 = JSProxy::ProxyCreate(thread_, target_handle, handler_handle); EXPECT_TRUE(*proxy_handle2 != nullptr); JSHandle key2(factory->NewFromString("y")); - PropertyDescriptor desc2(thread); - EXPECT_FALSE(JSProxy::GetOwnProperty(thread, proxy_handle2, key2, desc2)); + PropertyDescriptor desc2(thread_); + EXPECT_FALSE(JSProxy::GetOwnProperty(thread_, proxy_handle2, key2, desc2)); } // ES6 9.5.9 [[Set]] ( P, V, Receiver) @@ -175,37 +175,37 @@ JSTaggedValue HandlerSetProperty([[maybe_unused]] EcmaRuntimeCallInfo *argv) TEST_F(JSProxyTest, SetProperty) { // 1. handler has no "get" - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); // 1. handler has no "get" - JSHandle dynclass(thread, JSObjectTestCreate(thread)); + JSHandle dynclass(thread_, JSObjectTestCreate(thread_)); JSHandle target_handle(factory->NewJSObjectByConstructor(JSHandle(dynclass), dynclass)); EXPECT_TRUE(target_handle->IsECMAObject()); JSHandle key(factory->NewFromString("x")); - JSHandle value(thread, JSTaggedValue(1)); + JSHandle value(thread_, JSTaggedValue(1)); JSHandle handler_handle(factory->NewJSObjectByConstructor(JSHandle(dynclass), dynclass)); EXPECT_TRUE(handler_handle->IsECMAObject()); - JSHandle proxy_handle = JSProxy::ProxyCreate(thread, target_handle, handler_handle); + JSHandle proxy_handle = JSProxy::ProxyCreate(thread_, target_handle, handler_handle); EXPECT_TRUE(*proxy_handle != nullptr); - EXPECT_TRUE(JSProxy::SetProperty(thread, proxy_handle, key, value)); - EXPECT_EQ(JSProxy::GetProperty(thread, proxy_handle, key).GetValue()->GetInt(), 1); - EXPECT_EQ(JSObject::GetProperty(thread, target_handle, key).GetValue()->GetInt(), 1); + EXPECT_TRUE(JSProxy::SetProperty(thread_, proxy_handle, key, value)); + EXPECT_EQ(JSProxy::GetProperty(thread_, proxy_handle, key).GetValue()->GetInt(), 1); + EXPECT_EQ(JSObject::GetProperty(thread_, target_handle, key).GetValue()->GetInt(), 1); // 2. handler has "set" - EcmaVM *vm = thread->GetEcmaVM(); + EcmaVM *vm = thread_->GetEcmaVM(); JSHandle env = vm->GetGlobalEnv(); - JSHandle set_key = thread->GlobalConstants()->GetHandledSetString(); + JSHandle set_key = thread_->GlobalConstants()->GetHandledSetString(); JSHandle set_handle(factory->NewJSFunction(env, reinterpret_cast(HandlerSetProperty))); - JSObject::SetProperty(thread, JSHandle(handler_handle), set_key, set_handle); + JSObject::SetProperty(thread_, JSHandle(handler_handle), set_key, set_handle); - JSHandle proxy_handle2(JSProxy::ProxyCreate(thread, target_handle, handler_handle)); + JSHandle proxy_handle2(JSProxy::ProxyCreate(thread_, target_handle, handler_handle)); EXPECT_TRUE(*proxy_handle2 != nullptr); - JSHandle value2(thread, JSTaggedValue(10)); - EXPECT_FALSE(JSProxy::SetProperty(thread, proxy_handle2, key, value2)); - EXPECT_EQ(JSProxy::GetProperty(thread, proxy_handle2, key).GetValue()->GetInt(), 1); + JSHandle value2(thread_, JSTaggedValue(10)); + EXPECT_FALSE(JSProxy::SetProperty(thread_, proxy_handle2, key, value2)); + EXPECT_EQ(JSProxy::GetProperty(thread_, proxy_handle2, key).GetValue()->GetInt(), 1); } // ES6 9.5.6 [[DefineOwnProperty]] (P, Desc) @@ -216,38 +216,38 @@ JSTaggedValue HandlerDefineOwnProperty([[maybe_unused]] EcmaRuntimeCallInfo *arg TEST_F(JSProxyTest, DefineOwnProperty) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); // 1. handler has no "defineProperty" - JSHandle dynclass(thread, JSObjectTestCreate(thread)); + JSHandle dynclass(thread_, JSObjectTestCreate(thread_)); JSHandle target_handle(factory->NewJSObjectByConstructor(JSHandle(dynclass), dynclass)); EXPECT_TRUE(target_handle->IsECMAObject()); JSHandle key(factory->NewFromString("x")); - JSHandle value(thread, JSTaggedValue(1)); + JSHandle value(thread_, JSTaggedValue(1)); JSHandle handler_handle(factory->NewJSObjectByConstructor(JSHandle(dynclass), dynclass)); EXPECT_TRUE(handler_handle->IsECMAObject()); - JSHandle proxy_handle = JSProxy::ProxyCreate(thread, target_handle, handler_handle); + JSHandle proxy_handle = JSProxy::ProxyCreate(thread_, target_handle, handler_handle); EXPECT_TRUE(*proxy_handle != nullptr); - PropertyDescriptor desc(thread, JSHandle(thread, JSTaggedValue(1))); - EXPECT_TRUE(JSProxy::DefineOwnProperty(thread, proxy_handle, key, desc)); - EXPECT_EQ(JSProxy::GetProperty(thread, proxy_handle, key).GetValue()->GetInt(), 1); - EXPECT_EQ(JSObject::GetProperty(thread, target_handle, key).GetValue()->GetInt(), 1); + PropertyDescriptor desc(thread_, JSHandle(thread_, JSTaggedValue(1))); + EXPECT_TRUE(JSProxy::DefineOwnProperty(thread_, proxy_handle, key, desc)); + EXPECT_EQ(JSProxy::GetProperty(thread_, proxy_handle, key).GetValue()->GetInt(), 1); + EXPECT_EQ(JSObject::GetProperty(thread_, target_handle, key).GetValue()->GetInt(), 1); // 2. handler has "defineProperty" - EcmaVM *vm = thread->GetEcmaVM(); + EcmaVM *vm = thread_->GetEcmaVM(); JSHandle env = vm->GetGlobalEnv(); - JSHandle set_key = thread->GlobalConstants()->GetHandledDefinePropertyString(); + JSHandle set_key = thread_->GlobalConstants()->GetHandledDefinePropertyString(); JSHandle set_handle(factory->NewJSFunction(env, reinterpret_cast(HandlerDefineOwnProperty))); - JSObject::SetProperty(thread, JSHandle(handler_handle), set_key, set_handle); + JSObject::SetProperty(thread_, JSHandle(handler_handle), set_key, set_handle); - JSHandle proxy_handle2 = JSProxy::ProxyCreate(thread, target_handle, handler_handle); + JSHandle proxy_handle2 = JSProxy::ProxyCreate(thread_, target_handle, handler_handle); EXPECT_TRUE(*proxy_handle2 != nullptr); - PropertyDescriptor desc2(thread, JSHandle(thread, JSTaggedValue(10))); - EXPECT_FALSE(JSProxy::DefineOwnProperty(thread, proxy_handle, key, desc2)); - EXPECT_EQ(JSProxy::GetProperty(thread, proxy_handle2, key).GetValue()->GetInt(), 1); + PropertyDescriptor desc2(thread_, JSHandle(thread_, JSTaggedValue(10))); + EXPECT_FALSE(JSProxy::DefineOwnProperty(thread_, proxy_handle, key, desc2)); + EXPECT_EQ(JSProxy::GetProperty(thread_, proxy_handle2, key).GetValue()->GetInt(), 1); } JSTaggedValue HandlerDeleteProperty([[maybe_unused]] EcmaRuntimeCallInfo *argv) @@ -258,43 +258,43 @@ JSTaggedValue HandlerDeleteProperty([[maybe_unused]] EcmaRuntimeCallInfo *argv) // ES6 9.5.10 [[Delete]] (P) TEST_F(JSProxyTest, DeleteProperty) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); // 1. handler has no "deleteProperty" - JSHandle dynclass(thread, JSObjectTestCreate(thread)); + JSHandle dynclass(thread_, JSObjectTestCreate(thread_)); JSHandle target_handle(factory->NewJSObjectByConstructor(JSHandle(dynclass), dynclass)); EXPECT_TRUE(target_handle->IsECMAObject()); JSHandle key(factory->NewFromString("x")); - JSHandle value(thread, JSTaggedValue(1)); + JSHandle value(thread_, JSTaggedValue(1)); JSHandle handler_handle(factory->NewJSObjectByConstructor(JSHandle(dynclass), dynclass)); EXPECT_TRUE(handler_handle->IsECMAObject()); - JSHandle proxy_handle = JSProxy::ProxyCreate(thread, target_handle, handler_handle); + JSHandle proxy_handle = JSProxy::ProxyCreate(thread_, target_handle, handler_handle); EXPECT_TRUE(*proxy_handle != nullptr); - PropertyDescriptor desc(thread, JSHandle(thread, JSTaggedValue(1)), true, true, true); - EXPECT_TRUE(JSProxy::DefineOwnProperty(thread, proxy_handle, key, desc)); - EXPECT_EQ(JSProxy::GetProperty(thread, proxy_handle, key).GetValue()->GetInt(), 1); - EXPECT_EQ(JSObject::GetProperty(thread, target_handle, key).GetValue()->GetInt(), 1); - EXPECT_TRUE(JSProxy::DeleteProperty(thread, proxy_handle, key)); - PropertyDescriptor res_desc(thread); - JSProxy::GetOwnProperty(thread, proxy_handle, key, res_desc); + PropertyDescriptor desc(thread_, JSHandle(thread_, JSTaggedValue(1)), true, true, true); + EXPECT_TRUE(JSProxy::DefineOwnProperty(thread_, proxy_handle, key, desc)); + EXPECT_EQ(JSProxy::GetProperty(thread_, proxy_handle, key).GetValue()->GetInt(), 1); + EXPECT_EQ(JSObject::GetProperty(thread_, target_handle, key).GetValue()->GetInt(), 1); + EXPECT_TRUE(JSProxy::DeleteProperty(thread_, proxy_handle, key)); + PropertyDescriptor res_desc(thread_); + JSProxy::GetOwnProperty(thread_, proxy_handle, key, res_desc); EXPECT_TRUE(JSTaggedValue::SameValue(res_desc.GetValue().GetTaggedValue(), JSTaggedValue::Undefined())); // 2. handler has "deleteProperty" - EcmaVM *vm = thread->GetEcmaVM(); + EcmaVM *vm = thread_->GetEcmaVM(); JSHandle env = vm->GetGlobalEnv(); - JSHandle func_key = thread->GlobalConstants()->GetHandledDeletePropertyString(); + JSHandle func_key = thread_->GlobalConstants()->GetHandledDeletePropertyString(); JSHandle func_handle(factory->NewJSFunction(env, reinterpret_cast(HandlerDeleteProperty))); - JSObject::SetProperty(thread, JSHandle(handler_handle), func_key, func_handle); + JSObject::SetProperty(thread_, JSHandle(handler_handle), func_key, func_handle); - JSHandle proxy_handle2 = JSProxy::ProxyCreate(thread, target_handle, handler_handle); + JSHandle proxy_handle2 = JSProxy::ProxyCreate(thread_, target_handle, handler_handle); EXPECT_TRUE(*proxy_handle2 != nullptr); - PropertyDescriptor desc2(thread, JSHandle(thread, JSTaggedValue(1)), true, true, true); - EXPECT_TRUE(JSProxy::DefineOwnProperty(thread, proxy_handle2, key, desc2)); - EXPECT_EQ(JSProxy::GetProperty(thread, proxy_handle2, key).GetValue()->GetInt(), 1); - EXPECT_FALSE(JSProxy::DeleteProperty(thread, proxy_handle2, key)); + PropertyDescriptor desc2(thread_, JSHandle(thread_, JSTaggedValue(1)), true, true, true); + EXPECT_TRUE(JSProxy::DefineOwnProperty(thread_, proxy_handle2, key, desc2)); + EXPECT_EQ(JSProxy::GetProperty(thread_, proxy_handle2, key).GetValue()->GetInt(), 1); + EXPECT_FALSE(JSProxy::DeleteProperty(thread_, proxy_handle2, key)); } JSTaggedValue HandlerGetPrototype([[maybe_unused]] EcmaRuntimeCallInfo *argv) @@ -305,34 +305,34 @@ JSTaggedValue HandlerGetPrototype([[maybe_unused]] EcmaRuntimeCallInfo *argv) // ES6 9.5.1 [[GetPrototypeOf]] ( ) TEST_F(JSProxyTest, GetPrototypeOf) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); // 1. handler has no "GetPrototypeOf" - JSHandle dynclass(thread, JSObjectTestCreate(thread)); + JSHandle dynclass(thread_, JSObjectTestCreate(thread_)); JSHandle proto(factory->NewJSObjectByConstructor(JSHandle(dynclass), dynclass)); JSHandle target_handle(factory->NewJSObjectByConstructor(JSHandle(dynclass), dynclass)); EXPECT_TRUE(target_handle->IsECMAObject()); - JSObject::SetPrototype(thread, JSHandle(target_handle), proto); + JSObject::SetPrototype(thread_, JSHandle(target_handle), proto); EXPECT_TRUE( - JSTaggedValue::SameValue(JSHandle(target_handle)->GetPrototype(thread), proto.GetTaggedValue())); + JSTaggedValue::SameValue(JSHandle(target_handle)->GetPrototype(thread_), proto.GetTaggedValue())); JSHandle handler_handle(factory->NewJSObjectByConstructor(JSHandle(dynclass), dynclass)); EXPECT_TRUE(handler_handle->IsECMAObject()); - JSHandle proxy_handle = JSProxy::ProxyCreate(thread, target_handle, handler_handle); + JSHandle proxy_handle = JSProxy::ProxyCreate(thread_, target_handle, handler_handle); EXPECT_TRUE(*proxy_handle != nullptr); - EXPECT_TRUE(JSTaggedValue::SameValue(JSProxy::GetPrototype(thread, proxy_handle), proto.GetTaggedValue())); + EXPECT_TRUE(JSTaggedValue::SameValue(JSProxy::GetPrototype(thread_, proxy_handle), proto.GetTaggedValue())); // 2. handler has "GetPrototypeOf" - EcmaVM *vm = thread->GetEcmaVM(); + EcmaVM *vm = thread_->GetEcmaVM(); JSHandle env = vm->GetGlobalEnv(); - JSHandle func_key = thread->GlobalConstants()->GetHandledGetPrototypeOfString(); + JSHandle func_key = thread_->GlobalConstants()->GetHandledGetPrototypeOfString(); JSHandle func_handle(factory->NewJSFunction(env, reinterpret_cast(HandlerGetPrototype))); - JSObject::SetProperty(thread, JSHandle(handler_handle), func_key, func_handle); + JSObject::SetProperty(thread_, JSHandle(handler_handle), func_key, func_handle); - JSHandle proxy_handle2 = JSProxy::ProxyCreate(thread, target_handle, handler_handle); + JSHandle proxy_handle2 = JSProxy::ProxyCreate(thread_, target_handle, handler_handle); EXPECT_TRUE(*proxy_handle2 != nullptr); - EXPECT_TRUE(JSTaggedValue::SameValue(JSProxy::GetPrototype(thread, proxy_handle2), JSTaggedValue::Null())); + EXPECT_TRUE(JSTaggedValue::SameValue(JSProxy::GetPrototype(thread_, proxy_handle2), JSTaggedValue::Null())); } JSTaggedValue HandlerSetPrototype([[maybe_unused]] EcmaRuntimeCallInfo *argv) @@ -343,9 +343,9 @@ JSTaggedValue HandlerSetPrototype([[maybe_unused]] EcmaRuntimeCallInfo *argv) // ES6 9.5.2 [[SetPrototypeOf]] (V) TEST_F(JSProxyTest, SetPrototypeOf) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); // 1. handler has no "SetPrototypeOf" - JSHandle dynclass(thread, JSObjectTestCreate(thread)); + JSHandle dynclass(thread_, JSObjectTestCreate(thread_)); JSHandle proto(factory->NewJSObjectByConstructor(JSHandle(dynclass), dynclass)); JSHandle target_handle(factory->NewJSObjectByConstructor(JSHandle(dynclass), dynclass)); EXPECT_TRUE(target_handle->IsECMAObject()); @@ -353,23 +353,23 @@ TEST_F(JSProxyTest, SetPrototypeOf) JSHandle handler_handle(factory->NewJSObjectByConstructor(JSHandle(dynclass), dynclass)); EXPECT_TRUE(handler_handle->IsECMAObject()); - JSHandle proxy_handle = JSProxy::ProxyCreate(thread, target_handle, handler_handle); + JSHandle proxy_handle = JSProxy::ProxyCreate(thread_, target_handle, handler_handle); EXPECT_TRUE(*proxy_handle != nullptr); - JSProxy::SetPrototype(thread, proxy_handle, proto); + JSProxy::SetPrototype(thread_, proxy_handle, proto); EXPECT_TRUE( - JSTaggedValue::SameValue(JSHandle(target_handle)->GetPrototype(thread), proto.GetTaggedValue())); + JSTaggedValue::SameValue(JSHandle(target_handle)->GetPrototype(thread_), proto.GetTaggedValue())); // 2. handler has "SetPrototypeOf" - EcmaVM *vm = thread->GetEcmaVM(); + EcmaVM *vm = thread_->GetEcmaVM(); JSHandle env = vm->GetGlobalEnv(); - JSHandle func_key = thread->GlobalConstants()->GetHandledSetPrototypeOfString(); + JSHandle func_key = thread_->GlobalConstants()->GetHandledSetPrototypeOfString(); JSHandle func_handle(factory->NewJSFunction(env, reinterpret_cast(HandlerSetPrototype))); - JSObject::SetProperty(thread, JSHandle(handler_handle), func_key, func_handle); + JSObject::SetProperty(thread_, JSHandle(handler_handle), func_key, func_handle); - JSHandle proxy_handle2 = JSProxy::ProxyCreate(thread, target_handle, handler_handle); + JSHandle proxy_handle2 = JSProxy::ProxyCreate(thread_, target_handle, handler_handle); EXPECT_TRUE(*proxy_handle2 != nullptr); - EXPECT_FALSE(JSProxy::SetPrototype(thread, proxy_handle2, proto)); + EXPECT_FALSE(JSProxy::SetPrototype(thread_, proxy_handle2, proto)); } JSTaggedValue HandlerIsExtensible([[maybe_unused]] EcmaRuntimeCallInfo *argv) @@ -380,32 +380,32 @@ JSTaggedValue HandlerIsExtensible([[maybe_unused]] EcmaRuntimeCallInfo *argv) // ES6 9.5.3 [[IsExtensible]] ( ) TEST_F(JSProxyTest, IsExtensible) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); // 1. handler has no "IsExtensible" - JSHandle dynclass(thread, JSObjectTestCreate(thread)); + JSHandle dynclass(thread_, JSObjectTestCreate(thread_)); JSHandle target_handle(factory->NewJSObjectByConstructor(JSHandle(dynclass), dynclass)); EXPECT_TRUE(target_handle->IsECMAObject()); JSHandle handler_handle(factory->NewJSObjectByConstructor(JSHandle(dynclass), dynclass)); EXPECT_TRUE(handler_handle->IsECMAObject()); - JSHandle proxy_handle = JSProxy::ProxyCreate(thread, target_handle, handler_handle); + JSHandle proxy_handle = JSProxy::ProxyCreate(thread_, target_handle, handler_handle); EXPECT_TRUE(*proxy_handle != nullptr); - bool status1 = JSProxy::IsExtensible(thread, proxy_handle); + bool status1 = JSProxy::IsExtensible(thread_, proxy_handle); bool status2 = JSHandle::Cast(target_handle)->IsExtensible(); EXPECT_TRUE(status1 == status2); // 2. handler has "IsExtensible" - EcmaVM *vm = thread->GetEcmaVM(); + EcmaVM *vm = thread_->GetEcmaVM(); JSHandle env = vm->GetGlobalEnv(); - JSHandle func_key = thread->GlobalConstants()->GetHandledIsExtensibleString(); + JSHandle func_key = thread_->GlobalConstants()->GetHandledIsExtensibleString(); JSHandle func_handle(factory->NewJSFunction(env, reinterpret_cast(HandlerIsExtensible))); - JSObject::SetProperty(thread, JSHandle(handler_handle), func_key, func_handle); + JSObject::SetProperty(thread_, JSHandle(handler_handle), func_key, func_handle); - JSHandle proxy_handle2 = JSProxy::ProxyCreate(thread, target_handle, handler_handle); + JSHandle proxy_handle2 = JSProxy::ProxyCreate(thread_, target_handle, handler_handle); EXPECT_TRUE(*proxy_handle2 != nullptr); - EXPECT_FALSE(JSProxy::IsExtensible(thread, proxy_handle2)); + EXPECT_FALSE(JSProxy::IsExtensible(thread_, proxy_handle2)); } JSTaggedValue HandlerPreventExtensions([[maybe_unused]] EcmaRuntimeCallInfo *argv) @@ -416,34 +416,34 @@ JSTaggedValue HandlerPreventExtensions([[maybe_unused]] EcmaRuntimeCallInfo *arg // ES6 9.5.4 [[PreventExtensions]] ( ) TEST_F(JSProxyTest, PreventExtensions) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); // 1. handler has no "PreventExtensions" - JSHandle dynclass(thread, JSObjectTestCreate(thread)); + JSHandle dynclass(thread_, JSObjectTestCreate(thread_)); JSHandle target_handle(factory->NewJSObjectByConstructor(JSHandle(dynclass), dynclass)); EXPECT_TRUE(target_handle->IsECMAObject()); JSHandle handler_handle(factory->NewJSObjectByConstructor(JSHandle(dynclass), dynclass)); EXPECT_TRUE(handler_handle->IsECMAObject()); - JSHandle proxy_handle = JSProxy::ProxyCreate(thread, target_handle, handler_handle); + JSHandle proxy_handle = JSProxy::ProxyCreate(thread_, target_handle, handler_handle); EXPECT_TRUE(*proxy_handle != nullptr); - bool status1 = JSProxy::PreventExtensions(thread, proxy_handle); + bool status1 = JSProxy::PreventExtensions(thread_, proxy_handle); EXPECT_TRUE(status1); bool status2 = JSHandle::Cast(target_handle)->IsExtensible(); EXPECT_FALSE(status2); // 2. handler has "PreventExtensions" - EcmaVM *vm = thread->GetEcmaVM(); + EcmaVM *vm = thread_->GetEcmaVM(); JSHandle env = vm->GetGlobalEnv(); - JSHandle func_key = thread->GlobalConstants()->GetHandledPreventExtensionsString(); + JSHandle func_key = thread_->GlobalConstants()->GetHandledPreventExtensionsString(); JSHandle func_handle( factory->NewJSFunction(env, reinterpret_cast(HandlerPreventExtensions))); - JSObject::SetProperty(thread, JSHandle(handler_handle), func_key, func_handle); + JSObject::SetProperty(thread_, JSHandle(handler_handle), func_key, func_handle); - JSHandle proxy_handle2 = JSProxy::ProxyCreate(thread, target_handle, handler_handle); + JSHandle proxy_handle2 = JSProxy::ProxyCreate(thread_, target_handle, handler_handle); EXPECT_TRUE(*proxy_handle2 != nullptr); - EXPECT_FALSE(JSProxy::PreventExtensions(thread, proxy_handle2)); + EXPECT_FALSE(JSProxy::PreventExtensions(thread_, proxy_handle2)); } JSTaggedValue HandlerHasProperty([[maybe_unused]] EcmaRuntimeCallInfo *argv) @@ -454,34 +454,34 @@ JSTaggedValue HandlerHasProperty([[maybe_unused]] EcmaRuntimeCallInfo *argv) // ES6 9.5.7 [[HasProperty]] (P) TEST_F(JSProxyTest, HasProperty) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); // 1. handler has no "HasProperty" - JSHandle dynclass(thread, JSObjectTestCreate(thread)); + JSHandle dynclass(thread_, JSObjectTestCreate(thread_)); JSHandle target_handle(factory->NewJSObjectByConstructor(JSHandle(dynclass), dynclass)); EXPECT_TRUE(target_handle->IsECMAObject()); JSHandle key(factory->NewFromString("x")); - PropertyDescriptor desc(thread, JSHandle(thread, JSTaggedValue(1))); - JSObject::DefineOwnProperty(thread, JSHandle::Cast(target_handle), key, desc); + PropertyDescriptor desc(thread_, JSHandle(thread_, JSTaggedValue(1))); + JSObject::DefineOwnProperty(thread_, JSHandle::Cast(target_handle), key, desc); JSHandle handler_handle(factory->NewJSObjectByConstructor(JSHandle(dynclass), dynclass)); EXPECT_TRUE(handler_handle->IsECMAObject()); - JSHandle proxy_handle = JSProxy::ProxyCreate(thread, target_handle, handler_handle); + JSHandle proxy_handle = JSProxy::ProxyCreate(thread_, target_handle, handler_handle); EXPECT_TRUE(*proxy_handle != nullptr); - EXPECT_TRUE(JSProxy::HasProperty(thread, proxy_handle, key)); + EXPECT_TRUE(JSProxy::HasProperty(thread_, proxy_handle, key)); // 2. handler has "HasProperty" - EcmaVM *vm = thread->GetEcmaVM(); + EcmaVM *vm = thread_->GetEcmaVM(); JSHandle env = vm->GetGlobalEnv(); - JSHandle func_key = thread->GlobalConstants()->GetHandledHasString(); + JSHandle func_key = thread_->GlobalConstants()->GetHandledHasString(); JSHandle func_handle(factory->NewJSFunction(env, reinterpret_cast(HandlerHasProperty))); - JSObject::SetProperty(thread, JSHandle(handler_handle), func_key, func_handle); + JSObject::SetProperty(thread_, JSHandle(handler_handle), func_key, func_handle); - JSHandle proxy_handle2 = JSProxy::ProxyCreate(thread, target_handle, handler_handle); + JSHandle proxy_handle2 = JSProxy::ProxyCreate(thread_, target_handle, handler_handle); EXPECT_TRUE(*proxy_handle2 != nullptr); - EXPECT_FALSE(JSProxy::HasProperty(thread, proxy_handle2, key)); + EXPECT_FALSE(JSProxy::HasProperty(thread_, proxy_handle2, key)); } JSTaggedValue HandlerOwnPropertyKeys([[maybe_unused]] EcmaRuntimeCallInfo *argv) @@ -495,22 +495,22 @@ JSTaggedValue HandlerOwnPropertyKeys([[maybe_unused]] EcmaRuntimeCallInfo *argv) // ES6 9.5.12 [[OwnPropertyKeys]] () TEST_F(JSProxyTest, OwnPropertyKeys) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); // 1. handler has no "OwnPropertyKeys" - JSHandle dynclass(thread, JSObjectTestCreate(thread)); + JSHandle dynclass(thread_, JSObjectTestCreate(thread_)); JSHandle target_handle(factory->NewJSObjectByConstructor(JSHandle(dynclass), dynclass)); EXPECT_TRUE(target_handle->IsECMAObject()); JSHandle key(factory->NewFromString("x")); - PropertyDescriptor desc(thread, JSHandle(thread, JSTaggedValue(1))); - JSObject::DefineOwnProperty(thread, JSHandle::Cast(target_handle), key, desc); + PropertyDescriptor desc(thread_, JSHandle(thread_, JSTaggedValue(1))); + JSObject::DefineOwnProperty(thread_, JSHandle::Cast(target_handle), key, desc); JSHandle handler_handle(factory->NewJSObjectByConstructor(JSHandle(dynclass), dynclass)); EXPECT_TRUE(handler_handle->IsECMAObject()); - JSHandle proxy_handle = JSProxy::ProxyCreate(thread, target_handle, handler_handle); + JSHandle proxy_handle = JSProxy::ProxyCreate(thread_, target_handle, handler_handle); EXPECT_TRUE(*proxy_handle != nullptr); - JSHandle res = JSProxy::OwnPropertyKeys(thread, proxy_handle); + JSHandle res = JSProxy::OwnPropertyKeys(thread_, proxy_handle); EXPECT_TRUE(JSTaggedValue::SameValue(res->Get(0), key.GetTaggedValue())); @@ -518,15 +518,15 @@ TEST_F(JSProxyTest, OwnPropertyKeys) // create new empty target so we wont throw TypeError at (18. - 21.) JSHandle target_handle2(factory->NewJSObjectByConstructor(JSHandle(dynclass), dynclass)); EXPECT_TRUE(target_handle2->IsECMAObject()); - EcmaVM *vm = thread->GetEcmaVM(); + EcmaVM *vm = thread_->GetEcmaVM(); JSHandle env = vm->GetGlobalEnv(); - JSHandle func_key = thread->GlobalConstants()->GetHandledOwnKeysString(); + JSHandle func_key = thread_->GlobalConstants()->GetHandledOwnKeysString(); JSHandle func_handle(factory->NewJSFunction(env, reinterpret_cast(HandlerOwnPropertyKeys))); - JSObject::SetProperty(thread, JSHandle(handler_handle), func_key, func_handle); + JSObject::SetProperty(thread_, JSHandle(handler_handle), func_key, func_handle); - JSHandle proxy_handle2 = JSProxy::ProxyCreate(thread, target_handle2, handler_handle); + JSHandle proxy_handle2 = JSProxy::ProxyCreate(thread_, target_handle2, handler_handle); EXPECT_TRUE(*proxy_handle2 != nullptr); - JSHandle res2 = JSProxy::OwnPropertyKeys(thread, proxy_handle2); + JSHandle res2 = JSProxy::OwnPropertyKeys(thread_, proxy_handle2); EXPECT_TRUE(res2->GetLength() == 0 || !JSTaggedValue::SameValue(res2->Get(0), key.GetTaggedValue())); } @@ -542,34 +542,34 @@ JSTaggedValue HandlerFunction([[maybe_unused]] EcmaRuntimeCallInfo *argv) // ES6 9.5.13 [[Call]] (thisArgument, argumentsList) TEST_F(JSProxyTest, Call) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle env = thread_->GetEcmaVM()->GetGlobalEnv(); // 1. handler has no "Call" - JSHandle dynclass(thread, JSObjectTestCreate(thread)); + JSHandle dynclass(thread_, JSObjectTestCreate(thread_)); JSHandle targetHandle(factory->NewJSFunction(env, reinterpret_cast(HandlerFunction))); EXPECT_TRUE(targetHandle->IsECMAObject()); JSHandle handlerHandle(factory->NewJSObjectByConstructor(JSHandle(dynclass), dynclass)); EXPECT_TRUE(handlerHandle->IsECMAObject()); - JSHandle proxyHandle = JSProxy::ProxyCreate(thread, targetHandle, handlerHandle); + JSHandle proxyHandle = JSProxy::ProxyCreate(thread_, targetHandle, handlerHandle); EXPECT_TRUE(*proxyHandle != nullptr); JSTaggedValue res = - JSProxy::CallInternal(thread, proxyHandle, JSHandle::Cast(proxyHandle), 0, nullptr); - JSHandle taggedRes(thread, res); + JSProxy::CallInternal(thread_, proxyHandle, JSHandle::Cast(proxyHandle), 0, nullptr); + JSHandle taggedRes(thread_, res); EXPECT_TRUE(JSTaggedValue::SameValue(taggedRes.GetTaggedValue(), JSTaggedValue::True())); // 2. handler has "Call" - JSHandle funcKey = thread->GlobalConstants()->GetHandledApplyString(); + JSHandle funcKey = thread_->GlobalConstants()->GetHandledApplyString(); JSHandle funcHandle(factory->NewJSFunction(env, reinterpret_cast(HandlerCall))); - JSObject::SetProperty(thread, JSHandle(handlerHandle), funcKey, funcHandle); + JSObject::SetProperty(thread_, JSHandle(handlerHandle), funcKey, funcHandle); - JSHandle proxyHandle2 = JSProxy::ProxyCreate(thread, targetHandle, handlerHandle); + JSHandle proxyHandle2 = JSProxy::ProxyCreate(thread_, targetHandle, handlerHandle); EXPECT_TRUE(*proxyHandle2 != nullptr); JSTaggedValue res2 = - JSProxy::CallInternal(thread, proxyHandle2, JSHandle::Cast(proxyHandle2), 0, nullptr); - JSHandle taggedRes2(thread, res2); + JSProxy::CallInternal(thread_, proxyHandle2, JSHandle::Cast(proxyHandle2), 0, nullptr); + JSHandle taggedRes2(thread_, res2); EXPECT_TRUE(JSTaggedValue::SameValue(taggedRes2.GetTaggedValue(), JSTaggedValue::False())); } @@ -602,10 +602,10 @@ JSTaggedValue HandlerConFunc([[maybe_unused]] EcmaRuntimeCallInfo *argv) // ES6 9.5.14 [[Construct]] ( argumentsList, newTarget) TEST_F(JSProxyTest, Construct) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle env = thread_->GetEcmaVM()->GetGlobalEnv(); // 1. handler has no "Construct" - JSHandle dynclass(thread, JSObjectTestCreate(thread)); + JSHandle dynclass(thread_, JSObjectTestCreate(thread_)); JSHandle targetHandle(factory->NewJSFunction(env, reinterpret_cast(HandlerConFunc))); JSHandle::Cast(targetHandle)->GetJSHClass()->SetConstructor(true); EXPECT_TRUE(targetHandle->IsECMAObject()); @@ -613,22 +613,22 @@ TEST_F(JSProxyTest, Construct) JSHandle handlerHandle(factory->NewJSObjectByConstructor(JSHandle(dynclass), dynclass)); EXPECT_TRUE(handlerHandle->IsECMAObject()); - JSHandle proxyHandle = JSProxy::ProxyCreate(thread, targetHandle, handlerHandle); + JSHandle proxyHandle = JSProxy::ProxyCreate(thread_, targetHandle, handlerHandle); EXPECT_TRUE(*proxyHandle != nullptr); - JSTaggedValue res = JSProxy::ConstructInternal(thread, proxyHandle, 0, nullptr, targetHandle); - JSHandle taggedRes(thread, res); + JSTaggedValue res = JSProxy::ConstructInternal(thread_, proxyHandle, 0, nullptr, targetHandle); + JSHandle taggedRes(thread_, res); JSHandle key(factory->NewFromCanBeCompressString("x")); - EXPECT_EQ(JSObject::GetProperty(thread, taggedRes, key).GetValue()->GetInt(), 1); + EXPECT_EQ(JSObject::GetProperty(thread_, taggedRes, key).GetValue()->GetInt(), 1); // 2. handler has "Construct" - JSHandle funcKey = thread->GlobalConstants()->GetHandledProxyConstructString(); + JSHandle funcKey = thread_->GlobalConstants()->GetHandledProxyConstructString(); JSHandle funcHandle(factory->NewJSFunction(env, reinterpret_cast(HandlerConstruct))); - JSObject::SetProperty(thread, JSHandle(handlerHandle), funcKey, funcHandle); + JSObject::SetProperty(thread_, JSHandle(handlerHandle), funcKey, funcHandle); - JSHandle proxyHandle2 = JSProxy::ProxyCreate(thread, targetHandle, handlerHandle); + JSHandle proxyHandle2 = JSProxy::ProxyCreate(thread_, targetHandle, handlerHandle); EXPECT_TRUE(*proxyHandle2 != nullptr); - JSTaggedValue res2 = JSProxy::ConstructInternal(thread, proxyHandle2, 0, nullptr, targetHandle); - JSHandle taggedRes2(thread, res2); - EXPECT_EQ(JSObject::GetProperty(thread, taggedRes2, key).GetValue()->GetInt(), 2); + JSTaggedValue res2 = JSProxy::ConstructInternal(thread_, proxyHandle2, 0, nullptr, targetHandle); + JSHandle taggedRes2(thread_, res2); + EXPECT_EQ(JSObject::GetProperty(thread_, taggedRes2, key).GetValue()->GetInt(), 2); } } // namespace panda::test diff --git a/tests/runtime/common/js_set_iterator_test.cpp b/tests/runtime/common/js_set_iterator_test.cpp index 035d74223ffc2ed426026dc9726f1420c9ca387a..42198e0df01c3c05b99044ed831d5c5d3b5f0a50 100644 --- a/tests/runtime/common/js_set_iterator_test.cpp +++ b/tests/runtime/common/js_set_iterator_test.cpp @@ -37,16 +37,16 @@ public: void SetUp() override { - TestHelper::CreateEcmaVMWithScope(instance, thread, scope); + TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); } void TearDown() override { - TestHelper::DestroyEcmaVMWithScope(instance, scope); + TestHelper::DestroyEcmaVMWithScope(instance_, scope_); } - ecmascript::EcmaHandleScope *scope {nullptr}; - PandaVM *instance {nullptr}; - JSThread *thread {nullptr}; + ecmascript::EcmaHandleScope *scope_ {nullptr}; + PandaVM *instance_ {nullptr}; + JSThread *thread_ {nullptr}; }; JSSet *CreateSet(JSThread *thread) @@ -71,11 +71,11 @@ JSSet *CreateSet(JSThread *thread) */ TEST_F(JSSetIteratorTest, CreateSetIterator) { - JSHandle jsSet(thread, CreateSet(thread)); + JSHandle jsSet(thread_, CreateSet(thread_)); EXPECT_TRUE(*jsSet != nullptr); JSHandle setIteratorValue1 = - JSSetIterator::CreateSetIterator(thread, JSHandle(jsSet), IterationKind::KEY); + JSSetIterator::CreateSetIterator(thread_, JSHandle(jsSet), IterationKind::KEY); EXPECT_EQ(setIteratorValue1->IsJSSetIterator(), true); JSHandle setIterator1(setIteratorValue1); @@ -86,7 +86,7 @@ TEST_F(JSSetIteratorTest, CreateSetIterator) EXPECT_EQ(JSTaggedValue::SameValue(iterationKind1, JSTaggedValue(static_cast(IterationKind::KEY))), true); JSHandle setIteratorValue2 = - JSSetIterator::CreateSetIterator(thread, JSHandle(jsSet), IterationKind::VALUE); + JSSetIterator::CreateSetIterator(thread_, JSHandle(jsSet), IterationKind::VALUE); EXPECT_EQ(setIteratorValue2->IsJSSetIterator(), true); JSHandle setIterator2(setIteratorValue2); @@ -106,44 +106,44 @@ TEST_F(JSSetIteratorTest, CreateSetIterator) */ TEST_F(JSSetIteratorTest, Next) { - JSHandle jsSet(thread, CreateSet(thread)); + JSHandle jsSet(thread_, CreateSet(thread_)); EXPECT_TRUE(*jsSet != nullptr); for (int i = 0; i < 3; i++) { - JSHandle key(thread, JSTaggedValue(i)); - JSSet::Add(thread, jsSet, key); + JSHandle key(thread_, JSTaggedValue(i)); + JSSet::Add(thread_, jsSet, key); } // set IterationKind(key or value) JSHandle setIteratorValue = - JSSetIterator::CreateSetIterator(thread, JSHandle(jsSet), IterationKind::KEY); + JSSetIterator::CreateSetIterator(thread_, JSHandle(jsSet), IterationKind::KEY); JSHandle setIterator(setIteratorValue); - auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 6); + auto ecmaRuntimeCallInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread_, JSTaggedValue::Undefined(), 6); ecmaRuntimeCallInfo->SetFunction(JSTaggedValue::Undefined()); ecmaRuntimeCallInfo->SetThis(setIteratorValue.GetTaggedValue()); ecmaRuntimeCallInfo->SetCallArg(0, JSTaggedValue::Undefined()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, ecmaRuntimeCallInfo.get()); + [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread_, ecmaRuntimeCallInfo.get()); JSTaggedValue result1 = JSSetIterator::Next(ecmaRuntimeCallInfo.get()); EXPECT_EQ(setIterator->GetNextIndex().GetInt(), 1); - JSHandle resultObj1(thread, result1); - EXPECT_EQ(0, JSIterator::IteratorValue(thread, resultObj1)->GetInt()); + JSHandle resultObj1(thread_, result1); + EXPECT_EQ(0, JSIterator::IteratorValue(thread_, resultObj1)->GetInt()); JSTaggedValue result2 = JSSetIterator::Next(ecmaRuntimeCallInfo.get()); EXPECT_EQ(setIterator->GetNextIndex().GetInt(), 2); - JSHandle resultObj2(thread, result2); - EXPECT_EQ(1, JSIterator::IteratorValue(thread, resultObj2)->GetInt()); + JSHandle resultObj2(thread_, result2); + EXPECT_EQ(1, JSIterator::IteratorValue(thread_, resultObj2)->GetInt()); JSTaggedValue result3 = JSSetIterator::Next(ecmaRuntimeCallInfo.get()); EXPECT_EQ(setIterator->GetNextIndex().GetInt(), 3); - JSHandle resultObj3(thread, result3); - EXPECT_EQ(2, JSIterator::IteratorValue(thread, resultObj3)->GetInt()); + JSHandle resultObj3(thread_, result3); + EXPECT_EQ(2, JSIterator::IteratorValue(thread_, resultObj3)->GetInt()); JSTaggedValue result4 = JSSetIterator::Next(ecmaRuntimeCallInfo.get()); - JSHandle resultObj4(thread, result4); - EXPECT_EQ(JSIterator::IteratorValue(thread, resultObj4).GetTaggedValue(), JSTaggedValue::Undefined()); + JSHandle resultObj4(thread_, result4); + EXPECT_EQ(JSIterator::IteratorValue(thread_, resultObj4).GetTaggedValue(), JSTaggedValue::Undefined()); - TestHelper::TearDownFrame(thread, prev); + TestHelper::TearDownFrame(thread_, prev); } } // namespace panda::test diff --git a/tests/runtime/common/js_set_test.cpp b/tests/runtime/common/js_set_test.cpp index b30d19153617a7df0991c415f9399a06fca23caa..de3b26ee489d9a7fec809487bb1edf49fb318ca7 100644 --- a/tests/runtime/common/js_set_test.cpp +++ b/tests/runtime/common/js_set_test.cpp @@ -42,29 +42,29 @@ class JSSetTest : public testing::Test { public: void SetUp() override { - TestHelper::CreateEcmaVMWithScope(instance, thread, scope); + TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); } void TearDown() override { - TestHelper::DestroyEcmaVMWithScope(instance, scope); + TestHelper::DestroyEcmaVMWithScope(instance_, scope_); } - PandaVM *instance {nullptr}; - EcmaHandleScope *scope {nullptr}; - JSThread *thread; + PandaVM *instance_ {nullptr}; + EcmaHandleScope *scope_ {nullptr}; + JSThread *thread_; protected: JSSet *CreateSet() { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle env = thread_->GetEcmaVM()->GetGlobalEnv(); JSHandle constructor = env->GetBuiltinsSetFunction(); JSHandle set = JSHandle::Cast(factory->NewJSObjectByConstructor(JSHandle(constructor), constructor)); - JSHandle hashSet = LinkedHashSet::Create(thread); - set->SetLinkedSet(thread, hashSet); + JSHandle hashSet = LinkedHashSet::Create(thread_); + set->SetLinkedSet(thread_, hashSet); return JSSet::Cast(set.GetTaggedValue().GetTaggedObject()); } }; @@ -77,29 +77,29 @@ TEST_F(JSSetTest, SetCreate) TEST_F(JSSetTest, AddAndHas) { - ObjectFactory *factory_ = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory_ = thread_->GetEcmaVM()->GetFactory(); // create js_set - JSHandle set(thread, CreateSet()); + JSHandle set(thread_, CreateSet()); // JSHandle key(factory_->NewFromString("key")); - JSSet::Add(thread, set, key); + JSSet::Add(thread_, set, key); int hash = LinkedHash::Hash(key.GetTaggedValue()); EXPECT_TRUE(set->Has(key.GetTaggedValue(), hash)); } TEST_F(JSSetTest, DeleteAndGet) { - ObjectFactory *factory_ = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory_ = thread_->GetEcmaVM()->GetFactory(); // create js_set - JSHandle set(thread, CreateSet()); + JSHandle set(thread_, CreateSet()); // add 40 keys char key_array[] = "key0"; for (int i = 0; i < 40; i++) { key_array[3] = '1' + i; JSHandle key(factory_->NewFromString(key_array)); - JSSet::Add(thread, set, key); + JSSet::Add(thread_, set, key); int hash = LinkedHash::Hash(key.GetTaggedValue()); EXPECT_TRUE(set->Has(key.GetTaggedValue(), hash)); } @@ -107,7 +107,7 @@ TEST_F(JSSetTest, DeleteAndGet) // whether js_set has delete key key_array[3] = '1' + 8; JSHandle delete_key(factory_->NewFromString(key_array)); - JSSet::Delete(thread, set, delete_key); + JSSet::Delete(thread_, set, delete_key); int hash = LinkedHash::Hash(delete_key.GetTaggedValue()); EXPECT_FALSE(set->Has(delete_key.GetTaggedValue(), hash)); EXPECT_EQ(set->GetSize(), 39); @@ -115,39 +115,39 @@ TEST_F(JSSetTest, DeleteAndGet) TEST_F(JSSetTest, Iterator) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - JSHandle set(thread, CreateSet()); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle set(thread_, CreateSet()); for (int i = 0; i < 5; i++) { - JSHandle key(thread, JSTaggedValue(i)); - JSSet::Add(thread, set, key); + JSHandle key(thread_, JSTaggedValue(i)); + JSSet::Add(thread_, set, key); } JSHandle key_iter(factory->NewJSSetIterator(set, IterationKind::KEY)); JSHandle value_iter(factory->NewJSSetIterator(set, IterationKind::VALUE)); - JSHandle key_result0 = JSIterator::IteratorStep(thread, key_iter); - JSHandle value_result0 = JSIterator::IteratorStep(thread, value_iter); + JSHandle key_result0 = JSIterator::IteratorStep(thread_, key_iter); + JSHandle value_result0 = JSIterator::IteratorStep(thread_, value_iter); - EXPECT_EQ(0, JSIterator::IteratorValue(thread, key_result0)->GetInt()); - EXPECT_EQ(0, JSIterator::IteratorValue(thread, value_result0)->GetInt()); + EXPECT_EQ(0, JSIterator::IteratorValue(thread_, key_result0)->GetInt()); + EXPECT_EQ(0, JSIterator::IteratorValue(thread_, value_result0)->GetInt()); - JSHandle key_result1 = JSIterator::IteratorStep(thread, key_iter); - EXPECT_EQ(1, JSIterator::IteratorValue(thread, key_result1)->GetInt()); + JSHandle key_result1 = JSIterator::IteratorStep(thread_, key_iter); + EXPECT_EQ(1, JSIterator::IteratorValue(thread_, key_result1)->GetInt()); for (int i = 0; i < 3; i++) { - JSHandle key(thread, JSTaggedValue(i)); - JSSet::Delete(thread, set, key); + JSHandle key(thread_, JSTaggedValue(i)); + JSSet::Delete(thread_, set, key); } - JSHandle key_result2 = JSIterator::IteratorStep(thread, key_iter); - EXPECT_EQ(3, JSIterator::IteratorValue(thread, key_result2)->GetInt()); - JSHandle key_result3 = JSIterator::IteratorStep(thread, key_iter); - EXPECT_EQ(4, JSIterator::IteratorValue(thread, key_result3)->GetInt()); - JSHandle key(thread, JSTaggedValue(5)); - JSSet::Add(thread, set, key); - JSHandle key_result4 = JSIterator::IteratorStep(thread, key_iter); - EXPECT_EQ(5, JSIterator::IteratorValue(thread, key_result4)->GetInt()); - JSHandle key_result5 = JSIterator::IteratorStep(thread, key_iter); + JSHandle key_result2 = JSIterator::IteratorStep(thread_, key_iter); + EXPECT_EQ(3, JSIterator::IteratorValue(thread_, key_result2)->GetInt()); + JSHandle key_result3 = JSIterator::IteratorStep(thread_, key_iter); + EXPECT_EQ(4, JSIterator::IteratorValue(thread_, key_result3)->GetInt()); + JSHandle key(thread_, JSTaggedValue(5)); + JSSet::Add(thread_, set, key); + JSHandle key_result4 = JSIterator::IteratorStep(thread_, key_iter); + EXPECT_EQ(5, JSIterator::IteratorValue(thread_, key_result4)->GetInt()); + JSHandle key_result5 = JSIterator::IteratorStep(thread_, key_iter); EXPECT_EQ(JSTaggedValue::False(), key_result5.GetTaggedValue()); } diff --git a/tests/runtime/common/js_symbol_test.cpp b/tests/runtime/common/js_symbol_test.cpp index 40c2819cf18171841f5b4ccf36f17f07c63beb6a..01b629656099dadaad965b8fdf8c3ac56da84f18 100644 --- a/tests/runtime/common/js_symbol_test.cpp +++ b/tests/runtime/common/js_symbol_test.cpp @@ -38,17 +38,17 @@ class JSSymbolTest : public testing::Test { public: void SetUp() override { - TestHelper::CreateEcmaVMWithScope(instance, thread, scope); + TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); } void TearDown() override { - TestHelper::DestroyEcmaVMWithScope(instance, scope); + TestHelper::DestroyEcmaVMWithScope(instance_, scope_); } - PandaVM *instance {nullptr}; - ecmascript::EcmaHandleScope *scope {nullptr}; - JSThread *thread; + PandaVM *instance_ {nullptr}; + ecmascript::EcmaHandleScope *scope_ {nullptr}; + JSThread *thread_; }; } // namespace panda::test diff --git a/tests/runtime/common/js_tagged_queue_test.cpp b/tests/runtime/common/js_tagged_queue_test.cpp index b50a1c8eaaa7fa36af84a7f55f2b2ab902be8805..ac61421dbbbbde3a7bfa27a162bbdef0778d1210 100644 --- a/tests/runtime/common/js_tagged_queue_test.cpp +++ b/tests/runtime/common/js_tagged_queue_test.cpp @@ -33,22 +33,22 @@ class JSTaggedQueueTest : public testing::Test { public: void SetUp() override { - TestHelper::CreateEcmaVMWithScope(instance, thread, scope); + TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); } void TearDown() override { - TestHelper::DestroyEcmaVMWithScope(instance, scope); + TestHelper::DestroyEcmaVMWithScope(instance_, scope_); } - PandaVM *instance {nullptr}; - ecmascript::EcmaHandleScope *scope {nullptr}; - JSThread *thread; + PandaVM *instance_ {nullptr}; + ecmascript::EcmaHandleScope *scope_ {nullptr}; + JSThread *thread_; }; TEST_F(JSTaggedQueueTest, Create) { - JSHandle queue = thread->GetEcmaVM()->GetFactory()->NewTaggedQueue(0); + JSHandle queue = thread_->GetEcmaVM()->GetFactory()->NewTaggedQueue(0); EXPECT_TRUE(*queue != nullptr); EXPECT_TRUE(queue->Empty()); EXPECT_TRUE(queue->Size() == 0); @@ -58,50 +58,50 @@ TEST_F(JSTaggedQueueTest, Create) TEST_F(JSTaggedQueueTest, PopAndPush) { - JSHandle queue = thread->GetEcmaVM()->GetFactory()->NewTaggedQueue(0); + JSHandle queue = thread_->GetEcmaVM()->GetFactory()->NewTaggedQueue(0); EXPECT_TRUE(queue->Empty()); - JSHandle queue2(thread, - TaggedQueue::Push(thread, queue, JSHandle(thread, JSTaggedValue(0)))); + JSHandle queue2(thread_, + TaggedQueue::Push(thread_, queue, JSHandle(thread_, JSTaggedValue(0)))); EXPECT_FALSE(queue2->Empty()); EXPECT_EQ(queue2->Size(), 1); EXPECT_EQ(queue2->Front(), JSTaggedValue(0)); EXPECT_EQ(queue2->Back(), JSTaggedValue(0)); - JSHandle queue3(thread, - TaggedQueue::Push(thread, queue2, JSHandle(thread, JSTaggedValue(1)))); + JSHandle queue3( + thread_, TaggedQueue::Push(thread_, queue2, JSHandle(thread_, JSTaggedValue(1)))); EXPECT_EQ(queue3->Size(), 2); EXPECT_EQ(queue3->Front(), JSTaggedValue(0)); EXPECT_EQ(queue3->Back(), JSTaggedValue(1)); EXPECT_NE(queue3.GetTaggedValue(), queue2.GetTaggedValue()); - JSHandle queue4(thread, - TaggedQueue::Push(thread, queue3, JSHandle(thread, JSTaggedValue(2)))); + JSHandle queue4( + thread_, TaggedQueue::Push(thread_, queue3, JSHandle(thread_, JSTaggedValue(2)))); EXPECT_EQ(queue4->Size(), 3); EXPECT_EQ(queue4->Front(), JSTaggedValue(0)); EXPECT_EQ(queue4->Back(), JSTaggedValue(2)); EXPECT_NE(queue4.GetTaggedValue(), queue3.GetTaggedValue()); - JSHandle queue5(thread, - TaggedQueue::Push(thread, queue4, JSHandle(thread, JSTaggedValue(3)))); + JSHandle queue5( + thread_, TaggedQueue::Push(thread_, queue4, JSHandle(thread_, JSTaggedValue(3)))); EXPECT_EQ(queue5->Size(), 4); EXPECT_EQ(queue5->Front(), JSTaggedValue(0)); EXPECT_EQ(queue5->Back(), JSTaggedValue(3)); EXPECT_NE(queue5.GetTaggedValue(), queue4.GetTaggedValue()); - EXPECT_EQ(queue5->Pop(thread), JSTaggedValue(0)); + EXPECT_EQ(queue5->Pop(thread_), JSTaggedValue(0)); EXPECT_EQ(queue5->Size(), 3); EXPECT_EQ(queue5->Front(), JSTaggedValue(1)); - EXPECT_EQ(queue5->Pop(thread), JSTaggedValue(1)); + EXPECT_EQ(queue5->Pop(thread_), JSTaggedValue(1)); EXPECT_EQ(queue5->Size(), 2); EXPECT_EQ(queue5->Front(), JSTaggedValue(2)); - EXPECT_EQ(queue5->Pop(thread), JSTaggedValue(2)); + EXPECT_EQ(queue5->Pop(thread_), JSTaggedValue(2)); EXPECT_EQ(queue5->Size(), 1); EXPECT_EQ(queue5->Front(), JSTaggedValue(3)); - EXPECT_EQ(queue5->Pop(thread), JSTaggedValue(3)); + EXPECT_EQ(queue5->Pop(thread_), JSTaggedValue(3)); EXPECT_EQ(queue5->Size(), 0); EXPECT_EQ(queue5->Front(), JSTaggedValue::Hole()); EXPECT_TRUE(queue5->Empty()); diff --git a/tests/runtime/common/js_typed_array_test.cpp b/tests/runtime/common/js_typed_array_test.cpp index bf7ab7529d2e85e1f1ab1841000aafd4d685c108..b228cde3761a0b85bfc27dceb51ae33b81b2cbce 100644 --- a/tests/runtime/common/js_typed_array_test.cpp +++ b/tests/runtime/common/js_typed_array_test.cpp @@ -33,23 +33,24 @@ public: void SetUp() override { - TestHelper::CreateEcmaVMWithScope(instance, thread, scope); + TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); } void TearDown() override { - TestHelper::DestroyEcmaVMWithScope(instance, scope); + TestHelper::DestroyEcmaVMWithScope(instance_, scope_); } - PandaVM *instance {nullptr}; - EcmaHandleScope *scope {nullptr}; - JSThread *thread {nullptr}; + PandaVM *instance_ {nullptr}; + EcmaHandleScope *scope_ {nullptr}; + JSThread *thread_ {nullptr}; - const CVector cVecJSType {JSType::JS_INT8_ARRAY, JSType::JS_UINT8_ARRAY, JSType::JS_UINT8_CLAMPED_ARRAY, - JSType::JS_INT16_ARRAY, JSType::JS_UINT16_ARRAY, JSType::JS_INT32_ARRAY, - JSType::JS_UINT32_ARRAY, JSType::JS_FLOAT32_ARRAY, JSType::JS_FLOAT64_ARRAY}; + const CVector c_vec_js_type_ { + JSType::JS_INT8_ARRAY, JSType::JS_UINT8_ARRAY, JSType::JS_UINT8_CLAMPED_ARRAY, + JSType::JS_INT16_ARRAY, JSType::JS_UINT16_ARRAY, JSType::JS_INT32_ARRAY, + JSType::JS_UINT32_ARRAY, JSType::JS_FLOAT32_ARRAY, JSType::JS_FLOAT64_ARRAY}; // CVector pushed with JSTaggedValue made from compatible input value for the JSType - const CVector cVecHandleTagValValueForTypedArray { + const CVector c_vec_handle_tag_val_value_for_typed_array_ { // Use "(S)(...)" cast to make v in "JSTaggedValue(T v) : coretypes::TaggedValue(v) {}" compatible with S JSTaggedValue((int8_t)(-111)), JSTaggedValue((uint8_t)(222)), JSTaggedValue((uint8_t)(222)), JSTaggedValue((int16_t)(-31111)), JSTaggedValue((uint16_t)(61111)), @@ -110,10 +111,10 @@ JSHandle CreateNumberTypedArray(JSThread *thread, JSType jsType) */ TEST_F(JSTypedArrayTest, ToPropKey_001) { - JSHandle handleUndefined(thread, JSTaggedValue::Undefined()); - JSHandle handleHole(thread, JSTaggedValue::Hole()); - JSHandle hnadleTagValEcmaStrPropKeyTo1 = JSTypedArray::ToPropKey(thread, handleUndefined); - JSHandle hnadleTagValEcmaStrPropKeyTo2 = JSTypedArray::ToPropKey(thread, handleHole); + JSHandle handleUndefined(thread_, JSTaggedValue::Undefined()); + JSHandle handleHole(thread_, JSTaggedValue::Hole()); + JSHandle hnadleTagValEcmaStrPropKeyTo1 = JSTypedArray::ToPropKey(thread_, handleUndefined); + JSHandle hnadleTagValEcmaStrPropKeyTo2 = JSTypedArray::ToPropKey(thread_, handleHole); JSHandle handleEcmaStrPropKeyTo1 = JSHandle::Cast(hnadleTagValEcmaStrPropKeyTo1); JSHandle handleEcmaStrPropKeyTo2 = JSHandle::Cast(hnadleTagValEcmaStrPropKeyTo2); EXPECT_NE(0, sizeof(handleUndefined)); @@ -143,14 +144,14 @@ TEST_F(JSTypedArrayTest, ToPropKey_001) */ TEST_F(JSTypedArrayTest, ToPropKey_002) { - JSHandle handleTagVal1(thread, JSTaggedValue(0)); - JSHandle handleTagVal2(thread, JSTaggedValue(-1)); - JSHandle handleTagVal3(thread, JSTaggedValue(1.789)); - JSHandle handleTagVal4(thread, JSTaggedValue(-789.1)); - JSHandle hnadleTagValEcmaStrPropKeyTo1 = JSTypedArray::ToPropKey(thread, handleTagVal1); - JSHandle hnadleTagValEcmaStrPropKeyTo2 = JSTypedArray::ToPropKey(thread, handleTagVal2); - JSHandle hnadleTagValEcmaStrPropKeyTo3 = JSTypedArray::ToPropKey(thread, handleTagVal3); - JSHandle hnadleTagValEcmaStrPropKeyTo4 = JSTypedArray::ToPropKey(thread, handleTagVal4); + JSHandle handleTagVal1(thread_, JSTaggedValue(0)); + JSHandle handleTagVal2(thread_, JSTaggedValue(-1)); + JSHandle handleTagVal3(thread_, JSTaggedValue(1.789)); + JSHandle handleTagVal4(thread_, JSTaggedValue(-789.1)); + JSHandle hnadleTagValEcmaStrPropKeyTo1 = JSTypedArray::ToPropKey(thread_, handleTagVal1); + JSHandle hnadleTagValEcmaStrPropKeyTo2 = JSTypedArray::ToPropKey(thread_, handleTagVal2); + JSHandle hnadleTagValEcmaStrPropKeyTo3 = JSTypedArray::ToPropKey(thread_, handleTagVal3); + JSHandle hnadleTagValEcmaStrPropKeyTo4 = JSTypedArray::ToPropKey(thread_, handleTagVal4); JSHandle handleEcmaStrPropKeyTo1 = JSHandle::Cast(hnadleTagValEcmaStrPropKeyTo1); JSHandle handleEcmaStrPropKeyTo2 = JSHandle::Cast(hnadleTagValEcmaStrPropKeyTo2); JSHandle handleEcmaStrPropKeyTo3 = JSHandle::Cast(hnadleTagValEcmaStrPropKeyTo3); @@ -189,40 +190,40 @@ TEST_F(JSTypedArrayTest, ToPropKey_002) */ TEST_F(JSTypedArrayTest, TypedArrayCreate) { - JSHandle handleInt8Array = CreateNumberTypedArray(thread, JSType::JS_INT8_ARRAY); + JSHandle handleInt8Array = CreateNumberTypedArray(thread_, JSType::JS_INT8_ARRAY); JSHandle handleTagValInt8Array = JSHandle::Cast(handleInt8Array); EXPECT_TRUE(handleTagValInt8Array->IsJSInt8Array() && handleTagValInt8Array->IsTypedArray()); - JSHandle handleUint8Array = CreateNumberTypedArray(thread, JSType::JS_UINT8_ARRAY); + JSHandle handleUint8Array = CreateNumberTypedArray(thread_, JSType::JS_UINT8_ARRAY); JSHandle handleTagValUint8Array = JSHandle::Cast(handleUint8Array); EXPECT_TRUE(handleTagValUint8Array->IsJSUint8Array() && handleTagValUint8Array->IsTypedArray()); - JSHandle handleUint8ClampedArray = CreateNumberTypedArray(thread, JSType::JS_UINT8_CLAMPED_ARRAY); + JSHandle handleUint8ClampedArray = CreateNumberTypedArray(thread_, JSType::JS_UINT8_CLAMPED_ARRAY); JSHandle handleTagValUint8ClampedArray = JSHandle::Cast(handleUint8ClampedArray); EXPECT_TRUE(handleTagValUint8ClampedArray->IsJSUint8ClampedArray() && handleTagValUint8ClampedArray->IsTypedArray()); - JSHandle handleInt16Array = CreateNumberTypedArray(thread, JSType::JS_INT16_ARRAY); + JSHandle handleInt16Array = CreateNumberTypedArray(thread_, JSType::JS_INT16_ARRAY); JSHandle handleTagValInt16Array = JSHandle::Cast(handleInt16Array); EXPECT_TRUE(handleTagValInt16Array->IsJSInt16Array() && handleTagValInt16Array->IsTypedArray()); - JSHandle handleUint16Array = CreateNumberTypedArray(thread, JSType::JS_UINT16_ARRAY); + JSHandle handleUint16Array = CreateNumberTypedArray(thread_, JSType::JS_UINT16_ARRAY); JSHandle handleTagValUint16Array = JSHandle::Cast(handleUint16Array); EXPECT_TRUE(handleTagValUint16Array->IsJSUint16Array() && handleTagValUint16Array->IsTypedArray()); - JSHandle handleInt32Array = CreateNumberTypedArray(thread, JSType::JS_INT32_ARRAY); + JSHandle handleInt32Array = CreateNumberTypedArray(thread_, JSType::JS_INT32_ARRAY); JSHandle handleTagValInt32Array = JSHandle::Cast(handleInt32Array); EXPECT_TRUE(handleTagValInt32Array->IsJSInt32Array() && handleTagValInt32Array->IsTypedArray()); - JSHandle handleUint32Array = CreateNumberTypedArray(thread, JSType::JS_UINT32_ARRAY); + JSHandle handleUint32Array = CreateNumberTypedArray(thread_, JSType::JS_UINT32_ARRAY); JSHandle handleTagValUint32Array = JSHandle::Cast(handleUint32Array); EXPECT_TRUE(handleTagValUint32Array->IsJSUint32Array() && handleTagValUint32Array->IsTypedArray()); - JSHandle handleFloat32Array = CreateNumberTypedArray(thread, JSType::JS_FLOAT32_ARRAY); + JSHandle handleFloat32Array = CreateNumberTypedArray(thread_, JSType::JS_FLOAT32_ARRAY); JSHandle handleTagValFloat32Array = JSHandle::Cast(handleFloat32Array); EXPECT_TRUE(handleTagValFloat32Array->IsJSFloat32Array() && handleTagValFloat32Array->IsTypedArray()); - JSHandle handleFloat64Array = CreateNumberTypedArray(thread, JSType::JS_FLOAT64_ARRAY); + JSHandle handleFloat64Array = CreateNumberTypedArray(thread_, JSType::JS_FLOAT64_ARRAY); JSHandle handleTagValFloat64Array = JSHandle::Cast(handleFloat64Array); EXPECT_TRUE(handleTagValFloat64Array->IsJSFloat64Array() && handleTagValFloat64Array->IsTypedArray()); } @@ -237,15 +238,15 @@ TEST_F(JSTypedArrayTest, TypedArrayCreate) */ TEST_F(JSTypedArrayTest, SetViewedArrayBuffer) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); JSHandle handleArrayBufferFrom = factory->NewJSArrayBuffer(10); JSHandle handleTagValArrayBufferFrom = JSHandle::Cast(handleArrayBufferFrom); - for (size_t i = 0; i < cVecJSType.size(); i++) { - JSHandle handleTypedArray = CreateNumberTypedArray(thread, cVecJSType.at(i)); + for (size_t i = 0; i < c_vec_js_type_.size(); i++) { + JSHandle handleTypedArray = CreateNumberTypedArray(thread_, c_vec_js_type_.at(i)); EXPECT_EQ(handleTypedArray->GetViewedArrayBuffer(), JSTaggedValue::Undefined()); - handleTypedArray->SetViewedArrayBuffer(thread, handleTagValArrayBufferFrom); + handleTypedArray->SetViewedArrayBuffer(thread_, handleTagValArrayBufferFrom); EXPECT_EQ(handleTypedArray->GetViewedArrayBuffer(), handleTagValArrayBufferFrom.GetTaggedValue()); } } @@ -261,15 +262,15 @@ TEST_F(JSTypedArrayTest, SetViewedArrayBuffer) TEST_F(JSTypedArrayTest, SetTypedArrayName) { CString cStrName = "cStrName"; - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); JSHandle handleEcmaStrNameFrom = factory->NewFromString(cStrName); JSHandle handleTagValEcmaStrNameFrom = JSHandle::Cast(handleEcmaStrNameFrom); - for (size_t i = 0; i < cVecJSType.size(); i++) { - JSHandle handleTypedArray = CreateNumberTypedArray(thread, cVecJSType.at(i)); + for (size_t i = 0; i < c_vec_js_type_.size(); i++) { + JSHandle handleTypedArray = CreateNumberTypedArray(thread_, c_vec_js_type_.at(i)); EXPECT_EQ(handleTypedArray->GetTypedArrayName(), JSTaggedValue::Undefined()); - handleTypedArray->SetTypedArrayName(thread, handleTagValEcmaStrNameFrom); + handleTypedArray->SetTypedArrayName(thread_, handleTagValEcmaStrNameFrom); EXPECT_EQ(handleTypedArray->GetTypedArrayName(), handleTagValEcmaStrNameFrom.GetTaggedValue()); } } @@ -285,13 +286,13 @@ TEST_F(JSTypedArrayTest, SetTypedArrayName) TEST_F(JSTypedArrayTest, SetByteLength) { uint32_t u32ByteLength = 2; - JSHandle handleTagValByteLengthFrom(thread, JSTaggedValue(u32ByteLength)); + JSHandle handleTagValByteLengthFrom(thread_, JSTaggedValue(u32ByteLength)); - for (size_t i = 0; i < cVecJSType.size(); i++) { - JSHandle handleTypedArray = CreateNumberTypedArray(thread, cVecJSType.at(i)); + for (size_t i = 0; i < c_vec_js_type_.size(); i++) { + JSHandle handleTypedArray = CreateNumberTypedArray(thread_, c_vec_js_type_.at(i)); EXPECT_EQ(handleTypedArray->GetByteLength(), JSTaggedValue(0)); - handleTypedArray->SetByteLength(thread, handleTagValByteLengthFrom); + handleTypedArray->SetByteLength(thread_, handleTagValByteLengthFrom); EXPECT_EQ(handleTypedArray->GetByteLength(), handleTagValByteLengthFrom.GetTaggedValue()); } } @@ -307,13 +308,13 @@ TEST_F(JSTypedArrayTest, SetByteLength) TEST_F(JSTypedArrayTest, SetByteOffset) { uint32_t u32ByteOffset = 2; - JSHandle handleTagValByteOffsetFrom(thread, JSTaggedValue(u32ByteOffset)); + JSHandle handleTagValByteOffsetFrom(thread_, JSTaggedValue(u32ByteOffset)); - for (size_t i = 0; i < cVecJSType.size(); i++) { - JSHandle handleTypedArray = CreateNumberTypedArray(thread, cVecJSType.at(i)); + for (size_t i = 0; i < c_vec_js_type_.size(); i++) { + JSHandle handleTypedArray = CreateNumberTypedArray(thread_, c_vec_js_type_.at(i)); EXPECT_EQ(handleTypedArray->GetByteOffset(), JSTaggedValue(0)); - handleTypedArray->SetByteOffset(thread, handleTagValByteOffsetFrom); + handleTypedArray->SetByteOffset(thread_, handleTagValByteOffsetFrom); EXPECT_EQ(handleTypedArray->GetByteOffset(), handleTagValByteOffsetFrom.GetTaggedValue()); } } @@ -329,13 +330,13 @@ TEST_F(JSTypedArrayTest, SetByteOffset) TEST_F(JSTypedArrayTest, SetArrayLength) { uint32_t u32ArrayLength = 2; - JSHandle handleTagValArrayLengthFrom(thread, JSTaggedValue(u32ArrayLength)); + JSHandle handleTagValArrayLengthFrom(thread_, JSTaggedValue(u32ArrayLength)); - for (size_t i = 0; i < cVecJSType.size(); i++) { - JSHandle handleTypedArray = CreateNumberTypedArray(thread, cVecJSType.at(i)); + for (size_t i = 0; i < c_vec_js_type_.size(); i++) { + JSHandle handleTypedArray = CreateNumberTypedArray(thread_, c_vec_js_type_.at(i)); EXPECT_EQ(handleTypedArray->GetArrayLength(), JSTaggedValue(0)); - handleTypedArray->SetArrayLength(thread, handleTagValArrayLengthFrom); + handleTypedArray->SetArrayLength(thread_, handleTagValArrayLengthFrom); EXPECT_EQ(handleTypedArray->GetArrayLength(), handleTagValArrayLengthFrom.GetTaggedValue()); } } @@ -351,8 +352,8 @@ TEST_F(JSTypedArrayTest, SetArrayLength) TEST_F(JSTypedArrayTest, DISABLED_IntegerIndexedElementSet_Int8Array_001) { uint32_t numElementsInt8Array = 256; - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - JSHandle handleInt8Array = CreateNumberTypedArray(thread, JSType::JS_INT8_ARRAY); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle handleInt8Array = CreateNumberTypedArray(thread_, JSType::JS_INT8_ARRAY); JSHandle handleTagValInt8Array = JSHandle::Cast(handleInt8Array); uint32_t sizeElement = @@ -360,16 +361,16 @@ TEST_F(JSTypedArrayTest, DISABLED_IntegerIndexedElementSet_Int8Array_001) uint32_t byteLengthViewdArrayBuffer = sizeElement * numElementsInt8Array; JSHandle handleTagValArrayBufferFrom = JSHandle::Cast(factory->NewJSArrayBuffer(byteLengthViewdArrayBuffer)); - handleInt8Array->SetViewedArrayBuffer(thread, handleTagValArrayBufferFrom); - handleInt8Array->SetArrayLength(thread, JSTaggedValue(numElementsInt8Array)); + handleInt8Array->SetViewedArrayBuffer(thread_, handleTagValArrayBufferFrom); + handleInt8Array->SetArrayLength(thread_, JSTaggedValue(numElementsInt8Array)); CVector cVecOpResult = {}; for (size_t i = 0; i < numElementsInt8Array; i++) { EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet( - thread, handleTagValInt8Array, JSTaggedValue(i), - JSHandle(thread, JSTaggedValue(std::numeric_limits::min() + i)))); + thread_, handleTagValInt8Array, JSTaggedValue(i), + JSHandle(thread_, JSTaggedValue(std::numeric_limits::min() + i)))); OperationResult opResult = - JSTypedArray::IntegerIndexedElementGet(thread, handleTagValInt8Array, JSTaggedValue(i)); + JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValInt8Array, JSTaggedValue(i)); cVecOpResult.push_back(opResult); } for (size_t i = 0; i < numElementsInt8Array; i++) { @@ -378,31 +379,31 @@ TEST_F(JSTypedArrayTest, DISABLED_IntegerIndexedElementSet_Int8Array_001) cVecOpResult.clear(); OperationResult opResult1 = - JSTypedArray::IntegerIndexedElementGet(thread, handleTagValInt8Array, JSTaggedValue(-1)); + JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValInt8Array, JSTaggedValue(-1)); OperationResult opResult2 = - JSTypedArray::IntegerIndexedElementGet(thread, handleTagValInt8Array, JSTaggedValue(-0.0)); + JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValInt8Array, JSTaggedValue(-0.0)); OperationResult opResult3 = - JSTypedArray::IntegerIndexedElementGet(thread, handleTagValInt8Array, JSTaggedValue(1.1)); + JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValInt8Array, JSTaggedValue(1.1)); OperationResult opResult4 = - JSTypedArray::IntegerIndexedElementGet(thread, handleTagValInt8Array, JSTaggedValue(numElementsInt8Array)); + JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValInt8Array, JSTaggedValue(numElementsInt8Array)); EXPECT_EQ(opResult1.GetValue().GetTaggedValue(), JSTaggedValue::Undefined()); EXPECT_EQ(opResult2.GetValue().GetTaggedValue(), JSTaggedValue::Undefined()); EXPECT_EQ(opResult3.GetValue().GetTaggedValue(), JSTaggedValue::Undefined()); EXPECT_EQ(opResult4.GetValue().GetTaggedValue(), JSTaggedValue::Undefined()); - EXPECT_FALSE(JSTypedArray::IntegerIndexedElementSet(thread, handleTagValInt8Array, JSTaggedValue(-1), - JSHandle(thread, JSTaggedValue(0)))); - EXPECT_FALSE(JSTypedArray::IntegerIndexedElementSet(thread, handleTagValInt8Array, + EXPECT_FALSE(JSTypedArray::IntegerIndexedElementSet(thread_, handleTagValInt8Array, JSTaggedValue(-1), + JSHandle(thread_, JSTaggedValue(0)))); + EXPECT_FALSE(JSTypedArray::IntegerIndexedElementSet(thread_, handleTagValInt8Array, JSTaggedValue(numElementsInt8Array), - JSHandle(thread, JSTaggedValue(0)))); + JSHandle(thread_, JSTaggedValue(0)))); } // Nonstandard input value for Int8Array TEST_F(JSTypedArrayTest, IntegerIndexedElementSet_Int8Array_002) { uint32_t numElementsInt8Array = 16; - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - JSHandle handleInt8Array = CreateNumberTypedArray(thread, JSType::JS_INT8_ARRAY); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle handleInt8Array = CreateNumberTypedArray(thread_, JSType::JS_INT8_ARRAY); JSHandle handleTagValInt8Array = JSHandle::Cast(handleInt8Array); uint32_t sizeElement = @@ -410,30 +411,34 @@ TEST_F(JSTypedArrayTest, IntegerIndexedElementSet_Int8Array_002) uint32_t byteLengthViewdArrayBuffer = sizeElement * numElementsInt8Array; JSHandle handleTagValArrayBufferFrom = JSHandle::Cast(factory->NewJSArrayBuffer(byteLengthViewdArrayBuffer)); - handleInt8Array->SetViewedArrayBuffer(thread, handleTagValArrayBufferFrom); - handleInt8Array->SetArrayLength(thread, JSTaggedValue(numElementsInt8Array)); + handleInt8Array->SetViewedArrayBuffer(thread_, handleTagValArrayBufferFrom); + handleInt8Array->SetArrayLength(thread_, JSTaggedValue(numElementsInt8Array)); int64_t value1 = -129; // to int8 : 127 int64_t value2 = 128; // to int8 : -128 double value3 = 13.4; // to int8 : 13 double value4 = 13.6; // to int8 : 13 - JSHandle handleTagValValueSet1(thread, JSTaggedValue(value1)); - JSHandle handleTagValValueSet2(thread, JSTaggedValue(value2)); - JSHandle handleTagValValueSet3(thread, JSTaggedValue(value3)); - JSHandle handleTagValValueSet4(thread, JSTaggedValue(value4)); - - EXPECT_TRUE( - JSTypedArray::IntegerIndexedElementSet(thread, handleTagValInt8Array, JSTaggedValue(0), handleTagValValueSet1)); - OperationResult opResult1 = JSTypedArray::IntegerIndexedElementGet(thread, handleTagValInt8Array, JSTaggedValue(0)); - EXPECT_TRUE( - JSTypedArray::IntegerIndexedElementSet(thread, handleTagValInt8Array, JSTaggedValue(0), handleTagValValueSet2)); - OperationResult opResult2 = JSTypedArray::IntegerIndexedElementGet(thread, handleTagValInt8Array, JSTaggedValue(0)); - EXPECT_TRUE( - JSTypedArray::IntegerIndexedElementSet(thread, handleTagValInt8Array, JSTaggedValue(0), handleTagValValueSet3)); - OperationResult opResult3 = JSTypedArray::IntegerIndexedElementGet(thread, handleTagValInt8Array, JSTaggedValue(0)); - EXPECT_TRUE( - JSTypedArray::IntegerIndexedElementSet(thread, handleTagValInt8Array, JSTaggedValue(0), handleTagValValueSet4)); - OperationResult opResult4 = JSTypedArray::IntegerIndexedElementGet(thread, handleTagValInt8Array, JSTaggedValue(0)); + JSHandle handleTagValValueSet1(thread_, JSTaggedValue(value1)); + JSHandle handleTagValValueSet2(thread_, JSTaggedValue(value2)); + JSHandle handleTagValValueSet3(thread_, JSTaggedValue(value3)); + JSHandle handleTagValValueSet4(thread_, JSTaggedValue(value4)); + + EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread_, handleTagValInt8Array, JSTaggedValue(0), + handleTagValValueSet1)); + OperationResult opResult1 = + JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValInt8Array, JSTaggedValue(0)); + EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread_, handleTagValInt8Array, JSTaggedValue(0), + handleTagValValueSet2)); + OperationResult opResult2 = + JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValInt8Array, JSTaggedValue(0)); + EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread_, handleTagValInt8Array, JSTaggedValue(0), + handleTagValValueSet3)); + OperationResult opResult3 = + JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValInt8Array, JSTaggedValue(0)); + EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread_, handleTagValInt8Array, JSTaggedValue(0), + handleTagValValueSet4)); + OperationResult opResult4 = + JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValInt8Array, JSTaggedValue(0)); EXPECT_NE(value1, opResult1.GetValue().GetTaggedValue().GetNumber()); EXPECT_NE(value2, opResult2.GetValue().GetTaggedValue().GetNumber()); @@ -448,8 +453,8 @@ TEST_F(JSTypedArrayTest, IntegerIndexedElementSet_Int8Array_002) TEST_F(JSTypedArrayTest, IntegerIndexedElementSet_Uint8Array_001) { uint32_t numElementsUint8Array = 256; - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - JSHandle handleUint8Array = CreateNumberTypedArray(thread, JSType::JS_UINT8_ARRAY); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle handleUint8Array = CreateNumberTypedArray(thread_, JSType::JS_UINT8_ARRAY); JSHandle handleTagValUint8Array = JSHandle::Cast(handleUint8Array); uint32_t sizeElement = @@ -457,16 +462,16 @@ TEST_F(JSTypedArrayTest, IntegerIndexedElementSet_Uint8Array_001) uint32_t byteLengthViewdArrayBuffer = sizeElement * numElementsUint8Array; JSHandle handleTagValArrayBufferFrom = JSHandle::Cast(factory->NewJSArrayBuffer(byteLengthViewdArrayBuffer)); - handleUint8Array->SetViewedArrayBuffer(thread, handleTagValArrayBufferFrom); - handleUint8Array->SetArrayLength(thread, JSTaggedValue(numElementsUint8Array)); + handleUint8Array->SetViewedArrayBuffer(thread_, handleTagValArrayBufferFrom); + handleUint8Array->SetArrayLength(thread_, JSTaggedValue(numElementsUint8Array)); CVector cVecOpResult = {}; for (uint32_t i = 0; i < numElementsUint8Array; i++) { EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet( - thread, handleTagValUint8Array, JSTaggedValue(i), - JSHandle(thread, JSTaggedValue(std::numeric_limits::min() + i)))); + thread_, handleTagValUint8Array, JSTaggedValue(i), + JSHandle(thread_, JSTaggedValue(std::numeric_limits::min() + i)))); OperationResult opResult = - JSTypedArray::IntegerIndexedElementGet(thread, handleTagValUint8Array, JSTaggedValue(i)); + JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValUint8Array, JSTaggedValue(i)); cVecOpResult.push_back(opResult); } for (uint32_t i = 0; i < numElementsUint8Array; i++) { @@ -475,31 +480,31 @@ TEST_F(JSTypedArrayTest, IntegerIndexedElementSet_Uint8Array_001) cVecOpResult.clear(); OperationResult opResult1 = - JSTypedArray::IntegerIndexedElementGet(thread, handleTagValUint8Array, JSTaggedValue(-1)); + JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValUint8Array, JSTaggedValue(-1)); OperationResult opResult2 = - JSTypedArray::IntegerIndexedElementGet(thread, handleTagValUint8Array, JSTaggedValue(-0.0)); + JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValUint8Array, JSTaggedValue(-0.0)); OperationResult opResult3 = - JSTypedArray::IntegerIndexedElementGet(thread, handleTagValUint8Array, JSTaggedValue(1.1)); + JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValUint8Array, JSTaggedValue(1.1)); OperationResult opResult4 = - JSTypedArray::IntegerIndexedElementGet(thread, handleTagValUint8Array, JSTaggedValue(numElementsUint8Array)); + JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValUint8Array, JSTaggedValue(numElementsUint8Array)); EXPECT_EQ(opResult1.GetValue().GetTaggedValue(), JSTaggedValue::Undefined()); EXPECT_EQ(opResult2.GetValue().GetTaggedValue(), JSTaggedValue::Undefined()); EXPECT_EQ(opResult3.GetValue().GetTaggedValue(), JSTaggedValue::Undefined()); EXPECT_EQ(opResult4.GetValue().GetTaggedValue(), JSTaggedValue::Undefined()); - EXPECT_FALSE(JSTypedArray::IntegerIndexedElementSet(thread, handleTagValUint8Array, JSTaggedValue(-1), - JSHandle(thread, JSTaggedValue(0)))); - EXPECT_FALSE(JSTypedArray::IntegerIndexedElementSet(thread, handleTagValUint8Array, + EXPECT_FALSE(JSTypedArray::IntegerIndexedElementSet(thread_, handleTagValUint8Array, JSTaggedValue(-1), + JSHandle(thread_, JSTaggedValue(0)))); + EXPECT_FALSE(JSTypedArray::IntegerIndexedElementSet(thread_, handleTagValUint8Array, JSTaggedValue(numElementsUint8Array), - JSHandle(thread, JSTaggedValue(0)))); + JSHandle(thread_, JSTaggedValue(0)))); } // Nonstandard input value for Uint8Array TEST_F(JSTypedArrayTest, IntegerIndexedElementSet_Uint8Array_002) { uint32_t numElementsUint8Array = 16; - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - JSHandle handleUint8Array = CreateNumberTypedArray(thread, JSType::JS_UINT8_ARRAY); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle handleUint8Array = CreateNumberTypedArray(thread_, JSType::JS_UINT8_ARRAY); JSHandle handleTagValUint8Array = JSHandle::Cast(handleUint8Array); uint32_t sizeElement = @@ -507,34 +512,34 @@ TEST_F(JSTypedArrayTest, IntegerIndexedElementSet_Uint8Array_002) uint32_t byteLengthViewdArrayBuffer = sizeElement * numElementsUint8Array; JSHandle handleTagValArrayBufferFrom = JSHandle::Cast(factory->NewJSArrayBuffer(byteLengthViewdArrayBuffer)); - handleUint8Array->SetViewedArrayBuffer(thread, handleTagValArrayBufferFrom); - handleUint8Array->SetArrayLength(thread, JSTaggedValue(numElementsUint8Array)); + handleUint8Array->SetViewedArrayBuffer(thread_, handleTagValArrayBufferFrom); + handleUint8Array->SetArrayLength(thread_, JSTaggedValue(numElementsUint8Array)); int64_t value1 = -1; // to uint8 : 255 int64_t value2 = 256; // to uint8 : 0 double value3 = 13.4; // to uint8 : 13 double value4 = 13.6; // to uint8 : 13 - JSHandle handleTagValValueSet1(thread, JSTaggedValue(value1)); - JSHandle handleTagValValueSet2(thread, JSTaggedValue(value2)); - JSHandle handleTagValValueSet3(thread, JSTaggedValue(value3)); - JSHandle handleTagValValueSet4(thread, JSTaggedValue(value4)); + JSHandle handleTagValValueSet1(thread_, JSTaggedValue(value1)); + JSHandle handleTagValValueSet2(thread_, JSTaggedValue(value2)); + JSHandle handleTagValValueSet3(thread_, JSTaggedValue(value3)); + JSHandle handleTagValValueSet4(thread_, JSTaggedValue(value4)); - EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread, handleTagValUint8Array, JSTaggedValue(0), + EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread_, handleTagValUint8Array, JSTaggedValue(0), handleTagValValueSet1)); OperationResult opResult1 = - JSTypedArray::IntegerIndexedElementGet(thread, handleTagValUint8Array, JSTaggedValue(0)); - EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread, handleTagValUint8Array, JSTaggedValue(0), + JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValUint8Array, JSTaggedValue(0)); + EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread_, handleTagValUint8Array, JSTaggedValue(0), handleTagValValueSet2)); OperationResult opResult2 = - JSTypedArray::IntegerIndexedElementGet(thread, handleTagValUint8Array, JSTaggedValue(0)); - EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread, handleTagValUint8Array, JSTaggedValue(0), + JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValUint8Array, JSTaggedValue(0)); + EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread_, handleTagValUint8Array, JSTaggedValue(0), handleTagValValueSet3)); OperationResult opResult3 = - JSTypedArray::IntegerIndexedElementGet(thread, handleTagValUint8Array, JSTaggedValue(0)); - EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread, handleTagValUint8Array, JSTaggedValue(0), + JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValUint8Array, JSTaggedValue(0)); + EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread_, handleTagValUint8Array, JSTaggedValue(0), handleTagValValueSet4)); OperationResult opResult4 = - JSTypedArray::IntegerIndexedElementGet(thread, handleTagValUint8Array, JSTaggedValue(0)); + JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValUint8Array, JSTaggedValue(0)); EXPECT_NE(value1, opResult1.GetValue().GetTaggedValue().GetNumber()); EXPECT_NE(value2, opResult2.GetValue().GetTaggedValue().GetNumber()); @@ -549,8 +554,8 @@ TEST_F(JSTypedArrayTest, IntegerIndexedElementSet_Uint8Array_002) TEST_F(JSTypedArrayTest, IntegerIndexedElementSet_Uint8ClampedArray_001) { uint32_t numElementsUint8ClampedArray = 256; - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - JSHandle handleUint8ClampedArray = CreateNumberTypedArray(thread, JSType::JS_UINT8_CLAMPED_ARRAY); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle handleUint8ClampedArray = CreateNumberTypedArray(thread_, JSType::JS_UINT8_CLAMPED_ARRAY); JSHandle handleTagValUint8ClampedArray = JSHandle::Cast(handleUint8ClampedArray); uint32_t sizeElement = @@ -558,16 +563,16 @@ TEST_F(JSTypedArrayTest, IntegerIndexedElementSet_Uint8ClampedArray_001) uint32_t byteLengthViewdArrayBuffer = sizeElement * numElementsUint8ClampedArray; JSHandle handleTagValArrayBufferFrom = JSHandle::Cast(factory->NewJSArrayBuffer(byteLengthViewdArrayBuffer)); - handleUint8ClampedArray->SetViewedArrayBuffer(thread, handleTagValArrayBufferFrom); - handleUint8ClampedArray->SetArrayLength(thread, JSTaggedValue(numElementsUint8ClampedArray)); + handleUint8ClampedArray->SetViewedArrayBuffer(thread_, handleTagValArrayBufferFrom); + handleUint8ClampedArray->SetArrayLength(thread_, JSTaggedValue(numElementsUint8ClampedArray)); CVector cVecOpResult = {}; for (uint32_t i = 0; i < numElementsUint8ClampedArray; i++) { EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet( - thread, handleTagValUint8ClampedArray, JSTaggedValue(i), - JSHandle(thread, JSTaggedValue(std::numeric_limits::min() + i)))); + thread_, handleTagValUint8ClampedArray, JSTaggedValue(i), + JSHandle(thread_, JSTaggedValue(std::numeric_limits::min() + i)))); OperationResult opResult = - JSTypedArray::IntegerIndexedElementGet(thread, handleTagValUint8ClampedArray, JSTaggedValue(i)); + JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValUint8ClampedArray, JSTaggedValue(i)); cVecOpResult.push_back(opResult); } for (uint32_t i = 0; i < numElementsUint8ClampedArray; i++) { @@ -576,31 +581,31 @@ TEST_F(JSTypedArrayTest, IntegerIndexedElementSet_Uint8ClampedArray_001) cVecOpResult.clear(); OperationResult opResult1 = - JSTypedArray::IntegerIndexedElementGet(thread, handleTagValUint8ClampedArray, JSTaggedValue(-1)); + JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValUint8ClampedArray, JSTaggedValue(-1)); OperationResult opResult2 = - JSTypedArray::IntegerIndexedElementGet(thread, handleTagValUint8ClampedArray, JSTaggedValue(-0.0)); + JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValUint8ClampedArray, JSTaggedValue(-0.0)); OperationResult opResult3 = - JSTypedArray::IntegerIndexedElementGet(thread, handleTagValUint8ClampedArray, JSTaggedValue(1.1)); - OperationResult opResult4 = JSTypedArray::IntegerIndexedElementGet(thread, handleTagValUint8ClampedArray, + JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValUint8ClampedArray, JSTaggedValue(1.1)); + OperationResult opResult4 = JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValUint8ClampedArray, JSTaggedValue(numElementsUint8ClampedArray)); EXPECT_EQ(opResult1.GetValue().GetTaggedValue(), JSTaggedValue::Undefined()); EXPECT_EQ(opResult2.GetValue().GetTaggedValue(), JSTaggedValue::Undefined()); EXPECT_EQ(opResult3.GetValue().GetTaggedValue(), JSTaggedValue::Undefined()); EXPECT_EQ(opResult4.GetValue().GetTaggedValue(), JSTaggedValue::Undefined()); - EXPECT_FALSE(JSTypedArray::IntegerIndexedElementSet(thread, handleTagValUint8ClampedArray, JSTaggedValue(-1), - JSHandle(thread, JSTaggedValue(0)))); - EXPECT_FALSE(JSTypedArray::IntegerIndexedElementSet(thread, handleTagValUint8ClampedArray, + EXPECT_FALSE(JSTypedArray::IntegerIndexedElementSet(thread_, handleTagValUint8ClampedArray, JSTaggedValue(-1), + JSHandle(thread_, JSTaggedValue(0)))); + EXPECT_FALSE(JSTypedArray::IntegerIndexedElementSet(thread_, handleTagValUint8ClampedArray, JSTaggedValue(numElementsUint8ClampedArray), - JSHandle(thread, JSTaggedValue(0)))); + JSHandle(thread_, JSTaggedValue(0)))); } // Nonstandard input value for Uint8ClampedArray TEST_F(JSTypedArrayTest, IntegerIndexedElementSet_Uint8ClampedArray_002) { uint32_t numElementsUint8ClampedArray = 16; - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - JSHandle handleUint8ClampedArray = CreateNumberTypedArray(thread, JSType::JS_UINT8_CLAMPED_ARRAY); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle handleUint8ClampedArray = CreateNumberTypedArray(thread_, JSType::JS_UINT8_CLAMPED_ARRAY); JSHandle handleTagValUint8ClampedArray = JSHandle::Cast(handleUint8ClampedArray); uint32_t sizeElement = @@ -608,34 +613,34 @@ TEST_F(JSTypedArrayTest, IntegerIndexedElementSet_Uint8ClampedArray_002) uint32_t byteLengthViewdArrayBuffer = sizeElement * numElementsUint8ClampedArray; JSHandle handleTagValArrayBufferFrom = JSHandle::Cast(factory->NewJSArrayBuffer(byteLengthViewdArrayBuffer)); - handleUint8ClampedArray->SetViewedArrayBuffer(thread, handleTagValArrayBufferFrom); - handleUint8ClampedArray->SetArrayLength(thread, JSTaggedValue(numElementsUint8ClampedArray)); + handleUint8ClampedArray->SetViewedArrayBuffer(thread_, handleTagValArrayBufferFrom); + handleUint8ClampedArray->SetArrayLength(thread_, JSTaggedValue(numElementsUint8ClampedArray)); int64_t value1 = -1; // to uint8_clamped : 0 int64_t value2 = 256; // to uint8_clamped : 255 double value3 = 13.4; // to uint8_clamped : 13 double value4 = 13.6; // to uint8_clamped : 14 - JSHandle handleTagValValueSet1(thread, JSTaggedValue(value1)); - JSHandle handleTagValValueSet2(thread, JSTaggedValue(value2)); - JSHandle handleTagValValueSet3(thread, JSTaggedValue(value3)); - JSHandle handleTagValValueSet4(thread, JSTaggedValue(value4)); + JSHandle handleTagValValueSet1(thread_, JSTaggedValue(value1)); + JSHandle handleTagValValueSet2(thread_, JSTaggedValue(value2)); + JSHandle handleTagValValueSet3(thread_, JSTaggedValue(value3)); + JSHandle handleTagValValueSet4(thread_, JSTaggedValue(value4)); - EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread, handleTagValUint8ClampedArray, JSTaggedValue(0), + EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread_, handleTagValUint8ClampedArray, JSTaggedValue(0), handleTagValValueSet1)); OperationResult opResult1 = - JSTypedArray::IntegerIndexedElementGet(thread, handleTagValUint8ClampedArray, JSTaggedValue(0)); - EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread, handleTagValUint8ClampedArray, JSTaggedValue(0), + JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValUint8ClampedArray, JSTaggedValue(0)); + EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread_, handleTagValUint8ClampedArray, JSTaggedValue(0), handleTagValValueSet2)); OperationResult opResult2 = - JSTypedArray::IntegerIndexedElementGet(thread, handleTagValUint8ClampedArray, JSTaggedValue(0)); - EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread, handleTagValUint8ClampedArray, JSTaggedValue(0), + JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValUint8ClampedArray, JSTaggedValue(0)); + EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread_, handleTagValUint8ClampedArray, JSTaggedValue(0), handleTagValValueSet3)); OperationResult opResult3 = - JSTypedArray::IntegerIndexedElementGet(thread, handleTagValUint8ClampedArray, JSTaggedValue(0)); - EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread, handleTagValUint8ClampedArray, JSTaggedValue(0), + JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValUint8ClampedArray, JSTaggedValue(0)); + EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread_, handleTagValUint8ClampedArray, JSTaggedValue(0), handleTagValValueSet4)); OperationResult opResult4 = - JSTypedArray::IntegerIndexedElementGet(thread, handleTagValUint8ClampedArray, JSTaggedValue(0)); + JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValUint8ClampedArray, JSTaggedValue(0)); EXPECT_NE(value1, opResult1.GetValue().GetTaggedValue().GetNumber()); EXPECT_NE(value2, opResult2.GetValue().GetTaggedValue().GetNumber()); @@ -651,8 +656,8 @@ TEST_F(JSTypedArrayTest, DISABLED_IntegerIndexedElementSet_Int16Array_001) { uint32_t numElementsInt16Array = 100; int16_t scaleForInt16ValueSet = 100; - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - JSHandle handleInt16Array = CreateNumberTypedArray(thread, JSType::JS_INT16_ARRAY); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle handleInt16Array = CreateNumberTypedArray(thread_, JSType::JS_INT16_ARRAY); JSHandle handleTagValInt16Array = JSHandle::Cast(handleInt16Array); uint32_t sizeElement = @@ -660,17 +665,17 @@ TEST_F(JSTypedArrayTest, DISABLED_IntegerIndexedElementSet_Int16Array_001) uint32_t byteLengthViewdArrayBuffer = sizeElement * numElementsInt16Array; JSHandle handleTagValArrayBufferFrom = JSHandle::Cast(factory->NewJSArrayBuffer(byteLengthViewdArrayBuffer)); - handleInt16Array->SetViewedArrayBuffer(thread, handleTagValArrayBufferFrom); - handleInt16Array->SetArrayLength(thread, JSTaggedValue(numElementsInt16Array)); + handleInt16Array->SetViewedArrayBuffer(thread_, handleTagValArrayBufferFrom); + handleInt16Array->SetArrayLength(thread_, JSTaggedValue(numElementsInt16Array)); CVector cVecOpResult = {}; for (size_t i = 0; i < numElementsInt16Array; i++) { EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet( - thread, handleTagValInt16Array, JSTaggedValue(i), - JSHandle(thread, + thread_, handleTagValInt16Array, JSTaggedValue(i), + JSHandle(thread_, JSTaggedValue(std::numeric_limits::min() + i * scaleForInt16ValueSet)))); OperationResult opResult = - JSTypedArray::IntegerIndexedElementGet(thread, handleTagValInt16Array, JSTaggedValue(i)); + JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValInt16Array, JSTaggedValue(i)); cVecOpResult.push_back(opResult); } for (size_t i = 0; i < numElementsInt16Array; i++) { @@ -680,31 +685,31 @@ TEST_F(JSTypedArrayTest, DISABLED_IntegerIndexedElementSet_Int16Array_001) cVecOpResult.clear(); OperationResult opResult1 = - JSTypedArray::IntegerIndexedElementGet(thread, handleTagValInt16Array, JSTaggedValue(-1)); + JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValInt16Array, JSTaggedValue(-1)); OperationResult opResult2 = - JSTypedArray::IntegerIndexedElementGet(thread, handleTagValInt16Array, JSTaggedValue(-0.0)); + JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValInt16Array, JSTaggedValue(-0.0)); OperationResult opResult3 = - JSTypedArray::IntegerIndexedElementGet(thread, handleTagValInt16Array, JSTaggedValue(1.1)); + JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValInt16Array, JSTaggedValue(1.1)); OperationResult opResult4 = - JSTypedArray::IntegerIndexedElementGet(thread, handleTagValInt16Array, JSTaggedValue(numElementsInt16Array)); + JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValInt16Array, JSTaggedValue(numElementsInt16Array)); EXPECT_EQ(opResult1.GetValue().GetTaggedValue(), JSTaggedValue::Undefined()); EXPECT_EQ(opResult2.GetValue().GetTaggedValue(), JSTaggedValue::Undefined()); EXPECT_EQ(opResult3.GetValue().GetTaggedValue(), JSTaggedValue::Undefined()); EXPECT_EQ(opResult4.GetValue().GetTaggedValue(), JSTaggedValue::Undefined()); - EXPECT_FALSE(JSTypedArray::IntegerIndexedElementSet(thread, handleTagValInt16Array, JSTaggedValue(-1), - JSHandle(thread, JSTaggedValue(0)))); - EXPECT_FALSE(JSTypedArray::IntegerIndexedElementSet(thread, handleTagValInt16Array, + EXPECT_FALSE(JSTypedArray::IntegerIndexedElementSet(thread_, handleTagValInt16Array, JSTaggedValue(-1), + JSHandle(thread_, JSTaggedValue(0)))); + EXPECT_FALSE(JSTypedArray::IntegerIndexedElementSet(thread_, handleTagValInt16Array, JSTaggedValue(numElementsInt16Array), - JSHandle(thread, JSTaggedValue(0)))); + JSHandle(thread_, JSTaggedValue(0)))); } // Nonstandard input value for Int16Array TEST_F(JSTypedArrayTest, IntegerIndexedElementSet_Int16Array_002) { uint32_t numElementsInt16Array = 16; - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - JSHandle handleInt16Array = CreateNumberTypedArray(thread, JSType::JS_INT16_ARRAY); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle handleInt16Array = CreateNumberTypedArray(thread_, JSType::JS_INT16_ARRAY); JSHandle handleTagValInt16Array = JSHandle::Cast(handleInt16Array); uint32_t sizeElement = @@ -712,34 +717,34 @@ TEST_F(JSTypedArrayTest, IntegerIndexedElementSet_Int16Array_002) uint32_t byteLengthViewdArrayBuffer = sizeElement * numElementsInt16Array; JSHandle handleTagValArrayBufferFrom = JSHandle::Cast(factory->NewJSArrayBuffer(byteLengthViewdArrayBuffer)); - handleInt16Array->SetViewedArrayBuffer(thread, handleTagValArrayBufferFrom); - handleInt16Array->SetArrayLength(thread, JSTaggedValue(numElementsInt16Array)); + handleInt16Array->SetViewedArrayBuffer(thread_, handleTagValArrayBufferFrom); + handleInt16Array->SetArrayLength(thread_, JSTaggedValue(numElementsInt16Array)); int64_t value1 = -32769; // to int16 : 32767 int64_t value2 = 32768; // to int16 : -32768 double value3 = 13.4; // to int16 : 13 double value4 = 13.6; // to int16 : 13 - JSHandle handleTagValValueSet1(thread, JSTaggedValue(value1)); - JSHandle handleTagValValueSet2(thread, JSTaggedValue(value2)); - JSHandle handleTagValValueSet3(thread, JSTaggedValue(value3)); - JSHandle handleTagValValueSet4(thread, JSTaggedValue(value4)); + JSHandle handleTagValValueSet1(thread_, JSTaggedValue(value1)); + JSHandle handleTagValValueSet2(thread_, JSTaggedValue(value2)); + JSHandle handleTagValValueSet3(thread_, JSTaggedValue(value3)); + JSHandle handleTagValValueSet4(thread_, JSTaggedValue(value4)); - EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread, handleTagValInt16Array, JSTaggedValue(0), + EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread_, handleTagValInt16Array, JSTaggedValue(0), handleTagValValueSet1)); OperationResult opResult1 = - JSTypedArray::IntegerIndexedElementGet(thread, handleTagValInt16Array, JSTaggedValue(0)); - EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread, handleTagValInt16Array, JSTaggedValue(0), + JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValInt16Array, JSTaggedValue(0)); + EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread_, handleTagValInt16Array, JSTaggedValue(0), handleTagValValueSet2)); OperationResult opResult2 = - JSTypedArray::IntegerIndexedElementGet(thread, handleTagValInt16Array, JSTaggedValue(0)); - EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread, handleTagValInt16Array, JSTaggedValue(0), + JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValInt16Array, JSTaggedValue(0)); + EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread_, handleTagValInt16Array, JSTaggedValue(0), handleTagValValueSet3)); OperationResult opResult3 = - JSTypedArray::IntegerIndexedElementGet(thread, handleTagValInt16Array, JSTaggedValue(0)); - EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread, handleTagValInt16Array, JSTaggedValue(0), + JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValInt16Array, JSTaggedValue(0)); + EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread_, handleTagValInt16Array, JSTaggedValue(0), handleTagValValueSet4)); OperationResult opResult4 = - JSTypedArray::IntegerIndexedElementGet(thread, handleTagValInt16Array, JSTaggedValue(0)); + JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValInt16Array, JSTaggedValue(0)); EXPECT_NE(value1, opResult1.GetValue().GetTaggedValue().GetNumber()); EXPECT_NE(value2, opResult2.GetValue().GetTaggedValue().GetNumber()); @@ -755,8 +760,8 @@ TEST_F(JSTypedArrayTest, IntegerIndexedElementSet_Uint16Array_001) { uint32_t numElementsUint16Array = 100; uint32_t scaleForUint16ValueSet = 100; - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - JSHandle handleUint16Array = CreateNumberTypedArray(thread, JSType::JS_UINT16_ARRAY); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle handleUint16Array = CreateNumberTypedArray(thread_, JSType::JS_UINT16_ARRAY); JSHandle handleTagValUint16Array = JSHandle::Cast(handleUint16Array); uint32_t sizeElement = @@ -764,17 +769,17 @@ TEST_F(JSTypedArrayTest, IntegerIndexedElementSet_Uint16Array_001) uint32_t byteLengthViewdArrayBuffer = sizeElement * numElementsUint16Array; JSHandle handleTagValArrayBufferFrom = JSHandle::Cast(factory->NewJSArrayBuffer(byteLengthViewdArrayBuffer)); - handleUint16Array->SetViewedArrayBuffer(thread, handleTagValArrayBufferFrom); - handleUint16Array->SetArrayLength(thread, JSTaggedValue(numElementsUint16Array)); + handleUint16Array->SetViewedArrayBuffer(thread_, handleTagValArrayBufferFrom); + handleUint16Array->SetArrayLength(thread_, JSTaggedValue(numElementsUint16Array)); CVector cVecOpResult = {}; for (uint32_t i = 0; i < numElementsUint16Array; i++) { EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet( - thread, handleTagValUint16Array, JSTaggedValue(i), - JSHandle(thread, + thread_, handleTagValUint16Array, JSTaggedValue(i), + JSHandle(thread_, JSTaggedValue(std::numeric_limits::min() + i * scaleForUint16ValueSet)))); OperationResult opResult = - JSTypedArray::IntegerIndexedElementGet(thread, handleTagValUint16Array, JSTaggedValue(i)); + JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValUint16Array, JSTaggedValue(i)); cVecOpResult.push_back(opResult); } for (uint32_t i = 0; i < numElementsUint16Array; i++) { @@ -784,31 +789,31 @@ TEST_F(JSTypedArrayTest, IntegerIndexedElementSet_Uint16Array_001) cVecOpResult.clear(); OperationResult opResult1 = - JSTypedArray::IntegerIndexedElementGet(thread, handleTagValUint16Array, JSTaggedValue(-1)); + JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValUint16Array, JSTaggedValue(-1)); OperationResult opResult2 = - JSTypedArray::IntegerIndexedElementGet(thread, handleTagValUint16Array, JSTaggedValue(-0.0)); + JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValUint16Array, JSTaggedValue(-0.0)); OperationResult opResult3 = - JSTypedArray::IntegerIndexedElementGet(thread, handleTagValUint16Array, JSTaggedValue(1.1)); + JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValUint16Array, JSTaggedValue(1.1)); OperationResult opResult4 = - JSTypedArray::IntegerIndexedElementGet(thread, handleTagValUint16Array, JSTaggedValue(numElementsUint16Array)); + JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValUint16Array, JSTaggedValue(numElementsUint16Array)); EXPECT_EQ(opResult1.GetValue().GetTaggedValue(), JSTaggedValue::Undefined()); EXPECT_EQ(opResult2.GetValue().GetTaggedValue(), JSTaggedValue::Undefined()); EXPECT_EQ(opResult3.GetValue().GetTaggedValue(), JSTaggedValue::Undefined()); EXPECT_EQ(opResult4.GetValue().GetTaggedValue(), JSTaggedValue::Undefined()); - EXPECT_FALSE(JSTypedArray::IntegerIndexedElementSet(thread, handleTagValUint16Array, JSTaggedValue(-1), - JSHandle(thread, JSTaggedValue(0)))); - EXPECT_FALSE(JSTypedArray::IntegerIndexedElementSet(thread, handleTagValUint16Array, + EXPECT_FALSE(JSTypedArray::IntegerIndexedElementSet(thread_, handleTagValUint16Array, JSTaggedValue(-1), + JSHandle(thread_, JSTaggedValue(0)))); + EXPECT_FALSE(JSTypedArray::IntegerIndexedElementSet(thread_, handleTagValUint16Array, JSTaggedValue(numElementsUint16Array), - JSHandle(thread, JSTaggedValue(0)))); + JSHandle(thread_, JSTaggedValue(0)))); } // Nonstandard input value for Uint16Array TEST_F(JSTypedArrayTest, IntegerIndexedElementSet_Uint16Array_002) { uint32_t numElementsUint16Array = 16; - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - JSHandle handleUint16Array = CreateNumberTypedArray(thread, JSType::JS_UINT16_ARRAY); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle handleUint16Array = CreateNumberTypedArray(thread_, JSType::JS_UINT16_ARRAY); JSHandle handleTagValUint16Array = JSHandle::Cast(handleUint16Array); uint32_t sizeElement = @@ -816,34 +821,34 @@ TEST_F(JSTypedArrayTest, IntegerIndexedElementSet_Uint16Array_002) uint32_t byteLengthViewdArrayBuffer = sizeElement * numElementsUint16Array; JSHandle handleTagValArrayBufferFrom = JSHandle::Cast(factory->NewJSArrayBuffer(byteLengthViewdArrayBuffer)); - handleUint16Array->SetViewedArrayBuffer(thread, handleTagValArrayBufferFrom); - handleUint16Array->SetArrayLength(thread, JSTaggedValue(numElementsUint16Array)); + handleUint16Array->SetViewedArrayBuffer(thread_, handleTagValArrayBufferFrom); + handleUint16Array->SetArrayLength(thread_, JSTaggedValue(numElementsUint16Array)); int64_t value1 = -1; // to uint16 : 65535 int64_t value2 = 65536; // to uint16 : 0 double value3 = 13.4; // to uint16 : 13 double value4 = 13.6; // to uint16 : 13 - JSHandle handleTagValValueSet1(thread, JSTaggedValue(value1)); - JSHandle handleTagValValueSet2(thread, JSTaggedValue(value2)); - JSHandle handleTagValValueSet3(thread, JSTaggedValue(value3)); - JSHandle handleTagValValueSet4(thread, JSTaggedValue(value4)); + JSHandle handleTagValValueSet1(thread_, JSTaggedValue(value1)); + JSHandle handleTagValValueSet2(thread_, JSTaggedValue(value2)); + JSHandle handleTagValValueSet3(thread_, JSTaggedValue(value3)); + JSHandle handleTagValValueSet4(thread_, JSTaggedValue(value4)); - EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread, handleTagValUint16Array, JSTaggedValue(0), + EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread_, handleTagValUint16Array, JSTaggedValue(0), handleTagValValueSet1)); OperationResult opResult1 = - JSTypedArray::IntegerIndexedElementGet(thread, handleTagValUint16Array, JSTaggedValue(0)); - EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread, handleTagValUint16Array, JSTaggedValue(0), + JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValUint16Array, JSTaggedValue(0)); + EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread_, handleTagValUint16Array, JSTaggedValue(0), handleTagValValueSet2)); OperationResult opResult2 = - JSTypedArray::IntegerIndexedElementGet(thread, handleTagValUint16Array, JSTaggedValue(0)); - EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread, handleTagValUint16Array, JSTaggedValue(0), + JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValUint16Array, JSTaggedValue(0)); + EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread_, handleTagValUint16Array, JSTaggedValue(0), handleTagValValueSet3)); OperationResult opResult3 = - JSTypedArray::IntegerIndexedElementGet(thread, handleTagValUint16Array, JSTaggedValue(0)); - EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread, handleTagValUint16Array, JSTaggedValue(0), + JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValUint16Array, JSTaggedValue(0)); + EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread_, handleTagValUint16Array, JSTaggedValue(0), handleTagValValueSet4)); OperationResult opResult4 = - JSTypedArray::IntegerIndexedElementGet(thread, handleTagValUint16Array, JSTaggedValue(0)); + JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValUint16Array, JSTaggedValue(0)); EXPECT_NE(value1, opResult1.GetValue().GetTaggedValue().GetNumber()); EXPECT_NE(value2, opResult2.GetValue().GetTaggedValue().GetNumber()); @@ -859,8 +864,8 @@ TEST_F(JSTypedArrayTest, DISABLED_IntegerIndexedElementSet_Int32Array_001) { uint32_t numElementsInt32Array = 100; int32_t scaleForInt32ValueSet = 100000; - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - JSHandle handleInt32Array = CreateNumberTypedArray(thread, JSType::JS_INT32_ARRAY); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle handleInt32Array = CreateNumberTypedArray(thread_, JSType::JS_INT32_ARRAY); JSHandle handleTagValInt32Array = JSHandle::Cast(handleInt32Array); uint32_t sizeElement = @@ -868,17 +873,17 @@ TEST_F(JSTypedArrayTest, DISABLED_IntegerIndexedElementSet_Int32Array_001) uint32_t byteLengthViewdArrayBuffer = sizeElement * numElementsInt32Array; JSHandle handleTagValArrayBufferFrom = JSHandle::Cast(factory->NewJSArrayBuffer(byteLengthViewdArrayBuffer)); - handleInt32Array->SetViewedArrayBuffer(thread, handleTagValArrayBufferFrom); - handleInt32Array->SetArrayLength(thread, JSTaggedValue(numElementsInt32Array)); + handleInt32Array->SetViewedArrayBuffer(thread_, handleTagValArrayBufferFrom); + handleInt32Array->SetArrayLength(thread_, JSTaggedValue(numElementsInt32Array)); CVector cVecOpResult = {}; for (size_t i = 0; i < numElementsInt32Array; i++) { EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet( - thread, handleTagValInt32Array, JSTaggedValue(i), - JSHandle(thread, + thread_, handleTagValInt32Array, JSTaggedValue(i), + JSHandle(thread_, JSTaggedValue(std::numeric_limits::min() + i * scaleForInt32ValueSet)))); OperationResult opResult = - JSTypedArray::IntegerIndexedElementGet(thread, handleTagValInt32Array, JSTaggedValue(i)); + JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValInt32Array, JSTaggedValue(i)); cVecOpResult.push_back(opResult); } for (size_t i = 0; i < numElementsInt32Array; i++) { @@ -888,31 +893,31 @@ TEST_F(JSTypedArrayTest, DISABLED_IntegerIndexedElementSet_Int32Array_001) cVecOpResult.clear(); OperationResult opResult1 = - JSTypedArray::IntegerIndexedElementGet(thread, handleTagValInt32Array, JSTaggedValue(-1)); + JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValInt32Array, JSTaggedValue(-1)); OperationResult opResult2 = - JSTypedArray::IntegerIndexedElementGet(thread, handleTagValInt32Array, JSTaggedValue(-0.0)); + JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValInt32Array, JSTaggedValue(-0.0)); OperationResult opResult3 = - JSTypedArray::IntegerIndexedElementGet(thread, handleTagValInt32Array, JSTaggedValue(1.1)); + JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValInt32Array, JSTaggedValue(1.1)); OperationResult opResult4 = - JSTypedArray::IntegerIndexedElementGet(thread, handleTagValInt32Array, JSTaggedValue(numElementsInt32Array)); + JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValInt32Array, JSTaggedValue(numElementsInt32Array)); EXPECT_EQ(opResult1.GetValue().GetTaggedValue(), JSTaggedValue::Undefined()); EXPECT_EQ(opResult2.GetValue().GetTaggedValue(), JSTaggedValue::Undefined()); EXPECT_EQ(opResult3.GetValue().GetTaggedValue(), JSTaggedValue::Undefined()); EXPECT_EQ(opResult4.GetValue().GetTaggedValue(), JSTaggedValue::Undefined()); - EXPECT_FALSE(JSTypedArray::IntegerIndexedElementSet(thread, handleTagValInt32Array, JSTaggedValue(-1), - JSHandle(thread, JSTaggedValue(0)))); - EXPECT_FALSE(JSTypedArray::IntegerIndexedElementSet(thread, handleTagValInt32Array, + EXPECT_FALSE(JSTypedArray::IntegerIndexedElementSet(thread_, handleTagValInt32Array, JSTaggedValue(-1), + JSHandle(thread_, JSTaggedValue(0)))); + EXPECT_FALSE(JSTypedArray::IntegerIndexedElementSet(thread_, handleTagValInt32Array, JSTaggedValue(numElementsInt32Array), - JSHandle(thread, JSTaggedValue(0)))); + JSHandle(thread_, JSTaggedValue(0)))); } // Nonstandard input value for Int32Array TEST_F(JSTypedArrayTest, IntegerIndexedElementSet_Int32Array_002) { uint32_t numElementsInt32Array = 16; - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - JSHandle handleInt32Array = CreateNumberTypedArray(thread, JSType::JS_INT32_ARRAY); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle handleInt32Array = CreateNumberTypedArray(thread_, JSType::JS_INT32_ARRAY); JSHandle handleTagValInt32Array = JSHandle::Cast(handleInt32Array); uint32_t sizeElement = @@ -920,34 +925,34 @@ TEST_F(JSTypedArrayTest, IntegerIndexedElementSet_Int32Array_002) uint32_t byteLengthViewdArrayBuffer = sizeElement * numElementsInt32Array; JSHandle handleTagValArrayBufferFrom = JSHandle::Cast(factory->NewJSArrayBuffer(byteLengthViewdArrayBuffer)); - handleInt32Array->SetViewedArrayBuffer(thread, handleTagValArrayBufferFrom); - handleInt32Array->SetArrayLength(thread, JSTaggedValue(numElementsInt32Array)); + handleInt32Array->SetViewedArrayBuffer(thread_, handleTagValArrayBufferFrom); + handleInt32Array->SetArrayLength(thread_, JSTaggedValue(numElementsInt32Array)); int64_t value1 = -2147483649; // to int32 : 2147483647 int64_t value2 = 2147483648; // to int32 : -2147483648 double value3 = 13.4; // to int32 : 13 double value4 = 13.6; // to int32 : 13 - JSHandle handleTagValValueSet1(thread, JSTaggedValue(value1)); - JSHandle handleTagValValueSet2(thread, JSTaggedValue(value2)); - JSHandle handleTagValValueSet3(thread, JSTaggedValue(value3)); - JSHandle handleTagValValueSet4(thread, JSTaggedValue(value4)); + JSHandle handleTagValValueSet1(thread_, JSTaggedValue(value1)); + JSHandle handleTagValValueSet2(thread_, JSTaggedValue(value2)); + JSHandle handleTagValValueSet3(thread_, JSTaggedValue(value3)); + JSHandle handleTagValValueSet4(thread_, JSTaggedValue(value4)); - EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread, handleTagValInt32Array, JSTaggedValue(0), + EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread_, handleTagValInt32Array, JSTaggedValue(0), handleTagValValueSet1)); OperationResult opResult1 = - JSTypedArray::IntegerIndexedElementGet(thread, handleTagValInt32Array, JSTaggedValue(0)); - EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread, handleTagValInt32Array, JSTaggedValue(0), + JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValInt32Array, JSTaggedValue(0)); + EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread_, handleTagValInt32Array, JSTaggedValue(0), handleTagValValueSet2)); OperationResult opResult2 = - JSTypedArray::IntegerIndexedElementGet(thread, handleTagValInt32Array, JSTaggedValue(0)); - EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread, handleTagValInt32Array, JSTaggedValue(0), + JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValInt32Array, JSTaggedValue(0)); + EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread_, handleTagValInt32Array, JSTaggedValue(0), handleTagValValueSet3)); OperationResult opResult3 = - JSTypedArray::IntegerIndexedElementGet(thread, handleTagValInt32Array, JSTaggedValue(0)); - EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread, handleTagValInt32Array, JSTaggedValue(0), + JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValInt32Array, JSTaggedValue(0)); + EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread_, handleTagValInt32Array, JSTaggedValue(0), handleTagValValueSet4)); OperationResult opResult4 = - JSTypedArray::IntegerIndexedElementGet(thread, handleTagValInt32Array, JSTaggedValue(0)); + JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValInt32Array, JSTaggedValue(0)); EXPECT_NE(value1, opResult1.GetValue().GetTaggedValue().GetNumber()); EXPECT_NE(value2, opResult2.GetValue().GetTaggedValue().GetNumber()); @@ -963,8 +968,8 @@ TEST_F(JSTypedArrayTest, IntegerIndexedElementSet_Uint32Array_001) { uint32_t numElementsUint32Array = 100; uint32_t scaleForUint32ValueSet = 100000; - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - JSHandle handleUint32Array = CreateNumberTypedArray(thread, JSType::JS_UINT32_ARRAY); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle handleUint32Array = CreateNumberTypedArray(thread_, JSType::JS_UINT32_ARRAY); JSHandle handleTagValUint32Array = JSHandle::Cast(handleUint32Array); uint32_t sizeElement = @@ -972,17 +977,17 @@ TEST_F(JSTypedArrayTest, IntegerIndexedElementSet_Uint32Array_001) uint32_t byteLengthViewdArrayBuffer = sizeElement * numElementsUint32Array; JSHandle handleTagValArrayBufferFrom = JSHandle::Cast(factory->NewJSArrayBuffer(byteLengthViewdArrayBuffer)); - handleUint32Array->SetViewedArrayBuffer(thread, handleTagValArrayBufferFrom); - handleUint32Array->SetArrayLength(thread, JSTaggedValue(numElementsUint32Array)); + handleUint32Array->SetViewedArrayBuffer(thread_, handleTagValArrayBufferFrom); + handleUint32Array->SetArrayLength(thread_, JSTaggedValue(numElementsUint32Array)); CVector cVecOpResult = {}; for (uint32_t i = 0; i < numElementsUint32Array; i++) { EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet( - thread, handleTagValUint32Array, JSTaggedValue(i), - JSHandle(thread, + thread_, handleTagValUint32Array, JSTaggedValue(i), + JSHandle(thread_, JSTaggedValue(std::numeric_limits::min() + i * scaleForUint32ValueSet)))); OperationResult opResult = - JSTypedArray::IntegerIndexedElementGet(thread, handleTagValUint32Array, JSTaggedValue(i)); + JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValUint32Array, JSTaggedValue(i)); cVecOpResult.push_back(opResult); } for (uint32_t i = 0; i < numElementsUint32Array; i++) { @@ -992,31 +997,31 @@ TEST_F(JSTypedArrayTest, IntegerIndexedElementSet_Uint32Array_001) cVecOpResult.clear(); OperationResult opResult1 = - JSTypedArray::IntegerIndexedElementGet(thread, handleTagValUint32Array, JSTaggedValue(-1)); + JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValUint32Array, JSTaggedValue(-1)); OperationResult opResult2 = - JSTypedArray::IntegerIndexedElementGet(thread, handleTagValUint32Array, JSTaggedValue(-0.0)); + JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValUint32Array, JSTaggedValue(-0.0)); OperationResult opResult3 = - JSTypedArray::IntegerIndexedElementGet(thread, handleTagValUint32Array, JSTaggedValue(1.1)); + JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValUint32Array, JSTaggedValue(1.1)); OperationResult opResult4 = - JSTypedArray::IntegerIndexedElementGet(thread, handleTagValUint32Array, JSTaggedValue(numElementsUint32Array)); + JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValUint32Array, JSTaggedValue(numElementsUint32Array)); EXPECT_EQ(opResult1.GetValue().GetTaggedValue(), JSTaggedValue::Undefined()); EXPECT_EQ(opResult2.GetValue().GetTaggedValue(), JSTaggedValue::Undefined()); EXPECT_EQ(opResult3.GetValue().GetTaggedValue(), JSTaggedValue::Undefined()); EXPECT_EQ(opResult4.GetValue().GetTaggedValue(), JSTaggedValue::Undefined()); - EXPECT_FALSE(JSTypedArray::IntegerIndexedElementSet(thread, handleTagValUint32Array, JSTaggedValue(-1), - JSHandle(thread, JSTaggedValue(0)))); - EXPECT_FALSE(JSTypedArray::IntegerIndexedElementSet(thread, handleTagValUint32Array, + EXPECT_FALSE(JSTypedArray::IntegerIndexedElementSet(thread_, handleTagValUint32Array, JSTaggedValue(-1), + JSHandle(thread_, JSTaggedValue(0)))); + EXPECT_FALSE(JSTypedArray::IntegerIndexedElementSet(thread_, handleTagValUint32Array, JSTaggedValue(numElementsUint32Array), - JSHandle(thread, JSTaggedValue(0)))); + JSHandle(thread_, JSTaggedValue(0)))); } // Nonstandard input value for Uint32Array TEST_F(JSTypedArrayTest, IntegerIndexedElementSet_Uint32Array_002) { int32_t numElementsUint32Array = 16; - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - JSHandle handleUint32Array = CreateNumberTypedArray(thread, JSType::JS_UINT32_ARRAY); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle handleUint32Array = CreateNumberTypedArray(thread_, JSType::JS_UINT32_ARRAY); JSHandle handleTagValUint32Array = JSHandle::Cast(handleUint32Array); uint32_t sizeElement = @@ -1024,34 +1029,34 @@ TEST_F(JSTypedArrayTest, IntegerIndexedElementSet_Uint32Array_002) int32_t byteLengthViewdArrayBuffer = sizeElement * numElementsUint32Array; JSHandle handleTagValArrayBufferFrom = JSHandle::Cast(factory->NewJSArrayBuffer(byteLengthViewdArrayBuffer)); - handleUint32Array->SetViewedArrayBuffer(thread, handleTagValArrayBufferFrom); - handleUint32Array->SetArrayLength(thread, JSTaggedValue(numElementsUint32Array)); + handleUint32Array->SetViewedArrayBuffer(thread_, handleTagValArrayBufferFrom); + handleUint32Array->SetArrayLength(thread_, JSTaggedValue(numElementsUint32Array)); int64_t value1 = -1; // to uint32 : 4294967295 int64_t value2 = 4294967296; // to uint32 : 0 double value3 = 13.4; // to uint32 : 13 double value4 = 13.6; // to uint32 : 13 - JSHandle handleTagValValueSet1(thread, JSTaggedValue(value1)); - JSHandle handleTagValValueSet2(thread, JSTaggedValue(value2)); - JSHandle handleTagValValueSet3(thread, JSTaggedValue(value3)); - JSHandle handleTagValValueSet4(thread, JSTaggedValue(value4)); + JSHandle handleTagValValueSet1(thread_, JSTaggedValue(value1)); + JSHandle handleTagValValueSet2(thread_, JSTaggedValue(value2)); + JSHandle handleTagValValueSet3(thread_, JSTaggedValue(value3)); + JSHandle handleTagValValueSet4(thread_, JSTaggedValue(value4)); - EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread, handleTagValUint32Array, JSTaggedValue(0), + EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread_, handleTagValUint32Array, JSTaggedValue(0), handleTagValValueSet1)); OperationResult opResult1 = - JSTypedArray::IntegerIndexedElementGet(thread, handleTagValUint32Array, JSTaggedValue(0)); - EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread, handleTagValUint32Array, JSTaggedValue(0), + JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValUint32Array, JSTaggedValue(0)); + EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread_, handleTagValUint32Array, JSTaggedValue(0), handleTagValValueSet2)); OperationResult opResult2 = - JSTypedArray::IntegerIndexedElementGet(thread, handleTagValUint32Array, JSTaggedValue(0)); - EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread, handleTagValUint32Array, JSTaggedValue(0), + JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValUint32Array, JSTaggedValue(0)); + EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread_, handleTagValUint32Array, JSTaggedValue(0), handleTagValValueSet3)); OperationResult opResult3 = - JSTypedArray::IntegerIndexedElementGet(thread, handleTagValUint32Array, JSTaggedValue(0)); - EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread, handleTagValUint32Array, JSTaggedValue(0), + JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValUint32Array, JSTaggedValue(0)); + EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread_, handleTagValUint32Array, JSTaggedValue(0), handleTagValValueSet4)); OperationResult opResult4 = - JSTypedArray::IntegerIndexedElementGet(thread, handleTagValUint32Array, JSTaggedValue(0)); + JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValUint32Array, JSTaggedValue(0)); EXPECT_NE(value1, opResult1.GetValue().GetTaggedValue().GetNumber()); EXPECT_NE(value2, opResult2.GetValue().GetTaggedValue().GetNumber()); @@ -1066,8 +1071,8 @@ TEST_F(JSTypedArrayTest, IntegerIndexedElementSet_Uint32Array_002) TEST_F(JSTypedArrayTest, IntegerIndexedElementSet_Float32Array) { uint32_t numElementsFloat32Array = 100; - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - JSHandle handleFloat32Array = CreateNumberTypedArray(thread, JSType::JS_FLOAT32_ARRAY); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle handleFloat32Array = CreateNumberTypedArray(thread_, JSType::JS_FLOAT32_ARRAY); JSHandle handleTagValFloat32Array = JSHandle::Cast(handleFloat32Array); uint32_t sizeElement = @@ -1075,18 +1080,18 @@ TEST_F(JSTypedArrayTest, IntegerIndexedElementSet_Float32Array) uint32_t byteLengthViewdArrayBuffer = sizeElement * numElementsFloat32Array; JSHandle handleTagValArrayBufferFrom = JSHandle::Cast(factory->NewJSArrayBuffer(byteLengthViewdArrayBuffer)); - handleFloat32Array->SetViewedArrayBuffer(thread, handleTagValArrayBufferFrom); - handleFloat32Array->SetArrayLength(thread, JSTaggedValue(numElementsFloat32Array)); + handleFloat32Array->SetViewedArrayBuffer(thread_, handleTagValArrayBufferFrom); + handleFloat32Array->SetArrayLength(thread_, JSTaggedValue(numElementsFloat32Array)); CVector cVecOpResult = {}; float floatMaxValue = std::numeric_limits::max(); for (uint32_t i = 0; i < numElementsFloat32Array; i++) { EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet( - thread, handleTagValFloat32Array, JSTaggedValue(i), - JSHandle(thread, + thread_, handleTagValFloat32Array, JSTaggedValue(i), + JSHandle(thread_, JSTaggedValue(floatMaxValue - (i * (floatMaxValue / numElementsFloat32Array)))))); OperationResult opResult = - JSTypedArray::IntegerIndexedElementGet(thread, handleTagValFloat32Array, JSTaggedValue(i)); + JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValFloat32Array, JSTaggedValue(i)); cVecOpResult.push_back(opResult); } for (uint32_t i = 0; i < numElementsFloat32Array; i++) { @@ -1096,30 +1101,30 @@ TEST_F(JSTypedArrayTest, IntegerIndexedElementSet_Float32Array) cVecOpResult.clear(); OperationResult opResult1 = - JSTypedArray::IntegerIndexedElementGet(thread, handleTagValFloat32Array, JSTaggedValue(-1)); + JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValFloat32Array, JSTaggedValue(-1)); OperationResult opResult2 = - JSTypedArray::IntegerIndexedElementGet(thread, handleTagValFloat32Array, JSTaggedValue(-0.0)); + JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValFloat32Array, JSTaggedValue(-0.0)); OperationResult opResult3 = - JSTypedArray::IntegerIndexedElementGet(thread, handleTagValFloat32Array, JSTaggedValue(1.1)); - OperationResult opResult4 = JSTypedArray::IntegerIndexedElementGet(thread, handleTagValFloat32Array, + JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValFloat32Array, JSTaggedValue(1.1)); + OperationResult opResult4 = JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValFloat32Array, JSTaggedValue(numElementsFloat32Array)); EXPECT_EQ(opResult1.GetValue().GetTaggedValue(), JSTaggedValue::Undefined()); EXPECT_EQ(opResult2.GetValue().GetTaggedValue(), JSTaggedValue::Undefined()); EXPECT_EQ(opResult3.GetValue().GetTaggedValue(), JSTaggedValue::Undefined()); EXPECT_EQ(opResult4.GetValue().GetTaggedValue(), JSTaggedValue::Undefined()); - EXPECT_FALSE(JSTypedArray::IntegerIndexedElementSet(thread, handleTagValFloat32Array, JSTaggedValue(-1), - JSHandle(thread, JSTaggedValue(0)))); - EXPECT_FALSE(JSTypedArray::IntegerIndexedElementSet(thread, handleTagValFloat32Array, + EXPECT_FALSE(JSTypedArray::IntegerIndexedElementSet(thread_, handleTagValFloat32Array, JSTaggedValue(-1), + JSHandle(thread_, JSTaggedValue(0)))); + EXPECT_FALSE(JSTypedArray::IntegerIndexedElementSet(thread_, handleTagValFloat32Array, JSTaggedValue(numElementsFloat32Array), - JSHandle(thread, JSTaggedValue(0)))); + JSHandle(thread_, JSTaggedValue(0)))); } TEST_F(JSTypedArrayTest, IntegerIndexedElementSet_Float64Array) { uint32_t numElementsFloat64Array = 100; - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - JSHandle handleFloat64Array = CreateNumberTypedArray(thread, JSType::JS_FLOAT64_ARRAY); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle handleFloat64Array = CreateNumberTypedArray(thread_, JSType::JS_FLOAT64_ARRAY); JSHandle handleTagValFloat64Array = JSHandle::Cast(handleFloat64Array); uint32_t sizeElement = @@ -1127,18 +1132,18 @@ TEST_F(JSTypedArrayTest, IntegerIndexedElementSet_Float64Array) uint32_t byteLengthViewdArrayBuffer = sizeElement * numElementsFloat64Array; JSHandle handleTagValArrayBufferFrom = JSHandle::Cast(factory->NewJSArrayBuffer(byteLengthViewdArrayBuffer)); - handleFloat64Array->SetViewedArrayBuffer(thread, handleTagValArrayBufferFrom); - handleFloat64Array->SetArrayLength(thread, JSTaggedValue(numElementsFloat64Array)); + handleFloat64Array->SetViewedArrayBuffer(thread_, handleTagValArrayBufferFrom); + handleFloat64Array->SetArrayLength(thread_, JSTaggedValue(numElementsFloat64Array)); CVector cVecOpResult = {}; double doubleMaxValue = std::numeric_limits::max(); for (uint32_t i = 0; i < numElementsFloat64Array; i++) { EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet( - thread, handleTagValFloat64Array, JSTaggedValue(i), - JSHandle(thread, + thread_, handleTagValFloat64Array, JSTaggedValue(i), + JSHandle(thread_, JSTaggedValue(doubleMaxValue - (i * (doubleMaxValue / numElementsFloat64Array)))))); OperationResult opResult = - JSTypedArray::IntegerIndexedElementGet(thread, handleTagValFloat64Array, JSTaggedValue(i)); + JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValFloat64Array, JSTaggedValue(i)); cVecOpResult.push_back(opResult); } for (uint32_t i = 0; i < numElementsFloat64Array; i++) { @@ -1148,23 +1153,23 @@ TEST_F(JSTypedArrayTest, IntegerIndexedElementSet_Float64Array) cVecOpResult.clear(); OperationResult opResult1 = - JSTypedArray::IntegerIndexedElementGet(thread, handleTagValFloat64Array, JSTaggedValue(-1)); + JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValFloat64Array, JSTaggedValue(-1)); OperationResult opResult2 = - JSTypedArray::IntegerIndexedElementGet(thread, handleTagValFloat64Array, JSTaggedValue(-0.0)); + JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValFloat64Array, JSTaggedValue(-0.0)); OperationResult opResult3 = - JSTypedArray::IntegerIndexedElementGet(thread, handleTagValFloat64Array, JSTaggedValue(1.1)); - OperationResult opResult4 = JSTypedArray::IntegerIndexedElementGet(thread, handleTagValFloat64Array, + JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValFloat64Array, JSTaggedValue(1.1)); + OperationResult opResult4 = JSTypedArray::IntegerIndexedElementGet(thread_, handleTagValFloat64Array, JSTaggedValue(numElementsFloat64Array)); EXPECT_EQ(opResult1.GetValue().GetTaggedValue(), JSTaggedValue::Undefined()); EXPECT_EQ(opResult2.GetValue().GetTaggedValue(), JSTaggedValue::Undefined()); EXPECT_EQ(opResult3.GetValue().GetTaggedValue(), JSTaggedValue::Undefined()); EXPECT_EQ(opResult4.GetValue().GetTaggedValue(), JSTaggedValue::Undefined()); - EXPECT_FALSE(JSTypedArray::IntegerIndexedElementSet(thread, handleTagValFloat64Array, JSTaggedValue(-1), - JSHandle(thread, JSTaggedValue(0)))); - EXPECT_FALSE(JSTypedArray::IntegerIndexedElementSet(thread, handleTagValFloat64Array, + EXPECT_FALSE(JSTypedArray::IntegerIndexedElementSet(thread_, handleTagValFloat64Array, JSTaggedValue(-1), + JSHandle(thread_, JSTaggedValue(0)))); + EXPECT_FALSE(JSTypedArray::IntegerIndexedElementSet(thread_, handleTagValFloat64Array, JSTaggedValue(numElementsFloat64Array), - JSHandle(thread, JSTaggedValue(0)))); + JSHandle(thread_, JSTaggedValue(0)))); } /* @@ -1177,11 +1182,11 @@ TEST_F(JSTypedArrayTest, IntegerIndexedElementSet_Float64Array) */ TEST_F(JSTypedArrayTest, FastElementGet_TypedArray) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); - for (uint32_t j = 0; j < cVecJSType.size(); j++) { + for (uint32_t j = 0; j < c_vec_js_type_.size(); j++) { uint32_t numElementsTypedArray = 10; - JSHandle handleTypedArray = CreateNumberTypedArray(thread, cVecJSType.at(j)); + JSHandle handleTypedArray = CreateNumberTypedArray(thread_, c_vec_js_type_.at(j)); JSHandle handleTagValTypedArray = JSHandle::Cast(handleTypedArray); uint32_t sizeElement = @@ -1189,22 +1194,24 @@ TEST_F(JSTypedArrayTest, FastElementGet_TypedArray) uint32_t byteLengthViewdArrayBuffer = sizeElement * numElementsTypedArray; JSHandle handleTagValArrayBufferFrom = JSHandle::Cast(factory->NewJSArrayBuffer(byteLengthViewdArrayBuffer)); - handleTypedArray->SetViewedArrayBuffer(thread, handleTagValArrayBufferFrom); - handleTypedArray->SetArrayLength(thread, JSTaggedValue(numElementsTypedArray)); + handleTypedArray->SetViewedArrayBuffer(thread_, handleTagValArrayBufferFrom); + handleTypedArray->SetArrayLength(thread_, JSTaggedValue(numElementsTypedArray)); - JSHandle handleTagValValueSet(thread, JSTaggedValue(cVecHandleTagValValueForTypedArray.at(j))); + JSHandle handleTagValValueSet(thread_, + JSTaggedValue(c_vec_handle_tag_val_value_for_typed_array_.at(j))); for (uint32_t i = 0; i < numElementsTypedArray; i++) { - EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread, handleTagValTypedArray, JSTaggedValue(i), + EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread_, handleTagValTypedArray, JSTaggedValue(i), handleTagValValueSet)); } for (uint32_t i = 0; i < numElementsTypedArray; i++) { - OperationResult opResult = JSTypedArray::FastElementGet(thread, handleTagValTypedArray, i); + OperationResult opResult = JSTypedArray::FastElementGet(thread_, handleTagValTypedArray, i); EXPECT_EQ(opResult.GetValue().GetTaggedValue().GetNumber(), handleTagValValueSet.GetTaggedValue().GetNumber()); } - OperationResult opResult1 = JSTypedArray::FastElementGet(thread, handleTagValTypedArray, -1); - OperationResult opResult2 = JSTypedArray::FastElementGet(thread, handleTagValTypedArray, numElementsTypedArray); + OperationResult opResult1 = JSTypedArray::FastElementGet(thread_, handleTagValTypedArray, -1); + OperationResult opResult2 = + JSTypedArray::FastElementGet(thread_, handleTagValTypedArray, numElementsTypedArray); EXPECT_EQ(opResult1.GetValue().GetTaggedValue(), JSTaggedValue::Undefined()); EXPECT_EQ(opResult2.GetValue().GetTaggedValue(), JSTaggedValue::Undefined()); } @@ -1223,13 +1230,13 @@ TEST_F(JSTypedArrayTest, FastElementGet_TypedArray) */ TEST_F(JSTypedArrayTest, DefineOwnProperty_TypedArray) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); - for (size_t j = 0; j < cVecJSType.size(); j++) { + for (size_t j = 0; j < c_vec_js_type_.size(); j++) { int32_t numElementsTypedArray = 10; - JSHandle handleTagValValueDef(thread, cVecHandleTagValValueForTypedArray.at(j)); - PropertyDescriptor descFrom1(thread, handleTagValValueDef, true, true, true); - JSHandle handleTypedArray = CreateNumberTypedArray(thread, cVecJSType.at(j)); + JSHandle handleTagValValueDef(thread_, c_vec_handle_tag_val_value_for_typed_array_.at(j)); + PropertyDescriptor descFrom1(thread_, handleTagValValueDef, true, true, true); + JSHandle handleTypedArray = CreateNumberTypedArray(thread_, c_vec_js_type_.at(j)); JSHandle handleTagValTypedArray = JSHandle::Cast(handleTypedArray); uint32_t sizeElement = @@ -1237,24 +1244,24 @@ TEST_F(JSTypedArrayTest, DefineOwnProperty_TypedArray) int32_t byteLengthViewdArrayBuffer = sizeElement * numElementsTypedArray; JSHandle handleTagValArrayBufferFrom = JSHandle::Cast(factory->NewJSArrayBuffer(byteLengthViewdArrayBuffer)); - handleTypedArray->SetViewedArrayBuffer(thread, handleTagValArrayBufferFrom); - handleTypedArray->SetArrayLength(thread, JSTaggedValue(numElementsTypedArray)); + handleTypedArray->SetViewedArrayBuffer(thread_, handleTagValArrayBufferFrom); + handleTypedArray->SetArrayLength(thread_, JSTaggedValue(numElementsTypedArray)); for (int32_t i = 0; i < numElementsTypedArray; i++) { - JSHandle handleTagValKey(thread, JSTaggedValue(i)); - EXPECT_FALSE(JSTypedArray::HasProperty(thread, handleTagValTypedArray, handleTagValKey)); - EXPECT_TRUE(JSTypedArray::DefineOwnProperty(thread, handleTagValTypedArray, handleTagValKey, descFrom1)); - EXPECT_TRUE(JSTypedArray::HasProperty(thread, handleTagValTypedArray, handleTagValKey)); + JSHandle handleTagValKey(thread_, JSTaggedValue(i)); + EXPECT_FALSE(JSTypedArray::HasProperty(thread_, handleTagValTypedArray, handleTagValKey)); + EXPECT_TRUE(JSTypedArray::DefineOwnProperty(thread_, handleTagValTypedArray, handleTagValKey, descFrom1)); + EXPECT_TRUE(JSTypedArray::HasProperty(thread_, handleTagValTypedArray, handleTagValKey)); EXPECT_TRUE(JSTaggedValue::StrictEqual( - thread, handleTagValValueDef, - JSTypedArray::GetProperty(thread, handleTagValTypedArray, handleTagValKey).GetValue())); + thread_, handleTagValValueDef, + JSTypedArray::GetProperty(thread_, handleTagValTypedArray, handleTagValKey).GetValue())); - PropertyDescriptor descTo1(thread); + PropertyDescriptor descTo1(thread_); EXPECT_FALSE(descTo1.HasWritable() || descTo1.HasEnumerable() || descTo1.HasConfigurable()); - EXPECT_TRUE(JSTypedArray::GetOwnProperty(thread, handleTagValTypedArray, handleTagValKey, descTo1)); + EXPECT_TRUE(JSTypedArray::GetOwnProperty(thread_, handleTagValTypedArray, handleTagValKey, descTo1)); EXPECT_TRUE(descTo1.HasWritable() && descTo1.HasEnumerable() && descTo1.HasConfigurable()); EXPECT_TRUE(descTo1.IsWritable() && descTo1.IsEnumerable() && descTo1.IsConfigurable()); - EXPECT_TRUE(JSTaggedValue::StrictEqual(thread, descTo1.GetValue(), handleTagValValueDef)); + EXPECT_TRUE(JSTaggedValue::StrictEqual(thread_, descTo1.GetValue(), handleTagValValueDef)); } } } @@ -1272,12 +1279,12 @@ TEST_F(JSTypedArrayTest, DefineOwnProperty_TypedArray) */ TEST_F(JSTypedArrayTest, SetProperty_TypedArray) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); - for (size_t j = 0; j < cVecJSType.size(); j++) { + for (size_t j = 0; j < c_vec_js_type_.size(); j++) { int32_t numElementsTypedArray = 10; - JSHandle handleTagValValueSet(thread, cVecHandleTagValValueForTypedArray.at(j)); - JSHandle handleTypedArray = CreateNumberTypedArray(thread, cVecJSType.at(j)); + JSHandle handleTagValValueSet(thread_, c_vec_handle_tag_val_value_for_typed_array_.at(j)); + JSHandle handleTypedArray = CreateNumberTypedArray(thread_, c_vec_js_type_.at(j)); JSHandle handleTagValTypedArray = JSHandle::Cast(handleTypedArray); uint32_t sizeElement = @@ -1285,18 +1292,18 @@ TEST_F(JSTypedArrayTest, SetProperty_TypedArray) int32_t byteLengthViewdArrayBuffer = sizeElement * numElementsTypedArray; JSHandle handleTagValArrayBufferFrom = JSHandle::Cast(factory->NewJSArrayBuffer(byteLengthViewdArrayBuffer)); - handleTypedArray->SetViewedArrayBuffer(thread, handleTagValArrayBufferFrom); - handleTypedArray->SetArrayLength(thread, JSTaggedValue(numElementsTypedArray)); + handleTypedArray->SetViewedArrayBuffer(thread_, handleTagValArrayBufferFrom); + handleTypedArray->SetArrayLength(thread_, JSTaggedValue(numElementsTypedArray)); for (int32_t i = 0; i < numElementsTypedArray; i++) { - JSHandle handleTagValKey(thread, JSTaggedValue(i)); - EXPECT_FALSE(JSTypedArray::HasProperty(thread, handleTagValTypedArray, handleTagValKey)); + JSHandle handleTagValKey(thread_, JSTaggedValue(i)); + EXPECT_FALSE(JSTypedArray::HasProperty(thread_, handleTagValTypedArray, handleTagValKey)); EXPECT_TRUE( - JSTypedArray::SetProperty(thread, handleTagValTypedArray, handleTagValKey, handleTagValValueSet)); - EXPECT_TRUE(JSTypedArray::HasProperty(thread, handleTagValTypedArray, handleTagValKey)); + JSTypedArray::SetProperty(thread_, handleTagValTypedArray, handleTagValKey, handleTagValValueSet)); + EXPECT_TRUE(JSTypedArray::HasProperty(thread_, handleTagValTypedArray, handleTagValKey)); EXPECT_TRUE(JSTaggedValue::StrictEqual( - thread, handleTagValValueSet, - JSTypedArray::GetProperty(thread, handleTagValTypedArray, handleTagValKey).GetValue())); + thread_, handleTagValValueSet, + JSTypedArray::GetProperty(thread_, handleTagValTypedArray, handleTagValKey).GetValue())); } } } @@ -1314,12 +1321,12 @@ TEST_F(JSTypedArrayTest, SetProperty_TypedArray) */ TEST_F(JSTypedArrayTest, FastCopyElementToArray_TypedArray) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); - for (size_t j = 0; j < cVecJSType.size(); j++) { + for (size_t j = 0; j < c_vec_js_type_.size(); j++) { int32_t numElementsTypedArray = 10; - JSHandle handleTagValValueSet(thread, cVecHandleTagValValueForTypedArray.at(j)); - JSHandle handleTypedArrayFrom = CreateNumberTypedArray(thread, cVecJSType.at(j)); + JSHandle handleTagValValueSet(thread_, c_vec_handle_tag_val_value_for_typed_array_.at(j)); + JSHandle handleTypedArrayFrom = CreateNumberTypedArray(thread_, c_vec_js_type_.at(j)); JSHandle handleTagValTypedArrayFrom = JSHandle::Cast(handleTypedArrayFrom); uint32_t sizeElement = @@ -1328,14 +1335,14 @@ TEST_F(JSTypedArrayTest, FastCopyElementToArray_TypedArray) JSHandle handleTagValArrayBuffer = JSHandle::Cast(factory->NewJSArrayBuffer(byteLengthViewdArrayBuffer)); JSHandle handleTagArrTo = factory->NewTaggedArray(byteLengthViewdArrayBuffer); - handleTypedArrayFrom->SetViewedArrayBuffer(thread, handleTagValArrayBuffer); - handleTypedArrayFrom->SetArrayLength(thread, JSTaggedValue(numElementsTypedArray)); + handleTypedArrayFrom->SetViewedArrayBuffer(thread_, handleTagValArrayBuffer); + handleTypedArrayFrom->SetArrayLength(thread_, JSTaggedValue(numElementsTypedArray)); for (int32_t i = 0; i < numElementsTypedArray; i++) { - EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread, handleTagValTypedArrayFrom, JSTaggedValue(i), + EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread_, handleTagValTypedArrayFrom, JSTaggedValue(i), handleTagValValueSet)); } - EXPECT_TRUE(JSTypedArray::FastCopyElementToArray(thread, handleTagValTypedArrayFrom, handleTagArrTo)); + EXPECT_TRUE(JSTypedArray::FastCopyElementToArray(thread_, handleTagValTypedArrayFrom, handleTagArrTo)); for (int32_t i = 0; i < numElementsTypedArray; i++) { EXPECT_EQ(handleTagArrTo->Get(i), handleTagValValueSet.GetTaggedValue()); } diff --git a/tests/runtime/common/js_verification_test.cpp b/tests/runtime/common/js_verification_test.cpp index 84b1f70637033e8a7b03c34f58475c58c89c535a..7f4fab3aababe1963e080c9fc9c5d4694b7bccd5 100644 --- a/tests/runtime/common/js_verification_test.cpp +++ b/tests/runtime/common/js_verification_test.cpp @@ -37,22 +37,22 @@ class JSVerificationTest : public testing::Test { public: void SetUp() override { - TestHelper::CreateEcmaVMWithScope(instance, thread, scope); + TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); } void TearDown() override { - TestHelper::DestroyEcmaVMWithScope(instance, scope); + TestHelper::DestroyEcmaVMWithScope(instance_, scope_); } - PandaVM *instance {nullptr}; - EcmaHandleScope *scope {nullptr}; - JSThread *thread; + PandaVM *instance_ {nullptr}; + EcmaHandleScope *scope_ {nullptr}; + JSThread *thread_; }; TEST_F(JSVerificationTest, DISABLED_IsHeapAddress) // issue #5368 { - auto ecmaVm = thread->GetEcmaVM(); + auto ecmaVm = thread_->GetEcmaVM(); auto heap = ecmaVm->GetHeap(); auto objectFactory = ecmaVm->GetFactory(); auto verifier = Verification(heap); @@ -82,7 +82,7 @@ TEST_F(JSVerificationTest, DISABLED_IsHeapAddress) // issue #5368 TEST_F(JSVerificationTest, DISABLED_VerifyHeapObjects) // issue #5368 { - auto ecmaVm = thread->GetEcmaVM(); + auto ecmaVm = thread_->GetEcmaVM(); auto heap = const_cast(ecmaVm->GetHeap()); auto objectFactory = ecmaVm->GetFactory(); EXPECT_TRUE(heap->VerifyHeapObjects() == 0); // failcount is 0 @@ -90,12 +90,12 @@ TEST_F(JSVerificationTest, DISABLED_VerifyHeapObjects) // issue #5368 JSTaggedValue oldArray; auto verifier = Verification(heap); { - EcmaHandleScope handleScope(thread); + EcmaHandleScope handleScope(thread_); auto newArray = objectFactory->NewTaggedArray(1, JSTaggedValue::Undefined(), MemSpaceType::SEMI_SPACE); oldArray = (objectFactory->NewTaggedArray(1, JSTaggedValue::Undefined(), MemSpaceType::NON_MOVABLE)).GetTaggedValue(); - newArray->Set(thread, 0, oldArray); + newArray->Set(thread_, 0, oldArray); } ecmaVm->GetGC()->WaitForGC(GCTask(GCTaskCause::EXPLICIT_CAUSE)); EXPECT_TRUE(verifier.VerifyRoot() == 0); diff --git a/tests/runtime/common/large_object_test.cpp b/tests/runtime/common/large_object_test.cpp index 6ba931dcc58ffb16b48876486cbae8035ae09b6f..2900c2823bf9236dda35957151ddce670dcfb5a4 100644 --- a/tests/runtime/common/large_object_test.cpp +++ b/tests/runtime/common/large_object_test.cpp @@ -35,18 +35,18 @@ class LargeObjectTest : public testing::Test { public: void SetUp() override { - TestHelper::CreateEcmaVMWithScope(instance, thread, scope); - thread->GetEcmaVM()->GetFactory()->SetTriggerGc(false); + TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); + thread_->GetEcmaVM()->GetFactory()->SetTriggerGc(false); } void TearDown() override { - TestHelper::DestroyEcmaVMWithScope(instance, scope); + TestHelper::DestroyEcmaVMWithScope(instance_, scope_); } - JSThread *thread; - PandaVM *instance {nullptr}; - ecmascript::EcmaHandleScope *scope {nullptr}; + JSThread *thread_; + PandaVM *instance_ {nullptr}; + ecmascript::EcmaHandleScope *scope_ {nullptr}; }; #if !defined(NDEBUG) @@ -74,12 +74,12 @@ static TaggedArray *LargeArrayTestCreate(JSThread *thread) TEST_F(LargeObjectTest, LargeArrayKeep) { #if !defined(NDEBUG) - TaggedArray *array = LargeArrayTestCreate(thread); + TaggedArray *array = LargeArrayTestCreate(thread_); EXPECT_TRUE(array != nullptr); - JSHandle arrayHandle(thread, array); - JSHandle newObj(thread, JSObjectTestCreate(thread)); - arrayHandle->Set(thread, 0, newObj.GetTaggedValue()); - auto ecmaVm = thread->GetEcmaVM(); + JSHandle arrayHandle(thread_, array); + JSHandle newObj(thread_, JSObjectTestCreate(thread_)); + arrayHandle->Set(thread_, 0, newObj.GetTaggedValue()); + auto ecmaVm = thread_->GetEcmaVM(); EXPECT_EQ(*arrayHandle, reinterpret_cast(array)); ecmaVm->GetGC()->WaitForGCInManaged(GCTask(GCTaskCause::EXPLICIT_CAUSE)); // Trigger GC. ecmaVm->GetGC()->WaitForGCInManaged(GCTask(GCTaskCause::EXPLICIT_CAUSE)); // Trigger GC. @@ -91,15 +91,15 @@ TEST_F(LargeObjectTest, LargeArrayKeep) TEST_F(LargeObjectTest, DISABLED_MultipleArrays) // issue #5368 { #if !defined(NDEBUG) - auto ecmaVm = thread->GetEcmaVM(); + auto ecmaVm = thread_->GetEcmaVM(); auto heap = ecmaVm->GetHeap(); const HugeObjectSpace *space = heap->GetHugeObjectSpace(); - JSHandle array1(thread, LargeArrayTestCreate(thread)); + JSHandle array1(thread_, LargeArrayTestCreate(thread_)); { DISALLOW_GARBAGE_COLLECTION; - [[maybe_unused]] TaggedArray *array2 = LargeArrayTestCreate(thread); + [[maybe_unused]] TaggedArray *array2 = LargeArrayTestCreate(thread_); } - JSHandle array3(thread, LargeArrayTestCreate(thread)); + JSHandle array3(thread_, LargeArrayTestCreate(thread_)); Region *firstPage = space->GetRegionList().GetFirst(); Region *secondPage = firstPage->GetNext(); diff --git a/tests/runtime/common/lexical_env_test.cpp b/tests/runtime/common/lexical_env_test.cpp index 520599a7466d533647ca42d008f537d8b3513d9b..7d2f28f15feb98fe6cbbdd1d6af9c55ddaba6810 100644 --- a/tests/runtime/common/lexical_env_test.cpp +++ b/tests/runtime/common/lexical_env_test.cpp @@ -26,22 +26,22 @@ class LexicalEnvTest : public testing::Test { public: void SetUp() override { - TestHelper::CreateEcmaVMWithScope(instance, thread, scope); + TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); } void TearDown() override { - TestHelper::DestroyEcmaVMWithScope(instance, scope); + TestHelper::DestroyEcmaVMWithScope(instance_, scope_); } - PandaVM *instance {nullptr}; - ecmascript::EcmaHandleScope *scope {nullptr}; - JSThread *thread; + PandaVM *instance_ {nullptr}; + ecmascript::EcmaHandleScope *scope_ {nullptr}; + JSThread *thread_; }; TEST_F(LexicalEnvTest, LexicalEnv_Create) { - JSHandle lexicalEnv = thread->GetEcmaVM()->GetFactory()->NewLexicalEnv(0); + JSHandle lexicalEnv = thread_->GetEcmaVM()->GetFactory()->NewLexicalEnv(0); EXPECT_TRUE(lexicalEnv.GetTaggedValue().IsObject()); } } // namespace panda::test diff --git a/tests/runtime/common/linked_hash_table_test.cpp b/tests/runtime/common/linked_hash_table_test.cpp index 5ca6f2dd97ef7760f11e5d8cb99522a27f5c7478..ed5eb20abf7fe54ee8be951d681f3edaafc6e829 100644 --- a/tests/runtime/common/linked_hash_table_test.cpp +++ b/tests/runtime/common/linked_hash_table_test.cpp @@ -43,21 +43,21 @@ public: void SetUp() override { - TestHelper::CreateEcmaVMWithScope(instance, thread, scope); + TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); } void TearDown() override { - TestHelper::DestroyEcmaVMWithScope(instance, scope); + TestHelper::DestroyEcmaVMWithScope(instance_, scope_); } - PandaVM *instance {nullptr}; - EcmaHandleScope *scope {nullptr}; - JSThread *thread {nullptr}; + PandaVM *instance_ {nullptr}; + EcmaHandleScope *scope_ {nullptr}; + JSThread *thread_ {nullptr}; JSHandle GetGlobalEnv() { - EcmaVM *ecma = thread->GetEcmaVM(); + EcmaVM *ecma = thread_->GetEcmaVM(); return ecma->GetGlobalEnv(); } }; @@ -65,23 +65,23 @@ public: TEST_F(LinkedHashTableTest, MapCreate) { int numOfElement = 64; - JSHandle dict = LinkedHashMap::Create(thread, numOfElement); + JSHandle dict = LinkedHashMap::Create(thread_, numOfElement); EXPECT_TRUE(*dict != nullptr); } TEST_F(LinkedHashTableTest, SetCreate) { int numOfElement = 64; - JSHandle set = LinkedHashSet::Create(thread, numOfElement); + JSHandle set = LinkedHashSet::Create(thread_, numOfElement); EXPECT_TRUE(*set != nullptr); } TEST_F(LinkedHashTableTest, addKeyAndValue) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); // mock object needed in test int numOfElement = 64; - JSHandle dictHandle = LinkedHashMap::Create(thread, numOfElement); + JSHandle dictHandle = LinkedHashMap::Create(thread_, numOfElement); EXPECT_TRUE(*dictHandle != nullptr); JSHandle objFun = GetGlobalEnv()->GetObjectFunction(); @@ -96,7 +96,7 @@ TEST_F(LinkedHashTableTest, addKeyAndValue) JSHandle value2(factory->NewJSObjectByConstructor(JSHandle(objFun), objFun)); // test set() - dictHandle = LinkedHashMap::Set(thread, dictHandle, key1, value1); + dictHandle = LinkedHashMap::Set(thread_, dictHandle, key1, value1); EXPECT_EQ(dictHandle->NumberOfElements(), 1); // test find() @@ -105,15 +105,15 @@ TEST_F(LinkedHashTableTest, addKeyAndValue) EXPECT_EQ(key1.GetTaggedValue(), dictHandle->GetKey(entry1)); EXPECT_EQ(value1.GetTaggedValue(), dictHandle->GetValue(entry1)); - dictHandle = LinkedHashMap::Set(thread, dictHandle, key2, value2); + dictHandle = LinkedHashMap::Set(thread_, dictHandle, key2, value2); EXPECT_EQ(dictHandle->NumberOfElements(), 2); // test remove() - dictHandle = LinkedHashMap::Delete(thread, dictHandle, key1); + dictHandle = LinkedHashMap::Delete(thread_, dictHandle, key1); EXPECT_EQ(-1, dictHandle->FindElement(key1.GetTaggedValue(), hash)); EXPECT_EQ(dictHandle->NumberOfElements(), 1); - JSHandle undefinedKey(thread, JSTaggedValue::Undefined()); - dictHandle = LinkedHashMap::Set(thread, dictHandle, undefinedKey, value1); + JSHandle undefinedKey(thread_, JSTaggedValue::Undefined()); + dictHandle = LinkedHashMap::Set(thread_, dictHandle, undefinedKey, value1); int undefinedHash = LinkedHash::Hash(undefinedKey.GetTaggedValue()); int entry2 = dictHandle->FindElement(undefinedKey.GetTaggedValue(), undefinedHash); EXPECT_EQ(value1.GetTaggedValue(), dictHandle->GetValue(entry2)); @@ -121,10 +121,10 @@ TEST_F(LinkedHashTableTest, addKeyAndValue) TEST_F(LinkedHashTableTest, SetaddKeyAndValue) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); // mock object needed in test int numOfElement = 64; - JSHandle setHandle = LinkedHashSet::Create(thread, numOfElement); + JSHandle setHandle = LinkedHashSet::Create(thread_, numOfElement); EXPECT_TRUE(*setHandle != nullptr); JSHandle objFun = GetGlobalEnv()->GetObjectFunction(); @@ -139,31 +139,31 @@ TEST_F(LinkedHashTableTest, SetaddKeyAndValue) JSHandle value2(factory->NewJSObjectByConstructor(JSHandle(objFun), objFun)); // test set() - setHandle = LinkedHashSet::Add(thread, setHandle, key1); + setHandle = LinkedHashSet::Add(thread_, setHandle, key1); EXPECT_EQ(setHandle->NumberOfElements(), 1); // test has() int hash = LinkedHash::Hash(key1.GetTaggedValue()); EXPECT_TRUE(setHandle->Has(key1.GetTaggedValue(), hash)); - setHandle = LinkedHashSet::Add(thread, setHandle, key2); + setHandle = LinkedHashSet::Add(thread_, setHandle, key2); EXPECT_EQ(setHandle->NumberOfElements(), 2); // test remove() - setHandle = LinkedHashSet::Delete(thread, setHandle, key1); + setHandle = LinkedHashSet::Delete(thread_, setHandle, key1); EXPECT_EQ(-1, setHandle->FindElement(key1.GetTaggedValue(), hash)); EXPECT_EQ(setHandle->NumberOfElements(), 1); - JSHandle undefinedKey(thread, JSTaggedValue::Undefined()); - setHandle = LinkedHashSet::Add(thread, setHandle, undefinedKey); + JSHandle undefinedKey(thread_, JSTaggedValue::Undefined()); + setHandle = LinkedHashSet::Add(thread_, setHandle, undefinedKey); int undefinedHash = LinkedHash::Hash(undefinedKey.GetTaggedValue()); EXPECT_TRUE(setHandle->Has(undefinedKey.GetTaggedValue(), undefinedHash)); } TEST_F(LinkedHashTableTest, GrowCapacity) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); int numOfElement = 8; - JSHandle dictHandle = LinkedHashMap::Create(thread, numOfElement); + JSHandle dictHandle = LinkedHashMap::Create(thread_, numOfElement); EXPECT_TRUE(*dictHandle != nullptr); JSHandle objFun(GetGlobalEnv()->GetObjectFunction()); char keyArray[7] = "hello"; @@ -171,10 +171,10 @@ TEST_F(LinkedHashTableTest, GrowCapacity) keyArray[5] = '1' + i; keyArray[6] = 0; JSHandle key(factory->NewFromCanBeCompressString(keyArray)); - JSHandle value(thread, JSTaggedValue(i)); + JSHandle value(thread_, JSTaggedValue(i)); // test insert() - dictHandle = LinkedHashMap::Set(thread, dictHandle, key, value); + dictHandle = LinkedHashMap::Set(thread_, dictHandle, key, value); int hash = LinkedHash::Hash(key.GetTaggedValue()); EXPECT_EQ(i, dictHandle->FindElement(key.GetTaggedValue(), hash)); } @@ -194,9 +194,9 @@ TEST_F(LinkedHashTableTest, GrowCapacity) TEST_F(LinkedHashTableTest, SetGrowCapacity) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); int numOfElement = 8; - JSHandle setHandle = LinkedHashSet::Create(thread, numOfElement); + JSHandle setHandle = LinkedHashSet::Create(thread_, numOfElement); EXPECT_TRUE(*setHandle != nullptr); JSHandle objFun(GetGlobalEnv()->GetObjectFunction()); // create key and values @@ -208,7 +208,7 @@ TEST_F(LinkedHashTableTest, SetGrowCapacity) JSHandle key(stringKey); // test insert() - setHandle = LinkedHashSet::Add(thread, setHandle, key); + setHandle = LinkedHashSet::Add(thread_, setHandle, key); int hash = LinkedHash::Hash(key.GetTaggedValue()); EXPECT_EQ(i, setHandle->FindElement(key.GetTaggedValue(), hash)); } @@ -228,9 +228,9 @@ TEST_F(LinkedHashTableTest, SetGrowCapacity) TEST_F(LinkedHashTableTest, ShrinkCapacity) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); int numOfElement = 64; - JSHandle dictHandle = LinkedHashMap::Create(thread, numOfElement); + JSHandle dictHandle = LinkedHashMap::Create(thread_, numOfElement); EXPECT_TRUE(*dictHandle != nullptr); JSHandle objFun(GetGlobalEnv()->GetObjectFunction()); char keyArray[7] = "hello"; @@ -238,14 +238,14 @@ TEST_F(LinkedHashTableTest, ShrinkCapacity) keyArray[5] = '1' + i; keyArray[6] = 0; JSHandle key(factory->NewFromCanBeCompressString(keyArray)); - JSHandle value(thread, JSTaggedValue(i)); + JSHandle value(thread_, JSTaggedValue(i)); // test insert() - dictHandle = LinkedHashMap::Set(thread, dictHandle, key, value); + dictHandle = LinkedHashMap::Set(thread_, dictHandle, key, value); } keyArray[5] = '1' + 9; JSHandle key(factory->NewFromCanBeCompressString(keyArray)); - dictHandle = LinkedHashMap::Delete(thread, dictHandle, key); + dictHandle = LinkedHashMap::Delete(thread_, dictHandle, key); // test order for (int i = 0; i < 9; i++) { keyArray[5] = '1' + i; @@ -261,9 +261,9 @@ TEST_F(LinkedHashTableTest, ShrinkCapacity) TEST_F(LinkedHashTableTest, SetShrinkCapacity) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); int numOfElement = 64; - JSHandle setHandle = LinkedHashSet::Create(thread, numOfElement); + JSHandle setHandle = LinkedHashSet::Create(thread_, numOfElement); EXPECT_TRUE(*setHandle != nullptr); JSHandle objFun(GetGlobalEnv()->GetObjectFunction()); // create key and values @@ -274,11 +274,11 @@ TEST_F(LinkedHashTableTest, SetShrinkCapacity) JSHandle key(factory->NewFromCanBeCompressString(keyArray)); // test insert() - setHandle = LinkedHashSet::Add(thread, setHandle, key); + setHandle = LinkedHashSet::Add(thread_, setHandle, key); } keyArray[5] = '1' + 9; JSHandle keyHandle(factory->NewFromCanBeCompressString(keyArray)); - setHandle = LinkedHashSet::Delete(thread, setHandle, keyHandle); + setHandle = LinkedHashSet::Delete(thread_, setHandle, keyHandle); // test order for (int i = 0; i < 9; i++) { keyArray[5] = '1' + i; diff --git a/tests/runtime/common/name_dictionary_test.cpp b/tests/runtime/common/name_dictionary_test.cpp index 9a9de14704213a3157a5972dd648e7959692b3b8..8e507509d63fd9f70580ab4d5ac9afd44cfc4ad1 100644 --- a/tests/runtime/common/name_dictionary_test.cpp +++ b/tests/runtime/common/name_dictionary_test.cpp @@ -46,17 +46,17 @@ public: void SetUp() override { - TestHelper::CreateEcmaVMWithScope(instance, thread, scope); + TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); } void TearDown() override { - TestHelper::DestroyEcmaVMWithScope(instance, scope); + TestHelper::DestroyEcmaVMWithScope(instance_, scope_); } - PandaVM *instance {nullptr}; - EcmaHandleScope *scope {nullptr}; - JSThread *thread {nullptr}; + PandaVM *instance_ {nullptr}; + EcmaHandleScope *scope_ {nullptr}; + JSThread *thread_ {nullptr}; }; static JSHandle GetGlobalEnv(JSThread *thread) @@ -68,7 +68,7 @@ static JSHandle GetGlobalEnv(JSThread *thread) TEST_F(NameDictionaryTest, createDictionary) { int numOfElement = 64; - JSHandle dict = NameDictionary::Create(thread, numOfElement); + JSHandle dict = NameDictionary::Create(thread_, numOfElement); EXPECT_TRUE(*dict != nullptr); } @@ -76,34 +76,34 @@ TEST_F(NameDictionaryTest, addKeyAndValue) { // mock object needed in test int numOfElement = 64; - JSHandle dictJShandle(NameDictionary::Create(thread, numOfElement)); + JSHandle dictJShandle(NameDictionary::Create(thread_, numOfElement)); EXPECT_TRUE(*dictJShandle != nullptr); JSMutableHandle dictHandle(dictJShandle); - JSHandle objFun = GetGlobalEnv(thread)->GetObjectFunction(); + JSHandle objFun = GetGlobalEnv(thread_)->GetObjectFunction(); // create key and values JSHandle jsObject = - thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(objFun), objFun); + thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(objFun), objFun); EXPECT_TRUE(*jsObject != nullptr); char keyArray[] = "hello"; - JSHandle stringKey1 = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(keyArray); + JSHandle stringKey1 = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(keyArray); JSHandle key1(stringKey1); JSHandle taggedkey1(stringKey1); JSHandle value1( - thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(objFun), objFun)); + thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(objFun), objFun)); PropertyAttributes metaData1; char key2Array[] = "hello2"; - JSHandle stringKey2 = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(key2Array); + JSHandle stringKey2 = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(key2Array); JSHandle key2(stringKey2); JSHandle taggedkey2(stringKey2); JSHandle value2( - thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(objFun), objFun)); + thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(objFun), objFun)); PropertyAttributes metaData2; // test insert() - JSHandle dict(NameDictionary::PutIfAbsent(thread, dictHandle, key1, value1, metaData1)); + JSHandle dict(NameDictionary::PutIfAbsent(thread_, dictHandle, key1, value1, metaData1)); dictHandle.Update(dict.GetTaggedValue()); EXPECT_EQ(dict->EntriesCount(), 1); @@ -112,10 +112,10 @@ TEST_F(NameDictionaryTest, addKeyAndValue) EXPECT_EQ(key1.GetTaggedValue(), JSTaggedValue(dict->GetKey(entry1).GetRawData())); EXPECT_EQ(value1.GetTaggedValue(), JSTaggedValue(dict->GetValue(entry1).GetRawData())); - JSHandle dict2(NameDictionary::PutIfAbsent(thread, dictHandle, key2, value2, metaData2)); + JSHandle dict2(NameDictionary::PutIfAbsent(thread_, dictHandle, key2, value2, metaData2)); EXPECT_EQ(dict2->EntriesCount(), 2); // test remove() - dict = NameDictionary::Remove(thread, dictHandle, entry1); + dict = NameDictionary::Remove(thread_, dictHandle, entry1); EXPECT_EQ(-1, dict->FindEntry(key1.GetTaggedValue())); EXPECT_EQ(dict->EntriesCount(), 1); } @@ -123,12 +123,12 @@ TEST_F(NameDictionaryTest, addKeyAndValue) TEST_F(NameDictionaryTest, GrowCapacity) { int numOfElement = 8; - JSHandle dictHandle(NameDictionary::Create(thread, numOfElement)); + JSHandle dictHandle(NameDictionary::Create(thread_, numOfElement)); EXPECT_TRUE(*dictHandle != nullptr); - JSHandle objFun = GetGlobalEnv(thread)->GetObjectFunction(); + JSHandle objFun = GetGlobalEnv(thread_)->GetObjectFunction(); // create key and values JSHandle jsObject = - thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(objFun), objFun); + thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(objFun), objFun); EXPECT_TRUE(*jsObject != nullptr); char keyArray[7] = "hello"; for (int i = 0; i < 9; i++) { @@ -136,15 +136,15 @@ TEST_F(NameDictionaryTest, GrowCapacity) keyArray[5] = '1' + i; keyArray[6] = 0; - JSHandle stringKey = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(keyArray); + JSHandle stringKey = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(keyArray); ecmascript::JSHandle key(stringKey); JSHandle keyHandle(key); - ecmascript::JSHandle value(thread, JSTaggedValue(i)); + ecmascript::JSHandle value(thread_, JSTaggedValue(i)); JSHandle valueHandle(value); PropertyAttributes metaData; // test insert() - dictHandle = NameDictionary::PutIfAbsent(thread, tempHandle, keyHandle, valueHandle, metaData); + dictHandle = NameDictionary::PutIfAbsent(thread_, tempHandle, keyHandle, valueHandle, metaData); } EXPECT_EQ(dictHandle->EntriesCount(), 9); EXPECT_EQ(dictHandle->Size(), 16); @@ -153,38 +153,38 @@ TEST_F(NameDictionaryTest, GrowCapacity) TEST_F(NameDictionaryTest, ShrinkCapacity) { int numOfElement = 64; - JSMutableHandle dictHandle(NameDictionary::Create(thread, numOfElement)); + JSMutableHandle dictHandle(NameDictionary::Create(thread_, numOfElement)); EXPECT_TRUE(*dictHandle != nullptr); - JSHandle objFun = GetGlobalEnv(thread)->GetObjectFunction(); + JSHandle objFun = GetGlobalEnv(thread_)->GetObjectFunction(); // create key and values JSHandle jsObject = - thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(objFun), objFun); + thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(objFun), objFun); EXPECT_TRUE(*jsObject != nullptr); uint8_t keyArray[7] = "hello"; - auto stringTable = thread->GetEcmaVM()->GetEcmaStringTable(); + auto stringTable = thread_->GetEcmaVM()->GetEcmaStringTable(); for (int i = 0; i < 10; i++) { keyArray[5] = '0' + i; keyArray[6] = 0; - JSHandle key(thread, stringTable->GetOrInternString(keyArray, utf::Mutf8Size(keyArray), true)); - JSHandle value(thread, JSTaggedValue(i)); + JSHandle key(thread_, stringTable->GetOrInternString(keyArray, utf::Mutf8Size(keyArray), true)); + JSHandle value(thread_, JSTaggedValue(i)); PropertyAttributes metaData; // test insert() - JSHandle newDict = NameDictionary::PutIfAbsent(thread, dictHandle, key, value, metaData); + JSHandle newDict = NameDictionary::PutIfAbsent(thread_, dictHandle, key, value, metaData); dictHandle.Update(newDict.GetTaggedValue()); } keyArray[5] = '2'; keyArray[6] = 0; - JSHandle arrayHandle(thread, + JSHandle arrayHandle(thread_, stringTable->GetOrInternString(keyArray, utf::Mutf8Size(keyArray), true)); int entry = dictHandle->FindEntry(arrayHandle.GetTaggedValue()); EXPECT_NE(entry, -1); - JSHandle newDict1 = NameDictionary::Remove(thread, dictHandle, entry); + JSHandle newDict1 = NameDictionary::Remove(thread_, dictHandle, entry); dictHandle.Update(newDict1.GetTaggedValue()); EXPECT_EQ(dictHandle->EntriesCount(), 9); EXPECT_EQ(dictHandle->Size(), 16); diff --git a/tests/runtime/common/native_pointer_test.cpp b/tests/runtime/common/native_pointer_test.cpp index 2debf37c98c18092560e6af79ddd3954f45ef6b3..1c0a49e1e09091b1c0471cbbadb565298c6b399f 100644 --- a/tests/runtime/common/native_pointer_test.cpp +++ b/tests/runtime/common/native_pointer_test.cpp @@ -41,33 +41,33 @@ public: void SetUp() override { - TestHelper::CreateEcmaVMWithScope(instance, thread, scope); + TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); } void TearDown() override { - TestHelper::DestroyEcmaVMWithScope(instance, scope); + TestHelper::DestroyEcmaVMWithScope(instance_, scope_); } - PandaVM *instance {nullptr}; - ecmascript::EcmaHandleScope *scope {nullptr}; - JSThread *thread {nullptr}; + PandaVM *instance_ {nullptr}; + ecmascript::EcmaHandleScope *scope_ {nullptr}; + JSThread *thread_ {nullptr}; }; TEST_F(NativePointerTest, Print) { // mock object needed in test char array[] = "Hello World!"; - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle env = thread_->GetEcmaVM()->GetGlobalEnv(); JSHandle str = factory->NewFromCanBeCompressString(array); EXPECT_TRUE(*str != nullptr); JSHandle jsFunction = factory->NewJSFunction(env); EXPECT_TRUE(*jsFunction != nullptr); - JSMethod *target = thread->GetEcmaVM()->GetMethodForNativeFunction(nullptr); - jsFunction->SetCallTarget(thread, target); + JSMethod *target = thread_->GetEcmaVM()->GetMethodForNativeFunction(nullptr); + jsFunction->SetCallTarget(thread_, target); // run cpp methed 'Print' ASSERT_EQ(target, jsFunction->GetCallTarget()); diff --git a/tests/runtime/common/object_factory_test.cpp b/tests/runtime/common/object_factory_test.cpp index b23562aee22408f057b9837ed12b51fbf9aa9089..e2d0d9b3210bd77f3e6f9c08669bf145ec186b6e 100644 --- a/tests/runtime/common/object_factory_test.cpp +++ b/tests/runtime/common/object_factory_test.cpp @@ -46,17 +46,17 @@ public: void SetUp() override { - TestHelper::CreateEcmaVMWithScope(instance, thread, scope); + TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); } void TearDown() override { - TestHelper::DestroyEcmaVMWithScope(instance, scope); + TestHelper::DestroyEcmaVMWithScope(instance_, scope_); } - PandaVM *instance {nullptr}; - ecmascript::EcmaHandleScope *scope {nullptr}; - JSThread *thread {nullptr}; + PandaVM *instance_ {nullptr}; + ecmascript::EcmaHandleScope *scope_ {nullptr}; + JSThread *thread_ {nullptr}; }; JSHandle GetGlobal(JSThread *thread) @@ -66,50 +66,50 @@ JSHandle GetGlobal(JSThread *thread) TEST_F(ObjectFactoryTest, DISABLED_NewJSObjectByConstructor) // TODO(vpukhov) { - thread->GetEcmaVM()->SetEnableForceGC(false); - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - JSHandle objFun = GetGlobal(thread)->GetObjectFunction(); + thread_->GetEcmaVM()->SetEnableForceGC(false); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle objFun = GetGlobal(thread_)->GetObjectFunction(); // check mem alloc JSHandle newObj = factory->NewJSObjectByConstructor(JSHandle(objFun), objFun); - JSHandle newObjCls(thread, newObj->GetJSHClass()); + JSHandle newObjCls(thread_, newObj->GetJSHClass()); EXPECT_TRUE(*newObj != nullptr); EXPECT_TRUE(*newObjCls != nullptr); // check feild - EXPECT_EQ(newObj->GetProperties(), GetGlobal(thread)->GetEmptyArray().GetTaggedValue()); - EXPECT_EQ(newObj->GetElements(), GetGlobal(thread)->GetEmptyArray().GetTaggedValue()); + EXPECT_EQ(newObj->GetProperties(), GetGlobal(thread_)->GetEmptyArray().GetTaggedValue()); + EXPECT_EQ(newObj->GetElements(), GetGlobal(thread_)->GetEmptyArray().GetTaggedValue()); EXPECT_TRUE(JSTaggedValue(*newObj).IsECMAObject()); // check jshclass JSHClass *cls = *newObjCls; EXPECT_TRUE(cls->GetObjectSize() == JSObject::SIZE + JSHClass::DEFAULT_CAPACITY_OF_IN_OBJECTS * JSTaggedValue::TaggedTypeSize()); - EXPECT_TRUE(cls->GetPrototype() == GetGlobal(thread)->GetObjectFunctionPrototype().GetTaggedValue()); + EXPECT_TRUE(cls->GetPrototype() == GetGlobal(thread_)->GetObjectFunctionPrototype().GetTaggedValue()); EXPECT_TRUE(cls->GetObjectType() == JSType::JS_OBJECT); // check gc handle update auto *prototype = cls->GetPrototype().GetTaggedObject(); - thread->GetEcmaVM()->CollectGarbage(TriggerGCType::COMPRESS_FULL_GC); + thread_->GetEcmaVM()->CollectGarbage(TriggerGCType::COMPRESS_FULL_GC); // CompressGC not the same EXPECT_TRUE(prototype != newObjCls->GetPrototype().GetTaggedObject()); - thread->GetEcmaVM()->SetEnableForceGC(true); + thread_->GetEcmaVM()->SetEnableForceGC(true); } TEST_F(ObjectFactoryTest, NewJSFunction) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); + JSHandle env = thread_->GetEcmaVM()->GetGlobalEnv(); // check mem alloc JSHandle newFun = factory->NewJSFunction(env); - JSHandle newFunCls(thread, newFun->GetJSHClass()); + JSHandle newFunCls(thread_, newFun->GetJSHClass()); EXPECT_TRUE(*newFun != nullptr); EXPECT_TRUE(*newFunCls != nullptr); // check feild - EXPECT_EQ(newFun->GetProperties(), GetGlobal(thread)->GetEmptyArray().GetTaggedValue()); - EXPECT_EQ(newFun->GetElements(), GetGlobal(thread)->GetEmptyArray().GetTaggedValue()); + EXPECT_EQ(newFun->GetProperties(), GetGlobal(thread_)->GetEmptyArray().GetTaggedValue()); + EXPECT_EQ(newFun->GetElements(), GetGlobal(thread_)->GetEmptyArray().GetTaggedValue()); EXPECT_EQ(newFun->GetProtoOrDynClass(), JSTaggedValue::Hole()); EXPECT_EQ(newFun->GetHomeObject(), JSTaggedValue::Undefined()); EXPECT_TRUE(JSTaggedValue(*newFun).IsJSFunction()); @@ -118,7 +118,7 @@ TEST_F(ObjectFactoryTest, NewJSFunction) JSHClass *cls = *newFunCls; EXPECT_TRUE(cls->GetObjectSize() == JSFunction::SIZE + JSHClass::DEFAULT_CAPACITY_OF_IN_OBJECTS * JSTaggedValue::TaggedTypeSize()); - EXPECT_TRUE(cls->GetPrototype() == GetGlobal(thread)->GetFunctionPrototype().GetTaggedValue()); + EXPECT_TRUE(cls->GetPrototype() == GetGlobal(thread_)->GetFunctionPrototype().GetTaggedValue()); EXPECT_TRUE(cls->GetObjectType() == JSType::JS_FUNCTION); EXPECT_TRUE(cls->IsCallable()); EXPECT_TRUE(cls->IsExtensible()); @@ -127,32 +127,32 @@ TEST_F(ObjectFactoryTest, NewJSFunction) TEST_F(ObjectFactoryTest, NewJSBoundFunction) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); // test prepare - JSHandle funFun(GetGlobal(thread)->GetObjectFunction()); - JSHandle bound(thread, GetGlobal(thread)->GetObjectFunctionPrototype().GetTaggedValue()); - const JSHandle array(GetGlobal(thread)->GetEmptyArray()); + JSHandle funFun(GetGlobal(thread_)->GetObjectFunction()); + JSHandle bound(thread_, GetGlobal(thread_)->GetObjectFunctionPrototype().GetTaggedValue()); + const JSHandle array(GetGlobal(thread_)->GetEmptyArray()); // check mem alloc JSHandle targetFunc(funFun); JSHandle newBoundFun = factory->NewJSBoundFunction(targetFunc, bound, array); - JSHandle newBoundFunCls(thread, newBoundFun->GetJSHClass()); + JSHandle newBoundFunCls(thread_, newBoundFun->GetJSHClass()); EXPECT_TRUE(*newBoundFun != nullptr); EXPECT_TRUE(*newBoundFunCls != nullptr); } TEST_F(ObjectFactoryTest, NewJSPrimitiveRef) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); // test prepare - JSHandle numberFun(GetGlobal(thread)->GetNumberFunction()); - JSHandle primitive(thread, JSTaggedValue(1)); + JSHandle numberFun(GetGlobal(thread_)->GetNumberFunction()); + JSHandle primitive(thread_, JSTaggedValue(1)); // check mem alloc JSHandle newPrimitive = factory->NewJSPrimitiveRef(numberFun, primitive); - JSHandle newPrimitiveCls(thread, newPrimitive->GetJSHClass()); + JSHandle newPrimitiveCls(thread_, newPrimitive->GetJSHClass()); EXPECT_TRUE(*newPrimitive != nullptr); EXPECT_TRUE(*newPrimitiveCls != nullptr); @@ -161,22 +161,22 @@ TEST_F(ObjectFactoryTest, NewJSPrimitiveRef) TEST_F(ObjectFactoryTest, NewLexicalEnv) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); // check mem alloc JSHandle newLexicalEnv = factory->NewLexicalEnv(0); - JSHandle newLexicalEnvCls(thread, newLexicalEnv->GetClass()); + JSHandle newLexicalEnvCls(thread_, newLexicalEnv->GetClass()); EXPECT_TRUE(*newLexicalEnv != nullptr); EXPECT_TRUE(*newLexicalEnvCls != nullptr); } TEST_F(ObjectFactoryTest, NewJSArray) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); // check mem alloc JSHandle newJSAarray = factory->NewJSArray(); - JSHandle newJSArrayCls(thread, newJSAarray->GetJSHClass()); + JSHandle newJSArrayCls(thread_, newJSAarray->GetJSHClass()); EXPECT_TRUE(*newJSAarray != nullptr); EXPECT_TRUE(*newJSArrayCls != nullptr); } diff --git a/tests/runtime/common/separate_jsvm_test.cpp b/tests/runtime/common/separate_jsvm_test.cpp index 0b8aa369d1bd91a0a1bf159ec1e305698265dec3..83f6cf1a9d5e98e3146c94ef3768715d07a146f9 100644 --- a/tests/runtime/common/separate_jsvm_test.cpp +++ b/tests/runtime/common/separate_jsvm_test.cpp @@ -63,7 +63,7 @@ public: return ecma_vm; } - PandaVM *instance; + PandaVM *instance_; }; TEST_F(SepareteJSVMTest, CreateInstance) diff --git a/tests/runtime/common/symbol_table_test.cpp b/tests/runtime/common/symbol_table_test.cpp index a5505ad5a6ba513eeea7b2f2bd95b920e0ec47eb..be6972d4adeb1c08aecce62c9f3c7364b18c4ee1 100644 --- a/tests/runtime/common/symbol_table_test.cpp +++ b/tests/runtime/common/symbol_table_test.cpp @@ -37,16 +37,16 @@ public: void SetUp() override { - TestHelper::CreateEcmaVMWithScope(instance, thread, scope); + TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); } void TearDown() override { - TestHelper::DestroyEcmaVMWithScope(instance, scope); + TestHelper::DestroyEcmaVMWithScope(instance_, scope_); } - ecmascript::EcmaHandleScope *scope {nullptr}; - PandaVM *instance {nullptr}; - JSThread *thread {nullptr}; + ecmascript::EcmaHandleScope *scope_ {nullptr}; + PandaVM *instance_ {nullptr}; + JSThread *thread_ {nullptr}; }; TEST_F(SymbolTableTest, GetKeyIndex) @@ -82,7 +82,7 @@ TEST_F(SymbolTableTest, GetEntrySize) */ TEST_F(SymbolTableTest, IsMatch) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); JSHandle symbolTableString = factory->NewFromCanBeCompressString("name"); JSTaggedValue symbolTableOther = symbolTableString.GetTaggedValue(); @@ -107,7 +107,7 @@ TEST_F(SymbolTableTest, IsMatch) */ TEST_F(SymbolTableTest, Hash_Utf8) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); // test obj is not string JSHandle jsObJect(factory->NewEmptyJSObject()); EXPECT_EQ(SymbolTable::Hash(jsObJect.GetTaggedValue()), JSSymbol::ComputeHash()); @@ -137,7 +137,7 @@ TEST_F(SymbolTableTest, Hash_Utf8) */ TEST_F(SymbolTableTest, Hash_Utf16) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); uint16_t utf16ArrayName1[] = {1, 2, 3}; uint32_t utf16ArrayNameLen1 = sizeof(utf16ArrayName1) / sizeof(utf16ArrayName1[0]); @@ -166,7 +166,7 @@ TEST_F(SymbolTableTest, Create) bool flag = EcmaString::GetCompressedStringsEnabled(); EXPECT_EQ(flag, true); - JSHandle symbolTable = SymbolTable::Create(thread, numberOfElements); + JSHandle symbolTable = SymbolTable::Create(thread_, numberOfElements); EXPECT_TRUE(*symbolTable != nullptr); } @@ -180,30 +180,30 @@ TEST_F(SymbolTableTest, Create) */ TEST_F(SymbolTableTest, ContainsKey) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); JSHandle symbolTableStringKey1 = factory->NewFromCanBeCompressString("key"); JSHandle symbolTableStringKey2 = factory->NewFromCanBeCompressString("key1"); JSHandle symbolTableStringKey3 = factory->NewFromCanBeCompressString("value"); int numberOfElements = 2; - JSHandle symbolTable = SymbolTable::Create(thread, numberOfElements); - EXPECT_EQ(symbolTable->ContainsKey(thread, symbolTableStringKey1.GetTaggedValue()), false); + JSHandle symbolTable = SymbolTable::Create(thread_, numberOfElements); + EXPECT_EQ(symbolTable->ContainsKey(thread_, symbolTableStringKey1.GetTaggedValue()), false); - symbolTable->SetKey(thread, 1, JSTaggedValue::Hole()); - EXPECT_EQ(symbolTable->ContainsKey(thread, symbolTableStringKey1.GetTaggedValue()), false); + symbolTable->SetKey(thread_, 1, JSTaggedValue::Hole()); + EXPECT_EQ(symbolTable->ContainsKey(thread_, symbolTableStringKey1.GetTaggedValue()), false); - symbolTable->SetKey(thread, 1, JSTaggedValue::Undefined()); - EXPECT_EQ(symbolTable->ContainsKey(thread, symbolTableStringKey1.GetTaggedValue()), false); + symbolTable->SetKey(thread_, 1, JSTaggedValue::Undefined()); + EXPECT_EQ(symbolTable->ContainsKey(thread_, symbolTableStringKey1.GetTaggedValue()), false); - symbolTable->SetKey(thread, 1, symbolTableStringKey1.GetTaggedValue()); - EXPECT_EQ(symbolTable->ContainsKey(thread, symbolTableStringKey1.GetTaggedValue()), true); + symbolTable->SetKey(thread_, 1, symbolTableStringKey1.GetTaggedValue()); + EXPECT_EQ(symbolTable->ContainsKey(thread_, symbolTableStringKey1.GetTaggedValue()), true); // the key value has numbers - symbolTable->SetKey(thread, 1, symbolTableStringKey2.GetTaggedValue()); - EXPECT_EQ(symbolTable->ContainsKey(thread, symbolTableStringKey2.GetTaggedValue()), false); + symbolTable->SetKey(thread_, 1, symbolTableStringKey2.GetTaggedValue()); + EXPECT_EQ(symbolTable->ContainsKey(thread_, symbolTableStringKey2.GetTaggedValue()), false); - symbolTable->SetKey(thread, 1, symbolTableStringKey3.GetTaggedValue()); - EXPECT_EQ(symbolTable->ContainsKey(thread, symbolTableStringKey3.GetTaggedValue()), true); + symbolTable->SetKey(thread_, 1, symbolTableStringKey3.GetTaggedValue()); + EXPECT_EQ(symbolTable->ContainsKey(thread_, symbolTableStringKey3.GetTaggedValue()), true); } /* @@ -216,19 +216,19 @@ TEST_F(SymbolTableTest, ContainsKey) */ TEST_F(SymbolTableTest, GetSymbol) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); int numberOfElements = 2; JSHandle symbolTableStringKey = factory->NewFromCanBeCompressString("key"); - JSHandle symbolTable = SymbolTable::Create(thread, numberOfElements); + JSHandle symbolTable = SymbolTable::Create(thread_, numberOfElements); - symbolTable->SetKey(thread, 1, symbolTableStringKey.GetTaggedValue()); + symbolTable->SetKey(thread_, 1, symbolTableStringKey.GetTaggedValue()); EXPECT_EQ(symbolTable->GetSymbol(symbolTableStringKey.GetTaggedValue()), JSTaggedValue::Undefined()); - symbolTable->SetValue(thread, 0, JSTaggedValue(1)); + symbolTable->SetValue(thread_, 0, JSTaggedValue(1)); EXPECT_EQ(symbolTable->GetSymbol(symbolTableStringKey.GetTaggedValue()), JSTaggedValue::Undefined()); - symbolTable->SetValue(thread, 1, JSTaggedValue(1)); + symbolTable->SetValue(thread_, 1, JSTaggedValue(1)); EXPECT_EQ(symbolTable->GetSymbol(symbolTableStringKey.GetTaggedValue()).GetInt(), 1); } @@ -244,27 +244,27 @@ TEST_F(SymbolTableTest, GetSymbol) */ TEST_F(SymbolTableTest, FindSymbol) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); JSHandle symbolTableStringKey1(factory->NewFromCanBeCompressString("key")); JSHandle symbolTableStringKey2(factory->NewFromCanBeCompressString("key1")); int numberOfElements = 2; JSHandle handleSymbol = factory->NewJSSymbol(); - JSHandle symbolTable = SymbolTable::Create(thread, numberOfElements); + JSHandle symbolTable = SymbolTable::Create(thread_, numberOfElements); - JSTaggedValue resultValue1 = symbolTable->FindSymbol(thread, handleSymbol.GetTaggedValue()); + JSTaggedValue resultValue1 = symbolTable->FindSymbol(thread_, handleSymbol.GetTaggedValue()); EXPECT_EQ(JSTaggedValue::SameValue(resultValue1, JSTaggedValue::Undefined()), true); - handleSymbol->SetDescription(thread, symbolTableStringKey1.GetTaggedValue()); - JSTaggedValue resultValue2 = symbolTable->FindSymbol(thread, handleSymbol.GetTaggedValue()); + handleSymbol->SetDescription(thread_, symbolTableStringKey1.GetTaggedValue()); + JSTaggedValue resultValue2 = symbolTable->FindSymbol(thread_, handleSymbol.GetTaggedValue()); EXPECT_EQ(JSTaggedValue::SameValue(resultValue2, JSTaggedValue::Undefined()), true); - symbolTable->SetKey(thread, 1, symbolTableStringKey1.GetTaggedValue()); - JSTaggedValue resultValue3 = symbolTable->FindSymbol(thread, handleSymbol.GetTaggedValue()); + symbolTable->SetKey(thread_, 1, symbolTableStringKey1.GetTaggedValue()); + JSTaggedValue resultValue3 = symbolTable->FindSymbol(thread_, handleSymbol.GetTaggedValue()); EXPECT_EQ(resultValue3.GetRawData() == symbolTableStringKey1.GetTaggedValue().GetRawData(), true); - symbolTable->SetKey(thread, 1, symbolTableStringKey2.GetTaggedValue()); - JSTaggedValue resultValue4 = symbolTable->FindSymbol(thread, handleSymbol.GetTaggedValue()); + symbolTable->SetKey(thread_, 1, symbolTableStringKey2.GetTaggedValue()); + JSTaggedValue resultValue4 = symbolTable->FindSymbol(thread_, handleSymbol.GetTaggedValue()); EXPECT_EQ(JSTaggedValue::SameValue(resultValue4, JSTaggedValue::Undefined()), true); } } // namespace panda::test diff --git a/tests/runtime/common/tagged_value_test.cpp b/tests/runtime/common/tagged_value_test.cpp index cc658406dda73b12ba616014e35cd247e6cd6118..1c9afc2a087de652d139ad071304cb57d5d7cdc2 100644 --- a/tests/runtime/common/tagged_value_test.cpp +++ b/tests/runtime/common/tagged_value_test.cpp @@ -38,17 +38,17 @@ class JSTaggedValueTest : public testing::Test { public: void SetUp() override { - TestHelper::CreateEcmaVMWithScope(instance, thread, scope); + TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); } void TearDown() override { - TestHelper::DestroyEcmaVMWithScope(instance, scope); + TestHelper::DestroyEcmaVMWithScope(instance_, scope_); } - PandaVM *instance {nullptr}; - ecmascript::EcmaHandleScope *scope {nullptr}; - JSThread *thread; + PandaVM *instance_ {nullptr}; + ecmascript::EcmaHandleScope *scope_ {nullptr}; + JSThread *thread_; }; TEST_F(JSTaggedValueTest, Double) @@ -125,31 +125,31 @@ TEST_F(JSTaggedValueTest, ToPrimitive) JSTaggedValue result; JSTaggedValue int_v(100); - result = JSTaggedValue::ToPrimitive(thread, JSHandle(thread, int_v)); + result = JSTaggedValue::ToPrimitive(thread_, JSHandle(thread_, int_v)); EXPECT_EQ(result.GetInt(), 100); JSTaggedValue double_v((double)100.0); - result = JSTaggedValue::ToPrimitive(thread, JSHandle(thread, double_v)); + result = JSTaggedValue::ToPrimitive(thread_, JSHandle(thread_, double_v)); EXPECT_EQ(result.GetDouble(), (double)100.0); JSTaggedValue undefined_v = JSTaggedValue::Undefined(); - result = JSTaggedValue::ToPrimitive(thread, JSHandle(thread, undefined_v)); + result = JSTaggedValue::ToPrimitive(thread_, JSHandle(thread_, undefined_v)); EXPECT_TRUE(result.IsUndefined()); JSTaggedValue hole_v = JSTaggedValue::Hole(); - result = JSTaggedValue::ToPrimitive(thread, JSHandle(thread, hole_v)); + result = JSTaggedValue::ToPrimitive(thread_, JSHandle(thread_, hole_v)); EXPECT_TRUE(result.IsHole()); JSTaggedValue null_v = JSTaggedValue::Null(); - result = JSTaggedValue::ToPrimitive(thread, JSHandle(thread, null_v)); + result = JSTaggedValue::ToPrimitive(thread_, JSHandle(thread_, null_v)); EXPECT_TRUE(result.IsNull()); JSTaggedValue false_v = JSTaggedValue::False(); - result = JSTaggedValue::ToPrimitive(thread, JSHandle(thread, false_v)); + result = JSTaggedValue::ToPrimitive(thread_, JSHandle(thread_, false_v)); EXPECT_TRUE(result.IsFalse()); JSTaggedValue true_v = JSTaggedValue::True(); - result = JSTaggedValue::ToPrimitive(thread, JSHandle(thread, true_v)); + result = JSTaggedValue::ToPrimitive(thread_, JSHandle(thread_, true_v)); EXPECT_TRUE(result.IsTrue()); } @@ -170,8 +170,8 @@ TEST_F(JSTaggedValueTest, ToBoolean) EXPECT_FALSE(JSTaggedValue::False().ToBoolean()); EXPECT_TRUE(JSTaggedValue::True().ToBoolean()); - EXPECT_FALSE(thread->GetEcmaVM()->GetFactory()->GetEmptyString().GetTaggedValue().ToBoolean()); - EXPECT_TRUE(thread->GetEcmaVM()->GetFactory()->NewFromString("test").GetTaggedValue().ToBoolean()); + EXPECT_FALSE(thread_->GetEcmaVM()->GetFactory()->GetEmptyString().GetTaggedValue().ToBoolean()); + EXPECT_TRUE(thread_->GetEcmaVM()->GetFactory()->NewFromString("test").GetTaggedValue().ToBoolean()); } TEST_F(JSTaggedValueTest, ToNumber) @@ -179,162 +179,162 @@ TEST_F(JSTaggedValueTest, ToNumber) JSTaggedNumber result; JSTaggedValue int_v(100); - result = JSTaggedValue::ToNumber(thread, JSHandle(thread, int_v)); + result = JSTaggedValue::ToNumber(thread_, JSHandle(thread_, int_v)); EXPECT_EQ(result.GetNumber(), 100); JSTaggedValue double_v((double)100.0); - result = JSTaggedValue::ToNumber(thread, JSHandle(thread, double_v)); + result = JSTaggedValue::ToNumber(thread_, JSHandle(thread_, double_v)); EXPECT_EQ(result.GetNumber(), (double)100.0); JSTaggedValue undefined_v = JSTaggedValue::Undefined(); - result = JSTaggedValue::ToNumber(thread, JSHandle(thread, undefined_v)); + result = JSTaggedValue::ToNumber(thread_, JSHandle(thread_, undefined_v)); EXPECT_TRUE(std::isnan(result.GetNumber())); JSTaggedValue hole_v = JSTaggedValue::Hole(); - result = JSTaggedValue::ToNumber(thread, JSHandle(thread, hole_v)); + result = JSTaggedValue::ToNumber(thread_, JSHandle(thread_, hole_v)); EXPECT_TRUE(std::isnan(result.GetNumber())); JSTaggedValue null_v = JSTaggedValue::Null(); - result = JSTaggedValue::ToNumber(thread, JSHandle(thread, null_v)); + result = JSTaggedValue::ToNumber(thread_, JSHandle(thread_, null_v)); EXPECT_EQ(result.GetNumber(), 0); JSTaggedValue false_v = JSTaggedValue::False(); - result = JSTaggedValue::ToNumber(thread, JSHandle(thread, false_v)); + result = JSTaggedValue::ToNumber(thread_, JSHandle(thread_, false_v)); EXPECT_EQ(result.GetNumber(), 0); JSTaggedValue true_v = JSTaggedValue::True(); - result = JSTaggedValue::ToNumber(thread, JSHandle(thread, true_v)); + result = JSTaggedValue::ToNumber(thread_, JSHandle(thread_, true_v)); EXPECT_EQ(result.GetNumber(), 1); - JSHandle string_v0(thread->GetEcmaVM()->GetFactory()->NewFromString(" 1234 ")); - result = JSTaggedValue::ToNumber(thread, string_v0); + JSHandle string_v0(thread_->GetEcmaVM()->GetFactory()->NewFromString(" 1234 ")); + result = JSTaggedValue::ToNumber(thread_, string_v0); EXPECT_EQ(result.GetNumber(), 1234); - JSHandle string_v1(thread->GetEcmaVM()->GetFactory()->NewFromString(" 0b1010 ")); - result = JSTaggedValue::ToNumber(thread, string_v1); + JSHandle string_v1(thread_->GetEcmaVM()->GetFactory()->NewFromString(" 0b1010 ")); + result = JSTaggedValue::ToNumber(thread_, string_v1); EXPECT_EQ(result.GetNumber(), 10); - JSHandle string_v2(thread->GetEcmaVM()->GetFactory()->NewFromString(" 0O11 ")); - result = JSTaggedValue::ToNumber(thread, string_v2); + JSHandle string_v2(thread_->GetEcmaVM()->GetFactory()->NewFromString(" 0O11 ")); + result = JSTaggedValue::ToNumber(thread_, string_v2); EXPECT_EQ(result.GetNumber(), 9); - JSHandle string_v3(thread->GetEcmaVM()->GetFactory()->NewFromString(" 0x2d ")); - result = JSTaggedValue::ToNumber(thread, string_v3); + JSHandle string_v3(thread_->GetEcmaVM()->GetFactory()->NewFromString(" 0x2d ")); + result = JSTaggedValue::ToNumber(thread_, string_v3); EXPECT_EQ(result.GetNumber(), 45); - JSHandle string_v4(thread->GetEcmaVM()->GetFactory()->NewFromString(" 0.000001 ")); - result = JSTaggedValue::ToNumber(thread, string_v4); + JSHandle string_v4(thread_->GetEcmaVM()->GetFactory()->NewFromString(" 0.000001 ")); + result = JSTaggedValue::ToNumber(thread_, string_v4); EXPECT_EQ(result.GetNumber(), 0.000001); - JSHandle string_v5(thread->GetEcmaVM()->GetFactory()->NewFromString(" 1.23 ")); - result = JSTaggedValue::ToNumber(thread, string_v5); + JSHandle string_v5(thread_->GetEcmaVM()->GetFactory()->NewFromString(" 1.23 ")); + result = JSTaggedValue::ToNumber(thread_, string_v5); EXPECT_EQ(result.GetNumber(), 1.23); - JSHandle string_v6(thread->GetEcmaVM()->GetFactory()->NewFromString(" -1.23e2 ")); - result = JSTaggedValue::ToNumber(thread, string_v6); + JSHandle string_v6(thread_->GetEcmaVM()->GetFactory()->NewFromString(" -1.23e2 ")); + result = JSTaggedValue::ToNumber(thread_, string_v6); EXPECT_EQ(result.GetNumber(), -123); - JSHandle string_v7(thread->GetEcmaVM()->GetFactory()->NewFromString(" -123e-2")); - result = JSTaggedValue::ToNumber(thread, string_v7); + JSHandle string_v7(thread_->GetEcmaVM()->GetFactory()->NewFromString(" -123e-2")); + result = JSTaggedValue::ToNumber(thread_, string_v7); EXPECT_EQ(result.GetNumber(), -1.23); - JSHandle string_v8(thread->GetEcmaVM()->GetFactory()->NewFromString(" Infinity ")); - result = JSTaggedValue::ToNumber(thread, string_v8); + JSHandle string_v8(thread_->GetEcmaVM()->GetFactory()->NewFromString(" Infinity ")); + result = JSTaggedValue::ToNumber(thread_, string_v8); EXPECT_TRUE(std::isinf(result.GetNumber())); - JSHandle string_v9(thread->GetEcmaVM()->GetFactory()->NewFromString("100e307")); - result = JSTaggedValue::ToNumber(thread, string_v9); + JSHandle string_v9(thread_->GetEcmaVM()->GetFactory()->NewFromString("100e307")); + result = JSTaggedValue::ToNumber(thread_, string_v9); EXPECT_TRUE(std::isinf(result.GetNumber())); - JSHandle string_v10(thread->GetEcmaVM()->GetFactory()->NewFromString(" .")); - result = JSTaggedValue::ToNumber(thread, string_v10); + JSHandle string_v10(thread_->GetEcmaVM()->GetFactory()->NewFromString(" .")); + result = JSTaggedValue::ToNumber(thread_, string_v10); EXPECT_TRUE(std::isnan(result.GetNumber())); - JSHandle string_v11(thread->GetEcmaVM()->GetFactory()->NewFromString("12e+")); - result = JSTaggedValue::ToNumber(thread, string_v11); + JSHandle string_v11(thread_->GetEcmaVM()->GetFactory()->NewFromString("12e+")); + result = JSTaggedValue::ToNumber(thread_, string_v11); EXPECT_TRUE(std::isnan(result.GetNumber())); - JSHandle string_v12(thread->GetEcmaVM()->GetFactory()->NewFromString(".e3")); - result = JSTaggedValue::ToNumber(thread, string_v12); + JSHandle string_v12(thread_->GetEcmaVM()->GetFactory()->NewFromString(".e3")); + result = JSTaggedValue::ToNumber(thread_, string_v12); EXPECT_TRUE(std::isnan(result.GetNumber())); - JSHandle string_v13(thread->GetEcmaVM()->GetFactory()->NewFromString("23eE")); - result = JSTaggedValue::ToNumber(thread, string_v13); + JSHandle string_v13(thread_->GetEcmaVM()->GetFactory()->NewFromString("23eE")); + result = JSTaggedValue::ToNumber(thread_, string_v13); EXPECT_TRUE(std::isnan(result.GetNumber())); - JSHandle string_v14(thread->GetEcmaVM()->GetFactory()->NewFromString("a")); - result = JSTaggedValue::ToNumber(thread, string_v14); + JSHandle string_v14(thread_->GetEcmaVM()->GetFactory()->NewFromString("a")); + result = JSTaggedValue::ToNumber(thread_, string_v14); EXPECT_TRUE(std::isnan(result.GetNumber())); - JSHandle string_v15(thread->GetEcmaVM()->GetFactory()->NewFromString("0o12e3")); - result = JSTaggedValue::ToNumber(thread, string_v15); + JSHandle string_v15(thread_->GetEcmaVM()->GetFactory()->NewFromString("0o12e3")); + result = JSTaggedValue::ToNumber(thread_, string_v15); EXPECT_TRUE(std::isnan(result.GetNumber())); - JSHandle string_v16(thread->GetEcmaVM()->GetFactory()->NewFromString("0x12.3")); - result = JSTaggedValue::ToNumber(thread, string_v16); + JSHandle string_v16(thread_->GetEcmaVM()->GetFactory()->NewFromString("0x12.3")); + result = JSTaggedValue::ToNumber(thread_, string_v16); EXPECT_TRUE(std::isnan(result.GetNumber())); - JSHandle string_v17(thread->GetEcmaVM()->GetFactory()->NewFromString(" 12.4.")); - result = JSTaggedValue::ToNumber(thread, string_v17); + JSHandle string_v17(thread_->GetEcmaVM()->GetFactory()->NewFromString(" 12.4.")); + result = JSTaggedValue::ToNumber(thread_, string_v17); EXPECT_TRUE(std::isnan(result.GetNumber())); - JSHandle string_v18(thread->GetEcmaVM()->GetFactory()->NewFromString("123test")); - result = JSTaggedValue::ToNumber(thread, string_v18); + JSHandle string_v18(thread_->GetEcmaVM()->GetFactory()->NewFromString("123test")); + result = JSTaggedValue::ToNumber(thread_, string_v18); EXPECT_TRUE(std::isnan(result.GetNumber())); - JSHandle string_v19(thread->GetEcmaVM()->GetFactory()->NewFromString("123test")); - result = JSTaggedValue::ToNumber(thread, string_v19); + JSHandle string_v19(thread_->GetEcmaVM()->GetFactory()->NewFromString("123test")); + result = JSTaggedValue::ToNumber(thread_, string_v19); EXPECT_TRUE(std::isnan(result.GetNumber())); - JSHandle string_v20(thread->GetEcmaVM()->GetFactory()->NewFromString(" 0b ")); - result = JSTaggedValue::ToNumber(thread, string_v20); + JSHandle string_v20(thread_->GetEcmaVM()->GetFactory()->NewFromString(" 0b ")); + result = JSTaggedValue::ToNumber(thread_, string_v20); EXPECT_TRUE(std::isnan(result.GetNumber())); - JSHandle string_v21(thread->GetEcmaVM()->GetFactory()->NewFromString(" 0b0000 ")); - result = JSTaggedValue::ToNumber(thread, string_v21); + JSHandle string_v21(thread_->GetEcmaVM()->GetFactory()->NewFromString(" 0b0000 ")); + result = JSTaggedValue::ToNumber(thread_, string_v21); EXPECT_EQ(result.GetNumber(), 0); - JSHandle string_v22(thread->GetEcmaVM()->GetFactory()->NewFromString(" 0o0000 ")); - result = JSTaggedValue::ToNumber(thread, string_v22); + JSHandle string_v22(thread_->GetEcmaVM()->GetFactory()->NewFromString(" 0o0000 ")); + result = JSTaggedValue::ToNumber(thread_, string_v22); EXPECT_EQ(result.GetNumber(), 0); - JSHandle string_v23(thread->GetEcmaVM()->GetFactory()->NewFromString(" 0X0000 ")); - result = JSTaggedValue::ToNumber(thread, string_v23); + JSHandle string_v23(thread_->GetEcmaVM()->GetFactory()->NewFromString(" 0X0000 ")); + result = JSTaggedValue::ToNumber(thread_, string_v23); EXPECT_EQ(result.GetNumber(), 0); - JSHandle string_v24(thread->GetEcmaVM()->GetFactory()->NewFromString(" 000.00000 ")); - result = JSTaggedValue::ToNumber(thread, string_v24); + JSHandle string_v24(thread_->GetEcmaVM()->GetFactory()->NewFromString(" 000.00000 ")); + result = JSTaggedValue::ToNumber(thread_, string_v24); EXPECT_EQ(result.GetNumber(), 0); - JSHandle string_v25(thread->GetEcmaVM()->GetFactory()->NewFromString("")); - result = JSTaggedValue::ToNumber(thread, string_v25); + JSHandle string_v25(thread_->GetEcmaVM()->GetFactory()->NewFromString("")); + result = JSTaggedValue::ToNumber(thread_, string_v25); EXPECT_EQ(result.GetNumber(), 0); - JSHandle string_v26(thread->GetEcmaVM()->GetFactory()->NewFromString(" ")); - result = JSTaggedValue::ToNumber(thread, string_v26); + JSHandle string_v26(thread_->GetEcmaVM()->GetFactory()->NewFromString(" ")); + result = JSTaggedValue::ToNumber(thread_, string_v26); EXPECT_EQ(result.GetNumber(), 0); - JSHandle string_v27(thread->GetEcmaVM()->GetFactory()->NewFromString("0")); - result = JSTaggedValue::ToNumber(thread, string_v27); + JSHandle string_v27(thread_->GetEcmaVM()->GetFactory()->NewFromString("0")); + result = JSTaggedValue::ToNumber(thread_, string_v27); EXPECT_EQ(result.GetNumber(), 0); - JSHandle string_v28(thread->GetEcmaVM()->GetFactory()->NewFromString(" 0 ")); - result = JSTaggedValue::ToNumber(thread, string_v28); + JSHandle string_v28(thread_->GetEcmaVM()->GetFactory()->NewFromString(" 0 ")); + result = JSTaggedValue::ToNumber(thread_, string_v28); EXPECT_EQ(result.GetNumber(), 0); - JSHandle string_v29(thread->GetEcmaVM()->GetFactory()->NewFromString("00000000")); - result = JSTaggedValue::ToNumber(thread, string_v29); + JSHandle string_v29(thread_->GetEcmaVM()->GetFactory()->NewFromString("00000000")); + result = JSTaggedValue::ToNumber(thread_, string_v29); EXPECT_EQ(result.GetNumber(), 0); - JSHandle string_v30(thread->GetEcmaVM()->GetFactory()->NewFromString(" 00000000 ")); - result = JSTaggedValue::ToNumber(thread, string_v30); + JSHandle string_v30(thread_->GetEcmaVM()->GetFactory()->NewFromString(" 00000000 ")); + result = JSTaggedValue::ToNumber(thread_, string_v30); EXPECT_EQ(result.GetNumber(), 0); - thread->ClearException(); - JSHandle symbol_v1(thread->GetEcmaVM()->GetFactory()->NewJSSymbol()); - JSTaggedValue::ToNumber(thread, symbol_v1); - EXPECT_TRUE(thread->HasPendingException()); - EXPECT_TRUE(thread->GetException().IsJSError()); + thread_->ClearException(); + JSHandle symbol_v1(thread_->GetEcmaVM()->GetFactory()->NewJSSymbol()); + JSTaggedValue::ToNumber(thread_, symbol_v1); + EXPECT_TRUE(thread_->HasPendingException()); + EXPECT_TRUE(thread_->GetException().IsJSError()); } TEST_F(JSTaggedValueTest, ToInteger) @@ -342,35 +342,35 @@ TEST_F(JSTaggedValueTest, ToInteger) JSTaggedNumber result; JSTaggedValue int_v(100); - result = JSTaggedValue::ToInteger(thread, JSHandle(thread, int_v)); + result = JSTaggedValue::ToInteger(thread_, JSHandle(thread_, int_v)); EXPECT_EQ(result.GetNumber(), 100); JSTaggedValue double_v1((double)100.0); - result = JSTaggedValue::ToInteger(thread, JSHandle(thread, double_v1)); + result = JSTaggedValue::ToInteger(thread_, JSHandle(thread_, double_v1)); EXPECT_EQ(result.GetNumber(), (double)100.0); JSTaggedValue double_v2((double)100.123); - result = JSTaggedValue::ToInteger(thread, JSHandle(thread, double_v2)); + result = JSTaggedValue::ToInteger(thread_, JSHandle(thread_, double_v2)); EXPECT_EQ(result.GetNumber(), (double)100); JSTaggedValue undefined_v = JSTaggedValue::Undefined(); - result = JSTaggedValue::ToInteger(thread, JSHandle(thread, undefined_v)); + result = JSTaggedValue::ToInteger(thread_, JSHandle(thread_, undefined_v)); EXPECT_EQ(result.GetNumber(), 0); JSTaggedValue hole_v = JSTaggedValue::Hole(); - result = JSTaggedValue::ToInteger(thread, JSHandle(thread, hole_v)); + result = JSTaggedValue::ToInteger(thread_, JSHandle(thread_, hole_v)); EXPECT_EQ(result.GetNumber(), 0); JSTaggedValue null_v = JSTaggedValue::Null(); - result = JSTaggedValue::ToInteger(thread, JSHandle(thread, null_v)); + result = JSTaggedValue::ToInteger(thread_, JSHandle(thread_, null_v)); EXPECT_EQ(result.GetNumber(), 0); JSTaggedValue false_v = JSTaggedValue::False(); - result = JSTaggedValue::ToInteger(thread, JSHandle(thread, false_v)); + result = JSTaggedValue::ToInteger(thread_, JSHandle(thread_, false_v)); EXPECT_EQ(result.GetNumber(), 0); JSTaggedValue true_v = JSTaggedValue::True(); - result = JSTaggedValue::ToInteger(thread, JSHandle(thread, true_v)); + result = JSTaggedValue::ToInteger(thread_, JSHandle(thread_, true_v)); EXPECT_EQ(result.GetNumber(), 1); } @@ -379,50 +379,50 @@ TEST_F(JSTaggedValueTest, ToInt32) int32_t result; JSTaggedValue int_v(100); - result = JSTaggedValue::ToInt32(thread, JSHandle(thread, int_v)); + result = JSTaggedValue::ToInt32(thread_, JSHandle(thread_, int_v)); EXPECT_EQ(result, 100); JSTaggedValue double_v1((double)100.0); - result = JSTaggedValue::ToInt32(thread, JSHandle(thread, double_v1)); + result = JSTaggedValue::ToInt32(thread_, JSHandle(thread_, double_v1)); EXPECT_EQ(result, 100); JSTaggedValue double_v2((double)100.123); - result = JSTaggedValue::ToInt32(thread, JSHandle(thread, double_v2)); + result = JSTaggedValue::ToInt32(thread_, JSHandle(thread_, double_v2)); EXPECT_EQ(result, 100); double input_1 = (static_cast(UINT32_MAX) + 1) + 12345; JSTaggedValue double_v3(input_1); - result = JSTaggedValue::ToInt32(thread, JSHandle(thread, double_v3)); + result = JSTaggedValue::ToInt32(thread_, JSHandle(thread_, double_v3)); EXPECT_EQ(result, 12345); double input_2 = 100 * (static_cast(UINT32_MAX) + 1) + 23456; JSTaggedValue double_v4(input_2); - result = JSTaggedValue::ToInt32(thread, JSHandle(thread, double_v4)); + result = JSTaggedValue::ToInt32(thread_, JSHandle(thread_, double_v4)); EXPECT_EQ(result, 23456); double input_3 = 100 * (static_cast(UINT32_MAX) + 1) + INT32_MAX + 1 + 23456; JSTaggedValue double_v5(input_3); - result = JSTaggedValue::ToInt32(thread, JSHandle(thread, double_v5)); + result = JSTaggedValue::ToInt32(thread_, JSHandle(thread_, double_v5)); EXPECT_EQ(result, 23456 - static_cast(INT32_MAX) - 1); JSTaggedValue undefined_v = JSTaggedValue::Undefined(); - result = JSTaggedValue::ToInt32(thread, JSHandle(thread, undefined_v)); + result = JSTaggedValue::ToInt32(thread_, JSHandle(thread_, undefined_v)); EXPECT_EQ(result, 0); JSTaggedValue hole_v = JSTaggedValue::Hole(); - result = JSTaggedValue::ToInt32(thread, JSHandle(thread, hole_v)); + result = JSTaggedValue::ToInt32(thread_, JSHandle(thread_, hole_v)); EXPECT_EQ(result, 0); JSTaggedValue null_v = JSTaggedValue::Null(); - result = JSTaggedValue::ToInt32(thread, JSHandle(thread, null_v)); + result = JSTaggedValue::ToInt32(thread_, JSHandle(thread_, null_v)); EXPECT_EQ(result, 0); JSTaggedValue false_v = JSTaggedValue::False(); - result = JSTaggedValue::ToInt32(thread, JSHandle(thread, false_v)); + result = JSTaggedValue::ToInt32(thread_, JSHandle(thread_, false_v)); EXPECT_EQ(result, 0); JSTaggedValue true_v = JSTaggedValue::True(); - result = JSTaggedValue::ToInt32(thread, JSHandle(thread, true_v)); + result = JSTaggedValue::ToInt32(thread_, JSHandle(thread_, true_v)); EXPECT_EQ(result, 1); } @@ -431,50 +431,50 @@ TEST_F(JSTaggedValueTest, ToUint32) uint32_t result; JSTaggedValue int_v(100); - result = JSTaggedValue::ToUint32(thread, JSHandle(thread, int_v)); + result = JSTaggedValue::ToUint32(thread_, JSHandle(thread_, int_v)); EXPECT_EQ(result, 100); JSTaggedValue double_v1((double)100.0); - result = JSTaggedValue::ToUint32(thread, JSHandle(thread, double_v1)); + result = JSTaggedValue::ToUint32(thread_, JSHandle(thread_, double_v1)); EXPECT_EQ(result, 100); JSTaggedValue double_v2((double)100.123); - result = JSTaggedValue::ToUint32(thread, JSHandle(thread, double_v2)); + result = JSTaggedValue::ToUint32(thread_, JSHandle(thread_, double_v2)); EXPECT_EQ(result, 100); double input_1 = (static_cast(UINT32_MAX) + 1) + 12345; JSTaggedValue double_v3(input_1); - result = JSTaggedValue::ToUint32(thread, JSHandle(thread, double_v3)); + result = JSTaggedValue::ToUint32(thread_, JSHandle(thread_, double_v3)); EXPECT_EQ(result, 12345); double input_2 = 100 * (static_cast(UINT32_MAX) + 1) + 23456; JSTaggedValue double_v4(input_2); - result = JSTaggedValue::ToUint32(thread, JSHandle(thread, double_v4)); + result = JSTaggedValue::ToUint32(thread_, JSHandle(thread_, double_v4)); EXPECT_EQ(result, 23456); double input_3 = 100 * (static_cast(UINT32_MAX) + 1) + INT32_MAX + 1 + 23456; JSTaggedValue double_v5(input_3); - result = JSTaggedValue::ToUint32(thread, JSHandle(thread, double_v5)); + result = JSTaggedValue::ToUint32(thread_, JSHandle(thread_, double_v5)); EXPECT_EQ(result, static_cast(INT32_MAX) + 1 + 23456); JSTaggedValue undefined_v = JSTaggedValue::Undefined(); - result = JSTaggedValue::ToUint32(thread, JSHandle(thread, undefined_v)); + result = JSTaggedValue::ToUint32(thread_, JSHandle(thread_, undefined_v)); EXPECT_EQ(result, 0); JSTaggedValue hole_v = JSTaggedValue::Hole(); - result = JSTaggedValue::ToUint32(thread, JSHandle(thread, hole_v)); + result = JSTaggedValue::ToUint32(thread_, JSHandle(thread_, hole_v)); EXPECT_EQ(result, 0); JSTaggedValue null_v = JSTaggedValue::Null(); - result = JSTaggedValue::ToUint32(thread, JSHandle(thread, null_v)); + result = JSTaggedValue::ToUint32(thread_, JSHandle(thread_, null_v)); EXPECT_EQ(result, 0); JSTaggedValue false_v = JSTaggedValue::False(); - result = JSTaggedValue::ToUint32(thread, JSHandle(thread, false_v)); + result = JSTaggedValue::ToUint32(thread_, JSHandle(thread_, false_v)); EXPECT_EQ(result, 0); JSTaggedValue true_v = JSTaggedValue::True(); - result = JSTaggedValue::ToUint32(thread, JSHandle(thread, true_v)); + result = JSTaggedValue::ToUint32(thread_, JSHandle(thread_, true_v)); EXPECT_EQ(result, 1); } @@ -483,50 +483,50 @@ TEST_F(JSTaggedValueTest, ToInt16) int32_t result; JSTaggedValue int_v(100); - result = JSTaggedValue::ToInt16(thread, JSHandle(thread, int_v)); + result = JSTaggedValue::ToInt16(thread_, JSHandle(thread_, int_v)); EXPECT_EQ(result, 100); JSTaggedValue double_v1((double)100.0); - result = JSTaggedValue::ToInt16(thread, JSHandle(thread, double_v1)); + result = JSTaggedValue::ToInt16(thread_, JSHandle(thread_, double_v1)); EXPECT_EQ(result, 100); JSTaggedValue double_v2((double)100.123); - result = JSTaggedValue::ToInt16(thread, JSHandle(thread, double_v2)); + result = JSTaggedValue::ToInt16(thread_, JSHandle(thread_, double_v2)); EXPECT_EQ(result, 100); double input_1 = (static_cast(UINT16_MAX) + 1) + 12345; JSTaggedValue double_v3(input_1); - result = JSTaggedValue::ToInt16(thread, JSHandle(thread, double_v3)); + result = JSTaggedValue::ToInt16(thread_, JSHandle(thread_, double_v3)); EXPECT_EQ(result, 12345); double input_2 = 100 * (static_cast(UINT16_MAX) + 1) + 23456; JSTaggedValue double_v4(input_2); - result = JSTaggedValue::ToInt16(thread, JSHandle(thread, double_v4)); + result = JSTaggedValue::ToInt16(thread_, JSHandle(thread_, double_v4)); EXPECT_EQ(result, 23456); double input_3 = 100 * (static_cast(UINT16_MAX) + 1) + INT16_MAX + 1 + 23456; JSTaggedValue double_v5(input_3); - result = JSTaggedValue::ToInt16(thread, JSHandle(thread, double_v5)); + result = JSTaggedValue::ToInt16(thread_, JSHandle(thread_, double_v5)); EXPECT_EQ(result, 23456 - static_cast(INT16_MAX) - 1); JSTaggedValue undefined_v = JSTaggedValue::Undefined(); - result = JSTaggedValue::ToInt16(thread, JSHandle(thread, undefined_v)); + result = JSTaggedValue::ToInt16(thread_, JSHandle(thread_, undefined_v)); EXPECT_EQ(result, 0); JSTaggedValue hole_v = JSTaggedValue::Hole(); - result = JSTaggedValue::ToInt16(thread, JSHandle(thread, hole_v)); + result = JSTaggedValue::ToInt16(thread_, JSHandle(thread_, hole_v)); EXPECT_EQ(result, 0); JSTaggedValue null_v = JSTaggedValue::Null(); - result = JSTaggedValue::ToInt16(thread, JSHandle(thread, null_v)); + result = JSTaggedValue::ToInt16(thread_, JSHandle(thread_, null_v)); EXPECT_EQ(result, 0); JSTaggedValue false_v = JSTaggedValue::False(); - result = JSTaggedValue::ToInt16(thread, JSHandle(thread, false_v)); + result = JSTaggedValue::ToInt16(thread_, JSHandle(thread_, false_v)); EXPECT_EQ(result, 0); JSTaggedValue true_v = JSTaggedValue::True(); - result = JSTaggedValue::ToInt16(thread, JSHandle(thread, true_v)); + result = JSTaggedValue::ToInt16(thread_, JSHandle(thread_, true_v)); EXPECT_EQ(result, 1); } @@ -535,50 +535,50 @@ TEST_F(JSTaggedValueTest, ToUint16) uint32_t result; JSTaggedValue int_v(100); - result = JSTaggedValue::ToUint16(thread, JSHandle(thread, int_v)); + result = JSTaggedValue::ToUint16(thread_, JSHandle(thread_, int_v)); EXPECT_EQ(result, 100); JSTaggedValue double_v1((double)100.0); - result = JSTaggedValue::ToUint16(thread, JSHandle(thread, double_v1)); + result = JSTaggedValue::ToUint16(thread_, JSHandle(thread_, double_v1)); EXPECT_EQ(result, 100); JSTaggedValue double_v2((double)100.123); - result = JSTaggedValue::ToUint16(thread, JSHandle(thread, double_v2)); + result = JSTaggedValue::ToUint16(thread_, JSHandle(thread_, double_v2)); EXPECT_EQ(result, 100); double input_1 = (static_cast(UINT16_MAX) + 1) + 12345; JSTaggedValue double_v3(input_1); - result = JSTaggedValue::ToUint16(thread, JSHandle(thread, double_v3)); + result = JSTaggedValue::ToUint16(thread_, JSHandle(thread_, double_v3)); EXPECT_EQ(result, 12345); double input_2 = 100 * (static_cast(UINT16_MAX) + 1) + 23456; JSTaggedValue double_v4(input_2); - result = JSTaggedValue::ToUint16(thread, JSHandle(thread, double_v4)); + result = JSTaggedValue::ToUint16(thread_, JSHandle(thread_, double_v4)); EXPECT_EQ(result, 23456); double input_3 = 100 * (static_cast(UINT16_MAX) + 1) + INT16_MAX + 1 + 23456; JSTaggedValue double_v5(input_3); - result = JSTaggedValue::ToUint16(thread, JSHandle(thread, double_v5)); + result = JSTaggedValue::ToUint16(thread_, JSHandle(thread_, double_v5)); EXPECT_EQ(result, static_cast(INT16_MAX) + 1 + 23456); JSTaggedValue undefined_v = JSTaggedValue::Undefined(); - result = JSTaggedValue::ToUint16(thread, JSHandle(thread, undefined_v)); + result = JSTaggedValue::ToUint16(thread_, JSHandle(thread_, undefined_v)); EXPECT_EQ(result, 0); JSTaggedValue hole_v = JSTaggedValue::Hole(); - result = JSTaggedValue::ToUint16(thread, JSHandle(thread, hole_v)); + result = JSTaggedValue::ToUint16(thread_, JSHandle(thread_, hole_v)); EXPECT_EQ(result, 0); JSTaggedValue null_v = JSTaggedValue::Null(); - result = JSTaggedValue::ToUint16(thread, JSHandle(thread, null_v)); + result = JSTaggedValue::ToUint16(thread_, JSHandle(thread_, null_v)); EXPECT_EQ(result, 0); JSTaggedValue false_v = JSTaggedValue::False(); - result = JSTaggedValue::ToUint16(thread, JSHandle(thread, false_v)); + result = JSTaggedValue::ToUint16(thread_, JSHandle(thread_, false_v)); EXPECT_EQ(result, 0); JSTaggedValue true_v = JSTaggedValue::True(); - result = JSTaggedValue::ToUint16(thread, JSHandle(thread, true_v)); + result = JSTaggedValue::ToUint16(thread_, JSHandle(thread_, true_v)); EXPECT_EQ(result, 1); } @@ -587,50 +587,50 @@ TEST_F(JSTaggedValueTest, ToInt8) int32_t result; JSTaggedValue int_v(100); - result = JSTaggedValue::ToInt8(thread, JSHandle(thread, int_v)); + result = JSTaggedValue::ToInt8(thread_, JSHandle(thread_, int_v)); EXPECT_EQ(result, 100); JSTaggedValue double_v1((double)100.0); - result = JSTaggedValue::ToInt8(thread, JSHandle(thread, double_v1)); + result = JSTaggedValue::ToInt8(thread_, JSHandle(thread_, double_v1)); EXPECT_EQ(result, 100); JSTaggedValue double_v2((double)100.123); - result = JSTaggedValue::ToInt8(thread, JSHandle(thread, double_v2)); + result = JSTaggedValue::ToInt8(thread_, JSHandle(thread_, double_v2)); EXPECT_EQ(result, 100); double input_1 = (static_cast(UINT8_MAX) + 1) + 45; JSTaggedValue double_v3(input_1); - result = JSTaggedValue::ToInt8(thread, JSHandle(thread, double_v3)); + result = JSTaggedValue::ToInt8(thread_, JSHandle(thread_, double_v3)); EXPECT_EQ(result, 45); double input_2 = 100 * (static_cast(UINT8_MAX) + 1) + 56; JSTaggedValue double_v4(input_2); - result = JSTaggedValue::ToInt8(thread, JSHandle(thread, double_v4)); + result = JSTaggedValue::ToInt8(thread_, JSHandle(thread_, double_v4)); EXPECT_EQ(result, 56); double input_3 = 100 * (static_cast(UINT8_MAX) + 1) + INT8_MAX + 1 + 23; JSTaggedValue double_v5(input_3); - result = JSTaggedValue::ToInt8(thread, JSHandle(thread, double_v5)); + result = JSTaggedValue::ToInt8(thread_, JSHandle(thread_, double_v5)); EXPECT_EQ(result, 23 - static_cast(INT8_MAX) - 1); JSTaggedValue undefined_v = JSTaggedValue::Undefined(); - result = JSTaggedValue::ToInt8(thread, JSHandle(thread, undefined_v)); + result = JSTaggedValue::ToInt8(thread_, JSHandle(thread_, undefined_v)); EXPECT_EQ(result, 0); JSTaggedValue hole_v = JSTaggedValue::Hole(); - result = JSTaggedValue::ToInt8(thread, JSHandle(thread, hole_v)); + result = JSTaggedValue::ToInt8(thread_, JSHandle(thread_, hole_v)); EXPECT_EQ(result, 0); JSTaggedValue null_v = JSTaggedValue::Null(); - result = JSTaggedValue::ToInt8(thread, JSHandle(thread, null_v)); + result = JSTaggedValue::ToInt8(thread_, JSHandle(thread_, null_v)); EXPECT_EQ(result, 0); JSTaggedValue false_v = JSTaggedValue::False(); - result = JSTaggedValue::ToInt8(thread, JSHandle(thread, false_v)); + result = JSTaggedValue::ToInt8(thread_, JSHandle(thread_, false_v)); EXPECT_EQ(result, 0); JSTaggedValue true_v = JSTaggedValue::True(); - result = JSTaggedValue::ToInt8(thread, JSHandle(thread, true_v)); + result = JSTaggedValue::ToInt8(thread_, JSHandle(thread_, true_v)); EXPECT_EQ(result, 1); } @@ -639,50 +639,50 @@ TEST_F(JSTaggedValueTest, ToUint8) uint32_t result; JSTaggedValue int_v(100); - result = JSTaggedValue::ToUint8(thread, JSHandle(thread, int_v)); + result = JSTaggedValue::ToUint8(thread_, JSHandle(thread_, int_v)); EXPECT_EQ(result, 100); JSTaggedValue double_v1((double)100.0); - result = JSTaggedValue::ToUint8(thread, JSHandle(thread, double_v1)); + result = JSTaggedValue::ToUint8(thread_, JSHandle(thread_, double_v1)); EXPECT_EQ(result, 100); JSTaggedValue double_v2((double)100.123); - result = JSTaggedValue::ToUint8(thread, JSHandle(thread, double_v2)); + result = JSTaggedValue::ToUint8(thread_, JSHandle(thread_, double_v2)); EXPECT_EQ(result, 100); double input_1 = (static_cast(UINT8_MAX) + 1) + 34; JSTaggedValue double_v3(input_1); - result = JSTaggedValue::ToUint8(thread, JSHandle(thread, double_v3)); + result = JSTaggedValue::ToUint8(thread_, JSHandle(thread_, double_v3)); EXPECT_EQ(result, 34); double input_2 = 100 * (static_cast(UINT8_MAX) + 1) + 45; JSTaggedValue double_v4(input_2); - result = JSTaggedValue::ToUint8(thread, JSHandle(thread, double_v4)); + result = JSTaggedValue::ToUint8(thread_, JSHandle(thread_, double_v4)); EXPECT_EQ(result, 45); double input_3 = 100 * (static_cast(UINT8_MAX) + 1) + INT8_MAX + 1 + 56; JSTaggedValue double_v5(input_3); - result = JSTaggedValue::ToUint8(thread, JSHandle(thread, double_v5)); + result = JSTaggedValue::ToUint8(thread_, JSHandle(thread_, double_v5)); EXPECT_EQ(result, static_cast(INT8_MAX) + 1 + 56); JSTaggedValue undefined_v = JSTaggedValue::Undefined(); - result = JSTaggedValue::ToUint8(thread, JSHandle(thread, undefined_v)); + result = JSTaggedValue::ToUint8(thread_, JSHandle(thread_, undefined_v)); EXPECT_EQ(result, 0); JSTaggedValue hole_v = JSTaggedValue::Hole(); - result = JSTaggedValue::ToUint8(thread, JSHandle(thread, hole_v)); + result = JSTaggedValue::ToUint8(thread_, JSHandle(thread_, hole_v)); EXPECT_EQ(result, 0); JSTaggedValue null_v = JSTaggedValue::Null(); - result = JSTaggedValue::ToUint8(thread, JSHandle(thread, null_v)); + result = JSTaggedValue::ToUint8(thread_, JSHandle(thread_, null_v)); EXPECT_EQ(result, 0); JSTaggedValue false_v = JSTaggedValue::False(); - result = JSTaggedValue::ToUint8(thread, JSHandle(thread, false_v)); + result = JSTaggedValue::ToUint8(thread_, JSHandle(thread_, false_v)); EXPECT_EQ(result, 0); JSTaggedValue true_v = JSTaggedValue::True(); - result = JSTaggedValue::ToUint8(thread, JSHandle(thread, true_v)); + result = JSTaggedValue::ToUint8(thread_, JSHandle(thread_, true_v)); EXPECT_EQ(result, 1); } @@ -691,64 +691,64 @@ TEST_F(JSTaggedValueTest, ToUint8Clamp) uint32_t result; JSTaggedValue int_v1(-100); - result = JSTaggedValue::ToUint8Clamp(thread, JSHandle(thread, int_v1)); + result = JSTaggedValue::ToUint8Clamp(thread_, JSHandle(thread_, int_v1)); EXPECT_EQ(result, 0); JSTaggedValue int_v2(100); - result = JSTaggedValue::ToUint8Clamp(thread, JSHandle(thread, int_v2)); + result = JSTaggedValue::ToUint8Clamp(thread_, JSHandle(thread_, int_v2)); EXPECT_EQ(result, 100); JSTaggedValue int_v3(300); - result = JSTaggedValue::ToUint8Clamp(thread, JSHandle(thread, int_v3)); + result = JSTaggedValue::ToUint8Clamp(thread_, JSHandle(thread_, int_v3)); EXPECT_EQ(result, 255); JSTaggedValue double_v1((double)-100.123); - result = JSTaggedValue::ToUint8Clamp(thread, JSHandle(thread, double_v1)); + result = JSTaggedValue::ToUint8Clamp(thread_, JSHandle(thread_, double_v1)); EXPECT_EQ(result, 0); JSTaggedValue double_v2((double)100.123); - result = JSTaggedValue::ToUint8Clamp(thread, JSHandle(thread, double_v2)); + result = JSTaggedValue::ToUint8Clamp(thread_, JSHandle(thread_, double_v2)); EXPECT_EQ(result, 100); JSTaggedValue double_v3((double)100.55); - result = JSTaggedValue::ToUint8Clamp(thread, JSHandle(thread, double_v3)); + result = JSTaggedValue::ToUint8Clamp(thread_, JSHandle(thread_, double_v3)); EXPECT_EQ(result, 101); JSTaggedValue double_v4((double)99.9); - result = JSTaggedValue::ToUint8Clamp(thread, JSHandle(thread, double_v4)); + result = JSTaggedValue::ToUint8Clamp(thread_, JSHandle(thread_, double_v4)); EXPECT_EQ(result, 100); JSTaggedValue double_v5((double)300.5); - result = JSTaggedValue::ToUint8Clamp(thread, JSHandle(thread, double_v5)); + result = JSTaggedValue::ToUint8Clamp(thread_, JSHandle(thread_, double_v5)); EXPECT_EQ(result, 255); JSTaggedValue undefined_v = JSTaggedValue::Undefined(); - result = JSTaggedValue::ToUint8Clamp(thread, JSHandle(thread, undefined_v)); + result = JSTaggedValue::ToUint8Clamp(thread_, JSHandle(thread_, undefined_v)); EXPECT_EQ(result, 0); JSTaggedValue hole_v = JSTaggedValue::Hole(); - result = JSTaggedValue::ToUint8Clamp(thread, JSHandle(thread, hole_v)); + result = JSTaggedValue::ToUint8Clamp(thread_, JSHandle(thread_, hole_v)); EXPECT_EQ(result, 0); JSTaggedValue null_v = JSTaggedValue::Null(); - result = JSTaggedValue::ToUint8Clamp(thread, JSHandle(thread, null_v)); + result = JSTaggedValue::ToUint8Clamp(thread_, JSHandle(thread_, null_v)); EXPECT_EQ(result, 0); JSTaggedValue false_v = JSTaggedValue::False(); - result = JSTaggedValue::ToUint8Clamp(thread, JSHandle(thread, false_v)); + result = JSTaggedValue::ToUint8Clamp(thread_, JSHandle(thread_, false_v)); EXPECT_EQ(result, 0); JSTaggedValue true_v = JSTaggedValue::True(); - result = JSTaggedValue::ToUint8Clamp(thread, JSHandle(thread, true_v)); + result = JSTaggedValue::ToUint8Clamp(thread_, JSHandle(thread_, true_v)); EXPECT_EQ(result, 1); } TEST_F(JSTaggedValueTest, ToPropertyKey) { JSTaggedValue result; - JSHandle str = thread->GetEcmaVM()->GetFactory()->NewFromString("null"); + JSHandle str = thread_->GetEcmaVM()->GetFactory()->NewFromString("null"); JSTaggedValue key = str.GetTaggedValue(); - result = JSTaggedValue::ToPropertyKey(thread, JSHandle(thread, key)).GetTaggedValue(); + result = JSTaggedValue::ToPropertyKey(thread_, JSHandle(thread_, key)).GetTaggedValue(); EXPECT_TRUE(key == result); } @@ -771,95 +771,95 @@ void CheckOkString(JSThread *thread, const JSHandle &tagged, CStr TEST_F(JSTaggedValueTest, ToString) { CString rightCStr = ""; - CheckOkString(thread, JSHandle(thread, JSTaggedValue()), rightCStr); + CheckOkString(thread_, JSHandle(thread_, JSTaggedValue()), rightCStr); rightCStr = "undefined"; - CheckOkString(thread, JSHandle(thread, JSTaggedValue::Undefined()), rightCStr); + CheckOkString(thread_, JSHandle(thread_, JSTaggedValue::Undefined()), rightCStr); rightCStr = "null"; - CheckOkString(thread, JSHandle(thread, JSTaggedValue::Null()), rightCStr); + CheckOkString(thread_, JSHandle(thread_, JSTaggedValue::Null()), rightCStr); rightCStr = "true"; - CheckOkString(thread, JSHandle(thread, JSTaggedValue::True()), rightCStr); + CheckOkString(thread_, JSHandle(thread_, JSTaggedValue::True()), rightCStr); rightCStr = "false"; - CheckOkString(thread, JSHandle(thread, JSTaggedValue::False()), rightCStr); + CheckOkString(thread_, JSHandle(thread_, JSTaggedValue::False()), rightCStr); rightCStr = "hello world"; - CheckOkString(thread, - JSHandle(thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(rightCStr)), + CheckOkString(thread_, + JSHandle(thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString(rightCStr)), rightCStr); double num = 1; JSTaggedNumber numberNum = JSTaggedNumber(num); rightCStr = "1"; - CheckOkString(thread, JSHandle(thread, numberNum), rightCStr); + CheckOkString(thread_, JSHandle(thread_, numberNum), rightCStr); num = 1.23; numberNum = JSTaggedNumber(num); rightCStr = "1.23"; - CheckOkString(thread, JSHandle(thread, numberNum), rightCStr); + CheckOkString(thread_, JSHandle(thread_, numberNum), rightCStr); int numInt = 2; - JSHandle value1(thread, JSTaggedValue(numInt)); + JSHandle value1(thread_, JSTaggedValue(numInt)); rightCStr = "2"; - CheckOkString(thread, JSHandle::Cast(JSTaggedValue::ToObject(thread, value1)), rightCStr); + CheckOkString(thread_, JSHandle::Cast(JSTaggedValue::ToObject(thread_, value1)), rightCStr); num = 1.23; - JSHandle value2(thread, JSTaggedValue(num)); + JSHandle value2(thread_, JSTaggedValue(num)); rightCStr = "1.23"; - CheckOkString(thread, JSHandle::Cast(JSTaggedValue::ToObject(thread, value2)), rightCStr); + CheckOkString(thread_, JSHandle::Cast(JSTaggedValue::ToObject(thread_, value2)), rightCStr); bool valueBool = true; - JSHandle value3(thread, JSTaggedValue(valueBool)); + JSHandle value3(thread_, JSTaggedValue(valueBool)); rightCStr = "true"; - CheckOkString(thread, JSHandle::Cast(JSTaggedValue::ToObject(thread, value3)), rightCStr); + CheckOkString(thread_, JSHandle::Cast(JSTaggedValue::ToObject(thread_, value3)), rightCStr); } TEST_F(JSTaggedValueTest, CanonicalNumericIndexString) { JSTaggedValue result; - JSHandle str = thread->GetEcmaVM()->GetFactory()->NewFromString("-0"); + JSHandle str = thread_->GetEcmaVM()->GetFactory()->NewFromString("-0"); JSTaggedValue tmp_str = str.GetTaggedValue(); - result = JSTaggedValue::CanonicalNumericIndexString(thread, JSHandle(thread, tmp_str)); + result = JSTaggedValue::CanonicalNumericIndexString(thread_, JSHandle(thread_, tmp_str)); EXPECT_EQ(result.GetDouble(), -0.0); JSTaggedValue tmp_int(1); - result = JSTaggedValue::CanonicalNumericIndexString(thread, JSHandle(thread, tmp_int)); + result = JSTaggedValue::CanonicalNumericIndexString(thread_, JSHandle(thread_, tmp_int)); EXPECT_TRUE(result.IsUndefined()); JSTaggedValue tmp_double((double)100.0); - result = JSTaggedValue::CanonicalNumericIndexString(thread, JSHandle(thread, tmp_double)); + result = JSTaggedValue::CanonicalNumericIndexString(thread_, JSHandle(thread_, tmp_double)); EXPECT_TRUE(result.IsUndefined()); } TEST_F(JSTaggedValueTest, ToObject) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); // int -> JSObject - JSHandle value1(thread, JSTaggedValue(2)); + JSHandle value1(thread_, JSTaggedValue(2)); JSTaggedValue tagged1 = - JSTaggedValue(JSHandle::Cast(JSTaggedValue::ToObject(thread, value1))->GetValue()); + JSTaggedValue(JSHandle::Cast(JSTaggedValue::ToObject(thread_, value1))->GetValue()); EXPECT_EQ(tagged1.GetRawData(), JSTaggedValue(2).GetRawData()); // double -> JSObject - JSHandle value2(thread, JSTaggedValue(2.2)); + JSHandle value2(thread_, JSTaggedValue(2.2)); JSTaggedValue tagged2 = - JSTaggedValue(JSHandle::Cast(JSTaggedValue::ToObject(thread, value2))->GetValue()); + JSTaggedValue(JSHandle::Cast(JSTaggedValue::ToObject(thread_, value2))->GetValue()); EXPECT_EQ(tagged2.GetRawData(), JSTaggedValue(static_cast(2.2)).GetRawData()); // bool -> JSObject - JSHandle value3(thread, JSTaggedValue::True()); + JSHandle value3(thread_, JSTaggedValue::True()); JSTaggedValue tagged3 = - JSTaggedValue(JSHandle::Cast(JSTaggedValue::ToObject(thread, value3))->GetValue()); + JSTaggedValue(JSHandle::Cast(JSTaggedValue::ToObject(thread_, value3))->GetValue()); EXPECT_EQ(tagged3.GetRawData(), JSTaggedValue::True().GetRawData()); // String -> JSObject JSHandle value4(factory->NewFromString("aaa")); JSTaggedValue tagged4 = - JSTaggedValue(JSHandle::Cast(JSTaggedValue::ToObject(thread, value4))->GetValue()); + JSTaggedValue(JSHandle::Cast(JSTaggedValue::ToObject(thread_, value4))->GetValue()); EXPECT_TRUE(tagged4.IsString()); EXPECT_EQ(reinterpret_cast(tagged4.GetRawData())->Compare(value4.GetObject()), 0); @@ -868,18 +868,18 @@ TEST_F(JSTaggedValueTest, ToObject) JSHandle str = factory->NewFromString("bbb"); JSHandle value5(symbol); JSTaggedValue tagged5 = - JSTaggedValue(JSHandle::Cast(JSTaggedValue::ToObject(thread, value5))->GetValue()); + JSTaggedValue(JSHandle::Cast(JSTaggedValue::ToObject(thread_, value5))->GetValue()); EXPECT_EQ(EcmaString::Cast(reinterpret_cast(tagged5.GetRawData())->GetDescription().GetHeapObject()) ->Compare(*str), 0); EXPECT_TRUE(tagged5.IsSymbol()); // JSObject(include all types of objects inherited from JSObject) -> JSObject - EcmaVM *ecma = thread->GetEcmaVM(); + EcmaVM *ecma = thread_->GetEcmaVM(); JSHandle object_fun = ecma->GetGlobalEnv()->GetObjectFunction(); JSHandle js_obj = factory->NewJSObjectByConstructor(JSHandle(object_fun), object_fun); JSHandle value(js_obj); - EXPECT_EQ(*JSTaggedValue::ToObject(thread, value), *js_obj); + EXPECT_EQ(*JSTaggedValue::ToObject(thread_, value), *js_obj); } TEST_F(JSTaggedValueTest, ToLength) @@ -887,68 +887,68 @@ TEST_F(JSTaggedValueTest, ToLength) JSTaggedNumber result; JSTaggedValue int_v(100); - result = JSTaggedValue::ToLength(thread, JSHandle(thread, int_v)); + result = JSTaggedValue::ToLength(thread_, JSHandle(thread_, int_v)); EXPECT_EQ(result.GetNumber(), 100); JSTaggedValue int_v2(-1); - result = JSTaggedValue::ToLength(thread, JSHandle(thread, int_v2)); + result = JSTaggedValue::ToLength(thread_, JSHandle(thread_, int_v2)); EXPECT_EQ(result.GetNumber(), 0); JSTaggedValue double_v1((double)100.0); - result = JSTaggedValue::ToLength(thread, JSHandle(thread, double_v1)); + result = JSTaggedValue::ToLength(thread_, JSHandle(thread_, double_v1)); EXPECT_EQ(result.GetNumber(), (double)100.0); JSTaggedValue double_v2((double)100.123); - result = JSTaggedValue::ToLength(thread, JSHandle(thread, double_v2)); + result = JSTaggedValue::ToLength(thread_, JSHandle(thread_, double_v2)); EXPECT_EQ(result.GetNumber(), (double)100); JSTaggedValue double_v3((double)-1.0); - result = JSTaggedValue::ToLength(thread, JSHandle(thread, double_v3)); + result = JSTaggedValue::ToLength(thread_, JSHandle(thread_, double_v3)); EXPECT_EQ(result.GetNumber(), (double)0); JSTaggedValue double_v4((double)9007199254740992); - result = JSTaggedValue::ToLength(thread, JSHandle(thread, double_v4)); + result = JSTaggedValue::ToLength(thread_, JSHandle(thread_, double_v4)); EXPECT_EQ(result.GetNumber(), (double)9007199254740991); JSTaggedValue undefined_v = JSTaggedValue::Undefined(); - result = JSTaggedValue::ToLength(thread, JSHandle(thread, undefined_v)); + result = JSTaggedValue::ToLength(thread_, JSHandle(thread_, undefined_v)); EXPECT_EQ(result.GetNumber(), 0); JSTaggedValue hole_v = JSTaggedValue::Hole(); - result = JSTaggedValue::ToLength(thread, JSHandle(thread, hole_v)); + result = JSTaggedValue::ToLength(thread_, JSHandle(thread_, hole_v)); EXPECT_EQ(result.GetNumber(), 0); JSTaggedValue null_v = JSTaggedValue::Null(); - result = JSTaggedValue::ToLength(thread, JSHandle(thread, null_v)); + result = JSTaggedValue::ToLength(thread_, JSHandle(thread_, null_v)); EXPECT_EQ(result.GetNumber(), 0); JSTaggedValue false_v = JSTaggedValue::False(); - result = JSTaggedValue::ToLength(thread, JSHandle(thread, false_v)); + result = JSTaggedValue::ToLength(thread_, JSHandle(thread_, false_v)); EXPECT_EQ(result.GetNumber(), 0); JSTaggedValue true_v = JSTaggedValue::True(); - result = JSTaggedValue::ToLength(thread, JSHandle(thread, true_v)); + result = JSTaggedValue::ToLength(thread_, JSHandle(thread_, true_v)); EXPECT_EQ(result.GetNumber(), 1); } TEST_F(JSTaggedValueTest, IsArray) { - EcmaVM *ecma = thread->GetEcmaVM(); + EcmaVM *ecma = thread_->GetEcmaVM(); JSHandle object_fun = ecma->GetGlobalEnv()->GetArrayFunction(); JSHandle js_obj = - thread->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(object_fun), object_fun); + thread_->GetEcmaVM()->GetFactory()->NewJSObjectByConstructor(JSHandle(object_fun), object_fun); ASSERT_TRUE(js_obj->IsJSArray()); - ASSERT_FALSE(JSTaggedValue(1).IsArray(thread)); + ASSERT_FALSE(JSTaggedValue(1).IsArray(thread_)); - ASSERT_FALSE(thread->GetEcmaVM()->GetFactory()->NewFromString("test").GetTaggedValue().IsArray(thread)); + ASSERT_FALSE(thread_->GetEcmaVM()->GetFactory()->NewFromString("test").GetTaggedValue().IsArray(thread_)); } TEST_F(JSTaggedValueTest, IsCallable_IsConstructor_IsExtensible) { - JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); - JSHandle js_function = thread->GetEcmaVM()->GetFactory()->NewJSFunction(env); + JSHandle env = thread_->GetEcmaVM()->GetGlobalEnv(); + JSHandle js_function = thread_->GetEcmaVM()->GetFactory()->NewJSFunction(env); JSHClass *js_hclass = js_function->GetJSHClass(); ASSERT_TRUE(js_function->IsCallable()); js_hclass->SetConstructor(true); @@ -959,7 +959,7 @@ TEST_F(JSTaggedValueTest, IsCallable_IsConstructor_IsExtensible) ASSERT_TRUE(js_function->IsExtensible()); js_hclass->SetExtensible(false); ASSERT_FALSE(js_function->IsExtensible()); - ASSERT_FALSE(JSTaggedValue(1).IsExtensible(thread)); + ASSERT_FALSE(JSTaggedValue(1).IsExtensible(thread_)); ASSERT_FALSE(JSTaggedValue(1).IsConstructor()); ASSERT_FALSE(JSTaggedValue(1).IsCallable()); } @@ -980,25 +980,25 @@ TEST_F(JSTaggedValueTest, IsInteger) ASSERT_FALSE(JSTaggedValue::Null().IsInteger()); ASSERT_FALSE(JSTaggedValue::False().IsInteger()); ASSERT_FALSE(JSTaggedValue::Hole().IsInteger()); - ASSERT_FALSE(thread->GetEcmaVM()->GetFactory()->NewFromString("test").GetTaggedValue().IsInteger()); + ASSERT_FALSE(thread_->GetEcmaVM()->GetFactory()->NewFromString("test").GetTaggedValue().IsInteger()); } TEST_F(JSTaggedValueTest, IsPropertyKey) { ASSERT_TRUE(JSTaggedValue::IsPropertyKey( - JSHandle(thread->GetEcmaVM()->GetFactory()->NewFromString("test")))); + JSHandle(thread_->GetEcmaVM()->GetFactory()->NewFromString("test")))); } TEST_F(JSTaggedValueTest, IsRegExp) { - JSHandle string = thread->GetEcmaVM()->GetFactory()->NewFromString("test"); + JSHandle string = thread_->GetEcmaVM()->GetFactory()->NewFromString("test"); JSHandle obj = JSHandle::Cast(string); - ASSERT_FALSE(JSObject::IsRegExp(thread, obj)); + ASSERT_FALSE(JSObject::IsRegExp(thread_, obj)); } TEST_F(JSTaggedValueTest, SameValue) { - EcmaVM *ecma = thread->GetEcmaVM(); + EcmaVM *ecma = thread_->GetEcmaVM(); JSHandle object_fun = ecma->GetGlobalEnv()->GetObjectFunction(); JSHandle js_obj = @@ -1055,154 +1055,154 @@ TEST_F(JSTaggedValueTest, SameValueZero) TEST_F(JSTaggedValueTest, Less) { - JSHandle test(thread->GetEcmaVM()->GetFactory()->NewFromString("test")); - JSHandle test1(thread->GetEcmaVM()->GetFactory()->NewFromString("test1")); - JSHandle test2(thread->GetEcmaVM()->GetFactory()->NewFromString("test2")); - - ASSERT_TRUE(JSTaggedValue::Less(thread, JSHandle(thread, JSTaggedValue(1.0)), - JSHandle(thread, JSTaggedValue(2.0)))); - ASSERT_FALSE(JSTaggedValue::Less(thread, JSHandle(thread, JSTaggedValue(0.0)), - JSHandle(thread, JSTaggedValue(-0.0)))); - ASSERT_TRUE(JSTaggedValue::Less(thread, JSHandle(thread, JSTaggedValue(1)), - JSHandle(thread, JSTaggedValue(2)))); - - ASSERT_TRUE(JSTaggedValue::Less(thread, test, test1)); - ASSERT_FALSE(JSTaggedValue::Less(thread, test2, test1)); - ASSERT_FALSE(JSTaggedValue::Less(thread, JSHandle(thread, JSTaggedValue(1)), test1)); - ASSERT_FALSE(JSTaggedValue::Less(thread, test2, JSHandle(thread, JSTaggedValue(2)))); - - ASSERT_TRUE(JSTaggedValue::Less(thread, - JSHandle(thread->GetEcmaVM()->GetFactory()->NewFromString("1")), - JSHandle(thread, JSTaggedValue(2)))); - ASSERT_TRUE(JSTaggedValue::Less(thread, JSHandle(thread, JSTaggedValue(1)), - JSHandle(thread->GetEcmaVM()->GetFactory()->NewFromString("2")))); - - ASSERT_TRUE(JSTaggedValue::Less(thread, JSHandle(thread, JSTaggedValue::False()), - JSHandle(thread, JSTaggedValue::True()))); - ASSERT_FALSE(JSTaggedValue::Less(thread, JSHandle(thread, JSTaggedValue::True()), - JSHandle(thread, JSTaggedValue::False()))); - ASSERT_FALSE(JSTaggedValue::Less(thread, JSHandle(thread, JSTaggedValue::Undefined()), - JSHandle(thread, JSTaggedValue::Null()))); - ASSERT_FALSE(JSTaggedValue::Less(thread, JSHandle(thread, JSTaggedValue::Null()), - JSHandle(thread, JSTaggedValue::Undefined()))); + JSHandle test(thread_->GetEcmaVM()->GetFactory()->NewFromString("test")); + JSHandle test1(thread_->GetEcmaVM()->GetFactory()->NewFromString("test1")); + JSHandle test2(thread_->GetEcmaVM()->GetFactory()->NewFromString("test2")); + + ASSERT_TRUE(JSTaggedValue::Less(thread_, JSHandle(thread_, JSTaggedValue(1.0)), + JSHandle(thread_, JSTaggedValue(2.0)))); + ASSERT_FALSE(JSTaggedValue::Less(thread_, JSHandle(thread_, JSTaggedValue(0.0)), + JSHandle(thread_, JSTaggedValue(-0.0)))); + ASSERT_TRUE(JSTaggedValue::Less(thread_, JSHandle(thread_, JSTaggedValue(1)), + JSHandle(thread_, JSTaggedValue(2)))); + + ASSERT_TRUE(JSTaggedValue::Less(thread_, test, test1)); + ASSERT_FALSE(JSTaggedValue::Less(thread_, test2, test1)); + ASSERT_FALSE(JSTaggedValue::Less(thread_, JSHandle(thread_, JSTaggedValue(1)), test1)); + ASSERT_FALSE(JSTaggedValue::Less(thread_, test2, JSHandle(thread_, JSTaggedValue(2)))); + + ASSERT_TRUE(JSTaggedValue::Less(thread_, + JSHandle(thread_->GetEcmaVM()->GetFactory()->NewFromString("1")), + JSHandle(thread_, JSTaggedValue(2)))); + ASSERT_TRUE(JSTaggedValue::Less(thread_, JSHandle(thread_, JSTaggedValue(1)), + JSHandle(thread_->GetEcmaVM()->GetFactory()->NewFromString("2")))); + + ASSERT_TRUE(JSTaggedValue::Less(thread_, JSHandle(thread_, JSTaggedValue::False()), + JSHandle(thread_, JSTaggedValue::True()))); + ASSERT_FALSE(JSTaggedValue::Less(thread_, JSHandle(thread_, JSTaggedValue::True()), + JSHandle(thread_, JSTaggedValue::False()))); + ASSERT_FALSE(JSTaggedValue::Less(thread_, JSHandle(thread_, JSTaggedValue::Undefined()), + JSHandle(thread_, JSTaggedValue::Null()))); + ASSERT_FALSE(JSTaggedValue::Less(thread_, JSHandle(thread_, JSTaggedValue::Null()), + JSHandle(thread_, JSTaggedValue::Undefined()))); } TEST_F(JSTaggedValueTest, Equal) { - ASSERT_TRUE(JSTaggedValue::Equal(thread, JSHandle(thread, JSTaggedValue::Undefined()), - JSHandle(thread, JSTaggedValue::Undefined()))); - ASSERT_TRUE(JSTaggedValue::Equal(thread, JSHandle(thread, JSTaggedValue::Null()), - JSHandle(thread, JSTaggedValue::Undefined()))); - ASSERT_TRUE(JSTaggedValue::Equal(thread, JSHandle(thread, JSTaggedValue::Null()), - JSHandle(thread, JSTaggedValue::Null()))); - ASSERT_TRUE(JSTaggedValue::Equal(thread, JSHandle(thread, JSTaggedValue::Null()), - JSHandle(thread, JSTaggedValue::Undefined()))); - ASSERT_FALSE(JSTaggedValue::Equal(thread, JSHandle(thread, JSTaggedValue::Null()), - JSHandle(thread, JSTaggedValue(1)))); - ASSERT_FALSE(JSTaggedValue::Equal(thread, JSHandle(thread, JSTaggedValue::Null()), - JSHandle(thread, JSTaggedValue::True()))); - ASSERT_FALSE(JSTaggedValue::Equal(thread, JSHandle(thread, JSTaggedValue::Null()), - JSHandle(thread, JSTaggedValue::False()))); + ASSERT_TRUE(JSTaggedValue::Equal(thread_, JSHandle(thread_, JSTaggedValue::Undefined()), + JSHandle(thread_, JSTaggedValue::Undefined()))); + ASSERT_TRUE(JSTaggedValue::Equal(thread_, JSHandle(thread_, JSTaggedValue::Null()), + JSHandle(thread_, JSTaggedValue::Undefined()))); + ASSERT_TRUE(JSTaggedValue::Equal(thread_, JSHandle(thread_, JSTaggedValue::Null()), + JSHandle(thread_, JSTaggedValue::Null()))); + ASSERT_TRUE(JSTaggedValue::Equal(thread_, JSHandle(thread_, JSTaggedValue::Null()), + JSHandle(thread_, JSTaggedValue::Undefined()))); + ASSERT_FALSE(JSTaggedValue::Equal(thread_, JSHandle(thread_, JSTaggedValue::Null()), + JSHandle(thread_, JSTaggedValue(1)))); + ASSERT_FALSE(JSTaggedValue::Equal(thread_, JSHandle(thread_, JSTaggedValue::Null()), + JSHandle(thread_, JSTaggedValue::True()))); + ASSERT_FALSE(JSTaggedValue::Equal(thread_, JSHandle(thread_, JSTaggedValue::Null()), + JSHandle(thread_, JSTaggedValue::False()))); // number compare - ASSERT_TRUE(JSTaggedValue::Equal(thread, JSHandle(thread, JSTaggedValue(1)), - JSHandle(thread, JSTaggedValue(1)))); - ASSERT_FALSE(JSTaggedValue::Equal(thread, JSHandle(thread, JSTaggedValue(1)), - JSHandle(thread, JSTaggedValue(2)))); - ASSERT_TRUE(JSTaggedValue::Equal(thread, JSHandle(thread, JSTaggedValue(1.0)), - JSHandle(thread, JSTaggedValue(1.0)))); - ASSERT_TRUE(JSTaggedValue::Equal(thread, JSHandle(thread, JSTaggedValue(0.0)), - JSHandle(thread, JSTaggedValue(0.0)))); - ASSERT_TRUE(JSTaggedValue::Equal(thread, JSHandle(thread, JSTaggedValue(0.0)), - JSHandle(thread, JSTaggedValue(-0.0)))); - ASSERT_TRUE(JSTaggedValue::Equal(thread, JSHandle(thread, JSTaggedValue(0)), - JSHandle(thread, JSTaggedValue(-0)))); - ASSERT_TRUE(JSTaggedValue::Equal(thread, JSHandle(thread, JSTaggedValue(1)), - JSHandle(thread, JSTaggedValue::True()))); - ASSERT_TRUE(JSTaggedValue::Equal(thread, JSHandle(thread, JSTaggedValue(0)), - JSHandle(thread, JSTaggedValue::False()))); - ASSERT_FALSE(JSTaggedValue::Equal(thread, JSHandle(thread, JSTaggedValue(0)), - JSHandle(thread, JSTaggedValue::Undefined()))); - ASSERT_FALSE(JSTaggedValue::Equal(thread, JSHandle(thread, JSTaggedValue(0)), - JSHandle(thread, JSTaggedValue::Null()))); - - JSHandle test(thread->GetEcmaVM()->GetFactory()->NewFromString("test")); - JSHandle test1(thread->GetEcmaVM()->GetFactory()->NewFromString("test1")); - JSHandle empty(thread->GetEcmaVM()->GetFactory()->NewFromString("")); - JSHandle char0(thread->GetEcmaVM()->GetFactory()->NewFromString("0")); - JSHandle char0_point_0(thread->GetEcmaVM()->GetFactory()->NewFromString("0.0")); - JSHandle char1(thread->GetEcmaVM()->GetFactory()->NewFromString("1")); - JSHandle char1_point_0(thread->GetEcmaVM()->GetFactory()->NewFromString("1.0")); - JSHandle char_1(thread->GetEcmaVM()->GetFactory()->NewFromString("-1")); - JSHandle char_0_point_0(thread->GetEcmaVM()->GetFactory()->NewFromString("-0.0")); - JSHandle char_0_point_1(thread->GetEcmaVM()->GetFactory()->NewFromString("-0.1")); - - ASSERT_TRUE(JSTaggedValue::Equal(thread, JSHandle(thread, JSTaggedValue(0)), char0)); - ASSERT_TRUE(JSTaggedValue::Equal(thread, JSHandle(thread, JSTaggedValue(0.0)), char0)); - ASSERT_TRUE(JSTaggedValue::Equal(thread, JSHandle(thread, JSTaggedValue(1.0)), char1)); - ASSERT_TRUE(JSTaggedValue::Equal(thread, JSHandle(thread, JSTaggedValue(-1.0)), char_1)); - ASSERT_TRUE(JSTaggedValue::Equal(thread, JSHandle(thread, JSTaggedValue(0.0)), char_0_point_0)); - ASSERT_FALSE(JSTaggedValue::Equal(thread, JSHandle(thread, JSTaggedValue(0.0)), char_0_point_1)); + ASSERT_TRUE(JSTaggedValue::Equal(thread_, JSHandle(thread_, JSTaggedValue(1)), + JSHandle(thread_, JSTaggedValue(1)))); + ASSERT_FALSE(JSTaggedValue::Equal(thread_, JSHandle(thread_, JSTaggedValue(1)), + JSHandle(thread_, JSTaggedValue(2)))); + ASSERT_TRUE(JSTaggedValue::Equal(thread_, JSHandle(thread_, JSTaggedValue(1.0)), + JSHandle(thread_, JSTaggedValue(1.0)))); + ASSERT_TRUE(JSTaggedValue::Equal(thread_, JSHandle(thread_, JSTaggedValue(0.0)), + JSHandle(thread_, JSTaggedValue(0.0)))); + ASSERT_TRUE(JSTaggedValue::Equal(thread_, JSHandle(thread_, JSTaggedValue(0.0)), + JSHandle(thread_, JSTaggedValue(-0.0)))); + ASSERT_TRUE(JSTaggedValue::Equal(thread_, JSHandle(thread_, JSTaggedValue(0)), + JSHandle(thread_, JSTaggedValue(-0)))); + ASSERT_TRUE(JSTaggedValue::Equal(thread_, JSHandle(thread_, JSTaggedValue(1)), + JSHandle(thread_, JSTaggedValue::True()))); + ASSERT_TRUE(JSTaggedValue::Equal(thread_, JSHandle(thread_, JSTaggedValue(0)), + JSHandle(thread_, JSTaggedValue::False()))); + ASSERT_FALSE(JSTaggedValue::Equal(thread_, JSHandle(thread_, JSTaggedValue(0)), + JSHandle(thread_, JSTaggedValue::Undefined()))); + ASSERT_FALSE(JSTaggedValue::Equal(thread_, JSHandle(thread_, JSTaggedValue(0)), + JSHandle(thread_, JSTaggedValue::Null()))); + + JSHandle test(thread_->GetEcmaVM()->GetFactory()->NewFromString("test")); + JSHandle test1(thread_->GetEcmaVM()->GetFactory()->NewFromString("test1")); + JSHandle empty(thread_->GetEcmaVM()->GetFactory()->NewFromString("")); + JSHandle char0(thread_->GetEcmaVM()->GetFactory()->NewFromString("0")); + JSHandle char0_point_0(thread_->GetEcmaVM()->GetFactory()->NewFromString("0.0")); + JSHandle char1(thread_->GetEcmaVM()->GetFactory()->NewFromString("1")); + JSHandle char1_point_0(thread_->GetEcmaVM()->GetFactory()->NewFromString("1.0")); + JSHandle char_1(thread_->GetEcmaVM()->GetFactory()->NewFromString("-1")); + JSHandle char_0_point_0(thread_->GetEcmaVM()->GetFactory()->NewFromString("-0.0")); + JSHandle char_0_point_1(thread_->GetEcmaVM()->GetFactory()->NewFromString("-0.1")); + + ASSERT_TRUE(JSTaggedValue::Equal(thread_, JSHandle(thread_, JSTaggedValue(0)), char0)); + ASSERT_TRUE(JSTaggedValue::Equal(thread_, JSHandle(thread_, JSTaggedValue(0.0)), char0)); + ASSERT_TRUE(JSTaggedValue::Equal(thread_, JSHandle(thread_, JSTaggedValue(1.0)), char1)); + ASSERT_TRUE(JSTaggedValue::Equal(thread_, JSHandle(thread_, JSTaggedValue(-1.0)), char_1)); + ASSERT_TRUE(JSTaggedValue::Equal(thread_, JSHandle(thread_, JSTaggedValue(0.0)), char_0_point_0)); + ASSERT_FALSE(JSTaggedValue::Equal(thread_, JSHandle(thread_, JSTaggedValue(0.0)), char_0_point_1)); // string compare - ASSERT_TRUE(JSTaggedValue::Equal(thread, test, test)); - ASSERT_FALSE(JSTaggedValue::Equal(thread, test, test1)); - ASSERT_FALSE(JSTaggedValue::Equal(thread, test, empty)); - ASSERT_TRUE(JSTaggedValue::Equal(thread, empty, empty)); + ASSERT_TRUE(JSTaggedValue::Equal(thread_, test, test)); + ASSERT_FALSE(JSTaggedValue::Equal(thread_, test, test1)); + ASSERT_FALSE(JSTaggedValue::Equal(thread_, test, empty)); + ASSERT_TRUE(JSTaggedValue::Equal(thread_, empty, empty)); // ASSERT_FALSE(JSTaggedValue::Equal(JSTaggedValue(thread->GetEcmaVM()->GetFactory()->NewFromString(""))), // JSTaggedValue(1))); - ASSERT_TRUE(JSTaggedValue::Equal(thread, char1, JSHandle(thread, JSTaggedValue(1)))); + ASSERT_TRUE(JSTaggedValue::Equal(thread_, char1, JSHandle(thread_, JSTaggedValue(1)))); // ASSERT_FALSE(JSTaggedValue::Equal( // JSTaggedValue(thread->GetEcmaVM()->GetFactory()->NewFromString("aaa"))), // JSTaggedValue(0))); // ASSERT_FALSE(JSTaggedValue::Equal( // JSTaggedValue(thread->GetEcmaVM()->GetFactory()->NewFromString("true"))), // JSTaggedValue::True())); - ASSERT_TRUE(JSTaggedValue::Equal(thread, char1, JSHandle(thread, JSTaggedValue::True()))); - ASSERT_TRUE(JSTaggedValue::Equal(thread, char0, JSHandle(thread, JSTaggedValue::False()))); - ASSERT_FALSE(JSTaggedValue::Equal(thread, char0, JSHandle(thread, JSTaggedValue::Undefined()))); - ASSERT_FALSE(JSTaggedValue::Equal(thread, char0, JSHandle(thread, JSTaggedValue::Null()))); + ASSERT_TRUE(JSTaggedValue::Equal(thread_, char1, JSHandle(thread_, JSTaggedValue::True()))); + ASSERT_TRUE(JSTaggedValue::Equal(thread_, char0, JSHandle(thread_, JSTaggedValue::False()))); + ASSERT_FALSE(JSTaggedValue::Equal(thread_, char0, JSHandle(thread_, JSTaggedValue::Undefined()))); + ASSERT_FALSE(JSTaggedValue::Equal(thread_, char0, JSHandle(thread_, JSTaggedValue::Null()))); // boolean compare - ASSERT_TRUE(JSTaggedValue::Equal(thread, JSHandle(thread, JSTaggedValue::True()), - JSHandle(thread, JSTaggedValue::True()))); - ASSERT_TRUE(JSTaggedValue::Equal(thread, JSHandle(thread, JSTaggedValue::False()), - JSHandle(thread, JSTaggedValue::False()))); - ASSERT_FALSE(JSTaggedValue::Equal(thread, JSHandle(thread, JSTaggedValue::True()), - JSHandle(thread, JSTaggedValue::False()))); - ASSERT_FALSE(JSTaggedValue::Equal(thread, JSHandle(thread, JSTaggedValue::False()), - JSHandle(thread, JSTaggedValue::True()))); - ASSERT_TRUE(JSTaggedValue::Equal(thread, JSHandle(thread, JSTaggedValue::True()), - JSHandle(thread, JSTaggedValue(1)))); - ASSERT_TRUE(JSTaggedValue::Equal(thread, JSHandle(thread, JSTaggedValue::True()), - JSHandle(thread, JSTaggedValue(1.0)))); - ASSERT_FALSE(JSTaggedValue::Equal(thread, JSHandle(thread, JSTaggedValue::True()), - JSHandle(thread, JSTaggedValue(0)))); - ASSERT_FALSE(JSTaggedValue::Equal(thread, JSHandle(thread, JSTaggedValue::True()), - JSHandle(thread, JSTaggedValue(0.0)))); - ASSERT_TRUE(JSTaggedValue::Equal(thread, JSHandle(thread, JSTaggedValue::False()), - JSHandle(thread, JSTaggedValue(0)))); - ASSERT_TRUE(JSTaggedValue::Equal(thread, JSHandle(thread, JSTaggedValue::False()), - JSHandle(thread, JSTaggedValue(0.0)))); - ASSERT_FALSE(JSTaggedValue::Equal(thread, JSHandle(thread, JSTaggedValue::False()), - JSHandle(thread, JSTaggedValue(1)))); - ASSERT_FALSE(JSTaggedValue::Equal(thread, JSHandle(thread, JSTaggedValue::False()), - JSHandle(thread, JSTaggedValue(1.0)))); - ASSERT_TRUE(JSTaggedValue::Equal(thread, JSHandle(thread, JSTaggedValue::False()), char0)); - ASSERT_TRUE(JSTaggedValue::Equal(thread, JSHandle(thread, JSTaggedValue::False()), char0_point_0)); - ASSERT_TRUE(JSTaggedValue::Equal(thread, JSHandle(thread, JSTaggedValue::True()), char1)); - ASSERT_TRUE(JSTaggedValue::Equal(thread, JSHandle(thread, JSTaggedValue::True()), char1_point_0)); - ASSERT_FALSE(JSTaggedValue::Equal(thread, JSHandle(thread, JSTaggedValue::True()), char0)); - ASSERT_FALSE(JSTaggedValue::Equal(thread, JSHandle(thread, JSTaggedValue::False()), char1)); + ASSERT_TRUE(JSTaggedValue::Equal(thread_, JSHandle(thread_, JSTaggedValue::True()), + JSHandle(thread_, JSTaggedValue::True()))); + ASSERT_TRUE(JSTaggedValue::Equal(thread_, JSHandle(thread_, JSTaggedValue::False()), + JSHandle(thread_, JSTaggedValue::False()))); + ASSERT_FALSE(JSTaggedValue::Equal(thread_, JSHandle(thread_, JSTaggedValue::True()), + JSHandle(thread_, JSTaggedValue::False()))); + ASSERT_FALSE(JSTaggedValue::Equal(thread_, JSHandle(thread_, JSTaggedValue::False()), + JSHandle(thread_, JSTaggedValue::True()))); + ASSERT_TRUE(JSTaggedValue::Equal(thread_, JSHandle(thread_, JSTaggedValue::True()), + JSHandle(thread_, JSTaggedValue(1)))); + ASSERT_TRUE(JSTaggedValue::Equal(thread_, JSHandle(thread_, JSTaggedValue::True()), + JSHandle(thread_, JSTaggedValue(1.0)))); + ASSERT_FALSE(JSTaggedValue::Equal(thread_, JSHandle(thread_, JSTaggedValue::True()), + JSHandle(thread_, JSTaggedValue(0)))); + ASSERT_FALSE(JSTaggedValue::Equal(thread_, JSHandle(thread_, JSTaggedValue::True()), + JSHandle(thread_, JSTaggedValue(0.0)))); + ASSERT_TRUE(JSTaggedValue::Equal(thread_, JSHandle(thread_, JSTaggedValue::False()), + JSHandle(thread_, JSTaggedValue(0)))); + ASSERT_TRUE(JSTaggedValue::Equal(thread_, JSHandle(thread_, JSTaggedValue::False()), + JSHandle(thread_, JSTaggedValue(0.0)))); + ASSERT_FALSE(JSTaggedValue::Equal(thread_, JSHandle(thread_, JSTaggedValue::False()), + JSHandle(thread_, JSTaggedValue(1)))); + ASSERT_FALSE(JSTaggedValue::Equal(thread_, JSHandle(thread_, JSTaggedValue::False()), + JSHandle(thread_, JSTaggedValue(1.0)))); + ASSERT_TRUE(JSTaggedValue::Equal(thread_, JSHandle(thread_, JSTaggedValue::False()), char0)); + ASSERT_TRUE(JSTaggedValue::Equal(thread_, JSHandle(thread_, JSTaggedValue::False()), char0_point_0)); + ASSERT_TRUE(JSTaggedValue::Equal(thread_, JSHandle(thread_, JSTaggedValue::True()), char1)); + ASSERT_TRUE(JSTaggedValue::Equal(thread_, JSHandle(thread_, JSTaggedValue::True()), char1_point_0)); + ASSERT_FALSE(JSTaggedValue::Equal(thread_, JSHandle(thread_, JSTaggedValue::True()), char0)); + ASSERT_FALSE(JSTaggedValue::Equal(thread_, JSHandle(thread_, JSTaggedValue::False()), char1)); } TEST_F(JSTaggedValueTest, StrictEqual) { // This algorithm differs from the SameValue Algorithm in its treatment of signed zeroes and NaNs. - ASSERT_TRUE(JSTaggedValue::StrictEqual(thread, JSHandle(thread, JSTaggedValue(0.0)), - JSHandle(thread, JSTaggedValue(-0.0)))); + ASSERT_TRUE(JSTaggedValue::StrictEqual(thread_, JSHandle(thread_, JSTaggedValue(0.0)), + JSHandle(thread_, JSTaggedValue(-0.0)))); ASSERT_FALSE(JSTaggedValue::StrictEqual( - thread, JSHandle(thread, JSTaggedValue(std::numeric_limits::quiet_NaN())), - JSHandle(thread, JSTaggedValue(std::numeric_limits::quiet_NaN())))); + thread_, JSHandle(thread_, JSTaggedValue(std::numeric_limits::quiet_NaN())), + JSHandle(thread_, JSTaggedValue(std::numeric_limits::quiet_NaN())))); } } // namespace panda::test diff --git a/tests/runtime/common/test_helper.cpp b/tests/runtime/common/test_helper.cpp index 9aa89f29b9716804d29a3186992cdc1be5e54753..2e8f466a7ff35a99024d71cee5f6bde1d64ff1e8 100644 --- a/tests/runtime/common/test_helper.cpp +++ b/tests/runtime/common/test_helper.cpp @@ -21,17 +21,17 @@ using panda::ecmascript::EcmaRuntimeCallInfo; using panda::ecmascript::JSTaggedValue; using panda::ecmascript::JSThread; -thread_local bool TestHelper::isLeaf = true; -ecmascript::JSHandle TestHelper::methodFunction_ {}; +thread_local bool TestHelper::is_leaf_ = true; +ecmascript::JSHandle TestHelper::method_function_ {}; std::unique_ptr TestHelper::CreateEcmaRuntimeCallInfo(JSThread *thread, JSTaggedValue newTgt, array_size_t argvLength) { auto method = thread->GetEcmaVM()->GetMethodForNativeFunction(nullptr); - if (isLeaf && thread->GetCurrentFrame() != nullptr) { + if (is_leaf_ && thread->GetCurrentFrame() != nullptr) { method->ExitNativeMethodFrame(thread); } - isLeaf = true; + is_leaf_ = true; const uint8_t testDecodedSize = 2; // argvLength includes number of int64_t to store value and tag of function, 'this' and call args @@ -48,21 +48,21 @@ std::unique_ptr TestHelper::CreateEcmaRuntimeCallInfo(JSThr auto callInfo = std::make_unique(thread, numActualArgs, &frame->GetVReg(0)); - callInfo->SetFunction(methodFunction_.GetTaggedValue()); + callInfo->SetFunction(method_function_.GetTaggedValue()); callInfo->SetNewTarget(newTgt); return callInfo; } Frame *TestHelper::SetupFrame(JSThread *thread, [[maybe_unused]] EcmaRuntimeCallInfo *info) { - isLeaf = false; + is_leaf_ = false; ASSERT((void *)info->GetArgAddress(0) == &thread->GetCurrentFrame()->GetVReg(0)); return thread->GetCurrentFrame()->GetPrevFrame(); } void TestHelper::TearDownFrame([[maybe_unused]] JSThread *thread, [[maybe_unused]] Frame *prev) { - isLeaf = true; + is_leaf_ = true; auto frame = thread->GetCurrentFrame(); while (frame != nullptr && frame->GetPrevFrame() != prev) { Method::ExitNativeMethodFrame(thread); diff --git a/tests/runtime/common/test_helper.h b/tests/runtime/common/test_helper.h index eb039f0c7b5885418019171c70e74f810ac7f511..34873ed8a998e3bee85751582d320ba877d076e8 100644 --- a/tests/runtime/common/test_helper.h +++ b/tests/runtime/common/test_helper.h @@ -60,7 +60,7 @@ public: auto globalEnv = ecmaVm->GetGlobalEnv(); { ScopedManagedCodeThread s(thread); - methodFunction_ = ecmaVm->GetFactory()->NewJSFunction(globalEnv); + method_function_ = ecmaVm->GetFactory()->NewJSFunction(globalEnv); } if (enter_managed_code) { thread->ManagedCodeBegin(); @@ -81,8 +81,8 @@ public: } private: - static thread_local bool isLeaf; - static ecmascript::JSHandle methodFunction_; + static thread_local bool is_leaf_; + static ecmascript::JSHandle method_function_; }; } // namespace panda::test diff --git a/tests/runtime/hprof/heap_tracker_test.cpp b/tests/runtime/hprof/heap_tracker_test.cpp index 14badabe55a786767407fc1893620b2ea49cc21e..c982ee77393c6de1445c206bcd7738afbb1dd0ba 100644 --- a/tests/runtime/hprof/heap_tracker_test.cpp +++ b/tests/runtime/hprof/heap_tracker_test.cpp @@ -42,40 +42,40 @@ public: void SetUp() override { - TestHelper::CreateEcmaVMWithScope(instance, thread, scope); - EcmaVM::Cast(instance)->SetEnableForceGC(false); + TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); + EcmaVM::Cast(instance_)->SetEnableForceGC(false); } void TearDown() override { - TestHelper::DestroyEcmaVMWithScope(instance, scope); + TestHelper::DestroyEcmaVMWithScope(instance_, scope_); } - PandaVM *instance {nullptr}; - EcmaHandleScope *scope {nullptr}; - JSThread *thread {nullptr}; + PandaVM *instance_ {nullptr}; + EcmaHandleScope *scope_ {nullptr}; + JSThread *thread_ {nullptr}; }; TEST_F(HeapTrackerTest, DISABLED_HeapTracker) // issue #5368 { - [[maybe_unused]] EcmaHandleScope handleScope(thread); - HeapProfilerInterface *heapProfile = HeapProfilerInterface::CreateHeapProfiler(thread); - heapProfile->StartHeapTracking(thread, 50); + [[maybe_unused]] EcmaHandleScope handleScope(thread_); + HeapProfilerInterface *heapProfile = HeapProfilerInterface::CreateHeapProfiler(thread_); + heapProfile->StartHeapTracking(thread_, 50); sleep(1); int count = 100; while (count-- > 0) { - thread->GetEcmaVM()->GetFactory()->NewJSAsyncFuncObject(); + thread_->GetEcmaVM()->GetFactory()->NewJSAsyncFuncObject(); } sleep(1); count = 100; while (count-- > 0) { - thread->GetEcmaVM()->GetFactory()->NewJSSymbol(); + thread_->GetEcmaVM()->GetFactory()->NewJSSymbol(); } sleep(1); count = 100; while (count-- > 0) { - JSHandle string = thread->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("Hello World"); - thread->GetEcmaVM()->GetFactory()->NewJSString(JSHandle(string)); + JSHandle string = thread_->GetEcmaVM()->GetFactory()->NewFromCanBeCompressString("Hello World"); + thread_->GetEcmaVM()->GetFactory()->NewJSString(JSHandle(string)); } // Create file test.heaptimeline @@ -84,8 +84,8 @@ TEST_F(HeapTrackerTest, DISABLED_HeapTracker) // issue #5368 outputString.close(); outputString.clear(); - heapProfile->StopHeapTracking(thread, DumpFormat::JSON, fileName.c_str()); - HeapProfilerInterface::Destroy(thread, heapProfile); + heapProfile->StopHeapTracking(thread_, DumpFormat::JSON, fileName.c_str()); + HeapProfilerInterface::Destroy(thread_, heapProfile); // Check fstream inputStream(fileName, std::ios::in); diff --git a/tests/runtime/hprof/hprof_test.cpp b/tests/runtime/hprof/hprof_test.cpp index 8c9048bd6ee82068885c98d6734eb06b9eb5b110..85093ebee52e8305ebaf473b0f999c1093ba091e 100644 --- a/tests/runtime/hprof/hprof_test.cpp +++ b/tests/runtime/hprof/hprof_test.cpp @@ -28,23 +28,23 @@ class HProfTest : public testing::Test { public: void SetUp() override { - TestHelper::CreateEcmaVMWithScope(instance, thread, scope); + TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); } void TearDown() override { - TestHelper::DestroyEcmaVMWithScope(instance, scope); + TestHelper::DestroyEcmaVMWithScope(instance_, scope_); } protected: - PandaVM *instance; - JSThread *thread; - EcmaHandleScope *scope {nullptr}; + PandaVM *instance_; + JSThread *thread_; + EcmaHandleScope *scope_ {nullptr}; }; class HProfTestHelper { public: - explicit HProfTestHelper(const CString &aFilePath) : filePath(aFilePath) {} + explicit HProfTestHelper(const CString &aFilePath) : file_path_(aFilePath) {} ~HProfTestHelper() = default; bool IsFileExist() @@ -59,7 +59,7 @@ public: { int code = 0; if (IsFileExist()) { - code = std::remove(filePath.c_str()); + code = std::remove(file_path_.c_str()); } return code == 0 ? true : false; } @@ -68,10 +68,10 @@ public: { int retry = 2; RemoveExistingFile(); - HeapProfilerInterface::DumpHeapSnapShot(thread, DumpFormat::JSON, filePath.c_str()); + HeapProfilerInterface::DumpHeapSnapShot(thread, DumpFormat::JSON, file_path_.c_str()); while (!IsFileExist() && retry > 0) { retry--; - HeapProfilerInterface::DumpHeapSnapShot(thread, DumpFormat::JSON, filePath.c_str()); + HeapProfilerInterface::DumpHeapSnapShot(thread, DumpFormat::JSON, file_path_.c_str()); } return IsFileExist(); } @@ -85,7 +85,7 @@ public: } else { CString line; int i = 1; - while (getline(inputFile, line)) { + while (getline(input_file_, line)) { if (i == lineId && line.find(lineHeader) != line.npos) { all_same = true; break; @@ -106,7 +106,7 @@ public: } CString line; int i = 1; - while (getline(inputFile, line)) { + while (getline(input_file_, line)) { if (i > 10 && line.find(dataLable) != line.npos) { // Hit the line CString::size_type pos = 0; int loop = 0; @@ -132,7 +132,7 @@ public: } CString line_bk; // The Last Line CString line; - while (getline(inputFile, line)) { + while (getline(input_file_, line)) { line_bk = line; } SafeCloseFile(); @@ -147,7 +147,7 @@ public: } CString line; int i = 1; - while (getline(inputFile, line)) { + while (getline(input_file_, line)) { int length = line.length() - typeLable.length() - 1; if (line.find(typeLable) != line.npos) { // Get if (line.find(",") == line.npos) { // "trace_function_count" end without "," @@ -172,7 +172,7 @@ public: CString line; bool hit = false; int loop = 0; - while (getline(inputFile, line)) { + while (getline(input_file_, line)) { if (!hit && line.find(dataLabel) != line.npos) { // Get loop += 1; // First Line hit = true; @@ -201,42 +201,42 @@ public: private: bool SafeOpenFile() { - inputFile.clear(); - inputFile.open(filePath.c_str(), std::ios::in); + input_file_.clear(); + input_file_.open(file_path_.c_str(), std::ios::in); int retry = 2; - while (!inputFile.good() && retry > 0) { - inputFile.open(filePath.c_str(), std::ios::in); + while (!input_file_.good() && retry > 0) { + input_file_.open(file_path_.c_str(), std::ios::in); retry--; } - return inputFile.good(); + return input_file_.good(); } void SafeCloseFile() { - inputFile.close(); - inputFile.clear(); // Reset File status + input_file_.close(); + input_file_.clear(); // Reset File status } - CString filePath; - std::fstream inputFile; + CString file_path_; + std::fstream input_file_; }; TEST_F(HProfTest, DISABLED_GenerateFileForManualCheck) { HProfTestHelper tester("hprof_json_test.heapsnapshot"); - ASSERT_TRUE(tester.GenerateHeapDump(thread)); + ASSERT_TRUE(tester.GenerateHeapDump(thread_)); } TEST_F(HProfTest, DISABLED_GenerateFile) { HProfTestHelper tester("GenerateFile.heapsnapshot"); - ASSERT_TRUE(tester.GenerateHeapDump(thread)); + ASSERT_TRUE(tester.GenerateHeapDump(thread_)); ASSERT_TRUE(tester.RemoveExistingFile()); } TEST_F(HProfTest, DISABLED_ParseJSONHeader) { HProfTestHelper tester("ParseJSONHeader.heapsnapshot"); - ASSERT_TRUE(tester.GenerateHeapDump(thread)); + ASSERT_TRUE(tester.GenerateHeapDump(thread_)); ASSERT_TRUE(tester.ContrastJSONLineHeader(1, "{\"snapshot\":")); ASSERT_TRUE(tester.ContrastJSONLineHeader(2, "{\"meta\":")); ASSERT_TRUE(tester.ContrastJSONLineHeader(3, "{\"node_fields\":")); @@ -253,7 +253,7 @@ TEST_F(HProfTest, DISABLED_ParseJSONHeader) TEST_F(HProfTest, DISABLED_ContrastNode) { HProfTestHelper tester("ContrastNode.heapsnapshot"); - ASSERT_TRUE(tester.GenerateHeapDump(thread)); + ASSERT_TRUE(tester.GenerateHeapDump(thread_)); ASSERT_TRUE(tester.ContrastJSONSectionPayload("\"nodes\":", 7)); ASSERT_TRUE(tester.RemoveExistingFile()); } @@ -261,7 +261,7 @@ TEST_F(HProfTest, DISABLED_ContrastNode) TEST_F(HProfTest, DISABLED_ContrastEdge) { HProfTestHelper tester("ContrastEdge.heapsnapshot"); - ASSERT_TRUE(tester.GenerateHeapDump(thread)); + ASSERT_TRUE(tester.GenerateHeapDump(thread_)); ASSERT_TRUE(tester.ContrastJSONSectionPayload("\"edges\":", 3)); ASSERT_TRUE(tester.RemoveExistingFile()); } @@ -269,7 +269,7 @@ TEST_F(HProfTest, DISABLED_ContrastEdge) TEST_F(HProfTest, DISABLED_ContrastTraceFunctionInfo) { HProfTestHelper tester("ContrastTraceFunctionInfo.heapsnapshot"); - ASSERT_TRUE(tester.GenerateHeapDump(thread)); + ASSERT_TRUE(tester.GenerateHeapDump(thread_)); ASSERT_TRUE(tester.ContrastJSONSectionPayload("\"trace_function_infos\":", 2)); // Empty ASSERT_TRUE(tester.RemoveExistingFile()); } @@ -277,7 +277,7 @@ TEST_F(HProfTest, DISABLED_ContrastTraceFunctionInfo) TEST_F(HProfTest, DISABLED_ContrastTraceTree) { HProfTestHelper tester("ContrastTraceTree.heapsnapshot"); - ASSERT_TRUE(tester.GenerateHeapDump(thread)); + ASSERT_TRUE(tester.GenerateHeapDump(thread_)); ASSERT_TRUE(tester.ContrastJSONSectionPayload("\"trace_tree\":", 2)); // Empty ASSERT_TRUE(tester.RemoveExistingFile()); } @@ -285,7 +285,7 @@ TEST_F(HProfTest, DISABLED_ContrastTraceTree) TEST_F(HProfTest, DISABLED_ContrastSamples) { HProfTestHelper tester("ContrastSamples.heapsnapshot"); - ASSERT_TRUE(tester.GenerateHeapDump(thread)); + ASSERT_TRUE(tester.GenerateHeapDump(thread_)); ASSERT_TRUE(tester.ContrastJSONSectionPayload("\"samples\":", 2)); // Empty ASSERT_TRUE(tester.RemoveExistingFile()); } @@ -293,7 +293,7 @@ TEST_F(HProfTest, DISABLED_ContrastSamples) TEST_F(HProfTest, DISABLED_ContrastLocations) { HProfTestHelper tester("ContrastLocations.heapsnapshot"); - ASSERT_TRUE(tester.GenerateHeapDump(thread)); + ASSERT_TRUE(tester.GenerateHeapDump(thread_)); ASSERT_TRUE(tester.ContrastJSONSectionPayload("\"locations\":", 2)); // Empty ASSERT_TRUE(tester.RemoveExistingFile()); } @@ -301,7 +301,7 @@ TEST_F(HProfTest, DISABLED_ContrastLocations) TEST_F(HProfTest, DISABLED_ContrastString) { HProfTestHelper tester("ContrastString.heapsnapshot"); - ASSERT_TRUE(tester.GenerateHeapDump(thread)); + ASSERT_TRUE(tester.GenerateHeapDump(thread_)); ASSERT_TRUE(tester.ContrastJSONSectionPayload("\"strings\":[", 1 + 1)); ASSERT_TRUE(tester.RemoveExistingFile()); } @@ -309,7 +309,7 @@ TEST_F(HProfTest, DISABLED_ContrastString) TEST_F(HProfTest, DISABLED_ContrastClosure) { HProfTestHelper tester("ContrastClosure.heapsnapshot"); - ASSERT_TRUE(tester.GenerateHeapDump(thread)); + ASSERT_TRUE(tester.GenerateHeapDump(thread_)); ASSERT_TRUE(tester.ContrastJSONClousure()); ASSERT_TRUE(tester.RemoveExistingFile()); } @@ -317,7 +317,7 @@ TEST_F(HProfTest, DISABLED_ContrastClosure) TEST_F(HProfTest, DISABLED_ContrastNodeCount) { HProfTestHelper tester("ContrastNodeCount.heapsnapshot"); - ASSERT_TRUE(tester.GenerateHeapDump(thread)); + ASSERT_TRUE(tester.GenerateHeapDump(thread_)); ASSERT_TRUE(tester.ExtractCountFromMeta("\"node_count\":") == tester.ExtractCountFromPayload("\"nodes\":[")); ASSERT_TRUE(tester.RemoveExistingFile()); } @@ -325,7 +325,7 @@ TEST_F(HProfTest, DISABLED_ContrastNodeCount) TEST_F(HProfTest, DISABLED_ContrastEdgeCount) { HProfTestHelper tester("ContrastEdgeCount.heapsnapshot"); - ASSERT_TRUE(tester.GenerateHeapDump(thread)); + ASSERT_TRUE(tester.GenerateHeapDump(thread_)); ASSERT_TRUE(tester.ExtractCountFromMeta("\"edge_count\":") == tester.ExtractCountFromPayload("\"edges\":[")); ASSERT_TRUE(tester.RemoveExistingFile()); } @@ -333,7 +333,7 @@ TEST_F(HProfTest, DISABLED_ContrastEdgeCount) TEST_F(HProfTest, DISABLED_ContrastTraceFunctionInfoCount) { HProfTestHelper tester("ContrastTraceFunctionInfoCount.heapsnapshot"); - ASSERT_TRUE(tester.GenerateHeapDump(thread)); + ASSERT_TRUE(tester.GenerateHeapDump(thread_)); ASSERT_TRUE(tester.ExtractCountFromMeta("\"trace_function_count\":") == tester.ExtractCountFromPayload("\"trace_function_infos\":")); ASSERT_TRUE(tester.RemoveExistingFile()); diff --git a/tests/runtime/mem/g1gc_barrier_test.cpp b/tests/runtime/mem/g1gc_barrier_test.cpp index 8cda01f84bd7063a6483128c92f96b014672ffdc..910f415350a12bcb74e2998b566114057ab5b6ad 100644 --- a/tests/runtime/mem/g1gc_barrier_test.cpp +++ b/tests/runtime/mem/g1gc_barrier_test.cpp @@ -78,7 +78,7 @@ public: if (phase != mem::GCPhase::GC_PHASE_MARK) { return; } - has_concurrent_mark = true; + has_concurrent_mark_ = true; JSThread *thread = test_->thread_; array_->Set(thread, 0, JSTaggedValue::Undefined()); array_->Set(thread, 1, replacement_.GetTaggedValue()); @@ -96,7 +96,7 @@ public: JSHandle array_; JSHandle object_; JSHandle replacement_; - bool has_concurrent_mark = false; + bool has_concurrent_mark_ = false; }; TEST_F(G1GCBarrierTest, TestPreBarrier) @@ -114,6 +114,6 @@ TEST_F(G1GCBarrierTest, TestPreBarrier) GCTask task(GCTaskCause::HEAP_USAGE_THRESHOLD_CAUSE); // trigger concurrent marking task.Run(*gc); - ASSERT_TRUE(listener.has_concurrent_mark); + ASSERT_TRUE(listener.has_concurrent_mark_); } } // namespace panda::ecmascript diff --git a/tests/runtime/mem/weak_containers_test.cpp b/tests/runtime/mem/weak_containers_test.cpp index cbc3e26e0ed074b603d2b1daf74c247dd26eb45c..45f2cfdf497d8bdde7cde4d63de690adf92ae340 100644 --- a/tests/runtime/mem/weak_containers_test.cpp +++ b/tests/runtime/mem/weak_containers_test.cpp @@ -36,8 +36,8 @@ public: void SetUp() override { RuntimeOption option; - option.SetGcType(RuntimeOption::GC_TYPE::G1_GC); - option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR); + option.SetGcType(RuntimeOption::GcType::G1_GC); + option.SetLogLevel(RuntimeOption::LogLevel::ERROR); vm_ = JSNApi::CreateJSVM(option); ASSERT_TRUE(vm_ != nullptr) << "Cannot create Runtime"; thread_ = vm_->GetAssociatedJSThread(); diff --git a/tests/runtime/napi/jsnapi_tests.cpp b/tests/runtime/napi/jsnapi_tests.cpp index 8b8956210ec9d62301064e1b4548ab67bf0f2872..3e8753f30c958506611ad84aecf0f318ca25c169 100644 --- a/tests/runtime/napi/jsnapi_tests.cpp +++ b/tests/runtime/napi/jsnapi_tests.cpp @@ -46,8 +46,8 @@ public: void SetUp() override { RuntimeOption option; - option.SetGcType(RuntimeOption::GC_TYPE::STW); - option.SetLogLevel(RuntimeOption::LOG_LEVEL::ERROR); + option.SetGcType(RuntimeOption::GcType::STW); + option.SetLogLevel(RuntimeOption::LogLevel::ERROR); vm_ = JSNApi::CreateJSVM(option); ASSERT_TRUE(vm_ != nullptr) << "Cannot create Runtime"; thread_ = vm_->GetAssociatedJSThread(); @@ -414,15 +414,15 @@ TEST_F(JSNApiTests, ArrayBufferWithBuffer) { static bool isFree = false; struct Data { - int32_t length; + int32_t length_; }; const int32_t length = 15; Data *data = new Data(); - data->length = length; + data->length_ = length; Deleter deleter = [](void *buffer, void *data_ptr) -> void { delete[] reinterpret_cast(buffer); Data *currentData = reinterpret_cast(data_ptr); - ASSERT_EQ(currentData->length, 15); // 5 : size of arguments + ASSERT_EQ(currentData->length_, 15); // 5 : size of arguments delete currentData; isFree = true; }; diff --git a/tests/runtime/regexp/dyn_buffer_test.cpp b/tests/runtime/regexp/dyn_buffer_test.cpp index c163e9a801a4fde69aa1f5eb120813ec450fccf8..99092148883edebbe16ab154e204c1b4426cd85b 100644 --- a/tests/runtime/regexp/dyn_buffer_test.cpp +++ b/tests/runtime/regexp/dyn_buffer_test.cpp @@ -30,18 +30,18 @@ class DynBufferTest : public testing::Test { public: void SetUp() override { - TestHelper::CreateEcmaVMWithScope(instance, thread, scope); - chunk_ = thread->GetEcmaVM()->GetChunk(); + TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); + chunk_ = thread_->GetEcmaVM()->GetChunk(); } void TearDown() override { - TestHelper::DestroyEcmaVMWithScope(instance, scope); + TestHelper::DestroyEcmaVMWithScope(instance_, scope_); } - PandaVM *instance; - JSThread *thread; - EcmaHandleScope *scope {nullptr}; + PandaVM *instance_; + JSThread *thread_; + EcmaHandleScope *scope_ {nullptr}; Chunk *chunk_; }; diff --git a/tests/runtime/regexp/regexp_test.cpp b/tests/runtime/regexp/regexp_test.cpp index faa9d6ef17e7bc51f19d1907c3b40b1c08fa3e97..b32840cefb12f61b1bd6fd390b99a2a4ead2b33f 100644 --- a/tests/runtime/regexp/regexp_test.cpp +++ b/tests/runtime/regexp/regexp_test.cpp @@ -42,13 +42,13 @@ public: void SetUp() override { - TestHelper::CreateEcmaVMWithScope(instance, thread, scope); - chunk_ = thread->GetEcmaVM()->GetChunk(); + TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); + chunk_ = thread_->GetEcmaVM()->GetChunk(); } void TearDown() override { - TestHelper::DestroyEcmaVMWithScope(instance, scope); + TestHelper::DestroyEcmaVMWithScope(instance_, scope_); } bool IsValidAlphaEscapeInAtom(char s) const @@ -102,9 +102,9 @@ public: } protected: - PandaVM *instance {nullptr}; - EcmaHandleScope *scope {nullptr}; - JSThread *thread {nullptr}; + PandaVM *instance_ {nullptr}; + EcmaHandleScope *scope_ {nullptr}; + JSThread *thread_ {nullptr}; Chunk *chunk_ {nullptr}; }; @@ -610,7 +610,7 @@ TEST_F(RegExpTest, ParseNoError2) TEST_F(RegExpTest, ParseAndExec1) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); RegExpParser parser = RegExpParser(chunk_); CString source("ab"); parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 0); @@ -624,7 +624,7 @@ TEST_F(RegExpTest, ParseAndExec1) executor.Execute(reinterpret_cast(input.c_str()), 0, input.size(), parser.GetOriginBuffer()); ASSERT_TRUE(ret); - MatchResult result = executor.GetResult(thread, ret); + MatchResult result = executor.GetResult(thread_, ret); ASSERT_EQ(result.captures_.size(), 1); JSHandle str = factory->NewFromCanBeCompressString("ab"); ASSERT_TRUE(result.captures_[0].second->Compare(*str) == 0); @@ -632,7 +632,7 @@ TEST_F(RegExpTest, ParseAndExec1) TEST_F(RegExpTest, ParseAndExec2) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); RegExpParser parser = RegExpParser(chunk_); CString source("(((ab)|(cd)|(de))|((ef)|(gh)|(jk)))"); parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 0); @@ -646,7 +646,7 @@ TEST_F(RegExpTest, ParseAndExec2) executor.Execute(reinterpret_cast(input.c_str()), 0, input.size(), parser.GetOriginBuffer()); ASSERT_TRUE(ret); - MatchResult result = executor.GetResult(thread, ret); + MatchResult result = executor.GetResult(thread_, ret); ASSERT_EQ(result.captures_.size(), 10); JSHandle str = factory->NewFromCanBeCompressString("ab"); ASSERT_TRUE(result.captures_[0].second->Compare(*str) == 0); @@ -663,7 +663,7 @@ TEST_F(RegExpTest, ParseAndExec2) TEST_F(RegExpTest, ParseAndExec3) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); RegExpParser parser = RegExpParser(chunk_); CString source("(aa|aabaac|ba|b|c)*"); parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 0); @@ -677,7 +677,7 @@ TEST_F(RegExpTest, ParseAndExec3) executor.Execute(reinterpret_cast(input.c_str()), 0, input.size(), parser.GetOriginBuffer()); ASSERT_TRUE(ret); - MatchResult result = executor.GetResult(thread, ret); + MatchResult result = executor.GetResult(thread_, ret); ASSERT_EQ(result.captures_.size(), 2); JSHandle str1 = factory->NewFromCanBeCompressString("aaba"); JSHandle str2 = factory->NewFromCanBeCompressString("ba"); @@ -687,7 +687,7 @@ TEST_F(RegExpTest, ParseAndExec3) TEST_F(RegExpTest, ParseAndExec4) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); RegExpParser parser = RegExpParser(chunk_); CString source("a*"); parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 0); @@ -701,7 +701,7 @@ TEST_F(RegExpTest, ParseAndExec4) executor.Execute(reinterpret_cast(input.c_str()), 0, input.size(), parser.GetOriginBuffer()); ASSERT_TRUE(ret); - MatchResult result = executor.GetResult(thread, ret); + MatchResult result = executor.GetResult(thread_, ret); ASSERT_EQ(result.captures_.size(), 1); JSHandle str = factory->NewFromCanBeCompressString("aa"); ASSERT_TRUE(result.captures_[0].second->Compare(*str) == 0); @@ -709,7 +709,7 @@ TEST_F(RegExpTest, ParseAndExec4) TEST_F(RegExpTest, ParseAndExec5) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); RegExpParser parser = RegExpParser(chunk_); CString source("a?"); parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 0); @@ -723,7 +723,7 @@ TEST_F(RegExpTest, ParseAndExec5) executor.Execute(reinterpret_cast(input.c_str()), 0, input.size(), parser.GetOriginBuffer()); ASSERT_TRUE(ret); - MatchResult result = executor.GetResult(thread, ret); + MatchResult result = executor.GetResult(thread_, ret); ASSERT_EQ(result.captures_.size(), 1); JSHandle str = factory->NewFromCanBeCompressString(""); ASSERT_TRUE(result.captures_[0].second->Compare(*str) == 0); @@ -731,7 +731,7 @@ TEST_F(RegExpTest, ParseAndExec5) TEST_F(RegExpTest, ParseAndExec6) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); RegExpParser parser = RegExpParser(chunk_); CString source("(z)((a+)?(b+)?(c))*"); parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 0); @@ -745,7 +745,7 @@ TEST_F(RegExpTest, ParseAndExec6) executor.Execute(reinterpret_cast(input.c_str()), 0, input.size(), parser.GetOriginBuffer()); ASSERT_TRUE(ret); - MatchResult result = executor.GetResult(thread, ret); + MatchResult result = executor.GetResult(thread_, ret); ASSERT_EQ(result.captures_.size(), 6); JSHandle str1 = factory->NewFromCanBeCompressString("zaacbbbcac"); JSHandle str2 = factory->NewFromCanBeCompressString("z"); @@ -762,7 +762,7 @@ TEST_F(RegExpTest, ParseAndExec6) TEST_F(RegExpTest, ParseAndExec7) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); RegExpParser parser = RegExpParser(chunk_); CString source("^abc"); parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 4); @@ -776,7 +776,7 @@ TEST_F(RegExpTest, ParseAndExec7) executor.Execute(reinterpret_cast(input.c_str()), 0, input.size(), parser.GetOriginBuffer()); ASSERT_TRUE(ret); - MatchResult result = executor.GetResult(thread, ret); + MatchResult result = executor.GetResult(thread_, ret); ASSERT_EQ(result.captures_.size(), 1); JSHandle str = factory->NewFromCanBeCompressString("abc"); ASSERT_TRUE(result.captures_[0].second->Compare(*str) == 0); @@ -784,7 +784,7 @@ TEST_F(RegExpTest, ParseAndExec7) TEST_F(RegExpTest, ParseAndExec8) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); RegExpParser parser = RegExpParser(chunk_); CString source("abc$"); parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 4); @@ -798,7 +798,7 @@ TEST_F(RegExpTest, ParseAndExec8) executor.Execute(reinterpret_cast(input.c_str()), 0, input.size(), parser.GetOriginBuffer()); ASSERT_TRUE(ret); - MatchResult result = executor.GetResult(thread, ret); + MatchResult result = executor.GetResult(thread_, ret); ASSERT_EQ(result.captures_.size(), 1); JSHandle str = factory->NewFromCanBeCompressString("abc"); ASSERT_TRUE(result.captures_[0].second->Compare(*str) == 0); @@ -806,7 +806,7 @@ TEST_F(RegExpTest, ParseAndExec8) TEST_F(RegExpTest, ParseAndExec9) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); RegExpParser parser = RegExpParser(chunk_); CString source("er\\B"); parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 0); @@ -820,7 +820,7 @@ TEST_F(RegExpTest, ParseAndExec9) executor.Execute(reinterpret_cast(input.c_str()), 0, input.size(), parser.GetOriginBuffer()); ASSERT_TRUE(ret); - MatchResult result = executor.GetResult(thread, ret); + MatchResult result = executor.GetResult(thread_, ret); ASSERT_EQ(result.captures_.size(), 1); JSHandle str = factory->NewFromCanBeCompressString("er"); ASSERT_TRUE(result.captures_[0].second->Compare(*str) == 0); @@ -828,7 +828,7 @@ TEST_F(RegExpTest, ParseAndExec9) TEST_F(RegExpTest, ParseAndExec10) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); RegExpParser parser = RegExpParser(chunk_); CString source("d\\b"); parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 0); @@ -842,7 +842,7 @@ TEST_F(RegExpTest, ParseAndExec10) executor.Execute(reinterpret_cast(input.c_str()), 0, input.size(), parser.GetOriginBuffer()); ASSERT_TRUE(ret); - MatchResult result = executor.GetResult(thread, ret); + MatchResult result = executor.GetResult(thread_, ret); ASSERT_EQ(result.captures_.size(), 1); JSHandle str = factory->NewFromCanBeCompressString("d"); ASSERT_TRUE(result.captures_[0].second->Compare(*str) == 0); @@ -850,7 +850,7 @@ TEST_F(RegExpTest, ParseAndExec10) TEST_F(RegExpTest, ParseAndExec11) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); RegExpParser parser = RegExpParser(chunk_); CString source("."); parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 0); @@ -864,7 +864,7 @@ TEST_F(RegExpTest, ParseAndExec11) executor.Execute(reinterpret_cast(input.c_str()), 0, input.size(), parser.GetOriginBuffer()); ASSERT_TRUE(ret); - MatchResult result = executor.GetResult(thread, ret); + MatchResult result = executor.GetResult(thread_, ret); ASSERT_EQ(result.captures_.size(), 1); JSHandle str = factory->NewFromCanBeCompressString("a"); ASSERT_TRUE(result.captures_[0].second->Compare(*str) == 0); @@ -872,7 +872,7 @@ TEST_F(RegExpTest, ParseAndExec11) TEST_F(RegExpTest, ParseAndExec12) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); RegExpParser parser = RegExpParser(chunk_); CString source("."); parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 8); @@ -886,7 +886,7 @@ TEST_F(RegExpTest, ParseAndExec12) executor.Execute(reinterpret_cast(input.c_str()), 0, input.size(), parser.GetOriginBuffer()); ASSERT_TRUE(ret); - MatchResult result = executor.GetResult(thread, ret); + MatchResult result = executor.GetResult(thread_, ret); ASSERT_EQ(result.captures_.size(), 1); JSHandle str = factory->NewFromCanBeCompressString("\n"); ASSERT_TRUE(result.captures_[0].second->Compare(*str) == 0); @@ -894,7 +894,7 @@ TEST_F(RegExpTest, ParseAndExec12) TEST_F(RegExpTest, ParseAndExec13) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); RegExpParser parser = RegExpParser(chunk_); CString source("abc"); parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 4); @@ -908,7 +908,7 @@ TEST_F(RegExpTest, ParseAndExec13) executor.Execute(reinterpret_cast(input.c_str()), 0, input.size(), parser.GetOriginBuffer()); ASSERT_TRUE(ret); - MatchResult result = executor.GetResult(thread, ret); + MatchResult result = executor.GetResult(thread_, ret); ASSERT_EQ(result.captures_.size(), 1); JSHandle str = factory->NewFromCanBeCompressString("abc"); ASSERT_TRUE(result.captures_[0].second->Compare(*str) == 0); @@ -916,7 +916,7 @@ TEST_F(RegExpTest, ParseAndExec13) TEST_F(RegExpTest, ParseAndExec14) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); RegExpParser parser = RegExpParser(chunk_); CString source("abc"); parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 4); @@ -930,7 +930,7 @@ TEST_F(RegExpTest, ParseAndExec14) executor.Execute(reinterpret_cast(input.c_str()), 0, input.size(), parser.GetOriginBuffer()); ASSERT_TRUE(ret); - MatchResult result = executor.GetResult(thread, ret); + MatchResult result = executor.GetResult(thread_, ret); ASSERT_EQ(result.captures_.size(), 1); JSHandle str = factory->NewFromCanBeCompressString("abc"); ASSERT_TRUE(result.captures_[0].second->Compare(*str) == 0); @@ -938,7 +938,7 @@ TEST_F(RegExpTest, ParseAndExec14) TEST_F(RegExpTest, ParseAndExec15) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); RegExpParser parser = RegExpParser(chunk_); CString source("a(?=a)"); parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 0); @@ -952,7 +952,7 @@ TEST_F(RegExpTest, ParseAndExec15) executor.Execute(reinterpret_cast(input.c_str()), 0, input.size(), parser.GetOriginBuffer()); ASSERT_TRUE(ret); - MatchResult result = executor.GetResult(thread, ret); + MatchResult result = executor.GetResult(thread_, ret); ASSERT_EQ(result.captures_.size(), 1); JSHandle str = factory->NewFromCanBeCompressString("a"); ASSERT_TRUE(result.captures_[0].second->Compare(*str) == 0); @@ -960,7 +960,7 @@ TEST_F(RegExpTest, ParseAndExec15) TEST_F(RegExpTest, ParseAndExec16) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); RegExpParser parser = RegExpParser(chunk_); CString source("abc"); parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 2); @@ -974,7 +974,7 @@ TEST_F(RegExpTest, ParseAndExec16) executor.Execute(reinterpret_cast(input.c_str()), 0, input.size(), parser.GetOriginBuffer()); ASSERT_TRUE(ret); - MatchResult result = executor.GetResult(thread, ret); + MatchResult result = executor.GetResult(thread_, ret); ASSERT_EQ(result.captures_.size(), 1); JSHandle str = factory->NewFromCanBeCompressString("ABC"); ASSERT_TRUE(result.captures_[0].second->Compare(*str) == 0); @@ -982,7 +982,7 @@ TEST_F(RegExpTest, ParseAndExec16) TEST_F(RegExpTest, ParseAndExec17) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); RegExpParser parser = RegExpParser(chunk_); CString source("a\\n"); parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 2); @@ -996,7 +996,7 @@ TEST_F(RegExpTest, ParseAndExec17) executor.Execute(reinterpret_cast(input.c_str()), 0, input.size(), parser.GetOriginBuffer()); ASSERT_TRUE(ret); - MatchResult result = executor.GetResult(thread, ret); + MatchResult result = executor.GetResult(thread_, ret); ASSERT_EQ(result.captures_.size(), 1); JSHandle str = factory->NewFromCanBeCompressString("a\n"); ASSERT_TRUE(result.captures_[0].second->Compare(*str) == 0); @@ -1020,7 +1020,7 @@ TEST_F(RegExpTest, ParseAndExec18) TEST_F(RegExpTest, ParseAndExec19) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); RegExpParser parser = RegExpParser(chunk_); CString source("a(?!a)"); parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 0); @@ -1034,7 +1034,7 @@ TEST_F(RegExpTest, ParseAndExec19) executor.Execute(reinterpret_cast(input.c_str()), 0, input.size(), parser.GetOriginBuffer()); ASSERT_TRUE(ret); - MatchResult result = executor.GetResult(thread, ret); + MatchResult result = executor.GetResult(thread_, ret); ASSERT_EQ(result.captures_.size(), 1); JSHandle str = factory->NewFromCanBeCompressString("a"); ASSERT_TRUE(result.captures_[0].second->Compare(*str) == 0); @@ -1042,7 +1042,7 @@ TEST_F(RegExpTest, ParseAndExec19) TEST_F(RegExpTest, ParseAndExec20) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); RegExpParser parser = RegExpParser(chunk_); CString source("(?=(a+))"); parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 0); @@ -1056,7 +1056,7 @@ TEST_F(RegExpTest, ParseAndExec20) executor.Execute(reinterpret_cast(input.c_str()), 0, input.size(), parser.GetOriginBuffer()); ASSERT_TRUE(ret); - MatchResult result = executor.GetResult(thread, ret); + MatchResult result = executor.GetResult(thread_, ret); ASSERT_EQ(result.captures_.size(), 2); JSHandle str1 = factory->NewFromCanBeCompressString(""); JSHandle str2 = factory->NewFromCanBeCompressString("aaa"); @@ -1066,7 +1066,7 @@ TEST_F(RegExpTest, ParseAndExec20) TEST_F(RegExpTest, ParseAndExec21) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); RegExpParser parser = RegExpParser(chunk_); CString source("a(?=a(?=b))"); parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 0); @@ -1080,7 +1080,7 @@ TEST_F(RegExpTest, ParseAndExec21) executor.Execute(reinterpret_cast(input.c_str()), 0, input.size(), parser.GetOriginBuffer()); ASSERT_TRUE(ret); - MatchResult result = executor.GetResult(thread, ret); + MatchResult result = executor.GetResult(thread_, ret); ASSERT_EQ(result.captures_.size(), 1); JSHandle str = factory->NewFromCanBeCompressString("a"); ASSERT_TRUE(result.captures_[0].second->Compare(*str) == 0); @@ -1088,7 +1088,7 @@ TEST_F(RegExpTest, ParseAndExec21) TEST_F(RegExpTest, ParseAndExec22) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); RegExpParser parser = RegExpParser(chunk_); CString source(".+:"); parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 0); @@ -1102,7 +1102,7 @@ TEST_F(RegExpTest, ParseAndExec22) executor.Execute(reinterpret_cast(input.c_str()), 0, input.size(), parser.GetOriginBuffer()); ASSERT_TRUE(ret); - MatchResult result = executor.GetResult(thread, ret); + MatchResult result = executor.GetResult(thread_, ret); ASSERT_EQ(result.captures_.size(), 1); JSHandle str = factory->NewFromCanBeCompressString("aaaa:"); ASSERT_TRUE(result.captures_[0].second->Compare(*str) == 0); @@ -1110,7 +1110,7 @@ TEST_F(RegExpTest, ParseAndExec22) TEST_F(RegExpTest, ParseAndExec23) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); RegExpParser parser = RegExpParser(chunk_); CString source("a(?<=a(?(reinterpret_cast(source.c_str())), source.size(), 0); @@ -1124,7 +1124,7 @@ TEST_F(RegExpTest, ParseAndExec23) executor.Execute(reinterpret_cast(input.c_str()), 0, input.size(), parser.GetOriginBuffer()); ASSERT_TRUE(ret); - MatchResult result = executor.GetResult(thread, ret); + MatchResult result = executor.GetResult(thread_, ret); ASSERT_EQ(result.captures_.size(), 1); JSHandle str = factory->NewFromCanBeCompressString("a"); ASSERT_TRUE(result.captures_[0].second->Compare(*str) == 0); @@ -1148,7 +1148,7 @@ TEST_F(RegExpTest, ParseAndExec24) TEST_F(RegExpTest, ParseAndExec25) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); RegExpParser parser = RegExpParser(chunk_); CString source("(?<=(ab))"); parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 0); @@ -1162,7 +1162,7 @@ TEST_F(RegExpTest, ParseAndExec25) executor.Execute(reinterpret_cast(input.c_str()), 0, input.size(), parser.GetOriginBuffer()); ASSERT_TRUE(ret); - MatchResult result = executor.GetResult(thread, ret); + MatchResult result = executor.GetResult(thread_, ret); ASSERT_EQ(result.captures_.size(), 2); JSHandle str1 = factory->NewFromCanBeCompressString(""); JSHandle str2 = factory->NewFromCanBeCompressString("ab"); @@ -1172,7 +1172,7 @@ TEST_F(RegExpTest, ParseAndExec25) TEST_F(RegExpTest, ParseAndExec26) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); RegExpParser parser = RegExpParser(chunk_); CString source("[a-z]"); parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 2); @@ -1186,7 +1186,7 @@ TEST_F(RegExpTest, ParseAndExec26) executor.Execute(reinterpret_cast(input.c_str()), 0, input.size(), parser.GetOriginBuffer()); ASSERT_TRUE(ret); - MatchResult result = executor.GetResult(thread, ret); + MatchResult result = executor.GetResult(thread_, ret); ASSERT_EQ(result.captures_.size(), 1); JSHandle str = factory->NewFromCanBeCompressString("A"); ASSERT_TRUE(result.captures_[0].second->Compare(*str) == 0); @@ -1194,7 +1194,7 @@ TEST_F(RegExpTest, ParseAndExec26) TEST_F(RegExpTest, ParseAndExec27) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); RegExpParser parser = RegExpParser(chunk_); CString source("[^a-b]"); parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 2); @@ -1208,7 +1208,7 @@ TEST_F(RegExpTest, ParseAndExec27) executor.Execute(reinterpret_cast(input.c_str()), 0, input.size(), parser.GetOriginBuffer()); ASSERT_TRUE(ret); - MatchResult result = executor.GetResult(thread, ret); + MatchResult result = executor.GetResult(thread_, ret); ASSERT_EQ(result.captures_.size(), 1); JSHandle str = factory->NewFromCanBeCompressString("Z"); ASSERT_TRUE(result.captures_[0].second->Compare(*str) == 0); @@ -1216,7 +1216,7 @@ TEST_F(RegExpTest, ParseAndExec27) TEST_F(RegExpTest, ParseAndExec28) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); RegExpParser parser = RegExpParser(chunk_); CString source("\\s"); parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 0); @@ -1230,7 +1230,7 @@ TEST_F(RegExpTest, ParseAndExec28) executor.Execute(reinterpret_cast(input.c_str()), 0, input.size(), parser.GetOriginBuffer()); ASSERT_TRUE(ret); - MatchResult result = executor.GetResult(thread, ret); + MatchResult result = executor.GetResult(thread_, ret); ASSERT_EQ(result.captures_.size(), 1); JSHandle str = factory->NewFromCanBeCompressString("\n"); ASSERT_TRUE(result.captures_[0].second->Compare(*str) == 0); @@ -1238,7 +1238,7 @@ TEST_F(RegExpTest, ParseAndExec28) TEST_F(RegExpTest, ParseAndExec29) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); RegExpParser parser = RegExpParser(chunk_); CString source("()|"); parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 0); @@ -1252,7 +1252,7 @@ TEST_F(RegExpTest, ParseAndExec29) executor.Execute(reinterpret_cast(input.c_str()), 0, input.size(), parser.GetOriginBuffer()); ASSERT_TRUE(ret); - MatchResult result = executor.GetResult(thread, ret); + MatchResult result = executor.GetResult(thread_, ret); ASSERT_EQ(result.captures_.size(), 2); JSHandle str = factory->NewFromCanBeCompressString(""); ASSERT_TRUE(result.captures_[0].second->Compare(*str) == 0); @@ -1261,7 +1261,7 @@ TEST_F(RegExpTest, ParseAndExec29) TEST_F(RegExpTest, ParseAndExec30) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); RegExpParser parser = RegExpParser(chunk_); CString source("|()"); parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 0); @@ -1275,7 +1275,7 @@ TEST_F(RegExpTest, ParseAndExec30) executor.Execute(reinterpret_cast(input.c_str()), 0, input.size(), parser.GetOriginBuffer()); ASSERT_TRUE(ret); - MatchResult result = executor.GetResult(thread, ret); + MatchResult result = executor.GetResult(thread_, ret); ASSERT_EQ(result.captures_.size(), 2); JSHandle str = factory->NewFromCanBeCompressString(""); ASSERT_TRUE(result.captures_[0].second->Compare(*str) == 0); @@ -1284,7 +1284,7 @@ TEST_F(RegExpTest, ParseAndExec30) TEST_F(RegExpTest, ParseAndExec31) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); RegExpParser parser = RegExpParser(chunk_); CString source("a(a|b)\\1"); parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 2); @@ -1296,7 +1296,7 @@ TEST_F(RegExpTest, ParseAndExec31) bool ret = executor.Execute(reinterpret_cast(input.c_str()), 0, input.length(), parser.GetOriginBuffer()); ASSERT_TRUE(ret); - MatchResult result = executor.GetResult(thread, ret); + MatchResult result = executor.GetResult(thread_, ret); ASSERT_EQ(result.captures_.size(), 2); JSHandle str1 = factory->NewFromCanBeCompressString("abb"); JSHandle str2 = factory->NewFromCanBeCompressString("b"); @@ -1306,7 +1306,7 @@ TEST_F(RegExpTest, ParseAndExec31) TEST_F(RegExpTest, ParseAndExec32) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); RegExpParser parser = RegExpParser(chunk_); CString source("(a(a|b))\\2"); parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 2); @@ -1318,7 +1318,7 @@ TEST_F(RegExpTest, ParseAndExec32) bool ret = executor.Execute(reinterpret_cast(input.c_str()), 0, input.length(), parser.GetOriginBuffer()); ASSERT_TRUE(ret); - MatchResult result = executor.GetResult(thread, ret); + MatchResult result = executor.GetResult(thread_, ret); ASSERT_EQ(result.captures_.size(), 3); JSHandle str1 = factory->NewFromCanBeCompressString("abb"); JSHandle str2 = factory->NewFromCanBeCompressString("ab"); @@ -1330,7 +1330,7 @@ TEST_F(RegExpTest, ParseAndExec32) TEST_F(RegExpTest, ParseAndExec33) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); RegExpParser parser = RegExpParser(chunk_); CString source("qya+"); parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 2); @@ -1342,7 +1342,7 @@ TEST_F(RegExpTest, ParseAndExec33) bool ret = executor.Execute(reinterpret_cast(input.c_str()), 0, input.length(), parser.GetOriginBuffer()); ASSERT_TRUE(ret); - MatchResult result = executor.GetResult(thread, ret); + MatchResult result = executor.GetResult(thread_, ret); ASSERT_EQ(result.captures_.size(), 1); JSHandle str = factory->NewFromCanBeCompressString("qya"); ASSERT_TRUE(result.captures_[0].second->Compare(*str) == 0); @@ -1350,7 +1350,7 @@ TEST_F(RegExpTest, ParseAndExec33) TEST_F(RegExpTest, ParseAndExec34) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); RegExpParser parser = RegExpParser(chunk_); CString source("qy(?=\\s+)"); parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 2); @@ -1362,7 +1362,7 @@ TEST_F(RegExpTest, ParseAndExec34) bool ret = executor.Execute(reinterpret_cast(input.c_str()), 0, input.length(), parser.GetOriginBuffer()); ASSERT_TRUE(ret); - MatchResult result = executor.GetResult(thread, ret); + MatchResult result = executor.GetResult(thread_, ret); ASSERT_EQ(result.captures_.size(), 1); JSHandle str = factory->NewFromCanBeCompressString("qy"); ASSERT_TRUE(result.captures_[0].second->Compare(*str) == 0); @@ -1370,7 +1370,7 @@ TEST_F(RegExpTest, ParseAndExec34) TEST_F(RegExpTest, ParseAndExec35) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); RegExpParser parser = RegExpParser(chunk_); CString source("(\\d{4})-(\\d{2})-(\\d{2})"); parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 2); @@ -1382,7 +1382,7 @@ TEST_F(RegExpTest, ParseAndExec35) bool ret = executor.Execute(reinterpret_cast(input.c_str()), 0, input.length(), parser.GetOriginBuffer()); ASSERT_TRUE(ret); - MatchResult result = executor.GetResult(thread, ret); + MatchResult result = executor.GetResult(thread_, ret); ASSERT_EQ(result.captures_.size(), 4); JSHandle str1 = factory->NewFromCanBeCompressString("2021-01-09"); JSHandle str2 = factory->NewFromCanBeCompressString("2021"); @@ -1396,7 +1396,7 @@ TEST_F(RegExpTest, ParseAndExec35) TEST_F(RegExpTest, ParseAndExec36) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); RegExpParser parser = RegExpParser(chunk_); CString source("quick\\s(brown).+?(jumps)"); parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 2); @@ -1408,7 +1408,7 @@ TEST_F(RegExpTest, ParseAndExec36) bool ret = executor.Execute(reinterpret_cast(input.c_str()), 0, input.length(), parser.GetOriginBuffer()); ASSERT_TRUE(ret); - MatchResult result = executor.GetResult(thread, ret); + MatchResult result = executor.GetResult(thread_, ret); ASSERT_EQ(result.captures_.size(), 3); JSHandle str1 = factory->NewFromCanBeCompressString("Quick Brown Fox Jumps"); JSHandle str2 = factory->NewFromCanBeCompressString("Brown"); @@ -1420,7 +1420,7 @@ TEST_F(RegExpTest, ParseAndExec36) TEST_F(RegExpTest, ParseAndExec37) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); RegExpParser parser = RegExpParser(chunk_); CString source("(ab){1,2}?c"); parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 2); @@ -1432,7 +1432,7 @@ TEST_F(RegExpTest, ParseAndExec37) bool ret = executor.Execute(reinterpret_cast(input.c_str()), 0, input.length(), parser.GetOriginBuffer()); ASSERT_TRUE(ret); - MatchResult result = executor.GetResult(thread, ret); + MatchResult result = executor.GetResult(thread_, ret); ASSERT_EQ(result.captures_.size(), 2); JSHandle str1 = factory->NewFromCanBeCompressString("abABc"); JSHandle str2 = factory->NewFromCanBeCompressString("AB"); @@ -1442,7 +1442,7 @@ TEST_F(RegExpTest, ParseAndExec37) TEST_F(RegExpTest, ParseAndExec38) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); RegExpParser parser = RegExpParser(chunk_); CString source("^(([a-z]+)*[a-z]\\.)+[a-z]{2,}$"); parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 0); @@ -1454,7 +1454,7 @@ TEST_F(RegExpTest, ParseAndExec38) bool ret = executor.Execute(reinterpret_cast(input.c_str()), 0, input.length(), parser.GetOriginBuffer()); ASSERT_TRUE(ret); - MatchResult result = executor.GetResult(thread, ret); + MatchResult result = executor.GetResult(thread_, ret); ASSERT_EQ(result.captures_.size(), 3); JSHandle str1 = factory->NewFromCanBeCompressString("www.netscape.com"); JSHandle str2 = factory->NewFromCanBeCompressString("netscape."); @@ -1466,7 +1466,7 @@ TEST_F(RegExpTest, ParseAndExec38) TEST_F(RegExpTest, ParseAndExec39) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); RegExpParser parser = RegExpParser(chunk_); CString source("(a*)b\\1+"); parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 0); @@ -1478,7 +1478,7 @@ TEST_F(RegExpTest, ParseAndExec39) bool ret = executor.Execute(reinterpret_cast(input.c_str()), 0, input.length(), parser.GetOriginBuffer()); ASSERT_TRUE(ret); - MatchResult result = executor.GetResult(thread, ret); + MatchResult result = executor.GetResult(thread_, ret); ASSERT_EQ(result.captures_.size(), 2); JSHandle str1 = factory->NewFromCanBeCompressString("b"); JSHandle str2 = factory->NewFromCanBeCompressString(""); @@ -1488,7 +1488,7 @@ TEST_F(RegExpTest, ParseAndExec39) TEST_F(RegExpTest, ParseAndExec40) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); RegExpParser parser = RegExpParser(chunk_); CString source("a*?"); parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 0); @@ -1500,7 +1500,7 @@ TEST_F(RegExpTest, ParseAndExec40) bool ret = executor.Execute(reinterpret_cast(input.c_str()), 0, input.length(), parser.GetOriginBuffer()); ASSERT_TRUE(ret); - MatchResult result = executor.GetResult(thread, ret); + MatchResult result = executor.GetResult(thread_, ret); ASSERT_EQ(result.captures_.size(), 1); JSHandle str = factory->NewFromCanBeCompressString(""); ASSERT_TRUE(result.captures_[0].second->Compare(*str) == 0); @@ -1508,7 +1508,7 @@ TEST_F(RegExpTest, ParseAndExec40) TEST_F(RegExpTest, ParseAndExec41) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); RegExpParser parser = RegExpParser(chunk_); CString source("(.*?)a(?!(a+)b\\2c)\\2(.*)"); parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 0); @@ -1520,7 +1520,7 @@ TEST_F(RegExpTest, ParseAndExec41) bool ret = executor.Execute(reinterpret_cast(input.c_str()), 0, input.length(), parser.GetOriginBuffer()); ASSERT_TRUE(ret); - MatchResult result = executor.GetResult(thread, ret); + MatchResult result = executor.GetResult(thread_, ret); ASSERT_EQ(result.captures_.size(), 4); JSHandle str1 = factory->NewFromCanBeCompressString("baaabaac"); JSHandle str2 = factory->NewFromCanBeCompressString("ba"); @@ -1533,7 +1533,7 @@ TEST_F(RegExpTest, ParseAndExec41) TEST_F(RegExpTest, ParseAndExec42) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); RegExpParser parser = RegExpParser(chunk_); CString source("[a-c\\d]+"); parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 0); @@ -1545,7 +1545,7 @@ TEST_F(RegExpTest, ParseAndExec42) bool ret = executor.Execute(reinterpret_cast(input.c_str()), 0, input.length(), parser.GetOriginBuffer()); ASSERT_TRUE(ret); - MatchResult result = executor.GetResult(thread, ret); + MatchResult result = executor.GetResult(thread_, ret); ASSERT_EQ(result.captures_.size(), 1); JSHandle str = factory->NewFromCanBeCompressString("abc324234"); ASSERT_TRUE(result.captures_[0].second->Compare(*str) == 0); @@ -1553,7 +1553,7 @@ TEST_F(RegExpTest, ParseAndExec42) TEST_F(RegExpTest, ParseAndExec43) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); RegExpParser parser = RegExpParser(chunk_); CString source("[\\d][\n][^\\d]"); parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 0); @@ -1565,7 +1565,7 @@ TEST_F(RegExpTest, ParseAndExec43) bool ret = executor.Execute(reinterpret_cast(input.c_str()), 0, input.length(), parser.GetOriginBuffer()); ASSERT_TRUE(ret); - MatchResult result = executor.GetResult(thread, ret); + MatchResult result = executor.GetResult(thread_, ret); ASSERT_EQ(result.captures_.size(), 1); JSHandle str = factory->NewFromCanBeCompressString("1\nl"); ASSERT_TRUE(result.captures_[0].second->Compare(*str) == 0); @@ -1573,7 +1573,7 @@ TEST_F(RegExpTest, ParseAndExec43) TEST_F(RegExpTest, ParseAndExec44) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); RegExpParser parser = RegExpParser(chunk_); CString source(".[\b]."); parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 0); @@ -1585,7 +1585,7 @@ TEST_F(RegExpTest, ParseAndExec44) bool ret = executor.Execute(reinterpret_cast(input.c_str()), 0, input.length(), parser.GetOriginBuffer()); ASSERT_TRUE(ret); - MatchResult result = executor.GetResult(thread, ret); + MatchResult result = executor.GetResult(thread_, ret); ASSERT_EQ(result.captures_.size(), 1); JSHandle str = factory->NewFromCanBeCompressString("c\bd"); ASSERT_TRUE(result.captures_[0].second->Compare(*str) == 0); @@ -1593,7 +1593,7 @@ TEST_F(RegExpTest, ParseAndExec44) TEST_F(RegExpTest, ParseAndExec45) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); RegExpParser parser = RegExpParser(chunk_); CString source("[^\b]+"); parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 0); @@ -1605,7 +1605,7 @@ TEST_F(RegExpTest, ParseAndExec45) bool ret = executor.Execute(reinterpret_cast(input.c_str()), 0, input.length(), parser.GetOriginBuffer()); ASSERT_TRUE(ret); - MatchResult result = executor.GetResult(thread, ret); + MatchResult result = executor.GetResult(thread_, ret); ASSERT_EQ(result.captures_.size(), 1); JSHandle str = factory->NewFromCanBeCompressString("easy"); ASSERT_TRUE(result.captures_[0].second->Compare(*str) == 0); @@ -1613,7 +1613,7 @@ TEST_F(RegExpTest, ParseAndExec45) TEST_F(RegExpTest, ParseAndExec46) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); RegExpParser parser = RegExpParser(chunk_); CString source("([\\S]+([ \t]+[\\S]+)*)[ \t]*=[ \t]*[\\S]+"); parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 0); @@ -1625,7 +1625,7 @@ TEST_F(RegExpTest, ParseAndExec46) bool ret = executor.Execute(reinterpret_cast(input.c_str()), 0, input.length(), parser.GetOriginBuffer()); ASSERT_TRUE(ret); - MatchResult result = executor.GetResult(thread, ret); + MatchResult result = executor.GetResult(thread_, ret); ASSERT_EQ(result.captures_.size(), 3); JSHandle str1 = factory->NewFromCanBeCompressString("Course_Creator = Test"); JSHandle str2 = factory->NewFromCanBeCompressString("Course_Creator"); @@ -1637,7 +1637,7 @@ TEST_F(RegExpTest, ParseAndExec46) TEST_F(RegExpTest, ParseAndExec47) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); RegExpParser parser = RegExpParser(chunk_); CString source("[^o]t\\b"); parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 2); @@ -1649,7 +1649,7 @@ TEST_F(RegExpTest, ParseAndExec47) bool ret = executor.Execute(reinterpret_cast(input.c_str()), 0, input.length(), parser.GetOriginBuffer()); ASSERT_TRUE(ret); - MatchResult result = executor.GetResult(thread, ret); + MatchResult result = executor.GetResult(thread_, ret); ASSERT_EQ(result.captures_.size(), 1); JSHandle str = factory->NewFromCanBeCompressString("et"); ASSERT_TRUE(result.captures_[0].second->Compare(*str) == 0); @@ -1657,7 +1657,7 @@ TEST_F(RegExpTest, ParseAndExec47) TEST_F(RegExpTest, ParseAndExec49) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); RegExpParser parser = RegExpParser(chunk_); CString source("(a(b)\\4(5)(5))"); parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 2); @@ -1669,7 +1669,7 @@ TEST_F(RegExpTest, ParseAndExec49) bool ret = executor.Execute(reinterpret_cast(input.c_str()), 0, input.length(), parser.GetOriginBuffer()); ASSERT_TRUE(ret); - MatchResult result = executor.GetResult(thread, ret); + MatchResult result = executor.GetResult(thread_, ret); ASSERT_EQ(result.captures_.size(), 5); JSHandle str1 = factory->NewFromCanBeCompressString("ab55"); JSHandle str2 = factory->NewFromCanBeCompressString("ab55"); @@ -1685,7 +1685,7 @@ TEST_F(RegExpTest, ParseAndExec49) TEST_F(RegExpTest, ParseAndExec50) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); RegExpParser parser = RegExpParser(chunk_); CString source("(?\\d{4})-(?\\d{2}-(?\\d\\d))"); parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 0); @@ -1697,7 +1697,7 @@ TEST_F(RegExpTest, ParseAndExec50) bool ret = executor.Execute(reinterpret_cast(input.c_str()), 0, input.length(), parser.GetOriginBuffer()); ASSERT_TRUE(ret); - MatchResult result = executor.GetResult(thread, ret); + MatchResult result = executor.GetResult(thread_, ret); ASSERT_EQ(result.captures_.size(), 4); JSHandle str1 = factory->NewFromCanBeCompressString("2020-12-31"); JSHandle str2 = factory->NewFromCanBeCompressString("2020"); @@ -1722,13 +1722,13 @@ TEST_F(RegExpTest, ParseAndExec51) bool ret = executor.Execute(reinterpret_cast(input.c_str()), 0, input.length() + 1, parser.GetOriginBuffer(), true); ASSERT_TRUE(ret); - MatchResult result = executor.GetResult(thread, ret); + MatchResult result = executor.GetResult(thread_, ret); ASSERT_EQ(result.captures_.size(), 1); } TEST_F(RegExpTest, ParseAndExec52) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); RegExpParser parser = RegExpParser(chunk_); CString source("(aa).+\\1"); parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 0); @@ -1740,7 +1740,7 @@ TEST_F(RegExpTest, ParseAndExec52) bool ret = executor.Execute(reinterpret_cast(input.c_str()), 0, input.length(), parser.GetOriginBuffer()); ASSERT_TRUE(ret); - MatchResult result = executor.GetResult(thread, ret); + MatchResult result = executor.GetResult(thread_, ret); ASSERT_EQ(result.captures_.size(), 2); JSHandle str1 = factory->NewFromCanBeCompressString("aabcdaa"); JSHandle str2 = factory->NewFromCanBeCompressString("aa"); @@ -1750,7 +1750,7 @@ TEST_F(RegExpTest, ParseAndExec52) TEST_F(RegExpTest, ParseAndExec53) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); RegExpParser parser = RegExpParser(chunk_); CString source("\\x01"); parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 0); @@ -1762,7 +1762,7 @@ TEST_F(RegExpTest, ParseAndExec53) bool ret = executor.Execute(reinterpret_cast(input.c_str()), 0, input.length(), parser.GetOriginBuffer(), true); ASSERT_TRUE(ret); - MatchResult result = executor.GetResult(thread, ret); + MatchResult result = executor.GetResult(thread_, ret); ASSERT_EQ(result.captures_.size(), 1); JSHandle str = factory->NewFromCanBeCompressString("\u0001"); ASSERT_TRUE(result.captures_[0].second->Compare(*str) == 0); @@ -1785,7 +1785,7 @@ TEST_F(RegExpTest, ParseAndExec54) TEST_F(RegExpTest, ParseAndExec55) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); RegExpParser parser = RegExpParser(chunk_); CString source("e\\b"); parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 0); @@ -1797,7 +1797,7 @@ TEST_F(RegExpTest, ParseAndExec55) bool ret = executor.Execute(reinterpret_cast(input.c_str()), 0, input.length(), parser.GetOriginBuffer(), false); ASSERT_TRUE(ret); - MatchResult result = executor.GetResult(thread, ret); + MatchResult result = executor.GetResult(thread_, ret); ASSERT_EQ(result.captures_.size(), 1); JSHandle str = factory->NewFromCanBeCompressString("e"); ASSERT_TRUE(result.captures_[0].second->Compare(*str) == 0); @@ -1805,7 +1805,7 @@ TEST_F(RegExpTest, ParseAndExec55) TEST_F(RegExpTest, ParseAndExec56) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); RegExpParser parser = RegExpParser(chunk_); CString source("a啊"); parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 0); @@ -1817,7 +1817,7 @@ TEST_F(RegExpTest, ParseAndExec56) bool ret = executor.Execute(reinterpret_cast(input.c_str()), 0, input.length(), parser.GetOriginBuffer(), true); ASSERT_TRUE(ret); - MatchResult result = executor.GetResult(thread, ret); + MatchResult result = executor.GetResult(thread_, ret); ASSERT_EQ(result.captures_.size(), 1); JSHandle str = factory->NewFromString("a啊"); ASSERT_TRUE(result.captures_[0].second->Compare(*str) == 0); @@ -1839,7 +1839,7 @@ TEST_F(RegExpTest, ParseAndExec57) TEST_F(RegExpTest, ParseAndExec58) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); RegExpParser parser = RegExpParser(chunk_); CString source("\\udf06"); parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 0); @@ -1850,7 +1850,7 @@ TEST_F(RegExpTest, ParseAndExec58) char16_t data[] = {0xd834, 0xdf06}; bool ret = executor.Execute(reinterpret_cast(data), 0, 2, parser.GetOriginBuffer(), true); ASSERT_TRUE(ret); - MatchResult result = executor.GetResult(thread, ret); + MatchResult result = executor.GetResult(thread_, ret); ASSERT_EQ(result.captures_.size(), 1); char16_t data1[] = {0xdf06}; JSHandle str = factory->NewFromUtf16UnCheck(reinterpret_cast(data1), 1, true); @@ -1859,7 +1859,7 @@ TEST_F(RegExpTest, ParseAndExec58) TEST_F(RegExpTest, ParseAndExec59) { - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); + ObjectFactory *factory = thread_->GetEcmaVM()->GetFactory(); RegExpParser parser = RegExpParser(chunk_); CString source("\\v"); parser.Init(const_cast(reinterpret_cast(source.c_str())), source.size(), 0); @@ -1873,7 +1873,7 @@ TEST_F(RegExpTest, ParseAndExec59) executor.Execute(reinterpret_cast(input.c_str()), 0, input.size(), parser.GetOriginBuffer()); ASSERT_TRUE(ret); - MatchResult result = executor.GetResult(thread, ret); + MatchResult result = executor.GetResult(thread_, ret); ASSERT_EQ(result.captures_.size(), 1); JSHandle str = factory->NewFromCanBeCompressString("\u000B"); ASSERT_TRUE(result.captures_[0].second->Compare(*str) == 0); diff --git a/tests/runtime/snapshot/snapshot_test.cpp b/tests/runtime/snapshot/snapshot_test.cpp index c531d65c500a63a167e76dbf7db561470cb62809..39d43361c7783ab0c6eacd5c41461d7f5180acc0 100644 --- a/tests/runtime/snapshot/snapshot_test.cpp +++ b/tests/runtime/snapshot/snapshot_test.cpp @@ -33,17 +33,17 @@ class SnapShotTest : public testing::Test { public: void SetUp() override { - TestHelper::CreateEcmaVMWithScope(instance, thread, scope); + TestHelper::CreateEcmaVMWithScope(instance_, thread_, scope_); } void TearDown() override { - TestHelper::DestroyEcmaVMWithScope(instance, scope); + TestHelper::DestroyEcmaVMWithScope(instance_, scope_); } - PandaVM *instance {nullptr}; - EcmaHandleScope *scope {nullptr}; - JSThread *thread; + PandaVM *instance_ {nullptr}; + EcmaHandleScope *scope_ {nullptr}; + JSThread *thread_; }; TEST_F(SnapShotTest, Serialize) {} diff --git a/tests/runtime/tooling/api_tests/js/js_breakpoint_test.h b/tests/runtime/tooling/api_tests/js/js_breakpoint_test.h index 03e6a5156493c88f31eaeabc3ff142317c607b7d..e7b99f48e598ae80ce55f88531781b71a7e1381e 100644 --- a/tests/runtime/tooling/api_tests/js/js_breakpoint_test.h +++ b/tests/runtime/tooling/api_tests/js/js_breakpoint_test.h @@ -23,30 +23,30 @@ class JsBreakpointTest : public ApiTest { public: JsBreakpointTest() { - vm_start = [this] { + vm_start_ = [this] { location_ = TestUtil::GetLocation("Sample.js", 22, panda_file_.c_str()); ASSERT_TRUE(location_.GetMethodId().IsValid()); return true; }; - breakpoint = [this](PtThread, Method *, const PtLocation &location) { + breakpoint_ = [this](PtThread, Method *, const PtLocation &location) { ASSERT_TRUE(location.GetMethodId().IsValid()); ASSERT_LOCATION_EQ(location, location_); ++breakpoint_counter_; return true; }; - load_module = [this](std::string_view moduleName) { + load_module_ = [this](std::string_view moduleName) { if (moduleName.find(panda_file_.c_str()) == std::string_view::npos) { return true; } - ASSERT_SUCCESS(debug_interface->SetBreakpoint(location_)); - auto error = debug_interface->SetBreakpoint(location_); + ASSERT_SUCCESS(debug_interface_->SetBreakpoint(location_)); + auto error = debug_interface_->SetBreakpoint(location_); ASSERT_FALSE(!error); return true; }; - vm_death = [this]() { + vm_death_ = [this]() { ASSERT_EQ(breakpoint_counter_, 2U); return true; }; diff --git a/tests/runtime/tooling/api_tests/js/js_enumerate_frames_test.h b/tests/runtime/tooling/api_tests/js/js_enumerate_frames_test.h index b2167f7ccbfc3d02c209ae898b9344f9108d0fd9..40d32b6f4e53d802e32e9eab2c95ee229e01547f 100644 --- a/tests/runtime/tooling/api_tests/js/js_enumerate_frames_test.h +++ b/tests/runtime/tooling/api_tests/js/js_enumerate_frames_test.h @@ -23,23 +23,23 @@ class JsEnumerateFrameTest : public ApiTest { public: JsEnumerateFrameTest() { - vm_death = [this]() { + vm_death_ = [this]() { ASSERT_EQ(count_frames_, 9U); return true; }; - method_exit = [this](PtThread thread, Method *method, bool, VRegValue) { + method_exit_ = [this](PtThread thread, Method *method, bool, VRegValue) { if (method->GetFullName() == "_GLOBAL::func_method3_3") { ASSERT_EQ(count_frames_, 0U); - debug_interface->EnumerateFrames(thread, callback); + debug_interface_->EnumerateFrames(thread, callback_); ASSERT_EQ(count_frames_, 4U); } else if (method->GetFullName() == "_GLOBAL::func_method2_2") { ASSERT_EQ(count_frames_, 4U); - debug_interface->EnumerateFrames(thread, callback); + debug_interface_->EnumerateFrames(thread, callback_); ASSERT_EQ(count_frames_, 7U); } else if (method->GetFullName() == "_GLOBAL::func_method1_1") { ASSERT_EQ(count_frames_, 7U); - debug_interface->EnumerateFrames(thread, callback); + debug_interface_->EnumerateFrames(thread, callback_); ASSERT_EQ(count_frames_, 9U); } return true; @@ -56,7 +56,7 @@ private: std::string entry_point_ = "_GLOBAL::func_main_0"; size_t count_frames_ = 0; - std::function callback {[this](const PtFrame &debugFrame) { + std::function callback_ {[this](const PtFrame &debugFrame) { this->count_frames_++; if (debugFrame.GetArgumentNum() != 1) return true; diff --git a/tests/runtime/tooling/api_tests/js/js_exception_events_test.h b/tests/runtime/tooling/api_tests/js/js_exception_events_test.h index fdce4363dc45185a54f06e5b1641e8ed6a0d674d..198dce5d4c703aa367569fab493037f2c67cd616 100644 --- a/tests/runtime/tooling/api_tests/js/js_exception_events_test.h +++ b/tests/runtime/tooling/api_tests/js/js_exception_events_test.h @@ -24,13 +24,13 @@ class JsExceptionEventTest : public ApiTest { public: JsExceptionEventTest() { - vm_death = [this]() { + vm_death_ = [this]() { ASSERT_EQ(exception_counter_, 1U); ASSERT_EQ(exception_catch_counter_, 1U); return true; }; - method_entry = [this](PtThread thread, Method *method) { + method_entry_ = [this](PtThread thread, Method *method) { if (method->GetFullName() == "_GLOBAL::func_main_0") { ASSERT_TRUE(thread_id_ == PtThread::NONE.GetId()); thread_id_ = thread.GetId(); @@ -38,15 +38,15 @@ public: return true; }; - method_exit = [this](PtThread, Method *method, bool, VRegValue) { + method_exit_ = [this](PtThread, Method *method, bool, VRegValue) { if (method->GetFullName() == "_GLOBAL::func_main_0") { thread_id_ = PtThread::NONE.GetId(); } return true; }; - exception = [this](PtThread thread, Method *, const PtLocation &, ObjectHeader *, Method *, - const PtLocation &catch_location) { + exception_ = [this](PtThread thread, Method *, const PtLocation &, ObjectHeader *, Method *, + const PtLocation &catch_location) { if (thread_id_ != thread.GetId()) { return true; } @@ -56,7 +56,7 @@ public: return true; }; - exception_catch = [this](PtThread thread, Method *, const PtLocation &location, ObjectHeader *) { + exception_catch_ = [this](PtThread thread, Method *, const PtLocation &location, ObjectHeader *) { if (thread_id_ != thread.GetId()) { return true; } diff --git a/tests/runtime/tooling/api_tests/js/js_frame_pop_test.h b/tests/runtime/tooling/api_tests/js/js_frame_pop_test.h index 9b1502fe7a065dbf8299e2d290fdab3f2765d65f..79b3a2349c0ac922ecbbc072415623af00ae2df6 100644 --- a/tests/runtime/tooling/api_tests/js/js_frame_pop_test.h +++ b/tests/runtime/tooling/api_tests/js/js_frame_pop_test.h @@ -23,19 +23,19 @@ class JsFramePopTest : public ApiTest { public: JsFramePopTest() { - vm_start = [this] { + vm_start_ = [this] { location_ = TestUtil::GetLocation("FramePop.js", 33, panda_file_.c_str()); ASSERT_TRUE(location_.GetMethodId().IsValid()); return true; }; - vm_death = [this] { + vm_death_ = [this] { ASSERT_EQ(breakpoint_counter_, 2U); ASSERT_EQ(frame_pop_counter_, 2U); return true; }; - scenario = [this]() { + scenario_ = [this]() { PtThread suspended = TestUtil::WaitForBreakpoint(location_); ASSERT_NE(suspended.GetId(), PtThread::NONE.GetId()); @@ -51,27 +51,27 @@ public: return true; }; - breakpoint = [this](PtThread thread, Method *, const PtLocation &location) { + breakpoint_ = [this](PtThread thread, Method *, const PtLocation &location) { ASSERT_TRUE(location.GetMethodId().IsValid()); ASSERT_LOCATION_EQ(location, location_); ++breakpoint_counter_; TestUtil::SuspendUntilContinue(DebugEvent::BREAKPOINT, thread, location); if (breakpoint_counter_ == 1) { - ASSERT_SUCCESS(debug_interface->NotifyFramePop(thread, 0)); - ASSERT_SUCCESS(debug_interface->NotifyFramePop(thread, 2)); + ASSERT_SUCCESS(debug_interface_->NotifyFramePop(thread, 0)); + ASSERT_SUCCESS(debug_interface_->NotifyFramePop(thread, 2)); } return true; }; - load_module = [this](std::string_view moduleName) { + load_module_ = [this](std::string_view moduleName) { if (moduleName.find(panda_file_.c_str()) == std::string_view::npos) { return true; } - ASSERT_SUCCESS(debug_interface->SetBreakpoint(location_)); + ASSERT_SUCCESS(debug_interface_->SetBreakpoint(location_)); return true; }; - frame_pop = [this](PtThread thread_id, Method *method, bool was_popped_by_exception) { + frame_pop_ = [this](PtThread thread_id, Method *method, bool was_popped_by_exception) { auto method_name = method->GetFullName(); if (method_name == "_GLOBAL::func_frame0_4") { ASSERT_EQ(frame_pop_counter_, 0U); diff --git a/tests/runtime/tooling/api_tests/js/js_get_current_frame_test.h b/tests/runtime/tooling/api_tests/js/js_get_current_frame_test.h index 129c99670c151f31ed08f1c0e7761ab00db48634..f71ad8bdfdc590eb5615ab0a672b90d3c5add5f9 100644 --- a/tests/runtime/tooling/api_tests/js/js_get_current_frame_test.h +++ b/tests/runtime/tooling/api_tests/js/js_get_current_frame_test.h @@ -23,26 +23,26 @@ class JsCurrentFrameTest : public ApiTest { public: JsCurrentFrameTest() { - vm_death = [this]() { + vm_death_ = [this]() { ASSERT_EQ(entry_, 111U); return true; }; - method_exit = [this](PtThread thread, Method *method, bool, VRegValue) { + method_exit_ = [this](PtThread thread, Method *method, bool, VRegValue) { if (method->GetFullName() == "_GLOBAL::func_method3_3") { ASSERT_EQ(entry_, 0U); entry_++; - auto frme = debug_interface->GetCurrentFrame(thread); + auto frme = debug_interface_->GetCurrentFrame(thread); ASSERT_EQ((*frme)->GetMethod(), method); } else if (method->GetFullName() == "_GLOBAL::func_method2_2") { ASSERT_EQ(entry_, 1U); entry_ += 10; - auto frme = debug_interface->GetCurrentFrame(thread); + auto frme = debug_interface_->GetCurrentFrame(thread); ASSERT_EQ((*frme)->GetMethod(), method); } else if (method->GetFullName() == "_GLOBAL::func_method1_1") { ASSERT_EQ(entry_, 11U); entry_ += 100U; - auto frme = debug_interface->GetCurrentFrame(thread); + auto frme = debug_interface_->GetCurrentFrame(thread); ASSERT_EQ((*frme)->GetMethod(), method); } return true; diff --git a/tests/runtime/tooling/api_tests/js/js_get_variable_test.h b/tests/runtime/tooling/api_tests/js/js_get_variable_test.h index 96f285850229ea182ae6f6990eff4da4e8639b8f..fc08cd3ee13fe57d913c04fc094c183697511ede 100644 --- a/tests/runtime/tooling/api_tests/js/js_get_variable_test.h +++ b/tests/runtime/tooling/api_tests/js/js_get_variable_test.h @@ -30,23 +30,23 @@ class JsGetVariableTest : public ApiTest { public: JsGetVariableTest() { - vm_death = [this]() { + vm_death_ = [this]() { const int expectedCount = 1; ASSERT_EQ(count_checker_, expectedCount); return true; }; - load_module = [this](std::string_view moduleName) { + load_module_ = [this](std::string_view moduleName) { if (moduleName.find(panda_file_.c_str()) == std::string_view::npos) { return true; } auto location = TestUtil::GetLocation("GetVariable.js", 19, panda_file_.c_str()); // getVariable ASSERT_TRUE(location.GetMethodId().IsValid()); - ASSERT_SUCCESS(debug_interface->SetBreakpoint(location)); + ASSERT_SUCCESS(debug_interface_->SetBreakpoint(location)); return true; }; - breakpoint = [this](PtThread thread, Method *method, const PtLocation &location) { + breakpoint_ = [this](PtThread thread, Method *method, const PtLocation &location) { ASSERT_TRUE(CheckSetValues(thread, method, location.GetBytecodeOffset())); return true; }; @@ -97,7 +97,7 @@ public: int32_t argNumber = TestUtil::GetValueRegister(method, "bl1", offset); for (auto checker : checkersList) { VRegValue vregValue; - ASSERT_SUCCESS(debug_interface->GetVariable(thread, frameDepth, argNumber++, &vregValue)); + ASSERT_SUCCESS(debug_interface_->GetVariable(thread, frameDepth, argNumber++, &vregValue)); ASSERT_TRUE(checker(ecmascript::PtEcmaScriptExtension::VRegValueToTaggedValue(vregValue))); } diff --git a/tests/runtime/tooling/api_tests/js/js_method_event_test.h b/tests/runtime/tooling/api_tests/js/js_method_event_test.h index 7fa342d472f69fdfe3c23be1c3e58e0b3f518ae6..b68febf538c820454892cbfba1584bc4424194fa 100644 --- a/tests/runtime/tooling/api_tests/js/js_method_event_test.h +++ b/tests/runtime/tooling/api_tests/js/js_method_event_test.h @@ -23,19 +23,19 @@ class JsMethodEventTest : public ApiTest { public: JsMethodEventTest() { - vm_death = [this]() { + vm_death_ = [this]() { ASSERT_EQ(method_entry_exit_count_, 0); ASSERT_NE(method_entry_count_, 0); return true; }; - method_entry = [this](PtThread, Method *) { + method_entry_ = [this](PtThread, Method *) { method_entry_exit_count_++; method_entry_count_++; return true; }; - method_exit = [this](PtThread, Method *, bool, VRegValue) { + method_exit_ = [this](PtThread, Method *, bool, VRegValue) { method_entry_exit_count_--; return true; }; diff --git a/tests/runtime/tooling/api_tests/js/js_restart_frame_test.h b/tests/runtime/tooling/api_tests/js/js_restart_frame_test.h index 27858b087a686964b05c1de8e165f2654661d321..f2ed04c6f01fb42b095e9fc4f96c7ae1f76a1c83 100644 --- a/tests/runtime/tooling/api_tests/js/js_restart_frame_test.h +++ b/tests/runtime/tooling/api_tests/js/js_restart_frame_test.h @@ -26,40 +26,40 @@ class JsRestartFrameTest : public ApiTest { public: JsRestartFrameTest() { - vm_start = [this] { + vm_start_ = [this] { location_ = TestUtil::GetLocation("RestartFrame.js", 35, panda_file_.c_str()); ASSERT_TRUE(location_.GetMethodId().IsValid()); return true; }; - breakpoint = [this](PtThread thread, Method *, const PtLocation &location) { + breakpoint_ = [this](PtThread thread, Method *, const PtLocation &location) { ASSERT_TRUE(location.GetMethodId().IsValid()); ASSERT_LOCATION_EQ(location, location_); ++breakpoint_counter_; TestUtil::SuspendUntilContinue(DebugEvent::BREAKPOINT, thread, location); if (breakpoint_counter_ == 1) { - ASSERT_SUCCESS(debug_interface->RestartFrame(thread, 2)); + ASSERT_SUCCESS(debug_interface_->RestartFrame(thread, 2)); } if (breakpoint_counter_ == 2) { - ASSERT_SUCCESS(debug_interface->RestartFrame(thread, 0)); + ASSERT_SUCCESS(debug_interface_->RestartFrame(thread, 0)); } return true; }; - load_module = [this](std::string_view moduleName) { + load_module_ = [this](std::string_view moduleName) { if (moduleName.find(panda_file_.c_str()) == std::string_view::npos) { return true; } - ASSERT_SUCCESS(debug_interface->SetBreakpoint(location_)); + ASSERT_SUCCESS(debug_interface_->SetBreakpoint(location_)); return true; }; - method_entry = [this](PtThread, Method *) { + method_entry_ = [this](PtThread, Method *) { ++entry_exit_counter_; return true; }; - method_exit = [this](PtThread, Method *method, bool, VRegValue val) { + method_exit_ = [this](PtThread, Method *method, bool, VRegValue val) { auto moduleName = method->GetFullName(); if (moduleName == "_GLOBAL::func_2") { // Force exit always zero @@ -73,7 +73,7 @@ public: return true; }; - scenario = [this]() { + scenario_ = [this]() { ASSERT_BREAKPOINT_SUCCESS(location_); TestUtil::Continue(); @@ -87,7 +87,7 @@ public: return true; }; - vm_death = [this] { + vm_death_ = [this] { // result_ indicate count of calls // frame0 +1 // frame1 +10 diff --git a/tests/runtime/tooling/api_tests/js/js_set_notification_test.h b/tests/runtime/tooling/api_tests/js/js_set_notification_test.h index c5c325dff0d085f245de5c4cbabcdd9d9544415d..d3bd354047a8064eb89823c570829ce415b664e0 100644 --- a/tests/runtime/tooling/api_tests/js/js_set_notification_test.h +++ b/tests/runtime/tooling/api_tests/js/js_set_notification_test.h @@ -24,21 +24,21 @@ class JsSetNotificationTest : public ApiTest { public: JsSetNotificationTest() { - vm_death = [this]() { + vm_death_ = [this]() { ASSERT_EQ(nn_, 5); ASSERT_EQ(entry_, 3); ASSERT_EQ(exit_, 5); return true; }; - method_entry = [this](PtThread /* thread */, Method *method) { + method_entry_ = [this](PtThread /* thread */, Method *method) { if (method->GetFullName() == "_GLOBAL::func__2") { ++entry_; } return true; }; - method_exit = [this](PtThread thread, Method *method, bool, VRegValue) { + method_exit_ = [this](PtThread thread, Method *method, bool, VRegValue) { if (method->GetFullName() == "_GLOBAL::func__2") { ++exit_; ++nn_; @@ -61,25 +61,25 @@ public: ASSERT_EQ(exit_, 1); // Disable the entry hook globaly - debug_interface->SetNotification(PtThread::NONE, false, PtHookType::PT_HOOK_TYPE_METHOD_ENTRY); + debug_interface_->SetNotification(PtThread::NONE, false, PtHookType::PT_HOOK_TYPE_METHOD_ENTRY); } else if (nn_ == 2) { ASSERT_EQ(entry_, 1); ASSERT_EQ(exit_, 2); // Enable the entry hook locally - debug_interface->SetNotification(thread, true, PtHookType::PT_HOOK_TYPE_METHOD_ENTRY); + debug_interface_->SetNotification(thread, true, PtHookType::PT_HOOK_TYPE_METHOD_ENTRY); } else if (nn_ == 3) { ASSERT_EQ(entry_, 2); ASSERT_EQ(exit_, 3); // Disable the entry hook locally - debug_interface->SetNotification(thread, false, PtHookType::PT_HOOK_TYPE_METHOD_ENTRY); + debug_interface_->SetNotification(thread, false, PtHookType::PT_HOOK_TYPE_METHOD_ENTRY); } else if (nn_ == 4) { ASSERT_EQ(entry_, 2); ASSERT_EQ(exit_, 4); // Enable the entry hook globaly - debug_interface->SetNotification(PtThread::NONE, true, PtHookType::PT_HOOK_TYPE_METHOD_ENTRY); + debug_interface_->SetNotification(PtThread::NONE, true, PtHookType::PT_HOOK_TYPE_METHOD_ENTRY); } else if (nn_ == 5) { ASSERT_EQ(entry_, 3); ASSERT_EQ(exit_, 5); 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 9e92062ad8d7846e8b4c0741d077fad73579a943..2d0c110eb9c3acd7228a0ec305784430b636c5b5 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 @@ -30,13 +30,13 @@ class JsSetVariableTest : public ApiTest { public: JsSetVariableTest() { - vm_death = [this]() { + vm_death_ = [this]() { ASSERT_TRUE(checked_); ASSERT_EQ(breakpoint_count_, 4); return true; }; - load_module = [this](std::string_view moduleName) { + load_module_ = [this](std::string_view moduleName) { if (moduleName.find(panda_file_.c_str()) == std::string_view::npos) { return true; } @@ -47,34 +47,34 @@ public: return true; }; - breakpoint = [this](PtThread thread, Method *method, PtLocation location) { + breakpoint_ = [this](PtThread thread, Method *method, PtLocation location) { breakpoint_count_ += 1; auto methodName = method->GetFullName(); int frameDepth = 0; uint32_t currOffset = location.GetBytecodeOffset(); if (methodName == "_GLOBAL::func_setBoolean_1") { VRegValue value = ecmascript::PtEcmaScriptExtension::TaggedValueToVRegValue(JSTaggedValue(true)); - ASSERT_SUCCESS(debug_interface->SetVariable( + ASSERT_SUCCESS(debug_interface_->SetVariable( thread, frameDepth, TestUtil::GetValueRegister(method, "value", currOffset), value)); } else if (methodName == "_GLOBAL::func_setInt_2") { VRegValue value = ecmascript::PtEcmaScriptExtension::TaggedValueToVRegValue(JSTaggedValue(123456789)); // 123456789 - ASSERT_SUCCESS(debug_interface->SetVariable( + ASSERT_SUCCESS(debug_interface_->SetVariable( thread, frameDepth, TestUtil::GetValueRegister(method, "value", currOffset), value)); } else if (methodName == "_GLOBAL::func_setDouble_3") { VRegValue value = ecmascript::PtEcmaScriptExtension::TaggedValueToVRegValue(JSTaggedValue(12345.6789)); // 12345.6789 - ASSERT_SUCCESS(debug_interface->SetVariable( + ASSERT_SUCCESS(debug_interface_->SetVariable( thread, frameDepth, TestUtil::GetValueRegister(method, "value", currOffset), value)); } else if (methodName == "_GLOBAL::func_setString_4") { VRegValue value = ecmascript::JSTestApi::StringToVRegValue("x2348x"); - ASSERT_SUCCESS(debug_interface->SetVariable( + ASSERT_SUCCESS(debug_interface_->SetVariable( thread, frameDepth, TestUtil::GetValueRegister(method, "value", currOffset), value)); } return true; }; - method_entry = [this](PtThread thread, Method *method) { + method_entry_ = [this](PtThread thread, Method *method) { auto methodName = method->GetFullName(); if (methodName == "_GLOBAL::func_checkData_5") { checked_ = CheckData(thread, method); @@ -146,7 +146,7 @@ private: { auto location = TestUtil::GetLocation("SetVariable.js", line, panda_file_.c_str()); ASSERT_TRUE(location.GetMethodId().IsValid()); - ASSERT_SUCCESS(debug_interface->SetBreakpoint(location)); + ASSERT_SUCCESS(debug_interface_->SetBreakpoint(location)); } bool checked_ = false; diff --git a/tests/runtime/tooling/api_tests/js/js_single_step_test.h b/tests/runtime/tooling/api_tests/js/js_single_step_test.h index 93b57466d317a3f0ebdbc8d985c64c8b54040ecd..12eadf951d74bd1852833f6a71391c67e20f6cab 100644 --- a/tests/runtime/tooling/api_tests/js/js_single_step_test.h +++ b/tests/runtime/tooling/api_tests/js/js_single_step_test.h @@ -23,27 +23,27 @@ class JsSingleStepTest : public ApiTest { public: JsSingleStepTest() { - vm_start = [this] { + vm_start_ = [this] { location_start_ = TestUtil::GetLocation("Sample.js", 19, panda_file_.c_str()); location_end_ = TestUtil::GetLocation("Sample.js", 22, panda_file_.c_str()); return true; }; - vm_death = [this]() { + vm_death_ = [this]() { ASSERT_NE(step_count_, 0); ASSERT_EQ(breakpoint_count_, 2); return true; }; - load_module = [this](std::string_view moduleName) { + load_module_ = [this](std::string_view moduleName) { if (moduleName.find(panda_file_.c_str()) == std::string_view::npos) { return true; } - ASSERT_SUCCESS(debug_interface->SetBreakpoint(location_end_)); + ASSERT_SUCCESS(debug_interface_->SetBreakpoint(location_end_)); return true; }; - breakpoint = [this](PtThread, Method *, const PtLocation &location) { + breakpoint_ = [this](PtThread, Method *, const PtLocation &location) { ASSERT_TRUE(location.GetMethodId().IsValid()); ASSERT_LOCATION_EQ(location, location_end_); // Check's what step signalled before breakpoint @@ -55,7 +55,7 @@ public: return true; }; - single_step = [this](PtThread, Method *, const PtLocation &location) { + single_step_ = [this](PtThread, Method *, const PtLocation &location) { ASSERT_TRUE(location.GetMethodId().IsValid()); if (!collect_steps_) { if (location_start_ == location) { diff --git a/tests/runtime/tooling/api_tests/js/js_vm_event_test.h b/tests/runtime/tooling/api_tests/js/js_vm_event_test.h index 5777a8cd2e16cb8eb35616df7cf7e736a5d38115..b3733f14c62c3e1f8f0fe6de08bcd4f39c88f694 100644 --- a/tests/runtime/tooling/api_tests/js/js_vm_event_test.h +++ b/tests/runtime/tooling/api_tests/js/js_vm_event_test.h @@ -23,21 +23,21 @@ class JsVmEventTest : public ApiTest { public: JsVmEventTest() { - vm_start = [this]() { - start_counter++; + vm_start_ = [this]() { + start_counter_++; return true; }; - vm_init = [this](PtThread thread) { + vm_init_ = [this](PtThread thread) { init_thread_ = thread.GetId(); init_counter_++; return true; }; - vm_death = [this]() { + vm_death_ = [this]() { death_counter_++; ASSERT_NE(init_thread_, PtThread::NONE.GetId()); - ASSERT_EQ(start_counter, 1U); + ASSERT_EQ(start_counter_, 1U); ASSERT_EQ(init_counter_, 1U); return true; }; @@ -51,7 +51,7 @@ public: private: std::string panda_file_ = "js/Sample.abc"; std::string entry_point_ = "_GLOBAL::func_main_0"; - size_t start_counter = 0; + size_t start_counter_ = 0; size_t init_counter_ = 0; size_t death_counter_ = 0; uint32_t init_thread_ = PtThread::NONE.GetId();