• 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_COMPILER_NUMBER_SPECULATIVE_RUNNER_H
17 #define ECMASCRIPT_COMPILER_NUMBER_SPECULATIVE_RUNNER_H
18 
19 #include "ecmascript/compiler/number_speculative_lowering.h"
20 #include "ecmascript/compiler/pass_manager.h"
21 #include "ecmascript/compiler/number_speculative_retype.h"
22 #include "ecmascript/compiler/range_guard.h"
23 #include "ecmascript/ts_types/ts_manager.h"
24 
25 namespace panda::ecmascript::kungfu {
26 class NumberSpeculativeRunner {
27 public:
NumberSpeculativeRunner(Circuit * circuit,bool enableLog,const std::string & name,Chunk * chunk)28     NumberSpeculativeRunner(Circuit *circuit, bool enableLog, const std::string& name, Chunk* chunk)
29         : circuit_(circuit), acc_(circuit), enableLog_(enableLog), methodName_(name),
30           chunk_(chunk), typeInfos_(chunk), rangeInfos_(chunk) {}
31 
32     ~NumberSpeculativeRunner() = default;
33     void Run();
34 private:
IsLogEnabled()35     bool IsLogEnabled() const
36     {
37         return enableLog_;
38     }
39 
GetMethodName()40     const std::string& GetMethodName() const
41     {
42         return methodName_;
43     }
44 
45     Circuit *circuit_ {nullptr};
46     GateAccessor acc_;
47     bool enableLog_ {false};
48     std::string methodName_;
49     Chunk *chunk_ {nullptr};
50     ChunkVector<TypeInfo> typeInfos_;
51     ChunkVector<RangeInfo> rangeInfos_;
52 };
53 }  // panda::ecmascript::kungfu
54 #endif  // ECMASCRIPT_COMPILER_NUMBER_SPECULATIVE_RUNNER_H
55