586 Commits

Author SHA1 Message Date
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
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
Leesoo Ahn
290e845759
Do not check call_arguments twice through parsing call expression (#4346)
Checking call_arguments twice happens in a special case that
only if call_arguments <= 1 and opcode variable has CBC_EXT_SUPER_CALL.

JerryScript-DCO-1.0-Signed-off-by: Leesoo Ahn lsahn@ooseel.net
2020-12-01 11:29:25 +01:00
Péter Gál
5bd88e2723
Correct Regexp literal error release (#4351)
The error object for an incorrect Regexp literal was derefed then the error message
was accessed. This could lead to a state where the message was not available but
it was still accessed.

This could occur in case of heavy memory load or with mem stress mode.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.usz@partner.samsung.com
2020-12-01 11:28:04 +01:00
Peter Marki
8eda7cb7d8
Remove LITERAL_POOL_IN_EXPORT flag at class statement end (#4348)
Fixes #4265

JerryScript-DCO-1.0-Signed-off-by: Peter Marki marpeter@inf.u-szeged.hu
2020-11-30 10:50:13 +01:00
Zoltan Herczeg
cbc3a5d291
Fix function calls which name is async and has an extra comma (#4340)
Fixes #4132

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-11-19 11:27:29 +01:00
Péter Gál
65db83561f
Implement rest parameter support for destructuring object patterns in for (#4338)
In case of `for (const {...rest} ...) ` there was an incorrectly handling
of the destructuring pattern.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.usz@partner.samsung.com
2020-11-17 10:35:27 +01:00
Zoltan Herczeg
1237bef0f0
Variables created by eval in strict mode should ignore the properties of their parent function. (#4339)
Fixes #4018

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-11-16 15:04:22 +01:00
Zoltan Herczeg
640a7d33b3
Support byte code dump when snapshot is executed. (#4327)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-11-16 12:17:41 +01:00
Peter Marki
25bb5083be
Fix await parsing in modules (#4266)
Fixes #4189

JerryScript-DCO-1.0-Signed-off-by: Peter Marki marpeter@inf.u-szeged.hu
2020-11-10 09:53:00 +01:00
kisbg
11f7463986
Support decimal create with leading zero (#4286)
JerryScript-DCO-1.0-Signed-off-by: bence gabor kis kisbg@inf.u-szeged.hu
2020-10-30 14:32:32 +01:00
Zoltan Herczeg
c7986fd2c5
Implement rest parameter support for destructuring object patterns. (#4318)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-10-29 10:49:08 +01:00
Csaba Osztrogonác
01c0ca3b6c
Fix sign-compare compiler warning in js-scanner-util.c (#4293)
Found by mingw32-gcc (MinGW.org GCC Build-2) 9.2.0.

comparison of integer expressions of different signedness:
'intptr_t' {aka 'int'} and 'unsigned int' [-Werror=sign-compare]

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác csaba.osztrogonac@h-lab.eu
2020-10-19 14:29:13 +02:00
Zoltan Herczeg
f384642409
Implement proper function length support (#4290)
Comma after last destructuring argument has been fixed as well

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-10-19 10:55:26 +02:00
Dániel Bátyai
080abb94ca
Check for prototype bound name in class static accessors (#4257)
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai daniel.batyai@h-lab.eu
2020-10-16 17:02:17 +02:00
Zoltan Herczeg
841d536fce
Implement proper arguments support (#4289)
- Store arguments in a register when possible
- Create separate arguments object for function argument initializer when necessary

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-10-16 11:02:36 +02:00
Dániel Bátyai
650269feca
Exporting undeclared variables should throw a SyntaxError (#4276)
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai daniel.batyai@h-lab.eu
2020-10-15 14:48:25 +02:00
kisbg
da1a4bbd44
Implement numeric-separator (#4158)
JerryScript-DCO-1.0-Signed-off-by: bence gabor kis kisbg@inf.u-szeged.hu
2020-10-12 11:33:03 +02:00
Dániel Bátyai
17c8ec57bb
Propagate strict mode flag from scanner when parsing functions (#4262)
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai daniel.batyai@h-lab.eu
2020-10-06 10:25:13 +02:00
Péter Gál
261a55c6b5
Fix class handling with disabled module system (#4247)
If the module system is disabled however the es.next is enabled the following
code triggers an assert:

```js
class Demo {}
```

This was due to an incorrect scanner data processing where it was always
assumed that there is a module related information.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.usz@partner.samsung.com
2020-10-01 16:36:48 +02:00
Zoltan Herczeg
4b2dbd5c21
Correctly set flags of identifiers related to classes (#4233)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-09-30 12:45:53 +02:00
Dániel Bátyai
f58f15077f
Bound names of for-in/of statements cannot contain let (#4225)
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai daniel.batyai@h-lab.eu
2020-09-25 16:33:11 +02:00
Zoltan Herczeg
bc64957d19
Properly implement static class fields. (#4221)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-09-25 14:23:02 +02:00
Dániel Bátyai
629a0e51c4
Legacy octal escapes should not be allowed in template strings (#4227)
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai daniel.batyai@h-lab.eu
2020-09-25 10:14:28 +02:00
Dániel Bátyai
43e03a1ac6
Fix continue label lookup in for statements that have a private scope (#4224)
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai daniel.batyai@h-lab.eu
2020-09-25 10:06:19 +02:00
Zoltan Herczeg
4d135bec5d
Rework frame context (#4200)
A new shared frame context data is created which allows sharing
data between the function call and vm main loop. Furthermore
rest arguments and current function object handling is reworked.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-09-21 10:25:17 +02:00
Zoltan Herczeg
d9653823ca
Initial implementation of class fields (#4191)
Missing features:
 - this binding in static fields are not supported
 - static field evaluation order is wrong
 - function names are not supported

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-09-17 15:22:55 +02:00
Zoltan Herczeg
2bc3111e31
Improve error detection of nullish coalescing operator (#4179)
Also rename LEXER_IS_BINARY_LVALUE_TOKEN to LEXER_IS_BINARY_LVALUE_OP_TOKEN
because its name is wrong.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-09-07 14:43:41 +02:00
Robert Fancsik
2f08d8ac08
Fix evaluation order in non-binding destructuring patterns (#4173)
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-08-28 15:13:02 +02:00
Robert Fancsik
6d0e948bef
Introduce new API functions to obtain detailed object type information (#4162)
- jerry_object_get_type
- jerry_function_get_type
- jerry_iterator_get_type
- jerry_value_is_async_function

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-08-28 12:53:56 +02:00
Zoltan Herczeg
84bc1e03fb
Detect assignment pattern for for-in/of (#4140)
Furthermore do not allow default value for rest parameter

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-08-24 14:47:10 +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
Zoltan Herczeg
39fe04814e
Implement unary operators: bitwise not, pre/post increment/decrement (#4116)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-08-10 22:38:34 +02:00
Zoltan Herczeg
531f724926
Change BigInt zero representation to a constant (#4109)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-08-06 12:17:39 +02:00
Csaba Osztrogonác
c76736eadf
Methods shouldn't have prototype property (#3964)
JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác csaba.osztrogonac@h-lab.eu
2020-08-05 14:01:58 +02:00
Szilagyi Adam
019dd03fcc
Implement JSON superset (#4099)
JSON strings can contain unescaped LINE SEPARATOR and PARAGRAPH SEPARATOR in ES11

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2020-08-04 16:56:08 +02:00
Zoltan Herczeg
b5a96c9eca
Implement BigInt literal parsing in the parser. (#4089)
Support octal literals for BigInts.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-08-04 14:16:38 +02:00
Dániel Bátyai
26a299adf0
Fix block-scoped var/function redeclarations (#4080)
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai daniel.batyai@h-lab.eu
2020-07-31 17:43:15 +02:00
Péter Gál
26c1ffaf71
Fix build with disabled ES2015 module system (#4084)
With a disabled ES2015 module system the build fails as an enum value
is incorrectly guarded and used.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.usz@partner.samsung.com
2020-07-31 15:51:43 +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
Zoltan Herczeg
dff2a2a6da
Rework ascii string to use less memory. (#4030)
Furthermore rename utf8_string to short_string.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2020-07-28 15:47:07 +02:00
Robert Fancsik
dbea5e6a22
Indentifier should be expected after static in class body. (#4061)
This patch fixes #4055.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-07-28 10:58:09 +02:00
Robert Fancsik
2e2b0dafb0
Fix scope stack lookup for literal indices (#4067)
This patch fixes #4051.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-07-28 10:55:13 +02:00
Robert Fancsik
4d5757d1b1
Fix argument list end validation after destructuring argument (#4070)
This patch fixes #4050.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-07-28 10:53:08 +02:00
Robert Fancsik
9872c441e3
Fix invalid destructuring function arguments parsing (#4074)
This patch fixes #4016 and fixes #4019.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-07-28 10:41:45 +02:00
Robert Fancsik
daa409a09a
Remove invalid assertion from parser_flush_cbc (#4063)
This patch fixes #4054.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-07-27 19:38:19 +02:00
Robert Fancsik
11c2ae30d1
Invalid regexp patterns should not throw syntax error during parsing (#4038)
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-07-27 09:28:26 +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
Robert Fancsik
f596211553
Fix tagged template literal call precedence for new operator (#3998)
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2020-07-24 11:22:09 +02:00
kisbg
dfd9d4497a
Implement nullish coalescing operator (#3997)
JerryScript-DCO-1.0-Signed-off-by: bence gabor kis kisbg@inf.u-szeged.hu
2020-07-17 15:42:51 +02:00