diff --git a/ecmascript/js_array.cpp b/ecmascript/js_array.cpp index d41eca7e04..daa3dec876 100644 --- a/ecmascript/js_array.cpp +++ b/ecmascript/js_array.cpp @@ -242,7 +242,7 @@ void JSArray::SetCapacity(JSThread *thread, const JSHandle &array, if (newLen <= capacity) { // judge if need to cut down the array size, else fill the unused tail with holes CheckAndCopyArray(thread, JSHandle(array)); - array->FillElementsWithHoles(thread, newLen, oldLen < capacity ? oldLen : capacity); + JSObject::FillElementsWithHoles(thread, array, newLen, oldLen < capacity ? oldLen : capacity); } if (JSObject::ShouldTransToDict(oldLen, newLen)) { JSObject::ElementsToDictionary(thread, array); diff --git a/ecmascript/js_function.cpp b/ecmascript/js_function.cpp index 3db77ab99a..4cc4bc8749 100644 --- a/ecmascript/js_function.cpp +++ b/ecmascript/js_function.cpp @@ -959,22 +959,23 @@ void JSFunction::SetFunctionLength(const JSThread *thread, JSTaggedValue length) SetPropertyInlinedProps(thread, LENGTH_INLINE_PROPERTY_INDEX, length); } -void JSFunction::SetFunctionExtraInfo(JSThread *thread, void *nativeFunc, const NativePointerCallback &deleter, - void *data, size_t nativeBindingsize, Concurrent isConcurrent) +// static +void JSFunction::SetFunctionExtraInfo(JSThread *thread, const JSHandle &func, void *nativeFunc, + const NativePointerCallback &deleter, void *data, size_t nativeBindingsize, + Concurrent isConcurrent) { - JSTaggedType hashField = Barriers::GetValue(this, HASH_OFFSET); + JSTaggedType hashField = Barriers::GetValue(*func, HASH_OFFSET); EcmaVM *vm = thread->GetEcmaVM(); JSHandle value(thread, JSTaggedValue(hashField)); - JSHandle obj(thread, this); JSHandle pointer = vm->GetFactory()->NewJSNativePointer(nativeFunc, deleter, data, false, nativeBindingsize, isConcurrent); - if (!obj->HasHash()) { - Barriers::SetObject(thread, *obj, HASH_OFFSET, pointer.GetTaggedValue().GetRawData()); + if (!func->HasHash()) { + Barriers::SetObject(thread, *func, HASH_OFFSET, pointer.GetTaggedValue().GetRawData()); return; } if (value->IsHeapObject()) { if (value->IsJSNativePointer()) { - Barriers::SetObject(thread, *obj, HASH_OFFSET, pointer.GetTaggedValue().GetRawData()); + Barriers::SetObject(thread, *func, HASH_OFFSET, pointer.GetTaggedValue().GetRawData()); return; } JSHandle array(value); @@ -990,33 +991,33 @@ void JSFunction::SetFunctionExtraInfo(JSThread *thread, void *nativeFunc, const } newArray->Set(thread, nativeFieldCount + HASH_INDEX, array->Get(nativeFieldCount + HASH_INDEX)); newArray->Set(thread, nativeFieldCount + FUNCTION_EXTRA_INDEX, pointer); - Barriers::SetObject(thread, *obj, HASH_OFFSET, newArray.GetTaggedValue().GetRawData()); + Barriers::SetObject(thread, *func, HASH_OFFSET, newArray.GetTaggedValue().GetRawData()); } } else { JSHandle newArray = vm->GetFactory()->NewTaggedArray(RESOLVED_MAX_SIZE); newArray->SetExtraLength(0); newArray->Set(thread, HASH_INDEX, value); newArray->Set(thread, FUNCTION_EXTRA_INDEX, pointer); - Barriers::SetObject(thread, *obj, HASH_OFFSET, newArray.GetTaggedValue().GetRawData()); + Barriers::SetObject(thread, *func, HASH_OFFSET, newArray.GetTaggedValue().GetRawData()); } } -void JSFunction::SetSFunctionExtraInfo( - JSThread *thread, void *nativeFunc, const NativePointerCallback &deleter, void *data, size_t nativeBindingsize) +// static +void JSFunction::SetSFunctionExtraInfo(JSThread *thread, const JSHandle &func, void *nativeFunc, + const NativePointerCallback &deleter, void *data, size_t nativeBindingsize) { - JSTaggedType hashField = Barriers::GetValue(this, HASH_OFFSET); + JSTaggedType hashField = Barriers::GetValue(*func, HASH_OFFSET); EcmaVM *vm = thread->GetEcmaVM(); JSHandle value(thread, JSTaggedValue(hashField)); - JSHandle obj(thread, this); JSHandle pointer = vm->GetFactory()->NewSJSNativePointer(nativeFunc, deleter, data, false, nativeBindingsize); - if (!obj->HasHash()) { - Barriers::SetObject(thread, *obj, HASH_OFFSET, pointer.GetTaggedValue().GetRawData()); + if (!func->HasHash()) { + Barriers::SetObject(thread, *func, HASH_OFFSET, pointer.GetTaggedValue().GetRawData()); return; } if (value->IsHeapObject()) { if (value->IsJSNativePointer()) { - Barriers::SetObject(thread, *obj, HASH_OFFSET, pointer.GetTaggedValue().GetRawData()); + Barriers::SetObject(thread, *func, HASH_OFFSET, pointer.GetTaggedValue().GetRawData()); return; } JSHandle array(value); @@ -1033,14 +1034,14 @@ void JSFunction::SetSFunctionExtraInfo( } newArray->Set(thread, nativeFieldCount + HASH_INDEX, array->Get(nativeFieldCount + HASH_INDEX)); newArray->Set(thread, nativeFieldCount + FUNCTION_EXTRA_INDEX, pointer); - Barriers::SetObject(thread, *obj, HASH_OFFSET, newArray.GetTaggedValue().GetRawData()); + Barriers::SetObject(thread, *func, HASH_OFFSET, newArray.GetTaggedValue().GetRawData()); } } else { JSHandle newArray = vm->GetFactory()->NewSTaggedArrayWithoutInit(RESOLVED_MAX_SIZE); newArray->SetExtraLength(0); newArray->Set(thread, HASH_INDEX, value); newArray->Set(thread, FUNCTION_EXTRA_INDEX, pointer); - Barriers::SetObject(thread, *obj, HASH_OFFSET, newArray.GetTaggedValue().GetRawData()); + Barriers::SetObject(thread, *func, HASH_OFFSET, newArray.GetTaggedValue().GetRawData()); } } diff --git a/ecmascript/js_function.h b/ecmascript/js_function.h index 66c19eff7f..b069c37bcc 100644 --- a/ecmascript/js_function.h +++ b/ecmascript/js_function.h @@ -312,10 +312,11 @@ public: !ProfileTypeInfoCell::Cast(GetRawProfileTypeInfo())->GetValue().IsUndefined(); } - void SetFunctionExtraInfo(JSThread *thread, void *nativeFunc, const NativePointerCallback &deleter, - void *data, size_t nativeBindingsize = 0, Concurrent isConcurrent = Concurrent::NO); - void SetSFunctionExtraInfo(JSThread *thread, void *nativeFunc, const NativePointerCallback &deleter, - void *data, size_t nativeBindingsize = 0); + static void SetFunctionExtraInfo(JSThread *thread, const JSHandle &func, void *nativeFunc, + const NativePointerCallback &deleter, void *data, size_t nativeBindingsize = 0, + Concurrent isConcurrent = Concurrent::NO); + static void SetSFunctionExtraInfo(JSThread *thread, const JSHandle &func, void *nativeFunc, + const NativePointerCallback &deleter, void *data, size_t nativeBindingsize = 0); static void SetProfileTypeInfo(const JSThread *thread, const JSHandle &func, const JSHandle &value, BarrierMode mode = WRITE_BARRIER); static void UpdateProfileTypeInfoCell(JSThread *thread, JSHandle literalFunc, diff --git a/ecmascript/js_object-inl.h b/ecmascript/js_object-inl.h index 63e4aed1d0..6ef6000030 100644 --- a/ecmascript/js_object-inl.h +++ b/ecmascript/js_object-inl.h @@ -45,16 +45,16 @@ inline bool JSObject::IsExtensible() const return GetJSHClass()->IsExtensible(); } -inline void JSObject::FillElementsWithHoles(const JSThread *thread, uint32_t start, uint32_t end) +// static +inline void JSObject::FillElementsWithHoles(const JSThread *thread, const JSHandle &obj, + uint32_t start, uint32_t end) { if (start >= end) { return; } - JSHandle holeHandle(thread, JSTaggedValue::Hole()); - JSHandle thisObj(thread, this); for (uint32_t i = start; i < end; i++) { - ElementAccessor::Set(thread, thisObj, i, holeHandle, false); + ElementAccessor::Set(thread, obj, i, holeHandle, false); } } diff --git a/ecmascript/js_object.cpp b/ecmascript/js_object.cpp index baac8cc175..2db87165f3 100644 --- a/ecmascript/js_object.cpp +++ b/ecmascript/js_object.cpp @@ -2970,17 +2970,18 @@ void *ECMAObject::GetNativePointerField(int32_t index) const return nullptr; } -void ECMAObject::SetNativePointerField(const JSThread *thread, int32_t index, void *nativePointer, - const NativePointerCallback &callBack, void *data, size_t nativeBindingsize, Concurrent isConcurrent) +// static +void ECMAObject::SetNativePointerField(const JSThread *thread, const JSHandle &obj, int32_t index, + void *nativePointer, const NativePointerCallback &callBack, void *data, + size_t nativeBindingsize, Concurrent isConcurrent) { - JSTaggedType hashField = Barriers::GetValue(this, HASH_OFFSET); + JSTaggedType hashField = Barriers::GetValue(*obj, HASH_OFFSET); JSTaggedValue value(hashField); if (value.IsTaggedArray()) { JSHandle array(thread, value); if (static_cast(array->GetExtraLength()) > index) { EcmaVM *vm = thread->GetEcmaVM(); JSHandle current = JSHandle(thread, array->Get(thread, index)); - JSHandle obj(thread, this); if (!current->IsHole() && nativePointer == nullptr) { // Try to remove native pointer if exists. vm->RemoveFromNativePointerList(*JSHandle(current)); @@ -3010,14 +3011,14 @@ int32_t ECMAObject::GetNativePointerFieldCount() const return len; } -void ECMAObject::SetNativePointerFieldCount(const JSThread *thread, int32_t count) +// static +void ECMAObject::SetNativePointerFieldCount(const JSThread *thread, const JSHandle &obj, int32_t count) { if (count == 0) { return; } - JSTaggedType hashField = Barriers::GetValue(this, HASH_OFFSET); + JSTaggedType hashField = Barriers::GetValue(*obj, HASH_OFFSET); JSHandle value(thread, JSTaggedValue(hashField)); - JSHandle obj(thread, this); JSHandle object(obj); bool isShared = object->IsJSShared(); if (value->IsHeapObject()) { diff --git a/ecmascript/js_object.h b/ecmascript/js_object.h index 139a4fb201..44fcab44a9 100644 --- a/ecmascript/js_object.h +++ b/ecmascript/js_object.h @@ -385,11 +385,11 @@ public: } void* GetNativePointerField(int32_t index) const; - void SetNativePointerField(const JSThread *thread, int32_t index, void *nativePointer, - const NativePointerCallback &callBack, void *data, size_t nativeBindingsize = 0, - Concurrent isConcurrent = Concurrent::NO); + static void SetNativePointerField(const JSThread *thread, const JSHandle &obj, int32_t index, + void *nativePointer, const NativePointerCallback &callBack, void *data, + size_t nativeBindingsize = 0, Concurrent isConcurrent = Concurrent::NO); int32_t GetNativePointerFieldCount() const; - void SetNativePointerFieldCount(const JSThread *thread, int32_t count); + static void SetNativePointerFieldCount(const JSThread *thread, const JSHandle &obj, int32_t count); DECL_VISIT_OBJECT(HASH_OFFSET, SIZE); @@ -605,7 +605,8 @@ public: const JSHandle &receiver, const JSHandle &value, bool mayThrow = false); - void FillElementsWithHoles(const JSThread *thread, uint32_t start, uint32_t end); + static void FillElementsWithHoles(const JSThread *thread, const JSHandle &obj, + uint32_t start, uint32_t end); JSHClass *GetJSHClass() const { diff --git a/ecmascript/module/js_module_manager.cpp b/ecmascript/module/js_module_manager.cpp index b0404b7dcf..3359bd4549 100644 --- a/ecmascript/module/js_module_manager.cpp +++ b/ecmascript/module/js_module_manager.cpp @@ -254,7 +254,7 @@ void ModuleManager::StoreModuleValueInternal(JSHandle ¤t } JSThread *thread = vm_->GetJSThread(); JSHandle valueHandle(thread, value); - currentModule->StoreModuleValue(thread, index, valueHandle); + SourceTextModule::StoreModuleValue(thread, currentModule, index, valueHandle); } JSTaggedValue ModuleManager::GetModuleValueInner(JSTaggedValue key) @@ -342,7 +342,7 @@ void ModuleManager::StoreModuleValueInternal(JSHandle ¤t JSThread *thread = vm_->GetJSThread(); JSHandle keyHandle(thread, key); JSHandle valueHandle(thread, value); - currentModule->StoreModuleValue(thread, keyHandle, valueHandle); + SourceTextModule::StoreModuleValue(thread, currentModule, keyHandle, valueHandle); } JSHandle ModuleManager::GetImportedModule(const CString &referencing) { @@ -610,7 +610,7 @@ JSHandle ModuleManager::ExecuteNativeModuleMayThrowError(JSThread JSHandle(thread, JSTaggedValue::Undefined())); nativeModule->SetStatus(ModuleStatus::EVALUATED); nativeModule->SetLoadingTypes(LoadingTypes::STABLE_MODULE); - nativeModule->StoreModuleValue(thread, 0, JSNApiHelper::ToJSHandle(exportObject)); + SourceTextModule::StoreModuleValue(thread, nativeModule, 0, JSNApiHelper::ToJSHandle(exportObject)); AddResolveImportedModule(recordName, moduleRecord.GetTaggedValue()); return JSNApiHelper::ToJSHandle(exportObject); } diff --git a/ecmascript/module/js_module_namespace.cpp b/ecmascript/module/js_module_namespace.cpp index 686316fdc9..1207aa2422 100644 --- a/ecmascript/module/js_module_namespace.cpp +++ b/ecmascript/module/js_module_namespace.cpp @@ -177,7 +177,7 @@ JSHandle ModuleNamespace::OwnPropertyKeys(JSThread *thread, const J JSHandle moduleNamespace = JSHandle::Cast(obj); JSHandle exports(thread, moduleNamespace->GetExports()); JSHandle exportsArray = JSArray::ToTaggedArray(thread, exports); - if (!moduleNamespace->ValidateKeysAvailable(thread, exportsArray)) { + if (!ModuleNamespace::ValidateKeysAvailable(thread, moduleNamespace, exportsArray)) { return exportsArray; } @@ -196,7 +196,7 @@ JSHandle ModuleNamespace::OwnEnumPropertyKeys(JSThread *thread, con JSHandle moduleNamespace = JSHandle::Cast(obj); JSHandle exports(thread, moduleNamespace->GetExports()); JSHandle exportsArray = JSArray::ToTaggedArray(thread, exports); - if (!moduleNamespace->ValidateKeysAvailable(thread, exportsArray)) { + if (!ModuleNamespace::ValidateKeysAvailable(thread, moduleNamespace, exportsArray)) { return exportsArray; } @@ -351,9 +351,10 @@ bool ModuleNamespace::DeleteProperty(JSThread *thread, const JSHandle &exports) +// static +bool ModuleNamespace::ValidateKeysAvailable(JSThread *thread, const JSHandle &moduleNamespace, + const JSHandle &exports) { - JSHandle moduleNamespace(thread, this); JSHandle mm(thread, moduleNamespace->GetModule()); uint32_t exportsLength = exports->GetLength(); for (uint32_t idx = 0; idx < exportsLength; idx++) { diff --git a/ecmascript/module/js_module_namespace.h b/ecmascript/module/js_module_namespace.h index cbd44fac23..00fe8ec287 100644 --- a/ecmascript/module/js_module_namespace.h +++ b/ecmascript/module/js_module_namespace.h @@ -58,7 +58,8 @@ public: static JSHandle OwnEnumPropertyKeys(JSThread *thread, const JSHandle &obj); - bool ValidateKeysAvailable(JSThread *thread, const JSHandle &exports); + static bool ValidateKeysAvailable(JSThread *thread, const JSHandle &moduleNamespace, + const JSHandle &exports); static constexpr size_t MODULE_OFFSET = JSObject::SIZE; ACCESSORS(Module, MODULE_OFFSET, EXPORTS_OFFSET) diff --git a/ecmascript/module/js_module_source_text.cpp b/ecmascript/module/js_module_source_text.cpp index b0ad8551a7..12d9ba6aa3 100644 --- a/ecmascript/module/js_module_source_text.cpp +++ b/ecmascript/module/js_module_source_text.cpp @@ -389,12 +389,12 @@ bool SourceTextModule::LoadNativeModule(JSThread *thread, const JSHandleIsNativeModuleFailureInfoObject(vm))) { - requiredModule->StoreModuleValue(thread, 0, JSNApiHelper::ToJSHandle(exportObject)); + SourceTextModule::StoreModuleValue(thread, requiredModule, 0, JSNApiHelper::ToJSHandle(exportObject)); LOG_FULL(ERROR) << "loading fails, NativeModuleErrorObject is returned"; return false; } ASSERT(!thread->HasPendingException()); - requiredModule->StoreModuleValue(thread, 0, JSNApiHelper::ToJSHandle(exportObject)); + SourceTextModule::StoreModuleValue(thread, requiredModule, 0, JSNApiHelper::ToJSHandle(exportObject)); return true; } @@ -1358,9 +1358,10 @@ JSTaggedValue SourceTextModule::FindByExport(const JSTaggedValue &exportEntriesT return JSTaggedValue::Hole(); } -void SourceTextModule::StoreModuleValue(JSThread *thread, int32_t index, const JSHandle &value) +// static +void SourceTextModule::StoreModuleValue(JSThread *thread, const JSHandle &module, int32_t index, + const JSHandle &value) { - JSHandle module(thread, this); if (UNLIKELY(IsSharedModule(module)) && !value->IsSharedType()) { CString msg = "Export non-shared object from shared-module, module name is :" + module->GetEcmaModuleRecordNameString(); @@ -1386,11 +1387,11 @@ void SourceTextModule::StoreModuleValue(JSThread *thread, int32_t index, const J arr->Set(thread, index, value); } -// discard instructions won't consider shared-module. -void SourceTextModule::StoreModuleValue(JSThread *thread, const JSHandle &key, - const JSHandle &value) +// static +// discard instructions won't consider shared-module. +void SourceTextModule::StoreModuleValue(JSThread *thread, const JSHandle &module, + const JSHandle &key, const JSHandle &value) { - JSHandle module(thread, this); if (UNLIKELY(IsSharedModule(module)) && !value->IsSharedType()) { CString msg = "Export non-shared object from shared-module, module name is :" + module->GetEcmaModuleRecordNameString(); diff --git a/ecmascript/module/js_module_source_text.h b/ecmascript/module/js_module_source_text.h index 33eaa70bbf..3cdd718a47 100644 --- a/ecmascript/module/js_module_source_text.h +++ b/ecmascript/module/js_module_source_text.h @@ -345,10 +345,12 @@ public: ModuleTypes moduleType); JSTaggedValue GetModuleValue(JSThread *thread, int32_t index, bool isThrow); - void StoreModuleValue(JSThread *thread, int32_t index, const JSHandle &value); + static void StoreModuleValue(JSThread *thread, const JSHandle &module, int32_t index, + const JSHandle &value); JSTaggedValue GetModuleValue(JSThread *thread, JSTaggedValue key, bool isThrow); - void StoreModuleValue(JSThread *thread, const JSHandle &key, const JSHandle &value); + static void StoreModuleValue(JSThread *thread, const JSHandle &module, + const JSHandle &key, const JSHandle &value); static JSTaggedValue GetValueFromExportObject(JSThread *thread, JSHandle &exportObject, int32_t index); diff --git a/ecmascript/module/module_data_extractor.cpp b/ecmascript/module/module_data_extractor.cpp index 693aa728cf..377d18c445 100644 --- a/ecmascript/module/module_data_extractor.cpp +++ b/ecmascript/module/module_data_extractor.cpp @@ -122,7 +122,7 @@ JSHandle ModuleDataExtractor::ParseJsonModule(JSThread *thread, c defaultName, LocalExportEntry::LOCAL_DEFAULT_INDEX, SharedTypes::UNSENDABLE_MODULE); SourceTextModule::AddLocalExportEntry(thread, moduleRecord, localExportEntry, 0, 1); // 1 means len JSTaggedValue jsonData = JsonParse(thread, jsPandaFile, recordName); - moduleRecord->StoreModuleValue(thread, 0, JSHandle(thread, jsonData)); // index = 0 + SourceTextModule::StoreModuleValue(thread, moduleRecord, 0, JSHandle(thread, jsonData)); // index = 0 moduleRecord->SetEcmaModuleFilenameString(moduleFilename); @@ -149,7 +149,7 @@ JSHandle ModuleDataExtractor::ParseNativeModule(JSThread *thread, moduleRecord->SetTypes(moduleType); moduleRecord->SetIsNewBcVersion(true); moduleRecord->SetStatus(ModuleStatus::INSTANTIATED); - moduleRecord->StoreModuleValue(thread, 0, thread->GlobalConstants()->GetHandledUndefined()); + SourceTextModule::StoreModuleValue(thread, moduleRecord, 0, thread->GlobalConstants()->GetHandledUndefined()); return JSHandle::Cast(moduleRecord); } diff --git a/ecmascript/module/tests/ecma_module_test.cpp b/ecmascript/module/tests/ecma_module_test.cpp index 796e7d93a1..a59cd36e33 100644 --- a/ecmascript/module/tests/ecma_module_test.cpp +++ b/ecmascript/module/tests/ecma_module_test.cpp @@ -210,7 +210,7 @@ HWTEST_F_L0(EcmaModuleTest, StoreModuleValue) JSHandle storeKey = JSHandle::Cast(objFactory->NewFromUtf8(localName)); JSHandle valueHandle = JSHandle::Cast(objFactory->NewFromUtf8(value)); - module->StoreModuleValue(thread, storeKey, valueHandle); + SourceTextModule::StoreModuleValue(thread, module, storeKey, valueHandle); JSHandle loadKey = JSHandle::Cast(objFactory->NewFromUtf8(localName)); JSTaggedValue loadValue = module->GetModuleValue(thread, loadKey.GetTaggedValue(), false); @@ -242,7 +242,7 @@ HWTEST_F_L0(EcmaModuleTest, GetModuleValue) SourceTextModule::AddLocalExportEntry(thread, moduleExport, localExportEntry, 0, 1); // store module value JSHandle exportValueHandle = JSHandle::Cast(objFactory->NewFromUtf8(exportValue)); - moduleExport->StoreModuleValue(thread, exportLocalNameHandle, exportValueHandle); + SourceTextModule::StoreModuleValue(thread, moduleExport, exportLocalNameHandle, exportValueHandle); JSTaggedValue importDefaultValue = moduleExport->GetModuleValue(thread, exportLocalNameHandle.GetTaggedValue(), false); @@ -288,11 +288,11 @@ HWTEST_F_L0(EcmaModuleTest, FindByExport) JSHandle storeKey = JSHandle::Cast(objFactory->NewFromUtf8(localName1)); JSHandle valueHandle = JSHandle::Cast(objFactory->NewFromUtf8(value)); - module->StoreModuleValue(thread, storeKey, valueHandle); + SourceTextModule::StoreModuleValue(thread, module, storeKey, valueHandle); JSHandle storeKey2 = JSHandle::Cast(objFactory->NewFromUtf8(localName2)); JSHandle valueHandle2 = JSHandle::Cast(objFactory->NewFromUtf8(value2)); - module->StoreModuleValue(thread, storeKey2, valueHandle2); + SourceTextModule::StoreModuleValue(thread, module, storeKey2, valueHandle2); // FindByExport cannot find key from exportEntries, returns Hole() JSHandle loadKey1 = JSHandle::Cast(objFactory->NewFromUtf8(localName3)); @@ -1635,8 +1635,8 @@ HWTEST_F_L0(EcmaModuleTest, StoreModuleValue2) JSHandle storeKey = JSHandle::Cast(objFactory->NewFromUtf8(localName)); JSHandle valueHandle = JSHandle::Cast(objFactory->NewFromUtf8(value)); JSHandle valueHandle1 = JSHandle::Cast(objFactory->NewFromUtf8(value2)); - module->StoreModuleValue(thread, storeKey, valueHandle); - module->StoreModuleValue(thread, index, valueHandle1); + SourceTextModule::StoreModuleValue(thread, module, storeKey, valueHandle); + SourceTextModule::StoreModuleValue(thread, module, index, valueHandle1); JSHandle loadKey = JSHandle::Cast(objFactory->NewFromUtf8(localName)); JSTaggedValue loadValue = module->GetModuleValue(thread, loadKey.GetTaggedValue(), false); JSTaggedValue loadValue1 = module->GetModuleValue(thread, index, false); @@ -2042,7 +2042,7 @@ HWTEST_F_L0(EcmaModuleTest, ProcessModuleLoadInfoForESM) JSHandle localExportEntries = objectFactory->NewTaggedArray(1); localExportEntries->Set(thread, 0, localExportEntry); module2->SetLocalExportEntries(thread, localExportEntries); - module2->StoreModuleValue(thread, 0, val); + SourceTextModule::StoreModuleValue(thread, module2, 0, val); module2->SetStatus(ModuleStatus::EVALUATED); ModuleLogger *moduleLogger = new ModuleLogger(thread->GetEcmaVM()); thread->GetCurrentEcmaContext()->SetModuleLogger(moduleLogger); @@ -2090,7 +2090,7 @@ HWTEST_F_L0(EcmaModuleTest, ProcessModuleLoadInfoForCJS) JSHandle localExportEntries = objectFactory->NewTaggedArray(1); localExportEntries->Set(thread, 0, localExportEntry); module2->SetLocalExportEntries(thread, localExportEntries); - module2->StoreModuleValue(thread, 0, val); + SourceTextModule::StoreModuleValue(thread, module2, 0, val); module2->SetTypes(ModuleTypes::CJS_MODULE); module2->SetStatus(ModuleStatus::EVALUATED); JSHandle moduleCjs = objectFactory->NewCjsModule(); @@ -2142,7 +2142,7 @@ HWTEST_F_L0(EcmaModuleTest, ProcessModuleLoadInfoForNativeModule) JSHandle localExportEntries = objectFactory->NewTaggedArray(1); localExportEntries->Set(thread, 0, localExportEntry); module2->SetLocalExportEntries(thread, localExportEntries); - module2->StoreModuleValue(thread, 0, val); + SourceTextModule::StoreModuleValue(thread, module2, 0, val); module2->SetTypes(ModuleTypes::NATIVE_MODULE); module2->SetStatus(ModuleStatus::EVALUATED); @@ -2186,7 +2186,7 @@ HWTEST_F_L0(EcmaModuleTest, ResolvedBindingForLog) JSHandle localExportEntries = objectFactory->NewTaggedArray(1); localExportEntries->Set(thread, 0, localExportEntry); module2->SetLocalExportEntries(thread, localExportEntries); - module2->StoreModuleValue(thread, 0, val); + SourceTextModule::StoreModuleValue(thread, module2, 0, val); module2->SetStatus(ModuleStatus::EVALUATED); ModuleManager *moduleManager = thread->GetCurrentEcmaContext()->GetModuleManager(); moduleManager->AddResolveImportedModule(recordName2, module2.GetTaggedValue()); @@ -2459,7 +2459,7 @@ HWTEST_F_L0(EcmaModuleTest, ResolveNativeStarExport) JSHandle localExportEntries = objectFactory->NewTaggedArray(1); localExportEntries->Set(thread, 0, localExportEntry); module->SetLocalExportEntries(thread, localExportEntries); - module->StoreModuleValue(thread, 0, val); + SourceTextModule::StoreModuleValue(thread, module, 0, val); module->SetTypes(ModuleTypes::NATIVE_MODULE); JSHandle res1 = SourceTextModule::ResolveNativeStarExport(thread, module, val); @@ -2491,7 +2491,7 @@ HWTEST_F_L0(EcmaModuleTest, LoadNativeModuleImpl) JSHandle localExportEntries = objectFactory->NewTaggedArray(1); localExportEntries->Set(thread, 0, localExportEntry); module->SetLocalExportEntries(thread, localExportEntries); - module->StoreModuleValue(thread, 0, val); + SourceTextModule::StoreModuleValue(thread, module, 0, val); module->SetTypes(ModuleTypes::NATIVE_MODULE); ModuleLogger *moduleLogger = new ModuleLogger(vm); thread->GetCurrentEcmaContext()->SetModuleLogger(moduleLogger); @@ -2526,7 +2526,7 @@ HWTEST_F_L0(EcmaModuleTest, LoadNativeModuleMayThrowError1) localExportEntries->Set(thread, 0, localExportEntry); module->SetEcmaModuleRecordNameString("@app:bundleName/moduleName/lib*.so"); module->SetLocalExportEntries(thread, localExportEntries); - module->StoreModuleValue(thread, 0, val); + SourceTextModule::StoreModuleValue(thread, module, 0, val); module->SetTypes(ModuleTypes::NATIVE_MODULE); Local requireNapi = StringRef::NewFromUtf8(vm, "requireNapi"); Local globalObject = JSNApi::GetGlobalObject(vm); @@ -2547,7 +2547,7 @@ HWTEST_F_L0(EcmaModuleTest, LoadNativeModuleMayThrowError2) localExportEntries->Set(thread, 0, localExportEntry); module->SetEcmaModuleRecordNameString("@app:bundleName/moduleName/lib*.so"); module->SetLocalExportEntries(thread, localExportEntries); - module->StoreModuleValue(thread, 0, val); + SourceTextModule::StoreModuleValue(thread, module, 0, val); module->SetTypes(ModuleTypes::NATIVE_MODULE); Local requireNapi = StringRef::NewFromUtf8(vm, "requireNapi"); Local globalObject = JSNApi::GetGlobalObject(vm); @@ -2568,7 +2568,7 @@ HWTEST_F_L0(EcmaModuleTest, LoadNativeModuleMayThrowError3) localExportEntries->Set(thread, 0, localExportEntry); module->SetEcmaModuleRecordNameString("@app:bundleName/moduleName/lib*.so"); module->SetLocalExportEntries(thread, localExportEntries); - module->StoreModuleValue(thread, 0, val); + SourceTextModule::StoreModuleValue(thread, module, 0, val); module->SetTypes(ModuleTypes::NATIVE_MODULE); Local requireNapi = StringRef::NewFromUtf8(vm, "requireNapi"); Local globalObject = JSNApi::GetGlobalObject(vm); @@ -2589,7 +2589,7 @@ HWTEST_F_L0(EcmaModuleTest, LoadNativeModuleMayThrowError4) localExportEntries->Set(thread, 0, localExportEntry); module->SetEcmaModuleRecordNameString("@app:bundleName/moduleName/lib*.so"); module->SetLocalExportEntries(thread, localExportEntries); - module->StoreModuleValue(thread, 0, val); + SourceTextModule::StoreModuleValue(thread, module, 0, val); module->SetTypes(ModuleTypes::NATIVE_MODULE); Local requireNapi = StringRef::NewFromUtf8(vm, "requireNapi"); Local globalObject = JSNApi::GetGlobalObject(vm); @@ -2610,7 +2610,7 @@ HWTEST_F_L0(EcmaModuleTest, LoadNativeModule1) localExportEntries->Set(thread, 0, localExportEntry); module->SetEcmaModuleRecordNameString("@app:bundleName/moduleName/lib*.so"); module->SetLocalExportEntries(thread, localExportEntries); - module->StoreModuleValue(thread, 0, val); + SourceTextModule::StoreModuleValue(thread, module, 0, val); module->SetTypes(ModuleTypes::NATIVE_MODULE); Local requireNapi = StringRef::NewFromUtf8(vm, "requireNapi"); Local globalObject = JSNApi::GetGlobalObject(vm); @@ -2631,7 +2631,7 @@ HWTEST_F_L0(EcmaModuleTest, LoadNativeModule2) localExportEntries->Set(thread, 0, localExportEntry); module->SetEcmaModuleRecordNameString("@app:bundleName/moduleName/lib*.so"); module->SetLocalExportEntries(thread, localExportEntries); - module->StoreModuleValue(thread, 0, val); + SourceTextModule::StoreModuleValue(thread, module, 0, val); module->SetTypes(ModuleTypes::NATIVE_MODULE); Local requireNapi = StringRef::NewFromUtf8(vm, "requireNapi"); Local globalObject = JSNApi::GetGlobalObject(vm); @@ -2663,7 +2663,7 @@ HWTEST_F_L0(EcmaModuleTest, EvaluateNativeModule2) localExportEntries->Set(thread, 0, localExportEntry); module->SetEcmaModuleRecordNameString("@app:bundleName/moduleName/lib*.so"); module->SetLocalExportEntries(thread, localExportEntries); - module->StoreModuleValue(thread, 0, val); + SourceTextModule::StoreModuleValue(thread, module, 0, val); module->SetTypes(ModuleTypes::NATIVE_MODULE); module->SetStatus(ModuleStatus::INSTANTIATED); Local requireNapi = StringRef::NewFromUtf8(vm, "requireNapi"); @@ -2685,7 +2685,7 @@ HWTEST_F_L0(EcmaModuleTest, EvaluateNativeModule3) localExportEntries->Set(thread, 0, localExportEntry); module->SetEcmaModuleRecordNameString("@app:bundleName/moduleName/lib*.so"); module->SetLocalExportEntries(thread, localExportEntries); - module->StoreModuleValue(thread, 0, val); + SourceTextModule::StoreModuleValue(thread, module, 0, val); module->SetTypes(ModuleTypes::NATIVE_MODULE); module->SetStatus(ModuleStatus::INSTANTIATED); Local requireNapi = StringRef::NewFromUtf8(vm, "requireNapi"); @@ -2831,7 +2831,7 @@ HWTEST_F_L0(EcmaModuleTest, LoadNativeModule) localExportEntries->Set(thread, 0, localExportEntry); module->SetEcmaModuleRecordNameString("@app:bundleName/moduleName/lib*.so"); module->SetLocalExportEntries(thread, localExportEntries); - module->StoreModuleValue(thread, 0, val); + SourceTextModule::StoreModuleValue(thread, module, 0, val); module->SetTypes(ModuleTypes::NATIVE_MODULE); ModuleManager *moduleManager = thread->GetCurrentEcmaContext()->GetModuleManager(); JSHandle res = moduleManager->LoadNativeModule( @@ -2852,7 +2852,7 @@ HWTEST_F_L0(EcmaModuleTest, ExecuteNativeModuleMayThrowError) localExportEntries->Set(thread, 0, localExportEntry); module->SetEcmaModuleRecordNameString(recordName); module->SetLocalExportEntries(thread, localExportEntries); - module->StoreModuleValue(thread, 0, val); + SourceTextModule::StoreModuleValue(thread, module, 0, val); module->SetTypes(ModuleTypes::NATIVE_MODULE); module->SetStatus(ModuleStatus::EVALUATED); ModuleManager *moduleManager = thread->GetCurrentEcmaContext()->GetModuleManager(); @@ -2880,7 +2880,7 @@ HWTEST_F_L0(EcmaModuleTest, ExecuteNativeModule) localExportEntries->Set(thread, 0, localExportEntry); module->SetEcmaModuleRecordNameString(recordName); module->SetLocalExportEntries(thread, localExportEntries); - module->StoreModuleValue(thread, 0, val); + SourceTextModule::StoreModuleValue(thread, module, 0, val); module->SetTypes(ModuleTypes::NATIVE_MODULE); ModuleManager *moduleManager = thread->GetCurrentEcmaContext()->GetModuleManager(); @@ -2906,7 +2906,7 @@ HWTEST_F_L0(EcmaModuleTest, ExecuteNativeModule2) localExportEntries->Set(thread, 0, localExportEntry); module->SetEcmaModuleRecordNameString(recordName); module->SetLocalExportEntries(thread, localExportEntries); - module->StoreModuleValue(thread, 0, val); + SourceTextModule::StoreModuleValue(thread, module, 0, val); module->SetTypes(ModuleTypes::NATIVE_MODULE); ModuleManager *moduleManager = thread->GetCurrentEcmaContext()->GetModuleManager(); @@ -3138,7 +3138,7 @@ HWTEST_F_L0(EcmaModuleTest, GetLazyModuleValueFromRecordBinding) JSHandle localExportEntries = objectFactory->NewTaggedArray(1); localExportEntries->Set(thread, 0, localExportEntry); module2->SetLocalExportEntries(thread, localExportEntries); - module2->StoreModuleValue(thread, 0, val); + SourceTextModule::StoreModuleValue(thread, module2, 0, val); module2->SetStatus(ModuleStatus::EVALUATED); module2->SetTypes(ModuleTypes::NATIVE_MODULE); ModuleManager *moduleManager = thread->GetCurrentEcmaContext()->GetModuleManager(); @@ -3335,7 +3335,7 @@ HWTEST_F_L0(EcmaModuleTest, StoreModuleValue4) localExportEntries->Set(thread, 0, localExportEntry); module->SetLocalExportEntries(thread, localExportEntries); module->SetSharedType(SharedTypes::SHARED_MODULE); - module->StoreModuleValue(thread, 0, val); + SourceTextModule::StoreModuleValue(thread, module, 0, val); EXPECT_TRUE(!thread->HasPendingException()); } @@ -3865,7 +3865,7 @@ HWTEST_F_L0(EcmaModuleTest, ResolveNativeStarExport2) JSHandle localExportEntries = objectFactory->NewTaggedArray(1); localExportEntries->Set(thread, 0, localExportEntry); module->SetLocalExportEntries(thread, localExportEntries); - module->StoreModuleValue(thread, 0, val); + SourceTextModule::StoreModuleValue(thread, module, 0, val); module->SetTypes(ModuleTypes::NATIVE_MODULE); int arkProperties = thread->GetEcmaVM()->GetJSOptions().GetArkProperties(); @@ -3885,7 +3885,7 @@ HWTEST_F_L0(EcmaModuleTest, LoadNativeModuleImpl2) JSHandle localExportEntries = objectFactory->NewTaggedArray(1); localExportEntries->Set(thread, 0, localExportEntry); module->SetLocalExportEntries(thread, localExportEntries); - module->StoreModuleValue(thread, 0, val); + SourceTextModule::StoreModuleValue(thread, module, 0, val); module->SetTypes(ModuleTypes::NATIVE_MODULE); ModuleLogger *moduleLogger = new ModuleLogger(vm); thread->GetCurrentEcmaContext()->SetModuleLogger(moduleLogger); @@ -3915,7 +3915,7 @@ HWTEST_F_L0(EcmaModuleTest, LoadNativeModule3) localExportEntries->Set(thread, 0, localExportEntry); module->SetEcmaModuleRecordNameString("@app:bundleName/moduleName/lib*.so"); module->SetLocalExportEntries(thread, localExportEntries); - module->StoreModuleValue(thread, 0, val); + SourceTextModule::StoreModuleValue(thread, module, 0, val); module->SetTypes(ModuleTypes::NATIVE_MODULE); Local requireNapi = StringRef::NewFromUtf8(vm, "requireNapi"); Local globalObject = JSNApi::GetGlobalObject(vm); diff --git a/ecmascript/napi/jsnapi_expo.cpp b/ecmascript/napi/jsnapi_expo.cpp index a087581ec5..fcf238693d 100644 --- a/ecmascript/napi/jsnapi_expo.cpp +++ b/ecmascript/napi/jsnapi_expo.cpp @@ -2950,7 +2950,7 @@ void ObjectRef::SetNativePointerFieldCount(const EcmaVM *vm, int32_t count) // So we need do special value check before use it. DCHECK_SPECIAL_VALUE(this); JSHandle object(JSNApiHelper::ToJSHandle(this)); - object->SetNativePointerFieldCount(thread, count); + ECMAObject::SetNativePointerFieldCount(thread, object, count); } int32_t ObjectRef::GetNativePointerFieldCount(const EcmaVM *vm) @@ -2982,7 +2982,7 @@ void ObjectRef::SetNativePointerField(const EcmaVM *vm, int32_t index, void *nat // So we need do special value check before use it. DCHECK_SPECIAL_VALUE(this); JSHandle object(JSNApiHelper::ToJSHandle(this)); - object->SetNativePointerField(thread, index, nativePointer, callBack, data, nativeBindingsize); + ECMAObject::SetNativePointerField(thread, object, index, nativePointer, callBack, data, nativeBindingsize); } void ObjectRef::SetConcurrentNativePointerField(const EcmaVM *vm, int32_t index, void *nativePointer, @@ -2994,7 +2994,8 @@ void ObjectRef::SetConcurrentNativePointerField(const EcmaVM *vm, int32_t index, // So we need do special value check before use it. DCHECK_SPECIAL_VALUE(this); JSHandle object(JSNApiHelper::ToJSHandle(this)); - object->SetNativePointerField(thread, index, nativePointer, callBack, data, nativeBindingsize, Concurrent::YES); + ECMAObject::SetNativePointerField(thread, object, index, nativePointer, callBack, data, + nativeBindingsize, Concurrent::YES); } // -------------------------------- NativePointerRef ------------------------------------ @@ -3287,7 +3288,8 @@ Local FunctionRef::New(EcmaVM *vm, FunctionCallback nativeFunc, ObjectFactory *factory = vm->GetFactory(); JSHandle env = vm->GetGlobalEnv(); JSHandle current(factory->NewJSFunction(env, reinterpret_cast(Callback::RegisterCallback))); - current->SetFunctionExtraInfo(thread, reinterpret_cast(nativeFunc), deleter, data, nativeBindingsize); + JSFunction::SetFunctionExtraInfo(thread, current, reinterpret_cast(nativeFunc), + deleter, data, nativeBindingsize); current->SetCallNapi(callNapi); return JSNApiHelper::ToLocal(JSHandle(current)); } @@ -3300,8 +3302,8 @@ Local FunctionRef::NewConcurrent(EcmaVM *vm, FunctionCallback nativ ObjectFactory *factory = vm->GetFactory(); JSHandle env = vm->GetGlobalEnv(); JSHandle current(factory->NewJSFunction(env, reinterpret_cast(Callback::RegisterCallback))); - current->SetFunctionExtraInfo(thread, reinterpret_cast(nativeFunc), deleter, - data, nativeBindingsize, Concurrent::YES); + JSFunction::SetFunctionExtraInfo(thread, current, reinterpret_cast(nativeFunc), deleter, + data, nativeBindingsize, Concurrent::YES); current->SetCallNapi(callNapi); return JSNApiHelper::ToLocal(JSHandle(current)); } @@ -3314,7 +3316,7 @@ Local FunctionRef::New(EcmaVM *vm, InternalFunctionCallback nativeF ObjectFactory *factory = vm->GetFactory(); JSHandle env = vm->GetGlobalEnv(); JSHandle current(factory->NewJSFunction(env, reinterpret_cast(nativeFunc))); - current->SetFunctionExtraInfo(thread, nullptr, deleter, data, nativeBindingsize); + JSFunction::SetFunctionExtraInfo(thread, current, nullptr, deleter, data, nativeBindingsize); current->SetCallNapi(callNapi); return JSNApiHelper::ToLocal(JSHandle(current)); } @@ -3331,7 +3333,7 @@ Local FunctionRef::NewSendable(EcmaVM *vm, ObjectFactory *factory = vm->GetFactory(); JSHandle env = vm->GetGlobalEnv(); JSHandle current(factory->NewSFunction(env, reinterpret_cast(nativeFunc))); - current->SetSFunctionExtraInfo(thread, nullptr, deleter, data, nativeBindingsize); + JSFunction::SetSFunctionExtraInfo(thread, current, nullptr, deleter, data, nativeBindingsize); current->SetCallNapi(callNapi); return JSNApiHelper::ToLocal(JSHandle(current)); } @@ -3344,7 +3346,7 @@ Local FunctionRef::NewConcurrent(EcmaVM *vm, InternalFunctionCallba ObjectFactory *factory = vm->GetFactory(); JSHandle env = vm->GetGlobalEnv(); JSHandle current(factory->NewJSFunction(env, reinterpret_cast(nativeFunc))); - current->SetFunctionExtraInfo(thread, nullptr, deleter, data, nativeBindingsize, Concurrent::YES); + JSFunction::SetFunctionExtraInfo(thread, current, nullptr, deleter, data, nativeBindingsize, Concurrent::YES); current->SetCallNapi(callNapi); return JSNApiHelper::ToLocal(JSHandle(current)); } @@ -3383,7 +3385,8 @@ Local FunctionRef::NewClassFunction(EcmaVM *vm, FunctionCallback na factory->NewJSFunctionByHClass(reinterpret_cast(Callback::RegisterCallback), hclass, ecmascript::FunctionKind::CLASS_CONSTRUCTOR); InitClassFunction(vm, current, callNapi); - current->SetFunctionExtraInfo(thread, reinterpret_cast(nativeFunc), deleter, data, nativeBindingsize); + JSFunction::SetFunctionExtraInfo(thread, current, reinterpret_cast(nativeFunc), + deleter, data, nativeBindingsize); Local result = JSNApiHelper::ToLocal(JSHandle(current)); return scope.Escape(result); } @@ -3401,7 +3404,7 @@ Local FunctionRef::NewConcurrentClassFunction(EcmaVM *vm, InternalF factory->NewJSFunctionByHClass(reinterpret_cast(nativeFunc), hclass, ecmascript::FunctionKind::CLASS_CONSTRUCTOR); InitClassFunction(vm, current, callNapi); - current->SetFunctionExtraInfo(thread, nullptr, deleter, data, nativeBindingsize, Concurrent::YES); + JSFunction::SetFunctionExtraInfo(thread, current, nullptr, deleter, data, nativeBindingsize, Concurrent::YES); Local result = JSNApiHelper::ToLocal(JSHandle(current)); return scope.Escape(result); } @@ -3419,7 +3422,7 @@ Local FunctionRef::NewClassFunction(EcmaVM *vm, InternalFunctionCal factory->NewJSFunctionByHClass(reinterpret_cast(nativeFunc), hclass, ecmascript::FunctionKind::CLASS_CONSTRUCTOR); InitClassFunction(vm, current, callNapi); - current->SetFunctionExtraInfo(thread, nullptr, deleter, data, nativeBindingsize); + JSFunction::SetFunctionExtraInfo(thread, current, nullptr, deleter, data, nativeBindingsize); Local result = JSNApiHelper::ToLocal(JSHandle(current)); return scope.Escape(result); } @@ -3461,7 +3464,7 @@ Local FunctionRef::NewSendableClassFunction(const EcmaVM *vm, constructor->SetProtoOrHClass(thread, prototype); constructor->SetLexicalEnv(thread, constructor); constructor->SetCallNapi(callNapi); - constructor->SetSFunctionExtraInfo(thread, nullptr, deleter, data, nativeBindingSize); + JSFunction::SetSFunctionExtraInfo(thread, constructor, nullptr, deleter, data, nativeBindingSize); JSHClass *parentIHClass{nullptr}; if (hasParent) { @@ -3752,9 +3755,9 @@ void FunctionRef::SetData(const EcmaVM *vm, void *data, NativePointerCallback de JSHandle funcValue = JSNApiHelper::ToJSHandle(this); JSHandle function(funcValue); if (function->IsJSShared()) { - function->SetSFunctionExtraInfo(thread, nullptr, deleter, data, 0); + JSFunction::SetSFunctionExtraInfo(thread, function, nullptr, deleter, data, 0); } else { - function->SetFunctionExtraInfo(thread, nullptr, deleter, data, 0); + JSFunction::SetFunctionExtraInfo(thread, function, nullptr, deleter, data, 0); } } diff --git a/ecmascript/shared_objects/js_shared_array.cpp b/ecmascript/shared_objects/js_shared_array.cpp index 62bcddcaae..28fb20ee8f 100644 --- a/ecmascript/shared_objects/js_shared_array.cpp +++ b/ecmascript/shared_objects/js_shared_array.cpp @@ -222,7 +222,7 @@ void JSSharedArray::SetCapacity(JSThread *thread, const JSHandle &arra if (newLen <= capacity) { // judge if need to cut down the array size, else fill the unused tail with holes CheckAndCopyArray(thread, JSHandle(array)); - array->FillElementsWithHoles(thread, newLen, oldLen < capacity ? oldLen : capacity); + JSObject::FillElementsWithHoles(thread, array, newLen, oldLen < capacity ? oldLen : capacity); } if (newLen > capacity) { JSObject::GrowElementsCapacity(thread, array, newLen, isNew); diff --git a/ecmascript/tests/js_object_test.cpp b/ecmascript/tests/js_object_test.cpp index ac3d91171c..cb66dedf97 100644 --- a/ecmascript/tests/js_object_test.cpp +++ b/ecmascript/tests/js_object_test.cpp @@ -1255,9 +1255,9 @@ HWTEST_F_L0(JSObjectTest, NativePointerField) ECMAObject::SetHash(thread, 87, JSHandle::Cast(obj)); EXPECT_TRUE(obj->GetHash() == 87); - obj->SetNativePointerFieldCount(thread, 1); + ECMAObject::SetNativePointerFieldCount(thread, obj, 1); char array[] = "Hello World!"; - obj->SetNativePointerField(thread, 0, array, nullptr, nullptr); + ECMAObject::SetNativePointerField(thread, obj, 0, array, nullptr, nullptr); int32_t count = obj->GetNativePointerFieldCount(); EXPECT_TRUE(count == 1); void *pointer = obj->GetNativePointerField(0);