arkcompiler_ets_runtime/ecmascript/jspandafile/program_object.cpp
c00451847 ac3eae8b47 opt definefunc field store barrier
issue: https://gitee.com/open_harmony/dashboard?issue_id=I9IT6U
Change-Id: I631113b5a718d5e7a338ccb4888da974a100a8df
Signed-off-by: c00451847 <chenkai71@huawei.com>
2024-05-10 16:59:55 +08:00

40 lines
1.5 KiB
C++

/*
* 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.
*/
#include "ecmascript/jspandafile/program_object.h"
namespace panda::ecmascript {
JSHandle<ConstantPool> ConstantPool::GetDeserializedConstantPool(EcmaVM *vm, const JSPandaFile *jsPandaFile,
int32_t cpID)
{
auto aotFileManager = vm->GetAOTFileManager();
return JSHandle<ConstantPool>(aotFileManager->GetDeserializedConstantPool(jsPandaFile, cpID));
}
JSTaggedValue ConstantPool::GetMethodFromCache(JSTaggedValue constpool, uint32_t index)
{
const ConstantPool *taggedPool = ConstantPool::Cast(constpool.GetTaggedObject());
auto val = taggedPool->GetObjectFromCache(index);
JSPandaFile *jsPandaFile = taggedPool->GetJSPandaFile();
bool isLoadedAOT = jsPandaFile->IsLoadedAOT();
if (isLoadedAOT && val.IsAOTLiteralInfo()) {
val = JSTaggedValue::Hole();
}
return val.IsHole() ? JSTaggedValue::Undefined() : val;
}
}