diff --git a/BUILD.gn b/BUILD.gn index f4b67479842b8fc9ae5d6490383e1c45514e9c98..1b07797c29aaab68e6311178105ce255435c0c7f 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -151,7 +151,21 @@ source_set("libark_js_intl_static") { ] } +config("ark_jsruntime_compiler_config") { + configs = [ "//ark/js_runtime:ark_jsruntime_base_config" ] +} + config("ark_jsruntime_common_config") { + configs = [ "//ark/js_runtime:ark_jsruntime_base_config" ] + + cflags_cc = [ + "-Wshadow", + "-Werror", + "-Wextra", + ] +} + +config("ark_jsruntime_base_config") { defines = [ "PANDA_ENABLE_LTO" ] cflags_cc = [ "-Wall", @@ -265,11 +279,6 @@ config("ark_jsruntime_common_config") { } } -config("ark_jsruntime_config") { - configs = [ ":ark_jsruntime_common_config" ] - cflags_cc = [ "-Wshadow" ] -} - # ecmascript unit testcase config config("ecma_test_config") { visibility = [ ":*" ] @@ -379,7 +388,6 @@ ecma_source = [ "ecmascript/js_function.cpp", "ecmascript/js_generator_object.cpp", "ecmascript/js_hclass.cpp", - "ecmascript/js_invoker.cpp", "ecmascript/js_iterator.cpp", "ecmascript/js_map.cpp", "ecmascript/js_map_iterator.cpp", @@ -500,7 +508,7 @@ source_set("libark_jsruntime_static") { public_configs = [ ":ark_jsruntime_public_config", # should add before # arkruntime_public_config - ":ark_jsruntime_config", + ":ark_jsruntime_common_config", "$ark_root/runtime:arkruntime_public_config", ] @@ -540,7 +548,7 @@ ohos_shared_library("libark_jsruntime") { } } - configs = [ ":ark_jsruntime_config" ] + configs = [ ":ark_jsruntime_common_config" ] install_enable = true part_name = "ark_js_runtime" diff --git a/ecmascript/base/error_helper.h b/ecmascript/base/error_helper.h index 71d9bd013a2453031a5748d0e2f41a46314a6996..27beef773fcff19fd3c49adc26785595b561b761 100644 --- a/ecmascript/base/error_helper.h +++ b/ecmascript/base/error_helper.h @@ -16,11 +16,6 @@ #ifndef ECMASCRIPT_BASE_ERROR_HELPER_H #define ECMASCRIPT_BASE_ERROR_HELPER_H -#ifdef __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wextern-c-compat" -#endif - #include "ecmascript/base/error_type.h" #include "ecmascript/ecma_runtime_call_info.h" #include "ecmascript/js_handle.h" diff --git a/ecmascript/base/json_stringifier.cpp b/ecmascript/base/json_stringifier.cpp index 84769d15f81b87313017106b66afa935d94e18f2..a916b2e973c2a17a21baa43b33463bf6e158438d 100644 --- a/ecmascript/base/json_stringifier.cpp +++ b/ecmascript/base/json_stringifier.cpp @@ -28,7 +28,6 @@ #include "ecmascript/js_array.h" #include "ecmascript/js_function.h" #include "ecmascript/js_handle.h" -#include "ecmascript/js_invoker.h" #include "ecmascript/js_object-inl.h" #include "ecmascript/js_primitive_ref.h" #include "ecmascript/js_tagged_value-inl.h" diff --git a/ecmascript/builtins/builtins_ark_tools.cpp b/ecmascript/builtins/builtins_ark_tools.cpp index d2b063f546b4a066b0a47eb1ce04749ad703a6f8..2257cc81e6cb59aaa7db248baaf0e261188ace5c 100644 --- a/ecmascript/builtins/builtins_ark_tools.cpp +++ b/ecmascript/builtins/builtins_ark_tools.cpp @@ -33,7 +33,7 @@ JSTaggedValue BuiltinsArkTools::ObjectDump(EcmaRuntimeCallInfo *msg) for (uint32_t i = 1; i < numArgs; i++) { JSHandle obj = GetCallArg(msg, i); std::ostringstream oss; - obj->Dump(thread, oss); + obj->Dump(oss); // The default log level of ace_engine and js_runtime is error LOG(ERROR, RUNTIME) << ": " << oss.str(); diff --git a/ecmascript/builtins/builtins_global.cpp b/ecmascript/builtins/builtins_global.cpp index 694ba3f61072872eb25e31ecf54635bf6c2a4118..0c8bc2f620e4cebbd4d0aec342c4df33b7dc249e 100644 --- a/ecmascript/builtins/builtins_global.cpp +++ b/ecmascript/builtins/builtins_global.cpp @@ -23,7 +23,6 @@ #include "ecmascript/ecma_macros.h" #include "ecmascript/internal_call_params.h" #include "ecmascript/interpreter/slow_runtime_helper.h" -#include "ecmascript/js_invoker.h" #include "ecmascript/mem/c_containers.h" #include "ecmascript/tagged_array-inl.h" diff --git a/ecmascript/builtins/builtins_map.cpp b/ecmascript/builtins/builtins_map.cpp index ffc20db32ef74c919c46fc690655b14211a97dab..ec6f7704731463e276f8e6d584b7c433d589e7f2 100644 --- a/ecmascript/builtins/builtins_map.cpp +++ b/ecmascript/builtins/builtins_map.cpp @@ -17,7 +17,6 @@ #include "ecmascript/ecma_vm.h" #include "ecmascript/global_env.h" #include "ecmascript/internal_call_params.h" -#include "ecmascript/js_invoker.h" #include "ecmascript/js_map.h" #include "ecmascript/js_map_iterator.h" #include "ecmascript/linked_hash_table.h" @@ -98,24 +97,22 @@ JSTaggedValue BuiltinsMap::MapConstructor(EcmaRuntimeCallInfo *argv) JSHandle key = JSObject::GetProperty(thread, nextValue, keyIndex).GetValue(); // If k is an abrupt completion, return IteratorClose(iter, k). if (thread->HasPendingException()) { - return JSIterator::IteratorCloseAndReturn(thread, iter, key); + return JSIterator::IteratorCloseAndReturn(thread, iter); } // Let v be Get(nextItem, "1"). JSHandle value = JSObject::GetProperty(thread, nextValue, valueIndex).GetValue(); // If v is an abrupt completion, return IteratorClose(iter, v). if (thread->HasPendingException()) { - return JSIterator::IteratorCloseAndReturn(thread, iter, value); + return JSIterator::IteratorCloseAndReturn(thread, iter); } // Let status be Call(adder, map, «nextValue.[[value]]»). InternalCallParams *arguments = thread->GetInternalCallParams(); arguments->MakeArgv(key, value); - JSTaggedValue ret = JSFunction::Call(thread, - adder, JSHandle(map), 2, arguments->GetArgv()); // 2: key and value pair - - status.Update(ret); + JSFunction::Call( + thread, adder, JSHandle(map), 2, arguments->GetArgv()); // 2: key and value pair // If status is an abrupt completion, return IteratorClose(iter, status). if (thread->HasPendingException()) { - return JSIterator::IteratorCloseAndReturn(thread, iter, status); + return JSIterator::IteratorCloseAndReturn(thread, iter); } // Let next be IteratorStep(iter). next = JSIterator::IteratorStep(thread, iter); diff --git a/ecmascript/builtins/builtins_regexp.cpp b/ecmascript/builtins/builtins_regexp.cpp index d305033b1f2e5aeca554223808b91afe106c93cd..93463daecaf3d36cc1596b31ac78bc0a88ab3899 100644 --- a/ecmascript/builtins/builtins_regexp.cpp +++ b/ecmascript/builtins/builtins_regexp.cpp @@ -23,7 +23,6 @@ #include "ecmascript/js_array.h" #include "ecmascript/js_function.h" #include "ecmascript/js_hclass.h" -#include "ecmascript/js_invoker.h" #include "ecmascript/js_object-inl.h" #include "ecmascript/js_regexp.h" #include "ecmascript/js_tagged_value-inl.h" @@ -472,7 +471,7 @@ JSTaggedValue BuiltinsRegExp::Match(EcmaRuntimeCallInfo *argv) // c. Let nextIndex be AdvanceStringIndex(S, thisIndex, fullUnicode). // d. Let setStatus be Set(rx, "lastIndex", nextIndex, true). JSTaggedValue nextIndex = - JSTaggedValue(AdvanceStringIndex(thread, string, thisIndex.GetNumber(), fullUnicode)); + JSTaggedValue(AdvanceStringIndex(string, thisIndex.GetNumber(), fullUnicode)); FastRuntimeStub::FastSetProperty(thread, thisObj.GetTaggedValue(), lastIndexString.GetTaggedValue(), nextIndex, true); // e. ReturnIfAbrupt(setStatus). @@ -591,7 +590,7 @@ JSTaggedValue BuiltinsRegExp::RegExpReplaceFast(JSThread *thread, JSHandleIsUtf16() && (flags & RegExpParser::FLAG_UTF16); - endIndex = AdvanceStringIndex(thread, tagInputString, endIndex, unicode); + endIndex = AdvanceStringIndex(tagInputString, endIndex, unicode); } lastIndex = endIndex; } @@ -716,7 +715,7 @@ JSTaggedValue BuiltinsRegExp::Replace(EcmaRuntimeCallInfo *argv) RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); } // c. Let nextIndex be AdvanceStringIndex(S, thisIndex, fullUnicode). - uint32_t nextIndex = AdvanceStringIndex(thread, inputStr, thisIndex, fullUnicode); + uint32_t nextIndex = AdvanceStringIndex(inputStr, thisIndex, fullUnicode); nextIndexHandle.Update(JSTaggedValue(nextIndex)); // d. Let setStatus be Set(rx, "lastIndex", nextIndex, true). FastRuntimeStub::FastSetProperty(thread, thisObj.GetTaggedValue(), lastIndex.GetTaggedValue(), @@ -1045,7 +1044,7 @@ JSTaggedValue BuiltinsRegExp::Split(EcmaRuntimeCallInfo *argv) RETURN_EXCEPTION_IF_ABRUPT_COMPLETION(thread); // e. If z is null, let q be AdvanceStringIndex(S, q, unicodeMatching). if (execResult->IsNull()) { - endIndex = AdvanceStringIndex(thread, jsString, endIndex, unicodeMatching); + endIndex = AdvanceStringIndex(jsString, endIndex, unicodeMatching); } else { // f. Else z is not null, // i. Let e be ToLength(Get(splitter, "lastIndex")). @@ -1057,7 +1056,7 @@ JSTaggedValue BuiltinsRegExp::Split(EcmaRuntimeCallInfo *argv) uint32_t lastIndex = lastIndexNumber.GetNumber(); // iii. If e = p, let q be AdvanceStringIndex(S, q, unicodeMatching). if (lastIndex == startIndex) { - endIndex = AdvanceStringIndex(thread, jsString, endIndex, unicodeMatching); + endIndex = AdvanceStringIndex(jsString, endIndex, unicodeMatching); } else { // iv. Else e != p, // 1. Let T be a String value equal to the substring of S consisting of the elements at indices p @@ -1157,7 +1156,7 @@ RegExpExecutor::MatchResult BuiltinsRegExp::Matcher(JSThread *thread, const JSHa return result; } -uint32_t BuiltinsRegExp::AdvanceStringIndex(JSThread *thread, const JSHandle &inputStr, uint32_t index, +uint32_t BuiltinsRegExp::AdvanceStringIndex(const JSHandle &inputStr, uint32_t index, bool unicode) { // 1. Assert: Type(S) is String. diff --git a/ecmascript/builtins/builtins_regexp.h b/ecmascript/builtins/builtins_regexp.h index 71ebcd3768e9291a2800e346d7946a9d04237edc..65b6271fa11181a8aa46c45f137cda4ddb02be5f 100644 --- a/ecmascript/builtins/builtins_regexp.h +++ b/ecmascript/builtins/builtins_regexp.h @@ -73,7 +73,7 @@ private: static RegExpExecutor::MatchResult Matcher(JSThread *thread, const JSHandle ®exp, const uint8_t *buffer, size_t length, int32_t lastindex, bool isUtf16); // 21.2.5.2.3 AdvanceStringIndex ( S, index, unicode ) - static uint32_t AdvanceStringIndex(JSThread *thread, const JSHandle &inputStr, uint32_t index, + static uint32_t AdvanceStringIndex(const JSHandle &inputStr, uint32_t index, bool unicode); static bool GetFlagsInternal(JSThread *thread, const JSHandle &obj, diff --git a/ecmascript/builtins/builtins_set.cpp b/ecmascript/builtins/builtins_set.cpp index a9710d85f0a39ef734275dbf1b188b0583915791..8f0c3c00cffeddaa6f2e42f03d8c86260e577603 100644 --- a/ecmascript/builtins/builtins_set.cpp +++ b/ecmascript/builtins/builtins_set.cpp @@ -17,7 +17,6 @@ #include "ecmascript/ecma_vm.h" #include "ecmascript/global_env.h" #include "ecmascript/internal_call_params.h" -#include "ecmascript/js_invoker.h" #include "ecmascript/js_set.h" #include "ecmascript/js_set_iterator.h" #include "ecmascript/linked_hash_table-inl.h" @@ -88,12 +87,11 @@ JSTaggedValue BuiltinsSet::SetConstructor(EcmaRuntimeCallInfo *argv) auto prop = JSObject::GetProperty(thread, nextValue, valueIndex).GetValue(); arguments->MakeArgv(prop); } - JSTaggedValue ret = JSFunction::Call(thread, adder, JSHandle(set), 1, arguments->GetArgv()); + JSFunction::Call(thread, adder, JSHandle(set), 1, arguments->GetArgv()); // Let status be Call(adder, set, «nextValue.[[value]]»). - JSHandle status(thread, ret); if (thread->HasPendingException()) { - return JSIterator::IteratorCloseAndReturn(thread, iter, status); + return JSIterator::IteratorCloseAndReturn(thread, iter); } // Let next be IteratorStep(iter). next = JSIterator::IteratorStep(thread, iter); diff --git a/ecmascript/builtins/builtins_string.cpp b/ecmascript/builtins/builtins_string.cpp index e98ac03ba09b5bceaebd2333d30b85b416a169e3..08e36a78454706b998c82e7c738f4ef10c574aec 100644 --- a/ecmascript/builtins/builtins_string.cpp +++ b/ecmascript/builtins/builtins_string.cpp @@ -30,7 +30,6 @@ #include "ecmascript/interpreter/fast_runtime_stub-inl.h" #include "ecmascript/js_array.h" #include "ecmascript/js_hclass.h" -#include "ecmascript/js_invoker.h" #include "ecmascript/js_locale.h" #include "ecmascript/js_object-inl.h" #include "ecmascript/js_primitive_ref.h" diff --git a/ecmascript/builtins/builtins_symbol.cpp b/ecmascript/builtins/builtins_symbol.cpp index bd49902e9a1b63220b737120c366b75467e0c5d7..e8689adc19a97837ef0ba650f68560513344645b 100644 --- a/ecmascript/builtins/builtins_symbol.cpp +++ b/ecmascript/builtins/builtins_symbol.cpp @@ -189,7 +189,7 @@ JSTaggedValue BuiltinsSymbol::KeyFor(EcmaRuntimeCallInfo *argv) // 4.Return undefined. JSHandle env = thread->GetEcmaVM()->GetGlobalEnv(); auto *table = env->GetRegisterSymbols().GetObject(); - JSTaggedValue key = table->FindSymbol(thread, sym.GetTaggedValue()); + JSTaggedValue key = table->FindSymbol(sym.GetTaggedValue()); if (key.IsUndefined()) { return JSTaggedValue::Undefined(); } diff --git a/ecmascript/builtins/builtins_weak_map.cpp b/ecmascript/builtins/builtins_weak_map.cpp index 4df9e3f36150ffbb4d5914392af1af82df7a4e6e..e4f882e6ec5f6175e8960fc18944e3fdee72d048 100644 --- a/ecmascript/builtins/builtins_weak_map.cpp +++ b/ecmascript/builtins/builtins_weak_map.cpp @@ -17,7 +17,6 @@ #include "ecmascript/ecma_vm.h" #include "ecmascript/global_env.h" #include "ecmascript/internal_call_params.h" -#include "ecmascript/js_invoker.h" #include "ecmascript/js_map_iterator.h" #include "ecmascript/js_weak_container.h" #include "ecmascript/linked_hash_table.h" @@ -99,26 +98,24 @@ JSTaggedValue BuiltinsWeakMap::WeakMapConstructor(EcmaRuntimeCallInfo *argv) JSHandle key = JSObject::GetProperty(thread, nextValue, keyIndex).GetValue(); // If k is an abrupt completion, return IteratorClose(iter, k). if (thread->HasPendingException()) { - return JSIterator::IteratorCloseAndReturn(thread, iter, key); + return JSIterator::IteratorCloseAndReturn(thread, iter); } // Let v be Get(nextItem, "1"). JSHandle value = JSObject::GetProperty(thread, nextValue, valueIndex).GetValue(); // If v is an abrupt completion, return IteratorClose(iter, v). if (thread->HasPendingException()) { - return JSIterator::IteratorCloseAndReturn(thread, iter, value); + return JSIterator::IteratorCloseAndReturn(thread, iter); } // Let status be Call(adder, weakMap, «nextValue.[[value]]»). InternalCallParams *arguments = thread->GetInternalCallParams(); arguments->MakeArgv(key, value); - JSTaggedValue ret = JSFunction::Call(thread, + JSFunction::Call(thread, adder, JSHandle(weakMap), 2, arguments->GetArgv()); // 2: key and value pair - - status.Update(ret); // If status is an abrupt completion, return IteratorClose(iter, status). if (thread->HasPendingException()) { - return JSIterator::IteratorCloseAndReturn(thread, iter, status); + return JSIterator::IteratorCloseAndReturn(thread, iter); } // Let next be IteratorStep(iter). next = JSIterator::IteratorStep(thread, iter); diff --git a/ecmascript/builtins/builtins_weak_set.cpp b/ecmascript/builtins/builtins_weak_set.cpp index d16748626fb49b62689b18390a769f490716083d..0098138f279a26ab0486c66c497b27f5aaa386b7 100644 --- a/ecmascript/builtins/builtins_weak_set.cpp +++ b/ecmascript/builtins/builtins_weak_set.cpp @@ -17,7 +17,6 @@ #include "ecmascript/ecma_vm.h" #include "ecmascript/global_env.h" #include "ecmascript/internal_call_params.h" -#include "ecmascript/js_invoker.h" #include "ecmascript/js_set_iterator.h" #include "ecmascript/js_weak_container.h" #include "ecmascript/linked_hash_table-inl.h" @@ -89,13 +88,11 @@ JSTaggedValue BuiltinsWeakSet::WeakSetConstructor(EcmaRuntimeCallInfo *argv) auto prop = JSObject::GetProperty(thread, nextValue, valueIndex).GetValue(); arguments->MakeArgv(prop); } - JSTaggedValue ret = JSFunction::Call(thread, adder, JSHandle(weakSet), 1, arguments->GetArgv()); - // Let status be Call(adder, weakset, «nextValue.[[value]]»). - status.Update(ret); + JSFunction::Call(thread, adder, JSHandle(weakSet), 1, arguments->GetArgv()); // If status is an abrupt completion, return IteratorClose(iter, status). if (thread->HasPendingException()) { - return JSIterator::IteratorCloseAndReturn(thread, iter, status); + return JSIterator::IteratorCloseAndReturn(thread, iter); } // Let next be IteratorStep(iter). next = JSIterator::IteratorStep(thread, iter); diff --git a/ecmascript/builtins/tests/builtins_json_test.cpp b/ecmascript/builtins/tests/builtins_json_test.cpp index 7227242f36ae98acf26c382c71b48252e9a81d56..5ec2c33925f3563aea2e2aa3ddb4fee8bc9a5096 100644 --- a/ecmascript/builtins/tests/builtins_json_test.cpp +++ b/ecmascript/builtins/tests/builtins_json_test.cpp @@ -27,7 +27,6 @@ #include "ecmascript/js_array.h" #include "ecmascript/js_function.h" #include "ecmascript/js_handle.h" -#include "ecmascript/js_invoker.h" #include "ecmascript/js_object-inl.h" #include "ecmascript/js_primitive_ref.h" #include "ecmascript/js_tagged_value-inl.h" diff --git a/ecmascript/builtins/tests/builtins_map_test.cpp b/ecmascript/builtins/tests/builtins_map_test.cpp index c6addb3512a7ee58059aa9e73e994a37db6bf962..1cf882c48cc789d6e7c643409846c94ede1144b7 100644 --- a/ecmascript/builtins/tests/builtins_map_test.cpp +++ b/ecmascript/builtins/tests/builtins_map_test.cpp @@ -197,7 +197,7 @@ HWTEST_F_L0(BuiltinsMapTest, ForEach) JSTaggedValue result1 = BuiltinsMap::Set(ecmaRuntimeCallInfo.get()); EXPECT_TRUE(result1.IsECMAObject()); JSMap *jsMap = JSMap::Cast(reinterpret_cast(result1.GetRawData())); - EXPECT_EQ(jsMap->GetSize(), i + 1); + EXPECT_EQ(jsMap->GetSize(), static_cast(i) + 1); } // test foreach; JSHandle jsArray(JSArray::ArrayCreate(thread, JSTaggedNumber(0))); @@ -238,7 +238,7 @@ HWTEST_F_L0(BuiltinsMapTest, DeleteAndRemove) EXPECT_TRUE(result1.IsECMAObject()); JSMap *jsMap = JSMap::Cast(reinterpret_cast(result1.GetRawData())); - EXPECT_EQ(jsMap->GetSize(), i + 1); + EXPECT_EQ(jsMap->GetSize(), static_cast(i) + 1); } // whether jsMap has delete key keyArray[3] = '1' + 8; diff --git a/ecmascript/builtins/tests/builtins_set_test.cpp b/ecmascript/builtins/tests/builtins_set_test.cpp index fc98b376b9b195144d04fb9190383a2191b7a383..fd9c656557dfdd6ee455ee3fbd5fd9ddcc33517b 100644 --- a/ecmascript/builtins/tests/builtins_set_test.cpp +++ b/ecmascript/builtins/tests/builtins_set_test.cpp @@ -210,7 +210,7 @@ HWTEST_F_L0(BuiltinsSetTest, ForEach) EXPECT_TRUE(result1.IsECMAObject()); JSSet *jsSet = JSSet::Cast(reinterpret_cast(result1.GetRawData())); - EXPECT_EQ(jsSet->GetSize(), i + 1); + EXPECT_EQ(jsSet->GetSize(), static_cast(i) + 1); } // test foreach; JSHandle jsArray(JSArray::ArrayCreate(thread, JSTaggedNumber(0))); @@ -252,7 +252,7 @@ HWTEST_F_L0(BuiltinsSetTest, DeleteAndRemove) EXPECT_TRUE(result1.IsECMAObject()); JSSet *jsSet = JSSet::Cast(reinterpret_cast(result1.GetRawData())); - EXPECT_EQ(jsSet->GetSize(), i + 1); + EXPECT_EQ(jsSet->GetSize(), static_cast(i) + 1); } // whether jsSet has delete key keyArray[3] = '1' + 8; diff --git a/ecmascript/builtins/tests/builtins_symbol_test.cpp b/ecmascript/builtins/tests/builtins_symbol_test.cpp index d35da7da9bf0ef0db75d81807fa57e7db2c46715..f763133ef7edb7a2b2df46397571de5f373b126e 100644 --- a/ecmascript/builtins/tests/builtins_symbol_test.cpp +++ b/ecmascript/builtins/tests/builtins_symbol_test.cpp @@ -181,7 +181,7 @@ HWTEST_F_L0(BuiltinsSymbolTest, SymbolWithParameterFor) JSHandle string = ecmaVM->GetFactory()->NewFromCanBeCompressString("ccc"); ASSERT_EQ(string->GetLength(), 3U); JSHandle string_handle(string); - ASSERT_EQ(tableHandle->ContainsKey(thread, string_handle.GetTaggedValue()), false); + ASSERT_EQ(tableHandle->ContainsKey(string_handle.GetTaggedValue()), false); JSHandle symbol = ecmaVM->GetFactory()->NewSymbolWithTableWithChar("ccc"); @@ -193,7 +193,7 @@ HWTEST_F_L0(BuiltinsSymbolTest, SymbolWithParameterFor) [[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); + ASSERT_EQ(tableHandle->ContainsKey(string_handle.GetTaggedValue()), true); JSTaggedValue target(*symbol); ASSERT_EQ(result.GetRawData() == target.GetRawData(), true); @@ -241,7 +241,7 @@ HWTEST_F_L0(BuiltinsSymbolTest, SymbolKeyFor) ASSERT_TRUE(otherResult.IsString()); JSHandle tableHandle(env->GetRegisterSymbols()); JSTaggedValue stringValue(*string); - ASSERT_EQ(tableHandle->ContainsKey(thread, stringValue), true); + ASSERT_EQ(tableHandle->ContainsKey(stringValue), true); } // Symbol.ToPrimitive() diff --git a/ecmascript/builtins/tests/builtins_weak_map_test.cpp b/ecmascript/builtins/tests/builtins_weak_map_test.cpp index 382bdd5930f4b6f0fe5e50e9724518639ed9310d..bec567122271bd7261251880b330e6ec3f48b066 100644 --- a/ecmascript/builtins/tests/builtins_weak_map_test.cpp +++ b/ecmascript/builtins/tests/builtins_weak_map_test.cpp @@ -182,7 +182,7 @@ HWTEST_F_L0(BuiltinsWeakMapTest, DeleteAndRemove) EXPECT_TRUE(result1.IsECMAObject()); JSWeakMap *jsWeakMap = JSWeakMap::Cast(reinterpret_cast(result1.GetRawData())); - EXPECT_EQ(jsWeakMap->GetSize(), i + 1); + EXPECT_EQ(jsWeakMap->GetSize(), static_cast(i) + 1); lastKey = key.GetTaggedValue(); } diff --git a/ecmascript/builtins/tests/builtins_weak_set_test.cpp b/ecmascript/builtins/tests/builtins_weak_set_test.cpp index 469170b46dfd24018322de79c862053e3830ac54..f379be4318fc08e184dda98535261022be4e3a47 100644 --- a/ecmascript/builtins/tests/builtins_weak_set_test.cpp +++ b/ecmascript/builtins/tests/builtins_weak_set_test.cpp @@ -177,7 +177,7 @@ HWTEST_F_L0(BuiltinsWeakSetTest, DeleteAndRemove) EXPECT_TRUE(result1.IsECMAObject()); JSWeakSet *jsWeakSet = JSWeakSet::Cast(reinterpret_cast(result1.GetRawData())); - EXPECT_EQ(jsWeakSet->GetSize(), i + 1); + EXPECT_EQ(jsWeakSet->GetSize(), static_cast(i) + 1); lastKey = key.GetTaggedValue(); } // whether jsWeakSet has delete lastKey diff --git a/ecmascript/compiler/BUILD.gn b/ecmascript/compiler/BUILD.gn index 9b84b6ece67d7c6d5a34eab31d6378b4be763835..041cb71bfc3a20c26b8778e84a846dec6d4d2b0b 100644 --- a/ecmascript/compiler/BUILD.gn +++ b/ecmascript/compiler/BUILD.gn @@ -34,10 +34,6 @@ config("include_llvm") { } } -config("ark_jsruntime_compiler_config") { - configs = [ "//ark/js_runtime:ark_jsruntime_common_config" ] -} - source_set("libark_jsoptimizer_static") { sources = [ "aot_file_manager.cpp", @@ -61,7 +57,7 @@ source_set("libark_jsoptimizer_static") { public_configs = [ ":include_llvm", - ":ark_jsruntime_compiler_config", + "//ark/js_runtime:ark_jsruntime_compiler_config", "//ark/js_runtime:ark_jsruntime_public_config", "$ark_root/runtime:arkruntime_public_config", ] @@ -193,7 +189,7 @@ ohos_executable("ark_stub_compiler") { configs = [ ":include_llvm", - ":ark_jsruntime_compiler_config", + "//ark/js_runtime:ark_jsruntime_compiler_config", "//ark/js_runtime:ark_jsruntime_public_config", "$ark_root/runtime:arkruntime_public_config", ] @@ -225,7 +221,7 @@ ohos_executable("ark_aot_compiler") { configs = [ ":include_llvm", - ":ark_jsruntime_compiler_config", + "//ark/js_runtime:ark_jsruntime_compiler_config", "//ark/js_runtime:ark_jsruntime_public_config", "$ark_root/runtime:arkruntime_public_config", ] diff --git a/ecmascript/compiler/llvm_ir_builder.cpp b/ecmascript/compiler/llvm_ir_builder.cpp index 0f8c0c8a62128ce2682aa7187da0e6535dbedb6e..b2806e8351ff1fa6c4a4be0d02225fc2c0d4f25d 100644 --- a/ecmascript/compiler/llvm_ir_builder.cpp +++ b/ecmascript/compiler/llvm_ir_builder.cpp @@ -826,7 +826,7 @@ void LLVMIRBuilder::HandleGoto(GateRef gate) switch (circuit_->GetOpCode(gate)) { case OpCode::MERGE: case OpCode::LOOP_BEGIN: { - for (int i = 0; i < static_cast(outs.size()); i++) { + for (size_t i = 0; i < outs.size(); i++) { bbOut = instIdMapBbId_[circuit_->GetId(outs[i])]; VisitGoto(block, bbOut); } diff --git a/ecmascript/compiler/tests/BUILD.gn b/ecmascript/compiler/tests/BUILD.gn index 5268dae914decba60e314dc37f00abe35926acc5..a23783523d7dcd642f6e63bd89e46e501fe237c5 100644 --- a/ecmascript/compiler/tests/BUILD.gn +++ b/ecmascript/compiler/tests/BUILD.gn @@ -41,7 +41,7 @@ host_unittest_action("StubTest") { configs = [ ":include_llvm_config", "//ark/js_runtime:ecma_test_config", - "//ark/js_runtime/ecmascript/compiler:ark_jsruntime_compiler_config", + "//ark/js_runtime:ark_jsruntime_compiler_config", "//ark/js_runtime:ark_jsruntime_public_config", "$ark_root/runtime:arkruntime_public_config", ] diff --git a/ecmascript/containers/tests/containers_treemap_test.cpp b/ecmascript/containers/tests/containers_treemap_test.cpp index 0eab393f85f58957b0214cd99c5bca9abfaaaea8..8a4ea75e564e840a583ddcfbc2351a42ce55beb1 100644 --- a/ecmascript/containers/tests/containers_treemap_test.cpp +++ b/ecmascript/containers/tests/containers_treemap_test.cpp @@ -859,12 +859,12 @@ HWTEST_F_L0(ContainersTreeMapTest, KeysAndValuesAndEntries) } // test keys - auto callInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); - callInfo->SetFunction(JSTaggedValue::Undefined()); - callInfo->SetThis(tmap.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, callInfo.get()); - JSHandle iterKeys(thread, ContainersTreeMap::Keys(callInfo.get())); - TestHelper::TearDownFrame(thread, prev); + auto callInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); + callInfo1->SetFunction(JSTaggedValue::Undefined()); + callInfo1->SetThis(tmap.GetTaggedValue()); + [[maybe_unused]] auto prev1 = TestHelper::SetupFrame(thread, callInfo1.get()); + JSHandle iterKeys(thread, ContainersTreeMap::Keys(callInfo1.get())); + TestHelper::TearDownFrame(thread, prev1); EXPECT_TRUE(iterKeys->IsJSAPITreeMapIterator()); JSMutableHandle result(thread, JSTaggedValue::Undefined()); @@ -880,12 +880,12 @@ HWTEST_F_L0(ContainersTreeMapTest, KeysAndValuesAndEntries) } // test values - callInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); - callInfo->SetFunction(JSTaggedValue::Undefined()); - callInfo->SetThis(tmap.GetTaggedValue()); - prev = TestHelper::SetupFrame(thread, callInfo.get()); - JSHandle iterValues(thread, ContainersTreeMap::Values(callInfo.get())); - TestHelper::TearDownFrame(thread, prev); + callInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); + callInfo1->SetFunction(JSTaggedValue::Undefined()); + callInfo1->SetThis(tmap.GetTaggedValue()); + auto prev2 = TestHelper::SetupFrame(thread, callInfo1.get()); + JSHandle iterValues(thread, ContainersTreeMap::Values(callInfo1.get())); + TestHelper::TearDownFrame(thread, prev2); EXPECT_TRUE(iterValues->IsJSAPITreeMapIterator()); for (int i = 0; i < NODE_NUMBERS; i++) { @@ -917,10 +917,10 @@ HWTEST_F_L0(ContainersTreeMapTest, KeysAndValuesAndEntries) callInfo->SetCallArg(0, key.GetTaggedValue()); callInfo->SetCallArg(1, value.GetTaggedValue()); [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, callInfo.get()); - JSTaggedValue result = ContainersTreeMap::Set(callInfo.get()); + JSTaggedValue result1 = ContainersTreeMap::Set(callInfo.get()); TestHelper::TearDownFrame(thread, prev); - EXPECT_TRUE(result.IsJSAPITreeMap()); - EXPECT_EQ(JSAPITreeMap::Cast(result.GetTaggedObject())->GetSize(), NODE_NUMBERS + i + 1); + EXPECT_TRUE(result1.IsJSAPITreeMap()); + EXPECT_EQ(JSAPITreeMap::Cast(result1.GetTaggedObject())->GetSize(), NODE_NUMBERS + i + 1); } // test keys after add for (int i = 0; i < NODE_NUMBERS; i++) { @@ -954,17 +954,17 @@ HWTEST_F_L0(ContainersTreeMapTest, KeysAndValuesAndEntries) // test entries { - auto callInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); - callInfo->SetFunction(JSTaggedValue::Undefined()); - callInfo->SetThis(tmap.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, callInfo.get()); - JSHandle iter(thread, ContainersTreeMap::Entries(callInfo.get())); - TestHelper::TearDownFrame(thread, prev); + auto callInfo3 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); + callInfo3->SetFunction(JSTaggedValue::Undefined()); + callInfo3->SetThis(tmap.GetTaggedValue()); + [[maybe_unused]] auto prev3 = TestHelper::SetupFrame(thread, callInfo3.get()); + JSHandle iter(thread, ContainersTreeMap::Entries(callInfo3.get())); + TestHelper::TearDownFrame(thread, prev3); EXPECT_TRUE(iter->IsJSAPITreeMapIterator()); JSHandle first(thread, JSTaggedValue(0)); JSHandle second(thread, JSTaggedValue(1)); - JSMutableHandle result(thread, JSTaggedValue::Undefined()); + JSMutableHandle result1(thread, JSTaggedValue::Undefined()); JSMutableHandle entries(thread, JSTaggedValue::Undefined()); for (int i = 0; i < NODE_NUMBERS; i++) { auto callInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); @@ -972,9 +972,9 @@ HWTEST_F_L0(ContainersTreeMapTest, KeysAndValuesAndEntries) callInfo->SetThis(iter.GetTaggedValue()); [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, callInfo.get()); - result.Update(JSAPITreeMapIterator::Next(callInfo.get())); + result1.Update(JSAPITreeMapIterator::Next(callInfo.get())); TestHelper::TearDownFrame(thread, prev); - entries.Update(JSIterator::IteratorValue(thread, result).GetTaggedValue()); + entries.Update(JSIterator::IteratorValue(thread, result1).GetTaggedValue()); EXPECT_EQ(i, JSObject::GetProperty(thread, entries, first).GetValue()->GetInt()); EXPECT_EQ(i, JSObject::GetProperty(thread, entries, second).GetValue()->GetInt()); } @@ -1294,12 +1294,12 @@ HWTEST_F_L0(ContainersTreeMapTest, CustomCompareFunctionTest) } // test sort - auto callInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); - callInfo->SetFunction(JSTaggedValue::Undefined()); - callInfo->SetThis(tmap.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, callInfo.get()); - JSHandle iterKeys(thread, ContainersTreeMap::Keys(callInfo.get())); - TestHelper::TearDownFrame(thread, prev); + auto callInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); + callInfo1->SetFunction(JSTaggedValue::Undefined()); + callInfo1->SetThis(tmap.GetTaggedValue()); + [[maybe_unused]] auto prev1 = TestHelper::SetupFrame(thread, callInfo1.get()); + JSHandle iterKeys(thread, ContainersTreeMap::Keys(callInfo1.get())); + TestHelper::TearDownFrame(thread, prev1); EXPECT_TRUE(iterKeys->IsJSAPITreeMapIterator()); JSMutableHandle result(thread, JSTaggedValue::Undefined()); diff --git a/ecmascript/containers/tests/containers_treeset_test.cpp b/ecmascript/containers/tests/containers_treeset_test.cpp index b78134b766d30276190d0f2c8d0719da303aa302..2b4db108ada8c08c8416d84b3568d024149e8717 100644 --- a/ecmascript/containers/tests/containers_treeset_test.cpp +++ b/ecmascript/containers/tests/containers_treeset_test.cpp @@ -794,12 +794,12 @@ HWTEST_F_L0(ContainersTreeSetTest, KeysAndValuesAndEntries) } // test values - auto callInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); - callInfo->SetFunction(JSTaggedValue::Undefined()); - callInfo->SetThis(tset.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, callInfo.get()); - JSHandle iterValues(thread, ContainersTreeSet::Values(callInfo.get())); - TestHelper::TearDownFrame(thread, prev); + auto callInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); + callInfo1->SetFunction(JSTaggedValue::Undefined()); + callInfo1->SetThis(tset.GetTaggedValue()); + [[maybe_unused]] auto prev1 = TestHelper::SetupFrame(thread, callInfo1.get()); + JSHandle iterValues(thread, ContainersTreeSet::Values(callInfo1.get())); + TestHelper::TearDownFrame(thread, prev1); EXPECT_TRUE(iterValues->IsJSAPITreeSetIterator()); { JSMutableHandle result(thread, JSTaggedValue::Undefined()); @@ -853,12 +853,12 @@ HWTEST_F_L0(ContainersTreeSetTest, KeysAndValuesAndEntries) } // test entries { - auto callInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); - callInfo->SetFunction(JSTaggedValue::Undefined()); - callInfo->SetThis(tset.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, callInfo.get()); - JSHandle iter(thread, ContainersTreeSet::Entries(callInfo.get())); - TestHelper::TearDownFrame(thread, prev); + auto callInfo2 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); + callInfo2->SetFunction(JSTaggedValue::Undefined()); + callInfo2->SetThis(tset.GetTaggedValue()); + [[maybe_unused]] auto prev2 = TestHelper::SetupFrame(thread, callInfo2.get()); + JSHandle iter(thread, ContainersTreeSet::Entries(callInfo2.get())); + TestHelper::TearDownFrame(thread, prev2); EXPECT_TRUE(iter->IsJSAPITreeSetIterator()); JSHandle first(thread, JSTaggedValue(0)); @@ -1036,12 +1036,12 @@ HWTEST_F_L0(ContainersTreeSetTest, CustomCompareFunctionTest) EXPECT_EQ(tset->GetSize(), NODE_NUMBERS * 2); // test sort - auto callInfo = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); - callInfo->SetFunction(JSTaggedValue::Undefined()); - callInfo->SetThis(tset.GetTaggedValue()); - [[maybe_unused]] auto prev = TestHelper::SetupFrame(thread, callInfo.get()); - JSHandle iterValues(thread, ContainersTreeSet::Values(callInfo.get())); - TestHelper::TearDownFrame(thread, prev); + auto callInfo1 = TestHelper::CreateEcmaRuntimeCallInfo(thread, JSTaggedValue::Undefined(), 4); + callInfo1->SetFunction(JSTaggedValue::Undefined()); + callInfo1->SetThis(tset.GetTaggedValue()); + [[maybe_unused]] auto prev1 = TestHelper::SetupFrame(thread, callInfo1.get()); + JSHandle iterValues(thread, ContainersTreeSet::Values(callInfo1.get())); + TestHelper::TearDownFrame(thread, prev1); EXPECT_TRUE(iterValues->IsJSAPITreeSetIterator()); JSMutableHandle result(thread, JSTaggedValue::Undefined()); for (int i = 0; i < NODE_NUMBERS; i++) { diff --git a/ecmascript/dfx/cpu_profiler/cpu_profiler.cpp b/ecmascript/dfx/cpu_profiler/cpu_profiler.cpp index 194074dc6ac9d8158ef6546b0b6b40ff4b077682..b39e6d40e13d524eee7422d41a05c4129f51d3e6 100644 --- a/ecmascript/dfx/cpu_profiler/cpu_profiler.cpp +++ b/ecmascript/dfx/cpu_profiler/cpu_profiler.cpp @@ -183,14 +183,14 @@ void CpuProfiler::GetFrameStack(JSThread *thread) } auto *method = frameHandler.GetMethod(); if (method != nullptr && staticStackInfo_.count(method) == 0) { - ParseMethodInfo(method, thread, frameHandler); + ParseMethodInfo(method, frameHandler); } staticFrameStack_.push_back(method); } } } -void CpuProfiler::ParseMethodInfo(JSMethod *method, JSThread *thread, InterpretedFrameHandler frameHandler) +void CpuProfiler::ParseMethodInfo(JSMethod *method, InterpretedFrameHandler frameHandler) { struct StackInfo codeEntry; if (method != nullptr && method->IsNative()) { @@ -223,14 +223,18 @@ void CpuProfiler::ParseMethodInfo(JSMethod *method, JSThread *thread, Interprete } // line number int lineNumber = 0; - auto callbackFunc = [&](size_t line, [[maybe_unused]] size_t column) -> bool { - lineNumber = line + 1; + int columnNumber = 0; + auto callbackFunc = [&](size_t line, size_t column) -> bool { + lineNumber = static_cast(line) + 1; + columnNumber = static_cast(column) + 1; return true; }; if (!debugExtractor->MatchWithOffset(callbackFunc, method->GetFileId(), frameHandler.GetBytecodeOffset())) { codeEntry.lineNumber = 0; + codeEntry.columnNumber = 0; } else { codeEntry.lineNumber = lineNumber; + codeEntry.columnNumber = columnNumber; } staticStackInfo_.insert(std::make_pair(method, codeEntry)); } @@ -248,7 +252,7 @@ void CpuProfiler::IsNeedAndGetStack(JSThread *thread) } } -void CpuProfiler::GetStackSignalHandler(int signal) +void CpuProfiler::GetStackSignalHandler([[maybe_unused]] int signal) { JSThread *thread = ProfileProcessor::GetJSThread(); GetFrameStack(thread); diff --git a/ecmascript/dfx/cpu_profiler/cpu_profiler.h b/ecmascript/dfx/cpu_profiler/cpu_profiler.h index a995e4aa7c9805f0cc2c1ac1b10118c2d606af88..6fbe2e3c9538da70b99cb027a737c63655df03e3 100644 --- a/ecmascript/dfx/cpu_profiler/cpu_profiler.h +++ b/ecmascript/dfx/cpu_profiler/cpu_profiler.h @@ -49,7 +49,7 @@ private: class CpuProfiler { public: static CpuProfiler *GetInstance(); - static void ParseMethodInfo(JSMethod *method, JSThread *thread, InterpretedFrameHandler frameHandler); + static void ParseMethodInfo(JSMethod *method, InterpretedFrameHandler frameHandler); static void GetFrameStack(JSThread *thread); static void IsNeedAndGetStack(JSThread *thread); static void GetStackSignalHandler(int signal); diff --git a/ecmascript/dfx/cpu_profiler/profile_processor.cpp b/ecmascript/dfx/cpu_profiler/profile_processor.cpp index eb396b6a720ec4c6d0c7f652d958361e994d1d76..fe030de7996b0d2bc77e8de95dbad751581bf99b 100644 --- a/ecmascript/dfx/cpu_profiler/profile_processor.cpp +++ b/ecmascript/dfx/cpu_profiler/profile_processor.cpp @@ -31,7 +31,7 @@ ProfileProcessor::ProfileProcessor(ProfileGenerator *generator, const EcmaVM *vm } ProfileProcessor::~ProfileProcessor() {} -bool ProfileProcessor::Run(uint32_t threadIndex) +bool ProfileProcessor::Run([[maybe_unused]] uint32_t threadIndex) { uint64_t startTime = 0; uint64_t endTime = 0; diff --git a/ecmascript/dfx/hprof/heap_profiler.cpp b/ecmascript/dfx/hprof/heap_profiler.cpp index a180b4d109209f449ecc56216109ae596ebbe8fa..d843d76fe7b4eb2a660829c681743434def9dfc7 100644 --- a/ecmascript/dfx/hprof/heap_profiler.cpp +++ b/ecmascript/dfx/hprof/heap_profiler.cpp @@ -66,7 +66,7 @@ bool HeapProfiler::StartHeapTracking(JSThread *thread, double timeInterval, bool return true; } -bool HeapProfiler::StopHeapTracking(JSThread *thread, DumpFormat dumpFormat, const std::string &path) +bool HeapProfiler::StopHeapTracking(JSThread *thread, const std::string &path) { if (heapTracker_ == nullptr) { return false; diff --git a/ecmascript/dfx/hprof/heap_profiler.h b/ecmascript/dfx/hprof/heap_profiler.h index cd9d2ebc330ca0d5261fa693bab5c52b228f652c..fa0e959471fc0b3c93573e0ef81c05524ce86ad6 100644 --- a/ecmascript/dfx/hprof/heap_profiler.h +++ b/ecmascript/dfx/hprof/heap_profiler.h @@ -50,7 +50,7 @@ public: void AddSnapShot(HeapSnapShot *snapshot); bool StartHeapTracking(JSThread *thread, double timeInterval, bool isVmMode = true) override; - bool StopHeapTracking(JSThread *thread, DumpFormat dumpFormat, const std::string &filePath) override; + bool StopHeapTracking(JSThread *thread, const std::string &filePath) override; private: /** diff --git a/ecmascript/dfx/hprof/heap_profiler_interface.h b/ecmascript/dfx/hprof/heap_profiler_interface.h index a731a64838d7f6dc0b5bb29135f14f87e0234ed5..01e9fe49848ef235f374e2da84564e09e772fff7 100644 --- a/ecmascript/dfx/hprof/heap_profiler_interface.h +++ b/ecmascript/dfx/hprof/heap_profiler_interface.h @@ -35,7 +35,7 @@ public: virtual ~HeapProfilerInterface() = default; virtual bool StartHeapTracking(JSThread *thread, double timeInterval, bool isVmMode = true) = 0; - virtual bool StopHeapTracking(JSThread *thread, DumpFormat dumpFormat, const std::string &filePath) = 0; + virtual bool StopHeapTracking(JSThread *thread, const std::string &filePath) = 0; NO_MOVE_SEMANTIC(HeapProfilerInterface); NO_COPY_SEMANTIC(HeapProfilerInterface); diff --git a/ecmascript/dfx/hprof/heap_snapshot.cpp b/ecmascript/dfx/hprof/heap_snapshot.cpp index 63f19177c2212067ba2c5dc6fead81c3600e0937..26ad80b37933295d757f06e6a58e156195cae8c2 100644 --- a/ecmascript/dfx/hprof/heap_snapshot.cpp +++ b/ecmascript/dfx/hprof/heap_snapshot.cpp @@ -77,8 +77,8 @@ HeapSnapShot::~HeapSnapShot() bool HeapSnapShot::BuildUp(JSThread *thread) { - FillNodes(thread); - FillEdges(thread); + FillNodes(); + FillEdges(); AddSyntheticRoot(thread); return Verify(); } @@ -91,7 +91,7 @@ bool HeapSnapShot::Verify() void HeapSnapShot::PrepareSnapShot() { - FillNodes(thread_); + FillNodes(); } void HeapSnapShot::UpdateNode() @@ -99,7 +99,7 @@ void HeapSnapShot::UpdateNode() for (Node *node : nodes_) { node->SetLive(false); } - FillNodes(thread_); + FillNodes(); for (auto iter = nodes_.begin(); iter != nodes_.end();) { if (!(*iter)->IsLive()) { @@ -113,7 +113,7 @@ void HeapSnapShot::UpdateNode() bool HeapSnapShot::FinishSnapShot() { UpdateNode(); - FillEdges(thread_); + FillEdges(); AddSyntheticRoot(thread_); return Verify(); } @@ -125,7 +125,7 @@ void HeapSnapShot::RecordSampleTime() void HeapSnapShot::AddNode(uintptr_t address) { - GenerateNode(thread_, JSTaggedValue(address)); + GenerateNode(JSTaggedValue(address)); } void HeapSnapShot::MoveNode(uintptr_t address, uintptr_t forward_address) @@ -136,11 +136,11 @@ void HeapSnapShot::MoveNode(uintptr_t address, uintptr_t forward_address) sequenceId = node->GetId(); EraseNodeUnique(node); } - GenerateNode(thread_, JSTaggedValue(forward_address), sequenceId); + GenerateNode(JSTaggedValue(forward_address), sequenceId); } // NOLINTNEXTLINE(readability-function-size) -CString *HeapSnapShot::GenerateNodeName(JSThread *thread, TaggedObject *entry) +CString *HeapSnapShot::GenerateNodeName(TaggedObject *entry) { auto *hCls = entry->GetClass(); JSType type = hCls->GetObjectType(); @@ -416,17 +416,18 @@ NodeType HeapSnapShot::GenerateNodeType(TaggedObject *entry) return nodeType; } -void HeapSnapShot::FillNodes(JSThread *thread) +void HeapSnapShot::FillNodes() { // Iterate Heap Object auto heap = thread_->GetEcmaVM()->GetHeap(); if (heap != nullptr) { - heap->IteratorOverObjects( - [this, &thread](TaggedObject *obj) { this->GenerateNode(thread, JSTaggedValue(obj)); }); + heap->IteratorOverObjects([this](TaggedObject *obj) { + GenerateNode(JSTaggedValue(obj)); + }); } } -Node *HeapSnapShot::GenerateNode(JSThread *thread, JSTaggedValue entry, int sequenceId) +Node *HeapSnapShot::GenerateNode(JSTaggedValue entry, int sequenceId) { Node *node = nullptr; if (sequenceId == -1) { @@ -445,7 +446,7 @@ Node *HeapSnapShot::GenerateNode(JSThread *thread, JSTaggedValue entry, int sequ TaggedObject *obj = entry.GetTaggedObject(); auto *baseClass = obj->GetClass(); if (baseClass != nullptr) { - node = Node::NewNode(heap_, sequenceId, nodeCount_, GenerateNodeName(thread, obj), GenerateNodeType(obj), + node = Node::NewNode(heap_, sequenceId, nodeCount_, GenerateNodeName(obj), GenerateNodeType(obj), obj->GetClass()->SizeFromJSHClass(obj), obj); Node *existNode = entryMap_.FindOrInsertNode(node); // Fast Index if (existNode == node) { @@ -522,7 +523,7 @@ Node *HeapSnapShot::GenerateStringNode(JSTaggedValue entry, int sequenceId) return node; } -void HeapSnapShot::FillEdges(JSThread *thread) +void HeapSnapShot::FillEdges() { size_t length = nodes_.size(); auto iter = nodes_.begin(); @@ -531,7 +532,7 @@ 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(nameResources, isVmMode_); JSTaggedValue objValue(objFrom); for (auto const &it : nameResources) { JSTaggedValue toValue = it.second; @@ -544,7 +545,7 @@ void HeapSnapShot::FillEdges(JSThread *thread) entryTo = entryMap_.FindEntry(Node::NewAddress(to)); } if (entryTo == nullptr) { - entryTo = GenerateNode(thread, toValue); + entryTo = GenerateNode(toValue); } if (entryTo != nullptr) { Edge *edge = Edge::NewEdge(heap_, edgeCount_, EdgeType::DEFAULT, *iter, entryTo, GetString(it.first)); diff --git a/ecmascript/dfx/hprof/heap_snapshot.h b/ecmascript/dfx/hprof/heap_snapshot.h index 755a91fd2f02c7cd5605df76312e57a89d788390..9c9c6aa5e81c1672571dcdb4bb306d6b8bb2a4b0 100644 --- a/ecmascript/dfx/hprof/heap_snapshot.h +++ b/ecmascript/dfx/hprof/heap_snapshot.h @@ -278,7 +278,7 @@ public: { totalNodesSize_ -= size; } - CString *GenerateNodeName(JSThread *thread, TaggedObject *entry); + CString *GenerateNodeName(TaggedObject *entry); NodeType GenerateNodeType(TaggedObject *entry); const CList *GetNodes() const { @@ -301,10 +301,10 @@ public: } private: - void FillNodes(JSThread *thread); - Node *GenerateNode(JSThread *thread, JSTaggedValue entry, int sequenceId = -1); + void FillNodes(); + Node *GenerateNode(JSTaggedValue entry, int sequenceId = -1); Node *GenerateStringNode(JSTaggedValue entry, int sequenceId); - void FillEdges(JSThread *thread); + void FillEdges(); void BridgeAllReferences(); CString *GenerateEdgeName(TaggedObject *from, TaggedObject *to); diff --git a/ecmascript/dfx/hprof/tests/heap_tracker_test.cpp b/ecmascript/dfx/hprof/tests/heap_tracker_test.cpp index efa07ac8785eb94b902e6ad7b38d39f0d0156e92..f7c214e8f4caf52a25ccb05dd0767f305e9f8d26 100644 --- a/ecmascript/dfx/hprof/tests/heap_tracker_test.cpp +++ b/ecmascript/dfx/hprof/tests/heap_tracker_test.cpp @@ -84,7 +84,7 @@ HWTEST_F_L0(HeapTrackerTest, HeapTracker) outputString.close(); outputString.clear(); - heapProfile->StopHeapTracking(thread, DumpFormat::JSON, fileName.c_str()); + heapProfile->StopHeapTracking(thread, fileName.c_str()); HeapProfilerInterface::Destroy(thread, heapProfile); // Check diff --git a/ecmascript/dump.cpp b/ecmascript/dump.cpp index 1edb9b8c5f6e2e74030a5c7e714c1b464926adac..6e8a54c1c5876f33c712089a854c027136e033d0 100644 --- a/ecmascript/dump.cpp +++ b/ecmascript/dump.cpp @@ -305,7 +305,7 @@ CString JSHClass::DumpJSType(JSType type) } } -static void DumpArrayClass(JSThread *thread, const TaggedArray *arr, std::ostream &os) +static void DumpArrayClass(const TaggedArray *arr, std::ostream &os) { DISALLOW_GARBAGE_COLLECTION; uint32_t len = arr->GetLength(); @@ -314,7 +314,7 @@ static void DumpArrayClass(JSThread *thread, const TaggedArray *arr, std::ostrea JSTaggedValue val(arr->Get(i)); if (!val.IsHole()) { os << std::right << std::setw(DUMP_PROPERTY_OFFSET) << i << ": "; - val.DumpTaggedValue(thread, os); + val.DumpTaggedValue(os); os << "\n"; } } @@ -339,29 +339,29 @@ static void DumpPropertyKey(JSTaggedValue key, std::ostream &os) } } -static void DumpHClass(JSThread *thread, const JSHClass *jshclass, std::ostream &os, bool withDetail) +static void DumpHClass(const JSHClass *jshclass, std::ostream &os, bool withDetail) { DISALLOW_GARBAGE_COLLECTION; os << "JSHClass :" << std::setw(DUMP_TYPE_OFFSET); os << "Type :" << JSHClass::DumpJSType(jshclass->GetObjectType()) << "\n"; os << " - Prototype :" << std::setw(DUMP_TYPE_OFFSET); - jshclass->GetPrototype().DumpTaggedValue(thread, os); + jshclass->GetPrototype().DumpTaggedValue(os); os << "\n"; os << " - PropertyDescriptors :" << std::setw(DUMP_TYPE_OFFSET); JSTaggedValue attrs = jshclass->GetLayout(); - attrs.DumpTaggedValue(thread, os); + attrs.DumpTaggedValue(os); os << "\n"; if (withDetail && !attrs.IsNull()) { LayoutInfo *layoutInfo = LayoutInfo::Cast(attrs.GetTaggedObject()); - layoutInfo->Dump(thread, os); + layoutInfo->Dump(os); } os << " - Transitions :" << std::setw(DUMP_TYPE_OFFSET); JSTaggedValue transtions = jshclass->GetTransitions(); - transtions.DumpTaggedValue(thread, os); + transtions.DumpTaggedValue(os); os << "\n"; if (withDetail && !transtions.IsNull()) { - transtions.Dump(thread, os); + transtions.Dump(os); } os << " - Flags : " << std::setw(DUMP_TYPE_OFFSET); @@ -374,11 +374,11 @@ static void DumpHClass(JSThread *thread, const JSHClass *jshclass, std::ostream os << "\n"; } -static void DumpDynClass(JSThread *thread, TaggedObject *obj, std::ostream &os) +static void DumpDynClass(TaggedObject *obj, std::ostream &os) { JSHClass *hclass = obj->GetClass(); os << "JSHClass :" << std::setw(DUMP_TYPE_OFFSET) << " klass_(" << std::hex << hclass << ")\n"; - DumpHClass(thread, hclass, os, true); + DumpHClass(hclass, os, true); } static void DumpAttr(const PropertyAttributes &attr, bool fastMode, std::ostream &os) @@ -412,7 +412,7 @@ static void DumpAttr(const PropertyAttributes &attr, bool fastMode, std::ostream } } -static void DumpObject(JSThread *thread, TaggedObject *obj, std::ostream &os) +static void DumpObject(TaggedObject *obj, std::ostream &os) { DISALLOW_GARBAGE_COLLECTION; auto jsHclass = obj->GetClass(); @@ -420,11 +420,11 @@ static void DumpObject(JSThread *thread, TaggedObject *obj, std::ostream &os) switch (type) { case JSType::HCLASS: - return DumpDynClass(thread, obj, os); + return DumpDynClass(obj, os); case JSType::TAGGED_ARRAY: case JSType::TAGGED_DICTIONARY: case JSType::TEMPLATE_MAP: - DumpArrayClass(thread, TaggedArray::Cast(obj), os); + DumpArrayClass(TaggedArray::Cast(obj), os); break; case JSType::STRING: DumpStringClass(EcmaString::Cast(obj), os); @@ -443,39 +443,39 @@ static void DumpObject(JSThread *thread, TaggedObject *obj, std::ostream &os) case JSType::JS_SYNTAX_ERROR: case JSType::JS_ARGUMENTS: case JSType::JS_FUNCTION_BASE: - JSObject::Cast(obj)->Dump(thread, os); + JSObject::Cast(obj)->Dump(os); break; case JSType::GLOBAL_ENV: - GlobalEnv::Cast(obj)->Dump(thread, os); + GlobalEnv::Cast(obj)->Dump(os); break; case JSType::ACCESSOR_DATA: break; case JSType::JS_FUNCTION: - JSFunction::Cast(obj)->Dump(thread, os); + JSFunction::Cast(obj)->Dump(os); break; case JSType::JS_BOUND_FUNCTION: - JSBoundFunction::Cast(obj)->Dump(thread, os); + JSBoundFunction::Cast(obj)->Dump(os); break; case JSType::JS_SET: - JSSet::Cast(obj)->Dump(thread, os); + JSSet::Cast(obj)->Dump(os); break; case JSType::JS_MAP: - JSMap::Cast(obj)->Dump(thread, os); + JSMap::Cast(obj)->Dump(os); break; case JSType::JS_WEAK_SET: - JSWeakSet::Cast(obj)->Dump(thread, os); + JSWeakSet::Cast(obj)->Dump(os); break; case JSType::JS_WEAK_MAP: - JSWeakMap::Cast(obj)->Dump(thread, os); + JSWeakMap::Cast(obj)->Dump(os); break; case JSType::JS_REG_EXP: - JSRegExp::Cast(obj)->Dump(thread, os); + JSRegExp::Cast(obj)->Dump(os); break; case JSType::JS_DATE: - JSDate::Cast(obj)->Dump(thread, os); + JSDate::Cast(obj)->Dump(os); break; case JSType::JS_ARRAY: - JSArray::Cast(obj)->Dump(thread, os); + JSArray::Cast(obj)->Dump(os); break; case JSType::JS_TYPED_ARRAY: case JSType::JS_INT8_ARRAY: @@ -489,223 +489,223 @@ static void DumpObject(JSThread *thread, TaggedObject *obj, std::ostream &os) case JSType::JS_FLOAT64_ARRAY: case JSType::JS_BIGINT64_ARRAY: case JSType::JS_BIGUINT64_ARRAY: - JSTypedArray::Cast(obj)->Dump(thread, os); + JSTypedArray::Cast(obj)->Dump(os); break; case JSType::BIGINT: - BigInt::Cast(obj)->Dump(thread, os); + BigInt::Cast(obj)->Dump(os); break; case JSType::JS_PROXY: - JSProxy::Cast(obj)->Dump(thread, os); + JSProxy::Cast(obj)->Dump(os); break; case JSType::JS_PRIMITIVE_REF: - JSPrimitiveRef::Cast(obj)->Dump(thread, os); + JSPrimitiveRef::Cast(obj)->Dump(os); break; case JSType::SYMBOL: - JSSymbol::Cast(obj)->Dump(thread, os); + JSSymbol::Cast(obj)->Dump(os); break; case JSType::JS_DATA_VIEW: - JSDataView::Cast(obj)->Dump(thread, os); + JSDataView::Cast(obj)->Dump(os); break; case JSType::JS_ARRAY_BUFFER: - JSArrayBuffer::Cast(obj)->Dump(thread, os); + JSArrayBuffer::Cast(obj)->Dump(os); break; case JSType::PROMISE_REACTIONS: - PromiseReaction::Cast(obj)->Dump(thread, os); + PromiseReaction::Cast(obj)->Dump(os); break; case JSType::PROMISE_CAPABILITY: - PromiseCapability::Cast(obj)->Dump(thread, os); + PromiseCapability::Cast(obj)->Dump(os); break; case JSType::PROMISE_ITERATOR_RECORD: - PromiseIteratorRecord::Cast(obj)->Dump(thread, os); + PromiseIteratorRecord::Cast(obj)->Dump(os); break; case JSType::PROMISE_RECORD: - PromiseRecord::Cast(obj)->Dump(thread, os); + PromiseRecord::Cast(obj)->Dump(os); break; case JSType::RESOLVING_FUNCTIONS_RECORD: - ResolvingFunctionsRecord::Cast(obj)->Dump(thread, os); + ResolvingFunctionsRecord::Cast(obj)->Dump(os); break; case JSType::JS_PROMISE: - JSPromise::Cast(obj)->Dump(thread, os); + JSPromise::Cast(obj)->Dump(os); break; case JSType::JS_PROMISE_REACTIONS_FUNCTION: - JSPromiseReactionsFunction::Cast(obj)->Dump(thread, os); + JSPromiseReactionsFunction::Cast(obj)->Dump(os); break; case JSType::JS_PROMISE_EXECUTOR_FUNCTION: - JSPromiseExecutorFunction::Cast(obj)->Dump(thread, os); + JSPromiseExecutorFunction::Cast(obj)->Dump(os); break; case JSType::JS_PROMISE_ALL_RESOLVE_ELEMENT_FUNCTION: - JSPromiseAllResolveElementFunction::Cast(obj)->Dump(thread, os); + JSPromiseAllResolveElementFunction::Cast(obj)->Dump(os); break; case JSType::MICRO_JOB_QUEUE: - MicroJobQueue::Cast(obj)->Dump(thread, os); + MicroJobQueue::Cast(obj)->Dump(os); break; case JSType::PENDING_JOB: - PendingJob::Cast(obj)->Dump(thread, os); + PendingJob::Cast(obj)->Dump(os); break; case JSType::COMPLETION_RECORD: - CompletionRecord::Cast(obj)->Dump(thread, os); + CompletionRecord::Cast(obj)->Dump(os); break; case JSType::JS_PROXY_REVOC_FUNCTION: - JSProxyRevocFunction::Cast(obj)->Dump(thread, os); + JSProxyRevocFunction::Cast(obj)->Dump(os); break; case JSType::JS_ASYNC_FUNCTION: - JSAsyncFunction::Cast(obj)->Dump(thread, os); + JSAsyncFunction::Cast(obj)->Dump(os); break; case JSType::JS_ASYNC_AWAIT_STATUS_FUNCTION: - JSAsyncAwaitStatusFunction::Cast(obj)->Dump(thread, os); + JSAsyncAwaitStatusFunction::Cast(obj)->Dump(os); break; case JSType::JS_GENERATOR_FUNCTION: - JSGeneratorFunction::Cast(obj)->Dump(thread, os); + JSGeneratorFunction::Cast(obj)->Dump(os); break; case JSType::JS_INTL_BOUND_FUNCTION: - JSIntlBoundFunction::Cast(obj)->Dump(thread, os); + JSIntlBoundFunction::Cast(obj)->Dump(os); break; case JSType::JS_ITERATOR: break; case JSType::JS_FORIN_ITERATOR: - JSForInIterator::Cast(obj)->Dump(thread, os); + JSForInIterator::Cast(obj)->Dump(os); break; case JSType::JS_MAP_ITERATOR: - JSMapIterator::Cast(obj)->Dump(thread, os); + JSMapIterator::Cast(obj)->Dump(os); break; case JSType::JS_SET_ITERATOR: - JSSetIterator::Cast(obj)->Dump(thread, os); + JSSetIterator::Cast(obj)->Dump(os); break; case JSType::JS_ARRAY_ITERATOR: - JSArrayIterator::Cast(obj)->Dump(thread, os); + JSArrayIterator::Cast(obj)->Dump(os); break; case JSType::JS_STRING_ITERATOR: - JSStringIterator::Cast(obj)->Dump(thread, os); + JSStringIterator::Cast(obj)->Dump(os); break; case JSType::PROTOTYPE_HANDLER: - PrototypeHandler::Cast(obj)->Dump(thread, os); + PrototypeHandler::Cast(obj)->Dump(os); break; case JSType::TRANSITION_HANDLER: - TransitionHandler::Cast(obj)->Dump(thread, os); + TransitionHandler::Cast(obj)->Dump(os); break; case JSType::PROPERTY_BOX: - PropertyBox::Cast(obj)->Dump(thread, os); + PropertyBox::Cast(obj)->Dump(os); break; case JSType::JS_REALM: - JSRealm::Cast(obj)->Dump(thread, os); + JSRealm::Cast(obj)->Dump(os); break; case JSType::JS_INTL: - JSIntl::Cast(obj)->Dump(thread, os); + JSIntl::Cast(obj)->Dump(os); break; case JSType::JS_LOCALE: - JSLocale::Cast(obj)->Dump(thread, os); + JSLocale::Cast(obj)->Dump(os); break; case JSType::JS_DATE_TIME_FORMAT: - JSDateTimeFormat::Cast(obj)->Dump(thread, os); + JSDateTimeFormat::Cast(obj)->Dump(os); break; case JSType::JS_RELATIVE_TIME_FORMAT: - JSRelativeTimeFormat::Cast(obj)->Dump(thread, os); + JSRelativeTimeFormat::Cast(obj)->Dump(os); break; case JSType::JS_NUMBER_FORMAT: - JSNumberFormat::Cast(obj)->Dump(thread, os); + JSNumberFormat::Cast(obj)->Dump(os); break; case JSType::JS_COLLATOR: - JSCollator::Cast(obj)->Dump(thread, os); + JSCollator::Cast(obj)->Dump(os); break; case JSType::JS_PLURAL_RULES: - JSPluralRules::Cast(obj)->Dump(thread, os); + JSPluralRules::Cast(obj)->Dump(os); break; case JSType::JS_GENERATOR_OBJECT: - JSGeneratorObject::Cast(obj)->Dump(thread, os); + JSGeneratorObject::Cast(obj)->Dump(os); break; case JSType::JS_ASYNC_FUNC_OBJECT: - JSAsyncFuncObject::Cast(obj)->Dump(thread, os); + JSAsyncFuncObject::Cast(obj)->Dump(os); break; case JSType::JS_GENERATOR_CONTEXT: - GeneratorContext::Cast(obj)->Dump(thread, os); + GeneratorContext::Cast(obj)->Dump(os); break; case JSType::PROTOTYPE_INFO: - ProtoChangeDetails::Cast(obj)->Dump(thread, os); + ProtoChangeDetails::Cast(obj)->Dump(os); break; case JSType::PROTO_CHANGE_MARKER: - ProtoChangeMarker::Cast(obj)->Dump(thread, os); + ProtoChangeMarker::Cast(obj)->Dump(os); break; case JSType::PROGRAM: - Program::Cast(obj)->Dump(thread, os); + Program::Cast(obj)->Dump(os); break; case JSType::MACHINE_CODE_OBJECT: - MachineCode::Cast(obj)->Dump(thread, os); + MachineCode::Cast(obj)->Dump(os); break; case JSType::CLASS_INFO_EXTRACTOR: - ClassInfoExtractor::Cast(obj)->Dump(thread, os); + ClassInfoExtractor::Cast(obj)->Dump(os); break; case JSType::JS_API_ARRAY_LIST: - JSAPIArrayList::Cast(obj)->Dump(thread, os); + JSAPIArrayList::Cast(obj)->Dump(os); break; case JSType::JS_API_ARRAYLIST_ITERATOR: - JSAPIArrayListIterator::Cast(obj)->Dump(thread, os); + JSAPIArrayListIterator::Cast(obj)->Dump(os); break; case JSType::TS_OBJECT_TYPE: - TSObjectType::Cast(obj)->Dump(thread, os); + TSObjectType::Cast(obj)->Dump(os); break; case JSType::TS_CLASS_TYPE: - TSClassType::Cast(obj)->Dump(thread, os); + TSClassType::Cast(obj)->Dump(os); break; case JSType::TS_INTERFACE_TYPE: - TSInterfaceType::Cast(obj)->Dump(thread, os); + TSInterfaceType::Cast(obj)->Dump(os); break; case JSType::TS_IMPORT_TYPE: - TSImportType::Cast(obj)->Dump(thread, os); + TSImportType::Cast(obj)->Dump(os); break; case JSType::TS_CLASS_INSTANCE_TYPE: - TSClassInstanceType::Cast(obj)->Dump(thread, os); + TSClassInstanceType::Cast(obj)->Dump(os); break; case JSType::TS_UNION_TYPE: - TSUnionType::Cast(obj)->Dump(thread, os); + TSUnionType::Cast(obj)->Dump(os); break; case JSType::TS_FUNCTION_TYPE: - TSFunctionType::Cast(obj)->Dump(thread, os); + TSFunctionType::Cast(obj)->Dump(os); break; case JSType::TS_ARRAY_TYPE: - TSArrayType::Cast(obj)->Dump(thread, os); + TSArrayType::Cast(obj)->Dump(os); break; case JSType::JS_API_TREE_MAP: - JSAPITreeMap::Cast(obj)->Dump(thread, os); + JSAPITreeMap::Cast(obj)->Dump(os); break; case JSType::JS_API_TREE_SET: - JSAPITreeSet::Cast(obj)->Dump(thread, os); + JSAPITreeSet::Cast(obj)->Dump(os); break; case JSType::JS_API_TREEMAP_ITERATOR: - JSAPITreeMapIterator::Cast(obj)->Dump(thread, os); + JSAPITreeMapIterator::Cast(obj)->Dump(os); break; case JSType::JS_API_TREESET_ITERATOR: - JSAPITreeSetIterator::Cast(obj)->Dump(thread, os); + JSAPITreeSetIterator::Cast(obj)->Dump(os); break; case JSType::JS_API_QUEUE: - JSAPIQueue::Cast(obj)->Dump(thread, os); + JSAPIQueue::Cast(obj)->Dump(os); break; case JSType::JS_API_QUEUE_ITERATOR: - JSAPIQueueIterator::Cast(obj)->Dump(thread, os); + JSAPIQueueIterator::Cast(obj)->Dump(os); break; case JSType::SOURCE_TEXT_MODULE_RECORD: - SourceTextModule::Cast(obj)->Dump(thread, os); + SourceTextModule::Cast(obj)->Dump(os); break; case JSType::IMPORTENTRY_RECORD: - ImportEntry::Cast(obj)->Dump(thread, os); + ImportEntry::Cast(obj)->Dump(os); break; case JSType::EXPORTENTRY_RECORD: - ExportEntry::Cast(obj)->Dump(thread, os); + ExportEntry::Cast(obj)->Dump(os); break; case JSType::RESOLVEDBINDING_RECORD: - ResolvedBinding::Cast(obj)->Dump(thread, os); + ResolvedBinding::Cast(obj)->Dump(os); break; case JSType::JS_MODULE_NAMESPACE: - ModuleNamespace::Cast(obj)->Dump(thread, os); + ModuleNamespace::Cast(obj)->Dump(os); break; default: UNREACHABLE(); break; } - DumpHClass(thread, jsHclass, os, false); + DumpHClass(jsHclass, os, false); } -void JSTaggedValue::DumpSpecialValue([[maybe_unused]] JSThread *thread, std::ostream &os) const +void JSTaggedValue::DumpSpecialValue(std::ostream &os) const { ASSERT(IsSpecial()); os << "[Special Value] : "; @@ -734,7 +734,7 @@ void JSTaggedValue::DumpSpecialValue([[maybe_unused]] JSThread *thread, std::ost } } -void JSTaggedValue::DumpHeapObjectType([[maybe_unused]] JSThread *thread, std::ostream &os) const +void JSTaggedValue::DumpHeapObjectType(std::ostream &os) const { ASSERT(IsWeak() || IsHeapObject()); bool isWeak = IsWeak(); @@ -757,7 +757,7 @@ void JSTaggedValue::DumpHeapObjectType([[maybe_unused]] JSThread *thread, std::o } } -void JSTaggedValue::DumpTaggedValue(JSThread *thread, std::ostream &os) const +void JSTaggedValue::DumpTaggedValue(std::ostream &os) const { if (IsInt()) { os << std::left << std::setw(DUMP_TYPE_OFFSET) << "[Int] : " << std::hex << "0x" << GetInt() << std::dec << " (" @@ -765,29 +765,26 @@ void JSTaggedValue::DumpTaggedValue(JSThread *thread, std::ostream &os) const } else if (IsDouble()) { os << std::left << std::setw(DUMP_TYPE_OFFSET) << "[Double] : " << GetDouble(); } else if (IsSpecial()) { - DumpSpecialValue(thread, os); + DumpSpecialValue(os); } else { - DumpHeapObjectType(thread, os); + DumpHeapObjectType(os); } } -void JSTaggedValue::Dump(JSThread *thread, std::ostream &os) const +void JSTaggedValue::Dump(std::ostream &os) const { - DumpTaggedValue(thread, os); + DumpTaggedValue(os); os << "\n"; if (IsHeapObject()) { TaggedObject *obj = GetTaggedObject(); - if (thread == nullptr) { - thread = obj->GetJSThread(); - } - DumpObject(thread, obj, os); + DumpObject(obj, os); } } void JSTaggedValue::D() const { - Dump(nullptr, std::cout); + Dump(std::cout); } void JSTaggedValue::DV(JSTaggedType val) @@ -801,7 +798,7 @@ void JSThread::DumpStack() handler.DumpStack(std::cout); } -void NumberDictionary::Dump(JSThread *thread, std::ostream &os) const +void NumberDictionary::Dump(std::ostream &os) const { DISALLOW_GARBAGE_COLLECTION; int size = Size(); @@ -811,7 +808,7 @@ void NumberDictionary::Dump(JSThread *thread, std::ostream &os) const JSTaggedValue val(GetValue(hashIndex)); os << std::right << std::setw(DUMP_PROPERTY_OFFSET) << static_cast(JSTaggedNumber(key).GetNumber()) << ": "; - val.DumpTaggedValue(thread, os); + val.DumpTaggedValue(os); os << " "; DumpAttr(GetAttributes(hashIndex), false, os); os << "\n"; @@ -819,7 +816,7 @@ void NumberDictionary::Dump(JSThread *thread, std::ostream &os) const } } -void NameDictionary::Dump(JSThread *thread, std::ostream &os) const +void NameDictionary::Dump(std::ostream &os) const { DISALLOW_GARBAGE_COLLECTION; int size = Size(); @@ -830,7 +827,7 @@ void NameDictionary::Dump(JSThread *thread, std::ostream &os) const os << std::right << std::setw(DUMP_PROPERTY_OFFSET); DumpPropertyKey(key, os); os << ": "; - val.DumpTaggedValue(thread, os); + val.DumpTaggedValue(os); os << " "; DumpAttr(GetAttributes(hashIndex), false, os); os << "\n"; @@ -838,7 +835,7 @@ void NameDictionary::Dump(JSThread *thread, std::ostream &os) const } } -void GlobalDictionary::Dump(JSThread *thread, std::ostream &os) const +void GlobalDictionary::Dump(std::ostream &os) const { DISALLOW_GARBAGE_COLLECTION; int size = Size(); @@ -849,7 +846,7 @@ void GlobalDictionary::Dump(JSThread *thread, std::ostream &os) const os << std::right << std::setw(DUMP_PROPERTY_OFFSET); DumpPropertyKey(key, os); os << " : "; - val.DumpTaggedValue(thread, os); + val.DumpTaggedValue(os); os << " "; DumpAttr(GetAttributes(hashIndex), false, os); os << "\n"; @@ -857,7 +854,7 @@ void GlobalDictionary::Dump(JSThread *thread, std::ostream &os) const } } -void LayoutInfo::Dump([[maybe_unused]] JSThread *thread, std::ostream &os) const +void LayoutInfo::Dump(std::ostream &os) const { DISALLOW_GARBAGE_COLLECTION; int num = NumberOfElements(); @@ -873,7 +870,7 @@ void LayoutInfo::Dump([[maybe_unused]] JSThread *thread, std::ostream &os) const } } -void TransitionsDictionary::Dump(JSThread *thread, std::ostream &os) const +void TransitionsDictionary::Dump(std::ostream &os) const { DISALLOW_GARBAGE_COLLECTION; int size = Size(); @@ -883,15 +880,15 @@ void TransitionsDictionary::Dump(JSThread *thread, std::ostream &os) const os << std::right << std::setw(DUMP_PROPERTY_OFFSET); DumpPropertyKey(key, os); os << " : "; - GetValue(hashIndex).DumpTaggedValue(thread, os); + GetValue(hashIndex).DumpTaggedValue(os); os << " : "; - GetAttributes(hashIndex).DumpTaggedValue(thread, os); + GetAttributes(hashIndex).DumpTaggedValue(os); os << "\n"; } } } -void LinkedHashSet::Dump(JSThread *thread, std::ostream &os) const +void LinkedHashSet::Dump(std::ostream &os) const { DISALLOW_GARBAGE_COLLECTION; int capacity = NumberOfElements() + NumberOfDeletedElements(); @@ -899,13 +896,13 @@ void LinkedHashSet::Dump(JSThread *thread, std::ostream &os) const JSTaggedValue key(GetKey(hashIndex)); if (!key.IsUndefined() && !key.IsHole()) { os << std::right << std::setw(DUMP_PROPERTY_OFFSET); - key.DumpTaggedValue(thread, os); + key.DumpTaggedValue(os); os << "\n"; } } } -void LinkedHashMap::Dump(JSThread *thread, std::ostream &os) const +void LinkedHashMap::Dump(std::ostream &os) const { DISALLOW_GARBAGE_COLLECTION; int capacity = NumberOfElements() + NumberOfDeletedElements(); @@ -914,21 +911,21 @@ void LinkedHashMap::Dump(JSThread *thread, std::ostream &os) const if (!key.IsUndefined() && !key.IsHole()) { JSTaggedValue val(GetValue(hashIndex)); os << std::right << std::setw(DUMP_PROPERTY_OFFSET); - key.DumpTaggedValue(thread, os); + key.DumpTaggedValue(os); os << ": "; - val.DumpTaggedValue(thread, os); + val.DumpTaggedValue(os); os << "\n"; } } } -void JSObject::Dump(JSThread *thread, std::ostream &os) const +void JSObject::Dump(std::ostream &os) const { DISALLOW_GARBAGE_COLLECTION; JSHClass *jshclass = GetJSHClass(); os << " - hclass: " << std::hex << jshclass << "\n"; os << " - prototype: "; - jshclass->GetPrototype().DumpTaggedValue(thread, os); + jshclass->GetPrototype().DumpTaggedValue(os); os << "\n"; TaggedArray *elements = TaggedArray::Cast(GetElements().GetTaggedObject()); @@ -936,11 +933,11 @@ void JSObject::Dump(JSThread *thread, std::ostream &os) const if (elements->GetLength() == 0) { os << " NONE\n"; } else if (!elements->IsDictionaryMode()) { - DumpArrayClass(thread, elements, os); + DumpArrayClass(elements, os); } else { NumberDictionary *dict = NumberDictionary::Cast(elements); os << " EntriesCount() << "]>\n"; - dict->Dump(thread, os); + dict->Dump(os); } TaggedArray *properties = TaggedArray::Cast(GetProperties().GetTaggedObject()); @@ -948,7 +945,7 @@ void JSObject::Dump(JSThread *thread, std::ostream &os) const if (IsJSGlobalObject()) { GlobalDictionary *dict = GlobalDictionary::Cast(properties); os << " EntriesCount() << "]>\n"; - dict->Dump(thread, os); + dict->Dump(os); return; } @@ -974,7 +971,7 @@ void JSObject::Dump(JSThread *thread, std::ostream &os) const } else { val = properties->Get(i - jshclass->GetInlinedProperties()); } - val.DumpTaggedValue(thread, os); + val.DumpTaggedValue(os); os << ") "; DumpAttr(attr, true, os); os << "\n"; @@ -982,11 +979,11 @@ void JSObject::Dump(JSThread *thread, std::ostream &os) const } else { NameDictionary *dict = NameDictionary::Cast(properties); os << " EntriesCount() << "]>\n"; - dict->Dump(thread, os); + dict->Dump(os); } } -void AccessorData::Dump(JSThread *thread, std::ostream &os) const +void AccessorData::Dump(std::ostream &os) const { auto *hclass = GetClass(); if (hclass->GetObjectType() == JSType::INTERNAL_ACCESSOR) { @@ -996,27 +993,27 @@ void AccessorData::Dump(JSThread *thread, std::ostream &os) const } os << " - Getter: "; - GetGetter().DumpTaggedValue(thread, os); + GetGetter().DumpTaggedValue(os); os << "\n"; os << " - Setter: "; - GetSetter().DumpTaggedValue(thread, os); + GetSetter().DumpTaggedValue(os); os << "\n"; } -void Program::Dump(JSThread *thread, std::ostream &os) const +void Program::Dump(std::ostream &os) const { os << " - MainFunction: "; GetMainFunction().D(); os << "\n"; } -void ConstantPool::Dump(JSThread *thread, std::ostream &os) const +void ConstantPool::Dump(std::ostream &os) const { - DumpArrayClass(thread, this, os); + DumpArrayClass(this, os); } -void JSFunction::Dump(JSThread *thread, std::ostream &os) const +void JSFunction::Dump(std::ostream &os) const { os << " - ProtoOrDynClass: "; GetProtoOrDynClass().D(); @@ -1047,89 +1044,88 @@ void JSFunction::Dump(JSThread *thread, std::ostream &os) const os << " - Module: "; GetModule().D(); os << "\n"; - JSObject::Dump(thread, os); + JSObject::Dump(os); } -void JSHClass::Dump(JSThread *thread, std::ostream &os) const +void JSHClass::Dump(std::ostream &os) const { - DumpHClass(thread, this, os, true); + DumpHClass(this, os, true); } -void JSBoundFunction::Dump(JSThread *thread, std::ostream &os) const +void JSBoundFunction::Dump(std::ostream &os) const { os << " - BoundTarget: "; - GetBoundTarget().DumpTaggedValue(thread, os); + GetBoundTarget().DumpTaggedValue(os); os << "\n"; os << " - BoundThis: "; - GetBoundThis().DumpTaggedValue(thread, os); + GetBoundThis().DumpTaggedValue(os); os << "\n"; os << " - BoundArguments: "; - GetBoundArguments().DumpTaggedValue(thread, os); + GetBoundArguments().DumpTaggedValue(os); os << "\n"; - JSObject::Dump(thread, os); + JSObject::Dump(os); } -void JSPrimitiveRef::Dump(JSThread *thread, std::ostream &os) const +void JSPrimitiveRef::Dump(std::ostream &os) const { os << " - SubValue : "; - GetValue().DumpTaggedValue(thread, os); + GetValue().DumpTaggedValue(os); os << "\n"; - JSObject::Dump(thread, os); + JSObject::Dump(os); } -void BigInt::Dump(JSThread *thread, std::ostream &os) const +void BigInt::Dump(std::ostream &os) const { os << " - Data : "; - GetData().DumpTaggedValue(thread, os); + GetData().DumpTaggedValue(os); os << "\n"; os << " - value : " << ToStdString(DECIMAL) << "\n"; os << " - Sign : " << GetSign() << "\n"; } -void JSDate::Dump(JSThread *thread, std::ostream &os) const +void JSDate::Dump(std::ostream &os) const { os << " - time: " << GetTime().GetDouble() << "\n"; os << " - localOffset: " << GetLocalOffset().GetDouble() << "\n"; - JSObject::Dump(thread, os); + JSObject::Dump(os); } -void JSMap::Dump(JSThread *thread, std::ostream &os) const +void JSMap::Dump(std::ostream &os) const { LinkedHashMap *map = LinkedHashMap::Cast(GetLinkedMap().GetTaggedObject()); os << " - elements: " << std::dec << map->NumberOfElements() << "\n"; os << " - deleted-elements: " << std::dec << map->NumberOfDeletedElements() << "\n"; os << " - capacity: " << std::dec << map->Capacity() << "\n"; - JSObject::Dump(thread, os); + JSObject::Dump(os); os << " NumberOfElements() << "]>\n"; - map->Dump(thread, os); + map->Dump(os); } -void JSAPITreeMap::Dump(JSThread *thread, std::ostream &os) const +void JSAPITreeMap::Dump(std::ostream &os) const { TaggedTreeMap *map = TaggedTreeMap::Cast(GetTreeMap().GetTaggedObject()); os << " - elements: " << std::dec << map->NumberOfElements() << "\n"; os << " - deleted-elements: " << std::dec << map->NumberOfDeletedElements() << "\n"; os << " - capacity: " << std::dec << map->Capacity() << "\n"; - JSObject::Dump(thread, os); + JSObject::Dump(os); os << " NumberOfElements() << "]>\n"; - map->Dump(thread, os); + map->Dump(os); } -void JSAPITreeMap::DumpForSnapshot([[maybe_unused]] JSThread *thread, - std::vector> &vec) const +void JSAPITreeMap::DumpForSnapshot(std::vector> &vec) const { TaggedTreeMap *map = TaggedTreeMap::Cast(GetTreeMap().GetTaggedObject()); - map->DumpForSnapshot(thread, vec); + map->DumpForSnapshot(vec); - JSObject::DumpForSnapshot(thread, vec); + JSObject::DumpForSnapshot(vec); } -void JSAPITreeMapIterator::Dump(JSThread *thread, std::ostream &os) const +void JSAPITreeMapIterator::Dump(std::ostream &os) const { TaggedTreeMap *map = TaggedTreeMap::Cast(JSAPITreeMap::Cast(GetIteratedMap().GetTaggedObject())->GetTreeMap().GetTaggedObject()); @@ -1138,25 +1134,24 @@ void JSAPITreeMapIterator::Dump(JSThread *thread, std::ostream &os) const os << " - capacity: " << std::dec << map->Capacity() << "\n"; os << " - nextIndex: " << std::dec << GetNextIndex() << "\n"; os << " - IterationKind: " << std::dec << static_cast(GetIterationKind()) << "\n"; - JSObject::Dump(thread, os); + JSObject::Dump(os); os << " NumberOfElements() << "]>\n"; - map->Dump(thread, os); + map->Dump(os); } -void JSAPITreeMapIterator::DumpForSnapshot([[maybe_unused]] JSThread *thread, - std::vector> &vec) const +void JSAPITreeMapIterator::DumpForSnapshot(std::vector> &vec) const { TaggedTreeMap *map = TaggedTreeMap::Cast(JSAPITreeMap::Cast(GetIteratedMap().GetTaggedObject())->GetTreeMap().GetTaggedObject()); - map->DumpForSnapshot(thread, vec); + map->DumpForSnapshot(vec); vec.push_back(std::make_pair(CString("NextIndex"), JSTaggedValue(GetNextIndex()))); vec.push_back(std::make_pair(CString("IterationKind"), JSTaggedValue(static_cast(GetIterationKind())))); - JSObject::DumpForSnapshot(thread, vec); + JSObject::DumpForSnapshot(vec); } template -void DumpTaggedTreeEntry(JSThread *thread, T tree, std::ostream &os, int index, bool isMap = false) +void DumpTaggedTreeEntry(T tree, std::ostream &os, int index, bool isMap = false) { DISALLOW_GARBAGE_COLLECTION; JSTaggedValue parent(tree->GetParent(index)); @@ -1169,84 +1164,83 @@ void DumpTaggedTreeEntry(JSThread *thread, T tree, std::ostream &os, int index, if (isMap) { os << std::left << std::setw(DUMP_ELEMENT_OFFSET) << " [key]: {"; JSTaggedValue key(tree->GetKey(index)); - key.DumpTaggedValue(thread, os); + key.DumpTaggedValue(os); os << std::right << "};"; os << "\n"; } os << std::left << std::setw(DUMP_TYPE_OFFSET) << " [value]: {"; - val.DumpTaggedValue(thread, os); + val.DumpTaggedValue(os); os << std::right << "};"; os << "\n"; os << std::left << std::setw(DUMP_ELEMENT_OFFSET) << " [parent]: {"; - parent.DumpTaggedValue(thread, os); + parent.DumpTaggedValue(os); os << std::right << "};"; os << "\n"; os << std::left << std::setw(DUMP_TYPE_OFFSET) << " [color]: {"; - color.DumpTaggedValue(thread, os); + color.DumpTaggedValue(os); os << std::right << "};"; os << "\n"; os << std::left << std::setw(DUMP_ELEMENT_OFFSET) << " [left]: {"; - left.DumpTaggedValue(thread, os); + left.DumpTaggedValue(os); os << std::right << "}; "; os << std::left << std::setw(DUMP_TYPE_OFFSET) << " [right]: {"; - right.DumpTaggedValue(thread, os); + right.DumpTaggedValue(os); os << std::right << "};"; os << "\n"; } -void TaggedTreeMap::Dump(JSThread *thread, std::ostream &os) const +void TaggedTreeMap::Dump(std::ostream &os) const { DISALLOW_GARBAGE_COLLECTION; os << std::left << std::setw(DUMP_ELEMENT_OFFSET) << "[Elements]: {"; JSTaggedValue node = TaggedArray::Get(0); - node.DumpTaggedValue(thread, os); + node.DumpTaggedValue(os); os << std::right << "}" << "\n"; os << std::left << std::setw(DUMP_ELEMENT_OFFSET) << "[Delete]: {"; node = TaggedArray::Get(1); - node.DumpTaggedValue(thread, os); + node.DumpTaggedValue(os); os << std::right << "}" << "\n"; os << std::left << std::setw(DUMP_ELEMENT_OFFSET) << "[Capacity]: {"; node = TaggedArray::Get(2); // 2 means the three element - node.DumpTaggedValue(thread, os); + node.DumpTaggedValue(os); os << std::right << "}" << "\n"; os << std::left << std::setw(DUMP_ELEMENT_OFFSET) << "[RootNode]: {"; node = TaggedArray::Get(3); // 3 means the three element - node.DumpTaggedValue(thread, os); + node.DumpTaggedValue(os); os << std::right << "}" << "\n"; int capacity = NumberOfElements() + NumberOfDeletedElements(); for (int index = 0; index < capacity; index++) { if (GetKey(index).IsHole()) { os << std::left << std::setw(DUMP_ELEMENT_OFFSET) << "[entry] " << index << ": "; - GetKey(index).DumpTaggedValue(thread, os); + GetKey(index).DumpTaggedValue(os); os << "\n"; } else { - DumpTaggedTreeEntry(thread, const_cast(this), os, index, true); + DumpTaggedTreeEntry(const_cast(this), os, index, true); } } } -void JSAPITreeSet::Dump(JSThread *thread, std::ostream &os) const +void JSAPITreeSet::Dump(std::ostream &os) const { TaggedTreeSet *set = TaggedTreeSet::Cast(GetTreeSet().GetTaggedObject()); os << " - elements: " << std::dec << set->NumberOfElements() << "\n"; os << " - deleted-elements: " << std::dec << set->NumberOfDeletedElements() << "\n"; os << " - capacity: " << std::dec << set->Capacity() << "\n"; - JSObject::Dump(thread, os); + JSObject::Dump(os); os << " NumberOfElements() << "]>\n"; - set->Dump(thread, os); + set->Dump(os); } -void JSAPITreeSet::DumpForSnapshot([[maybe_unused]] JSThread *thread, - std::vector> &vec) const +void JSAPITreeSet::DumpForSnapshot(std::vector> &vec) const { TaggedTreeSet *set = TaggedTreeSet::Cast(GetTreeSet().GetTaggedObject()); - set->DumpForSnapshot(thread, vec); + set->DumpForSnapshot(vec); - JSObject::DumpForSnapshot(thread, vec); + JSObject::DumpForSnapshot(vec); } -void JSAPITreeSetIterator::Dump(JSThread *thread, std::ostream &os) const +void JSAPITreeSetIterator::Dump(std::ostream &os) const { TaggedTreeSet *set = TaggedTreeSet::Cast(JSAPITreeSet::Cast(GetIteratedSet().GetTaggedObject())->GetTreeSet().GetTaggedObject()); @@ -1255,72 +1249,71 @@ void JSAPITreeSetIterator::Dump(JSThread *thread, std::ostream &os) const os << " - capacity: " << std::dec << set->Capacity() << "\n"; os << " - nextIndex: " << std::dec << GetNextIndex() << "\n"; os << " - IterationKind: " << std::dec << static_cast(GetIterationKind()) << "\n"; - JSObject::Dump(thread, os); + JSObject::Dump(os); os << " NumberOfElements() << "]>\n"; - set->Dump(thread, os); + set->Dump(os); } -void JSAPITreeSetIterator::DumpForSnapshot([[maybe_unused]] JSThread *thread, - std::vector> &vec) const +void JSAPITreeSetIterator::DumpForSnapshot(std::vector> &vec) const { TaggedTreeSet *set = TaggedTreeSet::Cast(JSAPITreeSet::Cast(GetIteratedSet().GetTaggedObject())->GetTreeSet().GetTaggedObject()); - set->DumpForSnapshot(thread, vec); + set->DumpForSnapshot(vec); vec.push_back(std::make_pair(CString("NextIndex"), JSTaggedValue(GetNextIndex()))); vec.push_back(std::make_pair(CString("IterationKind"), JSTaggedValue(static_cast(GetIterationKind())))); - JSObject::DumpForSnapshot(thread, vec); + JSObject::DumpForSnapshot(vec); } -void TaggedTreeSet::Dump(JSThread *thread, std::ostream &os) const +void TaggedTreeSet::Dump(std::ostream &os) const { DISALLOW_GARBAGE_COLLECTION; os << std::left << std::setw(DUMP_ELEMENT_OFFSET) << "[Elements]: {"; JSTaggedValue node = TaggedArray::Get(0); - node.DumpTaggedValue(thread, os); + node.DumpTaggedValue(os); os << std::right << "}" << "\n"; os << std::left << std::setw(DUMP_ELEMENT_OFFSET) << "[Delete]: {"; node = TaggedArray::Get(1); - node.DumpTaggedValue(thread, os); + node.DumpTaggedValue(os); os << std::right << "}" << "\n"; os << std::left << std::setw(DUMP_ELEMENT_OFFSET) << "[Capacity]: {"; node = TaggedArray::Get(2); // 2 means the three element - node.DumpTaggedValue(thread, os); + node.DumpTaggedValue(os); os << std::right << "}" << "\n"; os << std::left << std::setw(DUMP_ELEMENT_OFFSET) << "[RootNode]: {"; node = TaggedArray::Get(3); // 3 means the three element - node.DumpTaggedValue(thread, os); + node.DumpTaggedValue(os); os << std::right << "}" << "\n"; int capacity = NumberOfElements() + NumberOfDeletedElements(); for (int index = 0; index < capacity; index++) { if (GetKey(index).IsHole()) { os << std::left << std::setw(DUMP_ELEMENT_OFFSET) << "[entry] " << index << ": "; - GetKey(index).DumpTaggedValue(thread, os); + GetKey(index).DumpTaggedValue(os); os << "\n"; } else { - DumpTaggedTreeEntry(thread, const_cast(this), os, index); + DumpTaggedTreeEntry(const_cast(this), os, index); } } } -void JSForInIterator::Dump(JSThread *thread, std::ostream &os) const +void JSForInIterator::Dump(std::ostream &os) const { os << " - Object : "; - GetObject().DumpTaggedValue(thread, os); + GetObject().DumpTaggedValue(os); os << "\n"; os << " - WasVisited : " << GetWasVisited(); os << "\n"; os << " - VisitedKeys : "; - GetVisitedKeys().DumpTaggedValue(thread, os); + GetVisitedKeys().DumpTaggedValue(os); os << "\n"; os << " - RemainingKeys : "; - GetRemainingKeys().DumpTaggedValue(thread, os); + GetRemainingKeys().DumpTaggedValue(os); os << "\n"; - JSObject::Dump(thread, os); + JSObject::Dump(os); } -void JSMapIterator::Dump(JSThread *thread, std::ostream &os) const +void JSMapIterator::Dump(std::ostream &os) const { LinkedHashMap *map = LinkedHashMap::Cast(GetIteratedMap().GetTaggedObject()); os << " - elements: " << std::dec << map->NumberOfElements() << "\n"; @@ -1328,51 +1321,51 @@ void JSMapIterator::Dump(JSThread *thread, std::ostream &os) const os << " - capacity: " << std::dec << map->Capacity() << "\n"; os << " - nextIndex: " << std::dec << GetNextIndex() << "\n"; os << " - IterationKind: " << std::dec << static_cast(GetIterationKind()) << "\n"; - JSObject::Dump(thread, os); + JSObject::Dump(os); os << " NumberOfElements() << "]>\n"; - map->Dump(thread, os); + map->Dump(os); } -void JSSet::Dump(JSThread *thread, std::ostream &os) const +void JSSet::Dump(std::ostream &os) const { LinkedHashSet *set = LinkedHashSet::Cast(GetLinkedSet().GetTaggedObject()); os << " - elements: " << std::dec << set->NumberOfElements() << "\n"; os << " - deleted-elements: " << std::dec << set->NumberOfDeletedElements() << "\n"; os << " - capacity: " << std::dec << set->Capacity() << "\n"; - JSObject::Dump(thread, os); + JSObject::Dump(os); os << " NumberOfElements() << "]>\n"; - set->Dump(thread, os); + set->Dump(os); } -void JSWeakMap::Dump(JSThread *thread, std::ostream &os) const +void JSWeakMap::Dump(std::ostream &os) const { LinkedHashMap *map = LinkedHashMap::Cast(GetLinkedMap().GetTaggedObject()); os << " - length: " << std::dec << GetSize() << "\n"; os << " - elements: " << std::dec << map->NumberOfElements() << "\n"; os << " - deleted-elements: " << std::dec << map->NumberOfDeletedElements() << "\n"; os << " - capacity: " << std::dec << map->Capacity() << "\n"; - JSObject::Dump(thread, os); + JSObject::Dump(os); os << " NumberOfElements() << "]>\n"; - map->Dump(thread, os); + map->Dump(os); } -void JSWeakSet::Dump(JSThread *thread, std::ostream &os) const +void JSWeakSet::Dump(std::ostream &os) const { LinkedHashSet *set = LinkedHashSet::Cast(GetLinkedSet().GetTaggedObject()); os << " - size: " << std::dec << GetSize() << "\n"; os << " - elements: " << std::dec << set->NumberOfElements() << "\n"; os << " - deleted-elements: " << std::dec << set->NumberOfDeletedElements() << "\n"; os << " - capacity: " << std::dec << set->Capacity() << "\n"; - JSObject::Dump(thread, os); + JSObject::Dump(os); os << " NumberOfElements() << "]>\n"; - set->Dump(thread, os); + set->Dump(os); } -void JSSetIterator::Dump(JSThread *thread, std::ostream &os) const +void JSSetIterator::Dump(std::ostream &os) const { LinkedHashSet *set = LinkedHashSet::Cast(GetIteratedSet().GetTaggedObject()); os << " - elements: " << std::dec << set->NumberOfElements() << "\n"; @@ -1380,65 +1373,65 @@ void JSSetIterator::Dump(JSThread *thread, std::ostream &os) const os << " - capacity: " << std::dec << set->Capacity() << "\n"; os << " - nextIndex: " << std::dec << GetNextIndex() << "\n"; os << " - IterationKind: " << std::dec << static_cast(GetIterationKind()) << "\n"; - JSObject::Dump(thread, os); + JSObject::Dump(os); os << " NumberOfElements() << "]>\n"; - set->Dump(thread, os); + set->Dump(os); } -void JSArray::Dump(JSThread *thread, std::ostream &os) const +void JSArray::Dump(std::ostream &os) const { os << " - length: " << std::dec << GetArrayLength() << "\n"; - JSObject::Dump(thread, os); + JSObject::Dump(os); } -void JSAPIArrayList::Dump(JSThread *thread, std::ostream &os) const +void JSAPIArrayList::Dump(std::ostream &os) const { os << " - length: " << std::dec << GetLength().GetArrayLength() << "\n"; - JSObject::Dump(thread, os); + JSObject::Dump(os); } -void JSAPIArrayListIterator::Dump(JSThread *thread, std::ostream &os) const +void JSAPIArrayListIterator::Dump(std::ostream &os) const { JSAPIArrayList *arrayList = JSAPIArrayList::Cast(GetIteratedArrayList().GetTaggedObject()); os << " - length: " << std::dec << arrayList->GetLength().GetArrayLength() << "\n"; os << " - nextIndex: " << std::dec << GetNextIndex() << "\n"; - JSObject::Dump(thread, os); + JSObject::Dump(os); } -void JSArrayIterator::Dump(JSThread *thread, std::ostream &os) const +void JSArrayIterator::Dump(std::ostream &os) const { JSArray *array = JSArray::Cast(GetIteratedArray().GetTaggedObject()); os << " - length: " << std::dec << array->GetArrayLength() << "\n"; os << " - nextIndex: " << std::dec << GetNextIndex() << "\n"; os << " - IterationKind: " << std::dec << static_cast(GetIterationKind()) << "\n"; - JSObject::Dump(thread, os); + JSObject::Dump(os); } -void JSAPIQueue::Dump(JSThread *thread, std::ostream &os) const +void JSAPIQueue::Dump(std::ostream &os) const { os << " - length: " << std::dec << GetSize() << "\n"; os << " - front: " << std::dec << GetFront() << "\n"; os << " - tail: " << std::dec << GetTail() << "\n"; - JSObject::Dump(thread, os); + JSObject::Dump(os); } -void JSAPIQueueIterator::Dump(JSThread *thread, std::ostream &os) const +void JSAPIQueueIterator::Dump(std::ostream &os) const { JSAPIQueue *queue = JSAPIQueue::Cast(GetIteratedQueue().GetTaggedObject()); os << " - length: " << std::dec << queue->GetSize() << "\n"; os << " - nextIndex: " << std::dec << GetNextIndex() << "\n"; - JSObject::Dump(thread, os); + JSObject::Dump(os); } -void JSStringIterator::Dump(JSThread *thread, std::ostream &os) const +void JSStringIterator::Dump(std::ostream &os) const { EcmaString *str = EcmaString::Cast(GetIteratedString().GetTaggedObject()); os << " - IteratedString: " << str->GetCString().get() << "\n"; os << " - StringIteratorNextIndex: " << std::dec << GetStringIteratorNextIndex() << "\n"; - JSObject::Dump(thread, os); + JSObject::Dump(os); } -void JSTypedArray::Dump(JSThread *thread, std::ostream &os) const +void JSTypedArray::Dump(std::ostream &os) const { os << " - viewed-array-buffer: "; GetViewedArrayBuffer().D(); @@ -1450,10 +1443,10 @@ void JSTypedArray::Dump(JSThread *thread, std::ostream &os) const GetByteOffset().D(); os << " - array-length: "; GetArrayLength().D(); - JSObject::Dump(thread, os); + JSObject::Dump(os); } -void JSRegExp::Dump(JSThread *thread, std::ostream &os) const +void JSRegExp::Dump(std::ostream &os) const { os << "\n"; os << " - ByteCodeBuffer: "; @@ -1467,21 +1460,21 @@ void JSRegExp::Dump(JSThread *thread, std::ostream &os) const os << "\n"; os << " - Length: " << GetLength(); os << "\n"; - JSObject::Dump(thread, os); + JSObject::Dump(os); } -void JSProxy::Dump(JSThread *thread, std::ostream &os) const +void JSProxy::Dump(std::ostream &os) const { os << " - Target: "; os << "\n"; - JSObject::Cast(GetTarget().GetTaggedObject())->Dump(thread, os); + JSObject::Cast(GetTarget().GetTaggedObject())->Dump(os); os << " - Handler: "; os << "\n"; - JSObject::Cast(GetHandler().GetTaggedObject())->Dump(thread, os); + JSObject::Cast(GetHandler().GetTaggedObject())->Dump(os); os << "\n"; } -void JSSymbol::Dump(JSThread *thread, std::ostream &os) const +void JSSymbol::Dump(std::ostream &os) const { os << " - hash-field: " << GetHashField(); os << "\n - flags: " << GetFlags(); @@ -1490,224 +1483,224 @@ void JSSymbol::Dump(JSThread *thread, std::ostream &os) const description.D(); } -void LexicalEnv::Dump(JSThread *thread, std::ostream &os) const +void LexicalEnv::Dump(std::ostream &os) const { - DumpArrayClass(thread, this, os); + DumpArrayClass(this, os); } // NOLINTNEXTLINE(readability-function-size) -void GlobalEnv::Dump(JSThread *thread, std::ostream &os) const +void GlobalEnv::Dump(std::ostream &os) const { - auto globalConst = thread->GlobalConstants(); + auto globalConst = GetJSThread()->GlobalConstants(); os << " - ObjectFunction: "; - GetObjectFunction().GetTaggedValue().Dump(thread, os); + GetObjectFunction().GetTaggedValue().Dump(os); os << " - FunctionFunction: "; - GetFunctionFunction().GetTaggedValue().Dump(thread, os); + GetFunctionFunction().GetTaggedValue().Dump(os); os << " - NumberFunction: "; - GetNumberFunction().GetTaggedValue().Dump(thread, os); + GetNumberFunction().GetTaggedValue().Dump(os); os << " - BigIntFunction: "; - GetBigIntFunction().GetTaggedValue().Dump(thread, os); + GetBigIntFunction().GetTaggedValue().Dump(os); os << " - DateFunction: "; - GetDateFunction().GetTaggedValue().Dump(thread, os); + GetDateFunction().GetTaggedValue().Dump(os); os << " - BooleanFunction: "; - GetBooleanFunction().GetTaggedValue().Dump(thread, os); + GetBooleanFunction().GetTaggedValue().Dump(os); os << " - ErrorFunction: "; - GetErrorFunction().GetTaggedValue().Dump(thread, os); + GetErrorFunction().GetTaggedValue().Dump(os); os << " - ArrayFunction: "; - GetArrayFunction().GetTaggedValue().Dump(thread, os); + GetArrayFunction().GetTaggedValue().Dump(os); os << " - TypedArrayFunction: "; - GetTypedArrayFunction().GetTaggedValue().Dump(thread, os); + GetTypedArrayFunction().GetTaggedValue().Dump(os); os << " - Int8ArrayFunction: "; - GetInt8ArrayFunction().GetTaggedValue().Dump(thread, os); + GetInt8ArrayFunction().GetTaggedValue().Dump(os); os << " - Uint8ArrayFunction: "; - GetUint8ArrayFunction().GetTaggedValue().Dump(thread, os); + GetUint8ArrayFunction().GetTaggedValue().Dump(os); os << " - Uint8ClampedArrayFunction: "; - GetUint8ClampedArrayFunction().GetTaggedValue().Dump(thread, os); + GetUint8ClampedArrayFunction().GetTaggedValue().Dump(os); os << " - Int16ArrayFunction: "; - GetInt16ArrayFunction().GetTaggedValue().Dump(thread, os); + GetInt16ArrayFunction().GetTaggedValue().Dump(os); os << " - ArrayBufferFunction: "; - GetArrayBufferFunction().GetTaggedValue().Dump(thread, os); + GetArrayBufferFunction().GetTaggedValue().Dump(os); os << " - SymbolFunction: "; - GetSymbolFunction().GetTaggedValue().Dump(thread, os); + GetSymbolFunction().GetTaggedValue().Dump(os); os << " - RangeErrorFunction: "; - GetRangeErrorFunction().GetTaggedValue().Dump(thread, os); + GetRangeErrorFunction().GetTaggedValue().Dump(os); os << " - ReferenceErrorFunction: "; - GetReferenceErrorFunction().GetTaggedValue().Dump(thread, os); + GetReferenceErrorFunction().GetTaggedValue().Dump(os); os << " - TypeErrorFunction: "; - GetTypeErrorFunction().GetTaggedValue().Dump(thread, os); + GetTypeErrorFunction().GetTaggedValue().Dump(os); os << " - URIErrorFunction: "; - GetURIErrorFunction().GetTaggedValue().Dump(thread, os); + GetURIErrorFunction().GetTaggedValue().Dump(os); os << " - SyntaxErrorFunction: "; - GetSyntaxErrorFunction().GetTaggedValue().Dump(thread, os); + GetSyntaxErrorFunction().GetTaggedValue().Dump(os); os << " - EvalErrorFunction: "; - GetEvalErrorFunction().GetTaggedValue().Dump(thread, os); + GetEvalErrorFunction().GetTaggedValue().Dump(os); os << " - RegExpFunction: "; - GetRegExpFunction().GetTaggedValue().Dump(thread, os); + GetRegExpFunction().GetTaggedValue().Dump(os); os << " - BuiltinsSetFunction: "; - GetBuiltinsSetFunction().GetTaggedValue().Dump(thread, os); + GetBuiltinsSetFunction().GetTaggedValue().Dump(os); os << " - BuiltinsMapFunction: "; - GetBuiltinsMapFunction().GetTaggedValue().Dump(thread, os); + GetBuiltinsMapFunction().GetTaggedValue().Dump(os); os << " - BuiltinsWeakSetFunction: "; - GetBuiltinsWeakSetFunction().GetTaggedValue().Dump(thread, os); + GetBuiltinsWeakSetFunction().GetTaggedValue().Dump(os); os << " - BuiltinsWeakMapFunction: "; - GetBuiltinsWeakMapFunction().GetTaggedValue().Dump(thread, os); + GetBuiltinsWeakMapFunction().GetTaggedValue().Dump(os); os << " - MathFunction: "; - GetMathFunction().GetTaggedValue().Dump(thread, os); + GetMathFunction().GetTaggedValue().Dump(os); os << " - JsonFunction: "; - GetJsonFunction().GetTaggedValue().Dump(thread, os); + GetJsonFunction().GetTaggedValue().Dump(os); os << " - StringFunction: "; - GetStringFunction().GetTaggedValue().Dump(thread, os); + GetStringFunction().GetTaggedValue().Dump(os); os << " - ProxyFunction: "; - GetProxyFunction().GetTaggedValue().Dump(thread, os); + GetProxyFunction().GetTaggedValue().Dump(os); os << " - ReflectFunction: "; - GetReflectFunction().GetTaggedValue().Dump(thread, os); + GetReflectFunction().GetTaggedValue().Dump(os); os << " - AsyncFunction: "; - GetAsyncFunction().GetTaggedValue().Dump(thread, os); + GetAsyncFunction().GetTaggedValue().Dump(os); os << " - AsyncFunctionPrototype: "; - GetAsyncFunctionPrototype().GetTaggedValue().Dump(thread, os); + GetAsyncFunctionPrototype().GetTaggedValue().Dump(os); os << " - JSGlobalObject: "; - GetJSGlobalObject().GetTaggedValue().Dump(thread, os); + GetJSGlobalObject().GetTaggedValue().Dump(os); os << " - EmptyArray: "; - GetEmptyArray().GetTaggedValue().Dump(thread, os); + GetEmptyArray().GetTaggedValue().Dump(os); os << " - EmptyString "; - globalConst->GetEmptyString().Dump(thread, os); + globalConst->GetEmptyString().Dump(os); os << " - EmptyTaggedQueue: "; - GetEmptyTaggedQueue().GetTaggedValue().Dump(thread, os); + GetEmptyTaggedQueue().GetTaggedValue().Dump(os); os << " - PrototypeString: "; - globalConst->GetPrototypeString().Dump(thread, os); + globalConst->GetPrototypeString().Dump(os); os << " - HasInstanceSymbol: "; - GetHasInstanceSymbol().GetTaggedValue().Dump(thread, os); + GetHasInstanceSymbol().GetTaggedValue().Dump(os); os << " - IsConcatSpreadableSymbol: "; - GetIsConcatSpreadableSymbol().GetTaggedValue().Dump(thread, os); + GetIsConcatSpreadableSymbol().GetTaggedValue().Dump(os); os << " - ToStringTagSymbol: "; - GetToStringTagSymbol().GetTaggedValue().Dump(thread, os); + GetToStringTagSymbol().GetTaggedValue().Dump(os); os << " - IteratorSymbol: "; - GetIteratorSymbol().GetTaggedValue().Dump(thread, os); + GetIteratorSymbol().GetTaggedValue().Dump(os); os << " - MatchSymbol: "; - GetMatchSymbol().GetTaggedValue().Dump(thread, os); + GetMatchSymbol().GetTaggedValue().Dump(os); os << " - ReplaceSymbol: "; - GetReplaceSymbol().GetTaggedValue().Dump(thread, os); + GetReplaceSymbol().GetTaggedValue().Dump(os); os << " - SearchSymbol: "; - GetSearchSymbol().GetTaggedValue().Dump(thread, os); + GetSearchSymbol().GetTaggedValue().Dump(os); os << " - SpeciesSymbol: "; - GetSpeciesSymbol().GetTaggedValue().Dump(thread, os); + GetSpeciesSymbol().GetTaggedValue().Dump(os); os << " - SplitSymbol: "; - GetSplitSymbol().GetTaggedValue().Dump(thread, os); + GetSplitSymbol().GetTaggedValue().Dump(os); os << " - ToPrimitiveSymbol: "; - GetToPrimitiveSymbol().GetTaggedValue().Dump(thread, os); + GetToPrimitiveSymbol().GetTaggedValue().Dump(os); os << " - UnscopablesSymbol: "; - GetUnscopablesSymbol().GetTaggedValue().Dump(thread, os); + GetUnscopablesSymbol().GetTaggedValue().Dump(os); os << " - HoleySymbol: "; - GetHoleySymbol().GetTaggedValue().Dump(thread, os); + GetHoleySymbol().GetTaggedValue().Dump(os); os << " - ConstructorString: "; - globalConst->GetConstructorString().Dump(thread, os); + globalConst->GetConstructorString().Dump(os); os << " - IteratorPrototype: "; - GetIteratorPrototype().GetTaggedValue().Dump(thread, os); + GetIteratorPrototype().GetTaggedValue().Dump(os); os << " - ForinIteratorPrototype: "; - GetForinIteratorPrototype().GetTaggedValue().Dump(thread, os); + GetForinIteratorPrototype().GetTaggedValue().Dump(os); os << " - StringIterator: "; - GetStringIterator().GetTaggedValue().Dump(thread, os); + GetStringIterator().GetTaggedValue().Dump(os); os << " - MapIteratorPrototype: "; - GetMapIteratorPrototype().GetTaggedValue().Dump(thread, os); + GetMapIteratorPrototype().GetTaggedValue().Dump(os); os << " - SetIteratorPrototype: "; - GetSetIteratorPrototype().GetTaggedValue().Dump(thread, os); + GetSetIteratorPrototype().GetTaggedValue().Dump(os); os << " - ArrayIteratorPrototype: "; - GetArrayIteratorPrototype().GetTaggedValue().Dump(thread, os); + GetArrayIteratorPrototype().GetTaggedValue().Dump(os); os << " - StringIteratorPrototype: "; - GetStringIteratorPrototype().GetTaggedValue().Dump(thread, os); + GetStringIteratorPrototype().GetTaggedValue().Dump(os); os << " - LengthString: "; - globalConst->GetLengthString().Dump(thread, os); + globalConst->GetLengthString().Dump(os); os << " - ValueString: "; - globalConst->GetValueString().Dump(thread, os); + globalConst->GetValueString().Dump(os); os << " - WritableString: "; - globalConst->GetWritableString().Dump(thread, os); + globalConst->GetWritableString().Dump(os); os << " - GetString: "; - globalConst->GetGetString().Dump(thread, os); + globalConst->GetGetString().Dump(os); os << " - SetString: "; - globalConst->GetSetString().Dump(thread, os); + globalConst->GetSetString().Dump(os); os << " - EnumerableString: "; - globalConst->GetEnumerableString().Dump(thread, os); + globalConst->GetEnumerableString().Dump(os); os << " - ConfigurableString: "; - globalConst->GetConfigurableString().Dump(thread, os); + globalConst->GetConfigurableString().Dump(os); os << " - NameString: "; - globalConst->GetNameString().Dump(thread, os); + globalConst->GetNameString().Dump(os); os << " - ValueOfString: "; - globalConst->GetValueOfString().Dump(thread, os); + globalConst->GetValueOfString().Dump(os); os << " - ToStringString: "; - globalConst->GetToStringString().Dump(thread, os); + globalConst->GetToStringString().Dump(os); os << " - ToLocaleStringString: "; - globalConst->GetToLocaleStringString().Dump(thread, os); + globalConst->GetToLocaleStringString().Dump(os); os << " - UndefinedString: "; - globalConst->GetUndefinedString().Dump(thread, os); + globalConst->GetUndefinedString().Dump(os); os << " - NullString: "; - globalConst->GetNullString().Dump(thread, os); + globalConst->GetNullString().Dump(os); os << " - TrueString: "; - globalConst->GetTrueString().Dump(thread, os); + globalConst->GetTrueString().Dump(os); os << " - FalseString: "; - globalConst->GetFalseString().Dump(thread, os); + globalConst->GetFalseString().Dump(os); os << " - RegisterSymbols: "; - GetRegisterSymbols().GetTaggedValue().Dump(thread, os); + GetRegisterSymbols().GetTaggedValue().Dump(os); os << " - ThrowTypeError: "; - GetThrowTypeError().GetTaggedValue().Dump(thread, os); + GetThrowTypeError().GetTaggedValue().Dump(os); os << " - GetPrototypeOfString: "; - globalConst->GetGetPrototypeOfString().Dump(thread, os); + globalConst->GetGetPrototypeOfString().Dump(os); os << " - SetPrototypeOfString: "; - globalConst->GetSetPrototypeOfString().Dump(thread, os); + globalConst->GetSetPrototypeOfString().Dump(os); os << " - IsExtensibleString: "; - globalConst->GetIsExtensibleString().Dump(thread, os); + globalConst->GetIsExtensibleString().Dump(os); os << " - PreventExtensionsString: "; - globalConst->GetPreventExtensionsString().Dump(thread, os); + globalConst->GetPreventExtensionsString().Dump(os); os << " - GetOwnPropertyDescriptorString: "; - globalConst->GetGetOwnPropertyDescriptorString().Dump(thread, os); + globalConst->GetGetOwnPropertyDescriptorString().Dump(os); os << " - DefinePropertyString: "; - globalConst->GetDefinePropertyString().Dump(thread, os); + globalConst->GetDefinePropertyString().Dump(os); os << " - HasString: "; - globalConst->GetHasString().Dump(thread, os); + globalConst->GetHasString().Dump(os); os << " - DeletePropertyString: "; - globalConst->GetDeletePropertyString().Dump(thread, os); + globalConst->GetDeletePropertyString().Dump(os); os << " - EnumerateString: "; - globalConst->GetEnumerateString().Dump(thread, os); + globalConst->GetEnumerateString().Dump(os); os << " - OwnKeysString: "; - globalConst->GetOwnKeysString().Dump(thread, os); + globalConst->GetOwnKeysString().Dump(os); os << " - ApplyString: "; - globalConst->GetApplyString().Dump(thread, os); + globalConst->GetApplyString().Dump(os); os << " - ProxyString: "; - globalConst->GetProxyString().Dump(thread, os); + globalConst->GetProxyString().Dump(os); os << " - RevokeString: "; - globalConst->GetRevokeString().Dump(thread, os); + globalConst->GetRevokeString().Dump(os); os << " - ProxyConstructString: "; - globalConst->GetProxyConstructString().Dump(thread, os); + globalConst->GetProxyConstructString().Dump(os); os << " - ProxyCallString: "; - globalConst->GetProxyCallString().Dump(thread, os); + globalConst->GetProxyCallString().Dump(os); os << " - DoneString: "; - globalConst->GetDoneString().Dump(thread, os); + globalConst->GetDoneString().Dump(os); os << " - NegativeZeroString: "; - globalConst->GetNegativeZeroString().Dump(thread, os); + globalConst->GetNegativeZeroString().Dump(os); os << " - NextString: "; - globalConst->GetNextString().Dump(thread, os); + globalConst->GetNextString().Dump(os); os << " - PromiseThenString: "; - globalConst->GetPromiseThenString().Dump(thread, os); + globalConst->GetPromiseThenString().Dump(os); os << " - PromiseFunction: "; - GetPromiseFunction().GetTaggedValue().Dump(thread, os); + GetPromiseFunction().GetTaggedValue().Dump(os); os << " - PromiseReactionJob: "; - GetPromiseReactionJob().GetTaggedValue().Dump(thread, os); + GetPromiseReactionJob().GetTaggedValue().Dump(os); os << " - PromiseResolveThenableJob: "; - GetPromiseResolveThenableJob().GetTaggedValue().Dump(thread, os); + GetPromiseResolveThenableJob().GetTaggedValue().Dump(os); os << " - ScriptJobString: "; - globalConst->GetScriptJobString().Dump(thread, os); + globalConst->GetScriptJobString().Dump(os); os << " - PromiseString: "; - globalConst->GetPromiseString().Dump(thread, os); + globalConst->GetPromiseString().Dump(os); os << " - IdentityString: "; - globalConst->GetIdentityString().Dump(thread, os); + globalConst->GetIdentityString().Dump(os); os << " - AsyncFunctionString: "; - globalConst->GetAsyncFunctionString().Dump(thread, os); + globalConst->GetAsyncFunctionString().Dump(os); os << " - ThrowerString: "; - globalConst->GetThrowerString().Dump(thread, os); + globalConst->GetThrowerString().Dump(os); os << " - Undefined: "; - globalConst->GetUndefined().Dump(thread, os); + globalConst->GetUndefined().Dump(os); } -void JSDataView::Dump(JSThread *thread, std::ostream &os) const +void JSDataView::Dump(std::ostream &os) const { os << " - data-view: "; GetDataView().D(); @@ -1717,7 +1710,7 @@ void JSDataView::Dump(JSThread *thread, std::ostream &os) const os << "\n - byte-offset: " << GetByteOffset(); } -void JSArrayBuffer::Dump(JSThread *thread, std::ostream &os) const +void JSArrayBuffer::Dump(std::ostream &os) const { os << " - byte-length: " << GetArrayBufferByteLength(); os << " - buffer-data: "; @@ -1725,7 +1718,7 @@ void JSArrayBuffer::Dump(JSThread *thread, std::ostream &os) const os << " - Shared: " << GetShared(); } -void PromiseReaction::Dump(JSThread *thread, std::ostream &os) const +void PromiseReaction::Dump(std::ostream &os) const { os << " - promise-capability: "; GetPromiseCapability().D(); @@ -1734,7 +1727,7 @@ void PromiseReaction::Dump(JSThread *thread, std::ostream &os) const GetHandler().D(); } -void PromiseCapability::Dump(JSThread *thread, std::ostream &os) const +void PromiseCapability::Dump(std::ostream &os) const { os << " - promise: "; GetPromise().D(); @@ -1744,20 +1737,20 @@ void PromiseCapability::Dump(JSThread *thread, std::ostream &os) const GetReject().D(); } -void PromiseIteratorRecord::Dump(JSThread *thread, std::ostream &os) const +void PromiseIteratorRecord::Dump(std::ostream &os) const { os << " - iterator: "; GetIterator().D(); os << " - done: " << GetDone(); } -void PromiseRecord::Dump(JSThread *thread, std::ostream &os) const +void PromiseRecord::Dump(std::ostream &os) const { os << " - value: "; GetValue().D(); } -void ResolvingFunctionsRecord::Dump(JSThread *thread, std::ostream &os) const +void ResolvingFunctionsRecord::Dump(std::ostream &os) const { os << " - resolve-function: "; GetResolveFunction().D(); @@ -1765,7 +1758,7 @@ void ResolvingFunctionsRecord::Dump(JSThread *thread, std::ostream &os) const GetRejectFunction().D(); } -void JSPromise::Dump(JSThread *thread, std::ostream &os) const +void JSPromise::Dump(std::ostream &os) const { os << " - promise-state: " << static_cast(GetPromiseState()); os << "\n - promise-result: "; @@ -1775,26 +1768,26 @@ void JSPromise::Dump(JSThread *thread, std::ostream &os) const os << " - promise-reject-reactions: "; GetPromiseRejectReactions().D(); os << " - promise-is-handled: " << GetPromiseIsHandled(); - JSObject::Dump(thread, os); + JSObject::Dump(os); } -void JSPromiseReactionsFunction::Dump(JSThread *thread, std::ostream &os) const +void JSPromiseReactionsFunction::Dump(std::ostream &os) const { os << " - promise: "; GetPromise().D(); os << " - already-resolved: "; GetAlreadyResolved().D(); - JSObject::Dump(thread, os); + JSObject::Dump(os); } -void JSPromiseExecutorFunction::Dump(JSThread *thread, std::ostream &os) const +void JSPromiseExecutorFunction::Dump(std::ostream &os) const { os << " - capability: "; GetCapability().D(); - JSObject::Dump(thread, os); + JSObject::Dump(os); } -void JSPromiseAllResolveElementFunction::Dump(JSThread *thread, std::ostream &os) const +void JSPromiseAllResolveElementFunction::Dump(std::ostream &os) const { os << " - index: "; GetIndex().D(); @@ -1806,10 +1799,10 @@ void JSPromiseAllResolveElementFunction::Dump(JSThread *thread, std::ostream &os GetRemainingElements().D(); os << " - already-called: "; GetAlreadyCalled().D(); - JSObject::Dump(thread, os); + JSObject::Dump(os); } -void MicroJobQueue::Dump(JSThread *thread, std::ostream &os) const +void MicroJobQueue::Dump(std::ostream &os) const { os << " - promise-job-queue: "; GetPromiseJobQueue().D(); @@ -1817,7 +1810,7 @@ void MicroJobQueue::Dump(JSThread *thread, std::ostream &os) const GetScriptJobQueue().D(); } -void PendingJob::Dump(JSThread *thread, std::ostream &os) const +void PendingJob::Dump(std::ostream &os) const { os << " - job: "; GetJob().D(); @@ -1825,14 +1818,14 @@ void PendingJob::Dump(JSThread *thread, std::ostream &os) const GetArguments().D(); } -void CompletionRecord::Dump(JSThread *thread, std::ostream &os) const +void CompletionRecord::Dump(std::ostream &os) const { os << " - type: " << static_cast(GetType()); os << " - value: "; GetValue().D(); } -void JSProxyRevocFunction::Dump(JSThread *thread, std::ostream &os) const +void JSProxyRevocFunction::Dump(std::ostream &os) const { os << " - RevocableProxy: "; os << "\n"; @@ -1840,12 +1833,12 @@ void JSProxyRevocFunction::Dump(JSThread *thread, std::ostream &os) const os << "\n"; } -void JSAsyncFunction::Dump(JSThread *thread, std::ostream &os) const +void JSAsyncFunction::Dump(std::ostream &os) const { - JSFunction::Dump(thread, os); + JSFunction::Dump(os); } -void JSAsyncAwaitStatusFunction::Dump(JSThread *thread, std::ostream &os) const +void JSAsyncAwaitStatusFunction::Dump(std::ostream &os) const { os << " - AsyncContext: "; os << "\n"; @@ -1853,12 +1846,12 @@ void JSAsyncAwaitStatusFunction::Dump(JSThread *thread, std::ostream &os) const os << "\n"; } -void JSGeneratorFunction::Dump(JSThread *thread, std::ostream &os) const +void JSGeneratorFunction::Dump(std::ostream &os) const { - JSFunction::Dump(thread, os); + JSFunction::Dump(os); } -void JSIntlBoundFunction::Dump(JSThread *thread, std::ostream &os) const +void JSIntlBoundFunction::Dump(std::ostream &os) const { os << " - NumberFormat: "; GetNumberFormat().D(); @@ -1869,17 +1862,17 @@ void JSIntlBoundFunction::Dump(JSThread *thread, std::ostream &os) const os << " - Collator: "; GetCollator().D(); os << "\n"; - JSObject::Dump(thread, os); + JSObject::Dump(os); } -void PropertyBox::Dump(JSThread *thread, std::ostream &os) const +void PropertyBox::Dump(std::ostream &os) const { os << " - Value: "; GetValue().D(); os << "\n"; } -void PrototypeHandler::Dump(JSThread *thread, std::ostream &os) const +void PrototypeHandler::Dump(std::ostream &os) const { os << " - HandlerInfo: "; GetHandlerInfo().D(); @@ -1892,7 +1885,7 @@ void PrototypeHandler::Dump(JSThread *thread, std::ostream &os) const os << "\n"; } -void TransitionHandler::Dump(JSThread *thread, std::ostream &os) const +void TransitionHandler::Dump(std::ostream &os) const { os << " - HandlerInfo: "; GetHandlerInfo().D(); @@ -1902,7 +1895,7 @@ void TransitionHandler::Dump(JSThread *thread, std::ostream &os) const os << "\n"; } -void JSRealm::Dump(JSThread *thread, std::ostream &os) const +void JSRealm::Dump(std::ostream &os) const { os << " - Value: "; GetValue().D(); @@ -1910,26 +1903,26 @@ void JSRealm::Dump(JSThread *thread, std::ostream &os) const os << " - GlobalEnv: "; GetGlobalEnv().D(); os << "\n"; - JSObject::Dump(thread, os); + JSObject::Dump(os); } -void JSIntl::Dump(JSThread *thread, std::ostream &os) const +void JSIntl::Dump(std::ostream &os) const { os << " - FallbackSymbol: "; GetFallbackSymbol().D(); os << "\n"; - JSObject::Dump(thread, os); + JSObject::Dump(os); } -void JSLocale::Dump(JSThread *thread, std::ostream &os) const +void JSLocale::Dump(std::ostream &os) const { os << " - IcuField: "; GetIcuField().D(); os << "\n"; - JSObject::Dump(thread, os); + JSObject::Dump(os); } -void JSDateTimeFormat::Dump(JSThread *thread, std::ostream &os) const +void JSDateTimeFormat::Dump(std::ostream &os) const { os << " - Locale: "; GetLocale().D(); @@ -1961,10 +1954,10 @@ void JSDateTimeFormat::Dump(JSThread *thread, std::ostream &os) const os << " - BoundFormat: "; GetBoundFormat().D(); os << "\n"; - JSObject::Dump(thread, os); + JSObject::Dump(os); } -void JSRelativeTimeFormat::Dump(JSThread *thread, std::ostream &os) const +void JSRelativeTimeFormat::Dump(std::ostream &os) const { os << " - Locale: "; GetLocale().D(); @@ -1985,10 +1978,10 @@ void JSRelativeTimeFormat::Dump(JSThread *thread, std::ostream &os) const os << " - IcuField: "; GetIcuField().D(); os << "\n"; - JSObject::Dump(thread, os); + JSObject::Dump(os); } -void JSNumberFormat::Dump(JSThread *thread, std::ostream &os) const +void JSNumberFormat::Dump(std::ostream &os) const { os << " - Locale: "; GetLocale().D(); @@ -2023,10 +2016,10 @@ void JSNumberFormat::Dump(JSThread *thread, std::ostream &os) const os << "\n" << " - IcuField: "; GetIcuField().D(); os << "\n"; - JSObject::Dump(thread, os); + JSObject::Dump(os); } -void JSCollator::Dump(JSThread *thread, std::ostream &os) const +void JSCollator::Dump(std::ostream &os) const { os << " - IcuField: "; GetIcuField().D(); @@ -2042,10 +2035,10 @@ void JSCollator::Dump(JSThread *thread, std::ostream &os) const os << "\n - BoundCompare: "; GetBoundCompare().D(); os << "\n"; - JSObject::Dump(thread, os); + JSObject::Dump(os); } -void JSPluralRules::Dump(JSThread *thread, std::ostream &os) const +void JSPluralRules::Dump(std::ostream &os) const { os << " - Locale: "; GetLocale().D(); @@ -2078,10 +2071,10 @@ void JSPluralRules::Dump(JSThread *thread, std::ostream &os) const os << " - IcuNF: "; GetIcuNF().D(); os << "\n"; - JSObject::Dump(thread, os); + JSObject::Dump(os); } -void JSGeneratorObject::Dump(JSThread *thread, std::ostream &os) const +void JSGeneratorObject::Dump(std::ostream &os) const { os << " - GeneratorContext: "; GetGeneratorContext().D(); @@ -2093,17 +2086,17 @@ void JSGeneratorObject::Dump(JSThread *thread, std::ostream &os) const os << "\n"; os << " - ResumeMode: " << static_cast(GetResumeMode()); os << "\n"; - JSObject::Dump(thread, os); + JSObject::Dump(os); } -void JSAsyncFuncObject::Dump(JSThread *thread, std::ostream &os) const +void JSAsyncFuncObject::Dump(std::ostream &os) const { os << " - Promise: "; GetPromise().D(); os << "\n"; } -void GeneratorContext::Dump(JSThread *thread, std::ostream &os) const +void GeneratorContext::Dump(std::ostream &os) const { os << " - RegsArray: "; GetRegsArray().D(); @@ -2126,12 +2119,12 @@ void GeneratorContext::Dump(JSThread *thread, std::ostream &os) const os << "\n"; } -void ProtoChangeMarker::Dump(JSThread *thread, std::ostream &os) const +void ProtoChangeMarker::Dump(std::ostream &os) const { os << " - HasChanged: " << GetHasChanged() << "\n"; } -void ProtoChangeDetails::Dump(JSThread *thread, std::ostream &os) const +void ProtoChangeDetails::Dump(std::ostream &os) const { os << " - ChangeListener: "; GetChangeListener().D(); @@ -2140,13 +2133,13 @@ void ProtoChangeDetails::Dump(JSThread *thread, std::ostream &os) const os << "\n"; } -void MachineCode::Dump(JSThread *thread, std::ostream &os) const +void MachineCode::Dump(std::ostream &os) const { os << " - InstructionSizeInBytes: " << GetInstructionSizeInBytes(); os << "\n"; } -void ClassInfoExtractor::Dump(JSThread *thread, std::ostream &os) const +void ClassInfoExtractor::Dump(std::ostream &os) const { os << " - PrototypeHClass: "; GetPrototypeHClass().D(); @@ -2174,7 +2167,7 @@ void ClassInfoExtractor::Dump(JSThread *thread, std::ostream &os) const os << "\n"; } -void TSObjectType::Dump(JSThread *thread, std::ostream &os) const +void TSObjectType::Dump(std::ostream &os) const { os << " - TSObjectType globalTSTypeRef: "; GlobalTSTypeRef gt = GetGTRef(); @@ -2194,12 +2187,12 @@ void TSObjectType::Dump(JSThread *thread, std::ostream &os) const os << typeKind; os << "\n"; os << " - ObjLayoutInfo: "; - DumpArrayClass(thread, TaggedArray::Cast(GetObjLayoutInfo().GetTaggedObject()), os); + DumpArrayClass(TaggedArray::Cast(GetObjLayoutInfo().GetTaggedObject()), os); os << " - HClass: "; GetHClass().D(); } -void TSClassType::Dump(JSThread *thread, std::ostream &os) const +void TSClassType::Dump(std::ostream &os) const { os << " - Dump TSClassType - " << "\n"; os << " - TSClassType globalTSTypeRef: "; @@ -2232,26 +2225,26 @@ void TSClassType::Dump(JSThread *thread, std::ostream &os) const os << " - InstanceType: " << "\n"; if (GetInstanceType().IsTSObjectType()) { TSObjectType *instanceType = TSObjectType::Cast(GetInstanceType().GetTaggedObject()); - instanceType->Dump(thread, os); + instanceType->Dump(os); os << "\n"; } os << " - ConstructorType: " << "\n"; if (GetConstructorType().IsTSObjectType()) { TSObjectType *constructorType = TSObjectType::Cast(GetConstructorType().GetTaggedObject()); - constructorType->Dump(thread, os); + constructorType->Dump(os); os << "\n"; } os << " - PrototypeType: " << "\n"; if (GetPrototypeType().IsTSObjectType()) { TSObjectType *prototypeType = TSObjectType::Cast(GetPrototypeType().GetTaggedObject()); - prototypeType->Dump(thread, os); + prototypeType->Dump(os); os << "\n"; } } -void TSInterfaceType::Dump(JSThread *thread, std::ostream &os) const +void TSInterfaceType::Dump(std::ostream &os) const { os << " - Dump Interface Type - " << "\n"; os << " - TSInterfaceType globalTSTypeRef: "; @@ -2272,21 +2265,20 @@ void TSInterfaceType::Dump(JSThread *thread, std::ostream &os) const os << typeKind; os << "\n"; os << " - Extends TypeId: " << "\n"; - JSHandle extendsId(thread, GetExtends()); - if (extendsId->GetLength() == 0) { - os << " (base interface type) "<< "\n"; + if (TaggedArray::Cast(GetExtends().GetTaggedObject())->GetLength() == 0) { + os << " (base interface type) "<< "\n"; } - DumpArrayClass(thread, TaggedArray::Cast(GetExtends().GetTaggedObject()), os); + DumpArrayClass(TaggedArray::Cast(GetExtends().GetTaggedObject()), os); os << " - Fields: " << "\n"; if (GetFields().IsTSObjectType()) { TSObjectType *fieldsType = TSObjectType::Cast(GetFields().GetTaggedObject()); - fieldsType->Dump(thread, os); + fieldsType->Dump(os); os << "\n"; } } -void TSImportType::Dump(JSThread *thread, std::ostream &os) const +void TSImportType::Dump(std::ostream &os) const { os << " - Dump Import Type - " << "\n"; os << " - TSImportType globalTSTypeRef: "; @@ -2361,11 +2353,11 @@ void TSImportType::Dump(JSThread *thread, std::ostream &os) const os << " -------------------------------------------- "; os << " - Taget Type Path: "; JSTaggedValue importPath = GetImportPath(); - importPath.DumpTaggedValue(thread, os); + importPath.DumpTaggedValue(os); os << "\n"; } -void TSClassInstanceType::Dump(JSThread *thread, std::ostream &os) const +void TSClassInstanceType::Dump(std::ostream &os) const { os << " - Dump ClassInstance Type - " << "\n"; os << " - TSClassInstanceType globalTSTypeRef: "; @@ -2393,7 +2385,7 @@ void TSClassInstanceType::Dump(JSThread *thread, std::ostream &os) const os << "\n"; } -void TSUnionType::Dump(JSThread *thread, std::ostream &os) const +void TSUnionType::Dump(std::ostream &os) const { os << " - Dump UnionType Type - " << "\n"; os << " - TSUnionType globalTSTypeRef: "; @@ -2414,12 +2406,10 @@ void TSUnionType::Dump(JSThread *thread, std::ostream &os) const os << typeKind; os << "\n"; os << " - TSUnionType TypeId: " << "\n"; - JSHandle componentTypes(thread, GetComponentTypes()); - - DumpArrayClass(thread, TaggedArray::Cast(GetComponentTypes().GetTaggedObject()), os); + DumpArrayClass(TaggedArray::Cast(GetComponentTypes().GetTaggedObject()), os); } -void TSFunctionType::Dump(JSThread *thread, std::ostream &os) const +void TSFunctionType::Dump(std::ostream &os) const { os << " - Dump TSFunctionType - " << "\n"; os << " - TSFunctionType globalTSTypeRef: "; @@ -2440,12 +2430,10 @@ void TSFunctionType::Dump(JSThread *thread, std::ostream &os) const os << typeKind; os << "\n"; os << " - TSFunctionType ParameterTypeIds: " << "\n"; - JSHandle parametertTypes(thread, GetParameterTypes()); - - DumpArrayClass(thread, TaggedArray::Cast(GetParameterTypes().GetTaggedObject()), os); + DumpArrayClass(TaggedArray::Cast(GetParameterTypes().GetTaggedObject()), os); } -void TSArrayType::Dump(JSThread *thread, std::ostream &os) const +void TSArrayType::Dump(std::ostream &os) const { os << " - Dump TSArrayType - " << "\n"; os << " - TSArrayType globalTSTypeRef: "; @@ -2471,7 +2459,7 @@ void TSArrayType::Dump(JSThread *thread, std::ostream &os) const os << "\n"; } -void SourceTextModule::Dump(JSThread *thread, std::ostream &os) const +void SourceTextModule::Dump(std::ostream &os) const { os << " - Environment: "; GetEnvironment().D(); @@ -2514,7 +2502,7 @@ void SourceTextModule::Dump(JSThread *thread, std::ostream &os) const os << "\n"; } -void ImportEntry::Dump(JSThread *thread, std::ostream &os) const +void ImportEntry::Dump(std::ostream &os) const { os << " - ModuleRequest: "; GetModuleRequest().D(); @@ -2527,7 +2515,7 @@ void ImportEntry::Dump(JSThread *thread, std::ostream &os) const os << "\n"; } -void ExportEntry::Dump(JSThread *thread, std::ostream &os) const +void ExportEntry::Dump(std::ostream &os) const { os << " - ExportName: "; GetExportName().D(); @@ -2543,7 +2531,7 @@ void ExportEntry::Dump(JSThread *thread, std::ostream &os) const os << "\n"; } -void ResolvedBinding::Dump(JSThread *thread, std::ostream &os) const +void ResolvedBinding::Dump(std::ostream &os) const { os << " - Module: "; GetModule().D(); @@ -2553,7 +2541,7 @@ void ResolvedBinding::Dump(JSThread *thread, std::ostream &os) const os << "\n"; } -void ModuleNamespace::Dump(JSThread *thread, std::ostream &os) const +void ModuleNamespace::Dump(std::ostream &os) const { os << " - Module: "; GetModule().D(); @@ -2566,7 +2554,7 @@ void ModuleNamespace::Dump(JSThread *thread, std::ostream &os) const // ######################################################################################## // Dump for Snapshot // ######################################################################################## -static void DumpArrayClass([[maybe_unused]] JSThread *thread, const TaggedArray *arr, +static void DumpArrayClass(const TaggedArray *arr, std::vector> &vec) { DISALLOW_GARBAGE_COLLECTION; @@ -2578,20 +2566,20 @@ static void DumpArrayClass([[maybe_unused]] JSThread *thread, const TaggedArray } } -static void DumpStringClass([[maybe_unused]] JSThread *thread, const EcmaString *str, +static void DumpStringClass(const EcmaString *str, std::vector> &vec) { vec.push_back(std::make_pair("string", JSTaggedValue(str))); } -static void DumpDynClass([[maybe_unused]] JSThread *thread, TaggedObject *obj, +static void DumpDynClass(TaggedObject *obj, std::vector> &vec) { JSHClass *jshclass = obj->GetClass(); vec.push_back(std::make_pair("__proto__", jshclass->GetPrototype())); } -static void DumpObject(JSThread *thread, TaggedObject *obj, +static void DumpObject(TaggedObject *obj, std::vector> &vec, bool isVmMode) { DISALLOW_GARBAGE_COLLECTION; @@ -2600,14 +2588,14 @@ static void DumpObject(JSThread *thread, TaggedObject *obj, switch (type) { case JSType::HCLASS: - DumpDynClass(thread, obj, vec); + DumpDynClass(obj, vec); return; case JSType::TAGGED_ARRAY: case JSType::TAGGED_DICTIONARY: - DumpArrayClass(thread, TaggedArray::Cast(obj), vec); + DumpArrayClass(TaggedArray::Cast(obj), vec); return; case JSType::STRING: - DumpStringClass(thread, EcmaString::Cast(obj), vec); + DumpStringClass(EcmaString::Cast(obj), vec); return; case JSType::JS_NATIVE_POINTER: return; @@ -2621,35 +2609,35 @@ static void DumpObject(JSThread *thread, TaggedObject *obj, case JSType::JS_SYNTAX_ERROR: case JSType::JS_ARGUMENTS: case JSType::JS_GLOBAL_OBJECT: - JSObject::Cast(obj)->DumpForSnapshot(thread, vec); + JSObject::Cast(obj)->DumpForSnapshot(vec); return; case JSType::JS_FUNCTION_BASE: case JSType::JS_FUNCTION: - JSFunction::Cast(obj)->DumpForSnapshot(thread, vec); + JSFunction::Cast(obj)->DumpForSnapshot(vec); return; case JSType::JS_BOUND_FUNCTION: - JSBoundFunction::Cast(obj)->DumpForSnapshot(thread, vec); + JSBoundFunction::Cast(obj)->DumpForSnapshot(vec); return; case JSType::JS_SET: - JSSet::Cast(obj)->DumpForSnapshot(thread, vec); + JSSet::Cast(obj)->DumpForSnapshot(vec); return; case JSType::JS_MAP: - JSMap::Cast(obj)->DumpForSnapshot(thread, vec); + JSMap::Cast(obj)->DumpForSnapshot(vec); return; case JSType::JS_WEAK_SET: - JSWeakSet::Cast(obj)->DumpForSnapshot(thread, vec); + JSWeakSet::Cast(obj)->DumpForSnapshot(vec); return; case JSType::JS_WEAK_MAP: - JSWeakMap::Cast(obj)->DumpForSnapshot(thread, vec); + JSWeakMap::Cast(obj)->DumpForSnapshot(vec); return; case JSType::JS_REG_EXP: - JSRegExp::Cast(obj)->DumpForSnapshot(thread, vec); + JSRegExp::Cast(obj)->DumpForSnapshot(vec); return; case JSType::JS_DATE: - JSDate::Cast(obj)->DumpForSnapshot(thread, vec); + JSDate::Cast(obj)->DumpForSnapshot(vec); return; case JSType::JS_ARRAY: - JSArray::Cast(obj)->DumpForSnapshot(thread, vec); + JSArray::Cast(obj)->DumpForSnapshot(vec); return; case JSType::JS_TYPED_ARRAY: case JSType::JS_INT8_ARRAY: @@ -2663,62 +2651,62 @@ static void DumpObject(JSThread *thread, TaggedObject *obj, case JSType::JS_FLOAT64_ARRAY: case JSType::JS_BIGINT64_ARRAY: case JSType::JS_BIGUINT64_ARRAY: - JSTypedArray::Cast(obj)->DumpForSnapshot(thread, vec); + JSTypedArray::Cast(obj)->DumpForSnapshot(vec); return; case JSType::BIGINT: - BigInt::Cast(obj)->DumpForSnapshot(thread, vec); + BigInt::Cast(obj)->DumpForSnapshot(vec); return; case JSType::JS_PROXY: - JSProxy::Cast(obj)->DumpForSnapshot(thread, vec); + JSProxy::Cast(obj)->DumpForSnapshot(vec); return; case JSType::JS_PRIMITIVE_REF: - JSPrimitiveRef::Cast(obj)->DumpForSnapshot(thread, vec); + JSPrimitiveRef::Cast(obj)->DumpForSnapshot(vec); return; case JSType::SYMBOL: - JSSymbol::Cast(obj)->DumpForSnapshot(thread, vec); + JSSymbol::Cast(obj)->DumpForSnapshot(vec); return; case JSType::ACCESSOR_DATA: case JSType::INTERNAL_ACCESSOR: - AccessorData::Cast(obj)->DumpForSnapshot(thread, vec); + AccessorData::Cast(obj)->DumpForSnapshot(vec); return; case JSType::JS_DATA_VIEW: - JSDataView::Cast(obj)->DumpForSnapshot(thread, vec); + JSDataView::Cast(obj)->DumpForSnapshot(vec); return; case JSType::PROMISE_REACTIONS: - PromiseReaction::Cast(obj)->DumpForSnapshot(thread, vec); + PromiseReaction::Cast(obj)->DumpForSnapshot(vec); return; case JSType::PROMISE_CAPABILITY: - PromiseCapability::Cast(obj)->DumpForSnapshot(thread, vec); + PromiseCapability::Cast(obj)->DumpForSnapshot(vec); return; case JSType::PROMISE_ITERATOR_RECORD: - PromiseIteratorRecord::Cast(obj)->DumpForSnapshot(thread, vec); + PromiseIteratorRecord::Cast(obj)->DumpForSnapshot(vec); return; case JSType::PROMISE_RECORD: - PromiseRecord::Cast(obj)->DumpForSnapshot(thread, vec); + PromiseRecord::Cast(obj)->DumpForSnapshot(vec); return; case JSType::RESOLVING_FUNCTIONS_RECORD: - ResolvingFunctionsRecord::Cast(obj)->DumpForSnapshot(thread, vec); + ResolvingFunctionsRecord::Cast(obj)->DumpForSnapshot(vec); return; case JSType::JS_PROMISE: - JSPromise::Cast(obj)->DumpForSnapshot(thread, vec); + JSPromise::Cast(obj)->DumpForSnapshot(vec); return; case JSType::JS_PROMISE_REACTIONS_FUNCTION: - JSPromiseReactionsFunction::Cast(obj)->DumpForSnapshot(thread, vec); + JSPromiseReactionsFunction::Cast(obj)->DumpForSnapshot(vec); return; case JSType::JS_PROMISE_EXECUTOR_FUNCTION: - JSPromiseExecutorFunction::Cast(obj)->DumpForSnapshot(thread, vec); + JSPromiseExecutorFunction::Cast(obj)->DumpForSnapshot(vec); return; case JSType::JS_PROMISE_ALL_RESOLVE_ELEMENT_FUNCTION: - JSPromiseAllResolveElementFunction::Cast(obj)->DumpForSnapshot(thread, vec); + JSPromiseAllResolveElementFunction::Cast(obj)->DumpForSnapshot(vec); return; case JSType::MICRO_JOB_QUEUE: - MicroJobQueue::Cast(obj)->DumpForSnapshot(thread, vec); + MicroJobQueue::Cast(obj)->DumpForSnapshot(vec); return; case JSType::PENDING_JOB: - PendingJob::Cast(obj)->DumpForSnapshot(thread, vec); + PendingJob::Cast(obj)->DumpForSnapshot(vec); return; case JSType::COMPLETION_RECORD: - CompletionRecord::Cast(obj)->DumpForSnapshot(thread, vec); + CompletionRecord::Cast(obj)->DumpForSnapshot(vec); return; case JSType::JS_ITERATOR: case JSType::JS_FORIN_ITERATOR: @@ -2727,94 +2715,94 @@ static void DumpObject(JSThread *thread, TaggedObject *obj, case JSType::JS_ARRAY_ITERATOR: case JSType::JS_STRING_ITERATOR: case JSType::JS_ARRAY_BUFFER: - JSArrayBuffer::Cast(obj)->DumpForSnapshot(thread, vec); + JSArrayBuffer::Cast(obj)->DumpForSnapshot(vec); return; case JSType::JS_PROXY_REVOC_FUNCTION: - JSProxyRevocFunction::Cast(obj)->DumpForSnapshot(thread, vec); + JSProxyRevocFunction::Cast(obj)->DumpForSnapshot(vec); return; case JSType::JS_ASYNC_FUNCTION: - JSAsyncFunction::Cast(obj)->DumpForSnapshot(thread, vec); + JSAsyncFunction::Cast(obj)->DumpForSnapshot(vec); return; case JSType::JS_ASYNC_AWAIT_STATUS_FUNCTION: - JSAsyncAwaitStatusFunction::Cast(obj)->DumpForSnapshot(thread, vec); + JSAsyncAwaitStatusFunction::Cast(obj)->DumpForSnapshot(vec); return; case JSType::JS_GENERATOR_FUNCTION: - JSGeneratorFunction::Cast(obj)->DumpForSnapshot(thread, vec); + JSGeneratorFunction::Cast(obj)->DumpForSnapshot(vec); return; case JSType::JS_INTL_BOUND_FUNCTION: - JSIntlBoundFunction::Cast(obj)->DumpForSnapshot(thread, vec); + JSIntlBoundFunction::Cast(obj)->DumpForSnapshot(vec); return; case JSType::JS_REALM: - JSRealm::Cast(obj)->DumpForSnapshot(thread, vec); + JSRealm::Cast(obj)->DumpForSnapshot(vec); return; case JSType::JS_INTL: - JSIntl::Cast(obj)->DumpForSnapshot(thread, vec); + JSIntl::Cast(obj)->DumpForSnapshot(vec); return; case JSType::JS_LOCALE: - JSLocale::Cast(obj)->DumpForSnapshot(thread, vec); + JSLocale::Cast(obj)->DumpForSnapshot(vec); return; case JSType::JS_DATE_TIME_FORMAT: - JSDateTimeFormat::Cast(obj)->DumpForSnapshot(thread, vec); + JSDateTimeFormat::Cast(obj)->DumpForSnapshot(vec); return; case JSType::JS_RELATIVE_TIME_FORMAT: - JSRelativeTimeFormat::Cast(obj)->DumpForSnapshot(thread, vec); + JSRelativeTimeFormat::Cast(obj)->DumpForSnapshot(vec); return; case JSType::JS_NUMBER_FORMAT: - JSNumberFormat::Cast(obj)->DumpForSnapshot(thread, vec); + JSNumberFormat::Cast(obj)->DumpForSnapshot(vec); return; case JSType::JS_COLLATOR: - JSCollator::Cast(obj)->DumpForSnapshot(thread, vec); + JSCollator::Cast(obj)->DumpForSnapshot(vec); return; case JSType::JS_PLURAL_RULES: - JSPluralRules::Cast(obj)->DumpForSnapshot(thread, vec); + JSPluralRules::Cast(obj)->DumpForSnapshot(vec); return; case JSType::JS_GENERATOR_OBJECT: - JSGeneratorObject::Cast(obj)->DumpForSnapshot(thread, vec); + JSGeneratorObject::Cast(obj)->DumpForSnapshot(vec); return; case JSType::JS_ASYNC_FUNC_OBJECT: - JSAsyncFuncObject::Cast(obj)->DumpForSnapshot(thread, vec); + JSAsyncFuncObject::Cast(obj)->DumpForSnapshot(vec); return; case JSType::JS_GENERATOR_CONTEXT: - GeneratorContext::Cast(obj)->DumpForSnapshot(thread, vec); + GeneratorContext::Cast(obj)->DumpForSnapshot(vec); return; case JSType::JS_API_ARRAY_LIST: - JSAPIArrayList::Cast(obj)->DumpForSnapshot(thread, vec); + JSAPIArrayList::Cast(obj)->DumpForSnapshot(vec); return; case JSType::JS_API_ARRAYLIST_ITERATOR: - JSAPIArrayListIterator::Cast(obj)->DumpForSnapshot(thread, vec); + JSAPIArrayListIterator::Cast(obj)->DumpForSnapshot(vec); return; case JSType::JS_API_TREE_MAP: - JSAPITreeMap::Cast(obj)->DumpForSnapshot(thread, vec); + JSAPITreeMap::Cast(obj)->DumpForSnapshot(vec); return; case JSType::JS_API_TREE_SET: - JSAPITreeSet::Cast(obj)->DumpForSnapshot(thread, vec); + JSAPITreeSet::Cast(obj)->DumpForSnapshot(vec); return; case JSType::JS_API_TREEMAP_ITERATOR: - JSAPITreeMapIterator::Cast(obj)->DumpForSnapshot(thread, vec); + JSAPITreeMapIterator::Cast(obj)->DumpForSnapshot(vec); return; case JSType::JS_API_TREESET_ITERATOR: - JSAPITreeSetIterator::Cast(obj)->DumpForSnapshot(thread, vec); + JSAPITreeSetIterator::Cast(obj)->DumpForSnapshot(vec); return; case JSType::JS_API_QUEUE: - JSAPIQueue::Cast(obj)->DumpForSnapshot(thread, vec); + JSAPIQueue::Cast(obj)->DumpForSnapshot(vec); return; case JSType::JS_API_QUEUE_ITERATOR: - JSAPIQueueIterator::Cast(obj)->DumpForSnapshot(thread, vec); + JSAPIQueueIterator::Cast(obj)->DumpForSnapshot(vec); return; case JSType::SOURCE_TEXT_MODULE_RECORD: - SourceTextModule::Cast(obj)->DumpForSnapshot(thread, vec); + SourceTextModule::Cast(obj)->DumpForSnapshot(vec); return; case JSType::IMPORTENTRY_RECORD: - ImportEntry::Cast(obj)->DumpForSnapshot(thread, vec); + ImportEntry::Cast(obj)->DumpForSnapshot(vec); return; case JSType::EXPORTENTRY_RECORD: - ExportEntry::Cast(obj)->DumpForSnapshot(thread, vec); + ExportEntry::Cast(obj)->DumpForSnapshot(vec); return; case JSType::RESOLVEDBINDING_RECORD: - ResolvedBinding::Cast(obj)->DumpForSnapshot(thread, vec); + ResolvedBinding::Cast(obj)->DumpForSnapshot(vec); return; case JSType::JS_MODULE_NAMESPACE: - ModuleNamespace::Cast(obj)->DumpForSnapshot(thread, vec); + ModuleNamespace::Cast(obj)->DumpForSnapshot(vec); return; default: break; @@ -2822,58 +2810,58 @@ static void DumpObject(JSThread *thread, TaggedObject *obj, if (isVmMode) { switch (type) { case JSType::PROPERTY_BOX: - PropertyBox::Cast(obj)->DumpForSnapshot(thread, vec); + PropertyBox::Cast(obj)->DumpForSnapshot(vec); return; case JSType::TEMPLATE_MAP: - DumpArrayClass(thread, TaggedArray::Cast(obj), vec); + DumpArrayClass(TaggedArray::Cast(obj), vec); return; case JSType::GLOBAL_ENV: - GlobalEnv::Cast(obj)->DumpForSnapshot(thread, vec); + GlobalEnv::Cast(obj)->DumpForSnapshot(vec); return; case JSType::PROTO_CHANGE_MARKER: - ProtoChangeMarker::Cast(obj)->DumpForSnapshot(thread, vec); + ProtoChangeMarker::Cast(obj)->DumpForSnapshot(vec); return; case JSType::PROTOTYPE_INFO: - ProtoChangeDetails::Cast(obj)->DumpForSnapshot(thread, vec); + ProtoChangeDetails::Cast(obj)->DumpForSnapshot(vec); return; case JSType::PROGRAM: - Program::Cast(obj)->DumpForSnapshot(thread, vec); + Program::Cast(obj)->DumpForSnapshot(vec); return; case JSType::MACHINE_CODE_OBJECT: - MachineCode::Cast(obj)->DumpForSnapshot(thread, vec); + MachineCode::Cast(obj)->DumpForSnapshot(vec); return; case JSType::TRANSITION_HANDLER: - TransitionHandler::Cast(obj)->DumpForSnapshot(thread, vec); + TransitionHandler::Cast(obj)->DumpForSnapshot(vec); return; case JSType::PROTOTYPE_HANDLER: - PrototypeHandler::Cast(obj)->DumpForSnapshot(thread, vec); + PrototypeHandler::Cast(obj)->DumpForSnapshot(vec); return; case JSType::CLASS_INFO_EXTRACTOR: - ClassInfoExtractor::Cast(obj)->DumpForSnapshot(thread, vec); + ClassInfoExtractor::Cast(obj)->DumpForSnapshot(vec); return; case JSType::TS_OBJECT_TYPE: - TSObjectType::Cast(obj)->DumpForSnapshot(thread, vec); + TSObjectType::Cast(obj)->DumpForSnapshot(vec); return; case JSType::TS_CLASS_TYPE: - TSClassType::Cast(obj)->DumpForSnapshot(thread, vec); + TSClassType::Cast(obj)->DumpForSnapshot(vec); return; case JSType::TS_INTERFACE_TYPE: - TSInterfaceType::Cast(obj)->DumpForSnapshot(thread, vec); + TSInterfaceType::Cast(obj)->DumpForSnapshot(vec); return; case JSType::TS_IMPORT_TYPE: - TSImportType::Cast(obj)->DumpForSnapshot(thread, vec); + TSImportType::Cast(obj)->DumpForSnapshot(vec); return; case JSType::TS_CLASS_INSTANCE_TYPE: - TSClassInstanceType::Cast(obj)->DumpForSnapshot(thread, vec); + TSClassInstanceType::Cast(obj)->DumpForSnapshot(vec); return; case JSType::TS_UNION_TYPE: - TSUnionType::Cast(obj)->DumpForSnapshot(thread, vec); + TSUnionType::Cast(obj)->DumpForSnapshot(vec); return; case JSType::TS_FUNCTION_TYPE: - TSFunctionType::Cast(obj)->DumpForSnapshot(thread, vec); + TSFunctionType::Cast(obj)->DumpForSnapshot(vec); return; case JSType::TS_ARRAY_TYPE: - TSArrayType::Cast(obj)->DumpForSnapshot(thread, vec); + TSArrayType::Cast(obj)->DumpForSnapshot(vec); return; default: UNREACHABLE(); @@ -2914,18 +2902,16 @@ static void KeyToStd(CString &res, JSTaggedValue key) } } -void JSTaggedValue::DumpForSnapshot(JSThread *thread, - std::vector> &vec, bool isVmMode) const +void JSTaggedValue::DumpForSnapshot(std::vector> &vec, bool isVmMode) const { if (IsHeapObject()) { - return DumpObject(thread, GetTaggedObject(), vec, isVmMode); + return DumpObject(GetTaggedObject(), vec, isVmMode); } UNREACHABLE(); } -void NumberDictionary::DumpForSnapshot([[maybe_unused]] JSThread *thread, - std::vector> &vec) const +void NumberDictionary::DumpForSnapshot(std::vector> &vec) const { DISALLOW_GARBAGE_COLLECTION; int size = Size(); @@ -2939,8 +2925,7 @@ void NumberDictionary::DumpForSnapshot([[maybe_unused]] JSThread *thread, } } -void NameDictionary::DumpForSnapshot([[maybe_unused]] JSThread *thread, - std::vector> &vec) const +void NameDictionary::DumpForSnapshot(std::vector> &vec) const { DISALLOW_GARBAGE_COLLECTION; int size = Size(); @@ -2955,8 +2940,7 @@ void NameDictionary::DumpForSnapshot([[maybe_unused]] JSThread *thread, } } -void GlobalDictionary::DumpForSnapshot([[maybe_unused]] JSThread *thread, - std::vector> &vec) const +void GlobalDictionary::DumpForSnapshot(std::vector> &vec) const { DISALLOW_GARBAGE_COLLECTION; int size = Size(); @@ -2971,8 +2955,7 @@ void GlobalDictionary::DumpForSnapshot([[maybe_unused]] JSThread *thread, } } -void LinkedHashSet::DumpForSnapshot([[maybe_unused]] JSThread *thread, - std::vector> &vec) const +void LinkedHashSet::DumpForSnapshot(std::vector> &vec) const { DISALLOW_GARBAGE_COLLECTION; int capacity = NumberOfElements() + NumberOfDeletedElements(); @@ -2986,8 +2969,7 @@ void LinkedHashSet::DumpForSnapshot([[maybe_unused]] JSThread *thread, } } -void LinkedHashMap::DumpForSnapshot([[maybe_unused]] JSThread *thread, - std::vector> &vec) const +void LinkedHashMap::DumpForSnapshot(std::vector> &vec) const { DISALLOW_GARBAGE_COLLECTION; int capacity = NumberOfElements() + NumberOfDeletedElements(); @@ -3002,8 +2984,7 @@ void LinkedHashMap::DumpForSnapshot([[maybe_unused]] JSThread *thread, } } -void TaggedTreeMap::DumpForSnapshot([[maybe_unused]] JSThread *thread, - std::vector> &vec) const +void TaggedTreeMap::DumpForSnapshot(std::vector> &vec) const { DISALLOW_GARBAGE_COLLECTION; int capacity = NumberOfElements() + NumberOfDeletedElements(); @@ -3018,8 +2999,7 @@ void TaggedTreeMap::DumpForSnapshot([[maybe_unused]] JSThread *thread, } } -void TaggedTreeSet::DumpForSnapshot([[maybe_unused]] JSThread *thread, - std::vector> &vec) const +void TaggedTreeSet::DumpForSnapshot(std::vector> &vec) const { DISALLOW_GARBAGE_COLLECTION; int capacity = NumberOfElements() + NumberOfDeletedElements(); @@ -3033,7 +3013,7 @@ void TaggedTreeSet::DumpForSnapshot([[maybe_unused]] JSThread *thread, } } -void JSObject::DumpForSnapshot(JSThread *thread, std::vector> &vec) const +void JSObject::DumpForSnapshot(std::vector> &vec) const { DISALLOW_GARBAGE_COLLECTION; JSHClass *jshclass = GetJSHClass(); @@ -3042,16 +3022,16 @@ void JSObject::DumpForSnapshot(JSThread *thread, std::vectorGetLength() == 0) { } else if (!elements->IsDictionaryMode()) { - DumpArrayClass(thread, elements, vec); + DumpArrayClass(elements, vec); } else { NumberDictionary *dict = NumberDictionary::Cast(elements); - dict->DumpForSnapshot(thread, vec); + dict->DumpForSnapshot(vec); } TaggedArray *properties = TaggedArray::Cast(GetProperties().GetTaggedObject()); if (IsJSGlobalObject()) { GlobalDictionary *dict = GlobalDictionary::Cast(properties); - dict->DumpForSnapshot(thread, vec); + dict->DumpForSnapshot(vec); return; } @@ -3080,17 +3060,15 @@ void JSObject::DumpForSnapshot(JSThread *thread, std::vectorDumpForSnapshot(thread, vec); + dict->DumpForSnapshot(vec); } } -void JSHClass::DumpForSnapshot([[maybe_unused]] JSThread *thread, - [[maybe_unused]] std::vector> &vec) const +void JSHClass::DumpForSnapshot([[maybe_unused]] std::vector> &vec) const { } -void JSFunction::DumpForSnapshot([[maybe_unused]] JSThread *thread, - std::vector> &vec) const +void JSFunction::DumpForSnapshot(std::vector> &vec) const { vec.push_back(std::make_pair(CString("ProtoOrDynClass"), GetProtoOrDynClass())); vec.push_back(std::make_pair(CString("LexicalEnv"), GetLexicalEnv())); @@ -3102,175 +3080,154 @@ void JSFunction::DumpForSnapshot([[maybe_unused]] JSThread *thread, vec.push_back(std::make_pair(CString("FunctionExtraInfo"), GetFunctionExtraInfo())); vec.push_back(std::make_pair(CString("ConstantPool"), GetConstantPool())); vec.push_back(std::make_pair(CString("ProfileTypeInfo"), GetProfileTypeInfo())); - JSObject::DumpForSnapshot(thread, vec); + JSObject::DumpForSnapshot(vec); } -void Program::DumpForSnapshot([[maybe_unused]] JSThread *thread, - std::vector> &vec) const +void Program::DumpForSnapshot(std::vector> &vec) const { vec.push_back(std::make_pair(CString("MainFunction"), GetMainFunction())); } -void ConstantPool::DumpForSnapshot([[maybe_unused]] JSThread *thread, - std::vector> &vec) const +void ConstantPool::DumpForSnapshot(std::vector> &vec) const { - DumpArrayClass(thread, this, vec); + DumpArrayClass(this, vec); } -void JSBoundFunction::DumpForSnapshot([[maybe_unused]] JSThread *thread, - std::vector> &vec) const +void JSBoundFunction::DumpForSnapshot(std::vector> &vec) const { - JSObject::DumpForSnapshot(thread, vec); + JSObject::DumpForSnapshot(vec); vec.push_back(std::make_pair(CString("BoundTarget"), GetBoundTarget())); vec.push_back(std::make_pair(CString("BoundThis"), GetBoundThis())); vec.push_back(std::make_pair(CString("BoundArguments"), GetBoundArguments())); } -void JSPrimitiveRef::DumpForSnapshot([[maybe_unused]] JSThread *thread, - std::vector> &vec) const +void JSPrimitiveRef::DumpForSnapshot(std::vector> &vec) const { vec.push_back(std::make_pair(CString("subValue"), GetValue())); - JSObject::DumpForSnapshot(thread, vec); + JSObject::DumpForSnapshot(vec); } -void BigInt::DumpForSnapshot([[maybe_unused]] JSThread *thread, - std::vector> &vec) const +void BigInt::DumpForSnapshot(std::vector> &vec) const { vec.push_back(std::make_pair(CString("Data"), GetData())); vec.push_back(std::make_pair(CString("Sign"), JSTaggedValue(GetSign()))); } -void JSDate::DumpForSnapshot([[maybe_unused]] JSThread *thread, - std::vector> &vec) const +void JSDate::DumpForSnapshot(std::vector> &vec) const { vec.push_back(std::make_pair(CString("time"), GetTime())); vec.push_back(std::make_pair(CString("localOffset"), GetLocalOffset())); - JSObject::DumpForSnapshot(thread, vec); + JSObject::DumpForSnapshot(vec); } -void JSMap::DumpForSnapshot([[maybe_unused]] JSThread *thread, - std::vector> &vec) const +void JSMap::DumpForSnapshot(std::vector> &vec) const { LinkedHashMap *map = LinkedHashMap::Cast(GetLinkedMap().GetTaggedObject()); - map->DumpForSnapshot(thread, vec); + map->DumpForSnapshot(vec); - JSObject::DumpForSnapshot(thread, vec); + JSObject::DumpForSnapshot(vec); } -void JSForInIterator::DumpForSnapshot([[maybe_unused]] JSThread *thread, - std::vector> &vec) const +void JSForInIterator::DumpForSnapshot(std::vector> &vec) const { vec.push_back(std::make_pair(CString("Object"), GetObject())); vec.push_back(std::make_pair(CString("WasVisited"), JSTaggedValue(GetWasVisited()))); vec.push_back(std::make_pair(CString("VisitedKeys"), GetVisitedKeys())); vec.push_back(std::make_pair(CString("RemainingKeys"), GetRemainingKeys())); - JSObject::DumpForSnapshot(thread, vec); + JSObject::DumpForSnapshot(vec); } -void JSMapIterator::DumpForSnapshot([[maybe_unused]] JSThread *thread, - std::vector> &vec) const +void JSMapIterator::DumpForSnapshot(std::vector> &vec) const { LinkedHashMap *map = LinkedHashMap::Cast(GetIteratedMap().GetTaggedObject()); - map->DumpForSnapshot(thread, vec); + map->DumpForSnapshot(vec); vec.push_back(std::make_pair(CString("NextIndex"), JSTaggedValue(GetNextIndex()))); vec.push_back(std::make_pair(CString("IterationKind"), JSTaggedValue(static_cast(GetIterationKind())))); - JSObject::DumpForSnapshot(thread, vec); + JSObject::DumpForSnapshot(vec); } -void JSSet::DumpForSnapshot([[maybe_unused]] JSThread *thread, - std::vector> &vec) const +void JSSet::DumpForSnapshot(std::vector> &vec) const { LinkedHashSet *set = LinkedHashSet::Cast(GetLinkedSet().GetTaggedObject()); - set->DumpForSnapshot(thread, vec); + set->DumpForSnapshot(vec); - JSObject::DumpForSnapshot(thread, vec); + JSObject::DumpForSnapshot(vec); } -void JSWeakMap::DumpForSnapshot([[maybe_unused]] JSThread *thread, - std::vector> &vec) const +void JSWeakMap::DumpForSnapshot(std::vector> &vec) const { LinkedHashMap *map = LinkedHashMap::Cast(GetLinkedMap().GetTaggedObject()); - map->DumpForSnapshot(thread, vec); + map->DumpForSnapshot(vec); - JSObject::DumpForSnapshot(thread, vec); + JSObject::DumpForSnapshot(vec); } -void JSWeakSet::DumpForSnapshot([[maybe_unused]] JSThread *thread, - std::vector> &vec) const +void JSWeakSet::DumpForSnapshot(std::vector> &vec) const { LinkedHashSet *set = LinkedHashSet::Cast(GetLinkedSet().GetTaggedObject()); - set->DumpForSnapshot(thread, vec); + set->DumpForSnapshot(vec); - JSObject::DumpForSnapshot(thread, vec); + JSObject::DumpForSnapshot(vec); } -void JSSetIterator::DumpForSnapshot([[maybe_unused]] JSThread *thread, - std::vector> &vec) const +void JSSetIterator::DumpForSnapshot(std::vector> &vec) const { LinkedHashSet *set = LinkedHashSet::Cast(GetIteratedSet().GetTaggedObject()); - set->DumpForSnapshot(thread, vec); + set->DumpForSnapshot(vec); vec.push_back(std::make_pair(CString("NextIndex"), JSTaggedValue(GetNextIndex()))); vec.push_back(std::make_pair(CString("IterationKind"), JSTaggedValue(static_cast(GetIterationKind())))); - JSObject::DumpForSnapshot(thread, vec); + JSObject::DumpForSnapshot(vec); } -void JSArray::DumpForSnapshot([[maybe_unused]] JSThread *thread, - std::vector> &vec) const +void JSArray::DumpForSnapshot(std::vector> &vec) const { - JSObject::DumpForSnapshot(thread, vec); + JSObject::DumpForSnapshot(vec); } -void JSAPIArrayList::DumpForSnapshot([[maybe_unused]] JSThread *thread, - std::vector> &vec) const +void JSAPIArrayList::DumpForSnapshot(std::vector> &vec) const { - JSObject::DumpForSnapshot(thread, vec); + JSObject::DumpForSnapshot(vec); } -void JSAPIArrayListIterator::DumpForSnapshot([[maybe_unused]] JSThread *thread, - std::vector> &vec) const +void JSAPIArrayListIterator::DumpForSnapshot(std::vector> &vec) const { JSAPIArrayList *arraylist = JSAPIArrayList::Cast(GetIteratedArrayList().GetTaggedObject()); - arraylist->DumpForSnapshot(thread, vec); + arraylist->DumpForSnapshot(vec); vec.push_back(std::make_pair(CString("NextIndex"), JSTaggedValue(GetNextIndex()))); - JSObject::DumpForSnapshot(thread, vec); + JSObject::DumpForSnapshot(vec); } -void JSAPIQueue::DumpForSnapshot([[maybe_unused]] JSThread *thread, - std::vector> &vec) const +void JSAPIQueue::DumpForSnapshot(std::vector> &vec) const { - JSObject::DumpForSnapshot(thread, vec); + JSObject::DumpForSnapshot(vec); } -void JSAPIQueueIterator::DumpForSnapshot([[maybe_unused]] JSThread *thread, - std::vector> &vec) const +void JSAPIQueueIterator::DumpForSnapshot(std::vector> &vec) const { JSAPIQueue *queue = JSAPIQueue::Cast(GetIteratedQueue().GetTaggedObject()); - queue->DumpForSnapshot(thread, vec); + queue->DumpForSnapshot(vec); vec.push_back(std::make_pair(CString("NextIndex"), JSTaggedValue(GetNextIndex()))); - JSObject::DumpForSnapshot(thread, vec); + JSObject::DumpForSnapshot(vec); } -void JSArrayIterator::DumpForSnapshot([[maybe_unused]] JSThread *thread, - std::vector> &vec) const +void JSArrayIterator::DumpForSnapshot(std::vector> &vec) const { JSArray *array = JSArray::Cast(GetIteratedArray().GetTaggedObject()); - array->DumpForSnapshot(thread, vec); + array->DumpForSnapshot(vec); vec.push_back(std::make_pair(CString("NextIndex"), JSTaggedValue(GetNextIndex()))); vec.push_back(std::make_pair(CString("IterationKind"), JSTaggedValue(static_cast(GetIterationKind())))); - JSObject::DumpForSnapshot(thread, vec); + JSObject::DumpForSnapshot(vec); } -void JSStringIterator::DumpForSnapshot([[maybe_unused]] JSThread *thread, - std::vector> &vec) const +void JSStringIterator::DumpForSnapshot(std::vector> &vec) const { vec.push_back(std::make_pair(CString("IteratedString"), GetIteratedString())); vec.push_back(std::make_pair(CString("StringIteratorNextIndex"), JSTaggedValue(GetStringIteratorNextIndex()))); - JSObject::DumpForSnapshot(thread, vec); + JSObject::DumpForSnapshot(vec); } -void JSTypedArray::DumpForSnapshot([[maybe_unused]] JSThread *thread, - std::vector> &vec) const +void JSTypedArray::DumpForSnapshot(std::vector> &vec) const { vec.push_back(std::make_pair(CString("viewed-array-buffer"), GetViewedArrayBuffer())); vec.push_back(std::make_pair(CString("typed-array-name"), GetTypedArrayName())); @@ -3279,47 +3236,41 @@ void JSTypedArray::DumpForSnapshot([[maybe_unused]] JSThread *thread, vec.push_back(std::make_pair(CString("array-length"), GetArrayLength())); } -void JSRegExp::DumpForSnapshot([[maybe_unused]] JSThread *thread, - std::vector> &vec) const +void JSRegExp::DumpForSnapshot(std::vector> &vec) const { vec.push_back(std::make_pair(CString("originalSource"), GetOriginalSource())); vec.push_back(std::make_pair(CString("originalFlags"), GetOriginalFlags())); - JSObject::DumpForSnapshot(thread, vec); + JSObject::DumpForSnapshot(vec); } -void JSProxy::DumpForSnapshot([[maybe_unused]] JSThread *thread, - std::vector> &vec) const +void JSProxy::DumpForSnapshot(std::vector> &vec) const { vec.push_back(std::make_pair(CString("target"), GetTarget())); vec.push_back(std::make_pair(CString("handler"), GetHandler())); } -void JSSymbol::DumpForSnapshot([[maybe_unused]] JSThread *thread, - std::vector> &vec) const +void JSSymbol::DumpForSnapshot(std::vector> &vec) const { vec.push_back(std::make_pair(CString("hash-field"), JSTaggedValue(GetHashField()))); vec.push_back(std::make_pair(CString("flags"), JSTaggedValue(GetFlags()))); vec.push_back(std::make_pair(CString("description"), GetDescription())); } -void AccessorData::DumpForSnapshot([[maybe_unused]] JSThread *thread, - std::vector> &vec) const +void AccessorData::DumpForSnapshot(std::vector> &vec) const { vec.push_back(std::make_pair(CString("getter"), GetGetter())); vec.push_back(std::make_pair(CString("setter"), GetSetter())); } -void LexicalEnv::DumpForSnapshot([[maybe_unused]] JSThread *thread, - std::vector> &vec) const +void LexicalEnv::DumpForSnapshot(std::vector> &vec) const { - DumpArrayClass(thread, this, vec); + DumpArrayClass(this, vec); } -void GlobalEnv::DumpForSnapshot([[maybe_unused]] JSThread *thread, - std::vector> &vec) const +void GlobalEnv::DumpForSnapshot(std::vector> &vec) const { - auto globalConst = thread->GlobalConstants(); + auto globalConst = GetJSThread()->GlobalConstants(); vec.push_back(std::make_pair(CString("ObjectFunction"), GetObjectFunction().GetTaggedValue())); vec.push_back(std::make_pair(CString("FunctionFunction"), GetFunctionFunction().GetTaggedValue())); vec.push_back(std::make_pair(CString("NumberFunction"), GetNumberFunction().GetTaggedValue())); @@ -3438,8 +3389,7 @@ void GlobalEnv::DumpForSnapshot([[maybe_unused]] JSThread *thread, vec.push_back(std::make_pair(CString("QueueIteratorPrototype"), globalConst->GetQueueIteratorPrototype())); } -void JSDataView::DumpForSnapshot([[maybe_unused]] JSThread *thread, - std::vector> &vec) const +void JSDataView::DumpForSnapshot(std::vector> &vec) const { vec.push_back(std::make_pair(CString("data-view"), GetDataView())); vec.push_back(std::make_pair(CString("buffer"), GetViewedArrayBuffer())); @@ -3447,183 +3397,161 @@ void JSDataView::DumpForSnapshot([[maybe_unused]] JSThread *thread, vec.push_back(std::make_pair(CString("byte-offset"), JSTaggedValue(GetByteOffset()))); } -void JSArrayBuffer::DumpForSnapshot([[maybe_unused]] JSThread *thread, - std::vector> &vec) const +void JSArrayBuffer::DumpForSnapshot(std::vector> &vec) const { vec.push_back(std::make_pair(CString("buffer-data"), GetArrayBufferData())); vec.push_back(std::make_pair(CString("byte-length"), JSTaggedValue(GetArrayBufferByteLength()))); vec.push_back(std::make_pair(CString("shared"), JSTaggedValue(GetShared()))); } -void PromiseReaction::DumpForSnapshot([[maybe_unused]] JSThread *thread, - std::vector> &vec) const +void PromiseReaction::DumpForSnapshot(std::vector> &vec) const { vec.push_back(std::make_pair(CString("promise-capability"), GetPromiseCapability())); vec.push_back(std::make_pair(CString("handler"), GetHandler())); vec.push_back(std::make_pair(CString("type"), JSTaggedValue(static_cast(GetType())))); } -void PromiseCapability::DumpForSnapshot([[maybe_unused]] JSThread *thread, - std::vector> &vec) const +void PromiseCapability::DumpForSnapshot(std::vector> &vec) const { vec.push_back(std::make_pair(CString("promise"), GetPromise())); vec.push_back(std::make_pair(CString("resolve"), GetResolve())); vec.push_back(std::make_pair(CString("reject"), GetReject())); } -void PromiseIteratorRecord::DumpForSnapshot([[maybe_unused]] JSThread *thread, - std::vector> &vec) const +void PromiseIteratorRecord::DumpForSnapshot(std::vector> &vec) const { vec.push_back(std::make_pair(CString("iterator"), GetIterator())); vec.push_back(std::make_pair(CString("done"), JSTaggedValue(GetDone()))); } -void PromiseRecord::DumpForSnapshot([[maybe_unused]] JSThread *thread, - std::vector> &vec) const +void PromiseRecord::DumpForSnapshot(std::vector> &vec) const { vec.push_back(std::make_pair(CString("value"), GetValue())); } -void ResolvingFunctionsRecord::DumpForSnapshot([[maybe_unused]] JSThread *thread, - std::vector> &vec) const +void ResolvingFunctionsRecord::DumpForSnapshot(std::vector> &vec) const { vec.push_back(std::make_pair(CString("resolve-function"), GetResolveFunction())); vec.push_back(std::make_pair(CString("reject-function"), GetRejectFunction())); } -void JSPromise::DumpForSnapshot([[maybe_unused]] JSThread *thread, - std::vector> &vec) const +void JSPromise::DumpForSnapshot(std::vector> &vec) const { vec.push_back(std::make_pair(CString("promise-state"), JSTaggedValue(static_cast(GetPromiseState())))); vec.push_back(std::make_pair(CString("promise-result"), GetPromiseResult())); vec.push_back(std::make_pair(CString("promise-fulfill-reactions"), GetPromiseFulfillReactions())); vec.push_back(std::make_pair(CString("promise-reject-reactions"), GetPromiseRejectReactions())); vec.push_back(std::make_pair(CString("promise-is-handled"), JSTaggedValue(GetPromiseIsHandled()))); - JSObject::DumpForSnapshot(thread, vec); + JSObject::DumpForSnapshot(vec); } -void JSPromiseReactionsFunction::DumpForSnapshot([[maybe_unused]] JSThread *thread, - std::vector> &vec) const +void JSPromiseReactionsFunction::DumpForSnapshot(std::vector> &vec) const { vec.push_back(std::make_pair(CString("promise"), GetPromise())); vec.push_back(std::make_pair(CString("already-resolved"), GetAlreadyResolved())); - JSObject::DumpForSnapshot(thread, vec); + JSObject::DumpForSnapshot(vec); } -void JSPromiseExecutorFunction::DumpForSnapshot([[maybe_unused]] JSThread *thread, - std::vector> &vec) const +void JSPromiseExecutorFunction::DumpForSnapshot(std::vector> &vec) const { vec.push_back(std::make_pair(CString("capability"), GetCapability())); - JSObject::DumpForSnapshot(thread, vec); + JSObject::DumpForSnapshot(vec); } -void JSPromiseAllResolveElementFunction::DumpForSnapshot([[maybe_unused]] JSThread *thread, - std::vector> &vec) const +void JSPromiseAllResolveElementFunction::DumpForSnapshot(std::vector> &vec) const { vec.push_back(std::make_pair(CString("index"), GetIndex())); vec.push_back(std::make_pair(CString("values"), GetValues())); vec.push_back(std::make_pair(CString("capabilities"), GetCapabilities())); vec.push_back(std::make_pair(CString("remaining-elements"), GetRemainingElements())); vec.push_back(std::make_pair(CString("already-called"), GetAlreadyCalled())); - JSObject::DumpForSnapshot(thread, vec); + JSObject::DumpForSnapshot(vec); } -void MicroJobQueue::DumpForSnapshot([[maybe_unused]] JSThread *thread, - std::vector> &vec) const +void MicroJobQueue::DumpForSnapshot(std::vector> &vec) const { vec.push_back(std::make_pair(CString("promise-job-queue"), GetPromiseJobQueue())); vec.push_back(std::make_pair(CString("script-job-queue"), GetScriptJobQueue())); } -void PendingJob::DumpForSnapshot([[maybe_unused]] JSThread *thread, - std::vector> &vec) const +void PendingJob::DumpForSnapshot(std::vector> &vec) const { vec.push_back(std::make_pair(CString("job"), GetJob())); vec.push_back(std::make_pair(CString("arguments"), GetArguments())); } -void CompletionRecord::DumpForSnapshot([[maybe_unused]] JSThread *thread, - std::vector> &vec) const +void CompletionRecord::DumpForSnapshot(std::vector> &vec) const { vec.push_back(std::make_pair(CString("value"), GetValue())); vec.push_back(std::make_pair(CString("type"), JSTaggedValue(static_cast(GetType())))); } -void JSProxyRevocFunction::DumpForSnapshot([[maybe_unused]] JSThread *thread, - std::vector> &vec) const +void JSProxyRevocFunction::DumpForSnapshot(std::vector> &vec) const { vec.push_back(std::make_pair(CString("RevocableProxy"), GetRevocableProxy())); } -void JSAsyncFunction::DumpForSnapshot([[maybe_unused]] JSThread *thread, - std::vector> &vec) const +void JSAsyncFunction::DumpForSnapshot(std::vector> &vec) const { - JSFunction::DumpForSnapshot(thread, vec); + JSFunction::DumpForSnapshot(vec); } -void JSAsyncAwaitStatusFunction::DumpForSnapshot([[maybe_unused]] JSThread *thread, - std::vector> &vec) const +void JSAsyncAwaitStatusFunction::DumpForSnapshot(std::vector> &vec) const { vec.push_back(std::make_pair(CString("AsyncContext"), GetAsyncContext())); } -void JSGeneratorFunction::DumpForSnapshot([[maybe_unused]] JSThread *thread, - std::vector> &vec) const +void JSGeneratorFunction::DumpForSnapshot(std::vector> &vec) const { - JSFunction::DumpForSnapshot(thread, vec); + JSFunction::DumpForSnapshot(vec); } -void JSIntlBoundFunction::DumpForSnapshot(JSThread *thread, - std::vector> &vec) const +void JSIntlBoundFunction::DumpForSnapshot(std::vector> &vec) const { vec.push_back(std::make_pair(CString("NumberFormat"), GetNumberFormat())); vec.push_back(std::make_pair(CString("DateTimeFormat"), GetDateTimeFormat())); vec.push_back(std::make_pair(CString("Collator"), GetCollator())); - JSObject::DumpForSnapshot(thread, vec); + JSObject::DumpForSnapshot(vec); } -void PropertyBox::DumpForSnapshot([[maybe_unused]] JSThread *thread, - std::vector> &vec) const +void PropertyBox::DumpForSnapshot(std::vector> &vec) const { vec.push_back(std::make_pair(CString("Value"), GetValue())); } -void PrototypeHandler::DumpForSnapshot([[maybe_unused]] JSThread *thread, - std::vector> &vec) const +void PrototypeHandler::DumpForSnapshot(std::vector> &vec) const { vec.push_back(std::make_pair(CString("HandlerInfo"), GetHandlerInfo())); vec.push_back(std::make_pair(CString("ProtoCell"), GetProtoCell())); vec.push_back(std::make_pair(CString("Holder"), GetHolder())); } -void TransitionHandler::DumpForSnapshot([[maybe_unused]] JSThread *thread, - std::vector> &vec) const +void TransitionHandler::DumpForSnapshot(std::vector> &vec) const { vec.push_back(std::make_pair(CString("HandlerInfo"), GetHandlerInfo())); vec.push_back(std::make_pair(CString("TransitionHClass"), GetTransitionHClass())); } -void JSRealm::DumpForSnapshot([[maybe_unused]] JSThread *thread, - std::vector> &vec) const +void JSRealm::DumpForSnapshot(std::vector> &vec) const { vec.push_back(std::make_pair(CString("Value"), GetValue())); vec.push_back(std::make_pair(CString("GLobalEnv"), GetGlobalEnv())); - JSObject::DumpForSnapshot(thread, vec); + JSObject::DumpForSnapshot(vec); } -void JSIntl::DumpForSnapshot(JSThread *thread, std::vector> &vec) const +void JSIntl::DumpForSnapshot(std::vector> &vec) const { vec.push_back(std::make_pair(CString("FallbackSymbol"), GetFallbackSymbol())); - JSObject::DumpForSnapshot(thread, vec); + JSObject::DumpForSnapshot(vec); } -void JSLocale::DumpForSnapshot(JSThread *thread, std::vector> &vec) const +void JSLocale::DumpForSnapshot(std::vector> &vec) const { vec.push_back(std::make_pair(CString("IcuField"), GetIcuField())); - JSObject::DumpForSnapshot(thread, vec); + JSObject::DumpForSnapshot(vec); } -void JSDateTimeFormat::DumpForSnapshot(JSThread *thread, std::vector> &vec) const +void JSDateTimeFormat::DumpForSnapshot(std::vector> &vec) const { vec.push_back(std::make_pair(CString("Locale"), GetLocale())); vec.push_back(std::make_pair(CString("Calendar"), GetCalendar())); @@ -3636,10 +3564,10 @@ void JSDateTimeFormat::DumpForSnapshot(JSThread *thread, std::vector(GetDateStyle())))); vec.push_back(std::make_pair(CString("TimeStyle"), JSTaggedValue(static_cast(GetTimeStyle())))); vec.push_back(std::make_pair(CString("BoundFormat"), GetBoundFormat())); - JSObject::DumpForSnapshot(thread, vec); + JSObject::DumpForSnapshot(vec); } -void JSRelativeTimeFormat::DumpForSnapshot(JSThread *thread, std::vector> &vec) const +void JSRelativeTimeFormat::DumpForSnapshot(std::vector> &vec) const { vec.push_back(std::make_pair(CString("Locale"), GetLocale())); vec.push_back(std::make_pair(CString("InitializedRelativeTimeFormat"), GetInitializedRelativeTimeFormat())); @@ -3648,10 +3576,10 @@ void JSRelativeTimeFormat::DumpForSnapshot(JSThread *thread, std::vector(GetNumeric())))); vec.push_back(std::make_pair(CString("AvailableLocales"), GetAvailableLocales())); vec.push_back(std::make_pair(CString("IcuField"), GetIcuField())); - JSObject::DumpForSnapshot(thread, vec); + JSObject::DumpForSnapshot(vec); } -void JSNumberFormat::DumpForSnapshot(JSThread *thread, std::vector> &vec) const +void JSNumberFormat::DumpForSnapshot(std::vector> &vec) const { vec.push_back(std::make_pair(CString("Locale"), GetLocale())); vec.push_back(std::make_pair(CString("NumberingSystem"), GetNumberingSystem())); @@ -3673,10 +3601,10 @@ void JSNumberFormat::DumpForSnapshot(JSThread *thread, std::vector(GetSignDisplay())))); vec.push_back(std::make_pair(CString("BoundFormat"), GetBoundFormat())); vec.push_back(std::make_pair(CString("IcuField"), GetIcuField())); - JSObject::DumpForSnapshot(thread, vec); + JSObject::DumpForSnapshot(vec); } -void JSCollator::DumpForSnapshot(JSThread *thread, std::vector> &vec) const +void JSCollator::DumpForSnapshot(std::vector> &vec) const { vec.push_back(std::make_pair(CString("IcuField"), GetIcuField())); vec.push_back(std::make_pair(CString("Locale"), GetLocale())); @@ -3687,10 +3615,10 @@ void JSCollator::DumpForSnapshot(JSThread *thread, std::vector(GetSensitivity())))); vec.push_back(std::make_pair(CString("IgnorePunctuation"), JSTaggedValue(GetIgnorePunctuation()))); vec.push_back(std::make_pair(CString("Numeric"), JSTaggedValue(GetNumeric()))); - JSObject::DumpForSnapshot(thread, vec); + JSObject::DumpForSnapshot(vec); } -void JSPluralRules::DumpForSnapshot(JSThread *thread, std::vector> &vec) const +void JSPluralRules::DumpForSnapshot(std::vector> &vec) const { vec.push_back(std::make_pair(CString("Locale"), GetLocale())); vec.push_back(std::make_pair(CString("InitializedPluralRules"), GetInitializedPluralRules())); @@ -3703,24 +3631,24 @@ void JSPluralRules::DumpForSnapshot(JSThread *thread, std::vector(GetType())))); - JSObject::DumpForSnapshot(thread, vec); + JSObject::DumpForSnapshot(vec); } -void JSGeneratorObject::DumpForSnapshot(JSThread *thread, std::vector> &vec) const +void JSGeneratorObject::DumpForSnapshot(std::vector> &vec) const { vec.push_back(std::make_pair(CString("GeneratorContext"), GetGeneratorContext())); vec.push_back(std::make_pair(CString("ResumeResult"), GetResumeResult())); vec.push_back(std::make_pair(CString("GeneratorState"), JSTaggedValue(static_cast(GetGeneratorState())))); vec.push_back(std::make_pair(CString("ResumeMode"), JSTaggedValue(static_cast(GetResumeMode())))); - JSObject::DumpForSnapshot(thread, vec); + JSObject::DumpForSnapshot(vec); } -void JSAsyncFuncObject::DumpForSnapshot(JSThread *thread, std::vector> &vec) const +void JSAsyncFuncObject::DumpForSnapshot(std::vector> &vec) const { vec.push_back(std::make_pair(CString("Promise"), GetPromise())); } -void GeneratorContext::DumpForSnapshot(JSThread *thread, std::vector> &vec) const +void GeneratorContext::DumpForSnapshot(std::vector> &vec) const { vec.push_back(std::make_pair(CString("RegsArray"), GetRegsArray())); vec.push_back(std::make_pair(CString("Method"), GetMethod())); @@ -3731,23 +3659,23 @@ void GeneratorContext::DumpForSnapshot(JSThread *thread, std::vector> &vec) const +void ProtoChangeMarker::DumpForSnapshot(std::vector> &vec) const { vec.push_back(std::make_pair(CString("Promise"), JSTaggedValue(GetHasChanged()))); } -void ProtoChangeDetails::DumpForSnapshot(JSThread *thread, std::vector> &vec) const +void ProtoChangeDetails::DumpForSnapshot(std::vector> &vec) const { vec.push_back(std::make_pair(CString("ChangeListener"), GetChangeListener())); vec.push_back(std::make_pair(CString("RegisterIndex"), JSTaggedValue(GetRegisterIndex()))); } -void MachineCode::DumpForSnapshot(JSThread *thread, std::vector> &vec) const +void MachineCode::DumpForSnapshot(std::vector> &vec) const { vec.push_back(std::make_pair(CString("InstructionSizeInBytes"), JSTaggedValue(GetInstructionSizeInBytes()))); } -void ClassInfoExtractor::DumpForSnapshot(JSThread *thread, std::vector> &vec) const +void ClassInfoExtractor::DumpForSnapshot(std::vector> &vec) const { vec.push_back(std::make_pair(CString("PrototypeHClass"), GetPrototypeHClass())); vec.push_back(std::make_pair(CString("NonStaticKeys"), GetNonStaticKeys())); @@ -3759,13 +3687,13 @@ void ClassInfoExtractor::DumpForSnapshot(JSThread *thread, std::vector> &vec) const +void TSObjectType::DumpForSnapshot(std::vector> &vec) const { vec.push_back(std::make_pair(CString("ObjLayoutInfo"), GetObjLayoutInfo())); vec.push_back(std::make_pair(CString("HClass"), GetHClass())); } -void TSClassType::DumpForSnapshot(JSThread *thread, std::vector> &vec) const +void TSClassType::DumpForSnapshot(std::vector> &vec) const { vec.push_back(std::make_pair(CString("InstanceType"), GetInstanceType())); vec.push_back(std::make_pair(CString("ConstructorType"), GetConstructorType())); @@ -3773,38 +3701,38 @@ void TSClassType::DumpForSnapshot(JSThread *thread, std::vector> &vec) const +void TSInterfaceType::DumpForSnapshot(std::vector> &vec) const { vec.push_back(std::make_pair(CString("Fields"), GetFields())); vec.push_back(std::make_pair(CString("Extends"), GetExtends())); } -void TSClassInstanceType::DumpForSnapshot(JSThread *thread, std::vector> &vec) const +void TSClassInstanceType::DumpForSnapshot(std::vector> &vec) const { vec.push_back(std::make_pair(CString("classTypeIndex"), JSTaggedValue(GetClassRefGT().GetGlobalTSTypeRef()))); } -void TSImportType::DumpForSnapshot(JSThread *thread, std::vector> &vec) const +void TSImportType::DumpForSnapshot(std::vector> &vec) const { vec.push_back(std::make_pair(CString("ImportTypePath"), GetImportPath())); } -void TSUnionType::DumpForSnapshot(JSThread *thread, std::vector> &vec) const +void TSUnionType::DumpForSnapshot(std::vector> &vec) const { vec.push_back(std::make_pair(CString("ComponentTypes"), GetComponentTypes())); } -void TSFunctionType::DumpForSnapshot(JSThread *thread, std::vector> &vec) const +void TSFunctionType::DumpForSnapshot(std::vector> &vec) const { vec.push_back(std::make_pair(CString("ParameterTypes"), GetParameterTypes())); } -void TSArrayType::DumpForSnapshot(JSThread *thread, std::vector> &vec) const +void TSArrayType::DumpForSnapshot(std::vector> &vec) const { vec.push_back(std::make_pair(CString("ParameterTypeRef"), JSTaggedValue(GetElementTypeRef()))); } -void SourceTextModule::DumpForSnapshot(JSThread *thread, std::vector> &vec) const +void SourceTextModule::DumpForSnapshot(std::vector> &vec) const { vec.push_back(std::make_pair(CString("Environment"), GetEnvironment())); vec.push_back(std::make_pair(CString("Namespace"), GetNamespace())); @@ -3821,14 +3749,14 @@ void SourceTextModule::DumpForSnapshot(JSThread *thread, std::vector> &vec) const +void ImportEntry::DumpForSnapshot(std::vector> &vec) const { vec.push_back(std::make_pair(CString("ModuleRequest"), GetModuleRequest())); vec.push_back(std::make_pair(CString("ImportName"), GetImportName())); vec.push_back(std::make_pair(CString("LocalName"), GetLocalName())); } -void ExportEntry::DumpForSnapshot(JSThread *thread, std::vector> &vec) const +void ExportEntry::DumpForSnapshot(std::vector> &vec) const { vec.push_back(std::make_pair(CString("ExportName"), GetExportName())); vec.push_back(std::make_pair(CString("ModuleRequest"), GetModuleRequest())); @@ -3836,13 +3764,13 @@ void ExportEntry::DumpForSnapshot(JSThread *thread, std::vector> &vec) const +void ResolvedBinding::DumpForSnapshot(std::vector> &vec) const { vec.push_back(std::make_pair(CString("Module"), GetModule())); vec.push_back(std::make_pair(CString("BindingName"), GetBindingName())); } -void ModuleNamespace::DumpForSnapshot(JSThread *thread, std::vector> &vec) const +void ModuleNamespace::DumpForSnapshot(std::vector> &vec) const { vec.push_back(std::make_pair(CString("Module"), GetModule())); vec.push_back(std::make_pair(CString("Exports"), GetExports())); diff --git a/ecmascript/ecma_macros.h b/ecmascript/ecma_macros.h index 574f778061f6cb46b3e65fce5ec320603bcd256b..6c4726a811ab71955c18c4762db501184b88323b 100644 --- a/ecmascript/ecma_macros.h +++ b/ecmascript/ecma_macros.h @@ -295,59 +295,59 @@ } while (false) // NOLINTNEXTLINE(cppcoreguidelines-macro-usage) -#define THROW_TYPE_ERROR_AND_RETURN(thread, message, exception) \ - do { \ - ObjectFactory *objectFactory = (thread)->GetEcmaVM()->GetFactory(); \ - JSHandle error = objectFactory->GetJSError(ErrorType::TYPE_ERROR, message); \ - THROW_NEW_ERROR_AND_RETURN_VALUE(thread, error.GetTaggedValue(), exception); \ +#define THROW_TYPE_ERROR_AND_RETURN(thread, message, exception) \ + do { \ + ObjectFactory *_factory = (thread)->GetEcmaVM()->GetFactory(); \ + JSHandle _error = _factory->GetJSError(ErrorType::TYPE_ERROR, message); \ + THROW_NEW_ERROR_AND_RETURN_VALUE(thread, _error.GetTaggedValue(), exception); \ } while (false) // NOLINTNEXTLINE(cppcoreguidelines-macro-usage) #define THROW_TYPE_ERROR(thread, message) \ do { \ - ObjectFactory *factory = (thread)->GetEcmaVM()->GetFactory(); \ - JSHandle error = factory->GetJSError(ErrorType::TYPE_ERROR, message); \ - THROW_NEW_ERROR_AND_RETURN(thread, error.GetTaggedValue()); \ + ObjectFactory *_factory = (thread)->GetEcmaVM()->GetFactory(); \ + JSHandle _error = _factory->GetJSError(ErrorType::TYPE_ERROR, message); \ + THROW_NEW_ERROR_AND_RETURN(thread, _error.GetTaggedValue()); \ } while (false) // NOLINTNEXTLINE(cppcoreguidelines-macro-usage) -#define THROW_RANGE_ERROR_AND_RETURN(thread, message, exception) \ - do { \ - ObjectFactory *objectFactory = (thread)->GetEcmaVM()->GetFactory(); \ - JSHandle error = objectFactory->GetJSError(ErrorType::RANGE_ERROR, message); \ - THROW_NEW_ERROR_AND_RETURN_VALUE(thread, error.GetTaggedValue(), exception); \ +#define THROW_RANGE_ERROR_AND_RETURN(thread, message, exception) \ + do { \ + ObjectFactory *_factory = (thread)->GetEcmaVM()->GetFactory(); \ + JSHandle _error = _factory->GetJSError(ErrorType::RANGE_ERROR, message); \ + THROW_NEW_ERROR_AND_RETURN_VALUE(thread, _error.GetTaggedValue(), exception); \ } while (false) // NOLINTNEXTLINE(cppcoreguidelines-macro-usage) -#define THROW_ERROR(thread, type, message) \ - do { \ - ObjectFactory *factory = (thread)->GetEcmaVM()->GetFactory(); \ - JSHandle error = factory->GetJSError(type, message); \ - THROW_NEW_ERROR_AND_RETURN(thread, error.GetTaggedValue()); \ +#define THROW_ERROR(thread, type, message) \ + do { \ + ObjectFactory *_factory = (thread)->GetEcmaVM()->GetFactory(); \ + JSHandle _error = _factory->GetJSError(type, message); \ + THROW_NEW_ERROR_AND_RETURN(thread, _error.GetTaggedValue()); \ } while (false) // NOLINTNEXTLINE(cppcoreguidelines-macro-usage) -#define THROW_URI_ERROR_AND_RETURN(thread, message, exception) \ - do { \ - ObjectFactory *objectFactory = (thread)->GetEcmaVM()->GetFactory(); \ - JSHandle error = objectFactory->GetJSError(ErrorType::URI_ERROR, message); \ - THROW_NEW_ERROR_AND_RETURN_VALUE(thread, error.GetTaggedValue(), exception); \ +#define THROW_URI_ERROR_AND_RETURN(thread, message, exception) \ + do { \ + ObjectFactory *_factory = (thread)->GetEcmaVM()->GetFactory(); \ + JSHandle _error = _factory->GetJSError(ErrorType::URI_ERROR, message); \ + THROW_NEW_ERROR_AND_RETURN_VALUE(thread, _error.GetTaggedValue(), exception); \ } while (false) // NOLINTNEXTLINE(cppcoreguidelines-macro-usage) -#define THROW_SYNTAX_ERROR_AND_RETURN(thread, message, exception) \ - do { \ - ObjectFactory *factory = (thread)->GetEcmaVM()->GetFactory(); \ - JSHandle error = factory->GetJSError(ErrorType::SYNTAX_ERROR, message); \ - THROW_NEW_ERROR_AND_RETURN_VALUE(thread, error.GetTaggedValue(), exception); \ +#define THROW_SYNTAX_ERROR_AND_RETURN(thread, message, exception) \ + do { \ + ObjectFactory *_factory = (thread)->GetEcmaVM()->GetFactory(); \ + JSHandle _error = _factory->GetJSError(ErrorType::SYNTAX_ERROR, message); \ + THROW_NEW_ERROR_AND_RETURN_VALUE(thread, _error.GetTaggedValue(), exception); \ } while (false) // NOLINTNEXTLINE(cppcoreguidelines-macro-usage) -#define THROW_REFERENCE_ERROR_AND_RETURN(thread, message, value) \ - do { \ - ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); \ - JSHandle error = factory->GetJSError(ErrorType::REFERENCE_ERROR, message); \ - THROW_NEW_ERROR_AND_RETURN_VALUE(thread, error.GetTaggedValue(), value); \ +#define THROW_REFERENCE_ERROR_AND_RETURN(thread, message, value) \ + do { \ + ObjectFactory *_factory = thread->GetEcmaVM()->GetFactory(); \ + JSHandle _error = _factory->GetJSError(ErrorType::REFERENCE_ERROR, message); \ + THROW_NEW_ERROR_AND_RETURN_VALUE(thread, _error.GetTaggedValue(), value); \ } while (false) // NOLINTNEXTLINE(cppcoreguidelines-macro-usage) @@ -389,13 +389,13 @@ } while (false) // NOLINTNEXTLINE(cppcoreguidelines-macro-usage) -#define DECL_DUMP() \ - void Dump(JSThread *thread, std::ostream &os) const DUMP_API_ATTR; \ - void Dump(JSThread *thread) const DUMP_API_ATTR \ - { \ - Dump(thread, std::cout); \ - } \ - void DumpForSnapshot(JSThread *thread, std::vector> &vec) const; +#define DECL_DUMP() \ + void Dump(std::ostream &os) const DUMP_API_ATTR; \ + void Dump() const DUMP_API_ATTR \ + { \ + Dump(std::cout); \ + } \ + void DumpForSnapshot(std::vector> &vec) const; #endif // defined(__cplusplus) diff --git a/ecmascript/ecma_string.cpp b/ecmascript/ecma_string.cpp index 65844d43042116dae9ddd3ed36d8ac5567ea3659..4a5952326eee0bbb38a6994717a44d8493ab39a2 100644 --- a/ecmascript/ecma_string.cpp +++ b/ecmascript/ecma_string.cpp @@ -410,12 +410,7 @@ template static int32_t ComputeHashForData(const T *data, size_t size, uint32_t hashSeed) { uint32_t hash = hashSeed; -#if defined(__GNUC__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wignored-attributes" Span sp(data, size); -#pragma GCC diagnostic pop -#endif for (auto c : sp) { constexpr size_t SHIFT = 5; hash = (hash << SHIFT) - hash + c; diff --git a/ecmascript/ecma_vm.cpp b/ecmascript/ecma_vm.cpp index 8685a68287c96c7cc8e8eff853f5ab514ea07f50..98bd651df460739d76ed5f8efa6dabd12f584e8d 100644 --- a/ecmascript/ecma_vm.cpp +++ b/ecmascript/ecma_vm.cpp @@ -32,6 +32,7 @@ #include "ecmascript/global_env_constants-inl.h" #include "ecmascript/global_env_constants.h" #include "ecmascript/internal_call_params.h" +#include "ecmascript/interpreter/interpreter-inl.h" #include "ecmascript/jobs/micro_job_queue.h" #include "ecmascript/jspandafile/js_pandafile.h" #include "ecmascript/jspandafile/js_pandafile_manager.h" @@ -40,7 +41,6 @@ #include "ecmascript/jspandafile/program_object-inl.h" #include "ecmascript/js_arraybuffer.h" #include "ecmascript/js_for_in_iterator.h" -#include "ecmascript/js_invoker.h" #include "ecmascript/js_native_pointer.h" #include "ecmascript/js_thread.h" #include "ecmascript/mem/concurrent_marker.h" @@ -428,11 +428,11 @@ Expected EcmaVM::InvokeEcmaEntrypoint(const JSPandaFile *js #if defined(ECMASCRIPT_SUPPORT_CPUPROFILER) CpuProfiler *profiler = CpuProfiler::GetInstance(); profiler->CpuProfiler::StartCpuProfiler(this, ""); - panda::ecmascript::InvokeJsFunction(thread_, func, global, newTarget, params); + EcmaInterpreter::Execute(thread_, func, global, newTarget, params); profiler->CpuProfiler::StopCpuProfiler(); #endif } else { - panda::ecmascript::InvokeJsFunction(thread_, func, global, newTarget, params); + EcmaInterpreter::Execute(thread_, func, global, newTarget, params); } if (!thread_->HasPendingException()) { job::MicroJobQueue::ExecutePendingJob(thread_, GetMicroJobQueue()); diff --git a/ecmascript/ecma_vm.h b/ecmascript/ecma_vm.h index 2de088df5f3835430b258b99da73fa4da2152605..0b467ea4ebc50d862c40101c9d3a7f6bc2142232 100644 --- a/ecmascript/ecma_vm.h +++ b/ecmascript/ecma_vm.h @@ -387,11 +387,12 @@ public: protected: bool CheckEntrypointSignature([[maybe_unused]] Method *entrypoint) override { - return true; + // unused interface + UNREACHABLE(); } - Expected InvokeEntrypointImpl(Method *entrypoint, - const std::vector &args) override + Expected InvokeEntrypointImpl([[maybe_unused]] Method *entrypoint, + [[maybe_unused]] const std::vector &args) override { // unused interface UNREACHABLE(); diff --git a/ecmascript/ic/ic_binary_op-inl.h b/ecmascript/ic/ic_binary_op-inl.h index ed2af96aba68a204a575cc1c1f32c601f6c47774..f11a0474268f51bb0eb389c9a8ae70a0d5d823c0 100644 --- a/ecmascript/ic/ic_binary_op-inl.h +++ b/ecmascript/ic/ic_binary_op-inl.h @@ -26,7 +26,7 @@ #include "ecmascript/napi/include/jsnapi.h" namespace panda::ecmascript { -JSTaggedValue ICBinaryOP::AddWithTSType(JSThread *thread, EcmaVM *ecma_vm, JSTaggedValue left, +JSTaggedValue ICBinaryOP::AddWithTSType(JSThread *thread, JSTaggedValue left, JSTaggedValue right, JSTaggedValue argType) { INTERPRETER_TRACE(thread, AddWithTSType); @@ -60,7 +60,7 @@ JSTaggedValue ICBinaryOP::AddWithTSType(JSThread *thread, EcmaVM *ecma_vm, JSTag case BinaryType::STRING: { JSHandle stringA0 = JSHandle(JSHandle(thread, left)); JSHandle stringA1 = JSHandle(JSHandle(thread, right)); - EcmaString *ret = EcmaString::Concat(stringA0, stringA1, ecma_vm); + EcmaString *ret = EcmaString::Concat(stringA0, stringA1, thread->GetEcmaVM()); return JSTaggedValue(ret); } // Support cases, such as: string + null, string + object, string + boolean, string + number, etc. @@ -70,18 +70,18 @@ JSTaggedValue ICBinaryOP::AddWithTSType(JSThread *thread, EcmaVM *ecma_vm, JSTag if (left.IsString()) { JSHandle stringA0 = JSHandle(leftValue); JSHandle stringA1 = JSTaggedValue::ToString(thread, rightValue); - EcmaString *ret = EcmaString::Concat(stringA0, stringA1, ecma_vm); + EcmaString *ret = EcmaString::Concat(stringA0, stringA1, thread->GetEcmaVM()); return JSTaggedValue(ret); } else { JSHandle stringA0 = JSTaggedValue::ToString(thread, leftValue); JSHandle stringA1 = JSHandle(rightValue); - EcmaString *ret = EcmaString::Concat(stringA0, stringA1, ecma_vm); + EcmaString *ret = EcmaString::Concat(stringA0, stringA1, thread->GetEcmaVM()); return JSTaggedValue(ret); } } // Some special cases, such as: object + undefined, object + boolean, etc. case BinaryType::GENERIC: { - JSTaggedValue res = SlowRuntimeStub::Add2Dyn(thread, ecma_vm, left, right); + JSTaggedValue res = SlowRuntimeStub::Add2Dyn(thread, left, right); return res; } default: { @@ -90,7 +90,7 @@ JSTaggedValue ICBinaryOP::AddWithTSType(JSThread *thread, EcmaVM *ecma_vm, JSTag } } -JSTaggedValue ICBinaryOP::SubWithTSType(JSThread *thread, EcmaVM *ecma_vm, JSTaggedValue left, +JSTaggedValue ICBinaryOP::SubWithTSType(JSThread *thread, JSTaggedValue left, JSTaggedValue right, JSTaggedValue argType) { INTERPRETER_TRACE(thread, SubWithTSType); @@ -123,7 +123,7 @@ JSTaggedValue ICBinaryOP::SubWithTSType(JSThread *thread, EcmaVM *ecma_vm, JSTag } } -JSTaggedValue ICBinaryOP::MulWithTSType(JSThread *thread, EcmaVM *ecma_vm, JSTaggedValue left, +JSTaggedValue ICBinaryOP::MulWithTSType(JSThread *thread, JSTaggedValue left, JSTaggedValue right, JSTaggedValue argType) { INTERPRETER_TRACE(thread, MulWithTSType); @@ -157,7 +157,7 @@ JSTaggedValue ICBinaryOP::MulWithTSType(JSThread *thread, EcmaVM *ecma_vm, JSTag } } -JSTaggedValue ICBinaryOP::DivWithTSType(JSThread *thread, EcmaVM *ecma_vm, JSTaggedValue left, +JSTaggedValue ICBinaryOP::DivWithTSType(JSThread *thread, JSTaggedValue left, JSTaggedValue right, JSTaggedValue argType) { INTERPRETER_TRACE(thread, DivWithTSType); @@ -191,7 +191,7 @@ JSTaggedValue ICBinaryOP::DivWithTSType(JSThread *thread, EcmaVM *ecma_vm, JSTag } } -JSTaggedValue ICBinaryOP::ModWithTSType(JSThread *thread, EcmaVM *ecma_vm, JSTaggedValue left, +JSTaggedValue ICBinaryOP::ModWithTSType(JSThread *thread, JSTaggedValue left, JSTaggedValue right, JSTaggedValue argType) { INTERPRETER_TRACE(thread, ModWithTSType); @@ -271,7 +271,7 @@ void ICBinaryOP::GetBitOPDate(JSThread *thread, JSTaggedValue left, JSTaggedValu return; } -JSTaggedValue ICBinaryOP::ShlWithTSType(JSThread *thread, EcmaVM *ecma_vm, JSTaggedValue left, +JSTaggedValue ICBinaryOP::ShlWithTSType(JSThread *thread, JSTaggedValue left, JSTaggedValue right, JSTaggedValue argType) { INTERPRETER_TRACE(thread, ShlWithTSType); @@ -287,7 +287,7 @@ JSTaggedValue ICBinaryOP::ShlWithTSType(JSThread *thread, EcmaVM *ecma_vm, JSTag return JSTaggedValue(ret); } -JSTaggedValue ICBinaryOP::ShrWithTSType(JSThread *thread, EcmaVM *ecma_vm, JSTaggedValue left, +JSTaggedValue ICBinaryOP::ShrWithTSType(JSThread *thread, JSTaggedValue left, JSTaggedValue right, JSTaggedValue argType) { INTERPRETER_TRACE(thread, ShrWithTSType); @@ -301,7 +301,7 @@ JSTaggedValue ICBinaryOP::ShrWithTSType(JSThread *thread, EcmaVM *ecma_vm, JSTag return JSTaggedValue(ret); } -JSTaggedValue ICBinaryOP::AshrWithTSType(JSThread *thread, EcmaVM *ecma_vm, JSTaggedValue left, +JSTaggedValue ICBinaryOP::AshrWithTSType(JSThread *thread, JSTaggedValue left, JSTaggedValue right, JSTaggedValue argType) { INTERPRETER_TRACE(thread, AshrWithTSType); @@ -317,7 +317,7 @@ JSTaggedValue ICBinaryOP::AshrWithTSType(JSThread *thread, EcmaVM *ecma_vm, JSTa return JSTaggedValue(ret); } -JSTaggedValue ICBinaryOP::AndWithTSType(JSThread *thread, EcmaVM *ecma_vm, JSTaggedValue left, +JSTaggedValue ICBinaryOP::AndWithTSType(JSThread *thread, JSTaggedValue left, JSTaggedValue right, JSTaggedValue argType) { INTERPRETER_TRACE(thread, AndWithTSType); @@ -330,7 +330,7 @@ JSTaggedValue ICBinaryOP::AndWithTSType(JSThread *thread, EcmaVM *ecma_vm, JSTag return JSTaggedValue(ret); } -JSTaggedValue ICBinaryOP::OrWithTSType(JSThread *thread, EcmaVM *ecma_vm, JSTaggedValue left, +JSTaggedValue ICBinaryOP::OrWithTSType(JSThread *thread, JSTaggedValue left, JSTaggedValue right, JSTaggedValue argType) { INTERPRETER_TRACE(thread, OrWithTSType); @@ -343,7 +343,7 @@ JSTaggedValue ICBinaryOP::OrWithTSType(JSThread *thread, EcmaVM *ecma_vm, JSTagg return JSTaggedValue(ret); } -JSTaggedValue ICBinaryOP::XorWithTSType(JSThread *thread, EcmaVM *ecma_vm, JSTaggedValue left, +JSTaggedValue ICBinaryOP::XorWithTSType(JSThread *thread, JSTaggedValue left, JSTaggedValue right, JSTaggedValue argType) { INTERPRETER_TRACE(thread, XorWithTSType); diff --git a/ecmascript/ic/ic_binary_op.h b/ecmascript/ic/ic_binary_op.h index 13c2d8702065ccd5fe5795a1d1754e180bf742a1..d8ed70f743052b46cbbdac0679050efa861d6193 100644 --- a/ecmascript/ic/ic_binary_op.h +++ b/ecmascript/ic/ic_binary_op.h @@ -32,29 +32,29 @@ enum class BinaryType : uint8_t { class ICBinaryOP { public: - static inline JSTaggedValue AddWithTSType(JSThread *thread, EcmaVM *ecma_vm, JSTaggedValue left, + static inline JSTaggedValue AddWithTSType(JSThread *thread, JSTaggedValue left, JSTaggedValue right, JSTaggedValue argType); - static inline JSTaggedValue SubWithTSType(JSThread *thread, EcmaVM *ecma_vm, JSTaggedValue left, + static inline JSTaggedValue SubWithTSType(JSThread *thread, JSTaggedValue left, JSTaggedValue right, JSTaggedValue argType); - static inline JSTaggedValue MulWithTSType(JSThread *thread, EcmaVM *ecma_vm, JSTaggedValue left, + static inline JSTaggedValue MulWithTSType(JSThread *thread, JSTaggedValue left, JSTaggedValue right, JSTaggedValue argType); - static inline JSTaggedValue DivWithTSType(JSThread *thread, EcmaVM *ecma_vm, JSTaggedValue left, + static inline JSTaggedValue DivWithTSType(JSThread *thread, JSTaggedValue left, JSTaggedValue right, JSTaggedValue argType); - static inline JSTaggedValue ModWithTSType(JSThread *thread, EcmaVM *ecma_vm, JSTaggedValue left, + static inline JSTaggedValue ModWithTSType(JSThread *thread, JSTaggedValue left, JSTaggedValue right, JSTaggedValue argType); static inline void GetBitOPDate(JSThread *thread, JSTaggedValue left, JSTaggedValue right, int32_t &opNumber0, int32_t &opNumber1, BinaryType opType); - static inline JSTaggedValue ShlWithTSType(JSThread *thread, EcmaVM *ecma_vm, JSTaggedValue left, + static inline JSTaggedValue ShlWithTSType(JSThread *thread, JSTaggedValue left, JSTaggedValue right, JSTaggedValue argType); - static inline JSTaggedValue ShrWithTSType(JSThread *thread, EcmaVM *ecma_vm, JSTaggedValue left, + static inline JSTaggedValue ShrWithTSType(JSThread *thread, JSTaggedValue left, JSTaggedValue right, JSTaggedValue argType); - static inline JSTaggedValue AshrWithTSType(JSThread *thread, EcmaVM *ecma_vm, JSTaggedValue left, + static inline JSTaggedValue AshrWithTSType(JSThread *thread, JSTaggedValue left, JSTaggedValue right, JSTaggedValue argType); - static inline JSTaggedValue AndWithTSType(JSThread *thread, EcmaVM *ecma_vm, JSTaggedValue left, + static inline JSTaggedValue AndWithTSType(JSThread *thread, JSTaggedValue left, JSTaggedValue right, JSTaggedValue argType); - static inline JSTaggedValue OrWithTSType(JSThread *thread, EcmaVM *ecma_vm, JSTaggedValue left, + static inline JSTaggedValue OrWithTSType(JSThread *thread, JSTaggedValue left, JSTaggedValue right, JSTaggedValue argType); - static inline JSTaggedValue XorWithTSType(JSThread *thread, EcmaVM *ecma_vm, JSTaggedValue left, + static inline JSTaggedValue XorWithTSType(JSThread *thread, JSTaggedValue left, JSTaggedValue right, JSTaggedValue argType); }; } // namespace panda::ecmascript diff --git a/ecmascript/ic/tests/ic_binaryop_test.cpp b/ecmascript/ic/tests/ic_binaryop_test.cpp index a7de9214e6f13a2153c420adcf9f0df368be4b62..016d3bfea521df899c2babd7efdf23cb4629c254 100644 --- a/ecmascript/ic/tests/ic_binaryop_test.cpp +++ b/ecmascript/ic/tests/ic_binaryop_test.cpp @@ -69,64 +69,64 @@ HWTEST_F_L0(ICBinaryOPTest, AddWithTSType) JSHandle arg2(thread, arg2Value); JSHandle arg3(thread, arg3Value); - JSTaggedValue resInSlowPath1 = SlowRuntimeStub::Add2Dyn(thread, ecmaVm, arg1.GetTaggedValue(), + JSTaggedValue resInSlowPath1 = SlowRuntimeStub::Add2Dyn(thread, arg1.GetTaggedValue(), arg2.GetTaggedValue()); JSHandle slowHandle1(thread, resInSlowPath1); - JSTaggedValue resInICPath1 = ICBinaryOP::AddWithTSType(thread, ecmaVm, arg1.GetTaggedValue(), arg2.GetTaggedValue(), + JSTaggedValue resInICPath1 = ICBinaryOP::AddWithTSType(thread, arg1.GetTaggedValue(), arg2.GetTaggedValue(), JSTaggedValue(static_cast(BinaryType::NUMBER))); EXPECT_EQ(slowHandle1.GetTaggedValue(), resInICPath1); - JSTaggedValue resInSlowPath2 = SlowRuntimeStub::Add2Dyn(thread, ecmaVm, arg1.GetTaggedValue(), + JSTaggedValue resInSlowPath2 = SlowRuntimeStub::Add2Dyn(thread, arg1.GetTaggedValue(), arg3.GetTaggedValue()); JSHandle slowHandle2(thread, resInSlowPath2); - JSTaggedValue resInICPath2 = ICBinaryOP::AddWithTSType(thread, ecmaVm, arg1.GetTaggedValue(), arg3.GetTaggedValue(), + JSTaggedValue resInICPath2 = ICBinaryOP::AddWithTSType(thread, arg1.GetTaggedValue(), arg3.GetTaggedValue(), JSTaggedValue(static_cast(BinaryType::NUMBER))); EXPECT_EQ(slowHandle2.GetTaggedValue(), resInICPath2); - JSTaggedValue resInSlowPath3 = SlowRuntimeStub::Add2Dyn(thread, ecmaVm, Str1.GetTaggedValue(), + JSTaggedValue resInSlowPath3 = SlowRuntimeStub::Add2Dyn(thread, Str1.GetTaggedValue(), Str2.GetTaggedValue()); JSHandle slowHandle3(thread, reinterpret_cast(resInSlowPath3.GetRawData())); - JSTaggedValue resInICPath3 = ICBinaryOP::AddWithTSType(thread, ecmaVm, Str1.GetTaggedValue(), Str2.GetTaggedValue(), + JSTaggedValue resInICPath3 = ICBinaryOP::AddWithTSType(thread, Str1.GetTaggedValue(), Str2.GetTaggedValue(), JSTaggedValue(static_cast(BinaryType::STRING))); ASSERT_TRUE(resInICPath3.IsString()); EXPECT_EQ(slowHandle3->Compare(reinterpret_cast(resInICPath3.GetRawData())), 0); - JSTaggedValue resInSlowPath4 = SlowRuntimeStub::Add2Dyn(thread, ecmaVm, JSTaggedValue::Undefined(), + JSTaggedValue resInSlowPath4 = SlowRuntimeStub::Add2Dyn(thread, JSTaggedValue::Undefined(), arg2.GetTaggedValue()); JSHandle slowHandle4(thread, resInSlowPath4); - JSTaggedValue resInICPath4 = ICBinaryOP::AddWithTSType(thread, ecmaVm, JSTaggedValue::Undefined(), + JSTaggedValue resInICPath4 = ICBinaryOP::AddWithTSType(thread, JSTaggedValue::Undefined(), arg2.GetTaggedValue(), JSTaggedValue(static_cast(BinaryType::NUMBER_GEN))); EXPECT_EQ(slowHandle4.GetTaggedValue(), resInICPath4); - JSTaggedValue resInSlowPath5 = SlowRuntimeStub::Add2Dyn(thread, ecmaVm, arg3.GetTaggedValue(), + JSTaggedValue resInSlowPath5 = SlowRuntimeStub::Add2Dyn(thread, arg3.GetTaggedValue(), Str1.GetTaggedValue()); JSHandle slowHandle5(thread, reinterpret_cast(resInSlowPath5.GetRawData())); - JSTaggedValue resInICPath5 = ICBinaryOP::AddWithTSType(thread, ecmaVm, arg3.GetTaggedValue(), + JSTaggedValue resInICPath5 = ICBinaryOP::AddWithTSType(thread, arg3.GetTaggedValue(), Str1.GetTaggedValue(), JSTaggedValue(static_cast(BinaryType::STRING_GEN))); ASSERT_TRUE(resInICPath5.IsString()); EXPECT_EQ(slowHandle5->Compare(reinterpret_cast(resInICPath5.GetRawData())), 0); - JSTaggedValue resInSlowPath6 = SlowRuntimeStub::Add2Dyn(thread, ecmaVm, Str1.GetTaggedValue(), + JSTaggedValue resInSlowPath6 = SlowRuntimeStub::Add2Dyn(thread, Str1.GetTaggedValue(), JSTaggedValue::Null()); JSHandle slowHandle6(thread, reinterpret_cast(resInSlowPath6.GetRawData())); - JSTaggedValue resInICPath6 = ICBinaryOP::AddWithTSType(thread, ecmaVm, Str1.GetTaggedValue(), JSTaggedValue::Null(), + JSTaggedValue resInICPath6 = ICBinaryOP::AddWithTSType(thread, Str1.GetTaggedValue(), JSTaggedValue::Null(), JSTaggedValue(static_cast(BinaryType::STRING_GEN))); ASSERT_TRUE(resInICPath6.IsString()); EXPECT_EQ(slowHandle6->Compare(reinterpret_cast(resInICPath6.GetRawData())), 0); - JSTaggedValue resInSlowPath7 = SlowRuntimeStub::Add2Dyn(thread, ecmaVm, arg1.GetTaggedValue(), + JSTaggedValue resInSlowPath7 = SlowRuntimeStub::Add2Dyn(thread, arg1.GetTaggedValue(), JSTaggedValue::True()); JSHandle slowHandle7(thread, resInSlowPath7); - JSTaggedValue resInICPath7 = ICBinaryOP::AddWithTSType(thread, ecmaVm, arg1.GetTaggedValue(), JSTaggedValue::True(), + JSTaggedValue resInICPath7 = ICBinaryOP::AddWithTSType(thread, arg1.GetTaggedValue(), JSTaggedValue::True(), JSTaggedValue(static_cast(BinaryType::NUMBER_GEN))); EXPECT_EQ(slowHandle7.GetTaggedValue(), resInICPath7); - JSTaggedValue resInSlowPath8 = SlowRuntimeStub::Add2Dyn(thread, ecmaVm, arg4.GetTaggedValue(), + JSTaggedValue resInSlowPath8 = SlowRuntimeStub::Add2Dyn(thread, arg4.GetTaggedValue(), JSTaggedValue::Null()); JSHandle slowHandle8(thread, reinterpret_cast(resInSlowPath8.GetRawData())); - JSTaggedValue resInICPath8 = ICBinaryOP::AddWithTSType(thread, ecmaVm, arg4.GetTaggedValue(), JSTaggedValue::Null(), + JSTaggedValue resInICPath8 = ICBinaryOP::AddWithTSType(thread, arg4.GetTaggedValue(), JSTaggedValue::Null(), JSTaggedValue(static_cast(BinaryType::GENERIC))); ASSERT_TRUE(resInICPath8.IsString()); EXPECT_EQ(slowHandle8->Compare(reinterpret_cast(resInICPath8.GetRawData())), 0); @@ -143,19 +143,19 @@ HWTEST_F_L0(ICBinaryOPTest, SubWithTSType) JSTaggedValue resInSlowPath1 = SlowRuntimeStub::Sub2Dyn(thread, arg1.GetTaggedValue(), arg2.GetTaggedValue()); JSHandle slowHandle1(thread, resInSlowPath1); - JSTaggedValue resInICPath1 = ICBinaryOP::SubWithTSType(thread, ecmaVm, arg1.GetTaggedValue(), arg2.GetTaggedValue(), + JSTaggedValue resInICPath1 = ICBinaryOP::SubWithTSType(thread, arg1.GetTaggedValue(), arg2.GetTaggedValue(), JSTaggedValue(static_cast(BinaryType::NUMBER))); EXPECT_EQ(slowHandle1.GetTaggedValue(), resInICPath1); JSTaggedValue resInSlowPath2 = SlowRuntimeStub::Sub2Dyn(thread, arg2.GetTaggedValue(), arg3.GetTaggedValue()); JSHandle slowHandle2(thread, resInSlowPath2); - JSTaggedValue resInICPath2 = ICBinaryOP::SubWithTSType(thread, ecmaVm, arg2.GetTaggedValue(), arg3.GetTaggedValue(), + JSTaggedValue resInICPath2 = ICBinaryOP::SubWithTSType(thread, arg2.GetTaggedValue(), arg3.GetTaggedValue(), JSTaggedValue(static_cast(BinaryType::NUMBER))); EXPECT_EQ(slowHandle2.GetTaggedValue(), resInICPath2); JSTaggedValue resInSlowPath3 = SlowRuntimeStub::Sub2Dyn(thread, arg1.GetTaggedValue(), JSTaggedValue::True()); JSHandle slowHandle3(thread, resInSlowPath3); - JSTaggedValue resInICPath3 = ICBinaryOP::SubWithTSType(thread, ecmaVm, arg1.GetTaggedValue(), JSTaggedValue::True(), + JSTaggedValue resInICPath3 = ICBinaryOP::SubWithTSType(thread, arg1.GetTaggedValue(), JSTaggedValue::True(), JSTaggedValue(static_cast(BinaryType::GENERIC))); EXPECT_EQ(slowHandle3.GetTaggedValue(), resInICPath3); }; @@ -171,19 +171,19 @@ HWTEST_F_L0(ICBinaryOPTest, MulWithTSType) JSTaggedValue resInSlowPath1 = SlowRuntimeStub::Mul2Dyn(thread, arg1.GetTaggedValue(), arg2.GetTaggedValue()); JSHandle slowHandle1(thread, resInSlowPath1); - JSTaggedValue resInICPath1 = ICBinaryOP::MulWithTSType(thread, ecmaVm, arg1.GetTaggedValue(), arg2.GetTaggedValue(), + JSTaggedValue resInICPath1 = ICBinaryOP::MulWithTSType(thread, arg1.GetTaggedValue(), arg2.GetTaggedValue(), JSTaggedValue(static_cast(BinaryType::NUMBER))); EXPECT_EQ(slowHandle1.GetTaggedValue(), resInICPath1); JSTaggedValue resInSlowPath2 = SlowRuntimeStub::Mul2Dyn(thread, arg2.GetTaggedValue(), arg3.GetTaggedValue()); JSHandle slowHandle2(thread, resInSlowPath2); - JSTaggedValue resInICPath2 = ICBinaryOP::MulWithTSType(thread, ecmaVm, arg2.GetTaggedValue(), arg3.GetTaggedValue(), + JSTaggedValue resInICPath2 = ICBinaryOP::MulWithTSType(thread, arg2.GetTaggedValue(), arg3.GetTaggedValue(), JSTaggedValue(static_cast(BinaryType::NUMBER))); EXPECT_EQ(slowHandle2.GetTaggedValue(), resInICPath2); JSTaggedValue resInSlowPath3 = SlowRuntimeStub::Mul2Dyn(thread, arg1.GetTaggedValue(), JSTaggedValue::True()); JSHandle slowHandle3(thread, resInSlowPath3); - JSTaggedValue resInICPath3 = ICBinaryOP::MulWithTSType(thread, ecmaVm, arg1.GetTaggedValue(), JSTaggedValue::True(), + JSTaggedValue resInICPath3 = ICBinaryOP::MulWithTSType(thread, arg1.GetTaggedValue(), JSTaggedValue::True(), JSTaggedValue(static_cast(BinaryType::GENERIC))); EXPECT_EQ(slowHandle3.GetTaggedValue(), resInICPath3); @@ -202,31 +202,31 @@ HWTEST_F_L0(ICBinaryOPTest, DivWithTSType) JSTaggedValue resInSlowPath1 = SlowRuntimeStub::Div2Dyn(thread, arg3.GetTaggedValue(), arg2.GetTaggedValue()); JSHandle slowHandle1(thread, resInSlowPath1); - JSTaggedValue resInICPath1 = ICBinaryOP::DivWithTSType(thread, ecmaVm, arg3.GetTaggedValue(), arg2.GetTaggedValue(), + JSTaggedValue resInICPath1 = ICBinaryOP::DivWithTSType(thread, arg3.GetTaggedValue(), arg2.GetTaggedValue(), JSTaggedValue(static_cast(BinaryType::NUMBER))); EXPECT_EQ(slowHandle1.GetTaggedValue(), resInICPath1); JSTaggedValue resInSlowPath2 = SlowRuntimeStub::Div2Dyn(thread, arg2.GetTaggedValue(), arg3.GetTaggedValue()); JSHandle slowHandle2(thread, resInSlowPath2); - JSTaggedValue resInICPath2 = ICBinaryOP::DivWithTSType(thread, ecmaVm, arg2.GetTaggedValue(), arg3.GetTaggedValue(), + JSTaggedValue resInICPath2 = ICBinaryOP::DivWithTSType(thread, arg2.GetTaggedValue(), arg3.GetTaggedValue(), JSTaggedValue(static_cast(BinaryType::NUMBER))); EXPECT_EQ(slowHandle2.GetTaggedValue(), resInICPath2); JSTaggedValue resInSlowPath3 = SlowRuntimeStub::Div2Dyn(thread, arg1.GetTaggedValue(), arg2.GetTaggedValue()); JSHandle slowHandle3(thread, resInSlowPath3); - JSTaggedValue resInICPath3 = ICBinaryOP::DivWithTSType(thread, ecmaVm, arg1.GetTaggedValue(), arg2.GetTaggedValue(), + JSTaggedValue resInICPath3 = ICBinaryOP::DivWithTSType(thread, arg1.GetTaggedValue(), arg2.GetTaggedValue(), JSTaggedValue(static_cast(BinaryType::NUMBER))); EXPECT_EQ(slowHandle3.GetTaggedValue(), resInICPath3); JSTaggedValue resInSlowPath4 = SlowRuntimeStub::Div2Dyn(thread, arg2.GetTaggedValue(), JSTaggedValue::True()); JSHandle slowHandle4(thread, resInSlowPath4); - JSTaggedValue resInICPath4 = ICBinaryOP::DivWithTSType(thread, ecmaVm, arg2.GetTaggedValue(), JSTaggedValue::True(), + JSTaggedValue resInICPath4 = ICBinaryOP::DivWithTSType(thread, arg2.GetTaggedValue(), JSTaggedValue::True(), JSTaggedValue(static_cast(BinaryType::GENERIC))); EXPECT_EQ(slowHandle4.GetTaggedValue(), resInICPath4); JSTaggedValue resInSlowPath5 = SlowRuntimeStub::Div2Dyn(thread, arg4.GetTaggedValue(), JSTaggedValue::False()); JSHandle slowHandle5(thread, resInSlowPath5); - JSTaggedValue resInICPath5 = ICBinaryOP::DivWithTSType(thread, ecmaVm, arg4.GetTaggedValue(), + JSTaggedValue resInICPath5 = ICBinaryOP::DivWithTSType(thread, arg4.GetTaggedValue(), JSTaggedValue::False(), JSTaggedValue(static_cast(BinaryType::GENERIC))); EXPECT_EQ(slowHandle5.GetTaggedValue(), resInICPath5); @@ -245,33 +245,33 @@ HWTEST_F_L0(ICBinaryOPTest, ModWithTSType) JSTaggedValue resInSlowPath1 = SlowRuntimeStub::Mod2Dyn(thread, arg3.GetTaggedValue(), arg2.GetTaggedValue()); JSHandle slowHandle1(thread, resInSlowPath1); - JSTaggedValue resInICPath1 = ICBinaryOP::ModWithTSType(thread, ecmaVm, arg3.GetTaggedValue(), arg2.GetTaggedValue(), + JSTaggedValue resInICPath1 = ICBinaryOP::ModWithTSType(thread, arg3.GetTaggedValue(), arg2.GetTaggedValue(), JSTaggedValue(static_cast(BinaryType::NUMBER))); EXPECT_EQ(slowHandle1.GetTaggedValue(), resInICPath1); JSTaggedValue resInSlowPath2 = SlowRuntimeStub::Mod2Dyn(thread, arg2.GetTaggedValue(), arg3.GetTaggedValue()); JSHandle slowHandle2(thread, resInSlowPath2); - JSTaggedValue resInICPath2 = ICBinaryOP::ModWithTSType(thread, ecmaVm, arg2.GetTaggedValue(), arg3.GetTaggedValue(), + JSTaggedValue resInICPath2 = ICBinaryOP::ModWithTSType(thread, arg2.GetTaggedValue(), arg3.GetTaggedValue(), JSTaggedValue(static_cast(BinaryType::NUMBER))); EXPECT_EQ(slowHandle2.GetTaggedValue(), resInICPath2); JSTaggedValue resInSlowPath3 = SlowRuntimeStub::Mod2Dyn(thread, arg1.GetTaggedValue(), arg2.GetTaggedValue()); JSHandle slowHandle3(thread, resInSlowPath3); - JSTaggedValue resInICPath3 = ICBinaryOP::ModWithTSType(thread, ecmaVm, arg1.GetTaggedValue(), arg2.GetTaggedValue(), + JSTaggedValue resInICPath3 = ICBinaryOP::ModWithTSType(thread, arg1.GetTaggedValue(), arg2.GetTaggedValue(), JSTaggedValue(static_cast(BinaryType::NUMBER))); EXPECT_EQ(slowHandle3.GetTaggedValue(), resInICPath3); JSTaggedValue resInSlowPath4 = SlowRuntimeStub::Mod2Dyn(thread, arg2.GetTaggedValue(), JSTaggedValue::True()); JSHandle slowHandle4(thread, resInSlowPath4); - JSTaggedValue resInICPath4 = ICBinaryOP::ModWithTSType(thread, ecmaVm, arg2.GetTaggedValue(), JSTaggedValue::True(), + JSTaggedValue resInICPath4 = ICBinaryOP::ModWithTSType(thread, arg2.GetTaggedValue(), JSTaggedValue::True(), JSTaggedValue(static_cast(BinaryType::GENERIC))); EXPECT_EQ(slowHandle4.GetTaggedValue(), resInICPath4); JSTaggedValue resInSlowPath5 = SlowRuntimeStub::Mod2Dyn(thread, arg4.GetTaggedValue(), JSTaggedValue::False()); JSHandle slowHandle5(thread, resInSlowPath5); - JSTaggedValue resInICPath5 = ICBinaryOP::ModWithTSType(thread, ecmaVm, arg4.GetTaggedValue(), + JSTaggedValue resInICPath5 = ICBinaryOP::ModWithTSType(thread, arg4.GetTaggedValue(), JSTaggedValue::False(), JSTaggedValue(static_cast(BinaryType::GENERIC))); EXPECT_EQ(slowHandle5.GetTaggedValue(), resInICPath5); @@ -285,11 +285,11 @@ HWTEST_F_L0(ICBinaryOPTest, ShlWithTSType) JSTaggedValue arg1(static_cast(286)); JSTaggedValue arg3(static_cast(5)); - JSTaggedValue resInICPath1 = ICBinaryOP::ShlWithTSType(thread, ecmaVm, arg1, arg3, + JSTaggedValue resInICPath1 = ICBinaryOP::ShlWithTSType(thread, arg1, arg3, JSTaggedValue(static_cast(BinaryType::NUMBER))); EXPECT_EQ(JSTaggedValue(9152), resInICPath1); - JSTaggedValue resInICPath2 = ICBinaryOP::ShlWithTSType(thread, ecmaVm, Str1.GetTaggedValue(), arg3, + JSTaggedValue resInICPath2 = ICBinaryOP::ShlWithTSType(thread, Str1.GetTaggedValue(), arg3, JSTaggedValue(static_cast(BinaryType::GENERIC))); EXPECT_EQ(JSTaggedValue(7200), resInICPath2); }; @@ -302,11 +302,11 @@ HWTEST_F_L0(ICBinaryOPTest, ShrWithTSType) JSTaggedValue arg1(static_cast(286)); JSTaggedValue arg3(static_cast(5)); - JSTaggedValue resInICPath1 = ICBinaryOP::ShrWithTSType(thread, ecmaVm, arg1, arg3, + JSTaggedValue resInICPath1 = ICBinaryOP::ShrWithTSType(thread, arg1, arg3, JSTaggedValue(static_cast(BinaryType::NUMBER))); EXPECT_EQ(JSTaggedValue(8), resInICPath1); - JSTaggedValue resInICPath2 = ICBinaryOP::ShrWithTSType(thread, ecmaVm, Str1.GetTaggedValue(), arg3, + JSTaggedValue resInICPath2 = ICBinaryOP::ShrWithTSType(thread, Str1.GetTaggedValue(), arg3, JSTaggedValue(static_cast(BinaryType::GENERIC))); EXPECT_EQ(JSTaggedValue(7), resInICPath2); }; @@ -320,15 +320,15 @@ HWTEST_F_L0(ICBinaryOPTest, AshrWithTSType) JSTaggedValue arg2(static_cast(-286)); JSTaggedValue arg3(static_cast(5)); - JSTaggedValue resInICPath1 = ICBinaryOP::AshrWithTSType(thread, ecmaVm, arg1, arg3, + JSTaggedValue resInICPath1 = ICBinaryOP::AshrWithTSType(thread, arg1, arg3, JSTaggedValue(static_cast(BinaryType::NUMBER))); EXPECT_EQ(JSTaggedValue(8), resInICPath1); - JSTaggedValue resInICPath3 = ICBinaryOP::AshrWithTSType(thread, ecmaVm, arg2, arg3, + JSTaggedValue resInICPath3 = ICBinaryOP::AshrWithTSType(thread, arg2, arg3, JSTaggedValue(static_cast(BinaryType::NUMBER))); EXPECT_EQ(JSTaggedValue(134217719), resInICPath3); - JSTaggedValue resInICPath2 = ICBinaryOP::AshrWithTSType(thread, ecmaVm, Str1.GetTaggedValue(), arg3, + JSTaggedValue resInICPath2 = ICBinaryOP::AshrWithTSType(thread, Str1.GetTaggedValue(), arg3, JSTaggedValue(static_cast(BinaryType::GENERIC))); EXPECT_EQ(JSTaggedValue(7), resInICPath2); @@ -341,11 +341,11 @@ HWTEST_F_L0(ICBinaryOPTest, AndWithTSType) JSTaggedValue arg1(static_cast(286)); JSTaggedValue arg3(static_cast(541)); - JSTaggedValue resInICPath1 = ICBinaryOP::AndWithTSType(thread, ecmaVm, arg1, arg3, + JSTaggedValue resInICPath1 = ICBinaryOP::AndWithTSType(thread, arg1, arg3, JSTaggedValue(static_cast(BinaryType::NUMBER))); EXPECT_EQ(JSTaggedValue(28), resInICPath1); - JSTaggedValue resInICPath2 = ICBinaryOP::AndWithTSType(thread, ecmaVm, Str1.GetTaggedValue(), arg3, + JSTaggedValue resInICPath2 = ICBinaryOP::AndWithTSType(thread, Str1.GetTaggedValue(), arg3, JSTaggedValue(static_cast(BinaryType::GENERIC))); EXPECT_EQ(JSTaggedValue(1), resInICPath2); }; @@ -357,11 +357,11 @@ HWTEST_F_L0(ICBinaryOPTest, OrWithTSType) JSTaggedValue arg1(static_cast(286)); JSTaggedValue arg3(static_cast(523)); - JSTaggedValue resInICPath1 = ICBinaryOP::OrWithTSType(thread, ecmaVm, arg1, arg3, + JSTaggedValue resInICPath1 = ICBinaryOP::OrWithTSType(thread, arg1, arg3, JSTaggedValue(static_cast(BinaryType::NUMBER))); EXPECT_EQ(JSTaggedValue(799), resInICPath1); - JSTaggedValue resInICPath2 = ICBinaryOP::OrWithTSType(thread, ecmaVm, Str1.GetTaggedValue(), arg3, + JSTaggedValue resInICPath2 = ICBinaryOP::OrWithTSType(thread, Str1.GetTaggedValue(), arg3, JSTaggedValue(static_cast(BinaryType::GENERIC))); EXPECT_EQ(JSTaggedValue(747), resInICPath2); }; @@ -373,11 +373,11 @@ HWTEST_F_L0(ICBinaryOPTest, XorWithTSType) JSTaggedValue arg1(static_cast(286)); JSTaggedValue arg3(static_cast(523)); - JSTaggedValue resInICPath1 = ICBinaryOP::XorWithTSType(thread, ecmaVm, arg1, arg3, + JSTaggedValue resInICPath1 = ICBinaryOP::XorWithTSType(thread, arg1, arg3, JSTaggedValue(static_cast(BinaryType::NUMBER))); EXPECT_EQ(JSTaggedValue(789), resInICPath1); - JSTaggedValue resInICPath2 = ICBinaryOP::XorWithTSType(thread, ecmaVm, Str1.GetTaggedValue(), arg3, + JSTaggedValue resInICPath2 = ICBinaryOP::XorWithTSType(thread, Str1.GetTaggedValue(), arg3, JSTaggedValue(static_cast(BinaryType::GENERIC))); EXPECT_EQ(JSTaggedValue(1730), resInICPath2); }; diff --git a/ecmascript/interpreter/frame_handler.cpp b/ecmascript/interpreter/frame_handler.cpp index a28d2ddff60c6267b6ed867a6c813351384de23c..1ae07ce2ee52e88a3bd2351064c268462a4a739a 100644 --- a/ecmascript/interpreter/frame_handler.cpp +++ b/ecmascript/interpreter/frame_handler.cpp @@ -229,7 +229,7 @@ void OptimizedFrameHandler::PrevFrame() sp_ = reinterpret_cast(frame->base.prevFp); } -void OptimizedFrameHandler::Iterate(const RootVisitor &v0, const RootRangeVisitor &v1, +void OptimizedFrameHandler::Iterate(const RootVisitor &v0, [[maybe_unused]] const RootRangeVisitor &v1, ChunkMap *derivedPointers, bool isVerifying) const { if (sp_ != nullptr) { @@ -244,13 +244,13 @@ void OptimizedFrameHandler::Iterate(const RootVisitor &v0, const RootRangeVisito #endif return; } - for (auto slot : slotAddrs) { + for (const auto &slot : slotAddrs) { v0(Root::ROOT_FRAME, ObjectSlot(slot)); } } } -void OptimizedEntryFrameHandler::Iterate(const RootVisitor &v0, const RootRangeVisitor &v1, +void OptimizedEntryFrameHandler::Iterate(const RootVisitor &v0, [[maybe_unused]] const RootRangeVisitor &v1, ChunkMap *derivedPointers, bool isVerifying) const { if (sp_ != nullptr) { @@ -265,7 +265,7 @@ void OptimizedEntryFrameHandler::Iterate(const RootVisitor &v0, const RootRangeV #endif return; } - for (auto slot : slotAddrs) { + for (const auto &slot : slotAddrs) { v0(Root::ROOT_FRAME, ObjectSlot(slot)); } } diff --git a/ecmascript/interpreter/interpreter-inl.h b/ecmascript/interpreter/interpreter-inl.h index 6aa89aaba98b7070264612aca4e4c48111a86e96..0bfc4008f22a0de77650ef1ad8897bd61717ee4f 100644 --- a/ecmascript/interpreter/interpreter-inl.h +++ b/ecmascript/interpreter/interpreter-inl.h @@ -421,6 +421,21 @@ JSTaggedType* EcmaInterpreter::GetCurrentFrameState(JSTaggedType *sp) return sp - FRAME_STATE_SIZE; } +JSTaggedValue EcmaInterpreter::Execute(JSThread *thread, const JSHandle &func, + const JSHandle &obj, + const JSHandle &newTgt, InternalCallParams *arguments) +{ + ASSERT(func->GetCallTarget() != nullptr); + + CallParams params; + params.callTarget = ECMAObject::Cast(*func); + params.newTarget = newTgt.GetTaggedType(); + params.thisArg = obj.GetTaggedType(); + params.argc = arguments->GetLength(); + params.argv = arguments->GetArgv(); + return Execute(thread, params); +} + JSTaggedValue EcmaInterpreter::Execute(JSThread *thread, const CallParams& params) { INTERPRETER_TRACE(thread, Execute); @@ -1440,7 +1455,7 @@ NO_UB_SANITIZE void EcmaInterpreter::RunInternal(JSThread *thread, ConstantPool } else { // one or both are not number, slow path SAVE_PC(); - JSTaggedValue res = SlowRuntimeStub::Add2Dyn(thread, ecmaVm, left, right); + JSTaggedValue res = SlowRuntimeStub::Add2Dyn(thread, left, right); INTERPRETER_RETURN_IF_ABRUPT(res); SET_ACC(res); } diff --git a/ecmascript/interpreter/interpreter.h b/ecmascript/interpreter/interpreter.h index 01d791c3b93815ed8ac41fdf37d405345dc29fe8..5af98762874e30fa0497219b4104f60fe1ed8cde 100644 --- a/ecmascript/interpreter/interpreter.h +++ b/ecmascript/interpreter/interpreter.h @@ -48,6 +48,9 @@ public: static const uint32_t METHOD_HOTNESS_THRESHOLD = 512; enum ActualNumArgsOfCall : uint8_t { CALLARG0 = 0, CALLARG1, CALLARGS2, CALLARGS3 }; + static inline JSTaggedValue Execute(JSThread *thread, const JSHandle &func, + const JSHandle &obj, + const JSHandle &newTgt, InternalCallParams *arguments); static inline JSTaggedValue Execute(JSThread *thread, const CallParams& params); static inline JSTaggedValue ExecuteNative(JSThread *thread, const CallParams& params); static inline JSTaggedValue GeneratorReEnterInterpreter(JSThread *thread, JSHandle context); diff --git a/ecmascript/interpreter/interpreter_assembly.cpp b/ecmascript/interpreter/interpreter_assembly.cpp index bd5ca4bd2023f322af4e8f2c9bf70c1506390eef..0ab053e098999b2b7debaef2668e33742ffd6e91 100644 --- a/ecmascript/interpreter/interpreter_assembly.cpp +++ b/ecmascript/interpreter/interpreter_assembly.cpp @@ -41,9 +41,11 @@ using panda::ecmascript::kungfu::CommonStubCSigns; #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wvoid-ptr-dereference" #pragma clang diagnostic ignored "-Wgnu-label-as-value" +#pragma clang diagnostic ignored "-Wunused-parameter" #elif defined(__GNUC__) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wpedantic" +#pragma GCC diagnostic ignored "-Wunused-parameter" #endif // NOLINTNEXTLINE(cppcoreguidelines-macro-usage) @@ -1239,8 +1241,7 @@ void InterpreterAssembly::HandleAdd2DynPrefV8( SET_ACC(JSTaggedValue(ret)) } else { // one or both are not number, slow path - EcmaVM *ecmaVm = thread->GetEcmaVM(); - JSTaggedValue res = SlowRuntimeStub::Add2Dyn(thread, ecmaVm, left, right); + JSTaggedValue res = SlowRuntimeStub::Add2Dyn(thread, left, right); INTERPRETER_RETURN_IF_ABRUPT(res); SET_ACC(res); } @@ -3779,7 +3780,7 @@ inline uint32_t InterpreterAssembly::GetNumArgs(JSTaggedType *sp, uint32_t restI uint32_t numArgs = JSMethod::NumArgsBits::Decode(callField); // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) JSTaggedType *lastFrame = state->base.prev - FRAME_STATE_SIZE; - if (lastFrame - sp > numVregs + copyArgs + numArgs) { + if (static_cast(lastFrame - sp) > numVregs + copyArgs + numArgs) { // In this case, actualNumArgs is in the end // If not, then actualNumArgs == declaredNumArgs, therefore do nothing // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) diff --git a/ecmascript/interpreter/slow_runtime_helper.cpp b/ecmascript/interpreter/slow_runtime_helper.cpp index 528d5132fd9282ae2487c0f8176e35f35a3e81a9..1a9a9b3e542b783beae17bad059da91ca7a3bd7a 100644 --- a/ecmascript/interpreter/slow_runtime_helper.cpp +++ b/ecmascript/interpreter/slow_runtime_helper.cpp @@ -19,7 +19,6 @@ #include "ecmascript/interpreter/frame_handler.h" #include "ecmascript/interpreter/interpreter-inl.h" #include "ecmascript/js_generator_object.h" -#include "ecmascript/js_invoker.h" #include "ecmascript/js_tagged_value.h" #include "ecmascript/mem/c_containers.h" #include "ecmascript/tagged_array-inl.h" @@ -37,7 +36,7 @@ JSTaggedValue SlowRuntimeHelper::CallBoundFunction(JSThread *thread, InternalCallParams *arguments = thread->GetInternalCallParams(); arguments->MakeBoundArgv(thread, boundFunc); JSHandle newTarget(thread, JSTaggedValue::Undefined()); - return InvokeJsFunction(thread, targetFunc, obj, newTarget, arguments); + return EcmaInterpreter::Execute(thread, targetFunc, obj, newTarget, arguments); } JSTaggedValue SlowRuntimeHelper::NewObject(JSThread *thread, JSHandle func, @@ -69,7 +68,7 @@ JSTaggedValue SlowRuntimeHelper::NewObject(JSThread *thread, JSHandleGetCallTarget()->IsNative()) { if (jsFunc->IsBuiltinsConstructor()) { - return InvokeJsFunction(thread, jsFunc, JSHandle(thread, JSTaggedValue::Undefined()), + return EcmaInterpreter::Execute(thread, jsFunc, JSHandle(thread, JSTaggedValue::Undefined()), newTarget, thread->GetInternalCallParams()); } THROW_TYPE_ERROR_AND_RETURN(thread, "Constructed NonConstructable", JSTaggedValue::Exception()); diff --git a/ecmascript/interpreter/slow_runtime_stub.cpp b/ecmascript/interpreter/slow_runtime_stub.cpp index 8be836b2d65903f325c60321ae1dce1553765518..208d55a0fb9b640024e9091902806e3ae02c5a77 100644 --- a/ecmascript/interpreter/slow_runtime_stub.cpp +++ b/ecmascript/interpreter/slow_runtime_stub.cpp @@ -22,6 +22,7 @@ #include "ecmascript/internal_call_params.h" #include "ecmascript/interpreter/fast_runtime_stub-inl.h" #include "ecmascript/interpreter/frame_handler.h" +#include "ecmascript/interpreter/interpreter-inl.h" #include "ecmascript/interpreter/slow_runtime_helper.h" #include "ecmascript/jspandafile/program_object-inl.h" #include "ecmascript/jspandafile/scope_info_extractor.h" @@ -33,7 +34,6 @@ #include "ecmascript/js_function.h" #include "ecmascript/js_generator_object.h" #include "ecmascript/js_hclass-inl.h" -#include "ecmascript/js_invoker.h" #include "ecmascript/js_iterator.h" #include "ecmascript/js_promise.h" #include "ecmascript/js_proxy.h" @@ -62,7 +62,7 @@ JSTaggedValue SlowRuntimeStub::CallSpreadDyn(JSThread *thread, JSTaggedValue fun InternalCallParams *params = thread->GetInternalCallParams(); params->MakeArgList(*coretypesArray); JSHandle newTarget(thread, JSTaggedValue::Undefined()); - JSTaggedValue res = InvokeJsFunction(thread, jsFunc, taggedObj, newTarget, params); + JSTaggedValue res = EcmaInterpreter::Execute(thread, jsFunc, taggedObj, newTarget, params); return res; } @@ -209,7 +209,7 @@ void SlowRuntimeStub::ThrowConstAssignment(JSThread *thread, JSTaggedValue value THROW_NEW_ERROR_AND_RETURN(thread, factory->NewJSError(base::ErrorType::TYPE_ERROR, msg).GetTaggedValue()); } -JSTaggedValue SlowRuntimeStub::Add2Dyn(JSThread *thread, EcmaVM *ecma_vm, JSTaggedValue left, JSTaggedValue right) +JSTaggedValue SlowRuntimeStub::Add2Dyn(JSThread *thread, JSTaggedValue left, JSTaggedValue right) { INTERPRETER_TRACE(thread, Add2Dyn); [[maybe_unused]] EcmaHandleScope handleScope(thread); @@ -1429,7 +1429,8 @@ JSTaggedValue SlowRuntimeStub::GetIterator(JSThread *thread, JSTaggedValue obj) JSHandle newTarget(thread, JSTaggedValue::Undefined()); InternalCallParams *params = thread->GetInternalCallParams(); params->MakeEmptyArgv(); - JSTaggedValue res = InvokeJsFunction(thread, JSHandle(valuesFunc), objHandle, newTarget, params); + JSTaggedValue res = EcmaInterpreter::Execute( + thread, JSHandle(valuesFunc), objHandle, newTarget, params); return res; } diff --git a/ecmascript/interpreter/slow_runtime_stub.h b/ecmascript/interpreter/slow_runtime_stub.h index a5e9cf31bf85e2f672ae7560cd301fff9f89bb43..f2f6fd93ae70394662e975ac198134c574b0e876 100644 --- a/ecmascript/interpreter/slow_runtime_stub.h +++ b/ecmascript/interpreter/slow_runtime_stub.h @@ -37,7 +37,7 @@ public: static void ThrowDyn(JSThread *thread, JSTaggedValue value); static JSTaggedValue GetPropIterator(JSThread *thread, JSTaggedValue value); static void ThrowConstAssignment(JSThread *thread, JSTaggedValue value); - static JSTaggedValue Add2Dyn(JSThread *thread, EcmaVM *ecma_vm, JSTaggedValue left, JSTaggedValue right); + static JSTaggedValue Add2Dyn(JSThread *thread, JSTaggedValue left, JSTaggedValue right); static JSTaggedValue Sub2Dyn(JSThread *thread, JSTaggedValue left, JSTaggedValue right); static JSTaggedValue Mul2Dyn(JSThread *thread, JSTaggedValue left, JSTaggedValue right); static JSTaggedValue Div2Dyn(JSThread *thread, JSTaggedValue left, JSTaggedValue right); diff --git a/ecmascript/js_array.cpp b/ecmascript/js_array.cpp index 60e3402c72165af8b61d9fbf28074e8da08dd745..dbe6b787afbb59a021af262b2fe682f812607f3e 100644 --- a/ecmascript/js_array.cpp +++ b/ecmascript/js_array.cpp @@ -19,7 +19,6 @@ #include "ecmascript/ecma_vm.h" #include "ecmascript/global_env.h" #include "ecmascript/internal_call_params.h" -#include "ecmascript/js_invoker.h" #include "ecmascript/js_tagged_value-inl.h" #include "ecmascript/object_factory.h" #include "interpreter/fast_runtime_stub-inl.h" diff --git a/ecmascript/js_bigint.cpp b/ecmascript/js_bigint.cpp index b79b3604b95892f24b7f973c3714734a1e23ec12..10d52a5ac45c30fd26413e474b55f1ff4979691b 100644 --- a/ecmascript/js_bigint.cpp +++ b/ecmascript/js_bigint.cpp @@ -770,7 +770,7 @@ inline uint32_t BigIntHelper::SubHelper(uint32_t x, uint32_t y, uint32_t &bigint return minuSub; } -ComparisonResult BigInt::Compare(JSThread *thread, const JSTaggedValue &x, const JSTaggedValue &y) +ComparisonResult BigInt::Compare(const JSTaggedValue &x, const JSTaggedValue &y) { if (!LessThan(x, y)) { if (!LessThan(y, x)) { @@ -1353,7 +1353,7 @@ static int CompareToBitsLen(JSHandle bigint, int numBitLen, int &preZero return -1; } -ComparisonResult BigInt::CompareWithNumber(JSThread *thread, JSHandle bigint, JSHandle number) +ComparisonResult BigInt::CompareWithNumber(JSHandle bigint, JSHandle number) { double num = number->GetNumber(); bool numberSign = num < 0; diff --git a/ecmascript/js_bigint.h b/ecmascript/js_bigint.h index 348e660604b2393d8f1d9eb02944d9743dd90144..d40a30137050d7ba3eb68535d7c1e3f4e5d69e13 100644 --- a/ecmascript/js_bigint.h +++ b/ecmascript/js_bigint.h @@ -68,7 +68,7 @@ public: static JSHandle Add(JSThread *thread, JSHandle x, JSHandle y); static JSHandle Subtract(JSThread *thread, JSHandle x, JSHandle y); static bool LessThan(const JSTaggedValue &x, const JSTaggedValue &y); - static ComparisonResult Compare(JSThread *thread, const JSTaggedValue &x, const JSTaggedValue &y); + static ComparisonResult Compare(const JSTaggedValue &x, const JSTaggedValue &y); static JSHandle SignedRightShift(JSThread *thread, JSHandle x, JSHandle y); static JSHandle RightShiftHelper(JSThread *thread, JSHandle x, JSHandle y); static JSTaggedValue UnsignedRightShift(JSThread *thread); @@ -88,8 +88,7 @@ public: static JSTaggedValue AsUintN(JSThread *thread, JSTaggedNumber &bits, JSHandle bigint); static JSTaggedValue AsintN(JSThread *thread, JSTaggedNumber &bits, JSHandle bigint); static JSTaggedNumber BigIntToNumber(JSHandle bigint); - static ComparisonResult CompareWithNumber(JSThread *thread, JSHandle bigint, - JSHandle number); + static ComparisonResult CompareWithNumber(JSHandle bigint, JSHandle number); inline bool IsZero() { return GetLength() == 1 && !GetDigit(0); diff --git a/ecmascript/js_function.cpp b/ecmascript/js_function.cpp index d2f33cd702666e4af251e258f1e2b9abb9f3d1e0..24be2ccfabd061fc5f0553ba4578e959abcbca45 100644 --- a/ecmascript/js_function.cpp +++ b/ecmascript/js_function.cpp @@ -535,7 +535,7 @@ JSHandle JSFunction::GetInstanceJSHClass(JSThread *thread, JSHandleIsDerivedConstructor()) { JSTaggedValue newTargetProto = JSHandle::Cast(newTarget)->GetPrototype(thread); if (newTargetProto == constructor.GetTaggedValue()) { - return GetOrCreateDerivedJSHClass(thread, newTargetFunc, constructor, ctorInitialJSHClass); + return GetOrCreateDerivedJSHClass(thread, newTargetFunc, ctorInitialJSHClass); } } } @@ -570,7 +570,6 @@ JSHandle JSFunction::GetInstanceJSHClass(JSThread *thread, JSHandle JSFunction::GetOrCreateDerivedJSHClass(JSThread *thread, JSHandle derived, - JSHandle constructor, JSHandle ctorInitialJSHClass) { JSTaggedValue protoOrDyn(derived->GetProtoOrDynClass()); diff --git a/ecmascript/js_function.h b/ecmascript/js_function.h index 208d9c5f8aea8c917468cfd4f78ca68e2b3e9171..ec7244d33191658ca10a6702413d16d338f14fb4 100644 --- a/ecmascript/js_function.h +++ b/ecmascript/js_function.h @@ -245,7 +245,6 @@ public: private: static JSHandle GetOrCreateDerivedJSHClass(JSThread *thread, JSHandle derived, - JSHandle constructor, JSHandle ctorInitialDynClass); }; diff --git a/ecmascript/js_invoker.cpp b/ecmascript/js_invoker.cpp deleted file mode 100644 index d5d45eb2b882a1ff268f9f8535a61fcb2ba1a7f9..0000000000000000000000000000000000000000 --- a/ecmascript/js_invoker.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "ecmascript/js_invoker.h" - -#include "ecmascript/ecma_runtime_call_info.h" -#include "ecmascript/interpreter/interpreter-inl.h" -#include "ecmascript/js_tagged_value.h" -#include "ecmascript/js_thread.h" -#include "ecmascript/mem/c_containers.h" -#include "ecmascript/tagged_array-inl.h" -#include "libpandabase/utils/span.h" - -namespace panda::ecmascript { -JSTaggedValue JsInvoker::Invoke(JSThread *thread) -{ - UNREACHABLE(); -} - -JSTaggedValue InvokeJsFunction(JSThread *thread, const JSHandle &func, const JSHandle &obj, - const JSHandle &newTgt, InternalCallParams *arguments) -{ - ASSERT(func->GetCallTarget() != nullptr); - - CallParams params; - params.callTarget = ECMAObject::Cast(*func); - params.newTarget = newTgt.GetTaggedType(); - params.thisArg = obj.GetTaggedType(); - params.argc = arguments->GetLength(); - params.argv = arguments->GetArgv(); - return EcmaInterpreter::Execute(thread, params); -} -} // namespace panda::ecmascript diff --git a/ecmascript/js_invoker.h b/ecmascript/js_invoker.h deleted file mode 100644 index 92a0464e6412690cf37d96c99756840e6117e251..0000000000000000000000000000000000000000 --- a/ecmascript/js_invoker.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ECMASCRIPT_INVOKE_H -#define ECMASCRIPT_INVOKE_H - -#include "ecmascript/js_function.h" -#include "ecmascript/js_handle.h" -#include "ecmascript/js_object.h" -#include "ecmascript/js_thread.h" -#include "ecmascript/mem/c_containers.h" - -namespace panda::ecmascript { -class JsInvoker { -public: - JsInvoker(const JSThread *thread, JSTaggedValue func, JSTaggedValue obj) - : JsInvoker(thread, func, obj, JSTaggedValue::Undefined()) - { - } - - JsInvoker(const JSThread *thread, JSTaggedValue func, JSTaggedValue obj, JSTaggedValue newTarget) - { - AddArgument(JSHandle(thread, func)); - AddArgument(JSHandle(thread, newTarget)); - AddArgument(JSHandle(thread, obj)); - } - - ~JsInvoker() = default; - NO_COPY_SEMANTIC(JsInvoker); - NO_MOVE_SEMANTIC(JsInvoker); - - template - void AddArgument(const JSHandle &arg) - { - args_.emplace_back(JSHandle(arg)); - } - - template - void AddArgument(JSHandle &&arg) - { - args_.emplace_back(std::move(arg)); - } - - JSTaggedValue Invoke(JSThread *thread); - -private: - CVector> args_{}; -}; - -JSTaggedValue InvokeJsFunction(JSThread *thread, const JSHandle &func, const JSHandle &obj, - const JSHandle &newTgt, InternalCallParams *arguments); -} // namespace panda::ecmascript - -#endif // ECMASCRIPT_INVOKE_H diff --git a/ecmascript/js_iterator.cpp b/ecmascript/js_iterator.cpp index 9d87af0dc1b9e503acacbe9e733354c903e5d5f1..5901f37887e0ff7a0d5bfef95c639f54adf0bac0 100644 --- a/ecmascript/js_iterator.cpp +++ b/ecmascript/js_iterator.cpp @@ -19,13 +19,11 @@ #include "ecmascript/accessor_data.h" #include "ecmascript/internal_call_params.h" #include "global_env.h" -#include "js_invoker.h" #include "js_symbol.h" #include "object_factory.h" namespace panda::ecmascript { -JSTaggedValue JSIterator::IteratorCloseAndReturn(JSThread *thread, const JSHandle &iter, - const JSHandle &status) +JSTaggedValue JSIterator::IteratorCloseAndReturn(JSThread *thread, const JSHandle &iter) { ASSERT(thread->HasPendingException()); ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); diff --git a/ecmascript/js_iterator.h b/ecmascript/js_iterator.h index e816cd362da576278ece51469e3a6ec6858b6613..b4ed0df48dea70d047a5e7d6020381948e1784ef 100644 --- a/ecmascript/js_iterator.h +++ b/ecmascript/js_iterator.h @@ -28,8 +28,7 @@ enum class IterationKind : uint8_t { class JSIterator final { public: - static JSTaggedValue IteratorCloseAndReturn(JSThread *thread, const JSHandle &iter, - const JSHandle &status); + static JSTaggedValue IteratorCloseAndReturn(JSThread *thread, const JSHandle &iter); // 7.4.1 static JSHandle GetIterator(JSThread *thread, const JSHandle &obj); diff --git a/ecmascript/js_locale.cpp b/ecmascript/js_locale.cpp index de5e11295c0b8b814c215e595450e81432b42084..be7cec7ac81ecb5185c2df5046bdf31be57be1f6 100644 --- a/ecmascript/js_locale.cpp +++ b/ecmascript/js_locale.cpp @@ -20,7 +20,20 @@ #include "js_locale.h" #include "object_factory.h" +#if defined(__clang__) +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wshadow" +#elif defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wshadow" +#endif #include "unicode/localebuilder.h" +#if defined(__clang__) +#pragma clang diagnostic pop +#elif defined(__GNUC__) +#pragma GCC diagnostic pop +#endif + #include "unicode/localematcher.h" namespace panda::ecmascript { @@ -197,7 +210,7 @@ JSHandle JSLocale::CanonicalizeLocaleList(JSThread *thread, const J JSHandle temp = factory->NewTaggedArray(1); temp->Set(thread, 0, tag.GetTaggedValue()); JSHandle obj = JSArray::CreateArrayFromList(thread, temp); - JSHandle finalSeen = CanonicalizeHelper(thread, locales, obj, localeSeen); + JSHandle finalSeen = CanonicalizeHelper(thread, obj, localeSeen); return finalSeen; } else if (locales->IsJSLocale()) { JSHandle tag = JSLocale::ToString(thread, JSHandle::Cast(locales)); @@ -205,20 +218,19 @@ JSHandle JSLocale::CanonicalizeLocaleList(JSThread *thread, const J RETURN_HANDLE_IF_ABRUPT_COMPLETION(TaggedArray, thread); temp->Set(thread, 0, tag.GetTaggedValue()); JSHandle obj = JSArray::CreateArrayFromList(thread, temp); - JSHandle finalSeen = CanonicalizeHelper(thread, locales, obj, localeSeen); + JSHandle finalSeen = CanonicalizeHelper(thread, obj, localeSeen); return finalSeen; } else { JSHandle obj = JSTaggedValue::ToObject(thread, locales); RETURN_HANDLE_IF_ABRUPT_COMPLETION(TaggedArray, thread); - JSHandle finalSeen = CanonicalizeHelper(thread, locales, obj, localeSeen); + JSHandle finalSeen = CanonicalizeHelper(thread, obj, localeSeen); return finalSeen; } return localeSeen; } template -JSHandle JSLocale::CanonicalizeHelper(JSThread *thread, const JSHandle &locales, - JSHandle &obj, JSHandle &seen) +JSHandle JSLocale::CanonicalizeHelper(JSThread *thread, JSHandle &obj, JSHandle &seen) { OperationResult operationResult = JSTaggedValue::GetProperty(thread, JSHandle::Cast(obj), thread->GlobalConstants()->GetHandledLengthString()); @@ -266,14 +278,14 @@ JSHandle JSLocale::CanonicalizeHelper(JSThread *thread, const JSHan } else { JSHandle kValueString = JSTaggedValue::ToString(thread, kValue); RETURN_HANDLE_IF_ABRUPT_COMPLETION(TaggedArray, thread); - JSHandle str = CanonicalizeUnicodeLocaleId(thread, kValueString); + JSHandle canonicalStr = CanonicalizeUnicodeLocaleId(thread, kValueString); RETURN_HANDLE_IF_ABRUPT_COMPLETION(TaggedArray, thread); - tag.Update(str.GetTaggedValue()); + tag.Update(canonicalStr.GetTaggedValue()); } // vii. If canonicalizedTag is not an element of seen, append canonicalizedTag as the last element of seen. bool isExist = false; - uint32_t len = seen->GetLength(); - for (uint32_t i = 0; i < len; i++) { + uint32_t seenLen = seen->GetLength(); + for (uint32_t i = 0; i < seenLen; i++) { if (JSTaggedValue::SameValue(seen->Get(thread, i), tag.GetTaggedValue())) { isExist = true; } @@ -1367,9 +1379,9 @@ JSHandle JSLocale::GetAvailableLocales(JSThread *thread, const char } if (localePath != nullptr || localeKey != nullptr) { - icu::Locale loc(locStr.c_str()); + icu::Locale locale(locStr.c_str()); bool res = false; - if (!CheckLocales(loc, localeKey, localePath, res)) { + if (!CheckLocales(locale, localeKey, localePath, res)) { continue; } } diff --git a/ecmascript/js_locale.h b/ecmascript/js_locale.h index bfe0ba9b2f5fbe72a89a5108ce8cb20197097fcb..b55aa430690572067dec127cb7c32993a2970f50 100644 --- a/ecmascript/js_locale.h +++ b/ecmascript/js_locale.h @@ -202,8 +202,7 @@ public: static JSHandle CanonicalizeLocaleList(JSThread *thread, const JSHandle &locales); template - static JSHandle CanonicalizeHelper(JSThread *thread, const JSHandle &locales, - JSHandle &obj, JSHandle &seen); + static JSHandle CanonicalizeHelper(JSThread *thread, JSHandle &obj, JSHandle &seen); // 9.2.2 BestAvailableLocale ( availableLocales, locale ) static std::string BestAvailableLocale(JSThread *thread, const JSHandle &availableLocales, diff --git a/ecmascript/js_number_format.cpp b/ecmascript/js_number_format.cpp index b0cb1443d03047df6e19a4a95eef00041e951f41..5502d70fcdfcb5daa6aecfbd4d8520d0a10693b7 100644 --- a/ecmascript/js_number_format.cpp +++ b/ecmascript/js_number_format.cpp @@ -189,8 +189,8 @@ icu::MeasureUnit ToMeasureUnit(const std::string &sanctionedUnit) bool IsSanctionedSimpleUnitIdentifier(const std::string &unit) { // 1. If unitIdentifier is listed in sanctioned unit set, return true. - auto it = sanctionedUnit.find(unit); - if (it != sanctionedUnit.end()) { + auto it = SANCTIONED_UNIT.find(unit); + if (it != SANCTIONED_UNIT.end()) { return true; } diff --git a/ecmascript/js_number_format.h b/ecmascript/js_number_format.h index 80ad89bbd6a173c8836fb5268870668390593c0d..fb233ca9e8933133ca5d0c3791d957c0185f0e52 100644 --- a/ecmascript/js_number_format.h +++ b/ecmascript/js_number_format.h @@ -41,7 +41,7 @@ struct FractionDigitsOption { int32_t mxfdDefault = 0; }; -static const std::set sanctionedUnit({ "acre", "bit", "byte", "celsius", "centimeter", "day", "degree", +static const std::set SANCTIONED_UNIT({ "acre", "bit", "byte", "celsius", "centimeter", "day", "degree", "fahrenheit", "fluid-ounce", "foot", "gallon", "gigabit", "gigabyte", "gram", "hectare", "hour", "inch", "kilobit", "kilobyte", "kilogram", "kilometer", "liter", "megabit", "megabyte", "meter", "mile", diff --git a/ecmascript/js_object.cpp b/ecmascript/js_object.cpp index 63b37fdab9b7542b580e6c2e0394d1d377e73caf..ee50f6c72ed9b5d250233b117f633f6984f9ec15 100644 --- a/ecmascript/js_object.cpp +++ b/ecmascript/js_object.cpp @@ -25,7 +25,6 @@ #include "js_array.h" #include "js_for_in_iterator.h" #include "js_hclass.h" -#include "js_invoker.h" #include "js_iterator.h" #include "object_factory.h" #include "property_attributes.h" @@ -289,7 +288,7 @@ void JSObject::GetAllKeys(const JSThread *thread, const JSHandle &obj, } } else { NameDictionary *dict = NameDictionary::Cast(obj->GetProperties().GetTaggedObject()); - dict->GetAllKeysIntoVector(thread, keyVector); + dict->GetAllKeysIntoVector(keyVector); } } @@ -371,7 +370,7 @@ void JSObject::GetALLElementKeysIntoVector(const JSThread *thread, const JSHandl } } else { JSHandle dict = JSHandle::Cast(elements); - dict->GetAllKeysIntoVector(thread, keyVector); + dict->GetAllKeysIntoVector(keyVector); } } diff --git a/ecmascript/js_stable_array.cpp b/ecmascript/js_stable_array.cpp index 23cdff3020c05a7d7a7ad9370636a91fdd69e48c..1a6e0e7dcf86682ee0f8c85f488907edfb948da6 100644 --- a/ecmascript/js_stable_array.cpp +++ b/ecmascript/js_stable_array.cpp @@ -18,7 +18,6 @@ #include "ecmascript/ecma_vm.h" #include "ecmascript/global_env.h" #include "ecmascript/js_array.h" -#include "ecmascript/js_invoker.h" #include "ecmascript/js_tagged_value-inl.h" #include "ecmascript/object_factory.h" #include "ecmascript/tagged_array.h" @@ -59,7 +58,7 @@ JSTaggedValue JSStableArray::Pop(JSHandle receiver, EcmaRuntimeCallInfo uint32_t capacity = elements->GetLength(); uint32_t index = length - 1; auto result = elements->Get(index); - if (TaggedArray::ShouldTrim(thread, capacity, index)) { + if (TaggedArray::ShouldTrim(capacity, index)) { elements->Trim(thread, index); } else { elements->Set(thread, index, JSTaggedValue::Hole()); @@ -131,7 +130,7 @@ JSTaggedValue JSStableArray::Splice(JSHandle receiver, EcmaRuntimeCallI srcElementsHandle->Set(thread, idx + insertCount, element); } - if (TaggedArray::ShouldTrim(thread, oldCapacity, newCapacity)) { + if (TaggedArray::ShouldTrim(oldCapacity, newCapacity)) { srcElementsHandle->Trim(thread, newCapacity); } else { for (uint32_t idx = newCapacity; idx < len; idx++) { @@ -180,7 +179,7 @@ JSTaggedValue JSStableArray::Shift(JSHandle receiver, EcmaRuntimeCallIn } uint32_t capacity = elements->GetLength(); uint32_t index = length - 1; - if (TaggedArray::ShouldTrim(thread, capacity, index)) { + if (TaggedArray::ShouldTrim(capacity, index)) { elements->Trim(thread, index); } else { elements->Set(thread, index, JSTaggedValue::Hole()); diff --git a/ecmascript/js_symbol.h b/ecmascript/js_symbol.h index 2be3e2d7c48ab8a5193711a268d6029c4b00db20..3db21b938ec3fcfb07c1398f6a157fb8817e4495 100644 --- a/ecmascript/js_symbol.h +++ b/ecmascript/js_symbol.h @@ -53,7 +53,7 @@ public: return (GetFlags() & IS_PRIVATE) != 0U; } - void SetPrivate(const JSThread *thread) + void SetPrivate() { SetFlags(GetFlags() | IS_PRIVATE); } @@ -63,7 +63,7 @@ public: return (GetFlags() & IS_WELL_KNOWN_SYMBOL) != 0U; } - void SetWellKnownSymbol(const JSThread *thread) + void SetWellKnownSymbol() { SetFlags(GetFlags() | IS_WELL_KNOWN_SYMBOL); } @@ -73,7 +73,7 @@ public: return (GetFlags() & IS_IN_PUBLIC_SYMBOL_TABLE) != 0U; } - void SetInPublicSymbolTable(const JSThread *thread) + void SetInPublicSymbolTable() { SetFlags(GetFlags() | IS_IN_PUBLIC_SYMBOL_TABLE); } @@ -83,7 +83,7 @@ public: return (GetFlags() & IS_INTERESTING_SYMBOL) != 0U; } - void SetInterestingSymbol(const JSThread *thread) + void SetInterestingSymbol() { SetFlags(GetFlags() | IS_INTERESTING_SYMBOL); } @@ -93,7 +93,7 @@ public: return (GetFlags() & IS_PRIVATE_NAME) != 0U; } - void SetPrivateNameSymbol(const JSThread *thread) + void SetPrivateNameSymbol() { SetFlags(GetFlags() | IS_PRIVATE_NAME); } diff --git a/ecmascript/js_tagged_value.cpp b/ecmascript/js_tagged_value.cpp index a7ae6f155502bc4e422902a73581f262425b37fc..d40148e2710385f880f6a8ebe71b7c7c0a597279 100644 --- a/ecmascript/js_tagged_value.cpp +++ b/ecmascript/js_tagged_value.cpp @@ -205,7 +205,7 @@ bool JSTaggedValue::Equal(JSThread *thread, const JSHandle &x, co } if (y->IsNumber()) { JSHandle bigint = JSHandle::Cast(x); - return BigInt::CompareWithNumber(thread, bigint, y) == ComparisonResult::EQUAL; + return BigInt::CompareWithNumber(bigint, y) == ComparisonResult::EQUAL; } if (y->IsHeapObject() && !y->IsSymbol()) { JSHandle yPrimitive(thread, ToPrimitive(thread, y)); @@ -273,17 +273,17 @@ ComparisonResult JSTaggedValue::Compare(JSThread *thread, const JSHandleIsBigInt()) { if (primY->IsNumber()) { JSHandle bigint = JSHandle::Cast(primX); - return BigInt::CompareWithNumber(thread, bigint, primY); + return BigInt::CompareWithNumber(bigint, primY); } else if (primY->IsString()) { JSHandle bigY(thread, base::NumberHelper::StringToBigInt(thread, primY)); if (!bigY->IsBigInt()) { return ComparisonResult::UNDEFINED; } - return BigInt::Compare(thread, primX.GetTaggedValue(), bigY.GetTaggedValue()); + return BigInt::Compare(primX.GetTaggedValue(), bigY.GetTaggedValue()); } else { JSHandle bigY(thread, ToBigInt(thread, primY)); RETURN_VALUE_IF_ABRUPT_COMPLETION(thread, ComparisonResult::UNDEFINED); - return BigInt::Compare(thread, primX.GetTaggedValue(), bigY.GetTaggedValue()); + return BigInt::Compare(primX.GetTaggedValue(), bigY.GetTaggedValue()); } } if (primY->IsBigInt()) { @@ -738,7 +738,7 @@ bool JSTaggedValue::SetPrototype(JSThread *thread, const JSHandle return JSProxy::SetPrototype(thread, JSHandle(obj), proto); } if (obj->IsModuleNamespace()) { - return ModuleNamespace::SetPrototype(thread, obj, proto); + return ModuleNamespace::SetPrototype(obj, proto); } if (obj->IsSpecialContainer()) { THROW_TYPE_ERROR_AND_RETURN(thread, "Can not set Prototype on Container Object", false); diff --git a/ecmascript/js_tagged_value.h b/ecmascript/js_tagged_value.h index 2e227f03b40422c08b5c51ae0a19b9aaa1d08d4b..5eadce46d83b54f02dc03f9c46e91cda58e10435 100644 --- a/ecmascript/js_tagged_value.h +++ b/ecmascript/js_tagged_value.h @@ -368,18 +368,18 @@ public: inline uint32_t GetKeyHashCode() const; static JSTaggedValue GetSuperBase(JSThread *thread, const JSHandle &obj); - void DumpTaggedValue(JSThread *thread, std::ostream &os) const DUMP_API_ATTR; - void Dump(JSThread *thread, std::ostream &os) const DUMP_API_ATTR; + void DumpTaggedValue(std::ostream &os) const DUMP_API_ATTR; + void Dump(std::ostream &os) const DUMP_API_ATTR; void D() const DUMP_API_ATTR; - void DumpForSnapshot(JSThread *thread, std::vector> &vec, + void DumpForSnapshot(std::vector> &vec, bool isVmMode = true) const; static void DV(JSTaggedType val) DUMP_API_ATTR; private: inline double ExtractNumber() const; - void DumpSpecialValue([[maybe_unused]] JSThread *thread, std::ostream &os) const; - void DumpHeapObjectType([[maybe_unused]] JSThread *thread, std::ostream &os) const; + void DumpSpecialValue(std::ostream &os) const; + void DumpHeapObjectType(std::ostream &os) const; // non ECMA standard jsapis static bool HasContainerProperty(JSThread *thread, const JSHandle &obj, diff --git a/ecmascript/js_vm/BUILD.gn b/ecmascript/js_vm/BUILD.gn index 0f9aaa5172bd56259eea39128f8099bb087e5895..c0f2b317c0ed7bd5be1b0b76f877537be7145b06 100644 --- a/ecmascript/js_vm/BUILD.gn +++ b/ecmascript/js_vm/BUILD.gn @@ -18,7 +18,7 @@ ohos_executable("ark_js_vm") { sources = [ "main.cpp" ] configs = [ - "//ark/js_runtime:ark_jsruntime_config", + "//ark/js_runtime:ark_jsruntime_common_config", "//ark/js_runtime:ark_jsruntime_public_config", "$ark_root/runtime:arkruntime_public_config", ] diff --git a/ecmascript/jspandafile/ecma_class_linker_extension.cpp b/ecmascript/jspandafile/ecma_class_linker_extension.cpp index 29194e73c0cbace3b94d9dcc2667913d70a7a38d..67f12156721c9c39486bfa7e82567e1b15112c15 100644 --- a/ecmascript/jspandafile/ecma_class_linker_extension.cpp +++ b/ecmascript/jspandafile/ecma_class_linker_extension.cpp @@ -22,7 +22,7 @@ namespace panda::ecmascript { using SourceLang = panda_file::SourceLang; -bool EcmaClassLinkerExtension::InitializeImpl(bool cmpStrEnabled) +bool EcmaClassLinkerExtension::InitializeImpl([[maybe_unused]] bool cmpStrEnabled) { return true; } diff --git a/ecmascript/jspandafile/js_pandafile_executor.cpp b/ecmascript/jspandafile/js_pandafile_executor.cpp index 3cef7331ea4f44c983e8202908629c7395906102..5010a8064ffd198033c7900b9f8b211ec9c83c7e 100644 --- a/ecmascript/jspandafile/js_pandafile_executor.cpp +++ b/ecmascript/jspandafile/js_pandafile_executor.cpp @@ -16,7 +16,6 @@ #include "ecmascript/jspandafile/js_pandafile_executor.h" #include "ecmascript/ecma_vm.h" #include "ecmascript/internal_call_params.h" -#include "ecmascript/js_invoker.h" #include "ecmascript/jspandafile/js_pandafile_manager.h" #include "ecmascript/jspandafile/program_object-inl.h" #include "ecmascript/module/js_module_manager.h" diff --git a/ecmascript/layout_info.cpp b/ecmascript/layout_info.cpp index 03f45f010c8d42c1d61eb3b4a270cc6be56d6dd2..1617d2a01bc6389e296a81884570b7da6eaafdf9 100644 --- a/ecmascript/layout_info.cpp +++ b/ecmascript/layout_info.cpp @@ -69,7 +69,7 @@ void LayoutInfo::GetAllKeys(const JSThread *thread, int end, int offset, TaggedA } } -void LayoutInfo::GetAllKeys(const JSThread *thread, int end, std::vector &keyVector) +void LayoutInfo::GetAllKeys([[maybe_unused]] const JSThread *thread, int end, std::vector &keyVector) { ASSERT(end <= NumberOfElements()); int enumKeys = 0; diff --git a/ecmascript/mem/concurrent_sweeper.cpp b/ecmascript/mem/concurrent_sweeper.cpp index 0ee6ee3db91d0712e42ba0bbafe636e33a123b78..93f785b493e90785c9e778ba852037645f494eb9 100644 --- a/ecmascript/mem/concurrent_sweeper.cpp +++ b/ecmascript/mem/concurrent_sweeper.cpp @@ -134,7 +134,7 @@ void ConcurrentSweeper::FinishSweeping(MemSpaceType type) space->FillSweptRegion(); } -bool ConcurrentSweeper::SweeperTask::Run(uint32_t threadIndex) +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++) { diff --git a/ecmascript/mem/heap.cpp b/ecmascript/mem/heap.cpp index ccfc8fa40430f11773feb1f1b107b7de00350053..974140464e7b982712040ab21cc0417b350e45be 100644 --- a/ecmascript/mem/heap.cpp +++ b/ecmascript/mem/heap.cpp @@ -602,7 +602,7 @@ bool Heap::ParallelGCTask::Run(uint32_t threadIndex) return true; } -bool Heap::AsyncClearTask::Run(uint32_t threadIndex) +bool Heap::AsyncClearTask::Run([[maybe_unused]] uint32_t threadIndex) { heap_->ReclaimRegions(gcType_); return true; diff --git a/ecmascript/mem/machine_code.h b/ecmascript/mem/machine_code.h index 73a3ab65531ef0ed6307d74aa16a5ca93b5baffb..dfb2ee8d71bb20bad946c47e1c20f99b357f7a7f 100644 --- a/ecmascript/mem/machine_code.h +++ b/ecmascript/mem/machine_code.h @@ -42,7 +42,7 @@ public: DECL_DUMP() - uintptr_t GetDataOffsetAddress(void) + uintptr_t GetDataOffsetAddress() { return reinterpret_cast(this) + DATA_OFFSET; } @@ -60,7 +60,7 @@ public: } } - void VisitRangeSlot(const EcmaObjectRangeVisitor &v) + void VisitRangeSlot([[maybe_unused]] const EcmaObjectRangeVisitor &v) { // left blank deliberately,only need to visit TaggedObject type object. } @@ -70,7 +70,7 @@ public: // left blank deliberately,only need to visit TaggedObject type object. } - size_t GetMachineCodeObjectSize(void) + size_t GetMachineCodeObjectSize() { return SIZE + this->GetInstructionSizeInBytes(); } diff --git a/ecmascript/mem/parallel_evacuation-inl.h b/ecmascript/mem/parallel_evacuation-inl.h index 1940b086de65b3c0c297e87f4a6784c23e5591b2..bf9683452ea2c8c87e7694f3e5ce4d00a6fe2b1f 100644 --- a/ecmascript/mem/parallel_evacuation-inl.h +++ b/ecmascript/mem/parallel_evacuation-inl.h @@ -84,7 +84,7 @@ bool ParallelEvacuation::UpdateWeakObjectSlot(TaggedObject *value, ObjectSlot &s void ParallelEvacuation::SetObjectFieldRSet(TaggedObject *object, JSHClass *cls) { Region *region = Region::ObjectAddressToRange(object); - auto callbackWithCSet = [region](TaggedObject *root, ObjectSlot start, ObjectSlot end) { + auto callbackWithCSet = [region]([[maybe_unused]] TaggedObject *root, ObjectSlot start, ObjectSlot end) { for (ObjectSlot slot = start; slot < end; slot++) { JSTaggedType value = slot.GetTaggedType(); if (JSTaggedValue(value).IsHeapObject()) { diff --git a/ecmascript/mem/parallel_evacuation.cpp b/ecmascript/mem/parallel_evacuation.cpp index d6f36ada0f1393bfc2f17f97bd22df295fb78a41..2526518e6e31c68af947c464dcc3a397f0154de7 100644 --- a/ecmascript/mem/parallel_evacuation.cpp +++ b/ecmascript/mem/parallel_evacuation.cpp @@ -148,7 +148,7 @@ void ParallelEvacuation::VerifyHeapObject(TaggedObject *object) { auto klass = object->GetClass(); objXRay_.VisitObjectBody(object, klass, - [&](TaggedObject *root, ObjectSlot start, ObjectSlot end) { + [&]([[maybe_unused]] TaggedObject *root, ObjectSlot start, ObjectSlot end) { for (ObjectSlot slot = start; slot < end; slot++) { JSTaggedValue value(slot.GetTaggedType()); if (value.IsHeapObject()) { @@ -373,7 +373,7 @@ void ParallelEvacuation::UpdateAndSweepNewRegionReference(Region *region) void ParallelEvacuation::UpdateNewObjectField(TaggedObject *object, JSHClass *cls) { objXRay_.VisitObjectBody(object, cls, - [this](TaggedObject *root, ObjectSlot start, ObjectSlot end) { + [this]([[maybe_unused]] TaggedObject *root, ObjectSlot start, ObjectSlot end) { for (ObjectSlot slot = start; slot < end; slot++) { UpdateObjectSlot(slot); } @@ -418,35 +418,35 @@ ParallelEvacuation::EvacuationTask::~EvacuationTask() delete allocator_; } -bool ParallelEvacuation::EvacuationTask::Run(uint32_t threadIndex) +bool ParallelEvacuation::EvacuationTask::Run([[maybe_unused]] uint32_t threadIndex) { return evacuation_->EvacuateSpace(allocator_); } -bool ParallelEvacuation::UpdateReferenceTask::Run(uint32_t threadIndex) +bool ParallelEvacuation::UpdateReferenceTask::Run([[maybe_unused]] uint32_t threadIndex) { evacuation_->ProcessFragments(false); return true; } -bool ParallelEvacuation::EvacuationFragment::Process(bool isMain) +bool ParallelEvacuation::EvacuationFragment::Process([[maybe_unused]] bool isMain) { return true; } -bool ParallelEvacuation::UpdateRSetFragment::Process(bool isMain) +bool ParallelEvacuation::UpdateRSetFragment::Process([[maybe_unused]] bool isMain) { GetEvacuation()->UpdateRSet(GetRegion()); return true; } -bool ParallelEvacuation::UpdateNewRegionFragment::Process(bool isMain) +bool ParallelEvacuation::UpdateNewRegionFragment::Process([[maybe_unused]] bool isMain) { GetEvacuation()->UpdateNewRegionReference(GetRegion()); return true; } -bool ParallelEvacuation::UpdateAndSweepNewRegionFragment::Process(bool isMain) +bool ParallelEvacuation::UpdateAndSweepNewRegionFragment::Process([[maybe_unused]] bool isMain) { GetEvacuation()->UpdateAndSweepNewRegionReference(GetRegion()); return true; diff --git a/ecmascript/mem/parallel_marker.cpp b/ecmascript/mem/parallel_marker.cpp index f898ecb19134d5c57d4cceb77c063195985693c4..993f18c426e2d2783d1a67a03c2e2c7ff5952fb4 100644 --- a/ecmascript/mem/parallel_marker.cpp +++ b/ecmascript/mem/parallel_marker.cpp @@ -127,7 +127,7 @@ void SemiGcMarker::ProcessMarkStack(uint32_t threadId) void CompressGcMarker::ProcessMarkStack(uint32_t threadId) { - auto visitor = [this, threadId](TaggedObject *root, ObjectSlot start, ObjectSlot end) { + auto visitor = [this, threadId]([[maybe_unused]] TaggedObject *root, ObjectSlot start, ObjectSlot end) { for (ObjectSlot slot = start; slot < end; slot++) { JSTaggedValue value(slot.GetTaggedType()); if (value.IsHeapObject()) { diff --git a/ecmascript/mem/parallel_marker.h b/ecmascript/mem/parallel_marker.h index b150a1ca2dc33fb7a8e97f35b6118f851a0ba86d..b941d86ba13100da9a5d1c60cd21a0c815b0e1c6 100644 --- a/ecmascript/mem/parallel_marker.h +++ b/ecmascript/mem/parallel_marker.h @@ -42,18 +42,20 @@ public: void ProcessOldToNew(uint32_t threadId, Region *region); // for SemiGC void ProcessSnapshotRSet(uint32_t threadId); // for SemiGC - virtual void ProcessMarkStack(uint32_t threadId) + virtual void ProcessMarkStack([[maybe_unused]] uint32_t threadId) { LOG(FATAL, ECMASCRIPT) << "can not call this method"; } protected: - virtual inline void MarkObject(uint32_t threadId, TaggedObject *object) // non move + // non move + virtual inline void MarkObject([[maybe_unused]] uint32_t threadId, [[maybe_unused]] TaggedObject *object) { LOG(FATAL, ECMASCRIPT) << "can not call this method"; } - virtual inline SlotStatus MarkObject(uint32_t threadId, TaggedObject *object, ObjectSlot slot) // move + virtual inline SlotStatus MarkObject([[maybe_unused]] uint32_t threadId, [[maybe_unused]] TaggedObject *object, + [[maybe_unused]] ObjectSlot slot) // move { LOG(FATAL, ECMASCRIPT) << "can not call this method"; return SlotStatus::KEEP_SLOT; @@ -63,7 +65,7 @@ protected: virtual inline void HandleRoots(uint32_t threadId, [[maybe_unused]] Root type, ObjectSlot slot) = 0; virtual inline void HandleRangeRoots(uint32_t threadId, [[maybe_unused]] Root type, ObjectSlot start, ObjectSlot end) = 0; - virtual inline void RecordWeakReference(uint32_t threadId, JSTaggedType *ref) + virtual inline void RecordWeakReference([[maybe_unused]] uint32_t threadId, [[maybe_unused]] JSTaggedType *ref) { LOG(FATAL, ECMASCRIPT) << "can not call this method"; } diff --git a/ecmascript/module/js_module_namespace.cpp b/ecmascript/module/js_module_namespace.cpp index 8fee8c4b4c5499a55dbb518c8d9665ecc899e8f0..b65d8c8bdaf70d6075503da3e2aa7b1a5e8c430e 100644 --- a/ecmascript/module/js_module_namespace.cpp +++ b/ecmascript/module/js_module_namespace.cpp @@ -126,8 +126,10 @@ bool ModuleNamespace::PreventExtensions() return true; } -bool ModuleNamespace::DefineOwnProperty(JSThread *thread, const JSHandle &obj, - const JSHandle &key, PropertyDescriptor desc) +bool ModuleNamespace::DefineOwnProperty([[maybe_unused]] JSThread *thread, + [[maybe_unused]] const JSHandle &obj, + [[maybe_unused]] const JSHandle &key, + [[maybe_unused]] PropertyDescriptor desc) { return false; } @@ -154,7 +156,7 @@ bool ModuleNamespace::HasProperty(JSThread *thread, const JSHandle &obj, +bool ModuleNamespace::SetPrototype([[maybe_unused]]const JSHandle &obj, const JSHandle &proto) { ASSERT(obj->IsModuleNamespace()); diff --git a/ecmascript/module/js_module_namespace.h b/ecmascript/module/js_module_namespace.h index 0cabdb3d0b8b934ab5604bce642e66f18eb0bf20..dbf07fdbf2d3a11f3540505a1a5d4476f60be619 100644 --- a/ecmascript/module/js_module_namespace.h +++ b/ecmascript/module/js_module_namespace.h @@ -28,7 +28,7 @@ public: static JSHandle ModuleNamespaceCreate(JSThread *thread, const JSHandle &module, const JSHandle &exports); // 9.4.6.1[[SetPrototypeOf]] - static bool SetPrototype(JSThread *thread, const JSHandle &obj, + static bool SetPrototype(const JSHandle &obj, const JSHandle &proto); // 9.4.6.2[[IsExtensible]] static bool IsExtensible(); diff --git a/ecmascript/napi/dfx_jsnapi.cpp b/ecmascript/napi/dfx_jsnapi.cpp index b996e5f858ac414ea7e1f62bdb39025f37a6efba..d5a39b48ba0bda54adc3d1ebb6cc467b54f37dc0 100644 --- a/ecmascript/napi/dfx_jsnapi.cpp +++ b/ecmascript/napi/dfx_jsnapi.cpp @@ -32,7 +32,7 @@ using ecmascript::GCStats; template using JSHandle = ecmascript::JSHandle; -void DFXJSNApi::DumpHeapSnapShot(EcmaVM *vm, int dumpFormat, const std::string &path, bool isVmMode) +void DFXJSNApi::DumpHeapSnapShot(EcmaVM *vm, int dumpFormat, const std::string &path, bool isVmMode) { if (dumpFormat == 0) { ecmascript::HeapProfilerInterface::DumpHeapSnapShot(vm->GetJSThread(), ecmascript::DumpFormat::JSON, @@ -62,19 +62,11 @@ bool DFXJSNApi::StartHeapTracking(EcmaVM *vm, double timeInterval, bool isVmMode return heapProfile->StartHeapTracking(vm->GetJSThread(), timeInterval, isVmMode); } -bool DFXJSNApi::StopHeapTracking(EcmaVM *vm, int dumpFormat, const std::string &filePath) +bool DFXJSNApi::StopHeapTracking(EcmaVM *vm, const std::string &filePath) { bool result = false; ecmascript::HeapProfilerInterface *heapProfile = ecmascript::HeapProfilerInterface::GetInstance(vm->GetJSThread()); - if (dumpFormat == 0) { - result = heapProfile->StopHeapTracking(vm->GetJSThread(), ecmascript::DumpFormat::JSON, filePath); - } - if (dumpFormat == 1) { - result = heapProfile->StopHeapTracking(vm->GetJSThread(), ecmascript::DumpFormat::BINARY, filePath); - } - if (dumpFormat == 2) { // 2: enum is 2 - result = heapProfile->StopHeapTracking(vm->GetJSThread(), ecmascript::DumpFormat::OTHER, filePath); - } + result = heapProfile->StopHeapTracking(vm->GetJSThread(), filePath); const ecmascript::Heap *heap = vm->GetJSThread()->GetEcmaVM()->GetHeap(); const_cast(heap->GetNativeAreaAllocator())->Delete(heapProfile); return result; diff --git a/ecmascript/napi/include/dfx_jsnapi.h b/ecmascript/napi/include/dfx_jsnapi.h index b7bbea631c4f8d169804aac6098294cddb9a26a2..b1ce058e6ee45fd30423ff26b7b48a8813bcb210 100644 --- a/ecmascript/napi/include/dfx_jsnapi.h +++ b/ecmascript/napi/include/dfx_jsnapi.h @@ -33,10 +33,10 @@ using EcmaVM = ecmascript::EcmaVM; class PUBLIC_API DFXJSNApi { public: - static void DumpHeapSnapShot(EcmaVM *vm, int dumpFormat, const std::string &path, bool isVmMode = true); + static void DumpHeapSnapShot(EcmaVM *vm, int dumpFormat, const std::string &path, bool isVmMode = true); static bool BuildNativeAndJsBackStackTrace(EcmaVM *vm, std::string &stackTraceStr); static bool StartHeapTracking(EcmaVM *vm, double timeInterval, bool isVmMode = true); - static bool StopHeapTracking(EcmaVM *vm, int dumpFormat, const std::string &filePath); + static bool StopHeapTracking(EcmaVM *vm, const std::string &filePath); static void PrintStatisticResult(const EcmaVM *vm); static void StartRuntimeStat(EcmaVM *vm); static void StopRuntimeStat(EcmaVM *vm); diff --git a/ecmascript/napi/jsnapi.cpp b/ecmascript/napi/jsnapi.cpp index 71269cb76c7f1f4a5f41fe5fd5075437235f2d60..358792512229b69a93bd7bd38fdf0298130d323e 100644 --- a/ecmascript/napi/jsnapi.cpp +++ b/ecmascript/napi/jsnapi.cpp @@ -1261,7 +1261,7 @@ Local ArrayBufferRef::New( return JSNApiHelper::ToLocal(JSHandle(arrayBuffer)); } -int32_t ArrayBufferRef::ByteLength(const EcmaVM *vm) +int32_t ArrayBufferRef::ByteLength([[maybe_unused]] const EcmaVM *vm) { JSHandle arrayBuffer(JSNApiHelper::ToJSHandle(this)); return arrayBuffer->GetArrayBufferByteLength(); @@ -1313,7 +1313,7 @@ Local DataViewRef::GetArrayBuffer(const EcmaVM *vm) // ---------------------------------- DataView ----------------------------------- // ---------------------------------- TypedArray ----------------------------------- -int32_t TypedArrayRef::ByteLength(const EcmaVM *vm) +int32_t TypedArrayRef::ByteLength([[maybe_unused]] const EcmaVM *vm) { JSHandle typedArray(JSNApiHelper::ToJSHandle(this)); JSTaggedValue length = typedArray->GetByteLength(); @@ -1323,7 +1323,7 @@ int32_t TypedArrayRef::ByteLength(const EcmaVM *vm) return length.GetNumber(); } -int32_t TypedArrayRef::ByteOffset(const EcmaVM *vm) +int32_t TypedArrayRef::ByteOffset([[maybe_unused]] const EcmaVM *vm) { JSHandle typedArray(JSNApiHelper::ToJSHandle(this)); JSTaggedValue length = typedArray->GetByteOffset(); @@ -1333,7 +1333,7 @@ int32_t TypedArrayRef::ByteOffset(const EcmaVM *vm) return length.GetNumber(); } -int32_t TypedArrayRef::ArrayLength(const EcmaVM *vm) +int32_t TypedArrayRef::ArrayLength([[maybe_unused]] const EcmaVM *vm) { JSHandle typedArray(JSNApiHelper::ToJSHandle(this)); JSTaggedValue length = typedArray->GetArrayLength(); diff --git a/ecmascript/object_factory.cpp b/ecmascript/object_factory.cpp index 1a288e0251b08dcb3849583454b4e0bec6acc971..e8a7abf42a190e835a3972b443b87e5ea19a810d 100644 --- a/ecmascript/object_factory.cpp +++ b/ecmascript/object_factory.cpp @@ -1242,7 +1242,7 @@ JSHandle ObjectFactory::NewJSSymbol() JSHandle ObjectFactory::NewPrivateSymbol() { JSHandle obj = NewJSSymbol(); - obj->SetPrivate(thread_); + obj->SetPrivate(); return obj; } @@ -1253,7 +1253,7 @@ JSHandle ObjectFactory::NewPrivateNameSymbol(const JSHandleGlobalConstants()->GetSymbolClass().GetTaggedObject())); JSHandle obj(thread_, JSSymbol::Cast(header)); obj->SetFlags(0); - obj->SetPrivateNameSymbol(thread_); + obj->SetPrivateNameSymbol(); obj->SetDescription(thread_, name); obj->SetHashField(SymbolTable::Hash(name.GetTaggedValue())); return obj; @@ -1266,7 +1266,7 @@ JSHandle ObjectFactory::NewWellKnownSymbol(const JSHandleGlobalConstants()->GetSymbolClass().GetTaggedObject())); JSHandle obj(thread_, JSSymbol::Cast(header)); obj->SetFlags(0); - obj->SetWellKnownSymbol(thread_); + obj->SetWellKnownSymbol(); obj->SetDescription(thread_, name); obj->SetHashField(SymbolTable::Hash(name.GetTaggedValue())); return obj; @@ -1288,7 +1288,7 @@ JSHandle ObjectFactory::NewSymbolWithTable(const JSHandle env = vm_->GetGlobalEnv(); JSHandle tableHandle(env->GetRegisterSymbols()); - if (tableHandle->ContainsKey(thread_, name.GetTaggedValue())) { + if (tableHandle->ContainsKey(name.GetTaggedValue())) { JSTaggedValue objValue = tableHandle->GetSymbol(name.GetTaggedValue()); return JSHandle(thread_, objValue); } @@ -2388,8 +2388,9 @@ JSHandle ObjectFactory::NewJSAPIArrayListIterator(const return iter; } -JSHandle ObjectFactory::CopyQueue(const JSHandle &old, [[maybe_unused]] uint32_t oldLength, - uint32_t newLength, uint32_t front, uint32_t tail) +JSHandle ObjectFactory::CopyQueue(const JSHandle &old, uint32_t oldLength, + uint32_t newLength, [[maybe_unused]] uint32_t front, + [[maybe_unused]] uint32_t tail) { NewObjectHook(); size_t size = TaggedArray::ComputeSize(JSTaggedValue::TaggedTypeSize(), newLength); diff --git a/ecmascript/snapshot/mem/snapshot.cpp b/ecmascript/snapshot/mem/snapshot.cpp index 206cb6e37370a084db53d714af5aedd893e6a1de..173ed23424e3af4c58686f146f17f9094bb895ea 100644 --- a/ecmascript/snapshot/mem/snapshot.cpp +++ b/ecmascript/snapshot/mem/snapshot.cpp @@ -59,11 +59,11 @@ void SnapShot::MakeSnapShotProgramObject(Program *program, const panda_file::Fil // handle GlobalEnvConstants auto constant = const_cast(vm_->GetJSThread()->GlobalConstants()); - constant->VisitRangeSlot([&objectQueue, &data](Root type, ObjectSlot start, ObjectSlot end) { + constant->VisitRangeSlot([&objectQueue, &data]([[maybe_unused]] Root type, ObjectSlot start, ObjectSlot end) { SerializeHelper::AddTaggedObjectRangeToData(start, end, &objectQueue, &data); }); - vm_->Iterate([&objectQueue, &data](Root type, ObjectSlot object) { + vm_->Iterate([&objectQueue, &data]([[maybe_unused]] Root type, ObjectSlot object) { SerializeHelper::AddObjectHeaderToData(object.GetTaggedObjectHeader(), &objectQueue, &data); }); diff --git a/ecmascript/stubs/runtime_stubs-inl.h b/ecmascript/stubs/runtime_stubs-inl.h index 84f67a1eb9ea32a7a96617f7a0e564d3b776df09..1002a90db2f60a40bdf5344b3638f014dc4207dc 100644 --- a/ecmascript/stubs/runtime_stubs-inl.h +++ b/ecmascript/stubs/runtime_stubs-inl.h @@ -27,7 +27,6 @@ #include "ecmascript/js_async_function.h" #include "ecmascript/js_for_in_iterator.h" #include "ecmascript/js_generator_object.h" -#include "ecmascript/js_invoker.h" #include "ecmascript/js_iterator.h" #include "ecmascript/js_promise.h" #include "ecmascript/module/js_module_manager.h" @@ -844,7 +843,7 @@ JSTaggedValue RuntimeStubs::RuntimeGetIterator(JSThread *thread, const JSHandle< JSHandle newTarget(thread, JSTaggedValue::Undefined()); InternalCallParams *params = thread->GetInternalCallParams(); params->MakeEmptyArgv(); - JSTaggedValue res = InvokeJsFunction(thread, JSHandle(valuesFunc), obj, newTarget, params); + JSTaggedValue res = EcmaInterpreter::Execute(thread, JSHandle(valuesFunc), obj, newTarget, params); return res; } @@ -1026,7 +1025,7 @@ JSTaggedValue RuntimeStubs::RuntimeGreaterEqDyn(JSThread *thread, const JSHandle return (ret ? JSTaggedValue::True() : JSTaggedValue::False()); } -JSTaggedValue RuntimeStubs::RuntimeAdd2Dyn(JSThread *thread, EcmaVM *ecma_vm, const JSHandle &left, +JSTaggedValue RuntimeStubs::RuntimeAdd2Dyn(JSThread *thread, const JSHandle &left, const JSHandle &right) { if (left->IsString() && right->IsString()) { @@ -1165,7 +1164,7 @@ JSTaggedValue RuntimeStubs::RuntimeMod2Dyn(JSThread *thread, const JSHandle globalEnv) { JSHandle builtinObj(globalEnv->GetObjectFunction()); @@ -1173,7 +1172,7 @@ JSTaggedValue RuntimeStubs::RuntimeCreateEmptyObject(JSThread *thread, ObjectFac return obj.GetTaggedValue(); } -JSTaggedValue RuntimeStubs::RuntimeCreateEmptyArray(JSThread *thread, ObjectFactory *factory, +JSTaggedValue RuntimeStubs::RuntimeCreateEmptyArray([[maybe_unused]] JSThread *thread, ObjectFactory *factory, JSHandle globalEnv) { JSHandle builtinObj(globalEnv->GetArrayFunction()); @@ -1452,7 +1451,7 @@ JSTaggedValue RuntimeStubs::RuntimeCallSpreadDyn(JSThread *thread, const JSHandl InternalCallParams *params = thread->GetInternalCallParams(); params->MakeArgList(*coretypesArray); JSHandle newTarget(thread, JSTaggedValue::Undefined()); - JSTaggedValue res = InvokeJsFunction(thread, jsFunc, obj, newTarget, params); + JSTaggedValue res = EcmaInterpreter::Execute(thread, jsFunc, obj, newTarget, params); return res; } diff --git a/ecmascript/stubs/runtime_stubs.cpp b/ecmascript/stubs/runtime_stubs.cpp index 8dd83a869ecbfd5013b8a7e8a1a8cac9197292c7..b78c161d5fcafb92965f4b1b488ed91d0201fff5 100644 --- a/ecmascript/stubs/runtime_stubs.cpp +++ b/ecmascript/stubs/runtime_stubs.cpp @@ -43,6 +43,14 @@ #include "ecmascript/ts_types/ts_loader.h" namespace panda::ecmascript { +#if defined(__clang__) +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wunused-parameter" +#elif defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif + #define DEF_RUNTIME_STUBS(name) \ JSTaggedType RuntimeStubs::name(uintptr_t argGlue, uint32_t argc, uintptr_t argv) \ @@ -1204,8 +1212,7 @@ DEF_RUNTIME_STUBS(Add2Dyn) RUNTIME_STUBS_HEADER(Add2Dyn); CONVERT_ARG_HANDLE_CHECKED(JSTaggedValue, left, 0); CONVERT_ARG_HANDLE_CHECKED(JSTaggedValue, right, 1); - EcmaVM *ecmaVm = thread->GetEcmaVM(); - return RuntimeAdd2Dyn(thread, ecmaVm, left, right).GetRawData(); + return RuntimeAdd2Dyn(thread, left, right).GetRawData(); } DEF_RUNTIME_STUBS(Sub2Dyn) @@ -1633,4 +1640,10 @@ void RuntimeStubs::Initialize(JSThread *thread) #undef INITIAL_RUNTIME_FUNCTIONS #undef DEF_RUNTIME_STUB } + +#if defined(__clang__) +#pragma clang diagnostic pop +#elif defined(__GNUC__) +#pragma GCC diagnostic pop +#endif } // namespace panda::ecmascript diff --git a/ecmascript/stubs/runtime_stubs.h b/ecmascript/stubs/runtime_stubs.h index 2584a8c7340d6899dadb5cbc3059674789ffabd6..4cf6d06086c5aa00efed112d97a95b34c0100096 100644 --- a/ecmascript/stubs/runtime_stubs.h +++ b/ecmascript/stubs/runtime_stubs.h @@ -343,7 +343,7 @@ private: const JSHandle &right); static inline JSTaggedValue RuntimeGreaterEqDyn(JSThread *thread, const JSHandle &left, const JSHandle &right); - static inline JSTaggedValue RuntimeAdd2Dyn(JSThread *thread, EcmaVM *ecma_vm, const JSHandle &left, + static inline JSTaggedValue RuntimeAdd2Dyn(JSThread *thread, const JSHandle &left, const JSHandle &right); static inline JSTaggedValue RuntimeSub2Dyn(JSThread *thread, const JSHandle &left, const JSHandle &right); diff --git a/ecmascript/symbol_table-inl.h b/ecmascript/symbol_table-inl.h index 2d95039ebd674f2e6264aefb589294da5a61f9f0..9af388e851a86cc7cc5eac550c97b039ee390aea 100644 --- a/ecmascript/symbol_table-inl.h +++ b/ecmascript/symbol_table-inl.h @@ -45,7 +45,7 @@ bool SymbolTable::IsMatch(const JSTaggedValue &name, const JSTaggedValue &other) return EcmaString::StringsAreEqual(nameString, otherString); } -bool SymbolTable::ContainsKey(JSThread *thread, const JSTaggedValue &key) +bool SymbolTable::ContainsKey(const JSTaggedValue &key) { int entry = FindEntry(key); return entry != -1; @@ -58,12 +58,12 @@ JSTaggedValue SymbolTable::GetSymbol(const JSTaggedValue &key) return GetValue(entry); } -JSTaggedValue SymbolTable::FindSymbol(JSThread *thread, const JSTaggedValue &value) +JSTaggedValue SymbolTable::FindSymbol(const JSTaggedValue &value) { JSSymbol *symbol = JSSymbol::Cast(value.GetTaggedObject()); JSTaggedValue des = symbol->GetDescription(); if (!des.IsUndefined()) { - if (ContainsKey(thread, des)) { + if (ContainsKey(des)) { return des; } } diff --git a/ecmascript/symbol_table.h b/ecmascript/symbol_table.h index 600ff65cf4c5956e0a3ad4c64952e80cc95ee09e..413f994f6c97b30532ce8d8f368a0901f987ef7c 100644 --- a/ecmascript/symbol_table.h +++ b/ecmascript/symbol_table.h @@ -53,11 +53,11 @@ public: return HashTable::Create(thread, numberOfElements); } - inline bool ContainsKey(JSThread *thread, const JSTaggedValue &key); + inline bool ContainsKey(const JSTaggedValue &key); inline JSTaggedValue GetSymbol(const JSTaggedValue &key); - inline JSTaggedValue FindSymbol(JSThread *thread, const JSTaggedValue &value); + inline JSTaggedValue FindSymbol(const JSTaggedValue &value); static constexpr int ENTRY_KEY_INDEX = 0; static constexpr int ENTRY_VALUE_INDEX = 1; static constexpr int ENTRY_SIZE = 2; diff --git a/ecmascript/tagged_array.h b/ecmascript/tagged_array.h index 374d6c70ebab2b808321e1a3ad963d94f36413b6..c2d4a85ef0e2434e735fa0b678f62f1287d994f5 100644 --- a/ecmascript/tagged_array.h +++ b/ecmascript/tagged_array.h @@ -77,7 +77,7 @@ public: inline void InitializeWithSpecialValue(JSTaggedValue initValue, uint32_t length); - static inline bool ShouldTrim(JSThread *thread, uint32_t oldLength, uint32_t newLength) + static inline bool ShouldTrim(uint32_t oldLength, uint32_t newLength) { return (oldLength - newLength > MAX_END_UNUSED); } diff --git a/ecmascript/tagged_hash_table-inl.h b/ecmascript/tagged_hash_table-inl.h index 4ec6691b932b639d8b72cd47efb62c18138978da..af748e69d76c760947d932ff10347cbb2be03ab0 100644 --- a/ecmascript/tagged_hash_table-inl.h +++ b/ecmascript/tagged_hash_table-inl.h @@ -399,7 +399,7 @@ JSHandle OrderTaggedHashTable::Put(const JSThread *thread, con } template -void TaggedHashTable::GetAllKeysIntoVector(const JSThread *thread, std::vector &vector) const +void TaggedHashTable::GetAllKeysIntoVector(std::vector &vector) const { int capacity = Size(); for (int hashIndex = 0; hashIndex < capacity; hashIndex++) { diff --git a/ecmascript/tagged_hash_table.h b/ecmascript/tagged_hash_table.h index 00ba61439639bc17ac548fe143aface90283990b..ee657d32b1f05d5a1387325925d3648f4d104ecd 100644 --- a/ecmascript/tagged_hash_table.h +++ b/ecmascript/tagged_hash_table.h @@ -60,7 +60,7 @@ public: inline void GetAllKeys(const JSThread *thread, int offset, TaggedArray *keyArray) const; - inline void GetAllKeysIntoVector(const JSThread *thread, std::vector &vector) const; + inline void GetAllKeysIntoVector(std::vector &vector) const; inline void Swap(const JSThread *thread, int src, int dst); diff --git a/ecmascript/tagged_tree.cpp b/ecmascript/tagged_tree.cpp index 3d01c603f171b69b6a93bddde5e18d74030cc77f..5f11157fa79003acb5ad477b79ad69ec675c5921 100644 --- a/ecmascript/tagged_tree.cpp +++ b/ecmascript/tagged_tree.cpp @@ -499,7 +499,7 @@ JSTaggedValue TaggedTreeMap::Delete(JSThread *thread, const JSHandle class##ClassName = \ factory->NewEcmaDynClass(ClassName::SIZE, JSType::TypeName, proto); \ JSHandle object##ClassName = factory->NewJSObject(class##ClassName); \ object##ClassName.GetTaggedValue().D(); \ - object##ClassName.GetTaggedValue().DumpForSnapshot(thread, snapshotVector); + object##ClassName.GetTaggedValue().DumpForSnapshot(snapshotVector); for (JSType type = JSType::JS_OBJECT; type <= JSType::TYPE_LAST; type = JSType(static_cast(type) + 1)) { switch (type) { diff --git a/ecmascript/tests/js_array_iterator_test.cpp b/ecmascript/tests/js_array_iterator_test.cpp index 0866467c0c564636b8d52e59c71444493374908f..c93950a9551389949bd7dc322c2592710d280019 100644 --- a/ecmascript/tests/js_array_iterator_test.cpp +++ b/ecmascript/tests/js_array_iterator_test.cpp @@ -84,7 +84,7 @@ HWTEST_F_L0(JSArrayIteratorTest, SetIteratedArray) EXPECT_EQ(handleJSArrayTo1->GetArrayLength(), static_cast(numArrayFrom1)); for (int i = 0; i < numArrayFrom1; i++) { EXPECT_EQ(JSArray::FastGetPropertyByValue(thread, JSHandle(handleJSArrayTo1), i)->GetNumber(), - static_cast(arrayFrom1[i])); + static_cast(arrayFrom1[i])); } // Call "SetIteratedArray" function in this HWTEST_F_L0. diff --git a/ecmascript/tests/js_array_test.cpp b/ecmascript/tests/js_array_test.cpp index 8acf52fc86ae633ab8e9f19f3bf5454c73ddb520..927f10877100113ec8c73d5babc398c6f15cb57f 100644 --- a/ecmascript/tests/js_array_test.cpp +++ b/ecmascript/tests/js_array_test.cpp @@ -174,17 +174,17 @@ HWTEST_F_L0(JSArrayTest, Iterator) 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(static_cast(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(static_cast(i), JSObject::GetProperty(thread, iter_value, index_key).GetValue()->GetInt()); EXPECT_EQ(JSTaggedValue::Undefined(), 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(static_cast(i), JSIterator::IteratorValue(thread, key_result)->GetInt()); + EXPECT_EQ(static_cast(i), JSIterator::IteratorValue(thread, value_result)->GetInt()); + EXPECT_EQ(static_cast(i), JSObject::GetProperty(thread, iter_value, index_key).GetValue()->GetInt()); + EXPECT_EQ(static_cast(i), JSObject::GetProperty(thread, iter_value, element_key).GetValue()->GetInt()); } } } // namespace panda::test diff --git a/ecmascript/tests/js_typed_array_test.cpp b/ecmascript/tests/js_typed_array_test.cpp index 606e84430a7dd7fb7a24a3a21291709938a4c00b..687132a6608c74de9505c0af984c7c27fa63ae43 100644 --- a/ecmascript/tests/js_typed_array_test.cpp +++ b/ecmascript/tests/js_typed_array_test.cpp @@ -119,8 +119,8 @@ HWTEST_F_L0(JSTypedArrayTest, ToPropKey_001) JSHandle hnadleTagValEcmaStrPropKeyTo2 = JSTypedArray::ToPropKey(thread, handleHole); JSHandle handleEcmaStrPropKeyTo1 = JSHandle::Cast(hnadleTagValEcmaStrPropKeyTo1); JSHandle handleEcmaStrPropKeyTo2 = JSHandle::Cast(hnadleTagValEcmaStrPropKeyTo2); - EXPECT_NE(0, sizeof(handleUndefined)); - EXPECT_NE(0, sizeof(handleHole)); + EXPECT_NE(0U, sizeof(handleUndefined)); + EXPECT_NE(0U, sizeof(handleHole)); std::unique_ptr uniCharArrTo1(handleEcmaStrPropKeyTo1->GetCString()); std::unique_ptr uniCharArrTo2(handleEcmaStrPropKeyTo2->GetCString()); EXPECT_EQ(uniCharArrTo1[0], 'u'); @@ -244,7 +244,7 @@ HWTEST_F_L0(JSTypedArrayTest, SetViewedArrayBuffer) JSHandle handleArrayBufferFrom = factory->NewJSArrayBuffer(10); JSHandle handleTagValArrayBufferFrom = JSHandle::Cast(handleArrayBufferFrom); - for (int i = 0; i < cVecJSType.size(); i++) { + for (size_t i = 0; i < cVecJSType.size(); i++) { JSHandle handleTypedArray = CreateNumberTypedArray(thread, cVecJSType.at(i)); EXPECT_EQ(handleTypedArray->GetViewedArrayBuffer(), JSTaggedValue::Undefined()); @@ -268,7 +268,7 @@ HWTEST_F_L0(JSTypedArrayTest, SetTypedArrayName) JSHandle handleEcmaStrNameFrom = factory->NewFromString(cStrName); JSHandle handleTagValEcmaStrNameFrom = JSHandle::Cast(handleEcmaStrNameFrom); - for (int i = 0; i < cVecJSType.size(); i++) { + for (size_t i = 0; i < cVecJSType.size(); i++) { JSHandle handleTypedArray = CreateNumberTypedArray(thread, cVecJSType.at(i)); EXPECT_EQ(handleTypedArray->GetTypedArrayName(), JSTaggedValue::Undefined()); @@ -290,7 +290,7 @@ HWTEST_F_L0(JSTypedArrayTest, SetByteLength) uint32_t u32ByteLength = 2; JSHandle handleTagValByteLengthFrom(thread, JSTaggedValue(u32ByteLength)); - for (int i = 0; i < cVecJSType.size(); i++) { + for (size_t i = 0; i < cVecJSType.size(); i++) { JSHandle handleTypedArray = CreateNumberTypedArray(thread, cVecJSType.at(i)); EXPECT_EQ(handleTypedArray->GetByteLength(), JSTaggedValue(0)); @@ -312,7 +312,7 @@ HWTEST_F_L0(JSTypedArrayTest, SetByteOffset) uint32_t u32ByteOffset = 2; JSHandle handleTagValByteOffsetFrom(thread, JSTaggedValue(u32ByteOffset)); - for (int i = 0; i < cVecJSType.size(); i++) { + for (size_t i = 0; i < cVecJSType.size(); i++) { JSHandle handleTypedArray = CreateNumberTypedArray(thread, cVecJSType.at(i)); EXPECT_EQ(handleTypedArray->GetByteOffset(), JSTaggedValue(0)); @@ -334,7 +334,7 @@ HWTEST_F_L0(JSTypedArrayTest, SetArrayLength) uint32_t u32ArrayLength = 2; JSHandle handleTagValArrayLengthFrom(thread, JSTaggedValue(u32ArrayLength)); - for (int i = 0; i < cVecJSType.size(); i++) { + for (size_t i = 0; i < cVecJSType.size(); i++) { JSHandle handleTypedArray = CreateNumberTypedArray(thread, cVecJSType.at(i)); EXPECT_EQ(handleTypedArray->GetArrayLength(), JSTaggedValue(0)); @@ -353,7 +353,7 @@ HWTEST_F_L0(JSTypedArrayTest, SetArrayLength) */ HWTEST_F_L0(JSTypedArrayTest, IntegerIndexedElementSet_Int8Array_001) { - uint32_t numElementsInt8Array = 256; + int numElementsInt8Array = 256; ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); JSHandle handleInt8Array = CreateNumberTypedArray(thread, JSType::JS_INT8_ARRAY); JSHandle handleTagValInt8Array = JSHandle::Cast(handleInt8Array); @@ -367,14 +367,14 @@ HWTEST_F_L0(JSTypedArrayTest, IntegerIndexedElementSet_Int8Array_001) handleInt8Array->SetArrayLength(thread, JSTaggedValue(numElementsInt8Array)); CVector cVecOpResult = {}; - for (int32_t i = 0; i < numElementsInt8Array; i++) { + for (int i = 0; i < numElementsInt8Array; i++) { EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread, handleTagValInt8Array, JSTaggedValue(i), JSHandle(thread, JSTaggedValue(std::numeric_limits::min() + i)))); OperationResult opResult = JSTypedArray::IntegerIndexedElementGet(thread, handleTagValInt8Array, JSTaggedValue(i)); cVecOpResult.push_back(opResult); } - for (int32_t i = 0; i < numElementsInt8Array; i++) { + for (int i = 0; i < numElementsInt8Array; i++) { EXPECT_EQ(cVecOpResult.at(i).GetValue().GetTaggedValue().GetNumber(), std::numeric_limits::min() + i); } cVecOpResult.clear(); @@ -401,7 +401,7 @@ HWTEST_F_L0(JSTypedArrayTest, IntegerIndexedElementSet_Int8Array_001) // Nonstandard input value for Int8Array HWTEST_F_L0(JSTypedArrayTest, IntegerIndexedElementSet_Int8Array_002) { - uint32_t numElementsInt8Array = 16; + int numElementsInt8Array = 16; ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); JSHandle handleInt8Array = CreateNumberTypedArray(thread, JSType::JS_INT8_ARRAY); JSHandle handleTagValInt8Array = JSHandle::Cast(handleInt8Array); @@ -452,7 +452,7 @@ HWTEST_F_L0(JSTypedArrayTest, IntegerIndexedElementSet_Int8Array_002) HWTEST_F_L0(JSTypedArrayTest, IntegerIndexedElementSet_Uint8Array_001) { - uint32_t numElementsUint8Array = 256; + int numElementsUint8Array = 256; ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); JSHandle handleUint8Array = CreateNumberTypedArray(thread, JSType::JS_UINT8_ARRAY); JSHandle handleTagValUint8Array = JSHandle::Cast(handleUint8Array); @@ -466,14 +466,14 @@ HWTEST_F_L0(JSTypedArrayTest, IntegerIndexedElementSet_Uint8Array_001) handleUint8Array->SetArrayLength(thread, JSTaggedValue(numElementsUint8Array)); CVector cVecOpResult = {}; - for (uint32_t i = 0; i < numElementsUint8Array; i++) { + for (int i = 0; i < numElementsUint8Array; i++) { EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread, handleTagValUint8Array, JSTaggedValue(i), JSHandle(thread, JSTaggedValue(std::numeric_limits::min() + i)))); OperationResult opResult = JSTypedArray::IntegerIndexedElementGet(thread, handleTagValUint8Array, JSTaggedValue(i)); cVecOpResult.push_back(opResult); } - for (uint32_t i = 0; i < numElementsUint8Array; i++) { + for (int i = 0; i < numElementsUint8Array; i++) { EXPECT_EQ(cVecOpResult.at(i).GetValue().GetTaggedValue().GetNumber(), std::numeric_limits::min() + i); } cVecOpResult.clear(); @@ -500,7 +500,7 @@ HWTEST_F_L0(JSTypedArrayTest, IntegerIndexedElementSet_Uint8Array_001) // Nonstandard input value for Uint8Array HWTEST_F_L0(JSTypedArrayTest, IntegerIndexedElementSet_Uint8Array_002) { - uint32_t numElementsUint8Array = 16; + int numElementsUint8Array = 16; ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); JSHandle handleUint8Array = CreateNumberTypedArray(thread, JSType::JS_UINT8_ARRAY); JSHandle handleTagValUint8Array = JSHandle::Cast(handleUint8Array); @@ -551,7 +551,7 @@ HWTEST_F_L0(JSTypedArrayTest, IntegerIndexedElementSet_Uint8Array_002) HWTEST_F_L0(JSTypedArrayTest, IntegerIndexedElementSet_Uint8ClampedArray_001) { - uint32_t numElementsUint8ClampedArray = 256; + int numElementsUint8ClampedArray = 256; ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); JSHandle handleUint8ClampedArray = CreateNumberTypedArray(thread, JSType::JS_UINT8_CLAMPED_ARRAY); JSHandle handleTagValUint8ClampedArray = JSHandle::Cast(handleUint8ClampedArray); @@ -565,14 +565,14 @@ HWTEST_F_L0(JSTypedArrayTest, IntegerIndexedElementSet_Uint8ClampedArray_001) handleUint8ClampedArray->SetArrayLength(thread, JSTaggedValue(numElementsUint8ClampedArray)); CVector cVecOpResult = {}; - for (uint32_t i = 0; i < numElementsUint8ClampedArray; i++) { + for (int i = 0; i < numElementsUint8ClampedArray; i++) { EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread, handleTagValUint8ClampedArray, JSTaggedValue(i), JSHandle(thread, JSTaggedValue(std::numeric_limits::min() + i)))); OperationResult opResult = JSTypedArray::IntegerIndexedElementGet(thread, handleTagValUint8ClampedArray, JSTaggedValue(i)); cVecOpResult.push_back(opResult); } - for (uint32_t i = 0; i < numElementsUint8ClampedArray; i++) { + for (int i = 0; i < numElementsUint8ClampedArray; i++) { EXPECT_EQ(cVecOpResult.at(i).GetValue().GetTaggedValue().GetNumber(), std::numeric_limits::min() + i); } cVecOpResult.clear(); @@ -599,7 +599,7 @@ HWTEST_F_L0(JSTypedArrayTest, IntegerIndexedElementSet_Uint8ClampedArray_001) // Nonstandard input value for Uint8ClampedArray HWTEST_F_L0(JSTypedArrayTest, IntegerIndexedElementSet_Uint8ClampedArray_002) { - uint32_t numElementsUint8ClampedArray = 16; + int numElementsUint8ClampedArray = 16; ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); JSHandle handleUint8ClampedArray = CreateNumberTypedArray(thread, JSType::JS_UINT8_CLAMPED_ARRAY); JSHandle handleTagValUint8ClampedArray = JSHandle::Cast(handleUint8ClampedArray); @@ -650,7 +650,7 @@ HWTEST_F_L0(JSTypedArrayTest, IntegerIndexedElementSet_Uint8ClampedArray_002) HWTEST_F_L0(JSTypedArrayTest, IntegerIndexedElementSet_Int16Array_001) { - uint32_t numElementsInt16Array = 100; + int numElementsInt16Array = 100; int16_t scaleForInt16ValueSet = 100; ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); JSHandle handleInt16Array = CreateNumberTypedArray(thread, JSType::JS_INT16_ARRAY); @@ -665,7 +665,7 @@ HWTEST_F_L0(JSTypedArrayTest, IntegerIndexedElementSet_Int16Array_001) handleInt16Array->SetArrayLength(thread, JSTaggedValue(numElementsInt16Array)); CVector cVecOpResult = {}; - for (int32_t i = 0; i < numElementsInt16Array; i++) { + for (int i = 0; i < numElementsInt16Array; i++) { EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread, handleTagValInt16Array, JSTaggedValue(i), JSHandle(thread, JSTaggedValue(std::numeric_limits::min() + i * scaleForInt16ValueSet)))); @@ -673,7 +673,7 @@ HWTEST_F_L0(JSTypedArrayTest, IntegerIndexedElementSet_Int16Array_001) JSTaggedValue(i)); cVecOpResult.push_back(opResult); } - for (int32_t i = 0; i < numElementsInt16Array; i++) { + for (int i = 0; i < numElementsInt16Array; i++) { EXPECT_EQ(cVecOpResult.at(i).GetValue().GetTaggedValue().GetNumber(), std::numeric_limits::min() + i * scaleForInt16ValueSet); } @@ -701,7 +701,7 @@ HWTEST_F_L0(JSTypedArrayTest, IntegerIndexedElementSet_Int16Array_001) // Nonstandard input value for Int16Array HWTEST_F_L0(JSTypedArrayTest, IntegerIndexedElementSet_Int16Array_002) { - uint32_t numElementsInt16Array = 16; + int numElementsInt16Array = 16; ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); JSHandle handleInt16Array = CreateNumberTypedArray(thread, JSType::JS_INT16_ARRAY); JSHandle handleTagValInt16Array = JSHandle::Cast(handleInt16Array); @@ -752,7 +752,7 @@ HWTEST_F_L0(JSTypedArrayTest, IntegerIndexedElementSet_Int16Array_002) HWTEST_F_L0(JSTypedArrayTest, IntegerIndexedElementSet_Uint16Array_001) { - uint32_t numElementsUint16Array = 100; + int numElementsUint16Array = 100; uint32_t scaleForUint16ValueSet = 100; ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); JSHandle handleUint16Array = CreateNumberTypedArray(thread, JSType::JS_UINT16_ARRAY); @@ -767,7 +767,7 @@ HWTEST_F_L0(JSTypedArrayTest, IntegerIndexedElementSet_Uint16Array_001) handleUint16Array->SetArrayLength(thread, JSTaggedValue(numElementsUint16Array)); CVector cVecOpResult = {}; - for (uint32_t i = 0; i < numElementsUint16Array; i++) { + for (int i = 0; i < numElementsUint16Array; i++) { EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread, handleTagValUint16Array, JSTaggedValue(i), JSHandle(thread, JSTaggedValue(std::numeric_limits::min() + i * scaleForUint16ValueSet)))); @@ -775,7 +775,7 @@ HWTEST_F_L0(JSTypedArrayTest, IntegerIndexedElementSet_Uint16Array_001) JSTaggedValue(i)); cVecOpResult.push_back(opResult); } - for (uint32_t i = 0; i < numElementsUint16Array; i++) { + for (int i = 0; i < numElementsUint16Array; i++) { EXPECT_EQ(cVecOpResult.at(i).GetValue().GetTaggedValue().GetNumber(), std::numeric_limits::min() + i * scaleForUint16ValueSet); } @@ -803,7 +803,7 @@ HWTEST_F_L0(JSTypedArrayTest, IntegerIndexedElementSet_Uint16Array_001) // Nonstandard input value for Uint16Array HWTEST_F_L0(JSTypedArrayTest, IntegerIndexedElementSet_Uint16Array_002) { - uint32_t numElementsUint16Array = 16; + int numElementsUint16Array = 16; ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); JSHandle handleUint16Array = CreateNumberTypedArray(thread, JSType::JS_UINT16_ARRAY); JSHandle handleTagValUint16Array = JSHandle::Cast(handleUint16Array); @@ -854,7 +854,7 @@ HWTEST_F_L0(JSTypedArrayTest, IntegerIndexedElementSet_Uint16Array_002) HWTEST_F_L0(JSTypedArrayTest, IntegerIndexedElementSet_Int32Array_001) { - uint32_t numElementsInt32Array = 100; + int numElementsInt32Array = 100; int32_t scaleForInt32ValueSet = 100000; ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); JSHandle handleInt32Array = CreateNumberTypedArray(thread, JSType::JS_INT32_ARRAY); @@ -869,7 +869,7 @@ HWTEST_F_L0(JSTypedArrayTest, IntegerIndexedElementSet_Int32Array_001) handleInt32Array->SetArrayLength(thread, JSTaggedValue(numElementsInt32Array)); CVector cVecOpResult = {}; - for (int32_t i = 0; i < numElementsInt32Array; i++) { + for (int i = 0; i < numElementsInt32Array; i++) { EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread, handleTagValInt32Array, JSTaggedValue(i), JSHandle(thread, JSTaggedValue(std::numeric_limits::min() + i * scaleForInt32ValueSet)))); @@ -877,7 +877,7 @@ HWTEST_F_L0(JSTypedArrayTest, IntegerIndexedElementSet_Int32Array_001) JSTaggedValue(i)); cVecOpResult.push_back(opResult); } - for (int32_t i = 0; i < numElementsInt32Array; i++) { + for (int i = 0; i < numElementsInt32Array; i++) { EXPECT_EQ(cVecOpResult.at(i).GetValue().GetTaggedValue().GetNumber(), std::numeric_limits::min() + i * scaleForInt32ValueSet); } @@ -905,7 +905,7 @@ HWTEST_F_L0(JSTypedArrayTest, IntegerIndexedElementSet_Int32Array_001) // Nonstandard input value for Int32Array HWTEST_F_L0(JSTypedArrayTest, IntegerIndexedElementSet_Int32Array_002) { - uint32_t numElementsInt32Array = 16; + int numElementsInt32Array = 16; ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); JSHandle handleInt32Array = CreateNumberTypedArray(thread, JSType::JS_INT32_ARRAY); JSHandle handleTagValInt32Array = JSHandle::Cast(handleInt32Array); @@ -956,7 +956,7 @@ HWTEST_F_L0(JSTypedArrayTest, IntegerIndexedElementSet_Int32Array_002) HWTEST_F_L0(JSTypedArrayTest, IntegerIndexedElementSet_Uint32Array_001) { - uint32_t numElementsUint32Array = 100; + int numElementsUint32Array = 100; uint32_t scaleForUint32ValueSet = 100000; ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); JSHandle handleUint32Array = CreateNumberTypedArray(thread, JSType::JS_UINT32_ARRAY); @@ -971,7 +971,7 @@ HWTEST_F_L0(JSTypedArrayTest, IntegerIndexedElementSet_Uint32Array_001) handleUint32Array->SetArrayLength(thread, JSTaggedValue(numElementsUint32Array)); CVector cVecOpResult = {}; - for (uint32_t i = 0; i < numElementsUint32Array; i++) { + for (int i = 0; i < numElementsUint32Array; i++) { EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread, handleTagValUint32Array, JSTaggedValue(i), JSHandle(thread, JSTaggedValue(std::numeric_limits::min() + i * scaleForUint32ValueSet)))); @@ -979,7 +979,7 @@ HWTEST_F_L0(JSTypedArrayTest, IntegerIndexedElementSet_Uint32Array_001) JSTaggedValue(i)); cVecOpResult.push_back(opResult); } - for (uint32_t i = 0; i < numElementsUint32Array; i++) { + for (int i = 0; i < numElementsUint32Array; i++) { EXPECT_EQ(cVecOpResult.at(i).GetValue().GetTaggedValue().GetNumber(), std::numeric_limits::min() + i * scaleForUint32ValueSet); } @@ -1058,7 +1058,7 @@ HWTEST_F_L0(JSTypedArrayTest, IntegerIndexedElementSet_Uint32Array_002) HWTEST_F_L0(JSTypedArrayTest, IntegerIndexedElementSet_Float32Array) { - uint32_t numElementsFloat32Array = 100; + int numElementsFloat32Array = 100; ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); JSHandle handleFloat32Array = CreateNumberTypedArray(thread, JSType::JS_FLOAT32_ARRAY); JSHandle handleTagValFloat32Array = JSHandle::Cast(handleFloat32Array); @@ -1073,7 +1073,7 @@ HWTEST_F_L0(JSTypedArrayTest, IntegerIndexedElementSet_Float32Array) CVector cVecOpResult = {}; float floatMaxValue = std::numeric_limits::max(); - for (uint32_t i = 0; i < numElementsFloat32Array; i++) { + for (int i = 0; i < numElementsFloat32Array; i++) { EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread, handleTagValFloat32Array, JSTaggedValue(i), JSHandle(thread, JSTaggedValue(floatMaxValue - (i * (floatMaxValue / numElementsFloat32Array)))))); @@ -1081,7 +1081,7 @@ HWTEST_F_L0(JSTypedArrayTest, IntegerIndexedElementSet_Float32Array) JSTaggedValue(i)); cVecOpResult.push_back(opResult); } - for (uint32_t i = 0; i < numElementsFloat32Array; i++) { + for (int i = 0; i < numElementsFloat32Array; i++) { EXPECT_EQ(cVecOpResult.at(i).GetValue().GetTaggedValue().GetNumber(), floatMaxValue - (i * (floatMaxValue / numElementsFloat32Array))); } @@ -1108,7 +1108,7 @@ HWTEST_F_L0(JSTypedArrayTest, IntegerIndexedElementSet_Float32Array) HWTEST_F_L0(JSTypedArrayTest, IntegerIndexedElementSet_Float64Array) { - uint32_t numElementsFloat64Array = 100; + int numElementsFloat64Array = 100; ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); JSHandle handleFloat64Array = CreateNumberTypedArray(thread, JSType::JS_FLOAT64_ARRAY); JSHandle handleTagValFloat64Array = JSHandle::Cast(handleFloat64Array); @@ -1123,7 +1123,7 @@ HWTEST_F_L0(JSTypedArrayTest, IntegerIndexedElementSet_Float64Array) CVector cVecOpResult = {}; double doubleMaxValue = std::numeric_limits::max(); - for (uint32_t i = 0; i < numElementsFloat64Array; i++) { + for (int i = 0; i < numElementsFloat64Array; i++) { EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread, handleTagValFloat64Array, JSTaggedValue(i), JSHandle(thread, JSTaggedValue( doubleMaxValue - (i * (doubleMaxValue / numElementsFloat64Array)))))); @@ -1131,7 +1131,7 @@ HWTEST_F_L0(JSTypedArrayTest, IntegerIndexedElementSet_Float64Array) JSTaggedValue(i)); cVecOpResult.push_back(opResult); } - for (uint32_t i = 0; i < numElementsFloat64Array; i++) { + for (int i = 0; i < numElementsFloat64Array; i++) { EXPECT_EQ(cVecOpResult.at(i).GetValue().GetTaggedValue().GetNumber(), doubleMaxValue - (i * (doubleMaxValue / numElementsFloat64Array))); } @@ -1169,7 +1169,7 @@ HWTEST_F_L0(JSTypedArrayTest, FastElementGet_TypedArray) ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); for (uint32_t j = 0; j < cVecJSType.size(); j++) { - uint32_t numElementsTypedArray = 10; + int numElementsTypedArray = 10; JSHandle handleTypedArray = CreateNumberTypedArray(thread, cVecJSType.at(j)); JSHandle handleTagValTypedArray = JSHandle::Cast(handleTypedArray); @@ -1182,11 +1182,11 @@ HWTEST_F_L0(JSTypedArrayTest, FastElementGet_TypedArray) handleTypedArray->SetArrayLength(thread, JSTaggedValue(numElementsTypedArray)); JSHandle handleTagValValueSet(thread, JSTaggedValue(cVecHandleTagValValueForTypedArray.at(j))); - for (uint32_t i = 0; i < numElementsTypedArray; i++) { + for (int i = 0; i < numElementsTypedArray; i++) { EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread, handleTagValTypedArray, JSTaggedValue(i), handleTagValValueSet)); } - for (uint32_t i = 0; i < numElementsTypedArray; i++) { + for (int i = 0; i < numElementsTypedArray; i++) { OperationResult opResult = JSTypedArray::FastElementGet(thread, handleTagValTypedArray, i); EXPECT_EQ(opResult.GetValue().GetTaggedValue().GetNumber(), handleTagValValueSet.GetTaggedValue().GetNumber()); @@ -1215,8 +1215,8 @@ HWTEST_F_L0(JSTypedArrayTest, DefineOwnProperty_TypedArray) { ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - for (int j = 0; j < cVecJSType.size(); j++) { - int32_t numElementsTypedArray = 10; + for (size_t j = 0; j < cVecJSType.size(); j++) { + int numElementsTypedArray = 10; JSHandle handleTagValValueDef(thread, cVecHandleTagValValueForTypedArray.at(j)); PropertyDescriptor descFrom1(thread, handleTagValValueDef, true, true, true); JSHandle handleTypedArray = CreateNumberTypedArray(thread, cVecJSType.at(j)); @@ -1230,7 +1230,7 @@ HWTEST_F_L0(JSTypedArrayTest, DefineOwnProperty_TypedArray) handleTypedArray->SetViewedArrayBuffer(thread, handleTagValArrayBufferFrom); handleTypedArray->SetArrayLength(thread, JSTaggedValue(numElementsTypedArray)); - for (uint32_t i = 0; i < numElementsTypedArray; i++) { + for (int 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)); @@ -1263,8 +1263,8 @@ HWTEST_F_L0(JSTypedArrayTest, SetProperty_TypedArray) { ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - for (int j = 0; j < cVecJSType.size(); j++) { - int32_t numElementsTypedArray = 10; + for (size_t j = 0; j < cVecJSType.size(); j++) { + int numElementsTypedArray = 10; JSHandle handleTagValValueSet(thread, cVecHandleTagValValueForTypedArray.at(j)); JSHandle handleTypedArray = CreateNumberTypedArray(thread, cVecJSType.at(j)); JSHandle handleTagValTypedArray = JSHandle::Cast(handleTypedArray); @@ -1277,7 +1277,7 @@ HWTEST_F_L0(JSTypedArrayTest, SetProperty_TypedArray) handleTypedArray->SetViewedArrayBuffer(thread, handleTagValArrayBufferFrom); handleTypedArray->SetArrayLength(thread, JSTaggedValue(numElementsTypedArray)); - for (uint32_t i = 0; i < numElementsTypedArray; i++) { + for (int i = 0; i < numElementsTypedArray; i++) { JSHandle handleTagValKey(thread, JSTaggedValue(i)); EXPECT_FALSE(JSTypedArray::HasProperty(thread, handleTagValTypedArray, handleTagValKey)); EXPECT_TRUE(JSTypedArray::SetProperty(thread, handleTagValTypedArray, handleTagValKey, @@ -1304,8 +1304,8 @@ HWTEST_F_L0(JSTypedArrayTest, FastCopyElementToArray_TypedArray) { ObjectFactory *factory = thread->GetEcmaVM()->GetFactory(); - for (int j = 0; j < cVecJSType.size(); j++) { - int32_t numElementsTypedArray = 10; + for (size_t j = 0; j < cVecJSType.size(); j++) { + int numElementsTypedArray = 10; JSHandle handleTagValValueSet(thread, cVecHandleTagValValueForTypedArray.at(j)); JSHandle handleTypedArrayFrom = CreateNumberTypedArray(thread, cVecJSType.at(j)); @@ -1320,12 +1320,12 @@ HWTEST_F_L0(JSTypedArrayTest, FastCopyElementToArray_TypedArray) handleTypedArrayFrom->SetViewedArrayBuffer(thread, handleTagValArrayBuffer); handleTypedArrayFrom->SetArrayLength(thread, JSTaggedValue(numElementsTypedArray)); - for (uint32_t i = 0; i < numElementsTypedArray; i++) { + for (int i = 0; i < numElementsTypedArray; i++) { EXPECT_TRUE(JSTypedArray::IntegerIndexedElementSet(thread, handleTagValTypedArrayFrom, JSTaggedValue(i), handleTagValValueSet)); } EXPECT_TRUE(JSTypedArray::FastCopyElementToArray(thread, handleTagValTypedArrayFrom, handleTagArrTo)); - for (uint32_t i = 0; i < numElementsTypedArray; i++) { + for (int i = 0; i < numElementsTypedArray; i++) { EXPECT_EQ(handleTagArrTo->Get(i), handleTagValValueSet.GetTaggedValue()); } } diff --git a/ecmascript/tests/js_verification_test.cpp b/ecmascript/tests/js_verification_test.cpp index 50020a797236a60a104ce5b993dca3f19a5afb90..96cd1fcc3bceed721b97ea626cecf6839860aabd 100644 --- a/ecmascript/tests/js_verification_test.cpp +++ b/ecmascript/tests/js_verification_test.cpp @@ -64,7 +64,7 @@ HWTEST_F_L0(JSVerificationTest, ContainObject) auto objectFactory = ecmaVm->GetFactory(); auto verifier = Verification(heap); - auto funcVerify = [](TaggedObject *object, Verification &v, const Heap *heap) { + auto funcVerify = [](TaggedObject *object, [[maybe_unused]] Verification &v, const Heap *heap) { EXPECT_TRUE(heap->ContainObject(object)); EXPECT_TRUE(heap->IsLive(object)); }; diff --git a/ecmascript/tests/symbol_table_test.cpp b/ecmascript/tests/symbol_table_test.cpp index e4e75c8bed18054bf77becb5d34ccfddfd7aca1e..18a07de0604866f71e1567ae784246ee384c9767 100644 --- a/ecmascript/tests/symbol_table_test.cpp +++ b/ecmascript/tests/symbol_table_test.cpp @@ -120,12 +120,12 @@ HWTEST_F_L0(SymbolTableTest, Hash_Utf8) uint8_t utf8ArrayName1[4] = {1, 2, 3}; // The last element is "\0" uint32_t utf8ArrayNameLen1 = sizeof(utf8ArrayName1) - 1; JSHandle nameStringUtf8Obj1 = factory->NewFromUtf8(utf8ArrayName1, utf8ArrayNameLen1); - EXPECT_EQ(SymbolTable::Hash(nameStringUtf8Obj1.GetTaggedValue()), 1026); // 1026 = (1 << 5 - 1 + 2) << 5 - 2 + 3 + EXPECT_EQ(SymbolTable::Hash(nameStringUtf8Obj1.GetTaggedValue()), 1026U); // 1026 = (1 << 5 - 1 + 2) << 5 - 2 + 3 uint8_t utf8ArrayName2[] = "key"; uint32_t utf8ArrayNameLen2 = sizeof(utf8ArrayName2) - 1; JSHandle nameStringUtf8Obj2 = factory->NewFromUtf8(utf8ArrayName2, utf8ArrayNameLen2); - EXPECT_EQ(SymbolTable::Hash(nameStringUtf8Obj2.GetTaggedValue()), 106079); + EXPECT_EQ(SymbolTable::Hash(nameStringUtf8Obj2.GetTaggedValue()), 106079U); } /* @@ -143,12 +143,12 @@ HWTEST_F_L0(SymbolTableTest, Hash_Utf16) uint16_t utf16ArrayName1[] = {1, 2, 3}; uint32_t utf16ArrayNameLen1 = sizeof(utf16ArrayName1) / sizeof(utf16ArrayName1[0]); JSHandle nameStringUtf16Obj1 = factory->NewFromUtf16(utf16ArrayName1, utf16ArrayNameLen1); - EXPECT_EQ(SymbolTable::Hash(nameStringUtf16Obj1.GetTaggedValue()), 1026); // 1026 = (1 << 5 - 1 + 2) << 5 - 2 + 3 + EXPECT_EQ(SymbolTable::Hash(nameStringUtf16Obj1.GetTaggedValue()), 1026U); // 1026 = (1 << 5 - 1 + 2) << 5 - 2 + 3 uint16_t utf16ArrayName2[] = {0, 1, 2}; uint32_t utf16ArrayNameLen2 = sizeof(utf16ArrayName2) / sizeof(utf16ArrayName2[0]); JSHandle nameStringUtf16Obj2 = factory->NewFromUtf16(utf16ArrayName2, utf16ArrayNameLen2); - EXPECT_EQ(SymbolTable::Hash(nameStringUtf16Obj2.GetTaggedValue()), 33); // 33 = (0 << 5 - 0 + 1) << 5 - 1 + 2 + EXPECT_EQ(SymbolTable::Hash(nameStringUtf16Obj2.GetTaggedValue()), 33U); // 33 = (0 << 5 - 0 + 1) << 5 - 1 + 2 } /* @@ -188,23 +188,23 @@ HWTEST_F_L0(SymbolTableTest, ContainsKey) int numberOfElements = 2; JSHandle symbolTable = SymbolTable::Create(thread, numberOfElements); - EXPECT_EQ(symbolTable->ContainsKey(thread, symbolTableStringKey1.GetTaggedValue()), false); + EXPECT_EQ(symbolTable->ContainsKey(symbolTableStringKey1.GetTaggedValue()), false); symbolTable->SetKey(thread, 1, JSTaggedValue::Hole()); - EXPECT_EQ(symbolTable->ContainsKey(thread, symbolTableStringKey1.GetTaggedValue()), false); + EXPECT_EQ(symbolTable->ContainsKey(symbolTableStringKey1.GetTaggedValue()), false); symbolTable->SetKey(thread, 1, JSTaggedValue::Undefined()); - EXPECT_EQ(symbolTable->ContainsKey(thread, symbolTableStringKey1.GetTaggedValue()), false); + EXPECT_EQ(symbolTable->ContainsKey(symbolTableStringKey1.GetTaggedValue()), false); symbolTable->SetKey(thread, 1, symbolTableStringKey1.GetTaggedValue()); - EXPECT_EQ(symbolTable->ContainsKey(thread, symbolTableStringKey1.GetTaggedValue()), true); + EXPECT_EQ(symbolTable->ContainsKey(symbolTableStringKey1.GetTaggedValue()), true); // the key value has numbers symbolTable->SetKey(thread, 1, symbolTableStringKey2.GetTaggedValue()); - EXPECT_EQ(symbolTable->ContainsKey(thread, symbolTableStringKey2.GetTaggedValue()), false); + EXPECT_EQ(symbolTable->ContainsKey(symbolTableStringKey2.GetTaggedValue()), false); symbolTable->SetKey(thread, 1, symbolTableStringKey3.GetTaggedValue()); - EXPECT_EQ(symbolTable->ContainsKey(thread, symbolTableStringKey3.GetTaggedValue()), true); + EXPECT_EQ(symbolTable->ContainsKey(symbolTableStringKey3.GetTaggedValue()), true); } /* @@ -253,19 +253,19 @@ HWTEST_F_L0(SymbolTableTest, FindSymbol) JSHandle handleSymbol = factory->NewJSSymbol(); JSHandle symbolTable = SymbolTable::Create(thread, numberOfElements); - JSTaggedValue resultValue1 = symbolTable->FindSymbol(thread, handleSymbol.GetTaggedValue()); + JSTaggedValue resultValue1 = symbolTable->FindSymbol(handleSymbol.GetTaggedValue()); EXPECT_EQ(JSTaggedValue::SameValue(resultValue1, JSTaggedValue::Undefined()), true); handleSymbol->SetDescription(thread, symbolTableStringKey1.GetTaggedValue()); - JSTaggedValue resultValue2 = symbolTable->FindSymbol(thread, handleSymbol.GetTaggedValue()); + JSTaggedValue resultValue2 = symbolTable->FindSymbol(handleSymbol.GetTaggedValue()); EXPECT_EQ(JSTaggedValue::SameValue(resultValue2, JSTaggedValue::Undefined()), true); symbolTable->SetKey(thread, 1, symbolTableStringKey1.GetTaggedValue()); - JSTaggedValue resultValue3 = symbolTable->FindSymbol(thread, handleSymbol.GetTaggedValue()); + JSTaggedValue resultValue3 = symbolTable->FindSymbol(handleSymbol.GetTaggedValue()); EXPECT_EQ(resultValue3.GetRawData() == symbolTableStringKey1.GetTaggedValue().GetRawData(), true); symbolTable->SetKey(thread, 1, symbolTableStringKey2.GetTaggedValue()); - JSTaggedValue resultValue4 = symbolTable->FindSymbol(thread, handleSymbol.GetTaggedValue()); + JSTaggedValue resultValue4 = symbolTable->FindSymbol(handleSymbol.GetTaggedValue()); EXPECT_EQ(JSTaggedValue::SameValue(resultValue4, JSTaggedValue::Undefined()), true); } } // namespace panda::test \ No newline at end of file diff --git a/ecmascript/tests/tagged_tree_test.cpp b/ecmascript/tests/tagged_tree_test.cpp index ddc64089eae293ad32c6a850578fbbee8a7bb636..9b17e5dbee04907e03d12fc274fcfbc6da2a689c 100644 --- a/ecmascript/tests/tagged_tree_test.cpp +++ b/ecmascript/tests/tagged_tree_test.cpp @@ -391,7 +391,7 @@ HWTEST_F_L0(TaggedTreeTest, TestTreeMapGetLowerKey) // check mykey1 ...mykeyn JSMutableHandle keyToCompare(thread, JSTaggedValue::Undefined()); - for (int i = 1; i < NODE_NUMBERS; i++) { + for (uint32_t i = 1; i < NODE_NUMBERS; i++) { std::string ikey = myKey + std::to_string(i); key.Update(factory->NewFromStdString(ikey).GetTaggedValue()); std::string tmp = myKey + std::to_string(i - 1); @@ -569,7 +569,7 @@ HWTEST_F_L0(TaggedTreeTest, TestTreeMapGetArrayFromMap) tmap.Update(TaggedTreeMap::Set(thread, tmap, key, value)); } JSHandle arr = TaggedTreeMap::GetArrayFromMap(thread, tmap); - EXPECT_EQ(arr->GetLength(), NODE_NUMBERS * 2); + EXPECT_EQ(static_cast(arr->GetLength()), NODE_NUMBERS * 2); for (int i = 0; i < NODE_NUMBERS; i++) { EXPECT_EQ(tmap->GetKey(arr->Get(i).GetInt()), JSTaggedValue(i)); @@ -612,7 +612,7 @@ HWTEST_F_L0(TaggedTreeTest, TestTreeSetGetLowerKey) // check mykey1 ...mykeyn JSMutableHandle keyToCompare(thread, JSTaggedValue::Undefined()); - for (int i = 1; i < NODE_NUMBERS; i++) { + for (uint32_t i = 1; i < NODE_NUMBERS; i++) { std::string ikey = myKey + std::to_string(i); key.Update(factory->NewFromStdString(ikey).GetTaggedValue()); std::string tmp = myKey + std::to_string(i - 1); @@ -731,7 +731,7 @@ HWTEST_F_L0(TaggedTreeTest, TestTreeSetGetArrayFromSet) tset.Update(TaggedTreeSet::Add(thread, tset, key)); } JSHandle arr = TaggedTreeSet::GetArrayFromSet(thread, tset); - EXPECT_EQ(arr->GetLength(), NODE_NUMBERS * 2); + EXPECT_EQ(static_cast(arr->GetLength()), NODE_NUMBERS * 2); for (int i = 0; i < NODE_NUMBERS; i++) { EXPECT_EQ(tset->GetKey(arr->Get(i).GetInt()), JSTaggedValue(i)); @@ -781,7 +781,7 @@ HWTEST_F_L0(TaggedTreeTest, TestSetAfterDelete) EXPECT_EQ(tmap->NumberOfElements(), NODE_NUMBERS + NODE_NUMBERS / 2); EXPECT_EQ(tmap->NumberOfDeletedElements(), 0); - for (int i = NODE_NUMBERS / 2; i < NODE_NUMBERS; i++) { + for (uint32_t i = NODE_NUMBERS / 2; i < NODE_NUMBERS; i++) { key.Update(JSTaggedValue(i)); value.Update(JSTaggedValue(i)); JSTaggedValue gvalue = TaggedTreeMap::Get(thread, tmap, key); @@ -824,7 +824,7 @@ HWTEST_F_L0(TaggedTreeTest, TestSetAfterDelete) EXPECT_EQ(tset->NumberOfElements(), NODE_NUMBERS + NODE_NUMBERS / 2); EXPECT_EQ(tset->NumberOfDeletedElements(), 0); - for (int i = NODE_NUMBERS / 2; i < NODE_NUMBERS; i++) { + for (uint32_t i = NODE_NUMBERS / 2; i < NODE_NUMBERS; i++) { key.Update(JSTaggedValue(i)); int entry = TaggedTreeSet::FindEntry(thread, tset, key); EXPECT_TRUE(entry >= 0); @@ -984,7 +984,7 @@ HWTEST_F_L0(TaggedTreeTest, CustomCompareFunctionTest) EXPECT_TRUE(tmap->NumberOfElements() == NODE_NUMBERS * 2); JSHandle arr = TaggedTreeMap::GetArrayFromMap(thread, tmap); - EXPECT_EQ(arr->GetLength(), NODE_NUMBERS * 2); + EXPECT_EQ(static_cast(arr->GetLength()), NODE_NUMBERS * 2); for (int i = NODE_NUMBERS; i < NODE_NUMBERS * 2; i++) { EXPECT_EQ(tmap->GetKey(arr->Get(i).GetInt()).GetInt(), (NODE_NUMBERS * 2 - 1 - i)); } @@ -1013,7 +1013,7 @@ HWTEST_F_L0(TaggedTreeTest, CustomCompareFunctionTest) EXPECT_TRUE(tset->NumberOfElements() == NODE_NUMBERS * 2); JSHandle sarr = TaggedTreeSet::GetArrayFromSet(thread, tset); - EXPECT_EQ(arr->GetLength(), NODE_NUMBERS * 2); + EXPECT_EQ(static_cast(arr->GetLength()), NODE_NUMBERS * 2); for (int i = NODE_NUMBERS; i < NODE_NUMBERS * 2; i++) { EXPECT_EQ(tset->GetKey(sarr->Get(i).GetInt()), JSTaggedValue(NODE_NUMBERS * 2 - 1 - i)); } diff --git a/ecmascript/tests/tagged_value_test.cpp b/ecmascript/tests/tagged_value_test.cpp index c52f4804e2d06d20ecaaccac36c611025a7bc278..e16b729754d819db5c518df3ed74e1a4106bf9eb 100644 --- a/ecmascript/tests/tagged_value_test.cpp +++ b/ecmascript/tests/tagged_value_test.cpp @@ -476,7 +476,7 @@ HWTEST_F_L0(JSTaggedValueTest, ToUint32) double input3 = 100 * (static_cast(UINT32_MAX) + 1) + INT32_MAX + 1 + 23456; JSTaggedValue doubleV5(input3); result = JSTaggedValue::ToUint32(thread, JSHandle(thread, doubleV5)); - EXPECT_EQ(result, static_cast(INT32_MAX + 1 + 23456)); + EXPECT_EQ(result, static_cast(static_cast(INT32_MAX) + 1 + 23456)); JSTaggedValue undefinedV = JSTaggedValue::Undefined(); result = JSTaggedValue::ToUint32(thread, JSHandle(thread, undefinedV)); diff --git a/ecmascript/tooling/agent/js_backend.cpp b/ecmascript/tooling/agent/js_backend.cpp index e1c7b2a79503240e81b01a565ec1c25ff105e43e..6893719105af4d2dfa528b194773fa94e3455fba 100644 --- a/ecmascript/tooling/agent/js_backend.cpp +++ b/ecmascript/tooling/agent/js_backend.cpp @@ -47,14 +47,9 @@ JSBackend::~JSBackend() DebuggerApi::DestroyJSDebugger(debugger_); } -void JSBackend::ProcessCommand() -{ - frontend_->ProcessCommand(ecmaVm_); -} - void JSBackend::WaitForDebugger() { - frontend_->WaitForDebugger(ecmaVm_); + frontend_->WaitForDebugger(); } void JSBackend::NotifyPaused(std::optional location, PauseReason reason) @@ -95,7 +90,7 @@ void JSBackend::NotifyPaused(std::optional location, PauseReason rea frontend_->SendNotification(ecmaVm_, std::move(paused)); // Waiting for Debugger - frontend_->WaitForDebugger(ecmaVm_); + frontend_->WaitForDebugger(); } void JSBackend::NotifyResume() @@ -123,7 +118,7 @@ bool JSBackend::NotifyScriptParsed(int32_t scriptId, const CString &fileName) LOG(WARNING, DEBUGGER) << "NotifyScriptParsed: already loaded: " << fileName; return false; } - const panda_file::File *pfs = DebuggerApi::FindPandaFile(ecmaVm_, fileName); + const panda_file::File *pfs = DebuggerApi::FindPandaFile(fileName); if (pfs == nullptr) { LOG(WARNING, DEBUGGER) << "NotifyScriptParsed: unknown file: " << fileName; return false; diff --git a/ecmascript/tooling/agent/js_backend.h b/ecmascript/tooling/agent/js_backend.h index b0ccf9c3b3f505476e26679ccb40a1a2c1a0b12a..c7e15f84189b636684e8401a9fe46a35b16de0b8 100644 --- a/ecmascript/tooling/agent/js_backend.h +++ b/ecmascript/tooling/agent/js_backend.h @@ -32,7 +32,6 @@ public: ~JSBackend(); // add for hooks - void ProcessCommand(); void WaitForDebugger(); void NotifyPaused(std::optional location, PauseReason reason); void NotifyResume(); diff --git a/ecmascript/tooling/agent/js_pt_hooks.cpp b/ecmascript/tooling/agent/js_pt_hooks.cpp index aaf514939f502b7268b7c1a96f7b2339dab70d50..197b1c9723ff1ecb65d66a5d388f2d6ea4cf47f8 100644 --- a/ecmascript/tooling/agent/js_pt_hooks.cpp +++ b/ecmascript/tooling/agent/js_pt_hooks.cpp @@ -65,8 +65,6 @@ void JSPtHooks::SingleStep([[maybe_unused]] PtThread thread, const PtLocation &l // pause or step complete if (backend_->StepComplete(location)) { backend_->NotifyPaused({}, OTHER); - } else { - backend_->ProcessCommand(); } } diff --git a/ecmascript/tooling/base/pt_events.cpp b/ecmascript/tooling/base/pt_events.cpp index 8bde47f437d2699259161c3840474bb28de2c7d4..6d1e1fd4aa60a111aadcf1c458f5bf1d01911b15 100644 --- a/ecmascript/tooling/base/pt_events.cpp +++ b/ecmascript/tooling/base/pt_events.cpp @@ -193,7 +193,8 @@ Local Paused::ToObject(const EcmaVM *ecmaVm) return object; } -std::unique_ptr Resumed::Create(const EcmaVM *ecmaVm, [[maybe_unused]] const Local ¶ms) +std::unique_ptr Resumed::Create([[maybe_unused]] const EcmaVM *ecmaVm, + [[maybe_unused]] const Local ¶ms) { return std::make_unique(); } diff --git a/ecmascript/tooling/base/pt_params.h b/ecmascript/tooling/base/pt_params.h index 21c6fc6b5a62f3570f52afea243b56825459f771..a9b89e2d321edde32180c9ecd44f06371d3bc7b3 100644 --- a/ecmascript/tooling/base/pt_params.h +++ b/ecmascript/tooling/base/pt_params.h @@ -37,7 +37,7 @@ public: ~EnableParams() override = default; static std::unique_ptr Create(const EcmaVM *ecmaVm, const Local ¶ms); - Local ToObject(const EcmaVM *ecmaVm) override + Local ToObject([[maybe_unused]] const EcmaVM *ecmaVm) override { return Local(); } @@ -65,7 +65,7 @@ public: ~EvaluateOnCallFrameParams() override = default; static std::unique_ptr Create(const EcmaVM *ecmaVm, const Local ¶ms); - Local ToObject(const EcmaVM *ecmaVm) override + Local ToObject([[maybe_unused]] const EcmaVM *ecmaVm) override { return Local(); } @@ -100,7 +100,7 @@ public: ~GetPossibleBreakpointsParams() override = default; static std::unique_ptr Create(const EcmaVM *ecmaVm, const Local ¶ms); - Local ToObject(const EcmaVM *ecmaVm) override + Local ToObject([[maybe_unused]] const EcmaVM *ecmaVm) override { return Local(); } @@ -148,7 +148,7 @@ public: ~GetScriptSourceParams() override = default; static std::unique_ptr Create(const EcmaVM *ecmaVm, const Local ¶ms); - Local ToObject(const EcmaVM *ecmaVm) override + Local ToObject([[maybe_unused]] const EcmaVM *ecmaVm) override { return Local(); } @@ -171,7 +171,7 @@ public: ~RemoveBreakpointParams() override = default; static std::unique_ptr Create(const EcmaVM *ecmaVm, const Local ¶ms); - Local ToObject(const EcmaVM *ecmaVm) override + Local ToObject([[maybe_unused]] const EcmaVM *ecmaVm) override { return Local(); } @@ -194,7 +194,7 @@ public: ~ResumeParams() override = default; static std::unique_ptr Create(const EcmaVM *ecmaVm, const Local ¶ms); - Local ToObject(const EcmaVM *ecmaVm) override + Local ToObject([[maybe_unused]] const EcmaVM *ecmaVm) override { return Local(); } @@ -222,7 +222,7 @@ public: ~SetAsyncCallStackDepthParams() override = default; static std::unique_ptr Create(const EcmaVM *ecmaVm, const Local ¶ms); - Local ToObject(const EcmaVM *ecmaVm) override + Local ToObject([[maybe_unused]] const EcmaVM *ecmaVm) override { return Local(); } @@ -244,7 +244,7 @@ public: SetBlackboxPatternsParams() = default; ~SetBlackboxPatternsParams() override = default; static std::unique_ptr Create(const EcmaVM *ecmaVm, const Local ¶ms); - Local ToObject(const EcmaVM *ecmaVm) override + Local ToObject([[maybe_unused]] const EcmaVM *ecmaVm) override { return Local(); } @@ -267,7 +267,7 @@ public: ~SetBreakpointByUrlParams() override = default; static std::unique_ptr Create(const EcmaVM *ecmaVm, const Local ¶ms); - Local ToObject(const EcmaVM *ecmaVm) override + Local ToObject([[maybe_unused]] const EcmaVM *ecmaVm) override { return Local(); } @@ -346,7 +346,7 @@ public: SetPauseOnExceptionsParams() = default; ~SetPauseOnExceptionsParams() override = default; static std::unique_ptr Create(const EcmaVM *ecmaVm, const Local ¶ms); - Local ToObject(const EcmaVM *ecmaVm) override + Local ToObject([[maybe_unused]] const EcmaVM *ecmaVm) override { return Local(); } @@ -386,7 +386,7 @@ public: ~StepIntoParams() override = default; static std::unique_ptr Create(const EcmaVM *ecmaVm, const Local ¶ms); - Local ToObject(const EcmaVM *ecmaVm) override + Local ToObject([[maybe_unused]] const EcmaVM *ecmaVm) override { return Local(); } @@ -428,7 +428,7 @@ public: ~StepOverParams() override = default; static std::unique_ptr Create(const EcmaVM *ecmaVm, const Local ¶ms); - Local ToObject(const EcmaVM *ecmaVm) override + Local ToObject([[maybe_unused]] const EcmaVM *ecmaVm) override { return Local(); } @@ -459,7 +459,7 @@ public: ~GetPropertiesParams() override = default; static std::unique_ptr Create(const EcmaVM *ecmaVm, const Local ¶ms); - Local ToObject(const EcmaVM *ecmaVm) override + Local ToObject([[maybe_unused]] const EcmaVM *ecmaVm) override { return Local(); } diff --git a/ecmascript/tooling/base/pt_types.h b/ecmascript/tooling/base/pt_types.h index 72a588a7df33d518cee485cabfa45aefc44f0139..bfaf1af5b7ba8dae1054f744d7b7075066fa49c2 100644 --- a/ecmascript/tooling/base/pt_types.h +++ b/ecmascript/tooling/base/pt_types.h @@ -345,7 +345,7 @@ public: class StringRemoteObject final : public RemoteObject { public: - explicit StringRemoteObject(const EcmaVM *ecmaVm, const Local &tagged) + explicit StringRemoteObject([[maybe_unused]] const EcmaVM *ecmaVm, const Local &tagged) { SetType(RemoteObject::TypeName::String).SetValue(tagged); } diff --git a/ecmascript/tooling/debugger_service.cpp b/ecmascript/tooling/debugger_service.cpp index 8cad5b70184ce2f93f7f78d986e69e3ead637d4c..18e9b83c7df834b54cb4cb8bd004889d7c6c3e20 100644 --- a/ecmascript/tooling/debugger_service.cpp +++ b/ecmascript/tooling/debugger_service.cpp @@ -33,7 +33,7 @@ void UninitializeDebugger() void DispatchProtocolMessage(const std::string &message) { if (g_handler != nullptr) { - g_handler->SendCommand(DebuggerApi::ConvertToString(message)); + g_handler->ProcessCommand(DebuggerApi::ConvertToString(message)); } } } // namespace panda::tooling::ecmascript \ No newline at end of file diff --git a/ecmascript/tooling/front_end.h b/ecmascript/tooling/front_end.h index f46e7da9809b899732fb042274885650dcd299da..3cd57c6df534f0622e224d642b3429e42790ad08 100644 --- a/ecmascript/tooling/front_end.h +++ b/ecmascript/tooling/front_end.h @@ -27,9 +27,8 @@ public: FrontEnd() = default; virtual ~FrontEnd() = default; - virtual void WaitForDebugger(const EcmaVM *ecmaVm) = 0; + virtual void WaitForDebugger() = 0; virtual void RunIfWaitingForDebugger() = 0; - virtual void ProcessCommand(const EcmaVM *ecmaVm) = 0; virtual void SendResponse(const DispatchRequest &request, const DispatchResponse &response, std::unique_ptr result) = 0; virtual void SendNotification(const EcmaVM *ecmaVm, std::unique_ptr events) = 0; diff --git a/ecmascript/tooling/interface/debugger_api.cpp b/ecmascript/tooling/interface/debugger_api.cpp index 368741751a71f0ab4ba4f3d0f4c041c781a95392..3f22e2624ad6d5b511a6ee0febac795d639d1de2 100644 --- a/ecmascript/tooling/interface/debugger_api.cpp +++ b/ecmascript/tooling/interface/debugger_api.cpp @@ -145,7 +145,7 @@ void DebuggerApi::ClearException(const EcmaVM *ecmaVm) } // EcmaVM -const panda_file::File *DebuggerApi::FindPandaFile(const EcmaVM *ecmaVm, const CString &fileName) +const panda_file::File *DebuggerApi::FindPandaFile(const CString &fileName) { const panda_file::File *pfs = nullptr; ::panda::ecmascript::JSPandaFileManager::GetInstance()->EnumerateJSPandaFiles([&pfs, fileName]( diff --git a/ecmascript/tooling/interface/debugger_api.h b/ecmascript/tooling/interface/debugger_api.h index 612dc93b1c05b32fda385c863165977641c26fc3..5b20a1b14cabd34f9b37beaea46982d11b9f1bf4 100644 --- a/ecmascript/tooling/interface/debugger_api.h +++ b/ecmascript/tooling/interface/debugger_api.h @@ -79,7 +79,7 @@ public: static void ClearException(const EcmaVM *ecmaVm); // EcmaVM - static const panda_file::File *FindPandaFile(const EcmaVM *ecmaVm, const CString &fileName); + static const panda_file::File *FindPandaFile(const CString &fileName); // NumberHelper static double StringToDouble(const uint8_t *start, const uint8_t *end, uint8_t radix); diff --git a/ecmascript/tooling/interface/js_debugger.h b/ecmascript/tooling/interface/js_debugger.h index b9bba51fefd077d95ce33e7fc77726f638f4200a..0207db7f8a78b7124a566b41c1458ef826e994be 100644 --- a/ecmascript/tooling/interface/js_debugger.h +++ b/ecmascript/tooling/interface/js_debugger.h @@ -87,7 +87,7 @@ public: { return nullptr; } - Expected GetPtMethod(const PtLocation &location) const override + Expected GetPtMethod([[maybe_unused]] const PtLocation &location) const override { return Unexpected(Error(Error::Type::INVALID_VALUE, "Unsupported GetPtMethod")); } @@ -99,88 +99,97 @@ public: { return {}; } - std::optional SetNotification(PtThread thread, bool enable, PtHookType hookType) override + std::optional SetNotification([[maybe_unused]] PtThread thread, [[maybe_unused]] bool enable, + [[maybe_unused]] PtHookType hookType) override { return {}; } - Expected, Error> GetCurrentFrame(PtThread thread) const override + Expected, Error> GetCurrentFrame([[maybe_unused]] PtThread thread) const override { return Unexpected(Error(Error::Type::INVALID_VALUE, "Unsupported GetCurrentFrame")); } - std::optional EnumerateFrames(PtThread thread, std::function callback) const override + std::optional EnumerateFrames([[maybe_unused]] PtThread thread, + [[maybe_unused]] std::function callback) const override { return {}; } - std::optional GetThisVariableByFrame(PtThread thread, uint32_t frameDepth, PtValue *value) override + std::optional GetThisVariableByFrame([[maybe_unused]] PtThread thread, [[maybe_unused]] uint32_t frameDepth, + [[maybe_unused]] PtValue *value) override { return {}; } - void ThreadStart(ManagedThread::ThreadId threadId) override {} - void ThreadEnd(ManagedThread::ThreadId threadId) override {} + void ThreadStart([[maybe_unused]] ManagedThread::ThreadId threadId) override {} + void ThreadEnd([[maybe_unused]] ManagedThread::ThreadId threadId) override {} void GarbageCollectorStart() override {} void GarbageCollectorFinish() override {} - void ObjectAlloc(BaseClass *klass, ObjectHeader *object, ManagedThread *thread, size_t size) override {} - void ExceptionCatch(const ManagedThread *thread, const Method *method, uint32_t bcOffset) override {} - void ClassLoad(Class *klass) override {} - void ClassPrepare(Class *klass) override {} - void MonitorWait(ObjectHeader *object, int64_t timeout) override {} - void MonitorWaited(ObjectHeader *object, bool timedOut) override {} - void MonitorContendedEnter(ObjectHeader *object) override {} - void MonitorContendedEntered(ObjectHeader *object) override {} + void ObjectAlloc([[maybe_unused]] BaseClass *klass, [[maybe_unused]] ObjectHeader *object, + [[maybe_unused]] ManagedThread *thread, [[maybe_unused]] size_t size) override {} + void ExceptionCatch([[maybe_unused]] const ManagedThread *thread, [[maybe_unused]] const Method *method, + [[maybe_unused]] uint32_t bcOffset) override {} + void ClassLoad([[maybe_unused]] Class *klass) override {} + void ClassPrepare([[maybe_unused]] Class *klass) override {} + void MonitorWait([[maybe_unused]] ObjectHeader *object, [[maybe_unused]] int64_t timeout) override {} + void MonitorWaited([[maybe_unused]] ObjectHeader *object, [[maybe_unused]] bool timedOut) override {} + void MonitorContendedEnter([[maybe_unused]] ObjectHeader *object) override {} + void MonitorContendedEntered([[maybe_unused]] ObjectHeader *object) override {} - std::optional GetThreadList(PandaVector *threadList) const override + std::optional GetThreadList([[maybe_unused]] PandaVector *threadList) const override { return {}; } - std::optional GetThreadInfo(PtThread thread, ThreadInfo *infoPtr) const override + std::optional GetThreadInfo([[maybe_unused]] PtThread thread, + [[maybe_unused]] ThreadInfo *infoPtr) const override { return {}; } - std::optional SuspendThread(PtThread thread) const override + std::optional SuspendThread([[maybe_unused]] PtThread thread) const override { return {}; } - std::optional ResumeThread(PtThread thread) const override + std::optional ResumeThread([[maybe_unused]] PtThread thread) const override { return {}; } - std::optional SetVariable(PtThread thread, uint32_t frameDepth, int32_t regNumber, - const PtValue &value) const override + std::optional SetVariable([[maybe_unused]] PtThread thread, [[maybe_unused]] uint32_t frameDepth, + [[maybe_unused]] int32_t regNumber, + [[maybe_unused]] const PtValue &value) const override { return {}; } - std::optional GetVariable(PtThread thread, uint32_t frameDepth, int32_t regNumber, - PtValue *result) const override + std::optional GetVariable([[maybe_unused]] PtThread thread, [[maybe_unused]] uint32_t frameDepth, + [[maybe_unused]] int32_t regNumber, + [[maybe_unused]] PtValue *result) const override { return {}; } std::optional GetProperty([[maybe_unused]] PtObject object, [[maybe_unused]] PtProperty property, - PtValue *value) const override + [[maybe_unused]] PtValue *value) const override { return {}; } std::optional SetProperty([[maybe_unused]] PtObject object, [[maybe_unused]] PtProperty property, - [[maybe_unused]] const PtValue &value) const override + [[maybe_unused]] const PtValue &value) const override { return {}; } std::optional EvaluateExpression([[maybe_unused]] PtThread thread, [[maybe_unused]] uint32_t frameNumber, - ExpressionWrapper expr, PtValue *result) const override + [[maybe_unused]] ExpressionWrapper expr, + [[maybe_unused]] PtValue *result) const override { return {}; } std::optional RetransformClasses([[maybe_unused]] int32_t classCount, - [[maybe_unused]] const PtClass *classes) const override + [[maybe_unused]] const PtClass *classes) const override { return {}; } std::optional RedefineClasses([[maybe_unused]] int32_t classCount, - [[maybe_unused]] const PandaClassDefinition *classes) const override + [[maybe_unused]] const PandaClassDefinition *classes) const override { return {}; } std::optional RestartFrame([[maybe_unused]] PtThread thread, - [[maybe_unused]] uint32_t frameNumber) const override + [[maybe_unused]] uint32_t frameNumber) const override { return {}; } @@ -188,36 +197,44 @@ public: { return {}; } - std::optional AwaitPromise([[maybe_unused]] PtObject promiseObject, PtValue *result) const override + std::optional AwaitPromise([[maybe_unused]] PtObject promiseObject, + [[maybe_unused]] PtValue *result) const override { return {}; } std::optional CallFunctionOn([[maybe_unused]] PtObject object, [[maybe_unused]] PtMethod method, - [[maybe_unused]] const PandaVector &arguments, PtValue *returnValue) const override + [[maybe_unused]] const PandaVector &arguments, + [[maybe_unused]] PtValue *returnValue) const override { return {}; } - std::optional GetProperties(uint32_t *countPtr, [[maybe_unused]] char ***propertyPtr) const override + std::optional GetProperties([[maybe_unused]] uint32_t *countPtr, + [[maybe_unused]] char ***propertyPtr) const override { return {}; } - std::optional NotifyFramePop(PtThread thread, uint32_t depth) const override + std::optional NotifyFramePop([[maybe_unused]] PtThread thread, + [[maybe_unused]] uint32_t depth) const override { return {}; } - std::optional SetPropertyAccessWatch(PtClass klass, PtProperty property) override + std::optional SetPropertyAccessWatch([[maybe_unused]] PtClass klass, + [[maybe_unused]] PtProperty property) override { return {}; } - std::optional ClearPropertyAccessWatch(PtClass klass, PtProperty property) override + std::optional ClearPropertyAccessWatch([[maybe_unused]] PtClass klass, + [[maybe_unused]] PtProperty property) override { return {}; } - std::optional SetPropertyModificationWatch(PtClass klass, PtProperty property) override + std::optional SetPropertyModificationWatch([[maybe_unused]] PtClass klass, + [[maybe_unused]] PtProperty property) override { return {}; } - std::optional ClearPropertyModificationWatch(PtClass klass, PtProperty property) override + std::optional ClearPropertyModificationWatch([[maybe_unused]] PtClass klass, + [[maybe_unused]] PtProperty property) override { return {}; } diff --git a/ecmascript/tooling/js_pt_lang_ext.h b/ecmascript/tooling/js_pt_lang_ext.h index 7db98d4261f05a8c4c179e7dfa56d0a99022158b..052c53cb33d486810806242680803b3f46d9dda8 100644 --- a/ecmascript/tooling/js_pt_lang_ext.h +++ b/ecmascript/tooling/js_pt_lang_ext.h @@ -23,55 +23,56 @@ public: ~JSPtLangExt() override = default; // PtValue API - PtObject ValueToObject(PtValue value) const override + PtObject ValueToObject([[maybe_unused]] PtValue value) const override { return PtObject(); } // PtClass API - PtClass GetClass(PtObject object) const override + PtClass GetClass([[maybe_unused]] PtObject object) const override { return PtClass(); } - PtClass GetClass(PtProperty property) const override + PtClass GetClass([[maybe_unused]] PtProperty property) const override { return PtClass(); } - void ReleaseClass(PtClass klass) const override {} - const char *GetClassDescriptor(PtClass klass) const override + void ReleaseClass([[maybe_unused]] PtClass klass) const override {} + const char *GetClassDescriptor([[maybe_unused]] PtClass klass) const override { return nullptr; } // PtObject API - PandaList GetProperties(PtObject object) const override + PandaList GetProperties([[maybe_unused]] PtObject object) const override { return {}; } - PtProperty GetProperty(PtObject object, const char *propertyName) const override + PtProperty GetProperty([[maybe_unused]] PtObject object, [[maybe_unused]] const char *propertyName) const override { return PtProperty(); } - bool AddProperty(PtObject object, const char *propertyName, PtValue value) const override + bool AddProperty([[maybe_unused]] PtObject object, [[maybe_unused]] const char *propertyName, + [[maybe_unused]] PtValue value) const override { return false; } - bool RemoveProperty(PtObject object, const char *propertyName) const override + bool RemoveProperty([[maybe_unused]] PtObject object, [[maybe_unused]] const char *propertyName) const override { return false; } // PtProperty API - const char *GetPropertyName(PtProperty property) const override + const char *GetPropertyName([[maybe_unused]] PtProperty property) const override { return nullptr; } - PtValue GetPropertyValue(PtProperty property) const override + PtValue GetPropertyValue([[maybe_unused]] PtProperty property) const override { return PtValue(); } - void SetPropertyPtValue(PtProperty property, PtValue value) const override {} - void ReleasePtValue(const PtValue *value) const override {} + void SetPropertyPtValue([[maybe_unused]] PtProperty property, [[maybe_unused]] PtValue value) const override {} + void ReleasePtValue([[maybe_unused]] const PtValue *value) const override {} NO_COPY_SEMANTIC(JSPtLangExt); NO_MOVE_SEMANTIC(JSPtLangExt); diff --git a/ecmascript/tooling/protocol_handler.cpp b/ecmascript/tooling/protocol_handler.cpp index eb5e889937419c463c436cb9a5957080330c434f..cf13ea6ee5ad66045878235a9c62f7781a9d7125 100644 --- a/ecmascript/tooling/protocol_handler.cpp +++ b/ecmascript/tooling/protocol_handler.cpp @@ -26,10 +26,13 @@ ProtocolHandler::ProtocolHandler(std::function callback, cons dispatcher_ = std::make_unique(this); } -void ProtocolHandler::WaitForDebugger(const EcmaVM *ecmaVm) +void ProtocolHandler::WaitForDebugger() { waitingForDebugger_ = true; - ProcessCommand(ecmaVm); + static constexpr int DEBUGGER_WAIT_SLEEP_TIME = 100; + while (waitingForDebugger_) { + usleep(DEBUGGER_WAIT_SLEEP_TIME); + } } void ProtocolHandler::RunIfWaitingForDebugger() @@ -37,17 +40,9 @@ void ProtocolHandler::RunIfWaitingForDebugger() waitingForDebugger_ = false; } -void ProtocolHandler::ProcessCommand(const EcmaVM *ecmaVm) -{ - static constexpr int DEBUGGER_WAIT_SLEEP_TIME = 100; - while (waitingForDebugger_) { - usleep(DEBUGGER_WAIT_SLEEP_TIME); - } -} - -void ProtocolHandler::SendCommand(const CString &msg) +void ProtocolHandler::ProcessCommand(const CString &msg) { - LOG(DEBUG, DEBUGGER) << "ProtocolHandler::SendCommand: " << msg; + LOG(DEBUG, DEBUGGER) << "ProtocolHandler::ProcessCommand: " << msg; Local exception = DebuggerApi::GetException(vm_); if (!exception->IsHole()) { DebuggerApi::ClearException(vm_); diff --git a/ecmascript/tooling/protocol_handler.h b/ecmascript/tooling/protocol_handler.h index ef6950bb20b8eeab64f01228a13aa922b025cc05..307b80821a0a61bc3896f797faed9307aee3a60a 100644 --- a/ecmascript/tooling/protocol_handler.h +++ b/ecmascript/tooling/protocol_handler.h @@ -28,10 +28,9 @@ public: explicit ProtocolHandler(std::function callback, const EcmaVM *vm); ~ProtocolHandler() override = default; - void WaitForDebugger(const EcmaVM *ecmaVm) override; + void WaitForDebugger() override; void RunIfWaitingForDebugger() override; - void ProcessCommand(const EcmaVM *ecmaVm) override; - void SendCommand(const CString &msg); + void ProcessCommand(const CString &msg); void SendResponse(const DispatchRequest &request, const DispatchResponse &response, std::unique_ptr result) override; void SendNotification(const EcmaVM *ecmaVm, std::unique_ptr events) override; diff --git a/ecmascript/tooling/test/debugger_types_test.cpp b/ecmascript/tooling/test/debugger_types_test.cpp index 8e4d6dc9c15b08368bd646be691b4668e961ffb5..d7e19ac047173a7038a1ec4e6e6608d16ed68e5f 100644 --- a/ecmascript/tooling/test/debugger_types_test.cpp +++ b/ecmascript/tooling/test/debugger_types_test.cpp @@ -1644,7 +1644,7 @@ HWTEST_F_L0(DebuggerTypesTest, CallFrameCreateTest) EXPECT_EQ(location->GetLine(), 19); EXPECT_EQ("url7", callFrame->GetUrl()); const CVector> *scopeChain = callFrame->GetScopeChain(); - EXPECT_EQ(scopeChain->size(), 2); + EXPECT_EQ(scopeChain->size(), 2U); RemoteObject *thisObj = callFrame->GetThis(); ASSERT_NE(thisObj, nullptr); EXPECT_EQ(thisObj->GetType(), ObjectType::Object); @@ -1671,7 +1671,7 @@ HWTEST_F_L0(DebuggerTypesTest, CallFrameCreateTest) EXPECT_EQ(location->GetLine(), 19); EXPECT_EQ("url7", callFrame->GetUrl()); scopeChain = callFrame->GetScopeChain(); - EXPECT_EQ(scopeChain->size(), 2); + EXPECT_EQ(scopeChain->size(), 2U); thisObj = callFrame->GetThis(); ASSERT_NE(thisObj, nullptr); EXPECT_EQ(thisObj->GetType(), ObjectType::Object); diff --git a/ecmascript/ts_types/tests/ts_type_test.cpp b/ecmascript/ts_types/tests/ts_type_test.cpp index b6a94d7f6c09f33a3106d9afdd634561bb33ff4d..8a7b205b1e060782a388d7a2cfc96f9b1d13b853 100644 --- a/ecmascript/ts_types/tests/ts_type_test.cpp +++ b/ecmascript/ts_types/tests/ts_type_test.cpp @@ -57,8 +57,8 @@ HWTEST_F_L0(TSTypeTest, UnionType) auto factory = ecmaVm->GetFactory(); JSHandle table = factory->NewTSTypeTable(2); - const int literalLength = 4; - const int unionLength = 2; + const uint32_t literalLength = 4; + const uint32_t unionLength = 2; JSHandle literal = factory->NewTaggedArray(literalLength); literal->Set(thread, 0, JSTaggedValue(static_cast(TSTypeTable::TypeLiteralFlag::UNION))); literal->Set(thread, 1, JSTaggedValue(unionLength)); @@ -118,7 +118,7 @@ HWTEST_F_L0(TSTypeTest, ImportType) importTable->Set(thread, 1, JSHandle(importType)); GlobalTSTypeRef importGT = importType->GetGTRef(); - ASSERT_EQ(importType->GetTargetRefGT().GetGlobalTSTypeRef(), 0); + ASSERT_EQ(importType->GetTargetRefGT().GetGlobalTSTypeRef(), 0ULL); tsLoader->AddTypeTable(JSHandle(importTable), importFileHandle); @@ -158,7 +158,7 @@ HWTEST_F_L0(TSTypeTest, ImportType) redirectImportTable->Set(thread, redirectImportTable->GetLength() - 1, redirectExportTableHandle); GlobalTSTypeRef redirectImportGT = redirectImportType->GetGTRef(); - ASSERT_EQ(redirectImportType->GetTargetRefGT().GetGlobalTSTypeRef(), 0); + ASSERT_EQ(redirectImportType->GetTargetRefGT().GetGlobalTSTypeRef(), 0ULL); tsLoader->AddTypeTable(JSHandle(redirectImportTable), redirectImportFileHandle); @@ -307,7 +307,7 @@ HWTEST_F_L0(TSTypeTest, ClassInstanceType) ASSERT_TRUE(type->IsTSClassInstanceType()); JSHandle classInstanceType = JSHandle(type); - ASSERT_EQ(classInstanceType->GetClassRefGT().GetGlobalTSTypeRef(), 50); + ASSERT_EQ(classInstanceType->GetClassRefGT().GetGlobalTSTypeRef(), 50ULL); } HWTEST_F_L0(TSTypeTest, FuntionType) @@ -340,9 +340,9 @@ HWTEST_F_L0(TSTypeTest, FuntionType) JSHandle parameterTypes(thread, functionType->GetParameterTypes()); ASSERT_EQ(parameterTypes->GetLength(), parameterLength + TSFunctionType::DEFAULT_LENGTH); ASSERT_EQ(functionType->GetParametersNum(), parameterLength); - ASSERT_EQ(functionType->GetParameterTypeGT(table, 0).GetGlobalTSTypeRef(), 1); - ASSERT_EQ(functionType->GetParameterTypeGT(table, 1).GetGlobalTSTypeRef(), 2); - ASSERT_EQ(functionType->GetReturnValueTypeGT(table).GetGlobalTSTypeRef(), 6); + ASSERT_EQ(functionType->GetParameterTypeGT(table, 0).GetGlobalTSTypeRef(), 1ULL); + ASSERT_EQ(functionType->GetParameterTypeGT(table, 1).GetGlobalTSTypeRef(), 2ULL); + ASSERT_EQ(functionType->GetReturnValueTypeGT(table).GetGlobalTSTypeRef(), 6ULL); } HWTEST_F_L0(TSTypeTest, ObjectType) @@ -394,6 +394,6 @@ HWTEST_F_L0(TSTypeTest, ArrayType) ASSERT_TRUE(type->IsTSArrayType()); JSHandle arrayType = JSHandle(type); - ASSERT_EQ(arrayType->GetElementTypeRef(), 2); + ASSERT_EQ(arrayType->GetElementTypeRef(), 2ULL); } } // namespace panda::test diff --git a/ecmascript/ts_types/ts_loader.cpp b/ecmascript/ts_types/ts_loader.cpp index d3bce00c5337112bc9536d8eeb8112e26876c867..da61276f54c14958c23cc9958bfd7930bb46fedf 100644 --- a/ecmascript/ts_types/ts_loader.cpp +++ b/ecmascript/ts_types/ts_loader.cpp @@ -234,7 +234,7 @@ void TSLoader::Dump() JSHandle table = GetTSModuleTable(); int GTLength = table->GetLength(); for (int i = 0; i < GTLength; i++) { - JSHandle(thread, table->Get(i))->Dump(thread, std::cout); + JSHandle(thread, table->Get(i))->Dump(std::cout); } } @@ -335,7 +335,7 @@ GlobalTSTypeRef TSLoader::FindInGlobalUTable(JSHandle unionType) co for (uint32_t unionIndex = 0; unionIndex < tableLength; unionIndex++) { JSHandle unionTemp(thread, unionTypeTable->Get(unionIndex)); ASSERT(unionTemp.GetTaggedValue().IsTSUnionType() && unionType.GetTaggedValue().IsTSUnionType()); - bool foundTag = unionTemp->IsEqual(thread, unionType); + bool foundTag = unionTemp->IsEqual(unionType); if (foundTag) { foundUnionRef = CreateGT(unionTableId, unionIndex, static_cast(TSTypeKind::TS_UNION)); diff --git a/ecmascript/ts_types/ts_type.cpp b/ecmascript/ts_types/ts_type.cpp index 8afa0789583a076d514429cf5fc303735217b01f..b97dcfa00cea6e552ca1eeff457e606027ddb71f 100644 --- a/ecmascript/ts_types/ts_type.cpp +++ b/ecmascript/ts_types/ts_type.cpp @@ -66,7 +66,7 @@ JSHClass *TSObjectType::CreateHClassByProps(JSThread *thread, JSHandle unionB) +bool TSUnionType::IsEqual(JSHandle unionB) { DISALLOW_GARBAGE_COLLECTION; ASSERT(unionB->GetComponentTypes().IsTaggedArray()); diff --git a/ecmascript/ts_types/ts_type.h b/ecmascript/ts_types/ts_type.h index 4ec679577b22740c0b644befc4e1beb69066104d..56e97ee170ab13e7bbaf122d6f7bfc6d392b8057 100644 --- a/ecmascript/ts_types/ts_type.h +++ b/ecmascript/ts_types/ts_type.h @@ -143,7 +143,7 @@ class TSUnionType : public TSType { public: CAST_CHECK(TSUnionType, IsTSUnionType); - bool IsEqual(JSThread *thread, JSHandle unionB); + bool IsEqual(JSHandle unionB); static constexpr size_t COMPONENT_OFFSET = TSType::SIZE; ACCESSORS(ComponentTypes, COMPONENT_OFFSET, SIZE); diff --git a/test/fuzztest/ark_DispatchProtocolMessage_fuzzer/BUILD.gn b/test/fuzztest/ark_DispatchProtocolMessage_fuzzer/BUILD.gn index 7a9f83725598c97bb23113bb28fe90f9c49d3f49..7dbfb83d0fd878742b69032e637e477fbda4bc73 100644 --- a/test/fuzztest/ark_DispatchProtocolMessage_fuzzer/BUILD.gn +++ b/test/fuzztest/ark_DispatchProtocolMessage_fuzzer/BUILD.gn @@ -27,7 +27,7 @@ ohos_fuzztest("test_ark_DispatchProtocolMessage_fuzzer") { configs = [ "//ark/js_runtime:ecma_test_config", "//ark/js_runtime:ark_jsruntime_public_config", - "//ark/js_runtime:ark_jsruntime_config", + "//ark/js_runtime:ark_jsruntime_common_config", "$ark_root/runtime:arkruntime_public_config", ] diff --git a/test/fuzztest/ark_Execute_fuzzer/BUILD.gn b/test/fuzztest/ark_Execute_fuzzer/BUILD.gn index 5643fb5085998edadbd79cc432b8e99be4b02230..7968e47ec6e72808aef828eaf9960c6296ca4359 100644 --- a/test/fuzztest/ark_Execute_fuzzer/BUILD.gn +++ b/test/fuzztest/ark_Execute_fuzzer/BUILD.gn @@ -27,7 +27,7 @@ ohos_fuzztest("test_ark_Execute_fuzzer") { configs = [ "//ark/js_runtime:ecma_test_config", "//ark/js_runtime:ark_jsruntime_public_config", - "//ark/js_runtime:ark_jsruntime_config", + "//ark/js_runtime:ark_jsruntime_common_config", "$ark_root/runtime:arkruntime_public_config", ] diff --git a/test/fuzztest/ark_InitializeDebugger_fuzzer/BUILD.gn b/test/fuzztest/ark_InitializeDebugger_fuzzer/BUILD.gn index e3bce040d7a9c285fa9b30119f6367c9a9bf87a7..8170783203951c715f72f8e7365b667074342d31 100644 --- a/test/fuzztest/ark_InitializeDebugger_fuzzer/BUILD.gn +++ b/test/fuzztest/ark_InitializeDebugger_fuzzer/BUILD.gn @@ -27,7 +27,7 @@ ohos_fuzztest("test_ark_InitializeDebugger_fuzzer") { configs = [ "//ark/js_runtime:ecma_test_config", "//ark/js_runtime:ark_jsruntime_public_config", - "//ark/js_runtime:ark_jsruntime_config", + "//ark/js_runtime:ark_jsruntime_common_config", "$ark_root/runtime:arkruntime_public_config", ]