arkcompiler_ets_runtime/ecmascript/ic/invoke_cache.h
yingguofeng@huawei.com 1d9b2ac3dd nativePointer optimization
Change-Id: I97b58375c2ec30f33778d7f11fb40a9cf0ed346b
Signed-off-by: yingguofeng@huawei.com <yingguofeng@huawei.com>
2021-12-23 19:40:54 +08:00

52 lines
2.2 KiB
C++

/*
* Copyright (c) 2021 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_IC_INVOKE_CACHE_H_
#define ECMASCRIPT_IC_INVOKE_CACHE_H_
#include "ecmascript/ic/profile_type_info.h"
#include "ecmascript/js_tagged_value.h"
namespace panda::ecmascript {
class InvokeCache {
public:
static constexpr size_t MONO_CASE_NUM = 2;
static constexpr size_t POLY_CASE_NUM = 4;
static bool SetMonoConstuctCacheSlot(JSThread *thread, ProfileTypeInfo *profileTypeInfo, uint32_t slotId,
JSTaggedValue newTarget, JSTaggedValue initialHClass);
static bool SetPolyConstuctCacheSlot(JSThread *thread, ProfileTypeInfo *profileTypeInfo, uint32_t slotId,
uint8_t length, JSTaggedValue newTargetArray,
JSTaggedValue initialHClassArray);
static JSTaggedValue CheckPolyInvokeCache(JSTaggedValue cachedArray, JSTaggedValue func);
static JSTaggedValue Construct(JSThread *thread, JSTaggedValue firstValue, JSTaggedValue secondValue,
JSTaggedValue ctor, JSTaggedValue newTarget, uint16_t firstArgIdx,
uint16_t length);
static bool SetMonoInlineCallCacheSlot(JSThread *thread, ProfileTypeInfo *profileTypeInfo, uint32_t slotId,
JSTaggedValue callee);
static bool SetPolyInlineCallCacheSlot(JSThread *thread, ProfileTypeInfo *profileTypeInfo, uint32_t slotId,
uint8_t length, JSTaggedValue calleeArray);
static bool DecideCanBeInlined(JSMethod *method);
};
} // namespace panda::ecmascript
#endif // ECMASCRIPT_IC_INVOKE_CACHE_H_