Small refactorings

Modifications:
* eliminate unnecessary variables, functions
* use ECMA_NUMBER macros where it is possible
* simplify code
* minor style fix (comments, increase-decrease operators)

JerryScript-DCO-1.0-Signed-off-by: Zsolt Borbély zsborbely.u-szeged@partner.samsung.com
This commit is contained in:
Zsolt Borbély
2016-02-22 08:50:11 +01:00
parent e14d0b8942
commit 3f377692d9
14 changed files with 88 additions and 167 deletions
+5
View File
@@ -579,6 +579,11 @@ typedef double ecma_number_t;
*/
#define ECMA_NUMBER_HALF ((ecma_number_t) 0.5f)
/**
* Value '-1' of ecma_number_t
*/
#define ECMA_NUMBER_MINUS_ONE ((ecma_number_t) -1)
/**
* Minimum positive and maximum value of ecma-number
*/
+8 -30
View File
@@ -1,4 +1,4 @@
/* Copyright 2014-2015 Samsung Electronics Co., Ltd.
/* Copyright 2014-2016 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -404,7 +404,7 @@ ecma_utf8_string_to_number (const lit_utf8_byte_t *str_p, /**< utf-8 string */
/* Hex literal handling */
begin_p += 2;
ecma_number_t num = 0;
ecma_number_t num = ECMA_NUMBER_ZERO;
for (const lit_utf8_byte_t * iter_p = begin_p;
iter_p <= end_p;
@@ -796,7 +796,7 @@ ecma_uint32_to_utf8_string (uint32_t value, /**< value to convert */
*p-- = digits[value % 10];
value /= 10;
bytes_copied ++;
bytes_copied++;
}
while (value != 0);
@@ -821,9 +821,7 @@ ecma_uint32_to_utf8_string (uint32_t value, /**< value to convert */
ecma_number_t
ecma_uint32_to_number (uint32_t value) /**< unsigned 32-bit integer value */
{
ecma_number_t num_value = (ecma_number_t) value;
return num_value;
return (ecma_number_t) value;
} /* ecma_uint32_to_number */
/**
@@ -834,9 +832,7 @@ ecma_uint32_to_number (uint32_t value) /**< unsigned 32-bit integer value */
ecma_number_t
ecma_int32_to_number (int32_t value) /**< signed 32-bit integer value */
{
ecma_number_t num_value = (ecma_number_t) value;
return num_value;
return (ecma_number_t) value;
} /* ecma_int32_to_number */
/**
@@ -857,17 +853,8 @@ ecma_number_to_uint32 (ecma_number_t num) /**< ecma-number */
return 0;
}
bool sign = ecma_number_is_negative (num);
ecma_number_t abs_num;
if (sign)
{
abs_num = ecma_number_negate (num);
}
else
{
abs_num = num;
}
const bool sign = ecma_number_is_negative (num);
const ecma_number_t abs_num = sign ? ecma_number_negate (num) : num;
// 2 ^ 32
const uint64_t uint64_2_pow_32 = (1ull << 32);
@@ -890,16 +877,7 @@ ecma_number_to_uint32 (ecma_number_t num) /**< ecma-number */
JERRY_ASSERT (num_in_uint32_range < uint64_2_pow_32);
uint32_t uint32_num = (uint32_t) num_in_uint32_range;
uint32_t ret;
if (sign)
{
ret = -uint32_num;
}
else
{
ret = uint32_num;
}
const uint32_t ret = sign ? -uint32_num : uint32_num;
#ifndef JERRY_NDEBUG
if (sign
+25 -49
View File
@@ -1,5 +1,5 @@
/* Copyright 2014 Samsung Electronics Co., Ltd.
* Copyright 2015 University of Szeged.
/* 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.
@@ -24,6 +24,9 @@
#include "ecma-globals.h"
#include "ecma-helpers.h"
#define ECMA_NUMBER_SIGN_POS (ECMA_NUMBER_FRACTION_WIDTH + \
ECMA_NUMBER_BIASED_EXP_WIDTH)
#if CONFIG_ECMA_NUMBER_TYPE == CONFIG_ECMA_NUMBER_FLOAT32
JERRY_STATIC_ASSERT (sizeof (ecma_number_t) == sizeof (uint32_t),
size_of_ecma_number_t_must_be_equal_to_4_bytes);
@@ -38,16 +41,12 @@ ecma_number_pack (bool sign, /**< sign */
uint32_t biased_exp, /**< biased exponent */
uint64_t fraction) /**< fraction */
{
const uint32_t fraction_pos = 0;
const uint32_t biased_exp_pos = fraction_pos + ECMA_NUMBER_FRACTION_WIDTH;
const uint32_t sign_pos = biased_exp_pos + ECMA_NUMBER_BIASED_EXP_WIDTH;
JERRY_ASSERT ((biased_exp & ~((1u << ECMA_NUMBER_BIASED_EXP_WIDTH) - 1)) == 0);
JERRY_ASSERT ((fraction & ~((1ull << ECMA_NUMBER_FRACTION_WIDTH) - 1)) == 0);
uint32_t packed_value = (((sign ? 1u : 0u) << sign_pos) |
(biased_exp << biased_exp_pos) |
(((uint32_t) fraction) << fraction_pos));
uint32_t packed_value = (((sign ? 1u : 0u) << ECMA_NUMBER_SIGN_POS) |
(biased_exp << ECMA_NUMBER_FRACTION_WIDTH) |
((uint32_t) fraction));
union
{
@@ -69,10 +68,6 @@ ecma_number_unpack (ecma_number_t num, /**< ecma-number */
uint32_t *biased_exp_p, /**< [out] biased exponent (optional) */
uint64_t *fraction_p) /**< [out] fraction (optional) */
{
const uint32_t fraction_pos = 0;
const uint32_t biased_exp_pos = fraction_pos + ECMA_NUMBER_FRACTION_WIDTH;
const uint32_t sign_pos = biased_exp_pos + ECMA_NUMBER_BIASED_EXP_WIDTH;
union
{
uint32_t u32_value;
@@ -85,12 +80,12 @@ ecma_number_unpack (ecma_number_t num, /**< ecma-number */
if (sign_p != NULL)
{
*sign_p = ((packed_value >> sign_pos) != 0);
*sign_p = ((packed_value >> ECMA_NUMBER_SIGN_POS) != 0);
}
if (biased_exp_p != NULL)
{
*biased_exp_p = (((packed_value) & ~(1u << sign_pos)) >> biased_exp_pos);
*biased_exp_p = (((packed_value) & ~(1u << ECMA_NUMBER_SIGN_POS)) >> ECMA_NUMBER_FRACTION_WIDTH);
}
if (fraction_p != NULL)
@@ -107,10 +102,6 @@ ecma_number_unpack (ecma_number_t num, /**< ecma-number */
*/
const int32_t ecma_number_exponent_bias = 127;
/**
* Relative precision used in calculation with ecma-numbers
*/
const ecma_number_t ecma_number_relative_eps = 1.0e-10f;
#elif CONFIG_ECMA_NUMBER_TYPE == CONFIG_ECMA_NUMBER_FLOAT64
JERRY_STATIC_ASSERT (sizeof (ecma_number_t) == sizeof (uint64_t),
size_of_ecma_number_t_must_be_equal_to_8_bytes);
@@ -125,13 +116,9 @@ ecma_number_pack (bool sign, /**< sign */
uint32_t biased_exp, /**< biased exponent */
uint64_t fraction) /**< fraction */
{
const uint32_t fraction_pos = 0;
const uint32_t biased_exp_pos = fraction_pos + ECMA_NUMBER_FRACTION_WIDTH;
const uint32_t sign_pos = biased_exp_pos + ECMA_NUMBER_BIASED_EXP_WIDTH;
uint64_t packed_value = (((sign ? 1ull : 0ull) << sign_pos) |
(((uint64_t) biased_exp) << biased_exp_pos) |
(fraction << fraction_pos));
uint64_t packed_value = (((sign ? 1ull : 0ull) << ECMA_NUMBER_SIGN_POS) |
(((uint64_t) biased_exp) << ECMA_NUMBER_FRACTION_WIDTH) |
fraction);
JERRY_ASSERT ((biased_exp & ~((1u << ECMA_NUMBER_BIASED_EXP_WIDTH) - 1)) == 0);
JERRY_ASSERT ((fraction & ~((1ull << ECMA_NUMBER_FRACTION_WIDTH) - 1)) == 0);
@@ -156,10 +143,6 @@ ecma_number_unpack (ecma_number_t num, /**< ecma-number */
uint32_t *biased_exp_p, /**< [out] biased exponent (optional) */
uint64_t *fraction_p) /**< [out] fraction (optional) */
{
const uint32_t fraction_pos = 0;
const uint32_t biased_exp_pos = fraction_pos + ECMA_NUMBER_FRACTION_WIDTH;
const uint32_t sign_pos = biased_exp_pos + ECMA_NUMBER_BIASED_EXP_WIDTH;
union
{
uint64_t u64_value;
@@ -171,12 +154,12 @@ ecma_number_unpack (ecma_number_t num, /**< ecma-number */
if (sign_p != NULL)
{
*sign_p = ((packed_value >> sign_pos) != 0);
*sign_p = ((packed_value >> ECMA_NUMBER_SIGN_POS) != 0);
}
if (biased_exp_p != NULL)
{
*biased_exp_p = (uint32_t) (((packed_value) & ~(1ull << sign_pos)) >> biased_exp_pos);
*biased_exp_p = (uint32_t) (((packed_value) & ~(1ull << ECMA_NUMBER_SIGN_POS)) >> ECMA_NUMBER_FRACTION_WIDTH);
}
if (fraction_p != NULL)
@@ -193,10 +176,6 @@ ecma_number_unpack (ecma_number_t num, /**< ecma-number */
*/
const int32_t ecma_number_exponent_bias = 1023;
/**
* Relative precision used in calculation with ecma-numbers
*/
const ecma_number_t ecma_number_relative_eps = 1.0e-16;
#endif /* CONFIG_ECMA_NUMBER_TYPE == CONFIG_ECMA_NUMBER_FLOAT64 */
/**
@@ -638,7 +617,7 @@ ecma_number_trunc (ecma_number_t num) /**< ecma-number */
if (exponent < 0)
{
return 0;
return ECMA_NUMBER_ZERO;
}
else if (exponent < dot_shift)
{
@@ -674,21 +653,18 @@ ecma_number_t
ecma_number_calc_remainder (ecma_number_t left_num, /**< left operand */
ecma_number_t right_num) /**< right operand */
{
ecma_number_t n = left_num, d = right_num;
JERRY_ASSERT (!ecma_number_is_nan (left_num)
&& !ecma_number_is_zero (left_num)
&& !ecma_number_is_infinity (left_num));
JERRY_ASSERT (!ecma_number_is_nan (right_num)
&& !ecma_number_is_zero (right_num)
&& !ecma_number_is_infinity (right_num));
JERRY_ASSERT (!ecma_number_is_nan (n)
&& !ecma_number_is_zero (n)
&& !ecma_number_is_infinity (n));
JERRY_ASSERT (!ecma_number_is_nan (d)
&& !ecma_number_is_zero (d)
&& !ecma_number_is_infinity (d));
ecma_number_t q = ecma_number_trunc (ecma_number_divide (n, d));
ecma_number_t r = ecma_number_substract (n, ecma_number_multiply (d, q));
const ecma_number_t q = ecma_number_trunc (ecma_number_divide (left_num, right_num));
ecma_number_t r = ecma_number_substract (left_num, ecma_number_multiply (right_num, q));
if (ecma_number_is_zero (r)
&& ecma_number_is_negative (n))
&& ecma_number_is_negative (left_num))
{
r = ecma_number_negate (r);
}
+12 -43
View File
@@ -339,17 +339,16 @@ ecma_concat_ecma_strings (ecma_string_t *string1_p, /**< first ecma-string */
const size_t data_size = new_size + sizeof (ecma_string_heap_header_t);
ecma_string_heap_header_t *data_p = (ecma_string_heap_header_t *) mem_heap_alloc_block (data_size);
ssize_t bytes_copied1, bytes_copied2;
bytes_copied1 = ecma_string_to_utf8_string (string1_p,
(lit_utf8_byte_t *) (data_p + 1),
(ssize_t) str1_size);
JERRY_ASSERT (bytes_copied1 > 0);
ssize_t bytes_copied = ecma_string_to_utf8_string (string1_p,
(lit_utf8_byte_t *) (data_p + 1),
(ssize_t) str1_size);
JERRY_ASSERT (bytes_copied > 0);
bytes_copied2 = ecma_string_to_utf8_string (string2_p,
(lit_utf8_byte_t *) (data_p + 1) + str1_size,
(ssize_t) str2_size);
JERRY_ASSERT (bytes_copied2 > 0);
bytes_copied = ecma_string_to_utf8_string (string2_p,
(lit_utf8_byte_t *) (data_p + 1) + str1_size,
(ssize_t) str2_size);
JERRY_ASSERT (bytes_copied > 0);
data_p->size = (uint16_t) new_size;
data_p->length = (uint16_t) (ecma_string_get_length (string1_p) + ecma_string_get_length (string2_p));
@@ -469,8 +468,8 @@ ecma_copy_or_ref_ecma_string (ecma_string_t *string_desc_p) /**< string descript
} /* ecma_copy_or_ref_ecma_string */
/**
* Decrease reference counter and deallocate ecma-string if
* after that the counter the counter becomes zero.
* Decrease reference counter and deallocate ecma-string
* if the counter becomes zero.
*/
void
ecma_deref_ecma_string (ecma_string_t *string_p) /**< ecma-string */
@@ -518,32 +517,6 @@ ecma_deref_ecma_string (ecma_string_t *string_p) /**< ecma-string */
ecma_dealloc_string (string_p);
} /* ecma_deref_ecma_string */
/**
* Assertion that specified ecma-string need not be freed
*/
void
ecma_check_that_ecma_string_need_not_be_freed (const ecma_string_t *string_p) /**< ecma-string descriptor */
{
#ifdef JERRY_NDEBUG
(void) string_p;
#else /* JERRY_NDEBUG */
/*
* No reference counter increment or decrement
* should be performed with ecma-string placed
* on stack
*/
JERRY_ASSERT (string_p->refs == 1);
ecma_string_container_t container_type = (ecma_string_container_t) string_p->container;
JERRY_ASSERT (container_type == ECMA_STRING_CONTAINER_LIT_TABLE ||
container_type == ECMA_STRING_CONTAINER_MAGIC_STRING ||
container_type == ECMA_STRING_CONTAINER_MAGIC_STRING_EX ||
container_type == ECMA_STRING_CONTAINER_UINT32_IN_DESC);
#endif /* !JERRY_NDEBUG */
} /* ecma_check_that_ecma_string_need_not_be_freed */
/**
* Convert ecma-string to number
*/
@@ -926,16 +899,12 @@ ecma_compare_ecma_strings (const ecma_string_t *string1_p, /* ecma-string */
{
JERRY_ASSERT (string1_p != NULL && string2_p != NULL);
const bool is_equal_hashes = (string1_p->hash == string2_p->hash);
if (!is_equal_hashes)
if (string1_p->hash != string2_p->hash)
{
return false;
}
const bool is_equal_containers = (string1_p->container == string2_p->container);
const bool is_equal_fields = (string1_p->u.common_field == string2_p->u.common_field);
if (is_equal_containers && is_equal_fields)
if (ecma_compare_ecma_strings_equal_hashes (string1_p, string2_p))
{
return true;
}
-3
View File
@@ -95,7 +95,6 @@ extern ecma_string_t *ecma_new_ecma_string_from_magic_string_ex_id (lit_magic_st
extern ecma_string_t *ecma_concat_ecma_strings (ecma_string_t *, ecma_string_t *);
extern ecma_string_t *ecma_copy_or_ref_ecma_string (ecma_string_t *);
extern void ecma_deref_ecma_string (ecma_string_t *);
extern void ecma_check_that_ecma_string_need_not_be_freed (const ecma_string_t *);
extern ecma_number_t ecma_string_to_number (const ecma_string_t *);
extern bool ecma_string_get_array_index (const ecma_string_t *, uint32_t *);
@@ -120,8 +119,6 @@ extern ecma_string_t *ecma_string_substr (const ecma_string_t *, ecma_length_t,
extern ecma_string_t *ecma_string_trim (const ecma_string_t *);
/* ecma-helpers-number.c */
extern const ecma_number_t ecma_number_relative_eps;
extern ecma_number_t ecma_number_make_nan (void);
extern ecma_number_t ecma_number_make_infinity (bool);
extern bool ecma_number_is_nan (ecma_number_t);
@@ -961,18 +961,18 @@ ecma_builtin_array_prototype_object_sort_compare_helper (ecma_value_t j, /**< le
{
if (k_is_undef)
{
*result_p = ecma_int32_to_number (0);
*result_p = ECMA_NUMBER_ZERO;
}
else
{
*result_p = ecma_int32_to_number (1);
*result_p = ECMA_NUMBER_ONE;
}
}
else
{
if (k_is_undef)
{
*result_p = ecma_int32_to_number (-1);
*result_p = ECMA_NUMBER_MINUS_ONE;
}
else
{
@@ -986,15 +986,15 @@ ecma_builtin_array_prototype_object_sort_compare_helper (ecma_value_t j, /**< le
if (ecma_compare_ecma_strings_relational (j_str_p, k_str_p))
{
*result_p = ecma_int32_to_number (-1);
*result_p = ECMA_NUMBER_MINUS_ONE;
}
else if (!ecma_compare_ecma_strings (j_str_p, k_str_p))
{
*result_p = ecma_int32_to_number (1);
*result_p = ECMA_NUMBER_ONE;
}
else
{
*result_p = ecma_int32_to_number (0);
*result_p = ECMA_NUMBER_ZERO;
}
ECMA_FINALIZE (k_value);
@@ -1766,7 +1766,7 @@ ecma_builtin_array_prototype_object_index_of (ecma_value_t this_arg, /**< this a
if (len == 0)
{
ecma_number_t *num_p = ecma_alloc_number ();
*num_p = ecma_int32_to_number (-1);
*num_p = ECMA_NUMBER_MINUS_ONE;
ret_value = ecma_make_number_value (num_p);
}
else
@@ -1774,7 +1774,7 @@ ecma_builtin_array_prototype_object_index_of (ecma_value_t this_arg, /**< this a
/* 5. */
ECMA_OP_TO_NUMBER_TRY_CATCH (arg_from_idx, arg2, ret_value);
ecma_number_t found_index = ecma_int32_to_number (-1);
ecma_number_t found_index = ECMA_NUMBER_MINUS_ONE;
uint32_t from_idx = ecma_builtin_helper_array_index_normalize (arg_from_idx, len);
@@ -1863,7 +1863,7 @@ ecma_builtin_array_prototype_object_last_index_of (ecma_value_t this_arg, /**< t
uint32_t len = ecma_number_to_uint32 (len_number);
ecma_number_t *num_p = ecma_alloc_number ();
*num_p = ecma_int32_to_number (-1);
*num_p = ECMA_NUMBER_MINUS_ONE;
/* 4. */
if (len == 0)
@@ -523,7 +523,7 @@ ecma_builtin_helper_string_prototype_object_index_of (ecma_value_t this_arg, /**
ecma_string_t *search_str_p = ecma_get_string_from_value (search_str_val);
ecma_number_t *ret_num_p = ecma_alloc_number ();
*ret_num_p = ecma_int32_to_number (-1);
*ret_num_p = ECMA_NUMBER_MINUS_ONE;
/* 8 (indexOf) -- 9 (lastIndexOf) */
ecma_length_t index_of = 0;
@@ -1,4 +1,4 @@
/* Copyright 2014-2015 Samsung Electronics Co., Ltd.
/* Copyright 2014-2016 Samsung Electronics Co., Ltd.
* Copyright 2015-2016 University of Szeged.
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -572,16 +572,16 @@ ecma_builtin_math_object_round (ecma_value_t this_arg __attr_unused___, /**< 'th
*num_p = arg_num;
}
else if (ecma_number_is_negative (arg_num)
&& arg_num >= -0.5f)
&& arg_num >= -ECMA_NUMBER_HALF)
{
*num_p = ecma_number_negate (0.0f);
*num_p = ecma_number_negate (ECMA_NUMBER_ZERO);
}
else
{
const ecma_number_t up_half = arg_num + 0.5f;
const ecma_number_t down_half = arg_num - 0.5f;
const ecma_number_t up_rounded = up_half - ecma_op_number_remainder (up_half, 1);
const ecma_number_t down_rounded = down_half - ecma_op_number_remainder (down_half, 1);
const ecma_number_t up_half = arg_num + ECMA_NUMBER_HALF;
const ecma_number_t down_half = arg_num - ECMA_NUMBER_HALF;
const ecma_number_t up_rounded = up_half - ecma_op_number_remainder (up_half, ECMA_NUMBER_ONE);
const ecma_number_t down_rounded = down_half - ecma_op_number_remainder (down_half, ECMA_NUMBER_ONE);
if (up_rounded - arg_num <= arg_num - down_rounded)
{
@@ -1,4 +1,4 @@
/* Copyright 2014-2015 Samsung Electronics Co., Ltd.
/* Copyright 2014-2016 Samsung Electronics Co., Ltd.
* Copyright 2015-2016 University of Szeged.
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -367,15 +367,15 @@ ecma_builtin_string_prototype_object_locale_compare (ecma_value_t this_arg, /**<
if (ecma_compare_ecma_strings_relational (this_string_p, arg_string_p))
{
*result_p = ecma_int32_to_number (-1);
*result_p = ECMA_NUMBER_MINUS_ONE;
}
else if (!ecma_compare_ecma_strings (this_string_p, arg_string_p))
{
*result_p = ecma_int32_to_number (1);
*result_p = ECMA_NUMBER_ONE;
}
else
{
*result_p = ecma_int32_to_number (0);
*result_p = ECMA_NUMBER_ZERO;
}
ret_value = ecma_make_number_value (result_p);
@@ -1,4 +1,4 @@
/* Copyright 2014-2015 Samsung Electronics Co., Ltd.
/* Copyright 2014-2016 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -179,8 +179,6 @@ ecma_op_array_object_define_own_property (ecma_object_t *obj_p, /**< the array o
return ecma_op_general_object_define_own_property (obj_p, property_name_p, property_desc_p, is_throw);
}
ecma_number_t new_len_num;
// c.
ecma_value_t completion = ecma_op_to_number (property_desc_p->value);
if (ecma_is_value_error (completion))
@@ -191,7 +189,7 @@ ecma_op_array_object_define_own_property (ecma_object_t *obj_p, /**< the array o
JERRY_ASSERT (!ecma_is_value_error (completion)
&& ecma_is_value_number (completion));
new_len_num = *ecma_get_number_from_value (completion);
ecma_number_t new_len_num = *ecma_get_number_from_value (completion);
ecma_free_value (completion);
@@ -1,4 +1,4 @@
/* Copyright 2014 Samsung Electronics Co., Ltd.
/* Copyright 2014-2016 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -38,23 +38,21 @@ ecma_number_t
ecma_op_number_remainder (ecma_number_t left_num, /**< left operand */
ecma_number_t right_num) /**< right operand */
{
ecma_number_t n = left_num, d = right_num;
if (ecma_number_is_nan (n)
|| ecma_number_is_nan (d)
|| ecma_number_is_infinity (n)
|| ecma_number_is_zero (d))
if (ecma_number_is_nan (left_num)
|| ecma_number_is_nan (right_num)
|| ecma_number_is_infinity (left_num)
|| ecma_number_is_zero (right_num))
{
return ecma_number_make_nan ();
}
else if (ecma_number_is_infinity (d)
|| (ecma_number_is_zero (n)
&& !ecma_number_is_zero (d)))
else if (ecma_number_is_infinity (right_num)
|| (ecma_number_is_zero (left_num)
&& !ecma_number_is_zero (right_num)))
{
return n;
return left_num;
}
return ecma_number_calc_remainder (n, d);
return ecma_number_calc_remainder (left_num, right_num);
} /* ecma_op_number_remainder */
/**
+2 -2
View File
@@ -792,7 +792,7 @@ lexer_parse_number (parser_context_t *context_p) /**< context */
do
{
source_p ++;
source_p++;
}
while (source_p < source_end_p
&& lexer_is_hex_digit (source_p[0]));
@@ -809,7 +809,7 @@ lexer_parse_number (parser_context_t *context_p) /**< context */
do
{
source_p ++;
source_p++;
}
while (source_p < source_end_p
&& source_p[0] >= '0'
+1 -1
View File
@@ -1430,7 +1430,7 @@ parser_post_processing (parser_context_t *context_p) /**< context */
* instructions, since this form is constructed during post
* processing and cannot be emitted directly. */
*opcode_p = CBC_JUMP_FORWARD;
length --;
length--;
}
else
{
+2 -2
View File
@@ -1121,7 +1121,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
if (base & 0x2)
{
/* For decrement operators */
increase = -ECMA_NUMBER_ONE;
increase = ECMA_NUMBER_MINUS_ONE;
}
/* Post operators require the unmodifed number value. */
@@ -2290,7 +2290,7 @@ vm_execute (vm_frame_ctx_t *frame_ctx_p, /**< frame context */
else
{
ecma_value_t *src_p = (ecma_value_t *) arg_p;
arg_list_len --;
arg_list_len--;
if (arg_list_len > argument_end)
{