2630 Commits

Author SHA1 Message Date
Yonggang Luo
d2d30df420
Revise tools scripts to be python3 compatible on win32 (#4856)
We introduce setup_stdio function to setup stdout/stderr properly.
For python <-> python pipe, we always use 'utf8'/'ignore' encoding for not lost characters.
For tty <-> python, we using native encoding with xmlcharrefreplace to encode, to preserve maximal information.
For python <-> native program, we use naive encoding with 'ignore' to not cause error

update_exclude_list with binary mode so that on win32 would not generate \r\n

run-test-suite.py: Handling skiplist properly on win32

Fixes #4854

Fixes test262-harness.py complain cannot use a string pattern on a bytes-like object with running test262 with python3

For reading/writing to file, we use 'utf8' /'ignore' encoding for not lost characters.
For decoding from process stdout, using native encoding with decoding error ignored for not lost data.
Execute commands also ignore errors
Fixes #4853

Fixes running test262-esnext failed with installed python3.9 on win32 with space in path
Fixes #4852

support both / \ in --test262-test-list arg

On win32.
python tools/run-tests.py  --test262-es2015=update --test262-test-list=built-ins/decodeURI/
python tools/run-tests.py  --test262-es2015=update --test262-test-list=built-ins\decodeURI\
should be both valid,
currently only --test262-test-list=built-ins\decodeURI\ are valid.

Support snapshot-tests-skiplist.txt on win32 by use os.path.normpath

Guard run-tests.py with timer.

All run-tests.py are finished in 30 minutes in normal situation.
May change the timeout by command line option

Move Windows CI to github actions
Define TERM colors for win32 properly

flush stderr.write stdout.write

On CI, the stderr are redirect to stdout, and if we don't flush stderr and stdout,
The output from stderr/stdout would out of sync.

`Testing new Date(-8640000000000000) and fixes date for win32`
So that the CI can passed

if sys.version_info.major >= 3: remove, as we do not support python2 anymore

Fixes compiling warnings/errors for mingw/gcc

JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo luoyonggang@gmail.com
2024-12-17 10:41:12 +01:00
Yonggang Luo
f0a249dfd3
CMake update cmake_minimum_required (VERSION 3.10) (#5187)
JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo luoyonggang@gmail.com
2024-12-17 10:12:34 +01:00
Yonggang Luo
b4bc23078a
Improve the jerry port api documents. (#4977)
Notable changes:
  - Remove the comments in port impl, that's easily getting to in-consistence
  - Sync the jerryscript-port.h and 05.PORT-API.md
  - Fixes the invalid comment in port codes

JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo luoyonggang@gmail.com
2024-12-17 10:10:37 +01:00
Yonggang Luo
5480cc3973
Doxygen comment update and PREDEFINED in Doxyfile is properly defined (#5186)
JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo luoyonggang@gmail.com
2024-12-17 09:02:54 +01:00
László Langó
a746a1d29a
Update the API documentation (#5178)
- Minor fixes, typos, version numbers, etc.
 - Followup fix after "Merge Promise Guard with ESNEXT #4725"
 - Added documentation for the new implemented API functions

JerryScript-DCO-1.0-Signed-off-by: Laszlo Lango laszlo.lango@h-lab.eu
2024-12-12 20:39:48 +01:00
Yonggang Luo
8d44eed661
Fixes dead loop when abort called in Win32/CI (#5197)
Disable the debug popup on MSVC/win32 by introduce new jerry_port_init function

For not popup dialog when crash happend on MSVC/win32
Closed: #4463

JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo luoyonggang@gmail.com
2024-12-11 08:52:05 +01:00
László Langó
aa7861daf2
Fix the return type of 'jerry_string_substr'. (#5185)
Also added new unit test to test basic functionality of 'jerry_string_substr'.

JerryScript-DCO-1.0-Signed-off-by: Laszlo Lango laszlo.lango@h-lab.eu
2024-12-10 21:56:23 +01:00
Gergo Csizi
5f467a658b
Fix check-string.sh to check every generated strings (#5179)
The original implementation only checked lit-magic-strings.inc.h.
This patch adds checking for ecma-error-messages.inc.h and parser-error-messages.inc.h

This patch fixes #5172 issue.

JerryScript-DCO-1.0-Signed-off-by: Gergo Csizi gergocs@inf.u-szeged.hu
2024-11-27 13:56:51 +01:00
Gergo Csizi
ba8957697a
Fix Typedarray.slice fastpath when the content type is matching (#5177)
This patch fixes #4888.

The implementation is based on PR #4898, only resolved the conflicts and
applied requested changes.

Co-authored-by: Robert Fancsik robert.fancsik@h-lab.eu
JerryScript-DCO-1.0-Signed-off-by: Gergo Csizi gergocs@inf.u-szeged.hu
2024-11-26 14:27:24 +01:00
maciej m.
59649fc222
fix building without BIGINT (#5047)
* fix building without BIGINT

Co-authored-by: Maciej Musiał <xt1@o2.pl>
JerryScript-DCO-1.0-Signed-off-by: aksdfauytv rdkifk@jadamspam.pl
2024-11-26 11:01:34 +01:00
Gergo Csizi
7db6a9a372
Implement operations of atomics (#5166)
The following methods were implemented:
 - Atomics.compareExchange
 - Atomics.store

The implementation is based on PR #4956, only resolved the conflicts.

Co-authored-by: Csaba Repasi repasics@inf.u-szeged.hu
JerryScript-DCO-1.0-Signed-off-by: Gergo Csizi gergocs@inf.u-szeged.hu
2024-11-26 10:56:28 +01:00
Yonggang Luo
dfa9afbf6e
Introduce JERRY_ZSTR_ARG macro to avoid jerryx_print_string, jerryx_print_byte, jerry_port_print_byte, strlen (#4982)
Replace usage of jerryx_print_byte, jerryx_print_string with jerryx_print_buffer.

As we now have JERRY_ZSTR_ARG, so we can take advantage of it

With this, the jerry_port_print_byte port api won't need any more
this reduced the port api surface

JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo luoyonggang@gmail.com
2024-11-25 17:28:55 +01:00
LJ
95cc5e992a
Fix the private field crash for the Array object. (#5139)
Fixes 5097, 5100, 5138

Additional regression test cases added by: Robert Sipka <robert.sipka@h-lab.eu>

JerryScript-DCO-1.0-Signed-off-by: Baihe Jiang <baihe.jiang@outlook.com>
JerryScript-DCO-1.0-Signed-off-by: Lily Jiang bhjiang.whu@hotmail.com
2024-11-25 13:04:00 +01:00
Gergo Csizi
00d12c0265
Implement BigInt asIntN and asUintN methods (#5165)
The following methods were implemented:
- BigInt.asIntN
- BigInt.asUintN

Custom dispatcher also added to builtin_bigint.

The implementation is based on PR #4736, only applied the requested changes.

Co-authored-by: Daniel Batiz batizjob@gmail.com
JerryScript-DCO-1.0-Signed-off-by: Gergo Csizi gergocs@inf.u-szeged.hu
2024-11-22 09:33:08 +01:00
Robert Fancsik
a7e24fe89a
Const literal marker should be processed before group assignment marker (#4948)
This patch fixes #4925.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik robert.fancsik@h-lab.eu
2024-11-21 11:10:09 +01:00
Gergo Csizi
f54f2d3a7b
Implement optional chaining (#5164)
The work is based on PR #4843, only fixed some conflicts and cppcheck errors.

Co-authored-by: Robert Fancsik robert.fancsik@h-lab.eu
JerryScript-DCO-1.0-Signed-off-by: Gergo Csizi gergocs@inf.u-szeged.hu
2024-11-20 11:57:58 +01:00
Gergo Csizi
e9f08a7879
Put reference on executable object's this_binding to avoid unwanted f… (#5169)
…rees before exiting execution

This patch fixes #4870.

The implementation is based on PR #4966, only resolved the conflicts
and applied requested changes.

Co-authored-by: Martin Negyokru negyokru@inf.u-szeged.hu
JerryScript-DCO-1.0-Signed-off-by: Gergo Csizi gergocs@inf.u-szeged.hu
2024-11-19 14:52:33 +01:00
Gergo Csizi
348e6a470e
Accessors should be kept alive during their invocation (#5167)
This patch fixes #4900.

The implementation is based on PR #4943, only resolved the conflicts.

Co-authored-by: Robert Fancsik robert.fancsik@h-lab.eu
JerryScript-DCO-1.0-Signed-off-by: Gergo Csizi gergocs@inf.u-szeged.hu
2024-11-18 09:47:07 +01:00
batizdaniel
5f3428becb
Fix runtime error Date object (#4914)
This patch fixes #4704

JerryScript-DCO-1.0-Signed-off-by: Daniel Batiz daniel.batiz@h-lab.eu
2024-11-06 16:15:37 +01:00
kulcsaradam
de515316cf
Fix parsing of invalid asterix symbol after private field symbol (#5155)
Raise syntax error instead of crashing.

JerryScript-DCO-1.0-Signed-off-by: Ádám Kulcsár kuladam@inf.u-szeged.hu
2024-08-14 18:09:09 +02:00
Máté Tokodi
2dbb6f79ef
Fix parsing class body that includes stray semicolon after a static block (#5145)
JerryScript-DCO-1.0-Signed-off-by: Máté Tokodi mate.tokodi@szteszoftver.hu
2024-06-18 20:02:48 +02:00
Máté Tokodi
4e89e1828e
Fix parsing of invalid private class properties (#5144)
Raise syntax error instead of failing with an assert

JerryScript-DCO-1.0-Signed-off-by: Máté Tokodi mate.tokodi@szteszoftver.hu
2024-06-18 20:00:07 +02:00
Máté Tokodi
d7e21259fe
Fix arguments object in eval-ed functions in static class initializers (#5140)
JerryScript-DCO-1.0-Signed-off-by: Máté Tokodi mate.tokodi@szteszoftver.hu
2024-05-28 06:59:13 +02:00
Máté Tokodi
cefd391772
Fix rare crash caused by get method of proxy object (#5129)
This fixes #5101
In rare cases the proxy object could get used after
being incorrectly removed by the gc

Add stack checks to the start of all function calls

JerryScript-DCO-1.0-Signed-off-by: Máté Tokodi mate.tokodi@szteszoftver.hu
2024-03-13 12:08:41 +01:00
Máté Tokodi
bac7ee3acd
Fix gc of async destructuring assignments of strings (#5126)
This fixes #5089

When garbage collection is running on a paused async function that
includes destructuring assignments of strings, the string can be a
direct string, and not an object, which cannot be marked as visited, as
it does not have a visited flag.

JerryScript-DCO-1.0-Signed-off-by: Máté Tokodi mate.tokodi@szteszoftver.hu
2024-02-06 08:10:14 +01:00
Máté Tokodi
52debe8589
Fix arrow function parsing (#5093)
This fixes #5085

JerryScript-DCO-1.0-Signed-off-by: Máté Tokodi mate.tokodi@szteszoftver.hu
2024-02-01 00:34:37 +01:00
Máté Tokodi
3b876f7392
Update clang-format (#5112)
Bump minimum clang-format version to 15 (the previously used 10 is not
in the ubuntu-22.04 repo)

Reformat several files

Re-enable format and strings CI checkers

JerryScript-DCO-1.0-Signed-off-by: Máté Tokodi mate.tokodi@szteszoftver.hu
2023-12-11 23:21:52 +01:00
Máté Tokodi
ef4cb2bf74
Update cppcheck (#5108)
Re-enable cppcheck CI job

Update cppcheck suppression list:
    The new version of cppcheck raises warnings for many potential
    issues that are guarded against, so those warnings have been
    supressed.

Handle realloc failures:
    - jerry-ext/util/sources.c
    - jerry-port/common/jerry-port-io.c

Refactor test-snapshot: move each test to separate functions like some
others already were.

Rename `handler` variables inside `main` of `test-api.c` as they
shadowed the `handler` function in the same file.

JerryScript-DCO-1.0-Signed-off-by: Máté Tokodi mate.tokodi@szteszoftver.hu
2023-11-22 11:36:45 +01:00
Máté Tokodi
ff9ff8f36c
Update doxygen and fix documentation (#5106)
Update Doxyfile to version 1.9.1

Re-enable doxygen CI checker

Fix some regular comments that should have been doc comments

Document void return types for some inline functions explicitly

Move start of some doxygen groups so they are included always, and not left
out of certain ifdefs

Ignore some doxygen warnings:
    Member (function) is not documented in headers
    Documented empty return type in headers
    Argument has multiple @param documentation sections

JerryScript-DCO-1.0-Signed-off-by: Máté Tokodi mate.tokodi@szteszoftver.hu
2023-11-15 09:49:04 +01:00
Akos Kiss
05dbbd134c
Fix line info guard comment (#5049)
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2023-03-27 11:53:34 +02:00
Zoltan Herczeg
6fe763f191
Allow redefining global variables as imports (#5023)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2022-09-09 16:36:08 +02:00
Damiano Mazzella
b143b050cc
Replace global inclusions with local ones (#4991)
Resolve compiler errors created by amalgam.py tool.
2022-08-22 16:06:21 +02:00
Zoltan Herczeg
368641043f
Mark generator as running during yield* (#5014)
Fixes #5013

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2022-08-08 17:36:59 +02:00
Yonggang Luo
c5bc3786cf
Remove abandoned es5.1 profile from API reference (#4972)
JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo luoyonggang@gmail.com
2022-02-03 11:35:42 +01:00
Szilagyi Adam
4924f9fd31
Remove ES_NEXT macro (#4915)
- remove all '#JERRY_ESNEXT' macro
- remove 5.1 build profile, update test runner accordingly (Note: all builtins are turn on by default)
- move tests from tests/jerry/esnext into tests/jerry, concatenate files with same names
- add skiplist to some snapshot tests that were supported only in 5.1
- fix doxygen issues that were hidden before (bc. of es.next macro)

Co-authored-by: Martin Negyokru negyokru@inf.u-szeged.hu
JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2022-01-31 16:46:00 +01:00
Dániel Bátyai
76403606d0
Fix logging related issues (#4971)
PR #4907 moved the log level into the engine context, however this caused
issues with logging without the engine being initialized. This commit
reverts the log level to be a static variable.

This commit also implements missing format specifiers for jerry_log.

JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
2022-01-21 10:02:35 +01:00
batizdaniel
0ef509458e
Fix runtime error: left shift of negative value (#4957)
This patch fixes #4701

JerryScript-DCO-1.0-Signed-off-by: Daniel Batiz daniel.batiz@h-lab.eu
2022-01-20 14:00:47 +01:00
Dániel Bátyai
ac1c48eeff
Update jerry-port and jerry-ext (#4907)
Notable changes:
  - Updated and the port API interface, new functions have been added
    and some have been changed. The port library is now cleaned up to
    not have any dependency on jerry-core, as it should be. The port library
    is now strictly a collection of functions that implement
    embedding/platform specific behavior.
  - The default port implementation has been split for windows and unix.
    Implemented port functions have been categorized and reorganized,
    and marked with attribute((weak)) for better reusability.
  - External context allocation has been moved to the port API instead
    of a core API callback. The iterface has also been extended with a
    function to free the allocated context. When external context is
    enabled, jerry_init now automatically calls the port implementation
    to allocate the context and jerry_cleanup automatically calls the port
    to free the context.
  - jerry_port_log has been changed to no longer require formatting to
    be implemented by the port. The reason beind this is that it was vague what
    format specifiers were used by the engine, and in what manner. The port
    function now takes a zero-terminated string, and should only implement
    how the string should be logged.
  - Logging and log message formatting is now handled by the core jerry library
    where it can be implemented as necessary. Logging can be done through a new
    core API function, which uses the port to output the final log message.
  - Log level has been moved into jerry-core, and an API function has
    been added to set the log level. It should be the library that
    filters log messages based on the requested log level, instead of
    logging everything and requiring the user to do so.
  - Module resolving logic has been moved into jerry-core. There's no
    reason to have it in the port library and requiring embedders to
    duplicate the code. It also added an unnecessary dependency on
    jerry-core to the port. Platform specific behavior is still used through
    the port API, like resolving module specifiers, and reading source file
    contents. If necessary, the resolving logic can still be overridden as
    previously.
  - The jerry-ext library has also been cleaned up, and many utility
    functions have been added that previously were implemented in
    jerry-main. This allows easier reusability for some common operations,
    like printing unhandled exceptions or providing a repl console.
  - Debugger interaction with logged/printed messages has been fixed, so
    that it's no longer the port implementations responsibility to send
    the output to the debugger, as the port should have no notion of what a
    debugger is.  The printing and logging functions will now pass the
    result message to the debugger, if connected.
  - Cleaned up TZA handling in the date port implementation, and simplified
    the API function prototype.
  - Moved property access helper functions that use ASCII strings as
    keys from jerry-ext to the core API.

JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
2022-01-20 13:53:47 +01:00
Robert Fancsik
79fd540ec9
Fix duplicated private identifier lookup (#4947)
This patch fixes #4921.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik robert.fancsik@h-lab.eu
2022-01-18 13:22:45 +01:00
Robert Fancsik
85c798705a
Add missing toObject conversion for PrivateSet operation (#4953)
This patch fixes #4936.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik robert.fancsik@h-lab.eu
2022-01-18 13:16:02 +01:00
mnegyokru
c68f6e79e1
Add stack-overflow check to 'lexer_construct_function_object' (#4965)
This patch fixes #4887.

JerryScript-DCO-1.0-Signed-off-by: Martin Negyokru negyokru@inf.u-szeged.hu
2022-01-14 11:02:50 +01:00
mnegyokru
57547d1261
Ban setting 'Object.prototype.__proto__' as Proxy to prevent circular referencing (#4961)
in prototype chain.

This patch fixes #4941

JerryScript-DCO-1.0-Signed-off-by: Martin Negyokru negyokru@inf.u-szeged.hu
2022-01-14 11:02:19 +01:00
Robert Fancsik
e9da834385
Fix async identifier parsing in class field position (#4949)
This patch fixes #4927

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik robert.fancsik@h-lab.eu
2022-01-14 10:16:23 +01:00
Robert Fancsik
47d025c74f
Check rest initializer existence after pattern finalization (#4950)
Since the scanner info is not present for invalid destructuring patterns we can only ensure the existence of the rest element after the pattern is finalized.
This patch fixes #4928.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik robert.fancsik@h-lab.eu
2022-01-14 10:15:48 +01:00
Robert Fancsik
799583e5c8
Private identifier resolving should always construct new literal object (#4951)
This patch fixes #4930.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik robert.fancsik@h-lab.eu
2022-01-14 10:14:04 +01:00
Robert Fancsik
2a3782141c
Fix fast array objects cannot hold private properties (#4952)
This patch fixes #4934.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik robert.fancsik@h-lab.eu
2022-01-14 10:13:03 +01:00
Robert Fancsik
8fa7819c1f
Fix memory leak in AtomicModifyWrite (#4944)
This patch fixes #4894.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik robert.fancsik@h-lab.eu
2022-01-14 10:05:39 +01:00
Robert Fancsik
d681f201c2
Fix invalid assertion CESU8-UTF8 buffer copy (#4946)
The UTF8 buffer size can be smaller then the CESU8 string's size so the UTF8 output is may truncated. Therefore we cannot ensure that the CESU8 buffer is read until the end.
This patch fixes #4920.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik robert.fancsik@h-lab.eu
2022-01-14 10:03:47 +01:00
mnegyokru
85bad33fbf
Fix scanning bracketed expressions (#4964)
Scan 'async' literal with different depth of brackets

This patch fixes #4924.
This patch fixes #4748.

JerryScript-DCO-1.0-Signed-off-by: Martin Negyokru negyokru@inf.u-szeged.hu
2022-01-13 13:48:34 +01:00
Robert Fancsik
0aa182c378
Date.prototype.setYear should invalidate cached tza (#4955)
This patch fixes #4939 and fixes #4940.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik robert.fancsik@h-lab.eu
2022-01-10 17:35:49 +01:00