Improve BigInt support (#4118)

This patch adds several small features:
- Support right shift with negative numbers
- Support exponentation operator
- BigInts can be enabled in ES5.1 mode
- Remove dead code from ecma_deref_bigint
- Support longer BigInt literals in the parser
- Fix various BigInt comparison issues
- Do not discard unary plus for BigInt constants

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
This commit is contained in:
Zoltan Herczeg
2020-08-11 11:25:01 +02:00
committed by GitHub
parent 286e515f9f
commit f761427a3e
13 changed files with 409 additions and 138 deletions
+11 -1
View File
@@ -59,6 +59,11 @@ typedef uint64_t ecma_bigint_two_digits_t;
#define ECMA_BIGINT_HIGH_DIGIT(digit) \
(((ecma_bigint_two_digits_t) digit) << (8 * sizeof (ecma_bigint_digit_t)))
/**
* Tells whether a number (usually a digit or uint32_t value) is an odd number.
*/
#define ECMA_BIGINT_NUMBER_IS_ODD(number) ((number & 0x1) != 0)
/**
* Bitwise operation types.
*/
@@ -117,7 +122,12 @@ ecma_extended_primitive_t *ecma_big_uint_div_mod (ecma_extended_primitive_t *div
bool is_mod);
ecma_extended_primitive_t *ecma_big_uint_shift_left (ecma_extended_primitive_t *left_value_p, uint32_t right_value);
ecma_extended_primitive_t *ecma_big_uint_shift_right (ecma_extended_primitive_t *left_value_p, uint32_t right_value);
ecma_extended_primitive_t *ecma_big_uint_shift_right (ecma_extended_primitive_t *left_value_p, uint32_t right_value,
bool increase_result);
#if ENABLED (JERRY_ESNEXT)
ecma_extended_primitive_t *ecma_big_uint_pow (ecma_extended_primitive_t *left_value_p, uint32_t right_value);
#endif /* ENABLED (JERRY_ESNEXT) */
ecma_extended_primitive_t *ecma_big_uint_bitwise_op (uint32_t operation_and_options,
ecma_extended_primitive_t *left_value_p,