/arkcompiler/runtime_core/static_core/plugins/ets/runtime/napi/ |
D | ets_napi_native_interface.cpp | 38 #define ETS_NAPI_DEBUG_TRACE(env) argument 40 #define CHECK_ENV(env) … argument 42 …ets_env *e = env; … 48 #define CHECK_ARG(env, arg) ETS_NAPI_RETURN_IF_EQ(arg, nullptr, ETS_INVALID_ARG) argument 219 static NapiType GeneralMethodCall(EtsEnv *env, ets_object obj, ets_method methodId, Args args) in GeneralMethodCall() argument 222 ScopedManagedCodeFix s(PandaEtsNapiEnv::ToPandaEtsEnv(env)); in GeneralMethodCall() 248 static inline EtsNapiType GetPrimitiveTypeField(EtsEnv *env, ets_object obj, ets_field fieldId) in GetPrimitiveTypeField() argument 254 ScopedManagedCodeFix s(PandaEtsNapiEnv::ToPandaEtsEnv(env)); in GetPrimitiveTypeField() 261 static inline void SetPrimitiveTypeField(EtsEnv *env, ets_object obj, ets_field fieldId, EtsNapiTyp… in SetPrimitiveTypeField() argument 267 ScopedManagedCodeFix s(PandaEtsNapiEnv::ToPandaEtsEnv(env)); in SetPrimitiveTypeField() [all …]
|
/arkcompiler/ets_runtime/ecmascript/builtins/ |
D | builtins.h | 46 …void Initialize(const JSHandle<GlobalEnv> &env, JSThread *thread, bool lazyInit = false, bool isRe… 54 …JSHandle<JSFunction> NewBuiltinConstructor(const JSHandle<GlobalEnv> &env, const JSHandle<JSObject… 59 JSHandle<JSFunction> NewBuiltinCjsCtor(const JSHandle<GlobalEnv> &env, 63 …JSHandle<JSFunction> NewFunction(const JSHandle<GlobalEnv> &env, const JSHandle<JSTaggedValue> &ke… 68 void InitializePropertyDetector(const JSHandle<GlobalEnv> &env, bool lazyInit) const; 73 void InitializeCtor(const JSHandle<GlobalEnv> &env, const JSHandle<JSObject> &prototype, 76 …void InitializeGlobalObject(const JSHandle<GlobalEnv> &env, const JSHandle<JSObject> &globalObject… 78 …void InitializeFunction(const JSHandle<GlobalEnv> &env, const JSHandle<JSHClass> &emptyFuncClass) … 80 … void InitializeObject(const JSHandle<GlobalEnv> &env, const JSHandle<JSObject> &objFuncPrototype, 83 void InitializeNumber(const JSHandle<GlobalEnv> &env, const JSHandle<JSObject> &globalObject, [all …]
|
D | builtins.cpp | 195 void Builtins::InitializeSObjectAndSFunction(const JSHandle<GlobalEnv> &env) in InitializeSObjectAndSFunction() argument 214 InitializeSFunciton(env, sFuncPrototypeHClass); in InitializeSObjectAndSFunction() 215 InitializeSObject(env, sObjIHClass, sObjFuncPrototype); in InitializeSObjectAndSFunction() 216 env->SetSObjectFunctionPrototype(thread_, sObjFuncPrototype); in InitializeSObjectAndSFunction() 220 void Builtins::InitializeSObject(const JSHandle<GlobalEnv> &env, const JSHandle<JSHClass> &sObjIHCl… in InitializeSObject() argument 226 …factory_->NewSFunction(env, reinterpret_cast<void *>(BuiltinsSharedObject::SharedObjectConstructor… in InitializeSObject() 229 env->SetSObjectFunction(thread_, sObjectFunction); in InitializeSObject() 232 … SetSFunction(env, JSHandle<JSObject>(sObjectFunction), entry.GetName(), entry.GetEntrypoint(), in InitializeSObject() 238 … SetSFunction(env, sObjFuncPrototypeObj, entry.GetName(), entry.GetEntrypoint(), entry.GetLength(), in InitializeSObject() 245 CreateSGetterSetter(env, Object::ProtoGetter, "__proto__", FunctionLength::ZERO); in InitializeSObject() [all …]
|
D | builtins_lazy_callback.cpp | 30 auto env = vm->GetGlobalEnv(); in Date() local 33 JSHandle<JSTaggedValue> objFuncPrototypeVal = env->GetObjectFunctionPrototype(); in Date() 35 builtin.InitializeDate(env, objFuncPrototypeVal); in Date() 36 return env->GetDateFunction().GetTaggedValue(); in Date() 45 auto env = vm->GetGlobalEnv(); in Set() local 49 JSHandle<JSTaggedValue> objFuncPrototypeVal = env->GetObjectFunctionPrototype(); in Set() 50 builtin.InitializeSet(env, objFuncPrototypeVal); in Set() 51 return env->GetBuiltinsSetFunction().GetTaggedValue(); in Set() 60 auto env = vm->GetGlobalEnv(); in Map() local 64 JSHandle<JSTaggedValue> objFuncPrototypeVal = env->GetObjectFunctionPrototype(); in Map() [all …]
|
/arkcompiler/runtime_core/static_core/plugins/ets/tests/mock/ |
D | calling_methods_test_helper.h | 33 [[maybe_unused]] static void CallVoidMethodListHelper(EtsEnv *env, ets_object obj, ets_method metho… in CallVoidMethodListHelper() argument 37 env->CallVoidMethodList(obj, methodId, args); in CallVoidMethodListHelper() 40 [[maybe_unused]] static ets_object CallObjectMethodListHelper(EtsEnv *env, ets_object obj, ets_meth… in CallObjectMethodListHelper() argument 44 return env->CallObjectMethodList(obj, methodId, args); in CallObjectMethodListHelper() 47 [[maybe_unused]] static ets_boolean CallBooleanMethodListHelper(EtsEnv *env, ets_object obj, ets_me… in CallBooleanMethodListHelper() argument 51 return env->CallBooleanMethodList(obj, methodId, args); in CallBooleanMethodListHelper() 54 [[maybe_unused]] static ets_byte CallByteMethodListHelper(EtsEnv *env, ets_object obj, ets_method m… in CallByteMethodListHelper() argument 58 return env->CallByteMethodList(obj, methodId, args); in CallByteMethodListHelper() 61 [[maybe_unused]] static ets_char CallCharMethodListHelper(EtsEnv *env, ets_object obj, ets_method m… in CallCharMethodListHelper() argument 65 return env->CallCharMethodList(obj, methodId, args); in CallCharMethodListHelper() [all …]
|
D | final_field_native_test.cpp | 50 ASSERT_TRUE(ETS_CreateVM(&vm, &env, &vm_args) == ETS_OK) << "Cannot create ETS VM"; in SetUp() 58 EtsEnv *env {}; member in panda::ets::test::FinalFieldNativeTest 65 ets_class testClass = env->FindClass("FinalFieldNativeTest"); in TEST_F() 68 ets_field field = env->GetStaticp_field(testClass, "boolean_value_final", "Z"); in TEST_F() 70 ASSERT_EQ(env->GetStaticBooleanField(testClass, field), ETS_TRUE); in TEST_F() 72 field = env->GetStaticp_field(testClass, "byte_value_final", "B"); in TEST_F() 74 ASSERT_EQ(env->GetStaticByteField(testClass, field), 2_I); in TEST_F() 76 field = env->GetStaticp_field(testClass, "short_value_final", "S"); in TEST_F() 78 ASSERT_EQ(env->GetStaticShortField(testClass, field), 256_I); in TEST_F() 80 field = env->GetStaticp_field(testClass, "char_value_final", "C"); in TEST_F() [all …]
|
D | clinit_native_test.cpp | 50 ASSERT_TRUE(ETS_CreateVM(&vm, &env, &vm_args) == ETS_OK) << "Cannot create ETS VM"; in SetUp() 58 EtsEnv *env {}; member in panda::ets::test::ClinitNativeTest 63 static bool IsInitialized(EtsEnv *env, ets_class cls) in IsInitialized() argument 65 panda::ets::napi::ScopedManagedCodeFix s(PandaEtsNapiEnv::ToPandaEtsEnv(env)); in IsInitialized() 78 ets_class testClass = env->FindClass("ClinitNativeTest"); in TEST_F() 80 ASSERT_FALSE(IsInitialized(env, testClass)); in TEST_F() 82 ets_method method = env->GetStaticp_method(testClass, "smethod", ":I"); in TEST_F() 84 ASSERT_TRUE(IsInitialized(env, testClass)); in TEST_F() 89 ets_class testClass = env->FindClass("ClinitNativeTest"); in TEST_F() 91 ASSERT_FALSE(IsInitialized(env, testClass)); in TEST_F() [all …]
|
D | stack_reference_check_test.cpp | 49 ASSERT_TRUE(ETS_CreateVM(&vm, &env, &vm_args) == ETS_OK) << "Cannot create ETS VM"; in SetUp() 58 EtsEnv *env {}; member in panda::ets::test::StackReferenceCheckTest 63 static ets_boolean StrCheck(EtsEnv *env, ets_string ets_str) in StrCheck() argument 65 …return env->GetObjectRefType(static_cast<ets_object>(ets_str)) == ETS_LOCAL_REF_TYPE ? ETS_TRUE : … in StrCheck() 70 ets_string ets_str = env->NewStringUTF("Hello world"); in TEST_F() 73 ets_class cls_A = env->FindClass("StackReferenceCheckTest"); in TEST_F() 80 … ets_int ret_code = env->RegisterNatives(cls_A, native_methods.data(), native_methods.size()); in TEST_F() 85 … ets_method method = env->GetStaticp_method(cls_A, "NativeRefStringCheck", "Lstd/core/String;:Z"); in TEST_F() 88 ets_boolean res_true = env->CallStaticBooleanMethod(cls_A, method, ets_str); in TEST_F() 93 ets_int ret_code = env->UnregisterNatives(cls_A); in TEST_F() [all …]
|
/arkcompiler/ets_runtime/ecmascript/compiler/builtins/ |
D | builtins_string_stub_builder.cpp | 25 auto env = GetEnvironment(); in FromCharCode() local 27 Label lengthIsZero(env); in FromCharCode() 28 Label lengthNotZero(env); in FromCharCode() 29 Label lengthIsOne(env); in FromCharCode() 30 Label canBeCompress(env); in FromCharCode() 31 Label isInt(env); in FromCharCode() 32 Label notInt(env); in FromCharCode() 33 Label newObj(env); in FromCharCode() 34 Label canNotBeCompress(env); in FromCharCode() 35 Label isPendingException(env); in FromCharCode() [all …]
|
D | builtins_object_stub_builder.cpp | 30 auto env = GetEnvironment(); in CreateListFromArrayLike() local 31 Label entry(env); in CreateListFromArrayLike() 32 env->SubCfgEntry(&entry); in CreateListFromArrayLike() 35 Label exit(env); in CreateListFromArrayLike() 38 Label targetIsHeapObject(env); in CreateListFromArrayLike() 39 Label targetIsEcmaObject(env); in CreateListFromArrayLike() 40 Label targetNotEcmaObject(env); in CreateListFromArrayLike() 58 Label isPendingException1(env); in CreateListFromArrayLike() 59 Label noPendingException1(env); in CreateListFromArrayLike() 67 Label indexInRange(env); in CreateListFromArrayLike() [all …]
|
D | linked_hashtable_stub_builder.cpp | 29 auto env = GetEnvironment(); in Rehash() local 30 Label entryLabel(env); in Rehash() 31 env->SubCfgEntry(&entryLabel); in Rehash() 40 Label loopHead(env); in Rehash() 41 Label loopEnd(env); in Rehash() 42 Label next(env); in Rehash() 43 Label loopExit(env); in Rehash() 54 Label hole(env); in Rehash() 55 Label notHole(env); in Rehash() 65 Label weak(env); in Rehash() [all …]
|
D | builtins_array_stub_builder.cpp | 32 auto env = GetEnvironment(); in Concat() local 33 Label isHeapObject(env); in Concat() 34 Label isJsArray(env); in Concat() 40 Label isExtensible(env); in Concat() 44 Label numArgsOne(env); in Concat() 49 Label allEcmaObject(env); in Concat() 50 Label allStableJsArray(env); in Concat() 65 Label isEmptyArray(env); in Concat() 66 Label notEmptyArray(env); in Concat() 75 Label notOverFlow(env); in Concat() [all …]
|
D | containers_stub_builder.cpp | 24 auto env = GetEnvironment(); in ContainersCommonFuncCall() local 31 Label valueIsJSAPIVector(env); in ContainersCommonFuncCall() 32 Label valueNotJSAPIVector(env); in ContainersCommonFuncCall() 33 Label objIsJSProxy(env); in ContainersCommonFuncCall() 34 Label objNotJSProxy(env); in ContainersCommonFuncCall() 35 Label objIsJSAPIVector(env); in ContainersCommonFuncCall() 36 Label thisArgUndefined(env); in ContainersCommonFuncCall() 37 Label thisArgNotUndefined(env); in ContainersCommonFuncCall() 38 Label callbackUndefined(env); in ContainersCommonFuncCall() 39 Label callbackNotUndefined(env); in ContainersCommonFuncCall() [all …]
|
D | builtins_function_stub_builder.cpp | 27 auto env = GetEnvironment(); in Apply() local 28 Label targetIsCallable(env); in Apply() 29 Label targetIsUndefined(env); in Apply() 30 Label targetNotUndefined(env); in Apply() 31 Label isHeapObject(env); in Apply() 54 Label targetIsHole(env); in Apply() 55 Label targetNotHole(env); in Apply() 62 Label isPendingException(env); in Apply() 63 Label noPendingException(env); in Apply() 81 Label taggedIsStableJsArg(env); in Apply() [all …]
|
/arkcompiler/ets_runtime/ecmascript/compiler/ |
D | operations_stub_builder.cpp | 24 auto env = GetEnvironment(); in Equal() local 25 Label entry(env); in Equal() 26 env->SubCfgEntry(&entry); in Equal() 27 Label exit(env); in Equal() 28 Label isHole(env); in Equal() 29 Label notHole(env); in Equal() 41 Label resultIsTrue(env); in Equal() 42 Label resultNotTrue(env); in Equal() 57 env->SubCfgExit(); in Equal() 63 auto env = GetEnvironment(); in NotEqual() local [all …]
|
D | access_object_stub_builder.cpp | 27 auto env = GetEnvironment(); in LoadObjByName() local 28 Label entry(env); in LoadObjByName() 29 env->SubCfgEntry(&entry); in LoadObjByName() 30 Label exit(env); in LoadObjByName() 31 Label tryFastPath(env); in LoadObjByName() 32 Label slowPath(env); in LoadObjByName() 55 env->SubCfgExit(); in LoadObjByName() 62 auto env = GetEnvironment(); in DeprecatedLoadObjByName() local 63 Label entry(env); in DeprecatedLoadObjByName() 64 env->SubCfgEntry(&entry); in DeprecatedLoadObjByName() [all …]
|
D | stub_builder.cpp | 119 auto *env = GetEnvironment(); in MatchTrackType() local 120 Label isNumber(env); in MatchTrackType() 121 Label checkBoolean(env); in MatchTrackType() 122 Label isBoolean(env); in MatchTrackType() 123 Label checkString(env); in MatchTrackType() 124 Label isString(env); in MatchTrackType() 125 Label checkJSShared(env); in MatchTrackType() 126 Label isJSShared(env); in MatchTrackType() 127 Label checkJSNone(env); in MatchTrackType() 128 Label isJSNone(env); in MatchTrackType() [all …]
|
D | profiler_stub_builder.cpp | 70 auto env = GetEnvironment(); in TryDump() local 71 Label subEntry(env); in TryDump() 72 env->SubCfgEntry(&subEntry); in TryDump() 74 Label updatePeriodCounter(env); in TryDump() 75 Label exit(env); in TryDump() 85 env->SubCfgExit(); in TryDump() 90 auto env = GetEnvironment(); in TryPreDump() local 91 Label subEntry(env); in TryPreDump() 92 env->SubCfgEntry(&subEntry); in TryPreDump() 93 Label exit(env); in TryPreDump() [all …]
|
D | typed_array_stub_builder.cpp | 25 auto env = GetEnvironment(); in IsDetachedBuffer() local 26 Label entryPass(env); in IsDetachedBuffer() 27 env->SubCfgEntry(&entryPass); in IsDetachedBuffer() 28 Label isNull(env); in IsDetachedBuffer() 29 Label exit(env); in IsDetachedBuffer() 30 Label isByteArray(env); in IsDetachedBuffer() 31 Label notByteArray(env); in IsDetachedBuffer() 50 env->SubCfgExit(); in IsDetachedBuffer() 56 auto env = GetEnvironment(); in GetDataPointFromBuffer() local 57 Label entryPass(env); in GetDataPointFromBuffer() [all …]
|
D | new_object_stub_builder.cpp | 36 auto env = GetEnvironment(); in NewLexicalEnv() local 40 Label afterAllocate(env); in NewLexicalEnv() 44 Label hasPendingException(env); in NewLexicalEnv() 45 Label noException(env); in NewLexicalEnv() 52 Label afterInitialize(env); in NewLexicalEnv() 70 auto env = GetEnvironment(); in NewJSArrayWithSize() local 71 Label entry(env); in NewJSArrayWithSize() 72 Label exit(env); in NewJSArrayWithSize() 73 env->SubCfgEntry(&entry); in NewJSArrayWithSize() 80 env->SubCfgExit(); in NewJSArrayWithSize() [all …]
|
/arkcompiler/runtime_core/static_core/plugins/ets/runtime/interop_js/ |
D | ets_vm_plugin.cpp | 30 static napi_value Version(napi_env env, [[maybe_unused]] napi_callback_info info) in Version() argument 35 …[[maybe_unused]] napi_status status = napi_create_string_utf8(env, MSG.data(), MSG.size(), &result… in Version() 41 static napi_value Fatal([[maybe_unused]] napi_env env, [[maybe_unused]] napi_callback_info info) in Fatal() argument 46 static napi_value GetEtsFunction(napi_env env, napi_callback_info info) in GetEtsFunction() argument 49 NAPI_CHECK_FATAL(napi_get_cb_info(env, info, &jsArgc, nullptr, nullptr, nullptr)); in GetEtsFunction() 51 …InteropCtx::ThrowJSError(env, "GetEtsFunction: bad args, actual args count: " + std::to_string(jsA… in GetEtsFunction() 57 NAPI_CHECK_FATAL(napi_get_cb_info(env, info, &jsArgc, jsArgv.data(), nullptr, nullptr)); in GetEtsFunction() 62 if (GetValueType(env, jsClassDescriptor) != napi_string) { in GetEtsFunction() 63 InteropCtx::ThrowJSError(env, "GetEtsFunction: class descriptor is not a string"); in GetEtsFunction() 66 if (GetValueType(env, jsFunctionName) != napi_string) { in GetEtsFunction() [all …]
|
D | interop_common.h | 76 explicit NapiScope(napi_env env) : env_(env) in NapiScope() argument 98 explicit NapiEscapableScope(napi_env env) : env_(env) in NapiEscapableScope() argument 124 inline napi_valuetype GetValueType(napi_env env, napi_value val) in GetValueType() argument 127 NAPI_CHECK_FATAL(napi_typeof(env, val, &vtype)); in GetValueType() 131 inline napi_value GetReferenceValue(napi_env env, napi_ref ref) in GetReferenceValue() argument 134 NAPI_CHECK_FATAL(napi_get_reference_value(env, ref, &val)); in GetReferenceValue() 138 inline napi_value GetUndefined(napi_env env) in GetUndefined() argument 141 NAPI_CHECK_FATAL(napi_get_undefined(env, &jsValueUndefined)); in GetUndefined() 145 inline napi_value GetNull(napi_env env) in GetNull() argument 148 NAPI_CHECK_FATAL(napi_get_null(env, &jsValueNull)); in GetNull() [all …]
|
D | intrinsics_api_impl.cpp | 66 auto env = ctx->GetJSEnv(); in JSRuntimeNewJSValueObject() local 67 NapiScope jsHandleScope(env); in JSRuntimeNewJSValueObject() 72 auto res = JSConvertJSValue::UnwrapWithNullCheck(ctx, env, result); in JSRuntimeNewJSValueObject() 95 auto env = ctx->GetJSEnv(); in JSRuntimeGetValueString() local 97 NapiScope jsHandleScope(env); in JSRuntimeGetValueString() 99 napi_value jsVal = etsJsValue->GetNapiValue(env); in JSRuntimeGetValueString() 100 auto res = JSConvertString::Unwrap(ctx, env, jsVal); in JSRuntimeGetValueString() 102 if (NapiIsExceptionPending(env)) { in JSRuntimeGetValueString() 134 auto env = ctx->GetJSEnv(); in JSRuntimeGetValueObject() local 135 NapiScope jsHandleScope(env); in JSRuntimeGetValueObject() [all …]
|
/arkcompiler/runtime_core/static_core/plugins/ets/tests/napi/lib/ |
D | InterfaceNativeTest.cpp | 22 ETS_EXPORT void ETS_CALL ETS_InterfaceNativeTest_callMethod(EtsEnv *env, [[maybe_unused]] ets_class… in ETS_InterfaceNativeTest_callMethod() argument 24 ets_method method = env->GetStaticp_method(cls, "staticLongMethod", "I:J"); in ETS_InterfaceNativeTest_callMethod() 25 env->native_interface->CallStaticLongMethod(env, cls, method, static_cast<ets_int>(10)); in ETS_InterfaceNativeTest_callMethod() 29 ETS_EXPORT void ETS_CALL ETS_InterfaceNativeTest_testChar(EtsEnv *env, ets_class cls, ets_char c) in ETS_InterfaceNativeTest_testChar() argument 34 ets_method method = env->GetStaticp_method(cls, "staticVoidMethod", "C:V"); in ETS_InterfaceNativeTest_testChar() 35 env->CallStaticVoidMethodArray(cls, method, arr); in ETS_InterfaceNativeTest_testChar() 39 ETS_EXPORT ets_int ETS_CALL ETS_InterfaceNativeTest_testFloat(EtsEnv *env, ets_class cls, ets_float… in ETS_InterfaceNativeTest_testFloat() argument 42 ets_method method = env->Getp_method(cls, "<ctor>", ":V"); in ETS_InterfaceNativeTest_testFloat() 51 method = env->GetStaticp_method(cls, "staticFloatMethod", "I:F"); in ETS_InterfaceNativeTest_testFloat() 53 ets_float res = env->CallStaticFloatMethod(cls, method, i); in ETS_InterfaceNativeTest_testFloat() [all …]
|
/arkcompiler/runtime_core/static_core/plugins/ets/tests/interop_js/gtest_plugin/ |
D | ets_interop_js_gtest.h | 89 [[nodiscard]] bool DoRunJsTestSuite(napi_env env, const std::string &path) in DoRunJsTestSuite() argument 97 return DoRunJsScript(env, "(() => { \n'use strict'\n" + testSouceCode + "\n})()"); in DoRunJsTestSuite() 100 [[nodiscard]] static bool DoRunJsScript(napi_env env, const std::string &script) in DoRunJsScript() argument 104 status = napi_create_string_utf8(env, script.c_str(), script.length(), &jsScript); in DoRunJsScript() 108 status = napi_run_script(env, jsScript, &jsResult); in DoRunJsScript() 112 status = napi_get_and_clear_last_exception(env, &exc); in DoRunJsScript() 115 status = napi_coerce_to_string(env, exc, &jsStr); in DoRunJsScript() 117 std::cerr << "Exception string: " << GetString(env, jsStr) << std::endl; in DoRunJsScript() 136 [[nodiscard]] std::optional<T> DoRunJsScriptByPath(napi_env env, const std::string &path) in DoRunJsScriptByPath() argument 140 if (!DoRunJsScript(env, ReadFile(fullPath))) { in DoRunJsScriptByPath() [all …]
|