arkcompiler_ets_runtime/ecmascript/ic/ic_compare_op.h
wengchangcheng ab13a0da91 Descriptor: support first level instruction
Details:
1. Add old Opcode defines
2. Add new inst handler of throw & wide & deprecated
3. Modify interpreter for new inst
4. Modify typeinfer for new inst
5. Modify asm interpreter for new inst
6. Modify aot circuit builder for new inst
7. Translate old inst to first level inst

Issue: https://gitee.com/openharmony/arkcompiler_ets_runtime/issues/I5LPNL

Signed-off-by: wengchangcheng <wengchangcheng@huawei.com>
Change-Id: If9e0b60cafc32a662a5fb1676887939d5a2b9ebf
2022-08-24 14:12:42 +08:00

78 lines
2.3 KiB
C++

/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ECMASCRIPT_IC_IC_COMPARE_H
#define ECMASCRIPT_IC_IC_COMPARE_H
#include "ecmascript/js_function.h"
#include "ecmascript/js_thread.h"
#include "ecmascript/object_factory.h"
namespace panda::ecmascript {
enum class CompareOpType {
NUMBER_NUMBER,
NUMBER_STRING,
NUMBER_BOOLEAN,
NUMBER_OBJ,
STRING_STRING,
STRING_NUMBER,
STRING_BOOLEAN,
STRING_OBJ,
BOOLEAN_BOOLEAN,
BOOLEAN_NUMBER,
BOOLEAN_STRING,
BOOLEAN_OBJ,
OBJ_OBJ,
OBJ_NUMBER,
OBJ_STRING,
OBJ_BOOLEAN,
SYMBOL_SYMBOL,
NULL_NULL,
NULL_UNDEFINED,
UNDEFINED_UNDEFINED,
UNDEFINED_NULL,
UNDEFINED_BLLEAN,
OTHER,
};
class CompareOp {
public:
CompareOp() = default;
~CompareOp() = default;
static JSTaggedValue EqualWithIC(JSThread* thread, JSTaggedValue left,
JSTaggedValue right, CompareOpType operationType);
static JSTaggedValue NotEqualWithIC(JSThread *thread, JSTaggedValue left,
JSTaggedValue right, CompareOpType operationType);
static ComparisonResult Compare(JSThread *thread, JSTaggedValue left,
JSTaggedValue right, CompareOpType operationType);
static JSTaggedValue LessWithIC(JSThread *thread, JSTaggedValue left,
JSTaggedValue right, CompareOpType operationType);
static JSTaggedValue LessEqWithIC(JSThread *thread, JSTaggedValue left,
JSTaggedValue right, CompareOpType operationType);
static JSTaggedValue GreaterWithIC(JSThread *thread, JSTaggedValue left,
JSTaggedValue right, CompareOpType operationType);
static JSTaggedValue GreaterEqWithIC(JSThread *thread, JSTaggedValue left,
JSTaggedValue right, CompareOpType operationType);
};
} // namespace panda::ecmascript
#endif // ECMASCRIPT_IC_IC_COMPAREOP_H