1 /* 2 * Copyright (c) 2022 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_HASH_STUB_BUILDER_H 17 #define ECMASCRIPT_COMPILER_HASH_STUB_BUILDER_H 18 19 #include "ecmascript/compiler/builtins/builtins_string_stub_builder.h" 20 #include "ecmascript/compiler/profiler_operation.h" 21 #include "ecmascript/compiler/stub_builder.h" 22 23 namespace panda::ecmascript::kungfu { 24 class HashStubBuilder : public StubBuilder { 25 public: HashStubBuilder(StubBuilder * parent,GateRef glue)26 explicit HashStubBuilder(StubBuilder *parent, GateRef glue) 27 : StubBuilder(parent), glue_(glue) {} 28 ~HashStubBuilder() override = default; 29 NO_MOVE_SEMANTIC(HashStubBuilder); 30 NO_COPY_SEMANTIC(HashStubBuilder); GenerateCircuit()31 void GenerateCircuit() override {} 32 33 GateRef GetHash(GateRef key); 34 35 private: 36 void CalcHashcodeForNumber(GateRef key, Variable *res, Label *exit); 37 38 GateRef glue_; 39 }; 40 } // namespace panda::ecmascript::kungfu 41 #endif // ECMASCRIPT_COMPILER_HASH_STUB_BUILDER_H 42