• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023-2024 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_BUILTINS_COLLATOR_STUB_BUILDER_H
17 #define ECMASCRIPT_COMPILER_BUILTINS_COLLATOR_STUB_BUILDER_H
18 #include <ecmascript/js_collator.h>
19 
20 #include "ecmascript/compiler/builtins/builtins_stubs.h"
21 
22 namespace panda::ecmascript::kungfu {
23 class BuiltinsCollatorStubBuilder : public BuiltinsStubBuilder {
24 public:
BuiltinsCollatorStubBuilder(BuiltinsStubBuilder * parent,GateRef globalEnv)25     explicit BuiltinsCollatorStubBuilder(BuiltinsStubBuilder *parent, GateRef globalEnv)
26         : BuiltinsStubBuilder(parent, globalEnv) {}
27     ~BuiltinsCollatorStubBuilder() override = default;
28     NO_MOVE_SEMANTIC(BuiltinsCollatorStubBuilder);
29     NO_COPY_SEMANTIC(BuiltinsCollatorStubBuilder);
GenerateCircuit()30     void GenerateCircuit() override {}
31     void ResolvedOptions(GateRef glue, GateRef thisValue, GateRef numArgs, Variable* res, Label *exit, Label *slowPath);
32 
33 private:
34     template <typename BitType>
35     GateRef GetBitField(GateRef collator);
36     GateRef UsageOptionsToEcmaString(GateRef glue, GateRef usage);
37     GateRef SensitivityOptionsToEcmaString(GateRef glue, GateRef sensitivity);
38     GateRef CaseFirstOptionsToEcmaString(GateRef glue, GateRef sensitivity);
39 
40     static constexpr size_t SENSITIVITY_OPTION_CASES_NUM = 5;
41     static int64_t SensitivityOptionCases[SENSITIVITY_OPTION_CASES_NUM];
42     static ConstantIndex SensitivityOptionIndexes[SENSITIVITY_OPTION_CASES_NUM - 1];
43 
44     static constexpr size_t CASE_FIRST_OPTION_NUM = 4;
45     static int64_t CaseFirstOptionCases[CASE_FIRST_OPTION_NUM];
46     static ConstantIndex CaseFirstOptionIndexes[CASE_FIRST_OPTION_NUM];
47 };
48 } // namespace panda::ecmascript::kungfu
49 #endif  // ECMASCRIPT_COMPILER_BUILTINS_COLLATOR_STUB_BUILDER_H