898 Commits

Author SHA1 Message Date
Rafal Walczyna
7345c83af7
Update TypedArray properties to conform with newest standard (#4194)
name and length properties has been updated.
Enabling BigInt support in TypedArray.prototype.sort when no
comparefn function is provided.

JerryScript-DCO-1.0-Signed-off-by: Rafal Walczyna r.walczyna@samsung.com
2020-09-14 17:32:26 +02:00
Daniella Barsony
c013fade26
Add TypedArray custom dispatcher (#4040)
JerryScript-DCO-1.0-Signed-off-by: Daniella Barsony bella@inf.u-szeged.hu
2020-09-08 10:05:15 +02:00
Szilagyi Adam
9bffc981cd
Refactor Array.prototype.splice to conform ES11 standard (#4172)
The algorithm is based on ECMA-262 v11, 22.1.3.28

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2020-09-08 10:04:13 +02:00
Rafal Walczyna
074945dafa
Add missing value release to TypedArray fill method (#4177)
Value was not freed when error occurs. It caused assertion to fail
when BigInt was used.

JerryScript-DCO-1.0-Signed-off-by: Rafal Walczyna r.walczyna@samsung.com
2020-09-01 15:28:12 +02:00
Szilagyi Adam
28c186c98f
Refactor ArrayBuffer.prototype.slice to conform ES11 standard (#4174)
The algorithm is based on ECMA-262 v11, 24.1.4.3

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2020-08-28 14:00:49 +02:00
Szilagyi Adam
9589771f7a
Refactor ecma_op_check_object_coercible (#4169)
The method returns bool now instead of an ecma_value_t

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2020-08-28 13:12:50 +02:00
kisbg
a470fef8a5
Add length check in copy_within's fast path (#4168)
fixes #4146

JerryScript-DCO-1.0-Signed-off-by: bence gabor kis kisbg@inf.u-szeged.hu
2020-08-28 10:55:26 +02:00
Szilagyi Adam
2aa5f136a4
Implement String.prototype.replaceAll (#4088)
The algorithm is based on ECMA-262 v12, 21.1.3.18

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2020-08-28 10:41:11 +02:00
kisbg
1ec216e573
Fixing test262 built-ins symbol test-cases (#4123)
The remaining test-cases needs realm feature

JerryScript-DCO-1.0-Signed-off-by: bence gabor kis kisbg@inf.u-szeged.hu
2020-08-27 13:39:04 +02:00
Virag Orkenyi
777b7e9c87
Cleanup toNumber and toNumeric abstract operations (#4034)
JerryScript-DCO-1.0-Signed-off-by: Virag Orkenyi orkvi@inf.u-szeged.hu
2020-08-27 13:32:30 +02:00
Szilagyi Adam
24753ddd70
Minor fix to ecma_builtin_object_object_define_property (#4124)
DefineOwnProperty result could be false, and we should throw an error in that case.

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2020-08-27 09:52:14 +02:00
Szilagyi Adam
138151832a
Minor fix to RegExp.prototype.compile (#4112)
Fixed tests from the exclude list:
<test id="annexB/built-ins/RegExp/prototype/compile/length.js"><reason></reason></test>
<test id="annexB/built-ins/RegExp/prototype/compile/pattern-regexp-flags-defined.js"><reason></reason></test>
<test id="annexB/built-ins/RegExp/prototype/compile/pattern-regexp-immutable-lastindex.js"><reason></reason></test>

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2020-08-26 15:16:55 +02:00
Tóth Béla
09c8d28b2c
Implement TrimStart TrimEnd and aliases (#4102)
Based on: https://tc39.es/ecma262/#sec-string.prototype.trim

JerryScript-DCO-1.0-Signed-off-by: Bela Toth tbela@inf.u-szeged.hu
2020-08-25 13:10:36 +02:00
Szilagyi Adam
85981457e6
Implement BigInt64 and BigUint64 typedArrays (#4151)
Also implemented ToBigInt conversion method based on ECMA-262 v11, 7.1.13

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2020-08-24 18:03:12 +02:00
Tóth Béla
1bcfb711a3
Fix BigInt.prototype.toString length (#4161)
JerryScript-DCO-1.0-Signed-off-by: Bela Toth tbela@inf.u-szeged.hu
2020-08-24 14:51:03 +02:00
Péter Gál
f2ff0d082f
Correctly release values in TypedArray's toLocaleString (#4156)
When the `toLocaleString` was called on a TypedArray's value
the resulting object's `toString/valueOf` invocations could
create errors. These error values were not released.

In addition the input element value for the toString operation
was released twice in case of an error.

Fixes: #4148.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.usz@partner.samsung.com
2020-08-24 14:50:18 +02:00
Csaba Osztrogonác
b828d1c15f
Fix heap-buffer-overflow in ecma_builtin_json_quote (#4143)
Fixes #4129.

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác csaba.osztrogonac@h-lab.eu
2020-08-18 13:56:01 +02:00
Péter Gál
9d586fea76
Handle errors in JSON.parse triggered by Proxies (#4134)
Fixes: #4130

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.usz@partner.samsung.com
2020-08-14 08:25:43 +02:00
Csaba Osztrogonác
ea07052869
Make Array.prototype.unshift method conform to ES11 (#4128)
Changes:
- Since ES6 Array.prototype.unshift shouldn't iterate
over the array elements if argument count is 0.
- Add proper guard for a check introduced in ES6.
- Update comments to reference to ES5.1 and ES11 specs too.

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác csaba.osztrogonac@h-lab.eu
2020-08-13 10:09:25 +02:00
kisbg
cd34bfa4c3
Implement Array.flat and Array.flatMap (#3925)
JerryScript-DCO-1.0-Signed-off-by: bence gabor kis kisbg@inf.u-szeged.hu
2020-08-12 16:51:04 +02:00
Csaba Osztrogonác
0bb4626ddb
Fix Array.prototype.slice, splice and map builtin methods (#4122)
CreateDataPropertyOrThrow is introduced in ES2015, and these methods should use it
to throw TypeError exception if the requested property update cannot be performed.

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác csaba.osztrogonac@h-lab.eu
2020-08-12 16:35:27 +02:00
Zoltan Herczeg
6adf0c1a87
Support BigInt to number conversion using Number constructor (#4121)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-08-12 16:33:31 +02:00
Zoltan Herczeg
f761427a3e
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
2020-08-11 11:25:01 +02:00
kisbg
43a82cddb9
Implement Object.prototype.fromEntries (#4065)
JerryScript-DCO-1.0-Signed-off-by: bence gabor kis kisbg@inf.u-szeged.hu
2020-08-07 15:08:12 +02:00
kisbg
cebb6aee5c
Fix Symbol's description default value (#4077)
In the standard if we create a Symbol object without adding a description value
default value is undefined not empty string.

JerryScript-DCO-1.0-Signed-off-by: bence gabor kis kisbg@inf.u-szeged.hu
2020-08-07 15:00:44 +02:00
kisbg
58a649ffe8
Fixed Array.prototype.concat error type (#4117)
JerryScript-DCO-1.0-Signed-off-by: bence gabor kis kisbg@inf.u-szeged.hu
2020-08-07 14:34:57 +02:00
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