429 Commits

Author SHA1 Message Date
Gergo Csizi
c509a06669
Added jerry-ext amalgamation (#5184)
Added option to enable jerry-ext amalgamation

The implementation is based on PR #4992. Only applied the requested changes
and rebase to master.

Co-authored-by: Damiano Mazzella damianomazzella@gmail.com
JerryScript-DCO-1.0-Signed-off-by: Gergo Csizi gergocs@inf.u-szeged.hu
2024-12-03 08:33:28 +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
Csaba Osztrogonác
e4017f0b3a
Use regular expressions to parse the YAML headers of the tests (#4910)
instead of the imported thirdparty YAML parser.

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác csaba.osztrogonac@h-lab.eu
2024-11-25 14:00:21 +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
winsoft666
4a39946ef6
Add build argument: --arch (#5147)
Signed-off-by: winsoft666 <mioktiar@gmail.com>
2024-11-04 15:28:36 +01:00
winsoft666
f5d3d9004a
Add build argument: --static-crt (#5148)
Signed-off-by: winsoft666 <mioktiar@gmail.com>
2024-11-04 15:27:57 +01: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
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
Máté Tokodi
bc408b159b
Modernize python and update pylint (#5096)
Update code to conform to the newer version of pylint available in
ubuntu-22.04, with few exceptions:
    - disabled `import-outside-toplevel` for `main()` in
      `jerry_client.py`
    - disabled `consider-using-with` for the logfile of `TestSuite` in
      `test262-harness.py` as using `with` is not practical in that case

Update test262-harness.py to use argparse instead of the now deprecated
optparse

Rename variables in jerry_client_main.py that redefined python builtins
or shadowed variables from an outer scope

Update python files to use f-stirngs

Add minimum python versions (3.6 and 3.8) to the CI jobs: without it the
default python version did not support the `with` statement for
`subprocess.Popen` used in `build.py` on macos, or in some cases f-stirngs

Remove `from __future__` imports that are no-ops in python 3

Remove shebang from non executable files

Re-enable most pylint checkers, except `missing-docstring`

JerryScript-DCO-1.0-Signed-off-by: Máté Tokodi mate.tokodi@szteszoftver.hu
2023-10-25 17:32:14 +02:00
Máté Tokodi
a588e49661
Update tests and CI to python3 (#5095)
Update debugger and test262 tests to python3
Disable CI jobs that need ubuntu-18.04 (EOL) until they are updated

JerryScript-DCO-1.0-Signed-off-by: Máté Tokodi matet@inf.u-szeged.hu
2023-09-20 15:38:30 +02: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
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
Csaba Osztrogonác
dfbd89d94f
Update test262 hash to the latest master (#4959)
JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác csaba.osztrogonac@h-lab.eu
2022-01-14 11:04:52 +01:00
Csaba Osztrogonác
a63e1d294d
Drop legacy test262-ES2015 testing support (#4908)
ES2015 features are already covered by ES.Next tests,
there is no need to run duplicated and outdated tests.

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác csaba.osztrogonac@h-lab.eu
2021-12-23 11:31:56 +01:00
Szilagyi Adam
4cbc77d709
Update detached arraybuffer handling (#4840)
- Fix isValidIntegerIndex usage in IntegerIndexed objects, [[Get]], [[Set]], [[DefineOwnProperty]] internal methods.
- The test262 revision is updated to the latest master hash.
- The PR is not separated into individual PRs since the standard change couldn't be tested without the new test262 revision.

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
2021-12-10 13:09:16 +01:00
Yonggang Luo
d5f048e961
Add FEATURE_INIT_FINI support on Windows. (#4859)
JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo luoyonggang@gmail.com
2021-12-10 13:01:24 +01:00
Dániel Bátyai
9860d66a56
Rework the public API (#4829)
Related to #4186.

Some notable changes:
  - The term 'Error' now strictly refers to native Error objects defined in
    the ECMA standard, which are ordinary objects. All other uses of
    'error' or 'error reference' where the term refers to a thrown value is
    now called 'exception'.

  - Simplified the naming scheme of many String API functions. These functions
    will now also take an 'encoding' argument to specify the desired
    encoding in which to operate.

  - Removed the substring-copy-to-buffer functions. These functions
    behaved awkwardly, as they use character index to specify the
    start/end positions, and were mostly used incorrectly with byte
    offsets instead. The functionality can still be replicated with
    other functions if necessary.

  - String-to-buffer functions will no longer fail if the buffer is not
    sufficiently large, the string will instead be cropped.

  - Fixed the usage of the '_sz' prefix in many API functions. The term
    'sz' means zero-terminated string in hungarian notation, this was
    used incorrectly in many cases.

  - Renamed most of the public API functions to have shorter, more on-point
    names, rather than the often too long descriptive names. Functions are now
    also grouped by the type of value they operate on, where this makes
    sense.

JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
2021-12-06 10:20:09 +01:00
Csaba Repasi
841e21a970
Generate parser error messages (#4836)
Support parser error messages generation in tools/gen-strings.py.

JerryScript-DCO-1.0-Signed-off-by: Csaba Repasi repasics@inf.u-szeged.hu
2021-11-26 10:26:46 +01:00
Csaba Repasi
271d9b2463
Outsource magic error messages (#4821)
Modify tools/gen-magic-strings.py to generate error messages.

JerryScript-DCO-1.0-Signed-off-by: Csaba Repasi repasics@inf.u-szeged.hu
2021-11-25 14:06:40 +01:00
Robert Fancsik
badfdf4dba
Replace vera++ with clang-format (#4518)
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik robert.fancsik@h-lab.eu
2021-11-05 14:15:47 +01:00
Csaba Osztrogonác
3c742bef57
Test262 runner shouldn't change newline characters (#4805)
It fixes the following test on Windows:
built-ins/Function/prototype/toString/line-terminator-normalisation-LF.js

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác csaba.osztrogonac@h-lab.eu
2021-10-28 13:56:52 +02:00
Gergo Csizi
fe3a5c08b2
Fix magic-string generation (#4751)
In some cases the magic-string generator creates conditions like: A || !A . These conditions can be simplified.

JerryScript-DCO-1.0-Signed-off-by: Gergo Csizi csgergo92@gmail.com
2021-10-15 19:09:04 +02:00
Zoltan Herczeg
6649940ea6
Implement function.toString operation (#4752)
May increase the memory consumtpion heavily.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-08-31 13:37:25 +02:00
Zoltan Herczeg
444806d78a
Implement vm_throw callback (#4726)
Slightly improve the description of vm_exec_stop callback.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-08-10 15:50:26 +02:00
Jiawen Geng
7be339ad61
Fix typo in property hashmap define (#4664)
Fixes jerryscript-project/jerryscript#4648

JerryScript-DCO-1.0-Signed-off-by: Jiawen Geng technicalcute@gmail.com
2021-05-26 12:26:11 +02:00
Zoltan Herczeg
874a6a49d5
Extract type defintions from jerryscript-core.h into jerryscript-types.h (#4634)
The function declarations in jerryscript-core.h should not be visible
internally, only the type declarations in jerryscript-types.h

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-03-24 05:51:59 +01:00
Zoltan Herczeg
01e0388d77
Add notification callback for Promise operations (#4595)
JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
2021-02-18 11:29:52 +01:00
kisbg
a2f22cf888
Update jerry debugger test-runner (#4597)
Now the test-runner will check the jerry (server) return code.

Fixed do_eval_at TC crash if jerry was build with --debug option.

JerryScript-DCO-1.0-Signed-off-by: bence gabor kis kisbg@inf.u-szeged.hu
2021-02-16 12:48:40 +01:00
Yonggang Luo
3df7998084
--engine parameter should be a file (#4585)
The --test262-object option should be passed independently,
otherwise os.path.dirname(args.engine) in tools\runners\run-test-suite-test262.py
makes no sense

JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo luoyonggang@gmail.com
2021-02-09 19:02:26 +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
Yonggang Luo
e01c2549d7
Add --build-debug options for run-tests.py script. (#4456)
This makes have option to running test262-es2015 and test262-esnext with debug version
of jerryscript.
On OSX, the $RUNNER -q --jerry-tests are in dead loop, disable it first.

Increase TEST262_CASE_TIMEOUT to 180, so that --build-debug can pass the tests
without timeout
An side effect of this are
```
  <test id="built-ins/decodeURIComponent/S15.1.3.2_A2.5_T1.js"><reason></reason></test>
  <test id="built-ins/decodeURI/S15.1.3.1_A2.5_T1.js"><reason></reason></test>
```
passed

JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo luoyonggang@gmail.com
2021-02-04 18:25:14 +01:00
Yonggang Luo
dd698f8d83
logging the crash properly when running test262-harness.py (#4472)
When running tests262 cases, the jerry program may exit with error code other than 1,
that's means a crash or JERRY_ASSERT triggered and should be resolved, so dump the test
name and stderr/stdout for tracking those crash in CI.

related issue: #4463

JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo luoyonggang@gmail.com
2021-02-04 13:28:54 +01:00
Yonggang Luo
4bb9e2b878
Move get_platform_cmd_prefix into util.py (#4495)
get_platform_cmd_prefix implement multiple times in multiple function.
Also add function get_python_cmd_prefix, call to python script always
add python command so that on windows, the python script doesn't have
executable permission also can be called.

JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo luoyonggang@gmail.com
2021-02-04 13:23:57 +01:00
Yonggang Luo
9dbb594170
Make install_jerry work with MinGW (#4517)
On windows, the generator can be Visual Studio or Ninja, when targeting mingw,
the generator can be Ninja or Makefile, they both use 'install' instead MSVC 'INSTALL',
so check the solution file for MSVC

JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo luoyonggang@gmail.com
2021-02-04 13:15:07 +01:00
Csaba Osztrogonác
e081cbc2f0
Remove a wrong test not to slow down test262-es2015 (#4542)
Since ES2018 iterator's next method is called once during the prologue of iteration,
rather than during each step. The test is incorrect and stuck in an infinite loop.
https://github.com/tc39/test262/pull/1248 fixed the test and it passes on test262-esnext.

Removing test/language/statements/for-of/iterator-next-reference.js from test262-es2015
is necessary, because it won't pass ever and only slow down testing.

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác csaba.osztrogonac@h-lab.eu
2021-01-26 18:29:56 +01:00
Csaba Osztrogonác
9900cacb15
Fix test262 harness to handle async negative tests properly (#4526)
JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác csaba.osztrogonac@h-lab.eu
2021-01-22 15:09:16 +01:00
Yonggang Luo
d97540e883
Add expm1 test case to cover the k==1024 case (#4508)
-7.095e+02 won't trigger the  k==1024 case, so we didn't add it into the test list

JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo luoyonggang@gmail.com
2021-01-18 23:23:57 +01:00
Dániel Bátyai
0fec9135ec
Rework module parsing and execution (#4462)
This patch disables automatic detection of module code, and instead
requires the user to explicitly specify whether to parse a source
as a module or as a script.

To achieve this the jerry_parse API function now takes a new option
which signals that the source should be parsed as a module.

JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai daniel.batyai@h-lab.eu
2021-01-18 15:33:43 +01:00
Akos Kiss
ef8a6a9f39
Get isfinite, isinf, and isnan right in jerry-math (#4497)
- `finite` is not C99 but a BSD fp classification function, so it
  is removed.
- The standard specifies that `isnan` is a macro (just like
  `isfinite` and `isinf`), so the `isnan` function implementation
  is removed.
- `isfinite` incorrectly classified NAN as finite, which is fixed.
- `isinf` returned 1 for negative infinity. This is not a bug
  according to the standard, but is not aligned with recent glibc,
  which returns -1. This is changed to simplify testing.
- Added test cases for `isfinite` and `isinf` to the unit test of
  jerry-math.
- Added a new pass to unittests to ensure that jerry-math is
  tested.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2021-01-18 15:07:25 +01:00
Yonggang Luo
f2e9062cfc
Fixes timezone get on win32 (#4494)
JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo luoyonggang@gmail.com
2021-01-17 14:13:19 +01:00
Yonggang Luo
2bad20abf8
Fix the test262 timeout on Windows (#4378)
Use the platform independent python threading.Timer instead of the unix only timeout tool.

The timeout error are like the following things:

```
C:\Users\lygstate>timeout -version
Error: The specified timeout (/T) value is invalid. The valid range is from -1 to 99999 seconds.

C:\Users\lygstate>timeout 0 python
Error: invalid syntax. The default option does not allow more than '1' times.
Type "TIMEOUT /?" to learn how to use it.
```

JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo luoyonggang@gmail.com
2021-01-16 21:41:28 +01:00
Akos Kiss
fdaacde667
Officially introduce amalgamated builds (#4416)
Remove redundancy between all-in-one and all-in-one-source builds
by keeping only the second, and adopt the more established term
"amalgamated" build for it. This change includes the following:

- Replace `ENABLE_ALL_IN_ONE` and `ENABLE_ALL_IN_ONE_SOURCE` cmake
  options with `ENABLE_AMALGAM` top-level option.
- Replace `--all-in-one` option of `build.py` helper with
  `--amalgam`.
- Merge the `srcmerger.py` and `srcgenerator.py` tool scripts into
  `amalgam.py` (with improvements).
- Update documentation.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2021-01-11 13:07:40 +01:00
Akos Kiss
4350401b5b
Add --build-type to tools/build.py (#4409)
This allows users to specify a build type other than `MinSizeRel`
or `Debug` for `tools/build.py`. (Build type was already freely
configurable by invoking cmake directly with a custom
`CMAKE_BUILD_TYPE` option.)

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2021-01-08 16:01:06 +01:00
Robert Fancsik
0e829cc41a
Enable generating compile_commands.json (#4417)
This feature is useful for intellisense users.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
2021-01-08 16:00:17 +01:00
Akos Kiss
d161e2d9ed
Disable libjerry-math by default (#4428)
Normally, it is more usual and safe to use a toolchain's native
math library. Especially, if multiple components of a project use
math functions, in which case all components should be linked
against the same libm.

The libjerry-math can be used, of course, but as it needs extra
care and consideration, it should be opt-in.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2021-01-08 11:37:46 +01:00
Akos Kiss
257814d063
Rename jerry-libm to jerry-math (#4410)
That "libm" in the name of the library resulted in awkward naming
on *nix systems (`libjerry-libm.*`, "lib" occurring twice). And the
name of the corresponding header is `math.h` anyway.

Note that this is a breaking change in some sense. The commit
contains no API change, but the build system does change for users
of the math library.

JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
2021-01-05 12:50:07 +01:00
Yonggang Luo
2faafa4cfc
Make test262-harness.py Python 3-compatible (#4381)
Less operator is not supported between int and None in Python 3. Fix
that Python 2 legacy in test262-harness.py.

JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo luoyonggang@gmail.com
2020-12-30 12:55:17 +01:00
kisbg
7cb9f808f7
Add support test262 $262 global object support (#4329)
Few test-cases in test262 uses a $262 object to run a few method (for example detachedArrayBuffer)

JerryScript-DCO-1.0-Signed-off-by: bence gabor kis kisbg@inf.u-szeged.hu
2020-12-07 17:06:15 +01:00