872 Commits

Author SHA1 Message Date
Zoltan Herczeg
f4f9cde3e7
Fix evaluation order for binary operators (#4114)
Furthermore fix toBoolean for BigInts as well.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-08-07 14:32:46 +02:00
Zoltan Herczeg
cb14682983
Create API for handling BigInts (#4111)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-08-07 13:43:29 +02:00
Daniella Barsony
082085a8fd
Add Number builtin custom dispatcher (#4113)
JerryScript-DCO-1.0-Signed-off-by: Daniella Barsony bella@inf.u-szeged.hu
2020-08-06 16:45:18 +02:00
Dániel Bátyai
3d44b26aeb
Update RegExp.prototype accessors for ES11 (#4103)
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai daniel.batyai@h-lab.eu
2020-08-06 14:24:48 +02:00
Szilagyi Adam
b82bd76175
Minor fixes to ecma_builtin_object_prototype_define_getter_setter (#4104)
Fixed tests from the exclude list:
annexB/built-ins/Object/prototype/__defineGetter__/define-non-configurable.js
annexB/built-ins/Object/prototype/__defineGetter__/define-non-extensible.js
annexB/built-ins/Object/prototype/__defineGetter__/getter-non-callable.js
annexB/built-ins/Object/prototype/__defineGetter__/this-non-obj.js
annexB/built-ins/Object/prototype/__defineSetter__/define-non-configurable.js
annexB/built-ins/Object/prototype/__defineSetter__/define-non-extensible.js
annexB/built-ins/Object/prototype/__defineSetter__/setter-non-callable.js
annexB/built-ins/Object/prototype/__defineSetter__/this-non-obj.js

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2020-08-05 12:06:28 +02:00
Péter Gál
b749c4c267
Allow error reporting during property creation in Array.prototype.filter (#4091)
In case of ES.next the Array.prototype.filter should raise an error
if the property on the target array's data property creation fails.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.usz@partner.samsung.com
2020-08-04 16:52:08 +02:00
Szilagyi Adam
945b22976a
Implement Object.prototype.{__lookupGetter__, __lookupSetter__} (#4039)
__lookupGetter__ is based on ECMA-262 v11, B.2.2.4
__lookupSetter__ is based on ECMA-262 v11, B.2.2.5

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2020-08-04 16:41:05 +02:00
Rafal Walczyna
4ce4b617fd
Add Symbol support to integrity testing routine (#4101)
Properties with Symbol caused assertion to fail

JerryScript-DCO-1.0-Signed-off-by: Rafal Walczyna r.walczyna@samsung.com
2020-08-03 17:29:34 +02:00
Zoltan Herczeg
cfd69d3b70
Implement relational operators for BigInts (#4087)
Improve BigInt constructor as well

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-08-03 13:46:34 +02:00
Szilagyi Adam
b4a4619a6c
Implement Object.prototype.{__defineGetter__, __defineSetter__} (#4032)
__defineGetter__ is based on ECMA-262 v11, B.2.2.2
__defineSetter__ is based on ECMA-262 v11, B.2.2.3

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2020-07-30 16:34:43 +02:00
Péter Gál
b27f40303b
Fix TypeError name property value (#4086)
The TypeError.name incorrectly returned the "SyntaxError" value.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.usz@partner.samsung.com
2020-07-30 16:24:26 +02:00
Zoltan Herczeg
df2f7782f7
Implement BigInt primitve type and some of its operations (#4062)
Supported operations:
- parse BigInt (decimal, hexadecimal, binary)
- toString with any radix between 2 and 36
- arithmetic operations: negate, add, subtract, multiply, divide, modulo
- left and right shift

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-07-30 12:08:34 +02:00
Robert Fancsik
3eb69075f7
Update ToLength operation to conform ES6 spec (#4007)
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-07-29 11:13:34 +02:00
Péter Gál
56e328be41
Fix conversion and signedness warnings (#4079)
In case of ARM Nuttx build with IoT.js there are small conversion
and signedness warnings resulting in a build failure.

```
ecma-builtin-regexp-prototype.c: error: conversion from 'int' to '_Bool8' {aka 'unsigned char'}
  may change value [-Werror=conversion]
  116 |   return ecma_make_boolean_value (flags & re_flags[offset]);
      |                                   ~~~~~~^~~~~~~~~~~~~~~~~~

js-scanner-util.c: In function 'scanner_pop_literal_pool':
js-scanner-util.c:628:43: error: comparison of integer expressions of different signedness:
  'intptr_t' {aka 'int'} and 'unsigned int' [-Werror=sign-compare]
  628 |       else if (diff >= -UINT8_MAX && diff <= UINT16_MAX)
      |                                           ^~
js-scanner-util.c:891:43: error: comparison of integer expressions of different signedness:
  'intptr_t' {aka 'int'} and 'unsigned int' [-Werror=sign-compare]
  891 |       else if (diff >= -UINT8_MAX && diff <= UINT16_MAX)
```

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.usz@partner.samsung.com
2020-07-29 00:05:35 +02:00
Robert Fancsik
2832bdc94d
Fix surrogate pair lookahead in String.prototype.toUpper (#4073)
This patch fixes #4013.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-07-28 15:53:17 +02:00
Dániel Bátyai
20f83d963b
Fix a use-after-free in RegExp.prototype.compile (#4068)
Fixes #4056.

JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai daniel.batyai@h-lab.eu
2020-07-28 10:47:37 +02:00
Robert Fancsik
7e0b478fe9
Update Array.prototype.concat error handling to ES11 (#4071)
This patch fixes #4044.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-07-28 10:45:51 +02:00
Robert Fancsik
d420811a0e
BoundFunctions [[Length]] property should be ecma_number_t (#4072)
This patch fixes #4043.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-07-28 10:45:01 +02:00
Péter Gál
435c9cadcf
Correctly free descriptors in Object.assign (#4069)
The property descriptors must be free'd during the iteration in the
Object.assign even if the property is not enumerable (or there is no value/getter).

Fixes: #4048

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.usz@partner.samsung.com
2020-07-27 19:47:55 +02:00
Robert Fancsik
9a026f54ac
Fix error handling in SetIntegrityLevel (#4064)
This patch fixes #4052.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-07-27 19:38:58 +02:00
Szilagyi Adam
ff36f3579d
Implement %TypedArray%.prototype.includes (#4025)
The algorithm is based on ECMA-262 v11, 22.2.3.13

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2020-07-27 18:09:39 +02:00
Szilagyi Adam
ff47c84bc4
Rework Object's [[OwnPropertyKeys]] (#4001)
I've removed the ecma_op_object_get_property_names method, and implemented the following ones:
- ecma_op_object_own_property_keys: this is now the internal [[OwnPropertyKeys]] method
- ecma_op_object_enumerate: this is used for the for-in iterator
- ecma_object_sort_property_names: this is used for sorting the property names of an object
- ecma_object_list_lazy_property_names: this is for getting the lazy instantiated properties
- ecma_object_prop_name_is_duplicated: this is for checking if a given property is duplicated in an object

Also the for-in operation with Proxy object works with this patch, #3992 should be closed

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2020-07-27 11:37:04 +02:00
Szilagyi Adam
da5b058dec
Fix argument boundary check order during number format conversion (#4031)
Also added some tests related to the issues caused by the wrong order

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2020-07-24 15:55:12 +02:00
kisbg
d39a076b2e
Added RegExp dotAll flag (#4000)
JerryScript-DCO-1.0-Signed-off-by: bence gabor kis kisbg@inf.u-szeged.hu
2020-07-24 13:42:57 +02:00
Dániel Bátyai
cf097ca16b
Fix values of properties that reference intrinsic function objects (#4024)
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai daniel.batyai@h-lab.eu
2020-07-24 12:54:54 +02:00
Szilagyi Adam
54bfd2ba37
Implement Promise.prototype.onFinally (#3987)
The algorith is based on ECMA-262 v11, 25.6.5.3

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2020-07-24 12:54:16 +02:00
Tóth Béla
2f2a4e066c
Implement String.padStart and String.padEnd (#3999)
Based on: https://tc39.es/ecma262/#sec-string.prototype.padstart

JerryScript-DCO-1.0-Signed-off-by: Bela Toth tbela@inf.u-szeged.hu
2020-07-24 11:24:18 +02:00
Rafal Walczyna
a4952da831
Change heap sort to merge sort for Array.prototype (#4026)
ES11 requires Array.prototype.sort to be stable

JerryScript-DCO-1.0-Signed-off-by: Rafal Walczyna r.walczyna@samsung.com
2020-07-22 13:33:07 +02:00
Szilagyi Adam
04f0a7a670
Add missing error check to ecma_builtin_regexp_prototype_compile (#4022)
Fixes #4017

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2020-07-21 16:06:35 +02:00
Daniella Barsony
12ee41602e
Add custom Regexp.prototype dispatcher (#3979)
JerryScript-DCO-1.0-Signed-off-by: Daniella Barsony bella@inf.u-szeged.hu
2020-07-21 12:46:59 +02:00
Szilagyi Adam
2fac7cc85e
Refactor Number.prototype methods toFixed, toExponential, toPrecision (#3911)
JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2020-07-21 12:46:03 +02:00
Robert Fancsik
39cb67397d
Remove the usage of ecma_length_t (#4009)
Now the following conventions are applied:
 - passing the number of arguments for a function call is always uint32_t
 - string size/length/position related operation should use lit_utf8_size_t
 - Extended objects internal fields must be uint32_t

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-07-20 16:36:27 +02:00
Szilagyi Adam
33359ac506
Implement UnicodeEscape abstract method (#3959)
Also refactored ecma_builtin_json_quote to use the method above

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2020-07-20 13:51:06 +02:00
Szilagyi Adam
e8c5c46894
Implement Symbol.prototype.description (#3995)
The algorithm is based on ECMA-262 v11, 19.4.3.2

Also added a custom dispatcher for the Symbol prototype

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2020-07-20 13:47:25 +02:00
Dániel Bátyai
74781c28c2
Fix sticky flag handling in @@replace (#4005)
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai daniel.batyai@h-lab.eu
2020-07-20 12:54:06 +02:00
Szilagyi Adam
604cfaced4
Implement Array.prototype.includes (#3991)
The algorithm is based on ECMA-262 v11, 22.1.3.13

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2020-07-15 19:21:24 +02:00
Péter Gál
c8d15ddbf7
Date.protoype.toJSON should look for toISOString once (#3996)
The toJSON method should be searched on the `this` object
only once. In case of normal objects there were no problems
however when a Proxy object is used as the `this` argument
for the Date.prototype.toJSON method the Proxy's `get` method
was invoked twice.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.usz@partner.samsung.com
2020-07-15 17:12:55 +02:00
Roland Takacs
8fdbc6a85b
Implement Object.{entries, values} built-in methods (#3993)
Object.keys also updated to follow the ES11 standard.

JerryScript-DCO-1.0-Signed-off-by: Roland Takacs rtakacs@inf.u-szeged.hu
2020-07-14 15:59:40 +02:00
Robert Fancsik
37906baa25
Rework promise internal structures (#3985)
- Capabilities
- Promise all resolver

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-07-10 16:08:34 +02:00
Szilagyi Adam
dfabfe7a56
Add missing isArray checks based on the ES11 standard (#3983)
Added checks to the following methods:
- ecma_builtin_json_stringify, ECMA-262 v11, 24.5.2
- ecma_builtin_json_internalize_property, ECMA-262 v11, 24.5.1.1

Fixes #3945
Fixes #3950

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2020-07-10 16:06:27 +02:00
Roland Takacs
35e1e98008
Fix Object.assign to call [[GetOwnProperty]] Proxy handler only once (#3988)
Removed the enumerable option when listing properties to prevent an extra
[[GetOwnProperty]] function call for Proxy objects.
In this case all the property names are collected, but the Object.assign()
implementation has already taken care of the enumerable property filtering.

JerryScript-DCO-1.0-Signed-off-by: Roland Takacs rtakacs@inf.u-szeged.hu
2020-07-09 10:23:43 +02:00
Péter Gál
ae5cfae3e7
Implement ToPropertyKey operation (#3966)
From ES 6 the ToPropertyKey operation is used to convert elements to a valid property key.
This "new" method uses the ToPrimitive operation which can call the `@@ToPrimitive`
well-known symbol to convert the given element to a key.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.usz@partner.samsung.com
2020-07-06 15:17:18 +02:00
Csaba Osztrogonác
ed9e3eccf9
Make Date constructor conform to the latest spec (#3972)
Date constructor called with 1 argument should accept Date objects too.

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác oszi@inf.u-szeged.hu
2020-07-06 14:47:10 +02:00
Robert Fancsik
c1e90da0b4
Support Unicode supplementary planes (#3928)
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-07-06 14:21:13 +02:00
László Langó
7353b253ab
Fixed memory leak in %TypedArray%.prototype object's 'sort' routine. (#3981)
The buffer of values were not freed properly when an exception was
thrown in the compare function.

Fixes #3975

JerryScript-DCO-1.0-Signed-off-by: László Langó lango@inf.u-szeged.hu
2020-07-06 13:42:27 +02:00
Szilagyi Adam
97fc48132a
Use the Invoke method where the ES10 standard says (#3963)
We can apply this change to methods which use older standards, because
of the backward compatibility the result is the same

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2020-07-06 09:05:04 +02:00
Csaba Osztrogonác
5f951bb4f1
Fix TimeWithinDay(t) abstract operation (#3974)
Fixes #3973.

TimeWithinDay(t) = t modulo msPerDay, where msPerDay = 86400000.
The sign of the modulo operation result should be same as the right side
per definition, conseqently TimeWithinDay(t) >= 0.

References:
- https://www.ecma-international.org/ecma-262/11.0/#sec-mathematical-operations
- https://www.ecma-international.org/ecma-262/11.0/#sec-overview-of-date-objects-and-definitions-of-abstract-operations

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác oszi@inf.u-szeged.hu
2020-07-06 08:12:07 +02:00
Szilagyi Adam
392ee71712
Remove ECMA_TRY_CATCH macro (#3829)
also refactored the touched methods a little bit

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2020-07-03 15:06:49 +02:00
Zoltan Herczeg
80716cca90
Implement missing async function and async iterator prototypes. (#3962)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-07-03 11:04:27 +02:00
Szilagyi Adam
cd1e067671
Update Promise.race and Promise.all to ES11 (#3954)
Changes based on ECMA-262 v11, 25.6.4.4 and 26.6.4.1 step 3

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2020-07-02 11:46:07 +02:00