• 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)25     explicit BuiltinsCollatorStubBuilder(BuiltinsStubBuilder *parent) : BuiltinsStubBuilder(parent) {}
26     ~BuiltinsCollatorStubBuilder() override = default;
27     NO_MOVE_SEMANTIC(BuiltinsCollatorStubBuilder);
28     NO_COPY_SEMANTIC(BuiltinsCollatorStubBuilder);
GenerateCircuit()29     void GenerateCircuit() override {}
30     void ResolvedOptions(GateRef glue, GateRef thisValue, GateRef numArgs, Variable* res, Label *exit, Label *slowPath);
31 
32 private:
33     template <typename BitType>
34     GateRef GetBitField(GateRef collator);
35     GateRef UsageOptionsToEcmaString(GateRef glue, GateRef usage);
36     GateRef SensitivityOptionsToEcmaString(GateRef glue, GateRef sensitivity);
37     GateRef CaseFirstOptionsToEcmaString(GateRef glue, GateRef sensitivity);
38 
39     static constexpr size_t SENSITIVITY_OPTION_CASES_NUM = 5;
40     static int64_t SensitivityOptionCases[SENSITIVITY_OPTION_CASES_NUM];
41     static ConstantIndex SensitivityOptionIndexes[SENSITIVITY_OPTION_CASES_NUM - 1];
42 
43     static constexpr size_t CASE_FIRST_OPTION_NUM = 4;
44     static int64_t CaseFirstOptionCases[CASE_FIRST_OPTION_NUM];
45     static ConstantIndex CaseFirstOptionIndexes[CASE_FIRST_OPTION_NUM];
46 };
47 } // namespace panda::ecmascript::kungfu
48 #endif  // ECMASCRIPT_COMPILER_BUILTINS_COLLATOR_STUB_BUILDER_H