1 /* 2 * Copyright (c) 2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 #ifndef ECMASCRIPT_COMPILER_ACCESS_OBJECT_STUB_BUILDER_H 16 #define ECMASCRIPT_COMPILER_ACCESS_OBJECT_STUB_BUILDER_H 17 #include "ecmascript/compiler/interpreter_stub.h" 18 #include "ecmascript/compiler/stub_builder.h" 19 20 namespace panda::ecmascript::kungfu { 21 class AccessObjectStubBuilder : public StubBuilder { 22 public: AccessObjectStubBuilder(StubBuilder * parent)23 explicit AccessObjectStubBuilder(StubBuilder *parent) 24 : StubBuilder(parent) {} 25 ~AccessObjectStubBuilder() = default; 26 NO_MOVE_SEMANTIC(AccessObjectStubBuilder); 27 NO_COPY_SEMANTIC(AccessObjectStubBuilder); GenerateCircuit()28 void GenerateCircuit() override {} 29 30 GateRef LoadObjByName(GateRef glue, GateRef receiver, GateRef prop, const StringIdInfo &info, 31 GateRef profileTypeInfo, GateRef slotId); 32 GateRef DeprecatedLoadObjByName(GateRef glue, GateRef receiver, GateRef propKey); 33 GateRef StoreObjByName(GateRef glue, GateRef receiver, GateRef prop, const StringIdInfo &info, 34 GateRef value, GateRef profileTypeInfo, GateRef slotId); 35 GateRef LoadObjByValue(GateRef glue, GateRef receiver, GateRef key, GateRef profileTypeInfo, GateRef slotId); 36 GateRef StoreObjByValue(GateRef glue, GateRef receiver, GateRef key, GateRef value, GateRef profileTypeInfo, 37 GateRef slotId); 38 GateRef DeprecatedLoadObjByValue(GateRef glue, GateRef receiver, GateRef key); 39 GateRef TryLoadGlobalByName(GateRef glue, GateRef prop, const StringIdInfo &info, 40 GateRef profileTypeInfo, GateRef slotId); 41 GateRef TryStoreGlobalByName(GateRef glue, GateRef prop, const StringIdInfo &info, 42 GateRef value, GateRef profileTypeInfo, GateRef slotId); 43 GateRef LoadGlobalVar(GateRef glue, GateRef prop, const StringIdInfo &info, 44 GateRef profileTypeInfo, GateRef slotId); 45 GateRef StoreGlobalVar(GateRef glue, GateRef prop, const StringIdInfo &info, 46 GateRef value, GateRef profileTypeInfo, GateRef slotId); 47 private: 48 GateRef ResolvePropKey(GateRef glue, GateRef prop, const StringIdInfo &info); 49 }; 50 } // namespace panda::ecmascript::kungfu 51 #endif // ECMASCRIPT_COMPILER_ACCESS_OBJECT_STUB_BUILDER_H