• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023 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 
16 #ifndef ECMASCRIPT_PGO_PROFILER_PGO_CONTEXT_H
17 #define ECMASCRIPT_PGO_PROFILER_PGO_CONTEXT_H
18 
19 #include <cstdint>
20 #include <fstream>
21 #include <memory>
22 #include <string>
23 #include <unordered_map>
24 
25 #include "ecmascript/pgo_profiler/pgo_utils.h"
26 #include "macros.h"
27 
28 namespace panda::ecmascript::pgo {
29 class PGOAbcFilePool;
30 class PGOProfileTypePool;
31 class PGOProfilerHeader;
32 
33 class PGOContext {
34 public:
35     PGOContext() = default;
36     virtual ~PGOContext() = default;
37     virtual std::shared_ptr<PGOProfileTypePool> GetProfileTypePool() const = 0;
38     virtual uint32_t GetHotnessThreshold() const = 0;
39     virtual PGOProfilerHeader *GetHeader() const = 0;
40     virtual bool SupportElementsKind() const = 0;
41     virtual bool SupportElementsTrackInfo() const = 0;
42     virtual void ResetAbcIdRemap() const = 0;
43     virtual void AddAbcIdRemap(ApEntityId oldId, ApEntityId newId) const = 0;
44     virtual const std::map<ApEntityId, ApEntityId> &GetAbcIdRemap() const = 0;
45 
46 private:
47     NO_COPY_SEMANTIC(PGOContext);
48     NO_MOVE_SEMANTIC(PGOContext);
49 };
50 } // namespace panda::ecmascript::pgo
51 #endif  // ECMASCRIPT_PGO_PROFILER_PGO_CONTEXT_H
52