14514f5e3Sopenharmony_ci/*
24514f5e3Sopenharmony_ci * Copyright (c) 2021-2023 Huawei Device Co., Ltd.
34514f5e3Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
44514f5e3Sopenharmony_ci * you may not use this file except in compliance with the License.
54514f5e3Sopenharmony_ci * You may obtain a copy of the License at
64514f5e3Sopenharmony_ci *
74514f5e3Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
84514f5e3Sopenharmony_ci *
94514f5e3Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
104514f5e3Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
114514f5e3Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
124514f5e3Sopenharmony_ci * See the License for the specific language governing permissions and
134514f5e3Sopenharmony_ci * limitations under the License.
144514f5e3Sopenharmony_ci */
154514f5e3Sopenharmony_ci
164514f5e3Sopenharmony_ci#ifndef ECMASCRIPT_IC_IC_COMPARE_OP_H
174514f5e3Sopenharmony_ci#define ECMASCRIPT_IC_IC_COMPARE_OP_H
184514f5e3Sopenharmony_ci
194514f5e3Sopenharmony_ci#include "ecmascript/js_function.h"
204514f5e3Sopenharmony_ci#include "ecmascript/js_thread.h"
214514f5e3Sopenharmony_ci#include "ecmascript/object_factory.h"
224514f5e3Sopenharmony_ci
234514f5e3Sopenharmony_cinamespace panda::ecmascript {
244514f5e3Sopenharmony_cienum class CompareOpType {
254514f5e3Sopenharmony_ci    NUMBER_NUMBER,
264514f5e3Sopenharmony_ci    NUMBER_STRING,
274514f5e3Sopenharmony_ci    NUMBER_BOOLEAN,
284514f5e3Sopenharmony_ci    NUMBER_OBJ,
294514f5e3Sopenharmony_ci    STRING_STRING,
304514f5e3Sopenharmony_ci    STRING_NUMBER,
314514f5e3Sopenharmony_ci    STRING_BOOLEAN,
324514f5e3Sopenharmony_ci    STRING_OBJ,
334514f5e3Sopenharmony_ci    BOOLEAN_BOOLEAN,
344514f5e3Sopenharmony_ci    BOOLEAN_NUMBER,
354514f5e3Sopenharmony_ci    BOOLEAN_STRING,
364514f5e3Sopenharmony_ci    BOOLEAN_OBJ,
374514f5e3Sopenharmony_ci    OBJ_OBJ,
384514f5e3Sopenharmony_ci    OBJ_NUMBER,
394514f5e3Sopenharmony_ci    OBJ_STRING,
404514f5e3Sopenharmony_ci    OBJ_BOOLEAN,
414514f5e3Sopenharmony_ci    SYMBOL_SYMBOL,
424514f5e3Sopenharmony_ci    NULL_NULL,
434514f5e3Sopenharmony_ci    NULL_UNDEFINED,
444514f5e3Sopenharmony_ci    UNDEFINED_UNDEFINED,
454514f5e3Sopenharmony_ci    UNDEFINED_NULL,
464514f5e3Sopenharmony_ci    UNDEFINED_BLLEAN,
474514f5e3Sopenharmony_ci    OTHER,
484514f5e3Sopenharmony_ci};
494514f5e3Sopenharmony_ci
504514f5e3Sopenharmony_ciclass CompareOp {
514514f5e3Sopenharmony_cipublic:
524514f5e3Sopenharmony_ci
534514f5e3Sopenharmony_ci    CompareOp() = default;
544514f5e3Sopenharmony_ci    ~CompareOp() = default;
554514f5e3Sopenharmony_ci
564514f5e3Sopenharmony_ci    static JSTaggedValue EqualWithIC(JSThread* thread, JSTaggedValue left,
574514f5e3Sopenharmony_ci        JSTaggedValue right, CompareOpType operationType);
584514f5e3Sopenharmony_ci
594514f5e3Sopenharmony_ci    static JSTaggedValue NotEqualWithIC(JSThread *thread, JSTaggedValue left,
604514f5e3Sopenharmony_ci        JSTaggedValue right, CompareOpType operationType);
614514f5e3Sopenharmony_ci
624514f5e3Sopenharmony_ci    static ComparisonResult Compare(JSThread *thread, JSTaggedValue left,
634514f5e3Sopenharmony_ci        JSTaggedValue right, CompareOpType operationType);
644514f5e3Sopenharmony_ci
654514f5e3Sopenharmony_ci    static JSTaggedValue LessWithIC(JSThread *thread, JSTaggedValue left,
664514f5e3Sopenharmony_ci        JSTaggedValue right, CompareOpType operationType);
674514f5e3Sopenharmony_ci
684514f5e3Sopenharmony_ci    static JSTaggedValue LessEqWithIC(JSThread *thread, JSTaggedValue left,
694514f5e3Sopenharmony_ci        JSTaggedValue right, CompareOpType operationType);
704514f5e3Sopenharmony_ci
714514f5e3Sopenharmony_ci    static JSTaggedValue GreaterWithIC(JSThread *thread, JSTaggedValue left,
724514f5e3Sopenharmony_ci        JSTaggedValue right, CompareOpType operationType);
734514f5e3Sopenharmony_ci
744514f5e3Sopenharmony_ci    static JSTaggedValue GreaterEqWithIC(JSThread *thread, JSTaggedValue left,
754514f5e3Sopenharmony_ci        JSTaggedValue right, CompareOpType operationType);
764514f5e3Sopenharmony_ci};
774514f5e3Sopenharmony_ci}   // namespace panda::ecmascript
784514f5e3Sopenharmony_ci#endif  // ECMASCRIPT_IC_IC_COMPARE_OP_H