192 Commits

Author SHA1 Message Date
Zoltan Herczeg
7a2665621b
Reorganize property descriptor flags (#4622)
Furthermore rename JERRY_PROP_IS_THROW to JERRY_PROP_SHOULD_THROW
and add more invalid descriptor checks.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-03-10 08:17:20 +01:00
kisbg
129ca4946c
Implement WeakRef Object (#4546)
Related test262 test-cases has been removed from skip list.
Execpt two test-case since they need other feature to work (Finalization registry and async GC)

JerryScript-DCO-1.0-Signed-off-by: Bence Gabor Kis kisbg@inf.u-szeged.hu
2021-03-01 13:46:54 +01:00
Robert Fancsik
f0f2a28109
Improve ecma_reject to give more detailed error messages (#4565)
Note: TypedArray.[[DefineOwnProperty]] has been slightly reworked (without semantical changes) for better error messages.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2021-02-24 09:36:55 +01:00
Yonggang Luo
75b0378bc5
Move static before inline. (#4582)
Make this consistence with other static inline definition.

JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo luoyonggang@gmail.com
2021-02-09 09:43:43 +01:00
kisbg
76a0b18287
Add cross-realm support to RegExp.prototype (#4567)
JerryScript-DCO-1.0-Signed-off-by: bence gabor kis kisbg@inf.u-szeged.hu
2021-02-08 16:35:40 +01:00
Robert Fancsik
0628ae1e7b
Remove the ENABLED/DISABLED macros (#4515)
The removal of these macros enabled cppcheck to reveal new errors.
These errors are also fixed by the patch.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2021-02-04 23:47:05 +01:00
Robert Fancsik
f369c84c24
Ensure that [[Set]] operation does not reject for TypedArray objects (#4558)
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2021-02-04 13:00:24 +01:00
Robert Fancsik
1712ad5dc4
Ensure that fast array objects are always extensible (#4557)
This patch helps to eliminate some extra checks from Array.prototype methods

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2021-02-03 16:17:50 +01:00
Zoltan Herczeg
e191a5cf47
Increase the maximum reference count of objects when cpointer 32 is enabled (#4550)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-01-29 14:45:27 +01:00
Zoltan Herczeg
ba06d492a3
Remove full stop after error messages (#4524)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-01-28 12:10:13 +01:00
Zoltan Herczeg
b5bf97c657
Stop after the first matching property in the prototype chain (#4543)
If multiple properties with the same name is in the
prototype chain, only the first one should be inspected

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-01-26 14:57:10 +01:00
Szilagyi Adam
6ec4455111
Implement Symbol.matchAll (#4082)
The following methods were implemented:
- String.prototype.matchAll based on ECMA-262 v11, 21.1.3.12
- RegExp.prototype[@@matchAll] based on ECMA-262 v11, 21.2.5.8
- RegExp String Iterator Object based on 21.2.7

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2021-01-18 18:08:35 +01:00
Yonggang Luo
fe3b0a8435
Fixes ENABLE_AMALGAM need FORCE set to ON when building with MSVC (#4392)
JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo luoyonggang@gmail.com
2021-01-16 16:44:55 +01:00
Péter Gál
5e483633f3
Fix prototype chain traversing (#4458)
After the introduction of the Proxy builtin object there was
a possibility to traverse the prototype chain with an invalid object.
The prototype was freed before it's data/properties were queried resulting
in accessing invalid information.

By forcing the allocator to always do a gc (`--mem-stres-test=on` build option)
it was possible to trigger the issue without complicated tests.

New internal method:
* `ecma_op_object_get_prototype_of` which always returns the prototype
  of an object and the return value must be freed (if it is valid).

Updated prototype chain traversing in:
* `jerry_object_get_property_names`
* `ecma_builtin_object_prototype_lookup_getter_setter`
* `ecma_op_function_has_instance`
* `ecma_op_function_get_super_constructor`
* `ecma_op_object_is_prototype_of`
* `ecma_op_object_enumerate`

Removed method `ecma_proxy_object_prototype_to_cp`

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.usz@partner.samsung.com
2021-01-15 20:54:09 +01:00
Robert Fancsik
b46535cb8d
Add strict flag check for ecma_op_object_put_apply_receiver (#4450)
This patch fixes #4441.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2021-01-15 14:11:47 +01:00
Zoltan Herczeg
3dc6ed0dd5
Fix internal property listing in ecma_op_object_own_property_keys (#4461)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-01-13 15:13:43 +01:00
Zoltan Herczeg
6f0391dd66
Unify internal property creation (#4373)
Furthermore free up a bit in the property descriptor.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-01-12 13:12:44 +01:00
Robert Fancsik
cab266f21d
Fix inherited property type check in ordinary object.[[Set]] (#4425)
This patch fixes #4405.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2021-01-06 11:25:14 +01:00
kisbg
2ac3c08c14
Add proxy check in ecma_op_object_put_with_receiver (#4411)
JerryScript-DCO-1.0-Signed-off-by: bence gabor kis kisbg@inf.u-szeged.hu
2021-01-06 08:44:48 +01:00
Zoltan Herczeg
cc1e8d2dee
Continue working on realms (#4356)
- Rework symbols to have the same value across realms
- Support realms for native functions
- Support test262
- Use new.target realms for constructing intrinsics

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-12-09 17:44:21 +01:00
Zoltan Herczeg
df92c86ecf
Implement realm object and support realms for built-ins and JS functions (#4354)
- Type for realm objects is introduced (ecma_global_object_t)
- Realm reference is added to built-in objects and ECMAScript functions
- Resolving built-ins, global environments, and scopes require realm object
- Unnecessary global object accesses are removed from the code

Missing: external functions and static snapshot functions have no realm reference

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-12-08 14:36:36 +01:00
Péter Gál
89ff0fcf1f
Handle revoked Proxy during [[Get]] operation (#4349)
The handling of Proxy.[[Get]] was not fully correctly in the case when the
Proxy was revoked during the execution of the handler.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.usz@partner.samsung.com
2020-12-04 10:49:40 +01:00
Zoltan Herczeg
de37e1e049
Template literal arrays should not be marked. (#4352)
Make array object big endian compatible.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-12-04 10:41:14 +01:00
Zoltan Herczeg
c0fc67f5bd
Rework built-in processing of JerryScript (#4347)
- All built-ins are native functions now
- Native handlers have a built-in id: ECMA_BUILTIN_ID_HANDLER
- Built-in routine identifiers start from 1
- Built-in routines have an own flag set
- Name property of routines is resolved dynamically
- Style fixes

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-12-01 11:37:08 +01:00
Ádám Kallai
d0e385f9eb
Fix the ESNext build with disabled JERRY_BUILTIN_PROXY (#4320)
With a disabled JERRY_BUILTIN_PROXY option the build fails becouse
of missing guards.

The run-test buildoption_test is also extended with this.

JerryScript-DCO-1.0-Signed-off-by: Adam Kallai kadam@inf.u-szeged.hu
2020-11-02 09:30:43 +01:00
Robert Fancsik
d8955552d7
Revise internal array creation operations (#4291)
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-10-16 15:24:50 +02:00
Péter Gál
4df833e7ad
Propagate strict mode for Proxy targets during delete (#4273)
After ES5.1 if the delete returns false a TypeError should be thrown
in strict mode.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.usz@partner.samsung.com
2020-10-08 10:00:47 +02:00
kisbg
99c7099eaa
Update object.prototype.toString to conform ES11 standard (#4196)
JerryScript-DCO-1.0-Signed-off-by: bence gabor kis kisbg@inf.u-szeged.hu
2020-10-07 15:05:17 +02:00
kisbg
17fe441819
Add AsyncFunc proto id check in ecma_object_check_class_name_is_object (#4274)
fixes #4147

JerryScript-DCO-1.0-Signed-off-by: bence gabor kis kisbg@inf.u-szeged.hu
2020-10-07 08:48:11 +02:00
Robert Fancsik
53a085cd28
Builtin objects symbol properties should be lazy listed (#4271)
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-10-06 14:52:25 +02:00
Robert Fancsik
75385a6045
Improve arguments object (#4145)
- Enhancement: Arguments object properties are now lazy instantiated
 - Bugfix: Mapped arguments object instantiated properties cannot be lcached
 - Bugfix: Mapped arguments should be constructed even if 0 formal parameters or arguments are provided
 - Update: remove 'caller' property of unmapped arguments object

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-09-28 15:57:58 +02:00
Virag Orkenyi
be180ba159
Delete ECMA_OP_TO_NUMBER_TRY_CATCH macro (#4229)
JerryScript-DCO-1.0-Signed-off-by: Virag Orkenyi orkvi@inf.u-szeged.hu
2020-09-24 10:50:12 +02:00
Dániel Bátyai
74f66879c2
Improve support for built-in native handlers (#4184)
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai daniel.batyai@h-lab.eu
2020-09-17 18:35:11 +02:00
Péter Gál
da2299d277
Convert fast array to normal array when the prototype is changed (#4198)
If the prototype of a fast array is changed, for example to a Proxy object,
the array should be converted back to a normal array. This is required to
correctly handle any [[Get]]/[[Set]]/etc... calls which should trigger
these method calls on the before mentioned Proxy object.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.usz@partner.samsung.com
2020-09-17 15:23:37 +02:00
Péter Gál
6f29e48fc6
Correctly handle strict mode in case of Proxy.[[Set]] (#4180)
JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.usz@partner.samsung.com
2020-09-08 10:03:27 +02:00
Péter Gál
f03bf9074f
Correctly set the define property flags during [[Set] in case of Proxy (#4178)
JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.usz@partner.samsung.com
2020-09-02 17:34:15 +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
Csaba Osztrogonác
409ead7415
Fix memory leak in ecma_op_object_get_enumerable_property_names (#4136)
JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác csaba.osztrogonac@h-lab.eu
2020-08-13 13:46:50 +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
Szilagyi Adam
a4312d614f
Fix prototype chain traversal in ecma_op_object_put_with_receiver (#4066)
The ECMA_OBJECT_IS_PROXY(proto_p) check is necessary throughout the prototype chain
not just at the beginning

Fixes #4045

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2020-07-30 14:35:18 +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
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
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
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
Szilagyi Adam
9dbbcab49d
Remove ecma_op_object_get_own_data_prop and use ecma_op_object_get_by_magic_id instead (#3969)
JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2020-07-13 12:12:46 +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
Zoltan Herczeg
9e18ff29c6
Implement ... support for object initializers. (#3968)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-07-02 15:04:21 +02:00
Csaba Osztrogonác
122480aa61
JERRY_BUILTIN_xxx macros should depend on JERRY_ESNEXT (#3920)
JERRY_BUILTIN_xxx (ES2015+) features don't build without enabling
JERRY_ESNEXT macro, this invalid configuration shouldn't be allowed.
Additionally remove unnecessary JERRY_ESNEXT ifdef guards.

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác oszi@inf.u-szeged.hu
2020-06-30 13:54:50 +02:00
Roland Takacs
034b3b63f5
Correct Object.keys to collect only enumerable property names (#3952)
In case of Proxy objects, there were no property descriptor checks when
collecting enumerable properties. Therefore, all the non-enumerable
Proxy.target properties were listed as well.

JerryScript-DCO-1.0-Signed-off-by: Roland Takacs rtakacs@inf.u-szeged.hu
2020-06-30 13:13:18 +02:00