arkcompiler_ets_runtime/ecmascript/compiler/jit_compilation_env.h
xiaoweidong 2aed02e4e4 [JIT] jit concurrent compile 2
1. Add alloc check in new share obj hook
2. get callsite from frame directly for jit
3. fix comments

Change-Id: I5232a29e8c84385cfdb805237f587cb4d8e982c2
Signed-off-by: xiaoweidong <xiaoweidong@huawei.com>
2024-04-15 14:04:05 +08:00

81 lines
3.1 KiB
C++

/*
* Copyright (c) 2024 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_JIT_COMPILATION_ENV_H
#define ECMASCRIPT_COMPILER_JIT_COMPILATION_ENV_H
#include "ecmascript/compiler/compilation_env.h"
namespace panda::ecmascript {
class JitCompilationEnv final : public CompilationEnv {
public:
JitCompilationEnv(EcmaVM *vm, EcmaVM *hVm, JSHandle<JSFunction> &jsFunction);
~JitCompilationEnv() = default;
bool IsJitCompiler() const override
{
return true;
}
JSRuntimeOptions &GetJSOptions() override;
// thread
const CMap<ElementsKind, ConstantIndex> &GetArrayHClassIndexMap() const override;
const BuiltinHClassEntries &GetBuiltinHClassEntries() const override;
JSHClass *GetBuiltinPrototypeHClass(BuiltinTypeId type) const override;
void SetTsManagerCompilationEnv();
// context
JSTaggedValue FindConstpool(const JSPandaFile *jsPandaFile, panda_file::File::EntityId id) const override;
JSTaggedValue FindConstpool(const JSPandaFile *jsPandaFile, int32_t index) const override;
JSTaggedValue FindOrCreateUnsharedConstpool(const uint32_t methodOffset) const override;
JSTaggedValue FindOrCreateUnsharedConstpool(JSTaggedValue sharedConstpool) const override;
JSHandle<ConstantPool> FindOrCreateConstPool(const JSPandaFile *jsPandaFile,
panda_file::File::EntityId id) override;
JSTaggedValue GetConstantPoolByMethodOffset(const uint32_t methodOffset) const override;
// ConstantPool
JSTaggedValue GetArrayLiteralFromCache(JSTaggedValue constpool, uint32_t index, CString entry) const override;
JSTaggedValue GetObjectLiteralFromCache(JSTaggedValue constpool, uint32_t index, CString entry) const override;
panda_file::File::EntityId GetIdFromCache(JSTaggedValue constpool, uint32_t index) const override;
// GlobalEnv
JSHandle<GlobalEnv> GetGlobalEnv() const override;
// GlobalConstants
const GlobalEnvConstants *GlobalConstants() const override;
JSTaggedValue GetStringFromConstantPool(const uint32_t methodOffset, const uint16_t cpIdx) const override;
JSThread *GetHostThread() const override
{
return hostThread_;
}
JSPandaFile *GetJSPandaFile() const override
{
return jsPandaFile_;
}
MethodLiteral *GetMethodLiteral() const override
{
return methodLiteral_;
}
private:
JSThread *hostThread_ {nullptr};
JSHandle<JSFunction> jsFunction_;
JSPandaFile *jsPandaFile_ {nullptr};
MethodLiteral *methodLiteral_ {nullptr};
};
} // namespace panda::ecmascript
#endif // ECMASCRIPT_COMPILER_JIT_COMPILATION_ENV_H