14514f5e3Sopenharmony_ci/*
24514f5e3Sopenharmony_ci * Copyright (c) 2022 Huawei Device Co., Ltd.
34514f5e3Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
44514f5e3Sopenharmony_ci * you may not use this file except in compliance with the License.
54514f5e3Sopenharmony_ci * You may obtain a copy of the License at
64514f5e3Sopenharmony_ci *
74514f5e3Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
84514f5e3Sopenharmony_ci *
94514f5e3Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
104514f5e3Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
114514f5e3Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
124514f5e3Sopenharmony_ci * See the License for the specific language governing permissions and
134514f5e3Sopenharmony_ci * limitations under the License.
144514f5e3Sopenharmony_ci */
154514f5e3Sopenharmony_ci#include "ecmascript/compiler/ic_stub_builder.h"
164514f5e3Sopenharmony_ci
174514f5e3Sopenharmony_ci#include "ecmascript/compiler/builtins/builtins_typedarray_stub_builder.h"
184514f5e3Sopenharmony_ci#include "ecmascript/compiler/stub_builder-inl.h"
194514f5e3Sopenharmony_ci
204514f5e3Sopenharmony_cinamespace panda::ecmascript::kungfu {
214514f5e3Sopenharmony_civoid ICStubBuilder::NamedICAccessor(Variable* cachedHandler, Label *tryICHandler)
224514f5e3Sopenharmony_ci{
234514f5e3Sopenharmony_ci    auto env = GetEnvironment();
244514f5e3Sopenharmony_ci    Label receiverIsHeapObject(env);
254514f5e3Sopenharmony_ci    Label receiverNotHeapObject(env);
264514f5e3Sopenharmony_ci    Label tryIC(env);
274514f5e3Sopenharmony_ci
284514f5e3Sopenharmony_ci    BRANCH(TaggedIsHeapObject(receiver_), &receiverIsHeapObject, &receiverNotHeapObject);
294514f5e3Sopenharmony_ci    Bind(&receiverIsHeapObject);
304514f5e3Sopenharmony_ci    {
314514f5e3Sopenharmony_ci        BRANCH(TaggedIsUndefined(profileTypeInfo_), tryFastPath_, &tryIC);
324514f5e3Sopenharmony_ci        Bind(&tryIC);
334514f5e3Sopenharmony_ci        {
344514f5e3Sopenharmony_ci            Label isHeapObject(env);
354514f5e3Sopenharmony_ci            Label notHeapObject(env);
364514f5e3Sopenharmony_ci            GateRef firstValue = GetValueFromTaggedArray(
374514f5e3Sopenharmony_ci                profileTypeInfo_, slotId_);
384514f5e3Sopenharmony_ci            BRANCH(TaggedIsHeapObject(firstValue), &isHeapObject, &notHeapObject);
394514f5e3Sopenharmony_ci            Bind(&isHeapObject);
404514f5e3Sopenharmony_ci            {
414514f5e3Sopenharmony_ci                GateRef secondValue = GetValueFromTaggedArray(profileTypeInfo_, Int32Add(slotId_, Int32(1)));
424514f5e3Sopenharmony_ci                cachedHandler->WriteVariable(secondValue);
434514f5e3Sopenharmony_ci                Label tryPoly(env);
444514f5e3Sopenharmony_ci                GateRef hclass = LoadHClass(receiver_);
454514f5e3Sopenharmony_ci                BRANCH(Equal(LoadObjectFromWeakRef(firstValue), hclass),
464514f5e3Sopenharmony_ci                       tryICHandler,
474514f5e3Sopenharmony_ci                       &tryPoly);
484514f5e3Sopenharmony_ci                Bind(&tryPoly);
494514f5e3Sopenharmony_ci                {
504514f5e3Sopenharmony_ci                    cachedHandler->WriteVariable(CheckPolyHClass(firstValue, hclass));
514514f5e3Sopenharmony_ci                    BRANCH(TaggedIsHole(cachedHandler->ReadVariable()), slowPath_, tryICHandler);
524514f5e3Sopenharmony_ci                }
534514f5e3Sopenharmony_ci            }
544514f5e3Sopenharmony_ci            Bind(&notHeapObject);
554514f5e3Sopenharmony_ci            {
564514f5e3Sopenharmony_ci                BRANCH(TaggedIsUndefined(firstValue), slowPath_, tryFastPath_);
574514f5e3Sopenharmony_ci            }
584514f5e3Sopenharmony_ci        }
594514f5e3Sopenharmony_ci    }
604514f5e3Sopenharmony_ci    Bind(&receiverNotHeapObject);
614514f5e3Sopenharmony_ci    {
624514f5e3Sopenharmony_ci        Label tryNumber(env);
634514f5e3Sopenharmony_ci        Label profileNotUndefined(env);
644514f5e3Sopenharmony_ci        BRANCH(TaggedIsNumber(receiver_), &tryNumber, slowPath_);
654514f5e3Sopenharmony_ci        Bind(&tryNumber);
664514f5e3Sopenharmony_ci        {
674514f5e3Sopenharmony_ci            BRANCH(TaggedIsUndefined(profileTypeInfo_), slowPath_, &profileNotUndefined);
684514f5e3Sopenharmony_ci            Bind(&profileNotUndefined);
694514f5e3Sopenharmony_ci            {
704514f5e3Sopenharmony_ci                GateRef firstValue = GetValueFromTaggedArray(profileTypeInfo_, slotId_);
714514f5e3Sopenharmony_ci                GateRef secondValue = GetValueFromTaggedArray(profileTypeInfo_, Int32Add(slotId_, Int32(1)));
724514f5e3Sopenharmony_ci                cachedHandler->WriteVariable(secondValue);
734514f5e3Sopenharmony_ci                Label isHeapObject(env);
744514f5e3Sopenharmony_ci                BRANCH(TaggedIsHeapObject(firstValue), &isHeapObject, slowPath_)
754514f5e3Sopenharmony_ci                Bind(&isHeapObject);
764514f5e3Sopenharmony_ci                {
774514f5e3Sopenharmony_ci                    GateRef glueGlobalEnvOffset = IntPtr(JSThread::GlueData::GetGlueGlobalEnvOffset(env->Is32Bit()));
784514f5e3Sopenharmony_ci                    GateRef glueGlobalEnv = Load(VariableType::NATIVE_POINTER(), glue_, glueGlobalEnvOffset);
794514f5e3Sopenharmony_ci                    auto numberFunction = GetGlobalEnvValue(VariableType::JS_ANY(),
804514f5e3Sopenharmony_ci                                                            glueGlobalEnv, GlobalEnv::NUMBER_FUNCTION_INDEX);
814514f5e3Sopenharmony_ci                    GateRef ctorProtoOrHC =
824514f5e3Sopenharmony_ci                            Load(VariableType::JS_POINTER(), numberFunction,
834514f5e3Sopenharmony_ci                                 IntPtr(JSFunction::PROTO_OR_DYNCLASS_OFFSET));
844514f5e3Sopenharmony_ci                    BRANCH(Equal(LoadObjectFromWeakRef(firstValue), ctorProtoOrHC), tryICHandler, slowPath_);
854514f5e3Sopenharmony_ci                }
864514f5e3Sopenharmony_ci            }
874514f5e3Sopenharmony_ci        }
884514f5e3Sopenharmony_ci    }
894514f5e3Sopenharmony_ci}
904514f5e3Sopenharmony_ci
914514f5e3Sopenharmony_civoid ICStubBuilder::ValuedICAccessor(Variable* cachedHandler, Label *tryICHandler, Label* tryElementIC)
924514f5e3Sopenharmony_ci{
934514f5e3Sopenharmony_ci    auto env = GetEnvironment();
944514f5e3Sopenharmony_ci    Label receiverIsHeapObject(env);
954514f5e3Sopenharmony_ci
964514f5e3Sopenharmony_ci    BRANCH(TaggedIsHeapObject(receiver_), &receiverIsHeapObject, slowPath_);
974514f5e3Sopenharmony_ci    Bind(&receiverIsHeapObject);
984514f5e3Sopenharmony_ci    {
994514f5e3Sopenharmony_ci        Label tryIC(env);
1004514f5e3Sopenharmony_ci        BRANCH(TaggedIsUndefined(profileTypeInfo_), tryFastPath_, &tryIC);
1014514f5e3Sopenharmony_ci        Bind(&tryIC);
1024514f5e3Sopenharmony_ci        {
1034514f5e3Sopenharmony_ci            Label isHeapObject(env);
1044514f5e3Sopenharmony_ci            Label notHeapObject(env);
1054514f5e3Sopenharmony_ci            GateRef firstValue = GetValueFromTaggedArray(
1064514f5e3Sopenharmony_ci                profileTypeInfo_, slotId_);
1074514f5e3Sopenharmony_ci            BRANCH(TaggedIsHeapObject(firstValue), &isHeapObject, &notHeapObject);
1084514f5e3Sopenharmony_ci            Bind(&isHeapObject);
1094514f5e3Sopenharmony_ci            {
1104514f5e3Sopenharmony_ci                Label tryPoly(env);
1114514f5e3Sopenharmony_ci                Label tryWithElementPoly(env);
1124514f5e3Sopenharmony_ci                GateRef hclass = LoadHClass(receiver_);
1134514f5e3Sopenharmony_ci                BRANCH(Equal(LoadObjectFromWeakRef(firstValue), hclass),
1144514f5e3Sopenharmony_ci                       tryElementIC,
1154514f5e3Sopenharmony_ci                       &tryPoly);
1164514f5e3Sopenharmony_ci                Bind(&tryPoly);
1174514f5e3Sopenharmony_ci                {
1184514f5e3Sopenharmony_ci                    Label firstIsKey(env);
1194514f5e3Sopenharmony_ci                    BRANCH(Int64Equal(firstValue, propKey_), &firstIsKey, &tryWithElementPoly);
1204514f5e3Sopenharmony_ci                    Bind(&firstIsKey);
1214514f5e3Sopenharmony_ci                    {
1224514f5e3Sopenharmony_ci                        GateRef handler = CheckPolyHClass(cachedHandler->ReadVariable(), hclass);
1234514f5e3Sopenharmony_ci                        cachedHandler->WriteVariable(handler);
1244514f5e3Sopenharmony_ci                        BRANCH(TaggedIsHole(cachedHandler->ReadVariable()), slowPath_, tryICHandler);
1254514f5e3Sopenharmony_ci                    }
1264514f5e3Sopenharmony_ci                    Bind(&tryWithElementPoly);
1274514f5e3Sopenharmony_ci                    {
1284514f5e3Sopenharmony_ci                        Label checkSecond(env);
1294514f5e3Sopenharmony_ci                        Label checkPoly(env);
1304514f5e3Sopenharmony_ci                        BRANCH(TaggedIsWeak(firstValue), slowPath_, &checkSecond);
1314514f5e3Sopenharmony_ci                        Bind(&checkSecond);
1324514f5e3Sopenharmony_ci                        {
1334514f5e3Sopenharmony_ci                            BRANCH(TaggedIsHole(cachedHandler->ReadVariable()), &checkPoly, slowPath_);
1344514f5e3Sopenharmony_ci                        }
1354514f5e3Sopenharmony_ci                        Bind(&checkPoly);
1364514f5e3Sopenharmony_ci                        {
1374514f5e3Sopenharmony_ci                            cachedHandler->WriteVariable(CheckPolyHClass(firstValue, hclass));
1384514f5e3Sopenharmony_ci                            BRANCH(TaggedIsHole(cachedHandler->ReadVariable()), slowPath_, tryElementIC);
1394514f5e3Sopenharmony_ci                        }
1404514f5e3Sopenharmony_ci                    }
1414514f5e3Sopenharmony_ci                }
1424514f5e3Sopenharmony_ci            }
1434514f5e3Sopenharmony_ci            Bind(&notHeapObject);
1444514f5e3Sopenharmony_ci            {
1454514f5e3Sopenharmony_ci                BRANCH(TaggedIsUndefined(firstValue), slowPath_, tryFastPath_);
1464514f5e3Sopenharmony_ci            }
1474514f5e3Sopenharmony_ci        }
1484514f5e3Sopenharmony_ci    }
1494514f5e3Sopenharmony_ci}
1504514f5e3Sopenharmony_ci
1514514f5e3Sopenharmony_civoid ICStubBuilder::LoadICByName(
1524514f5e3Sopenharmony_ci    Variable *result, Label *tryFastPath, Label *slowPath, Label *success, ProfileOperation callback)
1534514f5e3Sopenharmony_ci{
1544514f5e3Sopenharmony_ci    auto env = GetEnvironment();
1554514f5e3Sopenharmony_ci    Label loadWithHandler(env);
1564514f5e3Sopenharmony_ci
1574514f5e3Sopenharmony_ci    SetLabels(tryFastPath, slowPath, success);
1584514f5e3Sopenharmony_ci    DEFVARIABLE(cachedHandler, VariableType::JS_ANY(), Undefined());
1594514f5e3Sopenharmony_ci    NamedICAccessor(&cachedHandler, &loadWithHandler);
1604514f5e3Sopenharmony_ci    Bind(&loadWithHandler);
1614514f5e3Sopenharmony_ci    {
1624514f5e3Sopenharmony_ci        GateRef ret = LoadICWithHandler(glue_, receiver_, receiver_, *cachedHandler, callback);
1634514f5e3Sopenharmony_ci        result->WriteVariable(ret);
1644514f5e3Sopenharmony_ci        BRANCH(TaggedIsHole(ret), slowPath_, success_);
1654514f5e3Sopenharmony_ci    }
1664514f5e3Sopenharmony_ci}
1674514f5e3Sopenharmony_ci
1684514f5e3Sopenharmony_civoid ICStubBuilder::StoreICByName(Variable* result, Label* tryFastPath, Label *slowPath, Label *success)
1694514f5e3Sopenharmony_ci{
1704514f5e3Sopenharmony_ci    auto env = GetEnvironment();
1714514f5e3Sopenharmony_ci    Label storeWithHandler(env);
1724514f5e3Sopenharmony_ci
1734514f5e3Sopenharmony_ci    SetLabels(tryFastPath, slowPath, success);
1744514f5e3Sopenharmony_ci    GateRef secondValue = GetValueFromTaggedArray(
1754514f5e3Sopenharmony_ci        profileTypeInfo_, Int32Add(slotId_, Int32(1)));
1764514f5e3Sopenharmony_ci    DEFVARIABLE(cachedHandler, VariableType::JS_ANY(), secondValue);
1774514f5e3Sopenharmony_ci    NamedICAccessor(&cachedHandler, &storeWithHandler);
1784514f5e3Sopenharmony_ci    Bind(&storeWithHandler);
1794514f5e3Sopenharmony_ci    {
1804514f5e3Sopenharmony_ci        GateRef ret = StoreICWithHandler(glue_, receiver_, receiver_, value_, *cachedHandler, callback_);
1814514f5e3Sopenharmony_ci        result->WriteVariable(ret);
1824514f5e3Sopenharmony_ci        BRANCH(TaggedIsHole(ret), slowPath_, success_);
1834514f5e3Sopenharmony_ci    }
1844514f5e3Sopenharmony_ci}
1854514f5e3Sopenharmony_ci
1864514f5e3Sopenharmony_civoid ICStubBuilder::LoadICByValue(
1874514f5e3Sopenharmony_ci    Variable *result, Label *tryFastPath, Label *slowPath, Label *success, ProfileOperation callback)
1884514f5e3Sopenharmony_ci{
1894514f5e3Sopenharmony_ci    auto env = GetEnvironment();
1904514f5e3Sopenharmony_ci    Label loadWithHandler(env);
1914514f5e3Sopenharmony_ci    Label loadElement(env);
1924514f5e3Sopenharmony_ci    Label handlerInfoIsElement(env);
1934514f5e3Sopenharmony_ci    Label handlerInfoNotElement(env);
1944514f5e3Sopenharmony_ci    Label handlerInfoIsStringElement(env);
1954514f5e3Sopenharmony_ci    Label handlerInfoNotStringElement(env);
1964514f5e3Sopenharmony_ci    Label handlerInfoIsTypedArrayElement(env);
1974514f5e3Sopenharmony_ci    Label exit(env);
1984514f5e3Sopenharmony_ci
1994514f5e3Sopenharmony_ci    SetLabels(tryFastPath, slowPath, success);
2004514f5e3Sopenharmony_ci    GateRef secondValue = GetValueFromTaggedArray(
2014514f5e3Sopenharmony_ci        profileTypeInfo_, Int32Add(slotId_, Int32(1)));
2024514f5e3Sopenharmony_ci    DEFVARIABLE(cachedHandler, VariableType::JS_ANY(), secondValue);
2034514f5e3Sopenharmony_ci    DEFVARIABLE(ret, VariableType::JS_ANY(), secondValue);
2044514f5e3Sopenharmony_ci
2054514f5e3Sopenharmony_ci    ValuedICAccessor(&cachedHandler, &loadWithHandler, &loadElement);
2064514f5e3Sopenharmony_ci    Bind(&loadElement);
2074514f5e3Sopenharmony_ci    {
2084514f5e3Sopenharmony_ci        GateRef handlerInfo = GetInt64OfTInt(*cachedHandler);
2094514f5e3Sopenharmony_ci        BRANCH(IsElement(handlerInfo), &handlerInfoIsElement, &handlerInfoNotElement);
2104514f5e3Sopenharmony_ci        Bind(&handlerInfoIsElement);
2114514f5e3Sopenharmony_ci        {
2124514f5e3Sopenharmony_ci            ret = LoadElement(glue_, receiver_, propKey_);
2134514f5e3Sopenharmony_ci            Jump(&exit);
2144514f5e3Sopenharmony_ci        }
2154514f5e3Sopenharmony_ci        Bind(&handlerInfoNotElement);
2164514f5e3Sopenharmony_ci        {
2174514f5e3Sopenharmony_ci            BRANCH(IsStringElement(handlerInfo), &handlerInfoIsStringElement, &handlerInfoNotStringElement);
2184514f5e3Sopenharmony_ci            Bind(&handlerInfoIsStringElement);
2194514f5e3Sopenharmony_ci            {
2204514f5e3Sopenharmony_ci                ret = LoadStringElement(glue_, receiver_, propKey_);
2214514f5e3Sopenharmony_ci                Jump(&exit);
2224514f5e3Sopenharmony_ci            }
2234514f5e3Sopenharmony_ci            Bind(&handlerInfoNotStringElement);
2244514f5e3Sopenharmony_ci            {
2254514f5e3Sopenharmony_ci                BRANCH(IsTypedArrayElement(handlerInfo), &handlerInfoIsTypedArrayElement, &exit);
2264514f5e3Sopenharmony_ci                Bind(&handlerInfoIsTypedArrayElement);
2274514f5e3Sopenharmony_ci                {
2284514f5e3Sopenharmony_ci                    GateRef hclass = LoadHClass(receiver_);
2294514f5e3Sopenharmony_ci                    GateRef jsType = GetObjectType(hclass);
2304514f5e3Sopenharmony_ci                    BuiltinsTypedArrayStubBuilder typedArrayBuilder(reinterpret_cast<StubBuilder*>(this));
2314514f5e3Sopenharmony_ci                    ret = typedArrayBuilder.LoadTypedArrayElement(glue_, receiver_, propKey_, jsType);
2324514f5e3Sopenharmony_ci                    Jump(&exit);
2334514f5e3Sopenharmony_ci                }
2344514f5e3Sopenharmony_ci            }
2354514f5e3Sopenharmony_ci        }
2364514f5e3Sopenharmony_ci    }
2374514f5e3Sopenharmony_ci    Bind(&loadWithHandler);
2384514f5e3Sopenharmony_ci    {
2394514f5e3Sopenharmony_ci        ret = LoadICWithHandler(glue_, receiver_, receiver_, *cachedHandler, callback);
2404514f5e3Sopenharmony_ci        Jump(&exit);
2414514f5e3Sopenharmony_ci    }
2424514f5e3Sopenharmony_ci    Bind(&exit);
2434514f5e3Sopenharmony_ci    result->WriteVariable(*ret);
2444514f5e3Sopenharmony_ci    BRANCH(TaggedIsHole(*ret), slowPath_, success_);
2454514f5e3Sopenharmony_ci}
2464514f5e3Sopenharmony_ci
2474514f5e3Sopenharmony_civoid ICStubBuilder::StoreICByValue(Variable* result, Label* tryFastPath, Label *slowPath, Label *success)
2484514f5e3Sopenharmony_ci{
2494514f5e3Sopenharmony_ci    auto env = GetEnvironment();
2504514f5e3Sopenharmony_ci    Label storeWithHandler(env);
2514514f5e3Sopenharmony_ci    Label storeElement(env);
2524514f5e3Sopenharmony_ci    SetLabels(tryFastPath, slowPath, success);
2534514f5e3Sopenharmony_ci    GateRef secondValue = GetValueFromTaggedArray(
2544514f5e3Sopenharmony_ci        profileTypeInfo_, Int32Add(slotId_, Int32(1)));
2554514f5e3Sopenharmony_ci    DEFVARIABLE(cachedHandler, VariableType::JS_ANY(), secondValue);
2564514f5e3Sopenharmony_ci    ValuedICAccessor(&cachedHandler, &storeWithHandler, &storeElement);
2574514f5e3Sopenharmony_ci    Bind(&storeElement);
2584514f5e3Sopenharmony_ci    {
2594514f5e3Sopenharmony_ci        GateRef ret = ICStoreElement(glue_, receiver_, propKey_, value_, *cachedHandler,
2604514f5e3Sopenharmony_ci                                     true, profileTypeInfo_, Int32Add(slotId_, Int32(1)));
2614514f5e3Sopenharmony_ci        result->WriteVariable(ret);
2624514f5e3Sopenharmony_ci        BRANCH(TaggedIsHole(ret), slowPath_, success_);
2634514f5e3Sopenharmony_ci    }
2644514f5e3Sopenharmony_ci    Bind(&storeWithHandler);
2654514f5e3Sopenharmony_ci    {
2664514f5e3Sopenharmony_ci        GateRef ret = StoreICWithHandler(glue_, receiver_, receiver_, value_, *cachedHandler, callback_);
2674514f5e3Sopenharmony_ci        result->WriteVariable(ret);
2684514f5e3Sopenharmony_ci        BRANCH(TaggedIsHole(ret), slowPath_, success_);
2694514f5e3Sopenharmony_ci    }
2704514f5e3Sopenharmony_ci}
2714514f5e3Sopenharmony_ci
2724514f5e3Sopenharmony_civoid ICStubBuilder::TryLoadGlobalICByName(Variable* result, Label* tryFastPath, Label *slowPath, Label *success)
2734514f5e3Sopenharmony_ci{
2744514f5e3Sopenharmony_ci    auto env = GetEnvironment();
2754514f5e3Sopenharmony_ci    Label tryIC(env);
2764514f5e3Sopenharmony_ci
2774514f5e3Sopenharmony_ci    SetLabels(tryFastPath, slowPath, success);
2784514f5e3Sopenharmony_ci    BRANCH(TaggedIsUndefined(profileTypeInfo_), tryFastPath_, &tryIC);
2794514f5e3Sopenharmony_ci    Bind(&tryIC);
2804514f5e3Sopenharmony_ci    {
2814514f5e3Sopenharmony_ci        GateRef handler = GetValueFromTaggedArray(profileTypeInfo_, slotId_);
2824514f5e3Sopenharmony_ci        Label isHeapObject(env);
2834514f5e3Sopenharmony_ci        BRANCH(TaggedIsHeapObject(handler), &isHeapObject, slowPath_);
2844514f5e3Sopenharmony_ci        Bind(&isHeapObject);
2854514f5e3Sopenharmony_ci        {
2864514f5e3Sopenharmony_ci            GateRef ret = LoadGlobal(handler);
2874514f5e3Sopenharmony_ci            result->WriteVariable(ret);
2884514f5e3Sopenharmony_ci            BRANCH(TaggedIsHole(ret), slowPath_, success_);
2894514f5e3Sopenharmony_ci        }
2904514f5e3Sopenharmony_ci    }
2914514f5e3Sopenharmony_ci}
2924514f5e3Sopenharmony_ci
2934514f5e3Sopenharmony_civoid ICStubBuilder::TryStoreGlobalICByName(Variable* result, Label* tryFastPath, Label *slowPath, Label *success)
2944514f5e3Sopenharmony_ci{
2954514f5e3Sopenharmony_ci    auto env = GetEnvironment();
2964514f5e3Sopenharmony_ci    Label tryIC(env);
2974514f5e3Sopenharmony_ci
2984514f5e3Sopenharmony_ci    SetLabels(tryFastPath, slowPath, success);
2994514f5e3Sopenharmony_ci    BRANCH(TaggedIsUndefined(profileTypeInfo_), tryFastPath_, &tryIC);
3004514f5e3Sopenharmony_ci    Bind(&tryIC);
3014514f5e3Sopenharmony_ci    {
3024514f5e3Sopenharmony_ci        GateRef handler = GetValueFromTaggedArray(profileTypeInfo_, slotId_);
3034514f5e3Sopenharmony_ci        Label isHeapObject(env);
3044514f5e3Sopenharmony_ci        BRANCH(TaggedIsHeapObject(handler), &isHeapObject, slowPath_);
3054514f5e3Sopenharmony_ci        Bind(&isHeapObject);
3064514f5e3Sopenharmony_ci        {
3074514f5e3Sopenharmony_ci            GateRef ret = StoreGlobal(glue_, value_, handler);
3084514f5e3Sopenharmony_ci            result->WriteVariable(ret);
3094514f5e3Sopenharmony_ci            BRANCH(TaggedIsHole(ret), slowPath_, success_);
3104514f5e3Sopenharmony_ci        }
3114514f5e3Sopenharmony_ci    }
3124514f5e3Sopenharmony_ci}
3134514f5e3Sopenharmony_ci}  // namespace panda::ecmascript::kungfu
314