mirror of
https://github.com/google/pebble.git
synced 2025-03-21 11:21:21 +00:00
91 lines
2.6 KiB
C
91 lines
2.6 KiB
C
/* Copyright 2014-2016 Samsung Electronics Co., Ltd.
|
|
* Copyright 2015-2016 University of Szeged.
|
|
*
|
|
* 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.
|
|
*/
|
|
|
|
#include "ecma-builtins.h"
|
|
#include "ecma-comparison.h"
|
|
#include "ecma-exceptions.h"
|
|
#include "ecma-function-object.h"
|
|
#include "ecma-globals.h"
|
|
#include "ecma-helpers.h"
|
|
#include "ecma-lex-env.h"
|
|
#include "ecma-try-catch-macro.h"
|
|
#include "opcodes.h"
|
|
#include "vm-defines.h"
|
|
|
|
/** \addtogroup vm Virtual machine
|
|
* @{
|
|
*
|
|
* \addtogroup vm_opcodes Opcodes
|
|
* @{
|
|
*/
|
|
|
|
/**
|
|
* 'Equals' opcode handler.
|
|
*
|
|
* See also: ECMA-262 v5, 11.9.1
|
|
*
|
|
* @return ecma value
|
|
* Returned value must be freed with ecma_free_value
|
|
*/
|
|
ecma_value_t
|
|
opfunc_equal_value (ecma_value_t left_value, /**< left value */
|
|
ecma_value_t right_value) /**< right value */
|
|
{
|
|
JERRY_ASSERT (!ECMA_IS_VALUE_ERROR (left_value)
|
|
&& !ECMA_IS_VALUE_ERROR (right_value));
|
|
|
|
ecma_value_t compare_result = ecma_op_abstract_equality_compare (left_value,
|
|
right_value);
|
|
|
|
JERRY_ASSERT (ecma_is_value_boolean (compare_result)
|
|
|| ECMA_IS_VALUE_ERROR (compare_result));
|
|
|
|
return compare_result;
|
|
} /* opfunc_equal_value */
|
|
|
|
/**
|
|
* 'Does-not-equals' opcode handler.
|
|
*
|
|
* See also: ECMA-262 v5, 11.9.2
|
|
*
|
|
* @return ecma value
|
|
* Returned value must be freed with ecma_free_value
|
|
*/
|
|
ecma_value_t
|
|
opfunc_not_equal_value (ecma_value_t left_value, /**< left value */
|
|
ecma_value_t right_value) /**< right value */
|
|
{
|
|
JERRY_ASSERT (!ECMA_IS_VALUE_ERROR (left_value)
|
|
&& !ECMA_IS_VALUE_ERROR (right_value));
|
|
|
|
ecma_value_t compare_result = ecma_op_abstract_equality_compare (left_value,
|
|
right_value);
|
|
|
|
JERRY_ASSERT (ecma_is_value_boolean (compare_result)
|
|
|| ECMA_IS_VALUE_ERROR (compare_result));
|
|
|
|
if (!ECMA_IS_VALUE_ERROR (compare_result))
|
|
{
|
|
compare_result = ecma_invert_boolean_value (compare_result);
|
|
}
|
|
|
|
return compare_result;
|
|
} /* opfunc_not_equal_value */
|
|
|
|
/**
|
|
* @}
|
|
* @}
|
|
*/
|