* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ECMASCRIPT_COMPILER_ACCESS_OBJECT_STUB_BUILDER_H
#define ECMASCRIPT_COMPILER_ACCESS_OBJECT_STUB_BUILDER_H
#include "ecmascript/compiler/interpreter_stub.h"
#include "ecmascript/compiler/profiler_operation.h"
#include "ecmascript/compiler/share_gate_meta_data.h"
#include "ecmascript/compiler/stub_builder.h"
namespace panda::ecmascript::kungfu {
class AccessObjectStubBuilder : public StubBuilder {
public:
AccessObjectStubBuilder(StubBuilder *parent) : StubBuilder(parent)
{
jsFunc_ = Circuit::NullGate();
}
AccessObjectStubBuilder(StubBuilder *parent, GateRef globalEnv) : StubBuilder(parent, globalEnv)
{
jsFunc_ = Circuit::NullGate();
}
AccessObjectStubBuilder(StubBuilder *parent, GateRef globalEnv, GateRef jsFunc)
: StubBuilder(parent, globalEnv), jsFunc_(jsFunc) {}
~AccessObjectStubBuilder() override = default;
NO_MOVE_SEMANTIC(AccessObjectStubBuilder);
NO_COPY_SEMANTIC(AccessObjectStubBuilder);
void GenerateCircuit() override {}
GateRef LoadObjByName(GateRef glue, GateRef receiver, GateRef prop, const StringIdInfo &info,
GateRef profileTypeInfo, GateRef slotId, ProfileOperation callback = ProfileOperation());
GateRef LoadObjByNameWithMega(GateRef glue, GateRef receiver, GateRef megaStubCache, GateRef propKey,
GateRef jsFunc, GateRef slotId, ProfileOperation callback = ProfileOperation());
GateRef DeprecatedLoadObjByName(GateRef glue, GateRef receiver, GateRef propKey);
GateRef StoreObjByName(GateRef glue, GateRef receiver, GateRef prop, const StringIdInfo &info, GateRef value,
GateRef profileTypeInfo, GateRef slotId, ProfileOperation callback = ProfileOperation());
GateRef StOwnICByName(GateRef glue, GateRef receiver, GateRef prop, const StringIdInfo &info, GateRef value,
GateRef profileTypeInfo, GateRef slotId, ProfileOperation callback = ProfileOperation());
GateRef StoreObjByNameWithMega(GateRef glue, GateRef receiver, GateRef value, GateRef megaStubCache,
GateRef propKey, GateRef jsFunc, GateRef slotId,
ProfileOperation callback = ProfileOperation());
GateRef LoadPrivatePropertyByName(GateRef glue, GateRef receiver, GateRef key, GateRef profileTypeInfo,
GateRef slotId, ProfileOperation callback);
GateRef StorePrivatePropertyByName(GateRef glue,
GateRef receiver,
GateRef key,
GateRef value,
GateRef profileTypeInfo,
GateRef slotId,
ProfileOperation callback = ProfileOperation());
GateRef LoadObjByValue(GateRef glue, GateRef receiver, GateRef key, GateRef profileTypeInfo, GateRef slotId,
ProfileOperation callback = ProfileOperation());
GateRef StoreObjByValue(GateRef glue, GateRef receiver, GateRef key, GateRef value, GateRef profileTypeInfo,
GateRef slotId, ProfileOperation callback = ProfileOperation());
GateRef StoreOwnByIndex(GateRef glue, GateRef receiver, GateRef index, GateRef value, GateRef profileTypeInfo,
GateRef slotId, ProfileOperation callback = ProfileOperation());
GateRef DeprecatedLoadObjByValue(GateRef glue, GateRef receiver, GateRef key);
GateRef TryLoadGlobalByName(GateRef glue, GateRef prop, const StringIdInfo &info,
GateRef profileTypeInfo, GateRef slotId, ProfileOperation callback);
GateRef TryStoreGlobalByName(GateRef glue, GateRef prop, const StringIdInfo &info,
GateRef value, GateRef profileTypeInfo, GateRef slotId, ProfileOperation callback);
GateRef LoadGlobalVar(GateRef glue, GateRef prop, const StringIdInfo &info,
GateRef profileTypeInfo, GateRef slotId, ProfileOperation callback);
GateRef StoreGlobalVar(GateRef glue, GateRef prop, const StringIdInfo &info,
GateRef value, GateRef profileTypeInfo, GateRef slotId);
GateRef StOwnByIndex(GateRef glue, GateRef receiver, GateRef index, GateRef value);
GateRef StOwnByValue(GateRef glue, GateRef receiver, GateRef key, GateRef value);
GateRef StOwnByName(GateRef glue, GateRef receiver, GateRef key, GateRef value);
GateRef StOwnByValueWithNameSet(GateRef glue, GateRef receiver, GateRef key, GateRef value);
GateRef StOwnByNameWithNameSet(GateRef glue, GateRef receiver, GateRef key, GateRef value);
GateRef StObjByIndex(GateRef glue, GateRef receiver, GateRef index, GateRef value);
GateRef LdObjByIndex(GateRef glue, GateRef receiver, GateRef index);
private:
#if !ECMASCRIPT_ENABLE_NOT_FOUND_IC_CHECK
GateRef ResolvePropKey(GateRef glue, GateRef prop, const StringIdInfo &info);
#endif
GateRef jsFunc_ { Circuit::NullGate() };
};
}
#endif