14514f5e3Sopenharmony_ci/* 24514f5e3Sopenharmony_ci * Copyright (c) 2021-2023 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 164514f5e3Sopenharmony_ci#ifndef ECMASCRIPT_IC_IC_RUNTIME_STUB_H 174514f5e3Sopenharmony_ci#define ECMASCRIPT_IC_IC_RUNTIME_STUB_H 184514f5e3Sopenharmony_ci 194514f5e3Sopenharmony_ci#include "ecmascript/ic/profile_type_info.h" 204514f5e3Sopenharmony_ci#include "ecmascript/js_tagged_value.h" 214514f5e3Sopenharmony_ci#include "ecmascript/property_attributes.h" 224514f5e3Sopenharmony_ci 234514f5e3Sopenharmony_cinamespace panda::ecmascript { 244514f5e3Sopenharmony_ciclass ICRuntimeStub { 254514f5e3Sopenharmony_cipublic: 264514f5e3Sopenharmony_ci static inline JSTaggedValue LoadGlobalICByName(JSThread *thread, ProfileTypeInfo *profileTypeInfo, 274514f5e3Sopenharmony_ci JSTaggedValue globalValue, JSTaggedValue key, uint32_t slotId, 284514f5e3Sopenharmony_ci bool tryLoad); 294514f5e3Sopenharmony_ci static inline JSTaggedValue StoreGlobalICByName(JSThread *thread, ProfileTypeInfo *profileTypeInfo, 304514f5e3Sopenharmony_ci JSTaggedValue globalValue, JSTaggedValue key, 314514f5e3Sopenharmony_ci JSTaggedValue value, uint32_t slotId, bool tryStore); 324514f5e3Sopenharmony_ci static inline JSTaggedValue LoadICByName(JSThread *thread, ProfileTypeInfo *profileTypeInfo, 334514f5e3Sopenharmony_ci JSTaggedValue receiver, JSTaggedValue key, uint32_t slotId); 344514f5e3Sopenharmony_ci static inline JSTaggedValue TryLoadICByName(JSThread *thread, JSTaggedValue receiver, 354514f5e3Sopenharmony_ci JSTaggedValue firstValue, JSTaggedValue secondValue); 364514f5e3Sopenharmony_ci static inline JSTaggedValue TryStoreICByName(JSThread *thread, JSTaggedValue receiver, 374514f5e3Sopenharmony_ci JSTaggedValue firstValue, JSTaggedValue secondValue, 384514f5e3Sopenharmony_ci JSTaggedValue value); 394514f5e3Sopenharmony_ci static inline JSTaggedValue StoreICByName(JSThread *thread, ProfileTypeInfo *profileTypeInfo, 404514f5e3Sopenharmony_ci JSTaggedValue receiver, JSTaggedValue key, 414514f5e3Sopenharmony_ci JSTaggedValue value, uint32_t slotId); 424514f5e3Sopenharmony_ci static inline JSTaggedValue CheckPolyHClass(JSTaggedValue cachedValue, JSHClass* hclass); 434514f5e3Sopenharmony_ci static inline JSTaggedValue LoadICWithHandler(JSThread *thread, JSTaggedValue receiver, JSTaggedValue holder, 444514f5e3Sopenharmony_ci JSTaggedValue handler); 454514f5e3Sopenharmony_ci static inline JSTaggedValue LoadICWithElementHandler(JSThread *thread, JSTaggedValue receiver, 464514f5e3Sopenharmony_ci JSTaggedValue handler, JSTaggedValue key); 474514f5e3Sopenharmony_ci static inline JSTaggedValue StoreICWithHandler(JSThread *thread, JSTaggedValue receiver, JSTaggedValue holder, 484514f5e3Sopenharmony_ci JSTaggedValue value, JSTaggedValue handler); 494514f5e3Sopenharmony_ci static inline void StoreWithTransition(JSThread *thread, JSObject *receiver, JSTaggedValue value, 504514f5e3Sopenharmony_ci JSTaggedValue handler, bool withPrototype = false); 514514f5e3Sopenharmony_ci static inline JSTaggedValue StoreTransWithProto(JSThread *thread, JSObject *receiver, 524514f5e3Sopenharmony_ci JSTaggedValue value, JSTaggedValue handler); 534514f5e3Sopenharmony_ci static inline JSTaggedValue StoreWithTS(JSThread *thread, JSTaggedValue receiver, 544514f5e3Sopenharmony_ci JSTaggedValue value, JSTaggedValue handler); 554514f5e3Sopenharmony_ci static inline JSTaggedValue StorePrototype(JSThread *thread, JSTaggedValue receiver, 564514f5e3Sopenharmony_ci JSTaggedValue value, JSTaggedValue handler); 574514f5e3Sopenharmony_ci static inline JSTaggedValue LoadFromField(JSObject *receiver, uint64_t handlerInfo); 584514f5e3Sopenharmony_ci static inline void StoreField(JSThread *thread, JSObject *receiver, JSTaggedValue value, uint64_t handler); 594514f5e3Sopenharmony_ci static inline JSTaggedValue LoadGlobal(JSTaggedValue handler); 604514f5e3Sopenharmony_ci static inline JSTaggedValue StoreGlobal(JSThread *thread, JSTaggedValue value, JSTaggedValue handler); 614514f5e3Sopenharmony_ci static inline JSTaggedValue LoadPrototype(JSThread *thread, JSTaggedValue receiver, JSTaggedValue handler); 624514f5e3Sopenharmony_ci 634514f5e3Sopenharmony_ci static inline JSTaggedValue TryLoadICByValue(JSThread *thread, JSTaggedValue receiver, JSTaggedValue key, 644514f5e3Sopenharmony_ci JSTaggedValue firstValue, JSTaggedValue secondValue); 654514f5e3Sopenharmony_ci static inline JSTaggedValue LoadICByValue(JSThread *thread, ProfileTypeInfo *profileTypeInfo, 664514f5e3Sopenharmony_ci JSTaggedValue receiver, JSTaggedValue key, uint32_t slotId); 674514f5e3Sopenharmony_ci static inline JSTaggedValue TryStoreICByValue(JSThread *thread, JSTaggedValue receiver, JSTaggedValue key, 684514f5e3Sopenharmony_ci JSTaggedValue firstValue, JSTaggedValue secondValue, 694514f5e3Sopenharmony_ci JSTaggedValue value); 704514f5e3Sopenharmony_ci static inline JSTaggedValue StoreICByValue(JSThread *thread, ProfileTypeInfo *profileTypeInfo, 714514f5e3Sopenharmony_ci JSTaggedValue receiver, JSTaggedValue key, JSTaggedValue value, 724514f5e3Sopenharmony_ci uint32_t slotId); 734514f5e3Sopenharmony_ci static inline JSTaggedValue StoreOwnICByValue(JSThread *thread, ProfileTypeInfo *profileTypeInfo, 744514f5e3Sopenharmony_ci JSTaggedValue receiver, JSTaggedValue key, 754514f5e3Sopenharmony_ci JSTaggedValue value, uint32_t slotId); 764514f5e3Sopenharmony_ci static inline JSTaggedValue LoadElement(JSObject *receiver, JSTaggedValue key); 774514f5e3Sopenharmony_ci static inline JSTaggedValue LoadStringElement(JSThread *thread, JSTaggedValue receiver, JSTaggedValue key); 784514f5e3Sopenharmony_ci static inline JSTaggedValue LoadTypedArrayElement(JSThread *thread, JSTaggedValue receiver, JSTaggedValue key); 794514f5e3Sopenharmony_ci static inline JSTaggedValue StoreElement(JSThread *thread, JSObject *receiver, JSTaggedValue key, 804514f5e3Sopenharmony_ci JSTaggedValue value, JSTaggedValue handlerInfo); 814514f5e3Sopenharmony_ci static inline JSTaggedValue StoreTypedArrayElement(JSThread *thread, JSTaggedValue receiver, JSTaggedValue key, 824514f5e3Sopenharmony_ci JSTaggedValue value); 834514f5e3Sopenharmony_ci static inline int64_t TryToElementsIndex(JSTaggedValue key); 844514f5e3Sopenharmony_ci static inline JSTaggedValue LoadMiss(JSThread *thread, ProfileTypeInfo *profileTypeInfo, JSTaggedValue receiver, 854514f5e3Sopenharmony_ci JSTaggedValue key, uint32_t slotId, ICKind kind); 864514f5e3Sopenharmony_ci static inline JSTaggedValue LoadValueMiss(JSThread *thread, ProfileTypeInfo *profileTypeInfo, 874514f5e3Sopenharmony_ci JSTaggedValue receiver, JSTaggedValue key, uint32_t slotId, ICKind kind); 884514f5e3Sopenharmony_ci static inline JSTaggedValue StoreMiss(JSThread *thread, ProfileTypeInfo *profileTypeInfo, JSTaggedValue receiver, 894514f5e3Sopenharmony_ci JSTaggedValue key, JSTaggedValue value, uint32_t slotId, 904514f5e3Sopenharmony_ci ICKind kind, bool isOwn = false); 914514f5e3Sopenharmony_ci}; 924514f5e3Sopenharmony_ci} // namespace panda::ecmascript 934514f5e3Sopenharmony_ci 944514f5e3Sopenharmony_ci#endif // ECMASCRIPT_IC_IC_RUNTIME_STUB_H 95