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#ifndef ECMASCRIPT_COMPILER_ACCESS_OBJECT_STUB_BUILDER_H
164514f5e3Sopenharmony_ci#define ECMASCRIPT_COMPILER_ACCESS_OBJECT_STUB_BUILDER_H
174514f5e3Sopenharmony_ci
184514f5e3Sopenharmony_ci#include "ecmascript/compiler/interpreter_stub.h"
194514f5e3Sopenharmony_ci#include "ecmascript/compiler/profiler_operation.h"
204514f5e3Sopenharmony_ci#include "ecmascript/compiler/stub_builder.h"
214514f5e3Sopenharmony_ci
224514f5e3Sopenharmony_cinamespace panda::ecmascript::kungfu {
234514f5e3Sopenharmony_ciclass AccessObjectStubBuilder : public StubBuilder {
244514f5e3Sopenharmony_cipublic:
254514f5e3Sopenharmony_ci    explicit AccessObjectStubBuilder(StubBuilder *parent) : StubBuilder(parent)
264514f5e3Sopenharmony_ci    {
274514f5e3Sopenharmony_ci        jsFunc_ = Circuit::NullGate();
284514f5e3Sopenharmony_ci    }
294514f5e3Sopenharmony_ci    explicit AccessObjectStubBuilder(StubBuilder *parent, GateRef jsFunc)
304514f5e3Sopenharmony_ci        : StubBuilder(parent), jsFunc_(jsFunc) {}
314514f5e3Sopenharmony_ci    ~AccessObjectStubBuilder() override = default;
324514f5e3Sopenharmony_ci    NO_MOVE_SEMANTIC(AccessObjectStubBuilder);
334514f5e3Sopenharmony_ci    NO_COPY_SEMANTIC(AccessObjectStubBuilder);
344514f5e3Sopenharmony_ci    void GenerateCircuit() override {}
354514f5e3Sopenharmony_ci
364514f5e3Sopenharmony_ci    GateRef LoadObjByName(GateRef glue, GateRef receiver, GateRef prop, const StringIdInfo &info,
374514f5e3Sopenharmony_ci                          GateRef profileTypeInfo, GateRef slotId, ProfileOperation callback = ProfileOperation());
384514f5e3Sopenharmony_ci    GateRef DeprecatedLoadObjByName(GateRef glue, GateRef receiver, GateRef propKey);
394514f5e3Sopenharmony_ci    GateRef StoreObjByName(GateRef glue, GateRef receiver, GateRef prop, const StringIdInfo &info, GateRef value,
404514f5e3Sopenharmony_ci        GateRef profileTypeInfo, GateRef slotId, ProfileOperation callback = ProfileOperation());
414514f5e3Sopenharmony_ci    GateRef LoadPrivatePropertyByName(GateRef glue,
424514f5e3Sopenharmony_ci                                      GateRef receiver,
434514f5e3Sopenharmony_ci                                      GateRef key,
444514f5e3Sopenharmony_ci                                      GateRef profileTypeInfo,
454514f5e3Sopenharmony_ci                                      GateRef slotId,
464514f5e3Sopenharmony_ci                                      ProfileOperation callback);
474514f5e3Sopenharmony_ci    GateRef StorePrivatePropertyByName(GateRef glue,
484514f5e3Sopenharmony_ci                                       GateRef receiver,
494514f5e3Sopenharmony_ci                                       GateRef key,
504514f5e3Sopenharmony_ci                                       GateRef value,
514514f5e3Sopenharmony_ci                                       GateRef profileTypeInfo,
524514f5e3Sopenharmony_ci                                       GateRef slotId,
534514f5e3Sopenharmony_ci                                       ProfileOperation callback = ProfileOperation());
544514f5e3Sopenharmony_ci    GateRef LoadObjByValue(GateRef glue, GateRef receiver, GateRef key, GateRef profileTypeInfo, GateRef slotId,
554514f5e3Sopenharmony_ci        ProfileOperation callback = ProfileOperation());
564514f5e3Sopenharmony_ci    GateRef StoreObjByValue(GateRef glue, GateRef receiver, GateRef key, GateRef value, GateRef profileTypeInfo,
574514f5e3Sopenharmony_ci                            GateRef slotId, ProfileOperation callback = ProfileOperation());
584514f5e3Sopenharmony_ci    GateRef StoreOwnByIndex(GateRef glue, GateRef receiver, GateRef index, GateRef value, GateRef profileTypeInfo,
594514f5e3Sopenharmony_ci                            GateRef slotId, ProfileOperation callback = ProfileOperation());
604514f5e3Sopenharmony_ci    GateRef DeprecatedLoadObjByValue(GateRef glue, GateRef receiver, GateRef key);
614514f5e3Sopenharmony_ci    GateRef TryLoadGlobalByName(GateRef glue, GateRef prop, const StringIdInfo &info,
624514f5e3Sopenharmony_ci                                GateRef profileTypeInfo, GateRef slotId, ProfileOperation callback);
634514f5e3Sopenharmony_ci    GateRef TryStoreGlobalByName(GateRef glue, GateRef prop, const StringIdInfo &info,
644514f5e3Sopenharmony_ci                                 GateRef value, GateRef profileTypeInfo, GateRef slotId, ProfileOperation callback);
654514f5e3Sopenharmony_ci    GateRef LoadGlobalVar(GateRef glue, GateRef prop, const StringIdInfo &info,
664514f5e3Sopenharmony_ci                          GateRef profileTypeInfo, GateRef slotId, ProfileOperation callback);
674514f5e3Sopenharmony_ci    GateRef StoreGlobalVar(GateRef glue, GateRef prop, const StringIdInfo &info,
684514f5e3Sopenharmony_ci                           GateRef value, GateRef profileTypeInfo, GateRef slotId);
694514f5e3Sopenharmony_ci    GateRef StOwnByIndex(GateRef glue, GateRef receiver, GateRef index, GateRef value);
704514f5e3Sopenharmony_ci    GateRef StOwnByValue(GateRef glue, GateRef receiver, GateRef key, GateRef value);
714514f5e3Sopenharmony_ci    GateRef StOwnByName(GateRef glue, GateRef receiver, GateRef key, GateRef value);
724514f5e3Sopenharmony_ci    GateRef StOwnByValueWithNameSet(GateRef glue, GateRef receiver, GateRef key, GateRef value);
734514f5e3Sopenharmony_ci    GateRef StOwnByNameWithNameSet(GateRef glue, GateRef receiver, GateRef key, GateRef value);
744514f5e3Sopenharmony_ci    GateRef StObjByIndex(GateRef glue, GateRef receiver, GateRef index, GateRef value);
754514f5e3Sopenharmony_ci    GateRef LdObjByIndex(GateRef glue, GateRef receiver, GateRef index);
764514f5e3Sopenharmony_ci
774514f5e3Sopenharmony_ciprivate:
784514f5e3Sopenharmony_ci    GateRef ResolvePropKey(GateRef glue, GateRef prop, const StringIdInfo &info);
794514f5e3Sopenharmony_ci    GateRef jsFunc_ { Circuit::NullGate() };
804514f5e3Sopenharmony_ci};
814514f5e3Sopenharmony_ci}  // namespace panda::ecmascript::kungfu
824514f5e3Sopenharmony_ci#endif  // ECMASCRIPT_COMPILER_ACCESS_OBJECT_STUB_BUILDER_H
83