Lines Matching refs:func
29 void JSFunction::InitializeJSFunction(JSThread *thread, const JSHandle<JSFunction> &func, FunctionKind kind)
31 InitializeWithDefaultValue(thread, func);
37 func->SetPropertyInlinedProps(thread, PROTOTYPE_INLINE_PROPERTY_INDEX, accessor.GetTaggedValue());
39 func->SetPropertyInlinedProps(thread, NAME_INLINE_PROPERTY_INDEX, accessor.GetTaggedValue());
41 func->SetPropertyInlinedProps(thread, LENGTH_INLINE_PROPERTY_INDEX, accessor.GetTaggedValue());
49 func->SetProtoOrHClass(thread, initialGeneratorFuncPrototype);
58 func->SetProtoOrHClass(thread, initialGeneratorFuncPrototype);
63 thread, JSHandle<JSObject>(func), globalConst->GetHandledPrototypeString(), desc, SCheckMode::SKIP);
68 func->SetPropertyInlinedProps(thread, NAME_INLINE_PROPERTY_INDEX, accessor.GetTaggedValue());
70 func->SetPropertyInlinedProps(thread, LENGTH_INLINE_PROPERTY_INDEX, accessor.GetTaggedValue());
74 void JSFunction::InitializeSFunction(JSThread *thread, const JSHandle<JSFunction> &func, FunctionKind kind)
76 InitializeWithDefaultValue(thread, func);
81 func->SetPropertyInlinedProps(thread, PROTOTYPE_INLINE_PROPERTY_INDEX, accessor.GetTaggedValue());
84 func->SetPropertyInlinedProps(thread, NAME_INLINE_PROPERTY_INDEX, accessor.GetTaggedValue());
86 func->SetPropertyInlinedProps(thread, LENGTH_INLINE_PROPERTY_INDEX, accessor.GetTaggedValue());
90 void JSFunction::InitializeWithDefaultValue(JSThread *thread, const JSHandle<JSFunction> &func)
92 func->SetProtoOrHClass(thread, JSTaggedValue::Hole(), SKIP_BARRIER);
93 func->SetHomeObject(thread, JSTaggedValue::Undefined(), SKIP_BARRIER);
94 func->SetWorkNodePointer(reinterpret_cast<uintptr_t>(nullptr));
95 func->SetLexicalEnv(thread, JSTaggedValue::Undefined(), SKIP_BARRIER);
96 func->SetMachineCode(thread, JSTaggedValue::Undefined(), SKIP_BARRIER);
97 func->SetBaselineCode(thread, JSTaggedValue::Undefined(), SKIP_BARRIER);
98 func->SetRawProfileTypeInfo(thread, thread->GlobalConstants()->GetEmptyProfileTypeInfoCell(), SKIP_BARRIER);
99 func->SetMethod(thread, JSTaggedValue::Undefined(), SKIP_BARRIER);
100 func->SetModule(thread, JSTaggedValue::Undefined(), SKIP_BARRIER);
101 func->SetProtoTransRootHClass(thread, JSTaggedValue::Undefined(), SKIP_BARRIER);
102 func->SetCodeEntry(reinterpret_cast<uintptr_t>(nullptr));
103 func->ClearCompiledCodeFlags();
104 func->SetTaskConcurrentFuncFlag(0); // 0 : default value
107 JSHandle<JSObject> JSFunction::NewJSFunctionPrototype(JSThread *thread, const JSHandle<JSFunction> &func)
112 if (func->IsSharedFunction()) {
118 SetFunctionPrototypeOrInstanceHClass(thread, func, funPro.GetTaggedValue());
122 PropertyDescriptor descriptor(thread, JSHandle<JSTaggedValue>::Cast(func), true, false, true);
163 JSHandle<JSFunction> func = JSHandle<JSFunction>::Cast(self);
164 if (!func->HasFunctionPrototype()) {
165 JSHandle<JSTaggedValue> proto = JSHandle<JSTaggedValue>::Cast(NewJSFunctionPrototype(thread, func));
167 thread->GetEcmaVM()->GetPGOProfiler()->ProfileClassRootHClass(func.GetTaggedType(),
177 JSHandle<JSFunction> func(self);
178 JSTaggedValue protoOrHClass = func->GetProtoOrHClass();
183 func->SetProtoOrHClass(thread, newClass);
186 EntityId ctorMethodId = Method::Cast(func->GetMethod().GetTaggedObject())->GetMethodId();
191 func->SetProtoOrHClass(thread, value.GetTaggedValue());
196 JSMutableHandle<JSTaggedValue> oldPrototype(thread, func->GetProtoOrHClass());
199 oldPrototype.Update(JSHandle<JSTaggedValue>::Cast(NewJSFunctionPrototype(thread, func)));
202 func->SetProtoOrHClass(thread, value.GetTaggedValue());
205 thread->GetEcmaVM()->GetPGOProfiler()->ProfileProtoTransitionPrototype(func, value, oldPrototype, baseIhc);
328 JSHandle<JSFunction> func(self);
329 return JSTaggedValue(func->GetLength());
400 bool JSFunction::MakeConstructor(JSThread *thread, const JSHandle<JSFunction> &func,
404 ASSERT_PRINT(func->IsConstructor(), "func must be Constructor type");
409 ASSERT_PRINT(func->GetProtoOrHClass().IsHole() && func->IsExtensible(),
411 ASSERT_PRINT(JSObject::HasProperty(thread, JSHandle<JSObject>(func), constructorKey),
414 // proto.constructor = func
419 PropertyDescriptor constructorDesc(thread, JSHandle<JSTaggedValue>::Cast(func), writable, false, true);
422 PropertyDescriptor constructorDesc(thread, JSHandle<JSTaggedValue>::Cast(func), writable, false, true);
428 // func.prototype = proto
431 SetFunctionPrototypeOrInstanceHClass(thread, func, proto.GetTaggedValue());
446 JSHandle<JSTaggedValue> func = info->GetFunction();
449 if (!func->IsCallable()) {
454 auto *hclass = func->GetTaggedObject()->GetClass();
469 JSHandle<JSTaggedValue> func(info->GetFunction());
472 target = func;
475 if (!(func->IsConstructor() && target->IsConstructor())) {
480 if (func->IsJSFunction()) {
482 } else if (func->IsJSProxy()) {
485 ASSERT(func->IsBoundFunction());
499 JSHandle<JSTaggedValue> func(JSTaggedValue::GetProperty(thread, thisArg, key).GetValue());
501 info->SetFunction(func.GetTaggedValue());
575 JSTaggedValue JSFunction::InvokeOptimizedEntrypoint(JSThread *thread, JSHandle<JSFunction> func,
579 Method *method = func->GetCallTarget();
585 RuntimeStubs::StartCallTimer(thread->GetGlueAddr(), func.GetTaggedType(), true);
587 if (func->IsCompiledFastCall()) {
600 RuntimeStubs::EndCallTimer(thread->GetGlueAddr(), func.GetTaggedType());
610 // func need to create a new handle, because optimized EcmaRuntimeCallInfo may overwrite this position.
611 JSHandle<JSFunction> func(thread, info->GetFunction().GetTaggedValue());
614 if (!func->IsConstructor()) {
620 if (func->IsBase()) {
622 obj = JSHandle<JSTaggedValue>(factory->NewJSObjectByConstructor(func, newTarget));
628 if (func->IsCompiledCode()) {
629 resultValue = InvokeOptimizedEntrypoint(thread, func, info);
642 if (func->IsBase()) {
646 if (func->IsDerivedConstructor()) {
660 JSHandle<JSTaggedValue> JSFunctionBase::GetFunctionName(JSThread *thread, const JSHandle<JSFunctionBase> &func)
664 return JSObject::GetProperty(thread, JSHandle<JSTaggedValue>(func), nameKey).GetValue();
667 bool JSFunctionBase::SetFunctionName(JSThread *thread, const JSHandle<JSFunctionBase> &func,
670 ASSERT_PRINT(func->IsExtensible(), "Function must be extensible");
720 JSHandle<JSTaggedValue> funcHandle(func);
724 bool JSFunction::SetFunctionLength(JSThread *thread, const JSHandle<JSFunction> &func, JSTaggedValue length, bool cfg)
726 ASSERT_PRINT(func->IsExtensible(), "Function must be extensible");
733 JSHandle<JSTaggedValue> funcHandle(func);
741 JSHandle<JSBoundFunction> func(info->GetFunction());
742 JSHandle<JSTaggedValue> target(thread, func->GetBoundTarget());
748 if (JSTaggedValue::SameValue(func.GetTaggedValue(), newTarget.GetTaggedValue())) {
752 JSHandle<TaggedArray> boundArgs(thread, func->GetBoundArguments());
811 void JSFunction::SetFunctionNameNoPrefix(JSThread *thread, JSFunction *func, JSTaggedValue name)
813 ASSERT_PRINT(func->IsExtensible(), "Function must be extensible");
817 JSHandle<JSTaggedValue> funcHandle(thread, func);
937 const JSHandle<JSFunction> &func, FunctionKind kind)
939 InitializeJSFunction(thread, func, kind);
1046 void JSFunction::SetProfileTypeInfo(const JSThread *thread, const JSHandle<JSFunction> &func,
1049 JSHandle<ProfileTypeInfoCell> handleRaw(thread, func->GetRawProfileTypeInfo());
1053 func->SetRawProfileTypeInfo(thread, handleProfileTypeInfoCell, WRITE_BARRIER);
1118 void JSFunction::InitializeForConcurrentFunction(JSThread *thread, JSHandle<JSFunction> &func)
1120 JSHandle<Method> method(thread, func->GetMethod());
1122 if (func->IsSharedFunction() && !func->GetModule().IsUndefined()) {
1123 sendableEnv.Update(SourceTextModule::Cast(func->GetModule())->GetSendableEnv());
1160 if (!jsPandaFile->IsBundlePack() && func->IsSharedFunction()) {
1163 func->SetModule(thread, sendableClassRecord);
1165 func->SetModule(thread, moduleRecord);